diff options
author | Campbell Barton <ideasman42@gmail.com> | 2018-07-15 00:55:20 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-07-15 00:55:54 +0300 |
commit | 89299f66207bd278e37e9e55ade87e8989b0de3d (patch) | |
tree | d0287dd0aa7ceb3d5a7f9cb22018c0b41e76790b /release/scripts/templates_py | |
parent | 5ebebcfbfff4c218ab4101ee7f6a66617ee9b01f (diff) |
WM: rename manipulator to gizmo in Python API
Diffstat (limited to 'release/scripts/templates_py')
-rw-r--r-- | release/scripts/templates_py/gizmo_custom_geometry.py | 12 | ||||
-rw-r--r-- | release/scripts/templates_py/gizmo_operator.py | 30 | ||||
-rw-r--r-- | release/scripts/templates_py/gizmo_operator_target.py | 12 | ||||
-rw-r--r-- | release/scripts/templates_py/gizmo_simple.py | 10 |
4 files changed, 32 insertions, 32 deletions
diff --git a/release/scripts/templates_py/gizmo_custom_geometry.py b/release/scripts/templates_py/gizmo_custom_geometry.py index de324a909db..f71237f52f7 100644 --- a/release/scripts/templates_py/gizmo_custom_geometry.py +++ b/release/scripts/templates_py/gizmo_custom_geometry.py @@ -5,8 +5,8 @@ # import bpy from bpy.types import ( - Manipulator, - ManipulatorGroup, + Gizmo, + GizmoGroup, ) # Coordinates (each one is a triangle). @@ -62,7 +62,7 @@ custom_shape_verts = ( ) -class MyCustomShapeWidget(Manipulator): +class MyCustomShapeWidget(Gizmo): bl_idname = "VIEW3D_WT_auto_facemap" bl_target_properties = ( {"id": "offset", "type": 'FLOAT', "array_length": 1}, @@ -108,11 +108,11 @@ class MyCustomShapeWidget(Manipulator): delta /= 10.0 value = self.init_value + delta self.target_set_value("offset", value) - context.area.header_text_set("My Manipulator: %.4f" % value) + context.area.header_text_set("My Gizmo: %.4f" % value) return {'RUNNING_MODAL'} -class MyCustomShapeWidgetGroup(ManipulatorGroup): +class MyCustomShapeWidgetGroup(GizmoGroup): bl_idname = "OBJECT_WGT_light_test" bl_label = "Test Light Widget" bl_space_type = 'VIEW_3D' @@ -127,7 +127,7 @@ class MyCustomShapeWidgetGroup(ManipulatorGroup): def setup(self, context): # Assign the 'offset' target property to the light energy. ob = context.object - mpr = self.manipulators.new(MyCustomShapeWidget.bl_idname) + mpr = self.gizmos.new(MyCustomShapeWidget.bl_idname) mpr.target_set_prop("offset", ob.data, "energy") mpr.matrix_basis = ob.matrix_world.normalized() diff --git a/release/scripts/templates_py/gizmo_operator.py b/release/scripts/templates_py/gizmo_operator.py index 61796489a95..3cbb0801e9c 100644 --- a/release/scripts/templates_py/gizmo_operator.py +++ b/release/scripts/templates_py/gizmo_operator.py @@ -1,15 +1,15 @@ -# Example of an operator which uses manipulators to control its properties. +# Example of an operator which uses gizmos to control its properties. # # Usage: Run this script, then in mesh edit-mode press Spacebar # to activate the operator "Select Side of Plane" -# The manipulators can then be used to adjust the plane in the 3D view. +# The gizmos can then be used to adjust the plane in the 3D view. # import bpy import bmesh from bpy.types import ( Operator, - ManipulatorGroup, + GizmoGroup, ) from bpy.props import ( @@ -68,7 +68,7 @@ class SelectSideOfPlane(Operator): if context.space_data.type == 'VIEW_3D': wm = context.window_manager - wm.manipulator_group_type_add(SelectSideOfPlaneManipulatorGroup.bl_idname) + wm.gizmo_group_type_add(SelectSideOfPlaneGizmoGroup.bl_idname) return {'FINISHED'} @@ -78,10 +78,10 @@ class SelectSideOfPlane(Operator): return {'FINISHED'} -# Manipulators for plane_co, plane_no -class SelectSideOfPlaneManipulatorGroup(ManipulatorGroup): +# Gizmos for plane_co, plane_no +class SelectSideOfPlaneGizmoGroup(GizmoGroup): bl_idname = "MESH_WGT_select_side_of_plane" - bl_label = "Side of Plane Manipulator" + bl_label = "Side of Plane Gizmo" bl_space_type = 'VIEW_3D' bl_region_type = 'WINDOW' bl_options = {'3D'} @@ -106,7 +106,7 @@ class SelectSideOfPlaneManipulatorGroup(ManipulatorGroup): op = cls.my_target_operator(context) if op is None: wm = context.window_manager - wm.manipulator_group_type_remove(SelectSideOfPlaneManipulatorGroup.bl_idname) + wm.gizmo_group_type_remove(SelectSideOfPlaneGizmoGroup.bl_idname) return False return True @@ -117,16 +117,16 @@ class SelectSideOfPlaneManipulatorGroup(ManipulatorGroup): # Grab def grab_get_cb(): - op = SelectSideOfPlaneManipulatorGroup.my_target_operator(context) + op = SelectSideOfPlaneGizmoGroup.my_target_operator(context) return op.plane_co def grab_set_cb(value): - op = SelectSideOfPlaneManipulatorGroup.my_target_operator(context) + op = SelectSideOfPlaneGizmoGroup.my_target_operator(context) op.plane_co = value # XXX, this may change! op.execute(context) - mpr = self.manipulators.new("MANIPULATOR_WT_grab_3d") + mpr = self.gizmos.new("GIZMO_WT_grab_3d") mpr.target_set_handler("offset", get=grab_get_cb, set=grab_set_cb) mpr.use_draw_value = True @@ -145,7 +145,7 @@ class SelectSideOfPlaneManipulatorGroup(ManipulatorGroup): # Dial def direction_get_cb(): - op = SelectSideOfPlaneManipulatorGroup.my_target_operator(context) + op = SelectSideOfPlaneGizmoGroup.my_target_operator(context) no_a = self.widget_dial.matrix_basis.col[1].xyz no_b = Vector(op.plane_no) @@ -155,13 +155,13 @@ class SelectSideOfPlaneManipulatorGroup(ManipulatorGroup): return no_a.angle_signed(no_b) def direction_set_cb(value): - op = SelectSideOfPlaneManipulatorGroup.my_target_operator(context) + op = SelectSideOfPlaneGizmoGroup.my_target_operator(context) matrix_rotate = Matrix.Rotation(-value, 3, self.rotate_axis) no = matrix_rotate * self.widget_dial.matrix_basis.col[1].xyz op.plane_no = no op.execute(context) - mpr = self.manipulators.new("MANIPULATOR_WT_dial_3d") + mpr = self.gizmos.new("GIZMO_WT_dial_3d") mpr.target_set_handler("offset", get=direction_get_cb, set=direction_set_cb) mpr.draw_options = {'ANGLE_START_Y'} @@ -216,7 +216,7 @@ class SelectSideOfPlaneManipulatorGroup(ManipulatorGroup): classes = ( SelectSideOfPlane, - SelectSideOfPlaneManipulatorGroup, + SelectSideOfPlaneGizmoGroup, ) diff --git a/release/scripts/templates_py/gizmo_operator_target.py b/release/scripts/templates_py/gizmo_operator_target.py index ba53b5e10ff..08fe63ef0b7 100644 --- a/release/scripts/templates_py/gizmo_operator_target.py +++ b/release/scripts/templates_py/gizmo_operator_target.py @@ -1,15 +1,15 @@ -# Example of a manipulator that activates an operator -# using the predefined dial manipulator to change the camera roll. +# Example of a gizmo that activates an operator +# using the predefined dial gizmo to change the camera roll. # # Usage: Run this script and select a camera in the 3D view. # import bpy from bpy.types import ( - ManipulatorGroup, + GizmoGroup, ) -class MyCameraWidgetGroup(ManipulatorGroup): +class MyCameraWidgetGroup(GizmoGroup): bl_idname = "OBJECT_WGT_test_camera" bl_label = "Object Camera Test Widget" bl_space_type = 'VIEW_3D' @@ -22,9 +22,9 @@ class MyCameraWidgetGroup(ManipulatorGroup): return (ob and ob.type == 'CAMERA') def setup(self, context): - # Run an operator using the dial manipulator + # Run an operator using the dial gizmo ob = context.object - mpr = self.manipulators.new("MANIPULATOR_WT_dial_3d") + mpr = self.gizmos.new("GIZMO_WT_dial_3d") props = mpr.target_set_operator("transform.rotate") props.constraint_axis = False, False, True props.constraint_orientation = 'LOCAL' diff --git a/release/scripts/templates_py/gizmo_simple.py b/release/scripts/templates_py/gizmo_simple.py index cb10a8b94bb..0fd1e0b386b 100644 --- a/release/scripts/templates_py/gizmo_simple.py +++ b/release/scripts/templates_py/gizmo_simple.py @@ -1,16 +1,16 @@ # Example of a group that edits a single property -# using the predefined manipulator arrow. +# using the predefined gizmo arrow. # # Usage: Select a light in the 3D view and drag the arrow at it's rear # to change it's energy value. # import bpy from bpy.types import ( - ManipulatorGroup, + GizmoGroup, ) -class MyLightWidgetGroup(ManipulatorGroup): +class MyLightWidgetGroup(GizmoGroup): bl_idname = "OBJECT_WGT_light_test" bl_label = "Test Light Widget" bl_space_type = 'VIEW_3D' @@ -23,9 +23,9 @@ class MyLightWidgetGroup(ManipulatorGroup): return (ob and ob.type == 'LIGHT') def setup(self, context): - # Arrow manipulator has one 'offset' property we can assign to the light energy. + # Arrow gizmo has one 'offset' property we can assign to the light energy. ob = context.object - mpr = self.manipulators.new("MANIPULATOR_WT_arrow_3d") + mpr = self.gizmos.new("GIZMO_WT_arrow_3d") mpr.target_set_prop("offset", ob.data, "energy") mpr.matrix_basis = ob.matrix_world.normalized() mpr.draw_style = 'BOX' |