Getting Property Name

I'm having an issue where when I read a property name string, I gate a string with the text "Value".

  var oOwner = oProperty.getOwner();

var sPropertyLabel = oProperty.getLabel();

var sPropertyName = oProperty.name;

var sPropertyPath = oProperty.getPath();

var bPropertycanAutoFollow = oProperty.canAutoFollow();

var vPropertyMaxValue = oProperty.getMax();

var vPropertyMinValue = oProperty.getMin(); 

 

All these lines of code return correct values, but some Modifier/Shape properties (not all) don't return the name seen in the property spsemeter settings window.  I need this name because it's used during FBX export (not the label). 

 

Bruce

Comments

  • brucek5brucek5 Posts: 39

    Hi Richard,

    I tried the example code and prints nothing for for same properties I get the name of "Value".  These properties are for the Golen Palace GeoGraft. One thing I noticed in the properties window in the tb "Sub-Compontents" is it referes to items like "Z-Origin" which sounds like to moves a bone. The asset file path that ends with a ".dsf", has the same name that I'm trying to capture. So I tried:

    var assetSource = oProperty.assetSource.filePath;

    var assetUri = oProperty.assetUri.filePath;

    And both of these return an empty string, yet I can still get the Label, min-max, and all the key frames, just not the name.

     

    Bruce

  • OmnifluxOmniflux Posts: 377

    Look in the dsf file for the property you are getting this for (you must know the morph name for the property).

    /data/Vendor/Product/Item/Morphs/Vendor/Base/MorphName.dsf  - It may be compressed. You can uncompress with 7-Zip or in DS via Windows -> Panes -> Batch Convert if necessary.

    The JSON path you are looking for is '$.modifier_library[1].channel.name'. I'm sure the vendor did not name assign a unique name to the property and so the name actually is 'value' and what you are retrieving is correct.

  • brucek5brucek5 Posts: 39

    The channel names are "Value".

    But the file has asset information that matches what the property window shows. 

    So that means through script code there's no way to find it's asset file name too (see above code where the asset functons return empty strings)?  If I could get the assent file name, I could extract the name.

    The below functions all return empty strings:

    oProperty.assetUri.filePath

    oProperty.assetUri.toString()

    oProperty.assetSource.filePath

    oProperty.assetSource.toString()

    oProperty.assetID

     

    Bruce

  • TopologieTopologie Posts: 14
    edited January 14

    I realize this is a year late, and a bit of a hack, but I encountered the same issue today with property.getName() returning just "Value", where I was expecting a string like "head_bs_MouthRealism_HD3", like shown in the Parameter Settings dialog attached. I ended up having to parse it out of the ID path, like so:
     

    //var propName = oProperty.getName(); // Does not work, returns "Value" for many properties
    var uriToRoot = oProperty.buildIdUriToRoot().toString();
    var index0 = uriToRoot.indexOf("#")+1;
    var index1 = uriToRoot.indexOf(":");
    var propName = uriToRoot.substring(index0, index1);

    For all the properties I was trying to export via a DzSettings, the Id ends up being the name I needed with "Genesis9#" appened to the beginning, and ":?value" appened to the end, without exception. But this may not be true for all figures, so more specific parsing may be needed to generalize this. Ideally, Daz should fix this to match the panel, and add another API call for the channel name or wherever "Value" is coming from, if that's also still needed and not simply a bug.

    FWIW, you'll notice in the attached screenshot that the file name also contains the substring we're looking for, at least for this property. If what's above doesn't work for you, maybe look there?

    realname.png
    765 x 470 - 21K
    Post edited by Topologie on
  • CStratCStrat Posts: 30

    I'm dealing with this issue now.  So, we've establish why we're getting "value" for the name.  But I have a different issue:
    There doesn't seem to be a way to set the name?  Anyone know how to replace/change/set the name for a property?

  • OmnifluxOmniflux Posts: 377

    Can you give a specific example of what's not working? Setting the name for a property appears to work fine...

    Scene.getPrimarySelection().findProperty('XTranslate').name += " Renamed"

Sign In or Register to comment.