Figure Metrics - No Dialog [SOLVE]

laichunhlaichunh Posts: 12

As the title said, does anyone can use the script to create a new Genesis 8 Female by using two json file? 

below is the document i am talking about.

http://docs.daz3d.com/doku.php/public/software/dazstudio/4/referenceguide/scripting/api_reference/samples/remote_operation/figure_metrics_no_dialog/start

I do try JSON.stringify('json') but could not work.

Any comments will be appreciate!

Post edited by laichunh on

Comments

  • What are you wanting to do? Load a figure and then run the Figure Metrics script on it?

  • Thanks for you reply!!

    Yes , I want to load a metric and run the figure metrics script on it. Actually, I do not want to manually adjust the figure, I want given variables and automatically apply variables on the figure. Therefore, I use the method which write in this website to try it. 

    The code below is in the website. and I thought it can use "configuration" to config the figure and use "measurements" to ajust the figure.

    runSilent(		{		"configuration": "Genesis2Female",		"measurements": "5 ft 8 in, 36-24-36",		//"tolerance": 0.0001,		//"maxIterations": 200,		//"save": "Characters/Figure Metrics/G2F Hourglass"		}	);
    And I look in detail, it said it can use JSON to apply the "configuration" and "measurements". just like the code I provide below. These codes also come from the website that I provide.
    {	"Genesis2Female": {		"Height": {			"Node": "Genesis2Female",			"Property": "Scale"		},		"BustChestCircumference": {			"Node": "Genesis2Female",			"Property": "CTRLBustCircumference"		},		"WaistCircumference": {			"Node": "Genesis2Female",			"Property": "PBMWaistCircumference"		},		"LowHipCircumference": {			"Node": "Genesis2Female",			"Property": "PBMLowHipCircumference"		}	}}
    {	"Genesis2Female": {		"Height": [			68,			"in"		],		"HeadCircumference": [			22.33,			"in"		],		"BustChestCircumference": [			36,			"in"		],		"WaistCircumference": [			24,			"in"		],		"LowHipCircumference": [			36,			"in"		]	}}

     

  • Are you applying the measure nodes wearables preset to your figure before rtrying to invoke the Figure Metrics script?

  • laichunhlaichunh Posts: 12
    edited September 2021

    I think I did not. I did not remember I am using wearables preset. Currently, I am using the basic Genesis 8 Femal. It only contains four parameters in the Figure Metrics panel. In the future, I want to use the advance Genesis 8 Femal which contains 25 parameters. I'll check it accurately and reply again to you when I back to home. 

    UPDATE:: I do applying the measure nodes wearables preset to my figure brfore invoke the Figure Metrics script. Also, I update the error message.

    ERROR.png
    1345 x 328 - 29K
    Post edited by laichunh on
  • oh Yes, I did apply the measure nodes wearables preset to my figure brfore invoke the Figure Metrics script

    and this is an error message show me it cannot find.

    ERROR.png
    1345 x 328 - 29K
  • Does it work if manually applied?

  • Yes, It work if I manually apply! but don't know why it cannot use the script to control it.

  • Have you saved a configuration preset named Genesis8Female? That is what it is looking for.

  • laichunhlaichunh Posts: 12
    edited September 2021

    Yes I have saved configuration preset named Genesis8Female.

    this is the code that I write in my script. 

    /*Eitehr var Configurations = String("%1/resources/Figure Metrics/Presets/Configurations/Genesis8Female").arg( App.getAppDataPath() );ORvar Configurations = String("%1/resources/Figure Metrics/Presets/Configurations/Genesis8Female/Genesis8Female").arg( App.getAppDataPath() );could not work*/var Configurations = String("%1/resources/Figure Metrics/Presets/Configurations/Genesis8Female")    .arg( App.getAppDataPath() );print(Configurations);var Measurement = String("%1/resources/Figure Metrics/Presets/Measurements/Genesis8Female")    .arg( App.getAppDataPath() )print(Measurement)	/*********************************************************************/// Run the Figure Metrics script silently	runSilent(	{	"configuration": Configurations,	"measurements": Measurement	//"tolerance": 0.0001,	//"maxIterations": 200,	//"save": "Characters/Figure Metrics/G2F Hourglass"	});

    Then I print out the

    Configuration path:

    C:/Users/ChunhaoLai/AppData/Roaming/DAZ 3D/Studio4/resources/Figure Metrics/Presets/Configurations/Genesis8Female

    Measurement path:

    C:/Users/ChunhaoLai/AppData/Roaming/DAZ 3D/Studio4/resources/Figure Metrics/Presets/Measurements/Genesis8Female

     

    Actually, I am not sure what we are going to put the file path or the json string after "configuration" and "measurements". However, I tried it both of them and could not work.

     The code below is using the json format string to assig to "configuration"

    var conf = '{"Genesis8Female": {"Height": {"Node": "Genesis2Female","Property": "Scale"},"BustChestCircumference": {"Node": "Genesis2Female","Property": "CTRLBustCircumference"},"WaistCircumference": {"Node": "Genesis2Female","Property": "PBMWaistCircumference"},"LowHipCircumference": {"Node": "Genesis2Female","Property": "PBMLowHipCircumference"}}}';print(conf);/*********************************************************************/// Run the Figure Metrics script silentlyrunSilent(	{	"configuration": conf,	"measurements": Measurement	//"tolerance": 0.0001,	//"maxIterations": 200,	//"save": "Characters/Figure Metrics/G2F Hourglass"	});

    I attach my path

    path.png
    1856 x 396 - 26K
    Post edited by laichunh on
  • Richard HaseltineRichard Haseltine Posts: 100,728
    edited September 2021

    If I am reading the script correctly, you are meant to pass only the sub folder name - Genesis2Female or whatever - not try to include the location within the AppData folder. I think you are sending the full path to Figure metrics, which it then appends to the relative path and produces nonsense.

    Edited to add: and just after I received a note Rob had posted:

    the directory where the presets for a figure reside is automatically defined - all that is needed is the name of the preset (the basename of the file), not the path to it

    Post edited by Richard Haseltine on
  • Oh God!!! It works.
    You saved my day!!! I don't even have the words to thank you!!

    Now, I can move on to figure out how to adjust on 25 parameters preset.

Sign In or Register to comment.