[Bf-blender-cvs] [1de11c38d4d] master: Cleanup: assign rotation_mode to a variable

Campbell Barton noreply at git.blender.org
Tue Feb 26 04:32:50 CET 2019


Commit: 1de11c38d4dae96c57d5580a77631093b3e8c33a
Author: Campbell Barton
Date:   Tue Feb 26 14:13:30 2019 +1100
Branches: master
https://developer.blender.org/rB1de11c38d4dae96c57d5580a77631093b3e8c33a

Cleanup: assign rotation_mode to a variable

Don't access multiple times per draw.

===================================================================

M	release/scripts/startup/bl_ui/properties_data_bone.py
M	release/scripts/startup/bl_ui/properties_object.py

===================================================================

diff --git a/release/scripts/startup/bl_ui/properties_data_bone.py b/release/scripts/startup/bl_ui/properties_data_bone.py
index 3a7f348efa5..cc70b7d810f 100644
--- a/release/scripts/startup/bl_ui/properties_data_bone.py
+++ b/release/scripts/startup/bl_ui/properties_data_bone.py
@@ -78,16 +78,14 @@ class BONE_PT_transform(BoneButtonsPanel, Panel):
             sub.prop(pchan, "lock_location", text="")
 
             col = layout.column()
-            if pchan.rotation_mode == 'QUATERNION':
+            rotation_mode = pchan.rotation_mode
+            if rotation_mode == 'QUATERNION':
                 sub = col.row(align=True)
                 sub.prop(pchan, "rotation_quaternion", text="Rotation")
                 subsub = sub.column(align=True)
                 subsub.prop(pchan, "lock_rotation_w", text="")
                 subsub.prop(pchan, "lock_rotation", text="")
-            elif pchan.rotation_mode == 'AXIS_ANGLE':
-                # col.label(text="Rotation")
-                #col.prop(pchan, "rotation_angle", text="Angle")
-                #col.prop(pchan, "rotation_axis", text="Axis")
+            elif rotation_mode == 'AXIS_ANGLE':
                 sub = col.row(align=True)
                 sub.prop(pchan, "rotation_axis_angle", text="Rotation")
                 subsub = sub.column(align=True)
diff --git a/release/scripts/startup/bl_ui/properties_object.py b/release/scripts/startup/bl_ui/properties_object.py
index b7367a80e12..2ec7f1df3a0 100644
--- a/release/scripts/startup/bl_ui/properties_object.py
+++ b/release/scripts/startup/bl_ui/properties_object.py
@@ -60,7 +60,8 @@ class OBJECT_PT_transform(ObjectButtonsPanel, Panel):
         row.use_property_decorate = False
         row.prop(ob, "lock_location", text="", emboss=False, icon='DECORATE_UNLOCKED')
 
-        if ob.rotation_mode == 'QUATERNION':
+        rotation_mode = ob.rotation_mode
+        if rotation_mode == 'QUATERNION':
             col = flow.column()
             row = col.row(align=True)
             row.prop(ob, "rotation_quaternion", text="Rotation")
@@ -68,10 +69,7 @@ class OBJECT_PT_transform(ObjectButtonsPanel, Panel):
             sub.use_property_decorate = False
             sub.prop(ob, "lock_rotation_w", text="", emboss=False, icon='DECORATE_UNLOCKED')
             sub.prop(ob, "lock_rotation", text="", emboss=False, icon='DECORATE_UNLOCKED')
-        elif ob.rotation_mode == 'AXIS_ANGLE':
-            # row.column().label(text="Rotation")
-            #row.column().prop(pchan, "rotation_angle", text="Angle")
-            #row.column().prop(pchan, "rotation_axis", text="Axis")
+        elif rotation_mode == 'AXIS_ANGLE':
             col = flow.column()
             row = col.row(align=True)
             row.prop(ob, "rotation_axis_angle", text="Rotation")
@@ -114,13 +112,10 @@ class OBJECT_PT_delta_transform(ObjectButtonsPanel, Panel):
         col.prop(ob, "delta_location")
 
         col = flow.column()
-        if ob.rotation_mode == 'QUATERNION':
+        rotation_mode = ob.rotation_mode
+        if rotation_mode == 'QUATERNION':
             col.prop(ob, "delta_rotation_quaternion", text="Rotation")
-        elif ob.rotation_mode == 'AXIS_ANGLE':
-            # row.column().label(text="Rotation")
-            #row.column().prop(pchan, "delta_rotation_angle", text="Angle")
-            #row.column().prop(pchan, "delta_rotation_axis", text="Axis")
-            #row.column().prop(ob, "delta_rotation_axis_angle", text="Rotation")
+        elif rotation_mode == 'AXIS_ANGLE':
             col.label(text="Not for Axis-Angle")
         else:
             col.prop(ob, "delta_rotation_euler", text="Delta Rotation")



More information about the Bf-blender-cvs mailing list