Character object access



  • On 30/10/2015 at 06:21, xxxxxxxx wrote:

    Hi
    I now how to access the Character Object and its methods from the different python tabs on the Character Object itself. (Character component tags python tab etc)

    But how do i access a Character Object from another python tag or a script in the script manager.

      
    #Get the BaseObject   
    myCharacterObject = doc.SearchObject("Character")   
    #Get the CharacterObject   
    ...   
    

    Any help is appreciated.

    -b



  • On 02/11/2015 at 10:37, xxxxxxxx wrote:

    Hi Bonsak,

    the question is, what do you mean by accessing the Character object?

    For example in Script Manager you can simply do this (assuming Character object is selected, otherwise your SearchObject() should work as well), in order to access settings of the Character object:

    def main() :
      if op is None or not op.CheckType(c4d.Ocharacter) :
        print "No character object, please select a character object"
        return
      op[c4d.ID_CA_CHARACTER_TEMPLATE] = 0 # Switch to Advanced Quadruped
      c4d.EventAdd()
    

    If you want to "press" the buttons it gets a bit more complicated, as you can't simply use CallButton(). So it would be good to know, where you are heading?



  • On 02/11/2015 at 12:15, xxxxxxxx wrote:

    Thanks Andreas. I need to use some of the methods in c4d.modules.character.builder on the Character object, but i can't figure out how to get there :)
    If i have a character object selected and do like this:

      
    import c4d   
    from c4d.modules.character import builder as BU   
      
    def main() :   
        char = BU.CharacterObject(op)   
        print char # Returns <c4d.modules.character.builder.CharacterObject object at 0x12f260288>   
        print char.GetObject() # Returns "None" ?   
           
    if __name__=='__main__':   
        main()   
    

    Some of the methods i would like to use are: GetComponents(), PostInsertComponent(), IncludeObjects(), but i can't figure out how.

    -b



  • On 03/11/2015 at 05:30, xxxxxxxx wrote:

    Hi Bonsak,

    I'm afraid that is not possible. The module you discovered (it's described in the User manual for the Character Component tag) can really only be used within the Character Component tag. Sorry.



  • On 03/11/2015 at 05:34, xxxxxxxx wrote:

    Ok. Thanks anyway Andreas.

    -b


Log in to reply