Commit: bfe73288bda337d00c1edcd75b82106026e7b4e5
Author: Julian Eisel
Date:   Thu Nov 12 20:23:02 2015 +0100
Branches: wiggly-widgets
https://developer.blender.org/rBbfe73288bda337d00c1edcd75b82106026e7b4e5

Allow de-selecting Face Maps

Using de-select all for bones now de-selects all face maps, too.

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

M       source/blender/editors/armature/pose_select.c
M       source/blender/windowmanager/WM_api.h
M       source/blender/windowmanager/intern/wm_widgets.c

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

diff --git a/source/blender/editors/armature/pose_select.c 
b/source/blender/editors/armature/pose_select.c
index 44470c1..e12fb3a 100644
--- a/source/blender/editors/armature/pose_select.c
+++ b/source/blender/editors/armature/pose_select.c
@@ -352,6 +352,7 @@ static int pose_de_select_all_exec(bContext *C, wmOperator 
*op)
 {
        int action = RNA_enum_get(op->ptr, "action");
        
+       const ARegion *ar = CTX_wm_region(C);
        Scene *scene = CTX_data_scene(C);
        Object *ob = ED_object_context(C);
        bArmature *arm = ob->data;
@@ -368,6 +369,9 @@ static int pose_de_select_all_exec(bContext *C, wmOperator 
*op)
        }
        CTX_DATA_END;
 
+       /* handle widget selection */
+       WM_widgetmap_select_all(C, (wmWidgetMap *)ar->widgetmaps.first, action);
+
        WM_event_add_notifier(C, NC_OBJECT | ND_BONE_SELECT, NULL);
        
        /* weightpaint or mask modifiers need depsgraph updates */
diff --git a/source/blender/windowmanager/WM_api.h 
b/source/blender/windowmanager/WM_api.h
index 4b3fc81..ab6f0be 100644
--- a/source/blender/windowmanager/WM_api.h
+++ b/source/blender/windowmanager/WM_api.h
@@ -500,7 +500,10 @@ float       WM_event_tablet_data(const struct wmEvent 
*event, int *pen_flip, flo
 bool        WM_event_is_tablet(const struct wmEvent *event);
 
 
-/* *************** Widget API ******************** */
+/* *************** Widget API ********************
+ *
+ * TODO getting a bit crowded here - maybe move into own .h file?
+ */
 
 struct wmWidget *WM_widget_new(void (*draw)(const struct bContext *, struct 
wmWidget *),
                                void (*render_3d_intersection)(const struct 
bContext *, struct wmWidget *, int),
@@ -546,6 +549,8 @@ wmKeyMap *WM_widgetgroup_keymap_common(wmKeyConfig *config, 
const char *wgroupna
 
 struct wmWidgetMapType *WM_widgetmaptype_find(const char *idname, const int 
spaceid, const int regionid,
                                               const bool is_3d, const bool 
create);
+bool WM_widgetmap_select_all(struct bContext *C, struct wmWidgetMap *wmap, 
const int action);
+
 struct wmWidgetGroupType *WM_widgetgrouptype_new(
         int (*poll)(const struct bContext *, struct wmWidgetGroupType *),
         void (*create)(const struct bContext *, struct wmWidgetGroup *),
diff --git a/source/blender/windowmanager/intern/wm_widgets.c 
b/source/blender/windowmanager/intern/wm_widgets.c
index e9f12bf..9fd07c5 100644
--- a/source/blender/windowmanager/intern/wm_widgets.c
+++ b/source/blender/windowmanager/intern/wm_widgets.c
@@ -1074,6 +1074,34 @@ void wm_widgetmap_set_selected_widget(bContext *C, 
wmWidgetMap *wmap, wmWidget *
        }
 }
 
+/**
+ * Select/Deselect all selectable widgets in \a wmap
+ *
+ * \return if selection has changed.
+ *
+ * TODO currently only one selected widget supported
+ */
+bool WM_widgetmap_select_all(bContext *C, wmWidgetMap *wmap, const int action)
+{
+       bool changed = false;
+
+       switch (action) {
+               case SEL_SELECT:
+                       printf("Selecting multiple widgets is not supported 
yet!\n");
+                       break;
+               case SEL_DESELECT:
+                       if (wmap->selected_widget) {
+                               changed = true;
+                       }
+                       wm_widgetmap_set_selected_widget(C, wmap, NULL);
+                       break;
+               default:
+                       BLI_assert(0);
+       }
+
+       return changed;
+}
+
 void wm_widgetmap_handler_context(bContext *C, wmEventHandler *handler)
 {
        bScreen *screen = CTX_wm_screen(C);

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

Reply via email to