Memorize and restore items by script?
weird-grafx
Posts: 45
Hi,
can one of the script gurus tell me how to execute a menu command by script?
Epecially the [Edit]\[Object]\[Memorize]\[Memorize Selected Item(s)] and [Edit]\[Object]\[Restore]\[Restore Selected Item(s)] commands?
I know how I select items by code, but now I need to memorize the selected ones.
Best regards
Stefan
Comments
Memorise iss etting the default values, so the script would need to edit and recover the defaults. Do bear in mind that chnaging the defaults can cause issues (e.g. when saving assets, in the Parameetrs pane showing Currently Used proerpties).
Yes it does - get the selected nodes, get their proeprties, set their default values to their current values to memorise. Get the default value and set the current value to that for restore. e.g. http://docs.daz3d.com/doku.php/public/software/dazstudio/4/referenceguide/scripting/api_reference/object_index/numericproperty_dz#a_1a22da61d8538104c1cfbf18190d95a422 , http://docs.daz3d.com/doku.php/public/software/dazstudio/4/referenceguide/scripting/api_reference/object_index/numericproperty_dz#a_1a1d26ca7c6384c855b99cb3706f685d7d
You have to find the associated DzAction.
Memorize Selected Item(s)
MainWindow.getActionMgr().findAction('Memorize Selected Item(s)').trigger();Restore Selected Item(s)
MainWindow.getActionMgr().findAction('Restore Selected Item(s)').trigger();findAction() needs the class name of the action, not the text of the menu command. http://docs.daz3d.com/doku.php/public/software/dazstudio/4/referenceguide/scripting/api_reference/object_index/actionmgr_dz#a_1ab02d78060ea51efd118732925cc9ec00
Not sure what I was thinking when I typed that out.
Memorize Selected Item(s)
Restore Selected Item(s)