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:
authorHans Goudey <h.goudey@me.com>2020-06-29 22:00:25 +0300
committerHans Goudey <h.goudey@me.com>2020-06-29 22:00:25 +0300
commit1fa40c9f8a81036476d5051b09ff15e27b628012 (patch)
tree37a5fa840d8eae820b5aff81fbe4e3e36599aab3 /source/blender/blenkernel/intern
parent4f8a881715ca71599c1f4ee82b76cbce0a02b4d9 (diff)
UI: Add shortcuts for modifier panels
The shortcuts act on the modifier with its panel under the mouse. The following shortcuts are enabled by default: - Remove modifier: X, Delete - Apply modifier: Ctrl A - Duplicate modifier: Shift D More shortcuts can be added in the keymap. Each panel can now store a custom data RNA pointer, and a new function is added to get the custom data for the panel under the cursor. This custom data could be used to refactor the "List Panel System" to generalize it and integrate it further with RNA. The same functionality will be added in further commits where it applies to constraints, grease pencil modifiers, and effects. Differential Revision: https://developer.blender.org/D8031
Diffstat (limited to 'source/blender/blenkernel/intern')
-rw-r--r--source/blender/blenkernel/intern/screen.c26
1 files changed, 17 insertions, 9 deletions
diff --git a/source/blender/blenkernel/intern/screen.c b/source/blender/blenkernel/intern/screen.c
index bfc0d437994..c510b3a2dfb 100644
--- a/source/blender/blenkernel/intern/screen.c
+++ b/source/blender/blenkernel/intern/screen.c
@@ -393,6 +393,7 @@ static void panel_list_copy(ListBase *newlb, const ListBase *lb)
Panel *panel = lb->first;
for (; new_panel; new_panel = new_panel->next, panel = panel->next) {
new_panel->activedata = NULL;
+ new_panel->runtime.custom_data_ptr = NULL;
panel_list_copy(&new_panel->children, &panel->children);
}
}
@@ -575,18 +576,25 @@ void BKE_region_callback_free_gizmomap_set(void (*callback)(struct wmGizmoMap *)
region_free_gizmomap_callback = callback;
}
-void BKE_area_region_panels_free(ListBase *lb)
+static void area_region_panels_free_recursive(Panel *panel)
{
- Panel *panel, *panel_next;
- for (panel = lb->first; panel; panel = panel_next) {
- panel_next = panel->next;
- if (panel->activedata) {
- MEM_freeN(panel->activedata);
- }
- BKE_area_region_panels_free(&panel->children);
+ MEM_SAFE_FREE(panel->activedata);
+
+ LISTBASE_FOREACH_MUTABLE (Panel *, child_panel, &panel->children) {
+ area_region_panels_free_recursive(child_panel);
}
- BLI_freelistN(lb);
+ MEM_freeN(panel);
+}
+
+void BKE_area_region_panels_free(ListBase *lb)
+{
+ LISTBASE_FOREACH_MUTABLE (Panel *, panel, lb) {
+ /* Free custom data just for parent panels to avoid a double free. */
+ MEM_SAFE_FREE(panel->runtime.custom_data_ptr);
+ area_region_panels_free_recursive(panel);
+ }
+ BLI_listbase_clear(lb);
}
/* not region itself */