Can we create a shortcut to select for example, hands, head, neck node, etc?

JamesJames Posts: 1,046
edited May 2023 in Daz Studio Discussion

Can we create a shortcut to select for example, hands, head, neck node, etc?

Post edited by James on

Comments

  • crosswindcrosswind Posts: 7,004
    edited May 2023

    Shortcut ? What kind of shortcut? What's the purpose of doing so ? Sometimes we create a IK chain for each node, then Group the IK chains. When manipulating the Group, there'll be some 'special effects' in terms of figure's pose... but not sure if that is what you want...

    Post edited by crosswind on
  • Richard HaseltineRichard Haseltine Posts: 101,043

    If uou had a figue selected (or one of its bones) a script could get the figure node, then find a child by label - have multiple scripts, on e for each bone, and those could be made into custom actions and assigned shortcuts.

  • ShelLuserShelLuser Posts: 749

    When in doubt... check the options. Press F3, expand the "Scene view" section and you'll see all the shortcuts that are available for mapping. Or: Window menu => Workspace => Customize. Alas, such an option doesn't seem to exist.

    But I also fail to see what the point of this would be?  Surely you'd be able to use either the scene pane, viewport or perhaps the aux viewport?  I often keep the aux viewport open which then gives me a broad overview of my scene; that also makes it easier to select certain items.

    Food for thought?

  • crosswindcrosswind Posts: 7,004
    edited May 2023

    Ho~ by pressing a Shortcut, then both hands will be selected, like that ?  A script can nearly do anything but is that really necessary ?  I'll never do that, just Ctrl + twice clicks....

    Post edited by crosswind on
  • JamesJames Posts: 1,046
    edited May 2023

    @crosswind
    @shelLuser
    yep.
    It is necessary in my case, where I pose characters for many images mulitple times.
    making things efficient like reducing even one step can have significant impact.

    Once you do that kind of thing, doing repetitive actions so many times, you'll see the reason.
     

    Post edited by James on
  • Seven193Seven193 Posts: 1,080

    Like RH said, it sounds like a job for a script.  And I think scripts can be setup as a hotkey too, right?

  • Richard HaseltineRichard Haseltine Posts: 101,043

    Seven193 said:

    Like RH said, it sounds like a job for a script.  And I think scripts can be setup as a hotkey too, right?

    Yes

  • JamesJames Posts: 1,046
    edited May 2023

    @Seven193
    I can't do script, don't understand how to.

    Does chatgpt know daz3d script?

    Post edited by James on
  • lilweeplilweep Posts: 2,493
    edited May 2023

    ChatGPT 3 gets a lot of things wrong with daz scripting and also general daz processes.  Not sure about the newest version 4. 

    I guess you could try it

    If i wanted to select the Head i would just click on the head though.

    Post edited by lilweep on
  • JamesJames Posts: 1,046
    edited May 2023

    @lilweep

    what is tha basic laguage that daz3d use?

    ----

    Yea... if that's the only thing you do. That would be more then sufficient.

    But what if you need also to select the upper neck and lower neck, or other parts and the angle position of the viewport doesn't allow it?
    You rotate the viewport, ,click it, hopefully you don't miss, cos you have to click it again, or you select from the scene pane, then you click the pose pane and start to bend, twist, etc.

    Imagine you need to select 1000 times. Each time you can't always get to what you want directly and have to repeat all the above most of the times.
    A shortcut would be very handy.

     

    Post edited by James on
  • Richard HaseltineRichard Haseltine Posts: 101,043

    In the case of the neck it may be simplest to click on the easy target (the head) and then select the neck in the Scene pane, since selecting the head will expand the hierarchy to there. Having a script for every bone would be unworkable, especially as noit all figures have the same hierarchy.

  • eeyuneeyun Posts: 25

    There's always the PowerPose panel

     

  • Seven193Seven193 Posts: 1,080
    edited May 2023

    James said:

    @Seven193
    I can't do script, don't understand how to.
     

    Fixed.

    I wrote this simple script without much trouble. Select a figure then run it.  It selects the left hand and all its child nodes.  Save to file or copy/paste here: Window -> Panes (Tabs) -> Script IDE.  You can obviously customize it to whatever you need. If you don't want to select child nodes, then just comment that section out.

    (function ()
    {
        var rootNode = Scene.getPrimarySelection();
        if (!rootNode) {
            MessageBox.critical( qsTr("Nothing selected."), qsTr("Warning"), qsTr("&OK") );
            return;
        }

     rootNode.select(false);


        if( rootNode.inherits("DzBone")) rootNode = rootNode.getSkeleton();
        if( !rootNode.inherits("DzSkeleton")) {
            MessageBox.critical( qsTr("Selection is not a figure."), qsTr("Warning"), qsTr("&OK") );
            return;
        }

     var nodeName = String("Left Hand");
     var findNode = rootNode.findNodeChildByLabel(nodeName,true);
     
     if(findNode) {

        print("Result: found node label.");
        findNode.select(true);

        // Select child nodes.  Comment out if don't want.
        var childNodes = findNode.getNodeChildren(true);
        for(var i=0; i < childNodes.length; i++) {
           childNodes[i].select(true);
        }
     }
     else {
        print("Result: couldn't find node label.");
     }

    })();
     

    Post edited by Seven193 on
  • Richard HaseltineRichard Haseltine Posts: 101,043

    Seven193 said:

    James said:

    @Seven193
    I can't do script, don't understand how to.
     

    It's easy.

    I wrote this simple script without much trouble. Select a figure then run it.  It selects the left hand and all its child nodes.  Save to file or copy/paste here: Window -> Panes (Tabs) -> Script IDE.  You can obviously customize it to whatever you need. If you don't want to select child nodes, then just comment that section out.

    (function ()
    {
        var rootNode = Scene.getPrimarySelection();
        if (!rootNode) {
            MessageBox.critical( qsTr("Nothing selected."), qsTr("Warning"), qsTr("&OK") );
            return;
        }

        if( rootNode.inherits("DzBone")) rootNode = rootNode.getSkeleton();
        if( !rootNode.inherits("DzSkeleton")) {
            MessageBox.critical( qsTr("Selection is not a figure."), qsTr("Warning"), qsTr("&OK") );
            return;
        }

     var nodeName = String("Left Hand");
     var findNode = rootNode.findNodeChildByLabel(nodeName,true);
     
     if(findNode) {

        print("Result: found node label.");
        findNode.select(true);

        // Select child nodes.  Comment out if don't want.
        var childNodes = findNode.getNodeChildren(true);
        for(var i=0; i < childNodes.length; i++) {
           childNodes[i].select(true);
        }
     }
     else {
        print("Result: couldn't find node label.");
     }

    })();

    That looks like one of Rob's samples, or possibly several averaged through ChatGPT.

  • crosswindcrosswind Posts: 7,004

    It should not be 'easy' for one who has no or less knowledge of Daz Script and development exp.~ and the root node of the figure should be unselected...

  • Seven193Seven193 Posts: 1,080
    edited May 2023

    crosswind said:

    It should not be 'easy' for one who has no or less knowledge of Daz Script and development exp.~ and the root node of the figure should be unselected...

    Well, if you want to search the entire scene (assuming there's only one character):

     var findNode = Scene.findNodeByLabel( "Left Hand" );

    But, if you have two or more characters in scene, then it's better to select the character first before doing anything.

    Btw, if you know Javascript, then you know Daz script, as they're based on the same scripting principals.  It's not too hard to pickup.

     

    Post edited by Seven193 on
  • Seven193Seven193 Posts: 1,080

    Richard Haseltine said:

    That looks like one of Rob's samples, or possibly several averaged through ChatGPT.

    I haven't tried that, but it sounds like a recipe for failure.

  • crosswindcrosswind Posts: 7,004
    edited May 2023

    Seven193 said:

    crosswind said:

    It should not be 'easy' for one who has no or less knowledge of Daz Script and development exp.~ and the root node of the figure should be unselected...

    Well, if you want to search the entire scene (assuming there's only one character):

     var findNode = Scene.findNodeByLabel( "Left Hand" );

    But, if you have two or more characters in scene, then it's better to select the character first before doing anything.

    Btw, if you know Javascript, then you know Daz script, as they're based on the same scripting principals.  It's not too hard to pickup.

     

    I meant, in your script...after the hand and its sub-nodes are selected, the genesis figure should be unselected as OP expected...  Well, I've been using Daz for nearly 7 years so more or less I know some Daz Script though I'm not a veteran.. But for newbies, we better suggest them go for a right way otherwise the result might turn out to be the opposite of their wish... esp. I don't think most of them can have quick learning of the script...

    Post edited by crosswind on
  • Seven193Seven193 Posts: 1,080

    That should be easy to fix.  Just add this line to deselect the primary selection, so only the target selection remains.

     rootNode.select(false);
     

  • JamesJames Posts: 1,046
    edited May 2023

    @seven193

    Thank you. This is what I need.

    But regarding this:
    rootNode.select(false);

    It only works when the character is selected.
    But not when the sub node / body part is selected.

    Post edited by James on
  • crosswindcrosswind Posts: 7,004
    edited May 2023

    See……奇怪的需求,难以引导,最终都被带进坑里~

    Post edited by crosswind on
  • JamesJames Posts: 1,046
    edited May 2023

    Scene.selectAllNodes (false);

    I think this is better?
    before selecting the node.
    I read at other thread how to deselect all

    Post edited by James on
  • Seven193Seven193 Posts: 1,080
    edited May 2023

    I see. Put the line right after:

        var rootNode = Scene.getPrimarySelection();
        if (!rootNode) {
            MessageBox.critical( qsTr("Nothing selected."), qsTr("Warning"), qsTr("&OK") );
            return;
        }
     rootNode.select(false);

    GetPrimarySelection() returns the last selected node, however the next line swaps it out for the skeleton root node:
    rootNode = rootNode.getSkeleton();

    So, deselection has to happen before rootNode variable gets swapped.

    Deselecting everything will work too, but deselecting one node is always faster than deselecting the entire scene if that's all you need to do.

     

    Post edited by Seven193 on
Sign In or Register to comment.