diff options
author | Campbell Barton <ideasman42@gmail.com> | 2018-07-15 00:16:34 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-07-15 00:16:34 +0300 |
commit | cd1600413246a62156441f6e7910489b19ae5a28 (patch) | |
tree | c8e55d1235eaa441a0bffe5ccc1480f6a180c41c /release/scripts/templates_py/gizmo_operator_target.py | |
parent | fc7c934cfc00bd58f5cb6114bc9ca1e2e07564e1 (diff) |
WM: rename files, manipulator -> gizmo
Edit doxy files and header guards only.
Diffstat (limited to 'release/scripts/templates_py/gizmo_operator_target.py')
-rw-r--r-- | release/scripts/templates_py/gizmo_operator_target.py | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/release/scripts/templates_py/gizmo_operator_target.py b/release/scripts/templates_py/gizmo_operator_target.py new file mode 100644 index 00000000000..ba53b5e10ff --- /dev/null +++ b/release/scripts/templates_py/gizmo_operator_target.py @@ -0,0 +1,50 @@ +# Example of a manipulator that activates an operator +# using the predefined dial manipulator to change the camera roll. +# +# Usage: Run this script and select a camera in the 3D view. +# +import bpy +from bpy.types import ( + ManipulatorGroup, +) + + +class MyCameraWidgetGroup(ManipulatorGroup): + bl_idname = "OBJECT_WGT_test_camera" + bl_label = "Object Camera Test Widget" + bl_space_type = 'VIEW_3D' + bl_region_type = 'WINDOW' + bl_options = {'3D', 'PERSISTENT'} + + @classmethod + def poll(cls, context): + ob = context.object + return (ob and ob.type == 'CAMERA') + + def setup(self, context): + # Run an operator using the dial manipulator + ob = context.object + mpr = self.manipulators.new("MANIPULATOR_WT_dial_3d") + props = mpr.target_set_operator("transform.rotate") + props.constraint_axis = False, False, True + props.constraint_orientation = 'LOCAL' + props.release_confirm = True + + mpr.matrix_basis = ob.matrix_world.normalized() + mpr.line_width = 3 + + mpr.color = 0.8, 0.8, 0.8 + mpr.alpha = 0.5 + + mpr.color_highlight = 1.0, 1.0, 1.0 + mpr.alpha_highlight = 1.0 + + self.roll_widget = mpr + + def refresh(self, context): + ob = context.object + mpr = self.roll_widget + mpr.matrix_basis = ob.matrix_world.normalized() + + +bpy.utils.register_class(MyCameraWidgetGroup) |