Trigger Action Rigidity Group - Don't Prompt user for Name?

Hi,

I got this script from one of the daz help pages - is there anyway to prevent a user dialog prompting for the name of the rigidity group, but supply the name along with the trigger_action() call itself? The settings variable doesn't appear to be helping at all, even though I understand that should suffice. I still get the pop up anyway asking for rigidity group which must be manually fed. This is very annoying - is there a solution?

function trigger_action(action_mgr, sClassName, oSettings) {    if (!action_mgr) {        MessageBox.warning(             text("Action mananager is not available."), text("Resource Error"), text("&OK"), "");        return;    }    var oAction = action_mgr.findAction(sClassName);    if (!oAction) {        MessageBox.warning(text("The \"%1\" action could not be found.").arg(sClassName), text("Resource Error"), text("&OK"), "");        return;    }    if (!oAction.enabled) {        MessageBox.warning(             text("The \"%1\" action is currently disabled.").arg(oAction.text), text("Resource Error"), text("&OK"), "");        return;    }        // If we have the necessary function (4.16.1.18) and we have settings    if (typeof(oAction.triggerWithSettings) == "function" && oSettings) {        // Trigger execution of the action with the settings        print("tigger_action: tiggering <" + sClassName + "> with settings!");        oAction.triggerWithSettings(oSettings);    } else {        oAction.trigger();    }}var action_mgr = MainWindow.getActionMgr();var settings = { "RunSilent": true, "Name": 'MyRigidityGroup', "Label": 'MyRigidityGroup' };trigger_action(action_mgr, "DzPGECreateRigidityGroupFromSelectionAction", settings);

 

Edit: Is it just me or is CR/LF nor parsed correctly for code snippets on this  forum? My entire code snippets after saving appears as a single line?

Post edited by bittermiasma on

Comments

  • Richard HaseltineRichard Haseltine Posts: 100,888

    The license does require that you provide a link to the actual script, not just say "one of them". And yes, code blocks on the forum have been broken for some time.

  • bittermiasmabittermiasma Posts: 5
    edited May 19

    So no solution to my answer? Here is the link to the license:

    https://creativecommons.org/licenses/by/3.0/

    I am free to "copy and redistribute the material in any medium or format for any purpose, even commercially."  http://docs.daz3d.com/doku.php/public/software/dazstudio/4/referenceguide/scripting/api_reference/samples/actions/action_trigger/start

    Ok now that boilerplate is out of the way, is there a solution?

    Post edited by bittermiasma on
  • Richard HaseltineRichard Haseltine Posts: 100,888

    Following the license terms for the samples that have generousdly been provided to help us should not be dismissed as boilerplate - especailly if you are, in effect, asking for help from their author (this is definitely not soemthing I can answer off the top of my head).

    Have you looked at the with settings example http://docs.daz3d.com/doku.php/public/software/dazstudio/4/referenceguide/scripting/api_reference/samples/actions/action_trigger/start#example_with_settings ? If that doesn't help I am not sure there is a way to avoid the request for a name using the DzAction to do the work, though it is not something I have tried.

  • Richard HaseltineRichard Haseltine Posts: 100,888

    Richard Haseltine said:

    Following the license terms for the samples that have generousdly been provided to help us should not be dismissed as boilerplate - especailly if you are, in effect, asking for help from their author (this is definitely not soemthing I can answer off the top of my head).

    Have you looked at the with settings example http://docs.daz3d.com/doku.php/public/software/dazstudio/4/referenceguide/scripting/api_reference/samples/actions/action_trigger/start#example_with_settings ? If that doesn't help I am not sure there is a way to avoid the request for a name using the DzAction to do the work, though it is not something I have tried.

    This ation doesn't (yet) have a Settings input, so there is no way to avoid the request unless you can break down the action into steps and implemet your own version (I have no idea if the necessary objects and methods are available for that). The change log should tell you which actions do take settings objects, for the most part.

  • bittermiasmabittermiasma Posts: 5
    edited May 19

    I thought about doing that - but where is the API for creating a rigidity group documented, if there even is an API exposed to DSON? Is there C++ API for this - if so, where would that be documented? I see you said you have no idea, does that mean I'm out of luck? I have a list of actions which tell me which ones take a settings object. Knowing this unfortunately doesn't help me solve the problem of actually creating the rigidity group without user prompt, unless you mean something else entirely?

    EDIT:

    I was somehow able to make things easier for me by having DSON copy the rigidity group name to windows clipboard which I can easily CTRL+V (paste) to sort things out. Not ideal, but much better than typing names manually.

    Now I have a larger issue that I couldn't solve. I would also want to add facet groups as a rigidity reference to a rigidity group using DSON. There is no DzAction that exposes this feature when I checked - it has to be done manually with mouse & menu clicks. Can this feature also be added to DSON if it doesn't already exist?

    EDIT2:

    Ok - it seems like there is some documentation on Daz meta data for rigidity groups - basically looks exactly like JSON/DSON. I have never tried to edit .DUF or any other daz file metadata before, but is this something that other people often do considering its been documented? I would have to check how to actually edit and save the data, I'll look it up tomorrow as I'm dead tired right now. I can't imagine this being the right way to go as version changes in Daz might propagate changes in Daz metadata structures/trees?

    Link to rigidity metadata info: http://docs.daz3d.com/doku.php/public/dson_spec/object_definitions/rigidity/start

    Edit3:

    Ok last edit I promise. Thinking about it - maybe editing metadata is fine after all since upper versions of Daz would be expected to open previous Daz version files, so I'm assuming maintaining metadata structures & trees would be a default choice to ensure compatiblity? I'm just overthinking this aren't I?

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