Jump to content
Developer Wiki and Function Reference Links ×

Set Layer Node


DomC

Recommended Posts

Hello

I used my own "set layer" node in past. More recently the default library has a node "Set Layer". Did I understand it wrong or do this node just nothing?

 

# The code in the node of default library
    l = self.Params.layer.value
    o = self.Params.object.value
    
    #script
    layer = vs.GetObject(l) #get layer handle of input layer name 
    obj = vs.GetParent(o)   #get parent of object input (obj = existing layer) 
    vs.SetParent(obj, layer)#set existing layer to new layer that works? 
    
    #outputs
    self.Params.obj.value = o

As I understand, this code set the new layer as the parent of the existing layer. 

I think something like this, would be better, or not?

    #script
    layer = vs.GetObject(l) 
    #obj = vs.GetParent(o)   
    vs.SetParent(o, layer)

 

Test Set Layer.vwx

Edited by DomC
Link to comment
  • Marionette Maven

I think the default content node is missing a check to see if the parent of the object is a Marionette generated group or a layer. In the case of a Marionette created object (for instance a rectangle drawn with the rectangle node) we need to move its parent group to the appropriate layer so that when the network is rerun the object gets replaced. 

  • Like 1
Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...