Logging: Use CLOG for blenkernel
[blender.git] / source / blender / blenkernel / intern / dynamicpaint.c
index 590fe559ff048fccb84e84e673ccf0f45f2c32de..a93ed7461c359054ae181e358b9b41e3068da256 100644 (file)
@@ -63,7 +63,6 @@
 #include "BKE_deform.h"
 #include "BKE_dynamicpaint.h"
 #include "BKE_effect.h"
-#include "BKE_global.h"
 #include "BKE_image.h"
 #include "BKE_library.h"
 #include "BKE_main.h"
 
 #include "atomic_ops.h"
 
+#include "CLG_log.h"
+
 /* could enable at some point but for now there are far too many conversions */
 #ifdef __GNUC__
 //#  pragma GCC diagnostic ignored "-Wdouble-promotion"
 #endif
 
+static CLG_LogRef LOG = {"bke.dynamicpaint"};
+
 /* precalculated gaussian factors for 5x super sampling */
 static const float gaussianFactors[5] = {
     0.996849f,
@@ -241,6 +244,7 @@ static int setError(DynamicPaintCanvasSettings *canvas, const char *string)
 {
        /* Add error to canvas ui info label */
        BLI_strncpy(canvas->error, string, sizeof(canvas->error));
+       CLOG_STR_ERROR(&LOG, string);
        return 0;
 }
 
@@ -1580,7 +1584,7 @@ static void dynamicPaint_setInitialColor(const Scene *scene, DynamicPaintSurface
                        DynamicPaintSetInitColorData data = {
                            .surface = surface,
                            .mloop = mloop, .mlooptri = mlooptri, .mloopuv = mloopuv, .pool = pool,
-                           .scene_color_manage = scene_color_manage
+                           .scene_color_manage = scene_color_manage,
                        };
                        ParallelRangeSettings settings;
                        BLI_parallel_range_settings_defaults(&settings);
@@ -1595,7 +1599,7 @@ static void dynamicPaint_setInitialColor(const Scene *scene, DynamicPaintSurface
                        DynamicPaintSetInitColorData data = {
                            .surface = surface,
                            .mlooptri = mlooptri, .mloopuv = mloopuv,
-                           .scene_color_manage = scene_color_manage
+                           .scene_color_manage = scene_color_manage,
                        };
                        ParallelRangeSettings settings;
                        BLI_parallel_range_settings_defaults(&settings);
@@ -1756,7 +1760,7 @@ static void dynamicPaint_applySurfaceDisplace(DynamicPaintSurface *surface, Mesh
        if (surface->type == MOD_DPAINT_SURFACE_T_DISPLACE) {
                MVert *mvert = result->mvert;
 
-               DynamicPaintModifierApplyData data = {.surface = surface, .mvert = mvert};
+               DynamicPaintModifierApplyData data = { .surface = surface, .mvert = mvert, };
                ParallelRangeSettings settings;
                BLI_parallel_range_settings_defaults(&settings);
                settings.use_threading = (sData->total_points > 10000);
@@ -1903,7 +1907,7 @@ static Mesh *dynamicPaint_Modifier_apply(
                                                /* paint is stored on dry and wet layers, so mix final color first */
                                                float (*fcolor)[4] = MEM_callocN(sizeof(*fcolor) * sData->total_points, "Temp paint color");
 
-                                               DynamicPaintModifierApplyData data = {.surface = surface, .fcolor = fcolor};
+                                               DynamicPaintModifierApplyData data = { .surface = surface, .fcolor = fcolor, };
                                                {
                                                        ParallelRangeSettings settings;
                                                        BLI_parallel_range_settings_defaults(&settings);
@@ -2007,7 +2011,7 @@ static Mesh *dynamicPaint_Modifier_apply(
                                        else if (surface->type == MOD_DPAINT_SURFACE_T_WAVE) {
                                                MVert *mvert = result->mvert;
 
-                                               DynamicPaintModifierApplyData data = {.surface = surface, .mvert = mvert};
+                                               DynamicPaintModifierApplyData data = { .surface = surface, .mvert = mvert, };
                                                ParallelRangeSettings settings;
                                                BLI_parallel_range_settings_defaults(&settings);
                                                settings.use_threading = (sData->total_points > 1000);
@@ -2481,7 +2485,7 @@ static int dynamic_paint_find_neighbour_pixel(
                DynamicPaintFindIslandBorderData bdata = {
                        .vert_to_looptri_map = vert_to_looptri_map,
                        .w = w, .h = h, .px = px, .py = py,
-                       .best_index = NOT_FOUND, .best_weight = 1.0f
+                       .best_index = NOT_FOUND, .best_weight = 1.0f,
                };
 
                float pixel[2];
@@ -2811,7 +2815,7 @@ int dynamicPaint_createUVSurface(Scene *scene, DynamicPaintSurface *surface, flo
        /*
         * Start generating the surface
         */
-       printf("DynamicPaint: Preparing UV surface of %ix%i pixels and %i tris.\n", w, h, tottri);
+       CLOG_INFO(&LOG, 1, "Preparing UV surface of %ix%i pixels and %i tris.", w, h, tottri);
 
        /* Init data struct */
        if (surface->data)
@@ -3236,7 +3240,7 @@ void dynamicPaint_outputSurfaceImage(DynamicPaintSurface *surface, char *filenam
                return;
        }
 
-       DynamicPaintOutputSurfaceImageData data = {.surface = surface, .ibuf = ibuf};
+       DynamicPaintOutputSurfaceImageData data = { .surface = surface, .ibuf = ibuf, };
        switch (surface->type) {
                case MOD_DPAINT_SURFACE_T_PAINT:
                        switch (output_layer) {
@@ -4191,7 +4195,7 @@ static int dynamicPaint_paintMesh(Depsgraph *depsgraph, DynamicPaintSurface *sur
                                            .scene = scene, .timescale = timescale, .c_index = c_index,
                                            .mesh = mesh, .mvert = mvert, .mloop = mloop, .mlooptri = mlooptri,
                                            .brush_radius = brush_radius, .avg_brushNor = avg_brushNor, .brushVelocity = brushVelocity,
-                                           .treeData = &treeData
+                                           .treeData = &treeData,
                                        };
                                        ParallelRangeSettings settings;
                                        BLI_parallel_range_settings_defaults(&settings);
@@ -4449,7 +4453,7 @@ static int dynamicPaint_paintParticles(DynamicPaintSurface *surface,
                particlesAdded++;
        }
        if (invalidParticles)
-               printf("Warning: Invalid particle(s) found!\n");
+               CLOG_WARN(&LOG, "Invalid particle(s) found!");
 
        /* If no suitable particles were found, exit */
        if (particlesAdded < 1) {
@@ -5351,7 +5355,7 @@ static void dynamicPaint_doBorderStep(DynamicPaintSurface *surface)
 
        /* Don't use prevPoint, relying on the condition that neighbors are never border pixels. */
        DynamicPaintEffectData data = {
-               .surface = surface
+               .surface = surface,
        };
 
        ParallelRangeSettings settings;
@@ -5907,7 +5911,7 @@ static int dynamicPaint_doStep(
                return 0;
 
        if (dynamic_paint_surface_needs_dry_dissolve(surface)) {
-               DynamicPaintDissolveDryData data = {.surface = surface, .timescale = timescale};
+               DynamicPaintDissolveDryData data = { .surface = surface, .timescale = timescale, };
                ParallelRangeSettings settings;
                BLI_parallel_range_settings_defaults(&settings);
                settings.use_threading = (sData->total_points > 1000);
@@ -5963,8 +5967,6 @@ static int dynamicPaint_doStep(
                                            psys_check_enabled(brushObj, brush->psys, for_render))
                                        {
                                                /* Paint a particle system */
-                                               BKE_animsys_evaluate_animdata(depsgraph, scene, &brush->psys->part->id, brush->psys->part->adt,
-                                                                             BKE_scene_frame_get(scene), ADT_RECALC_ANIM);
                                                dynamicPaint_paintParticles(surface, brush->psys, brush, timescale);
                                        }
                                        /* Object center distance: */