Navigation

    • Register
    • Login
    • Search
    1. Home
    2. Swinn
    Swinn

    Swinn

    @Swinn

    0
    Reputation
    60
    Posts
    172
    Profile views
    0
    Followers
    0
    Following
    Joined Last Online
    Website dancouto.com Location Toronto, Canada

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

    Best posts made by Swinn

    This user does not have any upvoted posts yet.

    Latest posts made by Swinn

    RE: update User Data with Preset info

    Okay, this code works:

    import c4d
    
    def main():
    
        neon = op.GetObject()
        UD = neon.GetUserDataContainer()
    
        g_dirty_glass_presets = neon[c4d.ID_USERDATA,185]
        g_smudges = neon[c4d.ID_USERDATA,183]
        g_dirt = neon[c4d.ID_USERDATA,192]
        g_scratches = neon[c4d.ID_USERDATA,189]
        g_scale = neon[c4d.ID_USERDATA,193]
    
        g_ext = neon[c4d.ID_USERDATA,25]
    
        reset = neon[c4d.ID_USERDATA,229]
    
        if neon[c4d.ID_USERDATA,185] == 0:
            neon[c4d.ID_USERDATA,189] = 5
    

    I have set neon[c4d.ID_USERDATA,189] to a float. How would I set it to a gradient? How would I set it to a 2D vector? Thanks.

    posted in Cinema 4D SDK •
    RE: update User Data with Preset info

    This is from another scene I made. It resets User Data by inserting values when a button is clicked on. The button then resets. This code works. Why is the other code I posted not working?

    import c4d
    
    
    def main():
    
        ID_RESET_Classic_Beer = 29
        ID_RESET_Cool_Pop = 412
        ID_RESET_Dew = 413
        ID_RESET_Fridge = 414
        ID_RESET_Summer = 415
        ID_RESET_Mountain = 416
        ID_RESET_Cooler = 417
        ID_RESET_Picnic = 418
        ID_RESET_Heat_Wave = 419
        ID_RESET_Drive_in = 420
        ID_PRESET = 13
    
        rig = op.GetObject()
    
            # reset Classic Beer
        if rig[c4d.ID_USERDATA, ID_RESET_Classic_Beer]:
            rig[c4d.ID_USERDATA, ID_RESET_Classic_Beer] = False
    
            rig[c4d.ID_USERDATA, 196] = 0       # Classic Beer MASTER Coalesce
            rig[c4d.ID_USERDATA, 197] = 1       # Classic Beer Coalesce Amount
            rig[c4d.ID_USERDATA, 198] = 1       # Classic Beer BIG and SMALL Random Scale
            rig[c4d.ID_USERDATA, 199] = 3       # Classic Beer Mesh Density
    
            rig[c4d.ID_USERDATA, 201] = 1       # Classic Beer BIG Drops
            rig[c4d.ID_USERDATA, 202] = 500     # Classic Beer BIG Amount
            rig[c4d.ID_USERDATA, 203] = 3       # Classic Beer BIG Size
            rig[c4d.ID_USERDATA, 204] = 26085   # Classic Beer Random Seed BIG
    
            rig[c4d.ID_USERDATA, 206] = 1       # Classic Beer SMALL Drops
            rig[c4d.ID_USERDATA, 207] = 800     # Classic Beer SMALL Amount
            rig[c4d.ID_USERDATA, 208] = 1.6     # Classic Beer SMALL Size
            rig[c4d.ID_USERDATA, 209] = 24338   # Classic Beer Random Seed SMALL
    
            rig[c4d.ID_USERDATA, 211] = 1       # Classic Beer MICRO Drops
            rig[c4d.ID_USERDATA, 212] = 2000    # Classic Beer MICRO Amount
            rig[c4d.ID_USERDATA, 213] = 3       # Classic Beer MICRO Size
            rig[c4d.ID_USERDATA, 214] = .18     # Classic Beer MICRO Strength
            rig[c4d.ID_USERDATA, 215] = 28643   # Classic Beer RANDOM Seed MICRO
    
            rig[c4d.ID_USERDATA, 190] = 0       # Classic Beer MIST Off On
            rig[c4d.ID_USERDATA, 191] = 1000    # Classic Beer MIST Amount
            rig[c4d.ID_USERDATA, 192] = 1       # Classic Beer MIST Droplet Size
            rig[c4d.ID_USERDATA, 193] = 12345   # Classic Beer Random Seed MIST
            rig[c4d.ID_USERDATA, 194] = 2       # Classic Beer Random Scale MIST
    
            c4d.EventAdd()
    
    posted in Cinema 4D SDK •
    update User Data with Preset info

    Hi, I am trying to use values from a preset to update/change a User Data field. The console prints out the correct value but the User Data field remains unchanged. Can you tell me what I am missing? Thanks.

    import c4d
    
    def main():
    
        neon = op.GetObject()
        UD = neon.GetUserDataContainer()
    
        g_dirty_glass_presets = neon[c4d.ID_USERDATA,185]
        g_smudges = neon[c4d.ID_USERDATA,183]
        g_dirt = neon[c4d.ID_USERDATA,192]
        g_scratches = neon[c4d.ID_USERDATA,189]
        g_scale = neon[c4d.ID_USERDATA,193]
    
        if g_dirty_glass_presets == 0:
            g_scratches = 5.0
            print g_scratches
    
    posted in Cinema 4D SDK •
    RE: Redshift deleting using old information

    Thanks, PluginStudent! 🙂

    posted in Cinema 4D SDK •
    RE: Redshift deleting using old information

    I figured out a way to get this to work. They key is separating the User Data out of the RS XPresso node but still maintaining a connection to this node through a regular XPresso node. Cinema won't let me drag Redshift nodes from the RS XPresso window to the C4D XPresso window. Nor can I drag them from the AM.

    The solution is to delete the User Data from the RS XPresso window, paste it into a new C4D Xpresso window, then use Set Driven (Absolute) on the RS nodes I need what is essentially double access to. Cinema then automatically creates a new XPresso node, which I then cut the contents from and paste them into my UD Xpresso node.

    My only question is what is the difference between Set Driven (Absolute) and Set Driven (Relative)? Does it make a difference? Thanks.

    posted in Cinema 4D SDK •
    RE: Redshift deleting using old information

    I tried inputting the User Data directly into a RS port using Python and this code:

    import c4d
    
    def main():
    
        obj = op.GetObject()
        neon_col_INPUT = obj[c4d.ID_USERDATA,834]
    
        # List: Spline, Colour, Power, Gas, Blend.
        spline_UD = {1: 618}
    
        for item in spline_UD:
            rs_mat = doc.SearchObject ("S" + str (item) + " Gas")
            rs_tag = rs_mat.GetTag(c4d.Ttexture)
            rs_mat = rs_tag.GetMaterial()
            outputNode = rs_mat[c4d.REDSHIFT_GRAPH_NODES]
            gvMaster = outputNode.GetNodeMaster()
            gvRoot = gvMaster.GetRoot()
    
            colour = obj[c4d.ID_USERDATA,spline_UD[item]]
            print colour
    
            power = obj[c4d.ID_USERDATA,619]
            gas = obj[c4d.ID_USERDATA,65]
            blend = obj[c4d.ID_USERDATA,66]
    
            currentNode = gvRoot.GetDown()
            while currentNode is not None:
                if currentNode.GetName() == "RS Material":
                    RSMaterial[c4d.REDSHIFT_SHADER_MATERIAL_EMISSION_COLOR] = colour
                    break
    

    Now my code causes C4D to hang. Can you help?

    posted in Cinema 4D SDK •
    RE: Redshift deleting using old information

    Cool. I will try a different approach. Thanks for all your help on this, zipit. 🙂

    posted in Cinema 4D SDK •
    RE: Redshift deleting using old information

    The original code yields image 1:
    Screen Shot 2020-05-31 at 5.13.22 AM.png
    m, u yields image 2:
    Screen Shot 2020-05-31 at 5.14.23 AM.png
    s, u yields image 3:
    Screen Shot 2020-05-31 at 5.15.05 AM.png
    It doesn't look like any of the actual User Data Values (3 of which are colour) are coming through. Here are images of the node and the UD:
    Screen Shot 2020-05-31 at 5.18.21 AM.png
    Screen Shot 2020-05-31 at 5.18.46 AM.png
    Neither m,u or s,u causes the actual User Data to transfer to the nodes before the User Data node gets deleted. Is there something I am missing?

    posted in Cinema 4D SDK •
    RE: Redshift deleting using old information

    Because data is coming from User Data, do I need additional info as per this post?
    http://www.plugincafe.com/forum/forum_posts.asp?TID=5188

    posted in Cinema 4D SDK •
    RE: Redshift deleting using old information

    Hmmm. I tried to implement the code (fixed indent errors in the first def) and the print out looks like it is catching what it should but the User Data is not being copied over to the inputs before it gets deleted. Any idea what I am doing wrong?

        def get_port_descid(node, port):
            m, s, u = port.GetMainID(), port.GetSubID(), port.GetUserID()
            if u > 0:
                try:
                    node[(m, s, u)]
                    return (m, s, u)
                except AttributeError as e:
                    pass
                try:
                    node[(m, s)]
                    return (m, s)
                except AttributeError as e:
                    pass
                try:
                    node[s]
                    return s
                except AttributeError as e:
                    pass
    
            return None
    
        for item in spline_id:
            rs_mat = doc.SearchObject ("S" + str (item) + " Gas " + str (bake_name))
            rs_tag = rs_mat.GetTag(c4d.Ttexture)
            rs_mat = rs_tag.GetMaterial()
            outputNode = rs_mat[c4d.REDSHIFT_GRAPH_NODES]
            gvMaster = outputNode.GetNodeMaster()
            gvRoot = gvMaster.GetRoot()
    
            currentNode = gvRoot.GetDown()
            while currentNode is not None:
                if currentNode.GetName() == "Neon Redshift":
                    for out_port in currentNode.GetOutPorts():
    
                        connected_ports = out_port.GetDestination()
                        out_port.Remove()
    
                        c4d.EventAdd()
    
                        out_did = get_port_descid(currentNode, out_port)
                        print out_did
                        if out_did is None:
                            continue
    
                        for in_port in connected_ports:
                            in_node = in_port.GetNode()
                            in_did = (in_port.GetMainID(), in_port.GetSubID())
                            in_did = get_port_descid(in_node, in_port)
                            if in_did is not None:
                                in_node[in_did] = currentNode[out_did]
    
                    currentNode.Remove()
                    break
    
                currentNode = currentNode.GetNext()
    
    posted in Cinema 4D SDK •