How to Set Void Type Attributes in GraphNode?
-
Hi,
I'm currently working with GraphNode in my project and have successfully used methods likenode.SetValue(maxon.NODE.BASE.NAME, maxon.String("some name"))
to set parameters.
However, I'm struggling with attributes that are of void type. Specifically, I need to set maxon.NODE.BASE.SOLOPORT. Could someone please guide me on how to properly set void type attributes like this?
Any help or examples would be greatly appreciated!
-
Hello @Easan,
Thank you for reaching out to us. The TLDR is, you cannot do that.
What is
void
?In C++,
void
is a special type that represents the absence of a type. It is commonly used in two scenarios:- Function Return Type: If a function is not returning any value, you can use void as its return type.
- Pointer Type: void can also be used to create a void pointer, which can point to a variable of any type.
The first case will just translate into a function which returns
None
in Python, i.e., Python's way of saying that function has no return type. The second case is not translatable to Python. The idea of void pointers is to transport arbitrary data, something that does not come easily in C++ as it is statically typed opposed to Python.And void pointers is not translatable to Python, as Python does not (really) have the concept of casting. Methods which take or return a void pointer are usually not ported to Python or are at least heavily modified in their functionality. In the context of messages (which heavily make use of void pointers) you will run into messages which have been ported to Python which make use of void pointers. But that void pointer part is then simply not being used/ported.
What means void in the context of attributes?
A somewhat special case are maxon attributes which are void, such as SOLOPORT as shown here in the C++ docs:
I cannot unpack in all detail what maxon attributes are, but briefly speaking, they are global identifiers which play a huge role in
DataDescription
's and are with that somewhat the maxon API counterpart toDescID
in the classic APIDescID
&Description
pair.Attributes which are of type void and used in data descriptions are primarily used for two things:
- The values of an enum are expressed as attributes of type void. See
NODE::BASE::CATEGORY
for an example. - Node commands are expressed as void attributes,
SOLOPORT
is an example for that.
So, any attribute of type void ist not meant to write a value but merely exists for its identifiers. Node commands currently cannot be executed from Python. You have to find the command with DataDescriptionDefinitionDatabaseInterface::FindNodeMessage and then have to deal with the abstract delegate for the node command via
DescriptionMessageFunction
.Python is currently missing several layers of implementation to do that. So, very long story short:
You cannot solo nodes in Python (which I assume was what you were trying to do).Cheers,
Ferdinand -
This post is deleted! -
@ferdinand OK, I understand what you mean. Thanks for your response.
-
Hi if you want to define which node is soled you can use the method NimbusInterface.SetPath.
The nimbus ref can be retrieved by calling BaseList2D.GetNimbusRef on the owner of the graph (most likely the material or the scene node capsule).
Then the Path Node can be retrieved from any GraphNode with the method GraphNode.GetPath.You may find this topic interesting Unsolo a Node?
Cheers,
Maxime. -
@m_adam Thank you for providing an alternative method to set parameters.