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

    MAXPORTS GraphView Flags - Description Resource

    Cinema 4D SDK
    c++ sdk
    3
    4
    679
    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.
    • mfersaouiM
      mfersaoui
      last edited by

      Hello,
      How to dynamically limit the maximum number of ports of GraphView Flags, I'm using the following method inside the GetVirtualObjects() is this allowed or no, else is there a better method to do that.

      BaseContainer* objectData = op->GetDataInstance();
      if (!objectData)
          return BaseObject::Alloc(Onull);
      
      Float maxPorts = Min(Min(objectData->GetFloat(MYOBJECTDATA_WIDTH), objectData->GetFloat(MYOBJECTDATA_HEIGHT)), objectData->GetFloat(MYOBJECTDATA_DEPTH)) / 2;
      objectData->SetFloat(MYOBJECTDATA_RAD, ClampValue(objectData->GetFloat(MYOBJECTDATA_RAD), FMin(0.0, (Float)MAXRANGE), maxPorts));
      

      I use this because the ClampValue(value, lowerLimit, upperLimit) restriction inside the SetHandle are obsolete if the user use description resource to edit the object parameters.
      Thank you.

      1 Reply Last reply Reply Quote 0
      • ferdinandF
        ferdinand
        last edited by

        Hi,

        modifying the containers of the scene graph's nodes is allowed in a threaded environment, but it should be used with caution or be avoided if possible.

        For C++ goes the same as for Python. Read the Threading Manual, it will explain things in more depth.

        Cheers
        zipit

        MAXON SDK Specialist
        developers.maxon.net

        1 Reply Last reply Reply Quote 0
        • ManuelM
          Manuel
          last edited by Manuel

          Hello,

          sorry but it's not clear what you are trying to achieve here. (even after reading your first thread)
          You are talking about the number of ports of GraphView Flags and that part is really not clear.
          Are you trying to limit the value of the port and not the number of ports ?

          If i understand what you are trying to do in your code, you are trying to clamp the value of a description parameter base on value of other parameters.

          If you want your UI to be a bit dynamic, you have to do it in GetDDescription and setting the description parameters
          You can add component there and dynamically change the "limit" of the UI.
          (we have an example in our sdk that show how to add gadget dynamicly you can find in the sdk.zip or on github)

          If it's just to set a value of a parameter if you change another one, you can do that in GetDParameter

          Now, as we said, GetVirtualObject purpose is to build the cache of the object/generator. Description parameter should only be retrieve there, not set. If you want to react to something, there's other place than GVO

          It's normal to be a bit lost in all those functions, don't worry, just ask.

          Cheers,
          Manuel

          MAXON SDK Specialist

          MAXON Registered Developer

          mfersaouiM 1 Reply Last reply Reply Quote 1
          • mfersaouiM
            mfersaoui @Manuel
            last edited by

            @m_magalhaes said in MAXPORTS GraphView Flags - Description Resource:

            sdk.zip

            Hello,
            Yes I want to dynamically change the "limit" of the UI depending on other parameters.
            Thank you for the ZIP example.

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