Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Sharybin <sergey.vfx@gmail.com>2013-07-15 18:47:58 +0400
committerSergey Sharybin <sergey.vfx@gmail.com>2013-07-15 18:47:58 +0400
commit1dd7156c4c1d6a62f17fb6621ec3dc31297ba54a (patch)
treef135c227e6ebecee7c44b80aeb55ec0799441f01 /source/blender/blenkernel/intern/dynamicpaint.c
parent86ba5c4fc5fd0ae1f1c8610a81026d939fb68404 (diff)
Fix #36058: Displace Modifier errors using a baked Image and displace baking inconsistency between 2.67/2.68RC and previous versions
This was in fact really nasty bug, caused by multitex_nodes function using global variable R (which is a copy of current renderer). this variable is not initialized to anything meaningful for until first rendering (preview or final) happened. Since multitex_nodes might be used outside of render pipeline, made it so whether CM is on or off as an argument to functions multitex_ext_safe and multitex_ext. Now multitex_nodes() is only shall be used for stuff happening from render pipeline! Also needed to make some changes to other places, so all the usages of texture sampling knows for the fact whether CM is on or off. And one more change is related on behavior of dispalcement, wave, warp, weightvg modifiers and smoke. They'll be always using CM off since texture is used for influence, not for color. It's rather bigger patch, but it's mostly straightforward changes, which we really need to be done. Reviewed by Brecht, thanks!
Diffstat (limited to 'source/blender/blenkernel/intern/dynamicpaint.c')
-rw-r--r--source/blender/blenkernel/intern/dynamicpaint.c27
1 files changed, 14 insertions, 13 deletions
diff --git a/source/blender/blenkernel/intern/dynamicpaint.c b/source/blender/blenkernel/intern/dynamicpaint.c
index a6811af1a94..1d5eaf3a1fc 100644
--- a/source/blender/blenkernel/intern/dynamicpaint.c
+++ b/source/blender/blenkernel/intern/dynamicpaint.c
@@ -1449,12 +1449,13 @@ static void dynamicPaint_initAdjacencyData(DynamicPaintSurface *surface, int for
MEM_freeN(temp_data);
}
-static void dynamicPaint_setInitialColor(DynamicPaintSurface *surface)
+static void dynamicPaint_setInitialColor(Scene *scene, DynamicPaintSurface *surface)
{
PaintSurfaceData *sData = surface->data;
PaintPoint *pPoint = (PaintPoint *)sData->type_data;
DerivedMesh *dm = surface->canvas->dm;
int i;
+ bool scene_color_manage = BKE_scene_check_color_management_enabled(scene);
if (surface->type != MOD_DPAINT_SURFACE_T_PAINT)
return;
@@ -1503,7 +1504,7 @@ static void dynamicPaint_setInitialColor(DynamicPaintSurface *surface)
uv[0] = tface[i].uv[j][0] * 2.0f - 1.0f;
uv[1] = tface[i].uv[j][1] * 2.0f - 1.0f;
- multitex_ext_safe(tex, uv, &texres, pool);
+ multitex_ext_safe(tex, uv, &texres, pool, scene_color_manage);
if (texres.tin > pPoint[*vert].alpha) {
copy_v3_v3(pPoint[*vert].color, &texres.tr);
@@ -1536,8 +1537,8 @@ static void dynamicPaint_setInitialColor(DynamicPaintSurface *surface)
/* remap to -1.0 to 1.0 */
uv_final[0] = uv_final[0] * 2.0f - 1.0f;
uv_final[1] = uv_final[1] * 2.0f - 1.0f;
-
- multitex_ext_safe(tex, uv_final, &texres, NULL);
+
+ multitex_ext_safe(tex, uv_final, &texres, NULL, scene_color_manage);
/* apply color */
copy_v3_v3(pPoint[i].color, &texres.tr);
@@ -1596,7 +1597,7 @@ static void dynamicPaint_setInitialColor(DynamicPaintSurface *surface)
}
/* clears surface data back to zero */
-void dynamicPaint_clearSurface(DynamicPaintSurface *surface)
+void dynamicPaint_clearSurface(Scene *scene, DynamicPaintSurface *surface)
{
PaintSurfaceData *sData = surface->data;
if (sData && sData->type_data) {
@@ -1613,7 +1614,7 @@ void dynamicPaint_clearSurface(DynamicPaintSurface *surface)
/* set initial color */
if (surface->type == MOD_DPAINT_SURFACE_T_PAINT)
- dynamicPaint_setInitialColor(surface);
+ dynamicPaint_setInitialColor(scene, surface);
if (sData->bData)
sData->bData->clear = 1;
@@ -1621,7 +1622,7 @@ void dynamicPaint_clearSurface(DynamicPaintSurface *surface)
}
/* completely (re)initializes surface (only for point cache types)*/
-int dynamicPaint_resetSurface(DynamicPaintSurface *surface)
+int dynamicPaint_resetSurface(Scene *scene, DynamicPaintSurface *surface)
{
int numOfPoints = dynamicPaint_surfaceNumOfPoints(surface);
/* free existing data */
@@ -1642,16 +1643,16 @@ int dynamicPaint_resetSurface(DynamicPaintSurface *surface)
/* set initial color */
if (surface->type == MOD_DPAINT_SURFACE_T_PAINT)
- dynamicPaint_setInitialColor(surface);
+ dynamicPaint_setInitialColor(scene, surface);
return 1;
}
/* make sure allocated surface size matches current requirements */
-static int dynamicPaint_checkSurfaceData(DynamicPaintSurface *surface)
+static int dynamicPaint_checkSurfaceData(Scene *scene, DynamicPaintSurface *surface)
{
if (!surface->data || ((dynamicPaint_surfaceNumOfPoints(surface) != surface->data->total_points))) {
- return dynamicPaint_resetSurface(surface);
+ return dynamicPaint_resetSurface(scene, surface);
}
return 1;
}
@@ -1953,7 +1954,7 @@ static void dynamicPaint_frameUpdate(DynamicPaintModifierData *pmd, Scene *scene
/* make sure surface is valid */
no_surface_data = surface->data == NULL;
- if (!dynamicPaint_checkSurfaceData(surface)) continue;
+ if (!dynamicPaint_checkSurfaceData(scene, surface)) continue;
/* limit frame range */
CLAMP(current_frame, surface->start_frame, surface->end_frame);
@@ -2225,7 +2226,7 @@ static int dynamicPaint_findNeighbourPixel(PaintUVPoint *tempPoints, DerivedMesh
/*
* Create a surface for uv image sequence format
*/
-int dynamicPaint_createUVSurface(DynamicPaintSurface *surface)
+int dynamicPaint_createUVSurface(Scene *scene, DynamicPaintSurface *surface)
{
/* Antialias jitter point relative coords */
float jitter5sample[10] = {0.0f, 0.0f,
@@ -2676,7 +2677,7 @@ int dynamicPaint_createUVSurface(DynamicPaintSurface *surface)
}
#endif
- dynamicPaint_setInitialColor(surface);
+ dynamicPaint_setInitialColor(scene, surface);
}
return (error == 0);