diff --git a/__init__.py b/__init__.py index aa8ad7e..6297e0e 100644 --- a/__init__.py +++ b/__init__.py @@ -20,13 +20,13 @@ bl_info = { "name": "Modifier List", - "author": "Antti Tikka", - "version": (1, 8, 0), + "author": "Antti Tikka, Draise", + "version": (1, 7, 6), "blender": (2, 92, 0), "location": "Properties Editor & View3D > Sidebar & View3D > Alt + Spacebar", "description": "Alternative UI layout for modifiers with handy features " "+ a Sidebar tab and a popup.", - "warning": "Development version", + "warning": "", "doc_url": "https://github.com/Symstract/modifier_list", "category": "3D View" } diff --git a/modules/operators/modifier_add.py b/modules/operators/modifier_add.py index a90ddb1..b59dfe1 100644 --- a/modules/operators/modifier_add.py +++ b/modules/operators/modifier_add.py @@ -34,11 +34,16 @@ def execute(self, context): init_active_mod_index = ob.ml_modifier_active_index # Make adding modifiers possible when an object is pinned - override = context.copy() - override['object'] = ob + + ### Draise - Removed for compatibility with 4.0.0 + #override = context.copy() + #override['object'] = ob + + ### Draise - Added the "with" for compatibility with 4.0.0 try: - bpy.ops.object.modifier_add(override, type=self.modifier_type) + with context.temp_override(id=ob): + bpy.ops.object.modifier_add(type=self.modifier_type) except TypeError: for mod in ALL_MODIFIERS_NAMES_ICONS_TYPES: if mod[2] == self.modifier_type: diff --git a/modules/operators/modifier_apply.py b/modules/operators/modifier_apply.py index 64b223e..ab29f28 100644 --- a/modules/operators/modifier_apply.py +++ b/modules/operators/modifier_apply.py @@ -185,8 +185,12 @@ def invoke(self, context, event): def apply_modifier(self, context, ml_active_object, init_mode_is_editmode): # Make applying modifiers possible when an object is pinned - override = context.copy() - override['object'] = ml_active_object + + ### Draise - removed for Blender 4.0.0 compatibility + + #override = context.copy() + #override['object'] = ml_active_object + active_mod_index = ml_active_object.ml_modifier_active_index mod = ml_active_object.modifiers[active_mod_index] mod_type = mod.type @@ -194,7 +198,8 @@ def apply_modifier(self, context, ml_active_object, init_mode_is_editmode): try: if self.apply_as == 'DATA': - bpy.ops.object.modifier_apply(override, modifier=mod_name) + with context.temp_override(id=ml_active_object): ### Draise - added "with" for Blender 4.0.0 compatibility + bpy.ops.object.modifier_apply(modifier=mod_name) elif self.apply_as == 'SHAPE': bpy.ops.object.modifier_apply_as_shapekey( override, modifier=mod_name, diff --git a/modules/operators/modifier_copy.py b/modules/operators/modifier_copy.py index bb3329e..c66dafe 100644 --- a/modules/operators/modifier_copy.py +++ b/modules/operators/modifier_copy.py @@ -29,9 +29,13 @@ def execute(self, context): mod = ob.modifiers[ob.ml_modifier_active_index] # Make copying modifiers possible when an object is pinned - override = context.copy() - override['object'] = ob + + ### Draise - removed for Blender 4.0.0 compatibility - bpy.ops.object.modifier_copy(override, modifier=mod.name) + #override = context.copy() + #override['object'] = ob + + with context.temp_override(id=ob): ### Draise - added "with" for Blender 4.0.0 compatibility + bpy.ops.object.modifier_copy(modifier=mod.name) return {'FINISHED'} diff --git a/modules/operators/modifier_move_down.py b/modules/operators/modifier_move_down.py index bb3a8f0..4bb7619 100644 --- a/modules/operators/modifier_move_down.py +++ b/modules/operators/modifier_move_down.py @@ -41,8 +41,11 @@ def execute(self, context): ml_active_ob = get_ml_active_object() # Make using operators possible when an object is pinned - override = context.copy() - override['object'] = ml_active_ob + + ### Draise - removed for Blender 4.0.0 compatibility + + #override = context.copy() + #override['object'] = ml_active_ob active_mod_index = ml_active_ob.ml_modifier_active_index active_mod_name = ml_active_ob.modifiers[active_mod_index].name @@ -54,8 +57,9 @@ def execute(self, context): index=mods_max_index) ml_active_ob.ml_modifier_active_index = mods_max_index else: - bpy.ops.object.modifier_move_down(override, modifier=active_mod_name) - ml_active_ob.ml_modifier_active_index = np.clip(active_mod_index + 1, 0, mods_max_index) + with context.temp_override(id=ml_active_ob): ### Draise - added "with" for Blender 4.0.0 compatibility + bpy.ops.object.modifier_move_down(modifier=active_mod_name) + ml_active_ob.ml_modifier_active_index = np.clip(active_mod_index + 1, 0, mods_max_index) return {'FINISHED'} diff --git a/modules/operators/modifier_move_up.py b/modules/operators/modifier_move_up.py index a06b68d..1987961 100644 --- a/modules/operators/modifier_move_up.py +++ b/modules/operators/modifier_move_up.py @@ -41,8 +41,11 @@ def execute(self, context): ml_active_ob = get_ml_active_object() # Make using operators possible when an object is pinned - override = context.copy() - override['object'] = ml_active_ob + + ### Draise - removed for Blender 4.0.0 compatibility + + #override = context.copy() + #override['object'] = ml_active_ob active_mod_index = ml_active_ob.ml_modifier_active_index active_mod_name = ml_active_ob.modifiers[active_mod_index].name @@ -51,8 +54,9 @@ def execute(self, context): bpy.ops.object.modifier_move_to_index(modifier=active_mod_name, index=0) ml_active_ob.ml_modifier_active_index = 0 else: - bpy.ops.object.modifier_move_up(override, modifier=active_mod_name) - ml_active_ob.ml_modifier_active_index = np.clip(active_mod_index - 1, 0, 999) + with context.temp_override(id=ml_active_ob): ### Draise - added "with" for Blender 4.0.0 compatibility + bpy.ops.object.modifier_move_up(modifier=active_mod_name) + ml_active_ob.ml_modifier_active_index = np.clip(active_mod_index - 1, 0, 999) return {'FINISHED'} diff --git a/modules/operators/modifier_remove.py b/modules/operators/modifier_remove.py index 57e287f..038d410 100644 --- a/modules/operators/modifier_remove.py +++ b/modules/operators/modifier_remove.py @@ -41,8 +41,11 @@ def execute(self, context): ml_active_ob = get_ml_active_object() # Make using operators possible when an object is pinned - override = context.copy() - override['object'] = ml_active_ob + + ### Draise - removed for Blender 4.0.0 compatibility + + #override = context.copy() + #override['object'] = ml_active_ob active_mod_index = ml_active_ob.ml_modifier_active_index active_mod = ml_active_ob.modifiers[active_mod_index] @@ -50,7 +53,9 @@ def execute(self, context): if self.shift or prefs.always_delete_gizmo: self.remove_gizmo_and_vertex_group(context, ml_active_ob, active_mod) - bpy.ops.object.modifier_remove(override, modifier=active_mod.name) + ### Draise - added "with" for Blender 4.0.0 compatibility + with context.temp_override(id=ml_active_ob): + bpy.ops.object.modifier_remove(modifier=active_mod.name) ml_active_ob.ml_modifier_active_index = np.clip(active_mod_index - 1, 0, 999) return {'FINISHED'}