Make Constraint Tag-Python

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

THREAD CLOSED
 
Thread Tools Search this Thread Display Modes
Old 10 October 2012   #1
Make Constraint Tag-Python

Hi Everyone,

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.

Rick
 
Old 10 October 2012   #2
Hey,

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

http://forums.cgsociety.org/showthr...?f=47&t=1068882

what you have to use to create a PSR tag is:

constr_tag=c4d.BaseTag(1019364)
constr_tag=[c4d.ID_CA_CONSTRAINT_TAG_PSR]=True

Anna
 
Old 10 October 2012   #3
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.

Good luck!
__________________
The Third Party | Homepage | My Reel
"You need to know what you're doing before you start, and to start because you need what you're doing."
 
Old 10 October 2012   #4
Thread automatically closed

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.
 
Thread Closed share thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
CGSociety
Society of Digital Artists
www.cgsociety.org

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump
Miscellaneous

All times are GMT. The time now is 01:26 PM.


Powered by vBulletin
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.