Is there a quick way to parent an object in a complex scene?

backgroundbackground Posts: 810
edited April 22 in The Commons

Is there a quick way to parent an object in a complex scene?

Let's say I have a complex scene with contains multiple figures, I also have a suitcase in the scene. If I move the suitcase to the right hand of one of the figures, I would then like to parent the suitcase to that hand. Currently the only way I know of is the select the suitase, choose 'Change 'Suitcase' Parent' and then scroll through the looong list in the Change Parent window until I find the correct hand on the correct figure, this can be very time consuming.

What I would like to be able to do, is 'Right click on the hand, right click on the suitcase, and then have an option 'Parent 'Suitcase' to 'Right hand' ( with a option of 'Parent In Place' )without all the scrolling and searching.

Post edited by background on
«1

Comments

  • jmucchiellojmucchiello Posts: 1,312

    You can drag items in the scene panel to reparent them.

  • garrett_3dgarrett_3d Posts: 353

    What I do is click on the hand in viewport, this expands the scene list. Then in the scene list, click and drag the item to the hand and it parents.

    I understand this may be a little frustrating if you have dozens of assets in a scene and end up scrolling the tab, but I haven't found an easier way (although I'm still finding my way around the software).

  • backgroundbackground Posts: 810
    edited April 22

    Thanks for the suggestions, I was really hoping to avoid scrolling by selecting the two relevant items before going to the Parent dialogue. In the viewport the two items are right next to each other, so that seems to be an ideal place to make the selections, rather than a scrollable list which might contain hundreds of possible objects.

    Post edited by background on
  • Matt_CastleMatt_Castle Posts: 3,145

    This I would say is a worthwhile thing to suggest either as a program feature (in a CS ticket) in the same way as there's already a "point at" option, but it is also presumably something that could be done by a scripter. (However, my tame scripter is a bit busy with other things right now, so I'm not going to pester him with it right now).

  • backgroundbackground Posts: 810

    Matt_Castle said:

    This I would say is a worthwhile thing to suggest either as a program feature (in a CS ticket) in the same way as there's already a "point at" option, but it is also presumably something that could be done by a scripter. (However, my tame scripter is a bit busy with other things right now, so I'm not going to pester him with it right now).

    Thanks Matt, I'm not sure how I would go about creating a CS ticket, I thought they were only for reporting problems? Yes, it sounds like something that could be done with a script, but my programming days are long behind me. 

  • ElorElor Posts: 3,771

    background said:

    Thanks Matt, I'm not sure how I would go about creating a CS ticket, I thought they were only for reporting problems? Yes, it sounds like something that could be done with a script, but my programming days are long behind me. 

    I have never done it, but if you select Technical Support Question, for the 'Tech Ticket Tracker' field, you can select Feature Request among the other options.

  • jmucchiellojmucchiello Posts: 1,312

    It would probably be faster to get someone to make a script than to get a feature request worked on while Daz2026 is still in Beta.

  • backgroundbackground Posts: 810

    jmucchiello said:

    It would probably be faster to get someone to make a script than to get a feature request worked on while Daz2026 is still in Beta.

    Well I submitted a ticket, but you're correct that a script could probably be made faster than waiting for a program feaature addition. I don't know any scripters that I could ask though.  

  • WolfwoodWolfwood Posts: 948

    In blender is a simple task that it works very similar as requested. But in Daz the moment you select two items, the 'parent' action from right click disapear, pity.

    Surely a feature that could be added at least for Daz 2026

    Now, in the meantime and as pointed already, it may be possible with script. Since i wanted to experiment with some things regarding scripting, this might be a good thing to try.

     

  • backgroundbackground Posts: 810

    Any volunteers are very welcome, no pressure, but if someone can do it I'd be very grateful. 

  • HavosHavos Posts: 5,655
    edited April 22

    When the items are a long way apart, one way to change the parent is to select the item to be parented, then scroll to where in the scene panel is the object you want to parent it to. Right click the desired parent whilst dragging the mouse slightly to the left or right. Release the right mouse button and it should parent the selected item onto the desired object. You will likely have to practise this a bit to get it to work each time, but it is a useful way of changing parents in complex scenes. I don't know where this feature is documented, I stumbled across it by accident, but I use it all the time now.

    Post edited by Havos on
  • Richard HaseltineRichard Haseltine Posts: 110,158
    edited April 22

    Scripts>Utiltities already has the Snap parent script, which will parent a node to a bone and align it too. For a simple parent anythings-that-aren't-a-bone in place to anything:

    // Get all selected nodes in the scene
    var aNodes = Scene.getSelectedNodeList();
    // Get the primary selection - usually the last node selected
    var oParent = Scene.getPrimarySelection();
    
    // go through the list of selected nodes
    for ( var n = 0 ; n < aNodes.length ; n++ ) {
    	// skip the parent-to-be, we can't parent it to itself	
    	if ( aNodes[ n ] == oParent ) {
    		continue;
    	}
    	// We can't chnage the parents of bones, so skip them
    	if ( aNodes[ n ].inherits( "DzBone" ) ) {
    		continue;
    	}
    	// Parent the current node to the parent, with Parent in palce on - 
    	// replace the true with false to have it snap
    	oParent.addNodeChild( aNodes[ n ] , true );
    }
    Post edited by Richard Haseltine on
  • backgroundbackground Posts: 810
    edited April 22

    Thanks Richard, that looks like a solution ( bearing in mind my limited understanding of scripts).

    Updated  : Excellent it works exactly as I wanted, Thanks very much Richard. I'm going to create a custom action for that, for sure.

    Post edited by background on
  • WolfwoodWolfwood Posts: 948
    edited April 22

    Here is a variation.

    No cascade parenting, Last node selected to become child (easy swap changing variables). And it allows "Undo".

    //Get Nodes
    
    var oChild = Scene.getPrimarySelection();	
    
    var aSelect = Scene.getSelectedNodeList()
    
    var nPrevious = aSelect.length - 2;
    	
    var oParent = aSelect[nPrevious];
    
    	
    	
    //Parenting
    	
    beginUndo();
    
    try {
    
        
    	if (oChild && oParent && !oChild.inherits( "DzBone" )) {
    
    	oParent.addNodeChild(oChild, true);
    	
    	acceptUndo("Parenting");
    
    	} else {
    		print ("Bad nodes selection");
        }
        
    }
     
    catch (err) {
    
        cancelUndo();
        print("Error: " + err);
    }	

    I may try to upgrade this to a freebe tool that offer options.

    Edit: Sorry about formating, don't know why it changes to single line when i save.

    Edit2: Fixed?

     

    Edit3: Added 'true' to parent 'in place'.

    Post edited by Wolfwood on
  • backgroundbackground Posts: 810

    Thanks Wolfwood, I very much appreciate your taking the time to create that.

  • Richard HaseltineRichard Haseltine Posts: 110,158
    edited April 22

    Wolfwood said:

    Here is a variation.

    No cascade parenting, Last node selected to become child (easy swap changing variables). And it allows "Undo".

    //Get Nodes
    
    var oChild = Scene.getPrimarySelection();	
    
    var aSelect = Scene.getSelectedNodeList()
    
    var nPrevious = aSelect.length - 2;
    	
    var oParent = aSelect[nPrevious];
    
    	
    	
    //Parenting
    	
    beginUndo();
    
    try {
    
        
    	if (oChild && oParent && !oChild.inherits( "DzBone" )) {
    
    	oParent.addNodeChild(oChild);
    	
    	acceptUndo("Parenting");
    
    	} else {
    		print ("Bad nodes selection");
        }
        
    }
     
    catch (err) {
    
        cancelUndo();
        print("Error: " + err);
    }	

    I may try to upgrade this to a freebe tool that offer options.

    Edit: Sorry about formatigs, don't know why it changes to single line when i save.

    If you put the post into Source view (top-right of the button bar above the text box) and remove the code tags but leaving the pre tags, it seems to work. Took me several iterations of my earlier post to work that out.

    Post edited by Richard Haseltine on
  • WolfwoodWolfwood Posts: 948

    Richard Haseltine said:

    If you put the post into Source view (top-right of the button bar above the text box) and remove the code tags but leaving the pre tags, it seems to work. Took me several iterations of my earlier post to work that out.

    Thanks, it worked.

  • barbultbarbult Posts: 26,866

    Richard Haseltine said:

    Scripts>Utiltities already has the Snap parent script, which will parent a node to a bone and align it too. For a simple parent anythings-that-aren't-a-bone in place to anything:

    // Get all selected nodes in the scene
    var aNodes = Scene.getSelectedNodeList();
    // Get the primary selection - usually the last node selected
    var oParent = Scene.getPrimarySelection();
    
    // go through the list of selected nodes
    for ( var n = 0 ; n < aNodes.length ; n++ ) {
    	// skip the parent-to-be, we can't parent it to itself	
    	if ( aNodes[ n ] == oParent ) {
    		continue;
    	}
    	// We can't chnage the parents of bones, so skip them
    	if ( aNodes[ n ].inherits( "DzBone" ) ) {
    		continue;
    	}
    	// Parent the current node to the parent, with Parent in palce on - 
    	// replace the true with false to have it snap
    	oParent.addNodeChild( aNodes[ n ] , true );
    }

    "Parent in palce" = "Parent in place", I assume.
    Thank for this. It looks helpful.

     

  • Richard HaseltineRichard Haseltine Posts: 110,158

    As long as I didn't typo the code (well, as long as I fixed the various points at which did typo the code) ...

  • WolfwoodWolfwood Posts: 948

    And here i was wondering why my object moved sligthly, was missing that bit to make it in place.

    Now i wonder why without it it didn't move more. I was testing on purpose with a relatively distant object, the movement with previous script was not that much; but manually (deselecting 'in place') it moves the child to overlap.

  • barbultbarbult Posts: 26,866

    I tried the script Richard posted. I changed true to false at the end, where the comment said to do so. My experience is that it does not move the prop to the bone. Is the remembered "Parent in Place" in the Scene pane's Change Parent command overriding the script, or am I doing something else wrong? The prop gets parented to the bone, but it remains in its original location in the viewport.

    // Parent the current node to the parent, with Parent in palce on -
    // replace the true with false to have it snap
    oParent.addNodeChild( aNodes[ n ] , false );

     

  • Richard HaseltineRichard Haseltine Posts: 110,158

    barbult said:

    I tried the script Richard posted. I changed true to false at the end, where the comment said to do so. My experience is that it does not move the prop to the bone. Is the remembered "Parent in Place" in the Scene pane's Change Parent command overriding the script, or am I doing something else wrong? The prop gets parented to the bone, but it remains in its original location in the viewport.

    // Parent the current node to the parent, with Parent in palce on -
    // replace the true with false to have it snap
    oParent.addNodeChild( aNodes[ n ] , false );

    It is working, but the behaviour is different - with Parent in Place in the Scene pane/Change parent dialogue off any transformations on the child are zeroed and it just moves its origin to the parent's, with the scrript command the transformations remain but are now relative to the new parent object's origin instead of to the scene origin. I think this is how Parent In Place off in the UI used to work, I remember being thrown by the change.

  • MonkeMonke Posts: 48
    edited April 23

    You can also just create (and save) a filter in the scene panel. You can see in the screenshot I'm using a regular expression to match both the prop and hand anchor nodes.

    It's easy to replace the name of the prop in the top after selecting a saved filter (using the magnifying glass button). In this case you could just double-click on the word "suitcase" in the filter and it will select the whole word. You can then type a part of the prop name (you don't need the full name, just a unique enough part of it for the filter).

    Then you can right click the name of the character and choose expand -> expand all to quickly open the path to the hands

    Then simply drag the prop into the hand.

    There's an option to toggle "parent in place" behaviour when dragging.

    Screenshot 2026-04-23 a.png
    471 x 552 - 49K
    Screenshot 2026-04-23 d.png
    450 x 597 - 49K
    Post edited by Monke on
  • HavosHavos Posts: 5,655

    Monke said:

    You can also just create (and save) a filter in the scene view. You can see in the screenshot I'm using a regular expression to match both the prop and hand anchor nodes.

    It's easy to replace the name of the prop in the top after selecting a saved filter (using the magnifying glass button). In this case you could just double-click on the word "suitcase" in the filter and it will select the whole word. You can then type a part of the prop name (you don't need the full name, just a unique enough part of it for the filter).

    Then you can right click the name of the character and choose expand -> expand all to quickly open the path to the hands

    Then simply drag the prop into the hand.

    There's an option to toggle "parent in place" behaviour when dragging.

    Your regular expression is obscured by the pop up panel, and can not be seen.

  • MonkeMonke Posts: 48
    edited April 23

    Havos said:

    Monke said:

    You can also just create (and save) a filter in the scene view. You can see in the screenshot I'm using a regular expression to match both the prop and hand anchor nodes.

    It's easy to replace the name of the prop in the top after selecting a saved filter (using the magnifying glass button). In this case you could just double-click on the word "suitcase" in the filter and it will select the whole word. You can then type a part of the prop name (you don't need the full name, just a unique enough part of it for the filter).

    Then you can right click the name of the character and choose expand -> expand all to quickly open the path to the hands

    Then simply drag the prop into the hand.

    There's an option to toggle "parent in place" behaviour when dragging.

    Your regular expression is obscured by the pop up panel, and can not be seen.

    The forums seem to be laggy. I replaced all the screenshots already, but here it is:

    rx::ci::(.*anchor.*|.*suitcase.*)

    ( X | Y ) = match X OR Y

    .* = any characters

     

    Post edited by Monke on
  • barbultbarbult Posts: 26,866

    Richard Haseltine said:

    barbult said:

    I tried the script Richard posted. I changed true to false at the end, where the comment said to do so. My experience is that it does not move the prop to the bone. Is the remembered "Parent in Place" in the Scene pane's Change Parent command overriding the script, or am I doing something else wrong? The prop gets parented to the bone, but it remains in its original location in the viewport.

    // Parent the current node to the parent, with Parent in palce on -
    // replace the true with false to have it snap
    oParent.addNodeChild( aNodes[ n ] , false );

    It is working, but the behaviour is different - with Parent in Place in the Scene pane/Change parent dialogue off any transformations on the child are zeroed and it just moves its origin to the parent's, with the scrript command the transformations remain but are now relative to the new parent object's origin instead of to the scene origin. I think this is how Parent In Place off in the UI used to work, I remember being thrown by the change.

    If I understand this explanation correctly, the script does not replicate the behavior of parenting "in place unchecked" in the Scene pane. The difference is that the script does not change the origin of the parented object, so, regardless of whether the script is set to oParent.addNodeChild( aNodes[ n ] , false ); or oParent.addNodeChild( aNodes[ n ] , true);, the parented prop will not move (snap) to the parent's location, the way it does when doing the parenting "in place unchecked" in the Scene pane. 

    To be consistent with the current Scene pane operations, would the script need to be modified, or would the behavior of addNodeChild need to be modified by Daz developers?

  • Richard HaseltineRichard Haseltine Posts: 110,158

    barbult said:

    Richard Haseltine said:

    barbult said:

    I tried the script Richard posted. I changed true to false at the end, where the comment said to do so. My experience is that it does not move the prop to the bone. Is the remembered "Parent in Place" in the Scene pane's Change Parent command overriding the script, or am I doing something else wrong? The prop gets parented to the bone, but it remains in its original location in the viewport.

    // Parent the current node to the parent, with Parent in palce on -
    // replace the true with false to have it snap
    oParent.addNodeChild( aNodes[ n ] , false );

    It is working, but the behaviour is different - with Parent in Place in the Scene pane/Change parent dialogue off any transformations on the child are zeroed and it just moves its origin to the parent's, with the scrript command the transformations remain but are now relative to the new parent object's origin instead of to the scene origin. I think this is how Parent In Place off in the UI used to work, I remember being thrown by the change.

    If I understand this explanation correctly, the script does not replicate the behavior of parenting "in place unchecked" in the Scene pane. The difference is that the script does not change the origin of the parented object, so, regardless of whether the script is set to oParent.addNodeChild( aNodes[ n ] , false ); or oParent.addNodeChild( aNodes[ n ] , true);, the parented prop will not move (snap) to the parent's location, the way it does when doing the parenting "in place unchecked" in the Scene pane. 

    To be consistent with the current Scene pane operations, would the script need to be modified, or would the behavior of addNodeChild need to be modified by Daz developers?

    It could be modified by just adding commands to zero the transforms - node.getXPosControl() etc. https://docs.daz3d.com/public/software/dazstudio/4/referenceguide/scripting/api_reference/object_index/node_dz#a_1ab423cbff983e328b94694c50c6416688 will give the proerpties, then on that use oCtrl.setValue( 0 ) (for a non-animated scene) to zero them in turn, iif oCtrl is the variable used to store the value. Personally I would make it optional, or do more than one version of the script, as both zeroing and not zeroing the child properties can be useful at times (I wish it was an option in DS)

  • backgroundbackground Posts: 810

    Thanks for the various solutions people have suggested.

  • barbultbarbult Posts: 26,866

    Richard Haseltine said:

    barbult said:

    If I understand this explanation correctly, the script does not replicate the behavior of parenting "in place unchecked" in the Scene pane. The difference is that the script does not change the origin of the parented object, so, regardless of whether the script is set to oParent.addNodeChild( aNodes[ n ] , false ); or oParent.addNodeChild( aNodes[ n ] , true);, the parented prop will not move (snap) to the parent's location, the way it does when doing the parenting "in place unchecked" in the Scene pane. 

    To be consistent with the current Scene pane operations, would the script need to be modified, or would the behavior of addNodeChild need to be modified by Daz developers?

    It could be modified by just adding commands to zero the transforms - node.getXPosControl() etc. https://docs.daz3d.com/public/software/dazstudio/4/referenceguide/scripting/api_reference/object_index/node_dz#a_1ab423cbff983e328b94694c50c6416688 will give the proerpties, then on that use oCtrl.setValue( 0 ) (for a non-animated scene) to zero them in turn, iif oCtrl is the variable used to store the value. Personally I would make it optional, or do more than one version of the script, as both zeroing and not zeroing the child properties can be useful at times (I wish it was an option in DS)

    I don't find setValue() in the list of commands on the documentation page you referenced. Trying to use it resulted in a script error. I'm not a Daz scripter, so I might likely be making an error. Any further suggestions? 

  • Richard HaseltineRichard Haseltine Posts: 110,158

    setValue(), which has several varaiants, is a method for float properties (which all of those are). You get the proeprty using the calls I mentioned, then you use their proeprty.setVlaue( 0 ); or whatever to adjust them. The setValues are here https://docs.daz3d.com/public/software/dazstudio/4/referenceguide/scripting/api_reference/object_index/floatproperty_dz .

    In general you can click on the return type in one page (for example, the DzFloatProperty in from of the get...Control entries here) to get taken to the page with details for that type of object.

Sign In or Register to comment.