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-09-15 02:48:52 +0300
committerHans Goudey <h.goudey@me.com>2020-09-15 02:48:52 +0300
commitb827d1c530821e7679a948f41411753dc2dc52f2 (patch)
tree99a8e3978f67591bec93a552f29bda993d8d5f67 /source/blender/editors/space_buttons/space_buttons.c
parent9a870ccc6afa5065a48be762400cbb76b1f0b70a (diff)
Cleanup: Split properties editor layout function
Getting the string for a specific context is a basic thing that can be its own function. This way it can also be reused in other functions.
Diffstat (limited to 'source/blender/editors/space_buttons/space_buttons.c')
-rw-r--r--source/blender/editors/space_buttons/space_buttons.c74
1 files changed, 32 insertions, 42 deletions
diff --git a/source/blender/editors/space_buttons/space_buttons.c b/source/blender/editors/space_buttons/space_buttons.c
index 3b7fe45f9c8..377a9a6c1e4 100644
--- a/source/blender/editors/space_buttons/space_buttons.c
+++ b/source/blender/editors/space_buttons/space_buttons.c
@@ -230,68 +230,58 @@ int ED_buttons_tabs_list(SpaceProperties *sbuts, int *context_tabs_array)
return length;
}
-static void buttons_main_region_layout_properties(const bContext *C,
- SpaceProperties *sbuts,
- ARegion *region)
+static const char *buttons_main_region_context_string(const short mainb)
{
- buttons_context_compute(C, sbuts);
-
- const char *contexts[2] = {NULL, NULL};
-
- switch (sbuts->mainb) {
+ switch (mainb) {
case BCONTEXT_SCENE:
- contexts[0] = "scene";
- break;
+ return "scene";
case BCONTEXT_RENDER:
- contexts[0] = "render";
- break;
+ return "render";
case BCONTEXT_OUTPUT:
- contexts[0] = "output";
- break;
+ return "output";
case BCONTEXT_VIEW_LAYER:
- contexts[0] = "view_layer";
- break;
+ return "view_layer";
case BCONTEXT_WORLD:
- contexts[0] = "world";
- break;
+ return "world";
case BCONTEXT_OBJECT:
- contexts[0] = "object";
- break;
+ return "object";
case BCONTEXT_DATA:
- contexts[0] = "data";
- break;
+ return "data";
case BCONTEXT_MATERIAL:
- contexts[0] = "material";
- break;
+ return "material";
case BCONTEXT_TEXTURE:
- contexts[0] = "texture";
- break;
+ return "texture";
case BCONTEXT_PARTICLE:
- contexts[0] = "particle";
- break;
+ return "particle";
case BCONTEXT_PHYSICS:
- contexts[0] = "physics";
- break;
+ return "physics";
case BCONTEXT_BONE:
- contexts[0] = "bone";
- break;
+ return "bone";
case BCONTEXT_MODIFIER:
- contexts[0] = "modifier";
- break;
+ return "modifier";
case BCONTEXT_SHADERFX:
- contexts[0] = "shaderfx";
- break;
+ return "shaderfx";
case BCONTEXT_CONSTRAINT:
- contexts[0] = "constraint";
- break;
+ return "constraint";
case BCONTEXT_BONE_CONSTRAINT:
- contexts[0] = "bone_constraint";
- break;
+ return "bone_constraint";
case BCONTEXT_TOOL:
- contexts[0] = "tool";
- break;
+ return "tool";
}
+ /* All the cases should be handled. */
+ BLI_assert(false);
+ return "";
+}
+
+static void buttons_main_region_layout_properties(const bContext *C,
+ SpaceProperties *sbuts,
+ ARegion *region)
+{
+ buttons_context_compute(C, sbuts);
+
+ const char *contexts[2] = {buttons_main_region_context_string(sbuts->mainb), NULL};
+
ED_region_panels_layout_ex(C, region, &region->type->paneltypes, contexts, NULL);
}