[Bf-blender-cvs] [17ff2ab2545] custom-manipulators: RNA: Add registerable wmWidgetType
Campbell Barton
noreply at git.blender.org
Thu Jun 8 11:26:18 CEST 2017
Commit: 17ff2ab25450d3660ae9828a4e9e9e92b334615b
Author: Campbell Barton
Date: Thu Jun 8 19:26:21 2017 +1000
Branches: custom-manipulators
https://developer.blender.org/rB17ff2ab25450d3660ae9828a4e9e9e92b334615b
RNA: Add registerable wmWidgetType
Works on a basic level - creating Python widgetgroups and widgets, drawing.
Still lots more to do though.
===================================================================
M build_files/cmake/macros.cmake
M source/blender/editors/include/ED_manipulator_library.h
M source/blender/editors/manipulator_library/CMakeLists.txt
M source/blender/editors/manipulator_library/arrow2d_manipulator.c
M source/blender/editors/manipulator_library/arrow3d_manipulator.c
M source/blender/editors/manipulator_library/cage2d_manipulator.c
M source/blender/editors/manipulator_library/dial3d_manipulator.c
M source/blender/editors/manipulator_library/facemap3d_manipulator.c
R091 source/blender/windowmanager/manipulators/intern/manipulator_library/manipulator_library_presets.c source/blender/editors/manipulator_library/manipulator_library_presets.c
M source/blender/editors/manipulator_library/primitive3d_manipulator.c
M source/blender/editors/space_view3d/view3d_manipulators.c
M source/blender/makesrna/intern/rna_wm_manipulator.c
M source/blender/makesrna/intern/rna_wm_manipulator_api.c
M source/blender/python/intern/bpy_manipulator_wrap.c
M source/blender/python/intern/bpy_manipulator_wrap.h
M source/blender/windowmanager/manipulators/WM_manipulator_api.h
M source/blender/windowmanager/manipulators/WM_manipulator_types.h
M source/blender/windowmanager/manipulators/intern/wm_manipulator.c
M source/blender/windowmanager/manipulators/intern/wm_manipulatorgroup.c
M source/blender/windowmanager/manipulators/intern/wm_manipulatormap.c
M source/blender/windowmanager/manipulators/wm_manipulator_fn.h
===================================================================
diff --git a/build_files/cmake/macros.cmake b/build_files/cmake/macros.cmake
index ddab79ae36d..836fd5f1a6b 100644
--- a/build_files/cmake/macros.cmake
+++ b/build_files/cmake/macros.cmake
@@ -612,7 +612,7 @@ function(SETUP_BLENDER_SORTED_LIBS)
bf_physics
bf_nodes
bf_rna
- bf_windowmanager # FIXME, needed because of bad-level calls.
+ bf_editor_manipulator_library # rna -> manipulator bad-level calls
bf_python
bf_imbuf
bf_blenlib
diff --git a/source/blender/editors/include/ED_manipulator_library.h b/source/blender/editors/include/ED_manipulator_library.h
index a9c04c8e004..284f476e62e 100644
--- a/source/blender/editors/include/ED_manipulator_library.h
+++ b/source/blender/editors/include/ED_manipulator_library.h
@@ -38,8 +38,20 @@ void ED_manipulatortypes_dial_3d(void);
void ED_manipulatortypes_facemap_3d(void);
void ED_manipulatortypes_primitive_3d(void);
+struct wmManipulator;
struct wmManipulatorGroup;
+
+/* -------------------------------------------------------------------- */
+/* Shape Presets
+ *
+ * Intended to be called by custom draw functions.
+ */
+
+/* manipulator_library_presets.c */
+void ED_manipulator_draw_preset_box(const struct wmManipulator *manipulator, float mat[4][4], int select_id);
+
+
/* -------------------------------------------------------------------- */
/* 3D Arrow Manipulator */
diff --git a/source/blender/editors/manipulator_library/CMakeLists.txt b/source/blender/editors/manipulator_library/CMakeLists.txt
index 633a44df997..e54e7d7f58f 100644
--- a/source/blender/editors/manipulator_library/CMakeLists.txt
+++ b/source/blender/editors/manipulator_library/CMakeLists.txt
@@ -45,6 +45,7 @@ set(SRC
geom_arrow_manipulator.c
geom_cube_manipulator.c
manipulator_draw_utils.c
+ manipulator_library_presets.c
manipulator_library_utils.c
primitive3d_manipulator.c
diff --git a/source/blender/editors/manipulator_library/arrow2d_manipulator.c b/source/blender/editors/manipulator_library/arrow2d_manipulator.c
index 61827723752..a3b0f6a0480 100644
--- a/source/blender/editors/manipulator_library/arrow2d_manipulator.c
+++ b/source/blender/editors/manipulator_library/arrow2d_manipulator.c
@@ -190,8 +190,8 @@ static int manipulator_arrow2d_intersect(
struct wmManipulator *ED_manipulator_arrow2d_new(wmManipulatorGroup *mgroup, const char *name)
{
- const wmManipulatorType *mpt = WM_manipulatortype_find("MANIPULATOR_WT_arrow_2d", false);
- ArrowManipulator2D *arrow = (ArrowManipulator2D *)WM_manipulator_new(mpt, mgroup, name);
+ ArrowManipulator2D *arrow = (ArrowManipulator2D *)WM_manipulator_new(
+ "MANIPULATOR_WT_arrow_2d", mgroup, name);
arrow->manipulator.flag |= WM_MANIPULATOR_DRAW_ACTIVE;
@@ -222,7 +222,7 @@ static void MANIPULATOR_WT_arrow_2d(wmManipulatorType *wt)
wt->invoke = manipulator_arrow2d_invoke;
wt->intersect = manipulator_arrow2d_intersect;
- wt->size = sizeof(ArrowManipulator2D);
+ wt->struct_size = sizeof(ArrowManipulator2D);
}
void ED_manipulatortypes_arrow_2d(void)
diff --git a/source/blender/editors/manipulator_library/arrow3d_manipulator.c b/source/blender/editors/manipulator_library/arrow3d_manipulator.c
index 87e26aeba66..9c04b99074d 100644
--- a/source/blender/editors/manipulator_library/arrow3d_manipulator.c
+++ b/source/blender/editors/manipulator_library/arrow3d_manipulator.c
@@ -422,8 +422,8 @@ static void manipulator_arrow_exit(bContext *C, wmManipulator *manipulator, cons
wmManipulator *ED_manipulator_arrow3d_new(wmManipulatorGroup *mgroup, const char *name, const int style)
{
- const wmManipulatorType *mpt = WM_manipulatortype_find("MANIPULATOR_WT_arrow_3d", false);
- ArrowManipulator3D *arrow = (ArrowManipulator3D *)WM_manipulator_new(mpt, mgroup, name);
+ ArrowManipulator3D *arrow = (ArrowManipulator3D *)WM_manipulator_new(
+ "MANIPULATOR_WT_arrow_3d", mgroup, name);
int real_style = style;
@@ -539,7 +539,7 @@ static void MANIPULATOR_WT_arrow_3d(wmManipulatorType *wt)
wt->prop_data_update = manipulator_arrow_prop_data_update;
wt->exit = manipulator_arrow_exit;
- wt->size = sizeof(ArrowManipulator3D);
+ wt->struct_size = sizeof(ArrowManipulator3D);
}
void ED_manipulatortypes_arrow_3d(void)
diff --git a/source/blender/editors/manipulator_library/cage2d_manipulator.c b/source/blender/editors/manipulator_library/cage2d_manipulator.c
index 97b4e451bc7..cb4ef6879ff 100644
--- a/source/blender/editors/manipulator_library/cage2d_manipulator.c
+++ b/source/blender/editors/manipulator_library/cage2d_manipulator.c
@@ -554,8 +554,8 @@ static void manipulator_rect_transform_exit(bContext *C, wmManipulator *manipula
wmManipulator *ED_manipulator_rect_transform_new(wmManipulatorGroup *mgroup, const char *name, const int style)
{
- const wmManipulatorType *mpt = WM_manipulatortype_find("MANIPULATOR_WT_cage", false);
- RectTransformManipulator *cage = (RectTransformManipulator *)WM_manipulator_new(mpt, mgroup, name);
+ RectTransformManipulator *cage = (RectTransformManipulator *)WM_manipulator_new(
+ "MANIPULATOR_WT_cage", mgroup, name);
cage->manipulator.flag |= WM_MANIPULATOR_DRAW_ACTIVE;
cage->scale[0] = cage->scale[1] = 1.0f;
@@ -587,7 +587,7 @@ static void MANIPULATOR_WT_cage(wmManipulatorType *wt)
wt->prop_len_max = 2;
- wt->size = sizeof(RectTransformManipulator);
+ wt->struct_size = sizeof(RectTransformManipulator);
}
void ED_manipulatortypes_cage_2d(void)
diff --git a/source/blender/editors/manipulator_library/dial3d_manipulator.c b/source/blender/editors/manipulator_library/dial3d_manipulator.c
index 5097c8cab6f..1f8ee68038f 100644
--- a/source/blender/editors/manipulator_library/dial3d_manipulator.c
+++ b/source/blender/editors/manipulator_library/dial3d_manipulator.c
@@ -331,8 +331,8 @@ static void manipulator_dial_invoke(
wmManipulator *ED_manipulator_dial3d_new(wmManipulatorGroup *mgroup, const char *name, const int style)
{
- const wmManipulatorType *mpt = WM_manipulatortype_find("MANIPULATOR_WT_dial", false);
- DialManipulator *dial = (DialManipulator *)WM_manipulator_new(mpt, mgroup, name);
+ DialManipulator *dial = (DialManipulator *)WM_manipulator_new(
+ "MANIPULATOR_WT_dial", mgroup, name);
const float dir_default[3] = {0.0f, 0.0f, 1.0f};
@@ -365,7 +365,7 @@ static void MANIPULATOR_WT_dial_3d(wmManipulatorType *wt)
wt->draw_select = manipulator_dial_render_3d_intersect;
wt->invoke = manipulator_dial_invoke;
- wt->size = sizeof(DialManipulator);
+ wt->struct_size = sizeof(DialManipulator);
}
void ED_manipulatortypes_dial_3d(void)
diff --git a/source/blender/editors/manipulator_library/facemap3d_manipulator.c b/source/blender/editors/manipulator_library/facemap3d_manipulator.c
index 7912aeedf17..e861bf62ebc 100644
--- a/source/blender/editors/manipulator_library/facemap3d_manipulator.c
+++ b/source/blender/editors/manipulator_library/facemap3d_manipulator.c
@@ -108,8 +108,8 @@ struct wmManipulator *ED_manipulator_facemap_new(
wmManipulatorGroup *wgroup, const char *name, const int style,
Object *ob, const int facemap)
{
- const wmManipulatorType *mpt = WM_manipulatortype_find("MANIPULATOR_WT_facemap3d", false);
- FacemapManipulator *fmap_widget = (FacemapManipulator *)WM_manipulator_new(mpt, wgroup, name);
+ FacemapManipulator *fmap_widget = (FacemapManipulator *)WM_manipulator_new(
+ "MANIPULATOR_WT_facemap3d", wgroup, name);
BLI_assert(facemap > -1);
@@ -135,7 +135,7 @@ static void MANIPULATOR_WT_facemap3d(wmManipulatorType *wt)
wt->draw = widget_facemap_draw;
wt->draw_select = widget_facemap_render_3d_intersect;
- wt->size = sizeof(FacemapManipulator);
+ wt->struct_size = sizeof(FacemapManipulator);
}
void ED_manipulatortypes_facemap_3d(void)
diff --git a/source/blender/windowmanager/manipulators/intern/manipulator_library/manipulator_library_presets.c b/source/blender/editors/manipulator_library/manipulator_library_presets.c
similarity index 91%
rename from source/blender/windowmanager/manipulators/intern/manipulator_library/manipulator_library_presets.c
rename to source/blender/editors/manipulator_library/manipulator_library_presets.c
index b32330df2d6..069b9e54c23 100644
--- a/source/blender/windowmanager/manipulators/intern/manipulator_library/manipulator_library_presets.c
+++ b/source/blender/editors/manipulator_library/manipulator_library_presets.c
@@ -46,24 +46,24 @@
#include "MEM_guardedalloc.h"
+
#include "RNA_access.h"
#include "WM_types.h"
#include "WM_api.h"
+
/* own includes */
-#include "wm_manipulator_wmapi.h"
-#include "wm_manipulator_intern.h"
-#include "manipulator_geometry.h"
-#include "manipulator_library_intern.h"
+#include "ED_manipulator_library.h" /* own include */
+#include "manipulator_library_intern.h" /* own include */
/* TODO, this is to be used by RNA. might move to ED_manipulator_library */
-void WM_manipulator_draw_preset_box(
+void ED_manipulator_draw_preset_box(
const struct wmManipulator *mpr, float mat[4][4], int select_id)
{
const bool is_select = (select_id != -1);
- const bool is_highlight = is_select && (mpr->state & WM_MANIPULATOR_HIGHLIGHT) != 0;
+ const bool is_highlight = is_select && (mpr->state & WM_MANIPULATOR_STATE_HIGHLIGHT) != 0;
float color[4];
manipulator_color_get(mpr, is_highlight, color);
diff --git a/source/blender/editors/manipulator_library/primitive3d_manipulator.c b/source/blender/editors/manipulator_library/primitive3d_manipulator.c
index cc8fbeb17d2..8f99b7046a2 100644
--- a/source/blender/editors/manipulator_library/primitive3d_manipulator.c
+++ b/source/blender/editors/manipulator_library/primitive3d_manipulator.c
@@ -191,8 +191,8 @@ static void manipulator_primitive_invoke(
wmManipulator *ED_manipulator_primitive3d_new(wmManipulatorGroup *mgroup, const char *name, const int style)
{
- const wmManipulatorType *mpt = WM_manipulatortype_find("MANIPULATOR_WT_primitive3d", false);
- PrimitiveManipulator *prim = (PrimitiveManipulator *)WM_manipulator_new(mpt, mgroup, name);
+ PrimitiveManipulator *prim = (PrimitiveManipulator *)WM_manipulator_new(
+ "MANIPULATOR_WT_primitive3d", mgroup, name);
const float dir_default[3] = {0.0f, 0.0f, 1.0f};
@@ -241,7 +241,7 @@ static void MANIPULATOR_
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list