Hello everybody,
I am searching a way to change the name of my child nodes.
I found a way to do it but the update is not automatic. What I want is the same function as the rename waypoint button.
Can somebody help me please.
Best regards, Arnaud
Not all built-in child nodes may be renamed.
Waypoints are not supported by rename functionality in SDK 1.2.
Ok but, the ones that CAN be renamed⌠How can they be renamed dinamically?
For example, the URCap custom nodes. We define the name before the creation, before the genetarion of the script with âwriterâ⌠But then, what is the best way to rename them or to allow the user to rename them? Any sample code will help.
Thanks in advance! Regards, David
Since the release of SDK 1.4, naming of waypoints are now supported.
The name of a URCap node in the program tree is always refelected by the String returned by âgetTitle()â in the Contribution.
In order for a parent node to be able to rename the program node, you should consider a CustomAPI.
Thank you for the answer @jbm. I was able to change my node name using âgetTitle()â and it is working to perfection. I just thougth it wont update automatically on the program tree, but it does.
@dmartin
Polyscope calls the method getTitle()
to update the title in the program tree any time something is changed in the DataModel
of that program nodesâ contribution, thus, in order to change the title live, use something like:
public void getTitle()
{
return model.get("title", defaultTitle);
}
Then whenever you need the title to update, simply do model.set("title", newTitle)
and the title in the tree will update, since the DataModel
changed