Tools: Add Randomize to Curve Edit toolbar
authorWilliam Reynish <billrey@me.com>
Sun, 3 Mar 2019 19:37:47 +0000 (20:37 +0100)
committerWilliam Reynish <billrey@me.com>
Sun, 3 Mar 2019 19:37:47 +0000 (20:37 +0100)
release/datafiles/icons/ops.curve.vertex_random.dat [new file with mode: 0644]
release/scripts/presets/keyconfig/keymap_data/blender_default.py
release/scripts/startup/bl_ui/space_toolsystem_toolbar.py
source/blender/editors/datafiles/CMakeLists.txt

diff --git a/release/datafiles/icons/ops.curve.vertex_random.dat b/release/datafiles/icons/ops.curve.vertex_random.dat
new file mode 100644 (file)
index 0000000..ced246f
Binary files /dev/null and b/release/datafiles/icons/ops.curve.vertex_random.dat differ
index e29b4a3..e490ab5 100644 (file)
@@ -5673,6 +5673,15 @@ def km_3d_view_tool_edit_curve_shrink_fatten(params):
         ]},
     )
 
+def km_3d_view_tool_edit_curve_randomize(params):
+    return (
+        "3D View Tool: Edit Curve, Randomize",
+        {"space_type": 'VIEW_3D', "region_type": 'WINDOW'},
+        {"items": [
+            ("transform.vertex_random", {"type": params.tool_tweak, "value": 'ANY'},
+             {"properties": [("offset", 0.0)]}),
+        ]},
+    )
 
 def km_3d_view_tool_edit_curve_extrude(params):
     return (
@@ -6146,6 +6155,7 @@ def generate_keymaps(params=None):
         km_3d_view_tool_edit_curve_draw(params),
         km_3d_view_tool_edit_curve_shrink_fatten(params),
         km_3d_view_tool_edit_curve_tilt(params),
+        km_3d_view_tool_edit_curve_randomize(params),
         km_3d_view_tool_edit_curve_extrude(params),
         km_3d_view_tool_edit_curve_extrude_cursor(params),
         km_3d_view_tool_sculpt_box_hide(params),
index 92c599e..2092224 100644 (file)
@@ -811,6 +811,22 @@ class _defs_edit_curve:
             keymap=(),
         )
 
+    @ToolDef.from_fn
+    def curve_vertex_randomize():
+        def draw_settings(context, layout, tool):
+            props = tool.operator_properties("transform.vertex_random")
+            layout.prop(props, "uniform")
+            layout.prop(props, "normal")
+            layout.prop(props, "seed")
+        return dict(
+            text="Randomize",
+            icon="ops.curve.vertex_random",
+            widget="WM_GGT_value_operator_redo",
+            keymap=(),
+            draw_settings=draw_settings,
+        )
+
+
 class _defs_pose:
 
     @ToolDef.from_fn
@@ -1600,6 +1616,7 @@ class VIEW3D_PT_tools_active(ToolSelectPanelHelper, Panel):
             *_tools_default,
             None,
             _defs_edit_curve.curve_shrink_fatten,
+            _defs_edit_curve.curve_vertex_randomize,
             _defs_edit_curve.tilt,
             _defs_edit_curve.draw,
             (
index 19ddbc8..4ee5703 100644 (file)
@@ -669,6 +669,7 @@ set_property(GLOBAL PROPERTY ICON_GEOM_NAMES
        ops.curve.extrude_cursor
        ops.curve.extrude_move
        ops.curve.shrink_fatten
+       ops.curve.vertex_random
        ops.generic.cursor
        ops.generic.select
        ops.generic.select_box