Getting a tag ID
-
On 11/03/2013 at 08:40, xxxxxxxx wrote:
User Information:
Cinema 4D Version: 13
Platform: Windows ;
Language(s) : PYTHON ;---------
User Information:
Cinema 4D Version: 13
Platform: Windows ;
Language(s) : PYTHON ;---------
Hey Everyone,
I'm writing a plugin for cinema in python.
I'm trying to add a composite Tag to an object, but only in case it doesn't allready have one. In order to do that, i want to compare the Tag IDs:tagID = 5637 if c4d.documents.GetActiveDocument().GetSelection()[0].GetTags()[0].GetGUID() != tagID: hostObject.InsertTag(c4d.BaseTag(tagID))
It works up to GetGUID which is apparently not an attribute of c4d.BaseObject (same goes for GetID).
The only attributes i can find in the docs are
.GetObject()
.GetOrigin()And they both give me the Object the tag belongs to (in this case a simple Cube)
And just out of curiosity: How come that if i call .GetObject , which gives me the cube and its memory adress, the memory adress changes with every call?
Thanks a lot,
Aurel
-
On 11/03/2013 at 09:09, xxxxxxxx wrote:
You know there is a Python Subforum on this Forum, and that this Subforum is related to the
C++ SDK?You should use symbols instead of hardcoded integral numbers, like c4d.Tcomposite. You can
check if the object already has a composite tag via op.GetTag(c4d.Tcomposite).The memory address changes since the Python objects only wrap C++ objects internall. While
the address of the Python object changes from time to time, the memory address it is wrapping
does not change (assuming you're comparing exactly the same C4D entities). -
On 11/03/2013 at 10:05, xxxxxxxx wrote:
Thank you!
No i did not know that, sorry - I falsely assumed that python "developement" was referring to actual implementation of python into cinema... as in developing python for cinema... It sounds silly now