-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathBSDeltaToTransform.py
52 lines (40 loc) · 1.63 KB
/
BSDeltaToTransform.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
44
45
46
47
48
49
50
51
52
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:
obj.location.x = obj.location.x +obj.delta_location.x
obj.location.y = obj.location.y + obj.delta_location.y
obj.location.z = obj.location.z + obj.delta_location.z
obj.rotation_euler.x = obj.rotation_euler.x + obj.delta_rotation_euler.x
obj.rotation_euler.y = obj.rotation_euler.y + obj.delta_rotation_euler.y
obj.rotation_euler.z = obj.rotation_euler.z + obj.delta_rotation_euler.z
obj.delta_rotation_euler.x = 0.0
obj.delta_rotation_euler.y = 0.0
obj.delta_rotation_euler.z = 0.0
obj.delta_location.x = 0.0
obj.delta_location.y = 0.0
obj.delta_location.z = 0.0
##bpy.ops.object.transform_apply(location=True, rotation=False, scale=False)
"""
With this operator we reset pivot orientation and avoid disparities produced by delta values
"""
class BSModifyPivot_OT_deltaToTransform(bpy.types.Operator):
"""Transfers delta transform"""
bl_idname = "object.bsdelta_to_transform"
bl_label = "BS Delta to transform"
@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_deltaToTransform)
def unregister():
bpy.utils.unregister_class(BSModifyPivot_OT_deltaToTransform)