Split id->flag in two, persistent flags and runtime tags.
authorBastien Montagne <montagne29@wanadoo.fr>
Sun, 27 Dec 2015 10:53:50 +0000 (11:53 +0100)
committerBastien Montagne <montagne29@wanadoo.fr>
Sun, 27 Dec 2015 11:00:33 +0000 (12:00 +0100)
This is purely internal sanitizing/cleanup, no change in behavior is expected at all.

This change was also needed because we were getting short on ID flags, and
future enhancement of 'user_one' ID behavior requires two new ones.

id->flag remains for persistent data (fakeuser only, so far!), this also allows us
100% backward & forward compatibility.

New id->tag is used for most flags. Though written in .blend files, its content
is cleared at read time.

Note that .blend file version was bumped, so that we can clear runtimeflags from
old .blends, important in case we add new persistent flags in future.

Also, behavior of tags (either status ones, or whether they need to be cleared before/after use)
has been added as comments to their declaration.

Reviewers: sergey, campbellbarton

Differential Revision: https://developer.blender.org/D1683

55 files changed:
source/blender/blenkernel/BKE_blender.h
source/blender/blenkernel/BKE_library.h
source/blender/blenkernel/intern/anim_sys.c
source/blender/blenkernel/intern/blender.c
source/blender/blenkernel/intern/depsgraph.c
source/blender/blenkernel/intern/group.c
source/blender/blenkernel/intern/image.c
source/blender/blenkernel/intern/lamp.c
source/blender/blenkernel/intern/library.c
source/blender/blenkernel/intern/mask.c
source/blender/blenkernel/intern/material.c
source/blender/blenkernel/intern/object.c
source/blender/blenkernel/intern/object_dupli.c
source/blender/blenkernel/intern/scene.c
source/blender/blenkernel/intern/sequencer.c
source/blender/blenloader/intern/readfile.c
source/blender/blenloader/intern/versioning_270.c
source/blender/blenloader/intern/versioning_legacy.c
source/blender/blenloader/intern/writefile.c
source/blender/collada/SceneExporter.cpp
source/blender/collada/collada_utils.cpp
source/blender/depsgraph/intern/depsgraph.cc
source/blender/depsgraph/intern/depsgraph_build.cc
source/blender/depsgraph/intern/depsgraph_build_nodes.cc
source/blender/depsgraph/intern/depsgraph_build_relations.cc
source/blender/depsgraph/intern/depsgraph_tag.cc
source/blender/editors/animation/anim_filter.c
source/blender/editors/interface/interface_ops.c
source/blender/editors/interface/interface_templates.c
source/blender/editors/mesh/editmesh_utils.c
source/blender/editors/object/object_add.c
source/blender/editors/object/object_bake.c
source/blender/editors/object/object_bake_api.c
source/blender/editors/object/object_data_transfer.c
source/blender/editors/object/object_relations.c
source/blender/editors/object/object_transform.c
source/blender/editors/render/render_internal.c
source/blender/editors/space_node/node_edit.c
source/blender/editors/space_outliner/outliner_draw.c
source/blender/editors/space_outliner/outliner_tools.c
source/blender/editors/space_outliner/outliner_tree.c
source/blender/makesdna/DNA_ID.h
source/blender/makesrna/intern/rna_ID.c
source/blender/makesrna/intern/rna_scene.c
source/blender/modifiers/intern/MOD_correctivesmooth.c
source/blender/modifiers/intern/MOD_smoke.c
source/blender/python/intern/bpy_library.c
source/blender/render/intern/source/bake.c
source/blender/render/intern/source/convertblender.c
source/blender/render/intern/source/multires_bake.c
source/blender/render/intern/source/pipeline.c
source/blender/windowmanager/intern/wm_operators.c
source/gameengine/Converter/KX_BlenderSceneConverter.cpp
source/gameengine/Ketsji/BL_ActionManager.cpp
source/gameengine/Ketsji/KX_Scene.h

index 6886740c1af8343523bb24c49fb75dc923362fb4..9efaad81feb316af5d10378ad1875bb1df013a83 100644 (file)
@@ -42,7 +42,7 @@ extern "C" {
  * and keep comment above the defines.
  * Use STRINGIFY() rather than defining with quotes */
 #define BLENDER_VERSION         276
-#define BLENDER_SUBVERSION      4
+#define BLENDER_SUBVERSION      5
 /* Several breakages with 270, e.g. constraint deg vs rad */
 #define BLENDER_MINVERSION      270
 #define BLENDER_MINSUBVERSION   5
index 9a961bafbf9aa53d3d0fb4211802c367e4a61ffd..ff0cad2e5ed406d8a0709f1c9c6a20c7e0f6d1df 100644 (file)
@@ -102,8 +102,8 @@ void BKE_main_id_tag_idcode(struct Main *mainvar, const short type, const bool t
 void BKE_main_id_tag_listbase(struct ListBase *lb, const bool tag);
 void BKE_main_id_tag_all(struct Main *mainvar, const bool tag);
 
-void BKE_main_id_flag_listbase(ListBase *lb, const short flag, const bool value);
-void BKE_main_id_flag_all(struct Main *bmain, const short flag, const bool value);
+void BKE_main_id_flag_listbase(ListBase *lb, const int flag, const bool value);
+void BKE_main_id_flag_all(struct Main *bmain, const int flag, const bool value);
 
 void BKE_main_id_clear_newpoins(struct Main *bmain);
 
@@ -129,7 +129,7 @@ void BKE_library_callback_free_editor_id_reference_set(BKE_library_free_editor_i
 /* use when "" is given to new_id() */
 #define ID_FALLBACK_NAME N_("Untitled")
 
-#define IS_TAGGED(_id) ((_id) && (((ID *)_id)->flag & LIB_DOIT))
+#define IS_TAGGED(_id) ((_id) && (((ID *)_id)->tag & LIB_TAG_DOIT))
 
 #ifdef __cplusplus
 }
index 2ddf01433eb97bb7830279583e71e7200212a4d8..41950c59a223ab861c8f0df642f5a2e0fe74e7e8 100644 (file)
@@ -1596,8 +1596,8 @@ static bool animsys_write_rna_setting(PointerRNA *ptr, char *path, int array_ind
 
                                /* for cases like duplifarmes it's only a temporary so don't
                                 * notify anyone of updates */
-                               if (!(id->flag & LIB_ANIM_NO_RECALC)) {
-                                       id->flag |= LIB_ID_RECALC;
+                               if (!(id->tag & LIB_TAG_ANIM_NO_RECALC)) {
+                                       id->tag |= LIB_TAG_ID_RECALC;
                                        DAG_id_type_tag(G.main, GS(id->name));
                                }
                        }
@@ -2562,8 +2562,8 @@ static void animsys_evaluate_nla(ListBase *echannels, PointerRNA *ptr, AnimData
         */
        if (ptr->id.data != NULL) {
                ID *id = ptr->id.data;
-               if (!(id->flag & LIB_ANIM_NO_RECALC)) {
-                       id->flag |= LIB_ID_RECALC;
+               if (!(id->tag & LIB_TAG_ANIM_NO_RECALC)) {
+                       id->tag |= LIB_TAG_ID_RECALC;
                        DAG_id_type_tag(G.main, GS(id->name));
                }
        }
index fc76c29880282ae7b00f836c409e45a94ab7be74..8b447379d01bbd6f0548fe6d4849991e4c4e69a3 100644 (file)
@@ -963,12 +963,12 @@ Main *BKE_undo_get_main(Scene **r_scene)
 void BKE_copybuffer_begin(Main *bmain)
 {
        /* set all id flags to zero; */
-       BKE_main_id_flag_all(bmain, LIB_NEED_EXPAND | LIB_DOIT, false);
+       BKE_main_id_flag_all(bmain, LIB_TAG_NEED_EXPAND | LIB_TAG_DOIT, false);
 }
 
 void BKE_copybuffer_tag_ID(ID *id)
 {
-       id->flag |= LIB_NEED_EXPAND | LIB_DOIT;
+       id->tag |= LIB_TAG_NEED_EXPAND | LIB_TAG_DOIT;
 }
 
 static void copybuffer_doit(void *UNUSED(handle), Main *UNUSED(bmain), void *vid)
@@ -976,8 +976,8 @@ static void copybuffer_doit(void *UNUSED(handle), Main *UNUSED(bmain), void *vid
        if (vid) {
                ID *id = vid;
                /* only tag for need-expand if not done, prevents eternal loops */
-               if ((id->flag & LIB_DOIT) == 0)
-                       id->flag |= LIB_NEED_EXPAND | LIB_DOIT;
+               if ((id->tag & LIB_TAG_DOIT) == 0)
+                       id->tag |= LIB_TAG_NEED_EXPAND | LIB_TAG_DOIT;
        }
 }
 
@@ -1006,7 +1006,7 @@ int BKE_copybuffer_save(const char *filename, ReportList *reports)
                
                for (id = lb2->first; id; id = nextid) {
                        nextid = id->next;
-                       if (id->flag & LIB_DOIT) {
+                       if (id->tag & LIB_TAG_DOIT) {
                                BLI_remlink(lb2, id);
                                BLI_addtail(lb1, id);
                        }
@@ -1033,7 +1033,7 @@ int BKE_copybuffer_save(const char *filename, ReportList *reports)
        MEM_freeN(mainb);
        
        /* set id flag to zero; */
-       BKE_main_id_flag_all(G.main, LIB_NEED_EXPAND | LIB_DOIT, false);
+       BKE_main_id_flag_all(G.main, LIB_TAG_NEED_EXPAND | LIB_TAG_DOIT, false);
        
        if (path_list_backup) {
                BKE_bpath_list_restore(G.main, path_list_flag, path_list_backup);
@@ -1064,8 +1064,8 @@ int BKE_copybuffer_paste(bContext *C, const char *libname, ReportList *reports)
        /* tag everything, all untagged data can be made local
         * its also generally useful to know what is new
         *
-        * take extra care BKE_main_id_flag_all(bmain, LIB_LINK_TAG, false) is called after! */
-       BKE_main_id_flag_all(bmain, LIB_PRE_EXISTING, true);
+        * take extra care BKE_main_id_flag_all(bmain, LIB_TAG_PRE_EXISTING, false) is called after! */
+       BKE_main_id_flag_all(bmain, LIB_TAG_PRE_EXISTING, true);
        
        /* here appending/linking starts */
        mainl = BLO_library_link_begin(bmain, &bh, libname);
@@ -1084,7 +1084,7 @@ int BKE_copybuffer_paste(bContext *C, const char *libname, ReportList *reports)
        
        /* important we unset, otherwise these object wont
         * link into other scenes from this blend file */
-       BKE_main_id_flag_all(bmain, LIB_PRE_EXISTING, false);
+       BKE_main_id_flag_all(bmain, LIB_TAG_PRE_EXISTING, false);
        
        /* recreate dependency graph to include new objects */
        DAG_relations_tag_update(bmain);
index 17faae053eb957c1fb4feff1edd5644ff0de5e9f..e313ad7c2a1abcfc321dedee2b11a152d075b764 100644 (file)
@@ -398,13 +398,13 @@ static void dag_add_shader_nodetree_driver_relations(DagForest *dag, DagNode *no
 static void dag_add_material_driver_relations(DagForest *dag, DagNode *node, Material *ma)
 {
        /* Prevent infinite recursion by checking (and tagging the material) as having been visited 
-        * already (see build_dag()). This assumes ma->id.flag & LIB_DOIT isn't set by anything else
+        * already (see build_dag()). This assumes ma->id.tag & LIB_TAG_DOIT isn't set by anything else
         * in the meantime... [#32017]
         */
-       if (ma->id.flag & LIB_DOIT)
+       if (ma->id.tag & LIB_TAG_DOIT)
                return;
 
-       ma->id.flag |= LIB_DOIT;
+       ma->id.tag |= LIB_TAG_DOIT;
        
        /* material itself */
        if (ma->adt)
@@ -418,20 +418,20 @@ static void dag_add_material_driver_relations(DagForest *dag, DagNode *node, Mat
        if (ma->nodetree)
                dag_add_shader_nodetree_driver_relations(dag, node, ma->nodetree);
 
-       ma->id.flag &= ~LIB_DOIT;
+       ma->id.tag &= ~LIB_TAG_DOIT;
 }
 
 /* recursive handling for lamp drivers */
 static void dag_add_lamp_driver_relations(DagForest *dag, DagNode *node, Lamp *la)
 {
        /* Prevent infinite recursion by checking (and tagging the lamp) as having been visited 
-        * already (see build_dag()). This assumes la->id.flag & LIB_DOIT isn't set by anything else
+        * already (see build_dag()). This assumes la->id.tag & LIB_TAG_DOIT isn't set by anything else
         * in the meantime... [#32017]
         */
-       if (la->id.flag & LIB_DOIT)
+       if (la->id.tag & LIB_TAG_DOIT)
                return;
 
-       la->id.flag |= LIB_DOIT;
+       la->id.tag |= LIB_TAG_DOIT;
        
        /* lamp itself */
        if (la->adt)
@@ -445,7 +445,7 @@ static void dag_add_lamp_driver_relations(DagForest *dag, DagNode *node, Lamp *l
        if (la->nodetree)
                dag_add_shader_nodetree_driver_relations(dag, node, la->nodetree);
 
-       la->id.flag &= ~LIB_DOIT;
+       la->id.tag &= ~LIB_TAG_DOIT;
 }
 
 static void check_and_create_collision_relation(DagForest *dag, Object *ob, DagNode *node, Object *ob1, int skip_forcefield, bool no_collision)
@@ -903,10 +903,10 @@ static void build_dag_group(DagForest *dag, DagNode *scenenode, Main *bmain, Sce
 {
        GroupObject *go;
 
-       if (group->id.flag & LIB_DOIT)
+       if (group->id.tag & LIB_TAG_DOIT)
                return;
        
-       group->id.flag |= LIB_DOIT;
+       group->id.tag |= LIB_TAG_DOIT;
 
        for (go = group->gobject.first; go; go = go->next) {
                build_dag_object(dag, scenenode, bmain, scene, go->ob, mask);
@@ -932,7 +932,7 @@ DagForest *build_dag(Main *bmain, Scene *sce, short mask)
                sce->theDag = dag;
        }
        
-       /* clear "LIB_DOIT" flag from all materials, to prevent infinite recursion problems later [#32017] */
+       /* clear "LIB_TAG_DOIT" flag from all materials, to prevent infinite recursion problems later [#32017] */
        BKE_main_id_tag_idcode(bmain, ID_MA, false);
        BKE_main_id_tag_idcode(bmain, ID_LA, false);
        BKE_main_id_tag_idcode(bmain, ID_GR, false);
@@ -1402,15 +1402,15 @@ static void scene_sort_groups(Main *bmain, Scene *sce)
        
        /* test; are group objects all in this scene? */
        for (ob = bmain->object.first; ob; ob = ob->id.next) {
-               ob->id.flag &= ~LIB_DOIT;
+               ob->id.tag &= ~LIB_TAG_DOIT;
                ob->id.newid = NULL; /* newid abuse for GroupObject */
        }
        for (base = sce->base.first; base; base = base->next)
-               base->object->id.flag |= LIB_DOIT;
+               base->object->id.tag |= LIB_TAG_DOIT;
        
        for (group = bmain->group.first; group; group = group->id.next) {
                for (go = group->gobject.first; go; go = go->next) {
-                       if ((go->ob->id.flag & LIB_DOIT) == 0)
+                       if ((go->ob->id.tag & LIB_TAG_DOIT) == 0)
                                break;
                }
                /* this group is entirely in this scene */
@@ -1481,7 +1481,7 @@ static bool check_object_tagged_for_update(Object *object)
 
        if (ELEM(object->type, OB_MESH, OB_CURVE, OB_SURF, OB_FONT, OB_MBALL, OB_LATTICE)) {
                ID *data_id = object->data;
-               return (data_id->flag & (LIB_ID_RECALC_DATA | LIB_ID_RECALC)) != 0;
+               return (data_id->tag & (LIB_TAG_ID_RECALC_DATA | LIB_TAG_ID_RECALC)) != 0;
        }
 
        return false;
@@ -1729,13 +1729,13 @@ void DAG_scene_free(Scene *sce)
 
 static void lib_id_recalc_tag(Main *bmain, ID *id)
 {
-       id->flag |= LIB_ID_RECALC;
+       id->tag |= LIB_TAG_ID_RECALC;
        DAG_id_type_tag(bmain, GS(id->name));
 }
 
 static void lib_id_recalc_data_tag(Main *bmain, ID *id)
 {
-       id->flag |= LIB_ID_RECALC_DATA;
+       id->tag |= LIB_TAG_ID_RECALC_DATA;
        DAG_id_type_tag(bmain, GS(id->name));
 }
 
@@ -2262,10 +2262,10 @@ static void dag_group_update_flags(Main *bmain, Scene *scene, Group *group, cons
 {
        GroupObject *go;
 
-       if (group->id.flag & LIB_DOIT)
+       if (group->id.tag & LIB_TAG_DOIT)
                return;
        
-       group->id.flag |= LIB_DOIT;
+       group->id.tag |= LIB_TAG_DOIT;
 
        for (go = group->gobject.first; go; go = go->next) {
                if (do_time)
@@ -2301,7 +2301,7 @@ void DAG_scene_update_flags(Main *bmain, Scene *scene, unsigned int lay, const b
                        dag_object_time_update_flags(bmain, sce_iter, ob);
                }
 
-               /* recursively tag groups with LIB_DOIT, and update flags for objects */
+               /* recursively tag groups with LIB_TAG_DOIT, and update flags for objects */
                if (ob->dup_group)
                        dag_group_update_flags(bmain, scene, ob->dup_group, do_time);
        }
@@ -2324,12 +2324,12 @@ void DAG_scene_update_flags(Main *bmain, Scene *scene, unsigned int lay, const b
 
        /* and store the info in groupobject */
        for (group = bmain->group.first; group; group = group->id.next) {
-               if (group->id.flag & LIB_DOIT) {
+               if (group->id.tag & LIB_TAG_DOIT) {
                        for (go = group->gobject.first; go; go = go->next) {
                                go->recalc = go->ob->recalc;
                                // printf("ob %s recalc %d\n", go->ob->id.name, go->recalc);
                        }
-                       group->id.flag &= ~LIB_DOIT;
+                       group->id.tag &= ~LIB_TAG_DOIT;
                }
        }
 
@@ -2356,14 +2356,14 @@ static void dag_current_scene_layers(Main *bmain, ListBase *lb)
        /* if we have a windowmanager, look into windows */
        if ((wm = bmain->wm.first)) {
                
-               BKE_main_id_flag_listbase(&bmain->scene, LIB_DOIT, 1);
+               BKE_main_id_flag_listbase(&bmain->scene, LIB_TAG_DOIT, 1);
 
                for (win = wm->windows.first; win; win = win->next) {
                        if (win->screen && win->screen->scene->theDag) {
                                Scene *scene = win->screen->scene;
                                DagSceneLayer *dsl;
 
-                               if (scene->id.flag & LIB_DOIT) {
+                               if (scene->id.tag & LIB_TAG_DOIT) {
                                        dsl = MEM_mallocN(sizeof(DagSceneLayer), "dag scene layer");
 
                                        BLI_addtail(lb, dsl);
@@ -2371,7 +2371,7 @@ static void dag_current_scene_layers(Main *bmain, ListBase *lb)
                                        dsl->scene = scene;
                                        dsl->layer = BKE_screen_visible_layers(win->screen, scene);
 
-                                       scene->id.flag &= ~LIB_DOIT;
+                                       scene->id.tag &= ~LIB_TAG_DOIT;
                                }
                                else {
                                        /* It is possible that multiple windows shares the same scene
@@ -2413,20 +2413,20 @@ static void dag_group_on_visible_update(Scene *scene, Group *group)
 {
        GroupObject *go;
 
-       if (group->id.flag & LIB_DOIT)
+       if (group->id.tag & LIB_TAG_DOIT)
                return;
        
-       group->id.flag |= LIB_DOIT;
+       group->id.tag |= LIB_TAG_DOIT;
 
        for (go = group->gobject.first; go; go = go->next) {
                if (ELEM(go->ob->type, OB_MESH, OB_CURVE, OB_SURF, OB_FONT, OB_MBALL, OB_LATTICE)) {
                        go->ob->recalc |= OB_RECALC_DATA;
-                       go->ob->id.flag |= LIB_DOIT;
+                       go->ob->id.tag |= LIB_TAG_DOIT;
                        lib_id_recalc_tag(G.main, &go->ob->id);
                }
                if (go->ob->proxy_from) {
                        go->ob->recalc |= OB_RECALC_OB;
-                       go->ob->id.flag |= LIB_DOIT;
+                       go->ob->id.tag |= LIB_TAG_DOIT;
                        lib_id_recalc_tag(G.main, &go->ob->id);
                }
 
@@ -2749,7 +2749,7 @@ void DAG_ids_flush_tagged(Main *bmain)
                 * looping over all ID's in case there are no tags */
                if (id && bmain->id_tag_update[id->name[0]]) {
                        for (; id; id = id->next) {
-                               if (id->flag & (LIB_ID_RECALC | LIB_ID_RECALC_DATA)) {
+                               if (id->tag & (LIB_TAG_ID_RECALC | LIB_TAG_ID_RECALC_DATA)) {
                                        
                                        for (dsl = listbase.first; dsl; dsl = dsl->next)
                                                dag_id_flush_update(bmain, dsl->scene, id);
@@ -2874,13 +2874,13 @@ void DAG_ids_clear_recalc(Main *bmain)
                 * looping over all ID's in case there are no tags */
                if (id && bmain->id_tag_update[id->name[0]]) {
                        for (; id; id = id->next) {
-                               if (id->flag & (LIB_ID_RECALC | LIB_ID_RECALC_DATA))
-                                       id->flag &= ~(LIB_ID_RECALC | LIB_ID_RECALC_DATA);
+                               if (id->tag & (LIB_TAG_ID_RECALC | LIB_TAG_ID_RECALC_DATA))
+                                       id->tag &= ~(LIB_TAG_ID_RECALC | LIB_TAG_ID_RECALC_DATA);
 
                                /* some ID's contain semi-datablock nodetree */
                                ntree = ntreeFromID(id);
-                               if (ntree && (ntree->id.flag & (LIB_ID_RECALC | LIB_ID_RECALC_DATA)))
-                                       ntree->id.flag &= ~(LIB_ID_RECALC | LIB_ID_RECALC_DATA);
+                               if (ntree && (ntree->id.tag & (LIB_TAG_ID_RECALC | LIB_TAG_ID_RECALC_DATA)))
+                                       ntree->id.tag &= ~(LIB_TAG_ID_RECALC | LIB_TAG_ID_RECALC_DATA);
                        }
                }
        }
index 96cf0fe574aaa065af6b10ffd3906f15cb6f6529..4506f9324131d5a405417da6dc73125b912c4083 100644 (file)
@@ -232,12 +232,12 @@ static bool group_object_cyclic_check_internal(Object *object, Group *group)
 {
        if (object->dup_group) {
                Group *dup_group = object->dup_group;
-               if ((dup_group->id.flag & LIB_DOIT) == 0) {
+               if ((dup_group->id.tag & LIB_TAG_DOIT) == 0) {
                        /* Cycle already exists in groups, let's prevent further crappyness */
                        return true;
                }
                /* flag the object to identify cyclic dependencies in further dupli groups */
-               dup_group->id.flag &= ~LIB_DOIT;
+               dup_group->id.tag &= ~LIB_TAG_DOIT;
 
                if (dup_group == group)
                        return true;
@@ -251,7 +251,7 @@ static bool group_object_cyclic_check_internal(Object *object, Group *group)
                }
 
                /* un-flag the object, it's allowed to have the same group multiple times in parallel */
-               dup_group->id.flag |= LIB_DOIT;
+               dup_group->id.tag |= LIB_TAG_DOIT;
        }
 
        return false;
index 21d8f8dde677f54ad8179ba0c24fa6ef254a68d8..394237f6c1410d6d9543e29e2777a799e7dd2bc8 100644 (file)
@@ -1136,14 +1136,14 @@ void BKE_image_free_all_textures(void)
 #endif
 
        for (ima = G.main->image.first; ima; ima = ima->id.next)
-               ima->id.flag &= ~LIB_DOIT;
+               ima->id.tag &= ~LIB_TAG_DOIT;
 
        for (tex = G.main->tex.first; tex; tex = tex->id.next)
                if (tex->ima)
-                       tex->ima->id.flag |= LIB_DOIT;
+                       tex->ima->id.tag |= LIB_TAG_DOIT;
 
        for (ima = G.main->image.first; ima; ima = ima->id.next) {
-               if (ima->cache && (ima->id.flag & LIB_DOIT)) {
+               if (ima->cache && (ima->id.tag & LIB_TAG_DOIT)) {
 #ifdef CHECK_FREED_SIZE
                        uintptr_t old_size = image_mem_size(ima);
 #endif
index 7fcbd9cafb7613aa6ec5ed2d9c1d2dd5e7ec380a..9601a93b1f1dd0a2c64376d1de242490a659c5e9 100644 (file)
@@ -265,12 +265,12 @@ static void lamp_node_drivers_update(Scene *scene, bNodeTree *ntree, float ctime
 void lamp_drivers_update(Scene *scene, Lamp *la, float ctime)
 {
        /* Prevent infinite recursion by checking (and tagging the lamp) as having been visited already
-        * (see BKE_scene_update_tagged()). This assumes la->id.flag & LIB_DOIT isn't set by anything else
+        * (see BKE_scene_update_tagged()). This assumes la->id.tag & LIB_TAG_DOIT isn't set by anything else
         * in the meantime... [#32017] */
-       if (la->id.flag & LIB_DOIT)
+       if (la->id.tag & LIB_TAG_DOIT)
                return;
 
-       la->id.flag |= LIB_DOIT;
+       la->id.tag |= LIB_TAG_DOIT;
        
        /* lamp itself */
        if (la->adt && la->adt->drivers.first)
@@ -280,6 +280,6 @@ void lamp_drivers_update(Scene *scene, Lamp *la, float ctime)
        if (la->nodetree)
                lamp_node_drivers_update(scene, la->nodetree, ctime);
 
-       la->id.flag &= ~LIB_DOIT;
+       la->id.tag &= ~LIB_TAG_DOIT;
 }
 
index f1e0bc69dbc2c494b342dca94ca1481fc00323e4..14e21a8b014a0e9d0673144940847925bef62825 100644 (file)
@@ -154,9 +154,9 @@ void id_lib_extern(ID *id)
 {
        if (id) {
                BLI_assert(BKE_idcode_is_linkable(GS(id->name)));
-               if (id->flag & LIB_INDIRECT) {
-                       id->flag -= LIB_INDIRECT;
-                       id->flag |= LIB_EXTERN;
+               if (id->tag & LIB_TAG_INDIRECT) {
+                       id->tag -= LIB_TAG_INDIRECT;
+                       id->tag |= LIB_TAG_EXTERN;
                }
        }
 }
@@ -223,7 +223,7 @@ void id_fake_user_clear(ID *id)
  * if the block can be made local. */
 bool id_make_local(ID *id, bool test)
 {
-       if (id->flag & LIB_INDIRECT)
+       if (id->tag & LIB_TAG_INDIRECT)
                return false;
 
        switch (GS(id->name)) {
@@ -549,21 +549,27 @@ ListBase *which_libbase(Main *mainlib, short type)
        return NULL;
 }
 
-/* Flag all ids in listbase */
-void BKE_main_id_flag_listbase(ListBase *lb, const short flag, const bool value)
+/**
+ * Clear or set given flags for all ids in listbase (runtime flags only).
+ */
+void BKE_main_id_flag_listbase(ListBase *lb, const int flag, const bool value)
 {
        ID *id;
        if (value) {
-               for (id = lb->first; id; id = id->next) id->flag |= flag;
+               for (id = lb->first; id; id = id->next)
+                       id->tag |= flag;
        }
        else {
-               const short nflag = ~flag;
-               for (id = lb->first; id; id = id->next) id->flag &= nflag;
+               const int nflag = ~flag;
+               for (id = lb->first; id; id = id->next)
+                       id->tag &= nflag;
        }
 }
 
-/* Flag all ids in listbase */
-void BKE_main_id_flag_all(Main *bmain, const short flag, const bool value)
+/**
+ * Clear or set given flags for all ids in bmain (runtime flags only).
+ */
+void BKE_main_id_flag_all(Main *bmain, const int flag, const bool value)
 {
        ListBase *lbarray[MAX_LIBARRAY];
        int a;
@@ -952,7 +958,7 @@ void *BKE_libblock_copy_ex(Main *bmain, ID *id)
        }
        
        id->newid = idn;
-       idn->flag |= LIB_NEW;
+       idn->tag |= LIB_TAG_NEW;
 
        BKE_libblock_copy_data(idn, id, false);
        
@@ -978,7 +984,7 @@ void *BKE_libblock_copy_nolib(ID *id, const bool do_action)
        }
 
        id->newid = idn;
-       idn->flag |= LIB_NEW;
+       idn->tag |= LIB_TAG_NEW;
        idn->us = 1;
 
        BKE_libblock_copy_data(idn, id, do_action);
@@ -1000,8 +1006,8 @@ static bool id_relink_looper(void *UNUSED(user_data), ID **id_pointer, const int
                        BKE_library_update_ID_link_user(id->newid, id, cd_flag);
                        *id_pointer = id->newid;
                }
-               else if (id->flag & LIB_NEW) {
-                       id->flag &= ~LIB_NEW;
+               else if (id->tag & LIB_TAG_NEW) {
+                       id->tag &= ~LIB_TAG_NEW;
                        BKE_libblock_relink(id);
                }
        }
@@ -1632,7 +1638,7 @@ void id_clear_lib_data(Main *bmain, ID *id)
        id_fake_user_clear(id);
 
        id->lib = NULL;
-       id->flag = LIB_LOCAL;
+       id->tag |= LIB_TAG_LOCAL;
        new_id(which_libbase(bmain, GS(id->name)), id, NULL);
 
        /* internal bNodeTree blocks inside ID types below
@@ -1666,7 +1672,7 @@ void BKE_main_id_clear_newpoins(Main *bmain)
                id = lbarray[a]->first;
                while (id) {
                        id->newid = NULL;
-                       id->flag &= ~LIB_NEW;
+                       id->tag &= ~LIB_TAG_NEW;
                        id = id->next;
                }
        }
@@ -1674,7 +1680,8 @@ void BKE_main_id_clear_newpoins(Main *bmain)
 
 static void lib_indirect_test_id(ID *id, Library *lib)
 {
-#define LIBTAG(a)   if (a && a->id.lib) { a->id.flag &= ~LIB_INDIRECT; a->id.flag |= LIB_EXTERN; } (void)0
+#define LIBTAG(a) \
+       if (a && a->id.lib) { a->id.tag &= ~LIB_TAG_INDIRECT; a->id.tag |= LIB_TAG_EXTERN; } (void)0
        
        if (id->lib) {
                /* datablocks that were indirectly related are now direct links
@@ -1723,12 +1730,12 @@ void BKE_main_id_tag_listbase(ListBase *lb, const bool tag)
        ID *id;
        if (tag) {
                for (id = lb->first; id; id = id->next) {
-                       id->flag |= LIB_DOIT;
+                       id->tag |= LIB_TAG_DOIT;
                }
        }
        else {
                for (id = lb->first; id; id = id->next) {
-                       id->flag &= ~LIB_DOIT;
+                       id->tag &= ~LIB_TAG_DOIT;
                }
        }
 }
@@ -1767,27 +1774,27 @@ void BKE_library_make_local(Main *bmain, Library *lib, bool untagged_only)
                        id->newid = NULL;
                        idn = id->next;      /* id is possibly being inserted again */
                        
-                       /* The check on the second line (LIB_PRE_EXISTING) is done so its
+                       /* The check on the second line (LIB_TAG_PRE_EXISTING) is done so its
                         * possible to tag data you don't want to be made local, used for
                         * appending data, so any libdata already linked wont become local
                         * (very nasty to discover all your links are lost after appending)  
                         * */
-                       if (id->flag & (LIB_EXTERN | LIB_INDIRECT | LIB_NEW) &&
-                           ((untagged_only == false) || !(id->flag & LIB_PRE_EXISTING)))
+                       if (id->tag & (LIB_TAG_EXTERN | LIB_TAG_INDIRECT | LIB_TAG_NEW) &&
+                           ((untagged_only == false) || !(id->tag & LIB_TAG_PRE_EXISTING)))
                        {
                                if (lib == NULL || id->lib == lib) {
                                        if (id->lib) {
                                                /* for Make Local > All we should be calling id_make_local,
                                                 * but doing that breaks append (see #36003 and #36006), we
                                                 * we should make it work with all datablocks and id.us==0 */
-                                               id_clear_lib_data(bmain, id); /* sets 'id->flag' */
+                                               id_clear_lib_data(bmain, id); /* sets 'id->tag' */
 
                                                /* why sort alphabetically here but not in
                                                 * id_clear_lib_data() ? - campbell */
                                                id_sort_by_name(lbarray[a], id);
                                        }
                                        else {
-                                               id->flag &= ~(LIB_EXTERN | LIB_INDIRECT | LIB_NEW);
+                                               id->tag &= ~(LIB_TAG_EXTERN | LIB_TAG_INDIRECT | LIB_TAG_NEW);
                                        }
                                }
                        }
index cd26691c3e153c6a3de2e9139bb99f39ab451864..12db3a87ba0fcad3d8136158ace0c00def2f6cd4 100644 (file)
@@ -1589,8 +1589,8 @@ void BKE_mask_update_scene(Main *bmain, Scene *scene)
        Mask *mask;
 
        for (mask = bmain->mask.first; mask; mask = mask->id.next) {
-               if (mask->id.flag & (LIB_ID_RECALC | LIB_ID_RECALC_DATA)) {
-                       bool do_new_frame = (mask->id.flag & LIB_ID_RECALC_DATA) != 0;
+               if (mask->id.tag & (LIB_TAG_ID_RECALC | LIB_TAG_ID_RECALC_DATA)) {
+                       bool do_new_frame = (mask->id.tag & LIB_TAG_ID_RECALC_DATA) != 0;
                        BKE_mask_evaluate_all_masks(bmain, CFRA, do_new_frame);
                }
        }
index b913e6de4333371406e26569684f6750f63d168f..809b45d4b36fc319dd2eca7b41de020382e21505 100644 (file)
@@ -1312,13 +1312,13 @@ void material_drivers_update(Scene *scene, Material *ma, float ctime)
        //      printf("material_drivers_update(%s, %s)\n", scene->id.name, ma->id.name);
        
        /* Prevent infinite recursion by checking (and tagging the material) as having been visited already
-        * (see BKE_scene_update_tagged()). This assumes ma->id.flag & LIB_DOIT isn't set by anything else
+        * (see BKE_scene_update_tagged()). This assumes ma->id.tag & LIB_TAG_DOIT isn't set by anything else
         * in the meantime... [#32017]
         */
-       if (ma->id.flag & LIB_DOIT)
+       if (ma->id.tag & LIB_TAG_DOIT)
                return;
 
-       ma->id.flag |= LIB_DOIT;
+       ma->id.tag |= LIB_TAG_DOIT;
        
        /* material itself */
        if (ma->adt && ma->adt->drivers.first) {
@@ -1330,7 +1330,7 @@ void material_drivers_update(Scene *scene, Material *ma, float ctime)
                material_node_drivers_update(scene, ma->nodetree, ctime);
        }
 
-       ma->id.flag &= ~LIB_DOIT;
+       ma->id.tag &= ~LIB_TAG_DOIT;
 }
 
 bool object_remove_material_slot(Object *ob)
index 70da0111752c2583b2612e162bb58f505c36fe26..89f22b8e7428440147cd3255f6d4dd8fa80e4719 100644 (file)
@@ -1802,7 +1802,7 @@ void BKE_object_make_proxy(Object *ob, Object *target, Object *gob)
        /* set object type and link to data */
        ob->type = target->type;
        ob->data = target->data;
-       id_us_plus((ID *)ob->data);     /* ensures lib data becomes LIB_EXTERN */
+       id_us_plus((ID *)ob->data);     /* ensures lib data becomes LIB_TAG_EXTERN */
        
        /* copy material and index information */
        ob->actcol = ob->totcol = 0;
@@ -3795,13 +3795,13 @@ static Object *obrel_armature_find(Object *ob)
 
 static bool obrel_list_test(Object *ob)
 {
-       return ob && !(ob->id.flag & LIB_DOIT);
+       return ob && !(ob->id.tag & LIB_TAG_DOIT);
 }
 
 static void obrel_list_add(LinkNode **links, Object *ob)
 {
        BLI_linklist_prepend(links, ob);
-       ob->id.flag |= LIB_DOIT;
+       ob->id.tag |= LIB_TAG_DOIT;
 }
 
 /*
@@ -3819,7 +3819,7 @@ LinkNode *BKE_object_relational_superset(struct Scene *scene, eObjectSet objectS
 
        /* Remove markers from all objects */
        for (base = scene->base.first; base; base = base->next) {
-               base->object->id.flag &= ~LIB_DOIT;
+               base->object->id.tag &= ~LIB_TAG_DOIT;
        }
 
        /* iterate over all selected and visible objects */
index 8abe4bdbb97f2032f743033f98696c1b616bc36c..5da9fcbb4fe3fe4df82f63994f5be912b38584eb 100644 (file)
@@ -354,7 +354,7 @@ static void make_duplis_frames(const DupliContext *ctx)
 
        /* special flag to avoid setting recalc flags to notify the depsgraph of
         * updates, as this is not a permanent change to the object */
-       ob->id.flag |= LIB_ANIM_NO_RECALC;
+       ob->id.tag |= LIB_TAG_ANIM_NO_RECALC;
 
        for (scene->r.cfra = ob->dupsta; scene->r.cfra <= dupend; scene->r.cfra++) {
                int ok = 1;
index 73d211f5c44e10e7855db0985a2b14055ed84574..9f0a49ba1bc9647d2a3654f6fcdb7bd9ed2692e1 100644 (file)
@@ -1757,8 +1757,8 @@ static void prepare_mesh_for_viewport_render(Main *bmain, Scene *scene)
        if (obedit) {
                Mesh *mesh = obedit->data;
                if ((obedit->type == OB_MESH) &&
-                   ((obedit->id.flag & LIB_ID_RECALC_ALL) ||
-                    (mesh->id.flag & LIB_ID_RECALC_ALL)))
+                   ((obedit->id.tag & LIB_TAG_ID_RECALC_ALL) ||
+                    (mesh->id.tag & LIB_TAG_ID_RECALC_ALL)))
                {
                        if (check_rendered_viewport_visible(bmain)) {
                                BMesh *bm = mesh->edit_btmesh->bm;
@@ -1801,7 +1801,7 @@ void BKE_scene_update_tagged(EvaluationContext *eval_ctx, Main *bmain, Scene *sc
 
        /* removed calls to quick_cache, see pointcache.c */
        
-       /* clear "LIB_DOIT" flag from all materials, to prevent infinite recursion problems later 
+       /* clear "LIB_TAG_DOIT" flag from all materials, to prevent infinite recursion problems later
         * when trying to find materials with drivers that need evaluating [#32017] 
         */
        BKE_main_id_tag_idcode(bmain, ID_MA, false);
@@ -1960,7 +1960,7 @@ void BKE_scene_update_for_newframe_ex(EvaluationContext *eval_ctx, Main *bmain,
        }
 #endif
 
-       /* clear "LIB_DOIT" flag from all materials, to prevent infinite recursion problems later 
+       /* clear "LIB_TAG_DOIT" flag from all materials, to prevent infinite recursion problems later
         * when trying to find materials with drivers that need evaluating [#32017] 
         */
        BKE_main_id_tag_idcode(bmain, ID_MA, false);
index 7c420549a0dffed66fee4e6b712874e01e047974..588f591b2d182fe0804b8067e814aa416e755ff2 100644 (file)
@@ -3402,16 +3402,16 @@ static ImBuf *do_render_strip_uncached(const SeqRenderData *context, Sequence *s
                                if (seq->scene && (context->scene != seq->scene)) {
 #ifdef USE_SCENE_RECURSIVE_HACK
                                        /* weak recusrive check, same as T32017 */
-                                       if (seq->scene->id.flag & LIB_DOIT) {
+                                       if (seq->scene->id.tag & LIB_TAG_DOIT) {
                                                break;
                                        }
-                                       seq->scene->id.flag |= LIB_DOIT;
+                                       seq->scene->id.tag |= LIB_TAG_DOIT;
 #endif
 
                                        ibuf = do_render_strip_seqbase(context, seq, nr, use_preprocess);
 
 #ifdef USE_SCENE_RECURSIVE_HACK
-                                       seq->scene->id.flag &= ~LIB_DOIT;
+                                       seq->scene->id.tag &= ~LIB_TAG_DOIT;
 #endif
                                }
                        }
index 177055e720674b0e6a2c1b71fb6bee366d2f1dcf..30faa3709bad55adee2500508093d4868b294c80 100644 (file)
@@ -2158,8 +2158,8 @@ static void lib_link_brush(FileData *fd, Main *main)
        
        /* only link ID pointers */
        for (brush = main->brush.first; brush; brush = brush->id.next) {
-               if (brush->id.flag & LIB_NEED_LINK) {
-                       brush->id.flag -= LIB_NEED_LINK;
+               if (brush->id.tag & LIB_TAG_NEED_LINK) {
+                       brush->id.tag &= ~LIB_TAG_NEED_LINK;
                        
                        brush->mtex.tex = newlibadr_us(fd, brush->id.lib, brush->mtex.tex);
                        brush->mask_mtex.tex = newlibadr_us(fd, brush->id.lib, brush->mask_mtex.tex);
@@ -2194,8 +2194,8 @@ static void lib_link_palette(FileData *UNUSED(fd), Main *main)
 
        /* only link ID pointers */
        for (palette = main->palettes.first; palette; palette = palette->id.next) {
-               if (palette->id.flag & LIB_NEED_LINK) {
-                       palette->id.flag -= LIB_NEED_LINK;
+               if (palette->id.tag & LIB_TAG_NEED_LINK) {
+                       palette->id.tag &= ~LIB_TAG_NEED_LINK;
                }
        }
 }
@@ -2212,8 +2212,8 @@ static void lib_link_paint_curve(FileData *UNUSED(fd), Main *main)
 
        /* only link ID pointers */
        for (pc = main->paintcurves.first; pc; pc = pc->id.next) {
-               if (pc->id.flag & LIB_NEED_LINK) {
-                       pc->id.flag -= LIB_NEED_LINK;
+               if (pc->id.tag & LIB_TAG_NEED_LINK) {
+                       pc->id.tag &= ~LIB_TAG_NEED_LINK;
                }
        }
 }
@@ -2246,13 +2246,13 @@ static void lib_link_ipo(FileData *fd, Main *main)
        Ipo *ipo;
        
        for (ipo = main->ipo.first; ipo; ipo = ipo->id.next) {
-               if (ipo->id.flag & LIB_NEED_LINK) {
+               if (ipo->id.tag & LIB_TAG_NEED_LINK) {
                        IpoCurve *icu;
                        for (icu = ipo->curve.first; icu; icu = icu->next) {
                                if (icu->driver)
                                        icu->driver->ob = newlibadr(fd, ipo->id.lib, icu->driver->ob);
                        }
-                       ipo->id.flag -= LIB_NEED_LINK;
+                       ipo->id.tag &= ~LIB_TAG_NEED_LINK;
                }
        }
 }
@@ -2468,8 +2468,8 @@ static void lib_link_action(FileData *fd, Main *main)
        bActionChannel *chan;
 
        for (act = main->action.first; act; act = act->id.next) {
-               if (act->id.flag & LIB_NEED_LINK) {
-                       act->id.flag -= LIB_NEED_LINK;
+               if (act->id.tag & LIB_TAG_NEED_LINK) {
+                       act->id.tag &= ~LIB_TAG_NEED_LINK;
                        
 // XXX deprecated - old animation system <<<
                        for (chan=act->chanbase.first; chan; chan=chan->next) {
@@ -2719,8 +2719,8 @@ static void lib_link_nodetree(FileData *fd, Main *main)
        
        /* only link ID pointers */
        for (ntree = main->nodetree.first; ntree; ntree = ntree->id.next) {
-               if (ntree->id.flag & LIB_NEED_LINK) {
-                       ntree->id.flag -= LIB_NEED_LINK;
+               if (ntree->id.tag & LIB_TAG_NEED_LINK) {
+                       ntree->id.tag &= ~LIB_TAG_NEED_LINK;
                        lib_link_ntree(fd, &ntree->id, ntree);
                }
        }
@@ -2983,7 +2983,7 @@ static void direct_link_nodetree(FileData *fd, bNodeTree *ntree)
        ntree->adt = newdataadr(fd, ntree->adt);
        direct_link_animdata(fd, ntree->adt);
        
-       ntree->id.flag &= ~(LIB_ID_RECALC|LIB_ID_RECALC_DATA);
+       ntree->id.tag &= ~(LIB_TAG_ID_RECALC|LIB_TAG_ID_RECALC_DATA);
 
        link_list(fd, &ntree->nodes);
        for (node = ntree->nodes.first; node; node = node->next) {
@@ -3237,9 +3237,9 @@ static void lib_link_armature(FileData *fd, Main *main)
        bArmature *arm;
        
        for (arm = main->armature.first; arm; arm = arm->id.next) {
-               if (arm->id.flag & LIB_NEED_LINK) {
+               if (arm->id.tag & LIB_TAG_NEED_LINK) {
                        lib_link_animdata(fd, &arm->id, arm->adt);
-                       arm->id.flag -= LIB_NEED_LINK;
+                       arm->id.tag &= ~LIB_TAG_NEED_LINK;
                }
        }
 }
@@ -3286,14 +3286,14 @@ static void lib_link_camera(FileData *fd, Main *main)
        Camera *ca;
        
        for (ca = main->camera.first; ca; ca = ca->id.next) {
-               if (ca->id.flag & LIB_NEED_LINK) {
+               if (ca->id.tag & LIB_TAG_NEED_LINK) {
                        lib_link_animdata(fd, &ca->id, ca->adt);
                        
                        ca->ipo = newlibadr_us(fd, ca->id.lib, ca->ipo); // XXX deprecated - old animation system
                        
                        ca->dof_ob = newlibadr_us(fd, ca->id.lib, ca->dof_ob);
                        
-                       ca->id.flag -= LIB_NEED_LINK;
+                       ca->id.tag &= ~LIB_TAG_NEED_LINK;
                }
        }
 }
@@ -3314,7 +3314,7 @@ static void lib_link_lamp(FileData *fd, Main *main)
        int a;
        
        for (la = main->lamp.first; la; la = la->id.next) {
-               if (la->id.flag & LIB_NEED_LINK) {
+               if (la->id.tag & LIB_TAG_NEED_LINK) {
                        lib_link_animdata(fd, &la->id, la->adt);
                        
                        for (a = 0; a < MAX_MTEX; a++) {
@@ -3332,7 +3332,7 @@ static void lib_link_lamp(FileData *fd, Main *main)
                                la->nodetree->id.lib = la->id.lib;
                        }
                        
-                       la->id.flag -= LIB_NEED_LINK;
+                       la->id.tag &= ~LIB_TAG_NEED_LINK;
                }
        }
 }
@@ -3383,15 +3383,15 @@ static void lib_link_key(FileData *fd, Main *main)
                        blo_do_versions_key_uidgen(key);
                }
                
-               BLI_assert((key->id.flag & LIB_EXTERN) == 0);
+               BLI_assert((key->id.tag & LIB_TAG_EXTERN) == 0);
 
-               if (key->id.flag & LIB_NEED_LINK) {
+               if (key->id.tag & LIB_TAG_NEED_LINK) {
                        lib_link_animdata(fd, &key->id, key->adt);
                        
                        key->ipo = newlibadr_us(fd, key->id.lib, key->ipo); // XXX deprecated - old animation system
                        key->from = newlibadr(fd, key->id.lib, key->from);
                        
-                       key->id.flag -= LIB_NEED_LINK;
+                       key->id.tag &= ~LIB_TAG_NEED_LINK;
                }
        }
 }
@@ -3452,7 +3452,7 @@ static void lib_link_mball(FileData *fd, Main *main)
        int a;
        
        for (mb = main->mball.first; mb; mb = mb->id.next) {
-               if (mb->id.flag & LIB_NEED_LINK) {
+               if (mb->id.tag & LIB_TAG_NEED_LINK) {
                        lib_link_animdata(fd, &mb->id, mb->adt);
                        
                        for (a = 0; a < mb->totcol; a++) 
@@ -3460,7 +3460,7 @@ static void lib_link_mball(FileData *fd, Main *main)
                        
                        mb->ipo = newlibadr_us(fd, mb->id.lib, mb->ipo); // XXX deprecated - old animation system
                        
-                       mb->id.flag -= LIB_NEED_LINK;
+                       mb->id.tag &= ~LIB_TAG_NEED_LINK;
                }
        }
 }
@@ -3490,7 +3490,7 @@ static void lib_link_world(FileData *fd, Main *main)
        int a;
        
        for (wrld = main->world.first; wrld; wrld = wrld->id.next) {
-               if (wrld->id.flag & LIB_NEED_LINK) {
+               if (wrld->id.tag & LIB_TAG_NEED_LINK) {
                        lib_link_animdata(fd, &wrld->id, wrld->adt);
                        
                        wrld->ipo = newlibadr_us(fd, wrld->id.lib, wrld->ipo); // XXX deprecated - old animation system
@@ -3508,7 +3508,7 @@ static void lib_link_world(FileData *fd, Main *main)
                                wrld->nodetree->id.lib = wrld->id.lib;
                        }
                        
-                       wrld->id.flag -= LIB_NEED_LINK;
+                       wrld->id.tag &= ~LIB_TAG_NEED_LINK;
                }
        }
 }
@@ -3542,8 +3542,8 @@ static void lib_link_vfont(FileData *UNUSED(fd), Main *main)
        VFont *vf;
        
        for (vf = main->vfont.first; vf; vf = vf->id.next) {
-               if (vf->id.flag & LIB_NEED_LINK) {
-                       vf->id.flag -= LIB_NEED_LINK;
+               if (vf->id.tag & LIB_TAG_NEED_LINK) {
+                       vf->id.tag &= ~LIB_TAG_NEED_LINK;
                }
        }
 }
@@ -3562,8 +3562,8 @@ static void lib_link_text(FileData *UNUSED(fd), Main *main)
        Text *text;
        
        for (text = main->text.first; text; text = text->id.next) {
-               if (text->id.flag & LIB_NEED_LINK) {
-                       text->id.flag -= LIB_NEED_LINK;
+               if (text->id.tag & LIB_TAG_NEED_LINK) {
+                       text->id.tag &= ~LIB_TAG_NEED_LINK;
                }
        }
 }
@@ -3614,10 +3614,10 @@ static void lib_link_image(FileData *fd, Main *main)
        Image *ima;
        
        for (ima = main->image.first; ima; ima = ima->id.next) {
-               if (ima->id.flag & LIB_NEED_LINK) {
+               if (ima->id.tag & LIB_TAG_NEED_LINK) {
                        IDP_LibLinkProperty(ima->id.properties, (fd->flags & FD_FLAGS_SWITCH_ENDIAN), fd);
                        
-                       ima->id.flag -= LIB_NEED_LINK;
+                       ima->id.tag &= ~LIB_TAG_NEED_LINK;
                }
        }
 }
@@ -3682,7 +3682,7 @@ static void lib_link_curve(FileData *fd, Main *main)
        int a;
        
        for (cu = main->curve.first; cu; cu = cu->id.next) {
-               if (cu->id.flag & LIB_NEED_LINK) {
+               if (cu->id.tag & LIB_TAG_NEED_LINK) {
                        lib_link_animdata(fd, &cu->id, cu->adt);
                        
                        for (a = 0; a < cu->totcol; a++) 
@@ -3699,7 +3699,7 @@ static void lib_link_curve(FileData *fd, Main *main)
                        cu->ipo = newlibadr_us(fd, cu->id.lib, cu->ipo); // XXX deprecated - old animation system
                        cu->key = newlibadr_us(fd, cu->id.lib, cu->key);
                        
-                       cu->id.flag -= LIB_NEED_LINK;
+                       cu->id.tag &= ~LIB_TAG_NEED_LINK;
                }
        }
 }
@@ -3774,7 +3774,7 @@ static void lib_link_texture(FileData *fd, Main *main)
        Tex *tex;
        
        for (tex = main->tex.first; tex; tex = tex->id.next) {
-               if (tex->id.flag & LIB_NEED_LINK) {
+               if (tex->id.tag & LIB_TAG_NEED_LINK) {
                        lib_link_animdata(fd, &tex->id, tex->adt);
                        
                        tex->ima = newlibadr_us(fd, tex->id.lib, tex->ima);
@@ -3793,7 +3793,7 @@ static void lib_link_texture(FileData *fd, Main *main)
                                tex->nodetree->id.lib = tex->id.lib;
                        }
                        
-                       tex->id.flag -= LIB_NEED_LINK;
+                       tex->id.tag &= ~LIB_TAG_NEED_LINK;
                }
        }
 }
@@ -3854,7 +3854,7 @@ static void lib_link_material(FileData *fd, Main *main)
        int a;
        
        for (ma = main->mat.first; ma; ma = ma->id.next) {
-               if (ma->id.flag & LIB_NEED_LINK) {
+               if (ma->id.tag & LIB_TAG_NEED_LINK) {
                        lib_link_animdata(fd, &ma->id, ma->adt);
                        
                        /* Link ID Properties -- and copy this comment EXACTLY for easy finding
@@ -3877,7 +3877,7 @@ static void lib_link_material(FileData *fd, Main *main)
                                ma->nodetree->id.lib = ma->id.lib;
                        }
                        
-                       ma->id.flag -= LIB_NEED_LINK;
+                       ma->id.tag &= ~LIB_TAG_NEED_LINK;
                }
        }
 }
@@ -4002,7 +4002,7 @@ static void lib_link_particlesettings(FileData *fd, Main *main)
        int a;
        
        for (part = main->particle.first; part; part = part->id.next) {
-               if (part->id.flag & LIB_NEED_LINK) {
+               if (part->id.tag & LIB_TAG_NEED_LINK) {
                        lib_link_animdata(fd, &part->id, part->adt);
                        part->ipo = newlibadr_us(fd, part->id.lib, part->ipo); // XXX deprecated - old animation system
                        
@@ -4084,7 +4084,7 @@ static void lib_link_particlesettings(FileData *fd, Main *main)
                                }
                        }
                        
-                       part->id.flag -= LIB_NEED_LINK;
+                       part->id.tag &= ~LIB_TAG_NEED_LINK;
                }
        }
 }
@@ -4305,7 +4305,7 @@ static void lib_link_mesh(FileData *fd, Main *main)
        Mesh *me;
        
        for (me = main->mesh.first; me; me = me->id.next) {
-               if (me->id.flag & LIB_NEED_LINK) {
+               if (me->id.tag & LIB_TAG_NEED_LINK) {
                        int i;
                        
                        /* Link ID Properties -- and copy this comment EXACTLY for easy finding
@@ -4340,7 +4340,7 @@ static void lib_link_mesh(FileData *fd, Main *main)
        convert_tface_mt(fd, main);
 
        for (me = main->mesh.first; me; me = me->id.next) {
-               if (me->id.flag & LIB_NEED_LINK) {
+               if (me->id.tag & LIB_TAG_NEED_LINK) {
                        /*check if we need to convert mfaces to mpolys*/
                        if (me->totface && !me->totpoly) {
                                /* temporarily switch main so that reading from
@@ -4369,7 +4369,7 @@ static void lib_link_mesh(FileData *fd, Main *main)
                        BKE_mesh_tessface_clear(me);
 #endif
 
-                       me->id.flag -= LIB_NEED_LINK;
+                       me->id.tag &= ~LIB_TAG_NEED_LINK;
                }
        }
 }
@@ -4586,13 +4586,13 @@ static void lib_link_latt(FileData *fd, Main *main)
        Lattice *lt;
        
        for (lt = main->latt.first; lt; lt = lt->id.next) {
-               if (lt->id.flag & LIB_NEED_LINK) {
+               if (lt->id.tag & LIB_TAG_NEED_LINK) {
                        lib_link_animdata(fd, &lt->id, lt->adt);
                        
                        lt->ipo = newlibadr_us(fd, lt->id.lib, lt->ipo); // XXX deprecated - old animation system
                        lt->key = newlibadr_us(fd, lt->id.lib, lt->key);
                        
-                       lt->id.flag -= LIB_NEED_LINK;
+                       lt->id.tag &= ~LIB_TAG_NEED_LINK;
                }
        }
 }
@@ -4639,7 +4639,7 @@ static void lib_link_object(FileData *fd, Main *main)
        int warn=0, a;
        
        for (ob = main->object.first; ob; ob = ob->id.next) {
-               if (ob->id.flag & LIB_NEED_LINK) {
+               if (ob->id.tag & LIB_TAG_NEED_LINK) {
                        IDP_LibLinkProperty(ob->id.properties, (fd->flags & FD_FLAGS_SWITCH_ENDIAN), fd);
                        lib_link_animdata(fd, &ob->id, ob->adt);
                        
@@ -4716,7 +4716,7 @@ static void lib_link_object(FileData *fd, Main *main)
                        ob->gpd = newlibadr_us(fd, ob->id.lib, ob->gpd);
                        ob->duplilist = NULL;
                        
-                       ob->id.flag -= LIB_NEED_LINK;
+                       ob->id.tag &= ~LIB_TAG_NEED_LINK;
                        /* if id.us==0 a new base will be created later on */
                        
                        /* WARNING! Also check expand_object(), should reflect the stuff below. */
@@ -5235,7 +5235,7 @@ static void direct_link_object(FileData *fd, Object *ob)
         * Also when linking in a file don't allow edit and pose modes.
         * See [#34776, #42780] for more information.
         */
-       if (fd->memfile || (ob->id.flag & (LIB_EXTERN | LIB_INDIRECT))) {
+       if (fd->memfile || (ob->id.tag & (LIB_TAG_EXTERN | LIB_TAG_INDIRECT))) {
                ob->mode &= ~(OB_MODE_EDIT | OB_MODE_PARTICLE_EDIT);
                if (!fd->memfile) {
                        ob->mode &= ~OB_MODE_POSE;
@@ -5505,7 +5505,7 @@ static bool scene_validate_setscene__liblink(Scene *sce, const int totscene)
        if (sce->set == NULL) return 1;
 
        for (a = 0, sce_iter = sce; sce_iter->set; sce_iter = sce_iter->set, a++) {
-               if (sce_iter->id.flag & LIB_NEED_LINK) {
+               if (sce_iter->id.tag & LIB_TAG_NEED_LINK) {
                        return 1;
                }
 
@@ -5535,7 +5535,7 @@ static void lib_link_scene(FileData *fd, Main *main)
 #endif
        
        for (sce = main->scene.first; sce; sce = sce->id.next) {
-               if (sce->id.flag & LIB_NEED_LINK) {
+               if (sce->id.tag & LIB_TAG_NEED_LINK) {
                        /* Link ID Properties -- and copy this comment EXACTLY for easy finding
                         * of library blocks that implement this.*/
                        IDP_LibLinkProperty(sce->id.properties, (fd->flags & FD_FLAGS_SWITCH_ENDIAN), fd);
@@ -5684,10 +5684,10 @@ static void lib_link_scene(FileData *fd, Main *main)
                        }
                        else {
                                /* postpone un-setting the flag until we've checked the set-scene */
-                               sce->id.flag &= ~LIB_NEED_LINK;
+                               sce->id.tag &= ~LIB_TAG_NEED_LINK;
                        }
 #else
-                       sce->id.flag &= ~LIB_NEED_LINK;
+                       sce->id.tag &= ~LIB_TAG_NEED_LINK;
 #endif
                }
 
@@ -5699,8 +5699,8 @@ static void lib_link_scene(FileData *fd, Main *main)
 #ifdef USE_SETSCENE_CHECK
        if (need_check_set) {
                for (sce = main->scene.first; sce; sce = sce->id.next) {
-                       if (sce->id.flag & LIB_NEED_LINK) {
-                               sce->id.flag &= ~LIB_NEED_LINK;
+                       if (sce->id.tag & LIB_TAG_NEED_LINK) {
+                               sce->id.tag &= ~LIB_TAG_NEED_LINK;
                                if (!scene_validate_setscene__liblink(sce, totscene)) {
                                        printf("Found cyclic background scene when linking %s\n", sce->id.name + 2);
                                }
@@ -6081,11 +6081,11 @@ static void lib_link_windowmanager(FileData *fd, Main *main)
        wmWindow *win;
        
        for (wm = main->wm.first; wm; wm = wm->id.next) {
-               if (wm->id.flag & LIB_NEED_LINK) {
+               if (wm->id.tag & LIB_TAG_NEED_LINK) {
                        for (win = wm->windows.first; win; win = win->next)
                                win->screen = newlibadr(fd, NULL, win->screen);
                        
-                       wm->id.flag -= LIB_NEED_LINK;
+                       wm->id.tag &= ~LIB_TAG_NEED_LINK;
                }
        }
 }
@@ -6098,8 +6098,8 @@ static void lib_link_gpencil(FileData *fd, Main *main)
        bGPdata *gpd;
        
        for (gpd = main->gpencil.first; gpd; gpd = gpd->id.next) {
-               if (gpd->id.flag & LIB_NEED_LINK) {
-                       gpd->id.flag -= LIB_NEED_LINK;
+               if (gpd->id.tag & LIB_TAG_NEED_LINK) {
+                       gpd->id.tag &= ~LIB_TAG_NEED_LINK;
                        
                        lib_link_animdata(fd, &gpd->id, gpd->adt);
                }
@@ -6150,7 +6150,7 @@ static void lib_link_screen(FileData *fd, Main *main)
        ScrArea *sa;
        
        for (sc = main->screen.first; sc; sc = sc->id.next) {
-               if (sc->id.flag & LIB_NEED_LINK) {
+               if (sc->id.tag & LIB_TAG_NEED_LINK) {
                        id_us_ensure_real(&sc->id);
                        sc->scene = newlibadr(fd, sc->id.lib, sc->scene);
 
@@ -6340,7 +6340,7 @@ static void lib_link_screen(FileData *fd, Main *main)
                                        }
                                }
                        }
-                       sc->id.flag -= LIB_NEED_LINK;
+                       sc->id.tag &= ~LIB_TAG_NEED_LINK;
                }
        }
 }
@@ -7184,11 +7184,11 @@ static void lib_link_speaker(FileData *fd, Main *main)
        Speaker *spk;
        
        for (spk = main->speaker.first; spk; spk = spk->id.next) {
-               if (spk->id.flag & LIB_NEED_LINK) {
+               if (spk->id.tag & LIB_TAG_NEED_LINK) {
                        lib_link_animdata(fd, &spk->id, spk->adt);
                        
                        spk->sound = newlibadr_us(fd, spk->id.lib, spk->sound);
-                       spk->id.flag -= LIB_NEED_LINK;
+                       spk->id.tag &= ~LIB_TAG_NEED_LINK;
                }
        }
 }
@@ -7240,8 +7240,8 @@ static void lib_link_sound(FileData *fd, Main *main)
        bSound *sound;
        
        for (sound = main->sound.first; sound; sound = sound->id.next) {
-               if (sound->id.flag & LIB_NEED_LINK) {
-                       sound->id.flag -= LIB_NEED_LINK;
+               if (sound->id.tag & LIB_TAG_NEED_LINK) {
+                       sound->id.tag &= ~LIB_TAG_NEED_LINK;
                        sound->ipo = newlibadr_us(fd, sound->id.lib, sound->ipo); // XXX deprecated - old animation system
                        
                        BKE_sound_load(main, sound);
@@ -7264,8 +7264,8 @@ static void lib_link_group(FileData *fd, Main *main)
        bool add_us;
        
        for (group = main->group.first; group; group = group->id.next) {
-               if (group->id.flag & LIB_NEED_LINK) {
-                       group->id.flag -= LIB_NEED_LINK;
+               if (group->id.tag & LIB_TAG_NEED_LINK) {
+                       group->id.tag &= ~LIB_TAG_NEED_LINK;
                        
                        add_us = false;
                        
@@ -7389,7 +7389,7 @@ static void lib_link_movieclip(FileData *fd, Main *main)
        MovieClip *clip;
        
        for (clip = main->movieclip.first; clip; clip = clip->id.next) {
-               if (clip->id.flag & LIB_NEED_LINK) {
+               if (clip->id.tag & LIB_TAG_NEED_LINK) {
                        MovieTracking *tracking = &clip->tracking;
                        MovieTrackingObject *object;
 
@@ -7404,7 +7404,7 @@ static void lib_link_movieclip(FileData *fd, Main *main)
                                lib_link_movieTracks(fd, clip, &object->tracks);
                        }
 
-                       clip->id.flag -= LIB_NEED_LINK;
+                       clip->id.tag &= ~LIB_TAG_NEED_LINK;
                }
        }
 }
@@ -7468,7 +7468,7 @@ static void lib_link_mask(FileData *fd, Main *main)
 
        mask = main->mask.first;
        while (mask) {
-               if (mask->id.flag & LIB_NEED_LINK) {
+               if (mask->id.tag & LIB_TAG_NEED_LINK) {
                        MaskLayer *masklay;
 
                        lib_link_animdata(fd, &mask->id, mask->adt);
@@ -7492,7 +7492,7 @@ static void lib_link_mask(FileData *fd, Main *main)
                                }
                        }
 
-                       mask->id.flag -= LIB_NEED_LINK;
+                       mask->id.tag &= ~LIB_TAG_NEED_LINK;
                }
                mask = mask->id.next;
        }
@@ -7509,8 +7509,8 @@ static void lib_link_linestyle(FileData *fd, Main *main)
 
        linestyle = main->linestyle.first;
        while (linestyle) {
-               if (linestyle->id.flag & LIB_NEED_LINK) {
-                       linestyle->id.flag -= LIB_NEED_LINK;
+               if (linestyle->id.tag & LIB_TAG_NEED_LINK) {
+                       linestyle->id.tag &= ~LIB_TAG_NEED_LINK;
 
                        IDP_LibLinkProperty(linestyle->id.properties, (fd->flags & FD_FLAGS_SWITCH_ENDIAN), fd);
                        lib_link_animdata(fd, &linestyle->id, linestyle->adt);
@@ -7921,12 +7921,10 @@ static BHead *read_libblock(FileData *fd, Main *main, BHead *bhead, int flag, ID
        if (!id)
                return blo_nextbhead(fd, bhead);
        
-       /* clear first 8 bits */
-       id->flag = (id->flag & 0xFF00) | flag | LIB_NEED_LINK;
+       id->tag = flag | LIB_TAG_NEED_LINK;
        id->lib = main->curlib;
        id->us = ID_FAKE_USERS(id);
        id->icon_id = 0;
-       id->flag &= ~(LIB_ID_RECALC | LIB_ID_RECALC_DATA | LIB_DOIT | LIB_MISSING);
        
        /* this case cannot be direct_linked: it's just the ID part */
        if (bhead->code == ID_ID) {
@@ -8371,7 +8369,7 @@ BlendFileData *blo_read_file_internal(FileData *fd, const char *filepath)
                case ID_ID:
                        /* Always adds to the most recently loaded ID_LI block, see direct_link_library.
                         * This is part of the file format definition. */
-                       bhead = read_libblock(fd, mainlist.last, bhead, LIB_READ | LIB_EXTERN, NULL);
+                       bhead = read_libblock(fd, mainlist.last, bhead, LIB_TAG_READ | LIB_TAG_EXTERN, NULL);
                        break;
                        
                        /* in 2.50+ files, the file identifier for screens is patched, forward compatibility */
@@ -8379,7 +8377,7 @@ BlendFileData *blo_read_file_internal(FileData *fd, const char *filepath)
                        bhead->code = ID_SCR;
                        /* deliberate pass on to default */
                default:
-                       bhead = read_libblock(fd, bfd->main, bhead, LIB_LOCAL, NULL);
+                       bhead = read_libblock(fd, bfd->main, bhead, LIB_TAG_LOCAL, NULL);
                }
        }
        
@@ -8559,7 +8557,7 @@ static void expand_doit_library(void *fdhandle, Main *mainvar, void *old)
                                        id = is_yet_read(fd, ptr, bhead);
                                
                                if (id == NULL) {
-                                       read_libblock(fd, ptr, bhead, LIB_READ+LIB_INDIRECT, NULL);
+                                       read_libblock(fd, ptr, bhead, LIB_TAG_READ | LIB_TAG_INDIRECT, NULL);
                                        // commented because this can print way too much
                                        // if (G.debug & G_DEBUG) printf("expand_doit: other lib %s\n", lib->name);
                                        
@@ -8577,10 +8575,10 @@ static void expand_doit_library(void *fdhandle, Main *mainvar, void *old)
                                        /* Update: the issue is that in file reading, the oldnewmap is OK, but for existing data, it has to be
                                         * inserted in the map to be found! */
                                        
-                                       /* Update: previously it was checking for id->flag & LIB_PRE_EXISTING, however that does not affect file
-                                        * reading. For file reading we may need to insert it into the libmap as well, because you might have
-                                        * two files indirectly linking the same datablock, and in that case we need this in the libmap for the
-                                        * fd of both those files.
+                                       /* Update: previously it was checking for id->tag & LIB_TAG_PRE_EXISTING, however that
+                                        * does not affect file reading. For file reading we may need to insert it into the libmap as well,
+                                        * because you might have two files indirectly linking the same datablock, and in that case
+                                        * we need this in the libmap for the fd of both those files.
                                         *
                                         * The crash that this check avoided earlier was because bhead->code wasn't properly passed in, making
                                         * change_idid_adr not detect the mapping was for an ID_ID datablock. */
@@ -8597,7 +8595,7 @@ static void expand_doit_library(void *fdhandle, Main *mainvar, void *old)
                else {
                        id = is_yet_read(fd, mainvar, bhead);
                        if (id == NULL) {
-                               read_libblock(fd, mainvar, bhead, LIB_TESTIND, NULL);
+                               read_libblock(fd, mainvar, bhead, LIB_TAG_TESTIND, NULL);
                        }
                        else {
                                /* this is actually only needed on UI call? when ID was already read before, and another append
@@ -9397,7 +9395,7 @@ void BLO_main_expander(BLOExpandDoitCallback expand_doit_func)
 
 /**
  * Loop over all ID data in Main to mark relations.
- * Set (id->flag & LIB_NEED_EXPAND) to mark expanding. Flags get cleared after expanding.
+ * Set (id->tag & LIB_TAG_NEED_EXPAND) to mark expanding. Flags get cleared after expanding.
  *
  * \param fdhandle usually filedata, or own handle.
  * \param mainvar the Main database to expand.
@@ -9417,7 +9415,7 @@ void BLO_expand_main(void *fdhandle, Main *mainvar)
                while (a--) {
                        id = lbarray[a]->first;
                        while (id) {
-                               if (id->flag & LIB_NEED_EXPAND) {
+                               if (id->tag & LIB_TAG_NEED_EXPAND) {
                                        switch (GS(id->name)) {
                                        case ID_OB:
                                                expand_object(fd, mainvar, (Object *)id);
@@ -9497,7 +9495,7 @@ void BLO_expand_main(void *fdhandle, Main *mainvar)
                                        }
                                        
                                        do_it = true;
-                                       id->flag -= LIB_NEED_EXPAND;
+                                       id->tag &= ~LIB_TAG_NEED_EXPAND;
                                        
                                }
                                id = id->next;
@@ -9531,9 +9529,9 @@ static void give_base_to_objects(Main *mainvar, Scene *scene, View3D *v3d, Libra
 
        BLI_assert(scene);
 
-       /* give all objects which are LIB_INDIRECT a base, or for a group when *lib has been set */
+       /* give all objects which are LIB_TAG_INDIRECT a base, or for a group when *lib has been set */
        for (ob = mainvar->object.first; ob; ob = ob->id.next) {
-               if ((ob->id.flag & LIB_INDIRECT) && (ob->id.flag & LIB_PRE_EXISTING) == 0) {
+               if ((ob->id.tag & LIB_TAG_INDIRECT) && (ob->id.tag & LIB_TAG_PRE_EXISTING) == 0) {
                        bool do_it = false;
 
                        if (ob->id.us == 0) {
@@ -9560,8 +9558,8 @@ static void give_base_to_objects(Main *mainvar, Scene *scene, View3D *v3d, Libra
                                CLAMP_MIN(ob->id.us, 0);
                                ob->id.us += 1;
 
-                               ob->id.flag &= ~LIB_INDIRECT;
-                               ob->id.flag |= LIB_EXTERN;
+                               ob->id.tag &= ~LIB_TAG_INDIRECT;
+                               ob->id.tag |= LIB_TAG_EXTERN;
                        }
                }
        }
@@ -9577,9 +9575,9 @@ static void give_base_to_groups(
 
        /* give all objects which are tagged a base */
        for (group = mainvar->group.first; group; group = group->id.next) {
-               if (group->id.flag & LIB_DOIT) {
+               if (group->id.tag & LIB_TAG_DOIT) {
                        /* any indirect group should not have been tagged */
-                       BLI_assert((group->id.flag & LIB_INDIRECT) == 0);
+                       BLI_assert((group->id.tag & LIB_TAG_INDIRECT) == 0);
 
                        /* BKE_object_add(...) messes with the selection */
                        ob = BKE_object_add_only_object(mainvar, OB_EMPTY, group->id.name + 2);
@@ -9610,7 +9608,7 @@ static ID *create_placeholder(Main *mainvar, const char *idname, const short fla
        memcpy(ph_id->name, idname, sizeof(ph_id->name));
        BKE_libblock_init_empty(ph_id);
        ph_id->lib = mainvar->curlib;
-       ph_id->flag = flag | LIB_MISSING;
+       ph_id->tag = flag | LIB_TAG_MISSING;
        ph_id->us = ID_FAKE_USERS(ph_id);
        ph_id->icon_id = 0;
 
@@ -9633,7 +9631,7 @@ static ID *link_named_part(Main *mainl, FileData *fd, const short idcode, const
                id = is_yet_read(fd, mainl, bhead);
                if (id == NULL) {
                        /* not read yet */
-                       read_libblock(fd, mainl, bhead, LIB_TESTEXT, &id);
+                       read_libblock(fd, mainl, bhead, LIB_TAG_TESTEXT, &id);
 
                        if (id) {
                                /* sort by name in list */
@@ -9646,9 +9644,9 @@ static ID *link_named_part(Main *mainl, FileData *fd, const short idcode, const
                        if (G.debug)
                                printf("append: already linked\n");
                        oldnewmap_insert(fd->libmap, bhead->old, id, bhead->code);
-                       if (id->flag & LIB_INDIRECT) {
-                               id->flag -= LIB_INDIRECT;
-                               id->flag |= LIB_EXTERN;
+                       if (id->tag & LIB_TAG_INDIRECT) {
+                               id->tag &= ~LIB_TAG_INDIRECT;
+                               id->tag |= LIB_TAG_EXTERN;
                        }
                }
        }
@@ -9675,7 +9673,7 @@ void BLO_library_link_all(Main *mainl, BlendHandle *bh)
                if (bhead->code == ENDB)
                        break;
                if (bhead->code == ID_OB)
-                       read_libblock(fd, mainl, bhead, LIB_TESTIND, &id);
+                       read_libblock(fd, mainl, bhead, LIB_TAG_TESTIND, &id);
                        
                if (id) {
                        /* sort by name in list */
@@ -9722,7 +9720,7 @@ static ID *link_named_part_ex(
        else if (id && (GS(id->name) == ID_GR)) {
                /* tag as needing to be instantiated */
                if (flag & FILE_GROUP_INSTANCE)
-                       id->flag |= LIB_DOIT;
+                       id->tag |= LIB_TAG_DOIT;
        }
 
        return id;
@@ -9768,13 +9766,13 @@ ID *BLO_library_link_named_part_ex(
 static void link_id_part(ReportList *reports, FileData *fd, Main *mainvar, ID *id, ID **r_id)
 {
        BHead *bhead = NULL;
-       const bool is_valid = BKE_idcode_is_linkable(GS(id->name)) || ((id->flag & LIB_EXTERN) == 0);
+       const bool is_valid = BKE_idcode_is_linkable(GS(id->name)) || ((id->tag & LIB_TAG_EXTERN) == 0);
 
        if (fd) {
                bhead = find_bhead_from_idname(fd, id->name);
        }
 
-       id->flag &= ~LIB_READ;
+       id->tag &= ~LIB_TAG_READ;
 
        if (!is_valid) {
                blo_reportf_wrap(
@@ -9787,9 +9785,9 @@ static void link_id_part(ReportList *reports, FileData *fd, Main *mainvar, ID *i
        }
 
        if (bhead) {
-               id->flag |= LIB_NEED_EXPAND;
+               id->tag |= LIB_TAG_NEED_EXPAND;
                // printf("read lib block %s\n", id->name);
-               read_libblock(fd, mainvar, bhead, id->flag, r_id);
+               read_libblock(fd, mainvar, bhead, id->tag, r_id);
        }
        else {
                blo_reportf_wrap(
@@ -9802,7 +9800,7 @@ static void link_id_part(ReportList *reports, FileData *fd, Main *mainvar, ID *i
 
                /* Generate a placeholder for this ID (simplified version of read_libblock actually...). */
                if (r_id) {
-                       *r_id = is_valid ? create_placeholder(mainvar, id->name, id->flag) : NULL;
+                       *r_id = is_valid ? create_placeholder(mainvar, id->name, id->tag) : NULL;
                }
        }
 }
@@ -9942,7 +9940,7 @@ static int mainvar_count_libread_blocks(Main *mainvar)
                ID *id;
                
                for (id = lbarray[a]->first; id; id = id->next) {
-                       if (id->flag & LIB_READ)
+                       if (id->tag & LIB_TAG_READ)
                                tot++;
                }
        }
@@ -9968,7 +9966,7 @@ static void read_libraries(FileData *basefd, ListBase *mainlist)
                while (mainptr) {
                        int tot = mainvar_count_libread_blocks(mainptr);
                        
-                       // printf("found LIB_READ %s\n", mainptr->curlib->name);
+                       // printf("found LIB_TAG_READ %s\n", mainptr->curlib->name);
                        if (tot) {
                                FileData *fd = mainptr->curlib->filedata;
                                
@@ -10049,7 +10047,7 @@ static void read_libraries(FileData *basefd, ListBase *mainlist)
                                        }
                                        else {
                                                mainptr->curlib->filedata = NULL;
-                                               mainptr->curlib->id.flag |= LIB_MISSING;
+                                               mainptr->curlib->id.tag |= LIB_TAG_MISSING;
                                        }
                                        
                                        if (fd == NULL) {
@@ -10066,7 +10064,7 @@ static void read_libraries(FileData *basefd, ListBase *mainlist)
 
                                        while (id) {
                                                ID *idn = id->next;
-                                               if (id->flag & LIB_READ) {
+                                               if (id->tag & LIB_TAG_READ) {
                                                        ID *realid = NULL;
                                                        BLI_remlink(lbarray[a], id);
 
@@ -10099,7 +10097,7 @@ static void read_libraries(FileData *basefd, ListBase *mainlist)
                        
                        for (id = lbarray[a]->first; id; id = idn) {
                                idn = id->next;
-                               if (id->flag & LIB_READ) {
+                               if (id->tag & LIB_TAG_READ) {
                                        BLI_assert(0);
                                        BLI_remlink(lbarray[a], id);
                                        blo_reportf_wrap(
index 816eb87901544ecf8702d1aacd3970726ac6685d..b975a39a301120861419ef6eca5e2bc75c879ecf 100644 (file)
@@ -55,6 +55,7 @@
 #include "DNA_genfile.h"
 
 #include "BKE_colortools.h"
+#include "BKE_library.h"
 #include "BKE_main.h"
 #include "BKE_modifier.h"
 #include "BKE_node.h"
@@ -1036,4 +1037,17 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *main)
                        }
                }
        }
+       if (!MAIN_VERSION_ATLEAST(main, 276, 5)) {
+               ListBase *lbarray[MAX_LIBARRAY];
+               int a;
+
+               /* Important to clear all non-persistent flags from older versions here, otherwise they could collide
+                * with any new persistent flag we may add in the future. */
+               a = set_listbasepointers(main, lbarray);
+               while (a--) {
+                       for (ID *id = lbarray[a]->first; id; id = id->next) {
+                               id->flag &= LIB_FAKEUSER;
+                       }
+               }
+       }
 }
index 635df922c11e51446c6ea75b561717609652d942..ac7b7b11b61a62d42e4af92865e2196d18ed2b87 100644 (file)
@@ -589,7 +589,7 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *main)
                /* tex->extend and tex->imageflag have changed: */
                Tex *tex = main->tex.first;
                while (tex) {
-                       if (tex->id.flag & LIB_NEED_LINK) {
+                       if (tex->id.tag & LIB_TAG_NEED_LINK) {
 
                                if (tex->extend == 0) {
                                        if (tex->xrepeat || tex->yrepeat) {
@@ -3043,7 +3043,7 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *main)
                                part->id.lib = ob->id.lib;
 
                                part->id.us--;
-                               part->id.flag |= (ob->id.flag & LIB_NEED_LINK);
+                               part->id.tag |= (ob->id.tag & LIB_TAG_NEED_LINK);
 
                                psys->totpart = 0;
                                psys->flag = PSYS_CURRENT;
index 4643d2e56428eda2bd1792bd3b19b096d61b6e43..a2802db08026401ac8597cb8a69f5e8c3ba08444 100644 (file)
@@ -2897,7 +2897,7 @@ static void write_libraries(WriteData *wd, Main *main)
                        found_one = false;
                        while (tot--) {
                                for (id= lbarray[tot]->first; id; id= id->next) {
-                                       if (id->us>0 && (id->flag & LIB_EXTERN)) {
+                                       if (id->us > 0 && (id->tag & LIB_TAG_EXTERN)) {
                                                found_one = true;
                                                break;
                                        }
@@ -2922,7 +2922,7 @@ static void write_libraries(WriteData *wd, Main *main)
                        
                        while (a--) {
                                for (id= lbarray[a]->first; id; id= id->next) {
-                                       if (id->us>0 && (id->flag & LIB_EXTERN)) {
+                                       if (id->us > 0 && (id->tag & LIB_TAG_EXTERN)) {
                                                if (!BKE_idcode_is_linkable(GS(id->name))) {
                                                        printf("ERROR: write file: datablock '%s' from lib '%s' is not linkable "
                                                               "but is flagged as directly linked", id->name, main->curlib->filepath);
index ac8ac2b9867f4d3df7fe1933813bbde8b911e6fe..30cd6ddf197940f28c2e5819bfd7b20a1bf003cc 100644 (file)
@@ -61,7 +61,7 @@ void SceneExporter::exportHierarchy(Scene *sce)
        // Ensure all objects in the export_set are marked
        for (node = this->export_settings->export_set; node; node = node->next) {
                Object *ob = (Object *) node->link;
-               ob->id.flag |= LIB_DOIT;
+               ob->id.tag |= LIB_TAG_DOIT;
        }
        
        // Now find all exportable base ojects (highest in export hierarchy)
index e71078a0bae565c3dc9a10e2122a05c0be2fa2fe..efdfaadd3e28f525b299e67cfd8e70b9cd29d0f2 100644 (file)
@@ -198,7 +198,7 @@ Object *bc_get_assigned_armature(Object *ob)
 // returns NULL if no ancestor is selected
 // IMPORTANT: This function expects that
 // all exported objects have set:
-// ob->id.flag & LIB_DOIT
+// ob->id.tag & LIB_TAG_DOIT
 Object *bc_get_highest_selected_ancestor_or_self(LinkNode *export_set, Object *ob) 
 {
        Object *ancestor = ob;
@@ -237,17 +237,17 @@ bool bc_has_object_type(LinkNode *export_set, short obtype)
 
 int bc_is_marked(Object *ob)
 {
-       return ob && (ob->id.flag & LIB_DOIT);
+       return ob && (ob->id.tag & LIB_TAG_DOIT);
 }
 
 void bc_remove_mark(Object *ob)
 {
-       ob->id.flag &= ~LIB_DOIT;
+       ob->id.tag &= ~LIB_TAG_DOIT;
 }
 
 void bc_set_mark(Object *ob)
 {
-       ob->id.flag |= LIB_DOIT;
+       ob->id.tag |= LIB_TAG_DOIT;
 }
 
 // Use bubble sort algorithm for sorting the export set
index dedb6e322ba3e6e0f8faefc9fc72da52e7aa2ed7..18c7c5bd8e12100aa9e82b7e8e7096e70f4bed47 100644 (file)
@@ -317,7 +317,7 @@ IDDepsNode *Depsgraph::add_id_node(ID *id, const string &name)
        if (!id_node) {
                DepsNodeFactory *factory = DEG_get_node_factory(DEPSNODE_TYPE_ID_REF);
                id_node = (IDDepsNode *)factory->create_node(id, "", name);
-               id->flag |= LIB_DOIT;
+               id->tag |= LIB_TAG_DOIT;
                /* register */
                this->id_hash[id] = id_node;
        }
index 7a2ee2c416a494b2dfdea73ebb8bf3d5d2ee2425..a62b23bde683cd1e19fa179b2a7dafdd3fb90d41 100644 (file)
@@ -206,7 +206,7 @@ static void deg_graph_build_finalize(Depsgraph *graph)
                        stack.push(node);
                }
                IDDepsNode *id_node = node->owner->owner;
-               id_node->id->flag |= LIB_DOIT;
+               id_node->id->tag |= LIB_TAG_DOIT;
        }
 
        while (!stack.empty()) {
@@ -249,11 +249,11 @@ static void deg_graph_build_finalize(Depsgraph *graph)
                         * update tag.
                         */
                        ID *id = id_node->id;
-                       if (id->flag & LIB_ID_RECALC_ALL &&
-                           id->flag & LIB_DOIT)
+                       if (id->tag & LIB_TAG_ID_RECALC_ALL &&
+                           id->tag & LIB_TAG_DOIT)
                        {
                                id_node->tag_update(graph);
-                               id->flag &= ~LIB_DOIT;
+                               id->tag &= ~LIB_TAG_DOIT;
                        }
                }
        }
index 47aa14c763755416dd3736d35e39c4fbb2145860..87af9c8aceb776dc2dbb52e7ee1bc7ff46e93e6c 100644 (file)
@@ -242,7 +242,7 @@ OperationDepsNode *DepsgraphNodeBuilder::find_operation_node(
 
 void DepsgraphNodeBuilder::build_scene(Main *bmain, Scene *scene)
 {
-       /* LIB_DOIT is used to indicate whether node for given ID was already
+       /* LIB_TAG_DOIT is used to indicate whether node for given ID was already
         * created or not. This flag is being set in add_id_node(), so functions
         * shouldn't bother with setting it, they only might query this flag when
         * needed.
@@ -315,10 +315,10 @@ void DepsgraphNodeBuilder::build_group(Scene *scene,
                                        Group *group)
 {
        ID *group_id = &group->id;
-       if (group_id->flag & LIB_DOIT) {
+       if (group_id->tag & LIB_TAG_DOIT) {
                return;
        }
-       group_id->flag |= LIB_DOIT;
+       group_id->tag |= LIB_TAG_DOIT;
 
        for (GroupObject *go = (GroupObject *)group->gobject.first;
             go != NULL;
@@ -365,7 +365,7 @@ SubgraphDepsNode *DepsgraphNodeBuilder::build_subgraph(Group *group)
 
 void DepsgraphNodeBuilder::build_object(Scene *scene, Base *base, Object *ob)
 {
-       if (ob->id.flag & LIB_DOIT) {
+       if (ob->id.tag & LIB_TAG_DOIT) {
                IDDepsNode *id_node = m_graph->find_id_node(&ob->id);
                id_node->layers = base->lay;
                return;
@@ -430,7 +430,7 @@ void DepsgraphNodeBuilder::build_object(Scene *scene, Base *base, Object *ob)
                        default:
                        {
                                ID *obdata = (ID *)ob->data;
-                               if ((obdata->flag & LIB_DOIT) == 0) {
+                               if ((obdata->tag & LIB_TAG_DOIT) == 0) {
                                        build_animdata(obdata);
                                }
                                break;
@@ -598,7 +598,7 @@ OperationDepsNode *DepsgraphNodeBuilder::build_driver(ID *id, FCurve *fcu)
 void DepsgraphNodeBuilder::build_world(World *world)
 {
        ID *world_id = &world->id;
-       if (world_id->flag & LIB_DOIT) {
+       if (world_id->tag & LIB_TAG_DOIT) {
                return;
        }
 
@@ -961,7 +961,7 @@ void DepsgraphNodeBuilder::build_obdata_geom(Scene *scene, Object *ob)
                // add geometry collider relations
        }
 
-       if (obdata->flag & LIB_DOIT) {
+       if (obdata->tag & LIB_TAG_DOIT) {
                return;
        }
 
@@ -1045,7 +1045,7 @@ void DepsgraphNodeBuilder::build_camera(Object *ob)
        /* TODO: Link scene-camera links in somehow... */
        Camera *cam = (Camera *)ob->data;
        ID *camera_id = &cam->id;
-       if (camera_id->flag & LIB_DOIT) {
+       if (camera_id->tag & LIB_TAG_DOIT) {
                return;
        }
 
@@ -1068,7 +1068,7 @@ void DepsgraphNodeBuilder::build_lamp(Object *ob)
 {
        Lamp *la = (Lamp *)ob->data;
        ID *lamp_id = &la->id;
-       if (lamp_id->flag & LIB_DOIT) {
+       if (lamp_id->tag & LIB_TAG_DOIT) {
                return;
        }
 
@@ -1115,7 +1115,7 @@ void DepsgraphNodeBuilder::build_nodetree(DepsNode *owner_node, bNodeTree *ntree
                        }
                        else if (bnode->type == NODE_GROUP) {
                                bNodeTree *group_ntree = (bNodeTree *)bnode->id;
-                               if ((group_ntree->id.flag & LIB_DOIT) == 0) {
+                               if ((group_ntree->id.tag & LIB_TAG_DOIT) == 0) {
                                        build_nodetree(owner_node, group_ntree);
                                }
                        }
@@ -1129,7 +1129,7 @@ void DepsgraphNodeBuilder::build_nodetree(DepsNode *owner_node, bNodeTree *ntree
 void DepsgraphNodeBuilder::build_material(DepsNode *owner_node, Material *ma)
 {
        ID *ma_id = &ma->id;
-       if (ma_id->flag & LIB_DOIT) {
+       if (ma_id->tag & LIB_TAG_DOIT) {
                return;
        }
 
@@ -1167,10 +1167,10 @@ void DepsgraphNodeBuilder::build_texture_stack(DepsNode *owner_node, MTex **text
 void DepsgraphNodeBuilder::build_texture(DepsNode *owner_node, Tex *tex)
 {
        ID *tex_id = &tex->id;
-       if (tex_id->flag & LIB_DOIT) {
+       if (tex_id->tag & LIB_TAG_DOIT) {
                return;
        }
-       tex_id->flag |= LIB_DOIT;
+       tex_id->tag |= LIB_TAG_DOIT;
        /* texture itself */
        build_animdata(tex_id);
        /* texture's nodetree */
index 2a0dd6f9439a22b701cf00c0c73b34ac23318379..b0eed963aba34b66f8ff15023cf7def52aa47288 100644 (file)
@@ -240,7 +240,7 @@ void DepsgraphRelationBuilder::add_operation_relation(
 
 void DepsgraphRelationBuilder::build_scene(Main *bmain, Scene *scene)
 {
-       /* LIB_DOIT is used to indicate whether node for given ID was already
+       /* LIB_TAG_DOIT is used to indicate whether node for given ID was already
         * created or not.
         */
        BKE_main_id_tag_all(bmain, false);
@@ -305,7 +305,7 @@ void DepsgraphRelationBuilder::build_group(Main *bmain,
                                            Group *group)
 {
        ID *group_id = &group->id;
-       bool group_done = (group_id->flag & LIB_DOIT) != 0;
+       bool group_done = (group_id->tag & LIB_TAG_DOIT) != 0;
        OperationKey object_local_transform_key(&object->id,
                                                DEPSNODE_TYPE_TRANSFORM,
                                                DEG_OPCODE_TRANSFORM_LOCAL);
@@ -322,12 +322,12 @@ void DepsgraphRelationBuilder::build_group(Main *bmain,
                             DEPSREL_TYPE_TRANSFORM,
                             "Dupligroup");
        }
-       group_id->flag |= LIB_DOIT;
+       group_id->tag |= LIB_TAG_DOIT;
 }
 
 void DepsgraphRelationBuilder::build_object(Main *bmain, Scene *scene, Object *ob)
 {
-       if (ob->id.flag & LIB_DOIT) {
+       if (ob->id.tag & LIB_TAG_DOIT) {
                return;
        }
 
@@ -910,10 +910,10 @@ void DepsgraphRelationBuilder::build_driver(ID *id, FCurve *fcu)
 void DepsgraphRelationBuilder::build_world(World *world)
 {
        ID *world_id = &world->id;
-       if (world_id->flag & LIB_DOIT) {
+       if (world_id->tag & LIB_TAG_DOIT) {
                return;
        }
-       world_id->flag |= LIB_DOIT;
+       world_id->tag |= LIB_TAG_DOIT;
 
        build_animdata(world_id);
 
@@ -1631,10 +1631,10 @@ void DepsgraphRelationBuilder::build_obdata_geom(Main *bmain, Scene *scene, Obje
                }
        }
 
-       if (obdata->flag & LIB_DOIT) {
+       if (obdata->tag & LIB_TAG_DOIT) {
                return;
        }
-       obdata->flag |= LIB_DOIT;
+       obdata->tag |= LIB_TAG_DOIT;
 
        /* Link object data evaluation node to exit operation. */
        OperationKey obdata_geom_eval_key(obdata, DEPSNODE_TYPE_GEOMETRY, DEG_OPCODE_PLACEHOLDER, "Geometry Eval");
@@ -1718,10 +1718,10 @@ void DepsgraphRelationBuilder::build_camera(Object *ob)
 {
        Camera *cam = (Camera *)ob->data;
        ID *camera_id = &cam->id;
-       if (camera_id->flag & LIB_DOIT) {
+       if (camera_id->tag & LIB_TAG_DOIT) {
                return;
        }
-       camera_id->flag |= LIB_DOIT;
+       camera_id->tag |= LIB_TAG_DOIT;
 
        ComponentKey parameters_key(camera_id, DEPSNODE_TYPE_PARAMETERS);
 
@@ -1744,10 +1744,10 @@ void DepsgraphRelationBuilder::build_lamp(Object *ob)
 {
        Lamp *la = (Lamp *)ob->data;
        ID *lamp_id = &la->id;
-       if (lamp_id->flag & LIB_DOIT) {
+       if (lamp_id->tag & LIB_TAG_DOIT) {
                return;
        }
-       lamp_id->flag |= LIB_DOIT;
+       lamp_id->tag |= LIB_TAG_DOIT;
 
        ComponentKey parameters_key(lamp_id, DEPSNODE_TYPE_PARAMETERS);
 
@@ -1794,9 +1794,9 @@ void DepsgraphRelationBuilder::build_nodetree(ID *owner, bNodeTree *ntree)
                        }
                        else if (bnode->type == NODE_GROUP) {
                                bNodeTree *group_ntree = (bNodeTree *)bnode->id;
-                               if ((group_ntree->id.flag & LIB_DOIT) == 0) {
+                               if ((group_ntree->id.tag & LIB_TAG_DOIT) == 0) {
                                        build_nodetree(owner, group_ntree);
-                                       group_ntree->id.flag |= LIB_DOIT;
+                                       group_ntree->id.tag |= LIB_TAG_DOIT;
                                }
                                OperationKey group_parameters_key(&group_ntree->id,
                                                                  DEPSNODE_TYPE_PARAMETERS,
@@ -1821,10 +1821,10 @@ void DepsgraphRelationBuilder::build_nodetree(ID *owner, bNodeTree *ntree)
 void DepsgraphRelationBuilder::build_material(ID *owner, Material *ma)
 {
        ID *ma_id = &ma->id;
-       if (ma_id->flag & LIB_DOIT) {
+       if (ma_id->tag & LIB_TAG_DOIT) {
                return;
        }
-       ma_id->flag |= LIB_DOIT;
+       ma_id->tag |= LIB_TAG_DOIT;
 
        /* animation */
        build_animdata(ma_id);
@@ -1840,10 +1840,10 @@ void DepsgraphRelationBuilder::build_material(ID *owner, Material *ma)
 void DepsgraphRelationBuilder::build_texture(ID *owner, Tex *tex)
 {
        ID *tex_id = &tex->id;
-       if (tex_id->flag & LIB_DOIT) {
+       if (tex_id->tag & LIB_TAG_DOIT) {
                return;
        }
-       tex_id->flag |= LIB_DOIT;
+       tex_id->tag |= LIB_TAG_DOIT;
 
        /* texture itself */
        build_animdata(tex_id);
index a635cb670c7e31ce367e6a1e4e041e7593110417..42399cce3a5a86c377aacd24d63b804775976ab5 100644 (file)
@@ -76,13 +76,13 @@ namespace {
 
 void lib_id_recalc_tag(Main *bmain, ID *id)
 {
-       id->flag |= LIB_ID_RECALC;
+       id->tag |= LIB_TAG_ID_RECALC;
        DEG_id_type_tag(bmain, GS(id->name));
 }
 
 void lib_id_recalc_data_tag(Main *bmain, ID *id)
 {
-       id->flag |= LIB_ID_RECALC_DATA;
+       id->tag |= LIB_TAG_ID_RECALC_DATA;
        DEG_id_type_tag(bmain, GS(id->name));
 }
 
@@ -412,16 +412,16 @@ void DEG_graph_on_visible_update(Main *bmain, Scene *scene)
        wmWindowManager *wm = (wmWindowManager *)bmain->wm.first;
        int old_layers = graph->layers;
        if (wm != NULL) {
-               BKE_main_id_flag_listbase(&bmain->scene, LIB_DOIT, true);
+               BKE_main_id_flag_listbase(&bmain->scene, LIB_TAG_DOIT, true);
                graph->layers = 0;
                for (wmWindow *win = (wmWindow *)wm->windows.first;
                     win != NULL;
                     win = (wmWindow *)win->next)
                {
                        Scene *scene = win->screen->scene;
-                       if (scene->id.flag & LIB_DOIT) {
+                       if (scene->id.tag & LIB_TAG_DOIT) {
                                graph->layers |= BKE_screen_visible_layers(win->screen, scene);
-                               scene->id.flag &= ~LIB_DOIT;
+                               scene->id.tag &= ~LIB_TAG_DOIT;
                        }
                }
        }
@@ -443,7 +443,7 @@ void DEG_graph_on_visible_update(Main *bmain, Scene *scene)
                        OperationDepsNode *node = *it;
                        IDDepsNode *id_node = node->owner->owner;
                        ID *id = id_node->id;
-                       if ((id->flag & LIB_ID_RECALC_ALL) != 0 ||
+                       if ((id->tag & LIB_TAG_ID_RECALC_ALL) != 0 ||
                            (id_node->layers & scene->lay_updated) == 0)
                        {
                                id_node->tag_update(graph);
@@ -455,7 +455,7 @@ void DEG_graph_on_visible_update(Main *bmain, Scene *scene)
                         */
                        if (GS(id->name) == ID_OB) {
                                Object *object = (Object *)id;
-                               if ((id->flag & LIB_ID_RECALC_ALL) == 0 &&
+                               if ((id->tag & LIB_TAG_ID_RECALC_ALL) == 0 &&
                                    (object->recalc & OB_RECALC_ALL) != 0)
                                {
                                        id_node->tag_update(graph);
@@ -531,12 +531,12 @@ void DEG_ids_clear_recalc(Main *bmain)
                 */
                if (id && bmain->id_tag_update[(unsigned char)id->name[0]]) {
                        for (; id; id = (ID *)id->next) {
-                               id->flag &= ~(LIB_ID_RECALC | LIB_ID_RECALC_DATA);
+                               id->tag &= ~(LIB_TAG_ID_RECALC | LIB_TAG_ID_RECALC_DATA);
 
                                /* Some ID's contain semi-datablock nodetree */
                                ntree = ntreeFromID(id);
                                if (ntree != NULL) {
-                                       ntree->id.flag &= ~(LIB_ID_RECALC | LIB_ID_RECALC_DATA);
+                                       ntree->id.tag &= ~(LIB_TAG_ID_RECALC | LIB_TAG_ID_RECALC_DATA);
                                }
                        }
                }
index 51b5a366861cf50c5748f2621d261876298d556a..2778a458ca0b8621d4e1027d3c45e943b94790b1 100644 (file)
@@ -1828,7 +1828,7 @@ static size_t animdata_filter_ds_linestyle(bAnimContext *ac, ListBase *anim_data
        for (srl = sce->r.layers.first; srl; srl = srl->next) {
                for (lineset = srl->freestyleConfig.linesets.first; lineset; lineset = lineset->next) {
                        if (lineset->linestyle) {
-                               lineset->linestyle->id.flag |= LIB_DOIT;
+                               lineset->linestyle->id.tag |= LIB_TAG_DOIT;
                        }
                }
        }
@@ -1845,11 +1845,11 @@ static size_t animdata_filter_ds_linestyle(bAnimContext *ac, ListBase *anim_data
                        size_t tmp_items = 0;
 
                        if ((linestyle == NULL) ||
-                           !(linestyle->id.flag & LIB_DOIT))
+                           !(linestyle->id.tag & LIB_TAG_DOIT))
                        {
                                continue;
                        }
-                       linestyle->id.flag &= ~LIB_DOIT;
+                       linestyle->id.tag &= ~LIB_TAG_DOIT;
                        
                        /* add scene-level animation channels */
                        BEGIN_ANIMFILTER_SUBCHANNELS(FILTER_LS_SCED(linestyle))
index 6ac657fa7a3b997bc14f0e296cee4c1ec8e69c64..346c0879a787bc044fc7c3af2e5ee354518a5f1c 100644 (file)
@@ -358,7 +358,7 @@ bool UI_context_copy_to_selected_list(
                                        Object *ob = link->ptr.id.data;
                                        if (ob->data) {
                                                ID *id_data = ob->data;
-                                               id_data->flag |= LIB_DOIT;
+                                               id_data->tag |= LIB_TAG_DOIT;
                                        }
                                }
 
@@ -368,7 +368,7 @@ bool UI_context_copy_to_selected_list(
                                        link_next = link->next;
 
                                        if ((id_data == NULL) ||
-                                           (id_data->flag & LIB_DOIT) == 0 ||
+                                           (id_data->tag & LIB_TAG_DOIT) == 0 ||
                                            (id_data->lib) ||
                                            (GS(id_data->name) != id_code))
                                        {
@@ -381,7 +381,7 @@ bool UI_context_copy_to_selected_list(
                                        }
 
                                        if (id_data) {
-                                               id_data->flag &= ~LIB_DOIT;
+                                               id_data->tag &= ~LIB_TAG_DOIT;
                                        }
                                }
                        }
index 09422a0ebd3a6c92f85da15dc030acd637bb05e1..b53fa270898e7ce6f07e25edc13fcf62178e8809 100644 (file)
@@ -436,7 +436,7 @@ static void template_ID(
                if (user_alert) UI_but_flag_enable(but, UI_BUT_REDALERT);
 
                if (id->lib) {
-                       if (id->flag & LIB_INDIRECT) {
+                       if (id->tag & LIB_TAG_INDIRECT) {
                                but = uiDefIconBut(block, UI_BTYPE_BUT, 0, ICON_LIBRARY_DATA_INDIRECT, 0, 0, UI_UNIT_X, UI_UNIT_Y,
                                                   NULL, 0, 0, 0, 0, TIP_("Indirect library datablock, cannot change"));
                                UI_but_flag_enable(but, UI_BUT_DISABLED);
index 656869f9dec7b69ba599ef09e1059c59f36dd8c7..b9f20b6740fc044f9c75c43dfee52db695c60fa4 100644 (file)
@@ -113,7 +113,7 @@ void EDBM_redo_state_free(BMBackup *backup, BMEditMesh *em, int recalctess)
  * see: [#31811] */
 void EDBM_mesh_ensure_valid_dm_hack(Scene *scene, BMEditMesh *em)
 {
-       if ((((ID *)em->ob->data)->flag & LIB_ID_RECALC) ||
+       if ((((ID *)em->ob->data)->tag & LIB_TAG_ID_RECALC) ||
            (em->ob->recalc & OB_RECALC_DATA))
        {
                /* since we may not have done selection flushing */
index 7650be941d4b1dc4f23d1e0c36766095669a0d41..1cab8918abc534053dbd35065f03362d0c2ad75c 100644 (file)
@@ -1159,12 +1159,12 @@ static int object_delete_exec(bContext *C, wmOperator *op)
                return OPERATOR_CANCELLED;
 
        /* delete has to handle all open scenes */
-       BKE_main_id_flag_listbase(&bmain->scene, LIB_DOIT, 1);
+       BKE_main_id_flag_listbase(&bmain->scene, LIB_TAG_DOIT, 1);
        for (win = wm->windows.first; win; win = win->next) {
                scene = win->screen->scene;
                
-               if (scene->id.flag & LIB_DOIT) {
-                       scene->id.flag &= ~LIB_DOIT;
+               if (scene->id.tag & LIB_TAG_DOIT) {
+                       scene->id.tag &= ~LIB_TAG_DOIT;
                        
                        DAG_relations_tag_update(bmain);
 
@@ -1545,7 +1545,7 @@ static int convert_exec(bContext *C, wmOperator *op)
 
                        /* flag data thats not been edited (only needed for !keep_original) */
                        if (ob->data) {
-                               ((ID *)ob->data)->flag |= LIB_DOIT;
+                               ((ID *)ob->data)->tag |= LIB_TAG_DOIT;
                        }
 
                        /* possible metaball basis is not in this scene */
@@ -1791,7 +1791,7 @@ static int convert_exec(bContext *C, wmOperator *op)
 
                if (!keep_original && (ob->flag & OB_DONE)) {
                        DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
-                       ((ID *)ob->data)->flag &= ~LIB_DOIT; /* flag not to convert this datablock again */
+                       ((ID *)ob->data)->tag &= ~LIB_TAG_DOIT; /* flag not to convert this datablock again */
                }
        }
        CTX_DATA_END;
index ecaa05ace99dfa56171df6c682b14f87bdcf250c..888bf83204261e5d086a61075430f1a5bc17dd53 100644 (file)
@@ -267,7 +267,7 @@ static void clear_single_image(Image *image, ClearFlag flag)
        const float disp_alpha[4] = {0.5f, 0.5f, 0.5f, 0.0f};
        const float disp_solid[4] = {0.5f, 0.5f, 0.5f, 1.0f};
 
-       if ((image->id.flag & LIB_DOIT) == 0) {
+       if ((image->id.tag & LIB_TAG_DOIT) == 0) {
                ImBuf *ibuf = BKE_image_acquire_ibuf(image, NULL, NULL);
 
                if (flag == CLEAR_TANGENT_NORMAL)
@@ -277,7 +277,7 @@ static void clear_single_image(Image *image, ClearFlag flag)
                else
                        IMB_rectfill(ibuf, (ibuf->planes == R_IMF_PLANES_RGBA) ? vec_alpha : vec_solid);
 
-               image->id.flag |= LIB_DOIT;
+               image->id.tag |= LIB_TAG_DOIT;
 
                BKE_image_release_ibuf(image, ibuf, NULL);
        }
@@ -288,7 +288,7 @@ static void clear_images_poly(MTexPoly *mtpoly, int totpoly, ClearFlag flag)
        int a;
 
        for (a = 0; a < totpoly; a++) {
-               mtpoly[a].tpage->id.flag &= ~LIB_DOIT;
+               mtpoly[a].tpage->id.tag &= ~LIB_TAG_DOIT;
        }
 
        for (a = 0; a < totpoly; a++) {
@@ -296,7 +296,7 @@ static void clear_images_poly(MTexPoly *mtpoly, int totpoly, ClearFlag flag)
        }
 
        for (a = 0; a < totpoly; a++) {
-               mtpoly[a].tpage->id.flag &= ~LIB_DOIT;
+               mtpoly[a].tpage->id.tag &= ~LIB_TAG_DOIT;
        }
 }
 
@@ -670,7 +670,7 @@ static void finish_bake_internal(BakeRender *bkr)
                Mesh *me;
                BLI_assert(BLI_thread_is_main());
                for (me = G.main->mesh.first; me; me = me->id.next) {
-                       if (me->id.flag & LIB_DOIT) {
+                       if (me->id.tag & LIB_TAG_DOIT) {
                                DAG_id_tag_update(&me->id, OB_RECALC_DATA);
                                BKE_mesh_tessface_clear(me);
                        }
index e69f6174c98141e3d336157e63a76f17b9878963..93f9856b51a30cda7f881c1e66252e422c332e70 100644 (file)
@@ -421,7 +421,7 @@ static bool bake_object_check(Object *ob, ReportList *reports)
                        return false;
                }
 
-               image->id.flag |= LIB_DOIT;
+               image->id.tag |= LIB_TAG_DOIT;
        }
        return true;
 }
@@ -478,7 +478,7 @@ static void bake_images_clear(Main *bmain, const bool is_tangent)
 {
        Image *image;
        for (image = bmain->image.first; image; image = image->id.next) {
-               if ((image->id.flag & LIB_DOIT) != 0) {
+               if ((image->id.tag & LIB_TAG_DOIT) != 0) {
                        RE_bake_ibuf_clear(image, is_tangent);
                }
        }
@@ -497,7 +497,7 @@ static void build_image_lookup(Main *bmain, Object *ob, BakeImages *bake_images)
                Image *image;
                ED_object_get_active_image(ob, i + 1, &image, NULL, NULL, NULL);
 
-               if ((image->id.flag & LIB_DOIT)) {
+               if ((image->id.tag & LIB_TAG_DOIT)) {
                        for (j = 0; j < i; j++) {
                                if (bake_images->data[j].image == image) {
                                        bake_images->lookup[i] = j;
@@ -508,7 +508,7 @@ static void build_image_lookup(Main *bmain, Object *ob, BakeImages *bake_images)
                else {
                        bake_images->lookup[i] = tot_images;
                        bake_images->data[tot_images].image = image;
-                       image->id.flag |= LIB_DOIT;
+                       image->id.tag |= LIB_TAG_DOIT;
                        tot_images++;
                }
        }
index ac1935e9652c608a664b52af5ac6f2a0c53b40dc..47ee6752e51436006bcb4fcfe0f6b7514ecd708a 100644 (file)
@@ -304,11 +304,11 @@ static void data_transfer_exec_preprocess_objects(
                        /* Do not transfer to linked data, not supported. */
                        BKE_reportf(op->reports, RPT_WARNING, "Skipping object '%s', linked data '%s' cannot be modified",
                                    ob->id.name + 2, me->id.name + 2);
-                       me->id.flag &= ~LIB_DOIT;
+                       me->id.tag &= ~LIB_TAG_DOIT;
                        continue;
                }
 
-               me->id.flag |= LIB_DOIT;
+               me->id.tag |= LIB_TAG_DOIT;
        }
 }
 
@@ -326,8 +326,8 @@ static bool data_transfer_exec_is_object_valid(
        }
 
        me = ob_dst->data;
-       if (me->id.flag & LIB_DOIT) {
-               me->id.flag &= ~LIB_DOIT;
+       if (me->id.tag & LIB_TAG_DOIT) {
+               me->id.tag &= ~LIB_TAG_DOIT;
                return true;
        }
        else if (me->id.lib == NULL) {
index a1f59166c819cc6a8cc0dfcc0f65c2d03a09b44b..32a7806907b20b417721ef0d0dcbfe5cef086039 100644 (file)
@@ -1959,7 +1959,7 @@ static void single_mat_users(Scene *scene, const int flag, const bool do_texture
                        for (a = 1; a <= ob->totcol; a++) {
                                ma = give_current_material(ob, a);
                                if (ma) {
-                                       /* do not test for LIB_NEW: this functions guaranteed delivers single_users! */
+                                       /* do not test for LIB_TAG_NEW: this functions guaranteed delivers single_users! */
 
                                        if (ma->id.us > 1) {
                                                man = BKE_material_copy(ma);
@@ -2010,14 +2010,14 @@ static void do_single_tex_user(Tex **from)
 
 static void single_tex_users_expand(Main *bmain)
 {
-       /* only when 'parent' blocks are LIB_NEW */
+       /* only when 'parent' blocks are LIB_TAG_NEW */
        Material *ma;
        Lamp *la;
        World *wo;
        int b;
 
        for (ma = bmain->mat.first; ma; ma = ma->id.next) {
-               if (ma->id.flag & LIB_NEW) {
+               if (ma->id.tag & LIB_TAG_NEW) {
                        for (b = 0; b < MAX_MTEX; b++) {
                                if (ma->mtex[b] && ma->mtex[b]->tex) {
                                        do_single_tex_user(&(ma->mtex[b]->tex));
@@ -2027,7 +2027,7 @@ static void single_tex_users_expand(Main *bmain)
        }
 
        for (la = bmain->lamp.first; la; la = la->id.next) {
-               if (la->id.flag & LIB_NEW) {
+               if (la->id.tag & LIB_TAG_NEW) {
                        for (b = 0; b < MAX_MTEX; b++) {
                                if (la->mtex[b] && la->mtex[b]->tex) {
                                        do_single_tex_user(&(la->mtex[b]->tex));
@@ -2037,7 +2037,7 @@ static void single_tex_users_expand(Main *bmain)
        }
 
        for (wo = bmain->world.first; wo; wo = wo->id.next) {
-               if (wo->id.flag & LIB_NEW) {
+               if (wo->id.tag & LIB_TAG_NEW) {
                        for (b = 0; b < MAX_MTEX; b++) {
                                if (wo->mtex[b] && wo->mtex[b]->tex) {
                                        do_single_tex_user(&(wo->mtex[b]->tex));
@@ -2049,7 +2049,7 @@ static void single_tex_users_expand(Main *bmain)
 
 static void single_mat_users_expand(Main *bmain)
 {
-       /* only when 'parent' blocks are LIB_NEW */
+       /* only when 'parent' blocks are LIB_TAG_NEW */
        Object *ob;
        Mesh *me;
        Curve *cu;
@@ -2058,24 +2058,24 @@ static void single_mat_users_expand(Main *bmain)
        int a;
 
        for (ob = bmain->object.first; ob; ob = ob->id.next)
-               if (ob->id.flag & LIB_NEW)
+               if (ob->id.tag & LIB_TAG_NEW)
                        new_id_matar(ob->mat, ob->totcol);
 
        for (me = bmain->mesh.first; me; me = me->id.next)
-               if (me->id.flag & LIB_NEW)
+               if (me->id.tag & LIB_TAG_NEW)
                        new_id_matar(me->mat, me->totcol);
 
        for (cu = bmain->curve.first; cu; cu = cu->id.next)
-               if (cu->id.flag & LIB_NEW)
+               if (cu->id.tag & LIB_TAG_NEW)
                        new_id_matar(cu->mat, cu->totcol);
 
        for (mb = bmain->mball.first; mb; mb = mb->id.next)
-               if (mb->id.flag & LIB_NEW)
+               if (mb->id.tag & LIB_TAG_NEW)
                        new_id_matar(mb->mat, mb->totcol);
 
        /* material imats  */
        for (ma = bmain->mat.first; ma; ma = ma->id.next)
-               if (ma->id.flag & LIB_NEW)
+               if (ma->id.tag & LIB_TAG_NEW)
                        for (a = 0; a < MAX_MTEX; a++)
                                if (ma->mtex[a])
                                        ID_NEW(ma->mtex[a]->object);
@@ -2126,7 +2126,7 @@ enum {
 static bool tag_localizable_looper(void *UNUSED(user_data), ID **id_pointer, const int UNUSED(cd_flag))
 {
        if (*id_pointer) {
-               (*id_pointer)->flag &= ~LIB_DOIT;
+               (*id_pointer)->tag &= ~LIB_TAG_DOIT;
        }
        return true;
 }
@@ -2137,19 +2137,19 @@ static void tag_localizable_objects(bContext *C, const int mode)
 
        BKE_main_id_tag_all(bmain, false);
 
-       /* Set LIB_DOIT flag for all selected objects, so next we can check whether
+       /* Set LIB_TAG_DOIT flag for all selected objects, so next we can check whether
         * object is gonna to become local or not.
         */
        CTX_DATA_BEGIN (C, Object *, object, selected_objects)
        {
-               object->id.flag |= LIB_DOIT;
+               object->id.tag |= LIB_TAG_DOIT;
 
                /* If data is also gonna to become local, mark data we're interested in
                 * as gonna-to-be-local.
                 */
                if (mode == MAKE_LOCAL_SELECT_OBDATA && object->data) {
                        ID *data_id = (ID *) object->data;
-                       data_id->flag |= LIB_DOIT;
+                       data_id->tag |= LIB_TAG_DOIT;
                }
        }
        CTX_DATA_END;
@@ -2158,12 +2158,12 @@ static void tag_localizable_objects(bContext *C, const int mode)
         * them for modifiers or constraints.
         */
        for (Object *object = bmain->object.first; object; object = object->id.next) {
-               if ((object->id.flag & LIB_DOIT) == 0) {
+               if ((object->id.tag & LIB_TAG_DOIT) == 0) {
                        BKE_library_foreach_ID_link(&object->id, tag_localizable_looper, NULL, IDWALK_READONLY);
                }
                if (object->data) {
                        ID *data_id = (ID *) object->data;
-                       if ((data_id->flag & LIB_DOIT) == 0) {
+                       if ((data_id->tag & LIB_TAG_DOIT) == 0) {
                                BKE_library_foreach_ID_link(data_id, tag_localizable_looper, NULL, IDWALK_READONLY);
                        }
                }
@@ -2230,7 +2230,7 @@ static int make_local_exec(bContext *C, wmOperator *op)
 
        CTX_DATA_BEGIN (C, Object *, ob, selected_objects)
        {
-               if ((ob->id.flag & LIB_DOIT) == 0) {
+               if ((ob->id.tag & LIB_TAG_DOIT) == 0) {
                        continue;
                }
 
@@ -2250,7 +2250,7 @@ static int make_local_exec(bContext *C, wmOperator *op)
 
        CTX_DATA_BEGIN (C, Object *, ob, selected_objects)
        {
-               if ((ob->id.flag & LIB_DOIT) == 0) {
+               if ((ob->id.tag & LIB_TAG_DOIT) == 0) {
                        continue;
                }
 
@@ -2283,7 +2283,7 @@ static int make_local_exec(bContext *C, wmOperator *op)
        if (mode == MAKE_LOCAL_SELECT_OBDATA_MATERIAL) {
                CTX_DATA_BEGIN (C, Object *, ob, selected_objects)
                {
-                       if ((ob->id.flag & LIB_DOIT) == 0) {
+                       if ((ob->id.tag & LIB_TAG_DOIT) == 0) {
                                continue;
                        }
 
index 8f00c0eb467c6328974e6edbe801ce213f720838..d2bbb73b5972b649302847ca12a5bc6e3fb23322 100644 (file)
@@ -768,9 +768,9 @@ static int object_origin_set_exec(bContext *C, wmOperator *op)
 
        for (tob = bmain->object.first; tob; tob = tob->id.next) {
                if (tob->data)
-                       ((ID *)tob->data)->flag &= ~LIB_DOIT;
+                       ((ID *)tob->data)->tag &= ~LIB_TAG_DOIT;
                if (tob->dup_group)
-                       ((ID *)tob->dup_group)->flag &= ~LIB_DOIT;
+                       ((ID *)tob->dup_group)->tag &= ~LIB_TAG_DOIT;
        }
 
        for (ctx_ob = ctx_data_list.first;
@@ -791,7 +791,7 @@ static int object_origin_set_exec(bContext *C, wmOperator *op)
                        
                        if (ob->data == NULL) {
                                /* special support for dupligroups */
-                               if ((ob->transflag & OB_DUPLIGROUP) && ob->dup_group && (ob->dup_group->id.flag & LIB_DOIT) == 0) {
+                               if ((ob->transflag & OB_DUPLIGROUP) && ob->dup_group && (ob->dup_group->id.tag & LIB_TAG_DOIT) == 0) {
                                        if (ob->dup_group->id.lib) {
                                                tot_lib_error++;
                                        }
@@ -812,7 +812,7 @@ static int object_origin_set_exec(bContext *C, wmOperator *op)
                                                add_v3_v3(ob->dup_group->dupli_ofs, cent);
 
                                                tot_change++;
-                                               ob->dup_group->id.flag |= LIB_DOIT;
+                                               ob->dup_group->id.tag |= LIB_TAG_DOIT;
                                                do_inverse_offset = true;
                                        }
                                }
@@ -833,7 +833,7 @@ static int object_origin_set_exec(bContext *C, wmOperator *op)
                                BKE_mesh_translate(me, cent_neg, 1);
 
                                tot_change++;
-                               me->id.flag |= LIB_DOIT;
+                               me->id.tag |= LIB_TAG_DOIT;
                                do_inverse_offset = true;
                        }
                        else if (ELEM(ob->type, OB_CURVE, OB_SURF)) {
@@ -851,7 +851,7 @@ static int object_origin_set_exec(bContext *C, wmOperator *op)
                                BKE_curve_translate(cu, cent_neg, 1);
 
                                tot_change++;
-                               cu->id.flag |= LIB_DOIT;
+                               cu->id.tag |= LIB_TAG_DOIT;
                                do_inverse_offset = true;
 
                                if (obedit) {
@@ -885,7 +885,7 @@ static int object_origin_set_exec(bContext *C, wmOperator *op)
                                        cu->yof = cu->yof - (cent[1] / cu->fsize);
 
                                        tot_change++;
-                                       cu->id.flag |= LIB_DOIT;
+                                       cu->id.tag |= LIB_TAG_DOIT;
                                        do_inverse_offset = true;
                                }
                        }
@@ -906,7 +906,7 @@ static int object_origin_set_exec(bContext *C, wmOperator *op)
                                        ED_armature_origin_set(scene, ob, cursor, centermode, around);
 
                                        tot_change++;
-                                       arm->id.flag |= LIB_DOIT;
+                                       arm->id.tag |= LIB_TAG_DOIT;
                                        /* do_inverse_offset = true; */ /* docenter_armature() handles this */
 
                                        BKE_object_where_is_calc(scene, ob);
@@ -929,7 +929,7 @@ static int object_origin_set_exec(bContext *C, wmOperator *op)
                                BKE_mball_translate(mb, cent_neg);
 
                                tot_change++;
-                               mb->id.flag |= LIB_DOIT;
+                               mb->id.tag |= LIB_TAG_DOIT;
                                do_inverse_offset = true;
 
                                if (obedit) {
@@ -950,7 +950,7 @@ static int object_origin_set_exec(bContext *C, wmOperator *op)
                                BKE_lattice_translate(lt, cent_neg, 1);
 
                                tot_change++;
-                               lt->id.flag |= LIB_DOIT;
+                               lt->id.tag |= LIB_TAG_DOIT;
                                do_inverse_offset = true;
                        }
 
@@ -1011,7 +1011,7 @@ static int object_origin_set_exec(bContext *C, wmOperator *op)
        BLI_freelistN(&ctx_data_list);
 
        for (tob = bmain->object.first; tob; tob = tob->id.next)
-               if (tob->data && (((ID *)tob->data)->flag & LIB_DOIT))
+               if (tob->data && (((ID *)tob->data)->tag & LIB_TAG_DOIT))
                        DAG_id_tag_update(&tob->id, OB_RECALC_OB | OB_RECALC_DATA);
 
        if (tot_change) {
index a7038ac53ccec5039b22ae4cc55debcb241e9ee7..143003cc4e613fddc33947f53685d99f0cb99cf2 100644 (file)
@@ -786,7 +786,7 @@ static void clean_viewport_memory(Main *bmain, Scene *scene, int renderlay)
        Base *base;
 
        for (object = bmain->object.first; object; object = object->id.next) {
-               object->id.flag |= LIB_DOIT;
+               object->id.tag |= LIB_TAG_DOIT;
        }
 
        for (SETLOOPER(scene, sce_iter, base)) {
@@ -794,16 +794,16 @@ static void clean_viewport_memory(Main *bmain, Scene *scene, int renderlay)
                        continue;
                }
                if (RE_allow_render_generic_object(base->object)) {
-                       base->object->id.flag &= ~LIB_DOIT;
+                       base->object->id.tag &= ~LIB_TAG_DOIT;
                }
        }
 
        for (SETLOOPER(scene, sce_iter, base)) {
                object = base->object;
-               if ((object->id.flag & LIB_DOIT) == 0) {
+               if ((object->id.tag & LIB_TAG_DOIT) == 0) {
                        continue;
                }
-               object->id.flag &= ~LIB_DOIT;
+               object->id.tag &= ~LIB_TAG_DOIT;
 
                BKE_object_free_derived_caches(object);
        }
index a312888fc44054884c9b39fe01091526099c0935..ba5bea464d9393a0080595ef5b6cbc338c8621c1 100644 (file)
@@ -1317,15 +1317,15 @@ static int node_read_renderlayers_exec(bContext *C, wmOperator *UNUSED(op))
 
        /* first tag scenes unread */
        for (scene = bmain->scene.first; scene; scene = scene->id.next)
-               scene->id.flag |= LIB_DOIT;
+               scene->id.tag |= LIB_TAG_DOIT;
 
        for (node = snode->edittree->nodes.first; node; node = node->next) {
                if (node->type == CMP_NODE_R_LAYERS) {
                        ID *id = node->id;
-                       if (id->flag & LIB_DOIT) {
+                       if (id->tag & LIB_TAG_DOIT) {
                                RE_ReadRenderResult(curscene, (Scene *)id);
                                ntreeCompositTagRender((Scene *)id);
-                               id->flag &= ~LIB_DOIT;
+                               id->tag &= ~LIB_TAG_DOIT;
                        }
                }
        }
index 14f397f61fe3be06b2c8398459de563cb2c5b6df..09c9f88c55ffcdc31fd3f3809100179962f332d0 100644 (file)
@@ -1319,7 +1319,7 @@ static void tselem_draw_icon(uiBlock *block, int xmax, float x, float y, TreeSto
                        case ID_GR:
                                tselem_draw_icon_uibut(&arg, ICON_GROUP); break;
                        case ID_LI:
-                               if (tselem->id->flag & LIB_MISSING) {
+                               if (tselem->id->tag & LIB_TAG_MISSING) {
                                        tselem_draw_icon_uibut(&arg, ICON_LIBRARY_DATA_BROKEN);
                                }
                                else if (((Library *)tselem->id)->parent) {
@@ -1563,10 +1563,10 @@ static void outliner_draw_tree_element(
                
                if (tselem->type == 0 && tselem->id->lib) {
                        glPixelTransferf(GL_ALPHA_SCALE, 0.5f);
-                       if (tselem->id->flag & LIB_MISSING) {
+                       if (tselem->id->tag & LIB_TAG_MISSING) {
                                UI_icon_draw((float)startx + offsx, (float)*starty + 2 * ufac, ICON_LIBRARY_DATA_BROKEN);
                        }
-                       else if (tselem->id->flag & LIB_INDIRECT) {
+                       else if (tselem->id->tag & LIB_TAG_INDIRECT) {
                                UI_icon_draw((float)startx + offsx, (float)*starty + 2 * ufac, ICON_LIBRARY_DATA_INDIRECT);
                        }
                        else {
index e2f5747da8eba6042e3c6a018b16ebdbcbf1a0aa..6e4e8e53510aa38e3f70a3612f330bed14ab7ca8 100644 (file)
@@ -408,7 +408,7 @@ static void object_delete_cb(bContext *C, Scene *scene, TreeElement *te,
 static void id_local_cb(bContext *C, Scene *UNUSED(scene), TreeElement *UNUSED(te),
                         TreeStoreElem *UNUSED(tsep), TreeStoreElem *tselem, void *UNUSED(user_data))
 {
-       if (tselem->id->lib && (tselem->id->flag & LIB_EXTERN)) {
+       if (tselem->id->lib && (tselem->id->tag & LIB_TAG_EXTERN)) {
                /* if the ID type has no special local function,
                 * just clear the lib */
                if (id_make_local(tselem->id, false) == false) {
index f2d8321daa3b6b6a2176fe91281afe7f4fd9aded..9175a092cee59b6aef18813badbdc29f01e5210a 100644 (file)
@@ -392,7 +392,7 @@ static void outliner_add_line_styles(SpaceOops *soops, ListBase *lb, Scene *sce,
                for (lineset = srl->freestyleConfig.linesets.first; lineset; lineset = lineset->next) {
                        FreestyleLineStyle *linestyle = lineset->linestyle;
                        if (linestyle) {
-                               linestyle->id.flag |= LIB_DOIT;
+                               linestyle->id.tag |= LIB_TAG_DOIT;
                        }
                }
        }
@@ -400,9 +400,9 @@ static void outliner_add_line_styles(SpaceOops *soops, ListBase *lb, Scene *sce,
                for (lineset = srl->freestyleConfig.linesets.first; lineset; lineset = lineset->next) {
                        FreestyleLineStyle *linestyle = lineset->linestyle;
                        if (linestyle) {
-                               if (!(linestyle->id.flag & LIB_DOIT))
+                               if (!(linestyle->id.tag & LIB_TAG_DOIT))
                                        continue;
-                               linestyle->id.flag &= ~LIB_DOIT;
+                               linestyle->id.tag &= ~LIB_TAG_DOIT;
                                outliner_add_element(soops, lb, linestyle, te, 0, 0);
                        }
                }
@@ -1630,7 +1630,7 @@ void outliner_build_tree(Main *mainvar, Scene *scene, SpaceOops *soops)
                        lib = (Library *)tselem->id;
                        if (lib && lib->parent) {
                                par = (TreeElement *)lib->parent->id.newid;
-                               if (tselem->id->flag & LIB_INDIRECT) {
+                               if (tselem->id->tag & LIB_TAG_INDIRECT) {
                                        /* Only remove from 'first level' if lib is not also directly used. */
                                        BLI_remlink(&soops->tree, ten);
                                        BLI_addtail(&par->subtree, ten);
index 1d140f9570d9e130e237e4355cf6de40d98711e5..74a63be8bbcb9b5ef380e81bf408361fcf0d9959 100644 (file)
@@ -123,12 +123,16 @@ typedef struct ID {
        struct Library *lib;
        char name[66]; /* MAX_ID_NAME */
        /**
-        * LIB_... flags report on status of the datablock this ID belongs
-        * to.
+        * LIB_... flags report on status of the datablock this ID belongs to (persistent, saved to and read from .blend).
         */
        short flag;
+       /**
+        * LIB_TAG_... tags (runtime only, cleared at read time).
+        */
+       short tag;
+       short pad_s1;
        int us;
-       int icon_id, pad2;
+       int icon_id;
        IDProperty *properties;
 } ID;
 
@@ -261,7 +265,7 @@ typedef struct PreviewImage {
 
 #define ID_BLEND_PATH(_bmain, _id) ((_id)->lib ? (_id)->lib->filepath : (_bmain)->name)
 
-#define ID_MISSING(_id) (((_id)->flag & LIB_MISSING) != 0)
+#define ID_MISSING(_id) (((_id)->tag & LIB_TAG_MISSING) != 0)
 
 #ifdef GS
 #  undef GS
@@ -272,31 +276,56 @@ typedef struct PreviewImage {
 #define ID_NEW_US(a)   if (      (a)->id.newid)       { (a) = (void *)(a)->id.newid;       (a)->id.us++; }
 #define ID_NEW_US2(a)  if (((ID *)a)->newid)          { (a) = ((ID  *)a)->newid;     ((ID *)a)->us++;    }
 
-/* id->flag: set first 8 bits always at zero while reading */
+/* id->flag (persitent). */
 enum {
-       LIB_LOCAL           = 0,
-       LIB_EXTERN          = 1 << 0,
-       LIB_INDIRECT        = 1 << 1,
-       LIB_NEED_EXPAND     = 1 << 3,
-       LIB_TESTEXT         = (LIB_NEED_EXPAND | LIB_EXTERN),
-       LIB_TESTIND         = (LIB_NEED_EXPAND | LIB_INDIRECT),
-       LIB_READ            = 1 << 4,
-       LIB_NEED_LINK       = 1 << 5,
-       /* tag datablock as a place-holder (because the real one could not be linked from its library e.g.). */
-       LIB_MISSING         = 1 << 6,
-
-       LIB_NEW             = 1 << 8,
        LIB_FAKEUSER        = 1 << 9,
-       /* free test flag */
-       LIB_DOIT            = 1 << 10,
-       /* tag existing data before linking so we know what is new */
-       LIB_PRE_EXISTING    = 1 << 11,
-       /* runtime */
-       LIB_ID_RECALC       = 1 << 12,
-       LIB_ID_RECALC_DATA  = 1 << 13,
-       LIB_ANIM_NO_RECALC  = 1 << 14,
-
-       LIB_ID_RECALC_ALL   = (LIB_ID_RECALC | LIB_ID_RECALC_DATA),
+};
+
+/**
+ * id->tag (runtime-only).
+ *
+ * Those flags belong to three different categories, which have different expected handling in code:
+ *
+ *   - RESET_BEFORE_USE: piece of code that wants to use such flag has to ensure they are properly 'reset' first.
+ *   - RESET_AFTER_USE: piece of code that wants to use such flag has to ensure they are properly 'reset' after usage
+ *                      (though 'lifetime' of those flags is a bit fuzzy, e.g. _RECALC ones are reset on depsgraph
+ *                       evaluation...).
+ *   - RESET_NEVER: those flags are 'status' one, and never actually need any reset (except on initialization
+ *                  during .blend file reading).
+ */
+enum {
+       /* RESET_NEVER Datablock is from current .blend file. */
+       LIB_TAG_LOCAL           = 0,
+       /* RESET_NEVER Datablock is from a library, but is used (linked) directly by current .blend file. */
+       LIB_TAG_EXTERN          = 1 << 0,
+       /* RESET_NEVER Datablock is from a library, and is only used (linked) inderectly through other libraries. */
+       LIB_TAG_INDIRECT        = 1 << 1,
+
+       /* RESET_AFTER_USE Three flags used internally in readfile.c, to mark IDs needing to be read (only done once). */
+       LIB_TAG_NEED_EXPAND     = 1 << 3,
+       LIB_TAG_TESTEXT         = (LIB_TAG_NEED_EXPAND | LIB_TAG_EXTERN),
+       LIB_TAG_TESTIND         = (LIB_TAG_NEED_EXPAND | LIB_TAG_INDIRECT),
+       /* RESET_AFTER_USE Flag used internally in readfile.c, to mark IDs needing to be linked from a library. */
+       LIB_TAG_READ            = 1 << 4,
+       /* RESET_AFTER_USE */
+       LIB_TAG_NEED_LINK       = 1 << 5,
+
+       /* RESET_NEVER tag datablock as a place-holder (because the real one could not be linked from its library e.g.). */
+       LIB_TAG_MISSING         = 1 << 6,
+
+       /* RESET_AFTER_USE tag newly duplicated/copied IDs. */
+       LIB_TAG_NEW             = 1 << 8,
+       /* RESET_BEFORE_USE free test flag.
+     * TODO make it a RESET_AFTER_USE too. */
+       LIB_TAG_DOIT            = 1 << 10,
+       /* RESET_AFTER_USE tag existing data before linking so we know what is new. */
+       LIB_TAG_PRE_EXISTING    = 1 << 11,
+
+       /* RESET_AFTER_USE, used by update code (depsgraph). */
+       LIB_TAG_ID_RECALC       = 1 << 12,
+       LIB_TAG_ID_RECALC_DATA  = 1 << 13,
+       LIB_TAG_ANIM_NO_RECALC  = 1 << 14,
+       LIB_TAG_ID_RECALC_ALL   = (LIB_TAG_ID_RECALC | LIB_TAG_ID_RECALC_DATA),
 };
 
 /* To filter ID types (filter_id) */
index 5d36a0a4d4e17e6f17f885cc7260df1decd47c87..609e9d2f8dbef2f0c2f6ae293110d2160af1d00d 100644 (file)
@@ -934,24 +934,24 @@ static void rna_def_ID(BlenderRNA *brna)
        RNA_def_property_boolean_funcs(prop, NULL, "rna_ID_fake_user_set");
 
        prop = RNA_def_property(srna, "tag", PROP_BOOLEAN, PROP_NONE);
-       RNA_def_property_boolean_sdna(prop, NULL, "flag", LIB_DOIT);
+       RNA_def_property_boolean_sdna(prop, NULL, "tag", LIB_TAG_DOIT);
        RNA_def_property_flag(prop, PROP_LIB_EXCEPTION);
        RNA_def_property_ui_text(prop, "Tag",
                                 "Tools can use this to tag data for their own purposes "
                                 "(initial state is undefined)");
 
        prop = RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE);
-       RNA_def_property_boolean_sdna(prop, NULL, "flag", LIB_ID_RECALC);
+       RNA_def_property_boolean_sdna(prop, NULL, "tag", LIB_TAG_ID_RECALC);
        RNA_def_property_clear_flag(prop, PROP_EDITABLE);
        RNA_def_property_ui_text(prop, "Is Updated", "Datablock is tagged for recalculation");
 
        prop = RNA_def_property(srna, "is_updated_data", PROP_BOOLEAN, PROP_NONE);
-       RNA_def_property_boolean_sdna(prop, NULL, "flag", LIB_ID_RECALC_DATA);
+       RNA_def_property_boolean_sdna(prop, NULL, "tag", LIB_TAG_ID_RECALC_DATA);
        RNA_def_property_clear_flag(prop, PROP_EDITABLE);
        RNA_def_property_ui_text(prop, "Is Updated Data", "Datablock data is tagged for recalculation");
 
        prop = RNA_def_property(srna, "is_library_indirect", PROP_BOOLEAN, PROP_NONE);
-       RNA_def_property_boolean_sdna(prop, NULL, "flag", LIB_INDIRECT);
+       RNA_def_property_boolean_sdna(prop, NULL, "tag", LIB_TAG_INDIRECT);
        RNA_def_property_clear_flag(prop, PROP_EDITABLE);
        RNA_def_property_ui_text(prop, "Is Indirect", "Is this ID block linked indirectly");
 
index 2624e351c7478c6ec03c50feca5a14a099b38661..a0ff429a7e22fc855a7c80ed93c37fe354fdf813 100644 (file)
@@ -1539,11 +1539,11 @@ static void object_simplify_update(Object *ob)
        ModifierData *md;
        ParticleSystem *psys;
 
-       if ((ob->id.flag & LIB_DOIT) == 0) {
+       if ((ob->id.tag & LIB_TAG_DOIT) == 0) {
                return;
        }
 
-       ob->id.flag &= ~LIB_DOIT;
+       ob->id.tag &= ~LIB_TAG_DOIT;
 
        for (md = ob->modifiers.first; md; md = md->next) {
                if (ELEM(md->type, eModifierType_Subsurf, eModifierType_Multires, eModifierType_ParticleSystem)) {
index d5b4daca3b736a56aa53f9158defbc1b45648f8a..4046620592b422ae93c1dcac173b3b688723d27c 100644 (file)
@@ -575,7 +575,7 @@ static void correctivesmooth_modifier_do(
        const bool force_delta_cache_update =
                /* XXX, take care! if mesh data its self changes we need to forcefully recalculate deltas */
                ((csmd->rest_source == MOD_CORRECTIVESMOOTH_RESTSOURCE_ORCO) &&
-                (((ID *)ob->data)->flag & LIB_ID_RECALC));
+                (((ID *)ob->data)->tag & LIB_TAG_ID_RECALC));
 
        bool use_only_smooth = (csmd->flag & MOD_CORRECTIVESMOOTH_ONLY_SMOOTH) != 0;
        MDeformVert *dvert = NULL;
index f0f235c8ad5b8271a0ca6edc5ea9e3d1669c8475..3dcb03da52ce0bbcc9afad293bd4dfc445be11a5 100644 (file)
@@ -123,10 +123,10 @@ static void update_depsgraph_flow_coll_object(DagForest *forest,
                                               Object *object2)
 {
        SmokeModifierData *smd;
-       if ((object2->id.flag & LIB_DOIT) == 0) {
+       if ((object2->id.tag & LIB_TAG_DOIT) == 0) {
                return;
        }
-       object2->id.flag &= ~LIB_DOIT;
+       object2->id.tag &= ~LIB_TAG_DOIT;
        smd = (SmokeModifierData *)modifiers_findByType(object2, eModifierType_Smoke);
        if (smd && (((smd->type & MOD_SMOKE_TYPE_FLOW) && smd->flow) ||
                    ((smd->type & MOD_SMOKE_TYPE_COLL) && smd->coll)))
@@ -153,10 +153,10 @@ static void update_depsgraph_field_source_object(DagForest *forest,
                                                  Object *object,
                                                  Object *object2)
 {
-       if ((object2->id.flag & LIB_DOIT) == 0) {
+       if ((object2->id.tag & LIB_TAG_DOIT) == 0) {
                return;
        }
-       object2->id.flag &= ~LIB_DOIT;
+       object2->id.tag &= ~LIB_TAG_DOIT;
        if (object2->pd && object2->pd->forcefield == PFIELD_SMOKEFLOW && object2->pd->f_source == object) {
                DagNode *node2 = dag_get_node(forest, object2);
                dag_add_relation(forest, obNode, node2, DAG_RL_DATA_DATA | DAG_RL_OB_DATA, "Field Source Object");
@@ -233,10 +233,10 @@ static void update_depsgraph_flow_coll_object_new(struct DepsNodeHandle *node,
                                                   Object *object2)
 {
        SmokeModifierData *smd;
-       if ((object2->id.flag & LIB_DOIT) == 0) {
+       if ((object2->id.tag & LIB_TAG_DOIT) == 0) {
                return;
        }
-       object2->id.flag &= ~LIB_DOIT;
+       object2->id.tag &= ~LIB_TAG_DOIT;
        smd = (SmokeModifierData *)modifiers_findByType(object2, eModifierType_Smoke);
        if (smd && (((smd->type & MOD_SMOKE_TYPE_FLOW) && smd->flow) ||
                    ((smd->type & MOD_SMOKE_TYPE_COLL) && smd->coll)))
@@ -262,10 +262,10 @@ static void update_depsgraph_field_source_object_new(struct DepsNodeHandle *node
                                                      Object *object,
                                                      Object *object2)
 {
-       if ((object2->id.flag & LIB_DOIT) == 0) {
+       if ((object2->id.tag & LIB_TAG_DOIT) == 0) {
                return;
        }
-       object2->id.flag &= ~LIB_DOIT;
+       object2->id.tag &= ~LIB_TAG_DOIT;
        if (object2->pd && object2->pd->forcefield == PFIELD_SMOKEFLOW && object2->pd->f_source == object) {
                DEG_add_object_relation(node, object2, DEG_OB_COMP_TRANSFORM, "Field Source Object");
                DEG_add_object_relation(node, object2, DEG_OB_COMP_GEOMETRY, "Field Source Object");
index 0912ac0b637bd99b861609574f9e306c93ce59a8..d241a766b83915fa71805b91840fd14bc7cb9397 100644 (file)
@@ -332,7 +332,7 @@ static PyObject *bpy_lib_exit(BPy_Library *self, PyObject *UNUSED(args))
        Main *mainl = NULL;
        int err = 0;
 
-       BKE_main_id_flag_all(bmain, LIB_PRE_EXISTING, true);
+       BKE_main_id_flag_all(bmain, LIB_TAG_PRE_EXISTING, true);
 
        /* here appending/linking starts */
        mainl = BLO_library_link_begin(bmain, &(self->blo_handle), self->relpath);
@@ -400,7 +400,7 @@ static PyObject *bpy_lib_exit(BPy_Library *self, PyObject *UNUSED(args))
                /* exception raised above, XXX, this leaks some memory */
                BLO_blendhandle_close(self->blo_handle);
                self->blo_handle = NULL;
-               BKE_main_id_flag_all(bmain, LIB_PRE_EXISTING, false);
+               BKE_main_id_flag_all(bmain, LIB_TAG_PRE_EXISTING, false);
                return NULL;
        }
        else {
@@ -420,7 +420,7 @@ static PyObject *bpy_lib_exit(BPy_Library *self, PyObject *UNUSED(args))
                        }
                }
 
-               BKE_main_id_flag_all(bmain, LIB_PRE_EXISTING, false);
+               BKE_main_id_flag_all(bmain, LIB_TAG_PRE_EXISTING, false);
 
                /* finally swap the capsules for real bpy objects
                 * important since BLO_library_append_end initializes NodeTree types used by srna->refine */
index 30036c27b5d80dab2194639681f20303a2449618..da553402ea39fcc7f6cd17081315bbe93acc40ae 100644 (file)
@@ -656,7 +656,7 @@ static int get_next_bake_face(BakeShade *bs)
                                        bs->mloop = me->mloop + bs->mpoly->loopstart;
 
                                        /* Tag mesh for reevaluation. */
-                                       me->id.flag |= LIB_DOIT;
+                                       me->id.tag |= LIB_TAG_DOIT;
                                }
                                else {
                                        Image *ima = NULL;
@@ -690,14 +690,14 @@ static int get_next_bake_face(BakeShade *bs)
                                        }
                                        
                                        if (ima->flag & IMA_USED_FOR_RENDER) {
-                                               ima->id.flag &= ~LIB_DOIT;
+                                               ima->id.tag &= ~LIB_TAG_DOIT;
                                                BKE_image_release_ibuf(ima, ibuf, NULL);
                                                continue;
                                        }
                                        
                                        /* find the image for the first time? */
-                                       if (ima->id.flag & LIB_DOIT) {
-                                               ima->id.flag &= ~LIB_DOIT;
+                                       if (ima->id.tag & LIB_TAG_DOIT) {
+                                               ima->id.tag &= ~LIB_TAG_DOIT;
                                                
                                                /* we either fill in float or char, this ensures things go fine */
                                                if (ibuf->rect_float)
@@ -1026,7 +1026,7 @@ int RE_bake_shade_all_selected(Render *re, int type, Object *actob, short *do_up
        if ((R.r.bake_flag & R_BAKE_VCOL) == 0) {
                for (ima = G.main->image.first; ima; ima = ima->id.next) {
                        ImBuf *ibuf = BKE_image_acquire_ibuf(ima, NULL, NULL);
-                       ima->id.flag |= LIB_DOIT;
+                       ima->id.tag |= LIB_TAG_DOIT;
                        ima->flag &= ~IMA_USED_FOR_RENDER;
                        if (ibuf) {
                                ibuf->userdata = NULL; /* use for masking if needed */
@@ -1110,7 +1110,7 @@ int RE_bake_shade_all_selected(Render *re, int type, Object *actob, short *do_up
                }
 
                for (ima = G.main->image.first; ima; ima = ima->id.next) {
-                       if ((ima->id.flag & LIB_DOIT) == 0) {
+                       if ((ima->id.tag & LIB_TAG_DOIT) == 0) {
                                ImBuf *ibuf = BKE_image_acquire_ibuf(ima, NULL, NULL);
                                BakeImBufuserData *userdata;
 
index 846255b935fce573f6185216e100db345c63afd5..820e129b0ce408a119b889e368271d987da5f570 100644 (file)
@@ -3956,7 +3956,7 @@ static void add_lightgroup(Render *re, Group *group, int exclusive)
 {
        GroupObject *go, *gol;
        
-       group->id.flag &= ~LIB_DOIT;
+       group->id.tag &= ~LIB_TAG_DOIT;
 
        /* it's a bit too many loops in loops... but will survive */
        /* note that 'exclusive' will remove it from the global list */
@@ -3995,12 +3995,12 @@ static void set_material_lightgroups(Render *re)
                return;
        
        for (group= re->main->group.first; group; group=group->id.next)
-               group->id.flag |= LIB_DOIT;
+               group->id.tag |= LIB_TAG_DOIT;
        
        /* it's a bit too many loops in loops... but will survive */
        /* hola! materials not in use...? */
        for (ma= re->main->mat.first; ma; ma=ma->id.next) {
-               if (ma->group && (ma->group->id.flag & LIB_DOIT))
+               if (ma->group && (ma->group->id.tag & LIB_TAG_DOIT))
                        add_lightgroup(re, ma->group, ma->mode & MA_GROUP_NOLAY);
        }
 }
index dcc33b99742b9a8df6fd9867e77221852c8de7a2..8eb6e7000ab0976d342dfe60d4494f2218abd6c8 100644 (file)
@@ -1189,20 +1189,20 @@ static void count_images(MultiresBakeRender *bkr)
        totpoly = dm->getNumPolys(dm);
 
        for (a = 0; a < totpoly; a++)
-               mtexpoly[a].tpage->id.flag &= ~LIB_DOIT;
+               mtexpoly[a].tpage->id.tag &= ~LIB_TAG_DOIT;
 
        for (a = 0; a < totpoly; a++) {
                Image *ima = mtexpoly[a].tpage;
-               if ((ima->id.flag & LIB_DOIT) == 0) {
+               if ((ima->id.tag & LIB_TAG_DOIT) == 0) {
                        LinkData *data = BLI_genericNodeN(ima);
                        BLI_addtail(&bkr->image, data);
                        bkr->tot_image++;
-                       ima->id.flag |= LIB_DOIT;
+                       ima->id.tag |= LIB_TAG_DOIT;
                }
        }
 
        for (a = 0; a < totpoly; a++)
-               mtexpoly[a].tpage->id.flag &= ~LIB_DOIT;
+               mtexpoly[a].tpage->id.tag &= ~LIB_TAG_DOIT;
 }
 
 static void bake_images(MultiresBakeRender *bkr, MultiresBakeResult *result)
@@ -1234,7 +1234,7 @@ static void bake_images(MultiresBakeRender *bkr, MultiresBakeResult *result)
 
                BKE_image_release_ibuf(ima, ibuf, NULL);
 
-               ima->id.flag |= LIB_DOIT;
+               ima->id.tag |= LIB_TAG_DOIT;
        }
 }
 
index 64866509a0cb5ee65426356377736c5976622f58..1ac9dd8e716b77dd9e871abedbef39e0772eefb2 100644 (file)
@@ -2013,7 +2013,7 @@ static void tag_scenes_for_render(Render *re)
 #endif
        
        for (sce = re->main->scene.first; sce; sce = sce->id.next) {
-               sce->id.flag &= ~LIB_DOIT;
+               sce->id.tag &= ~LIB_TAG_DOIT;
 #ifdef DEPSGRAPH_WORKAROUND_HACK
                tag_dependend_objects_for_render(sce, renderlay);
 #endif
@@ -2022,7 +2022,7 @@ static void tag_scenes_for_render(Render *re)
 #ifdef WITH_FREESTYLE
        if (re->freestyle_bmain) {
                for (sce = re->freestyle_bmain->scene.first; sce; sce = sce->id.next) {
-                       sce->id.flag &= ~LIB_DOIT;
+                       sce->id.tag &= ~LIB_TAG_DOIT;
 #ifdef DEPSGRAPH_WORKAROUND_HACK
                        tag_dependend_objects_for_render(sce, renderlay);
 #endif
@@ -2031,7 +2031,7 @@ static void tag_scenes_for_render(Render *re)
 #endif
 
        if (RE_GetCamera(re) && composite_needs_render(re->scene, 1)) {
-               re->scene->id.flag |= LIB_DOIT;
+               re->scene->id.tag |= LIB_TAG_DOIT;
 #ifdef DEPSGRAPH_WORKAROUND_HACK
                tag_dependend_objects_for_render(re->scene, renderlay);
 #endif
@@ -2039,7 +2039,7 @@ static void tag_scenes_for_render(Render *re)
        
        if (re->scene->nodetree == NULL) return;
        
-       /* check for render-layers nodes using other scenes, we tag them LIB_DOIT */
+       /* check for render-layers nodes using other scenes, we tag them LIB_TAG_DOIT */
        for (node = re->scene->nodetree->nodes.first; node; node = node->next) {
                node->flag &= ~NODE_TEST;
                if (node->type == CMP_NODE_R_LAYERS && (node->flag & NODE_MUTED) == 0) {
@@ -2060,11 +2060,11 @@ static void tag_scenes_for_render(Render *re)
                                }
 
                                if (node->id != (ID *)re->scene) {
-                                       if ((node->id->flag & LIB_DOIT) == 0) {
+                                       if ((node->id->tag & LIB_TAG_DOIT) == 0) {
                                                Scene *scene = (Scene *) node->id;
                                                if (render_scene_has_layers_to_render(scene)) {
                                                        node->flag |= NODE_TEST;
-                                                       node->id->flag |= LIB_DOIT;
+                                                       node->id->tag |= LIB_TAG_DOIT;
 #ifdef DEPSGRAPH_WORKAROUND_HACK
                                                        tag_dependend_objects_for_render(scene, renderlay);
 #endif
@@ -2283,7 +2283,7 @@ static void do_merge_fullsample(Render *re, bNodeTree *ntree)
                        
                tag_scenes_for_render(re);
                for (sce = re->main->scene.first; sce; sce = sce->id.next) {
-                       if (sce->id.flag & LIB_DOIT) {
+                       if (sce->id.tag & LIB_TAG_DOIT) {
                                re1 = RE_GetRender(sce->id.name);
 
                                if (re1 && (re1->r.scemode & R_FULL_SAMPLE)) {
@@ -2408,12 +2408,12 @@ void RE_MergeFullSample(Render *re, Main *bmain, Scene *sce, bNodeTree *ntree)
        
        /* tag scenes unread */
        for (scene = re->main->scene.first; scene; scene = scene->id.next)
-               scene->id.flag |= LIB_DOIT;
+               scene->id.tag |= LIB_TAG_DOIT;
        
 #ifdef WITH_FREESTYLE
        if (re->freestyle_bmain) {
                for (scene = re->freestyle_bmain->scene.first; scene; scene = scene->id.next)
-                       scene->id.flag &= ~LIB_DOIT;
+                       scene->id.tag &= ~LIB_TAG_DOIT;
        }
 #endif
 
@@ -2422,18 +2422,18 @@ void RE_MergeFullSample(Render *re, Main *bmain, Scene *sce, bNodeTree *ntree)
                        Scene *nodescene = (Scene *)node->id;
                        
                        if (nodescene == NULL) nodescene = sce;
-                       if (nodescene->id.flag & LIB_DOIT) {
+                       if (nodescene->id.tag & LIB_TAG_DOIT) {
                                nodescene->r.mode |= R_OSA; /* render struct needs tables */
                                RE_ReadRenderResult(sce, nodescene);
-                               nodescene->id.flag &= ~LIB_DOIT;
+                               nodescene->id.tag &= ~LIB_TAG_DOIT;
                        }
                }
        }
        
        /* own render result should be read/allocated */
-       if (re->scene->id.flag & LIB_DOIT) {
+       if (re->scene->id.tag & LIB_TAG_DOIT) {
                RE_ReadRenderResult(re->scene, re->scene);
-               re->scene->id.flag &= ~LIB_DOIT;
+               re->scene->id.tag &= ~LIB_TAG_DOIT;
        }
        
        /* and now we can draw (result is there) */
index 5daa622a029b1314d1a5fd063b52309b1d3b1b51..7ee5f363e4b509e64f1f1fe4265ff4f5fdb86d20 100644 (file)
@@ -2624,8 +2624,8 @@ static int wm_link_append_exec(bContext *C, wmOperator *op)
        /* tag everything, all untagged data can be made local
         * its also generally useful to know what is new
         *
-        * take extra care BKE_main_id_flag_all(bmain, LIB_PRE_EXISTING, false) is called after! */
-       BKE_main_id_flag_all(bmain, LIB_PRE_EXISTING, true);
+        * take extra care BKE_main_id_flag_all(bmain, LIB_TAG_PRE_EXISTING, false) is called after! */
+       BKE_main_id_flag_all(bmain, LIB_TAG_PRE_EXISTING, true);
 
        /* We define our working data...
         * Note that here, each item 'uses' one library, and only one. */
@@ -2705,7 +2705,7 @@ static int wm_link_append_exec(bContext *C, wmOperator *op)
 
        /* important we unset, otherwise these object wont
         * link into other scenes from this blend file */
-       BKE_main_id_flag_all(bmain, LIB_PRE_EXISTING, false);
+       BKE_main_id_flag_all(bmain, LIB_TAG_PRE_EXISTING, false);
 
        /* recreate dependency graph to include new objects */
        DAG_scene_relations_rebuild(bmain, scene);
@@ -4832,11 +4832,11 @@ static bool previews_id_ensure_callback(void *todo_v, ID **idptr, int UNUSED(cd_
        PreviewsIDEnsureStack *todo = todo_v;
        ID *id = *idptr;
 
-       if (id && (id->flag & LIB_DOIT)) {
+       if (id && (id->tag & LIB_TAG_DOIT)) {
                if (ELEM(GS(id->name), ID_MA, ID_TE, ID_IM, ID_WO, ID_LA)) {
                        previews_id_ensure(todo->C, todo->scene, id);
                }
-               id->flag &= ~LIB_DOIT;  /* Tag the ID as done in any case. */
+               id->tag &= ~LIB_TAG_DOIT;  /* Tag the ID as done in any case. */
                BLI_LINKSTACK_PUSH(todo->id_stack, id);
        }
 
@@ -4852,8 +4852,8 @@ static int previews_ensure_exec(bContext *C, wmOperator *UNUSED(op))
        ID *id;
        int i;
 
-       /* We use LIB_DOIT to check whether we have already handled a given ID or not. */
-       BKE_main_id_flag_all(bmain, LIB_DOIT, true);
+       /* We use LIB_TAG_DOIT to check whether we have already handled a given ID or not. */
+       BKE_main_id_flag_all(bmain, LIB_TAG_DOIT, true);
 
        BLI_LINKSTACK_INIT(preview_id_stack.id_stack);
 
index 6cbb8e08cf5974b59f881c60a48804de08b022c6..ad1fdf2f06ac2f0ef4309a79754ddbb7b8764050 100644 (file)
@@ -1438,18 +1438,18 @@ RAS_MeshObject *KX_BlenderSceneConverter::ConvertMeshSpecial(KX_Scene *kx_scene,
                /* ensure all materials are tagged */
                for (int i = 0; i < mesh->totcol; i++) {
                        if (mesh->mat[i])
-                               mesh->mat[i]->id.flag &= ~LIB_DOIT;
+                               mesh->mat[i]->id.tag &= ~LIB_TAG_DOIT;
                }
 
                for (int i = 0; i < mesh->totcol; i++) {
                        Material *mat_old = mesh->mat[i];
 
                        /* if its tagged its a replaced material */
-                       if (mat_old && (mat_old->id.flag & LIB_DOIT) == 0) {
+                       if (mat_old && (mat_old->id.tag & LIB_TAG_DOIT) == 0) {
                                Material *mat_old = mesh->mat[i];
                                Material *mat_new = BKE_material_copy(mat_old);
 
-                               mat_new->id.flag |= LIB_DOIT;
+                               mat_new->id.tag |= LIB_TAG_DOIT;
                                id_us_min(&mat_old->id);
 
                                BLI_remlink(&G.main->mat, mat_new); // BKE_material_copy uses G.main, and there is no BKE_material_copy_ex
index 491be035d66e8361b6b4aa32f65bebb9372953ae..35f605f1a5f6d8cb33dd32dead5ed5d49b1de7fd 100644 (file)
@@ -28,7 +28,7 @@
 #include "BL_ActionManager.h"
 #include "DNA_ID.h"
 
-#define IS_TAGGED(_id) ((_id) && (((ID *)_id)->flag & LIB_DOIT))
+#define IS_TAGGED(_id) ((_id) && (((ID *)_id)->tag & LIB_TAG_DOIT))
 
 BL_ActionManager::BL_ActionManager(class KX_GameObject *obj):
        m_obj(obj),
index 046ad25c09cbfd0ddc31eb6e2e4a26c423ac4e71..c43b7be45dc970d7e44d34975ca473a804faa83f 100644 (file)
@@ -93,7 +93,7 @@ class KX_ObstacleSimulation;
 #endif
 
 /* for ID freeing */
-#define IS_TAGGED(_id) ((_id) && (((ID *)_id)->flag & LIB_DOIT))
+#define IS_TAGGED(_id) ((_id) && (((ID *)_id)->tag & LIB_TAG_DOIT))
 
 /**
  * The KX_Scene holds all data for an independent scene. It relates