PDA

View Full Version : Modeler DELETE command error



clintonman
11-17-2013, 10:36 PM
The following code runs in Modeler 11.5.1 but gives an error in 11.6 final release (it worked in the betas)


Traceback (most recent call last):
File "C:\Program Files\NewTek\LightWave11.6\support\plugins\scripts \Python\Modeler\CommandSequence\deleteTest.py", line 50, in process
result = mod_command.execute(mod_command.data, thecommand, None, lwsdk.OPSEL_USER)
File "lwsdk\pcore.py", line 15820, in execute
RuntimeError

At this point I think it's a Python bug in 11.6
Any ideas?


#! /usr/bin/env python
# -*- Mode: Python -*-
# -*- coding: ascii -*-

"""
This is a LightWave Command Sequence plug-in (Modeler) that
tests generic things
"""

import sys
import lwsdk
import os
import gzip
import struct
import math
#import gc


__author__ = "Clinton Reese"
__date__ = "October 25 2013"
__copyright__ = "Clinton's 3D Creations"
__version__ = "1.5"
__maintainer__ = "Clinton Reese"
__email__ = "[email protected]"
__status__ = "Example"
__lwver__ = "11.5"




class generic_test(lwsdk.ICommandSequence):
def __init__(self, context):
super(generic_test, self).__init__()
self.surface_funcs = lwsdk.LWSurfaceFuncs()

# LWCommandSequence -------------------------------------------
def process(self, mod_command):
#create a surface by making a ball
#some surface needs to exist before creating new ones
#surface will be used in meshes
self._surface = self.surface_funcs.first()
if not self._surface:
cs_options = lwsdk.marshall_dynavalues(([1.0, 1.0, 1.0], 5, 5))
thecommand = mod_command.lookup(mod_command.data, "MAKEBALL")
result, dyna_value = mod_command.execute(mod_command.data, thecommand, cs_options, lwsdk.OPSEL_USER)
self._surface = self.surface_funcs.first()

#delete material source but keep material active
thecommand = mod_command.lookup(mod_command.data, "DELETE")
result = mod_command.execute(mod_command.data, thecommand, None, lwsdk.OPSEL_USER)


return lwsdk.AFUNC_OK

ServerTagInfo = [
( "Python Generic Test Modeler", lwsdk.SRVTAG_USERNAME | lwsdk.LANGID_USENGLISH ),
( "Generic Test Modeler", lwsdk.SRVTAG_BUTTONNAME | lwsdk.LANGID_USENGLISH ),
( "Utilities/Python", lwsdk.SRVTAG_MENU | lwsdk.LANGID_USENGLISH )
]

ServerRecord = { lwsdk.CommandSequenceFactory("LW_PyGenericTestModeler", generic_test) : ServerTagInfo }

oliverhotz
11-17-2013, 11:09 PM
no bug.. just change:

(line 50): result = mod_command.execute(mod_command.data, thecommand, None, lwsdk.OPSEL_USER)

to

result = mod_command.execute(mod_command.data, thecommand, "", lwsdk.OPSEL_USER)

best,

Oliver

clintonman
11-18-2013, 08:56 AM
Thanks, Oliver, that did the trick. :)