How to Execute a Modifier plugin in Expression priority
-
Hi,
I have created a object modifier plugin and I want it to work once in priority Expression 10, and then again in Generator 1. How can I make it work as expected?
In the code, AddToExecution() and Execute() do not seem to work (the documentation states that switching priorities requires calling these two functions).import c4d from c4d import plugins, bitmaps PLUGIN_ID = 1000001 class S_Temp(plugins.ObjectData): def Execute(self, op, doc, bt, priority, flags) -> int: print("Execute") return c4d.EXECUTIONRESULT_OK def AddToExecution(self, op, list) -> bool: print("AddToExecution") return True def Init(self, node, isCloneInit: bool) -> bool: self.InitAttr(node, c4d.BaseList2D, c4d.S_TEMP_POSEDTARGETS) self.InitAttr(node, c4d.BaseList2D, c4d.S_TEMP_POSEDSOURCEADD) self.InitAttr(node, c4d.PriorityData, c4d.S_TEMP_PRIORITY) if not isCloneInit: pridata = c4d.PriorityData() pridata.SetPriorityValue(c4d.PRIORITYVALUE_MODE, c4d.CYCLE_EXPRESSION) pridata.SetPriorityValue(c4d.PRIORITYVALUE_PRIORITY, 10) node[c4d.S_TEMP_PRIORITY] = pridata return True def ModifyObject(self, mod, doc, op, op_mg, mod_mg, lod, flags, thread): allp = [pos + c4d.Vector(0,100,0) for pos in op.GetAllPoints()] op.SetAllPoints(allp) op.Message(c4d.MSG_UPDATE) return True if __name__ == '__main__': plugins.RegisterObjectPlugin(id=PLUGIN_ID, str="S_Temp", g=S_Temp, description="stemp", info=c4d.OBJECT_MODIFIER, icon=None)
Here is the file of this plugin --> s_Temp.zip
Thanks for any help!