[Bf-blender-cvs] [5dbf9e09a84] blender2.8: UV_OT_lightmap_pack: Distinction between edit and object modes

Dalai Felinto noreply at git.blender.org
Wed Sep 5 22:25:30 CEST 2018


Commit: 5dbf9e09a848c77f3e133a98695ce827daa726fa
Author: Dalai Felinto
Date:   Wed Sep 5 17:20:33 2018 -0300
Branches: blender2.8
https://developer.blender.org/rB5dbf9e09a848c77f3e133a98695ce827daa726fa

UV_OT_lightmap_pack: Distinction between edit and object modes

I don't even know why this operator was ever made to work in object mode.
That said, since it does, we should have different options for it
(or rather, always do all faces for it).

===================================================================

M	release/scripts/startup/bl_operators/uvcalc_lightmap.py

===================================================================

diff --git a/release/scripts/startup/bl_operators/uvcalc_lightmap.py b/release/scripts/startup/bl_operators/uvcalc_lightmap.py
index 0db63576920..360a11dccca 100644
--- a/release/scripts/startup/bl_operators/uvcalc_lightmap.py
+++ b/release/scripts/startup/bl_operators/uvcalc_lightmap.py
@@ -647,11 +647,35 @@ class LightMapPack(Operator):
         default=0.1,
     )
 
+    def draw(self, context):
+        layout = self.layout
+        layout.use_property_split = True
+
+        is_editmode = context.active_object.mode == 'EDIT'
+        if is_editmode:
+            layout.prop(self, "PREF_CONTEXT")
+
+        layout.prop(self, "PREF_PACK_IN_ONE")
+        layout.prop(self, "PREF_NEW_UVLAYER")
+        layout.prop(self, "PREF_APPLY_IMAGE")
+        layout.prop(self, "PREF_IMG_PX_SIZE")
+        layout.prop(self, "PREF_BOX_DIV")
+        layout.prop(self, "PREF_MARGIN_DIV")
+
+    @classmethod
+    def poll(cls, context):
+        ob = context.active_object
+        return ob and ob.type == 'MESH'
+
     def execute(self, context):
         kwargs = self.as_keywords()
         PREF_CONTEXT = kwargs.pop("PREF_CONTEXT")
 
-        if PREF_CONTEXT == 'SEL_FACES':
+        is_editmode = context.active_object.mode == 'EDIT'
+
+        if not is_editmode:
+            kwargs["PREF_SEL_ONLY"] = False
+        elif PREF_CONTEXT == 'SEL_FACES':
             kwargs["PREF_SEL_ONLY"] = True
         elif PREF_CONTEXT == 'ALL_FACES':
             kwargs["PREF_SEL_ONLY"] = False



More information about the Bf-blender-cvs mailing list