Python Galleries: setScript() and setScriptFromNode() bug?

   1008   1   0
User Avatar
Member
339 posts
Joined: June 2013
Offline
I'm not being able to have setScript() and setScriptFromNode()functions to actually update what the gallery entry builds when dragged to the network.
All the metadata, like label, icon, etc, does update but not the contents.

Am I missing something?

Thanks

Video showing the problem https://streamable.com/vndf2 [streamable.com]
Edited by probiner - April 2, 2019 07:55:27
User Avatar
Member
339 posts
Joined: June 2013
Offline
Here's the clarifying info I got from Hector, from support, for anyone looking into this:

The setScript() / setScriptFromNode() set a script that modifies the parameters of the target node when the gallery entry is applied to a node. It does not however, modify the contents of the gallery.

For example, if you create both your “box” and “tube” gallery entries from objects with different transforms, and then you copy the “box” gallery's script into the “tube” gallery's script using setScript(), you'll notice next time you instantiate the “tube” gallery, it will still create a tube, but it's transform will copy the box's transform.

You can change the contents (e.g. the child geometry) of a Gallery entry from a target node by using .setContentsFromNode().

If you try this you'll notice that this changes the contents, but not the parameters (e.g. the transforms set by the gallery's script remain the same).

I don't think there's currently a way to copy just the contents from another gallery entry instead of a node, but you can use setEqual(), which will copy both the contents and the script (and all other parameters except the gallery name) from another gallery.

So for example, if you wanted your “tube” gallery to be the same as your “box” gallery except for it's name and label, you could simply store the label() in a temporary variable and call setEqual(boxg) and then just reassign the label with setLabel().

Cheers
Edited by probiner - April 2, 2019 19:25:42
  • Quick Links