📋 Metadata
- Author: roaoao
- Date: 2020-02-11 10:29:44
- Type:
answer - Reply to: post_03018
- Replies (1): post_03021
💬 Content
HirasawaYui:
All objects have 2 UV cards. When you select all the objects and click on the map, the last object will have UVmap2 and the rest will have UVmap1. Is it possible to use PME to create a macro to select the last active UV map if all objects have the same number.
Add a new Regular Menu with 1 slot and use this code in Custom tab (or import this file):
uvs = sorted({k for obj in C.selected_objects if hasattr(obj.data, "uv_layers") for k in obj.data.uv_layers.keys()}); [operator(L, "pme.exec", text=uv, icon='UV', cmd="[setattr(obj.data.uv_layers, 'active', obj.data.uv_layers['%s']) for obj in C.selected_objects if hasattr(obj.data, 'uv_layers')]" % uv) for uv in uvs]
It generates a list of UVMap buttons which apply selected uvmap on selected objects
HirasawaYui:
How can I work with the “if, else, then and or” commands inside the PME.
If-else:
[True-execution] if [condition] [else] [False-execution]
If:
[True-execution] if [condition] [else] None
Also check this post
❤️ 4 likes