Navigation

    • Register
    • Login
        No matches found
    • Search
    1. Home
    2. moGRR
    M

    moGRR

    @moGRR

    3
    Reputation
    21
    Posts
    16
    Profile views
    0
    Followers
    0
    Following
    Joined Last Online

    • Profile
    • More
      • Following
      • Followers
      • Topics
      • Posts
      • Best
      • Groups
    moGRR Follow

    Best posts made by moGRR

    RE: Python Generator - Linking ports to xpresso node

    Hi all. I've installed the trial version of R21 (I'm looking to upgrade at some point anyway). However, I'm still struggling to get some python code that successfully adds ports to a GV node and then connects them.

    Any help would be massively appreciated.

    Jamie

    posted in Cinema 4D SDK •
    RE: Python Generator - Linking ports to xpresso node

    Hi @zipit - Thanks again for all your help and guidance with this.

    That last code you sent was really beneficial in helping me get a better understanding of how Python Generators work. I've got my Python Generator code working now just as I intended.

    Also, creating python tags rather than xpresso is a much more elegant way to achieve what I'm trying to do. I'm guessing that Python Generators might not be the best way to introduce yourself to Python in C4D?

    Having used AE for years and utilising Javascript expressions, I'm really excited about what python can open up to me with regards to C4D work. 🙂

    posted in Cinema 4D SDK •
    Is it possible to get a spline wrap object to use a python generated spline?

    Hi all.

    I have created a Python Generator that looks at the hierarchy of it's children and generates a spline through them all. This part all works fin.

    However, when I create a Spline Wrap object and set the Python Generator as it's spline, nothing happens. Is there a way I can get a Spline Wrap object to use a spline created by a Python Generator?

    Thanks,
    Jamie

    posted in Cinema 4D SDK •

    Latest posts made by moGRR

    RE: Is it possible to get a spline wrap object to use a python generated spline?

    Thanks @Cairyn

    I tried searching for that post, but I couldn't find it.

    I'm trying a slightly different approach now by using a python tag on a spline object. It's almost working but I'm having update issues.

    posted in Cinema 4D SDK •
    Is it possible to get a spline wrap object to use a python generated spline?

    Hi all.

    I have created a Python Generator that looks at the hierarchy of it's children and generates a spline through them all. This part all works fin.

    However, when I create a Spline Wrap object and set the Python Generator as it's spline, nothing happens. Is there a way I can get a Spline Wrap object to use a spline created by a Python Generator?

    Thanks,
    Jamie

    posted in Cinema 4D SDK •
    RE: Python Generator - Linking ports to xpresso node

    Hi @zipit - Thanks again for all your help and guidance with this.

    That last code you sent was really beneficial in helping me get a better understanding of how Python Generators work. I've got my Python Generator code working now just as I intended.

    Also, creating python tags rather than xpresso is a much more elegant way to achieve what I'm trying to do. I'm guessing that Python Generators might not be the best way to introduce yourself to Python in C4D?

    Having used AE for years and utilising Javascript expressions, I'm really excited about what python can open up to me with regards to C4D work. 🙂

    posted in Cinema 4D SDK •
    RE: Python Generator - Linking ports to xpresso node

    @zipit Ah I did wonder if the behaviour was slightly different due to it being a Python Generator.

    I think I understand most of what you have said there, but being new to Python (and coding really) it can be quite tricky for me grasp. From the sounds of it, I might be trying to do TOO MUCH of it within a Python Generator? I'm open to better/alternative pipelines.

    Here is a bit more detail about what I'm trying to to achieve overall:

    • Create a Python Generator that:
      • Has a series of User Data values which it then uses to create a hierarchy with a Connect Object at the top (root) (tick)
      • When collapsing the Python Generator by pressing 'C', the Connect object also inherits the same User Data from the Python Generator (tick - it does this by default)
      • The Connect object also has an xpresso tag that links certain attributes within the hierarchy to the Connect object's User Data. (this is where I am stuck)

    So overall, what I would like to have is a Python Generator which allows me to change certain User Data values so that it generates the correct hierarchy of Cloners, Objects and Deformers. (This all works fine) , but then what I would also like is the Python Generator to create an Xpresso tag that dynamically links certain attributes to the root object's User Data so that even after I have collapsed the Python Generator into the hierarchy, I can still change the User Data on the root object (The Connect object) and Deformer objects within the hierarchy will change accordingly.

    I hope that makes sense?

    Does this sound like something that is possible?

    Cheers,
    Jamie

    posted in Cinema 4D SDK •
    RE: Python Generator - Linking ports to xpresso node

    Thanks again @zipit

    To make things a bit clearer, here is what I am trying to do:

    Use a Python Generator to:

    • Create a Connector object
    • Create an Xpresso tag and assign it to the Connector object
    • Create a Deformer object (eg Bend) that is a child of the Connector object
    • Create a Node in the GV for the Connector Object
    • Create output ports for all of the Connector object's User Data.
    • Connect these ports to attributes of the Deformer object.

    I'm afraid I've got so confused with trying to get this right, that my code has become really messy with lots of things commented out as I try to figure what is working and what isn't.

    So I've created a new Python Generator with this code which is pretty much where I'm up to:

    def main():
        # Create Connector Object and insert an Xpresso tag to it
        connector_obj      = c4d.BaseObject(c4d.Oconnector)
        tag_xpresso        = c4d.BaseTag(c4d.Texpresso)
        connector_obj.InsertTag(tag_xpresso)
    
        # Get the node master and the root noode of that graphview.
        gvNode_master      = tag_xpresso.GetNodeMaster()
        gvNode_root        = gvNode_master.GetRoot()
        
        # Create a GV Node in the node Master 
        gvNode_controller  = gvNode_master.CreateNode(gvNode_root, c4d.ID_OPERATOR_OBJECT) 
        
        # Add port to GV Node
        USERDATA_NUMBER = 1
        gvNode_controller.AddPort(c4d.GV_PORT_OUTPUT, c4d.DescID(c4d.DescLevel(c4d.ID_USERDATA, c4d.DTYPE_SUBCONTAINER, 0), c4d.DescLevel(USERDATA_NUMBER)), message=True)
        
        return connector_obj
    
    posted in Cinema 4D SDK •
    RE: Python Generator - Linking ports to xpresso node

    Hi all. I've installed the trial version of R21 (I'm looking to upgrade at some point anyway). However, I'm still struggling to get some python code that successfully adds ports to a GV node and then connects them.

    Any help would be massively appreciated.

    Jamie

    posted in Cinema 4D SDK •
    RE: Python Generator - Linking ports to xpresso node

    Thanks again @zipit

    From the link you sent it looks like it's fixed for R21. So I'm downloading the trial version now to see if I can get it working.

    posted in Cinema 4D SDK •
    RE: Python Generator - Linking ports to xpresso node

    Thanks @zipit - that's helped me get a better understanding for connecting ports (please forgive me, I'm still very new to python). However, I'm still stuck with trying to add a 'User Data' port to the node.

    The Node I have created is c4d.ID_OPERATOR_OBJECT and then I use the following code to make sure it's referring to the right object:

    parentNode[c4d.GV_OBJECT_PATH_TYPE] = 0
    parentNode[c4d.GV_OBJECT_START_TYPE_ID] = 1
    

    But then I try and use the AddPort function to add an output port to the node but I can't get it working.

    posted in Cinema 4D SDK •
    Python Generator - Linking ports to xpresso node

    Hi all.

    I’m wanting to use a python generator to create an xpresso tag that then links user data to an object’s attribute.

    I’ve got as far as being able to add the xpresso tag and have added the object node in the xpresso tag, but I’m having no joy with adding ports and linking them.

    Could anyone show me a simple example that does this?

    Many thanks,
    Jamie

    posted in Cinema 4D SDK •
    RE: Python Generator - Adding Shaders to Deformer Objects

    @mp5gosu

    Ah brilliant. Thanks for that!

    And apologies for being such a noob at this.

    posted in Cinema 4D SDK •