How to check if normal map is mapped and read the map?

V3DigitimesV3Digitimes Posts: 3,150
edited December 1969 in Daz Script Developer Discussion

Hello,
I'm trying to grab the normal maps of a material, and for that of course I begin by checking the "oProperty.isMapped".

It works for the other maps (Diffuse, bump, ...). But for normal map I keep on having the message saying :

for the code :

if ((oNames == "Normal Map") && oProperty.isMapped())

Script Error: Line 680
TypeError: Result of expression 'oProperty.isMapped' [undefined] is not a function.
The same way, I cannot use the getMapValue on the property.
Yet I do exactly as I do for other surfaces?

Does any one has a clue if there is something specific with normal maps?

Comments

  • millighostmillighost Posts: 261
    edited December 1969

    Kadix said:
    Hello,
    I'm trying to grab the normal maps of a material, and for that of course I begin by checking the "oProperty.isMapped".

    It works for the other maps (Diffuse, bump, ...). But for normal map I keep on having the message saying :

    for the code :

    if ((oNames == "Normal Map") && oProperty.isMapped())
    ....

    Normal maps are not Colors or Floats (no default value); most likely they are ImageProperties, so use something like this:

    
    if ((oNames == "Normal Map") && oProperty.getValue () !== null) {
       /* normal map is set.... */
    }
    
  • Richard HaseltineRichard Haseltine Posts: 100,886
    edited December 1969

    If you put

    print( oNames + " is a " + oProperty.className() );

    in your script, at a point where those are defined, you can get a list of the object types for the properties (to the bottom of the ScriptIDE if you are running from there, or to the log file if you are running from a script file).

  • V3DigitimesV3Digitimes Posts: 3,150
    edited December 1969

    Thanks a lot both for your help!
    Indeed, when I run the script, "Normal Map is a DzImageProperty".
    I totally ignored Normal maps were treated differently.
    Now I just have to find out what I'm gonna do with that!

Sign In or Register to comment.