-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
operator_remove_modifier_from_inspector.py
43 lines (30 loc) · 1.52 KB
/
operator_remove_modifier_from_inspector.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import bpy
from .functions import getSelectedObjects, getSelectedBonesFCurves, getSelectedFCurves, redrawContextAreas, returnFCurve
#operator to remove modifier
class FCurveHelperRemoveModifierInspector(bpy.types.Operator):
"""Remove this Modifier"""
bl_idname = "fcurvehelper.remove_modifier_inspector"
bl_label = "Remove Modifiers"
bl_options = {'UNDO', 'INTERNAL'}
object_name : bpy.props.StringProperty()
fcurve_datapath : bpy.props.StringProperty()
fcurve_arrayindex : bpy.props.IntProperty()
modifier_index : bpy.props.IntProperty()
@classmethod
def poll(cls, context):
return True
def execute(self, context):
wm = context.window_manager
if wm.fcurvehelper_debug: print("FCurveHelper --- starting remove operator from inspector") ###debug
obj = bpy.data.objects[self.object_name]
if returnFCurve(obj, self.fcurve_datapath, self.fcurve_arrayindex):
curve = returnFCurve(obj, self.fcurve_datapath, self.fcurve_arrayindex )
modifier = curve.modifiers[self.modifier_index]
if wm.fcurvehelper_debug: print("FCurveHelper --- %s removing" % modifier.type) ###debug
curve.modifiers.remove(modifier)
curve.modifiers.update()
### TODO ### print log
### TODO ### return info log
redrawContextAreas(context)
context.scene.frame_current = context.scene.frame_current
return {'FINISHED'}