Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware 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
    1. Maxon Developers Forum
    2. danielsian
    D
    • Profile
    • Following 0
    • Followers 0
    • Topics 12
    • Posts 35
    • Best 0
    • Controversial 0
    • Groups 0

    danielsian

    @danielsian

    0
    Reputation
    24
    Profile views
    35
    Posts
    0
    Followers
    0
    Following
    Joined Last Online

    danielsian Unfollow Follow

    Latest posts made by danielsian

    • RE: Create Radio Button in User Data

      @i_mazlov Thanks a lot for your time.
      You answered my question brilliantly.

      posted in Cinema 4D SDK
      D
      danielsian
    • RE: Create Radio Button in User Data

      Awesome, thanks @i_mazlov
      Very nice approach to create an User Data entry.

      How can I find this kind of information when it is not documented, as I suppose there are other UD options without a symbol defined?

      posted in Cinema 4D SDK
      D
      danielsian
    • Create Radio Button in User Data

      Hi,
      I'm creating User Data through Python and I'm able to create a dropdown list (combobox) with this:

      cycle = c4d.GetCustomDataTypeDefault(c4d.DTYPE_LONG)
      cycle[c4d.DESC_CUSTOMGUI] = c4d.CUSTOMGUI_CYCLE
      

      But this is not what I want at all, but the old and classic radio button, as below.
      I'd expect to find something like 'c4d.CUSTOMGUI_RADIOBUTTONS' in the documentation, but there is nothing even close to this.
      Is it possible to be created in Python?
      e28d21fb-98f2-41bc-a2d9-a0e343331922-image.png

      posted in Cinema 4D SDK python
      D
      danielsian
    • RE: Flip spline in RSScalarRamp / Invert Gradient in RSRamp not possible in Node Material?

      Thanks @ferdinand, you answered my question brilliantly, as you always do.
      Cheers

      posted in Cinema 4D SDK
      D
      danielsian
    • RE: Adding nodes to existing material won't auto arrange the node editor

      Hey guys, how is it going with this BUG?
      Is it gonna be fixed soon?
      Thanks

      posted in Cinema 4D SDK
      D
      danielsian
    • Flip spline in RSScalarRamp / Invert Gradient in RSRamp not possible in Node Material?

      Hi there,
      In a ShaderGraph material I'm able to flip the spline in a Scalar Ramp node as well as invert the gradient in a Ramp node by using:

      Flip()
      
      InvertKnots()
      

      Do we have similar methods for the Maxon API?
      Do I need to invert the knots and points one by one manually?
      If so I'd appreciate any examples.

      Thanks a lot

      posted in Cinema 4D SDK python 2024 2023
      D
      danielsian
    • RE: How to group nodes in a Scaffold using Python

      Hey @m_adam ,

      Thanks for your help. It works now.

      However, I'm wondering how I would have known that I needed to set the scaffold ID to the node. The documentation doesn't seem to explicitly mention this step. I might be wrong, but for someone without strong knowledge of the API, I'd never thought that way. I would rather added the selected nodes to a group, as this is what a scaffol is. Does that make sense?

      As a side note, after adding the nodes to the scaffold group, they appear messy, actually the nodes are nicely arranged inside the group, but the scaffold is overlapping other nodes. This is likely related to the bug we discussed here: https://developers.maxon.net/forum/post/73446. Am I right?

      Cheers

      posted in Cinema 4D SDK
      D
      danielsian
    • How to group nodes in a Scaffold using Python

      Hi, I've been searching for examples on how to add nodes to a scaffold group in Python, but there is nothing available and the documentation is not helping too much as well....

      This is what I was trying to do, creating a material based on the example from github and adding a scaffold and then trying to move some nodes into it. But of course it is not working as this is just an attempt from a trial and error.
      Any help would be appreciated.

      Thanks

      import c4d
      import maxon
      
      doc: c4d.documents.BaseDocument
      
      def main():
      
        urlTexRust: maxon.Url = maxon.Url(r"asset:///file_edb3eb584c0d905c")
        urlTexSketch: maxon.Url = maxon.Url(r"asset:///file_3b194acc5a745a2c")
      
        # The node asset IDs
        idTextureNode: maxon.Id = maxon.Id("com.redshift3d.redshift4c4d.nodes.core.texturesampler")
        idMixNode: maxon.Id = maxon.Id("com.redshift3d.redshift4c4d.nodes.core.rscolormix")
        idRsStandardMaterial: maxon.Id = maxon.Id("com.redshift3d.redshift4c4d.nodes.core.standardmaterial")
      
        # Instantiate a material, get its node material and the graph for the RS material space.
        material: c4d.BaseMaterial = c4d.BaseMaterial(c4d.Mmaterial)
        if not material:
          raise MemoryError(f"{material = }")
      
        nodeMaterial: c4d.NodeMaterial = material.GetNodeMaterialReference()
        graph: maxon.GraphModelRef = nodeMaterial.CreateDefaultGraph(
          maxon.Id("com.redshift3d.redshift4c4d.class.nodespace"))
        if graph.IsNullValue():
          raise RuntimeError("Could not add RS graph to material.")
      
        # Get the Standard Material node
        result: list[maxon.GraphNode] = []
        maxon.GraphModelHelper.FindNodesByAssetId(graph, idRsStandardMaterial, True, result)
        if len(result) < 1:
          raise RuntimeError("Could not find RS Standard node in material.")
        standardNode: maxon.GraphNode = result[0]
      
        with graph.BeginTransaction() as transaction:
          # Add two texture nodes and a blend node to the graph.
          rustTexNode: maxon.GraphNode = graph.AddChild(maxon.Id(), idTextureNode)
          sketchTexNode: maxon.GraphNode = graph.AddChild(maxon.Id(), idTextureNode)
          mixNode: maxon.GraphNode = graph.AddChild(maxon.Id(), idMixNode)
      
          mixAmount: maxon.GraphNode = mixNode.GetInputs().FindChild(
            "com.redshift3d.redshift4c4d.nodes.core.rscolormix.mixamount")
          mixAmount.SetDefaultValue(0.5)
      
          # Get the ports and set the values
          pathRustPort: maxon.GraphNode = rustTexNode.GetInputs().FindChild(
            "com.redshift3d.redshift4c4d.nodes.core.texturesampler.tex0").FindChild("path")
          pathSketchPort: maxon.GraphNode = sketchTexNode.GetInputs().FindChild(
            "com.redshift3d.redshift4c4d.nodes.core.texturesampler.tex0").FindChild("path")
          pathRustPort.SetDefaultValue(urlTexRust)
          pathSketchPort.SetDefaultValue(urlTexSketch)
      
          # Get the color output ports of the two texture nodes and the color blend node.
          rustTexColorOutPort: maxon.GraphNode = rustTexNode.GetOutputs().FindChild(
            "com.redshift3d.redshift4c4d.nodes.core.texturesampler.outcolor")
          sketchTexColorOutPort: maxon.GraphNode = sketchTexNode.GetOutputs().FindChild(
            "com.redshift3d.redshift4c4d.nodes.core.texturesampler.outcolor")
          mixColorOutPort: maxon.GraphNode = mixNode.GetOutputs().FindChild(
            "com.redshift3d.redshift4c4d.nodes.core.rscolormix.outcolor")
      
          # Get the ports
          mixInput1Port: maxon.GraphNode = mixNode.GetInputs().FindChild(
            "com.redshift3d.redshift4c4d.nodes.core.rscolormix.input1")
          mixInput2Port: maxon.GraphNode = mixNode.GetInputs().FindChild(
            "com.redshift3d.redshift4c4d.nodes.core.rscolormix.input2")
          stdBaseColorInPort: maxon.GraphNode = standardNode.GetInputs().FindChild(
            "com.redshift3d.redshift4c4d.nodes.core.standardmaterial.base_color")
      
          # Connect the nodes
          rustTexColorOutPort.Connect(mixInput1Port, modes=maxon.WIRE_MODE.NORMAL, reverse=False)
          sketchTexColorOutPort.Connect(mixInput2Port, modes=maxon.WIRE_MODE.NORMAL, reverse=False)
          mixColorOutPort.Connect(stdBaseColorInPort, modes=maxon.WIRE_MODE.NORMAL, reverse=False)
      
          transaction.Commit()
      
        # Find all the texture nodes
        tex_nodes = []
        maxon.GraphModelHelper.FindNodesByAssetId(graph, idTextureNode, True, tex_nodes)
      
        ################################
        #  my attempt of grouping the texture nodes in a Scaffold
        #
        with graph.BeginTransaction() as transaction:
          scaffold = graph.AddChild(maxon.Id(), maxon.Id("net.maxon.node.scaffold"))
          graph.MoveToGroup(scaffold, maxon.Id("idOfMyGroup"), tex_nodes)
          transaction.Commit()
        #  
        ################################
        
        doc.InsertMaterial(material)
        doc.SetActiveMaterial(material)
        c4d.EventAdd()
      
      if __name__ == "__main__":
        main()
      
      posted in Cinema 4D SDK 2024 python
      D
      danielsian
    • RE: Adding nodes to existing material won't auto arrange the node editor

      Thanks @m_adam !

      posted in Cinema 4D SDK
      D
      danielsian
    • RE: Adding nodes to existing material won't auto arrange the node editor

      Thanks @Dunhou, I appreciate your reply confirms what seems to be a bug, and I wonder if @m_adam could confirm it based on the working code I provided, which demonstrates the issue in a simple way.

      posted in Cinema 4D SDK
      D
      danielsian