Revision: 40992
          
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=40992
Author:   miikah
Date:     2011-10-13 20:00:22 +0000 (Thu, 13 Oct 2011)
Log Message:
-----------
Dynamic Paint:
* Fix: Wave "timescale" also changed simulation behavior. Now different 
timescale values will lead to nearly identical results, just slower or faster.
* Added "Displace Factor" setting for vertex displace surfaces. You can use it 
to adjust final displace strength or use negative values to paint bumps.
* Added clamp/map value to wave image sequence output settings.
* RNA description tweaking.
* General code tweaking.

Modified Paths:
--------------
    
branches/soc-2011-carrot/release/scripts/startup/bl_ui/properties_physics_dynamicpaint.py
    branches/soc-2011-carrot/source/blender/blenkernel/BKE_customdata.h
    branches/soc-2011-carrot/source/blender/blenkernel/BKE_dynamicpaint.h
    branches/soc-2011-carrot/source/blender/blenkernel/intern/customdata.c
    branches/soc-2011-carrot/source/blender/blenkernel/intern/dynamicpaint.c
    branches/soc-2011-carrot/source/blender/blenlib/BLI_kdtree.h
    branches/soc-2011-carrot/source/blender/blenlib/intern/BLI_kdtree.c
    branches/soc-2011-carrot/source/blender/editors/physics/dynamicpaint_ops.c
    branches/soc-2011-carrot/source/blender/makesdna/DNA_dynamicpaint_types.h
    branches/soc-2011-carrot/source/blender/makesrna/intern/rna_dynamicpaint.c
    branches/soc-2011-carrot/source/blender/makesrna/intern/rna_space.c
    branches/soc-2011-carrot/source/blender/modifiers/intern/MOD_dynamicpaint.c
    branches/soc-2011-carrot/source/blender/modifiers/intern/MOD_util.c
    branches/soc-2011-carrot/source/blender/modifiers/intern/MOD_util.h
    branches/soc-2011-carrot/source/blender/modifiers/intern/MOD_uvproject.c
    branches/soc-2011-carrot/source/blender/modifiers/intern/MOD_wave.c
    branches/soc-2011-carrot/source/blenderplayer/bad_level_call_stubs/stubs.c

Modified: 
branches/soc-2011-carrot/release/scripts/startup/bl_ui/properties_physics_dynamicpaint.py
===================================================================
--- 
branches/soc-2011-carrot/release/scripts/startup/bl_ui/properties_physics_dynamicpaint.py
   2011-10-13 17:54:05 UTC (rev 40991)
+++ 
branches/soc-2011-carrot/release/scripts/startup/bl_ui/properties_physics_dynamicpaint.py
   2011-10-13 20:00:22 UTC (rev 40992)
@@ -183,8 +183,13 @@
         
         # per type settings
         if (surface.surface_type == "DISPLACE"):
-            layout.prop(surface, "disp_clamp")
             layout.prop(surface, "incremental_disp")
+            if (surface.surface_format == "VERTEX"):
+                split = layout.split()
+                col = split.column()
+                col.prop(surface, "depth_clamp")
+                col = split.column()
+                col.prop(surface, "disp_factor")
             
         if (surface.surface_type == "WAVE"):
             layout.prop(surface, "wave_open_borders")
@@ -284,6 +289,9 @@
                 col.prop(surface, "output_name", text="Filename: ")
                 if (surface.surface_type == "DISPLACE"):
                     col.prop(surface, "disp_type", text="Displace Type")
+                    col.prop(surface, "depth_clamp")
+                if (surface.surface_type == "WAVE"):
+                    col.prop(surface, "depth_clamp", text="Wave Clamp")
             
             layout.separator()
             layout.operator("dpaint.bake", text="Bake Image Sequence", 
icon='MOD_DYNAMICPAINT')

Modified: branches/soc-2011-carrot/source/blender/blenkernel/BKE_customdata.h
===================================================================
--- branches/soc-2011-carrot/source/blender/blenkernel/BKE_customdata.h 
2011-10-13 17:54:05 UTC (rev 40991)
+++ branches/soc-2011-carrot/source/blender/blenkernel/BKE_customdata.h 
2011-10-13 20:00:22 UTC (rev 40992)
@@ -280,6 +280,8 @@
 /* make sure the name of layer at index is unique */
 void CustomData_set_layer_unique_name(struct CustomData *data, int index);
 
+void CustomData_validate_layer_name(const struct CustomData *data, int type, 
char *name, char *outname);
+
 /* for file reading compatibility, returns false if the layer was freed,
    only after this test passes, layer->data should be assigned */
 int CustomData_verify_versions(struct CustomData *data, int index);

Modified: branches/soc-2011-carrot/source/blender/blenkernel/BKE_dynamicpaint.h
===================================================================
--- branches/soc-2011-carrot/source/blender/blenkernel/BKE_dynamicpaint.h       
2011-10-13 17:54:05 UTC (rev 40991)
+++ branches/soc-2011-carrot/source/blender/blenkernel/BKE_dynamicpaint.h       
2011-10-13 20:00:22 UTC (rev 40992)
@@ -70,6 +70,7 @@
 void dynamicPaint_freeSurface(struct DynamicPaintSurface *surface);
 void dynamicPaint_freeCanvas(struct DynamicPaintModifierData *pmd);
 void dynamicPaint_freeBrush(struct DynamicPaintModifierData *pmd);
+void dynamicPaint_freeSurfaceData(struct DynamicPaintSurface *surface);
 
 void dynamicPaint_cacheUpdateFrames(struct DynamicPaintSurface *surface);
 int  dynamicPaint_surfaceHasColorPreview(struct DynamicPaintSurface *surface);
@@ -79,6 +80,20 @@
 void dynamicPaint_resetPreview(struct DynamicPaintCanvasSettings *canvas);
 struct DynamicPaintSurface *get_activeSurface(struct 
DynamicPaintCanvasSettings *canvas);
 
-int dynamicPaint_initBake(struct bContext *C, struct wmOperator *op);
+/* image sequence baking */
+int dynamicPaint_createUVSurface(struct DynamicPaintSurface *surface);
+int dynamicPaint_calculateFrame(struct DynamicPaintSurface *surface, struct 
Scene *scene, struct Object *cObject, int frame);
+void dynamicPaint_outputImage(struct DynamicPaintSurface *surface, char* 
filename, short format, short type);
 
+
+/* surface -> image file flags */
+#define DPOUTPUT_JPEG 0
+#define DPOUTPUT_PNG 1
+#define DPOUTPUT_OPENEXR 2
+
+#define DPOUTPUT_PAINT 0
+#define DPOUTPUT_WET 1
+#define DPOUTPUT_DISPLACE 2
+#define DPOUTPUT_WAVES 3
+
 #endif /* BKE_DYNAMIC_PAINT_H_ */

Modified: branches/soc-2011-carrot/source/blender/blenkernel/intern/customdata.c
===================================================================
--- branches/soc-2011-carrot/source/blender/blenkernel/intern/customdata.c      
2011-10-13 17:54:05 UTC (rev 40991)
+++ branches/soc-2011-carrot/source/blender/blenkernel/intern/customdata.c      
2011-10-13 20:00:22 UTC (rev 40992)
@@ -2353,6 +2353,25 @@
        BLI_uniquename_cb(customdata_unique_check, &data_arg, 
typeInfo->defaultname, '.', nlayer->name, sizeof(nlayer->name));
 }
 
+void CustomData_validate_layer_name(const CustomData *data, int type, char 
*name, char *outname)
+{
+       int index = -1;
+
+       /* if a layer name was given, try to find that layer */
+       if(name[0])
+               index = CustomData_get_named_layer_index(data, type, name);
+
+       if(index < 0) {
+               /* either no layer was specified, or the layer we want has been
+               * deleted, so assign the active layer to name
+               */
+               index = CustomData_get_active_layer_index(data, type);
+               strcpy(outname, data->layers[index].name);
+       }
+       else
+               strcpy(outname, name);
+}
+
 int CustomData_verify_versions(struct CustomData *data, int index)
 {
        const LayerTypeInfo *typeInfo;

Modified: 
branches/soc-2011-carrot/source/blender/blenkernel/intern/dynamicpaint.c
===================================================================
--- branches/soc-2011-carrot/source/blender/blenkernel/intern/dynamicpaint.c    
2011-10-13 17:54:05 UTC (rev 40991)
+++ branches/soc-2011-carrot/source/blender/blenkernel/intern/dynamicpaint.c    
2011-10-13 20:00:22 UTC (rev 40992)
@@ -22,9 +22,6 @@
 #include "BLI_kdtree.h"
 #include "BLI_utildefines.h"
 
-/* Platform independend time   */
-#include "PIL_time.h"
-
 #include "DNA_anim_types.h"
 #include "DNA_dynamicpaint_types.h"
 #include "DNA_group_types.h" /*GroupObject*/
@@ -54,7 +51,6 @@
 #include "BKE_object.h"
 #include "BKE_particle.h"
 #include "BKE_pointcache.h"
-#include "BKE_report.h"
 #include "BKE_scene.h"
 #include "BKE_texture.h"
 
@@ -62,17 +58,10 @@
 #include "RNA_define.h"
 #include "RNA_enum_types.h"
 
-#include "../editors/include/ED_screen.h"
-#include "WM_api.h"
-
 /* for image output    */
 #include "IMB_imbuf_types.h"
 #include "IMB_imbuf.h"
 #include "BKE_image.h"
-#include "intern/IMB_filetype.h"
-#ifdef WITH_OPENEXR
-#include "intern/openexr/openexr_api.h"
-#endif
 
 /* uv validate */
 #include "intern/MOD_util.h"
@@ -90,30 +79,38 @@
 #include <omp.h>
 #endif
 
-#define DPOUTPUT_JPEG 0
-#define DPOUTPUT_PNG 1
-#define DPOUTPUT_OPENEXR 2
-
-struct Object;
-struct Scene;
-struct DerivedMesh;
-
 /* precalculated gaussian factors for 5x super sampling        */
-float gaussianFactors[5] = {   0.996849f,
+static float gaussianFactors[5] = {    0.996849f,
                                                                0.596145f,
                                                                0.596145f,
                                                                0.596145f,
                                                                0.524141f};
-float gaussianTotal = 3.309425f;
+static float gaussianTotal = 3.309425f;
 
-/*
-*      UV Image neighbouring pixel table x and y list
-*/
-int neighX[8] = {1,1,0,-1,-1,-1, 0, 1};
-int neighY[8] = {0,1,1, 1, 0,-1,-1,-1};
+/* UV Image neighbouring pixel table x and y list */
+static int neighX[8] = {1,1,0,-1,-1,-1, 0, 1};
+static int neighY[8] = {0,1,1, 1, 0,-1,-1,-1};
 
+/* subframe_updateObject() flags */
+#define UPDATE_PARENTS (1<<0)
+#define UPDATE_MESH (1<<1)
+#define UPDATE_EVERYTHING (UPDATE_PARENTS|UPDATE_MESH)
+/* surface_getBrushFlags() return vals */
+#define BRUSH_USES_VELOCITY (1<<0)
+/* brush mesh raycast status */
+#define HIT_VOLUME 1
+#define HIT_PROXIMITY 2
+/* paint effect default movement per frame in global units */
+#define EFF_MOVEMENT_PER_FRAME 0.05f
+/* initial wave time factor */
+#define WAVE_TIME_FAC 0.1
+/* vector macros */
+#define VECADDVAL(v,val)       {*(v)+=(val); *(v+1)+=(val); *(v+2)+=(val);}
+#define VECMULVAL(v,val)       {*(v)*=(val); *(v+1)*=(val); *(v+2)*=(val);}
+/* dissolve macro */
+#define VALUE_DISSOLVE(VALUE, SPEED, SCALE, LOG) (VALUE) = (LOG) ? (VALUE) * 
1.0f - 1.0f/((SPEED)/(SCALE)) : (VALUE) - 1.0f/(SPEED)*(SCALE)
+
 static int dynamicPaint_doStep(Scene *scene, Object *ob, DynamicPaintSurface 
*surface, float timescale, float subframe);
-static int dynamicPaint_calculateFrame(DynamicPaintSurface *surface, Scene 
*scene, Object *cObject, int frame);
 
 /***************************** Internal Structs ***************************/
 
@@ -127,7 +124,7 @@
 } Bounds3D;
 
 typedef struct VolumeGrid {
-       int x,y,z;
+       int dim[3];
        Bounds3D grid_bounds; /* whole grid bounds */
 
        Bounds3D *bounds;       /* (x*y*z) precalculated grid cell bounds */
@@ -373,13 +370,13 @@
                surface->output_name[0]='\0';
                surface->output_name2[0]='\0';
                surface->flags |= MOD_DPAINT_ANTIALIAS;
-               surface->disp_clamp = 1.0f;
+               surface->depth_clamp = 1.0f;
        }
        else {
                sprintf(surface->output_name, "dp_");
                strcpy(surface->output_name2,surface->output_name);
                surface->flags &= ~MOD_DPAINT_ANTIALIAS;
-               surface->disp_clamp = 0.0f;
+               surface->depth_clamp = 0.0f;
        }
 
        if (surface->type == MOD_DPAINT_SURFACE_T_PAINT) {
@@ -456,13 +453,8 @@
        BLI_freelistN(&pidlist);
 }
 
-#define UPDATE_PARENTS (1<<0)
-#define UPDATE_MESH (1<<1)
-#define UPDATE_EVERYTHING (UPDATE_PARENTS|UPDATE_MESH)
-
 static void subframe_updateObject(Scene *scene, Object *ob, int flags, float 
frame)
 {
-       int oflags;
        DynamicPaintModifierData *pmd = (DynamicPaintModifierData 
*)modifiers_findByType(ob, eModifierType_DynamicPaint);
 
        /* if other is dynamic paint canvas, dont update */
@@ -473,17 +465,13 @@
        if ((flags & UPDATE_PARENTS) && ob->parent) 
subframe_updateObject(scene, ob->parent, 0, frame);
        if ((flags & UPDATE_PARENTS) && ob->track) subframe_updateObject(scene, 
ob->track, 0, frame);
 
-       /* for curve */
+       /* for curve following objects, parented curve has to be updated too */
        if(ob->type==OB_CURVE) {
                Curve *cu= ob->data;
                BKE_animsys_evaluate_animdata(scene, &cu->id, cu->adt, frame, 
ADT_RECALC_ANIM);
        }
-       
-       /* backup object flags */
-       oflags = ob->recalc;
 
        ob->recalc |= OB_RECALC_ALL;
-       ob->recalc |= OB_RECALC_DATA;
        BKE_animsys_evaluate_animdata(scene, &ob->id, ob->adt, frame, 
ADT_RECALC_ANIM);
        if (flags & UPDATE_MESH) {
                /* ignore cache clear during subframe updates
@@ -494,9 +482,6 @@
        }
        else
                where_is_object_time(scene, ob, frame);
-
-       /* restore object flags */
-       ob->recalc = oflags;
 }
 
 static void scene_setSubframe(Scene *scene, float subframe)
@@ -645,72 +630,65 @@
 
        /* allocate separate bounds for each thread */

@@ Diff output truncated at 10240 characters. @@
_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to