Jump to content

Return type None- InsertTag


Guest pROTHEUs

Recommended Posts

Guest pROTHEUs

Hi,

i am wondering if i am missing something.

Problem:

tag =  op.InsertTag( c4d.BaseTag(c4d.Ttexture))

print tag  //None

 Return should be a tag. Instead i get a None.

 

https://developers.MAXON.net/docs/Cinema4DPythonSDK/html/modules/c4d/C4DAtom/GeListNode/BaseList2D/BaseObject/index.html?highlight=inserttag#BaseObject.InsertTag

 

Also, what s the difference between:

--op.InsertTag(c4d.BaseTag( c4d.Ttexture )) and   

--op.MakeTag(c4d.Ttexture) 

As I understand creates and attaches, but attaches to differentt(op and bc). Am I wrong?

Link to post

There is actually two way for adding tag (and object) in c4d.
Create it in memory then insert it to the scene/object using InsertTag

import c4d

def main():
    obj = doc.GetFirstObject()
    if not obj: return
    
    #Tag is only present in memory here
    tag = c4d.BaseTag(c4d.Ttexture)
    
    obj.InsertTag(tag) #InsertTag return nothing it's simply insert the tag to the obj
    c4d.EventAdd()

if __name__=='__main__':
    main()


Or you can create a new tag using MakeTag
 

import c4d

def main():
    obj = doc.GetFirstObject()
    if not obj: return
      
    tag = obj.MakeTag(c4d.Ttexture) #Maketag create a new tag, return it and laso add it to the obj
    c4d.EventAdd()

if __name__=='__main__':
    main()


Hope it's help :)

Link to post

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...