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:
authorBrecht Van Lommel <brechtvanlommel@gmail.com>2018-04-24 16:20:17 +0300
committerBrecht Van Lommel <brechtvanlommel@gmail.com>2018-04-26 18:06:14 +0300
commit67b014af484ad4ba6667e3cf9907422bedc8238a (patch)
tree68408128f8377b864c7b77be7c91b1fcead601b7 /source/blender/makesrna/intern/rna_scene.c
parentc490428bd4dff75fb371777d4e95ea270c77ea94 (diff)
Workspaces: active view layer now always comes from workspace, not scene.
Both the scene and workspace had an active view layer, and it was confusing which settings were being used or displayed where. Now we always have one, so there is no mismatch. The "View Layers" tab in the properties editor is now "View Layer", no longer showing a list of layers. Instead view layers can be added and removed with the workspace view layer selector. They are also listed and selectable in the outliner. Single layer rendering uses the active view layer from the workspace. This fixes bugs where the wrong active view layer was used, but more places remain that are wrong and are now using the first view layer in the scene. These are all marked with BKE_view_layer_context_active_PLACEHOLDER.
Diffstat (limited to 'source/blender/makesrna/intern/rna_scene.c')
-rw-r--r--source/blender/makesrna/intern/rna_scene.c79
1 files changed, 12 insertions, 67 deletions
diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c
index 822ab119854..faecae7ab65 100644
--- a/source/blender/makesrna/intern/rna_scene.c
+++ b/source/blender/makesrna/intern/rna_scene.c
@@ -1534,19 +1534,23 @@ static void rna_Physics_update(Main *UNUSED(bmain), Scene *UNUSED(scene), Pointe
static void rna_Scene_editmesh_select_mode_set(PointerRNA *ptr, const int *value)
{
- Scene *scene = (Scene *)ptr->id.data;
- ViewLayer *view_layer = BKE_view_layer_context_active_PLACEHOLDER(scene);
ToolSettings *ts = (ToolSettings *)ptr->data;
int flag = (value[0] ? SCE_SELECT_VERTEX : 0) | (value[1] ? SCE_SELECT_EDGE : 0) | (value[2] ? SCE_SELECT_FACE : 0);
if (flag) {
ts->selectmode = flag;
- if (view_layer->basact) {
- Mesh *me = BKE_mesh_from_object(view_layer->basact->object);
- if (me && me->edit_btmesh && me->edit_btmesh->selectmode != flag) {
- me->edit_btmesh->selectmode = flag;
- EDBM_selectmode_set(me->edit_btmesh);
+ /* Update select mode in all the workspaces in mesh edit mode. */
+ wmWindowManager *wm = G.main->wm.first;
+ for (wmWindow *win = wm->windows.first; win; win = win->next) {
+ ViewLayer *view_layer = WM_window_get_active_view_layer(win);
+
+ if (view_layer && view_layer->basact) {
+ Mesh *me = BKE_mesh_from_object(view_layer->basact->object);
+ if (me && me->edit_btmesh && me->edit_btmesh->selectmode != flag) {
+ me->edit_btmesh->selectmode = flag;
+ EDBM_selectmode_set(me->edit_btmesh);
+ }
}
}
}
@@ -2009,44 +2013,6 @@ static int rna_gpu_is_hq_supported_get(PointerRNA *UNUSED(ptr))
return true;
}
-static int rna_ViewLayer_active_view_layer_index_get(PointerRNA *ptr)
-{
- Scene *scene = (Scene *)ptr->data;
- return scene->active_view_layer;
-}
-
-static void rna_ViewLayer_active_view_layer_index_set(PointerRNA *ptr, int value)
-{
- Scene *scene = (Scene *)ptr->data;
- int num_layers = BLI_listbase_count(&scene->view_layers);
- scene->active_view_layer = min_ff(value, num_layers - 1);
-}
-
-static void rna_ViewLayer_active_view_layer_index_range(
- PointerRNA *ptr, int *min, int *max, int *UNUSED(softmin), int *UNUSED(softmax))
-{
- Scene *scene = (Scene *)ptr->data;
-
- *min = 0;
- *max = max_ii(0, BLI_listbase_count(&scene->view_layers) - 1);
-}
-
-static PointerRNA rna_ViewLayer_active_view_layer_get(PointerRNA *ptr)
-{
- Scene *scene = (Scene *)ptr->data;
- ViewLayer *view_layer = BLI_findlink(&scene->view_layers, scene->active_view_layer);
-
- return rna_pointer_inherit_refine(ptr, &RNA_ViewLayer, view_layer);
-}
-
-static void rna_ViewLayer_active_view_layer_set(PointerRNA *ptr, PointerRNA value)
-{
- Scene *scene = (Scene *)ptr->data;
- ViewLayer *view_layer = (ViewLayer *)value.data;
- const int index = BLI_findindex(&scene->view_layers, view_layer);
- if (index != -1) scene->active_view_layer = index;
-}
-
static ViewLayer *rna_ViewLayer_new(
ID *id, Scene *UNUSED(sce), Main *bmain, const char *name)
{
@@ -4069,7 +4035,6 @@ static void rna_def_gpu_dof_fx(BlenderRNA *brna)
srna = RNA_def_struct(brna, "GPUDOFSettings", NULL);
RNA_def_struct_ui_text(srna, "GPU DOF", "Settings for GPU based depth of field");
- RNA_def_struct_ui_icon(srna, ICON_RENDERLAYERS);
RNA_def_struct_path_func(srna, "rna_GPUDOF_path");
prop = RNA_def_property(srna, "focus_distance", PROP_FLOAT, PROP_DISTANCE);
@@ -4134,7 +4099,6 @@ static void rna_def_gpu_ssao_fx(BlenderRNA *brna)
srna = RNA_def_struct(brna, "GPUSSAOSettings", NULL);
RNA_def_struct_ui_text(srna, "GPU SSAO", "Settings for GPU based screen space ambient occlusion");
- RNA_def_struct_ui_icon(srna, ICON_RENDERLAYERS);
prop = RNA_def_property(srna, "factor", PROP_FLOAT, PROP_NONE);
RNA_def_property_ui_text(prop, "Strength", "Strength of the SSAO effect");
@@ -4175,7 +4139,6 @@ static void rna_def_gpu_fx(BlenderRNA *brna)
srna = RNA_def_struct(brna, "GPUFXSettings", NULL);
RNA_def_struct_ui_text(srna, "GPU FX Settings", "Settings for GPU based compositing");
- RNA_def_struct_ui_icon(srna, ICON_RENDERLAYERS);
prop = RNA_def_property(srna, "dof", PROP_POINTER, PROP_NONE);
RNA_def_property_flag(prop, PROP_NEVER_NULL);
@@ -4205,29 +4168,12 @@ static void rna_def_view_layers(BlenderRNA *brna, PropertyRNA *cprop)
StructRNA *srna;
FunctionRNA *func;
PropertyRNA *parm;
- PropertyRNA *prop;
RNA_def_property_srna(cprop, "ViewLayers");
srna = RNA_def_struct(brna, "ViewLayers", NULL);
RNA_def_struct_sdna(srna, "Scene");
RNA_def_struct_ui_text(srna, "Render Layers", "Collection of render layers");
- prop = RNA_def_property(srna, "active_index", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_int_sdna(prop, NULL, "active_view_layer");
- RNA_def_property_int_funcs(prop, "rna_ViewLayer_active_view_layer_index_get",
- "rna_ViewLayer_active_view_layer_index_set",
- "rna_ViewLayer_active_view_layer_index_range");
- RNA_def_property_ui_text(prop, "Active View Layer Index", "Active index in view layer array");
- RNA_def_property_update(prop, NC_SCENE | ND_LAYER, NULL);
-
- prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
- RNA_def_property_struct_type(prop, "ViewLayer");
- RNA_def_property_pointer_funcs(prop, "rna_ViewLayer_active_view_layer_get",
- "rna_ViewLayer_active_view_layer_set", NULL, NULL);
- RNA_def_property_flag(prop, PROP_EDITABLE | PROP_NEVER_NULL);
- RNA_def_property_ui_text(prop, "Active View Layer", "Active View Layer");
- RNA_def_property_update(prop, NC_SCENE | ND_LAYER, NULL);
-
func = RNA_def_function(srna, "new", "rna_ViewLayer_new");
RNA_def_function_ui_description(func, "Add a view layer to scene");
RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_USE_MAIN);
@@ -5408,8 +5354,7 @@ static void rna_def_scene_render_data(BlenderRNA *brna)
prop = RNA_def_property(srna, "use_single_layer", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "scemode", R_SINGLE_LAYER);
- RNA_def_property_ui_text(prop, "Single Layer", "Only render the active layer");
- RNA_def_property_ui_icon(prop, ICON_UNPINNED, 1);
+ RNA_def_property_ui_text(prop, "Render Single Layer", "Only render the active layer");
RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
/* views (stereoscopy et al) */