From 9de082dbf4130b48d59e673ed276a046d97cc1e4 Mon Sep 17 00:00:00 2001 From: Miika Hamalainen Date: Sat, 10 Sep 2011 08:55:44 +0000 Subject: Dynamic Paint: * Enabled modifier "Apply" button since it can now be used to apply displacement or output layers to the mesh. * Default surface output names are now unique in case canvas has multiple surfaces of same type. * Merged "face aligned" and "non-closed" brush options to a single "Project" toggle, available for "Proximity" brushes. * Added more icons to user interface selections. * Increased default proximity distance. * Set proximity falloff ramp to only affect alpha by default. * Removed some no longer required render ext. functions. * Fix: geometry node vertex alpha didn't work unless "Vertex Color Paint/Light" was enabled from material. --- .../bl_ui/properties_physics_dynamicpaint.py | 84 +++++----- source/blender/blenkernel/intern/dynamicpaint.c | 178 +++++++++++++-------- .../editors/interface/interface_templates.c | 4 +- source/blender/makesdna/DNA_dynamicpaint_types.h | 18 +-- source/blender/makesdna/DNA_modifier_types.h | 3 - source/blender/makesrna/intern/rna_dynamicpaint.c | 33 ++-- source/blender/makesrna/intern/rna_modifier.c | 2 +- source/blender/nodes/intern/SHD_util.c | 2 + .../blender/render/extern/include/RE_shader_ext.h | 3 - .../blender/render/intern/source/render_texture.c | 17 +- source/blender/render/intern/source/shadeinput.c | 11 +- source/blenderplayer/bad_level_call_stubs/stubs.c | 2 - 12 files changed, 191 insertions(+), 166 deletions(-) diff --git a/release/scripts/startup/bl_ui/properties_physics_dynamicpaint.py b/release/scripts/startup/bl_ui/properties_physics_dynamicpaint.py index 88cfc2afbda..9847c7f5c4b 100644 --- a/release/scripts/startup/bl_ui/properties_physics_dynamicpaint.py +++ b/release/scripts/startup/bl_ui/properties_physics_dynamicpaint.py @@ -202,40 +202,6 @@ 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" bl_options = {'DEFAULT_CLOSED'} @@ -323,7 +289,39 @@ class PHYSICS_PT_dp_canvas_output(PhysicButtonsPanel, bpy.types.Panel): layout.operator("dpaint.bake", text="Bake Image Sequence", icon='MOD_DYNAMICPAINT') if len(canvas.ui_info) != 0: layout.label(text=canvas.ui_info) - + +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_effects(PhysicButtonsPanel, bpy.types.Panel): bl_label = "Dynamic Paint: Effects" @@ -427,7 +425,7 @@ class PHYSICS_PT_dp_advanced_brush(PhysicButtonsPanel, bpy.types.Panel): split = layout.row().split(percentage=0.4) sub = split.column() sub.prop(brush, "accept_nonclosed") - if brush.accept_nonclosed: + if brush.prox_project: sub = split.column() sub.prop(brush, "ray_dir") @@ -436,13 +434,17 @@ class PHYSICS_PT_dp_advanced_brush(PhysicButtonsPanel, bpy.types.Panel): col.prop(brush, "paint_distance", text="Paint Distance") split = layout.row().split(percentage=0.4) sub = split.column() - if (brush.paint_source != 'POINT'): - sub.prop(brush, "prox_facealigned") + if brush.paint_source == 'DISTANCE': + sub.prop(brush, "prox_project") + if brush.paint_source == "VOLDIST": + sub.prop(brush, "prox_inverse") + sub = split.column() + if brush.paint_source == 'DISTANCE': + column = sub.column() + column.active = brush.prox_project + column.prop(brush, "ray_dir") sub.prop(brush, "prox_falloff") - if brush.paint_source == "VOLDIST": - col = layout.row().column() - col.prop(brush, "prox_inverse") if brush.prox_falloff == "RAMP": col = layout.row().column() col.separator() diff --git a/source/blender/blenkernel/intern/dynamicpaint.c b/source/blender/blenkernel/intern/dynamicpaint.c index 54613508a8a..c4c71adfb9a 100644 --- a/source/blender/blenkernel/intern/dynamicpaint.c +++ b/source/blender/blenkernel/intern/dynamicpaint.c @@ -298,44 +298,6 @@ static void dynamicPaint_setPreview(DynamicPaintSurface *t_surface) } } -/* change surface data to defaults on new type */ -void dynamicPaintSurface_updateType(struct DynamicPaintSurface *surface) -{ - if (surface->format == MOD_DPAINT_SURFACE_F_IMAGESEQ) { - surface->output_name[0]='\0'; - surface->output_name2[0]='\0'; - surface->flags |= MOD_DPAINT_ANTIALIAS; - surface->disp_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; - } - - if (surface->type == MOD_DPAINT_SURFACE_T_PAINT) { - strcat(surface->output_name,"paintmap"); - strcat(surface->output_name2,"wetmap"); - } - else if (surface->type == MOD_DPAINT_SURFACE_T_DISPLACE) { - strcat(surface->output_name,"displace"); - } - else if (surface->type == MOD_DPAINT_SURFACE_T_WEIGHT) { - strcat(surface->output_name,"weight"); - } - else if (surface->type == MOD_DPAINT_SURFACE_T_WAVE) { - strcat(surface->output_name,"wave"); - strcat(surface->output_name2,"foam"); - } - - /* update preview */ - if (dynamicPaint_surfaceHasColorPreview(surface)) - dynamicPaint_setPreview(surface); - else - dynamicPaint_resetPreview(surface->canvas); -} - int dynamicPaint_outputLayerExists(struct DynamicPaintSurface *surface, Object *ob, int index) { char *name; @@ -359,7 +321,33 @@ int dynamicPaint_outputLayerExists(struct DynamicPaintSurface *surface, Object * return 0; } -static int surfaceDublicateNameExists(void *arg, const char *name) +static int surface_duplicateOutputExists(void *arg, const char *name) +{ + DynamicPaintSurface *t_surface = (DynamicPaintSurface*)arg; + DynamicPaintSurface *surface = t_surface->canvas->surfaces.first; + + for(; surface; surface=surface->next) { + if (surface!=t_surface && surface->type==t_surface->type && + surface->format==t_surface->format) { + if (surface->output_name[0]!='\0' && !strcmp(name, surface->output_name)) return 1; + if (surface->output_name2[0]!='\0' && !strcmp(name, surface->output_name2)) return 1; + } + } + return 0; +} + +void surface_setUniqueOutputName(DynamicPaintSurface *surface, char *basename, int output) +{ + char name[64]; + strncpy(name, basename, 62); /* in case basename is surface->name use a copy */ + if (!output) + BLI_uniquename_cb(surface_duplicateOutputExists, surface, name, '.', surface->output_name, sizeof(surface->output_name)); + if (output) + BLI_uniquename_cb(surface_duplicateOutputExists, surface, name, '.', surface->output_name2, sizeof(surface->output_name2)); +} + + +static int surface_duplicateNameExists(void *arg, const char *name) { DynamicPaintSurface *t_surface = (DynamicPaintSurface*)arg; DynamicPaintSurface *surface = t_surface->canvas->surfaces.first; @@ -374,7 +362,48 @@ void dynamicPaintSurface_setUniqueName(DynamicPaintSurface *surface, char *basen { char name[64]; strncpy(name, basename, 62); /* in case basename is surface->name use a copy */ - BLI_uniquename_cb(surfaceDublicateNameExists, surface, name, '.', surface->name, sizeof(surface->name)); + BLI_uniquename_cb(surface_duplicateNameExists, surface, name, '.', surface->name, sizeof(surface->name)); +} + + +/* change surface data to defaults on new type */ +void dynamicPaintSurface_updateType(struct DynamicPaintSurface *surface) +{ + if (surface->format == MOD_DPAINT_SURFACE_F_IMAGESEQ) { + surface->output_name[0]='\0'; + surface->output_name2[0]='\0'; + surface->flags |= MOD_DPAINT_ANTIALIAS; + surface->disp_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; + } + + if (surface->type == MOD_DPAINT_SURFACE_T_PAINT) { + strcat(surface->output_name,"paintmap"); + strcat(surface->output_name2,"wetmap"); + surface_setUniqueOutputName(surface, surface->output_name2, 1); + } + else if (surface->type == MOD_DPAINT_SURFACE_T_DISPLACE) { + strcat(surface->output_name,"displace"); + } + else if (surface->type == MOD_DPAINT_SURFACE_T_WEIGHT) { + strcat(surface->output_name,"weight"); + } + else if (surface->type == MOD_DPAINT_SURFACE_T_WAVE) { + strcat(surface->output_name,"wave"); + } + + surface_setUniqueOutputName(surface, surface->output_name, 0); + + /* update preview */ + if (dynamicPaint_surfaceHasColorPreview(surface)) + dynamicPaint_setPreview(surface); + else + dynamicPaint_resetPreview(surface->canvas); } static int surface_totalSamples(DynamicPaintSurface *surface) @@ -1025,7 +1054,7 @@ int dynamicPaint_createType(struct DynamicPaintModifierData *pmd, int type, stru pmd->brush->psys = NULL; - pmd->brush->flags = MOD_DPAINT_ABS_ALPHA; + pmd->brush->flags = MOD_DPAINT_ABS_ALPHA | MOD_DPAINT_RAMP_ALPHA; pmd->brush->collision = MOD_DPAINT_COL_VOLUME; pmd->brush->mat = NULL; @@ -1035,7 +1064,7 @@ int dynamicPaint_createType(struct DynamicPaintModifierData *pmd, int type, stru pmd->brush->alpha = 1.0f; pmd->brush->wetness = 1.0f; - pmd->brush->paint_distance = 0.1f; + pmd->brush->paint_distance = 1.0f; pmd->brush->proximity_falloff = MOD_DPAINT_PRFALL_SMOOTH; pmd->brush->particle_radius = 0.2f; @@ -3318,8 +3347,6 @@ static void dynamicPaint_updatePointData(DynamicPaintSurface *surface, unsigned /* checks whether surface and brush bounds intersect depending on brush type */ static int meshBrush_boundsIntersect(Bounds3D *b1, Bounds3D *b2, DynamicPaintBrushSettings *brush) { - if (brush->flags & MOD_DPAINT_ACCEPT_NONCLOSED) - return 1; if (brush->collision == MOD_DPAINT_COL_VOLUME) return boundsIntersect(b1, b2); else if (brush->collision == MOD_DPAINT_COL_DIST || brush->collision == MOD_DPAINT_COL_VOLDIST) @@ -3452,6 +3479,7 @@ static int dynamicPaint_paintMesh(DynamicPaintSurface *surface, DynamicPaintBrus if (!brush->dm) return 0; { BVHTreeFromMesh treeData = {0}; + float avg_brushNor[3] = {0.0f}; int numOfVerts; int ii; Bounds3D mesh_bb = {0}; @@ -3468,6 +3496,25 @@ static int dynamicPaint_paintMesh(DynamicPaintSurface *surface, DynamicPaintBrus for (ii=0; iiobmat, mvert[ii].co); boundInsert(&mesh_bb, mvert[ii].co); + + /* for project brush calculate average normal */ + if (brush->collision & MOD_DPAINT_COL_DIST && brush->flags & MOD_DPAINT_PROX_PROJECT) { + float nor[3]; + normal_short_to_float_v3(nor, mvert[ii].no); + mul_mat3_m4_v3(brushOb->obmat, nor); + normalize_v3(nor); + + VECADD(avg_brushNor, avg_brushNor, nor); + } + } + + if (brush->collision & MOD_DPAINT_COL_DIST && brush->flags & MOD_DPAINT_PROX_PROJECT) { + VECMULVAL(avg_brushNor, 1.0f/(float)numOfVerts); + /* instead of null vector use positive z */ + if (!(MIN3(avg_brushNor[0],avg_brushNor[1],avg_brushNor[2]))) + avg_brushNor[2] = 1.0f; + else + normalize_v3(avg_brushNor); } /* check bounding box collision */ @@ -3510,7 +3557,7 @@ static int dynamicPaint_paintMesh(DynamicPaintSurface *surface, DynamicPaintBrus for (ss=0; ssrealCoord[bData->s_pos[index]+ss].v); - if (!(brush->flags & MOD_DPAINT_ACCEPT_NONCLOSED) || brush->ray_dir == MOD_DPAINT_RAY_CANVAS) { - VECCOPY(ray_dir, bData->bNormal[index].invNorm); - } - else /* MOD_DPAINT_RAY_ZPLUS */ - ray_dir[2] = 1.0f; + VECCOPY(ray_dir, bData->bNormal[index].invNorm); /* a simple hack to minimize chance of ray leaks at identical ray <-> edge locations */ VECADDVAL(ray_start, 0.001f); @@ -3566,15 +3609,13 @@ static int dynamicPaint_paintMesh(DynamicPaintSurface *surface, DynamicPaintBrus float dist = hit.dist; int f_index = hit.index; - /* In case of non-closed volumes, also cast a ray in opposite direction - * to make sure point is at least between two brush faces*/ - if (!(brush->flags & MOD_DPAINT_ACCEPT_NONCLOSED)) { - VECMULVAL(ray_dir, -1.0f); - hit.index = -1; - hit.dist = 9999; + /* Also cast a ray in opposite direction to make sure + * point is at least surrounded by two brush faces */ + VECMULVAL(ray_dir, -1.0f); + hit.index = -1; + hit.dist = 9999; - BLI_bvhtree_ray_cast(treeData.tree, ray_start, ray_dir, 0.0f, &hit, mesh_faces_spherecast_dp, &treeData); - } + BLI_bvhtree_ray_cast(treeData.tree, ray_start, ray_dir, 0.0f, &hit, mesh_faces_spherecast_dp, &treeData); if(hit.index != -1) { /* Add factor on supersample filter */ @@ -3603,7 +3644,7 @@ static int dynamicPaint_paintMesh(DynamicPaintSurface *surface, DynamicPaintBrus if (brush->flags & MOD_DPAINT_INVERSE_PROX && !hit_found) continue; /* If pure distance proximity, find the nearest point on the mesh */ - if (!(brush->flags & MOD_DPAINT_PROX_FACEALIGNED)) { + if (brush->collision != MOD_DPAINT_COL_DIST || !(brush->flags & MOD_DPAINT_PROX_PROJECT)) { if (BLI_bvhtree_find_nearest(treeData.tree, ray_start, &nearest, mesh_faces_nearest_point_dp, &treeData) != -1) { proxDist = sqrt(nearest.dist); copy_v3_v3(hitCo, nearest.co); @@ -3611,16 +3652,27 @@ static int dynamicPaint_paintMesh(DynamicPaintSurface *surface, DynamicPaintBrus face = nearest.index; } } - else { /* else cast a ray in surface normal direction */ - negate_v3(ray_dir); + else { /* else cast a ray in defined projection direction */ + float proj_ray[3] = {0.0f}; + + if (brush->ray_dir == MOD_DPAINT_RAY_CANVAS) { + VECCOPY(proj_ray, bData->bNormal[index].invNorm); + negate_v3(proj_ray); + } + else if (brush->ray_dir == MOD_DPAINT_RAY_BRUSH_AVG) { + VECCOPY(proj_ray, avg_brushNor); + } + else { /* MOD_DPAINT_RAY_ZPLUS */ + proj_ray[2] = 1.0f; + } hit.index = -1; hit.dist = brush->paint_distance; /* Do a face normal directional raycast, and use that distance */ - if(BLI_bvhtree_ray_cast(treeData.tree, ray_start, ray_dir, 0.0f, &hit, mesh_faces_spherecast_dp, &treeData) != -1) + if(BLI_bvhtree_ray_cast(treeData.tree, ray_start, proj_ray, 0.0f, &hit, mesh_faces_spherecast_dp, &treeData) != -1) { proxDist = hit.dist; - VECADDFAC(hitCo, ray_start, ray_dir, hit.dist); /* Calculate final hit coordinates */ + VECADDFAC(hitCo, ray_start, proj_ray, hit.dist); /* Calculate final hit coordinates */ hQuad = (hit.no[0] == 1.0f); face = hit.index; } diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c index b072ae4dfe5..04ddb130736 100644 --- a/source/blender/editors/interface/interface_templates.c +++ b/source/blender/editors/interface/interface_templates.c @@ -747,7 +747,7 @@ static uiLayout *draw_modifier(uiLayout *layout, Scene *scene, Object *ob, Modif uiBlockBeginAlign(block); /* Softbody not allowed in this situation, enforce! */ if ( ((md->type!=eModifierType_Softbody && md->type!=eModifierType_Collision) || !(ob->pd && ob->pd->deflect)) - && !ELEM(md->type, eModifierType_Surface, eModifierType_DynamicPaint) ) + && (md->type!=eModifierType_Surface) ) { uiItemR(row, &ptr, "show_render", 0, "", ICON_NONE); uiItemR(row, &ptr, "show_viewport", 0, "", ICON_NONE); @@ -804,7 +804,7 @@ static uiLayout *draw_modifier(uiLayout *layout, Scene *scene, Object *ob, Modif box= uiLayoutBox(column); row= uiLayoutRow(box, 0); - if (!ELEM3(md->type, eModifierType_Collision, eModifierType_Surface, eModifierType_DynamicPaint)) { + if (!ELEM(md->type, eModifierType_Collision, eModifierType_Surface)) { /* only here obdata, the rest of modifiers is ob level */ uiBlockSetButLock(block, object_data_is_libdata(ob), ERROR_LIBDATA_MESSAGE); diff --git a/source/blender/makesdna/DNA_dynamicpaint_types.h b/source/blender/makesdna/DNA_dynamicpaint_types.h index 2dbd1a50001..2a71831e074 100644 --- a/source/blender/makesdna/DNA_dynamicpaint_types.h +++ b/source/blender/makesdna/DNA_dynamicpaint_types.h @@ -85,30 +85,30 @@ typedef struct DynamicPaintSurface { char name[64]; short format, type; short disp_type, image_fileformat; - short effect_ui; /* just ui selection box */ + short effect_ui; /* ui selection box */ short preview_id; /* surface output id to preview */ short init_color_type, pad_s; int flags, effect; int image_resolution, substeps; int start_frame, end_frame; - - int dry_speed, diss_speed; - float disp_clamp; + int pad; /* initial color */ float init_color[4]; struct Tex *init_texture; char init_layername[40]; - int pad; + + int dry_speed, diss_speed; + float disp_clamp; float spread_speed, color_spread_speed, shrink_speed; float drip_vel, drip_acc; /* wave settings */ float wave_damping, wave_speed, wave_timescale, wave_spring; - char uvlayer_name[32]; + char uvlayer_name[32]; char image_output_path[240]; char output_name[40]; char output_name2[40]; /* some surfaces have 2 outputs */ @@ -143,9 +143,8 @@ typedef struct DynamicPaintCanvasSettings { #define MOD_DPAINT_ERASE (1<<3) /* removes paint */ #define MOD_DPAINT_RAMP_ALPHA (1<<4) /* only read falloff ramp alpha */ -#define MOD_DPAINT_PROX_FACEALIGNED (1<<5) /* do proximity check only in normal dir */ +#define MOD_DPAINT_PROX_PROJECT (1<<5) /* do proximity check only in defined dir */ #define MOD_DPAINT_INVERSE_PROX (1<<6) /* inverse proximity painting */ -#define MOD_DPAINT_ACCEPT_NONCLOSED (1<<7) /* allows volume brushes to work with non-closed volumes */ #define MOD_DPAINT_DO_SMUDGE (1<<8) /* brush smudges existing paint */ #define MOD_DPAINT_VELOCITY_ALPHA (1<<9) /* multiply brush influence by velocity */ @@ -173,7 +172,8 @@ typedef struct DynamicPaintCanvasSettings { /* brush ray_dir */ #define MOD_DPAINT_RAY_CANVAS 0 -#define MOD_DPAINT_RAY_ZPLUS 1 +#define MOD_DPAINT_RAY_BRUSH_AVG 1 +#define MOD_DPAINT_RAY_ZPLUS 2 /* Brush settings */ diff --git a/source/blender/makesdna/DNA_modifier_types.h b/source/blender/makesdna/DNA_modifier_types.h index 9f22a67d11e..3c6018328d8 100644 --- a/source/blender/makesdna/DNA_modifier_types.h +++ b/source/blender/makesdna/DNA_modifier_types.h @@ -751,9 +751,6 @@ typedef struct ScrewModifierData { typedef struct WarpModifierData { ModifierData modifier; - - - /* keep in sync with MappingInfoModifierData */ struct Tex *texture; struct Object *map_object; diff --git a/source/blender/makesrna/intern/rna_dynamicpaint.c b/source/blender/makesrna/intern/rna_dynamicpaint.c index bd9915f92be..0aa1c8f8aff 100644 --- a/source/blender/makesrna/intern/rna_dynamicpaint.c +++ b/source/blender/makesrna/intern/rna_dynamicpaint.c @@ -314,9 +314,9 @@ static void rna_def_canvas_surface(BlenderRNA *brna) /* 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", ""}, + {MOD_DPAINT_INITIAL_COLOR, "COLOR", ICON_COLOR, "Color", ""}, + {MOD_DPAINT_INITIAL_TEXTURE, "TEXTURE", ICON_TEXTURE, "UV Texture", ""}, + {MOD_DPAINT_INITIAL_VERTEXCOLOR, "VERTEXCOLOR", ICON_GROUP_VCOL, "Vertex Color", ""}, {0, NULL, 0, NULL, NULL}}; /* Effect type @@ -687,7 +687,7 @@ static void rna_def_dynamic_paint_brush_settings(BlenderRNA *brna) static EnumPropertyItem prop_dynamicpaint_prox_falloff[] = { {MOD_DPAINT_PRFALL_SMOOTH, "SMOOTH", ICON_SPHERECURVE, "Smooth", ""}, {MOD_DPAINT_PRFALL_SHARP, "SHARP", ICON_NOCURVE, "Sharp", ""}, - {MOD_DPAINT_PRFALL_RAMP, "RAMP", 0, "Color Ramp", ""}, + {MOD_DPAINT_PRFALL_RAMP, "RAMP", ICON_COLOR, "Color Ramp", ""}, {0, NULL, 0, NULL, NULL}}; static EnumPropertyItem prop_dynamicpaint_brush_wave_type[] = { @@ -698,7 +698,8 @@ static void rna_def_dynamic_paint_brush_settings(BlenderRNA *brna) static EnumPropertyItem prop_dynamicpaint_brush_ray_dir[] = { {MOD_DPAINT_RAY_CANVAS, "CANVAS", 0, "Canvas Normal", ""}, - {MOD_DPAINT_RAY_ZPLUS, "ZPLUT", 0, "Z-Axis", ""}, + {MOD_DPAINT_RAY_BRUSH_AVG, "BRUSH", 0, "Brush Normal", ""}, + {MOD_DPAINT_RAY_ZPLUS, "ZPLUS", 0, "Z-Axis", ""}, {0, NULL, 0, NULL, NULL}}; static EnumPropertyItem buttons_dynamicpaint_settings_menu[] = { @@ -804,15 +805,6 @@ static void rna_def_dynamic_paint_brush_settings(BlenderRNA *brna) RNA_def_property_enum_sdna(prop, NULL, "collision"); RNA_def_property_enum_items(prop, prop_dynamicpaint_collisiontype); RNA_def_property_ui_text(prop, "Paint Source", ""); - - prop= RNA_def_property(srna, "accept_nonclosed", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DPAINT_ACCEPT_NONCLOSED); - RNA_def_property_ui_text(prop, "Non-Closed", "Allows painting with non-closed meshes. Brush influence is defined by custom ray direction."); - - prop= RNA_def_property(srna, "ray_dir", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_sdna(prop, NULL, "ray_dir"); - RNA_def_property_enum_items(prop, prop_dynamicpaint_brush_ray_dir); - RNA_def_property_ui_text(prop, "Ray Dir", "Defines ray direction to use for non-closed meshes. If ray faces an opposite normal brush is processed."); prop= RNA_def_property(srna, "paint_distance", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "paint_distance"); @@ -830,13 +822,18 @@ static void rna_def_dynamic_paint_brush_settings(BlenderRNA *brna) RNA_def_property_enum_items(prop, prop_dynamicpaint_prox_falloff); RNA_def_property_ui_text(prop, "Falloff", "Proximity falloff type"); - prop= RNA_def_property(srna, "prox_facealigned", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DPAINT_PROX_FACEALIGNED); - RNA_def_property_ui_text(prop, "Face Aligned", "Check proximity in canvas face normal direction only."); + prop= RNA_def_property(srna, "prox_project", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DPAINT_PROX_PROJECT); + RNA_def_property_ui_text(prop, "Project", "Brush is projected to canvas from defined direction within brush proximity."); + + prop= RNA_def_property(srna, "ray_dir", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "ray_dir"); + RNA_def_property_enum_items(prop, prop_dynamicpaint_brush_ray_dir); + RNA_def_property_ui_text(prop, "Ray Dir", "Defines ray direction to use for projection. If brush object is located in that direction it's painted."); prop= RNA_def_property(srna, "prox_inverse", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DPAINT_INVERSE_PROX); - RNA_def_property_ui_text(prop, "Inner", "Proximity falloff is applied inside the volume."); + RNA_def_property_ui_text(prop, "Inner Proximity", "Proximity falloff is applied inside the volume."); /* diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c index c6e200dac73..f6470458b26 100644 --- a/source/blender/makesrna/intern/rna_modifier.c +++ b/source/blender/makesrna/intern/rna_modifier.c @@ -48,7 +48,7 @@ #include "BKE_animsys.h" #include "BKE_bmesh.h" /* For BevelModifierData */ -#include "BKE_dynamicpaint.h" /* For dynamicPaint_Modifier_free & *_createType */ +#include "BKE_dynamicpaint.h" #include "BKE_multires.h" #include "BKE_smoke.h" /* For smokeModifier_free & smokeModifier_createType */ diff --git a/source/blender/nodes/intern/SHD_util.c b/source/blender/nodes/intern/SHD_util.c index 190f68ce19a..2c0dc98fd3b 100644 --- a/source/blender/nodes/intern/SHD_util.c +++ b/source/blender/nodes/intern/SHD_util.c @@ -144,6 +144,8 @@ void ntreeShaderGetTexcoMode(bNodeTree *ntree, int r_mode, short *texco, int *mo *texco |= TEXCO_NORM|NEED_UV; break; case GEOM_OUT_VCOL: *texco |= NEED_UV; *mode |= MA_VERTEXCOL; break; + case GEOM_OUT_VCOL_ALPHA: + *texco |= NEED_UV; *mode |= MA_VERTEXCOL; break; } } } diff --git a/source/blender/render/extern/include/RE_shader_ext.h b/source/blender/render/extern/include/RE_shader_ext.h index 78f0407943f..52053fc2274 100644 --- a/source/blender/render/extern/include/RE_shader_ext.h +++ b/source/blender/render/extern/include/RE_shader_ext.h @@ -195,7 +195,6 @@ struct Tex; struct MTex; struct ImBuf; -int multitex(struct Tex *tex, float *texvec, float *dxt, float *dyt, int osatex, struct TexResult *texres, short thread, short which_output); /* this one uses nodes */ int multitex_ext(struct Tex *tex, float *texvec, float *dxt, float *dyt, int osatex, struct TexResult *texres); /* nodes disabled */ @@ -204,8 +203,6 @@ int multitex_ext_safe(struct Tex *tex, float *texvec, struct TexResult *texres); 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); -void texco_mapping_ext(float *facenor, struct Tex* tex, struct MTex* mtex, float* co, float* dx, float* dy, float* texvec); - /* shaded view and bake */ struct Render; struct Image; diff --git a/source/blender/render/intern/source/render_texture.c b/source/blender/render/intern/source/render_texture.c index 9a5de4ae937..56b6dedd24c 100644 --- a/source/blender/render/intern/source/render_texture.c +++ b/source/blender/render/intern/source/render_texture.c @@ -1164,7 +1164,7 @@ static void do_2d_mapping(MTex *mtex, float *t, VlakRen *vlr, float *n, float *d /* ************************************** */ -int multitex(Tex *tex, float *texvec, float *dxt, float *dyt, int osatex, TexResult *texres, short thread, short which_output) +static int multitex(Tex *tex, float *texvec, float *dxt, float *dyt, int osatex, TexResult *texres, short thread, short which_output) { float tmpvec[3]; int retval=0; /* return value, int:0, col:1, nor:2, everything:3 */ @@ -1672,21 +1672,6 @@ static void texco_mapping(ShadeInput* shi, Tex* tex, MTex* mtex, float* co, floa } } -void texco_mapping_ext(float *facenor, Tex* tex, MTex* mtex, float* co, float* dx, float* dy, float* texvec) -{ - ShadeInput dum_shi; - float null_v3[3] = {0.0f, 0.0f, 0.0f}; - memset (&dum_shi,0,sizeof(ShadeInput)); - - // Make sure values used by texco_mapping() are correct - dum_shi.osatex = 0; - dum_shi.vlr = NULL; - VECCOPY(dum_shi.facenor, facenor); - - texco_mapping(&dum_shi, tex, mtex, co, dx, dy, texvec, null_v3, null_v3); -} - - /* Bump code from 2.5 development cycle, has a number of bugs, but here for compatibility */ typedef struct CompatibleBump { diff --git a/source/blender/render/intern/source/shadeinput.c b/source/blender/render/intern/source/shadeinput.c index 2b3ad1027e5..7dc5f0dfa4a 100644 --- a/source/blender/render/intern/source/shadeinput.c +++ b/source/blender/render/intern/source/shadeinput.c @@ -1117,14 +1117,9 @@ void shade_input_set_shade_texco(ShadeInput *shi) scol->col[3]= (l*((float)cp3[0]) - u*((float)cp1[0]) - v*((float)cp2[0]))/255.0f; /* try to prevent invalid color sampling of zero alpha points */ - if (!cp1[0]) cp1 = cp2; - if (!cp1[0]) cp1 = cp3; - - if (!cp2[0]) cp2 = cp1; - if (!cp2[0]) cp2 = cp3; - - if (!cp3[0]) cp3 = cp1; - if (!cp3[0]) cp3 = cp2; + if (!cp1[0]) cp1 = cp2; if (!cp1[0]) cp1 = cp3; + if (!cp2[0]) cp2 = cp1; if (!cp2[0]) cp2 = cp3; + if (!cp3[0]) cp3 = cp1; if (!cp3[0]) cp3 = cp2; /* sample color value */ scol->col[0]= (l*((float)cp3[3]) - u*((float)cp1[3]) - v*((float)cp2[3]))/255.0f; diff --git a/source/blenderplayer/bad_level_call_stubs/stubs.c b/source/blenderplayer/bad_level_call_stubs/stubs.c index 8608176569a..d5974042f40 100644 --- a/source/blenderplayer/bad_level_call_stubs/stubs.c +++ b/source/blenderplayer/bad_level_call_stubs/stubs.c @@ -119,12 +119,10 @@ void RE_zbuf_accumulate_vecblur(struct NodeBlurData *nbd, int xsize, int ysize, void ibuf_sample(struct ImBuf *ibuf, float fx, float fy, float dx, float dy, float *result) {} /* texture.c */ -int multitex(struct Tex *tex, float *texvec, float *dxt, float *dyt, int osatex, struct TexResult *texres, short thread, short which_output) {return 0;} int multitex_thread(struct Tex *tex, float *texvec, float *dxt, float *dyt, int osatex, struct TexResult *texres, short thread, short which_output) {return 0;} int multitex_ext(struct Tex *tex, float *texvec, float *dxt, float *dyt, int osatex, struct TexResult *texres){return 0;} 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) {} -- cgit v1.2.3