Script request: Automatic scale UVW map to a specific size

Hi There,

I do create unwrapped UV maps for lots of objects that all need a UV map scaled in a special way, so all maps could use one texture (color only, with bumpiness). In this case a 5x5cm texture in size.

Is it possible to write a script that scales an relaxed and packed equalized island size UV map to a specific size, for example 5x5cm? Right now I check the object size and scale it manually.

Thank you very much for your help

Best regards,
Peter

1.jpg

Hello @peter-hofmann,

welcome to the Plugin Café and thank you for reaching out to us. Please read the Forum Guidelines for future questions. This is a forum about the development of Cinema 4D plugins and scripts run by Maxon to provide support for developers. Requests for scripts are not within the scope of the forum, and when they must be posted, they should be posted under General Talk.

I therefore have treated your question as a programming question. Please also note that we, Maxon, cannot provide full solutions.

The primary misconception of yours is that objects and vertices (or UV vertices in this case) would have an implicit unit as for example centimeters or meters. But they do not, all units you see in the interface are only an "illusion" for the end user. The data itself is unitless, e.g., an object has the width of five units, and not a width of five centimeters (although the interface might display it in that form). The same applies to UV islands, there are no UV-islands with the size 5*5cm, there are only UV islands where the UV-vertices all lie in the interval [0, 5] on both axis, i.e., a "5*5 units" UV-island.

You can manipulate UV vertices directly by reading and writing from a c4d.UvwTag or use c4d.modules.bodypaint.CallUVCommand to invoke one of the existing UV commands. We have an example for CallUVCommand on GitHub.

Cheers,
Ferdinand

Hi Ferdinand, thank you very much and thanks for placing it at correct location. Hopefully someone is able to help me out a bit since I am not a programmer just got an internal request, how to do it and need to find out how to solve it. You know same as always... 🙂

Well, helping out is generally my business. Although I have to admit, I have some problems understanding the actual goal.
If you like, contact me via job AT andreasblock DOT de