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

    How to understand GraphModelInterface.AddChild().

    Cinema 4D SDK
    2023 maxon api windows python
    3
    11
    1.6k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • DunhouD
      Dunhou
      last edited by

      Hi community!

      I want to add some nodes for redshift node material. and I find some problem with I think I just make it work but not fully understand this function.

      self.graph.AddChild(childId=maxon.Id(), nodeId=nodeId, args=maxon.DataDictionary())
      

      Problem:

      I found if I modify the graph and then insert material, the node will be well positioned, aka it will aligned perfectly.
      53de6911-c96e-47a7-aeb7-be2a2178fecc-image.png

      But if I modify the existing materials , like create a node tree , the node will add to the same position in the graph with not recognizable wires connection.
      57aa6394-c990-4676-9d4a-fd8c84cb7fc6-image.png

      If I try call the c4d.CallCommand(465002363) # Arrange All Nodes It will arranges all my nodes and break old nodes position. for now my solution is select new created nodes and call the Arrange Selected Nodes to position them.

      But I think I didn't use or understand the args=maxon.DataDictionary() arg, I wonder if I can set the position or something for the node .

      Question:

      1. Can I or how can I add nodes to exist graph with a reasonable position
      2. How to understand the maxon.DataDictionary() and what this use for

      Cheers~
      DunHou

      https://boghma.com
      https://github.com/DunHouGo

      1 Reply Last reply Reply Quote 0
      • M
        m_adam
        last edited by m_adam

        Hi @Dunhou

        1. This is for the moment not possible the auto-layouter should do it's work in your case it's seems not. Is it something 100% reproducible? Could you share with us a script that produce such output so we can fix the bug? Moreover for moment this is not possible to define the node position on a graph node. I forwarded this request to the responsible development team, but there is no guarantee that this will be implemented.

        2. The data dictionary can be used to define default parameters value by passing a NodePath before it's creation but the semantic is a bit complex in Python so I would advice you to use SetDefaultValue once a port is created as demonstrated in Modify Node Graph Example.

        Cheers,
        Maxime.

        MAXON SDK Specialist

        Development Blog, MAXON Registered Developer

        DunhouD 2 Replies Last reply Reply Quote 0
        • DunhouD
          Dunhou @m_adam
          last edited by

          Hi @m_adam
          I sent an e-mail with some part of the code and it is 100% reproducible at least for my PC . I didn't know if it is a bug or my wrong coding, thanks for your help.

          Cheers~
          DunHou.

          https://boghma.com
          https://github.com/DunHouGo

          1 Reply Last reply Reply Quote 1
          • DunhouD
            Dunhou @m_adam
            last edited by

            Hi @m_adam, how is it going? Is it a bug or my code mistakes? check it if you forgot this😊

            https://boghma.com
            https://github.com/DunHouGo

            1 Reply Last reply Reply Quote 0
            • M
              m_adam
              last edited by m_adam

              Hi @dunhou, as said in my last email the code you provided is not executable on my end, and due to the current development phase we are internally at Maxon, I do not have that much time right now to look at it, to try to debug it. So for the moment it's on hold until bugfixing time come into our development phase so I would have more time to look into it.

              I totally understand for you extracting all this to a simple example, that I can copy-paste to the script manager and that reproduce the issue without your own wrapper is a big task, but that will help a lot.

              Cheers,
              Maxime.

              MAXON SDK Specialist

              Development Blog, MAXON Registered Developer

              HerzogVonWieselH 1 Reply Last reply Reply Quote 0
              • HerzogVonWieselH
                HerzogVonWiesel @m_adam
                last edited by HerzogVonWiesel

                Hi @m_adam ! I recently added some functionality to Dunhou's Redshift material API, so I think I might be of help here.

                What @Dunhou mentions: try putting the c4d.callcommand to arrange the nodes outside of the transaction such that the added nodes get commited to the graph before it tries to arrange itself; that way it should work.

                Still, I have no idea how the arranging of nodes works. Is it for all selected materials? Is it only for the one that is currently opened in the node editor? Can I send all selected materials there to be arranged? Would love to find out how it works internally.
                Secondly, there is not really a way to add an AddUndo() to the callcommand, so if one is editing a lot of materials at once via a script, every undo is just one of the arrange nodes instead of undoing all of it at once.

                Lastly, I'd also like to find out how to come to conclusions more quickly. I'm working my way though the SDK docs when I need it, however I've tried finding out for a few hours if I can edit a Node's position; is it an attribute? How would I know? Struggling with that a lot hahah.

                Thanks in advance and hope this was a little bit of help,

                • Jerome
                DunhouD 1 Reply Last reply Reply Quote 0
                • DunhouD
                  Dunhou @HerzogVonWiesel
                  last edited by

                  Hey @HerzogVonWiesel

                  Hey many thanks your works! I had write a new helper temporary named RenderEngine . It contains Octane/Redshift/Arnold stuffs , It is a bare-bone of it. I will put it on my Github, but I wonder redshift is own by Maxon now, will an offical sdk will be publish soon . Now the Octane one is almost there , Redshift and Arnold can work but I wonder if it's ok to pay attention on it right now.
                  But anyway, maybe I will post a topic in General Talk. And welcome to improve it.

                  About arrange, for now I set the node selection active and callcommand the arrange selection. utill a solution there.

                  Cheers~
                  DunHou

                  https://boghma.com
                  https://github.com/DunHouGo

                  1 Reply Last reply Reply Quote 0
                  • M
                    m_adam
                    last edited by

                    Hi @Dunhou, regarding the release of a Redshift SDK, sadly this is nothing we can communicate about. May I ask what would be your expectation about a Redshift SDK if it there is one?

                    In any case I have the feeling that your utility classes will be greatly appreciated and useful for a lot of people, since I wrote C4D_RedshiftWrapper_API which only support xpresso redshift graph. It is really outdated by now, but there is still many people using it, so I'm sure a newer version using new node would be welcome !

                    Cheers,
                    Maxime.

                    MAXON SDK Specialist

                    Development Blog, MAXON Registered Developer

                    DunhouD 1 Reply Last reply Reply Quote 0
                    • DunhouD
                      Dunhou @m_adam
                      last edited by

                      Hi @m_adam ,I am working on control aovs/materials or something like that , now we have a import redshift but all I know is that use help function,but seems it is only few funtions, can I or where can I find all the funtions and docs in redshift class?

                      And yes, the old one of my redshift node gragh api is now some people use it ,now I am working on the new render engine api , hope it will help someone, especially I am an amateur habbit-coder.

                      https://boghma.com
                      https://github.com/DunHouGo

                      1 Reply Last reply Reply Quote 0
                      • M
                        m_adam
                        last edited by m_adam

                        Sadly there is no documentation for the Python redshift API, this is still something maintained by the redshift team, so best bet would be to reach the redshift guy on their forums.

                        Cheers,
                        Maxime.

                        MAXON SDK Specialist

                        Development Blog, MAXON Registered Developer

                        DunhouD 1 Reply Last reply Reply Quote 0
                        • DunhouD
                          Dunhou @m_adam
                          last edited by

                          Hi @m_adam , I have ask what are main functions in redshift do in redshift forum, but get no reply for week. and the help(redshift) also give me an ambiguous result.

                          But anyway, I have something here, I will update it and publish when I have free times.

                          https://boghma.com
                          https://github.com/DunHouGo

                          1 Reply Last reply Reply Quote 0
                          • DunhouD Dunhou referenced this topic on
                          • First post
                            Last post