style cleanup: osl and NULL pointer use, also correct sequencer gap operator id's

This commit is contained in:
Campbell Barton
2013-03-27 20:27:07 +00:00
parent 535253cad0
commit d15d78a33a
8 changed files with 17 additions and 16 deletions

View File

@@ -25,10 +25,10 @@ shader node_brightness(
output color ColorOut = 0.8) output color ColorOut = 0.8)
{ {
float a = 1.0 + Contrast; float a = 1.0 + Contrast;
float b = Bright - Contrast*0.5; float b = Bright - Contrast * 0.5;
ColorOut[0] = max(a*ColorIn[0] + b, 0.0); ColorOut[0] = max(a * ColorIn[0] + b, 0.0);
ColorOut[1] = max(a*ColorIn[1] + b, 0.0); ColorOut[1] = max(a * ColorIn[1] + b, 0.0);
ColorOut[2] = max(a*ColorIn[2] + b, 0.0); ColorOut[2] = max(a * ColorIn[2] + b, 0.0);
} }

View File

@@ -35,9 +35,10 @@ shader node_normal_map(
float tangent_sign; float tangent_sign;
// get _unnormalized_ interpolated normal and tangent // get _unnormalized_ interpolated normal and tangent
if(!getattribute(attr_name, tangent) || if (!getattribute(attr_name, tangent) ||
!getattribute(attr_sign_name, tangent_sign) || !getattribute(attr_sign_name, tangent_sign) ||
!getattribute("geom:N", ninterp)) { !getattribute("geom:N", ninterp))
{
Normal = normal(0, 0, 0); Normal = normal(0, 0, 0);
} }
else { else {

View File

@@ -21,7 +21,7 @@
float ramp_lookup(color ramp[RAMP_TABLE_SIZE], float at, int component) float ramp_lookup(color ramp[RAMP_TABLE_SIZE], float at, int component)
{ {
float f = clamp((at + 1.0)*0.5, 0.0, 1.0) * (RAMP_TABLE_SIZE - 1); float f = clamp((at + 1.0) * 0.5, 0.0, 1.0) * (RAMP_TABLE_SIZE - 1);
/* clamp int as well in case of NaN */ /* clamp int as well in case of NaN */
int i = (int)f; int i = (int)f;
@@ -34,7 +34,7 @@ float ramp_lookup(color ramp[RAMP_TABLE_SIZE], float at, int component)
if (t > 0.0) if (t > 0.0)
result = (1.0 - t) * result + t * ramp[i + 1][component]; result = (1.0 - t) * result + t * ramp[i + 1][component];
return result*2.0 - 1.0; return result * 2.0 - 1.0;
} }
shader node_vector_curves( shader node_vector_curves(

View File

@@ -31,7 +31,7 @@ shader node_ward_bsdf(
vector T = Tangent; vector T = Tangent;
if (Rotation != 0.0) if (Rotation != 0.0)
T = rotate(T, Rotation*2.0*M_PI, point(0.0, 0.0, 0.0), Normal); T = rotate(T, Rotation * 2.0 * M_PI, point(0.0, 0.0, 0.0), Normal);
/* compute roughness */ /* compute roughness */
float RoughnessU, RoughnessV; float RoughnessU, RoughnessV;

View File

@@ -284,8 +284,8 @@ class SEQUENCER_MT_strip(Menu):
layout.operator("transform.transform", text="Grab/Move").mode = 'TRANSLATION' layout.operator("transform.transform", text="Grab/Move").mode = 'TRANSLATION'
layout.operator("transform.transform", text="Grab/Extend from frame").mode = 'TIME_EXTEND' layout.operator("transform.transform", text="Grab/Extend from frame").mode = 'TIME_EXTEND'
layout.operator("sequencer.no_gap") layout.operator("sequencer.gap_remove")
layout.operator("sequencer.insert_gap") layout.operator("sequencer.gap_insert")
# uiItemO(layout, NULL, 0, "sequencer.strip_snap"); // TODO - add this operator # uiItemO(layout, NULL, 0, "sequencer.strip_snap"); // TODO - add this operator
layout.separator() layout.separator()

View File

@@ -402,7 +402,7 @@ static GPUTexture *GPU_texture_create_nD(int w, int h, int n, float *fpixels, in
} }
else { else {
glTexImage2D(tex->target, 0, internalformat, tex->w, tex->h, 0, glTexImage2D(tex->target, 0, internalformat, tex->w, tex->h, 0,
format, type, NULL); format, type, NULL);
if (fpixels) { if (fpixels) {
glTexSubImage2D(tex->target, 0, 0, 0, w, h, glTexSubImage2D(tex->target, 0, 0, 0, w, h,
@@ -677,7 +677,7 @@ GPUTexture *GPU_texture_create_vsm_shadow_map(int size, char err_out[256])
/* Now we tweak some of the settings */ /* Now we tweak some of the settings */
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RG32F, size, size, 0, GL_RG, GL_FLOAT, 0); glTexImage2D(GL_TEXTURE_2D, 0, GL_RG32F, size, size, 0, GL_RG, GL_FLOAT, NULL);
GPU_texture_unbind(tex); GPU_texture_unbind(tex);
} }

View File

@@ -175,7 +175,7 @@ static void cmp_node_image_create_outputs(bNodeTree *ntree, bNode *node)
Image *ima= (Image *)node->id; Image *ima= (Image *)node->id;
if (ima) { if (ima) {
ImageUser *iuser = node->storage; ImageUser *iuser = node->storage;
ImageUser load_iuser = {0}; ImageUser load_iuser = {NULL};
ImBuf *ibuf; ImBuf *ibuf;
int offset = BKE_image_sequence_guess_offset(ima); int offset = BKE_image_sequence_guess_offset(ima);

View File

@@ -199,7 +199,7 @@ void KX_Dome::CreateGLImages(void)
for (int j=0;j<m_numfaces;j++) { for (int j=0;j<m_numfaces;j++) {
glBindTexture(GL_TEXTURE_2D, domefacesId[j]); glBindTexture(GL_TEXTURE_2D, domefacesId[j]);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB8, m_imagesize, m_imagesize, 0, GL_RGB8, glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB8, m_imagesize, m_imagesize, 0, GL_RGB8,
GL_UNSIGNED_BYTE, 0); GL_UNSIGNED_BYTE, NULL);
glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, 0, 0, m_imagesize, m_imagesize, 0); glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, 0, 0, m_imagesize, m_imagesize, 0);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
@@ -209,7 +209,7 @@ void KX_Dome::CreateGLImages(void)
if (warp.usemesh) { if (warp.usemesh) {
glBindTexture(GL_TEXTURE_2D, domefacesId[m_numfaces]); glBindTexture(GL_TEXTURE_2D, domefacesId[m_numfaces]);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB8, warp.imagesize, warp.imagesize, 0, GL_RGB8, glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB8, warp.imagesize, warp.imagesize, 0, GL_RGB8,
GL_UNSIGNED_BYTE, 0); GL_UNSIGNED_BYTE, NULL);
glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, 0, 0, warp.imagesize, warp.imagesize, 0); glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, 0, 0, warp.imagesize, warp.imagesize, 0);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);