Changeset View
Changeset View
Standalone View
Standalone View
source/blender/makesrna/intern/rna_layer.c
| Show First 20 Lines • Show All 101 Lines • ▼ Show 20 Lines | static PointerRNA rna_SceneCollection_objects_get(CollectionPropertyIterator *iter) | ||||
| ListBaseIterator *internal = &iter->internal.listbase; | ListBaseIterator *internal = &iter->internal.listbase; | ||||
| /* we are actually iterating a LinkData list, so override get */ | /* we are actually iterating a LinkData list, so override get */ | ||||
| return rna_pointer_inherit_refine(&iter->parent, &RNA_Object, ((LinkData *)internal->link)->data); | return rna_pointer_inherit_refine(&iter->parent, &RNA_Object, ((LinkData *)internal->link)->data); | ||||
| } | } | ||||
| static int rna_SceneCollection_move_above(ID *id, SceneCollection *sc_src, Main *bmain, SceneCollection *sc_dst) | static int rna_SceneCollection_move_above(ID *id, SceneCollection *sc_src, Main *bmain, SceneCollection *sc_dst) | ||||
| { | { | ||||
| if (!BKE_collection_move_above(id, sc_dst, sc_src)) { | if (!BKE_collection_move_above(id, sc_dst, sc_src, bmain)) { | ||||
| return 0; | return 0; | ||||
| } | } | ||||
| DEG_relations_tag_update(bmain); | DEG_relations_tag_update(bmain); | ||||
| WM_main_add_notifier(NC_SCENE | ND_LAYER, NULL); | WM_main_add_notifier(NC_SCENE | ND_LAYER, NULL); | ||||
| return 1; | return 1; | ||||
| } | } | ||||
| static int rna_SceneCollection_move_below(ID *id, SceneCollection *sc_src, Main *bmain, SceneCollection *sc_dst) | static int rna_SceneCollection_move_below(ID *id, SceneCollection *sc_src, Main *bmain, SceneCollection *sc_dst) | ||||
| { | { | ||||
| if (!BKE_collection_move_below(id, sc_dst, sc_src)) { | if (!BKE_collection_move_below(id, sc_dst, sc_src, bmain)) { | ||||
| return 0; | return 0; | ||||
| } | } | ||||
| DEG_relations_tag_update(bmain); | DEG_relations_tag_update(bmain); | ||||
| WM_main_add_notifier(NC_SCENE | ND_LAYER, NULL); | WM_main_add_notifier(NC_SCENE | ND_LAYER, NULL); | ||||
| return 1; | return 1; | ||||
| } | } | ||||
| static int rna_SceneCollection_move_into(ID *id, SceneCollection *sc_src, Main *bmain, SceneCollection *sc_dst) | static int rna_SceneCollection_move_into(ID *id, SceneCollection *sc_src, Main *bmain, SceneCollection *sc_dst) | ||||
| { | { | ||||
| if (!BKE_collection_move_into(id, sc_dst, sc_src)) { | if (!BKE_collection_move_into(id, sc_dst, sc_src, bmain)) { | ||||
| return 0; | return 0; | ||||
| } | } | ||||
| DEG_relations_tag_update(bmain); | DEG_relations_tag_update(bmain); | ||||
| WM_main_add_notifier(NC_SCENE | ND_LAYER, NULL); | WM_main_add_notifier(NC_SCENE | ND_LAYER, NULL); | ||||
| return 1; | return 1; | ||||
| } | } | ||||
| Show All 16 Lines | static void rna_SceneCollection_remove( | ||||
| const int index = BLI_findindex(&sc_parent->scene_collections, sc); | const int index = BLI_findindex(&sc_parent->scene_collections, sc); | ||||
| if (index == -1) { | if (index == -1) { | ||||
| BKE_reportf(reports, RPT_ERROR, "Collection '%s' is not a sub-collection of '%s'", | BKE_reportf(reports, RPT_ERROR, "Collection '%s' is not a sub-collection of '%s'", | ||||
| sc->name, sc_parent->name); | sc->name, sc_parent->name); | ||||
| return; | return; | ||||
| } | } | ||||
| if (!BKE_collection_remove(id, sc)) { | if (!BKE_collection_remove(id, sc, bmain)) { | ||||
| BKE_reportf(reports, RPT_ERROR, "Collection '%s' could not be removed from collection '%s'", | BKE_reportf(reports, RPT_ERROR, "Collection '%s' could not be removed from collection '%s'", | ||||
| sc->name, sc_parent->name); | sc->name, sc_parent->name); | ||||
| return; | return; | ||||
| } | } | ||||
| RNA_POINTER_INVALIDATE(sc_ptr); | RNA_POINTER_INVALIDATE(sc_ptr); | ||||
| DEG_relations_tag_update(bmain); | DEG_relations_tag_update(bmain); | ||||
| ▲ Show 20 Lines • Show All 468 Lines • ▼ Show 20 Lines | |||||
| { | { | ||||
| ListBaseIterator *internal = &iter->internal.listbase; | ListBaseIterator *internal = &iter->internal.listbase; | ||||
| Base *base = ((LinkData *)internal->link)->data; | Base *base = ((LinkData *)internal->link)->data; | ||||
| return rna_pointer_inherit_refine(&iter->parent, &RNA_Object, base->object); | return rna_pointer_inherit_refine(&iter->parent, &RNA_Object, base->object); | ||||
| } | } | ||||
| static int rna_LayerCollection_move_above(ID *id, LayerCollection *lc_src, Main *bmain, LayerCollection *lc_dst) | static int rna_LayerCollection_move_above(ID *id, LayerCollection *lc_src, Main *bmain, LayerCollection *lc_dst) | ||||
| { | { | ||||
| if (!BKE_layer_collection_move_above(id, lc_dst, lc_src)) { | if (!BKE_layer_collection_move_above(id, lc_dst, lc_src, bmain)) { | ||||
| return 0; | return 0; | ||||
| } | } | ||||
| DEG_relations_tag_update(bmain); | DEG_relations_tag_update(bmain); | ||||
| WM_main_add_notifier(NC_SCENE | ND_LAYER, NULL); | WM_main_add_notifier(NC_SCENE | ND_LAYER, NULL); | ||||
| return 1; | return 1; | ||||
| } | } | ||||
| static int rna_LayerCollection_move_below(ID *id, LayerCollection *lc_src, Main *bmain, LayerCollection *lc_dst) | static int rna_LayerCollection_move_below(ID *id, LayerCollection *lc_src, Main *bmain, LayerCollection *lc_dst) | ||||
| { | { | ||||
| if (!BKE_layer_collection_move_below(id, lc_dst, lc_src)) { | if (!BKE_layer_collection_move_below(id, lc_dst, lc_src, bmain)) { | ||||
| return 0; | return 0; | ||||
| } | } | ||||
| DEG_relations_tag_update(bmain); | DEG_relations_tag_update(bmain); | ||||
| WM_main_add_notifier(NC_SCENE | ND_LAYER, NULL); | WM_main_add_notifier(NC_SCENE | ND_LAYER, NULL); | ||||
| return 1; | return 1; | ||||
| } | } | ||||
| static int rna_LayerCollection_move_into(ID *id, LayerCollection *lc_src, Main *bmain, LayerCollection *lc_dst) | static int rna_LayerCollection_move_into(ID *id, LayerCollection *lc_src, Main *bmain, LayerCollection *lc_dst) | ||||
| { | { | ||||
| if (!BKE_layer_collection_move_into(id, lc_dst, lc_src)) { | if (!BKE_layer_collection_move_into(id, lc_dst, lc_src, bmain)) { | ||||
| return 0; | return 0; | ||||
| } | } | ||||
| DEG_relations_tag_update(bmain); | DEG_relations_tag_update(bmain); | ||||
| WM_main_add_notifier(NC_SCENE | ND_LAYER, NULL); | WM_main_add_notifier(NC_SCENE | ND_LAYER, NULL); | ||||
| return 1; | return 1; | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 88 Lines • ▼ Show 20 Lines | static void rna_ViewLayer_collection_unlink( | ||||
| Scene *scene = (Scene *)id; | Scene *scene = (Scene *)id; | ||||
| if (BLI_findindex(&view_layer->layer_collections, lc) == -1) { | if (BLI_findindex(&view_layer->layer_collections, lc) == -1) { | ||||
| BKE_reportf(reports, RPT_ERROR, "Layer collection '%s' is not in '%s'", | BKE_reportf(reports, RPT_ERROR, "Layer collection '%s' is not in '%s'", | ||||
| lc->scene_collection->name, view_layer->name); | lc->scene_collection->name, view_layer->name); | ||||
| return; | return; | ||||
| } | } | ||||
| BKE_collection_unlink(view_layer, lc); | BKE_collection_unlink(view_layer, lc, bmain); | ||||
| DEG_relations_tag_update(bmain); | DEG_relations_tag_update(bmain); | ||||
| /* TODO(sergey): Use proper flag for tagging here. */ | /* TODO(sergey): Use proper flag for tagging here. */ | ||||
| DEG_id_tag_update(id, 0); | DEG_id_tag_update(id, 0); | ||||
| WM_main_add_notifier(NC_SCENE | ND_LAYER | ND_OB_ACTIVE, scene); | WM_main_add_notifier(NC_SCENE | ND_LAYER | ND_OB_ACTIVE, scene); | ||||
| } | } | ||||
| static PointerRNA rna_LayerObjects_active_object_get(PointerRNA *ptr) | static PointerRNA rna_LayerObjects_active_object_get(PointerRNA *ptr) | ||||
| ▲ Show 20 Lines • Show All 1,459 Lines • Show Last 20 Lines | |||||