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>2017-06-15 13:48:24 +0300
committerCampbell Barton <ideasman42@gmail.com>2017-06-15 13:56:22 +0300
commit830df9b33d3e2afdf3bb23b469378899c34fda78 (patch)
tree4f2fad8cdd48937e28d2c45115476c9045e4525b /source/blender/editors/space_node
parent1a7099f3ecf52fa8a54c2ba3f652d5827ca9103c (diff)
Updates to manipulator API
While this is work-in-progress from custom-manipulators branch its stable so adding into 2.8 so we don't get too much out of sync. - ManipulatorGroupType's are moved out of the manipulator-map and are now global (like operators, panels etc) and added into spaces as needed. Without this all operators that might ever use a manipulator in the 3D view would be polling the viewport. - Add optional get/set callbacks for non-RNA properties Needed so re-usable manipulators can control values that don't correspond to a single properly or need conversion. - Fix divide by zero bug in arrow manipulator (when moving zero pixels).
Diffstat (limited to 'source/blender/editors/space_node')
-rw-r--r--source/blender/editors/space_node/node_manipulators.c8
-rw-r--r--source/blender/editors/space_node/space_node.c12
2 files changed, 10 insertions, 10 deletions
diff --git a/source/blender/editors/space_node/node_manipulators.c b/source/blender/editors/space_node/node_manipulators.c
index 6eb03a6eb26..0f3f53c6dca 100644
--- a/source/blender/editors/space_node/node_manipulators.c
+++ b/source/blender/editors/space_node/node_manipulators.c
@@ -25,8 +25,6 @@
#include "BKE_context.h"
#include "BKE_image.h"
-#include "DNA_manipulator_types.h"
-
#include "ED_screen.h"
#include "ED_manipulator_library.h"
@@ -95,8 +93,8 @@ static void WIDGETGROUP_node_transform_refresh(const bContext *C, wmManipulatorG
SpaceNode *snode = CTX_wm_space_node(C);
PointerRNA nodeptr;
RNA_pointer_create(snode->id, &RNA_SpaceNodeEditor, snode, &nodeptr);
- WM_manipulator_def_property(cage, "offset", &nodeptr, "backdrop_offset", -1);
- WM_manipulator_def_property(cage, "scale", &nodeptr, "backdrop_zoom", -1);
+ WM_manipulator_property_def_rna(cage, "offset", &nodeptr, "backdrop_offset", -1);
+ WM_manipulator_property_def_rna(cage, "scale", &nodeptr, "backdrop_zoom", -1);
}
else {
WM_manipulator_set_flag(cage, WM_MANIPULATOR_HIDDEN, true);
@@ -110,6 +108,8 @@ void NODE_WGT_backdrop_transform(wmManipulatorGroupType *wgt)
wgt->name = "Backdrop Transform Widgets";
wgt->idname = "NODE_WGT_backdrop_transform";
+ wgt->flag |= WM_MANIPULATORGROUPTYPE_PERSISTENT;
+
wgt->poll = WIDGETGROUP_node_transform_poll;
wgt->setup = WIDGETGROUP_node_transform_setup;
wgt->refresh = WIDGETGROUP_node_transform_refresh;
diff --git a/source/blender/editors/space_node/space_node.c b/source/blender/editors/space_node/space_node.c
index 665808c500f..2f1e6d38d3d 100644
--- a/source/blender/editors/space_node/space_node.c
+++ b/source/blender/editors/space_node/space_node.c
@@ -646,9 +646,9 @@ static void node_main_region_init(wmWindowManager *wm, ARegion *ar)
UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_CUSTOM, ar->winx, ar->winy);
/* manipulators stay in the background for now - quick patchjob to make sure nodes themselves work */
- if (!ar->manipulator_map) {
- ar->manipulator_map = WM_manipulatormap_new_from_type(&(const struct wmManipulatorMapType_Params) {
- "Node_Canvas", SPACE_NODE, RGN_TYPE_WINDOW});
+ if (ar->manipulator_map == NULL) {
+ ar->manipulator_map = WM_manipulatormap_new_from_type(
+ &(const struct wmManipulatorMapType_Params){SPACE_NODE, RGN_TYPE_WINDOW});
}
WM_manipulatormap_add_handlers(ar, ar->manipulator_map);
@@ -859,9 +859,9 @@ static int node_context(const bContext *C, const char *member, bContextDataResul
static void node_widgets(void)
{
/* create the widgetmap for the area here */
- wmManipulatorMapType *wmaptype = WM_manipulatormaptype_ensure(&(const struct wmManipulatorMapType_Params) {
- "Node_Canvas", SPACE_NODE, RGN_TYPE_WINDOW});
- WM_manipulatorgrouptype_append(wmaptype, NODE_WGT_backdrop_transform);
+ wmManipulatorMapType *mmap_type = WM_manipulatormaptype_ensure(
+ &(const struct wmManipulatorMapType_Params){SPACE_NODE, RGN_TYPE_WINDOW});
+ WM_manipulatorgrouptype_append_and_link(mmap_type, NODE_WGT_backdrop_transform);
}
static void node_id_remap(ScrArea *UNUSED(sa), SpaceLink *slink, ID *old_id, ID *new_id)