Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush Python 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

    Access a Xpresso node via python tag? [SOLVED]

    Scheduled Pinned Locked Moved PYTHON Development
    4 Posts 0 Posters 447 Views
    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.
    • H Offline
      Helper
      last edited by

      On 22/03/2016 at 02:09, xxxxxxxx wrote:

      Hey Guys ^^

      so, what I want to do is, to access the "Output Upper" of an RangeMapper via a Python Tag.
      I want to use this like an multiplier with an Float Field from my User Data.
      I have tried it like this:

      import c4d
        
      def main() :
          obj_ps = doc.SearchObject("Null")
          multi = obj_ps[c4d.ID_USERDATA,29] #This is the float field
          xpresso_tag = obj_ps.GetFirstTag()
          node_master = xpresso_tag.GetNodeMaster()
          node = node_master.AllocNode(c4d.ID_OPERATOR_RANGEMAPPER)
          node[c4d.GV_RANGEMAPPER_RANGE22] = multi
      

      I tried it like this because I only have one Range Mapper in my Xpresso.
      but this seems to be not working.
      Well, it actually does nothing at all, but I don't get an error or something.
      So yeah, is it actually possible, or am I just to stupid to get it right?

      thanks in advance,

      neon

      1 Reply Last reply Reply Quote 0
      • H Offline
        Helper
        last edited by

        On 22/03/2016 at 03:21, xxxxxxxx wrote:

        Hello,

        in your code your are not accessing an existing node. You are allocating a new node (AllocNode) and that node is not inserted into anything.

        So if you are searching for a specific node you have to get the root node (GetRoot()) and search its child nodes for the node you want to edit.

          
        node_master = xpresso_tag.GetNodeMaster()  
        if node_master is None:  
          return  
          
        root = node_master.GetRoot()  
        if root is None:  
          return  
          
        first = root.GetDown()  
        if first is not None:  
          if first.GetOperatorID() == c4d.ID_OPERATOR_RANGEMAPPER:  
              first[c4d.GV_RANGEMAPPER_RANGE22] = 123  
        

        Best wishes,
        Sebastian

        1 Reply Last reply Reply Quote 0
        • H Offline
          Helper
          last edited by

          On 01/04/2016 at 09:20, xxxxxxxx wrote:

          Hello Neon,

          was your question answered?

          Best wishes,
          Sebastian

          1 Reply Last reply Reply Quote 0
          • H Offline
            Helper
            last edited by

            On 01/04/2016 at 10:37, xxxxxxxx wrote:

            Hello Sebastian,

            Yes it was!
            I actually thought I have already written a reply to your answer, I am sorry.

            greetings, 
            neon

            1 Reply Last reply Reply Quote 0
            • First post
              Last post