diff options
Diffstat (limited to 'source/blender/makesrna')
-rw-r--r-- | source/blender/makesrna/intern/rna_layer.c | 14 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_scene.c | 79 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_space.c | 6 |
3 files changed, 28 insertions, 71 deletions
diff --git a/source/blender/makesrna/intern/rna_layer.c b/source/blender/makesrna/intern/rna_layer.c index b74cdb5f0a5..93df67306e3 100644 --- a/source/blender/makesrna/intern/rna_layer.c +++ b/source/blender/makesrna/intern/rna_layer.c @@ -864,6 +864,15 @@ static void rna_LayerObjects_active_object_set(PointerRNA *ptr, PointerRNA value view_layer->basact = NULL; } +static char *rna_ViewLayer_path(PointerRNA *ptr) +{ + ViewLayer *srl = (ViewLayer *)ptr->data; + char name_esc[sizeof(srl->name) * 2]; + + BLI_strescape(name_esc, srl->name, sizeof(name_esc)); + return BLI_sprintfN("view_layers[\"%s\"]", name_esc); +} + static IDProperty *rna_ViewLayer_idprops(PointerRNA *ptr, bool create) { ViewLayer *view_layer = (ViewLayer *)ptr->data; @@ -1017,6 +1026,7 @@ static void rna_def_scene_collection(BlenderRNA *brna) srna = RNA_def_struct(brna, "SceneCollection", NULL); RNA_def_struct_ui_text(srna, "Scene Collection", "Collection"); + RNA_def_struct_ui_icon(srna, ICON_COLLAPSEMENU); RNA_def_struct_refine_func(srna, "rna_SceneCollection_refine"); prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE); @@ -2020,6 +2030,7 @@ static void rna_def_layer_collection(BlenderRNA *brna) srna = RNA_def_struct(brna, "LayerCollection", NULL); RNA_def_struct_ui_text(srna, "Layer Collection", "Layer collection"); + RNA_def_struct_ui_icon(srna, ICON_COLLAPSEMENU); prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE); RNA_def_property_string_funcs(prop, "rna_LayerCollection_name_get", "rna_LayerCollection_name_length", "rna_LayerCollection_name_set"); @@ -2217,7 +2228,8 @@ void RNA_def_view_layer(BlenderRNA *brna) srna = RNA_def_struct(brna, "ViewLayer", NULL); RNA_def_struct_ui_text(srna, "Render Layer", "Render layer"); - RNA_def_struct_ui_icon(srna, ICON_RENDERLAYERS); + RNA_def_struct_ui_icon(srna, ICON_RENDER_RESULT); + RNA_def_struct_path_func(srna, "rna_ViewLayer_path"); RNA_def_struct_idprops_func(srna, "rna_ViewLayer_idprops"); rna_def_view_layer_common(srna, 1); 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) */ diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c index 5d430e5d7b9..4683031d2da 100644 --- a/source/blender/makesrna/intern/rna_space.c +++ b/source/blender/makesrna/intern/rna_space.c @@ -201,7 +201,8 @@ const EnumPropertyItem rna_enum_clip_editor_mode_items[] = { static const EnumPropertyItem buttons_context_items[] = { {BCONTEXT_SCENE, "SCENE", ICON_SCENE_DATA, "Scene", "Scene"}, {BCONTEXT_RENDER, "RENDER", ICON_SCENE, "Render", "Render"}, - {BCONTEXT_VIEW_LAYER, "VIEW_LAYER", ICON_RENDERLAYERS, "View Layers", "View layers"}, + {BCONTEXT_VIEW_LAYER, "VIEW_LAYER", ICON_RENDER_RESULT, "View Layer", "View layer"}, + {BCONTEXT_COLLECTION, "COLLECTION", ICON_COLLAPSEMENU, "Collection", "Collection"}, {BCONTEXT_WORLD, "WORLD", ICON_WORLD, "World", "World"}, {BCONTEXT_OBJECT, "OBJECT", ICON_OBJECT_DATA, "Object", "Object"}, {BCONTEXT_CONSTRAINT, "CONSTRAINT", ICON_CONSTRAINT, "Constraints", "Object constraints"}, @@ -213,13 +214,12 @@ static const EnumPropertyItem buttons_context_items[] = { {BCONTEXT_TEXTURE, "TEXTURE", ICON_TEXTURE, "Texture", "Texture"}, {BCONTEXT_PARTICLE, "PARTICLES", ICON_PARTICLES, "Particles", "Particle"}, {BCONTEXT_PHYSICS, "PHYSICS", ICON_PHYSICS, "Physics", "Physics"}, - {BCONTEXT_COLLECTION, "COLLECTION", ICON_COLLAPSEMENU, "Collection", "Collection"}, {BCONTEXT_WORKSPACE, "WORKSPACE", ICON_SPLITSCREEN, "Workspace", "Workspace"}, {0, NULL, 0, NULL, NULL} }; static const EnumPropertyItem buttons_collection_context_items[] = { - {SB_COLLECTION_CTX_VIEW_LAYER, "VIEW_LAYER", ICON_RENDERLAYERS, "", "Show material textures"}, + {SB_COLLECTION_CTX_VIEW_LAYER, "VIEW_LAYER", ICON_RENDER_RESULT, "", "Show material textures"}, {SB_COLLECTION_CTX_GROUP, "GROUP", ICON_GROUP, "", "Show world textures"}, {0, NULL, 0, NULL, NULL} }; |