diff options
author | Nutti <nutti.metro@gmail.com> | 2018-11-17 15:11:55 +0300 |
---|---|---|
committer | Nutti <nutti.metro@gmail.com> | 2018-11-17 15:11:55 +0300 |
commit | 2532b96844c121b710e1a1973d2a5ff824ab3be4 (patch) | |
tree | c1f7682a77310f53ed4c2682b0788f73aa677d69 /uv_magic_uv/op/flip_rotate_uv.py | |
parent | 92ebf635ee2a9ddbc7fbf4a0c06b9732ee555b27 (diff) |
Magic UV: Release v5.2
* Bulit-in menu preferences
* Add-on updater
* Copy/Paste UV
* Add option "[New]" for pasting to newly allocated UV map
* Add option "[All]" for pasting all UV maps at once
* Align UV
* Add option "Mesh Influence"
* World Scale UV
* Add mode option "Manual" to allow the user specify the density manually
* Improve UI
* Cleanup documents
* Fix bugs
Diffstat (limited to 'uv_magic_uv/op/flip_rotate_uv.py')
-rw-r--r-- | uv_magic_uv/op/flip_rotate_uv.py | 62 |
1 files changed, 58 insertions, 4 deletions
diff --git a/uv_magic_uv/op/flip_rotate_uv.py b/uv_magic_uv/op/flip_rotate_uv.py index 30f6b0f7..751bb8fb 100644 --- a/uv_magic_uv/op/flip_rotate_uv.py +++ b/uv_magic_uv/op/flip_rotate_uv.py @@ -20,8 +20,8 @@ __author__ = "Nutti <nutti.metro@gmail.com>" __status__ = "production" -__version__ = "5.1" -__date__ = "24 Feb 2018" +__version__ = "5.2" +__date__ = "17 Nov 2018" import bpy import bmesh @@ -33,12 +33,59 @@ from bpy.props import ( from .. import common -class MUV_FlipRot(bpy.types.Operator): +__all__ = [ + 'Properties', + 'Operator', +] + + +def is_valid_context(context): + obj = context.object + + # only edit mode is allowed to execute + if obj is None: + return False + if obj.type != 'MESH': + return False + if context.object.mode != 'EDIT': + return False + + # only 'VIEW_3D' space is allowed to execute + for space in context.area.spaces: + if space.type == 'VIEW_3D': + break + else: + return False + + return True + + +class Properties: + @classmethod + def init_props(cls, scene): + scene.muv_flip_rotate_uv_enabled = BoolProperty( + name="Flip/Rotate UV Enabled", + description="Flip/Rotate UV is enabled", + default=False + ) + scene.muv_flip_rotate_uv_seams = BoolProperty( + name="Seams", + description="Seams", + default=True + ) + + @classmethod + def del_props(cls, scene): + del scene.muv_flip_rotate_uv_enabled + del scene.muv_flip_rotate_uv_seams + + +class Operator(bpy.types.Operator): """ Operation class: Flip and Rotate UV coordinate """ - bl_idname = "uv.muv_fliprot" + bl_idname = "uv.muv_flip_rotate_uv_operator" bl_label = "Flip/Rotate UV" bl_description = "Flip/Rotate UV coordinate" bl_options = {'REGISTER', 'UNDO'} @@ -60,6 +107,13 @@ class MUV_FlipRot(bpy.types.Operator): default=True ) + @classmethod + def poll(cls, context): + # we can not get area/space/region from console + if common.is_console_mode(): + return True + return is_valid_context(context) + def execute(self, context): self.report({'INFO'}, "Flip/Rotate UV") obj = context.active_object |