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).
This commit is contained in:
Dalai Felinto 2018-09-05 17:20:33 -03:00
parent 2b83b36a30
commit 5dbf9e09a8
1 changed files with 25 additions and 1 deletions

View File

@ -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