Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2018-07-15 00:16:34 +0300
committerCampbell Barton <ideasman42@gmail.com>2018-07-15 00:16:34 +0300
commitcd1600413246a62156441f6e7910489b19ae5a28 (patch)
treec8e55d1235eaa441a0bffe5ccc1480f6a180c41c /release/scripts/templates_py/gizmo_simple.py
parentfc7c934cfc00bd58f5cb6114bc9ca1e2e07564e1 (diff)
WM: rename files, manipulator -> gizmo
Edit doxy files and header guards only.
Diffstat (limited to 'release/scripts/templates_py/gizmo_simple.py')
-rw-r--r--release/scripts/templates_py/gizmo_simple.py47
1 files changed, 47 insertions, 0 deletions
diff --git a/release/scripts/templates_py/gizmo_simple.py b/release/scripts/templates_py/gizmo_simple.py
new file mode 100644
index 00000000000..cb10a8b94bb
--- /dev/null
+++ b/release/scripts/templates_py/gizmo_simple.py
@@ -0,0 +1,47 @@
+# Example of a group that edits a single property
+# using the predefined manipulator 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,
+)
+
+
+class MyLightWidgetGroup(ManipulatorGroup):
+ bl_idname = "OBJECT_WGT_light_test"
+ bl_label = "Test Light 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 == 'LIGHT')
+
+ def setup(self, context):
+ # Arrow manipulator has one 'offset' property we can assign to the light energy.
+ ob = context.object
+ mpr = self.manipulators.new("MANIPULATOR_WT_arrow_3d")
+ mpr.target_set_prop("offset", ob.data, "energy")
+ mpr.matrix_basis = ob.matrix_world.normalized()
+ mpr.draw_style = 'BOX'
+
+ mpr.color = 1.0, 0.5, 0.0
+ mpr.alpha = 0.5
+
+ mpr.color_highlight = 1.0, 0.5, 1.0
+ mpr.alpha_highlight = 0.5
+
+ self.energy_widget = mpr
+
+ def refresh(self, context):
+ ob = context.object
+ mpr = self.energy_widget
+ mpr.matrix_basis = ob.matrix_world.normalized()
+
+
+bpy.utils.register_class(MyLightWidgetGroup)