1 /* 2 * This program is free software; you can redistribute it and/or 3 * modify it under the terms of the GNU General Public License 4 * as published by the Free Software Foundation; either version 2 5 * of the License, or (at your option) any later version. 6 * 7 * This program is distributed in the hope that it will be useful, 8 * but WITHOUT ANY WARRANTY; without even the implied warranty of 9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 * GNU General Public License for more details. 11 * 12 * You should have received a copy of the GNU General Public License 13 * along with this program; if not, write to the Free Software Foundation, 14 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 15 * 16 * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. 17 * All rights reserved. 18 */ 19 20 /** \file 21 * \ingroup DNA 22 * 23 * \brief Object groups, one object can be in many groups at once. 24 */ 25 26 #pragma once 27 28 #include "DNA_ID.h" 29 #include "DNA_defs.h" 30 #include "DNA_listBase.h" 31 32 struct Collection; 33 struct Object; 34 35 typedef struct CollectionObject { 36 struct CollectionObject *next, *prev; 37 struct Object *ob; 38 } CollectionObject; 39 40 typedef struct CollectionChild { 41 struct CollectionChild *next, *prev; 42 struct Collection *collection; 43 } CollectionChild; 44 45 typedef struct Collection { 46 ID id; 47 48 /** CollectionObject. */ 49 ListBase gobject; 50 /** CollectionChild. */ 51 ListBase children; 52 53 struct PreviewImage *preview; 54 55 unsigned int layer DNA_DEPRECATED; 56 float instance_offset[3]; 57 58 short flag; 59 /* Runtime-only, always cleared on file load. */ 60 short tag; 61 62 int16_t color_tag; 63 char _pad[2]; 64 65 /* Runtime. Cache of objects in this collection and all its 66 * children. This is created on demand when e.g. some physics 67 * simulation needs it, we don't want to have it for every 68 * collections due to memory usage reasons. */ 69 ListBase object_cache; 70 71 /* Runtime. List of collections that are a parent of this 72 * datablock. */ 73 ListBase parents; 74 75 /* Deprecated */ 76 struct SceneCollection *collection DNA_DEPRECATED; 77 struct ViewLayer *view_layer DNA_DEPRECATED; 78 } Collection; 79 80 /* Collection->flag */ 81 enum { 82 COLLECTION_RESTRICT_VIEWPORT = (1 << 0), /* Disable in viewports. */ 83 COLLECTION_RESTRICT_SELECT = (1 << 1), /* Not selectable in viewport. */ 84 /* COLLECTION_DISABLED_DEPRECATED = (1 << 2), */ /* Not used anymore */ 85 COLLECTION_RESTRICT_RENDER = (1 << 3), /* Disable in renders. */ 86 COLLECTION_HAS_OBJECT_CACHE = (1 << 4), /* Runtime: object_cache is populated. */ 87 COLLECTION_IS_MASTER = (1 << 5), /* Is master collection embedded in the scene. */ 88 }; 89 90 /* Collection->tag */ 91 enum { 92 /* That code (BKE_main_collections_parent_relations_rebuild and the like) 93 * is called from very low-level places, like e.g ID remapping... 94 * Using a generic tag like LIB_TAG_DOIT for this is just impossible, we need our very own. */ 95 COLLECTION_TAG_RELATION_REBUILD = (1 << 0), 96 }; 97 98 /* Collection->color_tag. */ 99 typedef enum CollectionColorTag { 100 COLLECTION_COLOR_NONE = -1, 101 COLLECTION_COLOR_01, 102 COLLECTION_COLOR_02, 103 COLLECTION_COLOR_03, 104 COLLECTION_COLOR_04, 105 COLLECTION_COLOR_05, 106 COLLECTION_COLOR_06, 107 COLLECTION_COLOR_07, 108 COLLECTION_COLOR_08, 109 110 COLLECTION_COLOR_TOT, 111 } CollectionColorTag; 112