Commit: 64fc94e93f13c38fdf25d9ac3a13e08811d055d9
Author: Campbell Barton
Date:   Mon Jan 6 13:52:27 2014 +1100
https://developer.blender.org/rB64fc94e93f13c38fdf25d9ac3a13e08811d055d9

Code Cleanup: osl style

===================================================================

M       GNUmakefile
M       intern/cycles/kernel/shaders/node_texture_coordinate.osl
M       release/scripts/templates_osl/gabor_noise.osl
M       release/scripts/templates_osl/lyapunov_texture.osl

===================================================================

diff --git a/GNUmakefile b/GNUmakefile
index e6998cf..95c628f 100644
--- a/GNUmakefile
+++ b/GNUmakefile
@@ -243,13 +243,13 @@ test_style_c_qtc:
 
 test_style_osl:
        # run our own checks on C/C++ style
-       PYTHONIOENCODING=utf_8 python3 
"$(BLENDER_DIR)/source/tools/check_source/check_style_c.py" 
"$(BLENDER_DIR)/intern/cycles/kernel/shaders"
+       PYTHONIOENCODING=utf_8 python3 
"$(BLENDER_DIR)/source/tools/check_source/check_style_c.py" 
"$(BLENDER_DIR)/intern/cycles/kernel/shaders" 
"$(BLENDER_DIR)/release/scripts/templates_osl"
 
 
 test_style_osl_qtc:
        # run our own checks on C/C++ style
        USE_QTC_TASK=1 \
-       PYTHONIOENCODING=utf_8 python3 
"$(BLENDER_DIR)/source/tools/check_source/check_style_c.py" 
"$(BLENDER_DIR)/intern/cycles/kernel/shaders" > \
+       PYTHONIOENCODING=utf_8 python3 
"$(BLENDER_DIR)/source/tools/check_source/check_style_c.py" 
"$(BLENDER_DIR)/intern/cycles/kernel/shaders" 
"$(BLENDER_DIR)/release/scripts/templates_osl" > \
        test_style.tasks
        @echo "written: test_style.tasks"
 
diff --git a/intern/cycles/kernel/shaders/node_texture_coordinate.osl 
b/intern/cycles/kernel/shaders/node_texture_coordinate.osl
index fdd0a51..8fdf469 100644
--- a/intern/cycles/kernel/shaders/node_texture_coordinate.osl
+++ b/intern/cycles/kernel/shaders/node_texture_coordinate.osl
@@ -46,11 +46,11 @@ shader node_texture_coordinate(
                        getattribute("geom:dupli_generated", Generated); 
                        getattribute("geom:dupli_uv", UV);
                }
-               else if(is_volume) {
+               else if (is_volume) {
                        Generated = transform("object", P);
 
                        matrix tfm;
-                       if(getattribute("geom:generated_transform", tfm))
+                       if (getattribute("geom:generated_transform", tfm))
                                Generated = transform(tfm, Generated);
 
                        getattribute("geom:uv", UV);
diff --git a/release/scripts/templates_osl/gabor_noise.osl 
b/release/scripts/templates_osl/gabor_noise.osl
index 1f59106..9c8615a 100644
--- a/release/scripts/templates_osl/gabor_noise.osl
+++ b/release/scripts/templates_osl/gabor_noise.osl
@@ -6,12 +6,12 @@ shader gabor_noise(
        float Bandwidth = 1.0,
        float Impulses = 16,
        output float Gabor = 0.8)
-{   
+{
        Gabor = noise("gabor", Point,
-                       "direction", Direction,
-                       "anisotropic", Anisotropic,
-                       "do_filter", 1, // Set to 0 to disable 
filtering/anti-aliasing 
-                       "bandwidth", Bandwidth,
-                       "impulses", Impulses);
+                     "direction", Direction,
+                     "anisotropic", Anisotropic,
+                     "do_filter", 1, // Set to 0 to disable 
filtering/anti-aliasing 
+                     "bandwidth", Bandwidth,
+                     "impulses", Impulses);
 }
 
diff --git a/release/scripts/templates_osl/lyapunov_texture.osl 
b/release/scripts/templates_osl/lyapunov_texture.osl
index d8817b4..b658c07 100644
--- a/release/scripts/templates_osl/lyapunov_texture.osl
+++ b/release/scripts/templates_osl/lyapunov_texture.osl
@@ -23,7 +23,7 @@
  * More information: https://developer.blender.org/T32305
  */
  
- /* Fac_Type
+/* Fac_Type
  * 0, SPREAD,  Spread indices for fac output
  * 1, ABS,             Absolute values from indices
  * 2, COLOR,   Get fac output from used colors
@@ -54,56 +54,56 @@ float lyapunov(point p, float iteration_pre, float 
iteration_main, float p1, flo
        int iter = 0;
 
        /* Pre-iteration */
-       for(int i = 0; i < iter_pre; i++) {
-               x = p1*sin(x+a) * sin(x+a)+p2;
-               x = p1*sin(x+b) * sin(x+b)+p2;
-               x = p1*sin(x+c) * sin(x+c)+p2;
+       for (int i = 0; i < iter_pre; i++) {
+               x = p1 * sin(x + a) * sin(x + a) + p2;
+               x = p1 * sin(x + b) * sin(x + b) + p2;
+               x = p1 * sin(x + c) * sin(x + c) + p2;
        }
 
        if (nabla_pre != 0.0) {
                float x_pre = x;
 
-               x = p1*sin(x+a)*sin(x+a)+p2;
-               x = p1*sin(x+b)*sin(x+b)+p2;
-               x = p1*sin(x+c)*sin(x+c)+p2;
-               x = x*nabla_pre + x_pre*(1.0-nabla_pre);
+               x = p1 * sin(x + a) * sin(x + a) + p2;
+               x = p1 * sin(x + b) * sin(x + b) + p2;
+               x = p1 * sin(x + c) * sin(x + c) + p2;
+               x = x * nabla_pre + x_pre * (1.0 - nabla_pre);
        }
 
        /* Main-iteration */
-       for(int i = 0; i < iter_main; i++) {
-               x = p1*sin(x+a)*sin(x+a)+p2;
-               derivation = 2.0*p1*sin(x+a)*cos(x+a);
+       for (int i = 0; i < iter_main; i++) {
+               x = p1 * sin(x + a) * sin(x + a) + p2;
+               derivation = 2.0 *p1 *sin(x + a) * cos(x + a);
                if (derivation != 0.0) { index += log(fabs(derivation)); 
iter++; }
 
-               x = p1*sin(x+b)*sin(x+b)+p2;
-               derivation = 2.0*p1*sin(x+b)*cos(x+b);
+               x = p1 * sin(x + b) * sin(x + b) + p2;
+               derivation = 2.0 *p1 *sin(x + b) * cos(x + b);
                if (derivation != 0.0) { index += log(fabs(derivation)); 
iter++; }
 
-               x = p1*sin(x+c)*sin(x+c)+p2;
-               derivation = 2.0*p1*sin(x+c)*cos(x+c);
+               x = p1 * sin(x + c) * sin(x + c) + p2;
+               derivation = 2.0 *p1 *sin(x + c) * cos(x + c);
                if (derivation != 0.0) { index += log(fabs(derivation)); 
iter++; }
        }
 
        if (nabla_main == 0.0) {
-               index = (iter != 0) ? index/(float)(iter) : 0.0;
+               index = (iter != 0) ? index / (float)(iter) : 0.0;
        }
        else {
-               float index_pre = (iter != 0) ? index/(float)(iter) : 0.0;
+               float index_pre = (iter != 0) ? index / (float)(iter) : 0.0;
 
-               x = p1*sin(x+a)*sin(x+a)+p2;
-               derivation = 2.0*p1*sin(x+a)*cos(x+a);
+               x = p1 * sin(x + a) * sin(x + a) + p2;
+               derivation = 2.0 *p1 *sin(x + a) * cos(x + a);
                if (derivation != 0.0) { index += log(fabs(derivation)); 
iter++; }
 
-               x = p1*sin(x+b)*sin(x+b)+p2;
-               derivation = 2.0*p1*sin(x+b)*cos(x+b);
+               x = p1 * sin(x + b) * sin(x + b) + p2;
+               derivation = 2.0 *p1 *sin(x + b) * cos(x + b);
                if (derivation != 0.0) { index += log(fabs(derivation)); 
iter++; }
 
-               x = p1*sin(x+c)*sin(x+c)+p2;
-               derivation = 2.0*p1*sin(x+c)*cos(x+c);
+               x = p1 * sin(x + c) * sin(x + c) + p2;
+               derivation = 2.0 *p1 *sin(x + c) * cos(x + c);
                if (derivation != 0.0) { index += log(fabs(derivation)); 
iter++; }
 
-               index = (iter != 0) ? index/(float)(iter) : 0.0;
-               index = index*nabla_main + index_pre*(1.0-nabla_main);
+               index = (iter != 0) ? index / (float)(iter) : 0.0;
+               index = index * nabla_main + index_pre * (1.0 - nabla_main);
        }
 
        return index;
@@ -127,12 +127,12 @@ shader node_lyapunov(
        output color Color = 0.0)
 {
        /* Calculate Texture */
-       float index = lyapunov(Pos*Scale, Pre_Iteration, Main_Iteration, 
Param1, Param2);
+       float index = lyapunov(Pos * Scale, Pre_Iteration, Main_Iteration, 
Param1, Param2);
 
        /* Calculate Color */
-       if(index > 0.0 && (Render_Type != 0)) {
+       if (index > 0.0 && (Render_Type != 0)) {
                index *= Pos_Scale;
-               if(index > 1.0) { index = 1.0; }
+               if (index > 1.0) { index = 1.0; }
                Color = (Pos_Color - Mid_Color) * index + Mid_Color;
        }
        else if (index < 0.0 && (Render_Type != 1)) {
@@ -152,7 +152,7 @@ shader node_lyapunov(
                index = fabs(index);
        }
        else if (Fac_Type == 2) {
-               index = (Color[0]+Color[1]+Color[2]) * (1.0/3.0);
+               index = (Color[0] + Color[1] + Color[2]) * (1.0 / 3.0);
        }
 
        Fac = index;

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to