Apologies if this has been answered before, but I could not find it by searching.
my plugin makes a null follow the matrix of another object. problem is that because of priorities unless the plugin object is after the "target" it is always one frame behind ( or it snaps on position when you refresh the viewport)
my plugin is based on ObjectData, and is a Generator, not a tag, so how do I go about changing the priority so that the code only runs after the target's matrix has been calculated?
i'd much appreciate a "dummies" explanation, as I am still only dipping my toes into programming and plugin dev
Hi @Eduardo-Oliveira first of all welcome on the PluginCafe community.
I think @zipit already provided you some correct answers or at least point you that this workflow is kind of strange for a Cinema 4D user since normally the object by itself doesn't really set its own position, but it's up to a tag (constraint Tag) to define the object position to another one.
But in case you really want to do it, doing it in the Execute method of your ObjectData is fine.
def AddToExecution(self, op, list):
list.Add(op, c4d.EXECUTIONPRIORITY_GENERATOR, c4d.EXECUTIONFLAGS_CACHEBUILDING)
def Execute(self, op, doc, bt, priority, flags):
You also need to ensure you registered your object with the flag c4d.OBJECT_CALL_ADDEXECUTION so AddToExecution and Execute are called.
while object nodes (i.e. ObjectData) also have a priority list, it is AFAIK only being used to determine the call order of ObjectData.Execute and not the order of any cache building. What you could do is: