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:
authorJacques Lucke <mail@jlucke.com>2019-06-06 15:36:08 +0300
committerJacques Lucke <mail@jlucke.com>2019-06-06 15:36:08 +0300
commit54021da58bb0a593cbdfa38317d2d8a16fa1780c (patch)
tree72a86eab9bb3a47644b62aafb050e4f6cca164e9
parentfbd9c09ef0cb91a1c19a1a43cbc69856efc6d989 (diff)
Python Templates: fix operator_mesh_uv template
-rw-r--r--release/scripts/templates_py/operator_mesh_uv.py16
1 files changed, 8 insertions, 8 deletions
diff --git a/release/scripts/templates_py/operator_mesh_uv.py b/release/scripts/templates_py/operator_mesh_uv.py
index 4d25b7af37e..bf893480f2f 100644
--- a/release/scripts/templates_py/operator_mesh_uv.py
+++ b/release/scripts/templates_py/operator_mesh_uv.py
@@ -9,13 +9,12 @@ def main(context):
uv_layer = bm.loops.layers.uv.verify()
- # adjust UVs
- for f in bm.faces:
- for l in f.loops:
- luv = l[uv_layer]
- if luv.select:
- # apply the location of the vertex as a UV
- luv.uv = l.vert.co.xy
+ # adjust uv coordinates
+ for face in bm.faces:
+ for loop in face.loops:
+ loop_uv = loop[uv_layer]
+ # use xy position of the vertex as a uv coordinate
+ loop_uv.uv = loop.vert.co.xy
bmesh.update_edit_mesh(me)
@@ -27,7 +26,8 @@ class UvOperator(bpy.types.Operator):
@classmethod
def poll(cls, context):
- return (context.mode == 'EDIT_MESH')
+ obj = context.active_object
+ return obj and obj.type == 'MESH' and obj.mode == 'EDIT'
def execute(self, context):
main(context)