SOLVED MAXPORTS GraphView Flags - Description Resource

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.


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.



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 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.


@m_magalhaes said in MAXPORTS GraphView Flags - Description Resource:

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