Quantcast
Channel: Daz Script Developer Discussion - Daz 3D Forums
Viewing all articles
Browse latest Browse all 1036

Error warning without scripting error? (Surface renaming)

$
0
0

Strange problem here: I'm trying to rename the G8 Surface "Torso" to G8.1 Surface "Body" (for a Geoshell). The script does what it should (without errors) - but I still get the message "Error: Result of expression fFind[null] is not an object " after the script has finished.

I'm not a great programmer, but I think I understand what's going on in most cases. I have found the snippet that I use for finding / renaming the Surface several times here in the forum ... without reference to the error message. So I must be doing something wrong. Here is the snippet:


var oShape = geoShellOBJ.getObject().getCurrentShape();

var oDZMaterial = oShape.findMaterial('Torso');

if (oDZMaterial) { ... }

The "if" triggers the error warning. I have tried it with everything possible (if (! oDZMaterial) etc. ... but the error message still appears. Strange - and like said before: this is the way others suggested.

Since it is a commercial project, I would like to remove the error message. Does anyone have any tips? Sorry in advance if I am late in getting back to you. I have a lot to do at the moment.

Here the forum threads with the snippets (and without reference to possible error messages):
https://www.daz3d.com/forums/discussion/547276/how-to-change-surface-name-by-using-script-correctly
https://www.daz3d.com/forums/discussion/365736/unable-to-define-surfaces-for-a-geoshell

Additional info:
the script runs “save” (within an empty function), the version is // DAZ Studio version 4.15.0.2 file type DAZ Script


Viewing all articles
Browse latest Browse all 1036

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>