Commit: 8b9db543fd9b928867889d19eea4d9b038b316d5
Author: Campbell Barton
Date:   Fri May 18 07:58:37 2018 +0200
Branches: blender2.8
https://developer.blender.org/rB8b9db543fd9b928867889d19eea4d9b038b316d5

Tool System: add cursor (currently unused)

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

M       release/scripts/startup/bl_ui/space_toolsystem_common.py
M       source/blender/makesdna/DNA_workspace_types.h
M       source/blender/makesrna/intern/rna_workspace_api.c

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

diff --git a/release/scripts/startup/bl_ui/space_toolsystem_common.py 
b/release/scripts/startup/bl_ui/space_toolsystem_common.py
index a3846b0c1fb..d752cad8dfa 100644
--- a/release/scripts/startup/bl_ui/space_toolsystem_common.py
+++ b/release/scripts/startup/bl_ui/space_toolsystem_common.py
@@ -72,6 +72,8 @@ ToolDef = namedtuple(
         "text",
         # The name of the icon to use (found in ``release/datafiles/icons``) 
or None for no icon.
         "icon",
+        # An optional cursor to use when this tool is active.
+        "cursor",
         # An optional manipulator group to activate when the tool is set or 
None for no widget.
         "widget",
         # Optional keymap for tool, either:
@@ -101,6 +103,7 @@ def from_dict(kw_args):
     """
     kw = {
         "icon": None,
+        "cursor": None,
         "widget": None,
         "keymap": None,
         "data_block": None,
@@ -560,6 +563,7 @@ def activate_by_name(context, space_type, text):
         tool.setup(
             name=text,
             keymap=item.keymap[0].name if item.keymap is not None else "",
+            cursor=item.cursor or 'DEFAULT',
             manipulator_group=item.widget or "",
             data_block=item.data_block or "",
             index=index,
diff --git a/source/blender/makesdna/DNA_workspace_types.h 
b/source/blender/makesdna/DNA_workspace_types.h
index 693e4f672d2..12dd2d9962a 100644
--- a/source/blender/makesdna/DNA_workspace_types.h
+++ b/source/blender/makesdna/DNA_workspace_types.h
@@ -57,6 +57,7 @@
 #
 typedef struct bToolRef_Runtime {
        /* One of these must be defined. */
+       int cursor;
        char keymap[64];
        char manipulator_group[64];
        char data_block[64];
diff --git a/source/blender/makesrna/intern/rna_workspace_api.c 
b/source/blender/makesrna/intern/rna_workspace_api.c
index 4b0e2b5918e..4c6949cc33d 100644
--- a/source/blender/makesrna/intern/rna_workspace_api.c
+++ b/source/blender/makesrna/intern/rna_workspace_api.c
@@ -35,6 +35,8 @@
 #include "DNA_object_types.h"
 #include "DNA_windowmanager_types.h"
 
+#include "RNA_enum_types.h"  /* own include */
+
 #include "rna_internal.h"  /* own include */
 
 #ifdef RNA_RUNTIME
@@ -45,6 +47,7 @@ static void rna_WorkspaceTool_setup(
         bContext *C,
         const char *name,
         /* Args for: 'bToolRef_Runtime'. */
+        int cursor,
         const char *keymap,
         const char *manipulator_group,
         const char *data_block,
@@ -52,6 +55,7 @@ static void rna_WorkspaceTool_setup(
 {
        bToolRef_Runtime tref_rt = {0};
 
+       tref_rt.cursor = cursor;
        STRNCPY(tref_rt.keymap, keymap);
        STRNCPY(tref_rt.manipulator_group, manipulator_group);
        STRNCPY(tref_rt.data_block, data_block);
@@ -81,6 +85,8 @@ void RNA_api_workspace_tool(StructRNA *srna)
        RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
 
        /* 'bToolRef_Runtime' */
+       parm = RNA_def_property(func, "cursor", PROP_ENUM, PROP_NONE);
+       RNA_def_property_enum_items(parm, rna_enum_window_cursor_items);
        RNA_def_string(func, "keymap", NULL, KMAP_MAX_NAME, "Key Map", "");
        RNA_def_string(func, "manipulator_group", NULL, MAX_NAME, "Manipulator 
Group", "");
        RNA_def_string(func, "data_block", NULL, MAX_NAME, "Data Block", "");

_______________________________________________
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to