Cleanup: rename restrict to hide/visibility in Object, Collection, MaskLayer

This makes the internal naming consistent with the public API. And also gives
us a visibility_flag rather than restrictflag that can be extended with more
flags.
This commit is contained in:
2021-08-04 17:46:55 +02:00
parent 10b9621079
commit 8abf6efcf6
40 changed files with 177 additions and 169 deletions

View File

@@ -197,13 +197,14 @@ typedef void (*BKE_scene_collections_Cb)(struct Collection *ob, void *data);
#define FOREACH_COLLECTION_VISIBLE_OBJECT_RECURSIVE_BEGIN(_collection, _object, _mode) \
{ \
int _base_flag = (_mode == DAG_EVAL_VIEWPORT) ? BASE_ENABLED_VIEWPORT : BASE_ENABLED_RENDER; \
int _object_restrict_flag = (_mode == DAG_EVAL_VIEWPORT) ? OB_RESTRICT_VIEWPORT : \
OB_RESTRICT_RENDER; \
int _object_visibility_flag = (_mode == DAG_EVAL_VIEWPORT) ? OB_HIDE_VIEWPORT : \
OB_HIDE_RENDER; \
int _base_id = 0; \
for (Base *_base = (Base *)BKE_collection_object_cache_get(_collection).first; _base; \
_base = _base->next, _base_id++) { \
Object *_object = _base->object; \
if ((_base->flag & _base_flag) && (_object->restrictflag & _object_restrict_flag) == 0) {
if ((_base->flag & _base_flag) && \
(_object->visibility_flag & _object_visibility_flag) == 0) {
#define FOREACH_COLLECTION_VISIBLE_OBJECT_RECURSIVE_END \
} \

View File

@@ -806,10 +806,10 @@ static void collection_object_cache_fill(ListBase *lb,
/* Only collection flags are checked here currently, object restrict flag is checked
* in FOREACH_COLLECTION_VISIBLE_OBJECT_RECURSIVE_BEGIN since it can be animated
* without updating the cache. */
if (((child_restrict & COLLECTION_RESTRICT_VIEWPORT) == 0)) {
if (((child_restrict & COLLECTION_HIDE_VIEWPORT) == 0)) {
base->flag |= BASE_ENABLED_VIEWPORT;
}
if (((child_restrict & COLLECTION_RESTRICT_RENDER) == 0)) {
if (((child_restrict & COLLECTION_HIDE_RENDER) == 0)) {
base->flag |= BASE_ENABLED_RENDER;
}
}
@@ -1755,7 +1755,7 @@ static bool collection_objects_select(ViewLayer *view_layer, Collection *collect
{
bool changed = false;
if (collection->flag & COLLECTION_RESTRICT_SELECT) {
if (collection->flag & COLLECTION_HIDE_SELECT) {
return false;
}

View File

@@ -602,7 +602,7 @@ static bool layer_collection_hidden(ViewLayer *view_layer, LayerCollection *lc)
}
/* Check visiblilty restriction flags */
if (lc->flag & LAYER_COLLECTION_HIDE || lc->collection->flag & COLLECTION_RESTRICT_VIEWPORT) {
if (lc->flag & LAYER_COLLECTION_HIDE || lc->collection->flag & COLLECTION_HIDE_VIEWPORT) {
return true;
}
@@ -1005,17 +1005,17 @@ static void layer_collection_objects_sync(ViewLayer *view_layer,
BLI_addtail(r_lb_new_object_bases, base);
}
if ((collection_restrict & COLLECTION_RESTRICT_VIEWPORT) == 0) {
if ((collection_restrict & COLLECTION_HIDE_VIEWPORT) == 0) {
base->flag_from_collection |= (BASE_ENABLED_VIEWPORT | BASE_VISIBLE_DEPSGRAPH);
if ((layer_restrict & LAYER_COLLECTION_HIDE) == 0) {
base->flag_from_collection |= BASE_VISIBLE_VIEWLAYER;
}
if (((collection_restrict & COLLECTION_RESTRICT_SELECT) == 0)) {
if (((collection_restrict & COLLECTION_HIDE_SELECT) == 0)) {
base->flag_from_collection |= BASE_SELECTABLE;
}
}
if ((collection_restrict & COLLECTION_RESTRICT_RENDER) == 0) {
if ((collection_restrict & COLLECTION_HIDE_RENDER) == 0) {
base->flag_from_collection |= BASE_ENABLED_RENDER;
}
@@ -1150,11 +1150,11 @@ static void layer_collection_sync(ViewLayer *view_layer,
/* We separate restrict viewport and visible view layer because a layer collection can be
* hidden in the view layer yet (locally) visible in a viewport (if it is not restricted). */
if (child_collection_restrict & COLLECTION_RESTRICT_VIEWPORT) {
child_layer->runtime_flag |= LAYER_COLLECTION_RESTRICT_VIEWPORT;
if (child_collection_restrict & COLLECTION_HIDE_VIEWPORT) {
child_layer->runtime_flag |= LAYER_COLLECTION_HIDE_VIEWPORT;
}
if (((child_layer->runtime_flag & LAYER_COLLECTION_RESTRICT_VIEWPORT) == 0) &&
if (((child_layer->runtime_flag & LAYER_COLLECTION_HIDE_VIEWPORT) == 0) &&
((child_layer_restrict & LAYER_COLLECTION_HIDE) == 0)) {
child_layer->runtime_flag |= LAYER_COLLECTION_VISIBLE_VIEW_LAYER;
}
@@ -1333,7 +1333,7 @@ void BKE_main_collection_sync_remap(const Main *bmain)
*/
bool BKE_layer_collection_objects_select(ViewLayer *view_layer, LayerCollection *lc, bool deselect)
{
if (lc->collection->flag & COLLECTION_RESTRICT_SELECT) {
if (lc->collection->flag & COLLECTION_HIDE_SELECT) {
return false;
}
@@ -1369,7 +1369,7 @@ bool BKE_layer_collection_objects_select(ViewLayer *view_layer, LayerCollection
bool BKE_layer_collection_has_selected_objects(ViewLayer *view_layer, LayerCollection *lc)
{
if (lc->collection->flag & COLLECTION_RESTRICT_SELECT) {
if (lc->collection->flag & COLLECTION_HIDE_SELECT) {
return false;
}
@@ -1457,7 +1457,7 @@ bool BKE_object_is_visible_in_viewport(const View3D *v3d, const struct Object *o
{
BLI_assert(v3d != NULL);
if (ob->restrictflag & OB_RESTRICT_VIEWPORT) {
if (ob->visibility_flag & OB_HIDE_VIEWPORT) {
return false;
}
@@ -2146,14 +2146,14 @@ void BKE_base_eval_flags(Base *base)
base->flag |= (base->flag_from_collection & g_base_collection_flags);
/* Apply object restrictions. */
const int object_restrict = base->object->restrictflag;
if (object_restrict & OB_RESTRICT_VIEWPORT) {
const int object_restrict = base->object->visibility_flag;
if (object_restrict & OB_HIDE_VIEWPORT) {
base->flag &= ~BASE_ENABLED_VIEWPORT;
}
if (object_restrict & OB_RESTRICT_RENDER) {
if (object_restrict & OB_HIDE_RENDER) {
base->flag &= ~BASE_ENABLED_RENDER;
}
if (object_restrict & OB_RESTRICT_SELECT) {
if (object_restrict & OB_HIDE_SELECT) {
base->flag &= ~BASE_SELECTABLE;
}

View File

@@ -855,8 +855,8 @@ static void lib_override_library_create_post_process(Main *bmain,
default_instantiating_collection = BKE_collection_add(
bmain, (Collection *)id_root, "OVERRIDE_HIDDEN");
/* Hide the collection from viewport and render. */
default_instantiating_collection->flag |= COLLECTION_RESTRICT_VIEWPORT |
COLLECTION_RESTRICT_RENDER;
default_instantiating_collection->flag |= COLLECTION_HIDE_VIEWPORT |
COLLECTION_HIDE_RENDER;
break;
}
case ID_OB: {
@@ -1731,8 +1731,7 @@ void BKE_lib_override_library_main_resync(Main *bmain,
override_resync_residual_storage = BKE_collection_add(
bmain, scene->master_collection, OVERRIDE_RESYNC_RESIDUAL_STORAGE_NAME);
/* Hide the collection from viewport and render. */
override_resync_residual_storage->flag |= COLLECTION_RESTRICT_VIEWPORT |
COLLECTION_RESTRICT_RENDER;
override_resync_residual_storage->flag |= COLLECTION_HIDE_VIEWPORT | COLLECTION_HIDE_RENDER;
}
/* Necessary to improve performances, and prevent layers matching override sub-collections to be

View File

@@ -429,7 +429,7 @@ MaskLayer *BKE_mask_layer_copy(const MaskLayer *masklay)
masklay_new->blend_flag = masklay->blend_flag;
masklay_new->flag = masklay->flag;
masklay_new->falloff = masklay->falloff;
masklay_new->restrictflag = masklay->restrictflag;
masklay_new->visibility_flag = masklay->visibility_flag;
for (spline = masklay->splines.first; spline; spline = spline->next) {
MaskSpline *spline_new = BKE_mask_spline_copy(spline);
@@ -2092,7 +2092,7 @@ void BKE_mask_clipboard_copy_from_layer(MaskLayer *mask_layer)
MaskSpline *spline;
/* Nothing to do if selection if disabled for the given layer. */
if (mask_layer->restrictflag & MASK_RESTRICT_SELECT) {
if (mask_layer->visibility_flag & MASK_HIDE_SELECT) {
return;
}

View File

@@ -619,7 +619,7 @@ void BKE_maskrasterize_handle_init(MaskRasterHandle *mr_handle,
unsigned int tot_boundary_found = 0;
#endif
if (masklay->restrictflag & MASK_RESTRICT_RENDER) {
if (masklay->visibility_flag & MASK_HIDE_RENDER) {
/* skip the layer */
mr_handle->layers_tot--;
masklay_index--;

View File

@@ -1554,15 +1554,15 @@ static const DupliGenerator gen_dupli_particles = {
static const DupliGenerator *get_dupli_generator(const DupliContext *ctx)
{
int transflag = ctx->object->transflag;
int restrictflag = ctx->object->restrictflag;
int visibility_flag = ctx->object->visibility_flag;
if ((transflag & OB_DUPLI) == 0 && ctx->object->runtime.geometry_set_eval == nullptr) {
return nullptr;
}
/* Should the dupli's be generated for this object? - Respect restrict flags. */
if (DEG_get_mode(ctx->depsgraph) == DAG_EVAL_RENDER ? (restrictflag & OB_RESTRICT_RENDER) :
(restrictflag & OB_RESTRICT_VIEWPORT)) {
if (DEG_get_mode(ctx->depsgraph) == DAG_EVAL_RENDER ? (visibility_flag & OB_HIDE_RENDER) :
(visibility_flag & OB_HIDE_VIEWPORT)) {
return nullptr;
}

View File

@@ -2305,7 +2305,7 @@ Object *BKE_scene_camera_switch_find(Scene *scene)
Object *first_camera = NULL;
LISTBASE_FOREACH (TimeMarker *, m, &scene->markers) {
if (m->camera && (m->camera->restrictflag & OB_RESTRICT_RENDER) == 0) {
if (m->camera && (m->camera->visibility_flag & OB_HIDE_RENDER) == 0) {
if ((m->frame <= ctime) && (m->frame > frame)) {
camera = m->camera;
frame = m->frame;

View File

@@ -321,7 +321,7 @@ static void do_version_layer_collection_post(ViewLayer *view_layer,
lc->flag |= LAYER_COLLECTION_EXCLUDE;
}
if (enabled && !selectable) {
lc->collection->flag |= COLLECTION_RESTRICT_SELECT;
lc->collection->flag |= COLLECTION_HIDE_SELECT;
}
}
@@ -450,7 +450,7 @@ static void do_version_layers_to_collections(Main *bmain, Scene *scene)
collections[layer] = collection;
if (!(scene->lay & (1 << layer))) {
collection->flag |= COLLECTION_RESTRICT_VIEWPORT | COLLECTION_RESTRICT_RENDER;
collection->flag |= COLLECTION_HIDE_VIEWPORT | COLLECTION_HIDE_RENDER;
}
}
@@ -1198,7 +1198,7 @@ void do_versions_after_linking_280(Main *bmain, ReportList *UNUSED(reports))
/* Add fake user for all existing groups. */
id_fake_user_set(&collection->id);
if (collection->flag & (COLLECTION_RESTRICT_VIEWPORT | COLLECTION_RESTRICT_RENDER)) {
if (collection->flag & (COLLECTION_HIDE_VIEWPORT | COLLECTION_HIDE_RENDER)) {
continue;
}
@@ -1229,8 +1229,7 @@ void do_versions_after_linking_280(Main *bmain, ReportList *UNUSED(reports))
char name[MAX_ID_NAME];
BLI_snprintf(name, sizeof(name), DATA_("Hidden %d"), coll_idx + 1);
*collection_hidden = BKE_collection_add(bmain, collection, name);
(*collection_hidden)->flag |= COLLECTION_RESTRICT_VIEWPORT |
COLLECTION_RESTRICT_RENDER;
(*collection_hidden)->flag |= COLLECTION_HIDE_VIEWPORT | COLLECTION_HIDE_RENDER;
}
BKE_collection_object_add(bmain, *collection_hidden, ob);
@@ -4083,9 +4082,8 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
if (!MAIN_VERSION_ATLEAST(bmain, 280, 75)) {
for (Scene *scene = bmain->scenes.first; scene; scene = scene->id.next) {
if (scene->master_collection != NULL) {
scene->master_collection->flag &= ~(COLLECTION_RESTRICT_VIEWPORT |
COLLECTION_RESTRICT_SELECT |
COLLECTION_RESTRICT_RENDER);
scene->master_collection->flag &= ~(COLLECTION_HIDE_VIEWPORT | COLLECTION_HIDE_SELECT |
COLLECTION_HIDE_RENDER);
}
UnitSettings *unit = &scene->unit;

View File

@@ -203,9 +203,9 @@ static void *bmw_VertShellWalker_step(BMWalker *walker)
curedge = shellWalk.curedge;
do {
if (!BLI_gset_haskey(walker->visit_set, curedge)) {
if (!walker->restrictflag ||
(walker->restrictflag &&
BMO_edge_flag_test(walker->bm, curedge, walker->restrictflag))) {
if (!walker->visibility_flag ||
(walker->visibility_flag &&
BMO_edge_flag_test(walker->bm, curedge, walker->visibility_flag))) {
BMwShellWalker *newstate;
v_old = BM_edge_other_vert(curedge, shellWalk.base);
@@ -714,7 +714,7 @@ static void *bmw_IslandboundWalker_step(BMWalker *walker)
iwalk->base = owalk.base;
#if 0
if (!BMO_face_flag_test(walker->bm, l->f, walker->restrictflag)) {
if (!BMO_face_flag_test(walker->bm, l->f, walker->visibility_flag)) {
iwalk->curloop = l->radial_next;
}
else {

View File

@@ -648,9 +648,9 @@ void DepsgraphNodeBuilder::build_idproperties(IDProperty *id_property)
void DepsgraphNodeBuilder::build_collection(LayerCollection *from_layer_collection,
Collection *collection)
{
const int restrict_flag = (graph_->mode == DAG_EVAL_VIEWPORT) ? COLLECTION_RESTRICT_VIEWPORT :
COLLECTION_RESTRICT_RENDER;
const bool is_collection_restricted = (collection->flag & restrict_flag);
const int visibility_flag = (graph_->mode == DAG_EVAL_VIEWPORT) ? COLLECTION_HIDE_VIEWPORT :
COLLECTION_HIDE_RENDER;
const bool is_collection_restricted = (collection->flag & visibility_flag);
const bool is_collection_visible = !is_collection_restricted && is_parent_collection_visible_;
IDNode *id_node;
if (built_map_.checkIsBuiltAndTag(collection)) {

View File

@@ -60,11 +60,11 @@ namespace blender::deg {
void DepsgraphNodeBuilder::build_layer_collections(ListBase *lb)
{
const int restrict_flag = (graph_->mode == DAG_EVAL_VIEWPORT) ? COLLECTION_RESTRICT_VIEWPORT :
COLLECTION_RESTRICT_RENDER;
const int visibility_flag = (graph_->mode == DAG_EVAL_VIEWPORT) ? COLLECTION_HIDE_VIEWPORT :
COLLECTION_HIDE_RENDER;
for (LayerCollection *lc = (LayerCollection *)lb->first; lc; lc = lc->next) {
if (lc->collection->flag & restrict_flag) {
if (lc->collection->flag & visibility_flag) {
continue;
}
if ((lc->flag & LAYER_COLLECTION_EXCLUDE) == 0) {

View File

@@ -61,11 +61,11 @@ namespace blender::deg {
void DepsgraphRelationBuilder::build_layer_collections(ListBase *lb)
{
const int restrict_flag = (graph_->mode == DAG_EVAL_VIEWPORT) ? COLLECTION_RESTRICT_VIEWPORT :
COLLECTION_RESTRICT_RENDER;
const int visibility_flag = (graph_->mode == DAG_EVAL_VIEWPORT) ? COLLECTION_HIDE_VIEWPORT :
COLLECTION_HIDE_RENDER;
for (LayerCollection *lc = (LayerCollection *)lb->first; lc; lc = lc->next) {
if ((lc->collection->flag & restrict_flag)) {
if ((lc->collection->flag & visibility_flag)) {
continue;
}
if ((lc->flag & LAYER_COLLECTION_EXCLUDE) == 0) {

View File

@@ -1892,7 +1892,7 @@ static size_t animdata_filter_gpencil(bAnimContext *ac,
}
/* outliner restrict-flag */
if (ob->restrictflag & OB_RESTRICT_VIEWPORT) {
if (ob->visibility_flag & OB_HIDE_VIEWPORT) {
continue;
}
}
@@ -3098,7 +3098,7 @@ static bool animdata_filter_base_is_ok(bDopeSheet *ads, Base *base, int filter_m
}
/* outliner restrict-flag */
if (ob->restrictflag & OB_RESTRICT_VIEWPORT) {
if (ob->visibility_flag & OB_HIDE_VIEWPORT) {
return false;
}
}

View File

@@ -445,7 +445,7 @@ static void draw_marker_name(const uchar *text_color,
if (marker->camera) {
Object *camera = marker->camera;
name = camera->id.name + 2;
if (camera->restrictflag & OB_RESTRICT_RENDER) {
if (camera->visibility_flag & OB_HIDE_RENDER) {
final_text_color[3] = 100;
}
}

View File

@@ -521,7 +521,7 @@ static int add_vertex_exec(bContext *C, wmOperator *op)
MaskLayer *mask_layer = BKE_mask_layer_active(mask);
if (mask_layer && mask_layer->restrictflag & (MASK_RESTRICT_VIEW | MASK_RESTRICT_SELECT)) {
if (mask_layer && mask_layer->visibility_flag & (MASK_HIDE_VIEW | MASK_HIDE_SELECT)) {
mask_layer = NULL;
}

View File

@@ -191,7 +191,7 @@ static void draw_spline_points(const bContext *C,
const char draw_type)
{
const bool is_spline_sel = (spline->flag & SELECT) &&
(mask_layer->restrictflag & MASK_RESTRICT_SELECT) == 0;
(mask_layer->visibility_flag & MASK_HIDE_SELECT) == 0;
const bool is_smooth = (draw_flag & MASK_DRAWFLAG_SMOOTH) != 0;
uchar rgb_spline[4];
@@ -529,7 +529,7 @@ static void draw_spline_curve(const bContext *C,
uchar rgb_tmp[4];
const bool is_spline_sel = (spline->flag & SELECT) &&
(mask_layer->restrictflag & MASK_RESTRICT_SELECT) == 0;
(mask_layer->visibility_flag & MASK_HIDE_SELECT) == 0;
const bool is_smooth = (draw_flag & MASK_DRAWFLAG_SMOOTH) != 0;
const bool is_fill = (spline->flag & MASK_SPLINE_NOFILL) == 0;
@@ -604,7 +604,7 @@ static void draw_mask_layers(const bContext *C,
mask_layer = mask_layer->next, i++) {
const bool is_active = (i == mask->masklay_act);
if (mask_layer->restrictflag & MASK_RESTRICT_VIEW) {
if (mask_layer->visibility_flag & MASK_HIDE_VIEW) {
continue;
}
@@ -613,7 +613,7 @@ static void draw_mask_layers(const bContext *C,
/* draw curve itself first... */
draw_spline_curve(C, mask_layer, spline, draw_flag, draw_type, is_active, width, height);
if (!(mask_layer->restrictflag & MASK_RESTRICT_SELECT)) {
if (!(mask_layer->visibility_flag & MASK_HIDE_SELECT)) {
/* ...and then handles over the curve so they're nicely visible */
draw_spline_points(C, mask_layer, spline, draw_flag, draw_type);
}

View File

@@ -287,7 +287,7 @@ static bool spline_under_mouse_get(const bContext *C,
}
for (MaskLayer *mask_layer = mask->masklayers.first; mask_layer != NULL;
mask_layer = mask_layer->next) {
if (mask_layer->restrictflag & MASK_RESTRICT_SELECT) {
if (mask_layer->visibility_flag & MASK_HIDE_SELECT) {
continue;
}
@@ -1322,7 +1322,7 @@ static int cyclic_toggle_exec(bContext *C, wmOperator *UNUSED(op))
Mask *mask = CTX_data_edit_mask(C);
LISTBASE_FOREACH (MaskLayer *, mask_layer, &mask->masklayers) {
if (mask_layer->restrictflag & (MASK_RESTRICT_VIEW | MASK_RESTRICT_SELECT)) {
if (mask_layer->visibility_flag & (MASK_HIDE_VIEW | MASK_HIDE_SELECT)) {
continue;
}
@@ -1403,7 +1403,7 @@ static int delete_exec(bContext *C, wmOperator *UNUSED(op))
MaskSpline *spline;
int mask_layer_shape_ofs = 0;
if (mask_layer->restrictflag & (MASK_RESTRICT_VIEW | MASK_RESTRICT_SELECT)) {
if (mask_layer->visibility_flag & (MASK_HIDE_VIEW | MASK_HIDE_SELECT)) {
continue;
}
@@ -1523,7 +1523,7 @@ static int mask_switch_direction_exec(bContext *C, wmOperator *UNUSED(op))
LISTBASE_FOREACH (MaskLayer *, mask_layer, &mask->masklayers) {
bool changed_layer = false;
if (mask_layer->restrictflag & (MASK_RESTRICT_VIEW | MASK_RESTRICT_SELECT)) {
if (mask_layer->visibility_flag & (MASK_HIDE_VIEW | MASK_HIDE_SELECT)) {
continue;
}
@@ -1581,7 +1581,7 @@ static int mask_normals_make_consistent_exec(bContext *C, wmOperator *UNUSED(op)
LISTBASE_FOREACH (MaskLayer *, mask_layer, &mask->masklayers) {
bool changed_layer = false;
if (mask_layer->restrictflag & (MASK_RESTRICT_VIEW | MASK_RESTRICT_SELECT)) {
if (mask_layer->visibility_flag & (MASK_HIDE_VIEW | MASK_HIDE_SELECT)) {
continue;
}
@@ -1642,7 +1642,7 @@ static int set_handle_type_exec(bContext *C, wmOperator *op)
bool changed = false;
LISTBASE_FOREACH (MaskLayer *, mask_layer, &mask->masklayers) {
if (mask_layer->restrictflag & (MASK_RESTRICT_VIEW | MASK_RESTRICT_SELECT)) {
if (mask_layer->visibility_flag & (MASK_HIDE_VIEW | MASK_HIDE_SELECT)) {
continue;
}
@@ -1724,9 +1724,9 @@ static int mask_hide_view_clear_exec(bContext *C, wmOperator *op)
LISTBASE_FOREACH (MaskLayer *, mask_layer, &mask->masklayers) {
if (mask_layer->restrictflag & OB_RESTRICT_VIEWPORT) {
if (mask_layer->visibility_flag & OB_HIDE_VIEWPORT) {
ED_mask_layer_select_set(mask_layer, select);
mask_layer->restrictflag &= ~OB_RESTRICT_VIEWPORT;
mask_layer->visibility_flag &= ~OB_HIDE_VIEWPORT;
changed = true;
}
}
@@ -1766,7 +1766,7 @@ static int mask_hide_view_set_exec(bContext *C, wmOperator *op)
LISTBASE_FOREACH (MaskLayer *, mask_layer, &mask->masklayers) {
if (mask_layer->restrictflag & MASK_RESTRICT_SELECT) {
if (mask_layer->visibility_flag & MASK_HIDE_SELECT) {
continue;
}
@@ -1774,7 +1774,7 @@ static int mask_hide_view_set_exec(bContext *C, wmOperator *op)
if (ED_mask_layer_select_check(mask_layer)) {
ED_mask_layer_select_set(mask_layer, false);
mask_layer->restrictflag |= OB_RESTRICT_VIEWPORT;
mask_layer->visibility_flag |= OB_HIDE_VIEWPORT;
changed = true;
if (mask_layer == BKE_mask_layer_active(mask)) {
BKE_mask_layer_active_set(mask, NULL);
@@ -1783,7 +1783,7 @@ static int mask_hide_view_set_exec(bContext *C, wmOperator *op)
}
else {
if (!ED_mask_layer_select_check(mask_layer)) {
mask_layer->restrictflag |= OB_RESTRICT_VIEWPORT;
mask_layer->visibility_flag |= OB_HIDE_VIEWPORT;
changed = true;
if (mask_layer == BKE_mask_layer_active(mask)) {
BKE_mask_layer_active_set(mask, NULL);
@@ -1825,7 +1825,7 @@ static int mask_feather_weight_clear_exec(bContext *C, wmOperator *UNUSED(op))
bool changed = false;
LISTBASE_FOREACH (MaskLayer *, mask_layer, &mask->masklayers) {
if (mask_layer->restrictflag & (MASK_RESTRICT_SELECT | MASK_RESTRICT_VIEW)) {
if (mask_layer->visibility_flag & (MASK_HIDE_SELECT | MASK_HIDE_VIEW)) {
continue;
}

View File

@@ -85,7 +85,7 @@ bool ED_mask_find_nearest_diff_point(const bContext *C,
*mask_layer_eval = mask_eval->masklayers.first;
mask_layer_orig != NULL;
mask_layer_orig = mask_layer_orig->next, mask_layer_eval = mask_layer_eval->next) {
if (mask_layer_orig->restrictflag & (MASK_RESTRICT_VIEW | MASK_RESTRICT_SELECT)) {
if (mask_layer_orig->visibility_flag & (MASK_HIDE_VIEW | MASK_HIDE_SELECT)) {
continue;
}
@@ -245,7 +245,7 @@ MaskSplinePoint *ED_mask_point_find_nearest(const bContext *C,
mask_layer_orig != NULL;
mask_layer_orig = mask_layer_orig->next, mask_layer_eval = mask_layer_eval->next) {
if (mask_layer_orig->restrictflag & (MASK_RESTRICT_VIEW | MASK_RESTRICT_SELECT)) {
if (mask_layer_orig->visibility_flag & (MASK_HIDE_VIEW | MASK_HIDE_SELECT)) {
continue;
}
@@ -409,7 +409,7 @@ bool ED_mask_feather_find_nearest(const bContext *C,
int i, tot_feather_point;
float(*feather_points)[2], (*fp)[2];
if (mask_layer_orig->restrictflag & (MASK_RESTRICT_VIEW | MASK_RESTRICT_SELECT)) {
if (mask_layer_orig->visibility_flag & (MASK_HIDE_VIEW | MASK_HIDE_SELECT)) {
continue;
}
@@ -638,7 +638,7 @@ bool ED_mask_selected_minmax(const bContext *C,
INIT_MINMAX2(min, max);
for (MaskLayer *mask_layer = mask_eval->masklayers.first; mask_layer != NULL;
mask_layer = mask_layer->next) {
if (mask_layer->restrictflag & (MASK_RESTRICT_VIEW | MASK_RESTRICT_SELECT)) {
if (mask_layer->visibility_flag & (MASK_HIDE_VIEW | MASK_HIDE_SELECT)) {
continue;
}
for (MaskSpline *spline = mask_layer->splines.first; spline != NULL; spline = spline->next) {

View File

@@ -46,7 +46,7 @@ static int mask_parent_clear_exec(bContext *C, wmOperator *UNUSED(op))
Mask *mask = CTX_data_edit_mask(C);
LISTBASE_FOREACH (MaskLayer *, mask_layer, &mask->masklayers) {
if (mask_layer->restrictflag & (MASK_RESTRICT_VIEW | MASK_RESTRICT_SELECT)) {
if (mask_layer->visibility_flag & (MASK_HIDE_VIEW | MASK_HIDE_SELECT)) {
continue;
}
@@ -138,7 +138,7 @@ static int mask_parent_set_exec(bContext *C, wmOperator *UNUSED(op))
}
LISTBASE_FOREACH (MaskLayer *, mask_layer, &mask->masklayers) {
if (mask_layer->restrictflag & (MASK_RESTRICT_VIEW | MASK_RESTRICT_SELECT)) {
if (mask_layer->visibility_flag & (MASK_HIDE_VIEW | MASK_HIDE_SELECT)) {
continue;
}

View File

@@ -68,7 +68,7 @@ bool ED_mask_spline_select_check(const MaskSpline *spline)
bool ED_mask_layer_select_check(const MaskLayer *mask_layer)
{
if (mask_layer->restrictflag & (MASK_RESTRICT_VIEW | MASK_RESTRICT_SELECT)) {
if (mask_layer->visibility_flag & (MASK_HIDE_VIEW | MASK_HIDE_SELECT)) {
return false;
}
@@ -110,7 +110,7 @@ void ED_mask_spline_select_set(MaskSpline *spline, const bool do_select)
void ED_mask_layer_select_set(MaskLayer *mask_layer, const bool do_select)
{
if (mask_layer->restrictflag & MASK_RESTRICT_SELECT) {
if (mask_layer->visibility_flag & MASK_HIDE_SELECT) {
if (do_select == true) {
return;
}
@@ -134,7 +134,7 @@ void ED_mask_select_toggle_all(Mask *mask, int action)
LISTBASE_FOREACH (MaskLayer *, mask_layer, &mask->masklayers) {
if (mask_layer->restrictflag & MASK_RESTRICT_VIEW) {
if (mask_layer->visibility_flag & MASK_HIDE_VIEW) {
continue;
}
@@ -142,7 +142,7 @@ void ED_mask_select_toggle_all(Mask *mask, int action)
/* we don't have generic functions for this, its restricted to this operator
* if one day we need to re-use such functionality, they can be split out */
if (mask_layer->restrictflag & MASK_RESTRICT_SELECT) {
if (mask_layer->visibility_flag & MASK_HIDE_SELECT) {
continue;
}
LISTBASE_FOREACH (MaskSpline *, spline, &mask_layer->splines) {
@@ -166,7 +166,7 @@ void ED_mask_select_flush_all(Mask *mask)
/* Intentionally *don't* do this in the mask layer loop
* so we clear flags on all splines. */
if (mask_layer->restrictflag & MASK_RESTRICT_VIEW) {
if (mask_layer->visibility_flag & MASK_HIDE_VIEW) {
continue;
}
@@ -465,7 +465,7 @@ static int box_select_exec(bContext *C, wmOperator *op)
/* do actual selection */
LISTBASE_FOREACH (MaskLayer *, mask_layer, &mask->masklayers) {
if (mask_layer->restrictflag & (MASK_RESTRICT_VIEW | MASK_RESTRICT_SELECT)) {
if (mask_layer->visibility_flag & (MASK_HIDE_VIEW | MASK_HIDE_SELECT)) {
continue;
}
@@ -550,7 +550,7 @@ static bool do_lasso_select_mask(bContext *C,
/* do actual selection */
LISTBASE_FOREACH (MaskLayer *, mask_layer, &mask->masklayers) {
if (mask_layer->restrictflag & (MASK_RESTRICT_VIEW | MASK_RESTRICT_SELECT)) {
if (mask_layer->visibility_flag & (MASK_HIDE_VIEW | MASK_HIDE_SELECT)) {
continue;
}
@@ -691,7 +691,7 @@ static int circle_select_exec(bContext *C, wmOperator *op)
/* do actual selection */
LISTBASE_FOREACH (MaskLayer *, mask_layer, &mask->masklayers) {
if (mask_layer->restrictflag & (MASK_RESTRICT_VIEW | MASK_RESTRICT_SELECT)) {
if (mask_layer->visibility_flag & (MASK_HIDE_VIEW | MASK_HIDE_SELECT)) {
continue;
}
@@ -820,7 +820,7 @@ static int mask_select_linked_exec(bContext *C, wmOperator *UNUSED(op))
/* do actual selection */
LISTBASE_FOREACH (MaskLayer *, mask_layer, &mask->masklayers) {
if (mask_layer->restrictflag & (MASK_RESTRICT_VIEW | MASK_RESTRICT_SELECT)) {
if (mask_layer->visibility_flag & (MASK_HIDE_VIEW | MASK_HIDE_SELECT)) {
continue;
}
@@ -870,7 +870,7 @@ static int mask_select_more_less(bContext *C, bool more)
Mask *mask = CTX_data_edit_mask(C);
LISTBASE_FOREACH (MaskLayer *, mask_layer, &mask->masklayers) {
if (mask_layer->restrictflag & (MASK_RESTRICT_VIEW | MASK_RESTRICT_SELECT)) {
if (mask_layer->visibility_flag & (MASK_HIDE_VIEW | MASK_HIDE_SELECT)) {
continue;
}

View File

@@ -144,7 +144,7 @@ static int mask_shape_key_feather_reset_exec(bContext *C, wmOperator *UNUSED(op)
LISTBASE_FOREACH (MaskLayer *, mask_layer, &mask->masklayers) {
if (mask_layer->restrictflag & (MASK_RESTRICT_VIEW | MASK_RESTRICT_SELECT)) {
if (mask_layer->visibility_flag & (MASK_HIDE_VIEW | MASK_HIDE_SELECT)) {
continue;
}
@@ -238,7 +238,7 @@ static int mask_shape_key_rekey_exec(bContext *C, wmOperator *op)
const bool do_location = RNA_boolean_get(op->ptr, "location");
LISTBASE_FOREACH (MaskLayer *, mask_layer, &mask->masklayers) {
if (mask_layer->restrictflag & (MASK_RESTRICT_VIEW | MASK_RESTRICT_SELECT)) {
if (mask_layer->visibility_flag & (MASK_HIDE_VIEW | MASK_HIDE_SELECT)) {
continue;
}

View File

@@ -3530,7 +3530,7 @@ static int object_add_named_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
}
basen->object->restrictflag &= ~OB_RESTRICT_VIEWPORT;
basen->object->visibility_flag &= ~OB_HIDE_VIEWPORT;
int mval[2];
if (object_add_drop_xy_get(C, op, &mval)) {

View File

@@ -1311,7 +1311,7 @@ static int bake(const BakeAPIRender *bkr,
}
else {
ob_cage_eval = DEG_get_evaluated_object(depsgraph, ob_cage);
ob_cage_eval->restrictflag |= OB_RESTRICT_RENDER;
ob_cage_eval->visibility_flag |= OB_HIDE_RENDER;
ob_cage_eval->base_flag &= ~(BASE_VISIBLE_DEPSGRAPH | BASE_ENABLED_RENDER);
}
}
@@ -1411,7 +1411,7 @@ static int bake(const BakeAPIRender *bkr,
/* initialize highpoly_data */
highpoly[i].ob = ob_iter;
highpoly[i].ob_eval = DEG_get_evaluated_object(depsgraph, ob_iter);
highpoly[i].ob_eval->restrictflag &= ~OB_RESTRICT_RENDER;
highpoly[i].ob_eval->visibility_flag &= ~OB_HIDE_RENDER;
highpoly[i].ob_eval->base_flag |= (BASE_VISIBLE_DEPSGRAPH | BASE_ENABLED_RENDER);
highpoly[i].me = BKE_mesh_new_from_object(NULL, highpoly[i].ob_eval, false, false);
@@ -1427,10 +1427,10 @@ static int bake(const BakeAPIRender *bkr,
BLI_assert(i == tot_highpoly);
if (ob_cage != NULL) {
ob_cage_eval->restrictflag |= OB_RESTRICT_RENDER;
ob_cage_eval->visibility_flag |= OB_HIDE_RENDER;
ob_cage_eval->base_flag &= ~(BASE_VISIBLE_DEPSGRAPH | BASE_ENABLED_RENDER);
}
ob_low_eval->restrictflag |= OB_RESTRICT_RENDER;
ob_low_eval->visibility_flag |= OB_HIDE_RENDER;
ob_low_eval->base_flag &= ~(BASE_VISIBLE_DEPSGRAPH | BASE_ENABLED_RENDER);
/* populate the pixel arrays with the corresponding face data for each high poly object */
@@ -1473,7 +1473,7 @@ static int bake(const BakeAPIRender *bkr,
}
else {
/* If low poly is not renderable it should have failed long ago. */
BLI_assert((ob_low_eval->restrictflag & OB_RESTRICT_RENDER) == 0);
BLI_assert((ob_low_eval->visibility_flag & OB_HIDE_RENDER) == 0);
if (RE_bake_has_engine(re)) {
ok = RE_bake_engine(re,

View File

@@ -384,7 +384,7 @@ static int object_hide_collection_exec(bContext *C, wmOperator *op)
DEG_id_tag_update(&scene->id, ID_RECALC_BASE_FLAGS);
if (v3d->flag & V3D_LOCAL_COLLECTIONS) {
if (lc->runtime_flag & LAYER_COLLECTION_RESTRICT_VIEWPORT) {
if (lc->runtime_flag & LAYER_COLLECTION_HIDE_VIEWPORT) {
return OPERATOR_CANCELLED;
}
if (toggle) {
@@ -421,7 +421,7 @@ void ED_collection_hide_menu_draw(const bContext *C, uiLayout *layout)
continue;
}
if (lc->collection->flag & COLLECTION_RESTRICT_VIEWPORT) {
if (lc->collection->flag & COLLECTION_HIDE_VIEWPORT) {
continue;
}
@@ -926,7 +926,7 @@ static bool editmode_toggle_poll(bContext *C)
}
/* if hidden but in edit mode, we still display */
if ((ob->restrictflag & OB_RESTRICT_VIEWPORT) && !(ob->mode & OB_MODE_EDIT)) {
if ((ob->visibility_flag & OB_HIDE_VIEWPORT) && !(ob->mode & OB_MODE_EDIT)) {
return false;
}

View File

@@ -273,10 +273,10 @@ static void switch_preview_collection_visibilty(ViewLayer *view_layer, const ePr
for (lc = lc->layer_collections.first; lc; lc = lc->next) {
if (STREQ(lc->collection->id.name + 2, collection_name)) {
lc->collection->flag &= ~COLLECTION_RESTRICT_RENDER;
lc->collection->flag &= ~COLLECTION_HIDE_RENDER;
}
else {
lc->collection->flag |= COLLECTION_RESTRICT_RENDER;
lc->collection->flag |= COLLECTION_HIDE_RENDER;
}
}
}
@@ -288,10 +288,10 @@ static void switch_preview_floor_visibility(ViewLayer *view_layer,
LISTBASE_FOREACH (Base *, base, &view_layer->object_bases) {
if (STREQ(base->object->id.name + 2, "Floor")) {
if (pr_method == PR_ICON_RENDER) {
base->object->restrictflag |= OB_RESTRICT_RENDER;
base->object->visibility_flag |= OB_HIDE_RENDER;
}
else {
base->object->restrictflag &= ~OB_RESTRICT_RENDER;
base->object->visibility_flag &= ~OB_HIDE_RENDER;
}
}
}

View File

@@ -381,7 +381,7 @@ bool ED_operator_console_active(bContext *C)
static bool ed_object_hidden(const Object *ob)
{
/* if hidden but in edit mode, we still display, can happen with animation */
return ((ob->restrictflag & OB_RESTRICT_VIEWPORT) && !(ob->mode & OB_MODE_EDIT));
return ((ob->visibility_flag & OB_HIDE_VIEWPORT) && !(ob->mode & OB_MODE_EDIT));
}
bool ED_operator_object_active(bContext *C)

View File

@@ -492,7 +492,7 @@ static bool mask_has_selection(const bContext *C)
}
LISTBASE_FOREACH (MaskLayer *, mask_layer, &mask->masklayers) {
if (mask_layer->restrictflag & (MASK_RESTRICT_VIEW | MASK_RESTRICT_SELECT)) {
if (mask_layer->visibility_flag & (MASK_HIDE_VIEW | MASK_HIDE_SELECT)) {
continue;
}
LISTBASE_FOREACH (MaskSpline *, spline, &mask_layer->splines) {

View File

@@ -1263,22 +1263,22 @@ static bool collection_flag_poll(bContext *C, bool clear, int flag)
static bool collection_enable_poll(bContext *C)
{
return collection_flag_poll(C, true, COLLECTION_RESTRICT_VIEWPORT);
return collection_flag_poll(C, true, COLLECTION_HIDE_VIEWPORT);
}
static bool collection_disable_poll(bContext *C)
{
return collection_flag_poll(C, false, COLLECTION_RESTRICT_VIEWPORT);
return collection_flag_poll(C, false, COLLECTION_HIDE_VIEWPORT);
}
static bool collection_enable_render_poll(bContext *C)
{
return collection_flag_poll(C, true, COLLECTION_RESTRICT_RENDER);
return collection_flag_poll(C, true, COLLECTION_HIDE_RENDER);
}
static bool collection_disable_render_poll(bContext *C)
{
return collection_flag_poll(C, false, COLLECTION_RESTRICT_RENDER);
return collection_flag_poll(C, false, COLLECTION_HIDE_RENDER);
}
static int collection_flag_exec(bContext *C, wmOperator *op)
@@ -1288,7 +1288,7 @@ static int collection_flag_exec(bContext *C, wmOperator *op)
SpaceOutliner *space_outliner = CTX_wm_space_outliner(C);
const bool is_render = strstr(op->idname, "render");
const bool clear = strstr(op->idname, "show") || strstr(op->idname, "enable");
int flag = is_render ? COLLECTION_RESTRICT_RENDER : COLLECTION_RESTRICT_VIEWPORT;
int flag = is_render ? COLLECTION_HIDE_RENDER : COLLECTION_HIDE_VIEWPORT;
struct CollectionEditData data = {
.scene = scene,
.space_outliner = space_outliner,

View File

@@ -293,7 +293,7 @@ void createTransMaskingData(bContext *C, TransInfo *t)
for (masklay = mask->masklayers.first; masklay; masklay = masklay->next) {
MaskSpline *spline;
if (masklay->restrictflag & (MASK_RESTRICT_VIEW | MASK_RESTRICT_SELECT)) {
if (masklay->visibility_flag & (MASK_HIDE_VIEW | MASK_HIDE_SELECT)) {
continue;
}
@@ -351,7 +351,7 @@ void createTransMaskingData(bContext *C, TransInfo *t)
for (masklay = mask->masklayers.first; masklay; masklay = masklay->next) {
MaskSpline *spline;
if (masklay->restrictflag & (MASK_RESTRICT_VIEW | MASK_RESTRICT_SELECT)) {
if (masklay->visibility_flag & (MASK_HIDE_VIEW | MASK_HIDE_SELECT)) {
continue;
}

View File

@@ -1968,8 +1968,8 @@ static int lineart_usage_check(Collection *c, Object *ob, bool is_render)
if (c->gobject.first) {
if (BKE_collection_has_object(c, (Object *)(ob->id.orig_id))) {
if ((is_render && (c->flag & COLLECTION_RESTRICT_RENDER)) ||
((!is_render) && (c->flag & COLLECTION_RESTRICT_VIEWPORT))) {
if ((is_render && (c->flag & COLLECTION_HIDE_RENDER)) ||
((!is_render) && (c->flag & COLLECTION_HIDE_VIEWPORT))) {
return OBJECT_LRT_EXCLUDE;
}
if (ob->lineart.usage == OBJECT_LRT_INHERIT) {

View File

@@ -102,10 +102,10 @@ typedef struct Collection {
/* Collection->flag */
enum {
COLLECTION_RESTRICT_VIEWPORT = (1 << 0), /* Disable in viewports. */
COLLECTION_RESTRICT_SELECT = (1 << 1), /* Not selectable in viewport. */
COLLECTION_HIDE_VIEWPORT = (1 << 0), /* Disable in viewports. */
COLLECTION_HIDE_SELECT = (1 << 1), /* Not selectable in viewport. */
/* COLLECTION_DISABLED_DEPRECATED = (1 << 2), */ /* Not used anymore */
COLLECTION_RESTRICT_RENDER = (1 << 3), /* Disable in renders. */
COLLECTION_HIDE_RENDER = (1 << 3), /* Disable in renders. */
COLLECTION_HAS_OBJECT_CACHE = (1 << 4), /* Runtime: object_cache is populated. */
COLLECTION_IS_MASTER = (1 << 5), /* Is master collection embedded in the scene. */
COLLECTION_HAS_OBJECT_CACHE_INSTANCED = (1 << 6), /* for object_cache_instanced. */

View File

@@ -222,7 +222,7 @@ enum {
enum {
LAYER_COLLECTION_HAS_OBJECTS = (1 << 0),
/* LAYER_COLLECTION_VISIBLE_DEPSGRAPH = (1 << 1), */ /* UNUSED */
LAYER_COLLECTION_RESTRICT_VIEWPORT = (1 << 2),
LAYER_COLLECTION_HIDE_VIEWPORT = (1 << 2),
LAYER_COLLECTION_VISIBLE_VIEW_LAYER = (1 << 4),
};

View File

@@ -174,7 +174,7 @@ typedef struct MaskLayer {
/** For animation. */
char flag;
/** Matching 'Object' flag of the same name - eventually use in the outliner. */
char restrictflag;
char visibility_flag;
} MaskLayer;
/* MaskParent->flag */
@@ -206,10 +206,10 @@ enum {
MASK_SPLINE_OFFSET_SMOOTH = 1,
};
/* ob->restrictflag */
#define MASK_RESTRICT_VIEW (1 << 0)
#define MASK_RESTRICT_SELECT (1 << 1)
#define MASK_RESTRICT_RENDER (1 << 2)
/* MaskLayer->visibility_flag */
#define MASK_HIDE_VIEW (1 << 0)
#define MASK_HIDE_SELECT (1 << 1)
#define MASK_HIDE_RENDER (1 << 2)
/* SpaceClip->mask_draw_flag */
#define MASK_DRAWFLAG_SMOOTH (1 << 0)

View File

@@ -385,7 +385,7 @@ typedef struct Object {
short softflag;
/** For restricting view, select, render etc. accessible in outliner. */
char restrictflag;
char visibility_flag;
/** Flag for pinning. */
char shapeflag;
@@ -670,11 +670,11 @@ enum {
# define OB_FLAG_UNUSED_12 (1 << 12) /* cleared */
#endif
/* ob->restrictflag */
/* ob->visibility_flag */
enum {
OB_RESTRICT_VIEWPORT = 1 << 0,
OB_RESTRICT_SELECT = 1 << 1,
OB_RESTRICT_RENDER = 1 << 2,
OB_HIDE_VIEWPORT = 1 << 0,
OB_HIDE_SELECT = 1 << 1,
OB_HIDE_RENDER = 1 << 2,
};
/* ob->shapeflag */

View File

@@ -82,11 +82,13 @@ DNA_STRUCT_RENAME_ELEM(FluidDomainSettings, guiding_vel_factor, guide_vel_factor
DNA_STRUCT_RENAME_ELEM(FluidEffectorSettings, guiding_mode, guide_mode)
DNA_STRUCT_RENAME_ELEM(Image, name, filepath)
DNA_STRUCT_RENAME_ELEM(Library, name, filepath)
DNA_STRUCT_RENAME_ELEM(MaskLayer, restrictflag, visibility_flag)
DNA_STRUCT_RENAME_ELEM(MovieClip, name, filepath)
DNA_STRUCT_RENAME_ELEM(Object, col, color)
DNA_STRUCT_RENAME_ELEM(Object, dup_group, instance_collection)
DNA_STRUCT_RENAME_ELEM(Object, dupfacesca, instance_faces_scale)
DNA_STRUCT_RENAME_ELEM(Object, size, scale)
DNA_STRUCT_RENAME_ELEM(Object, restrictflag, visibility_flag)
DNA_STRUCT_RENAME_ELEM(ParticleSettings, dup_group, instance_collection)
DNA_STRUCT_RENAME_ELEM(ParticleSettings, dup_ob, instance_object)
DNA_STRUCT_RENAME_ELEM(ParticleSettings, dupliweights, instance_weights)

View File

@@ -322,17 +322,17 @@ static void rna_Collection_flag_set(PointerRNA *ptr, const bool value, const int
static void rna_Collection_hide_select_set(PointerRNA *ptr, bool value)
{
rna_Collection_flag_set(ptr, value, COLLECTION_RESTRICT_SELECT);
rna_Collection_flag_set(ptr, value, COLLECTION_HIDE_SELECT);
}
static void rna_Collection_hide_viewport_set(PointerRNA *ptr, bool value)
{
rna_Collection_flag_set(ptr, value, COLLECTION_RESTRICT_VIEWPORT);
rna_Collection_flag_set(ptr, value, COLLECTION_HIDE_VIEWPORT);
}
static void rna_Collection_hide_render_set(PointerRNA *ptr, bool value)
{
rna_Collection_flag_set(ptr, value, COLLECTION_RESTRICT_RENDER);
rna_Collection_flag_set(ptr, value, COLLECTION_HIDE_RENDER);
}
static void rna_Collection_flag_update(Main *bmain, Scene *scene, PointerRNA *ptr)
@@ -496,7 +496,7 @@ void RNA_def_collections(BlenderRNA *brna)
/* Flags */
prop = RNA_def_property(srna, "hide_select", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", COLLECTION_RESTRICT_SELECT);
RNA_def_property_boolean_sdna(prop, NULL, "flag", COLLECTION_HIDE_SELECT);
RNA_def_property_boolean_funcs(prop, NULL, "rna_Collection_hide_select_set");
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
RNA_def_property_ui_icon(prop, ICON_RESTRICT_SELECT_OFF, -1);
@@ -504,7 +504,7 @@ void RNA_def_collections(BlenderRNA *brna)
RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_Collection_flag_update");
prop = RNA_def_property(srna, "hide_viewport", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", COLLECTION_RESTRICT_VIEWPORT);
RNA_def_property_boolean_sdna(prop, NULL, "flag", COLLECTION_HIDE_VIEWPORT);
RNA_def_property_boolean_funcs(prop, NULL, "rna_Collection_hide_viewport_set");
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
RNA_def_property_ui_icon(prop, ICON_RESTRICT_VIEW_OFF, -1);
@@ -512,7 +512,7 @@ void RNA_def_collections(BlenderRNA *brna)
RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_Collection_flag_update");
prop = RNA_def_property(srna, "hide_render", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", COLLECTION_RESTRICT_RENDER);
RNA_def_property_boolean_sdna(prop, NULL, "flag", COLLECTION_HIDE_RENDER);
RNA_def_property_boolean_funcs(prop, NULL, "rna_Collection_hide_render_set");
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
RNA_def_property_ui_icon(prop, ICON_RESTRICT_RENDER_OFF, -1);

View File

@@ -134,7 +134,7 @@ static bool rna_LayerCollection_visible_get(LayerCollection *layer_collection, b
}
if (v3d->local_collections_uuid & layer_collection->local_collections_bits) {
return (layer_collection->runtime_flag & LAYER_COLLECTION_RESTRICT_VIEWPORT) == 0;
return (layer_collection->runtime_flag & LAYER_COLLECTION_HIDE_VIEWPORT) == 0;
}
return false;

View File

@@ -991,19 +991,19 @@ static void rna_def_mask_layer(BlenderRNA *brna)
/* restrict */
prop = RNA_def_property(srna, "hide", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "restrictflag", MASK_RESTRICT_VIEW);
RNA_def_property_boolean_sdna(prop, NULL, "visibility_flag", MASK_HIDE_VIEW);
RNA_def_property_ui_text(prop, "Restrict View", "Restrict visibility in the viewport");
RNA_def_property_ui_icon(prop, ICON_RESTRICT_VIEW_OFF, -1);
RNA_def_property_update(prop, NC_MASK | ND_DRAW, NULL);
prop = RNA_def_property(srna, "hide_select", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "restrictflag", MASK_RESTRICT_SELECT);
RNA_def_property_boolean_sdna(prop, NULL, "visibility_flag", MASK_HIDE_SELECT);
RNA_def_property_ui_text(prop, "Restrict Select", "Restrict selection in the viewport");
RNA_def_property_ui_icon(prop, ICON_RESTRICT_SELECT_OFF, -1);
RNA_def_property_update(prop, NC_MASK | ND_DRAW, NULL);
prop = RNA_def_property(srna, "hide_render", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "restrictflag", MASK_RESTRICT_RENDER);
RNA_def_property_boolean_sdna(prop, NULL, "visibility_flag", MASK_HIDE_RENDER);
RNA_def_property_ui_text(prop, "Restrict Render", "Restrict renderability");
RNA_def_property_ui_icon(prop, ICON_RESTRICT_RENDER_OFF, -1);
RNA_def_property_update(prop, NC_MASK | NA_EDITED, NULL);

View File

@@ -2927,6 +2927,44 @@ static void rna_def_object_lineart(BlenderRNA *brna)
RNA_def_property_update(prop, 0, "rna_object_lineart_update");
}
static void rna_def_object_visibility(StructRNA *srna)
{
PropertyRNA *prop;
/* Hide options. */
prop = RNA_def_property(srna, "hide_viewport", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "visibility_flag", OB_HIDE_VIEWPORT);
RNA_def_property_ui_text(prop, "Disable in Viewports", "Globally disable in viewports");
RNA_def_property_ui_icon(prop, ICON_RESTRICT_VIEW_OFF, -1);
RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_hide_update");
prop = RNA_def_property(srna, "hide_select", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "visibility_flag", OB_HIDE_SELECT);
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
RNA_def_property_ui_text(prop, "Disable Selection", "Disable selection in viewport");
RNA_def_property_ui_icon(prop, ICON_RESTRICT_SELECT_OFF, -1);
RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_hide_update");
prop = RNA_def_property(srna, "hide_render", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "visibility_flag", OB_HIDE_RENDER);
RNA_def_property_ui_text(prop, "Disable in Renders", "Globally disable in renders");
RNA_def_property_ui_icon(prop, ICON_RESTRICT_RENDER_OFF, -1);
RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_hide_update");
/* Instancer options. */
prop = RNA_def_property(srna, "show_instancer_for_render", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "duplicator_visibility_flag", OB_DUPLI_FLAG_RENDER);
RNA_def_property_ui_text(prop, "Render Instancer", "Make instancer visible when rendering");
RNA_def_property_update(
prop, NC_OBJECT | ND_DRAW, "rna_Object_duplicator_visibility_flag_update");
prop = RNA_def_property(srna, "show_instancer_for_viewport", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "duplicator_visibility_flag", OB_DUPLI_FLAG_VIEWPORT);
RNA_def_property_ui_text(prop, "Display Instancer", "Make instancer visible in the viewport");
RNA_def_property_update(
prop, NC_OBJECT | ND_DRAW, "rna_Object_duplicator_visibility_flag_update");
}
static void rna_def_object(BlenderRNA *brna)
{
StructRNA *srna;
@@ -3506,37 +3544,7 @@ static void rna_def_object(BlenderRNA *brna)
RNA_def_property_struct_type(prop, "RigidBodyConstraint");
RNA_def_property_ui_text(prop, "Rigid Body Constraint", "Constraint constraining rigid bodies");
/* restrict */
prop = RNA_def_property(srna, "hide_viewport", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "restrictflag", OB_RESTRICT_VIEWPORT);
RNA_def_property_ui_text(prop, "Disable in Viewports", "Globally disable in viewports");
RNA_def_property_ui_icon(prop, ICON_RESTRICT_VIEW_OFF, -1);
RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_hide_update");
prop = RNA_def_property(srna, "hide_select", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "restrictflag", OB_RESTRICT_SELECT);
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
RNA_def_property_ui_text(prop, "Disable Selection", "Disable selection in viewport");
RNA_def_property_ui_icon(prop, ICON_RESTRICT_SELECT_OFF, -1);
RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_hide_update");
prop = RNA_def_property(srna, "hide_render", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "restrictflag", OB_RESTRICT_RENDER);
RNA_def_property_ui_text(prop, "Disable in Renders", "Globally disable in renders");
RNA_def_property_ui_icon(prop, ICON_RESTRICT_RENDER_OFF, -1);
RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_hide_update");
prop = RNA_def_property(srna, "show_instancer_for_render", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "duplicator_visibility_flag", OB_DUPLI_FLAG_RENDER);
RNA_def_property_ui_text(prop, "Render Instancer", "Make instancer visible when rendering");
RNA_def_property_update(
prop, NC_OBJECT | ND_DRAW, "rna_Object_duplicator_visibility_flag_update");
prop = RNA_def_property(srna, "show_instancer_for_viewport", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "duplicator_visibility_flag", OB_DUPLI_FLAG_VIEWPORT);
RNA_def_property_ui_text(prop, "Display Instancer", "Make instancer visible in the viewport");
RNA_def_property_update(
prop, NC_OBJECT | ND_DRAW, "rna_Object_duplicator_visibility_flag_update");
rna_def_object_visibility(srna);
/* instancing */
prop = RNA_def_property(srna, "instance_type", PROP_ENUM, PROP_NONE);