Is there a quick way to parent an object in a complex scene?
background
Posts: 810
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.

Comments
You can drag items in the scene panel to reparent them.
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).
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.
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.
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.
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.
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.
Any volunteers are very welcome, no pressure, but if someone can do it I'd be very grateful.
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.
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 ); }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.
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'.
Thanks Wolfwood, I very much appreciate your taking the time to create that.
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.
"Parent in palce" = "Parent in place", I assume.
Thank for this. It looks helpful.
As long as I didn't typo the code (well, as long as I fixed the various points at which did typo the code) ...
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.
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.
// 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.
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.
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
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)
Thanks for the various solutions people have suggested.
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?
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.