Properties: remove redundant settings from workspaces tab.

Use render settings and active view layer will be handled elsewhere.
Also change icon to not be confusing with render layers.

Probably we should get rid of the workspace tab entirely and do it in
the user preferences, but that's for later.
This commit is contained in:
Brecht Van Lommel 2018-04-25 15:56:48 +02:00
parent 11995c5a6e
commit 5876856f7b
8 changed files with 5 additions and 68 deletions

View File

@ -31,32 +31,6 @@ class WorkSpaceButtonsPanel:
bl_context = "workspace"
class WORKSPACE_PT_context(WorkSpaceButtonsPanel, Panel):
bl_label = ""
bl_options = {'HIDE_HEADER'}
def draw(self, context):
layout = self.layout
workspace = context.workspace
layout.prop(workspace, "use_scene_settings", icon='SCENE')
class WORKSPACE_PT_workspace(WorkSpaceButtonsPanel, Panel):
bl_label = "Workspace"
def draw(self, context):
layout = self.layout
window = context.window
workspace = context.workspace
scene = context.scene
layout.enabled = not workspace.use_scene_settings
layout.template_search(window, "view_layer", scene, "view_layers")
class WORKSPACE_PT_owner_ids(WorkSpaceButtonsPanel, Panel):
bl_label = "Workspace Add-ons"
bl_options = {'DEFAULT_CLOSED'}
@ -118,8 +92,6 @@ class WORKSPACE_PT_custom_props(WorkSpaceButtonsPanel, PropertyPanel, Panel):
classes = (
WORKSPACE_PT_context,
WORKSPACE_PT_workspace,
WORKSPACE_PT_owner_ids,
WORKSPACE_PT_custom_props,
)

View File

@ -109,10 +109,6 @@ struct WorkSpaceLayout *BKE_workspace_hook_layout_for_workspace_get(
void BKE_workspace_hook_layout_for_workspace_set(
struct WorkSpaceInstanceHook *hook, struct WorkSpace *workspace, struct WorkSpaceLayout *layout) ATTR_NONNULL();
/* flags */
bool BKE_workspace_use_scene_settings_get(const struct WorkSpace *workspace) GETTER_ATTRS;
void BKE_workspace_use_scene_settings_set(struct WorkSpace *workspace, bool value) SETTER_ATTRS;
/* Update / evaluate */
void BKE_workspace_update_tagged(struct Main *bmain,
struct WorkSpace *workspace,

View File

@ -91,12 +91,7 @@ ViewLayer *BKE_view_layer_from_scene_get(const Scene *scene)
*/
ViewLayer *BKE_view_layer_from_workspace_get(const struct Scene *scene, const struct WorkSpace *workspace)
{
if (BKE_workspace_use_scene_settings_get(workspace)) {
return BKE_view_layer_from_scene_get(scene);
}
else {
return BKE_workspace_view_layer_get(workspace, scene);
}
return BKE_workspace_view_layer_get(workspace, scene);
}
/**

View File

@ -440,22 +440,6 @@ void BKE_workspace_hook_layout_for_workspace_set(
workspace_relation_ensure_updated(&workspace->hook_layout_relations, hook, layout);
}
/* Flags */
bool BKE_workspace_use_scene_settings_get(const WorkSpace *workspace)
{
return (workspace->flags & WORKSPACE_USE_SCENE_SETTINGS) != 0;
}
void BKE_workspace_use_scene_settings_set(WorkSpace *workspace, bool value)
{
if (value) {
workspace->flags |= WORKSPACE_USE_SCENE_SETTINGS;
}
else {
workspace->flags &= ~WORKSPACE_USE_SCENE_SETTINGS;
}
}
/* Update / evaluate */
void BKE_workspace_update_tagged(Main *bmain,

View File

@ -501,8 +501,6 @@ static int buttons_context_path(const bContext *C, ButsContextPath *path, int ma
memset(path, 0, sizeof(*path));
path->flag = flag;
const bool use_scene_settings = BKE_workspace_use_scene_settings_get(workspace);
/* If some ID datablock is pinned, set the root pointer. */
if (sbuts->pinid) {
id = sbuts->pinid;
@ -512,8 +510,8 @@ static int buttons_context_path(const bContext *C, ButsContextPath *path, int ma
}
/* No pinned root, use scene or workspace as initial root. */
else {
if ((mainb != BCONTEXT_WORKSPACE) && (use_scene_settings ||
ELEM(mainb, BCONTEXT_SCENE, BCONTEXT_RENDER, BCONTEXT_VIEW_LAYER, BCONTEXT_WORLD)))
if ((mainb != BCONTEXT_WORKSPACE) &&
ELEM(mainb, BCONTEXT_SCENE, BCONTEXT_RENDER, BCONTEXT_VIEW_LAYER, BCONTEXT_WORLD))
{
RNA_id_pointer_create(&scene->id, &path->ptr[0]);
path->len++;

View File

@ -155,7 +155,6 @@ typedef struct WorkSpaceInstanceHook {
} WorkSpaceInstanceHook;
typedef enum eWorkSpaceFlags {
WORKSPACE_USE_SCENE_SETTINGS = (1 << 0),
WORKSPACE_USE_FILTER_BY_ORIGIN = (1 << 1),
} eWorkSpaceFlags;

View File

@ -214,7 +214,7 @@ static const EnumPropertyItem buttons_context_items[] = {
{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_RENDER_RESULT, "Workspace", "Workspace"},
{BCONTEXT_WORKSPACE, "WORKSPACE", ICON_SPLITSCREEN, "Workspace", "Workspace"},
{0, NULL, 0, NULL, NULL}
};

View File

@ -168,7 +168,7 @@ static void rna_def_workspace(BlenderRNA *brna)
RNA_def_struct_sdna(srna, "WorkSpace");
RNA_def_struct_ui_text(srna, "Workspace", "Workspace data-block, defining the working environment for the user");
/* TODO: real icon, just to show something */
RNA_def_struct_ui_icon(srna, ICON_RENDER_RESULT);
RNA_def_struct_ui_icon(srna, ICON_SPLITSCREEN);
prop = RNA_def_property(srna, "screens", PROP_COLLECTION, PROP_NONE);
RNA_def_property_collection_sdna(prop, NULL, "layouts", NULL);
@ -204,13 +204,6 @@ static void rna_def_workspace(BlenderRNA *brna)
#endif
/* Flags */
prop = RNA_def_property(srna, "use_scene_settings", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
RNA_def_property_boolean_sdna(prop, NULL, "flags", WORKSPACE_USE_SCENE_SETTINGS);
RNA_def_property_ui_text(prop, "Scene Settings",
"Use scene settings instead of workspace settings");
RNA_def_property_update(prop, NC_SCREEN | ND_LAYER, NULL);
prop = RNA_def_property(srna, "use_filter_by_owner", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
RNA_def_property_boolean_sdna(prop, NULL, "flags", WORKSPACE_USE_FILTER_BY_ORIGIN);