-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathBSResetPivotOrientation.py
39 lines (31 loc) · 1.11 KB
/
BSResetPivotOrientation.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
import bpy
import mathutils
objAxis = None
objTarget = None
rotAxis = None
locAxis = None
checkParams = ["BSAxis_"]
def main(context):
if bpy.context.active_object != None:
for obj in context.selected_objects:
bpy.ops.object.transform_apply(location=False, rotation=True, scale=False)
obj.delta_rotation_euler.x = 0.0
obj.delta_rotation_euler.y = 0.0
obj.delta_rotation_euler.z = 0.0
"""
With this operator we reset pivot orientation and avoid disparities produced by delta values
"""
class BSModifyPivot_OT_ResetPivotOrientation(bpy.types.Operator):
"""Reset pivot rotation transform"""
bl_idname = "object.bsmodify_pivot_reset_orientation"
bl_label = "BS Modify Reset Pivot Orientation"
@classmethod
def poll(cls, context):
return context.active_object is not None
def execute(self, context):
main(context)
return {"FINISHED"}
def register():
bpy.utils.register_class(BSModifyPivot_OT_ResetPivotOrientation)
def unregister():
bpy.utils.unregister_class(BSModifyPivot_OT_ResetPivotOrientation)