Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'release/scripts/templates/operator_uv.py')
-rw-r--r--release/scripts/templates/operator_uv.py13
1 files changed, 7 insertions, 6 deletions
diff --git a/release/scripts/templates/operator_uv.py b/release/scripts/templates/operator_uv.py
index 1003bd6c58b..a18aaf358c8 100644
--- a/release/scripts/templates/operator_uv.py
+++ b/release/scripts/templates/operator_uv.py
@@ -15,21 +15,23 @@ def main(context):
# adjust UVs
for i, uv in enumerate(mesh.active_uv_texture.data):
uvs = uv.uv1, uv.uv2, uv.uv3, uv.uv4
- for j, v_idx in enumerate(mesh.faces[i].verts):
- if uv.uv_selected[j]:
+ for j, v_idx in enumerate(mesh.faces[i].vertices):
+ if uv.select_uv[j]:
# apply the location of the vertex as a UV
- uvs[j][:] = mesh.verts[v_idx].co.xy
+ uvs[j][:] = mesh.vertices[v_idx].co.xy
if is_editmode:
bpy.ops.object.mode_set(mode='EDIT', toggle=False)
+
class UvOperator(bpy.types.Operator):
- ''''''
+ '''UV Operator description'''
bl_idname = "uv.simple_operator"
bl_label = "Simple UV Operator"
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
obj = context.active_object
return (obj and obj.type == 'MESH')
@@ -37,7 +39,6 @@ class UvOperator(bpy.types.Operator):
main(context)
return {'FINISHED'}
-bpy.types.register(UvOperator)
if __name__ == "__main__":
bpy.ops.uv.simple_operator()