Question: How to script simple "if there is UV"-condition

Hi everybody,
I would like to make a simple script part, to set my UV by default on maximum of 8192.
Problem: That’s only possible when that mesh has an UV. Otherwise I get an error message and the script stops
(and there are also more adfjustments in that script, which should be done regardless if UV exists or not)

I looked through the zScripting tutorials, but couldn’t find out, how to query the condition “is there UV”.
I am also new to this stuff (I know just basics of MEL scripting).
I guess it has to begin with "[VarDef… " ?
And if my script find’s out there is no UV existing, is there a “do nothing”-command? I want it not to exit then, but to execute the other script parts.

Many thanks for help!

You can set the UV Map Size provided there is a polymesh selected. The mesh doesn’t have to have UVs already. You can do it like this:

[If,[IExists,Tool:UV Map:UV Map Size],
[ISet,Tool:UV Map:UV Map Size,8192]
]

This code will set the map size if available. Any code outside the If command block will run regardless.

Note that the map size is set on a per-tool or subtool basis, so you cannot use this method to have 8192 as the default.

thanks a lot!