Creating an Effector



  • 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



  • 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'.



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

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



  • 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!



  • 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.



  • 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.


Log in to reply