Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/space_outliner/outliner_draw.c
| Show First 20 Lines • Show All 927 Lines • ▼ Show 20 Lines | if (props_active->layer_collection_hide_viewport) { | ||||
| if (!props_active->layer_collection_hide_viewport) { | if (!props_active->layer_collection_hide_viewport) { | ||||
| props_active->base_hide_viewport = false; | props_active->base_hide_viewport = false; | ||||
| props_active->collection_hide_select = false; | props_active->collection_hide_select = false; | ||||
| props_active->object_hide_select = false; | props_active->object_hide_select = false; | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| static bool outliner_restrict_properties_collection_set(Scene *scene, | |||||
| TreeElement *te, | |||||
| PointerRNA *collection_ptr, | |||||
| PointerRNA *layer_collection_ptr, | |||||
| RestrictProperties *props, | |||||
| RestrictPropertiesActive *props_active) | |||||
| { | |||||
| TreeStoreElem *tselem = TREESTORE(te); | |||||
| LayerCollection *layer_collection = (tselem->type == TSE_LAYER_COLLECTION) ? te->directdata : | |||||
| NULL; | |||||
| Collection *collection = outliner_collection_from_tree_element(te); | |||||
| if ((collection->flag & COLLECTION_IS_MASTER) || | |||||
| (layer_collection && ((layer_collection->flag & LAYER_COLLECTION_EXCLUDE) != 0))) { | |||||
| return false; | |||||
| } | |||||
| /* Create the PointerRNA. */ | |||||
| RNA_id_pointer_create(&collection->id, collection_ptr); | |||||
| if (layer_collection != NULL) { | |||||
| RNA_pointer_create(&scene->id, &RNA_LayerCollection, layer_collection, layer_collection_ptr); | |||||
| } | |||||
| /* Update the restriction column values for the collection children. */ | |||||
| if (layer_collection) { | |||||
| outliner_restrict_properties_enable_layer_collection_set( | |||||
| layer_collection_ptr, collection_ptr, props, props_active); | |||||
| } | |||||
| else { | |||||
| outliner_restrict_properties_enable_collection_set(collection_ptr, props, props_active); | |||||
| } | |||||
| return true; | |||||
| } | |||||
| static void outliner_draw_restrictbuts(uiBlock *block, | static void outliner_draw_restrictbuts(uiBlock *block, | ||||
| Scene *scene, | Scene *scene, | ||||
| ViewLayer *view_layer, | ViewLayer *view_layer, | ||||
| ARegion *ar, | ARegion *ar, | ||||
| SpaceOutliner *soops, | SpaceOutliner *soops, | ||||
| ListBase *lb, | ListBase *lb, | ||||
| RestrictPropertiesActive props_active_parent) | RestrictPropertiesActive props_active_parent) | ||||
| { | { | ||||
| ▲ Show 20 Lines • Show All 388 Lines • ▼ Show 20 Lines | if (te->ys + 2 * UI_UNIT_Y >= ar->v2d.cur.ymin && te->ys <= ar->v2d.cur.ymax) { | ||||
| 0, | 0, | ||||
| 0, | 0, | ||||
| TIP_("Restrict editing of strokes and keyframes in this layer")); | TIP_("Restrict editing of strokes and keyframes in this layer")); | ||||
| UI_but_func_set(bt, restrictbutton_gp_layer_flag_cb, id, gpl); | UI_but_func_set(bt, restrictbutton_gp_layer_flag_cb, id, gpl); | ||||
| UI_but_flag_enable(bt, UI_BUT_DRAG_LOCK); | UI_but_flag_enable(bt, UI_BUT_DRAG_LOCK); | ||||
| } | } | ||||
| } | } | ||||
| else if (outliner_is_collection_tree_element(te)) { | else if (outliner_is_collection_tree_element(te)) { | ||||
| PointerRNA collection_ptr; | |||||
| PointerRNA layer_collection_ptr; | |||||
| if (outliner_restrict_properties_collection_set( | |||||
| scene, te, &collection_ptr, &layer_collection_ptr, &props, &props_active)) { | |||||
| LayerCollection *layer_collection = (tselem->type == TSE_LAYER_COLLECTION) ? | LayerCollection *layer_collection = (tselem->type == TSE_LAYER_COLLECTION) ? | ||||
| te->directdata : | te->directdata : | ||||
| NULL; | NULL; | ||||
| Collection *collection = outliner_collection_from_tree_element(te); | Collection *collection = outliner_collection_from_tree_element(te); | ||||
| if ((!layer_collection || !(layer_collection->flag & LAYER_COLLECTION_EXCLUDE)) && | |||||
| !(collection->flag & COLLECTION_IS_MASTER)) { | |||||
| PointerRNA collection_ptr; | |||||
| PointerRNA layer_collection_ptr; | |||||
| RNA_id_pointer_create(&collection->id, &collection_ptr); | |||||
| if (layer_collection != NULL) { | |||||
| RNA_pointer_create( | |||||
| &scene->id, &RNA_LayerCollection, layer_collection, &layer_collection_ptr); | |||||
| } | |||||
| /* Update the restriction column values for the collection children. */ | |||||
| if (layer_collection) { | |||||
| outliner_restrict_properties_enable_layer_collection_set( | |||||
| &layer_collection_ptr, &collection_ptr, &props, &props_active); | |||||
| } | |||||
| else { | |||||
| outliner_restrict_properties_enable_collection_set( | |||||
| &collection_ptr, &props, &props_active); | |||||
| } | |||||
| if (layer_collection != NULL) { | if (layer_collection != NULL) { | ||||
| if (soops->show_restrict_flags & SO_RESTRICT_HIDE) { | if (soops->show_restrict_flags & SO_RESTRICT_HIDE) { | ||||
| bt = uiDefIconButR_prop(block, | bt = uiDefIconButR_prop(block, | ||||
| UI_BTYPE_ICON_TOGGLE, | UI_BTYPE_ICON_TOGGLE, | ||||
| 0, | 0, | ||||
| 0, | 0, | ||||
| (int)(ar->v2d.cur.xmax - restrict_offsets.hide), | (int)(ar->v2d.cur.xmax - restrict_offsets.hide), | ||||
| ▲ Show 20 Lines • Show All 186 Lines • ▼ Show 20 Lines | if (te->ys + 2 * UI_UNIT_Y >= ar->v2d.cur.ymin && te->ys <= ar->v2d.cur.ymax) { | ||||
| UI_but_flag_enable(bt, UI_BUT_DRAG_LOCK); | UI_but_flag_enable(bt, UI_BUT_DRAG_LOCK); | ||||
| if (!props_active.collection_hide_select) { | if (!props_active.collection_hide_select) { | ||||
| UI_but_flag_enable(bt, UI_BUT_INACTIVE); | UI_but_flag_enable(bt, UI_BUT_INACTIVE); | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| else if (outliner_is_collection_tree_element(te)) { | |||||
| PointerRNA collection_ptr; | |||||
| PointerRNA layer_collection_ptr; | |||||
| outliner_restrict_properties_collection_set( | |||||
| scene, te, &collection_ptr, &layer_collection_ptr, &props, &props_active); | |||||
| } | |||||
| if (TSELEM_OPEN(tselem, soops)) { | if (TSELEM_OPEN(tselem, soops)) { | ||||
| outliner_draw_restrictbuts(block, scene, view_layer, ar, soops, &te->subtree, props_active); | outliner_draw_restrictbuts(block, scene, view_layer, ar, soops, &te->subtree, props_active); | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| static void outliner_draw_userbuts(uiBlock *block, ARegion *ar, SpaceOutliner *soops, ListBase *lb) | static void outliner_draw_userbuts(uiBlock *block, ARegion *ar, SpaceOutliner *soops, ListBase *lb) | ||||
| ▲ Show 20 Lines • Show All 1,894 Lines • Show Last 20 Lines | |||||