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

    Max value of an EditNumberArrows in TagData

    Cinema 4D SDK
    s22 python
    2
    3
    356
    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.
    • ?
      A Former User
      last edited by A Former User

      Hello,
      I'm looking to set the values of an EditNumberArrows gadget in a TagData plugin based on the points of an object to which the BaseTag is attached. I would like to use the points value to set the EditNumberArrows gadget's Max value to the pointCount value.

      This is how I'm doing it in the .res file, but I'm not sure how to edit the Max with the point Count inside of the TagData.

          GROUP CONTROLS_GROUP {
              DEFAULT 1;
              LONG CONTROLS_POINT_INDEX { MIN 1; MAX 50; STEP 1; }
      

      Is editing the Max value dynamically possible? Can anyone please advise me on this? Thanks!

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

        Hi @blastframe the usual way is to set the DESC_MAX value in the description of the NodeData.
        To do so you have to override the NodeData.GetDDescription method like so

            def GetDDescription(self, node, description, flags):
                # Before adding dynamic parameters, load the parameters from the description resource
                if not description.LoadDescription(node.GetType()):
                    return False
        
                # Check if there is an object attached
                obj = node.GetObject()
                if obj is not None:
        
                    CONTROLS_POINT_INDEX = 1001
                    paramSetting = description.GetParameterI(CONTROLS_POINT_INDEX)
                    paramSetting[c4d.DESC_MAX] = obj.GetPointCount()
        
                # After parameters have been loaded and added successfully, return True and DESCFLAGS_DESC_LOADED with the input flags
                return True, flags | c4d.DESCFLAGS_DESC_LOADED
        

        For more information about GetDDescription I invite you to read the C++ Manual about Description Manual.

        Cheers,
        Maxime.

        MAXON SDK Specialist

        Development Blog, MAXON Registered Developer

        ? 1 Reply Last reply Reply Quote 0
        • ?
          A Former User @m_adam
          last edited by

          @m_adam Thanks, Maxime!

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