diff options
author | Dalai Felinto <dfelinto@gmail.com> | 2018-09-05 23:20:33 +0300 |
---|---|---|
committer | Dalai Felinto <dfelinto@gmail.com> | 2018-09-05 23:24:07 +0300 |
commit | 5dbf9e09a848c77f3e133a98695ce827daa726fa (patch) | |
tree | 856e20bee9f865b67c059a0879f61ee3489acb53 /release | |
parent | 2b83b36a30dfd4f699adc971c12e371983e75bc7 (diff) |
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).
Diffstat (limited to 'release')
-rw-r--r-- | release/scripts/startup/bl_operators/uvcalc_lightmap.py | 26 |
1 files changed, 25 insertions, 1 deletions
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 |