Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Unread
    • Recent
    • Tags
    • Users
    • Login
    1. Maxon Developers Forum
    2. esan
    3. Topics
    • Profile
    • Following 0
    • Followers 0
    • Topics 4
    • Posts 15
    • Best 1
    • Controversial 0
    • Groups 0

    Topics created by esan

    • esanE

      Connect + Delete groups iteratively

      Cinema 4D SDK
      • python r20 • • esan
      5
      0
      Votes
      5
      Posts
      1.3k
      Views

      ManuelM

      hello,

      I'will consider this thread as solved tomorrow if you have nothing to add 🙂

      Cheers,
      Manuel

    • esanE

      Xpresso Python Node . "Code" field

      Cinema 4D SDK
      • • • esan
      8
      0
      Votes
      8
      Posts
      1.4k
      Views

      esanE

      @Cairyn

      Ah youre right, the Return was the cause of the errors, not the triple quotes. Got it all working now! (after taking a few tries to get the "indents" with the strings right)

      Thanks a ton!

    • esanE

      OperatorSetData for "Lists"?

      Cinema 4D SDK
      • python r20 • • esan
      5
      0
      Votes
      5
      Posts
      815
      Views

      r_giganteR

      @esan said in OperatorSetData for "Lists"?:

      Another quick question. is there still a bug on c4d.GV_OBJECT_OPERATOR_OBJECT_OUT?

      Yes it's still there and being R20 maintenance ended it's likely to remain.

      Best, R

    • esanE

      Cant select newly created Instance

      Cinema 4D SDK
      • python • • esan
      7
      0
      Votes
      7
      Posts
      1.1k
      Views

      esanE

      @blastframe Ok was able to retrofit your version to get what I wanted, a bit of guesswork in here, but got the result im after lol

      import c4d from c4d import gui def createInstance(): obj = op.GetDown() inst = c4d.BaseObject(c4d.Oinstance) # created Instance with Base Object inst[c4d.INSTANCEOBJECT_LINK] = obj # set Instance's reference link # set the name using the object passed to the function inst[c4d.ID_BASELIST_NAME] = "%s Instance"%obj[c4d.ID_BASELIST_NAME] return inst # return the Instance instance def AddLongDataType(obj): # create User Data Container named Picker if obj is None: return bc = c4d.GetCustomDataTypeDefault(c4d.DTYPE_LONG) bc[c4d.DESC_NAME] = "Picker" doc.AddUndo(c4d.UNDO_CHANGE, obj) obj.AddUserData(bc) c4d.EventAdd() def setQuickTab(obj, inst, data): # change User Date container to type Cycle, populate with Children Names descid = data[0][0] bc = data[0][1] children = obj.GetChildren() # Build new cycle options container dynamically cycle = c4d.BaseContainer() for i,child in enumerate(children): cycle.SetData(i, child.GetName()) bc[c4d.DESC_CYCLE] = cycle doc.AddUndo(c4d.UNDO_CHANGE, obj) # Set modified description data container inst.SetUserDataContainer(descid, bc) def main(doc): obj = doc.GetActiveObject() if (obj == None): gui.MessageDialog("Please select the Root of the Assets you wish to Instance.") return doc.StartUndo() inst = createInstance() doc.InsertObject(inst) AddLongDataType(inst) data = inst.GetUserDataContainer() setQuickTab(obj, inst, data) doc.AddUndo(c4d.UNDO_NEW, inst) doc.EndUndo() c4d.EventAdd() if __name__=='__main__': main(doc)