1. #1
    Senior Member Follow User Gallery
    Join Date
    Dec 2016
    Location
    Germany
    Posts
    175

    Question 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!

  2. #2
    Moderator Follow User Gallery
    Join Date
    Jun 2004
    Location
    UK
    Posts
    11,462

    Default

    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.

  3. #3
    Senior Member Follow User Gallery
    Join Date
    Dec 2016
    Location
    Germany
    Posts
    175

    Thumbs up

    thanks a lot!

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •