On 21/10/2015 at 06:32, xxxxxxxx wrote:
I have an Interaction tag acting as a point constraint plugin. I've placed the code in the draw method, and that works in the view port except for a slight delay when dragging. But it doesn't work when rendering to the PV. Is that because the draw method isn't called when rendering to the PV?
import c4d from c4d import gui #The tag has a user data field (link) for a point selection tag. def draw(bd) : #Get the number of points from the object that belongs to the tag in the user data field count = tag[c4d.ID_USERDATA,1].GetBaseSelect().GetCount() #Get the object that the tag belongs to pointObject = tag[c4d.ID_USERDATA,1].GetObject() #Convert the tag's data to a BaseSelect so we can do something with them PointS = tag[c4d.ID_USERDATA,1].GetBaseSelect() #Points in the tag will have an enabled state value in our BS instance pntArray = PointS.GetAll(tag[c4d.ID_USERDATA,1].GetObject().GetPointCount()) #Calculate the global position of point newPos = pointObject.GetMg() * pointObject.GetPoint(pntArray.index(1)) #Set up the matrix components off = newPos v1 = c4d.Vector( op.GetMg().v1 ) v2 = c4d.Vector( op.GetMg().v2 ) v3 = c4d.Vector( op.GetMg().v3 ) #Build the Matrix objMatrix = c4d.Matrix(off,v1,v2,v3) #Set ops Matrix op.SetMg(objMatrix)
Am i supposed to use the message method instead? If so, what message should the plugin listen for? Or is there an other way of approaching this with out making a full plugin.
Any help appreciated