View Full Version : Make Constraint Tag-Python
10-10-2012, 10:10 PM
So I am pretty sure BaseObject.MakeTag() is the correct command to generate a tag in c4d. But, when I look at the list of tag types I see no constraint tag anywhere. Is this a special case? I am trying to loop through a list of joints adding PSR constraints.
10-11-2012, 09:15 AM
I was asking a similar question a couple of weeks before, only that I had to create a clamp tag. There was this really nice guy who helped me a lot with it. Here is just the link to the thread in case you want to read it ;)
what you have to use to create a PSR tag is:
10-11-2012, 09:11 PM
You can also use the object.MakeTag(ID) route too, in this case it would be myTag = object.MakeTag(1019364)
With the other route the previous posters code will only allocate the tag, not place it into the scene so you must add the object.InsertTag(myTag) call.
Some points to remember that whichever route you go.
1) When dealing with BaseList2D objects in Cinema, there can only ever be one instance of that object in the scene, so if you opt to manually create the tags then remember that you must manually create each tag that you want in the scene before inserting it, you must not inert the same tag twice without first removing it from the original objects list (use the myTag.Remove() function to do this).
2) Unless you explicitly tell Cinema it wont automatically add Undo's for these sorts of actions, which means that the tag will be added and your user wont be able to remove it by clicking undo. To solve this add doc.AddUndo(c4d.UNDOTYPE_NEW, myTag) after you've inserted it into the document and adjusted it's settings however you want. There are several UNTOTYPE's and if you want to create multiple undo steps or control the undo stack you can do from scripting too, it's all documented, but it's something to consider when making a script that modifies the scene in some way. Redo's are automatically handled once you add the Undo data.
3) If you want to know what the ID of an object or tag is so you can allocate it using a script you can print it out in the console using the objects "GetType()" call. So for the active object type print(op.GetType()) into the Console entry field and when you hit enter it will print out the id, for tags you need to get the tag first using doc.GetActiveTag() but the rest remains the same, so the line would be print(doc.GetActiveTag().GetType()) and lo you shall have the number. You can also look up the ID's in the Command Manager if you search for the objects and commands there.
10-11-2012, 09:11 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
vBulletin v3.0.5, Copyright ©2000-2015, Jelsoft Enterprises Ltd.