I try to create an UR-Cap where a user can add move child nodes and all the move node should have same movement speed. The speed gets defined by the user in the UR-Cap node. My idea was to create a method that sets the speed from all nodes every time the user changes the speed but, in this case, a new created Move node wouldn´t get the speed when the user don´t changes the movement speed after. I prefer that it is possible to add the nodes from the normal program commands and not with a button in the UR-Cap. Is there a way to run a method every time a child node gets added to the UR-Cap node or to create a move node with a predefined speed?
If I’m understanding you correctly, you want the normal Move command (under Basic->Move) to call your method, which would set the speed of that MoveNode? I’m not aware of anything builtin to the SDK that could allow you to bind on an event like this. However, if you controlled the creation of MoveNodes through your URCap, then you could call your method as you desire. So ideally, you would set the setChildSequenceLocked to true for your URCap node to prevent the user from adding their own default MoveNode. And then just add a button to your URCap that does the adding of a MoveNode to it (which would call your method). This way you leave the user with no choice but to add MoveNodes through your URCap, which would ensure your method gets called.
As far as I know, the MoveNode class has a setConfig method where you can set various configurations (including speed). You can create a configuration by going into the MoveNode’s getConfigFactory() method which will return a configuration factory. With that factory, you can create custom MoveL, MoveJ, and MoveP configurations for your MoveNode. You should also be able to do this after the creation of said MoveNode. There are various methods that allow you to traverse your URCap’s tree structure. Once you find the MoveNode you want to edit, you can call setConfig on it to change speeds.
Thanks for your reply. I would like to avoid to add the MoveNode with a button, so the user can use the same way to add a MoveNode inside and outside of the URCap. In the moment i call the method to change the speed in the openview method. It works for now but i will try to get a better way for solving this.
There is no method and predefining requires you to add the move commands with a custom button.
I have a feature request open for child-add-event/config inheritance: Add an Event to ProgramNodes that is called when children are added to allow setting default configration / Add config inheritance