Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenkernel/intern/group.c
| Show First 20 Lines • Show All 43 Lines • ▼ Show 20 Lines | |||||
| #include "BLI_blenlib.h" | #include "BLI_blenlib.h" | ||||
| #include "BLI_utildefines.h" | #include "BLI_utildefines.h" | ||||
| #include "BKE_depsgraph.h" | #include "BKE_depsgraph.h" | ||||
| #include "BKE_global.h" | #include "BKE_global.h" | ||||
| #include "BKE_group.h" | #include "BKE_group.h" | ||||
| #include "BKE_icons.h" | |||||
| #include "BKE_library.h" | #include "BKE_library.h" | ||||
| #include "BKE_main.h" | #include "BKE_main.h" | ||||
| #include "BKE_object.h" | #include "BKE_object.h" | ||||
| #include "BKE_scene.h" /* BKE_scene_base_find */ | #include "BKE_scene.h" /* BKE_scene_base_find */ | ||||
| static void free_group_object(GroupObject *go) | static void free_group_object(GroupObject *go) | ||||
| { | { | ||||
| MEM_freeN(go); | MEM_freeN(go); | ||||
| } | } | ||||
| void BKE_group_free(Group *group) | void BKE_group_free(Group *group) | ||||
| { | { | ||||
| /* don't free group itself */ | /* don't free group itself */ | ||||
| GroupObject *go; | GroupObject *go; | ||||
| BKE_previewimg_free(&group->preview); | |||||
| while ((go = BLI_pophead(&group->gobject))) { | while ((go = BLI_pophead(&group->gobject))) { | ||||
| free_group_object(go); | free_group_object(go); | ||||
| } | } | ||||
| } | } | ||||
| void BKE_group_unlink(Group *group) | void BKE_group_unlink(Group *group) | ||||
| { | { | ||||
| Main *bmain = G.main; | Main *bmain = G.main; | ||||
| ▲ Show 20 Lines • Show All 58 Lines • ▼ Show 20 Lines | |||||
| } | } | ||||
| Group *BKE_group_add(Main *bmain, const char *name) | Group *BKE_group_add(Main *bmain, const char *name) | ||||
| { | { | ||||
| Group *group; | Group *group; | ||||
| group = BKE_libblock_alloc(bmain, ID_GR, name); | group = BKE_libblock_alloc(bmain, ID_GR, name); | ||||
| group->layer = (1 << 20) - 1; | group->layer = (1 << 20) - 1; | ||||
| group->preview = NULL; | |||||
| return group; | return group; | ||||
| } | } | ||||
| Group *BKE_group_copy(Group *group) | Group *BKE_group_copy(Group *group) | ||||
| { | { | ||||
| Group *groupn; | Group *groupn; | ||||
| groupn = BKE_libblock_copy(&group->id); | groupn = BKE_libblock_copy(&group->id); | ||||
| BLI_duplicatelist(&groupn->gobject, &group->gobject); | BLI_duplicatelist(&groupn->gobject, &group->gobject); | ||||
| /* Do not copy group's preview (same behavior as for objects). */ | |||||
| if (group->id.lib) { | if (group->id.lib) { | ||||
| BKE_id_lib_local_paths(G.main, group->id.lib, &groupn->id); | BKE_id_lib_local_paths(G.main, group->id.lib, &groupn->id); | ||||
| } | } | ||||
| return groupn; | return groupn; | ||||
| } | } | ||||
| /* external */ | /* external */ | ||||
| ▲ Show 20 Lines • Show All 264 Lines • Show Last 20 Lines | |||||