From 9c58865d201372ddd615f1f9b36d37cbc6937b98 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 23 Oct 2012 11:47:23 +0000 Subject: [PATCH] code cleanup: remove $Id's that crept back in, also osl style edits --- .../osl/nodes/node_convert_from_normal.osl | 2 +- .../osl/nodes/node_convert_from_point.osl | 2 +- .../osl/nodes/node_convert_from_vector.osl | 2 +- .../kernel/osl/nodes/node_image_texture.osl | 46 +++++++++---------- .../kernel/osl/nodes/node_light_falloff.osl | 4 +- source/blender/bmesh/CMakeLists.txt | 1 - source/blender/compositor/CMakeLists.txt | 1 - .../blender/modifiers/intern/MOD_decimate.c | 2 + .../composite/nodes/node_composite_boxmask.c | 2 - .../nodes/node_composite_ellipsemask.c | 2 - source/blender/opencl/CMakeLists.txt | 1 - source/gameengine/Ketsji/KX_PythonMain.cpp | 12 ++--- source/gameengine/Ketsji/KX_PythonMain.h | 11 ++--- 13 files changed, 38 insertions(+), 50 deletions(-) diff --git a/intern/cycles/kernel/osl/nodes/node_convert_from_normal.osl b/intern/cycles/kernel/osl/nodes/node_convert_from_normal.osl index 419e93e1518..32ef430d93b 100644 --- a/intern/cycles/kernel/osl/nodes/node_convert_from_normal.osl +++ b/intern/cycles/kernel/osl/nodes/node_convert_from_normal.osl @@ -27,7 +27,7 @@ shader node_convert_from_normal( output point Point = point(0.0, 0.0, 0.0)) { Val = (Normal[0] + Normal[1] + Normal[2]) * (1.0 / 3.0); - ValInt = (int)((Normal[0] + Normal[1] + Normal[2])*(1.0/3.0)); + ValInt = (int)((Normal[0] + Normal[1] + Normal[2]) * (1.0 / 3.0)); Vector = vector(Normal[0], Normal[1], Normal[2]); Color = color(Normal[0], Normal[1], Normal[2]); Point = point(Normal[0], Normal[1], Normal[2]); diff --git a/intern/cycles/kernel/osl/nodes/node_convert_from_point.osl b/intern/cycles/kernel/osl/nodes/node_convert_from_point.osl index cedd200f088..a9435c8abf4 100644 --- a/intern/cycles/kernel/osl/nodes/node_convert_from_point.osl +++ b/intern/cycles/kernel/osl/nodes/node_convert_from_point.osl @@ -27,7 +27,7 @@ shader node_convert_from_point( output normal Normal = normal(0.0, 0.0, 0.0)) { Val = (Point[0] + Point[1] + Point[2]) * (1.0 / 3.0); - ValInt = (int)((Normal[0] + Normal[1] + Normal[2])*(1.0/3.0)); + ValInt = (int)((Normal[0] + Normal[1] + Normal[2]) * (1.0 / 3.0)); Vector = vector(Point[0], Point[1], Point[2]); Color = color(Point[0], Point[1], Point[2]); Normal = normal(Point[0], Point[1], Point[2]); diff --git a/intern/cycles/kernel/osl/nodes/node_convert_from_vector.osl b/intern/cycles/kernel/osl/nodes/node_convert_from_vector.osl index a9f43a40074..4516f92c753 100644 --- a/intern/cycles/kernel/osl/nodes/node_convert_from_vector.osl +++ b/intern/cycles/kernel/osl/nodes/node_convert_from_vector.osl @@ -27,7 +27,7 @@ shader node_convert_from_vector( output normal Normal = normal(0.0, 0.0, 0.0)) { Val = (Vector[0] + Vector[1] + Vector[2]) * (1.0 / 3.0); - ValInt = (int)((Normal[0] + Normal[1] + Normal[2])*(1.0/3.0)); + ValInt = (int)((Normal[0] + Normal[1] + Normal[2]) * (1.0 / 3.0)); Color = color(Vector[0], Vector[1], Vector[2]); Point = point(Vector[0], Vector[1], Vector[2]); Normal = normal(Vector[0], Vector[1], Vector[2]); diff --git a/intern/cycles/kernel/osl/nodes/node_image_texture.osl b/intern/cycles/kernel/osl/nodes/node_image_texture.osl index 2ca7e682a35..6393605e6b5 100644 --- a/intern/cycles/kernel/osl/nodes/node_image_texture.osl +++ b/intern/cycles/kernel/osl/nodes/node_image_texture.osl @@ -23,7 +23,7 @@ color image_texture_lookup(string filename, string color_space, float u, float v { color rgb = (color)texture(filename, u, 1.0 - v, "wrap", "periodic", "alpha", Alpha); - if(color_space == "sRGB") + if (color_space == "sRGB") rgb = color_srgb_to_scene_linear(rgb); return rgb; @@ -38,10 +38,10 @@ shader node_image_texture( output color Color = color(0.0, 0.0, 0.0), output float Alpha = 1.0) { - if(projection == "Flat") { + if (projection == "Flat") { Color = image_texture_lookup(filename, color_space, Vector[0], Vector[1], Alpha); } - else if(projection == "Box") { + else if (projection == "Box") { /* object space normal */ vector Nob = transform("world", "object", N); @@ -57,44 +57,44 @@ shader node_image_texture( * the Nxyz values are the barycentric coordinates in an equilateral * triangle, which in case of blending, in the middle has a smaller * equilateral triangle where 3 textures blend. this divides things into - * 7 zones, with an if() test for each zone */ + * 7 zones, with an if () test for each zone */ vector weight = vector(0.0, 0.0, 0.0); float blend = projection_blend; float limit = 0.5*(1.0 + blend); /* first test for corners with single texture */ - if(Nob[0] > limit*(Nob[0] + Nob[1]) && Nob[0] > limit*(Nob[0] + Nob[2])) { + if (Nob[0] > limit*(Nob[0] + Nob[1]) && Nob[0] > limit*(Nob[0] + Nob[2])) { weight[0] = 1.0; } - else if(Nob[1] > limit*(Nob[0] + Nob[1]) && Nob[1] > limit*(Nob[1] + Nob[2])) { + else if (Nob[1] > limit*(Nob[0] + Nob[1]) && Nob[1] > limit*(Nob[1] + Nob[2])) { weight[1] = 1.0; } - else if(Nob[2] > limit*(Nob[0] + Nob[2]) && Nob[2] > limit*(Nob[1] + Nob[2])) { + else if (Nob[2] > limit*(Nob[0] + Nob[2]) && Nob[2] > limit*(Nob[1] + Nob[2])) { weight[2] = 1.0; } - else if(blend > 0.0) { + else if (blend > 0.0) { /* in case of blending, test for mixes between two textures */ - if(Nob[2] < (1.0 - limit)*(Nob[1] + Nob[0])) { - weight[0] = Nob[0]/(Nob[0] + Nob[1]); - weight[0] = clamp((weight[0] - 0.5*(1.0 - blend))/blend, 0.0, 1.0); + if (Nob[2] < (1.0 - limit)*(Nob[1] + Nob[0])) { + weight[0] = Nob[0] / (Nob[0] + Nob[1]); + weight[0] = clamp((weight[0] - 0.5 * (1.0 - blend)) / blend, 0.0, 1.0); weight[1] = 1.0 - weight[0]; } - else if(Nob[0] < (1.0 - limit)*(Nob[1] + Nob[2])) { - weight[1] = Nob[1]/(Nob[1] + Nob[2]); - weight[1] = clamp((weight[1] - 0.5*(1.0 - blend))/blend, 0.0, 1.0); + else if (Nob[0] < (1.0 - limit)*(Nob[1] + Nob[2])) { + weight[1] = Nob[1] / (Nob[1] + Nob[2]); + weight[1] = clamp((weight[1] - 0.5 * (1.0 - blend)) / blend, 0.0, 1.0); weight[2] = 1.0 - weight[1]; } - else if(Nob[1] < (1.0 - limit)*(Nob[0] + Nob[2])) { - weight[0] = Nob[0]/(Nob[0] + Nob[2]); - weight[0] = clamp((weight[0] - 0.5*(1.0 - blend))/blend, 0.0, 1.0); + else if (Nob[1] < (1.0 - limit) * (Nob[0] + Nob[2])) { + weight[0] = Nob[0] / (Nob[0] + Nob[2]); + weight[0] = clamp((weight[0] - 0.5 * (1.0 - blend)) / blend, 0.0, 1.0); weight[2] = 1.0 - weight[0]; } else { /* last case, we have a mix between three */ - weight[0] = ((2.0 - limit)*Nob[0] + (limit - 1.0))/(2.0*limit - 1.0); - weight[1] = ((2.0 - limit)*Nob[1] + (limit - 1.0))/(2.0*limit - 1.0); - weight[2] = ((2.0 - limit)*Nob[2] + (limit - 1.0))/(2.0*limit - 1.0); + weight[0] = ((2.0 - limit) * Nob[0] + (limit - 1.0)) / (2.0 * limit - 1.0); + weight[1] = ((2.0 - limit) * Nob[1] + (limit - 1.0)) / (2.0 * limit - 1.0); + weight[2] = ((2.0 - limit) * Nob[2] + (limit - 1.0)) / (2.0 * limit - 1.0); } } @@ -103,15 +103,15 @@ shader node_image_texture( float tmp_alpha; - if(weight[0] > 0.0) { + if (weight[0] > 0.0) { Color += weight[0]*image_texture_lookup(filename, color_space, Vector[1], Vector[2], tmp_alpha); Alpha += weight[0]*tmp_alpha; } - if(weight[1] > 0.0) { + if (weight[1] > 0.0) { Color += weight[1]*image_texture_lookup(filename, color_space, Vector[0], Vector[2], tmp_alpha); Alpha += weight[1]*tmp_alpha; } - if(weight[2] > 0.0) { + if (weight[2] > 0.0) { Color += weight[2]*image_texture_lookup(filename, color_space, Vector[1], Vector[0], tmp_alpha); Alpha += weight[2]*tmp_alpha; } diff --git a/intern/cycles/kernel/osl/nodes/node_light_falloff.osl b/intern/cycles/kernel/osl/nodes/node_light_falloff.osl index fd68594a1d8..3877b6d5bdc 100644 --- a/intern/cycles/kernel/osl/nodes/node_light_falloff.osl +++ b/intern/cycles/kernel/osl/nodes/node_light_falloff.osl @@ -29,9 +29,9 @@ shader node_light_falloff( float strength = Strength; getattribute("std::ray_length", ray_length); - if(Smooth > 0.0) { + if (Smooth > 0.0) { float squared = ray_length*ray_length; - strength *= squared/(Smooth + squared); + strength *= squared / (Smooth + squared); } /* Quadratic */ diff --git a/source/blender/bmesh/CMakeLists.txt b/source/blender/bmesh/CMakeLists.txt index 8b0e616515f..3c329b1dce4 100644 --- a/source/blender/bmesh/CMakeLists.txt +++ b/source/blender/bmesh/CMakeLists.txt @@ -1,4 +1,3 @@ -# $Id: CMakeLists.txt 31746 2010-09-04 05:31:25Z joeedh $ # ***** BEGIN GPL LICENSE BLOCK ***** # # This program is free software; you can redistribute it and/or diff --git a/source/blender/compositor/CMakeLists.txt b/source/blender/compositor/CMakeLists.txt index 9932ed17378..fcd710b9b13 100644 --- a/source/blender/compositor/CMakeLists.txt +++ b/source/blender/compositor/CMakeLists.txt @@ -1,4 +1,3 @@ -# $Id: CMakeLists.txt 14444 2008-04-16 22:40:48Z hos $ # ***** BEGIN GPL LICENSE BLOCK ***** # # This program is free software; you can redistribute it and/or diff --git a/source/blender/modifiers/intern/MOD_decimate.c b/source/blender/modifiers/intern/MOD_decimate.c index cf409c27b2f..75bea939107 100644 --- a/source/blender/modifiers/intern/MOD_decimate.c +++ b/source/blender/modifiers/intern/MOD_decimate.c @@ -195,6 +195,8 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, TIMEIT_END(decim); #endif + CDDM_calc_normals(result); + return result; } diff --git a/source/blender/nodes/composite/nodes/node_composite_boxmask.c b/source/blender/nodes/composite/nodes/node_composite_boxmask.c index 0f82fdb481a..d3c6b2ccef0 100644 --- a/source/blender/nodes/composite/nodes/node_composite_boxmask.c +++ b/source/blender/nodes/composite/nodes/node_composite_boxmask.c @@ -1,6 +1,4 @@ /* - * $Id: CMP_math.c 36271 2011-04-21 13:11:51Z campbellbarton $ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/nodes/composite/nodes/node_composite_ellipsemask.c b/source/blender/nodes/composite/nodes/node_composite_ellipsemask.c index 5e7bd26d34a..761b0b13f11 100644 --- a/source/blender/nodes/composite/nodes/node_composite_ellipsemask.c +++ b/source/blender/nodes/composite/nodes/node_composite_ellipsemask.c @@ -1,6 +1,4 @@ /* - * $Id: CMP_math.c 36271 2011-04-21 13:11:51Z campbellbarton $ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/opencl/CMakeLists.txt b/source/blender/opencl/CMakeLists.txt index 20dcf33d363..b3c76db1bca 100644 --- a/source/blender/opencl/CMakeLists.txt +++ b/source/blender/opencl/CMakeLists.txt @@ -1,4 +1,3 @@ -# $Id: CMakeLists.txt 14444 2008-04-16 22:40:48Z hos $ # ***** BEGIN GPL LICENSE BLOCK ***** # # This program is free software; you can redistribute it and/or diff --git a/source/gameengine/Ketsji/KX_PythonMain.cpp b/source/gameengine/Ketsji/KX_PythonMain.cpp index d926dff0bf5..740bb102fd9 100644 --- a/source/gameengine/Ketsji/KX_PythonMain.cpp +++ b/source/gameengine/Ketsji/KX_PythonMain.cpp @@ -1,6 +1,4 @@ -/* - * $Id: KX_PythonMain.cpp 37750 2011-06-27 09:27:56Z sjoerd $ - * +/* * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or @@ -17,15 +15,11 @@ * 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) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. + * Contributor(s): Benoit Bolsee * * ***** END GPL LICENSE BLOCK ***** */ + /** \file gameengine/Ketsji/KX_PythonMain.cpp * \ingroup ketsji */ diff --git a/source/gameengine/Ketsji/KX_PythonMain.h b/source/gameengine/Ketsji/KX_PythonMain.h index 1460ea2ca96..e638fa9094e 100644 --- a/source/gameengine/Ketsji/KX_PythonMain.h +++ b/source/gameengine/Ketsji/KX_PythonMain.h @@ -1,6 +1,4 @@ -/* - * $Id: KX_PythonMain.h 37750 2011-06-27 09:27:56Z sjoerd $ - * +/* * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or @@ -31,11 +29,12 @@ * \ingroup ketsji */ -#ifndef __KX_PYTHON_MAIN -#define __KX_PYTHON_MAIN +#ifndef __KX_PYTHON_MAIN__ +#define __KX_PYTHON_MAIN__ #include "BKE_main.h" #include "DNA_scene_types.h" extern "C" char *KX_GetPythonMain(struct Scene* scene); extern "C" char *KX_GetPythonCode(struct Main *main, char *python_main); -#endif + +#endif /* __KX_PYTHON_MAIN__ */