Blender V2.61 - r43446

rna_dynamicpaint.c

Go to the documentation of this file.
00001 
00014 #include <stdlib.h>
00015 #include <limits.h>
00016 
00017 #include "RNA_define.h"
00018 
00019 #include "rna_internal.h"
00020 
00021 #include "BKE_modifier.h"
00022 #include "BKE_dynamicpaint.h"
00023 
00024 #include "DNA_dynamicpaint_types.h"
00025 #include "DNA_modifier_types.h"
00026 #include "DNA_object_force.h"
00027 #include "DNA_object_types.h"
00028 #include "DNA_scene_types.h"
00029 
00030 #include "WM_types.h"
00031 
00032 EnumPropertyItem prop_dynamicpaint_type_items[] = {
00033         {MOD_DYNAMICPAINT_TYPE_CANVAS, "CANVAS", 0, "Canvas", ""},
00034         {MOD_DYNAMICPAINT_TYPE_BRUSH, "BRUSH", 0, "Brush", ""},
00035         {0, NULL, 0, NULL, NULL}};
00036 
00037 
00038 #ifdef RNA_RUNTIME
00039 
00040 #include "BKE_context.h"
00041 #include "BKE_depsgraph.h"
00042 #include "BKE_particle.h"
00043 
00044 
00045 static char *rna_DynamicPaintCanvasSettings_path(PointerRNA *ptr)
00046 {
00047     DynamicPaintCanvasSettings *settings = (DynamicPaintCanvasSettings*)ptr->data;
00048     ModifierData *md= (ModifierData *)settings->pmd;
00049 
00050     return BLI_sprintfN("modifiers[\"%s\"].canvas_settings", md->name);
00051 }
00052 
00053 static char *rna_DynamicPaintBrushSettings_path(PointerRNA *ptr)
00054 {
00055     DynamicPaintBrushSettings *settings = (DynamicPaintBrushSettings*)ptr->data;
00056     ModifierData *md= (ModifierData *)settings->pmd;
00057 
00058     return BLI_sprintfN("modifiers[\"%s\"].brush_settings", md->name);
00059 }
00060 
00061 static char *rna_DynamicPaintSurface_path(PointerRNA *ptr)
00062 {
00063     DynamicPaintSurface *surface = (DynamicPaintSurface*)ptr->data;
00064     ModifierData *md= (ModifierData *)surface->canvas->pmd;
00065 
00066     return BLI_sprintfN("modifiers[\"%s\"].canvas_settings.canvas_surfaces[\"%s\"]", md->name, surface->name);
00067 }
00068 
00069 
00070 /*
00071 *   Surfaces
00072 */
00073 
00074 static void rna_DynamicPaint_redoModifier(Main *bmain, Scene *scene, PointerRNA *ptr)
00075 {
00076     DAG_id_tag_update(ptr->id.data, OB_RECALC_DATA);
00077 }
00078 
00079 static void rna_DynamicPaintSurfaces_updateFrames(Main *bmain, Scene *scene, PointerRNA *ptr)
00080 {
00081     dynamicPaint_cacheUpdateFrames((DynamicPaintSurface*)ptr->data);
00082 }
00083 
00084 static void rna_DynamicPaintSurface_reset(Main *bmain, Scene *scene, PointerRNA *ptr)
00085 {
00086     dynamicPaint_resetSurface((DynamicPaintSurface*)ptr->data);
00087     rna_DynamicPaint_redoModifier(bmain, scene, ptr);
00088 }
00089 
00090 static void rna_DynamicPaintSurface_initialcolortype(Main *bmain, Scene *scene, PointerRNA *ptr)
00091 {
00092     DynamicPaintSurface *surface = (DynamicPaintSurface*)ptr->data;
00093 
00094     surface->init_layername[0] = '\0';
00095     dynamicPaint_clearSurface(surface);
00096     rna_DynamicPaint_redoModifier(bmain, scene, ptr);
00097 }
00098 
00099 static void rna_DynamicPaintSurface_changePreview(Main *bmain, Scene *scene, PointerRNA *ptr)
00100 {
00101     DynamicPaintSurface *act_surface = (DynamicPaintSurface*)ptr->data;
00102     DynamicPaintSurface *surface = act_surface->canvas->surfaces.first;
00103 
00104     /* since only one color surface can show preview at time
00105     *  disable preview on other surfaces*/
00106     for(; surface; surface=surface->next) {
00107         if(surface != act_surface)
00108             surface->flags &= ~MOD_DPAINT_PREVIEW;
00109     }
00110     rna_DynamicPaint_redoModifier(bmain, scene, ptr);
00111 }
00112 
00113 static void rna_DynamicPaintSurface_uniqueName(Main *bmain, Scene *scene, PointerRNA *ptr)
00114 {
00115     dynamicPaintSurface_setUniqueName((DynamicPaintSurface*)ptr->data, ((DynamicPaintSurface*)ptr->data)->name);
00116 }
00117 
00118 
00119 static void rna_DynamicPaintSurface_changeType(Main *bmain, Scene *scene, PointerRNA *ptr)
00120 {
00121     dynamicPaintSurface_updateType((DynamicPaintSurface*)ptr->data);
00122     dynamicPaint_resetSurface((DynamicPaintSurface*)ptr->data);
00123     rna_DynamicPaintSurface_reset(bmain, scene, ptr);
00124 }
00125 
00126 static void rna_DynamicPaintSurfaces_changeFormat(Main *bmain, Scene *scene, PointerRNA *ptr)
00127 {
00128     DynamicPaintSurface *surface = (DynamicPaintSurface*)ptr->data;
00129 
00130     surface->type = MOD_DPAINT_SURFACE_T_PAINT;
00131     dynamicPaintSurface_updateType((DynamicPaintSurface*)ptr->data);
00132     rna_DynamicPaintSurface_reset(bmain, scene, ptr);
00133 }
00134 
00135 static void rna_DynamicPaint_resetDependancy(Main *bmain, Scene *scene, PointerRNA *ptr)
00136 {
00137     rna_DynamicPaintSurface_reset(bmain, scene, ptr);
00138     DAG_scene_sort(bmain, scene);
00139 }
00140 
00141 static PointerRNA rna_PaintSurface_active_get(PointerRNA *ptr)
00142 {
00143     DynamicPaintCanvasSettings *canvas= (DynamicPaintCanvasSettings*)ptr->data;
00144     DynamicPaintSurface *surface = canvas->surfaces.first;
00145     int id=0;
00146 
00147     for(; surface; surface=surface->next) {
00148         if(id == canvas->active_sur)
00149             return rna_pointer_inherit_refine(ptr, &RNA_DynamicPaintSurface, surface);
00150         id++;
00151     }
00152     return rna_pointer_inherit_refine(ptr, &RNA_DynamicPaintSurface, NULL);
00153 }
00154 
00155 static void rna_DynamicPaint_surfaces_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
00156 {
00157     DynamicPaintCanvasSettings *canvas= (DynamicPaintCanvasSettings*)ptr->data;
00158     //rna_iterator_array_begin(iter, (void*)canvas->surfaces, sizeof(PaintSurface), canvas->totsur, 0, 0);
00159     rna_iterator_listbase_begin(iter, &canvas->surfaces, NULL);
00160 }
00161 
00162 static int rna_Surface_active_point_index_get(PointerRNA *ptr)
00163 {
00164     DynamicPaintCanvasSettings *canvas= (DynamicPaintCanvasSettings*)ptr->data;
00165     return canvas->active_sur;
00166 }
00167 
00168 static void rna_Surface_active_point_index_set(struct PointerRNA *ptr, int value)
00169 {
00170     DynamicPaintCanvasSettings *canvas= (DynamicPaintCanvasSettings*)ptr->data;
00171     canvas->active_sur = value;
00172     return;
00173 }
00174 
00175 static void rna_Surface_active_point_range(PointerRNA *ptr, int *min, int *max)
00176 {
00177     DynamicPaintCanvasSettings *canvas= (DynamicPaintCanvasSettings*)ptr->data;
00178 
00179     *min= 0;
00180     *max= BLI_countlist(&canvas->surfaces)-1;
00181 }
00182 
00183 /* uvlayer */
00184 static void rna_DynamicPaint_uvlayer_set(PointerRNA *ptr, const char *value)
00185 {
00186     DynamicPaintCanvasSettings *canvas= ((DynamicPaintSurface*)ptr->data)->canvas;
00187     DynamicPaintSurface *surface = canvas->surfaces.first;
00188     int id=0;
00189 
00190     for(; surface; surface=surface->next) {
00191         if(id == canvas->active_sur) {
00192             rna_object_uvlayer_name_set(ptr, value, surface->uvlayer_name, sizeof(surface->uvlayer_name));
00193             return;
00194         }
00195         id++;
00196     }
00197 }
00198 
00199 /* is point cache used */
00200 static int rna_DynamicPaint_is_cache_user_get(PointerRNA *ptr)
00201 {
00202     DynamicPaintSurface *surface= (DynamicPaintSurface*)ptr->data;
00203 
00204     return (surface->format != MOD_DPAINT_SURFACE_F_IMAGESEQ) ?  1 : 0;
00205 }
00206 
00207 /* does output layer exist*/
00208 static int rna_DynamicPaint_is_output_exists(DynamicPaintSurface *surface, Object *ob, int index)
00209 {
00210     return dynamicPaint_outputLayerExists(surface, ob, index);
00211 }
00212 
00213 
00214 static EnumPropertyItem *rna_DynamicPaint_surface_type_itemf(bContext *C, PointerRNA *ptr, PropertyRNA *UNUSED(prop), int *free)
00215 {
00216     DynamicPaintSurface *surface= (DynamicPaintSurface*)ptr->data;
00217 
00218     EnumPropertyItem *item= NULL;
00219     EnumPropertyItem tmp= {0, "", 0, "", ""};
00220     int totitem= 0;
00221 
00222     /* Paint type - available for all formats */
00223     tmp.value = MOD_DPAINT_SURFACE_T_PAINT;
00224     tmp.identifier = "PAINT";
00225     tmp.name = "Paint";
00226     RNA_enum_item_add(&item, &totitem, &tmp);
00227 
00228     /* Displace */
00229     if (surface->format == MOD_DPAINT_SURFACE_F_VERTEX ||
00230         surface->format == MOD_DPAINT_SURFACE_F_IMAGESEQ) {
00231         tmp.value = MOD_DPAINT_SURFACE_T_DISPLACE;
00232         tmp.identifier = "DISPLACE";
00233         tmp.name = "Displace";
00234         RNA_enum_item_add(&item, &totitem, &tmp);
00235     }
00236 
00237     /* Weight */
00238     if (surface->format == MOD_DPAINT_SURFACE_F_VERTEX) {
00239         tmp.value = MOD_DPAINT_SURFACE_T_WEIGHT;
00240         tmp.identifier = "WEIGHT";
00241         tmp.name = "Weight";
00242         RNA_enum_item_add(&item, &totitem, &tmp);
00243     }
00244 
00245     /* Height waves */
00246     {
00247         tmp.value = MOD_DPAINT_SURFACE_T_WAVE;
00248         tmp.identifier = "WAVE";
00249         tmp.name = "Waves";
00250         RNA_enum_item_add(&item, &totitem, &tmp);
00251     }
00252 
00253     RNA_enum_item_end(&item, &totitem);
00254     *free = 1;
00255 
00256     return item;
00257 }
00258 
00259 #else
00260 
00261 /* canvas.canvas_surfaces */
00262 static void rna_def_canvas_surfaces(BlenderRNA *brna, PropertyRNA *cprop)
00263 {
00264     StructRNA *srna;
00265     PropertyRNA *prop;
00266 
00267     RNA_def_property_srna(cprop, "DynamicPaintSurfaces");
00268     srna= RNA_def_struct(brna, "DynamicPaintSurfaces", NULL);
00269     RNA_def_struct_sdna(srna, "DynamicPaintCanvasSettings");
00270     RNA_def_struct_ui_text(srna, "Canvas Surfaces", "Collection of Dynamic Paint Canvas surfaces");
00271 
00272     prop= RNA_def_property(srna, "active_index", PROP_INT, PROP_UNSIGNED);
00273     RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
00274     RNA_def_property_int_funcs(prop, "rna_Surface_active_point_index_get", "rna_Surface_active_point_index_set", "rna_Surface_active_point_range");
00275     RNA_def_property_ui_text(prop, "Active Point Cache Index", "");
00276 
00277     prop= RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
00278     RNA_def_property_struct_type(prop, "DynamicPaintSurface");
00279     RNA_def_property_pointer_funcs(prop, "rna_PaintSurface_active_get", NULL, NULL, NULL);
00280     RNA_def_property_ui_text(prop, "Active Surface", "Active Dynamic Paint surface being displayed");
00281     RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL);
00282 }
00283 
00284 
00285 static void rna_def_canvas_surface(BlenderRNA *brna)
00286 {
00287     StructRNA *srna;
00288     PropertyRNA *prop;
00289     PropertyRNA *parm;
00290     FunctionRNA *func;
00291 
00292     /*  Surface format */
00293     static EnumPropertyItem prop_dynamicpaint_surface_format[] = {
00294             //{MOD_DPAINT_SURFACE_F_PTEX, "PTEX", ICON_TEXTURE_SHADED, "Ptex", ""},
00295             {MOD_DPAINT_SURFACE_F_VERTEX, "VERTEX", ICON_OUTLINER_DATA_MESH, "Vertex", ""},
00296             {MOD_DPAINT_SURFACE_F_IMAGESEQ, "IMAGE", ICON_FILE_IMAGE, "Image Sequence", ""},
00297             {0, NULL, 0, NULL, NULL}};
00298 
00299     /*  Surface type - generated dynamically based on surface format */
00300     static EnumPropertyItem prop_dynamicpaint_surface_type[] = {
00301             {MOD_DPAINT_SURFACE_T_PAINT, "PAINT", 0, "Paint", ""},
00302             {0, NULL, 0, NULL, NULL}};
00303 
00304     /*  Surface output preview. currently only paint has multiple outputs */
00305     static EnumPropertyItem prop_dynamicpaint_surface_preview[] = {
00306             {MOD_DPAINT_SURFACE_PREV_PAINT, "PAINT", 0, "Paint", ""},
00307             {MOD_DPAINT_SURFACE_PREV_WETMAP, "WETMAP", 0, "Wetmap", ""},
00308             {0, NULL, 0, NULL, NULL}};
00309 
00310     /*  Initial color setting */
00311     static EnumPropertyItem prop_dynamicpaint_init_color_type[] = {
00312             {MOD_DPAINT_INITIAL_NONE, "NONE", 0, "None", ""},
00313             {MOD_DPAINT_INITIAL_COLOR, "COLOR", ICON_COLOR, "Color", ""},
00314             {MOD_DPAINT_INITIAL_TEXTURE, "TEXTURE", ICON_TEXTURE, "UV Texture", ""},
00315             {MOD_DPAINT_INITIAL_VERTEXCOLOR, "VERTEX_COLOR", ICON_GROUP_VCOL, "Vertex Color", ""},
00316             {0, NULL, 0, NULL, NULL}};
00317 
00318     /*  Effect type
00319     *   Only used by ui to view per effect settings */
00320     static EnumPropertyItem prop_dynamicpaint_effecttype[] = {
00321             {1, "SPREAD", 0, "Spread", ""},
00322             {2, "DRIP", 0, "Drip", ""},
00323             {3, "SHRINK", 0, "Shrink", ""},
00324             {0, NULL, 0, NULL, NULL}};
00325 
00326     /* Displacemap file format */
00327     static EnumPropertyItem prop_dynamicpaint_image_fileformat[] = {
00328             {MOD_DPAINT_IMGFORMAT_PNG, "PNG", 0, "PNG", ""},
00329 #ifdef WITH_OPENEXR
00330             {MOD_DPAINT_IMGFORMAT_OPENEXR, "OPENEXR", 0, "OpenEXR", ""},
00331 #endif
00332             {0, NULL, 0, NULL, NULL}};
00333 
00334     /* Displacemap type */
00335     static EnumPropertyItem prop_dynamicpaint_displace_type[] = {
00336             {MOD_DPAINT_DISP_DISPLACE, "DISPLACE", 0, "Displacement", ""},
00337             {MOD_DPAINT_DISP_DEPTH, "DEPTH", 0, "Depth", ""},
00338             {0, NULL, 0, NULL, NULL}};
00339 
00340 
00341 
00342     /* Surface */
00343     srna= RNA_def_struct(brna, "DynamicPaintSurface", NULL);
00344     RNA_def_struct_sdna(srna, "DynamicPaintSurface");
00345     RNA_def_struct_ui_text(srna, "Paint Surface", "A canvas surface layer");
00346     RNA_def_struct_path_func(srna, "rna_DynamicPaintSurface_path");
00347 
00348     prop= RNA_def_property(srna, "surface_format", PROP_ENUM, PROP_NONE);
00349     RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
00350     RNA_def_property_enum_sdna(prop, NULL, "format");
00351     RNA_def_property_enum_items(prop, prop_dynamicpaint_surface_format);
00352     RNA_def_property_ui_text(prop, "Format", "Surface Format");
00353     RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_DynamicPaintSurfaces_changeFormat");
00354 
00355     prop= RNA_def_property(srna, "surface_type", PROP_ENUM, PROP_NONE);
00356     RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
00357     RNA_def_property_enum_sdna(prop, NULL, "type");
00358     RNA_def_property_enum_items(prop, prop_dynamicpaint_surface_type);
00359     RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_DynamicPaint_surface_type_itemf");
00360     RNA_def_property_ui_text(prop, "Surface Type", "Surface Type");
00361     RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_DynamicPaintSurface_changeType");
00362 
00363     prop= RNA_def_property(srna, "is_active", PROP_BOOLEAN, PROP_NONE);
00364     RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DPAINT_ACTIVE);
00365     RNA_def_property_ui_text(prop, "Is Active", "Toggle whether surface is processed or ignored");
00366     RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_DynamicPaint_redoModifier");
00367 
00368     prop= RNA_def_property(srna, "show_preview", PROP_BOOLEAN, PROP_NONE);
00369     RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DPAINT_PREVIEW);
00370     RNA_def_property_ui_text(prop, "Show Preview", "Display surface preview in 3D-views");
00371     RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_DynamicPaintSurface_changePreview");
00372 
00373     prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
00374     RNA_def_property_ui_text(prop, "Name", "Surface name");
00375     RNA_def_property_update(prop, NC_OBJECT, "rna_DynamicPaintSurface_uniqueName");
00376     RNA_def_struct_name_property(srna, prop);
00377 
00378     prop= RNA_def_property(srna, "brush_group", PROP_POINTER, PROP_NONE);
00379     RNA_def_property_struct_type(prop, "Group");
00380     RNA_def_property_flag(prop, PROP_EDITABLE);
00381     RNA_def_property_ui_text(prop, "Brush Group", "Only use brush objects from this group");
00382     RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_DynamicPaint_resetDependancy");
00383 
00384 
00385     /*
00386     *   Paint, wet and displace
00387     */
00388 
00389     prop= RNA_def_property(srna, "use_dissolve", PROP_BOOLEAN, PROP_NONE);
00390     RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DPAINT_DISSOLVE);
00391     RNA_def_property_ui_text(prop, "Dissolve", "Enable to make surface changes disappear over time");
00392     
00393     prop= RNA_def_property(srna, "dissolve_speed", PROP_INT, PROP_NONE);
00394     RNA_def_property_int_sdna(prop, NULL, "diss_speed");
00395     RNA_def_property_range(prop, 1.0, 10000.0);
00396     RNA_def_property_ui_range(prop, 1.0, 10000.0, 5, 0);
00397     RNA_def_property_ui_text(prop, "Dissolve Speed", "Approximately in how many frames should dissolve happen");
00398 
00399     prop= RNA_def_property(srna, "use_drying", PROP_BOOLEAN, PROP_NONE);
00400     RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DPAINT_USE_DRYING);
00401     RNA_def_property_ui_text(prop, "Dry", "Enable to make surface wetness dry over time");
00402     
00403     prop= RNA_def_property(srna, "dry_speed", PROP_INT, PROP_NONE);
00404     RNA_def_property_range(prop, 1.0, 10000.0);
00405     RNA_def_property_ui_range(prop, 1.0, 10000.0, 5, 0);
00406     RNA_def_property_ui_text(prop, "Dry Speed", "Approximately in how many frames should drying happen");
00407     
00408     /*
00409     *   Simulation settings
00410     */
00411     prop= RNA_def_property(srna, "image_resolution", PROP_INT, PROP_NONE);
00412     RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
00413     RNA_def_property_range(prop, 16.0, 4096.0);
00414     RNA_def_property_ui_range(prop, 16.0, 4096.0, 1, 0);
00415     RNA_def_property_ui_text(prop, "Resolution", "Output image resolution");
00416     
00417     prop= RNA_def_property(srna, "uv_layer", PROP_STRING, PROP_NONE);
00418     RNA_def_property_string_sdna(prop, NULL, "uvlayer_name");
00419     RNA_def_property_ui_text(prop, "UV Map", "UV map name");
00420     RNA_def_property_string_funcs(prop, NULL, NULL, "rna_DynamicPaint_uvlayer_set");
00421     
00422     prop= RNA_def_property(srna, "frame_start", PROP_INT, PROP_NONE);
00423     RNA_def_property_int_sdna(prop, NULL, "start_frame");
00424     RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
00425     RNA_def_property_range(prop, 1.0, 9999.0);
00426     RNA_def_property_ui_range(prop, 1.0, 9999, 1, 0);
00427     RNA_def_property_ui_text(prop, "Start Frame", "Simulation start frame");
00428     RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_DynamicPaintSurfaces_updateFrames");
00429     
00430     prop= RNA_def_property(srna, "frame_end", PROP_INT, PROP_NONE);
00431     RNA_def_property_int_sdna(prop, NULL, "end_frame");
00432     RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
00433     RNA_def_property_range(prop, 1.0, 9999.0);
00434     RNA_def_property_ui_range(prop, 1.0, 9999.0, 1, 0);
00435     RNA_def_property_ui_text(prop, "End Frame", "Simulation end frame");
00436     RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_DynamicPaintSurfaces_updateFrames");
00437     
00438     prop= RNA_def_property(srna, "frame_substeps", PROP_INT, PROP_NONE);
00439     RNA_def_property_int_sdna(prop, NULL, "substeps");
00440     RNA_def_property_range(prop, 0.0, 20.0);
00441     RNA_def_property_ui_range(prop, 0.0, 10, 1, 0);
00442     RNA_def_property_ui_text(prop, "Sub-Steps", "Do extra frames between scene frames to ensure smooth motion");
00443     
00444     prop= RNA_def_property(srna, "use_antialiasing", PROP_BOOLEAN, PROP_NONE);
00445     RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
00446     RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DPAINT_ANTIALIAS);
00447     RNA_def_property_ui_text(prop, "Anti-aliasing", "Use 5x multisampling to smoothen paint edges");
00448     RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_DynamicPaintSurface_reset");
00449 
00450     prop= RNA_def_property(srna, "brush_influence_scale", PROP_FLOAT, PROP_FACTOR);
00451     RNA_def_property_float_sdna(prop, NULL, "influence_scale");
00452     RNA_def_property_range(prop, 0.0, 1.0);
00453     RNA_def_property_ui_range(prop, 0.0, 1.0, 1, 2);
00454     RNA_def_property_ui_text(prop, "Influence Scale", "Adjust influence brush objects have on this surface");
00455     RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_DynamicPaint_redoModifier");
00456 
00457     prop= RNA_def_property(srna, "brush_radius_scale", PROP_FLOAT, PROP_FACTOR);
00458     RNA_def_property_float_sdna(prop, NULL, "radius_scale");
00459     RNA_def_property_range(prop, 0.0, 10.0);
00460     RNA_def_property_ui_range(prop, 0.0, 1.0, 1, 2);
00461     RNA_def_property_ui_text(prop, "Radius Scale", "Adjust radius of proximity brushes or particles for this surface");
00462     RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_DynamicPaint_redoModifier");
00463 
00464     /*
00465     *   Initial Color
00466     */
00467 
00468     prop= RNA_def_property(srna, "init_color_type", PROP_ENUM, PROP_NONE);
00469     RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
00470     RNA_def_property_enum_items(prop, prop_dynamicpaint_init_color_type);
00471     RNA_def_property_ui_text(prop, "Initial Color", "");
00472     RNA_def_property_update(prop, NC_MATERIAL|ND_SHADING_DRAW|ND_MODIFIER, "rna_DynamicPaintSurface_initialcolortype");
00473 
00474     prop= RNA_def_property(srna, "init_color", PROP_FLOAT, PROP_COLOR_GAMMA);
00475     RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
00476     RNA_def_property_array(prop, 4);
00477     RNA_def_property_ui_text(prop, "Color", "Initial color of the surface");
00478     RNA_def_property_update(prop, NC_MATERIAL|ND_SHADING_DRAW|ND_MODIFIER, "rna_DynamicPaintSurface_reset");
00479 
00480     prop= RNA_def_property(srna, "init_texture", PROP_POINTER, PROP_NONE);
00481     RNA_def_property_flag(prop, PROP_EDITABLE);
00482     RNA_def_property_ui_text(prop, "Texture", "");
00483     RNA_def_property_update(prop, NC_MATERIAL|ND_SHADING_DRAW|ND_MODIFIER, "rna_DynamicPaintSurface_reset");
00484 
00485     prop= RNA_def_property(srna, "init_layername", PROP_STRING, PROP_NONE);
00486     RNA_def_property_ui_text(prop, "Data Layer", "");
00487     RNA_def_property_update(prop, NC_MATERIAL|ND_SHADING_DRAW|ND_MODIFIER, "rna_DynamicPaintSurface_reset");
00488 
00489     /*
00490     *   Effect Settings
00491     */
00492     prop= RNA_def_property(srna, "effect_ui", PROP_ENUM, PROP_NONE);
00493     RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
00494     RNA_def_property_enum_items(prop, prop_dynamicpaint_effecttype);
00495     RNA_def_property_ui_text(prop, "Effect Type", "");
00496     
00497     prop= RNA_def_property(srna, "use_dry_log", PROP_BOOLEAN, PROP_NONE);
00498     RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DPAINT_DRY_LOG);
00499     RNA_def_property_ui_text(prop, "Slow", "Use logarithmic drying (makes high values to dry faster than low values)");
00500 
00501     prop= RNA_def_property(srna, "use_dissolve_log", PROP_BOOLEAN, PROP_NONE);
00502     RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DPAINT_DISSOLVE_LOG);
00503     RNA_def_property_ui_text(prop, "Slow", "Use logarithmic dissolve (makes high values to fade faster than low values)");
00504     
00505     prop= RNA_def_property(srna, "use_spread", PROP_BOOLEAN, PROP_NONE);
00506     RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
00507     RNA_def_property_boolean_sdna(prop, NULL, "effect", MOD_DPAINT_EFFECT_DO_SPREAD);
00508     RNA_def_property_ui_text(prop, "Use Spread", "Process spread effect (spread wet paint around surface)");
00509     RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_DynamicPaintSurface_reset");
00510     
00511     prop= RNA_def_property(srna, "spread_speed", PROP_FLOAT, PROP_NONE);
00512     RNA_def_property_float_sdna(prop, NULL, "spread_speed");
00513     RNA_def_property_range(prop, 0.001, 10.0);
00514     RNA_def_property_ui_range(prop, 0.01, 5.0, 1, 2);
00515     RNA_def_property_ui_text(prop, "Spread Speed", "How fast spread effect moves on the canvas surface");
00516 
00517     prop= RNA_def_property(srna, "color_dry_threshold", PROP_FLOAT, PROP_FACTOR);
00518     RNA_def_property_float_sdna(prop, NULL, "color_dry_threshold");
00519     RNA_def_property_range(prop, 0.0, 1.0);
00520     RNA_def_property_ui_range(prop, 0.0, 1.0, 1, 2);
00521     RNA_def_property_ui_text(prop, "Color Dry", "The wetness level when colors start to shift to the background");
00522 
00523     prop= RNA_def_property(srna, "color_spread_speed", PROP_FLOAT, PROP_NONE);
00524     RNA_def_property_float_sdna(prop, NULL, "color_spread_speed");
00525     RNA_def_property_range(prop, 0.0, 2.0);
00526     RNA_def_property_ui_range(prop, 0.0, 2.0, 1, 2);
00527     RNA_def_property_ui_text(prop, "Color Spread", "How fast colors get mixed within wet paint");
00528     
00529     prop= RNA_def_property(srna, "use_drip", PROP_BOOLEAN, PROP_NONE);
00530     RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
00531     RNA_def_property_boolean_sdna(prop, NULL, "effect", MOD_DPAINT_EFFECT_DO_DRIP);
00532     RNA_def_property_ui_text(prop, "Use Drip", "Process drip effect (drip wet paint to gravity direction)");
00533     RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_DynamicPaintSurface_reset");
00534     
00535     prop= RNA_def_property(srna, "use_shrink", PROP_BOOLEAN, PROP_NONE);
00536     RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
00537     RNA_def_property_boolean_sdna(prop, NULL, "effect", MOD_DPAINT_EFFECT_DO_SHRINK);
00538     RNA_def_property_ui_text(prop, "Use Shrink", "Process shrink effect (shrink paint areas)");
00539     RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_DynamicPaintSurface_reset");
00540     
00541     prop= RNA_def_property(srna, "shrink_speed", PROP_FLOAT, PROP_NONE);
00542     RNA_def_property_float_sdna(prop, NULL, "shrink_speed");
00543     RNA_def_property_range(prop, 0.001, 10.0);
00544     RNA_def_property_ui_range(prop, 0.01, 5.0, 1, 2);
00545     RNA_def_property_ui_text(prop, "Shrink Speed", "How fast shrink effect moves on the canvas surface");
00546 
00547     prop= RNA_def_property(srna, "effector_weights", PROP_POINTER, PROP_NONE);
00548     RNA_def_property_struct_type(prop, "EffectorWeights");
00549     RNA_def_property_clear_flag(prop, PROP_EDITABLE);
00550     RNA_def_property_ui_text(prop, "Effector Weights", "");
00551 
00552     prop= RNA_def_property(srna, "drip_velocity", PROP_FLOAT, PROP_NONE);
00553     RNA_def_property_float_sdna(prop, NULL, "drip_vel");
00554     RNA_def_property_range(prop, -200.0f, 200.0f);
00555     RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.1, 3);
00556     RNA_def_property_ui_text(prop, "Velocity", "How much surface velocity affects dripping");
00557 
00558     prop= RNA_def_property(srna, "drip_acceleration", PROP_FLOAT, PROP_NONE);
00559     RNA_def_property_float_sdna(prop, NULL, "drip_acc");
00560     RNA_def_property_range(prop, -200.0f, 200.0f);
00561     RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.1, 3);
00562     RNA_def_property_ui_text(prop, "Acceleration", "How much surface acceleration affects dripping");
00563 
00564     /*
00565     *   Output settings
00566     */
00567     prop= RNA_def_property(srna, "use_premultiply", PROP_BOOLEAN, PROP_NONE);
00568     RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
00569     RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DPAINT_MULALPHA);
00570     RNA_def_property_ui_text(prop, "Premultiply alpha", "Multiply color by alpha (recommended for Blender input)");
00571     
00572     prop= RNA_def_property(srna, "image_output_path", PROP_STRING, PROP_DIRPATH);
00573     RNA_def_property_string_sdna(prop, NULL, "image_output_path");
00574     RNA_def_property_ui_text(prop, "Output Path", "Directory to save the textures");
00575 
00576     /* output for primary surface data */
00577     prop= RNA_def_property(srna, "output_name_a", PROP_STRING, PROP_NONE);
00578     RNA_def_property_string_sdna(prop, NULL, "output_name");
00579     RNA_def_property_ui_text(prop, "Output Name", "Name used to save output from this surface");
00580 
00581     prop= RNA_def_property(srna, "use_output_a", PROP_BOOLEAN, PROP_NONE);
00582     RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DPAINT_OUT1);
00583     RNA_def_property_ui_text(prop, "Use Output", "Save this output layer");
00584 
00585     /* output for secondary sufrace data */
00586     prop= RNA_def_property(srna, "output_name_b", PROP_STRING, PROP_NONE);
00587     RNA_def_property_string_sdna(prop, NULL, "output_name2");
00588     RNA_def_property_ui_text(prop, "Output Name", "Name used to save output from this surface");
00589 
00590     prop= RNA_def_property(srna, "use_output_b", PROP_BOOLEAN, PROP_NONE);
00591     RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DPAINT_OUT2);
00592     RNA_def_property_ui_text(prop, "Use Output", "Save this output layer");
00593 
00594     prop= RNA_def_property(srna, "preview_id", PROP_ENUM, PROP_NONE);
00595     RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
00596     RNA_def_property_enum_sdna(prop, NULL, "preview_id");
00597     RNA_def_property_enum_items(prop, prop_dynamicpaint_surface_preview);
00598     RNA_def_property_ui_text(prop, "Preview", "");
00599     RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_DynamicPaint_redoModifier");
00600 
00601     /* to check if output name exists */
00602     func = RNA_def_function(srna, "output_exists", "rna_DynamicPaint_is_output_exists");
00603     RNA_def_function_ui_description(func, "Checks if surface output layer of given name exists");
00604     parm= RNA_def_pointer(func, "object", "Object", "", "");
00605     RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
00606     parm= RNA_def_int(func, "index", 0, 0, 1, "Index", "", 0, 1);
00607     RNA_def_property_flag(parm, PROP_REQUIRED);
00608     /* return type */
00609     parm= RNA_def_boolean(func, "exists", 0, "", "");
00610     RNA_def_function_return(func, parm);
00611     
00612     prop= RNA_def_property(srna, "depth_clamp", PROP_FLOAT, PROP_NONE);
00613     RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
00614     RNA_def_property_range(prop, 0.00, 50.0);
00615     RNA_def_property_ui_range(prop, 0.00, 5.0, 1, 2);
00616     RNA_def_property_ui_text(prop, "Max Displace", "Maximum level of depth intersection in object space (use 0.0 to disable)");
00617     RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_DynamicPaint_redoModifier");
00618 
00619     prop= RNA_def_property(srna, "displace_factor", PROP_FLOAT, PROP_NONE);
00620     RNA_def_property_float_sdna(prop, NULL, "disp_factor");
00621     RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
00622     RNA_def_property_range(prop, -50.0, 50.0);
00623     RNA_def_property_ui_range(prop, -5.0, 5.0, 1, 2);
00624     RNA_def_property_ui_text(prop, "Displace Factor", "Strength of displace when applied to the mesh");
00625     RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_DynamicPaint_redoModifier");
00626     
00627     prop= RNA_def_property(srna, "image_fileformat", PROP_ENUM, PROP_NONE);
00628     RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
00629     RNA_def_property_enum_items(prop, prop_dynamicpaint_image_fileformat);
00630     RNA_def_property_ui_text(prop, "File Format", "");
00631     
00632     prop= RNA_def_property(srna, "displace_type", PROP_ENUM, PROP_NONE);
00633     RNA_def_property_enum_sdna(prop, NULL, "disp_type");
00634     RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
00635     RNA_def_property_enum_items(prop, prop_dynamicpaint_displace_type);
00636     RNA_def_property_ui_text(prop, "Data Type", "");
00637 
00638     prop= RNA_def_property(srna, "use_incremental_displace", PROP_BOOLEAN, PROP_NONE);
00639     RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
00640     RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DPAINT_DISP_INCREMENTAL);
00641     RNA_def_property_ui_text(prop, "Incremental", "New displace is added cumulatively on top of existing");
00642     RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_DynamicPaintSurface_reset");
00643 
00644     /* wave simulator settings */
00645     prop= RNA_def_property(srna, "wave_damping", PROP_FLOAT, PROP_NONE);
00646     RNA_def_property_range(prop, 0.0, 1.0);
00647     RNA_def_property_ui_range(prop, 0.01, 1.0, 1, 2);
00648     RNA_def_property_ui_text(prop, "Damping", "Wave damping factor");
00649 
00650     prop= RNA_def_property(srna, "wave_speed", PROP_FLOAT, PROP_NONE);
00651     RNA_def_property_range(prop, 0.01, 5.0);
00652     RNA_def_property_ui_range(prop, 0.20, 4.0, 1, 2);
00653     RNA_def_property_ui_text(prop, "Speed", "Wave propogation speed");
00654 
00655     prop= RNA_def_property(srna, "wave_timescale", PROP_FLOAT, PROP_NONE);
00656     RNA_def_property_range(prop, 0.01, 3.0);
00657     RNA_def_property_ui_range(prop, 0.01, 1.5, 1, 2);
00658     RNA_def_property_ui_text(prop, "Timescale", "Wave time scaling factor");
00659 
00660     prop= RNA_def_property(srna, "wave_spring", PROP_FLOAT, PROP_NONE);
00661     RNA_def_property_range(prop, 0.0, 1.0);
00662     RNA_def_property_ui_range(prop, 0.01, 1.0, 1, 2);
00663     RNA_def_property_ui_text(prop, "Spring", "Spring force that pulls water level back to zero");
00664 
00665     prop= RNA_def_property(srna, "use_wave_open_border", PROP_BOOLEAN, PROP_NONE);
00666     RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DPAINT_WAVE_OPEN_BORDERS);
00667     RNA_def_property_ui_text(prop, "Open Borders", "Pass waves through mesh edges");
00668 
00669     
00670     /* cache */
00671     prop= RNA_def_property(srna, "point_cache", PROP_POINTER, PROP_NONE);
00672     RNA_def_property_flag(prop, PROP_NEVER_NULL);
00673     RNA_def_property_pointer_sdna(prop, NULL, "pointcache");
00674     RNA_def_property_ui_text(prop, "Point Cache", "");
00675 
00676     /* is cache used */
00677     prop= RNA_def_property(srna, "is_cache_user", PROP_BOOLEAN, PROP_NONE);
00678     RNA_def_property_boolean_funcs(prop, "rna_DynamicPaint_is_cache_user_get", NULL);
00679     RNA_def_property_ui_text(prop, "Use Cache", "");
00680     RNA_def_property_clear_flag(prop, PROP_ANIMATABLE|PROP_EDITABLE);
00681 }
00682 
00683 static void rna_def_dynamic_paint_canvas_settings(BlenderRNA *brna)
00684 {
00685     StructRNA *srna;
00686     PropertyRNA *prop;
00687 
00688     srna = RNA_def_struct(brna, "DynamicPaintCanvasSettings", NULL);
00689     RNA_def_struct_ui_text(srna, "Canvas Settings", "Dynamic Paint canvas settings");
00690     RNA_def_struct_sdna(srna, "DynamicPaintCanvasSettings");
00691     RNA_def_struct_path_func(srna, "rna_DynamicPaintCanvasSettings_path");
00692 
00693     /*
00694     *   Surface Slots
00695     */
00696     prop= RNA_def_property(srna, "canvas_surfaces", PROP_COLLECTION, PROP_NONE);
00697     RNA_def_property_collection_funcs(prop, "rna_DynamicPaint_surfaces_begin", "rna_iterator_listbase_next", "rna_iterator_listbase_end", "rna_iterator_listbase_get", NULL, NULL, NULL, NULL);
00698     RNA_def_property_struct_type(prop, "DynamicPaintSurface");
00699     RNA_def_property_ui_text(prop, "Paint Surface List", "Paint surface list");
00700     rna_def_canvas_surfaces(brna, prop);
00701 }
00702 
00703 static void rna_def_dynamic_paint_brush_settings(BlenderRNA *brna)
00704 {
00705     StructRNA *srna;
00706     PropertyRNA *prop;
00707 
00708     /* paint collision type */
00709     static EnumPropertyItem prop_dynamicpaint_collisiontype[] = {
00710             {MOD_DPAINT_COL_PSYS, "PARTICLE_SYSTEM", ICON_PARTICLES, "Particle System", ""},
00711             {MOD_DPAINT_COL_POINT, "POINT", ICON_META_EMPTY, "Object Center", ""},
00712             {MOD_DPAINT_COL_DIST, "DISTANCE", ICON_META_EMPTY, "Proximity", ""},
00713             {MOD_DPAINT_COL_VOLDIST, "VOLUME_DISTANCE", ICON_META_CUBE, "Mesh Volume + Proximity", ""},
00714             {MOD_DPAINT_COL_VOLUME, "VOLUME", ICON_MESH_CUBE, "Mesh Volume", ""},
00715             {0, NULL, 0, NULL, NULL}};
00716 
00717     static EnumPropertyItem prop_dynamicpaint_prox_falloff[] = {
00718             {MOD_DPAINT_PRFALL_SMOOTH, "SMOOTH", ICON_SPHERECURVE, "Smooth", ""},
00719             {MOD_DPAINT_PRFALL_CONSTANT, "CONSTANT", ICON_NOCURVE, "Constant", ""},
00720             {MOD_DPAINT_PRFALL_RAMP, "RAMP", ICON_COLOR, "Color Ramp", ""},
00721             {0, NULL, 0, NULL, NULL}};
00722 
00723     static EnumPropertyItem prop_dynamicpaint_brush_wave_type[] = {
00724             {MOD_DPAINT_WAVEB_CHANGE, "CHANGE", 0, "Depth Change", ""},
00725             {MOD_DPAINT_WAVEB_DEPTH, "DEPTH", 0, "Obstacle", ""},
00726             {MOD_DPAINT_WAVEB_FORCE, "FORCE", 0, "Force", ""},
00727             {MOD_DPAINT_WAVEB_REFLECT, "REFLECT", 0, "Reflect Only", ""},
00728             {0, NULL, 0, NULL, NULL}};
00729 
00730     static EnumPropertyItem prop_dynamicpaint_brush_ray_dir[] = {
00731             {MOD_DPAINT_RAY_CANVAS, "CANVAS", 0, "Canvas Normal", ""},
00732             {MOD_DPAINT_RAY_BRUSH_AVG, "BRUSH", 0, "Brush Normal", ""},
00733             {MOD_DPAINT_RAY_ZPLUS, "Z_AXIS", 0, "Z-Axis", ""},
00734             {0, NULL, 0, NULL, NULL}};
00735 
00736     srna = RNA_def_struct(brna, "DynamicPaintBrushSettings", NULL);
00737     RNA_def_struct_ui_text(srna, "Brush Settings", "Brush settings");
00738     RNA_def_struct_sdna(srna, "DynamicPaintBrushSettings");
00739     RNA_def_struct_path_func(srna, "rna_DynamicPaintBrushSettings_path");
00740 
00741     /*
00742     *   Paint
00743     */
00744     prop= RNA_def_property(srna, "paint_color", PROP_FLOAT, PROP_COLOR_GAMMA);
00745     RNA_def_property_float_sdna(prop, NULL, "r");
00746     RNA_def_property_array(prop, 3);
00747     RNA_def_property_ui_text(prop, "Paint Color", "Color of the paint");
00748     RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_DynamicPaint_redoModifier");
00749 
00750     prop= RNA_def_property(srna, "paint_alpha", PROP_FLOAT, PROP_NONE);
00751     RNA_def_property_float_sdna(prop, NULL, "alpha");
00752     RNA_def_property_range(prop, 0.0, 1.0);
00753     RNA_def_property_ui_range(prop, 0.0, 1.0, 5, 2);
00754     RNA_def_property_ui_text(prop, "Paint Alpha", "Paint alpha");
00755     RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_DynamicPaint_redoModifier");
00756     
00757     prop= RNA_def_property(srna, "use_material", PROP_BOOLEAN, PROP_NONE);
00758     RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DPAINT_USE_MATERIAL);
00759     RNA_def_property_ui_text(prop, "Use object material", "Use object material to define color and influence");
00760     RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_DynamicPaint_redoModifier");
00761 
00762     prop= RNA_def_property(srna, "material", PROP_POINTER, PROP_NONE);
00763     RNA_def_property_pointer_sdna(prop, NULL, "mat");
00764     RNA_def_property_ui_text(prop, "Material", "Material to use (if not defined, material linked to the mesh is used)");
00765     RNA_def_property_flag(prop, PROP_EDITABLE);
00766     RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_DynamicPaint_redoModifier");
00767     
00768     prop= RNA_def_property(srna, "use_absolute_alpha", PROP_BOOLEAN, PROP_NONE);
00769     RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DPAINT_ABS_ALPHA);
00770     RNA_def_property_ui_text(prop, "Absolute Alpha", "Only increase alpha value if paint alpha is higher than existing");
00771     
00772     prop= RNA_def_property(srna, "paint_wetness", PROP_FLOAT, PROP_NONE);
00773     RNA_def_property_float_sdna(prop, NULL, "wetness");
00774     RNA_def_property_range(prop, 0.0, 1.0);
00775     RNA_def_property_ui_range(prop, 0.0, 1.0, 5, 2);
00776     RNA_def_property_ui_text(prop, "Paint Wetness", "Paint wetness, visible in wetmap (some effects only affect wet paint)");
00777     RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_DynamicPaint_redoModifier");
00778     
00779     prop= RNA_def_property(srna, "use_paint_erase", PROP_BOOLEAN, PROP_NONE);
00780     RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DPAINT_ERASE);
00781     RNA_def_property_ui_text(prop, "Erase Paint", "Erase / remove paint instead of adding it");
00782     RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_DynamicPaint_redoModifier");
00783 
00784     prop= RNA_def_property(srna, "wave_type", PROP_ENUM, PROP_NONE);
00785     RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
00786     RNA_def_property_enum_items(prop, prop_dynamicpaint_brush_wave_type);
00787     RNA_def_property_ui_text(prop, "Wave Type", "");
00788 
00789     prop= RNA_def_property(srna, "wave_factor", PROP_FLOAT, PROP_NONE);
00790     RNA_def_property_range(prop, -2.0, 2.0);
00791     RNA_def_property_ui_range(prop, -1.0, 1.0, 5, 2);
00792     RNA_def_property_ui_text(prop, "Factor", "Multiplier for wave influence of this brush");
00793 
00794     prop= RNA_def_property(srna, "wave_clamp", PROP_FLOAT, PROP_NONE);
00795     RNA_def_property_range(prop, 0.00, 50.0);
00796     RNA_def_property_ui_range(prop, 0.00, 5.0, 1, 2);
00797     RNA_def_property_ui_text(prop, "Clamp Waves", "Maximum level of surface intersection used to influence waves (use 0.0 to disable)");
00798 
00799     prop= RNA_def_property(srna, "use_smudge", PROP_BOOLEAN, PROP_NONE);
00800     RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DPAINT_DO_SMUDGE);
00801     RNA_def_property_ui_text(prop, "Do Smudge", "Make this brush to smudge existing paint as it moves");
00802 
00803     prop= RNA_def_property(srna, "smudge_strength", PROP_FLOAT, PROP_NONE);
00804     RNA_def_property_range(prop, 0.0, 1.0);
00805     RNA_def_property_ui_range(prop, 0.0, 1.0, 5, 2);
00806     RNA_def_property_ui_text(prop, "Smudge Strength", "Smudge effect strength");
00807 
00808     prop= RNA_def_property(srna, "velocity_max", PROP_FLOAT, PROP_NONE);
00809     RNA_def_property_float_sdna(prop, NULL, "max_velocity");
00810     RNA_def_property_range(prop, 0.0001, 10.0);
00811     RNA_def_property_ui_range(prop, 0.1, 2.0, 5, 2);
00812     RNA_def_property_ui_text(prop, "Max Velocity", "Velocity considered as maximum influence (Blender units per frame)");
00813 
00814     prop= RNA_def_property(srna, "use_velocity_alpha", PROP_BOOLEAN, PROP_NONE);
00815     RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DPAINT_VELOCITY_ALPHA);
00816     RNA_def_property_ui_text(prop, "Multiply Alpha", "Multiply brush influence by velocity color ramp alpha");
00817     RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_DynamicPaint_redoModifier");
00818 
00819     prop= RNA_def_property(srna, "use_velocity_depth", PROP_BOOLEAN, PROP_NONE);
00820     RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DPAINT_VELOCITY_DEPTH);
00821     RNA_def_property_ui_text(prop, "Multiply Depth", "Multiply brush intersection depth (displace, waves) by velocity ramp alpha");
00822     RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_DynamicPaint_redoModifier");
00823 
00824     prop= RNA_def_property(srna, "use_velocity_color", PROP_BOOLEAN, PROP_NONE);
00825     RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DPAINT_VELOCITY_COLOR);
00826     RNA_def_property_ui_text(prop, "Replace Color", "Replace brush color by velocity color ramp");
00827     RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_DynamicPaint_redoModifier");
00828     
00829     /*
00830     *   Paint Area / Collision
00831     */
00832     prop= RNA_def_property(srna, "paint_source", PROP_ENUM, PROP_NONE);
00833     RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
00834     RNA_def_property_enum_sdna(prop, NULL, "collision");
00835     RNA_def_property_enum_items(prop, prop_dynamicpaint_collisiontype);
00836     RNA_def_property_ui_text(prop, "Paint Source", "");
00837     RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_DynamicPaint_redoModifier");
00838     
00839     prop= RNA_def_property(srna, "paint_distance", PROP_FLOAT, PROP_NONE);
00840     RNA_def_property_float_sdna(prop, NULL, "paint_distance");
00841     RNA_def_property_range(prop, 0.0, 500.0);
00842     RNA_def_property_ui_range(prop, 0.0, 500.0, 10, 3);
00843     RNA_def_property_ui_text(prop, "Proximity Distance", "Maximum distance from brush to mesh surface to affect paint");
00844     RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_DynamicPaint_redoModifier");
00845     
00846     prop= RNA_def_property(srna, "use_proximity_ramp_alpha", PROP_BOOLEAN, PROP_NONE);
00847     RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DPAINT_RAMP_ALPHA);
00848     RNA_def_property_ui_text(prop, "Only Use Alpha", "Only read color ramp alpha");
00849     RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_DynamicPaint_redoModifier");
00850     
00851     prop= RNA_def_property(srna, "proximity_falloff", PROP_ENUM, PROP_NONE);
00852     RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
00853     RNA_def_property_enum_sdna(prop, NULL, "proximity_falloff");
00854     RNA_def_property_enum_items(prop, prop_dynamicpaint_prox_falloff);
00855     RNA_def_property_ui_text(prop, "Falloff", "Proximity falloff type");
00856     RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_DynamicPaint_redoModifier");
00857     
00858     prop= RNA_def_property(srna, "use_proximity_project", PROP_BOOLEAN, PROP_NONE);
00859     RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DPAINT_PROX_PROJECT);
00860     RNA_def_property_ui_text(prop, "Project", "Brush is projected to canvas from defined direction within brush proximity");
00861     RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_DynamicPaint_redoModifier");
00862 
00863     prop= RNA_def_property(srna, "ray_direction", PROP_ENUM, PROP_NONE);
00864     RNA_def_property_enum_sdna(prop, NULL, "ray_dir");
00865     RNA_def_property_enum_items(prop, prop_dynamicpaint_brush_ray_dir);
00866     RNA_def_property_ui_text(prop, "Ray Direction", "Ray direction to use for projection (if brush object is located in that direction it's painted)");
00867     RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_DynamicPaint_redoModifier");
00868 
00869     prop= RNA_def_property(srna, "invert_proximity", PROP_BOOLEAN, PROP_NONE);
00870     RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DPAINT_INVERSE_PROX);
00871     RNA_def_property_ui_text(prop, "Inner Proximity", "Proximity falloff is applied inside the volume");
00872     RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_DynamicPaint_redoModifier");
00873 
00874     prop= RNA_def_property(srna, "use_negative_volume", PROP_BOOLEAN, PROP_NONE);
00875     RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DPAINT_NEGATE_VOLUME);
00876     RNA_def_property_ui_text(prop, "Negate Volume", "Negate influence inside the volume");
00877     RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_DynamicPaint_redoModifier");
00878     
00879 
00880     /*
00881     *   Particle
00882     */
00883     prop= RNA_def_property(srna, "particle_system", PROP_POINTER, PROP_NONE);
00884     RNA_def_property_pointer_sdna(prop, NULL, "psys");
00885     RNA_def_property_struct_type(prop, "ParticleSystem");
00886     RNA_def_property_flag(prop, PROP_EDITABLE);
00887     RNA_def_property_ui_text(prop, "Particle Systems", "The particle system to paint with");
00888     RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_DynamicPaint_resetDependancy");
00889 
00890     
00891     prop= RNA_def_property(srna, "use_particle_radius", PROP_BOOLEAN, PROP_NONE);
00892     RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DPAINT_PART_RAD);
00893     RNA_def_property_ui_text(prop, "Use Particle Radius", "Use radius from particle settings");
00894     RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_DynamicPaint_redoModifier");
00895     
00896     prop= RNA_def_property(srna, "solid_radius", PROP_FLOAT, PROP_NONE);
00897     RNA_def_property_float_sdna(prop, NULL, "particle_radius");
00898     RNA_def_property_range(prop, 0.01, 10.0);
00899     RNA_def_property_ui_range(prop, 0.01, 2.0, 5, 3);
00900     RNA_def_property_ui_text(prop, "Solid Radius", "Radius that will be painted solid");
00901     RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_DynamicPaint_redoModifier");
00902 
00903     prop= RNA_def_property(srna, "smooth_radius", PROP_FLOAT, PROP_NONE);
00904     RNA_def_property_float_sdna(prop, NULL, "particle_smooth");
00905     RNA_def_property_range(prop, 0.0, 10.0);
00906     RNA_def_property_ui_range(prop, 0.0, 1.0, 5, 0);
00907     RNA_def_property_ui_text(prop, "Smooth Radius", "Smooth falloff added after solid radius");
00908     RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_DynamicPaint_redoModifier");
00909     
00910 
00911     /*
00912     * Color ramps
00913     */
00914     prop= RNA_def_property(srna, "paint_ramp", PROP_POINTER, PROP_NONE);
00915     RNA_def_property_pointer_sdna(prop, NULL, "paint_ramp");
00916     RNA_def_property_struct_type(prop, "ColorRamp");
00917     RNA_def_property_ui_text(prop, "Paint Color Ramp", "Color ramp used to define proximity falloff");
00918     RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_DynamicPaint_redoModifier");
00919 
00920     prop= RNA_def_property(srna, "velocity_ramp", PROP_POINTER, PROP_NONE);
00921     RNA_def_property_pointer_sdna(prop, NULL, "vel_ramp");
00922     RNA_def_property_struct_type(prop, "ColorRamp");
00923     RNA_def_property_ui_text(prop, "Velocity Color Ramp", "Color ramp used to define brush velocity effect");
00924     RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_DynamicPaint_redoModifier");
00925 }
00926 
00927 void RNA_def_dynamic_paint(BlenderRNA *brna)
00928 {
00929     rna_def_dynamic_paint_canvas_settings(brna);
00930     rna_def_dynamic_paint_brush_settings(brna);
00931     rna_def_canvas_surface(brna);
00932 }
00933 
00934 #endif