View Full Version : LWPy 11.6.2 bug

03-10-2014, 04:43 PM
I found silly bug in new version. Probably it's exist in all 11.6.x versions (didn't tested).
Here is simple test example and picture with result in different versions.

The meaning of the bug:
Inside plugin instance I create interface and register callback for a button. It seems like LWPy doesn't register callback properly (or put it into another scope), because inside callback I lose all objects that I created before, they are just 'None'. I tried to call globals(), it's still contains valid object names, but almost all of them have type of None.

import os
import sys
import lwsdk

__author__ = "User"
__copyright__ = "Copyright (C) 2014"
__version__ = "1.0"
__maintainer__ = "User"
__email__ = "[email protected]"
__status__ = "Beta"
__lwver__ = "11"

class FooGlobal(object):
def __init__(self):
self.message = 'Test message blah, blah'

class FooPlugin(lwsdk.IGeneric):
def __init__(self, context):
super(FooPlugin, self).__init__()
self.win = None
self.button = None

def process(self, ga):
return lwsdk.AFUNC_OK

def onButtonPressed(self, ctl, data):
lwsdk.LWMessageFuncs().yesNo('Message', g_Foo.message, '')

def inter_ui(self):
ui = lwsdk.LWPanels()
self.win = ui.create("Foo Plugin")

self.button = self.win.button_ctl('press me')

if self.win.open(lwsdk.PANF_NOBUTT) == 0:
return lwsdk.AFUNC_OK

g_Foo = FooGlobal()

ServerTagInfo = [
( "FooPlugin", lwsdk.SRVTAG_USERNAME | lwsdk.LANGID_USENGLISH ),
( "FooPlugin", lwsdk.SRVTAG_BUTTONNAME | lwsdk.LANGID_USENGLISH ),
( "Utilities/Python", lwsdk.SRVTAG_MENU | lwsdk.LANGID_USENGLISH )

ServerRecord = { lwsdk.GenericFactory("FooPlugin", FooPlugin) : ServerTagInfo }


It would be nice if somebody will tell to developers about it. Thanks.

03-12-2014, 03:12 AM
Hey Styler,

I know it's easier to post here and often important to check with others and confirm first, but would you mind posting a bug report directly yourself here:


You don't need to have an account to do it - just click the "New Case" link, select "LightWave 3D bugs" and "Scripting Systems" from the drop downs, and enter your bug info (all the better if you attach a stripped down bit of code that is commented that demonstrates it) and submit it directly to the dev team.

I've done this twice recently, and both times been very impressed with how fast the dev team got back to me, and also their email reports to me they fixed my issues which will be in the next build. I don't think they have time to read forums and a well constructed report there seems to get traction quickly. Probably the best way to get things done rather than put it here hoping it floats upward.

Please don't take this as anything other than me sharing my success getting things fixed with it rather than here, hoping it helps you and improves LW as they fix things more quickly as they become aware of issues directly. :)

03-12-2014, 06:07 AM
Thank you man ;). I submitted the bug.

09-26-2014, 04:06 PM
In LWSDK button callback have prototype:

typedef void (*LWCtlEventHook)(LWControlID, void *);

I would expect that Python have similar.