Changeset View
Changeset View
Standalone View
Standalone View
space_view3d_modifier_tools.py
| Context not available. | |||||
| self.report(type={"INFO"}, message=(message_a if not message_b else | self.report(type={"INFO"}, message=(message_a if not message_b else | ||||
| "Applying modifiers failed for {}".format(message_obj))) | "Applying modifiers failed for {}".format(message_obj))) | ||||
| if (collect_names and message_obj == "some objects (Check System Console)"): | if collect_names and message_obj == "some objects (Check System Console)": | ||||
| print("\n** MODIFIER SPECIALS REPORT **\n Applying failed on:\n", | print("\n** MODIFIER SPECIALS REPORT **\n Applying failed on:\n", | ||||
| ", ".join(collect_names)) | ", ".join(collect_names)) | ||||
| Context not available. | |||||
| message_a = "" | message_a = "" | ||||
| for mod in context.active_object.modifiers: | for mod in context.active_object.modifiers: | ||||
| if (mod.show_viewport): | if mod.show_viewport: | ||||
| is_apply = False | is_apply = False | ||||
| break | break | ||||
| for obj in context.selected_objects: | for obj in context.selected_objects: | ||||
| Context not available. | |||||
| def execute(self, context): | def execute(self, context): | ||||
| obj = context.active_object | obj = context.active_object | ||||
| if (len(obj.modifiers)): | if len(obj.modifiers): | ||||
| vs = 0 | vs = 0 | ||||
| for mod in obj.modifiers: | for mod in obj.modifiers: | ||||
| if (mod.show_expanded): | if mod.show_expanded: | ||||
| vs += 1 | vs += 1 | ||||
| else: | else: | ||||
| vs -= 1 | vs -= 1 | ||||
| is_close = False | is_close = False | ||||
| if (0 < vs): | if 0 < vs: | ||||
| is_close = True | is_close = True | ||||
| for mod in obj.modifiers: | for mod in obj.modifiers: | ||||
| mod.show_expanded = not is_close | mod.show_expanded = not is_close | ||||
| Context not available. | |||||
| # Menus # | # Menus # | ||||
| def menu(self, context): | def menu(self, context): | ||||
| if (context.active_object): | if context.active_object: | ||||
| if (len(context.active_object.modifiers)): | if len(context.active_object.modifiers): | ||||
| col = self.layout.column(align=True) | col = self.layout.column(align=True) | ||||
| row = col.row(align=True) | row = col.row(align=True) | ||||
| Context not available. | |||||
| def menu_func(self, context): | def menu_func(self, context): | ||||
| if (context.active_object): | if context.active_object: | ||||
| if (len(context.active_object.modifiers)): | if len(context.active_object.modifiers): | ||||
| layout = self.layout | layout = self.layout | ||||
| layout.separator() | layout.separator() | ||||
| layout.operator(ApplyAllModifiers.bl_idname, | layout.operator(ApplyAllModifiers.bl_idname, | ||||
| Context not available. | |||||