[Bf-blender-cvs] [ccaf8d1] temp_widgets_update_tagging: More refactoring of the update->draw routine
Julian Eisel
noreply at git.blender.org
Tue Mar 8 01:41:52 CET 2016
Commit: ccaf8d1decfa1dc5401a894dcc179211e30f19a1
Author: Julian Eisel
Date: Tue Mar 8 01:30:20 2016 +0100
Branches: temp_widgets_update_tagging
https://developer.blender.org/rBccaf8d1decfa1dc5401a894dcc179211e30f19a1
More refactoring of the update->draw routine
We never recreate widgets anymore, we only create them once using an init callback and handle changing data in update callbacks.
For efficiency, we now have 3 widgetgroup init/update callbacks:
* init - initialize data that doesn't change in widget lifetime
* refresh - update data that doesn't change each redraw, only called if WM_widgetmap_tag_refresh was called before
* draw_prepare - update drawing data, called before each redraw
This should really increase widget drawing performance.
Note: Widgets other than the transform manipulator are still not adjusted to work in new drawing routine.
===================================================================
M source/blender/editors/include/ED_transform.h
M source/blender/editors/include/ED_view3d.h
M source/blender/editors/object/object_edit.c
M source/blender/editors/space_graph/graph_edit.c
M source/blender/editors/space_graph/space_graph.c
M source/blender/editors/space_image/space_image.c
M source/blender/editors/space_node/node_draw.c
M source/blender/editors/space_node/space_node.c
M source/blender/editors/space_sequencer/sequencer_draw.c
M source/blender/editors/space_sequencer/sequencer_view.c
M source/blender/editors/space_sequencer/space_sequencer.c
M source/blender/editors/space_view3d/space_view3d.c
M source/blender/editors/space_view3d/view3d_draw.c
M source/blender/editors/space_view3d/view3d_intern.h
M source/blender/editors/space_view3d/view3d_widgets.c
M source/blender/editors/transform/transform_manipulator.c
M source/blender/editors/transform/transform_manipulator2d.c
M source/blender/windowmanager/widgets/WM_widget_api.h
M source/blender/windowmanager/widgets/WM_widget_types.h
M source/blender/windowmanager/widgets/intern/wm_widget_intern.h
M source/blender/windowmanager/widgets/intern/wm_widgetgroup.c
M source/blender/windowmanager/widgets/intern/wm_widgetmap.c
===================================================================
diff --git a/source/blender/editors/include/ED_transform.h b/source/blender/editors/include/ED_transform.h
index eabcefc..381dc81 100644
--- a/source/blender/editors/include/ED_transform.h
+++ b/source/blender/editors/include/ED_transform.h
@@ -161,13 +161,14 @@ void Transform_Properties(struct wmOperatorType *ot, int flags);
/* transform manipulators */
int WIDGETGROUP_manipulator_poll(const struct bContext *C, struct wmWidgetGroupType *wgrouptype);
-void WIDGETGROUP_manipulator_create(const struct bContext *C, struct wmWidgetGroup *wgroup);
-void WIDGETGROUP_manipulator_update(const struct bContext *C, struct wmWidgetGroup *wgroup);
+void WIDGETGROUP_manipulator_init(const struct bContext *C, struct wmWidgetGroup *wgroup);
+void WIDGETGROUP_manipulator_refresh(const struct bContext *C, struct wmWidgetGroup *wgroup);
+void WIDGETGROUP_manipulator_draw_prepare(const struct bContext *C, struct wmWidgetGroup *wgroup);
-void WIDGETGROUP_object_manipulator_create(const struct bContext *C, struct wmWidgetGroup *wgroup);
+void WIDGETGROUP_object_manipulator_init(const struct bContext *C, struct wmWidgetGroup *wgroup);
int WIDGETGROUP_object_manipulator_poll(const struct bContext *C, struct wmWidgetGroupType *wgrouptype);
-void WIDGETGROUP_manipulator2d_create(const struct bContext *C, struct wmWidgetGroup *wgroup);
+void WIDGETGROUP_manipulator2d_init(const struct bContext *C, struct wmWidgetGroup *wgroup);
int WIDGETGROUP_manipulator2d_poll(const struct bContext *C, struct wmWidgetGroupType *wgrouptype);
diff --git a/source/blender/editors/include/ED_view3d.h b/source/blender/editors/include/ED_view3d.h
index 7d984ef..3bd1cb9 100644
--- a/source/blender/editors/include/ED_view3d.h
+++ b/source/blender/editors/include/ED_view3d.h
@@ -414,7 +414,7 @@ bool ED_view3d_snap_from_ray(
float r_co[3]);
int WIDGETGROUP_lamp_poll(const struct bContext *C, struct wmWidgetGroupType *wgrouptype);
-void WIDGETGROUP_lamp_create(const struct bContext *C, struct wmWidgetGroup *wgroup);
+void WIDGETGROUP_lamp_init(const struct bContext *C, struct wmWidgetGroup *wgroup);
/* render */
void ED_view3d_stop_render_preview(struct wmWindowManager *wm, struct ARegion *ar);
diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c
index f7aaea4..e54509b 100644
--- a/source/blender/editors/object/object_edit.c
+++ b/source/blender/editors/object/object_edit.c
@@ -2184,7 +2184,7 @@ static int object_widget_add_exec(bContext *C, wmOperator *UNUSED(op))
CTX_data_main(C),
&(const struct wmWidgetMapType_Params) {"View3D", SPACE_VIEW3D, RGN_TYPE_WINDOW, WM_WIDGETMAPTYPE_3D},
WIDGETGROUP_object_manipulator_poll,
- WIDGETGROUP_object_manipulator_create,
+ WIDGETGROUP_object_manipulator_init,
WM_widgetgroup_keymap_common,
"Object Widgets");
diff --git a/source/blender/editors/space_graph/graph_edit.c b/source/blender/editors/space_graph/graph_edit.c
index 3c7afff..5e656a9 100644
--- a/source/blender/editors/space_graph/graph_edit.c
+++ b/source/blender/editors/space_graph/graph_edit.c
@@ -2613,7 +2613,7 @@ static int graph_widget_backdrop_transform_poll(bContext *C)
(sipo->backdrop_camera));
}
-static void widgetgroup_backdrop_create(const struct bContext *C, struct wmWidgetGroup *wgroup)
+static void widgetgroup_backdrop_init(const struct bContext *C, struct wmWidgetGroup *wgroup)
{
ARegion *ar = CTX_wm_region(C);
wmOperator *op = wgroup->type->op;
@@ -2641,7 +2641,7 @@ static wmWidgetGroupType *graph_widget_backdrop_transform_widgets(void)
return WM_widgetgrouptype_register(
NULL,
&(const struct wmWidgetMapType_Params) {"Graph_Canvas", SPACE_IPO, RGN_TYPE_WINDOW, 0},
- NULL, widgetgroup_backdrop_create,
+ NULL, widgetgroup_backdrop_init,
WM_widgetgroup_keymap_common,
"Backdrop Transform Widgets");
}
diff --git a/source/blender/editors/space_graph/space_graph.c b/source/blender/editors/space_graph/space_graph.c
index 2d4e4e4..a2ac466 100644
--- a/source/blender/editors/space_graph/space_graph.c
+++ b/source/blender/editors/space_graph/space_graph.c
@@ -352,7 +352,7 @@ static void graph_main_region_draw(const bContext *C, ARegion *ar)
/* finally draw any widgets here */
WM_widgetmap_widgets_update(C, ar->widgetmaps.first);
- WM_widgetmap_widgets_draw(C, ar->widgetmaps.first, false);
+ WM_widgetmap_widgets_draw(C, ar->widgetmaps.first, false, true);
/* scrollers */
// FIXME: args for scrollers depend on the type of data being shown...
diff --git a/source/blender/editors/space_image/space_image.c b/source/blender/editors/space_image/space_image.c
index 0e0cdac..be76156 100644
--- a/source/blender/editors/space_image/space_image.c
+++ b/source/blender/editors/space_image/space_image.c
@@ -593,7 +593,7 @@ static void image_widgets(void)
WM_widgetgrouptype_register_ptr(
NULL, wmaptype,
WIDGETGROUP_manipulator2d_poll,
- WIDGETGROUP_manipulator2d_create,
+ WIDGETGROUP_manipulator2d_init,
WM_widgetgroup_keymap_common,
"Manipulator Widgets");
}
@@ -810,7 +810,7 @@ static void image_main_region_draw(const bContext *C, ARegion *ar)
}
WM_widgetmap_widgets_update(C, ar->widgetmaps.first);
- WM_widgetmap_widgets_draw(C, ar->widgetmaps.first, false);
+ WM_widgetmap_widgets_draw(C, ar->widgetmaps.first, false, true);
draw_image_cache(C, ar);
diff --git a/source/blender/editors/space_node/node_draw.c b/source/blender/editors/space_node/node_draw.c
index 6dd98de..229bd6f 100644
--- a/source/blender/editors/space_node/node_draw.c
+++ b/source/blender/editors/space_node/node_draw.c
@@ -1377,7 +1377,7 @@ void drawnodespace(const bContext *C, ARegion *ar)
wmOrtho2_pixelspace(ar->winx, ar->winy);
WM_widgetmap_widgets_update(C, ar->widgetmaps.first);
- WM_widgetmap_widgets_draw(C, ar->widgetmaps.first, false);
+ WM_widgetmap_widgets_draw(C, ar->widgetmaps.first, false, true);
glMatrixMode(GL_PROJECTION);
glPopMatrix();
diff --git a/source/blender/editors/space_node/space_node.c b/source/blender/editors/space_node/space_node.c
index 8e0cd42..6de6cc2 100644
--- a/source/blender/editors/space_node/space_node.c
+++ b/source/blender/editors/space_node/space_node.c
@@ -849,7 +849,7 @@ static int WIDGETGROUP_node_transform_poll(const struct bContext *C, struct wmWi
return false;
}
-static void WIDGETGROUP_node_transform_create(const struct bContext *C, struct wmWidgetGroup *wgroup)
+static void WIDGETGROUP_node_transform_init(const struct bContext *C, struct wmWidgetGroup *wgroup)
{
Image *ima;
ImBuf *ibuf;
@@ -894,7 +894,7 @@ static void node_widgets(void)
WM_widgetgrouptype_register_ptr(
NULL, wmaptype,
WIDGETGROUP_node_transform_poll,
- WIDGETGROUP_node_transform_create,
+ WIDGETGROUP_node_transform_init,
WM_widgetgroup_keymap_common,
"Backdrop Transform Widgets");
}
diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c b/source/blender/editors/space_sequencer/sequencer_draw.c
index f328bda..2fcd3e8 100644
--- a/source/blender/editors/space_sequencer/sequencer_draw.c
+++ b/source/blender/editors/space_sequencer/sequencer_draw.c
@@ -1676,7 +1676,7 @@ void draw_timeline_seq(const bContext *C, ARegion *ar)
/* finally draw any widgets here */
WM_widgetmap_widgets_update(C, ar->widgetmaps.first);
- WM_widgetmap_widgets_draw(C, ar->widgetmaps.first, false);
+ WM_widgetmap_widgets_draw(C, ar->widgetmaps.first, false, true);
/* scrollers */
unit = (sseq->flag & SEQ_DRAWFRAMES) ? V2D_UNIT_FRAMES : V2D_UNIT_SECONDS;
diff --git a/source/blender/editors/space_sequencer/sequencer_view.c b/source/blender/editors/space_sequencer/sequencer_view.c
index 906acae..9582b4a 100644
--- a/source/blender/editors/space_sequencer/sequencer_view.c
+++ b/source/blender/editors/space_sequencer/sequencer_view.c
@@ -265,7 +265,7 @@ static int sequencer_overdrop_transform_poll(bContext *C)
return (sseq && ar && ar->type->regionid == RGN_TYPE_WINDOW && (sseq->draw_flag & SEQ_DRAW_OVERDROP));
}
-static void widgetgroup_overdrop_create(const struct bContext *C, struct wmWidgetGroup *wgroup)
+static void widgetgroup_overdrop_init(const struct bContext *C, struct wmWidgetGroup *wgroup)
{
ARegion *ar = CTX_wm_region(C);
wmOperator *op = wgroup->type->op;
@@ -293,7 +293,7 @@ static wmWidgetGroupType *sequencer_overdrop_widgets(void)
return WM_widgetgrouptype_register(
NULL,
&(const struct wmWidgetMapType_Params) {"Seq_Canvas", SPACE_SEQ, RGN_TYPE_WINDOW, 0},
- NULL, widgetgroup_overdrop_create,
+ NULL, widgetgroup_overdrop_init,
WM_widgetgroup_keymap_common,
"Backdrop Transform Widgets");
}
@@ -432,7 +432,7 @@ static int sequencer_image_transform_widget_poll(bContext *C)
return (sseq && ar && ar->type->regionid == RGN_TYPE_PREVIEW);
}
-static void widgetgroup_image_transform_create(const struct bContext *C, struct wmWidgetGroup *wgroup)
+static void widgetgroup_image_transform_init(const struct bContext *C, struct wmWidgetGroup *wgroup)
{
ARegion *ar = CTX_wm_region(C);
View2D *v2d = &ar->v2d;
@@ -463,7 +463,7 @@ static wmWidgetGroupType *sequencer_image_transform_widgets(void)
return WM_widgetgrouptype_register(
NULL,
&(const struct wmWidgetMapType_Params) {"Seq_Canvas", SPACE_SEQ, RGN_TYPE_PREVIEW, 0},
- NULL, widgetgroup_image_transform_create,
+ NULL, widgetgroup_image_transform_init,
WM_widgetgroup_keymap_common,
"Image Transform Widgets");
}
diff --git a/source/blender/editors/space_sequencer/space_sequencer.c b/source/blender/editors/space_sequencer/space_sequencer.c
index 71386fd..6dcb0ec 100644
--- a/source/blender/editors/space_sequencer/space_sequencer.c
+++ b/source/blender/editors/space_sequencer/space_sequencer.c
@@ -610,7 +610,7 @@ static void sequencer_preview_region_draw(const bContext *C, ARegion *ar)
}
WM_widgetmap_widgets_update(C, ar->widgetmaps.first);
- WM_widgetmap_widgets_draw(C, ar->widgetmaps.first, false);
+ WM_widgetmap_widgets_draw(C, ar->w
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list