Object Replacement Class

Note

These interface classes are not intended for direct usage; rather they should be inherited by your own subclass. (See Anatomy of a LightWave Python Plug-in)

Handler

class lwsdk.IObjReplacement(self)

Bases: lwsdk.lwsdk.IHandlerFuncs, lwsdk.lwsdk.IInterfaceFuncs, lwsdk.lwsdk.IGizmoFuncs, lwsdk.lwsdk.IItemFuncs

Proxy of C++ PCore::IObjReplacement class

 evaluate(LWObjReplacementAccess arg0)

This is where the object replacement happens. The LWObjReplacementAccess instance (described below) passed to this function contains information about the currently loaded object and the evaluation time. You compare these and provide a new filename if a different object should be loaded. If the currently loaded geometry can be used for the new frame and time, set the new filename to None.

Access

class lwsdk.LWObjReplacementAccess(self, LWObjReplacementAccess source_)

Bases: object

Proxy of C++ PCore::LWObjReplacementAccess class

 curFilename → char

The filename of the currently loaded object file. This will be None if the LWObjReplacementAccess::curType is lwsdk.LWOBJREP_NONE.

 curFrame → LWFrame

The frame number at which the currently loaded object file was most recently evaluated.

 curTime → LWTime

The time at which the currently loaded object file was most recently evaluated.

 curType → int

This describes the current geometry and the type needed for the new time. An object replacement handler might ignore the time values and only perform replacements when the types differ. The type can be one of the following:

lwsdk.LWOBJREP_NONE if the current geometry for the object is a Null object. (This value will not appear in LWObjReplacementAccess::newType.)

lwsdk.LWOBJREP_PREVIEW if the object will be used during previewing and user interaction with the interface.

lwsdk.LWOBJREP_RENDER if the object will be used during rendering.

 editMesh(LWModCommand modeling_command) → int

!! NOT DOCUMENTED !!

 force → int

Set this to 1 to force object replacement even if filename or file contents have not changed.

 newFilename → char

If you want to replace the currently loaded object file, set this to the name of a different file. Set this to None if the object file shouldn't be changed. The memory that holds this string must persist after the evaluation function returns.

 newFrame → LWFrame

The evaluation frame. If you provide a new filename, this is the frame at which that object file will be loaded. Because of network rendering, the new frame may not follow the curFrame values sequentially.

 newTime → LWTime

The evaluation time. If you provide a new filename, this is the time at which that object file will be loaded. Because of network rendering, the new time may not follow the curTime values sequentially.

 newType → int

This describes the type needed for the new time. See LWObjReplacementAccess::curType.

 objectID → LWItemID

Item ID of the object.

Factory

class lwsdk.ObjReplacementFactory(name, klass)

Bases: lwsdk.lwsdk.IObjReplacementFactory

Default Python Factory for IObjReplacement

 create(context)
 destroy(instance)

Example

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
class frame_timer(lwsdk.IObjReplacement):
    def __init__(self, context):
        super(frame_timer, self).__init__()

        self._itemid = context
        self._name = lwsdk.LWItemInfo().name(self._itemid)
[...]
    # LWObjReplacement ------------------------------------
    def evaluate(self, ra):
        global object_path

        if len(object_path) == 0:
            return
[...]
ServerRecord = { lwsdk.ObjReplacementFactory("LW_PyFrameTimer", frame_timer) : ServerTagInfo }

Table Of Contents

Previous topic

Shader Class

Next topic

Displacement Class

This Page