Objects: restore H key per object hiding.
H hides selected objects, Shift+H hides unselected objects, and Alt+H reveals hidden objects. This hiding state is distinct from restrict viewport and render, and meant for temporarily hiding objects without affecting more persistent collection hiding. Object hiding is per view-layer, same as selection. It affects the viewport and any preview renders in there, but not final renders. In the outliner, different icons are now used for temporary hiding, and restrict viewport and render. Hidden objects are greyed out. Remaining design issues: * For lamps we probably still want to keep their effect on the scene, currently they are fully disabled by hiding. Arguably mesh lights or even objects being reflected or casting shadows are not that different but perhaps the special lamp exception from local view should remain. * We need a feature still to disabled this hiding for specific viewports, for render or animation preview where you want to see the entire scene while working in another view. * We need a new icon for restrict viewport, for now it uses a grid similar to the 2.4 icon. * Hiding objects does not preserve selection state as it did in 2.7, it's probably convenient to support this again?
This commit is contained in:
@@ -31919,6 +31919,108 @@
|
||||
y1="199.12067"
|
||||
x2="17.16466"
|
||||
y2="211.01585" />
|
||||
<mask
|
||||
maskUnits="userSpaceOnUse"
|
||||
id="mask25369-1">
|
||||
<g
|
||||
id="g25371-3"
|
||||
transform="translate(-21,-21)">
|
||||
<path
|
||||
inkscape:connector-curvature="0"
|
||||
style="fill:url(#linearGradient25381);fill-rule:evenodd;stroke:none"
|
||||
d="m 341,302 8,8 -8,8 z"
|
||||
id="path25373-1"
|
||||
sodipodi:nodetypes="cccc"
|
||||
inkscape:transform-center-x="4" />
|
||||
<path
|
||||
inkscape:connector-curvature="0"
|
||||
inkscape:transform-center-y="-4"
|
||||
sodipodi:nodetypes="cccc"
|
||||
id="path25375-1"
|
||||
d="m 357,302 -8,8 -8,-8 z"
|
||||
style="fill:url(#linearGradient25383-9);fill-rule:evenodd;stroke:none" />
|
||||
<path
|
||||
inkscape:connector-curvature="0"
|
||||
inkscape:transform-center-x="-4"
|
||||
sodipodi:nodetypes="cccc"
|
||||
id="path25377-0"
|
||||
d="m 357,318 -8,-8 8,-8 z"
|
||||
style="fill:url(#linearGradient25385-1);fill-rule:evenodd;stroke:none" />
|
||||
<path
|
||||
inkscape:connector-curvature="0"
|
||||
inkscape:transform-center-y="4"
|
||||
sodipodi:nodetypes="cccc"
|
||||
id="path25379-3"
|
||||
d="m 341,318 8,-8 8,8 z"
|
||||
style="fill:url(#linearGradient25387-9);fill-rule:evenodd;stroke:none" />
|
||||
</g>
|
||||
</mask>
|
||||
<linearGradient
|
||||
inkscape:collect="always"
|
||||
xlink:href="#linearGradient16595"
|
||||
id="linearGradient25383-9"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
gradientTransform="rotate(90,339,299)"
|
||||
x1="342"
|
||||
y1="288.5"
|
||||
x2="344.5"
|
||||
y2="288.5" />
|
||||
<linearGradient
|
||||
inkscape:collect="always"
|
||||
xlink:href="#linearGradient16595"
|
||||
id="linearGradient25385-1"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
gradientTransform="rotate(180,349.5,299.5)"
|
||||
x1="342"
|
||||
y1="288.5"
|
||||
x2="344.5"
|
||||
y2="288.5" />
|
||||
<linearGradient
|
||||
inkscape:collect="always"
|
||||
xlink:href="#linearGradient16595"
|
||||
id="linearGradient25387-9"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
gradientTransform="rotate(-90,360,300)"
|
||||
x1="342"
|
||||
y1="288.5"
|
||||
x2="344.5"
|
||||
y2="288.5" />
|
||||
<mask
|
||||
maskUnits="userSpaceOnUse"
|
||||
id="mask25369-1-6">
|
||||
<g
|
||||
id="g25371-3-4"
|
||||
transform="translate(-21,-21)">
|
||||
<path
|
||||
inkscape:connector-curvature="0"
|
||||
style="fill:url(#linearGradient25381);fill-rule:evenodd;stroke:none"
|
||||
d="m 341,302 8,8 -8,8 z"
|
||||
id="path25373-1-0"
|
||||
sodipodi:nodetypes="cccc"
|
||||
inkscape:transform-center-x="4" />
|
||||
<path
|
||||
inkscape:connector-curvature="0"
|
||||
inkscape:transform-center-y="-4"
|
||||
sodipodi:nodetypes="cccc"
|
||||
id="path25375-1-0"
|
||||
d="m 357,302 -8,8 -8,-8 z"
|
||||
style="fill:url(#linearGradient25383-9);fill-rule:evenodd;stroke:none" />
|
||||
<path
|
||||
inkscape:connector-curvature="0"
|
||||
inkscape:transform-center-x="-4"
|
||||
sodipodi:nodetypes="cccc"
|
||||
id="path25377-0-4"
|
||||
d="m 357,318 -8,-8 8,-8 z"
|
||||
style="fill:url(#linearGradient25385-1);fill-rule:evenodd;stroke:none" />
|
||||
<path
|
||||
inkscape:connector-curvature="0"
|
||||
inkscape:transform-center-y="4"
|
||||
sodipodi:nodetypes="cccc"
|
||||
id="path25379-3-6"
|
||||
d="m 341,318 8,-8 8,8 z"
|
||||
style="fill:url(#linearGradient25387-9);fill-rule:evenodd;stroke:none" />
|
||||
</g>
|
||||
</mask>
|
||||
</defs>
|
||||
<sodipodi:namedview
|
||||
id="base"
|
||||
@@ -92721,6 +92823,80 @@
|
||||
sodipodi:nodetypes="ccccccc" />
|
||||
</g>
|
||||
</g>
|
||||
<g
|
||||
style="display:inline;enable-background:new"
|
||||
transform="translate(168.01766,170.03707)"
|
||||
id="ICON_GRID-3"
|
||||
mask="url(#mask25369-1)">
|
||||
<rect
|
||||
y="281"
|
||||
x="320"
|
||||
height="16"
|
||||
width="16"
|
||||
id="rect36193-3"
|
||||
style="display:inline;overflow:visible;visibility:visible;opacity:0.01000001;fill:#cccccc;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:2.70000005;marker:none;enable-background:accumulate" />
|
||||
<path
|
||||
sodipodi:nodetypes="cccc"
|
||||
d="m 324.5,295.75 v -13.5 m 7,13.5 v -13.5"
|
||||
style="fill:#ffffff;fill-rule:evenodd;stroke:#000000;stroke-width:2.5;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
||||
id="path36195-8"
|
||||
inkscape:connector-curvature="0" />
|
||||
<path
|
||||
id="path36197-0"
|
||||
style="fill:#ffffff;fill-rule:evenodd;stroke:#000000;stroke-width:2.5;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
||||
d="M 321.25001,285.50001 334.75,285.5 M 321.25001,292.50001 334.75,292.5"
|
||||
sodipodi:nodetypes="cccc"
|
||||
inkscape:connector-curvature="0" />
|
||||
<path
|
||||
id="path36199-5"
|
||||
style="fill:none;stroke:#ffffff;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
||||
d="m 324.5,296.5 v -14.99999 m 7,14.99999 v -14.99999"
|
||||
sodipodi:nodetypes="cccc"
|
||||
inkscape:connector-curvature="0" />
|
||||
<path
|
||||
sodipodi:nodetypes="cccc"
|
||||
d="m 320.5,285.50001 h 15 m -15,6.99999 h 15"
|
||||
style="fill:none;stroke:#ffffff;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
||||
id="path36201-6"
|
||||
inkscape:connector-curvature="0" />
|
||||
</g>
|
||||
<g
|
||||
style="display:inline;enable-background:new;opacity:0.25"
|
||||
transform="translate(188.9552,170.08067)"
|
||||
id="ICON_GRID-3-7"
|
||||
mask="url(#mask25369-1-6)">
|
||||
<rect
|
||||
y="281"
|
||||
x="320"
|
||||
height="16"
|
||||
width="16"
|
||||
id="rect36193-3-2"
|
||||
style="display:inline;overflow:visible;visibility:visible;opacity:0.01000001;fill:#cccccc;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:2.70000005;marker:none;enable-background:accumulate" />
|
||||
<path
|
||||
sodipodi:nodetypes="cccc"
|
||||
d="m 324.5,295.75 v -13.5 m 7,13.5 v -13.5"
|
||||
style="fill:#ffffff;fill-rule:evenodd;stroke:#000000;stroke-width:2.5;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
||||
id="path36195-8-8"
|
||||
inkscape:connector-curvature="0" />
|
||||
<path
|
||||
id="path36197-0-2"
|
||||
style="fill:#ffffff;fill-rule:evenodd;stroke:#000000;stroke-width:2.5;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
||||
d="M 321.25001,285.50001 334.75,285.5 M 321.25001,292.50001 334.75,292.5"
|
||||
sodipodi:nodetypes="cccc"
|
||||
inkscape:connector-curvature="0" />
|
||||
<path
|
||||
id="path36199-5-9"
|
||||
style="fill:none;stroke:#ffffff;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
||||
d="m 324.5,296.5 v -14.99999 m 7,14.99999 v -14.99999"
|
||||
sodipodi:nodetypes="cccc"
|
||||
inkscape:connector-curvature="0" />
|
||||
<path
|
||||
sodipodi:nodetypes="cccc"
|
||||
d="m 320.5,285.50001 h 15 m -15,6.99999 h 15"
|
||||
style="fill:none;stroke:#ffffff;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
||||
id="path36201-6-9"
|
||||
inkscape:connector-curvature="0" />
|
||||
</g>
|
||||
</g>
|
||||
<g
|
||||
inkscape:groupmode="layer"
|
||||
|
Before Width: | Height: | Size: 4.4 MiB After Width: | Height: | Size: 4.4 MiB |
BIN
release/datafiles/blender_icons16/icon16_hide_off.dat
Normal file
BIN
release/datafiles/blender_icons16/icon16_hide_off.dat
Normal file
Binary file not shown.
BIN
release/datafiles/blender_icons16/icon16_hide_on.dat
Normal file
BIN
release/datafiles/blender_icons16/icon16_hide_on.dat
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
release/datafiles/blender_icons32/icon32_hide_off.dat
Normal file
BIN
release/datafiles/blender_icons32/icon32_hide_off.dat
Normal file
Binary file not shown.
BIN
release/datafiles/blender_icons32/icon32_hide_on.dat
Normal file
BIN
release/datafiles/blender_icons32/icon32_hide_on.dat
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1517,6 +1517,10 @@ class VIEW3D_MT_object(Menu):
|
||||
|
||||
layout.separator()
|
||||
|
||||
layout.menu("VIEW3D_MT_object_showhide")
|
||||
|
||||
layout.separator()
|
||||
|
||||
layout.operator("object.delete", text="Delete...").use_global = False
|
||||
|
||||
|
||||
@@ -1873,6 +1877,20 @@ class VIEW3D_MT_object_quick_effects(Menu):
|
||||
layout.operator("object.quick_fluid")
|
||||
|
||||
|
||||
class VIEW3D_MT_object_showhide(Menu):
|
||||
bl_label = "Show/Hide"
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
layout.operator("object.hide_view_clear", text="Show Hidden")
|
||||
|
||||
layout.separator()
|
||||
|
||||
layout.operator("object.hide_view_set", text="Hide Selected").unselected = False
|
||||
layout.operator("object.hide_view_set", text="Hide Unselected").unselected = True
|
||||
|
||||
|
||||
class VIEW3D_MT_make_single_user(Menu):
|
||||
bl_label = "Make Single User"
|
||||
|
||||
@@ -4217,6 +4235,7 @@ classes = (
|
||||
VIEW3D_MT_object_collection,
|
||||
VIEW3D_MT_object_constraints,
|
||||
VIEW3D_MT_object_quick_effects,
|
||||
VIEW3D_MT_object_showhide,
|
||||
VIEW3D_MT_make_single_user,
|
||||
VIEW3D_MT_make_links,
|
||||
VIEW3D_MT_brush,
|
||||
|
@@ -608,6 +608,8 @@ static void layer_collection_sync(
|
||||
lc->flag = parent_exclude;
|
||||
}
|
||||
|
||||
lc->runtime_flag = 0;
|
||||
|
||||
/* Collection restrict is inherited. */
|
||||
int child_restrict = parent_restrict;
|
||||
if (!(collection->flag & COLLECTION_IS_MASTER)) {
|
||||
@@ -655,6 +657,17 @@ static void layer_collection_sync(
|
||||
if ((child_restrict & COLLECTION_RESTRICT_RENDER) == 0) {
|
||||
base->flag |= BASE_VISIBLE_RENDER;
|
||||
}
|
||||
|
||||
/* Update runtime flags used for faster display. */
|
||||
if (base->flag & BASE_HIDE) {
|
||||
view_layer->runtime_flag |= VIEW_LAYER_HAS_HIDE;
|
||||
}
|
||||
else if (base->flag & BASE_VISIBLED) {
|
||||
lc->runtime_flag |= LAYER_COLLECTION_HAS_VISIBLE_OBJECTS;
|
||||
if (base->flag & BASE_SELECTED) {
|
||||
lc->runtime_flag |= LAYER_COLLECTION_HAS_SELECTED_OBJECTS;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -688,6 +701,8 @@ void BKE_layer_collection_sync(const Scene *scene, ViewLayer *view_layer)
|
||||
base->flag &= ~(BASE_VISIBLED | BASE_SELECTABLED | BASE_VISIBLE_VIEWPORT | BASE_VISIBLE_RENDER);
|
||||
}
|
||||
|
||||
view_layer->runtime_flag = 0;
|
||||
|
||||
/* Generate new layer connections and object bases when collections changed. */
|
||||
CollectionChild child = {NULL, NULL, scene->master_collection};
|
||||
const ListBase collections = {&child, &child};
|
||||
@@ -1229,7 +1244,8 @@ void BKE_view_layer_bases_in_mode_iterator_end(BLI_Iterator *UNUSED(iter))
|
||||
static bool base_is_visible(Base *base, eEvaluationMode mode)
|
||||
{
|
||||
if (mode == DAG_EVAL_VIEWPORT) {
|
||||
return ((base->flag & BASE_VISIBLE_VIEWPORT) != 0);
|
||||
return ((base->flag & BASE_VISIBLE_VIEWPORT) != 0) &&
|
||||
((base->flag & BASE_HIDE) == 0);
|
||||
}
|
||||
else {
|
||||
return ((base->flag & BASE_VISIBLE_RENDER) != 0);
|
||||
|
@@ -5573,6 +5573,8 @@ static void direct_link_layer_collections(FileData *fd, ListBase *lb, bool maste
|
||||
lc->collection = newdataadr(fd, lc->collection);
|
||||
}
|
||||
|
||||
lc->runtime_flag = 0;
|
||||
|
||||
direct_link_layer_collections(fd, &lc->layer_collections, false);
|
||||
}
|
||||
}
|
||||
@@ -5595,6 +5597,7 @@ static void direct_link_view_layer(FileData *fd, ViewLayer *view_layer)
|
||||
BLI_listbase_clear(&view_layer->drawdata);
|
||||
view_layer->object_bases_array = NULL;
|
||||
view_layer->object_bases_hash = NULL;
|
||||
view_layer->runtime_flag = 0;
|
||||
}
|
||||
|
||||
static void lib_link_layer_collection(FileData *fd, Library *lib, LayerCollection *layer_collection, bool master)
|
||||
|
@@ -292,8 +292,10 @@ DEF_ICON(RNA_ADD)
|
||||
DEF_ICON(BLANK112)
|
||||
DEF_ICON(BLANK113)
|
||||
DEF_ICON(BLANK114)
|
||||
DEF_ICON(BLANK115)
|
||||
DEF_ICON(BLANK116)
|
||||
#endif
|
||||
DEF_ICON(RESTRICT_VIEW_OFF)
|
||||
DEF_ICON(RESTRICT_VIEW_ON)
|
||||
#ifndef DEF_ICON_BLANK_SKIP
|
||||
DEF_ICON(BLANK116b)
|
||||
#endif
|
||||
|
||||
@@ -319,8 +321,8 @@ DEF_ICON(OUTLINER_OB_LIGHTPROBE)
|
||||
#endif
|
||||
DEF_ICON(RESTRICT_COLOR_OFF)
|
||||
DEF_ICON(RESTRICT_COLOR_ON)
|
||||
DEF_ICON(RESTRICT_VIEW_OFF)
|
||||
DEF_ICON(RESTRICT_VIEW_ON)
|
||||
DEF_ICON(HIDE_OFF)
|
||||
DEF_ICON(HIDE_ON)
|
||||
DEF_ICON(RESTRICT_SELECT_OFF)
|
||||
DEF_ICON(RESTRICT_SELECT_ON)
|
||||
DEF_ICON(RESTRICT_RENDER_OFF)
|
||||
|
@@ -1748,7 +1748,7 @@ static uiLayout *draw_constraint(uiLayout *layout, Object *ob, bConstraint *con)
|
||||
/* enabled */
|
||||
UI_block_emboss_set(block, UI_EMBOSS_NONE);
|
||||
uiItemR(row, &ptr, "mute", 0, "",
|
||||
(con->flag & CONSTRAINT_OFF) ? ICON_RESTRICT_VIEW_ON : ICON_RESTRICT_VIEW_OFF);
|
||||
(con->flag & CONSTRAINT_OFF) ? ICON_HIDE_ON : ICON_HIDE_OFF);
|
||||
UI_block_emboss_set(block, UI_EMBOSS);
|
||||
|
||||
uiLayoutSetOperatorContext(row, WM_OP_INVOKE_DEFAULT);
|
||||
|
@@ -146,6 +146,119 @@ Object *ED_object_active_context(bContext *C)
|
||||
return ob;
|
||||
}
|
||||
|
||||
/* ********************** object hiding *************************** */
|
||||
|
||||
static int object_hide_poll(bContext *C)
|
||||
{
|
||||
if (CTX_wm_space_outliner(C) != NULL) {
|
||||
return ED_outliner_collections_editor_poll(C);
|
||||
}
|
||||
else {
|
||||
return ED_operator_view3d_active(C);
|
||||
}
|
||||
}
|
||||
|
||||
static int object_hide_view_clear_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
ViewLayer *view_layer = CTX_data_view_layer(C);
|
||||
const bool select = RNA_boolean_get(op->ptr, "select");
|
||||
bool changed = false;
|
||||
|
||||
for (Base *base = view_layer->object_bases.first; base; base = base->next) {
|
||||
if (base->flag & BASE_HIDE) {
|
||||
base->flag &= ~BASE_HIDE;
|
||||
changed = true;
|
||||
|
||||
if (select) {
|
||||
ED_object_base_select(base, BA_SELECT);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!changed) {
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
|
||||
BKE_layer_collection_sync(scene, view_layer);
|
||||
DEG_id_tag_update(&scene->id, DEG_TAG_BASE_FLAGS_UPDATE);
|
||||
WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene);
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
||||
void OBJECT_OT_hide_view_clear(wmOperatorType *ot)
|
||||
{
|
||||
/* identifiers */
|
||||
ot->name = "Show Hidden Objects";
|
||||
ot->description = "Reveal temporarily hidden objects";
|
||||
ot->idname = "OBJECT_OT_hide_view_clear";
|
||||
|
||||
/* api callbacks */
|
||||
ot->exec = object_hide_view_clear_exec;
|
||||
ot->poll = object_hide_poll;
|
||||
|
||||
/* flags */
|
||||
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
||||
|
||||
RNA_def_boolean(ot->srna, "select", false, "Select", "");
|
||||
}
|
||||
|
||||
static int object_hide_view_set_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
ViewLayer *view_layer = CTX_data_view_layer(C);
|
||||
const bool unselected = RNA_boolean_get(op->ptr, "unselected");
|
||||
bool changed = false;
|
||||
|
||||
for (Base *base = view_layer->object_bases.first; base; base = base->next) {
|
||||
if (!(base->flag & BASE_VISIBLED)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!unselected) {
|
||||
if (base->flag & BASE_SELECTED) {
|
||||
ED_object_base_select(base, BA_DESELECT);
|
||||
base->flag |= BASE_HIDE;
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (!(base->flag & BASE_SELECTED)) {
|
||||
ED_object_base_select(base, BA_DESELECT);
|
||||
base->flag |= BASE_HIDE;
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!changed) {
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
|
||||
BKE_layer_collection_sync(scene, view_layer);
|
||||
DEG_id_tag_update(&scene->id, DEG_TAG_BASE_FLAGS_UPDATE);
|
||||
WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene);
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
||||
void OBJECT_OT_hide_view_set(wmOperatorType *ot)
|
||||
{
|
||||
/* identifiers */
|
||||
ot->name = "Hide Objects";
|
||||
ot->description = "Temporarily hide objects from the viewport";
|
||||
ot->idname = "OBJECT_OT_hide_view_set";
|
||||
|
||||
/* api callbacks */
|
||||
ot->exec = object_hide_view_set_exec;
|
||||
ot->poll = object_hide_poll;
|
||||
|
||||
/* flags */
|
||||
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
||||
|
||||
RNA_def_boolean(ot->srna, "unselected", 0, "Unselected", "Hide unselected rather than selected objects");
|
||||
}
|
||||
|
||||
/* ******************* toggle editmode operator ***************** */
|
||||
|
||||
|
@@ -76,6 +76,8 @@ void OBJECT_OT_drop_named_material(struct wmOperatorType *ot);
|
||||
void OBJECT_OT_unlink_data(struct wmOperatorType *ot);
|
||||
|
||||
/* object_edit.c */
|
||||
void OBJECT_OT_hide_view_set(struct wmOperatorType *ot);
|
||||
void OBJECT_OT_hide_view_clear(struct wmOperatorType *ot);
|
||||
void OBJECT_OT_mode_set(struct wmOperatorType *ot);
|
||||
void OBJECT_OT_mode_set_or_submode(struct wmOperatorType *ot);
|
||||
void OBJECT_OT_editmode_toggle(struct wmOperatorType *ot);
|
||||
|
@@ -247,6 +247,9 @@ void ED_operatortypes_object(void)
|
||||
WM_operatortype_append(OBJECT_OT_data_transfer);
|
||||
WM_operatortype_append(OBJECT_OT_datalayout_transfer);
|
||||
WM_operatortype_append(OBJECT_OT_surfacedeform_bind);
|
||||
|
||||
WM_operatortype_append(OBJECT_OT_hide_view_clear);
|
||||
WM_operatortype_append(OBJECT_OT_hide_view_set);
|
||||
}
|
||||
|
||||
void ED_operatormacros_object(void)
|
||||
@@ -404,6 +407,13 @@ void ED_keymap_object(wmKeyConfig *keyconf)
|
||||
|
||||
WM_keymap_add_item(keymap, "OBJECT_OT_move_to_collection", MKEY, KM_PRESS, 0, 0);
|
||||
WM_keymap_add_item(keymap, "OBJECT_OT_link_to_collection", MKEY, KM_PRESS, KM_SHIFT, 0);
|
||||
|
||||
kmi = WM_keymap_add_item(keymap, "OBJECT_OT_hide_view_clear", HKEY, KM_PRESS, KM_ALT, 0);
|
||||
RNA_boolean_set(kmi->ptr, "select", false);
|
||||
kmi = WM_keymap_add_item(keymap, "OBJECT_OT_hide_view_set", HKEY, KM_PRESS, 0, 0);
|
||||
RNA_boolean_set(kmi->ptr, "unselected", false);
|
||||
kmi = WM_keymap_add_item(keymap, "OBJECT_OT_hide_view_set", HKEY, KM_PRESS, KM_SHIFT, 0);
|
||||
RNA_boolean_set(kmi->ptr, "unselected", true);
|
||||
}
|
||||
|
||||
void ED_keymap_proportional_cycle(struct wmKeyConfig *UNUSED(keyconf), struct wmKeyMap *keymap)
|
||||
|
@@ -387,7 +387,7 @@ void uiTemplateMarker(uiLayout *layout, PointerRNA *ptr, const char *propname, P
|
||||
else
|
||||
tip = TIP_("Marker is enabled at current frame");
|
||||
|
||||
bt = uiDefIconButBitI(block, UI_BTYPE_TOGGLE_N, MARKER_DISABLED, 0, ICON_RESTRICT_VIEW_OFF, 0, 0, UI_UNIT_X, UI_UNIT_Y,
|
||||
bt = uiDefIconButBitI(block, UI_BTYPE_TOGGLE_N, MARKER_DISABLED, 0, ICON_HIDE_OFF, 0, 0, UI_UNIT_X, UI_UNIT_Y,
|
||||
&cb->marker_flag, 0, 0, 1, 0, tip);
|
||||
UI_but_funcN_set(bt, marker_update_cb, cb, NULL);
|
||||
}
|
||||
|
@@ -278,6 +278,16 @@ static void restrictbutton_id_user_toggle(bContext *UNUSED(C), void *poin, void
|
||||
}
|
||||
}
|
||||
|
||||
static void hidebutton_base_flag_cb(bContext *C, void *poin, void *poin2)
|
||||
{
|
||||
Scene *scene = poin;
|
||||
ViewLayer *view_layer = poin2;
|
||||
|
||||
BKE_layer_collection_sync(scene, view_layer);
|
||||
DEG_id_tag_update(&scene->id, DEG_TAG_BASE_FLAGS_UPDATE);
|
||||
WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene);
|
||||
}
|
||||
|
||||
static void namebutton_cb(bContext *C, void *tsep, char *oldname)
|
||||
{
|
||||
Main *bmain = CTX_data_main(C);
|
||||
@@ -435,7 +445,7 @@ static void namebutton_cb(bContext *C, void *tsep, char *oldname)
|
||||
}
|
||||
|
||||
static void outliner_draw_restrictbuts(
|
||||
uiBlock *block, Scene *scene, ARegion *ar, SpaceOops *soops, ListBase *lb)
|
||||
uiBlock *block, Scene *scene, ViewLayer *view_layer, ARegion *ar, SpaceOops *soops, ListBase *lb)
|
||||
{
|
||||
uiBut *bt;
|
||||
|
||||
@@ -455,15 +465,28 @@ static void outliner_draw_restrictbuts(
|
||||
if (te->ys + 2 * UI_UNIT_Y >= ar->v2d.cur.ymin && te->ys <= ar->v2d.cur.ymax) {
|
||||
if (tselem->type == TSE_R_LAYER && (soops->outlinevis == SO_SCENES)) {
|
||||
/* View layer render toggle. */
|
||||
ViewLayer *view_layer = te->directdata;
|
||||
ViewLayer *layer = te->directdata;
|
||||
|
||||
bt = uiDefIconButBitS(
|
||||
block, UI_BTYPE_ICON_TOGGLE_N, VIEW_LAYER_RENDER, 0, ICON_RESTRICT_RENDER_OFF,
|
||||
(int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_RENDERX), te->ys, UI_UNIT_X,
|
||||
UI_UNIT_Y, &view_layer->flag, 0, 0, 0, 0, TIP_("Use view layer for rendering"));
|
||||
UI_UNIT_Y, &layer->flag, 0, 0, 0, 0, TIP_("Use view layer for rendering"));
|
||||
UI_but_func_set(bt, restrictbutton_r_lay_cb, tselem->id, NULL);
|
||||
UI_but_flag_enable(bt, UI_BUT_DRAG_LOCK);
|
||||
}
|
||||
else if (tselem->type == 0 && te->idcode == ID_OB) {
|
||||
ob = (Object *)tselem->id;
|
||||
Base *base = BKE_view_layer_base_find(view_layer, ob);
|
||||
|
||||
if (base) {
|
||||
bt = uiDefIconButBitS(block, UI_BTYPE_ICON_TOGGLE, BASE_HIDE, 0, ICON_HIDE_OFF,
|
||||
(int)(ar->v2d.cur.xmax - OL_TOG_HIDEX), te->ys, UI_UNIT_X,
|
||||
UI_UNIT_Y, &base->flag, 0, 0, 0, 0,
|
||||
TIP_("Hide object in viewport"));
|
||||
UI_but_func_set(bt, hidebutton_base_flag_cb, scene, view_layer);
|
||||
UI_but_flag_enable(bt, UI_BUT_DRAG_LOCK);
|
||||
}
|
||||
}
|
||||
else if (tselem->type == TSE_MODIFIER) {
|
||||
ModifierData *md = (ModifierData *)te->directdata;
|
||||
Object *ob = (Object *)tselem->id;
|
||||
@@ -489,7 +512,7 @@ static void outliner_draw_restrictbuts(
|
||||
Object *ob = (Object *)tselem->id;
|
||||
|
||||
bt = uiDefIconButBitI(
|
||||
block, UI_BTYPE_ICON_TOGGLE, BONE_HIDDEN_P, 0, ICON_RESTRICT_VIEW_OFF,
|
||||
block, UI_BTYPE_ICON_TOGGLE, BONE_HIDDEN_P, 0, ICON_HIDE_OFF,
|
||||
(int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_VIEWX), te->ys, UI_UNIT_X,
|
||||
UI_UNIT_Y, &(bone->flag), 0, 0, 0, 0,
|
||||
TIP_("Restrict/Allow visibility in the 3D View"));
|
||||
@@ -527,7 +550,7 @@ static void outliner_draw_restrictbuts(
|
||||
bGPDlayer *gpl = (bGPDlayer *)te->directdata;
|
||||
|
||||
bt = uiDefIconButBitS(
|
||||
block, UI_BTYPE_ICON_TOGGLE, GP_LAYER_HIDE, 0, ICON_RESTRICT_VIEW_OFF,
|
||||
block, UI_BTYPE_ICON_TOGGLE, GP_LAYER_HIDE, 0, ICON_HIDE_OFF,
|
||||
(int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_VIEWX), te->ys, UI_UNIT_X,
|
||||
UI_UNIT_Y, &gpl->flag, 0, 0, 0, 0,
|
||||
TIP_("Restrict/Allow visibility in the 3D View"));
|
||||
@@ -576,7 +599,7 @@ static void outliner_draw_restrictbuts(
|
||||
}
|
||||
|
||||
if (TSELEM_OPEN(tselem, soops)) {
|
||||
outliner_draw_restrictbuts(block, scene, ar, soops, &te->subtree);
|
||||
outliner_draw_restrictbuts(block, scene, view_layer, ar, soops, &te->subtree);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1999,7 +2022,7 @@ void draw_outliner(const bContext *C)
|
||||
/* draw restriction columns */
|
||||
outliner_draw_restrictcols(ar);
|
||||
|
||||
outliner_draw_restrictbuts(block, scene, ar, soops, &soops->tree);
|
||||
outliner_draw_restrictbuts(block, scene, view_layer, ar, soops, &soops->tree);
|
||||
}
|
||||
|
||||
/* draw edit buttons if nessecery */
|
||||
|
@@ -151,6 +151,7 @@ typedef enum {
|
||||
/* size constants */
|
||||
#define OL_Y_OFFSET 2
|
||||
|
||||
#define OL_TOG_HIDEX (UI_UNIT_X * 4.0f)
|
||||
#define OL_TOG_RESTRICT_SELECTX (UI_UNIT_X * 3.0f)
|
||||
#define OL_TOG_RESTRICT_VIEWX (UI_UNIT_X * 2.0f)
|
||||
#define OL_TOG_RESTRICT_RENDERX UI_UNIT_X
|
||||
|
@@ -560,6 +560,13 @@ void outliner_keymap(wmKeyConfig *keyconf)
|
||||
WM_keymap_verify_item(keymap, "OBJECT_OT_move_to_collection", MKEY, KM_PRESS, 0, 0);
|
||||
WM_keymap_verify_item(keymap, "OBJECT_OT_link_to_collection", MKEY, KM_PRESS, KM_SHIFT, 0);
|
||||
|
||||
kmi = WM_keymap_add_item(keymap, "OBJECT_OT_hide_view_clear", HKEY, KM_PRESS, KM_ALT, 0);
|
||||
RNA_boolean_set(kmi->ptr, "select", false);
|
||||
kmi = WM_keymap_add_item(keymap, "OBJECT_OT_hide_view_set", HKEY, KM_PRESS, KM_CTRL, 0);
|
||||
RNA_boolean_set(kmi->ptr, "unselected", false);
|
||||
kmi = WM_keymap_add_item(keymap, "OBJECT_OT_hide_view_set", HKEY, KM_PRESS, KM_SHIFT, 0);
|
||||
RNA_boolean_set(kmi->ptr, "unselected", true);
|
||||
|
||||
outliner_item_drag_drop_modal_keymap(keyconf);
|
||||
}
|
||||
|
||||
|
@@ -1586,8 +1586,8 @@ void OUTLINER_OT_animdata_operation(wmOperatorType *ot)
|
||||
/* **************************************** */
|
||||
|
||||
static const EnumPropertyItem prop_constraint_op_types[] = {
|
||||
{OL_CONSTRAINTOP_ENABLE, "ENABLE", ICON_RESTRICT_VIEW_OFF, "Enable", ""},
|
||||
{OL_CONSTRAINTOP_DISABLE, "DISABLE", ICON_RESTRICT_VIEW_ON, "Disable", ""},
|
||||
{OL_CONSTRAINTOP_ENABLE, "ENABLE", ICON_HIDE_OFF, "Enable", ""},
|
||||
{OL_CONSTRAINTOP_DISABLE, "DISABLE", ICON_HIDE_ON, "Disable", ""},
|
||||
{OL_CONSTRAINTOP_DELETE, "DELETE", ICON_X, "Delete", ""},
|
||||
{0, NULL, 0, NULL, NULL}
|
||||
};
|
||||
|
@@ -1469,6 +1469,10 @@ static void outliner_add_layer_collection_objects(
|
||||
Base *base = BKE_view_layer_base_find(layer, cob->ob);
|
||||
TreeElement *te_object = outliner_add_element(soops, tree, base->object, ten, 0, 0);
|
||||
te_object->directdata = base;
|
||||
|
||||
if (!(base->flag & BASE_VISIBLED)) {
|
||||
te_object->flag |= TE_DISABLED;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -1045,8 +1045,9 @@ static const char *view3d_get_name(View3D *v3d, RegionView3D *rv3d)
|
||||
return name;
|
||||
}
|
||||
|
||||
static void draw_viewport_name(ARegion *ar, View3D *v3d, const rcti *rect)
|
||||
static void draw_viewport_name(const bContext *C, ARegion *ar, View3D *v3d, const rcti *rect)
|
||||
{
|
||||
ViewLayer *view_layer = CTX_data_view_layer(C);
|
||||
RegionView3D *rv3d = ar->regiondata;
|
||||
const char *name = view3d_get_name(v3d, rv3d);
|
||||
/* increase size for unicode languages (Chinese in utf-8...) */
|
||||
@@ -1056,7 +1057,8 @@ static void draw_viewport_name(ARegion *ar, View3D *v3d, const rcti *rect)
|
||||
char tmpstr[32];
|
||||
#endif
|
||||
|
||||
if (v3d->localvd) {
|
||||
/* TODO: integrate localvd with local hiding */
|
||||
if (v3d->localvd || (view_layer->runtime_flag & VIEW_LAYER_HAS_HIDE)) {
|
||||
BLI_snprintf(tmpstr, sizeof(tmpstr), IFACE_("%s (Local)"), name);
|
||||
name = tmpstr;
|
||||
}
|
||||
@@ -1219,7 +1221,7 @@ void view3d_draw_region_info(const bContext *C, ARegion *ar, const int offset)
|
||||
ED_scene_draw_fps(scene, &rect);
|
||||
}
|
||||
else if (U.uiflag & USER_SHOW_VIEWPORTNAME) {
|
||||
draw_viewport_name(ar, v3d, &rect);
|
||||
draw_viewport_name(C, ar, v3d, &rect);
|
||||
}
|
||||
|
||||
if (U.uiflag & USER_DRAWVIEWINFO) {
|
||||
|
@@ -411,7 +411,7 @@ static const EnumPropertyItem *rna_undo_itemf(bContext *C, int *totitem)
|
||||
item_tmp.identifier = us->name;
|
||||
item_tmp.name = IFACE_(us->name);
|
||||
if (us == wm->undo_stack->step_active) {
|
||||
item_tmp.icon = ICON_RESTRICT_VIEW_OFF;
|
||||
item_tmp.icon = ICON_HIDE_OFF;
|
||||
}
|
||||
else {
|
||||
item_tmp.icon = ICON_NONE;
|
||||
|
@@ -56,7 +56,8 @@ typedef struct LayerCollection {
|
||||
struct Collection *collection;
|
||||
struct SceneCollection *scene_collection DNA_DEPRECATED;
|
||||
short flag;
|
||||
short pad[3];
|
||||
short runtime_flag;
|
||||
short pad[2];
|
||||
ListBase layer_collections; /* synced with collection->children */
|
||||
} LayerCollection;
|
||||
|
||||
@@ -64,7 +65,8 @@ typedef struct ViewLayer {
|
||||
struct ViewLayer *next, *prev;
|
||||
char name[64]; /* MAX_NAME */
|
||||
short flag;
|
||||
short pad[3];
|
||||
short runtime_flag;
|
||||
short pad[2];
|
||||
ListBase object_bases; /* ObjectBase */
|
||||
struct SceneStats *stats; /* default allocated now */
|
||||
struct Base *basact;
|
||||
@@ -97,6 +99,7 @@ enum {
|
||||
BASE_FROM_SET = (1 << 5), /* To be set only by the depsgraph */
|
||||
BASE_VISIBLE_VIEWPORT = (1 << 6),
|
||||
BASE_VISIBLE_RENDER = (1 << 7),
|
||||
BASE_HIDE = (1 << 8),
|
||||
};
|
||||
|
||||
/* LayerCollection->flag */
|
||||
@@ -108,6 +111,12 @@ enum {
|
||||
LAYER_COLLECTION_EXCLUDE = (1 << 4),
|
||||
};
|
||||
|
||||
/* Layer Collection->runtime_flag */
|
||||
enum {
|
||||
LAYER_COLLECTION_HAS_VISIBLE_OBJECTS = (1 << 0),
|
||||
LAYER_COLLECTION_HAS_SELECTED_OBJECTS = (1 << 1),
|
||||
};
|
||||
|
||||
/* ViewLayer->flag */
|
||||
enum {
|
||||
VIEW_LAYER_RENDER = (1 << 0),
|
||||
@@ -115,6 +124,11 @@ enum {
|
||||
VIEW_LAYER_FREESTYLE = (1 << 2),
|
||||
};
|
||||
|
||||
/* ViewLayer->runtime_flag */
|
||||
enum {
|
||||
VIEW_LAYER_HAS_HIDE = (1 << 0),
|
||||
};
|
||||
|
||||
/****************************** Deprecated ******************************/
|
||||
|
||||
/* Compatibility with collections saved in early 2.8 versions,
|
||||
|
@@ -1271,7 +1271,7 @@ static void rna_def_gpencil_layer(BlenderRNA *brna)
|
||||
/* Flags */
|
||||
prop = RNA_def_property(srna, "hide", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_LAYER_HIDE);
|
||||
RNA_def_property_ui_icon(prop, ICON_RESTRICT_VIEW_OFF, 1);
|
||||
RNA_def_property_ui_icon(prop, ICON_HIDE_OFF, 1);
|
||||
RNA_def_property_ui_text(prop, "Hide", "Set layer Visibility");
|
||||
RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
|
||||
|
||||
@@ -1457,7 +1457,7 @@ static void rna_def_gpencil_palettecolor(BlenderRNA *brna)
|
||||
/* Flags */
|
||||
prop = RNA_def_property(srna, "hide", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "flag", PC_COLOR_HIDE);
|
||||
RNA_def_property_ui_icon(prop, ICON_RESTRICT_VIEW_OFF, 1);
|
||||
RNA_def_property_ui_icon(prop, ICON_HIDE_OFF, 1);
|
||||
RNA_def_property_ui_text(prop, "Hide", "Set color Visibility");
|
||||
RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
|
||||
|
||||
|
@@ -722,7 +722,7 @@ static void rna_def_keyblock(BlenderRNA *brna)
|
||||
prop = RNA_def_property(srna, "mute", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "flag", KEYBLOCK_MUTE);
|
||||
RNA_def_property_ui_text(prop, "Mute", "Mute this shape key");
|
||||
RNA_def_property_ui_icon(prop, ICON_RESTRICT_VIEW_OFF, 1);
|
||||
RNA_def_property_ui_icon(prop, ICON_HIDE_OFF, 1);
|
||||
RNA_def_property_update(prop, 0, "rna_Key_update_data");
|
||||
|
||||
prop = RNA_def_property(srna, "slider_min", PROP_FLOAT, PROP_NONE);
|
||||
|
@@ -1504,7 +1504,7 @@ static void rna_def_sequence(BlenderRNA *brna)
|
||||
|
||||
prop = RNA_def_property(srna, "mute", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_MUTE);
|
||||
RNA_def_property_ui_icon(prop, ICON_RESTRICT_VIEW_OFF, true);
|
||||
RNA_def_property_ui_icon(prop, ICON_HIDE_OFF, true);
|
||||
RNA_def_property_ui_text(prop, "Mute", "Disable strip so that it cannot be viewed in the output");
|
||||
RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_mute_update");
|
||||
|
||||
@@ -2581,7 +2581,7 @@ static void rna_def_modifier(BlenderRNA *brna)
|
||||
prop = RNA_def_property(srna, "mute", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQUENCE_MODIFIER_MUTE);
|
||||
RNA_def_property_ui_text(prop, "Mute", "Mute this modifier");
|
||||
RNA_def_property_ui_icon(prop, ICON_RESTRICT_VIEW_OFF, 1);
|
||||
RNA_def_property_ui_icon(prop, ICON_HIDE_OFF, 1);
|
||||
RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_SequenceModifier_update");
|
||||
|
||||
prop = RNA_def_property(srna, "show_expanded", PROP_BOOLEAN, PROP_NONE);
|
||||
|
Reference in New Issue
Block a user