Merging r42178 through r42192 form trunk into soc-2011-tomato
authorSergey Sharybin <sergey.vfx@gmail.com>
Sun, 27 Nov 2011 19:35:46 +0000 (19:35 +0000)
committerSergey Sharybin <sergey.vfx@gmail.com>
Sun, 27 Nov 2011 19:35:46 +0000 (19:35 +0000)
15 files changed:
build_files/buildbot/config/user-config-i686.py
build_files/buildbot/config/user-config-player-i686.py
build_files/buildbot/config/user-config-player-x86_64.py
build_files/buildbot/config/user-config-x86_64.py
intern/cycles/blender/addon/__init__.py
intern/cycles/blender/addon/engine.py
intern/cycles/blender/addon/enums.py
intern/cycles/blender/addon/properties.py
intern/cycles/blender/addon/ui.py
source/blender/blenkernel/intern/material.c
source/blender/blenlib/BLI_mempool.h
source/blender/blenlib/intern/BLI_mempool.c
source/blender/editors/interface/interface_panel.c
source/blender/editors/screen/area.c
source/blender/makesrna/intern/rna_rna.c

index 99af7f3fa046ea7b9c7c55d8af10b1867ba25912..34817ed0ae9ba40b5266bd225a32c67f5e4d6cb6 100644 (file)
@@ -58,6 +58,8 @@ WITH_BF_PNG = True
 BF_PNG_LIB = 'libpng'
 BF_PNG_LIBPATH = '/home/sources/staticlibs/lib32'
 
+WITH_BF_STATICLIBSAMPLERATE = True
+
 WITH_BF_ZLIB = True
 WITH_BF_STATICZLIB = True
 BF_ZLIB_LIB_STATIC = '${BF_ZLIB}/lib/libz.a'
@@ -114,5 +116,5 @@ WITH_BF_OCEANSIM = True
 
 # Compilation and optimization
 BF_DEBUG = False
-REL_CCFLAGS = ['-O2', '-msse', '-msse2']  # C & C++
+REL_CCFLAGS = ['-O2']  # C & C++
 PLATFORM_LINKFLAGS = ['-L/home/sources/staticlibs/lib32']
index 3445ae59bda2db69aa944a1c1307d790d165e55f..6c5c5f89ad482403c91346f77ae39afa3c8cb38e 100644 (file)
@@ -52,6 +52,8 @@ WITH_BF_PNG = True
 BF_PNG_LIB = 'libpng'
 BF_PNG_LIBPATH = '/home/sources/staticlibs/lib32'
 
+WITH_BF_STATICLIBSAMPLERATE = True
+
 WITH_BF_ZLIB = True
 WITH_BF_STATICZLIB = True
 BF_ZLIB_LIB_STATIC = '${BF_ZLIB}/lib/libz.a'
@@ -93,5 +95,5 @@ WITH_BF_OCEANSIM = True
 
 # Compilation and optimization
 BF_DEBUG = False
-REL_CCFLAGS = ['-O2', '-msse', '-msse2']  # C & C++
+REL_CCFLAGS = ['-O2']  # C & C++
 PLATFORM_LINKFLAGS = ['-L/home/sources/staticlibs/lib32']
index 6ec56865c26b8caff29e4b5c044721e9e832d94d..ad3839a24344e959f56cd935b97ec89fe7b90e64 100644 (file)
@@ -48,6 +48,8 @@ WITH_BF_JPEG = True
 BF_JPEG_LIB = 'libjpeg'
 BF_JPEG_LIBPATH = '/home/sources/staticlibs/lib64'
 
+WITH_BF_STATICLIBSAMPLERATE = True
+
 WITH_BF_PNG = True
 BF_PNG_LIB = 'libpng'
 BF_PNG_LIBPATH = '/home/sources/staticlibs/lib64'
@@ -93,5 +95,5 @@ WITH_BF_OCEANSIM = True
 
 # Compilation and optimization
 BF_DEBUG = False
-REL_CCFLAGS = ['-O2', '-msse', '-msse2']  # C & C++
+REL_CCFLAGS = ['-O2']  # C & C++
 PLATFORM_LINKFLAGS = ['-L/home/sources/staticlibs/lib64']
index a607be286f941e97aca788b451a07cf4ea0eb4ab..e090ddfbfd669ab74eb28557307db818e5800355 100644 (file)
@@ -58,6 +58,8 @@ WITH_BF_PNG = True
 BF_PNG_LIB = 'libpng'
 BF_PNG_LIBPATH = '/home/sources/staticlibs/lib64'
 
+WITH_BF_STATICLIBSAMPLERATE = True
+
 WITH_BF_ZLIB = True
 WITH_BF_STATICZLIB = True
 BF_ZLIB_LIB_STATIC = '${BF_ZLIB}/lib/libz.a'
@@ -114,5 +116,5 @@ WITH_BF_OCEANSIM = True
 
 # Compilation and optimization
 BF_DEBUG = False
-REL_CCFLAGS = ['-O2', '-msse', '-msse2']  # C & C++
+REL_CCFLAGS = ['-O2']  # C & C++
 PLATFORM_LINKFLAGS = ['-L/home/sources/staticlibs/lib64']
index a7a8a74bf38b3cba0e70e31d0e91720ec619d563..34ed3dd8072d3087a2c9e20468c1a671ff13b667 100644 (file)
@@ -33,12 +33,7 @@ bl_info = {
     "category": "Render"}
 
 import bpy
-
-from cycles import ui
-from cycles import properties
-from cycles import xml
-from cycles import engine
-from cycles import presets
+from . import ui, properties, xml, engine, presets
 
 
 class CyclesRender(bpy.types.RenderEngine):
index a32a9e91499152a3054af010a8b189a1c08af43f..2fedd2c0afa060675fa73e928d1dcd046e783016 100644 (file)
@@ -56,7 +56,7 @@ def free(engine):
 
 def render(engine):
     import bcycles
-    if "session" in dir(engine):
+    if hasattr(engine, "session"):
         bcycles.render(engine.session)
 
 
index 463fdc19534f558ded0a0d09b162e1e210977573..581dc08436a925d670de865cc207fc41315b2fe3 100644 (file)
@@ -18,7 +18,7 @@
 
 # <pep8 compliant>
 
-from cycles import engine
+from . import engine
 
 
 def get_gpu_device():
index 95f898f3ca5482b2c435279a1c4c0c4826e8633d..37de27dc6b4f7c9d1ff6d3182735bbb8e02b4cfc 100644 (file)
@@ -27,7 +27,7 @@ from bpy.props import (BoolProperty,
 
 import math
 
-from cycles import enums
+from . import enums
 
 
 class CyclesRenderSettings(bpy.types.PropertyGroup):
index 224e44c287aa2c0785006d0f14da413aa3435bae..ca733c6eeb080bd7d185a9d7208c21ea080a9f6c 100644 (file)
@@ -22,8 +22,7 @@ import bpy
 
 from bpy.types import Panel, Menu
 
-from cycles import enums
-from cycles import engine
+from . import enums, engine
 
 
 class CYCLES_MT_integrator_presets(Menu):
@@ -324,7 +323,7 @@ class CyclesObject_PT_ray_visibility(CyclesButtonsPanel, Panel):
     @classmethod
     def poll(cls, context):
         ob = context.object
-        return CyclesButtonsPanel.poll(context) and ob and ob.type in ('MESH', 'CURVE', 'CURVE', 'SURFACE', 'FONT', 'META')  # todo: 'LAMP'
+        return CyclesButtonsPanel.poll(context) and ob and ob.type in {'MESH', 'CURVE', 'CURVE', 'SURFACE', 'FONT', 'META'}  # todo: 'LAMP'
 
     def draw(self, context):
         layout = self.layout
@@ -399,7 +398,7 @@ class CyclesLamp_PT_lamp(CyclesButtonsPanel, Panel):
         split = layout.split()
         col = split.column(align=True)
 
-        if lamp.type in ('POINT', 'SUN', 'SPOT'):
+        if lamp.type in {'POINT', 'SUN', 'SPOT'}:
             col.prop(lamp, "shadow_soft_size", text="Size")
         elif lamp.type == 'AREA':
             col.prop(lamp, "shape", text="")
@@ -460,7 +459,8 @@ class CyclesWorld_PT_volume(CyclesButtonsPanel, Panel):
     @classmethod
     def poll(cls, context):
         # world = context.world
-        return False  # world and world.node_tree and CyclesButtonsPanel.poll(context)
+        # world and world.node_tree and CyclesButtonsPanel.poll(context)
+        return False
 
     def draw(self, context):
         layout = self.layout
@@ -494,7 +494,8 @@ class CyclesMaterial_PT_volume(CyclesButtonsPanel, Panel):
     @classmethod
     def poll(cls, context):
         # mat = context.material
-        return False  # mat and mat.node_tree and CyclesButtonsPanel.poll(context)
+        # mat and mat.node_tree and CyclesButtonsPanel.poll(context)
+        return False
 
     def draw(self, context):
         layout = self.layout
@@ -730,7 +731,7 @@ def draw_pause(self, context):
 
 
 def get_panels():
-    return [
+    return (
         bpy.types.RENDER_PT_render,
         bpy.types.RENDER_PT_output,
         bpy.types.RENDER_PT_encoding,
@@ -782,7 +783,8 @@ def get_panels():
         bpy.types.PARTICLE_PT_field_weights,
         bpy.types.PARTICLE_PT_force_fields,
         bpy.types.PARTICLE_PT_vertexgroups,
-        bpy.types.PARTICLE_PT_custom_props]
+        bpy.types.PARTICLE_PT_custom_props,
+        )
 
 
 def register():
index fa0e886b784d135071e74f437d0804932d360b8c..ecf74b1d8e1befa82d9db3c44b3c1b10ee30a963 100644 (file)
@@ -1178,8 +1178,7 @@ int object_remove_material_slot(Object *ob)
 }
 
 
-/* r g b = current value, col = new value, fac==0 is no change */
-/* if g==NULL, it only does r channel */
+/* r_col = current value, col = new value, fac==0 is no change */
 void ramp_blend(int type, float r_col[3], const float fac, const float col[3])
 {
        float tmp, facm= 1.0f-fac;
@@ -1187,165 +1186,137 @@ void ramp_blend(int type, float r_col[3], const float fac, const float col[3])
        switch (type) {
                case MA_RAMP_BLEND:
                        r_col[0] = facm*(r_col[0]) + fac*col[0];
-                       if(r_col[1]) {
-                               r_col[1] = facm*(r_col[1]) + fac*col[1];
-                               r_col[2] = facm*(r_col[2]) + fac*col[2];
-                       }
-                               break;
+                       r_col[1] = facm*(r_col[1]) + fac*col[1];
+                       r_col[2] = facm*(r_col[2]) + fac*col[2];
+                       break;
                case MA_RAMP_ADD:
                        r_col[0] += fac*col[0];
-                       if(r_col[1]) {
-                               r_col[1] += fac*col[1];
-                               r_col[2] += fac*col[2];
-                       }
-                               break;
+                       r_col[1] += fac*col[1];
+                       r_col[2] += fac*col[2];
+                       break;
                case MA_RAMP_MULT:
                        r_col[0] *= (facm + fac*col[0]);
-                       if(r_col[1]) {
-                               r_col[1] *= (facm + fac*col[1]);
-                               r_col[2] *= (facm + fac*col[2]);
-                       }
-                               break;
+                       r_col[1] *= (facm + fac*col[1]);
+                       r_col[2] *= (facm + fac*col[2]);
+                       break;
                case MA_RAMP_SCREEN:
                        r_col[0] = 1.0f - (facm + fac*(1.0f - col[0])) * (1.0f - r_col[0]);
-                       if(r_col[1]) {
-                               r_col[1] = 1.0f - (facm + fac*(1.0f - col[1])) * (1.0f - r_col[1]);
-                               r_col[2] = 1.0f - (facm + fac*(1.0f - col[2])) * (1.0f - r_col[2]);
-                       }
-                               break;
+                       r_col[1] = 1.0f - (facm + fac*(1.0f - col[1])) * (1.0f - r_col[1]);
+                       r_col[2] = 1.0f - (facm + fac*(1.0f - col[2])) * (1.0f - r_col[2]);
+                       break;
                case MA_RAMP_OVERLAY:
                        if(r_col[0] < 0.5f)
                                r_col[0] *= (facm + 2.0f*fac*col[0]);
                        else
                                r_col[0] = 1.0f - (facm + 2.0f*fac*(1.0f - col[0])) * (1.0f - r_col[0]);
-                       if(r_col[1]) {
-                               if(r_col[1] < 0.5f)
-                                       r_col[1] *= (facm + 2.0f*fac*col[1]);
-                               else
-                                       r_col[1] = 1.0f - (facm + 2.0f*fac*(1.0f - col[1])) * (1.0f - r_col[1]);
-                               if(r_col[2] < 0.5f)
-                                       r_col[2] *= (facm + 2.0f*fac*col[2]);
-                               else
-                                       r_col[2] = 1.0f - (facm + 2.0f*fac*(1.0f - col[2])) * (1.0f - r_col[2]);
-                       }
-                               break;
+                       if(r_col[1] < 0.5f)
+                               r_col[1] *= (facm + 2.0f*fac*col[1]);
+                       else
+                               r_col[1] = 1.0f - (facm + 2.0f*fac*(1.0f - col[1])) * (1.0f - r_col[1]);
+                       if(r_col[2] < 0.5f)
+                               r_col[2] *= (facm + 2.0f*fac*col[2]);
+                       else
+                               r_col[2] = 1.0f - (facm + 2.0f*fac*(1.0f - col[2])) * (1.0f - r_col[2]);
+                       break;
                case MA_RAMP_SUB:
                        r_col[0] -= fac*col[0];
-                       if(r_col[1]) {
-                               r_col[1] -= fac*col[1];
-                               r_col[2] -= fac*col[2];
-                       }
-                               break;
+                       r_col[1] -= fac*col[1];
+                       r_col[2] -= fac*col[2];
+                       break;
                case MA_RAMP_DIV:
                        if(col[0]!=0.0f)
                                r_col[0] = facm*(r_col[0]) + fac*(r_col[0])/col[0];
-                       if(r_col[1]) {
-                               if(col[1]!=0.0f)
-                                       r_col[1] = facm*(r_col[1]) + fac*(r_col[1])/col[1];
-                               if(col[2]!=0.0f)
-                                       r_col[2] = facm*(r_col[2]) + fac*(r_col[2])/col[2];
-                       }
-                               break;
+                       if(col[1]!=0.0f)
+                               r_col[1] = facm*(r_col[1]) + fac*(r_col[1])/col[1];
+                       if(col[2]!=0.0f)
+                               r_col[2] = facm*(r_col[2]) + fac*(r_col[2])/col[2];
+                       break;
                case MA_RAMP_DIFF:
                        r_col[0] = facm*(r_col[0]) + fac*fabsf(r_col[0]-col[0]);
-                       if(r_col[1]) {
-                               r_col[1] = facm*(r_col[1]) + fac*fabsf(r_col[1]-col[1]);
-                               r_col[2] = facm*(r_col[2]) + fac*fabsf(r_col[2]-col[2]);
-                       }
-                               break;
+                       r_col[1] = facm*(r_col[1]) + fac*fabsf(r_col[1]-col[1]);
+                       r_col[2] = facm*(r_col[2]) + fac*fabsf(r_col[2]-col[2]);
+                       break;
                case MA_RAMP_DARK:
-                       tmp=col[0]+((1-col[0])*facm); 
+                       tmp=col[0]+((1-col[0])*facm);
                        if(tmp < r_col[0]) r_col[0]= tmp;
-                       if(r_col[1]) {
-                               tmp=col[1]+((1-col[1])*facm); 
-                               if(tmp < r_col[1]) r_col[1]= tmp;
-                               tmp=col[2]+((1-col[2])*facm); 
-                               if(tmp < r_col[2]) r_col[2]= tmp;
-                       } 
-                               break; 
+                       tmp=col[1]+((1-col[1])*facm);
+                       if(tmp < r_col[1]) r_col[1]= tmp;
+                       tmp=col[2]+((1-col[2])*facm);
+                       if(tmp < r_col[2]) r_col[2]= tmp;
+                       break;
                case MA_RAMP_LIGHT:
                        tmp= fac*col[0];
                        if(tmp > r_col[0]) r_col[0]= tmp;
-                               if(r_col[1]) {
-                                       tmp= fac*col[1];
-                                       if(tmp > r_col[1]) r_col[1]= tmp;
-                                       tmp= fac*col[2];
-                                       if(tmp > r_col[2]) r_col[2]= tmp;
-                               }
-                                       break;  
-               case MA_RAMP_DODGE:                     
-                       
-                               
+                               tmp= fac*col[1];
+                               if(tmp > r_col[1]) r_col[1]= tmp;
+                               tmp= fac*col[2];
+                               if(tmp > r_col[2]) r_col[2]= tmp;
+                               break;
+               case MA_RAMP_DODGE:
                        if(r_col[0] !=0.0f){
                                tmp = 1.0f - fac*col[0];
                                if(tmp <= 0.0f)
                                        r_col[0] = 1.0f;
                                else if ((tmp = (r_col[0]) / tmp)> 1.0f)
                                        r_col[0] = 1.0f;
-                               else 
+                               else
                                        r_col[0] = tmp;
                        }
-                       if(r_col[1]) {
-                               if(r_col[1] !=0.0f){
-                                       tmp = 1.0f - fac*col[1];
-                                       if(tmp <= 0.0f )
-                                               r_col[1] = 1.0f;
-                                       else if ((tmp = (r_col[1]) / tmp) > 1.0f )
-                                               r_col[1] = 1.0f;
-                                       else
-                                               r_col[1] = tmp;
-                               }
-                               if(r_col[2] !=0.0f){
-                                       tmp = 1.0f - fac*col[2];
-                                       if(tmp <= 0.0f)
-                                               r_col[2] = 1.0f;
-                                       else if ((tmp = (r_col[2]) / tmp) > 1.0f )
-                                               r_col[2] = 1.0f;
-                                       else
-                                               r_col[2] = tmp;
-                               }
-
+                       if(r_col[1] !=0.0f){
+                               tmp = 1.0f - fac*col[1];
+                               if(tmp <= 0.0f )
+                                       r_col[1] = 1.0f;
+                               else if ((tmp = (r_col[1]) / tmp) > 1.0f )
+                                       r_col[1] = 1.0f;
+                               else
+                                       r_col[1] = tmp;
                        }
-                               break;  
+                       if(r_col[2] !=0.0f){
+                               tmp = 1.0f - fac*col[2];
+                               if(tmp <= 0.0f)
+                                       r_col[2] = 1.0f;
+                               else if ((tmp = (r_col[2]) / tmp) > 1.0f )
+                                       r_col[2] = 1.0f;
+                               else
+                                       r_col[2] = tmp;
+                       }
+                       break;
                case MA_RAMP_BURN:
-                       
                        tmp = facm + fac*col[0];
-                       
+
                        if(tmp <= 0.0f)
                                r_col[0] = 0.0f;
                        else if (( tmp = (1.0f - (1.0f - (r_col[0])) / tmp )) < 0.0f)
                                        r_col[0] = 0.0f;
                        else if (tmp > 1.0f)
                                r_col[0]=1.0f;
-                       else 
+                       else
                                r_col[0] = tmp;
 
-                       if(r_col[1]) {
-                               tmp = facm + fac*col[1];
-                               if(tmp <= 0.0f)
+                       tmp = facm + fac*col[1];
+                       if(tmp <= 0.0f)
+                               r_col[1] = 0.0f;
+                       else if (( tmp = (1.0f - (1.0f - (r_col[1])) / tmp )) < 0.0f )
                                        r_col[1] = 0.0f;
-                               else if (( tmp = (1.0f - (1.0f - (r_col[1])) / tmp )) < 0.0f )
-                                               r_col[1] = 0.0f;
-                               else if(tmp >1.0f)
-                                       r_col[1]=1.0f;
-                               else
-                                       r_col[1] = tmp;
+                       else if(tmp >1.0f)
+                               r_col[1]=1.0f;
+                       else
+                               r_col[1] = tmp;
 
-                                       tmp = facm + fac*col[2];
-                                       if(tmp <= 0.0f)
+                               tmp = facm + fac*col[2];
+                               if(tmp <= 0.0f)
+                               r_col[2] = 0.0f;
+                       else if (( tmp = (1.0f - (1.0f - (r_col[2])) / tmp )) < 0.0f  )
                                        r_col[2] = 0.0f;
-                               else if (( tmp = (1.0f - (1.0f - (r_col[2])) / tmp )) < 0.0f  )
-                                               r_col[2] = 0.0f;
-                               else if(tmp >1.0f)
-                                       r_col[2]= 1.0f;
-                               else
-                                       r_col[2] = tmp;
-                       }
-                               break;
-               case MA_RAMP_HUE:               
-                       if(r_col[1]){
+                       else if(tmp >1.0f)
+                               r_col[2]= 1.0f;
+                       else
+                               r_col[2] = tmp;
+                       break;
+               case MA_RAMP_HUE:
+                       {
                                float rH,rS,rV;
-                               float colH,colS,colV; 
+                               float colH,colS,colV;
                                float tmpr,tmpg,tmpb;
                                rgb_to_hsv(col[0],col[1],col[2],&colH,&colS,&colV);
                                if(colS!=0 ){
@@ -1356,9 +1327,9 @@ void ramp_blend(int type, float r_col[3], const float fac, const float col[3])
                                        r_col[2] = facm*(r_col[2]) + fac*tmpb;
                                }
                        }
-                               break;
-               case MA_RAMP_SAT:               
-                       if(r_col[1]){
+                       break;
+               case MA_RAMP_SAT:
+                       {
                                float rH,rS,rV;
                                float colH,colS,colV;
                                rgb_to_hsv(r_col[0],r_col[1],r_col[2],&rH,&rS,&rV);
@@ -1367,18 +1338,18 @@ void ramp_blend(int type, float r_col[3], const float fac, const float col[3])
                                        hsv_to_rgb( rH, (facm*rS +fac*colS), rV, r_col+0, r_col+1, r_col+2);
                                }
                        }
-                               break;
-               case MA_RAMP_VAL:               
-                       if(r_col[1]){
+                       break;
+               case MA_RAMP_VAL:
+                       {
                                float rH,rS,rV;
                                float colH,colS,colV;
                                rgb_to_hsv(r_col[0],r_col[1],r_col[2],&rH,&rS,&rV);
                                rgb_to_hsv(col[0],col[1],col[2],&colH,&colS,&colV);
                                hsv_to_rgb( rH, rS, (facm*rV +fac*colV), r_col+0, r_col+1, r_col+2);
                        }
-                               break;
-               case MA_RAMP_COLOR:             
-                       if(r_col[1]){
+                       break;
+               case MA_RAMP_COLOR:
+                       {
                                float rH,rS,rV;
                                float colH,colS,colV;
                                float tmpr,tmpg,tmpb;
@@ -1391,12 +1362,12 @@ void ramp_blend(int type, float r_col[3], const float fac, const float col[3])
                                        r_col[2] = facm*(r_col[2]) + fac*tmpb;
                                }
                        }
-                               break;
-               case MA_RAMP_SOFT: 
-                       if (r_col[1]){
-                               float scr, scg, scb; 
+                       break;
+               case MA_RAMP_SOFT:
+                       {
+                               float scr, scg, scb;
 
-                               /* first calculate non-fac based Screen mix */ 
+                               /* first calculate non-fac based Screen mix */
                                scr = 1.0f - (1.0f - col[0]) * (1.0f - r_col[0]);
                                scg = 1.0f - (1.0f - col[1]) * (1.0f - r_col[1]);
                                scb = 1.0f - (1.0f - col[2]) * (1.0f - r_col[2]);
@@ -1404,25 +1375,23 @@ void ramp_blend(int type, float r_col[3], const float fac, const float col[3])
                                r_col[0] = facm*(r_col[0]) + fac*(((1.0f - r_col[0]) * col[0] * (r_col[0])) + (r_col[0] * scr));
                                r_col[1] = facm*(r_col[1]) + fac*(((1.0f - r_col[1]) * col[1] * (r_col[1])) + (r_col[1] * scg));
                                r_col[2] = facm*(r_col[2]) + fac*(((1.0f - r_col[2]) * col[2] * (r_col[2])) + (r_col[2] * scb));
-                       } 
-                               break; 
-               case MA_RAMP_LINEAR: 
-                       if (col[0] > 0.5f)  
+                       }
+                       break;
+               case MA_RAMP_LINEAR:
+                       if (col[0] > 0.5f)
                                r_col[0] = r_col[0] + fac*(2.0f*(col[0]-0.5f));
-                       else  
+                       else
                                r_col[0] = r_col[0] + fac*(2.0f*(col[0]) - 1.0f);
-                       if (r_col[1]){
-                               if (col[1] > 0.5f)  
-                                       r_col[1] = r_col[1] + fac*(2.0f*(col[1]-0.5f));
-                               else  
-                                       r_col[1] = r_col[1] + fac*(2.0f*(col[1]) -1.0f);
-                               if (col[2] > 0.5f)  
-                                       r_col[2] = r_col[2] + fac*(2.0f*(col[2]-0.5f));
-                               else  
-                                       r_col[2] = r_col[2] + fac*(2.0f*(col[2]) - 1.0f);
-                       } 
-                               break; 
-       }       
+                       if (col[1] > 0.5f)
+                               r_col[1] = r_col[1] + fac*(2.0f*(col[1]-0.5f));
+                       else
+                               r_col[1] = r_col[1] + fac*(2.0f*(col[1]) -1.0f);
+                       if (col[2] > 0.5f)
+                               r_col[2] = r_col[2] + fac*(2.0f*(col[2]-0.5f));
+                       else
+                               r_col[2] = r_col[2] + fac*(2.0f*(col[2]) - 1.0f);
+                       break;
+       }
 }
 
 /* copy/paste buffer, if we had a propper py api that would be better */
index f98919fadd3a0f850e4c5535a83116fe9c44f968..a46ba78aef0728a7cfe8292d357cac61fd255e80 100644 (file)
@@ -55,6 +55,7 @@ void *BLI_mempool_calloc(BLI_mempool *pool);
 void BLI_mempool_free(BLI_mempool *pool, void *addr);
 void BLI_mempool_destroy(BLI_mempool *pool);
 int BLI_mempool_count(BLI_mempool *pool);
+void *BLI_mempool_findelem(BLI_mempool *pool, const int index);
 
 /** iteration stuff.  note: this may easy to produce bugs with **/
 /*private structure*/
index 19ae89da8ea2bb276338be056b2f95ecd2d8c18b..f8da524d0975c6dac3f26888aa5c1d3d22389c91 100644 (file)
@@ -68,8 +68,9 @@ typedef struct BLI_mempool_chunk {
 
 struct BLI_mempool {
        struct ListBase chunks;
-       int esize, csize, pchunk;        /* size of elements and chunks in bytes
-                                         * and number of elements per chunk*/
+       int esize;         /* element size in bytes */
+       int csize;         /* chunk size in bytes */
+       int pchunk;        /* number of elements per chunk */
        short use_sysmalloc, allow_iter;
        /* keeps aligned to 16 bits */
 
@@ -240,6 +241,23 @@ void BLI_mempool_free(BLI_mempool *pool, void *addr)
        }
 }
 
+void *BLI_mempool_findelem(BLI_mempool *pool, const int index)
+{
+       if ((index >= 0) && (index < pool->totused)) {
+               BLI_mempool_chunk *mpchunk;
+               int i= 0;
+
+               for (mpchunk = pool->chunks.first; mpchunk; mpchunk = mpchunk->next) {
+                       if (index < i + pool->pchunk) {
+                               return ((char *)mpchunk->data) + (pool->esize * (index - i));
+                       }
+                       i += pool->pchunk;
+               }
+       }
+
+       return NULL;
+}
+
 void BLI_mempool_iternew(BLI_mempool *pool, BLI_mempool_iter *iter)
 {
        if (!pool->allow_iter) {
index d66e6852f1d16d4eec6c61886a87558be845c180..38b0c2f6d382e6a269b0348884ba7c38558eb8d8 100644 (file)
@@ -494,7 +494,7 @@ void ui_draw_aligned_panel(uiStyle *style, uiBlock *block, rcti *rect)
        /* calculate header rect */
        /* + 0.001f to prevent flicker due to float inaccuracy */
        headrect= *rect;
-       headrect.ymin= headrect.ymax - 2.0f/block->aspect;
+       headrect.ymin= headrect.ymax;
        headrect.ymax= headrect.ymin + floor(PNL_HEADER/block->aspect + 0.001f);
        
        {
@@ -508,7 +508,7 @@ void ui_draw_aligned_panel(uiStyle *style, uiBlock *block, rcti *rect)
                        /* draw with background color */
                        glEnable(GL_BLEND);
                        glColor4ubv((unsigned char*)btheme->tui.panel.header);
-                       glRectf(minx, headrect.ymin, maxx, y);
+                       glRectf(minx, headrect.ymin+1, maxx, y);
 
                        fdrawline(minx, y, maxx, y);
                        fdrawline(minx, y, maxx, y);
index f3d087d6986e5250286099dba716786a7a3232c4..24c261095026e8c8edf73831c09badc46115088e 100644 (file)
@@ -262,12 +262,12 @@ static void region_draw_azone_tab_plus(AZone *az)
                        break;
        }
 
-       glColor4f(0.05f, 0.05f, 0.05f, 0.5f);
+       glColor4f(0.05f, 0.05f, 0.05f, 0.4f);
        uiRoundBox((float)az->x1, (float)az->y1, (float)az->x2, (float)az->y2, 4.0f);
 
        glEnable(GL_BLEND);
 
-       glColor4f(0.8f, 0.8f, 0.8f, 0.5f);
+       glColor4f(0.8f, 0.8f, 0.8f, 0.4f);
        draw_azone_plus((float)az->x1, (float)az->y1, (float)az->x2, (float)az->y2);
 
        glDisable(GL_BLEND);
@@ -711,8 +711,8 @@ static void region_azone_icon(ScrArea *sa, AZone *az, ARegion *ar)
        }
 }
 
-#define AZONEPAD_TAB_PLUSW     16
-#define AZONEPAD_TAB_PLUSH     16
+#define AZONEPAD_TAB_PLUSW     14
+#define AZONEPAD_TAB_PLUSH     14
 
 /* region already made zero sized, in shape of edge */
 static void region_azone_tab_plus(ScrArea *sa, AZone *az, ARegion *ar)
@@ -739,9 +739,9 @@ static void region_azone_tab_plus(ScrArea *sa, AZone *az, ARegion *ar)
                        az->y2= ar->winrct.ymin;
                        break;
                case AE_LEFT_TO_TOPRIGHT:
-                       az->x1= ar->winrct.xmin + 1 - AZONEPAD_TAB_PLUSH;
+                       az->x1= ar->winrct.xmin - AZONEPAD_TAB_PLUSH;
                        az->y1= ar->winrct.ymax - 2.5*AZONEPAD_TAB_PLUSW;
-                       az->x2= ar->winrct.xmin + 1;
+                       az->x2= ar->winrct.xmin;
                        az->y2= ar->winrct.ymax - 1.5*AZONEPAD_TAB_PLUSW;
                        break;
                case AE_RIGHT_TO_TOPLEFT:
index 424a08f15cbda6e03a208323437c9a4008de41bf..940e2e749e30ef0c9ce71cf28bc3d24488dbd494 100644 (file)
@@ -746,7 +746,7 @@ static int rna_StringProperty_max_length_get(PointerRNA *ptr)
        return ((StringPropertyRNA*)prop)->maxlength;
 }
 
-static EnumPropertyItem *rna_EnumProperty_default_itemf(bContext *C, PointerRNA *ptr, PropertyRNA *UNUSED(prop), int *free)
+static EnumPropertyItem *rna_EnumProperty_default_itemf(bContext *C, PointerRNA *ptr, PropertyRNA *prop_parent, int *free)
 {
        PropertyRNA *prop= (PropertyRNA*)ptr->data;
        EnumPropertyRNA *eprop;
@@ -754,6 +754,11 @@ static EnumPropertyItem *rna_EnumProperty_default_itemf(bContext *C, PointerRNA
        rna_idproperty_check(&prop, ptr);
        eprop= (EnumPropertyRNA*)prop;
 
+       /* incompatible default attributes */
+       if ((prop_parent->flag & PROP_ENUM_FLAG) != (prop->flag & PROP_ENUM_FLAG)) {
+               return NULL;
+       }
+
        if(             (eprop->itemf == NULL) ||
                        (eprop->itemf == rna_EnumProperty_default_itemf) ||
                        (ptr->type == &RNA_EnumProperty) ||