Depsgraph: Don't case ID_Type to short
authorSergey Sharybin <sergey.vfx@gmail.com>
Mon, 28 Aug 2017 09:51:53 +0000 (11:51 +0200)
committerSergey Sharybin <sergey.vfx@gmail.com>
Mon, 28 Aug 2017 09:51:53 +0000 (11:51 +0200)
source/blender/depsgraph/intern/builder/deg_builder_relations.cc
source/blender/depsgraph/intern/depsgraph.cc
source/blender/depsgraph/intern/depsgraph_tag.cc
source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc

index 611eb2d7df9e42f16746c643c008bde41e72754d..18326baab45b0d05a87bc9799376a2dccd57d8d5 100644 (file)
@@ -974,7 +974,7 @@ void DepsgraphRelationBuilder::build_driver(ID *id, FCurve *fcu)
                                fcu->array_index);
        bPoseChannel *pchan = NULL;
        const char *rna_path = fcu->rna_path ? fcu->rna_path : "";
-       const short id_type = GS(id->name);
+       const ID_Type id_type = GS(id->name);
 
        /* Create dependency between driver and data affected by it. */
        /* - direct property relationship... */
@@ -1102,6 +1102,8 @@ void DepsgraphRelationBuilder::build_driver(ID *id, FCurve *fcu)
                                             "[Driver -> NTree Shading Update]");
                                break;
                        }
+                       default:
+                               break;
                }
        }
        /* Ensure that affected prop's update callbacks will be triggered once
index 9664d3897948e36c2111984d35c86dfef06816fa..9f25fcaaa32386ff53e97e03eb418bc7dd0c815b 100644 (file)
@@ -319,7 +319,7 @@ void Depsgraph::clear_id_nodes()
                if (!deg_copy_on_write_is_expanded(id_node->id_cow)) {
                        continue;
                }
-               const short id_type = GS(id_node->id_cow->name);
+               const ID_Type id_type = GS(id_node->id_cow->name);
                if (id_type != ID_PA) {
                        id_node->destroy();
                }
index 6d5a2e3628e197bb1583b3991ba59731dc9ea615..46557b93aa52294771914100d14eb04ce99a6b68 100644 (file)
@@ -151,7 +151,7 @@ void id_tag_update_object_transform(Depsgraph *graph, IDDepsNode *id_node)
 /* Tag corresponding to OB_RECALC_DATA. */
 void id_tag_update_object_data(Depsgraph *graph, IDDepsNode *id_node)
 {
-       const short id_type = GS(id_node->id_orig->name);
+       const ID_Type id_type = GS(id_node->id_orig->name);
        ComponentDepsNode *data_comp = NULL;
        switch (id_type) {
                case ID_OB:
@@ -177,6 +177,8 @@ void id_tag_update_object_data(Depsgraph *graph, IDDepsNode *id_node)
                        break;
                case ID_PA:
                        return;
+               default:
+                       break;
        }
        if (data_comp == NULL) {
 #ifdef STRICT_COMPONENT_TAGGING
@@ -290,7 +292,7 @@ void deg_graph_id_tag_update(Main *bmain, Depsgraph *graph, ID *id, int flag)
                id_tag_update_object_data(graph, id_node);
 #ifdef WITH_COPY_ON_WRITE
                if (flag & DEG_TAG_COPY_ON_WRITE) {
-                       const short id_type = GS(id_node->id_orig->name);
+                       const ID_Type id_type = GS(id_node->id_orig->name);
                        if (id_type == ID_OB) {
                                Object *object = (Object *)id_node->id_orig;
                                ID *ob_data = (ID *)object->data;
@@ -334,7 +336,7 @@ void deg_graph_on_visible_update(Main *bmain, Scene *scene, Depsgraph *graph)
        /* Make sure objects are up to date. */
        GHASH_FOREACH_BEGIN(DEG::IDDepsNode *, id_node, graph->id_hash)
        {
-               const short id_type = GS(id_node->id_orig->name);
+               const ID_Type id_type = GS(id_node->id_orig->name);
                if (id_type != ID_OB) {
                        /* Ignore non-object nodes on visibility changes. */
                        continue;
index 63b52af7c70ae6ab02fb5c3d144242ae6d5bc2e4..bd1d0dc0504f4a343543c20d3bab9ad5377b8a77 100644 (file)
@@ -320,7 +320,7 @@ BLI_INLINE bool check_datablock_expanded(const ID *id_cow)
  */
 static bool check_datablock_expanded_at_construction(const ID *id_orig)
 {
-       const short id_type = GS(id_orig->name);
+       const ID_Type id_type = GS(id_orig->name);
        return (id_type == ID_SCE) ||
               (id_type == ID_OB && ((Object *)id_orig)->type == OB_ARMATURE) ||
               (id_type == ID_AR);
@@ -334,7 +334,7 @@ static bool check_datablock_expanded_at_construction(const ID *id_orig)
  */
 static bool check_datablocks_copy_on_writable(const ID *id_orig)
 {
-       const short id_type = GS(id_orig->name);
+       const ID_Type id_type = GS(id_orig->name);
        /* We shouldn't bother if copied ID is same as original one. */
        if (!deg_copy_on_write_is_needed(id_orig)) {
                return false;
@@ -398,8 +398,8 @@ int foreach_libblock_remap_callback(void *user_data_v,
                                 * those or at least make it more reliable check where the
                                 * pointer is coming from.
                                 */
-                               const short id_type = GS(id_orig->name);
-                               const short id_type_self = GS(id_self->name);
+                               const ID_Type id_type = GS(id_orig->name);
+                               const ID_Type id_type_self = GS(id_self->name);
                                if (id_type == ID_OB && id_type_self == ID_SCE) {
                                        IDDepsNode *id_node = depsgraph->find_id_node(id_orig);
                                        if (id_node == NULL) {
@@ -433,7 +433,7 @@ int foreach_libblock_remap_callback(void *user_data_v,
 void update_special_pointers(const Depsgraph *depsgraph,
                              const ID *id_orig, ID *id_cow)
 {
-       const short type = GS(id_orig->name);
+       const ID_Type type = GS(id_orig->name);
        switch (type) {
                case ID_OB:
                {
@@ -480,6 +480,8 @@ void update_special_pointers(const Depsgraph *depsgraph,
                        }
                        break;
                }
+               default:
+                       break;
        }
 }
 
@@ -560,7 +562,7 @@ void update_copy_on_write_datablock(const Depsgraph *depsgraph,
                                     const ID *id_orig, ID *id_cow)
 {
        bool ok = false;
-       const short id_type = GS(id_orig->name);
+       const ID_Type id_type = GS(id_orig->name);
        switch (id_type) {
                case ID_SCE: {
                        const Scene *scene_orig = (const Scene *)id_orig;
@@ -584,6 +586,8 @@ void update_copy_on_write_datablock(const Depsgraph *depsgraph,
                        /* Nothing to do currently. */
                        ok = true;
                        break;
+               default:
+                       break;
        }
        // TODO(sergey): Other ID types here.
        if (!ok) {
@@ -663,7 +667,7 @@ ID *deg_expand_copy_on_write_datablock(const Depsgraph *depsgraph,
         * or cases where we want to do something smarter than simple datablock
         * copy.
         */
-       const short id_type = GS(id_orig->name);
+       const ID_Type id_type = GS(id_orig->name);
        switch (id_type) {
                case ID_SCE:
                {
@@ -680,6 +684,8 @@ ID *deg_expand_copy_on_write_datablock(const Depsgraph *depsgraph,
                         */
                        break;
                }
+               default:
+                       break;
        }
        if (!done) {
                if (id_copy_no_main(id_orig, &newid)) {
@@ -749,7 +755,7 @@ ID *deg_update_copy_on_write_datablock(const Depsgraph *depsgraph,
                                        const IDDepsNode *id_node)
 {
        const ID *id_orig = id_node->id_orig;
-       const short id_type = GS(id_orig->name);
+       const ID_Type id_type = GS(id_orig->name);
        ID *id_cow = id_node->id_cow;
        /* Similar to expansion, no need to do anything here. */
        if (!deg_copy_on_write_is_needed(id_orig)) {
@@ -805,6 +811,8 @@ ID *deg_update_copy_on_write_datablock(const Depsgraph *depsgraph,
                                }
                                break;
                        }
+                       default:
+                               break;
                }
                if (gpumaterial_ptr != NULL) {
                        gpumaterial_backup = *gpumaterial_ptr;
@@ -860,7 +868,7 @@ void deg_free_copy_on_write_datablock(ID *id_cow)
                 */
                return;
        }
-       const short type = GS(id_cow->name);
+       const ID_Type type = GS(id_cow->name);
 #ifdef NESTED_ID_NASTY_WORKAROUND
        nested_id_hack_discard_pointers(id_cow);
 #endif
@@ -896,6 +904,8 @@ void deg_free_copy_on_write_datablock(ID *id_cow)
                        id_cow->name[0] = '\0';
                        return;
                }
+               default:
+                       break;
        }
        BKE_libblock_free_datablock(id_cow, 0);
        BKE_libblock_free_data(id_cow, false);
@@ -940,7 +950,7 @@ bool deg_copy_on_write_is_expanded(const ID *id_cow)
 
 bool deg_copy_on_write_is_needed(const ID *id_orig)
 {
-       const short id_type = GS(id_orig->name);
+       const ID_Type id_type = GS(id_orig->name);
        return !ELEM(id_type, ID_IM);
 }