Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush Python 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

    Creating an Effector

    Scheduled Pinned Locked Moved PYTHON Development
    6 Posts 0 Posters 449 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • H Offline
      Helper
      last edited by

      On 16/05/2013 at 12:23, xxxxxxxx wrote:

      I'd like to have an effector created as part of my script but not sure how to reference the Effector object. This is how I would think it should work:

      obj = c4d.Obaseeffector(c4d.EffectorName)
      doc.InsertObject(obj) 
      

      Couldn't find an Effector list in the documentation

      1 Reply Last reply Reply Quote 0
      • H Offline
        Helper
        last edited by

        On 16/05/2013 at 12:42, xxxxxxxx wrote:

        Osomething, Xsomething and so on is always referring to a symbol, so your code does not make
        much sense as you cannot instantiate a symbol. There is also the problem that some symbol id
        links are broken (not sure if only in python or also in cpp). almost all mograph objects are part of 
        that problem. you have to pass the plain plugin id instead of the symbol to the instantiating class.
        when you are not sure about the outcome of a plugin ID you can also always use BaseList2D
        instead of the specific class.

        myShaderEffector = c4d.BaseList2D(1018561)

        And as a general note. You need a text file search program to search the c4d folder for symbols
        and plugin ids. I am using Agent Ransack, but TextWrangler is also not bad. You can also simply
        search the c4d module directly.

        def foo(pattern) :
            for element in dir(c4d) :
                if pattern in element: print element
        

        pattern would be something like 'effector' or 'radius'.

        1 Reply Last reply Reply Quote 0
        • H Offline
          Helper
          last edited by

          On 16/05/2013 at 12:55, xxxxxxxx wrote:

          I would recommend using BaseObject instead of BaseList2D, since all effectors are objects.

          1 Reply Last reply Reply Quote 0
          • H Offline
            Helper
            last edited by

            On 16/05/2013 at 13:27, xxxxxxxx wrote:

            Perfect! thats what I was looking for. I didn't realize it was a BaseList2D object (im still kind of a noob). And thanks for the tip, ill try using one of the text searches next time.

            Thanks!

            1 Reply Last reply Reply Quote 0
            • H Offline
              Helper
              last edited by

              On 16/05/2013 at 13:33, xxxxxxxx wrote:

              Originally posted by xxxxxxxx

              Perfect! thats what I was looking for. I didn't realize it was a BaseList2D object (im still kind of a noob). And thanks for the tip, ill try using one of the text searches next time.
              Thanks!

              Almost every object is a BaseList2D in c4d. I just used that form to show you how to instantiate a 
              plugin ID of unknown type. As jack already said effectors are actually BaseObjects.

              1 Reply Last reply Reply Quote 0
              • H Offline
                Helper
                last edited by

                On 17/05/2013 at 00:48, xxxxxxxx wrote:

                Originally posted by xxxxxxxx

                Almost every object is a BaseList2D in c4d. I just used that form to show you how to instantiate a plugin ID of unknown type. As jack already said effectors are actually BaseObjects.

                Not only almost, but every object you see in the Object Manager is a BaseObject, and BaseObject is derived from BaseList2D. That applies to effectors as well as to every other kind of object.

                Take a look into the inheritance table in the Python SDK, after searching for either BaseObject or BaseList2D.

                It's important to understand that concept of inheritance, and to keep in mind that a BaseObject can do everything that a BaseList2D can do, and that it also inherits all of BaseLists2D's member functions. BaseList2D, again, is derived from GeListNode, which again is derived from C4DAtom.

                When allocating a new object, or a shader, material, or tag in CINEMA 4D, you should always use their inherited type for allocation: BaseObject, BaseShader, BaseMaterial, BaseTag, BaseVideopost, et cetera, even though they are all derived from BaseList2D.

                1 Reply Last reply Reply Quote 0
                • First post
                  Last post