svn merge ^/trunk/blender -r43664:43676

This commit is contained in:
Campbell Barton 2012-01-24 20:19:09 +00:00
commit d3090a32f2
39 changed files with 381 additions and 130 deletions

@ -462,6 +462,9 @@ static void xml_read_shader_graph(const XMLReadState& state, Shader *shader, pug
else if(string_iequals(node.name(), "gamma")) {
snode = new GammaNode();
}
else if(string_iequals(node.name(), "brightness")) {
snode = new BrightContrastNode();
}
else if(string_iequals(node.name(), "combine_rgb")) {
snode = new CombineRGBNode();
}

@ -142,6 +142,10 @@ static ShaderNode *add_node(BL::BlendData b_data, ShaderGraph *graph, BL::Shader
node = new GammaNode();
break;
}
case BL::ShaderNode::type_BRIGHTCONTRAST: {
node = new BrightContrastNode();
break;
}
case BL::ShaderNode::type_MIX_RGB: {
BL::ShaderNodeMixRGB b_mix_node(b_node);
MixNode *mix = new MixNode();

@ -61,6 +61,7 @@ set(SRC_SVM_HEADERS
svm/svm_displace.h
svm/svm_fresnel.h
svm/svm_gamma.h
svm/svm_brightness.h
svm/svm_geometry.h
svm/svm_gradient.h
svm/svm_hsv.h

@ -20,6 +20,7 @@ set(SRC_OSL
node_environment_texture.osl
node_fresnel.osl
node_gamma.osl
node_brightness.osl
node_geometry.osl
node_glass_bsdf.osl
node_glossy_bsdf.osl

@ -0,0 +1,50 @@
/*
* Copyright 2011, Blender Foundation.
*
* 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.
*/
#include "stdosl.h"
shader node_brightness(
color ColorIn = color(0.8, 0.8, 0.8),
float Bright = 0.0,
float Contrast = 0.0,
output ColorOut = color(0.8, 0.8, 0.8)
{
float delta = Contrast * (1.0/200.0);
float a = 1.0 - delta * 2.0;
float b;
Bright *= 1.0/100.0;
/*
* The algorithm is by Werner D. Streidt
* (http://visca.com/ffactory/archives/5-99/msg00021.html)
* Extracted of OpenCV demhist.c
*/
if (Contrast > 0.0) {
a = (a < 0.0 ? 1.0/a : 0.0);
b = a * (Brightness - delta);
}
else {
delta *= -1.0;
b = a * (Brightness + delta);
}
ColorOut = a * ColorIn + b;
}

@ -131,6 +131,7 @@ CCL_NAMESPACE_END
#include "svm_hsv.h"
#include "svm_image.h"
#include "svm_gamma.h"
#include "svm_brightness.h"
#include "svm_invert.h"
#include "svm_light_path.h"
#include "svm_magic.h"
@ -270,6 +271,9 @@ __device_noinline void svm_eval_nodes(KernelGlobals *kg, ShaderData *sd, ShaderT
case NODE_GAMMA:
svm_node_gamma(sd, stack, node.y, node.z, node.w);
break;
case NODE_BRIGHTCONTRAST:
svm_node_brightness(sd, stack, node.y, node.z, node.w);
break;
case NODE_MIX:
svm_node_mix(kg, sd, stack, node.y, node.z, node.w, &offset);
break;

@ -0,0 +1,57 @@
/*
* Copyright 2011, Blender Foundation.
*
* 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.
*/
CCL_NAMESPACE_BEGIN
__device void svm_node_brightness(ShaderData *sd, float *stack, uint in_color, uint out_color, uint node)
{
uint bright_offset, contrast_offset;
float3 color = stack_load_float3(stack, in_color);
decode_node_uchar4(node, &bright_offset, &contrast_offset, NULL, NULL);
float brightness = stack_load_float(stack, bright_offset);
float contrast = stack_load_float(stack, contrast_offset);
brightness *= 1.0f/100.0f;
float delta = contrast * (1.0f/200.0f);
float a = 1.0f - delta * 2.0f;
float b;
/*
* The algorithm is by Werner D. Streidt
* (http://visca.com/ffactory/archives/5-99/msg00021.html)
* Extracted of OpenCV demhist.c
*/
if (contrast > 0.0f) {
a = (a > 0.0f? (1.0f / a): 0.0f);
b = a * (brightness - delta);
}
else {
delta *= -1.0f;
b = a * (brightness + delta);
}
color.x = a*color.x + b;
color.y = a*color.y + b;
color.z = a*color.z + b;
if (stack_valid(out_color))
stack_store_float3(stack, out_color, color);
}
CCL_NAMESPACE_END

@ -87,7 +87,8 @@ typedef enum NodeType {
NODE_INVERT = 5400,
NODE_NORMAL = 5500,
NODE_GAMMA = 5600,
NODE_TEX_CHECKER = 5700
NODE_TEX_CHECKER = 5700,
NODE_BRIGHTCONTRAST = 5800
} NodeType;
typedef enum NodeAttributeType {

@ -1820,6 +1820,38 @@ void GammaNode::compile(OSLCompiler& compiler)
compiler.add(this, "node_gamma");
}
/* Bright Contrast */
BrightContrastNode::BrightContrastNode()
: ShaderNode("brightness")
{
add_input("Color", SHADER_SOCKET_COLOR);
add_input("Bright", SHADER_SOCKET_FLOAT);
add_input("Contrast", SHADER_SOCKET_FLOAT);
add_output("Color", SHADER_SOCKET_COLOR);
}
void BrightContrastNode::compile(SVMCompiler& compiler)
{
ShaderInput *color_in = input("Color");
ShaderInput *bright_in = input("Bright");
ShaderInput *contrast_in = input("Contrast");
ShaderOutput *color_out = output("Color");
compiler.stack_assign(color_in);
compiler.stack_assign(bright_in);
compiler.stack_assign(contrast_in);
compiler.stack_assign(color_out);
compiler.add_node(NODE_BRIGHTCONTRAST,
color_in->stack_offset, color_out->stack_offset,
compiler.encode_uchar4(bright_in->stack_offset, contrast_in->stack_offset));
}
void BrightContrastNode::compile(OSLCompiler& compiler)
{
compiler.add(this, "node_brightness");
}
/* Separate RGB */
SeparateRGBNode::SeparateRGBNode()
: ShaderNode("separate_rgb")

@ -320,6 +320,11 @@ public:
SHADER_NODE_CLASS(GammaNode)
};
class BrightContrastNode : public ShaderNode {
public:
SHADER_NODE_CLASS(BrightContrastNode)
};
class SeparateRGBNode : public ShaderNode {
public:
SHADER_NODE_CLASS(SeparateRGBNode)

@ -523,6 +523,7 @@ struct ShadeResult;
#define SH_NODE_VOLUME_ISOTROPIC 162
#define SH_NODE_GAMMA 163
#define SH_NODE_TEX_CHECKER 164
#define SH_NODE_BRIGHTCONTRAST 165
/* custom defines options for Material node */
#define SH_NODE_MAT_DIFF 1

@ -97,6 +97,10 @@ static int neighY[8] = {0,1,1, 1, 0,-1,-1,-1};
/* brush mesh raycast status */
#define HIT_VOLUME 1
#define HIT_PROXIMITY 2
/* dynamicPaint_findNeighbourPixel() return codes */
#define NOT_FOUND -1
#define ON_MESH_EDGE -2
#define OUT_OF_TEXTURE -3
/* paint effect default movement per frame in global units */
#define EFF_MOVEMENT_PER_FRAME 0.05f
/* initial wave time factor */
@ -134,10 +138,10 @@ typedef struct Vec3f {
float v[3];
} Vec3f;
typedef struct BakeNeighPoint {
typedef struct BakeAdjPoint {
float dir[3]; /* vector pointing towards this neighbour */
float dist; /* distance to */
} BakeNeighPoint;
} BakeAdjPoint;
/* Surface data used while processing a frame */
typedef struct PaintBakeNormal {
@ -156,7 +160,7 @@ typedef struct PaintBakeData {
Bounds3D mesh_bounds;
/* adjacency info */
BakeNeighPoint *bNeighs; /* current global neighbour distances and directions, if required */
BakeAdjPoint *bNeighs; /* current global neighbour distances and directions, if required */
double average_dist;
/* space partitioning */
VolumeGrid *grid; /* space partitioning grid to optimize brush checks */
@ -188,13 +192,6 @@ typedef struct ImgSeqFormatData {
Vec3f *barycentricWeights; /* b-weights for all pixel samples */
} ImgSeqFormatData;
#if 0 /* UNUSED */
typedef struct EffVelPoint {
float previous_pos[3];
float previous_vel[3];
} EffVelPoint;
#endif
/* adjacency data flags */
#define ADJ_ON_MESH_EDGE (1<<0)
@ -470,19 +467,25 @@ static void object_cacheIgnoreClear(Object *ob, int state)
BLI_freelistN(&pidlist);
}
static void subframe_updateObject(Scene *scene, Object *ob, int flags, float frame)
static int subframe_updateObject(Scene *scene, Object *ob, int flags, float frame)
{
DynamicPaintModifierData *pmd = (DynamicPaintModifierData *)modifiers_findByType(ob, eModifierType_DynamicPaint);
bConstraint *con;
/* if other is dynamic paint canvas, dont update */
if (pmd && pmd->canvas)
return;
return 1;
/* if object has parents, update them too */
if (flags & UPDATE_PARENTS) {
if (ob->parent) subframe_updateObject(scene, ob->parent, 0, frame);
if (ob->track) subframe_updateObject(scene, ob->track, 0, frame);
int is_canvas = 0;
if (ob->parent) is_canvas += subframe_updateObject(scene, ob->parent, 0, frame);
if (ob->track) is_canvas += subframe_updateObject(scene, ob->track, 0, frame);
/* skip subframe if object is parented
* to vertex of a dynamic paint canvas */
if (is_canvas && (ob->partype == PARVERT1 || ob->partype == PARVERT3))
return 0;
/* also update constraint targets */
for (con = ob->constraints.first; con; con=con->next) {
@ -519,6 +522,8 @@ static void subframe_updateObject(Scene *scene, Object *ob, int flags, float fra
}
else
where_is_object_time(scene, ob, frame);
return 0;
}
static void scene_setSubframe(Scene *scene, float subframe)
@ -1223,7 +1228,7 @@ static void dynamicPaint_initAdjacencyData(DynamicPaintSurface *surface, int for
{
PaintSurfaceData *sData = surface->data;
DerivedMesh *dm = surface->canvas->dm;
PaintAdjData *ed;
PaintAdjData *ad;
int *temp_data;
int neigh_points = 0;
@ -1239,17 +1244,17 @@ static void dynamicPaint_initAdjacencyData(DynamicPaintSurface *surface, int for
if (!neigh_points) return;
/* allocate memory */
ed = sData->adj_data = MEM_callocN(sizeof(PaintAdjData), "Surface Adj Data");
if (!ed) return;
ed->n_index = MEM_callocN(sizeof(int)*sData->total_points, "Surface Adj Index");
ed->n_num = MEM_callocN(sizeof(int)*sData->total_points, "Surface Adj Counts");
ad = sData->adj_data = MEM_callocN(sizeof(PaintAdjData), "Surface Adj Data");
if (!ad) return;
ad->n_index = MEM_callocN(sizeof(int)*sData->total_points, "Surface Adj Index");
ad->n_num = MEM_callocN(sizeof(int)*sData->total_points, "Surface Adj Counts");
temp_data = MEM_callocN(sizeof(int)*sData->total_points, "Temp Adj Data");
ed->n_target = MEM_callocN(sizeof(int)*neigh_points, "Surface Adj Targets");
ed->flags = MEM_callocN(sizeof(int)*sData->total_points, "Surface Adj Flags");
ed->total_targets = neigh_points;
ad->n_target = MEM_callocN(sizeof(int)*neigh_points, "Surface Adj Targets");
ad->flags = MEM_callocN(sizeof(int)*sData->total_points, "Surface Adj Flags");
ad->total_targets = neigh_points;
/* in case of allocation error, free memory */
if (!ed->n_index || !ed->n_num || !ed->n_target || !temp_data) {
if (!ad->n_index || !ad->n_num || !ad->n_target || !temp_data) {
dynamicPaint_freeAdjData(sData);
if (temp_data) MEM_freeN(temp_data);
setError(surface->canvas, "Not enough free memory.");
@ -1269,14 +1274,15 @@ static void dynamicPaint_initAdjacencyData(DynamicPaintSurface *surface, int for
/* count number of edges per vertex */
for (i=0; i<numOfEdges; i++) {
ed->n_num[edge[i].v1]++;
ed->n_num[edge[i].v2]++;
ad->n_num[edge[i].v1]++;
ad->n_num[edge[i].v2]++;
temp_data[edge[i].v1]++;
temp_data[edge[i].v2]++;
}
/* to locate points on "mesh edge" */
/* also add number of vertices to temp_data
* to locate points on "mesh edge" */
for (i=0; i<numOfPolys; i++) {
int j=0;
for (; j<mpoly[i].totloop; j++) {
@ -1289,7 +1295,7 @@ static void dynamicPaint_initAdjacencyData(DynamicPaintSurface *surface, int for
for (i=0; i<sData->total_points; i++) {
if ((temp_data[i]%2) ||
temp_data[i] < 4)
ed->flags[i] |= ADJ_ON_MESH_EDGE;
ad->flags[i] |= ADJ_ON_MESH_EDGE;
/* reset temp data */
temp_data[i] = 0;
@ -1298,22 +1304,22 @@ static void dynamicPaint_initAdjacencyData(DynamicPaintSurface *surface, int for
/* order n_index array */
n_pos = 0;
for (i=0; i<sData->total_points; i++) {
ed->n_index[i] = n_pos;
n_pos += ed->n_num[i];
ad->n_index[i] = n_pos;
n_pos += ad->n_num[i];
}
/* and now add neighbour data using that info */
for (i=0; i<numOfEdges; i++) {
/* first vertex */
int index = edge[i].v1;
n_pos = ed->n_index[index]+temp_data[index];
ed->n_target[n_pos] = edge[i].v2;
n_pos = ad->n_index[index]+temp_data[index];
ad->n_target[n_pos] = edge[i].v2;
temp_data[index]++;
/* second vertex */
index = edge[i].v2;
n_pos = ed->n_index[index]+temp_data[index];
ed->n_target[n_pos] = edge[i].v1;
n_pos = ad->n_index[index]+temp_data[index];
ad->n_target[n_pos] = edge[i].v1;
temp_data[index]++;
}
}
@ -1497,10 +1503,11 @@ void dynamicPaint_clearSurface(DynamicPaintSurface *surface)
int dynamicPaint_resetSurface(DynamicPaintSurface *surface)
{
int numOfPoints = dynamicPaint_surfaceNumOfPoints(surface);
/* dont touch image sequence types. they get handled only on bake */
if (surface->format == MOD_DPAINT_SURFACE_F_IMAGESEQ) return 1;
/* free existing data */
if (surface->data) dynamicPaint_freeSurfaceData(surface);
/* dont reallocate for image sequence types. they get handled only on bake */
if (surface->format == MOD_DPAINT_SURFACE_F_IMAGESEQ) return 1;
if (numOfPoints < 1) return 0;
/* allocate memory */
@ -1904,8 +1911,8 @@ static int dynamicPaint_findNeighbourPixel(PaintUVPoint *tempPoints, DerivedMesh
x = px + neighX[n_index];
y = py + neighY[n_index];
if (x<0 || x>=w) return -1;
if (y<0 || y>=h) return -1;
if (x<0 || x>=w) return OUT_OF_TEXTURE;
if (y<0 || y>=h) return OUT_OF_TEXTURE;
tPoint = &tempPoints[x+w*y]; /* UV neighbour */
cPoint = &tempPoints[px+w*py]; /* Origin point */
@ -2018,8 +2025,8 @@ static int dynamicPaint_findNeighbourPixel(PaintUVPoint *tempPoints, DerivedMesh
}
}
/* If none found return -1 */
if (target_face == -1) return -1;
/* If none found pixel is on mesh edge */
if (target_face == -1) return ON_MESH_EDGE;
/*
* If target face is connected in UV space as well, just use original index
@ -2057,15 +2064,15 @@ static int dynamicPaint_findNeighbourPixel(PaintUVPoint *tempPoints, DerivedMesh
final_pixel[1] = (int)floor(pixel[1]);
/* If current pixel uv is outside of texture */
if (final_pixel[0] < 0 || final_pixel[0] >= w) return -1;
if (final_pixel[1] < 0 || final_pixel[1] >= h) return -1;
if (final_pixel[0] < 0 || final_pixel[0] >= w) return OUT_OF_TEXTURE;
if (final_pixel[1] < 0 || final_pixel[1] >= h) return OUT_OF_TEXTURE;
final_index = final_pixel[0] + w * final_pixel[1];
/* If we ended up to our origin point ( mesh has smaller than pixel sized faces) */
if (final_index == (px+w*py)) return -1;
if (final_index == (px+w*py)) return NOT_FOUND;
/* If found pixel still lies on wrong face ( mesh has smaller than pixel sized faces) */
if (tempPoints[final_index].face_index != target_face) return -1;
if (tempPoints[final_index].face_index != target_face) return NOT_FOUND;
/*
* If final point is an "edge pixel", use it's "real" neighbour instead
@ -2447,11 +2454,14 @@ int dynamicPaint_createUVSurface(DynamicPaintSurface *surface)
* If not found, -1 is returned */
int n_target = dynamicPaint_findNeighbourPixel(tempPoints, dm, uvname, w, h, tx, ty, i);
if (n_target != -1) {
if (n_target >= 0) {
ed->n_target[n_pos] = final_index[n_target];
ed->n_num[final_index[index]]++;
n_pos++;
}
else if (n_target == ON_MESH_EDGE || n_target == OUT_OF_TEXTURE) {
ed->flags[final_index[index]] |= ADJ_ON_MESH_EDGE;
}
}
}
}
@ -3152,8 +3162,8 @@ static int dynamicPaint_paintMesh(DynamicPaintSurface *surface,
mul_m4_v3(brushOb->obmat, mvert[ii].co);
boundInsert(&mesh_bb, mvert[ii].co);
/* for project brush calculate average normal */
if (brush->flags & MOD_DPAINT_PROX_PROJECT) {
/* for proximity project calculate average normal */
if (brush->flags & MOD_DPAINT_PROX_PROJECT && brush->collision != MOD_DPAINT_COL_VOLUME) {
float nor[3];
normal_short_to_float_v3(nor, mvert[ii].no);
mul_mat3_m4_v3(brushOb->obmat, nor);
@ -3163,7 +3173,7 @@ static int dynamicPaint_paintMesh(DynamicPaintSurface *surface,
}
}
if (brush->flags & MOD_DPAINT_PROX_PROJECT) {
if (brush->flags & MOD_DPAINT_PROX_PROJECT && brush->collision != MOD_DPAINT_COL_VOLUME) {
mul_v3_fl(avg_brushNor, 1.0f/(float)numOfVerts);
/* instead of null vector use positive z */
if (!(MIN3(avg_brushNor[0],avg_brushNor[1],avg_brushNor[2])))
@ -3860,14 +3870,13 @@ static int dynamicPaint_paintSinglePoint(DynamicPaintSurface *surface, float *po
/***************************** Dynamic Paint Step / Baking ******************************/
/*
* Calculate current frame neighbouring point distances
* and direction vectors
* Calculate current frame distances and directions for adjacency data
*/
static void dynamicPaint_prepareNeighbourData(DynamicPaintSurface *surface, int force_init)
static void dynamicPaint_prepareAdjacencyData(DynamicPaintSurface *surface, int force_init)
{
PaintSurfaceData *sData = surface->data;
PaintBakeData *bData = sData->bData;
BakeNeighPoint *bNeighs;
BakeAdjPoint *bNeighs;
PaintAdjData *adj_data = sData->adj_data;
Vec3f *realCoord = bData->realCoord;
int index;
@ -3875,7 +3884,7 @@ static void dynamicPaint_prepareNeighbourData(DynamicPaintSurface *surface, int
if ((!surface_usesAdjDistance(surface) && !force_init) || !sData->adj_data) return;
if (bData->bNeighs) MEM_freeN(bData->bNeighs);
bNeighs = bData->bNeighs = MEM_mallocN(sData->adj_data->total_targets*sizeof(struct BakeNeighPoint),"PaintEffectBake");
bNeighs = bData->bNeighs = MEM_mallocN(sData->adj_data->total_targets*sizeof(struct BakeAdjPoint),"PaintEffectBake");
if (!bNeighs) return;
#pragma omp parallel for schedule(static)
@ -3914,7 +3923,7 @@ static void dynamicPaint_prepareNeighbourData(DynamicPaintSurface *surface, int
/* find two adjacency points (closest_id) and influence (closest_d) to move paint towards when affected by a force */
void surface_determineForceTargetPoints(PaintSurfaceData *sData, int index, float force[3], float closest_d[2], int closest_id[2])
{
BakeNeighPoint *bNeighs = sData->bData->bNeighs;
BakeAdjPoint *bNeighs = sData->bData->bNeighs;
int numOfNeighs = sData->adj_data->n_num[index];
int i;
@ -3983,7 +3992,7 @@ static void dynamicPaint_doSmudge(DynamicPaintSurface *surface, DynamicPaintBrus
{
PaintSurfaceData *sData = surface->data;
PaintBakeData *bData = sData->bData;
BakeNeighPoint *bNeighs = sData->bData->bNeighs;
BakeAdjPoint *bNeighs = sData->bData->bNeighs;
int index, steps, step;
float eff_scale, max_velocity = 0.0f;
@ -4142,7 +4151,7 @@ static int dynamicPaint_prepareEffectStep(DynamicPaintSurface *surface, Scene *s
static void dynamicPaint_doEffectStep(DynamicPaintSurface *surface, float *force, PaintPoint *prevPoint, float timescale, float steps)
{
PaintSurfaceData *sData = surface->data;
BakeNeighPoint *bNeighs = sData->bData->bNeighs;
BakeAdjPoint *bNeighs = sData->bData->bNeighs;
float distance_scale = getSurfaceDimension(sData)/CANVAS_REL_SIZE;
int index;
timescale /= steps;
@ -4171,7 +4180,7 @@ static void dynamicPaint_doEffectStep(DynamicPaintSurface *surface, float *force
/* Loop through neighbouring points */
for (i=0; i<numOfNeighs; i++) {
int n_index = sData->adj_data->n_index[index]+i;
float w_factor /* , p_alpha = pPoint->e_alpha */ /* UNUSED */;
float w_factor;
PaintPoint *ePoint = &prevPoint[sData->adj_data->n_target[n_index]];
float speed_scale = (bNeighs[n_index].dist<eff_scale) ? 1.0f : eff_scale/bNeighs[n_index].dist;
float color_mix = (MIN3(ePoint->wetness, pPoint->wetness, 1.0f))*0.25f*surface->color_spread_speed;
@ -4308,7 +4317,7 @@ static void dynamicPaint_doEffectStep(DynamicPaintSurface *surface, float *force
void dynamicPaint_doWaveStep(DynamicPaintSurface *surface, float timescale)
{
PaintSurfaceData *sData = surface->data;
BakeNeighPoint *bNeighs = sData->bData->bNeighs;
BakeAdjPoint *bNeighs = sData->bData->bNeighs;
int index;
int steps, ss;
float dt, min_dist, damp_factor;
@ -4741,8 +4750,8 @@ static int dynamicPaint_generateBakeData(DynamicPaintSurface *surface, Scene *sc
/* generate surface space partitioning grid */
surfaceGenerateGrid(surface);
/* calculate current frame neighbouring point distances and global dirs */
dynamicPaint_prepareNeighbourData(surface, 0);
/* calculate current frame adjacency point distances and global dirs */
dynamicPaint_prepareAdjacencyData(surface, 0);
/* Copy current frame vertices to check against in next frame */
copy_m4_m4(bData->prev_obmat, ob->obmat);
@ -4825,7 +4834,7 @@ static int dynamicPaint_doStep(Scene *scene, Object *ob, DynamicPaintSurface *su
if (!sData->adj_data)
dynamicPaint_initAdjacencyData(surface, 1);
if (!bData->bNeighs)
dynamicPaint_prepareNeighbourData(surface, 1);
dynamicPaint_prepareAdjacencyData(surface, 1);
}
/* update object data on this subframe */

@ -1881,6 +1881,7 @@ static void registerShaderNodes(bNodeTreeType *ttype)
register_node_type_sh_material(ttype);
register_node_type_sh_camera(ttype);
register_node_type_sh_gamma(ttype);
register_node_type_sh_brightcontrast(ttype);
register_node_type_sh_value(ttype);
register_node_type_sh_rgb(ttype);
register_node_type_sh_mix_rgb(ttype);

@ -422,7 +422,7 @@ void FONT_OT_file_paste(wmOperatorType *ot)
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
/* properties */
WM_operator_properties_filesel(ot, FOLDERFILE|TEXTFILE, FILE_SPECIAL, FILE_OPENFILE, WM_FILESEL_FILEPATH);
WM_operator_properties_filesel(ot, FOLDERFILE|TEXTFILE, FILE_SPECIAL, FILE_OPENFILE, WM_FILESEL_FILEPATH, FILE_DEFAULTDISPLAY);
}
/******************* text to object operator ********************/
@ -1697,7 +1697,7 @@ void FONT_OT_open(wmOperatorType *ot)
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
/* properties */
WM_operator_properties_filesel(ot, FOLDERFILE|FTFONTFILE, FILE_SPECIAL, FILE_OPENFILE, WM_FILESEL_FILEPATH|WM_FILESEL_RELPATH);
WM_operator_properties_filesel(ot, FOLDERFILE|FTFONTFILE, FILE_SPECIAL, FILE_OPENFILE, WM_FILESEL_FILEPATH|WM_FILESEL_RELPATH, FILE_DEFAULTDISPLAY);
}
/******************* delete operator *********************/

@ -1731,7 +1731,7 @@ void init_userdef_do_versions(void)
SETCOLF(btheme->toops.selected_highlight, 0.51, 0.53, 0.55, 0.3);
}
U.use_16bit_textures = 0;
U.use_16bit_textures = 1;
}
/* GL Texture Garbage Collection (variable abused above!) */

@ -4852,7 +4852,7 @@ void EXPORT_MESH_OT_wavefront(wmOperatorType *ot)
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
/* properties */
WM_operator_properties_filesel(ot, FOLDERFILE|TEXTFILE, FILE_SPECIAL, FILE_SAVE, WM_FILESEL_FILEPATH);
WM_operator_properties_filesel(ot, FOLDERFILE|TEXTFILE, FILE_SPECIAL, FILE_SAVE, WM_FILESEL_FILEPATH, FILE_DEFAULTDISPLAY);
RNA_def_boolean(ot->srna, "apply_modifiers", 0, "Apply Modifiers", "Apply Modifiers");
RNA_def_boolean(ot->srna, "relpaths", 0, "Relative Paths", "Use relative paths for textures");

@ -1308,7 +1308,7 @@ void OBJECT_OT_multires_external_save(wmOperatorType *ot)
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
WM_operator_properties_filesel(ot, FOLDERFILE|BTXFILE, FILE_SPECIAL, FILE_SAVE, WM_FILESEL_FILEPATH|WM_FILESEL_RELPATH);
WM_operator_properties_filesel(ot, FOLDERFILE|BTXFILE, FILE_SPECIAL, FILE_SAVE, WM_FILESEL_FILEPATH|WM_FILESEL_RELPATH, FILE_DEFAULTDISPLAY);
edit_modifier_properties(ot);
}

@ -749,7 +749,7 @@ void TEXTURE_OT_envmap_save(wmOperatorType *ot)
prop= RNA_def_float_array(ot->srna, "layout", 12, default_envmap_layout, 0.0f, 0.0f, "File layout", "Flat array describing the X,Y position of each cube face in the output image, where 1 is the size of a face - order is [+Z -Z +Y -X -Y +X] (use -1 to skip a face)", 0.0f, 0.0f);
RNA_def_property_flag(prop, PROP_HIDDEN);
WM_operator_properties_filesel(ot, FOLDERFILE|IMAGEFILE|MOVIEFILE, FILE_SPECIAL, FILE_SAVE, WM_FILESEL_FILEPATH);
WM_operator_properties_filesel(ot, FOLDERFILE|IMAGEFILE|MOVIEFILE, FILE_SPECIAL, FILE_SAVE, WM_FILESEL_FILEPATH, FILE_DEFAULTDISPLAY);
}
static int envmap_clear_exec(bContext *C, wmOperator *UNUSED(op))

@ -228,7 +228,7 @@ void SCREEN_OT_screenshot(wmOperatorType *ot)
ot->flag= 0;
WM_operator_properties_filesel(ot, FOLDERFILE|IMAGEFILE, FILE_SPECIAL, FILE_SAVE, WM_FILESEL_FILEPATH);
WM_operator_properties_filesel(ot, FOLDERFILE|IMAGEFILE, FILE_SPECIAL, FILE_SAVE, WM_FILESEL_FILEPATH, FILE_DEFAULTDISPLAY);
RNA_def_boolean(ot->srna, "full", 1, "Full Screen", "");
}

@ -186,7 +186,7 @@ static void SOUND_OT_open(wmOperatorType *ot)
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
/* properties */
WM_operator_properties_filesel(ot, FOLDERFILE|SOUNDFILE|MOVIEFILE, FILE_SPECIAL, FILE_OPENFILE, WM_FILESEL_FILEPATH | WM_FILESEL_RELPATH);
WM_operator_properties_filesel(ot, FOLDERFILE|SOUNDFILE|MOVIEFILE, FILE_SPECIAL, FILE_OPENFILE, WM_FILESEL_FILEPATH | WM_FILESEL_RELPATH, FILE_DEFAULTDISPLAY);
RNA_def_boolean(ot->srna, "cache", FALSE, "Cache", "Cache the sound in memory");
RNA_def_boolean(ot->srna, "mono", FALSE, "Mono", "Mixdown the sound to mono");
}
@ -207,7 +207,7 @@ static void SOUND_OT_open_mono(wmOperatorType *ot)
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
/* properties */
WM_operator_properties_filesel(ot, FOLDERFILE|SOUNDFILE|MOVIEFILE, FILE_SPECIAL, FILE_OPENFILE, WM_FILESEL_FILEPATH | WM_FILESEL_RELPATH);
WM_operator_properties_filesel(ot, FOLDERFILE|SOUNDFILE|MOVIEFILE, FILE_SPECIAL, FILE_OPENFILE, WM_FILESEL_FILEPATH | WM_FILESEL_RELPATH, FILE_DEFAULTDISPLAY);
RNA_def_boolean(ot->srna, "cache", FALSE, "Cache", "Cache the sound in memory");
RNA_def_boolean(ot->srna, "mono", TRUE, "Mono", "Mixdown the sound to mono");
}
@ -587,7 +587,7 @@ static void SOUND_OT_mixdown(wmOperatorType *ot)
ot->flag= OPTYPE_REGISTER;
/* properties */
WM_operator_properties_filesel(ot, FOLDERFILE|SOUNDFILE, FILE_SPECIAL, FILE_SAVE, WM_FILESEL_FILEPATH);
WM_operator_properties_filesel(ot, FOLDERFILE|SOUNDFILE, FILE_SPECIAL, FILE_SAVE, WM_FILESEL_FILEPATH, FILE_DEFAULTDISPLAY);
#ifdef WITH_AUDASPACE
RNA_def_int(ot->srna, "accuracy", 1024, 1, 16777216, "Accuracy", "Sample accuracy, important for animation data (the lower the value, the more accurate)", 1, 16777216);
RNA_def_enum(ot->srna, "container", container_items, AUD_CONTAINER_FLAC, "Container", "File format");

@ -224,7 +224,7 @@ void BUTTONS_OT_file_browse(wmOperatorType *ot)
ot->cancel= file_browse_cancel;
/* properties */
WM_operator_properties_filesel(ot, 0, FILE_SPECIAL, FILE_OPENFILE, WM_FILESEL_FILEPATH|WM_FILESEL_RELPATH);
WM_operator_properties_filesel(ot, 0, FILE_SPECIAL, FILE_OPENFILE, WM_FILESEL_FILEPATH|WM_FILESEL_RELPATH, FILE_DEFAULTDISPLAY);
}
/* second operator, only difference from BUTTONS_OT_file_browse is WM_FILESEL_DIRECTORY */
@ -241,5 +241,5 @@ void BUTTONS_OT_directory_browse(wmOperatorType *ot)
ot->cancel= file_browse_cancel;
/* properties */
WM_operator_properties_filesel(ot, 0, FILE_SPECIAL, FILE_OPENFILE, WM_FILESEL_DIRECTORY|WM_FILESEL_RELPATH);
WM_operator_properties_filesel(ot, 0, FILE_SPECIAL, FILE_OPENFILE, WM_FILESEL_DIRECTORY|WM_FILESEL_RELPATH, FILE_DEFAULTDISPLAY);
}

@ -213,7 +213,7 @@ void CLIP_OT_open(wmOperatorType *ot)
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
/* properties */
WM_operator_properties_filesel(ot, FOLDERFILE|IMAGEFILE|MOVIEFILE, FILE_SPECIAL, FILE_OPENFILE, WM_FILESEL_FILEPATH|WM_FILESEL_RELPATH);
WM_operator_properties_filesel(ot, FOLDERFILE|IMAGEFILE|MOVIEFILE, FILE_SPECIAL, FILE_OPENFILE, WM_FILESEL_FILEPATH|WM_FILESEL_RELPATH, FILE_DEFAULTDISPLAY);
}
/******************* reload clip operator *********************/

@ -215,14 +215,19 @@ short ED_fileselect_set_params(SpaceFile *sfile)
params->flag |= RNA_boolean_get(op->ptr, "autoselect") ? FILE_AUTOSELECT : 0;
params->flag |= RNA_boolean_get(op->ptr, "active_layer") ? FILE_ACTIVELAY : 0;
}
if (U.uiflag & USER_SHOW_THUMBNAILS) {
if(params->filter & (IMAGEFILE|MOVIEFILE))
params->display= FILE_IMGDISPLAY;
else
if(RNA_struct_find_property(op->ptr, "display_type"))
params->display= RNA_enum_get(op->ptr, "display_type");
if(params->display==FILE_DEFAULTDISPLAY) {
if (U.uiflag & USER_SHOW_THUMBNAILS) {
if(params->filter & (IMAGEFILE|MOVIEFILE))
params->display= FILE_IMGDISPLAY;
else
params->display= FILE_SHORTDISPLAY;
} else {
params->display= FILE_SHORTDISPLAY;
} else {
params->display= FILE_SHORTDISPLAY;
}
}
if (is_relative_path) {

@ -1188,7 +1188,7 @@ void GRAPH_OT_sound_bake (wmOperatorType *ot)
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
/* properties */
WM_operator_properties_filesel(ot, FOLDERFILE|SOUNDFILE|MOVIEFILE, FILE_SPECIAL, FILE_OPENFILE, WM_FILESEL_FILEPATH);
WM_operator_properties_filesel(ot, FOLDERFILE|SOUNDFILE|MOVIEFILE, FILE_SPECIAL, FILE_OPENFILE, WM_FILESEL_FILEPATH, FILE_DEFAULTDISPLAY);
RNA_def_float(ot->srna, "low", 0.0f, 0.0, 100000.0, "Lowest frequency", "", 0.1, 1000.00);
RNA_def_float(ot->srna, "high", 100000.0, 0.0, 100000.0, "Highest frequency", "", 0.1, 1000.00);
RNA_def_float(ot->srna, "attack", 0.005, 0.0, 2.0, "Attack time", "", 0.01, 0.1);

@ -868,7 +868,7 @@ void IMAGE_OT_open(wmOperatorType *ot)
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
/* properties */
WM_operator_properties_filesel(ot, FOLDERFILE|IMAGEFILE|MOVIEFILE, FILE_SPECIAL, FILE_OPENFILE, WM_FILESEL_FILEPATH|WM_FILESEL_RELPATH);
WM_operator_properties_filesel(ot, FOLDERFILE|IMAGEFILE|MOVIEFILE, FILE_SPECIAL, FILE_OPENFILE, WM_FILESEL_FILEPATH|WM_FILESEL_RELPATH, FILE_DEFAULTDISPLAY);
}
/******************** replace image operator ********************/
@ -928,7 +928,7 @@ void IMAGE_OT_replace(wmOperatorType *ot)
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
/* properties */
WM_operator_properties_filesel(ot, FOLDERFILE|IMAGEFILE|MOVIEFILE, FILE_SPECIAL, FILE_OPENFILE, WM_FILESEL_FILEPATH|WM_FILESEL_RELPATH);
WM_operator_properties_filesel(ot, FOLDERFILE|IMAGEFILE|MOVIEFILE, FILE_SPECIAL, FILE_OPENFILE, WM_FILESEL_FILEPATH|WM_FILESEL_RELPATH, FILE_DEFAULTDISPLAY);
}
/******************** save image as operator ********************/
@ -1278,7 +1278,7 @@ void IMAGE_OT_save_as(wmOperatorType *ot)
/* properties */
RNA_def_boolean(ot->srna, "copy", 0, "Copy", "Create a new image file without modifying the current image in blender");
WM_operator_properties_filesel(ot, FOLDERFILE|IMAGEFILE|MOVIEFILE, FILE_SPECIAL, FILE_SAVE, WM_FILESEL_FILEPATH|WM_FILESEL_RELPATH);
WM_operator_properties_filesel(ot, FOLDERFILE|IMAGEFILE|MOVIEFILE, FILE_SPECIAL, FILE_SAVE, WM_FILESEL_FILEPATH|WM_FILESEL_RELPATH, FILE_DEFAULTDISPLAY);
}
/******************** save image operator ********************/

@ -309,7 +309,7 @@ void FILE_OT_find_missing_files(wmOperatorType *ot)
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
/* properties */
WM_operator_properties_filesel(ot, 0, FILE_SPECIAL, FILE_OPENFILE, WM_FILESEL_FILEPATH);
WM_operator_properties_filesel(ot, 0, FILE_SPECIAL, FILE_OPENFILE, WM_FILESEL_FILEPATH, FILE_DEFAULTDISPLAY);
}
/********************* report box operator *********************/

@ -3519,7 +3519,7 @@ void NODE_OT_add_file(wmOperatorType *ot)
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
WM_operator_properties_filesel(ot, FOLDERFILE|IMAGEFILE, FILE_SPECIAL, FILE_OPENFILE, WM_FILESEL_FILEPATH); //XXX TODO, relative_path
WM_operator_properties_filesel(ot, FOLDERFILE|IMAGEFILE, FILE_SPECIAL, FILE_OPENFILE, WM_FILESEL_FILEPATH, FILE_DEFAULTDISPLAY); //XXX TODO, relative_path
RNA_def_string(ot->srna, "name", "Image", MAX_ID_NAME-2, "Name", "Datablock name to assign");
}

@ -402,7 +402,7 @@ void SEQUENCER_OT_movie_strip_add(struct wmOperatorType *ot)
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
WM_operator_properties_filesel(ot, FOLDERFILE|MOVIEFILE, FILE_SPECIAL, FILE_OPENFILE, WM_FILESEL_FILEPATH|WM_FILESEL_RELPATH|WM_FILESEL_FILES);
WM_operator_properties_filesel(ot, FOLDERFILE|MOVIEFILE, FILE_SPECIAL, FILE_OPENFILE, WM_FILESEL_FILEPATH|WM_FILESEL_RELPATH|WM_FILESEL_FILES, FILE_DEFAULTDISPLAY);
sequencer_generic_props__internal(ot, SEQPROP_STARTFRAME);
RNA_def_boolean(ot->srna, "sound", TRUE, "Sound", "Load sound with the movie");
}
@ -454,7 +454,7 @@ void SEQUENCER_OT_sound_strip_add(struct wmOperatorType *ot)
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
WM_operator_properties_filesel(ot, FOLDERFILE|SOUNDFILE, FILE_SPECIAL, FILE_OPENFILE, WM_FILESEL_FILEPATH|WM_FILESEL_RELPATH|WM_FILESEL_FILES);
WM_operator_properties_filesel(ot, FOLDERFILE|SOUNDFILE, FILE_SPECIAL, FILE_OPENFILE, WM_FILESEL_FILEPATH|WM_FILESEL_RELPATH|WM_FILESEL_FILES, FILE_DEFAULTDISPLAY);
sequencer_generic_props__internal(ot, SEQPROP_STARTFRAME);
RNA_def_boolean(ot->srna, "cache", FALSE, "Cache", "Cache the sound in memory");
}
@ -558,7 +558,7 @@ void SEQUENCER_OT_image_strip_add(struct wmOperatorType *ot)
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
WM_operator_properties_filesel(ot, FOLDERFILE|IMAGEFILE, FILE_SPECIAL, FILE_OPENFILE, WM_FILESEL_DIRECTORY|WM_FILESEL_RELPATH|WM_FILESEL_FILES);
WM_operator_properties_filesel(ot, FOLDERFILE|IMAGEFILE, FILE_SPECIAL, FILE_OPENFILE, WM_FILESEL_DIRECTORY|WM_FILESEL_RELPATH|WM_FILESEL_FILES, FILE_DEFAULTDISPLAY);
sequencer_generic_props__internal(ot, SEQPROP_STARTFRAME|SEQPROP_ENDFRAME);
}
@ -734,7 +734,7 @@ void SEQUENCER_OT_effect_strip_add(struct wmOperatorType *ot)
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
WM_operator_properties_filesel(ot, 0, FILE_SPECIAL, FILE_OPENFILE, WM_FILESEL_FILEPATH|WM_FILESEL_RELPATH);
WM_operator_properties_filesel(ot, 0, FILE_SPECIAL, FILE_OPENFILE, WM_FILESEL_FILEPATH|WM_FILESEL_RELPATH, FILE_DEFAULTDISPLAY);
sequencer_generic_props__internal(ot, SEQPROP_STARTFRAME|SEQPROP_ENDFRAME);
RNA_def_enum(ot->srna, "type", sequencer_prop_effect_types, SEQ_CROSS, "Type", "Sequencer effect type");
RNA_def_float_vector(ot->srna, "color", 3, NULL, 0.0f, 1.0f, "Color", "Initialize the strip with this color (only used when type='COLOR')", 0.0f, 1.0f);

@ -3060,5 +3060,5 @@ void SEQUENCER_OT_change_path(struct wmOperatorType *ot)
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
WM_operator_properties_filesel(ot, FOLDERFILE|IMAGEFILE|MOVIEFILE, FILE_SPECIAL, FILE_OPENFILE, WM_FILESEL_DIRECTORY|WM_FILESEL_RELPATH|WM_FILESEL_FILEPATH|WM_FILESEL_FILES);
WM_operator_properties_filesel(ot, FOLDERFILE|IMAGEFILE|MOVIEFILE, FILE_SPECIAL, FILE_OPENFILE, WM_FILESEL_DIRECTORY|WM_FILESEL_RELPATH|WM_FILESEL_FILEPATH|WM_FILESEL_FILES, FILE_DEFAULTDISPLAY);
}

@ -303,7 +303,7 @@ void TEXT_OT_open(wmOperatorType *ot)
ot->flag= OPTYPE_UNDO;
/* properties */
WM_operator_properties_filesel(ot, FOLDERFILE|TEXTFILE|PYSCRIPTFILE, FILE_SPECIAL, FILE_OPENFILE, WM_FILESEL_FILEPATH); //XXX TODO, relative_path
WM_operator_properties_filesel(ot, FOLDERFILE|TEXTFILE|PYSCRIPTFILE, FILE_SPECIAL, FILE_OPENFILE, WM_FILESEL_FILEPATH, FILE_DEFAULTDISPLAY); //XXX TODO, relative_path
RNA_def_boolean(ot->srna, "internal", 0, "Make internal", "Make text file internal after loading");
}
@ -563,7 +563,7 @@ void TEXT_OT_save_as(wmOperatorType *ot)
ot->poll= text_edit_poll;
/* properties */
WM_operator_properties_filesel(ot, FOLDERFILE|TEXTFILE|PYSCRIPTFILE, FILE_SPECIAL, FILE_SAVE, WM_FILESEL_FILEPATH); //XXX TODO, relative_path
WM_operator_properties_filesel(ot, FOLDERFILE|TEXTFILE|PYSCRIPTFILE, FILE_SPECIAL, FILE_SAVE, WM_FILESEL_FILEPATH, FILE_DEFAULTDISPLAY); //XXX TODO, relative_path
}
/******************* run script operator *********************/

@ -165,6 +165,11 @@ typedef struct drawDMFacesSel_userData {
int *orig_index;
} drawDMFacesSel_userData;
typedef struct drawDMNormal_userData {
BMEditMesh *em;
float normalsize;
} drawDMNormal_userData;
typedef struct bbsObmodeMeshVerts_userData {
void *offset;
MVert *mvert;
@ -2236,24 +2241,25 @@ void nurbs_foreachScreenVert(
static void draw_dm_face_normals__mapFunc(void *userData, int index, float *cent, float *no)
{
Scene *scene= ((void **)userData)[0];
BMEditMesh *em = ((void **)userData)[1];
BMFace *efa = EDBM_get_face_for_index(em, index);
ToolSettings *ts= scene->toolsettings;
drawDMNormal_userData *data = userData;
BMFace *efa = EDBM_get_face_for_index(data->em, index);
if (!BM_TestHFlag(efa, BM_HIDDEN)) {
glVertex3fv(cent);
glVertex3f( cent[0] + no[0]*ts->normalsize,
cent[1] + no[1]*ts->normalsize,
cent[2] + no[2]*ts->normalsize);
glVertex3f(cent[0] + no[0] * data->normalsize,
cent[1] + no[1] * data->normalsize,
cent[2] + no[2] * data->normalsize);
}
}
static void draw_dm_face_normals(BMEditMesh *em, Scene *scene, DerivedMesh *dm)
{
void *ptrs[2] = {scene, em};
drawDMNormal_userData data;
data.em = em;
data.normalsize = scene->toolsettings->normalsize;
glBegin(GL_LINES);
dm->foreachMappedFaceCenter(dm, draw_dm_face_normals__mapFunc, ptrs);
dm->foreachMappedFaceCenter(dm, draw_dm_face_normals__mapFunc, &data);
glEnd();
}
@ -2277,31 +2283,33 @@ static void draw_dm_face_centers(BMEditMesh *em, DerivedMesh *dm, int sel)
static void draw_dm_vert_normals__mapFunc(void *userData, int index, float *co, float *no_f, short *no_s)
{
Scene *scene= ((void **)userData)[0];
ToolSettings *ts= scene->toolsettings;
BMEditMesh *em = ((void **)userData)[1];
BMVert *eve = EDBM_get_vert_for_index(em, index);
drawDMNormal_userData *data = userData;
BMVert *eve = EDBM_get_vert_for_index(data->em, index);
if (!BM_TestHFlag(eve, BM_HIDDEN)) {
glVertex3fv(co);
if (no_f) {
glVertex3f( co[0] + no_f[0]*ts->normalsize,
co[1] + no_f[1]*ts->normalsize,
co[2] + no_f[2]*ts->normalsize);
} else {
glVertex3f( co[0] + no_s[0]*ts->normalsize/32767.0f,
co[1] + no_s[1]*ts->normalsize/32767.0f,
co[2] + no_s[2]*ts->normalsize/32767.0f);
glVertex3f(co[0] + no_f[0] * data->normalsize,
co[1] + no_f[1] * data->normalsize,
co[2] + no_f[2] * data->normalsize);
}
else {
glVertex3f(co[0] + no_s[0] * (data->normalsize / 32767.0f),
co[1] + no_s[1] * (data->normalsize / 32767.0f),
co[2] + no_s[2] * (data->normalsize / 32767.0f));
}
}
}
static void draw_dm_vert_normals(BMEditMesh *em, Scene *scene, DerivedMesh *dm)
{
void *ptrs[2] = {scene, em};
drawDMNormal_userData data;
data.em = em;
data.normalsize = scene->toolsettings->normalsize;
glBegin(GL_LINES);
dm->foreachMappedVert(dm, draw_dm_vert_normals__mapFunc, ptrs);
dm->foreachMappedVert(dm, draw_dm_vert_normals__mapFunc, &data);
glEnd();
}

@ -608,7 +608,8 @@ typedef struct SpaceClip {
/* FileSelectParams.display */
enum FileDisplayTypeE {
FILE_SHORTDISPLAY = 1,
FILE_DEFAULTDISPLAY = 0,
FILE_SHORTDISPLAY,
FILE_LONGDISPLAY,
FILE_IMGDISPLAY
};

@ -41,6 +41,7 @@ DefNode( ShaderNode, SH_NODE_RGBTOBW, 0, "RGBTO
DefNode( ShaderNode, SH_NODE_TEXTURE, def_texture, "TEXTURE", Texture, "Texture", "" )
DefNode( ShaderNode, SH_NODE_NORMAL, 0, "NORMAL", Normal, "Normal", "" )
DefNode( ShaderNode, SH_NODE_GAMMA, 0, "GAMMA", Gamma, "Gamma", "" )
DefNode( ShaderNode, SH_NODE_BRIGHTCONTRAST, 0, "BRIGHTCONTRAST", BrightContrast, "Bright Contrast", "" )
DefNode( ShaderNode, SH_NODE_GEOMETRY, def_sh_geometry, "GEOMETRY", Geometry, "Geometry", "" )
DefNode( ShaderNode, SH_NODE_MAPPING, def_sh_mapping, "MAPPING", Mapping, "Mapping", "" )
DefNode( ShaderNode, SH_NODE_CURVE_VEC, def_vector_curve, "CURVE_VEC", VectorCurve, "Vector Curve", "" )

@ -115,6 +115,7 @@ set(SRC
shader/nodes/node_shader_curves.c
shader/nodes/node_shader_dynamic.c
shader/nodes/node_shader_gamma.c
shader/nodes/node_shader_brightness.c
shader/nodes/node_shader_geom.c
shader/nodes/node_shader_hueSatVal.c
shader/nodes/node_shader_invert.c

@ -55,6 +55,7 @@ void register_node_type_sh_rgbtobw(struct bNodeTreeType *ttype);
void register_node_type_sh_texture(struct bNodeTreeType *ttype);
void register_node_type_sh_normal(struct bNodeTreeType *ttype);
void register_node_type_sh_gamma(struct bNodeTreeType *ttype);
void register_node_type_sh_brightcontrast(struct bNodeTreeType *ttype);
void register_node_type_sh_geom(struct bNodeTreeType *ttype);
void register_node_type_sh_mapping(struct bNodeTreeType *ttype);
void register_node_type_sh_curve_vec(struct bNodeTreeType *ttype);

@ -0,0 +1,60 @@
/*
* ***** 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.
*
* The Original Code is Copyright (C) 2006 Blender Foundation.
* All rights reserved.
*
* The Original Code is: all of this file.
*
* Contributor(s): none yet.
*
* ***** END GPL LICENSE BLOCK *****
*/
#include "node_shader_util.h"
/* **************** Brigh and contrsast ******************** */
static bNodeSocketTemplate sh_node_brightcontrast_in[]= {
{ SOCK_RGBA, 1, "Color", 1.0f, 1.0f, 1.0f, 1.0f},
{ SOCK_FLOAT, 1, "Bright", 0.0f, 0.0f, 0.0f, 0.0f, -100.0f, 100.0f, PROP_NONE},
{ SOCK_FLOAT, 1, "Contrast", 0.0f, 0.0f, 0.0f, 0.0f, -100.0f, 100.0f, PROP_NONE},
{ -1, 0, "" }
};
static bNodeSocketTemplate sh_node_brightcontrast_out[]= {
{ SOCK_RGBA, 0, "Color"},
{ -1, 0, "" }
};
void register_node_type_sh_brightcontrast(bNodeTreeType *ttype)
{
static bNodeType ntype;
node_type_base(ttype, &ntype, SH_NODE_BRIGHTCONTRAST, "Bright/Contrast", NODE_CLASS_OP_COLOR, NODE_OPTIONS);
node_type_compatibility(&ntype, NODE_NEW_SHADING);
node_type_socket_templates(&ntype, sh_node_brightcontrast_in, sh_node_brightcontrast_out);
node_type_size(&ntype, 140, 100, 320);
node_type_init(&ntype, NULL);
node_type_storage(&ntype, "", NULL, NULL);
node_type_exec(&ntype, NULL);
node_type_gpu(&ntype, NULL);
nodeRegisterType(ttype, &ntype);
}

@ -26,11 +26,6 @@
*/
/** \file blender/nodes/composite/nodes/node_composite_gamma.c
* \ingroup cmpnodes
*/
#include "node_shader_util.h"
/* **************** Gamma Tools ******************** */

@ -203,7 +203,7 @@ void WM_operator_properties_reset(struct wmOperator *op);
void WM_operator_properties_create(struct PointerRNA *ptr, const char *opstring);
void WM_operator_properties_create_ptr(struct PointerRNA *ptr, struct wmOperatorType *ot);
void WM_operator_properties_free(struct PointerRNA *ptr);
void WM_operator_properties_filesel(struct wmOperatorType *ot, int filter, short type, short action, short flag);
void WM_operator_properties_filesel(struct wmOperatorType *ot, int filter, short type, short action, short flag, short display);
void WM_operator_properties_gesture_border(struct wmOperatorType *ot, int extend);
void WM_operator_properties_gesture_straightline(struct wmOperatorType *ot, int cursor);
void WM_operator_properties_select_all(struct wmOperatorType *ot);

@ -831,10 +831,17 @@ int WM_operator_filesel(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
}
/* default properties for fileselect */
void WM_operator_properties_filesel(wmOperatorType *ot, int filter, short type, short action, short flag)
void WM_operator_properties_filesel(wmOperatorType *ot, int filter, short type, short action, short flag, short display)
{
PropertyRNA *prop;
static EnumPropertyItem file_display_items[] = {
{FILE_DEFAULTDISPLAY, "FILE_DEFAULTDISPLAY", 0, "Default", "Automatically determine display type for files"},
{FILE_SHORTDISPLAY, "FILE_SHORTDISPLAY", ICON_SHORTDISPLAY, "Short List", "Display files as short list"},
{FILE_LONGDISPLAY, "FILE_LONGDISPLAY", ICON_LONGDISPLAY, "Long List", "Display files as a detailed list"},
{FILE_IMGDISPLAY, "FILE_IMGDISPLAY", ICON_IMGDISPLAY, "Thumbnails", "Display files as thumbnails"},
{0, NULL, 0, NULL, NULL}};
if(flag & WM_FILESEL_FILEPATH)
RNA_def_string_file_path(ot->srna, "filepath", "", FILE_MAX, "File Path", "Path to file");
@ -881,6 +888,9 @@ void WM_operator_properties_filesel(wmOperatorType *ot, int filter, short type,
if(flag & WM_FILESEL_RELPATH)
RNA_def_boolean(ot->srna, "relative_path", TRUE, "Relative Path", "Select the file relative to the blend file");
prop= RNA_def_enum(ot->srna, "display_type", file_display_items, display, "Display Type", "");
RNA_def_property_flag(prop, PROP_HIDDEN);
}
void WM_operator_properties_select_all(wmOperatorType *ot)
@ -1650,7 +1660,7 @@ static void WM_OT_open_mainfile(wmOperatorType *ot)
ot->exec= wm_open_mainfile_exec;
/* ommit window poll so this can work in background mode */
WM_operator_properties_filesel(ot, FOLDERFILE|BLENDERFILE, FILE_BLENDER, FILE_OPENFILE, WM_FILESEL_FILEPATH);
WM_operator_properties_filesel(ot, FOLDERFILE|BLENDERFILE, FILE_BLENDER, FILE_OPENFILE, WM_FILESEL_FILEPATH, FILE_DEFAULTDISPLAY);
RNA_def_boolean(ot->srna, "load_ui", 1, "Load UI", "Load user interface setup in the .blend file");
RNA_def_boolean(ot->srna, "use_scripts", 1, "Trusted Source", "Allow blend file execute scripts automatically, default available from system preferences");
@ -1840,7 +1850,7 @@ static void WM_OT_link_append(wmOperatorType *ot)
ot->flag |= OPTYPE_UNDO;
WM_operator_properties_filesel(ot, FOLDERFILE|BLENDERFILE, FILE_LOADLIB, FILE_OPENFILE, WM_FILESEL_FILEPATH|WM_FILESEL_DIRECTORY|WM_FILESEL_FILENAME| WM_FILESEL_RELPATH|WM_FILESEL_FILES);
WM_operator_properties_filesel(ot, FOLDERFILE|BLENDERFILE, FILE_LOADLIB, FILE_OPENFILE, WM_FILESEL_FILEPATH|WM_FILESEL_DIRECTORY|WM_FILESEL_FILENAME| WM_FILESEL_RELPATH|WM_FILESEL_FILES, FILE_DEFAULTDISPLAY);
RNA_def_boolean(ot->srna, "link", 1, "Link", "Link the objects or datablocks rather than appending");
RNA_def_boolean(ot->srna, "autoselect", 1, "Select", "Select the linked objects");
@ -1921,7 +1931,7 @@ static void WM_OT_recover_auto_save(wmOperatorType *ot)
ot->invoke= wm_recover_auto_save_invoke;
ot->poll= WM_operator_winactive;
WM_operator_properties_filesel(ot, BLENDERFILE, FILE_BLENDER, FILE_OPENFILE, WM_FILESEL_FILEPATH);
WM_operator_properties_filesel(ot, BLENDERFILE, FILE_BLENDER, FILE_OPENFILE, WM_FILESEL_FILEPATH, FILE_LONGDISPLAY);
}
/* *************** save file as **************** */
@ -2035,7 +2045,7 @@ static void WM_OT_save_as_mainfile(wmOperatorType *ot)
ot->check= blend_save_check;
/* ommit window poll so this can work in background mode */
WM_operator_properties_filesel(ot, FOLDERFILE|BLENDERFILE, FILE_BLENDER, FILE_SAVE, WM_FILESEL_FILEPATH);
WM_operator_properties_filesel(ot, FOLDERFILE|BLENDERFILE, FILE_BLENDER, FILE_SAVE, WM_FILESEL_FILEPATH, FILE_DEFAULTDISPLAY);
RNA_def_boolean(ot->srna, "compress", 0, "Compress", "Write compressed .blend file");
RNA_def_boolean(ot->srna, "relative_remap", 1, "Remap Relative", "Remap relative paths when saving in a different directory");
RNA_def_boolean(ot->srna, "copy", 0, "Save Copy", "Save a copy of the actual working state but does not make saved file active");
@ -2102,7 +2112,7 @@ static void WM_OT_save_mainfile(wmOperatorType *ot)
ot->check= blend_save_check;
/* ommit window poll so this can work in background mode */
WM_operator_properties_filesel(ot, FOLDERFILE|BLENDERFILE, FILE_BLENDER, FILE_SAVE, WM_FILESEL_FILEPATH);
WM_operator_properties_filesel(ot, FOLDERFILE|BLENDERFILE, FILE_BLENDER, FILE_SAVE, WM_FILESEL_FILEPATH, FILE_DEFAULTDISPLAY);
RNA_def_boolean(ot->srna, "compress", 0, "Compress", "Write compressed .blend file");
RNA_def_boolean(ot->srna, "relative_remap", 0, "Remap Relative", "Remap relative paths when saving in a different directory");
}