From ec963d9d7d179e3ba12f5bdf748818939c2f17d8 Mon Sep 17 00:00:00 2001 From: Hans Goudey Date: Fri, 19 Jun 2020 14:42:08 -0400 Subject: UI: Grease Pencil Modifier Drag and Drop, Layout Changes This patch implements the list panel system D7490 for grease pencil modifiers. It also moves their drawing to a callback in GpencilModifierTypeInfo in line with the extensible architecture refactoring goal T75724. This also adds the "set_error" function for grease pencil modifiers, which hadn't been copied from mesh modifiers yet. The implementation is basically exactly the same as for the modifier patch (9b099c86123fc82). Thanks to Matias Mendiola (mendio) for providing mockups for many of the layout changes. Differential Revision: https://developer.blender.org/D7978 --- source/blender/editors/space_buttons/space_buttons.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'source/blender/editors/space_buttons/space_buttons.c') diff --git a/source/blender/editors/space_buttons/space_buttons.c b/source/blender/editors/space_buttons/space_buttons.c index 187334a5c34..2cc9679dd3f 100644 --- a/source/blender/editors/space_buttons/space_buttons.c +++ b/source/blender/editors/space_buttons/space_buttons.c @@ -30,11 +30,10 @@ #include "BLI_utildefines.h" #include "BKE_context.h" +#include "BKE_gpencil_modifier.h" /* Types for registering panels. */ #include "BKE_modifier.h" #include "BKE_screen.h" -#include "DNA_modifier_types.h" - #include "ED_screen.h" #include "ED_space_api.h" #include "ED_view3d.h" /* To draw toolbar UI. */ @@ -643,6 +642,12 @@ void ED_spacetype_buttons(void) mti->panelRegister(art); } } + for (int i = 0; i < NUM_GREASEPENCIL_MODIFIER_TYPES; i++) { + const GpencilModifierTypeInfo *mti = BKE_gpencil_modifier_get_info(i); + if (mti != NULL && mti->panelRegister != NULL) { + mti->panelRegister(art); + } + } /* regions: header */ art = MEM_callocN(sizeof(ARegionType), "spacetype buttons region"); -- cgit v1.2.3 From bb4cef71eeaf36aa61187d47b8a8ae06ba55f7c0 Mon Sep 17 00:00:00 2001 From: Hans Goudey Date: Fri, 19 Jun 2020 15:07:13 -0400 Subject: UI: ShaderFx Drag and Drop, Layout Updates This patch implements the list panel system D7490 for grease pencil shader effects. It also moves their drawing to a callback in ShaderFxTypeInfo in line with the extensible architecture refactoring goal T75724. The implementation is basically exactly the same as for the modifier patch (9b099c86123fc82). Thanks to Matias Mendiola (@mendio) for helping to develop the layout changes. Differential Revision: https://developer.blender.org/D7985 --- source/blender/editors/space_buttons/space_buttons.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'source/blender/editors/space_buttons/space_buttons.c') diff --git a/source/blender/editors/space_buttons/space_buttons.c b/source/blender/editors/space_buttons/space_buttons.c index 2cc9679dd3f..71b86996989 100644 --- a/source/blender/editors/space_buttons/space_buttons.c +++ b/source/blender/editors/space_buttons/space_buttons.c @@ -33,6 +33,7 @@ #include "BKE_gpencil_modifier.h" /* Types for registering panels. */ #include "BKE_modifier.h" #include "BKE_screen.h" +#include "BKE_shader_fx.h" #include "ED_screen.h" #include "ED_space_api.h" @@ -648,6 +649,15 @@ void ED_spacetype_buttons(void) mti->panelRegister(art); } } + for (int i = 0; i < NUM_SHADER_FX_TYPES; i++) { + if (i == eShaderFxType_Light_deprecated) { + continue; + } + const ShaderFxTypeInfo *fxti = BKE_shaderfx_get_info(i); + if (fxti != NULL && fxti->panelRegister != NULL) { + fxti->panelRegister(art); + } + } /* regions: header */ art = MEM_callocN(sizeof(ARegionType), "spacetype buttons region"); -- cgit v1.2.3 From a856de700b4274ebc1735aa349f7425c7c23cbfc Mon Sep 17 00:00:00 2001 From: Hans Goudey Date: Mon, 6 Jul 2020 13:17:07 -0400 Subject: Fix T77730: ShaderFx Missing Update Notifier This adds a notification type for shaderfx so the properties editor can be properly notified to redraw. Another possible solution would be to also redraw the shaderfx tab with a ND_MODIFIER update, but this solution allows us to avoid some unecessary redraws too. There were no existing cases of ND_OBJECT | NC_MODIFIER updates, so those cases were removed from buttons_area_listener. Differential Revision: https://developer.blender.org/D8159 --- source/blender/editors/space_buttons/space_buttons.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'source/blender/editors/space_buttons/space_buttons.c') diff --git a/source/blender/editors/space_buttons/space_buttons.c b/source/blender/editors/space_buttons/space_buttons.c index 71b86996989..88c2c6e82b6 100644 --- a/source/blender/editors/space_buttons/space_buttons.c +++ b/source/blender/editors/space_buttons/space_buttons.c @@ -422,6 +422,9 @@ static void buttons_area_listener(wmWindow *UNUSED(win), buttons_area_redraw(area, BCONTEXT_CONSTRAINT); buttons_area_redraw(area, BCONTEXT_BONE_CONSTRAINT); break; + case ND_SHADERFX: + buttons_area_redraw(area, BCONTEXT_SHADERFX); + break; case ND_PARTICLE: if (wmn->action == NA_EDITED) { buttons_area_redraw(area, BCONTEXT_PARTICLE); @@ -435,13 +438,6 @@ static void buttons_area_listener(wmWindow *UNUSED(win), /* Needed to refresh context path when changing active particle system index. */ buttons_area_redraw(area, BCONTEXT_PARTICLE); break; - case ND_SHADING: - case ND_SHADING_DRAW: - case ND_SHADING_LINKS: - case ND_SHADING_PREVIEW: - /* currently works by redraws... if preview is set, it (re)starts job */ - sbuts->preview = 1; - break; default: /* Not all object RNA props have a ND_ notifier (yet) */ ED_area_tag_redraw(area); -- cgit v1.2.3 From 6f3c37a3ff83222bf8d2de8a888b63bdfb70c079 Mon Sep 17 00:00:00 2001 From: Hans Goudey Date: Thu, 23 Jul 2020 11:01:59 -0400 Subject: UI: Move properties tab list creation from RNA to editor This is a change I pulled from the property-search-ui branch, where I have to use the list of tabs to search the inactive tabs and it makes more sense to use the array directly. It is also an improvement to have this fundamental code to the properties editor in the editor code rather than an RNA callback. There are no functional changes. Differential Revision: https://developer.blender.org/D8368 --- .../blender/editors/space_buttons/space_buttons.c | 93 ++++++++++++++++++++++ 1 file changed, 93 insertions(+) (limited to 'source/blender/editors/space_buttons/space_buttons.c') diff --git a/source/blender/editors/space_buttons/space_buttons.c b/source/blender/editors/space_buttons/space_buttons.c index 88c2c6e82b6..8337c9b792a 100644 --- a/source/blender/editors/space_buttons/space_buttons.c +++ b/source/blender/editors/space_buttons/space_buttons.c @@ -35,6 +35,7 @@ #include "BKE_screen.h" #include "BKE_shader_fx.h" +#include "ED_buttons.h" #include "ED_screen.h" #include "ED_space_api.h" #include "ED_view3d.h" /* To draw toolbar UI. */ @@ -139,6 +140,98 @@ static void buttons_main_region_init(wmWindowManager *wm, ARegion *region) WM_event_add_keymap_handler(®ion->handlers, keymap); } +/** + * Fills an array with the tab context values for the properties editor. -1 signals a separator. + * + * \return The total number of items in the array returned. + */ +int ED_buttons_tabs_list(SpaceProperties *sbuts, int *context_tabs_array) +{ + int length = 0; + if (sbuts->pathflag & (1 << BCONTEXT_TOOL)) { + context_tabs_array[length] = BCONTEXT_TOOL; + length++; + } + if (length != 0) { + context_tabs_array[length] = -1; + length++; + } + if (sbuts->pathflag & (1 << BCONTEXT_RENDER)) { + context_tabs_array[length] = BCONTEXT_RENDER; + length++; + } + if (sbuts->pathflag & (1 << BCONTEXT_OUTPUT)) { + context_tabs_array[length] = BCONTEXT_OUTPUT; + length++; + } + if (sbuts->pathflag & (1 << BCONTEXT_VIEW_LAYER)) { + context_tabs_array[length] = BCONTEXT_VIEW_LAYER; + length++; + } + if (sbuts->pathflag & (1 << BCONTEXT_SCENE)) { + context_tabs_array[length] = BCONTEXT_SCENE; + length++; + } + if (sbuts->pathflag & (1 << BCONTEXT_WORLD)) { + context_tabs_array[length] = BCONTEXT_WORLD; + length++; + } + if (length != 0) { + context_tabs_array[length] = -1; + length++; + } + if (sbuts->pathflag & (1 << BCONTEXT_OBJECT)) { + context_tabs_array[length] = BCONTEXT_OBJECT; + length++; + } + if (sbuts->pathflag & (1 << BCONTEXT_MODIFIER)) { + context_tabs_array[length] = BCONTEXT_MODIFIER; + length++; + } + if (sbuts->pathflag & (1 << BCONTEXT_SHADERFX)) { + context_tabs_array[length] = BCONTEXT_SHADERFX; + length++; + } + if (sbuts->pathflag & (1 << BCONTEXT_PARTICLE)) { + context_tabs_array[length] = BCONTEXT_PARTICLE; + length++; + } + if (sbuts->pathflag & (1 << BCONTEXT_PHYSICS)) { + context_tabs_array[length] = BCONTEXT_PHYSICS; + length++; + } + if (sbuts->pathflag & (1 << BCONTEXT_CONSTRAINT)) { + context_tabs_array[length] = BCONTEXT_CONSTRAINT; + length++; + } + if (sbuts->pathflag & (1 << BCONTEXT_DATA)) { + context_tabs_array[length] = BCONTEXT_DATA; + length++; + } + if (sbuts->pathflag & (1 << BCONTEXT_BONE)) { + context_tabs_array[length] = BCONTEXT_BONE; + length++; + } + if (sbuts->pathflag & (1 << BCONTEXT_BONE_CONSTRAINT)) { + context_tabs_array[length] = BCONTEXT_BONE_CONSTRAINT; + length++; + } + if (sbuts->pathflag & (1 << BCONTEXT_MATERIAL)) { + context_tabs_array[length] = BCONTEXT_MATERIAL; + length++; + } + if (length != 0) { + context_tabs_array[length] = -1; + length++; + } + if (sbuts->pathflag & (1 << BCONTEXT_TEXTURE)) { + context_tabs_array[length] = BCONTEXT_TEXTURE; + length++; + } + + return length; +} + static void buttons_main_region_layout_properties(const bContext *C, SpaceProperties *sbuts, ARegion *region) -- cgit v1.2.3 From 18cca0e7043f9a7c38c7163f1fab5140eea82cae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Foucault?= Date: Sat, 25 Jul 2020 18:53:04 +0200 Subject: Cleanup: GPU: Remove GPU_glew.h outside of GPU module Remove use of GL* constants and types inside the codebase. There is still a few occurence to get rid of. --- source/blender/editors/space_buttons/space_buttons.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'source/blender/editors/space_buttons/space_buttons.c') diff --git a/source/blender/editors/space_buttons/space_buttons.c b/source/blender/editors/space_buttons/space_buttons.c index 8337c9b792a..67efd8f4b8e 100644 --- a/source/blender/editors/space_buttons/space_buttons.c +++ b/source/blender/editors/space_buttons/space_buttons.c @@ -50,8 +50,6 @@ #include "UI_resources.h" -#include "GPU_glew.h" - #include "buttons_intern.h" /* own include */ /* ******************** default callbacks for buttons space ***************** */ -- cgit v1.2.3