Page 1 of 1

xAgeSDLBoolRespond confusion (bug?)

PostPosted: Thu Jul 25, 2013 9:40 am
by tachzusamm
xAgeSDLBoolRespond class definition:

Code: Select all
class xAgeSDLBoolRespond(ptResponder):
    """Runs a given responder based on the value of an SDL boolean"""

    def __init__(self):
        ptResponder.__init__(self)
[..]


Now, D'Lanor mentioned that ptResponder when it initializes sets self.sceneobject to None.
D'Lanor wrote:ptResponder is derived from ptModifier. The only difference is that ptResponder when it initializes sets self.sceneobject to None. This is only relevant for the BuiltIn prp file. Anywhere else pythonfile mods are attached to scene objects. So in effect it makes no difference which one you use.

( viewtopic.php?p=48943#p48943 )

But self.sceneobject is used in the code, for example here:
Code: Select all
        ageSDL = PtGetAgeSDL()
        if not ageSDL:
            PtDebugPrint("xAgeSDLBoolRespond._Initialize():\tAgeSDL is None. Initing %s to its default" % self.sceneobject.getName())
            self._Execute(defaultValue.value, initFastFwd.value)
            return


So, wouldn't this cause PtDebugPrint to fail writing the sceneobject name?

Not sure if this is a bug and the class definition should read
Code: Select all
class xAgeSDLBoolRespond(ptModifier):
    """Runs a given responder based on the value of an SDL boolean"""

    def __init__(self):
        ptModifier.__init__(self)
[..]


or am I getting something wrong here?

Re: xAgeSDLBoolRespond confusion (bug?)

PostPosted: Thu Jul 25, 2013 12:11 pm
by Tsar Hoikas
self.sceneobject is set to the plSceneObject target of any ptResponder by the C++ code. It's the same way the ptAttributes get their values ;)

I used to be savvy on the exact difference between the two base classes, but I have forgotten. When I have some time, I'll rifle through the engine code and try to figure it out :geek: