Dynamic Paint:
* Added "Initial Color" setting for surfaces. You can for example set color from UV mapped texture or from vertex colors. * Added clamping option for "wave" brushes. * Merged smudge and drip adjacency search code. This fixes some issues with drip effect and makes code easier to maintain. * Some adjustments to the bounding box generation code. * OpenMP is now completely disabled if no compile flag is set. * Wetness values are now properly clamped on vertex surfaces. No more black dots on >1.0 wetness. * Textured brushes now use same function calls as internal renderer, instead of modified duplicates. * Moved operator code to editors/physics/. * Re-enabled some particle brush optimizations. * Fixed sometimes incorrect volume brush influence. * Fixed possible crash when using a brush that uses "Voxel Data" texture simultaneously with material preview or render. * Fixed texture mapping issues for "Object Center" brush. * Fixed possible crash/corruption when duplicating brush object that uses color ramps. * Other tweaking and code cleanup.
This commit is contained in:
parent
39b66f9ad4
commit
79ef35889f
|
@ -117,8 +117,11 @@ class PHYSICS_PT_dynamic_paint(PhysicButtonsPanel, bpy.types.Panel):
|
|||
elif (brush.brush_settings_context == "WAVE"):
|
||||
layout.prop(brush, "wave_type")
|
||||
if (brush.wave_type != "REFLECT"):
|
||||
split = layout.split(percentage=0.6)
|
||||
split.prop(brush, "wave_factor")
|
||||
split = layout.split(percentage=0.5)
|
||||
col = split.column()
|
||||
col.prop(brush, "wave_factor")
|
||||
col = split.column()
|
||||
col.prop(brush, "wave_clamp")
|
||||
elif (brush.brush_settings_context == "VELOCITY"):
|
||||
col = layout.row().column()
|
||||
col.label(text="Velocity Settings:")
|
||||
|
@ -199,6 +202,39 @@ class PHYSICS_PT_dp_advanced_canvas(PhysicButtonsPanel, bpy.types.Panel):
|
|||
layout.label(text="Brush Group:")
|
||||
layout.prop(surface, "brush_group", text="")
|
||||
|
||||
class PHYSICS_PT_dp_canvas_initial_color(PhysicButtonsPanel, bpy.types.Panel):
|
||||
bl_label = "Dynamic Paint: Initial Color"
|
||||
bl_options = {'DEFAULT_CLOSED'}
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
md = context.dynamic_paint
|
||||
if (not (md and (md.ui_type == "CANVAS") and (md.canvas_settings))):
|
||||
return 0
|
||||
surface = context.dynamic_paint.canvas_settings.canvas_surfaces.active
|
||||
return (surface and surface.surface_type=="PAINT")
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
canvas = context.dynamic_paint.canvas_settings
|
||||
surface = canvas.canvas_surfaces.active
|
||||
ob = context.object
|
||||
|
||||
layout.prop(surface, "init_color_type", expand=False)
|
||||
layout.separator()
|
||||
|
||||
# dissolve
|
||||
if (surface.init_color_type == "COLOR"):
|
||||
layout.prop(surface, "init_color")
|
||||
|
||||
if (surface.init_color_type == "TEXTURE"):
|
||||
layout.prop(surface, "init_texture")
|
||||
layout.prop_search(surface, "init_layername", ob.data, "uv_textures", text="UV Layer:")
|
||||
|
||||
if (surface.init_color_type == "VERTEXCOLOR"):
|
||||
layout.prop_search(surface, "init_layername", ob.data, "vertex_colors", text="Color Layer: ")
|
||||
|
||||
|
||||
class PHYSICS_PT_dp_canvas_output(PhysicButtonsPanel, bpy.types.Panel):
|
||||
bl_label = "Dynamic Paint: Output"
|
||||
|
|
|
@ -18,6 +18,8 @@
|
|||
|
||||
struct PaintEffectData;
|
||||
struct PaintBakeData;
|
||||
struct bContext;
|
||||
struct wmOperator;
|
||||
|
||||
/* Actual surface point */
|
||||
typedef struct PaintSurfaceData {
|
||||
|
@ -61,12 +63,22 @@ struct DerivedMesh *dynamicPaint_Modifier_do(struct DynamicPaintModifierData *pm
|
|||
void dynamicPaint_Modifier_free (struct DynamicPaintModifierData *pmd);
|
||||
void dynamicPaint_Modifier_copy(struct DynamicPaintModifierData *pmd, struct DynamicPaintModifierData *tsmd);
|
||||
|
||||
void dynamicPaint_cacheUpdateFrames(struct DynamicPaintSurface *surface);
|
||||
void dynamicPaint_clearSurface(DynamicPaintSurface *surface);
|
||||
int dynamicPaint_createType(struct DynamicPaintModifierData *pmd, int type, struct Scene *scene);
|
||||
struct DynamicPaintSurface *dynamicPaint_createNewSurface(struct DynamicPaintCanvasSettings *canvas, struct Scene *scene);
|
||||
void dynamicPaint_clearSurface(struct DynamicPaintSurface *surface);
|
||||
int dynamicPaint_resetSurface(struct DynamicPaintSurface *surface);
|
||||
int dynamicPaint_surfaceHasColorPreview(DynamicPaintSurface *surface);
|
||||
void dynamicPaint_freeSurface(struct DynamicPaintSurface *surface);
|
||||
void dynamicPaint_freeCanvas(struct DynamicPaintModifierData *pmd);
|
||||
void dynamicPaint_freeBrush(struct DynamicPaintModifierData *pmd);
|
||||
|
||||
void dynamicPaint_cacheUpdateFrames(struct DynamicPaintSurface *surface);
|
||||
int dynamicPaint_surfaceHasColorPreview(struct DynamicPaintSurface *surface);
|
||||
int dynamicPaint_outputLayerExists(struct DynamicPaintSurface *surface, struct Object *ob, int index);
|
||||
void dynamicPaintSurface_updateType(struct DynamicPaintSurface *surface);
|
||||
void dynamicPaintSurface_setUniqueName(DynamicPaintSurface *surface, char *basename);
|
||||
void dynamicPaintSurface_setUniqueName(struct DynamicPaintSurface *surface, char *basename);
|
||||
void dynamicPaint_resetPreview(struct DynamicPaintCanvasSettings *canvas);
|
||||
struct DynamicPaintSurface *get_activeSurface(struct DynamicPaintCanvasSettings *canvas);
|
||||
|
||||
int dynamicPaint_initBake(struct bContext *C, struct wmOperator *op);
|
||||
|
||||
#endif /* BKE_DYNAMIC_PAINT_H_ */
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -36,6 +36,7 @@ set(INC_SYS
|
|||
)
|
||||
|
||||
set(SRC
|
||||
dynamicpaint_ops.c
|
||||
particle_boids.c
|
||||
particle_edit.c
|
||||
particle_object.c
|
||||
|
|
|
@ -0,0 +1,268 @@
|
|||
/*
|
||||
* ***** BEGIN GPL LICENSE BLOCK *****
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* ***** END GPL LICENSE BLOCK *****
|
||||
*/
|
||||
|
||||
#include "DNA_dynamicpaint_types.h"
|
||||
#include "DNA_modifier_types.h"
|
||||
#include "DNA_object_types.h"
|
||||
#include "DNA_scene_types.h"
|
||||
|
||||
#include "BKE_context.h"
|
||||
#include "BKE_deform.h"
|
||||
#include "BKE_depsgraph.h"
|
||||
#include "BKE_dynamicpaint.h"
|
||||
#include "BKE_modifier.h"
|
||||
|
||||
#include "ED_mesh.h"
|
||||
#include "ED_screen.h"
|
||||
|
||||
#include "RNA_access.h"
|
||||
#include "RNA_define.h"
|
||||
#include "RNA_enum_types.h"
|
||||
|
||||
#include "WM_types.h"
|
||||
#include "WM_api.h"
|
||||
|
||||
static int dynamicpaint_bake_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
/* Bake dynamic paint */
|
||||
if(!dynamicPaint_initBake(C, op)) {
|
||||
return OPERATOR_CANCELLED;}
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
||||
void DPAINT_OT_bake(wmOperatorType *ot)
|
||||
{
|
||||
/* identifiers */
|
||||
ot->name= "Dynamic Paint Bake";
|
||||
ot->description= "Bake dynamic paint image sequence surface";
|
||||
ot->idname= "DPAINT_OT_bake";
|
||||
|
||||
/* api callbacks */
|
||||
ot->exec= dynamicpaint_bake_exec;
|
||||
ot->poll= ED_operator_object_active_editable;
|
||||
}
|
||||
|
||||
static int surface_slot_add_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
DynamicPaintModifierData *pmd = 0;
|
||||
Object *cObject = CTX_data_pointer_get_type(C, "object", &RNA_Object).data;
|
||||
DynamicPaintSurface *surface;
|
||||
|
||||
/* Make sure we're dealing with a canvas */
|
||||
pmd = (DynamicPaintModifierData *)modifiers_findByType(cObject, eModifierType_DynamicPaint);
|
||||
if (!pmd) return OPERATOR_CANCELLED;
|
||||
if (!pmd->canvas) return OPERATOR_CANCELLED;
|
||||
|
||||
surface = dynamicPaint_createNewSurface(pmd->canvas, CTX_data_scene(C));
|
||||
|
||||
if (!surface) return OPERATOR_CANCELLED;
|
||||
|
||||
/* set preview for this surface only and set active */
|
||||
pmd->canvas->active_sur = 0;
|
||||
for(surface=surface->prev; surface; surface=surface->prev) {
|
||||
surface->flags &= ~MOD_DPAINT_PREVIEW;
|
||||
pmd->canvas->active_sur++;
|
||||
}
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
||||
/* add surface slot */
|
||||
void DPAINT_OT_surface_slot_add(wmOperatorType *ot)
|
||||
{
|
||||
/* identifiers */
|
||||
ot->name= "Add Surface Slot";
|
||||
ot->idname= "DPAINT_OT_surface_slot_add";
|
||||
ot->description="Add a new Dynamic Paint surface slot";
|
||||
|
||||
/* api callbacks */
|
||||
ot->exec= surface_slot_add_exec;
|
||||
ot->poll= ED_operator_object_active_editable;
|
||||
|
||||
/* flags */
|
||||
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
|
||||
}
|
||||
|
||||
static int surface_slot_remove_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
DynamicPaintModifierData *pmd = 0;
|
||||
Object *cObject = CTX_data_pointer_get_type(C, "object", &RNA_Object).data;
|
||||
DynamicPaintSurface *surface;
|
||||
int id=0;
|
||||
|
||||
/* Make sure we're dealing with a canvas */
|
||||
pmd = (DynamicPaintModifierData *)modifiers_findByType(cObject, eModifierType_DynamicPaint);
|
||||
if (!pmd) return OPERATOR_CANCELLED;
|
||||
if (!pmd->canvas) return OPERATOR_CANCELLED;
|
||||
|
||||
surface = pmd->canvas->surfaces.first;
|
||||
|
||||
/* find active surface and remove it */
|
||||
for(; surface; surface=surface->next) {
|
||||
if(id == pmd->canvas->active_sur) {
|
||||
pmd->canvas->active_sur -= 1;
|
||||
dynamicPaint_freeSurface(surface);
|
||||
break;
|
||||
}
|
||||
id++;
|
||||
}
|
||||
|
||||
dynamicPaint_resetPreview(pmd->canvas);
|
||||
DAG_id_tag_update(&cObject->id, OB_RECALC_DATA);
|
||||
WM_event_add_notifier(C, NC_OBJECT|ND_MODIFIER, cObject);
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
||||
/* remove surface slot */
|
||||
void DPAINT_OT_surface_slot_remove(wmOperatorType *ot)
|
||||
{
|
||||
/* identifiers */
|
||||
ot->name= "Remove Surface Slot";
|
||||
ot->idname= "DPAINT_OT_surface_slot_remove";
|
||||
ot->description="Remove the selected surface slot";
|
||||
|
||||
/* api callbacks */
|
||||
ot->exec= surface_slot_remove_exec;
|
||||
ot->poll= ED_operator_object_active_editable;
|
||||
|
||||
/* flags */
|
||||
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
|
||||
}
|
||||
|
||||
static int type_toggle_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
|
||||
Object *cObject = CTX_data_pointer_get_type(C, "object", &RNA_Object).data;
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
DynamicPaintModifierData *pmd = (DynamicPaintModifierData *)modifiers_findByType(cObject, eModifierType_DynamicPaint);
|
||||
int type= RNA_enum_get(op->ptr, "type");
|
||||
|
||||
if (!pmd) return OPERATOR_CANCELLED;
|
||||
|
||||
/* if type is already enabled, toggle it off */
|
||||
if (type == MOD_DYNAMICPAINT_TYPE_CANVAS && pmd->canvas) {
|
||||
dynamicPaint_freeCanvas(pmd);
|
||||
}
|
||||
else if (type == MOD_DYNAMICPAINT_TYPE_BRUSH && pmd->brush) {
|
||||
dynamicPaint_freeBrush(pmd);
|
||||
}
|
||||
/* else create a new type */
|
||||
else {
|
||||
if (!dynamicPaint_createType(pmd, type, scene))
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
|
||||
/* update dependancy */
|
||||
DAG_id_tag_update(&cObject->id, OB_RECALC_DATA);
|
||||
WM_event_add_notifier(C, NC_OBJECT|ND_MODIFIER, cObject);
|
||||
DAG_scene_sort(CTX_data_main(C), scene);
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
||||
void DPAINT_OT_type_toggle(wmOperatorType *ot)
|
||||
{
|
||||
PropertyRNA *prop;
|
||||
|
||||
/* identifiers */
|
||||
ot->name= "Toggle Type Active";
|
||||
ot->idname= "DPAINT_OT_type_toggle";
|
||||
ot->description = "Toggles whether given type is active or not";
|
||||
|
||||
/* api callbacks */
|
||||
ot->exec= type_toggle_exec;
|
||||
ot->poll= ED_operator_object_active_editable;
|
||||
|
||||
/* flags */
|
||||
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
|
||||
|
||||
/* properties */
|
||||
prop= RNA_def_enum(ot->srna, "type", prop_dynamicpaint_type_items, MOD_DYNAMICPAINT_TYPE_CANVAS, "Type", "");
|
||||
ot->prop= prop;
|
||||
}
|
||||
|
||||
static int output_toggle_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
|
||||
Object *ob = CTX_data_pointer_get_type(C, "object", &RNA_Object).data;
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
DynamicPaintModifierData *pmd = (DynamicPaintModifierData *)modifiers_findByType(ob, eModifierType_DynamicPaint);
|
||||
int index= RNA_int_get(op->ptr, "index");
|
||||
|
||||
if (!pmd) return OPERATOR_CANCELLED;
|
||||
|
||||
|
||||
/* if type is already enabled, toggle it off */
|
||||
if (pmd->canvas) {
|
||||
DynamicPaintSurface *surface = get_activeSurface(pmd->canvas);
|
||||
|
||||
if (surface->format == MOD_DPAINT_SURFACE_F_VERTEX) {
|
||||
int exists = dynamicPaint_outputLayerExists(surface, ob, index);
|
||||
char *name;
|
||||
|
||||
if (index == 0)
|
||||
name = surface->output_name;
|
||||
else if (index == 1)
|
||||
name = surface->output_name2;
|
||||
|
||||
/* Vertex Color Layer */
|
||||
if (surface->type == MOD_DPAINT_SURFACE_T_PAINT) {
|
||||
if (!exists)
|
||||
ED_mesh_color_add(C, scene, ob, ob->data, name, 1);
|
||||
else
|
||||
ED_mesh_color_remove_named(C, ob, ob->data, name);
|
||||
}
|
||||
/* Vertex Weight Layer */
|
||||
else if (surface->type == MOD_DPAINT_SURFACE_T_WEIGHT) {
|
||||
if (!exists)
|
||||
ED_vgroup_add_name(ob, name);
|
||||
else {
|
||||
bDeformGroup *defgroup = defgroup_find_name(ob, name);
|
||||
if (defgroup) ED_vgroup_delete(ob, defgroup);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
||||
void DPAINT_OT_output_toggle(wmOperatorType *ot)
|
||||
{
|
||||
PropertyRNA *prop;
|
||||
|
||||
/* identifiers */
|
||||
ot->name= "Toggle Output Layer";
|
||||
ot->idname= "DPAINT_OT_output_toggle";
|
||||
ot->description = "Adds or removes Dynamic Paint output data layer.";
|
||||
|
||||
/* api callbacks */
|
||||
ot->exec= output_toggle_exec;
|
||||
ot->poll= ED_operator_object_active_editable;
|
||||
|
||||
/* flags */
|
||||
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
|
||||
|
||||
/* properties */
|
||||
prop= RNA_def_int(ot->srna, "index", 0, 0, 1, "Index", "", 0, 1);
|
||||
ot->prop= prop;
|
||||
}
|
|
@ -61,6 +61,12 @@ struct PaintSurfaceData;
|
|||
#define MOD_DPAINT_SURFACE_PREV_PAINT 0
|
||||
#define MOD_DPAINT_SURFACE_PREV_WETMAP 1
|
||||
|
||||
/* init_color_type */
|
||||
#define MOD_DPAINT_INITIAL_NONE 0
|
||||
#define MOD_DPAINT_INITIAL_COLOR 1
|
||||
#define MOD_DPAINT_INITIAL_TEXTURE 2
|
||||
#define MOD_DPAINT_INITIAL_VERTEXCOLOR 3
|
||||
|
||||
typedef struct DynamicPaintSurface {
|
||||
|
||||
struct DynamicPaintSurface *next, *prev;
|
||||
|
@ -81,6 +87,7 @@ typedef struct DynamicPaintSurface {
|
|||
short disp_type, image_fileformat;
|
||||
short effect_ui; /* just ui selection box */
|
||||
short preview_id; /* surface output id to preview */
|
||||
short init_color_type, pad_s;
|
||||
int flags, effect;
|
||||
|
||||
int image_resolution, substeps;
|
||||
|
@ -89,6 +96,12 @@ typedef struct DynamicPaintSurface {
|
|||
int dry_speed, diss_speed;
|
||||
float disp_clamp;
|
||||
|
||||
/* initial color */
|
||||
float init_color[4];
|
||||
struct Tex *init_texture;
|
||||
char init_layername[40];
|
||||
int pad;
|
||||
|
||||
float spread_speed, color_spread_speed, shrink_speed;
|
||||
float drip_vel, drip_acc;
|
||||
|
||||
|
@ -188,9 +201,8 @@ typedef struct DynamicPaintBrushSettings {
|
|||
short wave_type;
|
||||
short ray_dir;
|
||||
|
||||
float wave_factor;
|
||||
float wave_factor, wave_clamp;
|
||||
float max_velocity, smudge_strength;
|
||||
float pad;
|
||||
} DynamicPaintBrushSettings;
|
||||
|
||||
#endif
|
||||
|
|
|
@ -87,6 +87,15 @@ static void rna_DynamicPaintSurface_reset(Main *bmain, Scene *scene, PointerRNA
|
|||
rna_DynamicPaint_redoModifier(bmain, scene, ptr);
|
||||
}
|
||||
|
||||
static void rna_DynamicPaintSurface_initialcolortype(Main *bmain, Scene *scene, PointerRNA *ptr)
|
||||
{
|
||||
DynamicPaintSurface *surface = (DynamicPaintSurface*)ptr->data;
|
||||
|
||||
surface->init_layername[0] = '\0';
|
||||
dynamicPaint_clearSurface(surface);
|
||||
rna_DynamicPaint_redoModifier(bmain, scene, ptr);
|
||||
}
|
||||
|
||||
static void rna_DynamicPaintSurface_changePreview(Main *bmain, Scene *scene, PointerRNA *ptr)
|
||||
{
|
||||
DynamicPaintSurface *act_surface = (DynamicPaintSurface*)ptr->data;
|
||||
|
@ -302,6 +311,14 @@ static void rna_def_canvas_surface(BlenderRNA *brna)
|
|||
{MOD_DPAINT_SURFACE_PREV_WETMAP, "WETMAP", 0, "Wetmap", ""},
|
||||
{0, NULL, 0, NULL, NULL}};
|
||||
|
||||
/* Initial color setting */
|
||||
static EnumPropertyItem prop_dynamicpaint_init_color_type[] = {
|
||||
{MOD_DPAINT_INITIAL_NONE, "NONE", 0, "None", ""},
|
||||
{MOD_DPAINT_INITIAL_COLOR, "COLOR", 0, "Color", ""},
|
||||
{MOD_DPAINT_INITIAL_TEXTURE, "TEXTURE", 0, "UV Texture", ""},
|
||||
{MOD_DPAINT_INITIAL_VERTEXCOLOR, "VERTEXCOLOR", 0, "Vertex Color", ""},
|
||||
{0, NULL, 0, NULL, NULL}};
|
||||
|
||||
/* Effect type
|
||||
* Only used by ui to view per effect settings */
|
||||
static EnumPropertyItem prop_dynamicpaint_effecttype[] = {
|
||||
|
@ -358,13 +375,11 @@ static void rna_def_canvas_surface(BlenderRNA *brna)
|
|||
RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_DynamicPaintSurface_changePreview");
|
||||
|
||||
prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
|
||||
RNA_def_property_string_sdna(prop, NULL, "name");
|
||||
RNA_def_property_ui_text(prop, "Name", "Surface name");
|
||||
RNA_def_property_update(prop, NC_OBJECT, "rna_DynamicPaintSurface_uniqueName");
|
||||
RNA_def_struct_name_property(srna, prop);
|
||||
|
||||
prop= RNA_def_property(srna, "brush_group", PROP_POINTER, PROP_NONE);
|
||||
RNA_def_property_pointer_sdna(prop, NULL, "brush_group");
|
||||
RNA_def_property_struct_type(prop, "Group");
|
||||
RNA_def_property_flag(prop, PROP_EDITABLE);
|
||||
RNA_def_property_ui_text(prop, "Brush Group", "Only use brush objects from this group");
|
||||
|
@ -386,7 +401,6 @@ static void rna_def_canvas_surface(BlenderRNA *brna)
|
|||
RNA_def_property_ui_text(prop, "Dissolve Speed", "Dissolve Speed");
|
||||
|
||||
prop= RNA_def_property(srna, "dry_speed", PROP_INT, PROP_NONE);
|
||||
RNA_def_property_int_sdna(prop, NULL, "dry_speed");
|
||||
RNA_def_property_range(prop, 1.0, 10000.0);
|
||||
RNA_def_property_ui_range(prop, 1.0, 10000.0, 5, 0);
|
||||
RNA_def_property_ui_text(prop, "Dry Speed", "Dry Speed");
|
||||
|
@ -396,7 +410,6 @@ static void rna_def_canvas_surface(BlenderRNA *brna)
|
|||
*/
|
||||
prop= RNA_def_property(srna, "image_resolution", PROP_INT, PROP_NONE);
|
||||
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
|
||||
RNA_def_property_int_sdna(prop, NULL, "image_resolution");
|
||||
RNA_def_property_range(prop, 16.0, 4096.0);
|
||||
RNA_def_property_ui_range(prop, 16.0, 4096.0, 1, 0);
|
||||
RNA_def_property_ui_text(prop, "Resolution", "Output image resolution");
|
||||
|
@ -408,7 +421,6 @@ static void rna_def_canvas_surface(BlenderRNA *brna)
|
|||
|
||||
prop= RNA_def_property(srna, "start_frame", PROP_INT, PROP_NONE);
|
||||
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
|
||||
RNA_def_property_int_sdna(prop, NULL, "start_frame");
|
||||
RNA_def_property_range(prop, 1.0, 9999.0);
|
||||
RNA_def_property_ui_range(prop, 1.0, 9999, 1, 0);
|
||||
RNA_def_property_ui_text(prop, "Start Frame", "Simulation start frame");
|
||||
|
@ -416,14 +428,12 @@ static void rna_def_canvas_surface(BlenderRNA *brna)
|
|||
|
||||
prop= RNA_def_property(srna, "end_frame", PROP_INT, PROP_NONE);
|
||||
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
|
||||
RNA_def_property_int_sdna(prop, NULL, "end_frame");
|
||||
RNA_def_property_range(prop, 1.0, 9999.0);
|
||||
RNA_def_property_ui_range(prop, 1.0, 9999.0, 1, 0);
|
||||
RNA_def_property_ui_text(prop, "End Frame", "Simulation end frame");
|
||||
RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_DynamicPaintSurfaces_updateFrames");
|
||||
|
||||
prop= RNA_def_property(srna, "substeps", PROP_INT, PROP_NONE);
|
||||
RNA_def_property_int_sdna(prop, NULL, "substeps");
|
||||
RNA_def_property_range(prop, 0.0, 10.0);
|
||||
RNA_def_property_ui_range(prop, 0.0, 10, 1, 0);
|
||||
RNA_def_property_ui_text(prop, "Sub-Steps", "Do extra frames between scene frames to ensure smooth motion.");
|
||||
|
@ -434,12 +444,35 @@ static void rna_def_canvas_surface(BlenderRNA *brna)
|
|||
RNA_def_property_ui_text(prop, "Anti-aliasing", "Uses 5x multisampling to smoothen paint edges.");
|
||||
RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_DynamicPaintSurface_reset");
|
||||
|
||||
/*
|
||||
* Initial Color
|
||||
*/
|
||||
|
||||
prop= RNA_def_property(srna, "init_color_type", PROP_ENUM, PROP_NONE);
|
||||
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
|
||||
RNA_def_property_enum_items(prop, prop_dynamicpaint_init_color_type);
|
||||
RNA_def_property_ui_text(prop, "Initial Color", "");
|
||||
RNA_def_property_update(prop, NC_MATERIAL|ND_SHADING_DRAW|ND_MODIFIER, "rna_DynamicPaintSurface_initialcolortype");
|
||||
|
||||
prop= RNA_def_property(srna, "init_color", PROP_FLOAT, PROP_COLOR_GAMMA);
|
||||
RNA_def_property_array(prop, 4);
|
||||
RNA_def_property_ui_text(prop, "Color", "Initial color of the surface.");
|
||||
RNA_def_property_update(prop, NC_MATERIAL|ND_SHADING_DRAW|ND_MODIFIER, "rna_DynamicPaintSurface_reset");
|
||||
|
||||
prop= RNA_def_property(srna, "init_texture", PROP_POINTER, PROP_NONE);
|
||||
RNA_def_property_flag(prop, PROP_EDITABLE);
|
||||
RNA_def_property_ui_text(prop, "Texture", "");
|
||||
RNA_def_property_update(prop, NC_MATERIAL|ND_SHADING_DRAW|ND_MODIFIER, "rna_DynamicPaintSurface_reset");
|
||||
|
||||
prop= RNA_def_property(srna, "init_layername", PROP_STRING, PROP_NONE);
|
||||
RNA_def_property_ui_text(prop, "Data Layer", "");
|
||||
RNA_def_property_update(prop, NC_MATERIAL|ND_SHADING_DRAW|ND_MODIFIER, "rna_DynamicPaintSurface_reset");
|
||||
|
||||
/*
|
||||
* Effect Settings
|
||||
*/
|
||||
prop= RNA_def_property(srna, "effect_ui", PROP_ENUM, PROP_NONE);
|
||||
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
|
||||
RNA_def_property_enum_sdna(prop, NULL, "effect_ui");
|
||||
RNA_def_property_enum_items(prop, prop_dynamicpaint_effecttype);
|
||||
RNA_def_property_ui_text(prop, "Effect Type", "");
|
||||
|
||||
|
@ -554,20 +587,17 @@ static void rna_def_canvas_surface(BlenderRNA *brna)
|
|||
|
||||
prop= RNA_def_property(srna, "disp_clamp", PROP_FLOAT, PROP_NONE);
|
||||
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
|
||||
RNA_def_property_float_sdna(prop, NULL, "disp_clamp");
|
||||
RNA_def_property_range(prop, 0.00, 50.0);
|
||||
RNA_def_property_ui_range(prop, 0.00, 5.0, 1, 2);
|
||||
RNA_def_property_ui_text(prop, "Clamp Displace", "Maximum level of displace intersection. Use 0.0 to disable.");
|
||||
RNA_def_property_ui_text(prop, "Clamp Displace", "Maximum level of displace intersection in mesh space. Use 0.0 to disable.");
|
||||
|
||||
prop= RNA_def_property(srna, "image_fileformat", PROP_ENUM, PROP_NONE);
|
||||
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
|
||||
RNA_def_property_enum_sdna(prop, NULL, "image_fileformat");
|
||||
RNA_def_property_enum_items(prop, prop_dynamicpaint_image_fileformat);
|
||||
RNA_def_property_ui_text(prop, "File Format", "");
|
||||
|
||||
prop= RNA_def_property(srna, "disp_type", PROP_ENUM, PROP_NONE);
|
||||
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
|
||||
RNA_def_property_enum_sdna(prop, NULL, "disp_type");
|
||||
RNA_def_property_enum_items(prop, prop_dynamicpaint_disp_type);
|
||||
RNA_def_property_ui_text(prop, "Data Type", "");
|
||||
|
||||
|
@ -579,25 +609,21 @@ static void rna_def_canvas_surface(BlenderRNA *brna)
|
|||
|
||||
/* wave simulator settings */
|
||||
prop= RNA_def_property(srna, "wave_damping", PROP_FLOAT, PROP_NONE);
|
||||
RNA_def_property_float_sdna(prop, NULL, "wave_damping");
|
||||
RNA_def_property_range(prop, 0.001, 1.0);
|
||||
RNA_def_property_ui_range(prop, 0.01, 1.0, 1, 2);
|
||||
RNA_def_property_ui_text(prop, "Damping", "Wave damping factor.");
|
||||
|
||||
prop= RNA_def_property(srna, "wave_speed", PROP_FLOAT, PROP_NONE);
|
||||
RNA_def_property_float_sdna(prop, NULL, "wave_speed");
|
||||
RNA_def_property_range(prop, 0.01, 3.0);
|
||||
RNA_def_property_ui_range(prop, 0.01, 1.5, 1, 2);
|
||||
RNA_def_property_ui_text(prop, "Speed", "Wave propogation speed.");
|
||||
|
||||
prop= RNA_def_property(srna, "wave_timescale", PROP_FLOAT, PROP_NONE);
|
||||
RNA_def_property_float_sdna(prop, NULL, "wave_timescale");
|
||||
RNA_def_property_range(prop, 0.01, 3.0);
|
||||
RNA_def_property_ui_range(prop, 0.01, 1.5, 1, 2);
|
||||
RNA_def_property_ui_text(prop, "Timescale", "Wave time scaling factor.");
|
||||
|
||||
prop= RNA_def_property(srna, "wave_spring", PROP_FLOAT, PROP_NONE);
|
||||
RNA_def_property_float_sdna(prop, NULL, "wave_spring");
|
||||
RNA_def_property_range(prop, 0.001, 1.0);
|
||||
RNA_def_property_ui_range(prop, 0.01, 1.0, 1, 2);
|
||||
RNA_def_property_ui_text(prop, "Spring", "Spring force that pulls water level back to zero.");
|
||||
|
@ -640,7 +666,6 @@ static void rna_def_dynamic_paint_canvas_settings(BlenderRNA *brna)
|
|||
rna_def_canvas_surfaces(brna, prop);
|
||||
|
||||
prop= RNA_def_property(srna, "ui_info", PROP_STRING, PROP_NONE);
|
||||
RNA_def_property_string_sdna(prop, NULL, "ui_info");
|
||||
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
||||
RNA_def_property_ui_text(prop, "Bake Info", "Info on bake status");
|
||||
}
|
||||
|
@ -732,28 +757,29 @@ static void rna_def_dynamic_paint_brush_settings(BlenderRNA *brna)
|
|||
|
||||
prop= RNA_def_property(srna, "wave_type", PROP_ENUM, PROP_NONE);
|
||||
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
|
||||
RNA_def_property_enum_sdna(prop, NULL, "wave_type");
|
||||
RNA_def_property_enum_items(prop, prop_dynamicpaint_brush_wave_type);
|
||||
RNA_def_property_ui_text(prop, "Paint Type", "");
|
||||
|
||||
prop= RNA_def_property(srna, "wave_factor", PROP_FLOAT, PROP_NONE);
|
||||
RNA_def_property_float_sdna(prop, NULL, "wave_factor");
|
||||
RNA_def_property_range(prop, -2.0, 2.0);
|
||||
RNA_def_property_ui_range(prop, -1.0, 1.0, 5, 2);
|
||||
RNA_def_property_ui_text(prop, "Factor", "Multiplier for wave influence of this brush.");
|
||||
|
||||
prop= RNA_def_property(srna, "wave_clamp", PROP_FLOAT, PROP_NONE);
|
||||
RNA_def_property_range(prop, 0.00, 50.0);
|
||||
RNA_def_property_ui_range(prop, 0.00, 5.0, 1, 2);
|
||||
RNA_def_property_ui_text(prop, "Clamp Waves", "Maximum level of surface intersection used to influence waves. Use 0.0 to disable.");
|
||||
|
||||
prop= RNA_def_property(srna, "do_smudge", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DPAINT_DO_SMUDGE);
|
||||
RNA_def_property_ui_text(prop, "Do Smudge", "Makes this brush to smudge existing paint as it moves.");
|
||||
|
||||
prop= RNA_def_property(srna, "smudge_strength", PROP_FLOAT, PROP_NONE);
|
||||
RNA_def_property_float_sdna(prop, NULL, "smudge_strength");
|
||||
RNA_def_property_range(prop, 0.0, 1.0);
|
||||
RNA_def_property_ui_range(prop, 0.0, 1.0, 5, 2);
|
||||
RNA_def_property_ui_text(prop, "Smudge Strength", "Smudge effect strength");
|
||||
|
||||
prop= RNA_def_property(srna, "max_velocity", PROP_FLOAT, PROP_NONE);
|
||||
RNA_def_property_float_sdna(prop, NULL, "max_velocity");
|
||||
RNA_def_property_range(prop, 0.0001, 10.0);
|
||||
RNA_def_property_ui_range(prop, 0.1, 2.0, 5, 2);
|
||||
RNA_def_property_ui_text(prop, "Max Velocity", "Velocity considered as maximum influence. (Blender units per frame)");
|
||||
|
|
|
@ -112,6 +112,7 @@ static void foreachIDLink(ModifierData *md, Object *ob,
|
|||
|
||||
for(; surface; surface=surface->next) {
|
||||
walk(userData, ob, (ID **)&surface->brush_group);
|
||||
walk(userData, ob, (ID **)&surface->init_texture);
|
||||
}
|
||||
}
|
||||
if (pmd->brush) {
|
||||
|
@ -119,6 +120,12 @@ static void foreachIDLink(ModifierData *md, Object *ob,
|
|||
}
|
||||
}
|
||||
|
||||
static void foreachTexLink(ModifierData *md, Object *ob,
|
||||
TexWalkFunc walk, void *userData)
|
||||
{
|
||||
walk(userData, ob, md, ""); /* property name isn't used */
|
||||
}
|
||||
|
||||
ModifierTypeInfo modifierType_DynamicPaint = {
|
||||
/* name */ "Dynamic Paint",
|
||||
/* structName */ "DynamicPaintModifierData",
|
||||
|
@ -144,4 +151,5 @@ ModifierTypeInfo modifierType_DynamicPaint = {
|
|||
/* dependsOnNormals */ 0,
|
||||
/* foreachObjectLink */ 0,
|
||||
/* foreachIDLink */ foreachIDLink,
|
||||
/* foreachTexLink */ foreachTexLink,
|
||||
};
|
||||
|
|
|
@ -68,7 +68,7 @@ void do_halo_tex(struct HaloRen *har, float xn, float yn, float *colf);
|
|||
void do_sky_tex(float *rco, float *lo, float *dxyview, float *hor, float *zen, float *blend, int skyflag, short thread);
|
||||
void do_material_tex(struct ShadeInput *shi);
|
||||
void do_lamp_tex(LampRen *la, float *lavec, struct ShadeInput *shi, float *colf, int effect);
|
||||
void do_volume_tex(struct ShadeInput *shi, float *xyz, int mapto_flag, float *col, float *val);
|
||||
void do_volume_tex(struct ShadeInput *shi, float *xyz, int mapto_flag, float *col, float *val, struct Render *re);
|
||||
|
||||
void init_render_textures(Render *re);
|
||||
void end_render_textures(Render *re);
|
||||
|
|
|
@ -2673,7 +2673,7 @@ void do_material_tex(ShadeInput *shi)
|
|||
}
|
||||
|
||||
|
||||
void do_volume_tex(ShadeInput *shi, float *xyz, int mapto_flag, float *col, float *val)
|
||||
void do_volume_tex(ShadeInput *shi, float *xyz, int mapto_flag, float *col, float *val, Render *re)
|
||||
{
|
||||
MTex *mtex;
|
||||
Tex *tex;
|
||||
|
@ -2682,7 +2682,7 @@ void do_volume_tex(ShadeInput *shi, float *xyz, int mapto_flag, float *col, floa
|
|||
float co[3], texvec[3];
|
||||
float fact, stencilTin=1.0;
|
||||
|
||||
if (R.r.scemode & R_NO_TEX) return;
|
||||
if (re->r.scemode & R_NO_TEX) return;
|
||||
/* here: test flag if there's a tex (todo) */
|
||||
|
||||
for(tex_nr=0; tex_nr<MAX_MTEX; tex_nr++) {
|
||||
|
@ -2724,7 +2724,7 @@ void do_volume_tex(ShadeInput *shi, float *xyz, int mapto_flag, float *col, floa
|
|||
}
|
||||
else if(mtex->texco==TEXCO_GLOB) {
|
||||
VECCOPY(co, xyz);
|
||||
mul_m4_v3(R.viewinv, co);
|
||||
mul_m4_v3(re->viewinv, co);
|
||||
}
|
||||
else continue; // can happen when texco defines disappear and it renders old files
|
||||
|
||||
|
|
|
@ -290,7 +290,7 @@ float vol_get_density(struct ShadeInput *shi, float *co)
|
|||
float density_scale = shi->mat->vol.density_scale;
|
||||
|
||||
if (shi->mat->mapto_textured & MAP_DENSITY)
|
||||
do_volume_tex(shi, co, MAP_DENSITY, NULL, &density);
|
||||
do_volume_tex(shi, co, MAP_DENSITY, NULL, &density, &R);
|
||||
|
||||
// if meta-object, modulate by metadensity without increasing it
|
||||
if (shi->obi->obr->ob->type == OB_MBALL) {
|
||||
|
@ -312,11 +312,11 @@ static void vol_get_reflection_color(ShadeInput *shi, float *ref_col, float *co)
|
|||
VECCOPY(ref_col, shi->mat->vol.reflection_col);
|
||||
|
||||
if (shi->mat->mapto_textured & (MAP_SCATTERING+MAP_REFLECTION_COL))
|
||||
do_volume_tex(shi, co, MAP_SCATTERING+MAP_REFLECTION_COL, ref_col, &scatter);
|
||||
do_volume_tex(shi, co, MAP_SCATTERING+MAP_REFLECTION_COL, ref_col, &scatter, &R);
|
||||
|
||||
/* only one single float parameter at a time... :s */
|
||||
if (shi->mat->mapto_textured & (MAP_REFLECTION))
|
||||
do_volume_tex(shi, co, MAP_REFLECTION, NULL, &reflection);
|
||||
do_volume_tex(shi, co, MAP_REFLECTION, NULL, &reflection, &R);
|
||||
|
||||
ref_col[0] = reflection * ref_col[0] * scatter;
|
||||
ref_col[1] = reflection * ref_col[1] * scatter;
|
||||
|
@ -331,7 +331,7 @@ static void vol_get_emission(ShadeInput *shi, float *emission_col, float *co)
|
|||
VECCOPY(emission_col, shi->mat->vol.emission_col);
|
||||
|
||||
if (shi->mat->mapto_textured & (MAP_EMISSION+MAP_EMISSION_COL))
|
||||
do_volume_tex(shi, co, MAP_EMISSION+MAP_EMISSION_COL, emission_col, &emission);
|
||||
do_volume_tex(shi, co, MAP_EMISSION+MAP_EMISSION_COL, emission_col, &emission, &R);
|
||||
|
||||
emission_col[0] = emission_col[0] * emission;
|
||||
emission_col[1] = emission_col[1] * emission;
|
||||
|
@ -351,7 +351,7 @@ static void vol_get_sigma_t(ShadeInput *shi, float *sigma_t, float *co)
|
|||
float scattering = shi->mat->vol.scattering;
|
||||
|
||||
if (shi->mat->mapto_textured & (MAP_SCATTERING+MAP_TRANSMISSION_COL))
|
||||
do_volume_tex(shi, co, MAP_SCATTERING+MAP_TRANSMISSION_COL, transmission_col, &scattering);
|
||||
do_volume_tex(shi, co, MAP_SCATTERING+MAP_TRANSMISSION_COL, transmission_col, &scattering, &R);
|
||||
|
||||
sigma_t[0] = (1.0f - transmission_col[0]) + scattering;
|
||||
sigma_t[1] = (1.0f - transmission_col[1]) + scattering;
|
||||
|
|
|
@ -124,6 +124,8 @@ int multitex_ext(struct Tex *tex, float *texvec, float *dxt, float *dyt, int osa
|
|||
int multitex_ext_safe(struct Tex *tex, float *texvec, struct TexResult *texres){return 0;}
|
||||
int multitex_nodes(struct Tex *tex, float *texvec, float *dxt, float *dyt, int osatex, struct TexResult *texres, short thread, short which_output, struct ShadeInput *shi, struct MTex *mtex) {return 0;}
|
||||
void texco_mapping_ext(float *facenor, struct Tex* tex, struct MTex* mtex, float* co, float* dx, float* dy, float* texvec){}
|
||||
void do_material_tex(struct ShadeInput *shi) {}
|
||||
void do_volume_tex(struct ShadeInput *shi, float *xyz, int mapto_flag, float *col, float *val, struct Render *re) {}
|
||||
|
||||
/* nodes */
|
||||
struct RenderResult *RE_GetResult(struct Render *re){return (struct RenderResult *) NULL;}
|
||||
|
|
Loading…
Reference in New Issue