Merge branch 'master' into blender2.8
authorSergey Sharybin <sergey.vfx@gmail.com>
Tue, 16 Jan 2018 15:40:05 +0000 (16:40 +0100)
committerSergey Sharybin <sergey.vfx@gmail.com>
Tue, 16 Jan 2018 15:40:05 +0000 (16:40 +0100)
source/blender/alembic/intern/abc_customdata.cc
source/blender/blenkernel/intern/anim_sys.c
source/blender/makesrna/intern/rna_depsgraph.c

index 8b52661605377e64f542907da007f12d22e8ac77..b3b015c7abf6332fd1c7da802f57541e3c4d8791 100644 (file)
@@ -285,6 +285,7 @@ static void read_custom_data_mcols(const std::string & iobject_full_name,
 {
        C3fArraySamplePtr c3f_ptr = C3fArraySamplePtr();
        C4fArraySamplePtr c4f_ptr = C4fArraySamplePtr();
+       Alembic::Abc::UInt32ArraySamplePtr indices;
        bool use_c3f_ptr;
        bool is_facevarying;
 
@@ -299,6 +300,7 @@ static void read_custom_data_mcols(const std::string & iobject_full_name,
                                 config.totloop == sample.getIndices()->size();
 
                c3f_ptr = sample.getVals();
+               indices = sample.getIndices();
                use_c3f_ptr = true;
        }
        else if (IC4fGeomParam::matches(prop_header)) {
@@ -311,6 +313,7 @@ static void read_custom_data_mcols(const std::string & iobject_full_name,
                                 config.totloop == sample.getIndices()->size();
 
                c4f_ptr = sample.getVals();
+               indices = sample.getIndices();
                use_c3f_ptr = false;
        }
        else {
@@ -331,6 +334,12 @@ static void read_custom_data_mcols(const std::string & iobject_full_name,
        size_t color_index;
        bool bounds_warning_given = false;
 
+       /* The colors can go through two layers of indexing. Often the 'indices'
+        * array doesn't do anything (i.e. indices[n] = n), but when it does, it's
+        * important. Blender 2.79 writes indices incorrectly (see T53745), which
+        * is why we have to check for indices->size() > 0 */
+       bool use_dual_indexing = is_facevarying && indices->size() > 0;
+
        for (int i = 0; i < config.totpoly; ++i) {
                MPoly *poly = &mpolys[i];
                MCol *cface = &cfaces[poly->loopstart + poly->totloop];
@@ -340,9 +349,13 @@ static void read_custom_data_mcols(const std::string & iobject_full_name,
                        --cface;
                        --mloop;
 
+                       color_index = is_facevarying ? face_index : mloop->v;
+                       if (use_dual_indexing) {
+                               color_index = (*indices)[color_index];
+                       }
                        if (use_c3f_ptr) {
                                color_index = mcols_out_of_bounds_check(
-                                                 is_facevarying ? face_index : mloop->v,
+                                                 color_index,
                                                  c3f_ptr->size(),
                                                  iobject_full_name, prop_header,
                                                  bounds_warning_given);
@@ -355,7 +368,7 @@ static void read_custom_data_mcols(const std::string & iobject_full_name,
                        }
                        else {
                                color_index = mcols_out_of_bounds_check(
-                                                 is_facevarying ? face_index : mloop->v,
+                                                 color_index,
                                                  c4f_ptr->size(),
                                                  iobject_full_name, prop_header,
                                                  bounds_warning_given);
index 82bce6e346d907fe10acdf386044c4b5b0a906e7..58b476d3da5d63ab4a900edea0eda53d81dc4287 100644 (file)
@@ -2885,7 +2885,7 @@ void BKE_animsys_eval_animdata(const EvaluationContext *eval_ctx, ID *id)
 {
        AnimData *adt = BKE_animdata_from_id(id);
        Scene *scene = NULL; /* XXX: this is only needed for flushing RNA updates,
-                             * which should get handled as part of the graph instead...
+                             * which should get handled as part of the dependency graph instead...
                              */
        DEBUG_PRINT("%s on %s, time=%f\n\n", __func__, id->name, (double)eval_ctx->ctime);
        BKE_animsys_evaluate_animdata(scene, id, adt, eval_ctx->ctime, ADT_RECALC_ANIM);
index 706fb23ab56a4dc087de2cf4947ecba3a297c6ca..e6e1c714008ef9e06bf20aab93003da41ca52c29 100644 (file)
@@ -120,18 +120,18 @@ static int rna_DepsgraphIter_is_instance_get(PointerRNA *ptr)
 
 /* **************** Depsgraph **************** */
 
-static void rna_Depsgraph_debug_relations_graphviz(Depsgraph *graph,
+static void rna_Depsgraph_debug_relations_graphviz(Depsgraph *depsgraph,
                                                    const char *filename)
 {
        FILE *f = fopen(filename, "w");
        if (f == NULL) {
                return;
        }
-       DEG_debug_relations_graphviz(graph, f, "Depsgraph");
+       DEG_debug_relations_graphviz(depsgraph, f, "Depsgraph");
        fclose(f);
 }
 
-static void rna_Depsgraph_debug_stats_gnuplot(Depsgraph *graph,
+static void rna_Depsgraph_debug_stats_gnuplot(Depsgraph *depsgraph,
                                               const char *filename,
                                               const char *output_filename)
 {
@@ -139,19 +139,19 @@ static void rna_Depsgraph_debug_stats_gnuplot(Depsgraph *graph,
        if (f == NULL) {
                return;
        }
-       DEG_debug_stats_gnuplot(graph, f, "Timing Statistics", output_filename);
+       DEG_debug_stats_gnuplot(depsgraph, f, "Timing Statistics", output_filename);
        fclose(f);
 }
 
-static void rna_Depsgraph_debug_tag_update(Depsgraph *graph)
+static void rna_Depsgraph_debug_tag_update(Depsgraph *depsgraph)
 {
-       DEG_graph_tag_relations_update(graph);
+       DEG_graph_tag_relations_update(depsgraph);
 }
 
-static void rna_Depsgraph_debug_stats(Depsgraph *graph, char *result)
+static void rna_Depsgraph_debug_stats(Depsgraph *depsgraph, char *result)
 {
        size_t outer, ops, rels;
-       DEG_stats_simple(graph, &outer, &ops, &rels);
+       DEG_stats_simple(depsgraph, &outer, &ops, &rels);
        BLI_snprintf(result, STATS_MAX_SIZE,
                    "Approx %lu Operations, %lu Relations, %lu Outer Nodes",
                     ops, rels, outer);