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-10-02 09:59:54 +0300
committerCampbell Barton <ideasman42@gmail.com>2018-10-02 10:03:23 +0300
commit07d4580f644577ebbd49f7d9a2bd8a81561cc099 (patch)
tree268e8a78e00389f136391c1d00e2020eb9f472a4 /source/blender/windowmanager/gizmo
parentdce12293d0dbaf0ae1e2ea90dc46ae7e40763f31 (diff)
Gizmo: support for gizmo-group properties
This allows gizmo groups to store properties in the tool. This makes sense for gizmo options which only control gizmo display and don't control operator execution. Unlike similar kinds of properties, this isn't accessible via the gizmo-group-type instance. For now the it's only stored in the workspace tool as can be done for operator properties, so each instance doesn't have different settings which would be confusing from a user perspective and complicate access from the top-bar. Later we could add gizmo-group properties if needed.
Diffstat (limited to 'source/blender/windowmanager/gizmo')
-rw-r--r--source/blender/windowmanager/gizmo/WM_gizmo_types.h8
-rw-r--r--source/blender/windowmanager/gizmo/intern/wm_gizmo_group_type.c10
2 files changed, 13 insertions, 5 deletions
diff --git a/source/blender/windowmanager/gizmo/WM_gizmo_types.h b/source/blender/windowmanager/gizmo/WM_gizmo_types.h
index dc3e77eb130..c92172dff15 100644
--- a/source/blender/windowmanager/gizmo/WM_gizmo_types.h
+++ b/source/blender/windowmanager/gizmo/WM_gizmo_types.h
@@ -389,11 +389,11 @@ typedef struct wmGizmoGroupType {
/* Only for convenient removal. */
struct wmKeyConfig *keyconf;
- /* Disable for now, maybe some day we want properties. */
-#if 0
- /* rna for properties */
+ /* Note: currently gizmo-group instances don't store properties,
+ * they're kept in the tool properties. */
+
+ /* RNA for properties */
struct StructRNA *srna;
-#endif
/* RNA integration */
ExtensionRNA ext;
diff --git a/source/blender/windowmanager/gizmo/intern/wm_gizmo_group_type.c b/source/blender/windowmanager/gizmo/intern/wm_gizmo_group_type.c
index a44005a7d28..655d38a5206 100644
--- a/source/blender/windowmanager/gizmo/intern/wm_gizmo_group_type.c
+++ b/source/blender/windowmanager/gizmo/intern/wm_gizmo_group_type.c
@@ -32,6 +32,7 @@
#include "MEM_guardedalloc.h"
#include "RNA_access.h"
+#include "RNA_define.h"
#include "WM_api.h"
#include "WM_types.h"
@@ -83,7 +84,12 @@ void WM_gizmogrouptype_iter(GHashIterator *ghi)
static wmGizmoGroupType *wm_gizmogrouptype_append__begin(void)
{
wmGizmoGroupType *gzgt = MEM_callocN(sizeof(wmGizmoGroupType), "gizmogrouptype");
-
+ gzgt->srna = RNA_def_struct_ptr(&BLENDER_RNA, "", &RNA_GizmoGroupProperties);
+#if 0
+ /* Set the default i18n context now, so that opfunc can redefine it if needed! */
+ RNA_def_struct_translation_context(ot->srna, BLT_I18NCONTEXT_OPERATOR_DEFAULT);
+ ot->translation_context = BLT_I18NCONTEXT_OPERATOR_DEFAULT;
+#endif
return gzgt;
}
static void wm_gizmogrouptype_append__end(wmGizmoGroupType *gzgt)
@@ -91,6 +97,8 @@ static void wm_gizmogrouptype_append__end(wmGizmoGroupType *gzgt)
BLI_assert(gzgt->name != NULL);
BLI_assert(gzgt->idname != NULL);
+ RNA_def_struct_identifier(&BLENDER_RNA, gzgt->srna, gzgt->idname);
+
gzgt->type_update_flag |= WM_GIZMOMAPTYPE_KEYMAP_INIT;
/* if not set, use default */