Commit: e3bb4086162126240b73c054bc210a92bb593d61
Author: Julian Eisel
Date:   Sun Dec 20 19:35:25 2015 +0100
Branches: temp_widgets_c++_experiment
https://developer.blender.org/rBe3bb4086162126240b73c054bc210a92bb593d61

Use C++ version of widget-group-types where possible

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

M       source/blender/windowmanager/intern/widgets/wm_widgetgrouptype.cc
M       source/blender/windowmanager/intern/widgets/wm_widgetgrouptype.h
M       source/blender/windowmanager/intern/widgets/wm_widgetmap.cc

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

diff --git a/source/blender/windowmanager/intern/widgets/wm_widgetgrouptype.cc 
b/source/blender/windowmanager/intern/widgets/wm_widgetgrouptype.cc
index fbd05c5..5aa3549 100644
--- a/source/blender/windowmanager/intern/widgets/wm_widgetgrouptype.cc
+++ b/source/blender/windowmanager/intern/widgets/wm_widgetgrouptype.cc
@@ -167,3 +167,8 @@ size_t wmWidgetGroupType::get_idname(char *r_idname)
        return sizeof(this->idname);
 }
 
+bool wmWidgetGroupType::poll_check(const bContext *C)
+{
+       return (!poll || poll(C, this));
+}
+
diff --git a/source/blender/windowmanager/intern/widgets/wm_widgetgrouptype.h 
b/source/blender/windowmanager/intern/widgets/wm_widgetgrouptype.h
index ea0d9c3..a5d07e4 100644
--- a/source/blender/windowmanager/intern/widgets/wm_widgetgrouptype.h
+++ b/source/blender/windowmanager/intern/widgets/wm_widgetgrouptype.h
@@ -59,6 +59,8 @@ public:
        void attach_to_handler(bContext *C, struct wmEventHandler *handler, 
struct wmOperator *op);
        size_t get_idname(char *r_idname);
 
+       bool poll_check(const bContext *) ATTR_WARN_UNUSED_RESULT;
+
 private:
        char idname[64]; /* MAX_NAME */
        char name[64]; /* widget group name - displayed in UI (keymap editor) */
diff --git a/source/blender/windowmanager/intern/widgets/wm_widgetmap.cc 
b/source/blender/windowmanager/intern/widgets/wm_widgetmap.cc
index 08b5da8..4f3daa0 100644
--- a/source/blender/windowmanager/intern/widgets/wm_widgetmap.cc
+++ b/source/blender/windowmanager/intern/widgets/wm_widgetmap.cc
@@ -152,7 +152,7 @@ static void 
widgetmap_prepare_visible_widgets_3d(wmWidgetMap *wmap, ListBase *vi
        wmWidget *widget;
 
        for (wmWidgetGroup *wgroup = (wmWidgetGroup *)wmap->widgetgroups.first; 
wgroup; wgroup = wgroup->next) {
-               if (!wgroup->type->poll || wgroup->type->poll(C, wgroup->type)) 
{
+               if (wgroup->type_cxx->poll_check(C)) {
                        for (widget = (wmWidget *)wgroup->widgets.first; 
widget; widget = widget->next) {
                                if (widget->render_3d_intersection && 
(widget->flag & WM_WIDGET_HIDDEN) == 0) {
                                        BLI_addhead(visible_widgets, 
BLI_genericNodeN(widget));
@@ -204,7 +204,7 @@ static wmWidget *widgetmap_find_highlighted_widget(
        wmWidget *widget;
 
        for (wmWidgetGroup *wgroup = (wmWidgetGroup *)wmap->widgetgroups.first; 
wgroup; wgroup = wgroup->next) {
-               if (!wgroup->type->poll || wgroup->type->poll(C, wgroup->type)) 
{
+               if (wgroup->type_cxx->poll_check(C)) {
                        for (widget = (wmWidget *)wgroup->widgets.first; 
widget; widget = widget->next) {
                                if (widget->intersect) {
                                        if ((*part = widget->intersect(C, 
event, widget)))

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to