How to get current texture image of Diffuse Color Property

jag11jag11 Posts: 885

I'm writing a script to change the Diffuse Color, but keeping the current texture image

This is the code to set the Diffuse Color property:


 g_oPresetHelper.setColorProperty( "Diffuse Color",  [ 255, 255, 255 ],
  "/Runtime/Textures/DAZ/Characters/Genesis2/Olympia/Olympia6FaceM.jpg" );

Question is, how do I get the current settings? in order to do:


        var currentTexture = getCurrentTextureFunction...
 g_oPresetHelper.setColorProperty( "Diffuse Color",  [ 255, 255, 255 ],
  currentTexture );

Any help would be appreciated. Thanks in advance.

Comments

  • Richard HaseltineRichard Haseltine Posts: 100,905
    edited December 1969

    I wouldn't use the presetHelper object - it was, as its name implies, a special object to abstract the functions of presets from the script to the application. Instead you can, once you have the surface, find its diffuse colour property with findProperty( name ) or findPropertyByLabel( label ), which will be a DzColorProperty, and then just use its setColorValue( color ) method without touching the map (which is available through getMapValue(), which will return a DzTexture which has getFilename() ).

  • jag11jag11 Posts: 885
    edited December 1969

    I wouldn't use the presetHelper object - it was, as its name implies, a special object to abstract the functions of presets from the script to the application. Instead you can, once you have the surface, find its diffuse colour property with findProperty( name ) or findPropertyByLabel( label ), which will be a DzColorProperty, and then just use its setColorValue( color ) method without touching the map (which is available through getMapValue(), which will return a DzTexture which has getFilename() ).

    Thanks Richard, I'll go that way.

Sign In or Register to comment.