svn merge -r 30718:30912 https://svn.blender.org/svnroot/bf-blender/trunk/blender
authorJoerg Mueller <nexyon@gmail.com>
Fri, 30 Jul 2010 22:34:27 +0000 (22:34 +0000)
committerJoerg Mueller <nexyon@gmail.com>
Fri, 30 Jul 2010 22:34:27 +0000 (22:34 +0000)
171 files changed:
CMakeLists.txt
Makefile
build_files/scons/config/win32-vc-config.py
build_files/scons/tools/Blender.py
intern/audaspace/intern/AUD_IReader.h
intern/audaspace/intern/AUD_StreamBufferFactory.cpp
intern/smoke/extern/smoke_API.h
intern/smoke/intern/FLUID_3D.cpp
intern/smoke/intern/FLUID_3D.h
intern/smoke/intern/smoke_API.cpp
po/Makefile
release/Makefile
release/bin/.blender/.Blanguages [moved from bin/.blender/.Blanguages with 100% similarity]
release/bin/.blender/.bfont.ttf [moved from bin/.blender/.bfont.ttf with 100% similarity]
release/bin/blender-thumbnailer.py [moved from bin/blender-thumbnailer.py with 100% similarity]
release/scripts/io/export_3ds.py
release/scripts/io/export_fbx.py
release/scripts/io/export_obj.py
release/scripts/io/export_ply.py
release/scripts/io/export_x3d.py
release/scripts/io/import_scene_3ds.py
release/scripts/modules/bpy/utils.py
release/scripts/op/console_python.py
release/scripts/ui/properties_data_armature.py
release/scripts/ui/properties_data_mesh.py
release/scripts/ui/properties_data_modifier.py
release/scripts/ui/properties_particle.py
release/scripts/ui/properties_physics_smoke.py
release/scripts/ui/space_buttons.py [deleted file]
release/scripts/ui/space_image.py
release/scripts/ui/space_logic.py
release/scripts/ui/space_node.py
release/scripts/ui/space_sequencer.py
release/scripts/ui/space_text.py
release/scripts/ui/space_userpref.py
release/scripts/ui/space_view3d.py
release/scripts/ui/space_view3d_toolbar.py
release/windows/installer/01.installer.bmp [new file with mode: 0644]
source/blender/blenkernel/BKE_armature.h
source/blender/blenkernel/BKE_blender.h
source/blender/blenkernel/BKE_brush.h
source/blender/blenkernel/BKE_colortools.h
source/blender/blenkernel/BKE_image.h
source/blender/blenkernel/BKE_paint.h
source/blender/blenkernel/BKE_sequencer.h
source/blender/blenkernel/BKE_text.h
source/blender/blenkernel/BKE_texture.h
source/blender/blenkernel/intern/armature.c
source/blender/blenkernel/intern/brush.c
source/blender/blenkernel/intern/cdderivedmesh.c
source/blender/blenkernel/intern/colortools.c
source/blender/blenkernel/intern/constraint.c
source/blender/blenkernel/intern/deform.c
source/blender/blenkernel/intern/displist.c
source/blender/blenkernel/intern/effect.c
source/blender/blenkernel/intern/font.c
source/blender/blenkernel/intern/icons.c
source/blender/blenkernel/intern/image.c
source/blender/blenkernel/intern/library.c
source/blender/blenkernel/intern/mesh.c
source/blender/blenkernel/intern/node.c
source/blender/blenkernel/intern/object.c
source/blender/blenkernel/intern/paint.c
source/blender/blenkernel/intern/particle.c
source/blender/blenkernel/intern/particle_system.c
source/blender/blenkernel/intern/scene.c
source/blender/blenkernel/intern/seqeffects.c
source/blender/blenkernel/intern/sequencer.c
source/blender/blenkernel/intern/smoke.c
source/blender/blenkernel/intern/text.c
source/blender/blenkernel/intern/texture.c
source/blender/blenlib/BLI_math_rotation.h
source/blender/blenlib/BLI_math_vector.h
source/blender/blenlib/BLI_storage_types.h
source/blender/blenlib/intern/math_matrix.c
source/blender/blenlib/intern/math_rotation.c
source/blender/blenlib/intern/math_vector_inline.c
source/blender/blenlib/intern/storage.c
source/blender/blenloader/intern/readfile.c
source/blender/blenloader/intern/writefile.c
source/blender/editors/armature/editarmature.c
source/blender/editors/armature/poseobject.c
source/blender/editors/curve/editcurve.c
source/blender/editors/datafiles/startup.blend.c
source/blender/editors/include/ED_datafiles.h
source/blender/editors/include/UI_icons.h
source/blender/editors/interface/interface_handlers.c
source/blender/editors/interface/interface_icons.c
source/blender/editors/interface/interface_layout.c
source/blender/editors/interface/interface_templates.c
source/blender/editors/interface/interface_widgets.c
source/blender/editors/mesh/editmesh_mods.c
source/blender/editors/object/object_add.c
source/blender/editors/object/object_select.c
source/blender/editors/physics/particle_edit.c
source/blender/editors/render/render_preview.c
source/blender/editors/render/render_shading.c
source/blender/editors/screen/screen_edit.c
source/blender/editors/sculpt_paint/paint_image.c
source/blender/editors/sculpt_paint/paint_ops.c
source/blender/editors/sculpt_paint/paint_stroke.c
source/blender/editors/sculpt_paint/paint_utils.c
source/blender/editors/sculpt_paint/paint_vertex.c
source/blender/editors/sculpt_paint/sculpt.c
source/blender/editors/space_buttons/space_buttons.c
source/blender/editors/space_image/image_ops.c
source/blender/editors/space_logic/logic_header.c [deleted file]
source/blender/editors/space_logic/logic_intern.h
source/blender/editors/space_logic/space_logic.c
source/blender/editors/space_sequencer/sequencer_add.c
source/blender/editors/space_sequencer/sequencer_edit.c
source/blender/editors/space_text/text_draw.c
source/blender/editors/space_text/text_ops.c
source/blender/editors/space_view3d/drawarmature.c
source/blender/editors/space_view3d/drawobject.c
source/blender/editors/space_view3d/drawvolume.c
source/blender/editors/space_view3d/space_view3d.c
source/blender/editors/space_view3d/view3d_draw.c
source/blender/editors/space_view3d/view3d_edit.c
source/blender/editors/space_view3d/view3d_intern.h
source/blender/editors/space_view3d/view3d_select.c
source/blender/editors/space_view3d/view3d_view.c
source/blender/editors/transform/transform_conversions.c
source/blender/editors/transform/transform_input.c
source/blender/gpu/GPU_material.h
source/blender/gpu/intern/gpu_material.c
source/blender/gpu/intern/gpu_shader_material.glsl
source/blender/gpu/intern/gpu_shader_material.glsl.c
source/blender/imbuf/intern/jpeg.c
source/blender/imbuf/intern/thumbs.c
source/blender/imbuf/intern/tiff.c
source/blender/makesdna/DNA_brush_types.h
source/blender/makesdna/DNA_curve_types.h
source/blender/makesdna/DNA_image_types.h
source/blender/makesdna/DNA_mesh_types.h
source/blender/makesdna/DNA_smoke_types.h
source/blender/makesrna/RNA_access.h
source/blender/makesrna/RNA_enum_types.h
source/blender/makesrna/intern/rna_access.c
source/blender/makesrna/intern/rna_brush.c
source/blender/makesrna/intern/rna_color.c
source/blender/makesrna/intern/rna_curve.c
source/blender/makesrna/intern/rna_fluidsim.c
source/blender/makesrna/intern/rna_mesh.c
source/blender/makesrna/intern/rna_modifier.c
source/blender/makesrna/intern/rna_scene.c
source/blender/makesrna/intern/rna_smoke.c
source/blender/makesrna/intern/rna_space.c
source/blender/makesrna/intern/rna_wm.c
source/blender/nodes/intern/CMP_nodes/CMP_huecorrect.c
source/blender/python/generic/mathutils_quat.c
source/blender/python/intern/bpy_interface.c
source/blender/python/intern/bpy_rna.c
source/blender/render/intern/include/render_types.h
source/blender/render/intern/include/renderdatabase.h
source/blender/render/intern/source/convertblender.c
source/blender/render/intern/source/occlusion.c
source/blender/render/intern/source/pointdensity.c
source/blender/render/intern/source/rayshade.c
source/blender/render/intern/source/renderdatabase.c
source/blender/render/intern/source/shadeinput.c
source/blender/render/intern/source/shadeoutput.c
source/blender/render/intern/source/texture.c
source/blender/render/intern/source/volumetric.c
source/creator/CMakeLists.txt
source/darwin/Makefile
source/gameengine/Converter/BL_ArmatureChannel.cpp
source/gameengine/GameLogic/SCA_PythonController.cpp
source/gameengine/Ketsji/KX_Light.cpp
source/gameengine/PyDoc/bge.types.rst
source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_VAOpenGLRasterizer.cpp

index bec1353a8cf3a16165066210eb5531c9549d8294..0016f3de16183dc57e06731eca88e0f9bc5e2fc4 100644 (file)
@@ -115,6 +115,7 @@ OPTION(WITH_LZMA          "Enable best LZMA compression, (used for pointcache)"
 OPTION(WITH_RAYOPTIMIZATION    "Enable use of SIMD (SSE) optimizations for the raytracer" ON) 
 OPTION(WITH_CXX_GUARDEDALLOC "Enable GuardedAlloc for C++ memory allocation tracking" OFF)
 OPTION(WITH_INSTALL       "Install accompanying scripts and language files needed to run blender" ON)
+OPTION(WITH_PYTHON_INSTALL       "Copy system python into the blender install folder" ON)
 
 IF(APPLE)
        OPTION(WITH_COCOA         "Use Cocoa framework instead of deprecated Carbon" ON)
@@ -130,6 +131,10 @@ IF(NOT WITH_GAMEENGINE AND WITH_PLAYER)
        MESSAGE("WARNING: WITH_PLAYER needs WITH_GAMEENGINE")
 ENDIF(NOT WITH_GAMEENGINE AND WITH_PLAYER)
 
+IF(NOT WITH_INSTALL AND WITH_PYTHON_INSTALL)
+       MESSAGE("WARNING: WITH_PYTHON_INSTALL needs WITH_INSTALL")
+ENDIF(NOT WITH_INSTALL AND WITH_PYTHON_INSTALL)
+
 TEST_SSE_SUPPORT()
 
 # disabled for now, not supported
index b16e046d5e858dc41c3335529ea9724c5573bf9c..d92edf2c02c3c3439ee2e0f06eb69593e1035825 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -45,7 +45,7 @@ MAKEFLAGS=-I$(NANBLENDERHOME)/build_files/make --no-print-directory
 
 SOURCEDIR = 
 ifeq ($(FREE_WINDOWS),true)
-    DIRS ?= dlltool extern intern source po
+    DIRS ?= $(NANBLENDERHOME)/build_files/make/dlltool extern intern source po
 else
     DIRS ?= extern intern source po
 endif
index ce34737fd498e0278ef8199078173a86f5303039..3572dd113bf55f951bd525b5856191b11f32dda0 100644 (file)
@@ -130,7 +130,7 @@ BF_OPENJPEG_LIB = ''
 BF_OPENJPEG_INC = '${BF_OPENJPEG}'
 BF_OPENJPEG_LIBPATH='${BF_OPENJPEG}/lib'
 
-WITH_BF_FFTW3 = False
+WITH_BF_FFTW3 = True
 BF_FFTW3 = LIBDIR + '/fftw3'
 BF_FFTW3_INC = '${BF_FFTW3}/include'
 BF_FFTW3_LIB = 'libfftw'
index 7f5ce4767e38c86ee28cca0838f5e4c0412ff594..1c2fccec322ff1d9d301e26ecc48d416c04089b1 100644 (file)
@@ -529,13 +529,13 @@ def AppIt(target=None, source=None, env=None):
 #      print cmd
        commands.getoutput(cmd)
        cmd = installdir + '/%s.app/Contents/MacOS/%s'%(binary,VERSION)
-       shutil.copy(bldroot + '/bin/.blender/.bfont.ttf', cmd)
-       shutil.copy(bldroot + '/bin/.blender/.Blanguages', cmd)
-       cmd = 'cp -R %s/bin/%s/locale %s/%s.app/Contents/Resources/'%(bldroot,VERSION,installdir,binary)
+       shutil.copy(bldroot + '/release/bin/.blender/.bfont.ttf', cmd)
+       shutil.copy(bldroot + '/release/bin/.blender/.Blanguages', cmd)
+       cmd = 'cp -R %s/release/bin/%s/locale %s/%s.app/Contents/Resources/'%(bldroot,VERSION,installdir,binary)
        commands.getoutput(cmd)
-       cmd = 'cp -R %s/bin/%s/locale %s/%s.app/Contents/MacOS/%s/'%(bldroot,VERSION,installdir,binary,VERSION)
+       cmd = 'cp -R %s/release/bin/%s/locale %s/%s.app/Contents/MacOS/%s/'%(bldroot,VERSION,installdir,binary,VERSION)
        commands.getoutput(cmd)
-       cmd = 'cp %s/bin/%s/.Blanguages %s/%s.app/Contents/Resources/'%(bldroot,VERSION,installdir,binary)
+       cmd = 'cp %s/release/bin/%s/.Blanguages %s/%s.app/Contents/Resources/'%(bldroot,VERSION,installdir,binary)
        commands.getoutput(cmd)
        cmd = 'mkdir %s/%s.app/Contents/MacOS/%s/python/'%(installdir,binary, VERSION)
        commands.getoutput(cmd)
index baba587ea03ebf4d224429931c0472e680c29b29..816abfea7f3b2a14ff7bd7270903f4d9bd06c9bd 100644 (file)
@@ -60,7 +60,7 @@ public:
        virtual void seek(int position)=0;
 
        /**
-        * Returns an aproximated length of the source in samples.
+        * Returns an approximated length of the source in samples.
         * For readers of the type buffer this has to return a correct value!
         * \return The length as sample count. May be negative if unknown.
         * \see getType
index 4079079cb3349486c27243fe28ae9a94297df256..c1eb8161e30c26ca9249c5b286cf3f8c018d423f 100644 (file)
@@ -41,7 +41,7 @@ AUD_StreamBufferFactory::AUD_StreamBufferFactory(AUD_IFactory* factory) :
        int index = 0;
        sample_t* buffer;
 
-       // get an aproximated size if possible
+       // get an approximated size if possible
        int size = reader->getLength();
 
        if(size <= 0)
index 3e296fd7c9031a1cb8c6a90fbc5af1f8b3d7d050..b340c914519c3352b0530a3d74ff47140a49860f 100644 (file)
@@ -38,11 +38,11 @@ struct FLUID_3D;
 void smoke_export(struct FLUID_3D *fluid, float *dt, float *dx, float **dens, float **densold, float **heat, float **heatold, float **vx, float **vy, float **vz, float **vxold, float **vyold, float **vzold, unsigned char **obstacles);
 
 // low res
-struct FLUID_3D *smoke_init(int *res, float *p0, float dt);
+struct FLUID_3D *smoke_init(int *res, float *p0);
 void smoke_free(struct FLUID_3D *fluid);
 
-void smoke_initBlenderRNA(struct FLUID_3D *fluid, float *alpha, float *beta);
-void smoke_step(struct FLUID_3D *fluid, size_t framenr);
+void smoke_initBlenderRNA(struct FLUID_3D *fluid, float *alpha, float *beta, float *dt_factor, float *vorticity, int *border_colli);
+void smoke_step(struct FLUID_3D *fluid, size_t framenr, float fps);
 
 float *smoke_get_density(struct FLUID_3D *fluid);
 float *smoke_get_heat(struct FLUID_3D *fluid);
index 4ac960b5ef07ead3f23ce2cb3d7f48eb777692b9..05fbb918d248d8fcfbd437dcd66571b256ba7a25 100644 (file)
 #include <omp.h>
 #endif // PARALLEL 
 
-// boundary conditions of the fluid domain
-#define DOMAIN_BC_FRONT  0 // z
-#define DOMAIN_BC_TOP    1 // y
-#define DOMAIN_BC_LEFT   1 // x
-#define DOMAIN_BC_BACK   DOMAIN_BC_FRONT
-#define DOMAIN_BC_BOTTOM DOMAIN_BC_TOP
-#define DOMAIN_BC_RIGHT  DOMAIN_BC_LEFT
-
 //////////////////////////////////////////////////////////////////////
 // Construction/Destruction
 //////////////////////////////////////////////////////////////////////
 
-FLUID_3D::FLUID_3D(int *res, float *p0, float dt) :
-       _xRes(res[0]), _yRes(res[1]), _zRes(res[2]), _res(0.0f), _dt(dt)
+FLUID_3D::FLUID_3D(int *res, float *p0) :
+       _xRes(res[0]), _yRes(res[1]), _zRes(res[2]), _res(0.0f)
 {
        // set simulation consts
-       // _dt = dt; // 0.10
+       _dt = DT_DEFAULT;       // just in case. set in step from a RNA factor
        
        // start point of array
        _p0[0] = p0[0];
@@ -61,7 +53,6 @@ FLUID_3D::FLUID_3D(int *res, float *p0, float dt) :
        _iterations = 100;
        _tempAmb = 0; 
        _heatDiffusion = 1e-3;
-       _vorticityEps = 2.0;
        _totalTime = 0.0f;
        _totalSteps = 0;
        _res = Vec3Int(_xRes,_yRes,_zRes);
@@ -77,9 +68,9 @@ FLUID_3D::FLUID_3D(int *res, float *p0, float dt) :
        
        // scale the constants according to the refinement of the grid
        _dx = 1.0f / (float)_maxRes;
-       float scaling = 64.0f / _maxRes;
-       scaling = (scaling < 1.0f) ? 1.0f : scaling;
-       _vorticityEps /= scaling;
+       _constantScaling = 64.0f / _maxRes;
+       _constantScaling = (_constantScaling < 1.0f) ? 1.0f : _constantScaling;
+       _vorticityEps = 2.0f / _constantScaling; // Just in case set a default value
 
        // allocate arrays
        _totalCells   = _xRes * _yRes * _zRes;
@@ -126,30 +117,42 @@ FLUID_3D::FLUID_3D(int *res, float *p0, float dt) :
                _obstacles[x]    = false;
        }
 
+       // boundary conditions of the fluid domain
+       // set default values -> vertically non-colliding
+       _domainBcFront = true;
+       _domainBcTop = false;
+       _domainBcLeft = true;
+       _domainBcBack = _domainBcFront;
+       _domainBcBottom = _domainBcTop;
+       _domainBcRight  = _domainBcLeft;
+
+       _colloPrev = 1; // default value
+
+
        // set side obstacles
        int index;
        for (int y = 0; y < _yRes; y++)
        for (int x = 0; x < _xRes; x++)
        {
-               // front slab
+               // bottom slab
                index = x + y * _xRes;
-               if(DOMAIN_BC_FRONT==1) _obstacles[index] = 1;
+               if(_domainBcBottom==1) _obstacles[index] = 1;
 
-               // back slab
+               // top slab
                index += _totalCells - _slabSize;
-               if(DOMAIN_BC_BACK==1) _obstacles[index] = 1;
+               if(_domainBcTop==1) _obstacles[index] = 1;
        }
 
        for (int z = 0; z < _zRes; z++)
        for (int x = 0; x < _xRes; x++)
        {
-               // bottom slab
+               // front slab
                index = x + z * _slabSize;
-               if(DOMAIN_BC_BOTTOM==1) _obstacles[index] = 1;
+               if(_domainBcFront==1) _obstacles[index] = 1;
 
-               // top slab
+               // back slab
                index += _slabSize - _xRes;
-               if(DOMAIN_BC_TOP==1) _obstacles[index] = 1;
+               if(_domainBcBack==1) _obstacles[index] = 1;
        }
 
        for (int z = 0; z < _zRes; z++)
@@ -157,12 +160,13 @@ FLUID_3D::FLUID_3D(int *res, float *p0, float dt) :
        {
                // left slab
                index = y * _xRes + z * _slabSize;
-               if(DOMAIN_BC_LEFT==1) _obstacles[index] = 1;
+               if(_domainBcLeft==1) _obstacles[index] = 1;
 
                // right slab
                index += _xRes - 1;
-               if(DOMAIN_BC_RIGHT==1) _obstacles[index] = 1;
+               if(_domainBcRight==1) _obstacles[index] = 1;
        }
+
 }
 
 FLUID_3D::~FLUID_3D()
@@ -193,17 +197,32 @@ FLUID_3D::~FLUID_3D()
 }
 
 // init direct access functions from blender
-void FLUID_3D::initBlenderRNA(float *alpha, float *beta)
+void FLUID_3D::initBlenderRNA(float *alpha, float *beta, float *dt_factor, float *vorticity, int *borderCollision)
 {
        _alpha = alpha;
        _beta = beta;
+       _dtFactor = dt_factor;
+       _vorticityRNA = vorticity;
+       _borderColli = borderCollision;
 }
 
 //////////////////////////////////////////////////////////////////////
 // step simulation once
 //////////////////////////////////////////////////////////////////////
-void FLUID_3D::step()
+void FLUID_3D::step(float dt)
 {
+       // If border rules have been changed
+       if (_colloPrev != *_borderColli) {
+               setBorderCollisions();
+       }
+
+
+       // set delta time by dt_factor
+       _dt = (*_dtFactor) * dt;
+       // set vorticity from RNA value
+       _vorticityEps = (*_vorticityRNA)/_constantScaling;
+
+
 #if PARALLEL==1
        int threadval = 1;
        threadval = omp_get_max_threads();
@@ -246,6 +265,13 @@ void FLUID_3D::step()
        #pragma omp single
        {
 #endif
+       /*
+       * addForce() changed Temp values to preserve thread safety
+       * (previous functions in per thread loop still needed
+       *  original velocity data)
+       *
+       * So swap temp values to velocity
+       */
        SWAP_POINTERS(_xVelocity, _xVelocityTemp);
        SWAP_POINTERS(_yVelocity, _yVelocityTemp);
        SWAP_POINTERS(_zVelocity, _zVelocityTemp);
@@ -276,6 +302,10 @@ void FLUID_3D::step()
        #pragma omp single
        {
 #endif
+       /*
+       * For thread safety use "Old" to read
+       * "current" values but still allow changing values.
+       */
        SWAP_POINTERS(_xVelocity, _xVelocityOld);
        SWAP_POINTERS(_yVelocity, _yVelocityOld);
        SWAP_POINTERS(_zVelocity, _zVelocityOld);
@@ -334,6 +364,10 @@ void FLUID_3D::step()
        }
 #endif
 
+       /*
+       * swap final velocity back to Velocity array
+       * from temp xForce storage
+       */
        SWAP_POINTERS(_xVelocity, _xForce);
        SWAP_POINTERS(_yVelocity, _yForce);
        SWAP_POINTERS(_zVelocity, _zForce);
@@ -351,6 +385,88 @@ void FLUID_3D::step()
 
 }
 
+
+// Set border collision model from RNA setting
+
+void FLUID_3D::setBorderCollisions() {
+
+
+       _colloPrev = *_borderColli;             // saving the current value
+
+       // boundary conditions of the fluid domain
+       if (_colloPrev == 0)
+       {
+               // No collisions
+               _domainBcFront = false;
+               _domainBcTop = false;
+               _domainBcLeft = false;
+       }
+       else if (_colloPrev == 2)
+       {
+               // Collide with all sides
+               _domainBcFront = true;
+               _domainBcTop = true;
+               _domainBcLeft = true;
+       }
+       else
+       {
+               // Default values: Collide with "walls", but not top and bottom
+               _domainBcFront = true;
+               _domainBcTop = false;
+               _domainBcLeft = true;
+       }
+
+       _domainBcBack = _domainBcFront;
+       _domainBcBottom = _domainBcTop;
+       _domainBcRight  = _domainBcLeft;
+
+
+
+       // set side obstacles
+       int index;
+       for (int y = 0; y < _yRes; y++)
+       for (int x = 0; x < _xRes; x++)
+       {
+               // front slab
+               index = x + y * _xRes;
+               if(_domainBcBottom==1) _obstacles[index] = 1;
+               else _obstacles[index] = 0;
+
+               // back slab
+               index += _totalCells - _slabSize;
+               if(_domainBcTop==1) _obstacles[index] = 1;
+               else _obstacles[index] = 0;
+       }
+
+       for (int z = 0; z < _zRes; z++)
+       for (int x = 0; x < _xRes; x++)
+       {
+               // bottom slab
+               index = x + z * _slabSize;
+               if(_domainBcFront==1) _obstacles[index] = 1;
+               else _obstacles[index] = 0;
+
+               // top slab
+               index += _slabSize - _xRes;
+               if(_domainBcBack==1) _obstacles[index] = 1;
+               else _obstacles[index] = 0;
+       }
+
+       for (int z = 0; z < _zRes; z++)
+       for (int y = 0; y < _yRes; y++)
+       {
+               // left slab
+               index = y * _xRes + z * _slabSize;
+               if(_domainBcLeft==1) _obstacles[index] = 1;
+               else _obstacles[index] = 0;
+
+               // right slab
+               index += _xRes - 1;
+               if(_domainBcRight==1) _obstacles[index] = 1;
+               else _obstacles[index] = 0;
+       }
+}
+
 //////////////////////////////////////////////////////////////////////
 // helper function to dampen co-located grid artifacts of given arrays in intervals
 // (only needed for velocity, strength (w) depends on testcase...
@@ -428,6 +544,10 @@ void FLUID_3D::artificialDampingExactSL(int pos) {
                        for (y = 1; y < _res[1]-1; y++)
                                for (x = 1+(y+z)%2; x < _res[0]-1; x+=2) {
                                        index = x + y*_res[0] + posslab;
+                                       /*
+                                       * Uses xForce as temporary storage to allow other threads to read
+                                       * old values from xVelocityTemp
+                                       */
                                        _xForce[index] = (1-w)*_xVelocityTemp[index] + 1./6. * w*(
                                                        _xVelocityTemp[index+1] + _xVelocityTemp[index-1] +
                                                        _xVelocityTemp[index+_res[0]] + _xVelocityTemp[index-_res[0]] +
@@ -450,6 +570,11 @@ void FLUID_3D::artificialDampingExactSL(int pos) {
                        for (y = 1; y < _res[1]-1; y++)
                                for (x = 1+(y+z+1)%2; x < _res[0]-1; x+=2) {
                                        index = x + y*_res[0] + posslab;
+
+                                       /*
+                                       * Uses xForce as temporary storage to allow other threads to read
+                                       * old values from xVelocityTemp
+                                       */
                                        _xForce[index] = (1-w)*_xVelocityTemp[index] + 1./6. * w*(
                                                        _xVelocityTemp[index+1] + _xVelocityTemp[index-1] +
                                                        _xVelocityTemp[index+_res[0]] + _xVelocityTemp[index-_res[0]] +
@@ -661,13 +786,13 @@ void FLUID_3D::project()
        setObstacleBoundaries(_pressure, 0, _zRes);
        
        // copy out the boundaries
-       if(DOMAIN_BC_LEFT == 0)  setNeumannX(_xVelocity, _res, 0, _zRes);
+       if(_domainBcLeft == 0)  setNeumannX(_xVelocity, _res, 0, _zRes);
        else setZeroX(_xVelocity, _res, 0, _zRes); 
 
-       if(DOMAIN_BC_TOP == 0)   setNeumannY(_yVelocity, _res, 0, _zRes);
+       if(_domainBcFront == 0)   setNeumannY(_yVelocity, _res, 0, _zRes);
        else setZeroY(_yVelocity, _res, 0, _zRes); 
 
-       if(DOMAIN_BC_FRONT == 0) setNeumannZ(_zVelocity, _res, 0, _zRes);
+       if(_domainBcTop == 0) setNeumannZ(_zVelocity, _res, 0, _zRes);
        else setZeroZ(_zVelocity, _res, 0, _zRes);
 
        // calculate divergence
@@ -1060,13 +1185,13 @@ void FLUID_3D::advectMacCormackBegin(int zBegin, int zEnd)
 {
        Vec3Int res = Vec3Int(_xRes,_yRes,_zRes);
 
-       if(DOMAIN_BC_LEFT == 0) copyBorderX(_xVelocityOld, res, zBegin, zEnd);
+       if(_domainBcLeft == 0) copyBorderX(_xVelocityOld, res, zBegin, zEnd);
        else setZeroX(_xVelocityOld, res, zBegin, zEnd);
 
-       if(DOMAIN_BC_TOP == 0) copyBorderY(_yVelocityOld, res, zBegin, zEnd);
+       if(_domainBcFront == 0) copyBorderY(_yVelocityOld, res, zBegin, zEnd);
        else setZeroY(_yVelocityOld, res, zBegin, zEnd); 
 
-       if(DOMAIN_BC_FRONT == 0) copyBorderZ(_zVelocityOld, res, zBegin, zEnd);
+       if(_domainBcTop == 0) copyBorderZ(_zVelocityOld, res, zBegin, zEnd);
        else setZeroZ(_zVelocityOld, res, zBegin, zEnd);
 }
 
@@ -1114,13 +1239,13 @@ void FLUID_3D::advectMacCormackEnd2(int zBegin, int zEnd)
        advectFieldMacCormack2(dt0, _xVelocityOld, _yVelocityOld, _zVelocityOld, _yVelocityOld, _yVelocityTemp, _yVelocity, t1, res, _obstacles, zBegin, zEnd);
        advectFieldMacCormack2(dt0, _xVelocityOld, _yVelocityOld, _zVelocityOld, _zVelocityOld, _zVelocityTemp, _zVelocity, t1, res, _obstacles, zBegin, zEnd);
 
-       if(DOMAIN_BC_LEFT == 0) copyBorderX(_xVelocityTemp, res, zBegin, zEnd);
+       if(_domainBcLeft == 0) copyBorderX(_xVelocityTemp, res, zBegin, zEnd);
        else setZeroX(_xVelocityTemp, res, zBegin, zEnd);                               
 
-       if(DOMAIN_BC_TOP == 0) copyBorderY(_yVelocityTemp, res, zBegin, zEnd);
+       if(_domainBcFront == 0) copyBorderY(_yVelocityTemp, res, zBegin, zEnd);
        else setZeroY(_yVelocityTemp, res, zBegin, zEnd); 
 
-       if(DOMAIN_BC_FRONT == 0) copyBorderZ(_zVelocityTemp, res, zBegin, zEnd);
+       if(_domainBcTop == 0) copyBorderZ(_zVelocityTemp, res, zBegin, zEnd);
        else setZeroZ(_zVelocityTemp, res, zBegin, zEnd);
 
        setZeroBorder(_density, res, zBegin, zEnd);
index 6ca50b2c03207c710065af3305911aabb2ae210c..c244180ee57e783f9f50456d7a0aeea10b342a32 100644 (file)
@@ -36,6 +36,9 @@
 // #include "WTURBULENCE.h"
 #include "VEC3.h"
 
+// timestep default value for nice appearance
+#define DT_DEFAULT 0.1f;
+
 using namespace std;
 using namespace BasicVector;
 class WTURBULENCE;
@@ -43,11 +46,11 @@ class WTURBULENCE;
 class FLUID_3D  
 {
        public:
-               FLUID_3D(int *res, /* int amplify, */ float *p0, float dt);
+               FLUID_3D(int *res, /* int amplify, */ float *p0);
                FLUID_3D() {};
                virtual ~FLUID_3D();
 
-               void initBlenderRNA(float *alpha, float *beta);
+               void initBlenderRNA(float *alpha, float *beta, float *dt_factor, float *vorticity, int *border_colli);
                
                // create & allocate vector noise advection 
                void initVectorNoise(int amplify);
@@ -55,7 +58,7 @@ class FLUID_3D
                void addSmokeColumn();
                static void addSmokeTestCase(float* field, Vec3Int res);
 
-               void step();
+               void step(float dt);
                void addObstacle(OBSTACLE* obstacle);
 
                const float* xVelocity() { return _xVelocity; }; 
@@ -111,11 +114,25 @@ class FLUID_3D
 
                // simulation constants
                float _dt;
+               float *_dtFactor;
                float _vorticityEps;
                float _heatDiffusion;
+               float *_vorticityRNA;   // RNA-pointer.
                float *_alpha; // for the buoyancy density term <-- as pointer to get blender RNA in here
                float *_beta; // was _buoyancy <-- as pointer to get blender RNA in here
                float _tempAmb; /* ambient temperature */
+               float _constantScaling;
+
+               bool _domainBcFront;  // z
+               bool _domainBcTop;    // y
+               bool _domainBcLeft;   // x
+               bool _domainBcBack;   // DOMAIN_BC_FRONT
+               bool _domainBcBottom; // DOMAIN_BC_TOP
+               bool _domainBcRight;  // DOMAIN_BC_LEFT
+               int *_borderColli; // border collision rules <-- as pointer to get blender RNA in here
+               int _colloPrev;         // To track whether value has been changed (to not
+                                                       // have to recalibrate borders if nothing has changed
+               void setBorderCollisions();
 
                // WTURBULENCE object, if active
                // WTURBULENCE* _wTurbulence;
index 427f4d53171cc463f3890452d96bd1ff4e370359..168395f370d11ac3d114a7f959e1e48740d12a75 100644 (file)
 #include <math.h>
 
 // y in smoke is z in blender
-extern "C" FLUID_3D *smoke_init(int *res, float *p0, float dt)
+extern "C" FLUID_3D *smoke_init(int *res, float *p0)
 {
        // smoke lib uses y as top-bottom/vertical axis where blender uses z
-       FLUID_3D *fluid = new FLUID_3D(res, p0, dt);
+       FLUID_3D *fluid = new FLUID_3D(res, p0);
 
        // printf("xres: %d, yres: %d, zres: %d\n", res[0], res[1], res[2]);
 
@@ -75,9 +75,41 @@ extern "C" size_t smoke_get_index2d(int x, int max_x, int y /*, int max_y, int z
        return x + y * max_x;
 }
 
-extern "C" void smoke_step(FLUID_3D *fluid, size_t framenr)
+extern "C" void smoke_step(FLUID_3D *fluid, size_t framenr, float fps)
 {
-       fluid->step();
+       /* stability values copied from wturbulence.cpp */
+       const int maxSubSteps = 25;
+       const float maxVel = 0.5f; /* TODO: maybe 0.5 is still too high, please confirm! -dg */
+
+       float dt = DT_DEFAULT;
+       float maxVelMag = 0.0f;
+       int totalSubsteps;
+       int substep = 0;
+       float dtSubdiv;
+
+       /* get max velocity and lower the dt value if it is too high */
+       size_t size= fluid->_xRes * fluid->_yRes * fluid->_zRes;
+
+       for(size_t i = 0; i < size; i++)
+       {
+               float vtemp = (fluid->_xVelocity[i]*fluid->_xVelocity[i]+fluid->_yVelocity[i]*fluid->_yVelocity[i]+fluid->_zVelocity[i]*fluid->_zVelocity[i]);
+               if(vtemp > maxVelMag)
+                       maxVelMag = vtemp;
+       }
+
+       /* adapt timestep for different framerates, dt = 0.1 is at 25fps */
+       dt *= (25.0f / fps);
+
+       maxVelMag = sqrt(maxVelMag) * dt * (*(fluid->_dtFactor));
+       totalSubsteps = (int)((maxVelMag / maxVel) + 1.0f); /* always round up */
+       totalSubsteps = (totalSubsteps < 1) ? 1 : totalSubsteps;
+       totalSubsteps = (totalSubsteps > maxSubSteps) ? maxSubSteps : totalSubsteps;
+       dtSubdiv = (float)dt / (float)totalSubsteps;
+
+       // printf("totalSubsteps: %d, maxVelMag: %f, dt: %f\n", totalSubsteps, maxVelMag, dt);
+
+       for(substep = 0; substep < totalSubsteps; substep++)
+               fluid->step(dtSubdiv);
 }
 
 extern "C" void smoke_turbulence_step(WTURBULENCE *wt, FLUID_3D *fluid)
@@ -85,9 +117,9 @@ extern "C" void smoke_turbulence_step(WTURBULENCE *wt, FLUID_3D *fluid)
        wt->stepTurbulenceFull(fluid->_dt/fluid->_dx, fluid->_xVelocity, fluid->_yVelocity, fluid->_zVelocity, fluid->_obstacles); 
 }
 
-extern "C" void smoke_initBlenderRNA(FLUID_3D *fluid, float *alpha, float *beta)
+extern "C" void smoke_initBlenderRNA(FLUID_3D *fluid, float *alpha, float *beta, float *dt_factor, float *vorticity, int *border_colli)
 {
-       fluid->initBlenderRNA(alpha, beta);
+       fluid->initBlenderRNA(alpha, beta, dt_factor, vorticity, border_colli);
 }
 
 extern "C" void smoke_dissolve(FLUID_3D *fluid, int speed, int log)
index b656a00fb381d33fcdddbf895b37de39b35c897e..bbd1caa68ad422c60d7083c7e91d195f36c3079f 100644 (file)
@@ -51,7 +51,7 @@ $(DIR)%/LC_MESSAGES/blender.mo: %.po
        mkdir -p $(@D)
        msgfmt -o $@ $<
 ifeq ($(BF_VERIFY_MO_FILES), true)
-       @cmp $@ $(NANBLENDERHOME)/bin/.blender/locale/$(basename $<)/LC_MESSAGES/blender.mo \
+       @cmp $@ $(NANBLENDERHOME)/release/bin/.blender/locale/$(basename $<)/LC_MESSAGES/blender.mo \
           || ( echo Mismatch between generated and commited $(basename $<).mo catalog && \
                rm -f $@ && false )
 endif
index 809ac54872412d4961d9263d22b1ca35c5426504..e6d904ea13cb625394e90a8be03b7b1b913a27fe 100644 (file)
@@ -114,8 +114,8 @@ install: package
     ifneq ($(OS), darwin)
        @[ ! -d $(OCGDIR)/bin/.blender ] || \
                cp -r $(OCGDIR)/bin/.blender $(DISTDIR)
-       @cp $(NANBLENDERHOME)/bin/.blender/.Blanguages $(CONFDIR)
-       @cp $(NANBLENDERHOME)/bin/.blender/.bfont.ttf $(CONFDIR)
+       @cp $(NANBLENDERHOME)/release/bin/.blender/.Blanguages $(CONFDIR)
+       @cp $(NANBLENDERHOME)/release/bin/.blender/.bfont.ttf $(CONFDIR)
     endif
        @echo "----> Copy blender$(EXT0) executable"
     ifeq ($(TYPE),-static)
index 6b776c77a7a7a8ae1e8e0fd7d0e96986ce287d86..910d462a9f9d9d7d2af1247f19c1a0c5ae250226 100644 (file)
@@ -941,7 +941,8 @@ def save_3ds(filename, context):
     sce = context.scene
 #      sce= bpy.data.scenes.active
 
-    bpy.ops.object.mode_set(mode='OBJECT')
+    if context.object:
+        bpy.ops.object.mode_set(mode='OBJECT')
 
     # Initialize the main chunk (primary):
     primary = _3ds_chunk(PRIMARY)
index b68d6fafafa4ac54e5d582423064dcd289bb5efc..72b03a110bdea449dbed09d2f5321c4b65458e7e 100644 (file)
@@ -305,7 +305,8 @@ def write(filename, batch_objects = None, \
         BATCH_OWN_DIR =                                False
     ):
 
-    bpy.ops.object.mode_set(mode='OBJECT')
+    if bpy.context.object:
+        bpy.ops.object.mode_set(mode='OBJECT')
 
     # ----------------- Batch support!
     if BATCH_ENABLE:
index 6b47f6ddb54b53e5f63f66defbbd8033e9323bc4..a4d98aac12eb8cbc86963ec0bc30f66647039871 100644 (file)
@@ -634,7 +634,7 @@ def write(filepath, objects, scene,
 #                                      for vIdx, vWeight in me.getVertsFromGroup(vertexGroupName, 1):
                         vgroupsMap[vIdx].append((g.name, vWeight))
 
-            for f_index, f in enumerate(faces):
+            for f, f_index in face_index_pairs:
                 f_v = [{"index": index, "vertex": me.verts[index]} for index in f.verts]
 
                 # if f.verts[3] == 0:
@@ -646,7 +646,7 @@ def write(filepath, objects, scene,
 #                              f_mat = min(f.mat, len(materialNames)-1)
                 if faceuv:
 
-                    tface = me.active_uv_texture.data[face_index_pairs[f_index][1]]
+                    tface = me.active_uv_texture.data[f_index]
 
                     f_image = tface.image
                     f_uv = tface.uv
@@ -823,7 +823,8 @@ def do_export(filepath, context,
     orig_scene = context.scene
 
     # Exit edit mode before exporting, so current object states are exported properly.
-    bpy.ops.object.mode_set(mode='OBJECT')
+    if context.object:
+        bpy.ops.object.mode_set(mode='OBJECT')
 
 #      if EXPORT_ALL_SCENES:
 #              export_scenes = bpy.data.scenes
index 0b936bdceb2e223dfe36cf024d59d4f3b9b9c9af..07865e4f65a43de2100750229b887645a9b91258 100644 (file)
@@ -99,7 +99,8 @@ def write(filename, scene, ob, \
 
     Window.WaitCursor(1)
     """
-    bpy.ops.object.mode_set(mode='OBJECT')
+    if scene.objects.active:
+        bpy.ops.object.mode_set(mode='OBJECT')
 
     #mesh = BPyMesh.getMeshFromObject(ob, None, EXPORT_APPLY_MODIFIERS, False, scn) # XXX
     if EXPORT_APPLY_MODIFIERS:
index 1bad80f6d8e778ecbe33a2caaaf539b3d0bafc61..7f5dd57171c1ccc065e4f81941a8acd48f9980ea 100644 (file)
@@ -1156,8 +1156,9 @@ def x3d_export(filename,
 
     scene = context.scene
     world = scene.world
-    
-    bpy.ops.object.mode_set(mode='OBJECT')
+
+    if scene.objects.active:
+        bpy.ops.object.mode_set(mode='OBJECT')
 
     # XXX these are global textures while .Get() returned only scene's?
     alltextures = bpy.data.textures
index 7b3004d4f52084f8b00de5c419608df0752f6ab0..435e08a209e38f4cca62ac727f8999ee62b6678a 100644 (file)
@@ -883,14 +883,12 @@ def load_3ds(filename, context, IMPORT_CONSTRAIN_BOUNDS=10.0, IMAGE_SEARCH=True,
 
     # REMOVE DUMMYVERT, - remove this in the next release when blenders internal are fixed.
 
-
-#      for ob in importedObjects:
-#              if ob.type == 'MESH':
-# #            if ob.type=='Mesh':
-#                      me = ob.getData(mesh=1)
-#                      me.verts.delete([me.verts[0],])
-#                      if not APPLY_MATRIX:
-#                              me.transform(ob.matrix_world.copy().invert())
+    for ob in importedObjects:
+        if ob.type == 'MESH':
+            me = ob.data
+#           me.verts.delete([me.verts[0],]) # XXX, todo
+            if not APPLY_MATRIX:
+                me.transform(ob.matrix_world.copy().invert())
 
     # Done DUMMYVERT
     """
@@ -1009,15 +1007,19 @@ class IMPORT_OT_autodesk_3ds(bpy.types.Operator):
 
     # List of operator properties, the attributes will be assigned
     # to the class instance from the operator settings before calling.
-
     filepath = StringProperty(name="File Path", description="Filepath used for importing the 3DS file", maxlen= 1024, default= "")
 
-#      size_constraint = FloatProperty(name="Size Constraint", description="Scale the model by 10 until it reacehs the size constraint. Zero Disables.", min=0.0, max=1000.0, soft_min=0.0, soft_max=1000.0, default=10.0),
-#      search_images = BoolProperty(name="Image Search", description="Search subdirectories for any assosiated images (Warning, may be slow)", default=True),
-#      apply_matrix = BoolProperty(name="Transform Fix", description="Workaround for object transformations importing incorrectly", default=False),
+    constrain_size = FloatProperty(name="Size Constraint", description="Scale the model by 10 until it reacehs the size constraint. Zero Disables.", min=0.0, max=1000.0, soft_min=0.0, soft_max=1000.0, default=10.0)
+    search_images = BoolProperty(name="Image Search", description="Search subdirectories for any assosiated images (Warning, may be slow)", default=True)
+    apply_transform = BoolProperty(name="Apply Transform", description="Workaround for object transformations importing incorrectly", default=False)
 
     def execute(self, context):
-        load_3ds(self.properties.filepath, context, 0.0, False, False)
+        load_3ds(self.properties.filepath,
+                 context,
+                 IMPORT_CONSTRAIN_BOUNDS=self.properties.constrain_size,
+                 IMAGE_SEARCH=self.properties.search_images,
+                 APPLY_MATRIX=self.properties.apply_transform)
+
         return {'FINISHED'}
 
     def invoke(self, context, event):
index 404013fb79a1ae69180c48d01a635802e9a4ac22..06dbe8fd4cca9c6e1a0c7f26c396095aad97a0f5 100644 (file)
@@ -210,7 +210,7 @@ def load_scripts(reload_scripts=False, refresh_scripts=False):
         print("gc.collect() -> %d" % gc.collect())
 
     if _bpy.app.debug:
-        print("Time %.4f" % (time.time() - t_main))
+        print("Python Script Load Time %.4f" % (time.time() - t_main))
 
 
 def expandpath(path):
@@ -238,30 +238,29 @@ def relpath(path, start=None):
     return path
 
 
-_unclean_chars = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, \
-    17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, \
-    35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 46, 47, 58, 59, 60, 61, 62, 63, \
-    64, 91, 92, 93, 94, 96, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, \
-    133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, \
-    147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, \
-    161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, \
-    175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, \
-    189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, \
-    203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, \
-    217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, \
-    231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, \
-    245, 246, 247, 248, 249, 250, 251, 252, 253, 254]
-
-_unclean_chars = ''.join([chr(i) for i in _unclean_chars])
-
-
 def clean_name(name, replace="_"):
     """
     Returns a name with characters replaced that may cause problems under various circumstances, such as writing to a file.
     All characters besides A-Z/a-z, 0-9 are replaced with "_"
     or the replace argument if defined.
     """
-    for ch in _unclean_chars:
+
+    unclean_chars = \
+                 "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\
+                  \x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\
+                  \x1e\x1f\x20\x21\x22\x23\x24\x25\x26\x27\x28\x29\x2a\x2b\x2c\
+                  \x2e\x2f\x3a\x3b\x3c\x3d\x3e\x3f\x40\x5b\x5c\x5d\x5e\x60\x7b\
+                  \x7c\x7d\x7e\x7f\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\
+                  \x8b\x8c\x8d\x8e\x8f\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\
+                  \x9a\x9b\x9c\x9d\x9e\x9f\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7\xa8\
+                  \xa9\xaa\xab\xac\xad\xae\xaf\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7\
+                  \xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf\xc0\xc1\xc2\xc3\xc4\xc5\xc6\
+                  \xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf\xd0\xd1\xd2\xd3\xd4\xd5\
+                  \xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf\xe0\xe1\xe2\xe3\xe4\
+                  \xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef\xf0\xf1\xf2\xf3\
+                  \xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\xfd\xfe"
+
+    for ch in unclean_chars:
         name = name.replace(ch, replace)
     return name
 
index d3a90cb7accdc089a7e98a3d02a13c87856d5463..2881e87fe00826de88fd497bdd39daec0f6b2b7c 100644 (file)
@@ -22,6 +22,9 @@ import bpy
 
 language_id = 'python'
 
+# store our own __main__ module, not 100% needed
+# but python expects this in some places
+_BPY_MAIN_OWN = True
 
 def add_scrollback(text, text_type):
     for l in text.split('\n'):
@@ -67,8 +70,21 @@ def get_console(console_id):
         stdout = io.StringIO()
         stderr = io.StringIO()
     else:
-        namespace = {'__builtins__': __builtins__, 'bpy': bpy}
+        if _BPY_MAIN_OWN:
+            import types
+            bpy_main_mod = types.ModuleType("__main__")
+            namespace = bpy_main_mod.__dict__
+        else:
+            namespace = {}
+        
+        namespace["__builtins__"] = sys.modules["builtins"]
+        namespace["bpy"] = bpy
+        namespace["C"] = bpy.context
+
         console = InteractiveConsole(locals=namespace, filename="<blender_console>")
+        
+        if _BPY_MAIN_OWN:
+            console._bpy_main_mod = bpy_main_mod
 
         import io
         stdout = io.StringIO()
@@ -97,10 +113,6 @@ def execute(context):
 
     console, stdout, stderr = get_console(hash(context.region))
 
-    # Hack, useful but must add some other way to access
-    #if "C" not in console.locals:
-    console.locals["C"] = context
-
     # redirect output
     sys.stdout = stdout
     sys.stderr = stderr
@@ -109,6 +121,10 @@ def execute(context):
     stdin_backup = sys.stdin
     sys.stdin = None
 
+    if _BPY_MAIN_OWN:
+        main_mod_back = sys.modules["__main__"]
+        sys.modules["__main__"] = console._bpy_main_mod
+
     # incase exception happens
     line = "" # incase of encodingf error
     is_multiline = False
@@ -125,6 +141,8 @@ def execute(context):
         import traceback
         stderr.write(traceback.format_exc())
 
+    if _BPY_MAIN_OWN:
+        sys.modules["__main__"] = main_mod_back
 
     stdout.seek(0)
     stderr.seek(0)
@@ -243,10 +261,6 @@ def banner(context):
     add_scrollback("", 'OUTPUT')
     sc.prompt = PROMPT
 
-    # Add context into the namespace for quick access
-    console = get_console(hash(context.region))[0]
-    console.locals["C"] = bpy.context
-
     return {'FINISHED'}
 
 
index 38903cc1f276b7d5f026f8b92d732478409510f0..31ede4adfb5dc667cf7f674ea86ea61b5d2a850b 100644 (file)
@@ -120,6 +120,7 @@ class DATA_PT_display(DataButtonsPanel):
         if wide_ui:
             col = split.column()
         col.prop(arm, "draw_group_colors", text="Colors")
+        col.prop(ob, "x_ray", text="X-Ray")
         col.prop(arm, "delay_deform", text="Delay Refresh")
 
 
@@ -173,8 +174,6 @@ class DATA_PT_bone_groups(DataButtonsPanel):
 
 
 # TODO: this panel will soon be depreceated too
-
-
 class DATA_PT_ghost(DataButtonsPanel):
     bl_label = "Ghost"
 
index 44d3d19e79318a3284c91f87f654cec8ff58dfbd..c3170be886010d367c3c152840d3a5b088a1f2f4 100644 (file)
@@ -114,7 +114,6 @@ class DATA_PT_normals(DataButtonsPanel):
             col = split.column()
         else:
             col.separator()
-        col.prop(mesh, "vertex_normal_flip")
         col.prop(mesh, "double_sided")
 
 
index dfa0d8029b250ddfb27c1186be525fc44c8e0c13..37764e208547b8fab0f132e4391edf4aebc95e8b 100644 (file)
@@ -437,7 +437,6 @@ class DATA_PT_modifiers(DataButtonsPanel):
         col.prop(md, "levels", text="Preview")
         col.prop(md, "sculpt_levels", text="Sculpt")
         col.prop(md, "render_levels", text="Render")
-        col.prop(bpy.context.tool_settings.sculpt, "fast_navigate")
 
         if wide_ui:
             col = split.column()
index 58e602dd1e2c0f8624b161d6d5fca301bd01b8fe..f858c9b8511a919f46081c4080be9344209e2bc3 100644 (file)
@@ -401,11 +401,12 @@ class PARTICLE_PT_physics(ParticleButtonsPanel):
         else:
             row.prop(part, "physics_type", text="")
 
+        row = layout.row()
+        col = row.column(align=True)
+        col.prop(part, "particle_size")
+        col.prop(part, "random_size", slider=True)
+
         if part.physics_type != 'NO':
-            row = layout.row()
-            col = row.column(align=True)
-            col.prop(part, "particle_size")
-            col.prop(part, "random_size", slider=True)
             col = row.column(align=True)
             col.prop(part, "mass")
             col.prop(part, "sizemass", text="Multiply mass with size")
index c5357c515deae58a07275b93db6f2fad4bc8ac95..9bae4c5b63fb7a8f2be2becb1dd4dac4a2c88a51 100644 (file)
@@ -78,14 +78,17 @@ class PHYSICS_PT_smoke(PhysicButtonsPanel):
                 col = split.column()
                 col.label(text="Resolution:")
                 col.prop(domain, "maxres", text="Divisions")
-                col.label(text="Particle:")
-                col.prop(domain, "initial_velocity", text="Initial Velocity")
+                col.label(text="Time:")
+                col.prop(domain, "time_scale", text="Scale")
+                col.label(text="Border Collisions:")
+                col.prop(domain, "smoke_domain_colli", text="")
 
                 if wide_ui:
                     col = split.column()
                 col.label(text="Behavior:")
                 col.prop(domain, "alpha")
                 col.prop(domain, "beta")
+                col.prop(domain, "vorticity")
                 col.prop(domain, "dissolve_smoke", text="Dissolve")
                 sub = col.column()
                 sub.active = domain.dissolve_smoke
@@ -93,6 +96,7 @@ class PHYSICS_PT_smoke(PhysicButtonsPanel):
                 sub.prop(domain, "dissolve_smoke_log", text="Slow")
 
             elif md.smoke_type == 'FLOW':
+    
                 flow = md.flow_settings
 
                 split = layout.split()
@@ -102,15 +106,21 @@ class PHYSICS_PT_smoke(PhysicButtonsPanel):
                 col.label(text="Particle System:")
                 col.prop_object(flow, "psys", ob, "particle_systems", text="")
 
-                if md.flow_settings.outflow:
-                    if wide_ui:
-                        col = split.column()
-                else:
-                    if wide_ui:
-                        col = split.column()
-                    col.label(text="Behavior:")
-                    col.prop(flow, "temperature")
-                    col.prop(flow, "density")
+                sub = col.column()
+                sub.active = not md.flow_settings.outflow
+
+                sub.prop(flow, "initial_velocity", text="Initial Velocity")
+                sub = sub.column()
+                sub.active = flow.initial_velocity
+                sub.prop(flow, "velocity_multiplier", text="Multiplier")
+
+                if wide_ui:
+                    sub = split.column()
+                sub.active = not md.flow_settings.outflow
+                sub.label(text="Behavior:")
+                sub.prop(flow, "temperature")
+                sub.prop(flow, "density")
+                sub.prop(flow, "absolute")
 
             #elif md.smoke_type == 'COLLISION':
             #  layout.separator()
@@ -191,6 +201,7 @@ class PHYSICS_PT_smoke_highres(PhysicButtonsPanel):
         col = split.column()
         col.label(text="Resolution:")
         col.prop(md, "amplify", text="Divisions")
+        col.prop(md, "smoothemitter")
         col.prop(md, "viewhighres")
 
         if wide_ui:
diff --git a/release/scripts/ui/space_buttons.py b/release/scripts/ui/space_buttons.py
deleted file mode 100644 (file)
index 9fc30a8..0000000
+++ /dev/null
@@ -1,72 +0,0 @@
-# ##### 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.
-#
-# ##### END GPL LICENSE BLOCK #####
-
-# <pep8 compliant>
-import bpy
-
-
-class Buttons_HT_header(bpy.types.Header):
-    bl_space_type = 'PROPERTIES'
-
-    def draw(self, context):
-        layout = self.layout
-
-        so = context.space_data
-        scene = context.scene
-
-        row = layout.row(align=True)
-        row.template_header()
-
-        if context.area.show_menus:
-            sub = row.row(align=True)
-            sub.menu("Buttons_MT_view", text="View")
-
-        row = layout.row()
-        row.prop(so, "buttons_context", expand=True, text="")
-        row.prop(scene, "frame_current")
-
-
-class Buttons_MT_view(bpy.types.Menu):
-    bl_label = "View"
-
-    def draw(self, context):
-        layout = self.layout
-        so = context.space_data
-
-        col = layout.column()
-        col.prop(so, "panel_alignment", expand=True)
-
-
-classes = [
-    Buttons_HT_header,
-    Buttons_MT_view]
-
-
-def register():
-    register = bpy.types.register
-    for cls in classes:
-        register(cls)
-
-
-def unregister():
-    unregister = bpy.types.unregister
-    for cls in classes:
-        unregister(cls)
-
-if __name__ == "__main__":
-    register()
index 907725a4ef7b9043748d0bcbd9d05ad120316b50..a28ddb90a40046163454174777f7c9a93d729d09 100644 (file)
@@ -673,7 +673,6 @@ class IMAGE_PT_paint_curve(bpy.types.Panel):
         row.operator("brush.curve_preset", icon="SHARPCURVE", text="").shape = 'SHARP'
         row.operator("brush.curve_preset", icon="LINCURVE", text="").shape = 'LINE'
         row.operator("brush.curve_preset", icon="NOCURVE", text="").shape = 'MAX'
-        row.operator("brush.curve_preset", icon="RNDCURVE", text="").shape = 'MID9'
 
 classes = [
     IMAGE_MT_view,
index a01a5ce63050c9051eac486c499801bf57cc38e9..6003c4d4bd784009526747c3617ed6a03001ec85 100644 (file)
@@ -57,9 +57,43 @@ class LOGIC_MT_logicbricks_add(bpy.types.Menu):
         layout.operator_menu_enum("logic.sensor_add", "type", text="Sensor")
         layout.operator_menu_enum("logic.controller_add", "type", text="Controller")
         layout.operator_menu_enum("logic.actuator_add", "type", text="Actuator")
+        
+
+class LOGIC_HT_header(bpy.types.Header):
+    bl_space_type = 'LOGIC_EDITOR'
+
+    def draw(self, context):
+        layout = self.layout
+
+        st = context.space_data
+
+        row = layout.row(align=True)
+        row.template_header()
+
+        if context.area.show_menus:
+            sub = row.row(align=True)
+            sub.menu("LOGIC_MT_view")
+            #sub.menu("LOGIC_MT_select")
+            #sub.menu("LOGIC_MT_add")
+        
+
+class LOGIC_MT_view(bpy.types.Menu):
+    bl_label = "View"
+
+    def draw(self, context):
+        layout = self.layout
+
+        layout.column()
+        
+        layout.operator("logic.properties", icon='MENU_PANEL')
+
 
 classes = [
-    LOGIC_PT_properties, LOGIC_MT_logicbricks_add]
+    LOGIC_HT_header,
+    LOGIC_MT_view,
+    
+    LOGIC_PT_properties,
+    LOGIC_MT_logicbricks_add]
 
 
 def register():
index 365835009ba03ebf922040aff8478dd3803dc2b2..21b2ebc5390889b40ede4677db70eaf510519a77 100644 (file)
@@ -90,6 +90,13 @@ class NODE_MT_view(bpy.types.Menu):
 
         layout.operator("node.view_all")
 
+        if context.space_data.backdrop:
+            layout.separator()
+            
+            layout.operator("node.backimage_move",text = "Backdrop move")
+            layout.operator("node.backimage_zoom",text = "Backdrop zoom in").factor = 1.2
+            layout.operator("node.backimage_zoom",text = "Backdrop zoom out").factor = 0.833
+        
         layout.separator()
 
         layout.operator("screen.area_dupli")
@@ -131,6 +138,7 @@ class NODE_MT_node(bpy.types.Menu):
         layout.separator()
         layout.operator("node.link_make")
         layout.operator("node.link_make", text="Make and Replace Links").replace = True
+        layout.operator("node.links_cut")
 
         layout.separator()
         layout.operator("node.group_edit")
index ba17b13775a3fec190de99d0da3d0df35a47d096..adf80635bc1cae7977b13e6d348cac96aeef765b 100644 (file)
@@ -98,6 +98,10 @@ class SEQUENCER_MT_view(bpy.types.Menu):
         st = context.space_data
 
         layout.column()
+        
+        layout.operator("sequencer.properties", icon='MENU_PANEL')
+        
+        layout.separator()
 
         """
     uiBlock *block= uiBeginBlock(C, ar, "seq_viewmenu", UI_EMBOSSP);
@@ -127,7 +131,6 @@ class SEQUENCER_MT_view(bpy.types.Menu):
              menuwidth, 19, NULL, 0.0, 0.0, 1, 2, "");
 
         """
-        layout.separator()
         if (st.view_type == 'SEQUENCER') or (st.view_type == 'SEQUENCER_PREVIEW'):
             layout.operator("sequencer.view_all", text='View all Sequences')
         if (st.view_type == 'PREVIEW') or (st.view_type == 'SEQUENCER_PREVIEW'):
@@ -357,7 +360,6 @@ class SEQUENCER_PT_edit(SequencerButtonsPanel):
         sub = row.row()
         sub.active = (not strip.mute)
         sub.prop(strip, "blend_opacity", text="Opacity", slider=True)
-        sub = row.row()
         row.prop(strip, "mute", toggle=True, icon='RESTRICT_VIEW_ON' if strip.mute else 'RESTRICT_VIEW_OFF', text="")
         row.prop(strip, "lock", toggle=True, icon='LOCKED' if strip.lock else 'UNLOCKED', text="")
 
@@ -379,30 +381,6 @@ class SEQUENCER_PT_edit(SequencerButtonsPanel):
         col.label(text="Frame Still %d:%d" % (strip.frame_still_start, strip.frame_still_end))
 
 
-class SEQUENCER_PT_preview(bpy.types.Panel):
-    bl_label = "Scene Preview/Render"
-    bl_space_type = 'SEQUENCE_EDITOR'
-    bl_region_type = 'UI'
-
-    def draw(self, context):
-        layout = self.layout
-        render = context.scene.render
-
-        col = layout.column()
-        col.prop(render, "use_sequencer_gl_preview", text="Open GL Preview")
-        col = layout.column()
-        col.active = render.use_sequencer_gl_preview
-        col.prop(render, "sequencer_gl_preview", text="")
-
-        '''
-        col = layout.column()
-        col.prop(render, "use_sequencer_gl_render", text="Open GL Render")
-        col = layout.column()
-        col.active = render.use_sequencer_gl_render
-        col.prop(render, "sequencer_gl_render", text="")
-        '''
-
-
 class SEQUENCER_PT_effect(SequencerButtonsPanel):
     bl_label = "Effect Strip"
 
@@ -816,6 +794,30 @@ class SEQUENCER_PT_proxy(SequencerButtonsPanel):
                 flow.prop(strip.proxy, "filepath")
 
 
+class SEQUENCER_PT_preview(SequencerButtonsPanel_Output):
+    bl_label = "Scene Preview/Render"
+    bl_space_type = 'SEQUENCE_EDITOR'
+    bl_region_type = 'UI'
+
+    def draw(self, context):
+        layout = self.layout
+        render = context.scene.render
+
+        col = layout.column()
+        col.prop(render, "use_sequencer_gl_preview", text="Open GL Preview")
+        col = layout.column()
+        col.active = render.use_sequencer_gl_preview
+        col.prop(render, "sequencer_gl_preview", text="")
+
+        '''
+        col = layout.column()
+        col.prop(render, "use_sequencer_gl_render", text="Open GL Render")
+        col = layout.column()
+        col.active = render.use_sequencer_gl_render
+        col.prop(render, "sequencer_gl_render", text="")
+        '''
+
+
 class SEQUENCER_PT_view(SequencerButtonsPanel_Output):
     bl_label = "View Settings"
 
@@ -843,7 +845,6 @@ classes = [
     SEQUENCER_MT_strip,
 
     SEQUENCER_PT_edit, # sequencer panels
-    SEQUENCER_PT_preview,
     SEQUENCER_PT_effect,
     SEQUENCER_PT_input_movie,
     SEQUENCER_PT_input_image,
@@ -853,6 +854,7 @@ classes = [
     SEQUENCER_PT_filter,
     SEQUENCER_PT_proxy,
 
+    SEQUENCER_PT_preview,
     SEQUENCER_PT_view] # view panels
 
 
index 692f1581bd6b7d7b59d0592256740b19f5756b66..552621d87c6cfbca6317f85ccba3686b3c089dfe 100644 (file)
@@ -34,6 +34,7 @@ class TEXT_HT_header(bpy.types.Header):
 
         if context.area.show_menus:
             sub = row.row(align=True)
+            sub.menu("TEXT_MT_view")
             sub.menu("TEXT_MT_text")
             if text:
                 sub.menu("TEXT_MT_edit")
@@ -127,6 +128,20 @@ class TEXT_PT_find(bpy.types.Panel):
         row.prop(st, "find_all", text="All")
 
 
+class TEXT_MT_view(bpy.types.Menu):
+    bl_label = "View"
+    
+    def draw(self, context):
+        layout = self.layout
+        
+        layout.operator("text.properties", icon='MENU_PANEL')
+        
+        layout.separator()
+
+        layout.operator("screen.area_dupli")
+        layout.operator("screen.screen_full_area")
+        
+        
 class TEXT_MT_text(bpy.types.Menu):
     bl_label = "Text"
 
@@ -160,15 +175,8 @@ class TEXT_MT_text(bpy.types.Menu):
 
         layout.separator()
 
-        layout.operator("text.properties", icon='MENU_PANEL')
-
         layout.menu("TEXT_MT_templates")
 
-        layout.separator()
-
-        layout.operator("screen.area_dupli")
-        layout.operator("screen.screen_full_area")
-
 
 class TEXT_MT_templates(bpy.types.Menu):
     '''
@@ -294,6 +302,7 @@ classes = [
     TEXT_HT_header,
     TEXT_PT_properties,
     TEXT_PT_find,
+    TEXT_MT_view,
     TEXT_MT_text,
     TEXT_MT_templates,
     TEXT_MT_format,
index b3629b03c2278180e9f7171f8fdabef5b5721cb0..7929aa64df7cbf05d4d5eeaf3ccb9f0b92eb7da4 100644 (file)
@@ -327,16 +327,9 @@ class USERPREF_PT_edit(bpy.types.Panel):
         row.separator()
         row.separator()
 
-        sculpt = context.tool_settings.sculpt
         col = row.column()
-        col.label(text="Paint and Sculpt:")
-        col.prop(edit, "sculpt_paint_use_unified_size", text="Unify Size")
-        col.prop(edit, "sculpt_paint_use_unified_strength", text="Unify Strength")
         row = col.row(align=True)
-        row.label("Overlay Color:")
-        row.prop(edit, "sculpt_paint_overlay_col", text="")
-        col.prop(sculpt, "use_openmp", text="Threaded Sculpt")
-        col.prop(sculpt, "show_brush")
+        row.prop(edit, "sculpt_paint_overlay_col", text="Sculpt Overlay Color")
 
         col.separator()
         col.separator()
@@ -829,14 +822,23 @@ class USERPREF_PT_addons(bpy.types.Panel):
     @staticmethod
     def _addon_list():
         import sys
+        import time
+
         modules = []
         loaded_modules = set()
         paths = bpy.utils.script_paths("addons")
+
+        if bpy.app.debug:
+            t_main = time.time()
+
         # sys.path.insert(0, None)
         for path in paths:
             # sys.path[0] = path
             modules.extend(bpy.utils.modules_from_path(path, loaded_modules))
 
+        if bpy.app.debug:
+            print("Addon Script Load Time %.4f" % (time.time() - t_main))
+
         # del sys.path[0]
         return modules
 
index 12b3c508ac20b391e58768fda9732c941c92aa0e..5d22c3b41bb7d07272e97ad0b1ee9b2ff4e55123 100644 (file)
@@ -1001,8 +1001,9 @@ class VIEW3D_MT_sculpt(bpy.types.Menu):
     def draw(self, context):
         layout = self.layout
 
-        sculpt = context.tool_settings.sculpt
-        brush = context.tool_settings.sculpt.brush
+        tool_settings = context.tool_settings
+        sculpt = tool_settings.sculpt
+        brush = tool_settings.sculpt.brush
 
         layout.prop(sculpt, "symmetry_x")
         layout.prop(sculpt, "symmetry_y")
@@ -1024,12 +1025,20 @@ class VIEW3D_MT_sculpt(bpy.types.Menu):
                 layout.prop(brush, "use_anchor")
 
             if sculpt_tool in ('DRAW', 'PINCH', 'INFLATE', 'LAYER', 'CLAY'):
-                layout.prop(brush, "flip_direction")
+                layout.prop(brush, "direction")
 
             if sculpt_tool == 'LAYER':
                 layout.prop(brush, "use_persistent")
                 layout.operator("sculpt.set_persistent_base")
 
+        layout.separator()
+        layout.prop(sculpt, "use_openmp", text="Threaded Sculpt")
+        layout.prop(sculpt, "show_brush")
+
+        # TODO, make availabel from paint menu!
+        layout.prop(tool_settings, "sculpt_paint_use_unified_size", text="Unify Size")
+        layout.prop(tool_settings, "sculpt_paint_use_unified_strength", text="Unify Strength")
+
 # ********** Particle menu **********
 
 
index 9d3c26891af38c5cae64605409a8030ccf0cdbd5..ebf9f8e5af3c7ad2373c37506cf08baf314e8b15 100644 (file)
@@ -643,29 +643,9 @@ class VIEW3D_PT_tools_brush(PaintPanel):
             row= col.row()
             row.prop(brush, "use_frontface", text="Front Faces Only")
 
-            #if brush.sculpt_tool in ('DRAW', 'CREASE', 'BLOB', 'LAYER', 'CLAY', 'CLAY_TUBES'):
-            if brush.sculpt_tool in ('DRAW', 'CREASE', 'BLOB', 'LAYER', 'CLAY'):
-                col.separator()
-                col.row().prop(brush, "direction", expand=True)
-            elif brush.sculpt_tool in ('FLATTEN'):
-                col.separator()
-                col.row().prop(brush, "flatten_contrast", expand=True)
-            elif brush.sculpt_tool in ('FILL'):
-                col.separator()
-                col.row().prop(brush, "fill_deepen", expand=True)
-            elif brush.sculpt_tool in ('SCRAPE'):
-                col.separator()
-                col.row().prop(brush, "scrape_peaks", expand=True)
-            elif brush.sculpt_tool in ('INFLATE'):
-                col.separator()
-                col.row().prop(brush, "inflate_deflate", expand=True)
-            elif brush.sculpt_tool in ('PINCH'):
-                col.separator()
-                col.row().prop(brush, "pinch_magnify", expand=True)
-
-
+            col.separator()
+            col.row().prop(brush, "direction", expand=True)
 
-            #if brush.sculpt_tool in ('DRAW', 'CREASE', 'BLOB', 'INFLATE', 'LAYER', 'CLAY', 'CLAY_TUBES'):
             if brush.sculpt_tool in ('DRAW', 'CREASE', 'BLOB', 'INFLATE', 'LAYER', 'CLAY'):
                 col.separator()
 
@@ -879,6 +859,7 @@ class VIEW3D_PT_tools_brush_tool(PaintPanel):
 
         if context.sculpt_object:
             col.prop(brush, "sculpt_tool", expand=False, text="")
+            col.operator("brush.reset")
         elif context.texture_paint_object:
             col.prop(brush, "imagepaint_tool", expand=False, text="")
         elif context.vertex_paint_object or context.weight_paint_object:
@@ -1005,7 +986,6 @@ class VIEW3D_PT_tools_brush_curve(PaintPanel):
         row.operator("brush.curve_preset", icon="SHARPCURVE", text="").shape = 'SHARP'
         row.operator("brush.curve_preset", icon="LINCURVE", text="").shape = 'LINE'
         row.operator("brush.curve_preset", icon="NOCURVE", text="").shape = 'MAX'
-        row.operator("brush.curve_preset", icon="RNDCURVE", text="").shape = 'MID9'
 
 class VIEW3D_PT_sculpt_options(PaintPanel):
     bl_label = "Options"
@@ -1028,6 +1008,10 @@ class VIEW3D_PT_sculpt_options(PaintPanel):
 
         col = split.column()
 
+        col.prop(sculpt, "use_openmp", text="Threaded Sculpt")
+        col.prop(sculpt, "fast_navigate")
+        col.prop(sculpt, "show_brush")
+
         col.label(text="Unified Settings:")
         col.prop(tool_settings, "sculpt_paint_use_unified_size", text="Size")
         col.prop(tool_settings, "sculpt_paint_use_unified_strength", text="Strength")
@@ -1043,6 +1027,8 @@ class VIEW3D_PT_sculpt_options(PaintPanel):
         row.prop(sculpt, "lock_y", text="Y", toggle=True)
         row.prop(sculpt, "lock_z", text="Z", toggle=True)
 
+               
+               
 class VIEW3D_PT_sculpt_symmetry(PaintPanel):
     bl_label = "Symmetry"
     bl_default_closed = True
@@ -1107,16 +1093,14 @@ class VIEW3D_PT_tools_brush_appearance(PaintPanel):
         else:
             col.prop(brush, "add_col", text="Color")
 
-        col.separator()
-
         col = layout.column()
         col.label(text="Icon:")
 
         row = col.row(align=True)
-        row.prop(brush, "icon", text="")
-
-        row = col.row(align=True)
-        row.prop(brush, "icon_filepath", text="")
+        row.prop(brush, "use_custom_icon")
+        if brush.use_custom_icon:
+            row = col.row(align=True)
+            row.prop(brush, "icon_filepath", text="")
 
 # ********** default tools for weightpaint ****************
 
diff --git a/release/windows/installer/01.installer.bmp b/release/windows/installer/01.installer.bmp
new file mode 100644 (file)
index 0000000..10fb014
Binary files /dev/null and b/release/windows/installer/01.installer.bmp differ
index 2c661a745732059e79f803c35d920d8cd099f20a..242de4d788bef5e23952dd34d23026712180c611 100644 (file)
@@ -80,7 +80,6 @@ void free_armature(struct bArmature *arm);
 void make_local_armature(struct bArmature *arm);
 struct bArmature *copy_armature(struct bArmature *arm);
 
-void bone_flip_name (char *name, int strip_number);
 int bone_autoside_name (char *name, int strip_number, short axis, float head, float tail);
 
 struct Bone *get_named_bone (struct bArmature *arm, const char *name);
index 4e299accffcec26374c05e402b44c1961e4613f6..189cd61d5a8c7901a93ae639ce4b4be91b7b5b6b 100644 (file)
@@ -45,7 +45,7 @@ struct Scene;
 struct Main;
 
 #define BLENDER_VERSION                        253
-#define BLENDER_SUBVERSION             0
+#define BLENDER_SUBVERSION             1
 
 #define BLENDER_MINVERSION             250
 #define BLENDER_MINSUBVERSION  0
index 3ad902c41feea6e998f18f41401e36a21c7997a7..3afcfddfea38f380395f1bf1d179e38b2bca1a49 100644 (file)
@@ -44,6 +44,8 @@ struct Brush *copy_brush(struct Brush *brush);
 void make_local_brush(struct Brush *brush);
 void free_brush(struct Brush *brush);
 
+void brush_reset_sculpt(struct Brush *brush);
+
 /* image icon function */
 struct ImBuf *get_brush_icon(struct Brush *brush);
 
index 1f2dee6dcfc6c6ced7492a62f80f0d79d02b5c6b..e0ebedb320b208b482a4ff40d1cefec867470044 100644 (file)
@@ -53,9 +53,11 @@ void                         curvemapping_free(struct CurveMapping *cumap);
 struct CurveMapping    *curvemapping_copy(struct CurveMapping *cumap);
 void                           curvemapping_set_black_white(struct CurveMapping *cumap, float *black, float *white);
 
+#define CURVEMAP_SLOPE_NEGATIVE        0
+#define CURVEMAP_SLOPE_POSITIVE        1
+void                           curvemap_reset(struct CurveMap *cuma, struct rctf *clipr, int preset, int slope);
 void                           curvemap_remove(struct CurveMap *cuma, int flag);
 void                           curvemap_insert(struct CurveMap *cuma, float x, float y);
-void                           curvemap_reset(struct CurveMap *cuma, struct rctf *clipr, int preset);
 void                           curvemap_sethandle(struct CurveMap *cuma, int type);
 
 void                           curvemapping_changed(struct CurveMapping *cumap, int rem_doubles);
index d7eb5fe824675143afea05e40c3ad494176632bd..c842efaa3b2440f143f0e47de2477e5d7bf617d9 100644 (file)
@@ -159,7 +159,7 @@ void BKE_image_memorypack(struct Image *ima);
 void BKE_image_print_memlist(void);
 
 /* empty image block, of similar type and filename */
-struct Image *BKE_image_copy(struct Image *ima);
+struct Image *copy_image(struct Image *ima);
 
 /* merge source into dest, and free source */
 void BKE_image_merge(struct Image *dest, struct Image *source);
index f9954b3d55d37054b9c15908b7e180e6462181fd..95293f16d9d6487bbe3482f3efe8d8edfec6b102 100644 (file)
@@ -60,6 +60,8 @@ void paint_brush_slot_remove(struct Paint *p);
  * however hiding faces is useful */
 int paint_facesel_test(struct Object *ob);
 
+int paint_has_brush(struct Paint *p, struct Brush *brush);
+
 /* Session data (mode-specific) */
 
 typedef struct SculptSession {
index 81ae83cafb670e060359978496e4fffdf3fdce41..b544b3461cdfaad2db7906056013bac8b2b38610 100644 (file)
@@ -107,15 +107,14 @@ struct SeqEffectHandle {
        0: no early out, 
        1: out = ibuf1, 
        2: out = ibuf2 */
-       int (*early_out)(struct Sequence *seq,
-                                        float facf0, float facf1); 
+       int (*early_out)(struct Sequence *seq, float facf0, float facf1); 
        
        /* stores the y-range of the effect IPO */
        void (*store_icu_yrange)(struct Sequence * seq,
                                  short adrcode, float *ymin, float *ymax);
        
        /* stores the default facf0 and facf1 if no IPO is present */
-       void (*get_default_fac)(struct Sequence *seq, int cfra,
+       void (*get_default_fac)(struct Sequence *seq, float cfra,
                                 float * facf0, float * facf1);
        
        /* execute the effect
@@ -123,11 +122,12 @@ struct SeqEffectHandle {
            float-rects or byte-rects 
            (mixed cases are handled one layer up...) */
        
-       void (*execute)(struct Scene *scene, struct Sequence *seq, int cfra,
-                        float facf0, float facf1,
-                        int x, int y, int preview_render_size,
-                        struct ImBuf *ibuf1, struct ImBuf *ibuf2,
-                        struct ImBuf *ibuf3, struct ImBuf *out);
+       struct ImBuf* (*execute)(
+               struct Scene *scene, struct Sequence *seq, float cfra,
+               float facf0, float facf1,
+               int x, int y, int preview_render_size,
+               struct ImBuf *ibuf1, struct ImBuf *ibuf2,
+               struct ImBuf *ibuf3);
 };
 
 /* ********************* prototypes *************** */
@@ -164,6 +164,10 @@ struct StripElem *give_stripelem(struct Sequence *seq, int cfra);
 // intern?
 void update_changed_seq_and_deps(struct Scene *scene, struct Sequence *changed_seq, int len_change, int ibuf_change);
 
+int input_have_to_preprocess(
+       struct Scene *scene, struct Sequence * seq, 
+       float cfra, int seqrectx, int seqrecty);
+
 /* seqcache.c */
 
 typedef enum {
index 244fffa06ea737c6df5edfec2936bc28999c8c05..bcda86fdae41b6db2be590c745af5acb2db0373a 100644 (file)
@@ -92,7 +92,7 @@ void  unindent                (struct Text *text);
 void   comment                 (struct Text *text);
 void   indent                  (struct Text *text);
 void   uncomment               (struct Text *text);
-int    setcurr_tab             (struct Text *text);
+int    setcurr_tab_spaces      (struct Text *text, int space);
 
 void   txt_add_marker                                          (struct Text *text, struct TextLine *line, int start, int end, char color[4], int group, int flags);
 short  txt_clear_marker_region                         (struct Text *text, struct TextLine *line, int start, int end, int group, int flags);
index 39c12a2bfd875ea9be70c1d83c4b3beef15c03ae..380672dae04adf6e6401ebbc594db1e043e7ff50 100644 (file)
@@ -61,6 +61,9 @@ void init_colorband(struct ColorBand *coba, int rangetype);
 struct ColorBand *add_colorband(int rangetype);
 int do_colorband(struct ColorBand *coba, float in, float out[4]);
 void colorband_table_RGBA(struct ColorBand *coba, float **array, int *size);
+int vergcband(const void *a1, const void *a2);
+struct CBData *colorband_element_add(struct ColorBand *coba, float position);
+int colorband_element_remove(struct ColorBand *coba, int index);
 
 void default_tex(struct Tex *tex);
 struct Tex *add_texture(const char *name);
index 990993b1077f2748acc57285a7f57264d63ef425..b9b171780c78cd3ca2fa4df75a2c0f504a517ae6 100644 (file)
@@ -245,117 +245,6 @@ Bone *get_named_bone (bArmature *arm, const char *name)
        return bone;
 }
 
-
-#define IS_SEPARATOR(a)        (a=='.' || a==' ' || a=='-' || a=='_')
-
-/* finds the best possible flipped name. For renaming; check for unique names afterwards */
-/* if strip_number: removes number extensions */
-void bone_flip_name (char *name, int strip_number)
-{
-       int             len;
-       char    prefix[128]={""};       /* The part before the facing */
-       char    suffix[128]={""};       /* The part after the facing */
-       char    replace[128]={""};      /* The replacement string */
-       char    number[128]={""};       /* The number extension string */
-       char    *index=NULL;
-
-       len= strlen(name);
-       if(len<3) return;       // we don't do names like .R or .L
-
-       /* We first check the case with a .### extension, let's find the last period */
-       if(isdigit(name[len-1])) {
-               index= strrchr(name, '.');      // last occurrence
-               if (index && isdigit(index[1]) ) {              // doesnt handle case bone.1abc2 correct..., whatever!
-                       if(strip_number==0) 
-                               strcpy(number, index);
-                       *index= 0;
-                       len= strlen(name);
-               }
-       }
-
-       strcpy (prefix, name);
-
-       /* first case; separator . - _ with extensions r R l L  */
-       if( IS_SEPARATOR(name[len-2]) ) {
-               switch(name[len-1]) {
-                       case 'l':
-                               prefix[len-1]= 0;
-                               strcpy(replace, "r");
-                               break;
-                       case 'r':
-                               prefix[len-1]= 0;
-                               strcpy(replace, "l");
-                               break;
-                       case 'L':
-                               prefix[len-1]= 0;
-                               strcpy(replace, "R");
-                               break;
-                       case 'R':
-                               prefix[len-1]= 0;
-                               strcpy(replace, "L");
-                               break;
-               }
-       }
-       /* case; beginning with r R l L , with separator after it */
-       else if( IS_SEPARATOR(name[1]) ) {
-               switch(name[0]) {
-                       case 'l':
-                               strcpy(replace, "r");
-                               strcpy(suffix, name+1);
-                               prefix[0]= 0;
-                               break;
-                       case 'r':
-                               strcpy(replace, "l");
-                               strcpy(suffix, name+1);
-                               prefix[0]= 0;
-                               break;
-                       case 'L':
-                               strcpy(replace, "R");
-                               strcpy(suffix, name+1);
-                               prefix[0]= 0;
-                               break;
-                       case 'R':
-                               strcpy(replace, "L");
-                               strcpy(suffix, name+1);
-                               prefix[0]= 0;
-                               break;
-               }
-       }
-       else if(len > 5) {
-               /* hrms, why test for a separator? lets do the rule 'ultimate left or right' */
-               index = BLI_strcasestr(prefix, "right");
-               if (index==prefix || index==prefix+len-5) {
-                       if(index[0]=='r') 
-                               strcpy (replace, "left");
-                       else {
-                               if(index[1]=='I') 
-                                       strcpy (replace, "LEFT");
-                               else
-                                       strcpy (replace, "Left");
-                       }
-                       *index= 0;
-                       strcpy (suffix, index+5);
-               }
-               else {
-                       index = BLI_strcasestr(prefix, "left");
-                       if (index==prefix || index==prefix+len-4) {
-                               if(index[0]=='l') 
-                                       strcpy (replace, "right");
-                               else {
-                                       if(index[1]=='E') 
-                                               strcpy (replace, "RIGHT");
-                                       else
-                                               strcpy (replace, "Right");
-                               }
-                               *index= 0;
-                               strcpy (suffix, index+4);
-                       }
-               }               
-       }
-
-       sprintf (name, "%s%s%s%s", prefix, replace, suffix, number);
-}
-
 /* Finds the best possible extension to the name on a particular axis. (For renaming, check for unique names afterwards)
  * This assumes that bone names are at most 32 chars long!
  *     strip_number: removes number extensions  (TODO: not used)
index 23a221cadf489cbdb3fcab65266dca8888ee31b8..b9d7ea177d4fee2637743a08902f6de4867617d8 100644 (file)
 #include "RE_render_ext.h" /* externtex */
 #include "RE_shader_ext.h"
 
-/* Datablock add/copy/free/make_local */
-
-Brush *add_brush(const char *name)
+static void brush_set_defaults(Brush *brush)
 {
-       Brush *brush;
-
-       brush= alloc_libblock(&G.main->brush, ID_BR, name);
+       brush->blend = 0;
+       brush->flag = 0;
 
        /* BRUSH SCULPT TOOL SETTINGS */
-       brush->sculpt_tool = SCULPT_TOOL_DRAW; /* sculpting defaults to the draw tool for new brushes */
        brush->size= 35; /* radius of the brush in pixels */
        brush->alpha= 0.5f; /* brush strength/intensity probably variable should be renamed? */
        brush->autosmooth_factor= 0.0f;
        brush->crease_pinch_factor= 0.5f;
-       brush->sculpt_plane = SCULPT_DISP_DIR_VIEW;
+       brush->sculpt_plane = SCULPT_DISP_DIR_AREA;
        brush->plane_offset= 0.0f; /* how far above or below the plane that is found by averaging the faces */
        brush->plane_trim= 0.5f;
        brush->clone.alpha= 0.5f;
        brush->normal_weight= 0.0f;
+       brush->flag |= BRUSH_ALPHA_PRESSURE;
 
        /* BRUSH PAINT TOOL SETTINGS */
        brush->rgb[0]= 1.0f; /* default rgb color of the brush when painting - white */
@@ -102,6 +99,7 @@ Brush *add_brush(const char *name)
        default_mtex(&brush->mtex);
 
        brush->texture_sample_bias= 0; /* value to added to texture samples */
+       brush->texture_overlay_alpha= 33;
 
        /* brush appearance  */
 
@@ -112,6 +110,19 @@ Brush *add_brush(const char *name)
        brush->sub_col[0]= 0.39; /* subtract mode color is light blue */
        brush->sub_col[1]= 0.39;
        brush->sub_col[2]= 1.00;
+}
+
+/* Datablock add/copy/free/make_local */
+
+Brush *add_brush(const char *name)
+{
+       Brush *brush;
+
+       brush= alloc_libblock(&G.main->brush, ID_BR, name);
+
+       brush_set_defaults(brush);
+
+       brush->sculpt_tool = SCULPT_TOOL_DRAW; /* sculpting defaults to the draw tool for new brushes */
 
         /* the default alpha falloff curve */
        brush_curve_preset(brush, CURVE_PRESET_SMOOTH);
@@ -212,6 +223,175 @@ void make_local_brush(Brush *brush)
        }
 }
 
+void brush_debug_print_state(Brush *br)
+{
+       Brush def;
+
+       /* create a fake brush and set it to the defaults */
+       memset(&def, 0, sizeof(Brush));
+       brush_set_defaults(&def);
+       
+#define BR_TEST(field, t)                                      \
+       if(br->field != def.field)                              \
+               printf("br->" #field " = %" #t ";\n", br->field)
+
+#define BR_TEST_FLAG(_f)                               \
+       if((br->flag & _f) && !(def.flag & _f))         \
+               printf("br->flag |= " #_f ";\n");       \
+       else if(!(br->flag & _f) && (def.flag & _f))    \
+               printf("br->flag &= ~" #_f ";\n")
+       
+
+       /* print out any non-default brush state */
+       BR_TEST(normal_weight, f);
+
+       BR_TEST(blend, d);
+       BR_TEST(size, d);
+
+       /* br->flag */
+       BR_TEST_FLAG(BRUSH_AIRBRUSH);
+       BR_TEST_FLAG(BRUSH_TORUS);
+       BR_TEST_FLAG(BRUSH_ALPHA_PRESSURE);
+       BR_TEST_FLAG(BRUSH_SIZE_PRESSURE);
+       BR_TEST_FLAG(BRUSH_JITTER_PRESSURE);
+       BR_TEST_FLAG(BRUSH_SPACING_PRESSURE);
+       BR_TEST_FLAG(BRUSH_FIXED_TEX);
+       BR_TEST_FLAG(BRUSH_RAKE);
+       BR_TEST_FLAG(BRUSH_ANCHORED);
+       BR_TEST_FLAG(BRUSH_DIR_IN);
+       BR_TEST_FLAG(BRUSH_SPACE);
+       BR_TEST_FLAG(BRUSH_SMOOTH_STROKE);
+       BR_TEST_FLAG(BRUSH_PERSISTENT);
+       BR_TEST_FLAG(BRUSH_ACCUMULATE);
+       BR_TEST_FLAG(BRUSH_LOCK_ALPHA);
+       BR_TEST_FLAG(BRUSH_ORIGINAL_NORMAL);
+       BR_TEST_FLAG(BRUSH_OFFSET_PRESSURE);
+       BR_TEST_FLAG(BRUSH_SPACE_ATTEN);
+       BR_TEST_FLAG(BRUSH_ADAPTIVE_SPACE);
+       BR_TEST_FLAG(BRUSH_LOCK_SIZE);
+       BR_TEST_FLAG(BRUSH_TEXTURE_OVERLAY);
+       BR_TEST_FLAG(BRUSH_EDGE_TO_EDGE);
+       BR_TEST_FLAG(BRUSH_RESTORE_MESH);
+       BR_TEST_FLAG(BRUSH_INVERSE_SMOOTH_PRESSURE);
+       BR_TEST_FLAG(BRUSH_RANDOM_ROTATION);
+       BR_TEST_FLAG(BRUSH_PLANE_TRIM);
+       BR_TEST_FLAG(BRUSH_FRONTFACE);
+       BR_TEST_FLAG(BRUSH_CUSTOM_ICON);
+
+       BR_TEST(jitter, f);
+       BR_TEST(spacing, d);
+       BR_TEST(smooth_stroke_radius, d);
+       BR_TEST(smooth_stroke_factor, f);
+       BR_TEST(rate, f);
+
+       BR_TEST(alpha, f);
+
+       BR_TEST(sculpt_plane, d);
+
+       BR_TEST(plane_offset, f);
+
+       BR_TEST(autosmooth_factor, f);
+
+       BR_TEST(crease_pinch_factor, f);
+
+       BR_TEST(plane_trim, f);
+
+       BR_TEST(texture_sample_bias, f);
+       BR_TEST(texture_overlay_alpha, d);
+
+       BR_TEST(add_col[0], f);
+       BR_TEST(add_col[1], f);
+       BR_TEST(add_col[2], f);
+       BR_TEST(sub_col[0], f);
+       BR_TEST(sub_col[1], f);
+       BR_TEST(sub_col[2], f);
+
+       printf("\n");
+       
+#undef BR_TEST
+#undef BR_TEST_FLAG
+}
+
+void brush_reset_sculpt(Brush *br)
+{
+       /* enable this to see any non-default
+          settings used by a brush:
+
+          brush_debug_print_state(br);
+       */
+
+       brush_set_defaults(br);
+       brush_curve_preset(br, CURVE_PRESET_SMOOTH);
+
+       switch(br->sculpt_tool) {
+       case SCULPT_TOOL_CLAY:
+               br->flag |= BRUSH_FRONTFACE;
+               break;
+       case SCULPT_TOOL_CREASE:
+               br->flag |= BRUSH_DIR_IN;
+               br->alpha = 0.25;
+               break;
+       case SCULPT_TOOL_FILL:
+               br->add_col[1] = 1;
+               br->sub_col[0] = 0.25;
+               br->sub_col[1] = 1;
+               break;
+       case SCULPT_TOOL_FLATTEN:
+               br->add_col[1] = 1;
+               br->sub_col[0] = 0.25;
+               br->sub_col[1] = 1;
+               break;
+       case SCULPT_TOOL_INFLATE:
+               br->add_col[0] = 0.750000;
+               br->add_col[1] = 0.750000;
+               br->add_col[2] = 0.750000;
+               br->sub_col[0] = 0.250000;
+               br->sub_col[1] = 0.250000;
+               br->sub_col[2] = 0.250000;
+               break;
+       case SCULPT_TOOL_NUDGE:
+               br->add_col[0] = 0.250000;
+               br->add_col[1] = 1.000000;
+               br->add_col[2] = 0.250000;
+               break;
+       case SCULPT_TOOL_PINCH:
+               br->add_col[0] = 0.750000;
+               br->add_col[1] = 0.750000;
+               br->add_col[2] = 0.750000;
+               br->sub_col[0] = 0.250000;
+               br->sub_col[1] = 0.250000;
+               br->sub_col[2] = 0.250000;
+               break;
+       case SCULPT_TOOL_SCRAPE:
+               br->add_col[1] = 1.000000;
+               br->sub_col[0] = 0.250000;
+               br->sub_col[1] = 1.000000;
+               break;
+       case SCULPT_TOOL_ROTATE:
+               break;
+       case SCULPT_TOOL_SMOOTH:
+               br->flag &= ~BRUSH_SPACE_ATTEN;
+               br->spacing = 5;
+               br->add_col[0] = 0.750000;
+               br->add_col[1] = 0.750000;
+               br->add_col[2] = 0.750000;
+               break;
+       case SCULPT_TOOL_GRAB:
+       case SCULPT_TOOL_SNAKE_HOOK:
+       case SCULPT_TOOL_THUMB:
+               br->size = 75;
+               br->flag &= ~BRUSH_ALPHA_PRESSURE;
+               br->flag &= ~BRUSH_SPACE;
+               br->flag &= ~BRUSH_SPACE_ATTEN;
+               br->add_col[0] = 0.250000;
+               br->add_col[1] = 1.000000;
+               br->add_col[2] = 0.250000;
+               break;
+       default:
+               break;
+       }
+}
+
 /* Library Operations */
 
 int brush_set_nr(Brush **current_brush, int nr, const char *name)
@@ -272,7 +452,7 @@ void brush_curve_preset(Brush *b, /*CurveMappingPreset*/int preset)
        cm->flag &= ~CUMA_EXTEND_EXTRAPOLATE;
 
        b->curve->preset = preset;
-       curvemap_reset(cm, &b->curve->clipr, b->curve->preset);
+       curvemap_reset(cm, &b->curve->clipr, b->curve->preset, CURVEMAP_SLOPE_NEGATIVE);
        curvemapping_changed(b->curve, 0);
 }
 
@@ -862,7 +1042,6 @@ int brush_painter_paint(BrushPainter *painter, BrushFunc func, float *pos, doubl
                float startdistance, spacing, step, paintpos[2], dmousepos[2], finalpos[2];
                float t, len, press;
                const int radius= brush_size(brush);
-               const int diameter= 2*radius;
 
                /* compute brush spacing adapted to brush radius, spacing may depend
                   on pressure, so update it */
@@ -1239,7 +1418,7 @@ void brush_set_size(Brush *brush, int size)
        else
                brush->size= size;
 
-       WM_main_add_notifier(NC_BRUSH|NA_EDITED, brush);
+       //WM_main_add_notifier(NC_BRUSH|NA_EDITED, brush);
 }
 
 int brush_size(Brush *brush)
@@ -1259,7 +1438,7 @@ void brush_set_use_locked_size(Brush *brush, int value)
                        brush->flag &= ~BRUSH_LOCK_SIZE;
        }
 
-       WM_main_add_notifier(NC_BRUSH|NA_EDITED, brush);
+       //WM_main_add_notifier(NC_BRUSH|NA_EDITED, brush);
 }
 
 int brush_use_locked_size(Brush *brush)
@@ -1279,7 +1458,7 @@ void brush_set_use_size_pressure(Brush *brush, int value)
                        brush->flag &= ~BRUSH_SIZE_PRESSURE;
        }
 
-       WM_main_add_notifier(NC_BRUSH|NA_EDITED, brush);
+       //WM_main_add_notifier(NC_BRUSH|NA_EDITED, brush);
 }
 
 int brush_use_size_pressure(Brush *brush)
@@ -1299,7 +1478,7 @@ void brush_set_use_alpha_pressure(Brush *brush, int value)
                        brush->flag &= ~BRUSH_ALPHA_PRESSURE;
        }
 
-       WM_main_add_notifier(NC_BRUSH|NA_EDITED, brush);
+       //WM_main_add_notifier(NC_BRUSH|NA_EDITED, brush);
 }
 
 int brush_use_alpha_pressure(Brush *brush)
@@ -1314,7 +1493,7 @@ void brush_set_unprojected_radius(Brush *brush, float unprojected_radius)
        else
                brush->unprojected_radius= unprojected_radius;
 
-       WM_main_add_notifier(NC_BRUSH|NA_EDITED, brush);
+       //WM_main_add_notifier(NC_BRUSH|NA_EDITED, brush);
 }
 
 float brush_unprojected_radius(Brush *brush)
@@ -1329,7 +1508,7 @@ void brush_set_alpha(Brush *brush, float alpha)
        else
                brush->alpha= alpha;
 
-       WM_main_add_notifier(NC_BRUSH|NA_EDITED, brush);
+       //WM_main_add_notifier(NC_BRUSH|NA_EDITED, brush);
 }
 
 float brush_alpha(Brush *brush)
index 41e33002999dffd8127c3f56d5a6162c355d8aeb..fb1e8c009915371c87e8631e0e93f13c32288578 100644 (file)
@@ -241,7 +241,8 @@ static void cdDM_drawVerts(DerivedMesh *dm)
        else {  /* use OpenGL VBOs or Vertex Arrays instead for better, faster rendering */
                GPU_vertex_setup(dm);
                if( !GPU_buffer_legacy(dm) ) {
-                       glDrawArrays(GL_POINTS,0,dm->drawObject->nelements);
+                       if(dm->drawObject->nelements)   glDrawArrays(GL_POINTS,0, dm->drawObject->nelements);
+                       else                                                    glDrawArrays(GL_POINTS,0, dm->drawObject->nlooseverts);
                }
                GPU_buffer_unbind();
        }
@@ -1673,6 +1674,11 @@ DerivedMesh *CDDM_from_template(DerivedMesh *source,
        CDDerivedMesh *cddm = cdDM_create("CDDM_from_template dest");
        DerivedMesh *dm = &cddm->dm;
 
+       /* ensure these are created if they are made on demand */
+       source->getVertDataArray(source, CD_ORIGINDEX);
+       source->getEdgeDataArray(source, CD_ORIGINDEX);
+       source->getFaceDataArray(source, CD_ORIGINDEX);
+
        /* this does a copy of all non mvert/medge/mface layers */
        DM_from_template(dm, source, DM_TYPE_CDDM, numVerts, numEdges, numFaces);
 
index a07c18f42f3b75d938cc328b9490c4d58c914edf..11801557c99944a9e769176606a283bb84310903 100644 (file)
@@ -236,7 +236,7 @@ void curvemap_insert(CurveMap *cuma, float x, float y)
        cuma->curve= cmp;
 }
 
-void curvemap_reset(CurveMap *cuma, rctf *clipr, int preset)
+void curvemap_reset(CurveMap *cuma, rctf *clipr, int preset, int slope)
 {
        if(cuma->curve)
                MEM_freeN(cuma->curve);
@@ -320,6 +320,20 @@ void curvemap_reset(CurveMap *cuma, rctf *clipr, int preset)
                        break;
        }
 
+       /* mirror curve in x direction to have positive slope
+        * rather than default negative slope */
+       if (slope == CURVEMAP_SLOPE_POSITIVE) {
+               int i, last=cuma->totpoint-1;
+               CurveMapPoint *newpoints= MEM_dupallocN(cuma->curve);
+               
+               for (i=0; i<cuma->totpoint; i++) {
+                       newpoints[i].y = cuma->curve[last-i].y;
+               }
+               
+               MEM_freeN(cuma->curve);
+               cuma->curve = newpoints;
+       }
+       
        if(cuma->table) {
                MEM_freeN(cuma->table);
                cuma->table= NULL;
index 171276d118ed572b75c6d49c1c92b8c5ccf1c2cd..aae70c055d097d5266c9deaf1280a35480d046a0 100644 (file)
@@ -1127,10 +1127,9 @@ static void kinematic_get_tarmat (bConstraint *con, bConstraintOb *cob, bConstra
                        else {
                                float vec[3];
                                /* move grabtarget into world space */
-                               VECCOPY(vec, data->grabtarget);
-                               mul_m4_v3(ob->obmat, vec);
+                               mul_v3_m4v3(vec, ob->obmat, data->grabtarget);
                                copy_m4_m4(ct->matrix, ob->obmat);
-                               VECCOPY(ct->matrix[3], vec);
+                               copy_v3_v3(ct->matrix[3], vec);
                        }
                }
                else
index ccb6ebe1f1eb22c9b1e954be0bab731092edb149..5f262c526c3f199ebd4146e6a7baf99ce0366076 100644 (file)
@@ -471,6 +471,7 @@ void flip_side_name (char *name, const char *from_name, int strip_number)
 #undef IS_SEPARATOR
 
        sprintf (name, "%s%s%s%s", prefix, replace, suffix, number);
+       printf("'%s' --> '%s'\n", from_name, name);
 }
 
 float defvert_find_weight(const struct MDeformVert *dvert, int group_num)
index ca659faa9727201239964b13a13053942d646d1e..1cb28fe56d8f82004b14cb767a1861f2ef037a24 100644 (file)
@@ -1326,7 +1326,6 @@ static void curve_calc_modifiers_post(Scene *scene, Object *ob, ListBase *dispba
        ModifierData *preTesselatePoint;
        Curve *cu= ob->data;
        ListBase *nurb= BKE_curve_nurbs(cu);
-       DispList *dl;
        int required_mode = 0, totvert = 0;
        int editmode = (!forRender && cu->editnurb);
        DerivedMesh *dm= NULL, *ndm;
index e9283ea867e59a8618d6a8d59c9a804d4e9b3cff..5f55814341ba092be7a60ffe87c941310a667140 100644 (file)
@@ -433,9 +433,8 @@ static float eff_calc_visibility(ListBase *colliders, EffectorCache *eff, Effect
 
        if(!colls)
                return visibility;
-       
-       VECCOPY(norm, efd->vec_to_point);
-       negate_v3(norm);
+
+       negate_v3_v3(norm, efd->vec_to_point);
        len = normalize_v3(norm);
        
        // check all collision objects
index a99f2599f660aa04b56279dee74a64e0e3238c7d..7ebd0c3f4578eb184ce2587612487dee2edf9044 100644 (file)
@@ -1194,18 +1194,14 @@ struct chartrans *BKE_text_to_curve(Scene *scene, Object *ob, int mode)
                                ascii = mem[i];
                                info = &(custrinfo[i]);
                                if (cu->sepchar == (i+1)) {
-                                       float vecyo[3];
+                                       float vecyo[3]= {ct->xof, ct->yof, 0.0f};
                                        
                                        mem[0] = ascii;
                                        mem[1] = 0;
                                        custrinfo[0]= *info;
                                        cu->pos = 1;
                                        cu->len = 1;
-                                       vecyo[0] = ct->xof;
-                                       vecyo[1] = ct->yof;
-                                       vecyo[2] = 0;
-                                       mul_m4_v3(ob->obmat, vecyo);
-                                       VECCOPY(ob->loc, vecyo);
+                                       mul_v3_m4v3(ob->loc, ob->obmat, vecyo);
                                        outta = 1;
                                        cu->sepchar = 0;
                                }
index c1e00e091e8a8887b56a85a7b6cbd9e0918e0825..78306705d6bcde87bebab49ab99dab9bbac28aa0 100644 (file)
@@ -178,7 +178,7 @@ void BKE_previewimg_free_id(ID *id)
                Image *img  = (Image*)id;
                BKE_previewimg_free(&img->preview);
        } else if (GS(id->name) == ID_BR) {
-               Brush *br  = (Brush*)br;
+               Brush *br  = (Brush*)id;
                BKE_previewimg_free(&br->preview);
        }
 }
index ffd0b378f078bf06e69725c4403923856050788a..77607ae25b6ad55fadad433368c6674cf54d2d26 100644 (file)
@@ -287,17 +287,25 @@ static void image_assign_ibuf(Image *ima, ImBuf *ibuf, int index, int frame)
 }
 
 /* empty image block, of similar type and filename */
-Image *BKE_image_copy(Image *ima)
+Image *copy_image(Image *ima)
 {
-       Image *new= image_alloc(ima->id.name+2, ima->source, ima->type);
+       Image *nima= image_alloc(ima->id.name+2, ima->source, ima->type);
 
-       BLI_strncpy(new->name, ima->name, sizeof(ima->name));
-       
-       new->gen_x= ima->gen_x;
-       new->gen_y= ima->gen_y;
-       new->gen_type= ima->gen_type;
+       BLI_strncpy(nima->name, ima->name, sizeof(ima->name));
+
+       nima->flag= ima->flag;
+       nima->tpageflag= ima->tpageflag;
        
-       return new;
+       nima->gen_x= ima->gen_x;
+       nima->gen_y= ima->gen_y;
+       nima->gen_type= ima->gen_type;
+
+       nima->animspeed= ima->animspeed;
+
+       nima->aspx= ima->aspx;
+       nima->aspy= ima->aspy;
+
+       return nima;
 }
 
 void BKE_image_merge(Image *dest, Image *source)
index acfaef9eb88a41d0b3215431c19dc670ee806568..716a0b7d41b3aff78007ad36e974420233ff79ce 100644 (file)
@@ -262,7 +262,8 @@ int id_copy(ID *id, ID **newid, int test)
                        if(!test) *newid= (ID*)copy_texture((Tex*)id);
                        return 1;
                case ID_IM:
-                       return 0; /* not implemented */
+                       if(!test) *newid= (ID*)copy_image((Image*)id);
+                       return 1;
                case ID_WV:
                        return 0; /* deprecated */
                case ID_LT:
index cd8b2eb0a8eaa1f15b5f5e0ddb591a2541486e6a..66e8c10206c5024c955dc16353d234ebfe2dc7f0 100644 (file)
@@ -697,7 +697,6 @@ void mball_to_mesh(ListBase *lb, Mesh *me)
        if(dl==0) return;
 
        if(dl->type==DL_INDEX4) {
-               me->flag= ME_NOPUNOFLIP;
                me->totvert= dl->nr;
                me->totface= dl->parts;
                
index add011d0950445cd912bba2fd36a107765500abd..ff1887b0883193b9a604fb88c9ea00974568d242 100644 (file)
@@ -2565,7 +2565,7 @@ bNodeTree *ntreeLocalize(bNodeTree *ntree)
                if(ELEM(node->type, CMP_NODE_VIEWER, CMP_NODE_SPLITVIEWER)) {
                        if(node->id) {
                                if(node->flag & NODE_DO_OUTPUT)
-                                       node->new_node->id= (ID *)BKE_image_copy((Image *)node->id);
+                                       node->new_node->id= (ID *)copy_image((Image *)node->id);
                                else
                                        node->new_node->id= NULL;
                        }
index efff3d138e65eebe03b4589b6b8f84c9c6cb99a3..39e02ee584d7fb67f3adbbae3218daa743006a5a 100644 (file)
@@ -1837,47 +1837,38 @@ static void give_parvert(Object *par, int nr, float *vec)
        
        if(par->type==OB_MESH) {
                Mesh *me= par->data;
-               em = BKE_mesh_get_editmesh(me);
+               DerivedMesh *dm;
 
-               if(em) {
-                       EditVert *eve;
+               em = BKE_mesh_get_editmesh(me);
+               dm = (em)? em->derivedFinal: par->derivedFinal;
                        
-                       for(eve= em->verts.first; eve; eve= eve->next) {
-                               if(eve->keyindex==nr) {
-                                       memcpy(vec, eve->co, sizeof(float)*3);
-                                       break;
+               if(dm) {
+                       MVert *mvert= dm->getVertArray(dm);
+                       int *index = (int *)dm->getVertDataArray(dm, CD_ORIGINDEX);
+                       int i, count = 0, vindex, numVerts = dm->getNumVerts(dm);
+
+                       /* get the average of all verts with (original index == nr) */
+                       for(i = 0; i < numVerts; i++) {
+                               vindex= (index)? index[i]: i;
+
+                               if(vindex == nr) {
+                                       add_v3_v3(vec, mvert[i].co);
+                                       count++;
                                }
                        }
-                       BKE_mesh_end_editmesh(me, em);
-               }
-               else {
-                       DerivedMesh *dm = par->derivedFinal;
-                       
-                       if(dm) {
-                               MVert *mvert= dm->getVertArray(dm);
-                               int *index = (int *)dm->getVertDataArray(dm, CD_ORIGINDEX);
-                               int i, count = 0, vindex, numVerts = dm->getNumVerts(dm);
-
-                               /* get the average of all verts with (original index == nr) */
-                               for(i = 0; i < numVerts; i++) {
-                                       vindex= (index)? index[i]: i;
-
-                                       if(vindex == nr) {
-                                               add_v3_v3(vec, mvert[i].co);
-                                               count++;
-                                       }
-                               }
 
-                               if (count==0) {
-                                       /* keep as 0,0,0 */
-                               } else if(count > 0) {
-                                       mul_v3_fl(vec, 1.0f / count);
-                               } else {
-                                       /* use first index if its out of range */
-                                       dm->getVertCo(dm, 0, vec);
-                               }
+                       if (count==0) {
+                               /* keep as 0,0,0 */
+                       } else if(count > 0) {
+                               mul_v3_fl(vec, 1.0f / count);
+                       } else {
+                               /* use first index if its out of range */
+                               dm->getVertCo(dm, 0, vec);
                        }
                }
+
+               if(em)
+                       BKE_mesh_end_editmesh(me, em);
        }
        else if (ELEM(par->type, OB_CURVE, OB_SURF)) {
                Nurb *nu;
@@ -2324,11 +2315,9 @@ void minmax_object(Object *ob, float *min, float *max)
                if(ob->pose) {
                        bPoseChannel *pchan;
                        for(pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
-                               VECCOPY(vec, pchan->pose_head);
-                               mul_m4_v3(ob->obmat, vec);
+                               mul_v3_m4v3(vec, ob->obmat, pchan->pose_head);
                                DO_MINMAX(vec, min, max);
-                               VECCOPY(vec, pchan->pose_tail);
-                               mul_m4_v3(ob->obmat, vec);
+                               mul_v3_m4v3(vec, ob->obmat, pchan->pose_tail);
                                DO_MINMAX(vec, min, max);
                        }
                        break;
@@ -2957,7 +2946,11 @@ static KeyBlock *insert_curvekey(Scene *scene, Object *ob, char *name, int from_
        if(newkey || from_mix==FALSE) {
                /* create from curve */
                kb= add_keyblock(key, name);
-               curve_to_key(cu, kb, lb);
+               if (!newkey) {
+                       KeyBlock *basekb= (KeyBlock *)key->block.first;
+                       kb->data= MEM_dupallocN(basekb->data);
+                       kb->totelem= basekb->totelem;
+               } else curve_to_key(cu, kb, lb);
        }
        else {
                /* copy from current values */
index cf5deb95258f86ac2cd70ca8f0a6ed89a5ee4f40..fcbe8d65d642f8d64df12df50ce307021c7e41d0 100644 (file)
@@ -192,3 +192,15 @@ void copy_paint(Paint *orig, Paint *new)
                        id_us_plus((ID *)new->brushes[i]);
        }
 }
+
+int paint_has_brush(Paint *p, Brush *brush)
+{
+       int i;
+
+       for (i= 0; i < p->brush_count; i++) {
+               if (strcmp(brush->id.name+2, p->brushes[i]->id.name+2) == 0) 
+                       return 1;
+       }
+
+       return 0;
+}
index 3791d808d01179c6121e3d52728aa373ffca2237..ed63f011342049ec4c155f579971de95a5c9fa18 100644 (file)
@@ -2787,7 +2787,7 @@ void psys_cache_paths(ParticleSimulationData *sim, float cfra)
        int steps = (int)pow(2.0, (double)(psys->renderdata ? part->ren_step : part->draw_step));
        int totpart = psys->totpart;
        float length, vec[3];
-       float *vg_effector= NULL, effector=0.0f;
+       float *vg_effector= NULL;
        float *vg_length= NULL, pa_length=1.0f;
        int keyed, baked;
 
@@ -2889,85 +2889,84 @@ void psys_cache_paths(ParticleSimulationData *sim, float cfra)
                
                /*--modify paths and calculate rotation & velocity--*/
 
-               sub_v3_v3v3(vec,(cache[p]+1)->co,cache[p]->co);
-               length = len_v3(vec);
+               if(!(psys->flag & PSYS_GLOBAL_HAIR)) {
+                       /* apply effectors */
+                       if((psys->part->flag & PART_CHILD_EFFECT) == 0) {
+                               float effector= 1.0f;
+                               if(vg_effector)
+                                       effector*= psys_particle_value_from_verts(psmd->dm,psys->part->from,pa,vg_effector);
 
-               effector= 1.0f;
-               if(vg_effector)
-                       effector*= psys_particle_value_from_verts(psmd->dm,psys->part->from,pa,vg_effector);
+                               sub_v3_v3v3(vec,(cache[p]+1)->co,cache[p]->co);
+                               length = len_v3(vec);
 
-               for(k=0, ca=cache[p]; k<=steps; k++, ca++) {
-                       if(!(psys->flag & PSYS_GLOBAL_HAIR)) {
-                       /* apply effectors */
-                               if(!(psys->part->flag & PART_CHILD_EFFECT) && k)
+                               for(k=1, ca=cache[p]+1; k<=steps; k++, ca++)
                                        do_path_effectors(sim, p, ca, k, steps, cache[p]->co, effector, dfra, cfra, &length, vec);
+                       }
 
-                               /* apply guide curves to path data */
-                               if(sim->psys->effectors && (psys->part->flag & PART_CHILD_EFFECT)==0)
+                       /* apply guide curves to path data */
+                       if(sim->psys->effectors && (psys->part->flag & PART_CHILD_EFFECT)==0) {
+                               for(k=0, ca=cache[p]; k<=steps; k++, ca++)
                                        /* ca is safe to cast, since only co and vel are used */
                                        do_guides(sim->psys->effectors, (ParticleKey*)ca, p, (float)k/(float)steps);
+                       }
 
-                               /* apply lattice */
-                               if(psys->lattice)
+                       /* lattices have to be calculated separately to avoid mixups between effector calculations */
+                       if(psys->lattice) {
+                               for(k=0, ca=cache[p]; k<=steps; k++, ca++)
                                        calc_latt_deform(psys->lattice, ca->co, 1.0f);
+                       }
+               }
 
-                               /* figure out rotation */
-                               
-                               if(k) {
-                                       float cosangle, angle, tangent[3], normal[3], q[4];
-
-                                       if(k == 1) {
-                                               /* calculate initial tangent for incremental rotations */
-                                               VECSUB(tangent, ca->co, (ca - 1)->co);
-                                               VECCOPY(prev_tangent, tangent);
-                                               normalize_v3(prev_tangent);
-
-                                               /* First rotation is based on emitting face orientation.                */
-                                               /* This is way better than having flipping rotations resulting  */
-                                               /* from using a global axis as a rotation pole (vec_to_quat()). */
-                                               /* It's not an ideal solution though since it disregards the    */
-                                               /* initial tangent, but taking that in to account will allow    */
-                                               /* the possibility of flipping again. -jahka                                    */
-                                               mat3_to_quat_is_ok( (ca-1)->rot,rotmat);
-                                       }
-                                       else {
-                                               VECSUB(tangent, ca->co, (ca - 1)->co);
-                                               normalize_v3(tangent);
-
-                                               cosangle= dot_v3v3(tangent, prev_tangent);
-
-                                               /* note we do the comparison on cosangle instead of
-                                               * angle, since floating point accuracy makes it give
-                                               * different results across platforms */
-                                               if(cosangle > 0.999999f) {
-                                                       QUATCOPY((ca - 1)->rot, (ca - 2)->rot);
-                                               }
-                                               else {
-                                                       angle= saacos(cosangle);
-                                                       cross_v3_v3v3(normal, prev_tangent, tangent);
-                                                       axis_angle_to_quat( q,normal, angle);
-                                                       mul_qt_qtqt((ca - 1)->rot, q, (ca - 2)->rot);
-                                               }
+               /* finally do rotation & velocity */
+               for(k=1, ca=cache[p]+1; k<=steps; k++, ca++) {
+                       /* figure out rotation */
+                       float cosangle, angle, tangent[3], normal[3], q[4];
+
+                       if(k == 1) {
+                               /* calculate initial tangent for incremental rotations */
+                               VECSUB(tangent, ca->co, (ca - 1)->co);
+                               VECCOPY(prev_tangent, tangent);
+                               normalize_v3(prev_tangent);
+
+                               /* First rotation is based on emitting face orientation.                */
+                               /* This is way better than having flipping rotations resulting  */
+                               /* from using a global axis as a rotation pole (vec_to_quat()). */
+                               /* It's not an ideal solution though since it disregards the    */
+                               /* initial tangent, but taking that in to account will allow    */
+                               /* the possibility of flipping again. -jahka                                    */
+                               mat3_to_quat_is_ok( (ca-1)->rot,rotmat);
+                       }
+                       else {
+                               VECSUB(tangent, ca->co, (ca - 1)->co);
+                               normalize_v3(tangent);
 
-                                               VECCOPY(prev_tangent, tangent);
-                                       }
+                               cosangle= dot_v3v3(tangent, prev_tangent);
 
-                                       if(k == steps)
-                                               QUATCOPY(ca->rot, (ca - 1)->rot);
+                               /* note we do the comparison on cosangle instead of
+                               * angle, since floating point accuracy makes it give
+                               * different results across platforms */
+                               if(cosangle > 0.999999f) {
+                                       QUATCOPY((ca - 1)->rot, (ca - 2)->rot);
+                               }
+                               else {
+                                       angle= saacos(cosangle);
+                                       cross_v3_v3v3(normal, prev_tangent, tangent);
+                                       axis_angle_to_quat( q,normal, angle);
+                                       mul_qt_qtqt((ca - 1)->rot, q, (ca - 2)->rot);
                                }
 
+                               VECCOPY(prev_tangent, tangent);
                        }
-                       
-                       /* set velocity */
 
-                       if(k){
-                               VECSUB(ca->vel, ca->co, (ca-1)->co);
+                       if(k == steps)
+                               QUATCOPY(ca->rot, (ca - 1)->rot);
+                       
 
-                               if(k==1) {
-                                       VECCOPY((ca-1)->vel, ca->vel);
-                               }
+                       /* set velocity */
+                       VECSUB(ca->vel, ca->co, (ca-1)->co);
 
-                       }
+                       if(k==1)
+                               VECCOPY((ca-1)->vel, ca->vel);
                }
        }
 
index 181d8fee4ba718a946cd012309cc84a9d185986a..366d2e37d78a2d4426badaa9506e9bdcfa88dce6 100644 (file)
@@ -727,7 +727,7 @@ static void psys_thread_distribute_particle(ParticleThread *thread, ParticleData
                                pa->foffset=0.0;
                        else switch(distr){
                                case PART_DISTR_JIT:
-                                       pa->foffset*= ctx->jit[2*(int)ctx->jitoff[i]];
+                                       pa->foffset*= ctx->jit[p%(2*ctx->jitlevel)];
                                        break;
                                case PART_DISTR_RAND:
                                        pa->foffset*=BLI_frand();
@@ -4038,12 +4038,21 @@ void particle_system_update(Scene *scene, Object *ob, ParticleSystem *psys)
                                case PART_PHYS_NO:
                                case PART_PHYS_KEYED:
                                {
+                                       PARTICLE_P;
+
                                        if(emit_particles(&sim, NULL, cfra)) {
                                                free_keyed_keys(psys);
                                                distribute_particles(&sim, part->from);
                                                initialize_all_particles(&sim);
                                        }
-                                       reset_all_particles(&sim, 0.0, cfra, 0);
+
+                                       LOOP_EXISTING_PARTICLES {
+                                               pa->size = part->size;
+                                               if(part->randsize > 0.0)
+                                                       pa->size *= 1.0f - part->randsize * PSYS_FRAND(p + 1);
+
+                                               reset_particle(&sim, pa, 0.0, cfra);
+                                       }
 
                                        if(part->phystype == PART_PHYS_KEYED) {
                                                psys_count_keyed_targets(&sim);
index 9d736bd92eb305233b5dfa3d0aab34f8af106341..3c7f6e13445e5cf3f2c70345fa77eed3e2306c85 100644 (file)
@@ -395,6 +395,7 @@ Scene *add_scene(char *name)
        sce->toolsettings->jointrilimit = 0.8f;
 
        sce->toolsettings->selectmode= SCE_SELECT_VERTEX;
+       sce->toolsettings->uv_selectmode= UV_SELECT_VERTEX;
        sce->toolsettings->normalsize= 0.1;
        sce->toolsettings->autokey_mode= U.autokey_mode;
 
index 151fc1c407c8b234f7597211e8600cae56135ac0..c117f51c072fb8c7a7a863d6896b6594d2597e7a 100644 (file)
@@ -67,6 +67,48 @@ enum {
        GlowA=3
 };
 
+static struct ImBuf * prepare_effect_imbufs(
+       int x, int y,
+       struct ImBuf *ibuf1, struct ImBuf *ibuf2,
+       struct ImBuf *ibuf3)
+{
+       struct ImBuf * out;
+
+       if (!ibuf1 && !ibuf2 && !ibuf3) {
+               /* hmmm, global float option ? */
+               out = IMB_allocImBuf((short)x, (short)y, 32, IB_rect, 0);
+       } else if ((ibuf1 && ibuf1->rect_float) || 
+                  (ibuf2 && ibuf2->rect_float) || 
+                  (ibuf3 && ibuf3->rect_float)) {
+               /* if any inputs are rectfloat, output is float too */
+
+               out = IMB_allocImBuf((short)x, (short)y, 32, IB_rectfloat, 0);
+       } else {
+               out = IMB_allocImBuf((short)x, (short)y, 32, IB_rect, 0);
+       }
+       
+       if (ibuf1 && !ibuf1->rect_float && out->rect_float) {
+               IMB_float_from_rect_simple(ibuf1);
+       }
+       if (ibuf2 && !ibuf2->rect_float && out->rect_float) {
+               IMB_float_from_rect_simple(ibuf2);
+       }
+       if (ibuf3 && !ibuf3->rect_float && out->rect_float) {
+               IMB_float_from_rect_simple(ibuf3);
+       }
+       
+       if (ibuf1 && !ibuf1->rect && !out->rect_float) {
+               IMB_rect_from_float(ibuf1);
+       }
+       if (ibuf2 && !ibuf2->rect && !out->rect_float) {
+               IMB_rect_from_float(ibuf2);
+       }
+       if (ibuf3 && !ibuf3->rect && !out->rect_float) {
+               IMB_rect_from_float(ibuf3);
+       }
+                       
+       return out;
+}
 
 /* **********************************************************************
    PLUGINS
@@ -229,11 +271,12 @@ static ImBuf * IMB_cast_away_list(ImBuf * i)
        return (ImBuf*) (((void**) i) + 2);
 }
 
-static void do_plugin_effect(Scene *scene, Sequence *seq, int cfra,
-                            float facf0, float facf1, int x, int y, 
-                            int preview_render_size,
-                            struct ImBuf *ibuf1, struct ImBuf *ibuf2, 
-                            struct ImBuf *ibuf3, struct ImBuf *out)
+static struct ImBuf * do_plugin_effect(
+       Scene *scene, Sequence *seq, float cfra,
+       float facf0, float facf1, int x, int y, 
+       int preview_render_size,
+       struct ImBuf *ibuf1, struct ImBuf *ibuf2, 
+       struct ImBuf *ibuf3)
 {
        char *cp;
        int float_rendering;
@@ -241,6 +284,8 @@ static void do_plugin_effect(Scene *scene, Sequence *seq, int cfra,
                                  old plugins) do very bad stuff
                                  with imbuf-internals */
 
+       struct ImBuf * out = prepare_effect_imbufs(x, y, ibuf1, ibuf2, ibuf3);
+
        if(seq->plugin && seq->plugin->doit) {
                
                if(seq->plugin->cfra) 
@@ -321,6 +366,7 @@ static void do_plugin_effect(Scene *scene, Sequence *seq, int cfra,
                        if (ibuf3) IMB_freeImBuf(ibuf3);
                }
        }
+       return out;
 }
 
 static int do_plugin_early_out(struct Sequence *seq,
@@ -476,12 +522,15 @@ static void do_alphaover_effect_float(float facf0, float facf1, int x, int y,
        }
 }
 
-static void do_alphaover_effect(Scene *scene, Sequence *seq, int cfra,
-                               float facf0, float facf1, int x, int y, 
-                               int preview_render_size,
-                               struct ImBuf *ibuf1, struct ImBuf *ibuf2, 
-                               struct ImBuf *ibuf3, struct ImBuf *out)
+static struct ImBuf * do_alphaover_effect(
+       Scene *scene, Sequence *seq, float cfra,
+       float facf0, float facf1, int x, int y, 
+       int preview_render_size,
+       struct ImBuf *ibuf1, struct ImBuf *ibuf2, 
+       struct ImBuf *ibuf3)
 {
+       struct ImBuf * out = prepare_effect_imbufs(x, y, ibuf1, ibuf2, ibuf3);
+
        if (out->rect_float) {
                do_alphaover_effect_float(
                        facf0, facf1, x, y,
@@ -493,6 +542,7 @@ static void do_alphaover_effect(Scene *scene, Sequence *seq, int cfra,
                        (char*) ibuf1->rect, (char*) ibuf2->rect,
                        (char*) out->rect);
        }
+       return out;
 }
 
 
@@ -644,12 +694,15 @@ static void do_alphaunder_effect_float(float facf0, float facf1, int x, int y,
        }
 }
 
-static void do_alphaunder_effect(Scene *scene, Sequence *seq, int cfra,
-                               float facf0, float facf1, int x, int y, 
-                                int preview_render_size,
-                               struct ImBuf *ibuf1, struct ImBuf *ibuf2, 
-                               struct ImBuf *ibuf3, struct ImBuf *out)
+static struct ImBuf* do_alphaunder_effect(
+       Scene *scene, Sequence *seq, float cfra,
+       float facf0, float facf1, int x, int y, 
+       int preview_render_size,
+       struct ImBuf *ibuf1, struct ImBuf *ibuf2, 
+       struct ImBuf *ibuf3)
 {
+       struct ImBuf * out = prepare_effect_imbufs(x, y, ibuf1, ibuf2, ibuf3);
+
        if (out->rect_float) {
                do_alphaunder_effect_float(
                        facf0, facf1, x, y,
@@ -661,6 +714,7 @@ static void do_alphaunder_effect(Scene *scene, Sequence *seq, int cfra,
                        (char*) ibuf1->rect, (char*) ibuf2->rect,
                        (char*) out->rect);
        }
+       return out;
 }
 
 
@@ -765,12 +819,15 @@ void do_cross_effect_float(float facf0, float facf1, int x, int y,
 
 /* carefull: also used by speed effect! */
 
-static void do_cross_effect(Scene *scene, Sequence *seq, int cfra,
-                           float facf0, float facf1, int x, int y, 
-                           int preview_render_size,
-                           struct ImBuf *ibuf1, struct ImBuf *ibuf2, 
-                           struct ImBuf *ibuf3, struct ImBuf *out)
+static struct ImBuf* do_cross_effect(
+       Scene *scene, Sequence *seq, float cfra,
+       float facf0, float facf1, int x, int y, 
+       int preview_render_size,
+       struct ImBuf *ibuf1, struct ImBuf *ibuf2, 
+       struct ImBuf *ibuf3)
 {
+       struct ImBuf * out = prepare_effect_imbufs(x, y, ibuf1, ibuf2, ibuf3);
+
        if (out->rect_float) {
                do_cross_effect_float(
                        facf0, facf1, x, y,
@@ -782,6 +839,7 @@ static void do_cross_effect(Scene *scene, Sequence *seq, int cfra,
                        (char*) ibuf1->rect, (char*) ibuf2->rect,
                        (char*) out->rect);
        }
+       return out;
 }
 
 
@@ -1028,12 +1086,15 @@ static void do_gammacross_effect_float(float facf0, float facf1,
        }
 }
 
-static void do_gammacross_effect(Scene *scene, Sequence *seq, int cfra,
-                                float facf0, float facf1, int x, int y, 
-                                int preview_render_size,
-                                struct ImBuf *ibuf1, struct ImBuf *ibuf2, 
-                                struct ImBuf *ibuf3, struct ImBuf *out)
+static struct ImBuf * do_gammacross_effect(
+       Scene *scene, Sequence *seq, float cfra,
+       float facf0, float facf1, int x, int y, 
+       int preview_render_size,
+       struct ImBuf *ibuf1, struct ImBuf *ibuf2, 
+       struct ImBuf *ibuf3)
 {
+       struct ImBuf * out = prepare_effect_imbufs(x, y, ibuf1, ibuf2, ibuf3);
+
        build_gammatabs();
 
        if (out->rect_float) {
@@ -1047,6 +1108,7 @@ static void do_gammacross_effect(Scene *scene, Sequence *seq, int cfra,
                        (unsigned char*) ibuf1->rect, (unsigned char*) ibuf2->rect,
                        (unsigned char*) out->rect);
        }
+       return out;
 }
 
 
@@ -1143,12 +1205,14 @@ static void do_add_effect_float(float facf0, float facf1, int x, int y,
        }
 }
 
-static void do_add_effect(Scene *scene, Sequence *seq, int cfra,
-                         float facf0, float facf1, int x, int y, 
-                         int preview_render_size,
-                         struct ImBuf *ibuf1, struct ImBuf *ibuf2, 
-                         struct ImBuf *ibuf3, struct ImBuf *out)
+static struct ImBuf * do_add_effect(Scene *scene, Sequence *seq, float cfra,
+                                   float facf0, float facf1, int x, int y, 
+                                   int preview_render_size,
+                                   struct ImBuf *ibuf1, struct ImBuf *ibuf2, 
+                                   struct ImBuf *ibuf3)
 {
+       struct ImBuf * out = prepare_effect_imbufs(x, y, ibuf1, ibuf2, ibuf3);
+
        if (out->rect_float) {
                do_add_effect_float(
                        facf0, facf1, x, y,
@@ -1160,6 +1224,7 @@ static void do_add_effect(Scene *scene, Sequence *seq, int cfra,
                        (unsigned char*) ibuf1->rect, (unsigned char*) ibuf2->rect,
                        (unsigned char*) out->rect);
        }
+       return out;
 }
 
 
@@ -1256,12 +1321,15 @@ static void do_sub_effect_float(float facf0, float facf1, int x, int y,
        }
 }
 
-static void do_sub_effect(Scene *scene, Sequence *seq, int cfra,
-                         float facf0, float facf1, int x, int y,
-                         int preview_render_size,
-                         struct ImBuf *ibuf1, struct ImBuf *ibuf2, 
-                         struct ImBuf *ibuf3, struct ImBuf *out)
+static struct ImBuf * do_sub_effect(
+       Scene *scene, Sequence *seq, float cfra,
+       float facf0, float facf1, int x, int y,
+       int preview_render_size,
+       struct ImBuf *ibuf1, struct ImBuf *ibuf2, 
+       struct ImBuf *ibuf3)
 {
+       struct ImBuf * out = prepare_effect_imbufs(x, y, ibuf1, ibuf2, ibuf3);
+
        if (out->rect_float) {
                do_sub_effect_float(
                        facf0, facf1, x, y,
@@ -1273,6 +1341,7 @@ static void do_sub_effect(Scene *scene, Sequence *seq, int cfra,
                        (char*) ibuf1->rect, (char*) ibuf2->rect,
                        (char*) out->rect);
        }
+       return out;
 }
 
 /* **********************************************************************
@@ -1284,8 +1353,8 @@ static void do_sub_effect(Scene *scene, Sequence *seq, int cfra,
 #define YOFF   8
 
 static void do_drop_effect_byte(float facf0, float facf1, int x, int y, 
-                               unsigned char *rect2i, unsigned char *rect1i, 
-                               unsigned char *outi)
+                               char *rect2i, char *rect1i, 
+                               char *outi)
 {
        int height, width, temp, fac, fac1, fac2;
        char *rt1, *rt2, *out;
@@ -1364,27 +1433,6 @@ static void do_drop_effect_float(float facf0, float facf1, int x, int y,
        memcpy(out, rt1, 4 * sizeof(float)*YOFF*width);
 }
 
-
-static void do_drop_effect(Scene *scene, Sequence *seq, int cfra,
-                          float facf0, float facf1, int x, int y, 
-                          int preview_render_size,
-                          struct ImBuf *ibuf1, struct ImBuf *ibuf2, 
-                          struct ImBuf * ibuf3,
-                          struct ImBuf *out)
-{
-       if (out->rect_float) {
-               do_drop_effect_float(
-                       facf0, facf1, x, y,
-                       ibuf1->rect_float, ibuf2->rect_float,
-                       out->rect_float);
-       } else {
-               do_drop_effect_byte(
-                       facf0, facf1, x, y,
-                       (unsigned char*) ibuf1->rect, (unsigned char*) ibuf2->rect,
-                       (unsigned char*) out->rect);
-       }
-}
-
 /* **********************************************************************
    MUL
    ********************************************************************** */
@@ -1487,12 +1535,15 @@ static void do_mul_effect_float(float facf0, float facf1, int x, int y,
        }
 }
 
-static void do_mul_effect(Scene *scene, Sequence *seq, int cfra,
-                         float facf0, float facf1, int x, int y, 
-                         int preview_render_size,
-                         struct ImBuf *ibuf1, struct ImBuf *ibuf2, 
-                         struct ImBuf *ibuf3, struct ImBuf *out)
+static struct ImBuf * do_mul_effect(
+       Scene *scene, Sequence *seq, float cfra,
+       float facf0, float facf1, int x, int y, 
+       int preview_render_size,
+       struct ImBuf *ibuf1, struct ImBuf *ibuf2, 
+       struct ImBuf *ibuf3)
 {
+       struct ImBuf * out = prepare_effect_imbufs(x, y, ibuf1, ibuf2, ibuf3);
+
        if (out->rect_float) {
                do_mul_effect_float(
                        facf0, facf1, x, y,
@@ -1504,6 +1555,8 @@ static void do_mul_effect(Scene *scene, Sequence *seq, int cfra,
                        (unsigned char*) ibuf1->rect, (unsigned char*) ibuf2->rect,
                        (unsigned char*) out->rect);
        }
+
+       return out;
 }
 
 /* **********************************************************************
@@ -1938,12 +1991,15 @@ static void do_wipe_effect_float(Sequence *seq, float facf0, float facf1,
        }
 }
 
-static void do_wipe_effect(Scene *scene, Sequence *seq, int cfra,
-                          float facf0, float facf1, int x, int y, 
-                          int preview_render_size,
-                          struct ImBuf *ibuf1, struct ImBuf *ibuf2, 
-                          struct ImBuf *ibuf3, struct ImBuf *out)
+static struct ImBuf * do_wipe_effect(
+       Scene *scene, Sequence *seq, float cfra,
+       float facf0, float facf1, int x, int y, 
+       int preview_render_size,
+       struct ImBuf *ibuf1, struct ImBuf *ibuf2, 
+       struct ImBuf *ibuf3)
 {
+       struct ImBuf * out = prepare_effect_imbufs(x, y, ibuf1, ibuf2, ibuf3);
+
        if (out->rect_float) {
                do_wipe_effect_float(seq,
                                         facf0, facf1, x, y,
@@ -1955,6 +2011,8 @@ static void do_wipe_effect(Scene *scene, Sequence *seq, int cfra,
                                        (unsigned char*) ibuf1->rect, (unsigned char*) ibuf2->rect,
                                        (unsigned char*) out->rect);
        }
+
+       return out;
 }
 /* **********************************************************************
    TRANSFORM
@@ -2084,13 +2142,18 @@ static void do_transform(Scene *scene, Sequence *seq, float facf0, int x, int y,
 }
 
 
-static void do_transform_effect(Scene *scene, Sequence *seq,int cfra,
-                               float facf0, float facf1, int x, int y, 
-                               int preview_render_size,
-                               struct ImBuf *ibuf1, struct ImBuf *ibuf2, 
-                               struct ImBuf *ibuf3, struct ImBuf *out)
+static struct ImBuf * do_transform_effect(
+       Scene *scene, Sequence *seq,float cfra,
+       float facf0, float facf1, int x, int y, 
+       int preview_render_size,
+       struct ImBuf *ibuf1, struct ImBuf *ibuf2, 
+       struct ImBuf *ibuf3)
 {
+       struct ImBuf * out = prepare_effect_imbufs(x, y, ibuf1, ibuf2, ibuf3);
+
        do_transform(scene, seq, facf0, x, y, ibuf1, out);
+
+       return out;
 }
 
 
@@ -2597,12 +2660,15 @@ static void do_glow_effect_float(Sequence *seq, float facf0, float facf1,
                RVAddBitmaps_float (inbuf , outbuf, outbuf, x, y);
 }
 
-static void do_glow_effect(Scene *scene, Sequence *seq, int cfra,
-                          float facf0, float facf1, int x, int y, 
-                          int preview_render_size,
-                          struct ImBuf *ibuf1, struct ImBuf *ibuf2, 
-                          struct ImBuf *ibuf3, struct ImBuf *out)
+static struct ImBuf * do_glow_effect(
+       Scene *scene, Sequence *seq, float cfra,
+       float facf0, float facf1, int x, int y, 
+       int preview_render_size,
+       struct ImBuf *ibuf1, struct ImBuf *ibuf2, 
+       struct ImBuf *ibuf3)
 {
+       struct ImBuf * out = prepare_effect_imbufs(x, y, ibuf1, ibuf2, ibuf3);
+
        if (out->rect_float) {
                do_glow_effect_float(seq,
                                         facf0, facf1, x, y,
@@ -2614,6 +2680,8 @@ static void do_glow_effect(Scene *scene, Sequence *seq, int cfra,
                                        (char*) ibuf1->rect, (char*) ibuf2->rect,
                                        (char*) out->rect);
        }
+
+       return out;
 }
 
 /* **********************************************************************
@@ -2653,12 +2721,15 @@ static int early_out_color(struct Sequence *seq,
        return -1;
 }
 
-static void do_solid_color(Scene *scene, Sequence *seq, int cfra,
-                          float facf0, float facf1, int x, int y, 
-                          int preview_render_size,
-                          struct ImBuf *ibuf1, struct ImBuf *ibuf2, 
-                          struct ImBuf *ibuf3, struct ImBuf *out)
+static struct ImBuf * do_solid_color(
+       Scene *scene, Sequence *seq, float cfra,
+       float facf0, float facf1, int x, int y, 
+       int preview_render_size,
+       struct ImBuf *ibuf1, struct ImBuf *ibuf2, 
+       struct ImBuf *ibuf3)
 {
+       struct ImBuf * out = prepare_effect_imbufs(x, y, ibuf1, ibuf2, ibuf3);
+
        SolidColorVars *cv = (SolidColorVars *)seq->effectdata;
 
        unsigned char *rect;
@@ -2728,6 +2799,7 @@ static void do_solid_color(Scene *scene, Sequence *seq, int cfra,
                        }
                }
        }
+       return out;
 }
 
 /* **********************************************************************
@@ -2745,48 +2817,45 @@ static int early_out_multicam(struct Sequence *seq, float facf0, float facf1)
        return -1;
 }
 
-static void do_multicam(Scene *scene, Sequence *seq, int cfra,
-                       float facf0, float facf1, int x, int y, 
-                       int preview_render_size,
-                       struct ImBuf *ibuf1, struct ImBuf *ibuf2, 
-                       struct ImBuf *ibuf3, struct ImBuf *out)
+static struct ImBuf * do_multicam(
+       Scene *scene, Sequence *seq, float cfra,
+       float facf0, float facf1, int x, int y, 
+       int preview_render_size,
+       struct ImBuf *ibuf1, struct ImBuf *ibuf2, 
+       struct ImBuf *ibuf3)
 {
        struct ImBuf * i;
+       struct ImBuf * out;
        Editing * ed;
        ListBase * seqbasep;
 
        if (seq->multicam_source == 0 || seq->multicam_source >= seq->machine) {
-               return;
+               return 0;
        }
 
        ed = scene->ed;
        if (!ed) {
-               return;
+               return 0;
        }
        seqbasep = seq_seqbase(&ed->seqbase, seq);
        if (!seqbasep) {
-               return;
+               return 0;
        }
 
-       i = give_ibuf_seqbase(scene, 
-                             out->x, out->y, cfra, seq->multicam_source, 
+       i = give_ibuf_seqbase(scene, x, y, cfra, seq->multicam_source, 
                              preview_render_size, seqbasep);
        if (!i) {
-               return;
+               return 0;
        }
 
-       if (out->rect && i->rect) {
-               memcpy(out->rect, i->rect, out->x * out->y * 4);
-       } else if (out->rect_float && i->rect_float) {
-               memcpy(out->rect_float, i->rect_float, out->x * out->y *4*sizeof(float));
-       } else if (out->rect && i->rect_float) { 
-               IMB_rect_from_float(i);
-               memcpy(out->rect, i->rect, out->x * out->y * 4);
-       } else if (out->rect_float && i->rect) {
-               IMB_float_from_rect_simple(i);
-               memcpy(out->rect_float, i->rect_float, out->x * out->y *4*sizeof(float));
+       if (input_have_to_preprocess(scene, seq, cfra, x, y)) {
+               out = IMB_dupImBuf(i);
+               IMB_freeImBuf(i);
+       } else {
+               out = i;
        }
-       IMB_freeImBuf(i);
+       
+       return out;
 }
 
 /* **********************************************************************
@@ -3049,13 +3118,13 @@ static void store_icu_yrange_noop(struct Sequence * seq,
        /* defaults are fine */
 }
 
-static void get_default_fac_noop(struct Sequence *seq, int cfra,
+static void get_default_fac_noop(struct Sequence *seq, float cfra,
                                 float * facf0, float * facf1)
 {
        *facf0 = *facf1 = 1.0;
 }
 
-static void get_default_fac_fade(struct Sequence *seq, int cfra,
+static void get_default_fac_fade(struct Sequence *seq, float cfra,
                                 float * facf0, float * facf1)
 {
        *facf0 = (float)(cfra - seq->startdisp);
@@ -3064,21 +3133,38 @@ static void get_default_fac_fade(struct Sequence *seq, int cfra,
        *facf1 /= seq->len;
 }
 
-static void do_overdrop_effect(Scene *scene, Sequence *seq, int cfra,
-                              float fac, float facf, 
-                              int x, int y, 
-                              int preview_render_size,
-                              struct ImBuf * ibuf1, 
-                              struct ImBuf * ibuf2, 
-                              struct ImBuf * ibuf3, 
-                              struct ImBuf * out)
-{
-       do_drop_effect(scene, seq, cfra, fac, facf, x, y, 
-                      preview_render_size,
-                      ibuf1, ibuf2, ibuf3, out);
-       do_alphaover_effect(scene, seq, cfra, fac, facf, x, y, 
-                           preview_render_size,
-                           ibuf1, ibuf2, ibuf3, out);
+static struct ImBuf * do_overdrop_effect(Scene *scene, Sequence *seq, float cfra,
+                                        float facf0, float facf1, 
+                                        int x, int y, 
+                                        int preview_render_size,
+                                        struct ImBuf * ibuf1, 
+                                        struct ImBuf * ibuf2, 
+                                        struct ImBuf * ibuf3)
+{
+       struct ImBuf * out = prepare_effect_imbufs(x, y, ibuf1, ibuf2, ibuf3);
+
+       if (out->rect_float) {
+               do_drop_effect_float(
+                       facf0, facf1, x, y,
+                       ibuf1->rect_float, ibuf2->rect_float,
+                       out->rect_float);
+               do_alphaover_effect_float(
+                       facf0, facf1, x, y,
+                       ibuf1->rect_float, ibuf2->rect_float,
+                       out->rect_float);
+       } else {
+               do_drop_effect_byte(
+                       facf0, facf1, x, y,
+                       (char*) ibuf1->rect, 
+                       (char*) ibuf2->rect,
+                       (char*) out->rect);
+               do_alphaover_effect_byte(
+                       facf0, facf1, x, y,
+                       (char*) ibuf1->rect, (char*) ibuf2->rect,
+                       (char*) out->rect);
+       }
+
+       return out;
 }
 
 static struct SeqEffectHandle get_sequence_effect_impl(int seq_type)
index bbc50490ab70cbf043dbc5c2f3e55ee2afad4202..4f3ad50e294a4c5592923bef94193b2e324a13f8 100644 (file)
@@ -1443,7 +1443,7 @@ static void color_balance(Sequence * seq, ImBuf* ibuf, float mul)
 
 */
 
-static int input_have_to_preprocess(
+int input_have_to_preprocess(
        Scene *scene, Sequence * seq, float cfra, int seqrectx, int seqrecty)
 {
        float mul;
@@ -1708,13 +1708,9 @@ static ImBuf* seq_render_effect_strip_impl(
        early_out = sh.early_out(seq, fac, facf);
 
        if (early_out == -1) { /* no input needed */
-               /* hmmm, global float option ? */
-               out = IMB_allocImBuf(
-                       (short)seqrectx, (short)seqrecty, 32, IB_rect, 0);
-
-               sh.execute(scene, seq, cfra, fac, facf, 
-                          out->x, out->y, render_size,
-                          0, 0, 0, out);
+               out = sh.execute(scene, seq, cfra, fac, facf, 
+                                seqrectx, seqrecty, render_size,
+                                0, 0, 0);
                goto finish;
        }
 
@@ -1781,31 +1777,9 @@ static ImBuf* seq_render_effect_strip_impl(
                goto finish;
        }
 
-       /* if any inputs are rectfloat, output is float too */
-       if((ibuf[0] && ibuf[0]->rect_float) || 
-          (ibuf[1] && ibuf[1]->rect_float) || 
-          (ibuf[2] && ibuf[2]->rect_float)) {
-               out = IMB_allocImBuf(
-                       (short)seqrectx, (short)seqrecty, 32, IB_rectfloat, 0);
-       } else {
-               out = IMB_allocImBuf(
-                       (short)seqrectx, (short)seqrecty, 32, IB_rect, 0);
-       }
-
-       for (i = 0; i < 3; i++) {
-               ImBuf * b = ibuf[i];
-               if (b) {
-                       if (!b->rect_float && out->rect_float) {
-                               IMB_float_from_rect_simple(b);
-                       }
-                       if (!b->rect && !out->rect_float) {
-                               IMB_rect_from_float(b);
-                       }
-               }
-       }
-
-       sh.execute(scene, seq, cfra, fac, facf, out->x, out->y, render_size,
-                  ibuf[0], ibuf[1], ibuf[2], out);
+       out = sh.execute(scene, seq, cfra, fac, facf, seqrectx, seqrecty, 
+                        render_size,
+                        ibuf[0], ibuf[1], ibuf[2]);
 
 finish:
        for (i = 0; i < 3; i++) {
@@ -1826,8 +1800,8 @@ static ImBuf * seq_render_scene_strip_impl(
 {
        ImBuf * ibuf = 0;
        float frame= seq->sfra + nr + seq->anim_startofs;
-       float oldcfra = seq->scene->r.cfra;
-       Object *oldcamera= seq->scene->camera;
+       float oldcfra;
+       Object *oldcamera;
        ListBase oldmarkers;
        
        /* Hack! This function can be called from do_render_seq(), in that case
@@ -1846,21 +1820,20 @@ static ImBuf * seq_render_scene_strip_impl(
        int doseq;
        int doseq_gl= G.rendering ? /*(scene->r.seq_flag & R_SEQ_GL_REND)*/ 0 : (scene->r.seq_flag & R_SEQ_GL_PREV);
        int have_seq= FALSE;
-       Scene *sce= seq->scene;// *oldsce= scene;
+       Scene *sce= seq->scene; /* dont refer to seq->scene above this point!, it can be NULL */
        int sce_valid= FALSE;
 
-       have_seq= (sce->r.scemode & R_DOSEQ) 
-               && sce->ed && sce->ed->seqbase.first;
-
        if(sce) {
+               have_seq= (sce->r.scemode & R_DOSEQ) && sce->ed && sce->ed->seqbase.first;
                sce_valid= (sce->camera || have_seq);
        }
 
-       if (!sce_valid) {
-               return 0;
-       }
+       if (!sce_valid)
+               return NULL;
+
+       oldcfra= seq->scene->r.cfra;
+       oldcamera= seq->scene->camera;
 
-       
        /* prevent eternal loop */
        doseq= scene->r.scemode & R_DOSEQ;
        scene->r.scemode &= ~R_DOSEQ;
@@ -1909,8 +1882,12 @@ static ImBuf * seq_render_scene_strip_impl(
                           IMB_saveiff(imb, "/tmp/foo.image", IB_rect | IB_metadata);
                           IMB_freeImBuf(imb);
                           } */
-                       
-               } else if (rres.rect32) {
+
+                       /* float buffers in the sequencer are not linear */
+                       ibuf->profile= IB_PROFILE_LINEAR_RGB;
+                       IMB_convert_profile(ibuf, IB_PROFILE_SRGB);                     
+               }
+               else if (rres.rect32) {
                        ibuf= IMB_allocImBuf(rres.rectx, rres.recty, 32, IB_rect, 0);
                        memcpy(ibuf->rect, rres.rect32, 4*rres.rectx*rres.recty);
                }
@@ -2271,41 +2248,17 @@ static ImBuf* seq_render_strip_stack(
                        int swap_input 
                                = seq_must_swap_input_in_blend_mode(seq);
 
-                       int x= out->x;
-                       int y= out->y;
+                       int x= seqrectx;
+                       int y= seqrecty;
 
-                       if (ibuf1->rect_float || ibuf2->rect_float) {
-                               out = IMB_allocImBuf(
-                                       (short)seqrectx, (short)seqrecty, 
-                                       32, IB_rectfloat, 0);
-                       } else {
-                               out = IMB_allocImBuf(
-                                       (short)seqrectx, (short)seqrecty, 
-                                       32, IB_rect, 0);
-                       }
-
-                       if (!ibuf1->rect_float && out->rect_float) {
-                               IMB_float_from_rect_simple(ibuf1);
-                       }
-                       if (!ibuf2->rect_float && out->rect_float) {
-                               IMB_float_from_rect_simple(ibuf2);
-                       }
-
-                       if (!ibuf1->rect && !out->rect_float) {
-                               IMB_rect_from_float(ibuf1);
-                       }
-                       if (!ibuf2->rect && !out->rect_float) {
-                               IMB_rect_from_float(ibuf2);
-                       }
-                       
                        if (swap_input) {
-                               sh.execute(scene, seq, cfra, 
-                                          facf, facf, x, y, render_size,
-                                          ibuf2, ibuf1, 0, out);
+                               out = sh.execute(scene, seq, cfra, 
+                                                facf, facf, x, y, render_size,
+                                                ibuf2, ibuf1, 0);
                        } else {
-                               sh.execute(scene, seq, cfra, 
-                                          facf, facf, x, y, render_size,
-                                          ibuf1, ibuf2, 0, out);
+                               out = sh.execute(scene, seq, cfra, 
+                                                facf, facf, x, y, render_size,
+                                                ibuf1, ibuf2, 0);
                        }
                
                        IMB_freeImBuf(ibuf1);
index 7424026354a0cc10da034b7e7470efeff648b5c9..2664a20bd184308fb5f396b9d4af25fcea5aa274 100644 (file)
@@ -220,7 +220,7 @@ int smokeModifier_init (SmokeModifierData *smd, Object *ob, Scene *scene, Derive
 
                // printf("res[0]: %d, res[1]: %d, res[2]: %d\n", smd->domain->res[0], smd->domain->res[1], smd->domain->res[2]);
                // dt max is 0.1
-               smd->domain->fluid = smoke_init(smd->domain->res, smd->domain->p0, 0.1);
+               smd->domain->fluid = smoke_init(smd->domain->res, smd->domain->p0);
                smd->time = scene->r.cfra;
 
                if(smd->domain->flags & MOD_SMOKE_HIGHRES)
@@ -237,7 +237,7 @@ int smokeModifier_init (SmokeModifierData *smd, Object *ob, Scene *scene, Derive
                if(!smd->domain->shadow)
                        smd->domain->shadow = MEM_callocN(sizeof(float) * smd->domain->res[0] * smd->domain->res[1] * smd->domain->res[2], "SmokeDomainShadow");
 
-               smoke_initBlenderRNA(smd->domain->fluid, &(smd->domain->alpha), &(smd->domain->beta));
+               smoke_initBlenderRNA(smd->domain->fluid, &(smd->domain->alpha), &(smd->domain->beta), &(smd->domain->time_scale), &(smd->domain->vorticity), &(smd->domain->border_collisions));
 
                if(smd->domain->wt)     
                {
@@ -713,12 +713,16 @@ void smokeModifier_createType(struct SmokeModifierData *smd)
                        smd->domain->omega = 1.0;                       
                        smd->domain->alpha = -0.001;
                        smd->domain->beta = 0.1;
-                       smd->domain->flags = MOD_SMOKE_DISSOLVE_LOG;
+                       smd->domain->time_scale = 1.0;
+                       smd->domain->vorticity = 2.0;
+                       smd->domain->border_collisions = 1;             // vertically non-colliding
+                       smd->domain->flags = MOD_SMOKE_DISSOLVE_LOG | MOD_SMOKE_HIGH_SMOOTH;
                        smd->domain->strength = 2.0;
                        smd->domain->noise = MOD_SMOKE_NOISEWAVE;
                        smd->domain->diss_speed = 5;
-                       // init view3d buffer
-                       smd->domain->viewsettings = 0;
+                       // init 3dview buffer
+
+                       smd->domain->viewsettings = MOD_SMOKE_VIEW_SHOWBIG;
                        smd->domain->effector_weights = BKE_add_effector_weights(NULL);
                }
                else if(smd->type & MOD_SMOKE_TYPE_FLOW)
@@ -733,6 +737,8 @@ void smokeModifier_createType(struct SmokeModifierData *smd)
                        /* set some standard values */
                        smd->flow->density = 1.0;
                        smd->flow->temp = 1.0;
+                       smd->flow->flags = MOD_SMOKE_FLOW_ABSOLUTE;
+                       smd->flow->vel_multi = 1.0;
 
                        smd->flow->psys = NULL;
 
@@ -862,7 +868,7 @@ static void smoke_calc_domain(Scene *scene, Object *ob, SmokeModifierData *smd)
                                        {
                                                ParticleSystem *psys = sfs->psys;
                                                ParticleSettings *part=psys->part;
-                                               ParticleData *pa = NULL;                                                                
+                                               ParticleData *pa = NULL;                                                        
                                                int p = 0;                                                              
                                                float *density = smoke_get_density(sds->fluid);                                                         
                                                float *bigdensity = smoke_turbulence_get_density(sds->wt);                                                              
@@ -871,7 +877,27 @@ static void smoke_calc_domain(Scene *scene, Object *ob, SmokeModifierData *smd)
                                                float *velocity_y = smoke_get_velocity_y(sds->fluid);                                                           
                                                float *velocity_z = smoke_get_velocity_z(sds->fluid);                                                           
                                                unsigned char *obstacle = smoke_get_obstacle(sds->fluid);                                                               
-                                               int bigres[3];  
+                                               int bigres[3];
+                                               short absolute_flow = (sfs->flags & MOD_SMOKE_FLOW_ABSOLUTE);
+                                               short high_emission_smoothing = bigdensity ? (smd->domain->flags & MOD_SMOKE_HIGH_SMOOTH) : 0;
+
+                                               /*
+                                               * A temporary volume map used to store whole emissive
+                                               * area to be added to smoke density and interpolated
+                                               * for high resolution smoke.
+                                               */
+                                               float *temp_emission_map = NULL;
+
+                                               // initialize temp emission map
+                                               if(!(sfs->type & MOD_SMOKE_FLOW_TYPE_OUTFLOW))
+                                               {
+                                                       int i;
+                                                       temp_emission_map = MEM_callocN(sizeof(float) * sds->res[0]*sds->res[1]*sds->res[2], "SmokeTempEmission");
+                                                       // set whole volume to 0.0f
+                                                       for (i=0; i<sds->res[0]*sds->res[1]*sds->res[2]; i++) {
+                                                               temp_emission_map[i] = 0.0f;
+                                                       }
+                                               }
                                                                                                                
                                                // mostly copied from particle code                                                             
                                                for(p=0, pa=psys->particles; p<psys->totpart; p++, pa++)                                                                
@@ -905,33 +931,20 @@ static void smoke_calc_domain(Scene *scene, Object *ob, SmokeModifierData *smd)
                                                                // heat[index] += sfs->temp * 0.1;                                                                              
                                                                // density[index] += sfs->density * 0.1;
                                                                heat[index] = sfs->temp;
-                                                               density[index] = sfs->density;
+                                                               
+                                                               // Add emitter density to temp emission map
+                                                               temp_emission_map[index] = sfs->density;
 
 
                                                                // Uses particle velocity as initial velocity for smoke
-                                                               if(smd->domain->flags & MOD_SMOKE_INITVELOCITY) {
-                                                               velocity_x[index] = pa->state.vel[0];
-                                                               velocity_y[index] = pa->state.vel[1];
-                                                               velocity_z[index] = pa->state.vel[2];                                                                           
-                                                               }                                                                               
-                                                               
-                                                               // obstacle[index] |= 2;
-                                                               // we need different handling for the high-res feature
-                                                               if(bigdensity)
+                                                               if(sfs->flags & MOD_SMOKE_FLOW_INITVELOCITY && (psys->part->phystype != PART_PHYS_NO))
                                                                {
-                                                                       // init all surrounding cells according to amplification, too
-                                                                       int i, j, k;
-
-                                                                       smoke_turbulence_get_res(smd->domain->wt, bigres);
+                                                                       velocity_x[index] = pa->state.vel[0]*sfs->vel_multi;
+                                                                       velocity_y[index] = pa->state.vel[1]*sfs->vel_multi;
+                                                                       velocity_z[index] = pa->state.vel[2]*sfs->vel_multi;
+                                                               }                                                                               
+                                                       
 
-                                                                       for(i = 0; i < smd->domain->amplify + 1; i++)
-                                                                               for(j = 0; j < smd->domain->amplify + 1; j++)
-                                                                                       for(k = 0; k < smd->domain->amplify + 1; k++)                                                                                                   
-                                                                                       {                                                                                                               
-                                                                                               index = smoke_get_index((smd->domain->amplify + 1)* cell[0] + i, bigres[0], (smd->domain->amplify + 1)* cell[1] + j, bigres[1], (smd->domain->amplify + 1)* cell[2] + k);                                                                                                               
-                                                                                               bigdensity[index] = sfs->density;                                                                                                       
-                                                                                       }                                                                               
-                                                               }                                                                       
                                                        }                                                                       
                                                        else if(sfs->type & MOD_SMOKE_FLOW_TYPE_OUTFLOW) // outflow                                                                     
                                                        {                                                                               
@@ -954,9 +967,136 @@ static void smoke_calc_domain(Scene *scene, Object *ob, SmokeModifierData *smd)
                                                                                                index = smoke_get_index((smd->domain->amplify + 1)* cell[0] + i, bigres[0], (smd->domain->amplify + 1)* cell[1] + j, bigres[1], (smd->domain->amplify + 1)* cell[2] + k);                                                                                                               
                                                                                                bigdensity[index] = 0.f;                                                                                                        
                                                                                        }                                                                               
-                                                               }                                                                       
-                                                       }       // particles loop                                                       
-                                       }                                                       
+                                                               }
+                                                       }
+                                                       }       // particles loop
+
+
+                                                       // apply emission values
+                                                       if(!(sfs->type & MOD_SMOKE_FLOW_TYPE_OUTFLOW)) {
+
+                                                               // initialize variables
+                                                               int ii, jj, kk, x, y, z, block_size;
+                                                               size_t index, index_big;
+
+                                                               smoke_turbulence_get_res(smd->domain->wt, bigres);
+                                                               block_size = smd->domain->amplify + 1;  // high res block size
+
+
+                                                                       // loop through every low res cell
+                                                                       for(x = 0; x < sds->res[0]; x++)
+                                                                               for(y = 0; y < sds->res[1]; y++)
+                                                                                       for(z = 0; z < sds->res[2]; z++)                                                                                                        
+                                                                                       {
+
+                                                                                               // neighbour cell emission densities (for high resolution smoke smooth interpolation)
+                                                                                               float c000, c001, c010, c011,  c100, c101, c110, c111;
+
+                                                                                               c000 = (x>0 && y>0 && z>0) ? temp_emission_map[smoke_get_index(x-1, sds->res[0], y-1, sds->res[1], z-1)] : 0;
+                                                                                               c001 = (x>0 && y>0) ? temp_emission_map[smoke_get_index(x-1, sds->res[0], y-1, sds->res[1], z)] : 0;
+                                                                                               c010 = (x>0 && z>0) ? temp_emission_map[smoke_get_index(x-1, sds->res[0], y, sds->res[1], z-1)] : 0;
+                                                                                               c011 = (x>0) ? temp_emission_map[smoke_get_index(x-1, sds->res[0], y, sds->res[1], z)] : 0;
+
+                                                                                               c100 = (y>0 && z>0) ? temp_emission_map[smoke_get_index(x, sds->res[0], y-1, sds->res[1], z-1)] : 0;
+                                                                                               c101 = (y>0) ? temp_emission_map[smoke_get_index(x, sds->res[0], y-1, sds->res[1], z)] : 0;
+                                                                                               c110 = (z>0) ? temp_emission_map[smoke_get_index(x, sds->res[0], y, sds->res[1], z-1)] : 0;
+                                                                                               c111 = temp_emission_map[smoke_get_index(x, sds->res[0], y, sds->res[1], z)];                   // this cell
+
+
+
+                                                                                               // get cell index
+                                                                                               index = smoke_get_index(x, sds->res[0], y, sds->res[1], z);
+
+                                                                                               // add emission to low resolution density
+                                                                                               if (absolute_flow) {if (temp_emission_map[index]>0) density[index] = temp_emission_map[index];}
+                                                                                               else {
+                                                                                                       density[index] += temp_emission_map[index];
+                                                                                                       if (density[index]>1) density[index]=1.0f;
+                                                                                               }
+
+                                                                                               smoke_turbulence_get_res(smd->domain->wt, bigres);
+
+
+
+                                                                                               /*
+                                                                                               loop through high res blocks if high res enabled
+                                                                                               */
+                                                                                               if (bigdensity)
+                                                                                               for(ii = 0; ii < block_size; ii++)
+                                                                                                       for(jj = 0; jj < block_size; jj++)
+                                                                                                               for(kk = 0; kk < block_size; kk++)                                                                                                      
+                                                                                                               {
+
+                                                                                                               float fx,fy,fz, interpolated_value;
+                                                                                                               int shift_x, shift_y, shift_z;
+
+
+                                                                                                               /*
+                                                                                                               * Do volume interpolation if emitter smoothing
+                                                                                                               * is enabled
+                                                                                                               */
+                                                                                                               if (high_emission_smoothing) {
+                                                                                                                       // convert block position to relative
+                                                                                                                       // for interpolation smoothing
+                                                                                                                       fx = (float)ii/block_size + 0.5f/block_size;
+                                                                                                                       fy = (float)jj/block_size + 0.5f/block_size;
+                                                                                                                       fz = (float)kk/block_size + 0.5f/block_size;
+
+                                                                                                                       // calculate trilinear interpolation
+                                                                                                                       interpolated_value = c000 * (1-fx) * (1-fy) * (1-fz) +
+                                                                                                                       c100 * fx * (1-fy) * (1-fz) +
+                                                                                                                       c010 * (1-fx) * fy * (1-fz) +
+                                                                                                                       c001 * (1-fx) * (1-fy) * fz +
+                                                                                                                       c101 * fx * (1-fy) * fz +
+                                                                                                                       c011 * (1-fx) * fy * fz +
+                                                                                                                       c110 * fx * fy * (1-fz) +
+                                                                                                                       c111 * fx * fy * fz;
+
+
+                                                                                                                       // add some contrast / sharpness
+                                                                                                                       // depending on hi-res block size
+
+                                                                                                                       interpolated_value = (interpolated_value-0.4f*sfs->density)*(block_size/2) + 0.4f*sfs->density;
+                                                                                                                       if (interpolated_value<0.0f) interpolated_value = 0.0f;
+                                                                                                                       if (interpolated_value>1.0f) interpolated_value = 1.0f;
+
+                                                                                                                       // shift smoke block index
+                                                                                                                       // (because pixel center is actually
+                                                                                                                       // in halfway of the low res block)
+                                                                                                                       shift_x = (x < 1) ? 0 : block_size/2;
+                                                                                                                       shift_y = (y < 1) ? 0 : block_size/2;
+                                                                                                                       shift_z = (z < 1) ? 0 : block_size/2;
+                                                                                                               }
+                                                                                                               else {
+                                                                                                                       // without interpolation use same low resolution
+                                                                                                                       // block value for all hi-res blocks
+                                                                                                                       interpolated_value = c111;
+                                                                                                                       shift_x = 0;
+                                                                                                                       shift_y = 0;
+                                                                                                                       shift_z = 0;
+                                                                                                               }
+
+                                                                                                               // get shifted index for current high resolution block
+                                                                                                               index_big = smoke_get_index(block_size * x + ii - shift_x, bigres[0], block_size * y + jj - shift_y, bigres[1], block_size * z + kk - shift_z);                                                                                                         
+                                                                                                               
+                                                                                                               // add emission data to high resolution density
+                                                                                                               if (absolute_flow) {if (interpolated_value > 0) bigdensity[index_big] = interpolated_value;}
+                                                                                                               else {
+                                                                                                                       bigdensity[index_big] += interpolated_value;
+                                                                                                                       if (bigdensity[index_big]>1) bigdensity[index_big]=1.0f;
+                                                                                                               }
+
+                                                                                                               } // end of hires loop
+
+                                                                       }       // end of low res loop
+
+                                                               // free temporary emission map
+                                                       if (temp_emission_map) MEM_freeN(temp_emission_map);
+
+                                                       }       // end emission
+
+
+                                                                               
                                }                                                       
                                else                                                    
                                {                                                               
@@ -970,7 +1110,7 @@ static void smoke_calc_domain(Scene *scene, Object *ob, SmokeModifierData *smd)
 
                                                BLI_bvhtree_find_nearest(sfs->bvh->tree, pco, &nearest, sfs->bvh->nearest_callback, sfs->bvh);
                                        }*/                                                     
-                               }                                               
+                               }
                        }                                               
                }
                        if(sds->fluid_group)
@@ -1272,7 +1412,7 @@ void smokeModifier_do(SmokeModifierData *smd, Scene *scene, Object *ob, DerivedM
                {
                        if(sds->flags & MOD_SMOKE_DISSOLVE)
                                smoke_dissolve(sds->fluid, sds->diss_speed, sds->flags & MOD_SMOKE_DISSOLVE_LOG);
-                       smoke_step(sds->fluid, smd->time);
+                       smoke_step(sds->fluid, smd->time, scene->r.frs_sec / scene->r.frs_sec_base);
                }
 
                // create shadows before writing cache so we get nice shadows for sstartframe, too
index e8328d0e62214c759a6676419f7b2e578ac532d1..5a6ebb187cfc10452e9a84388501c3015a774b38 100644 (file)
@@ -2683,19 +2683,20 @@ void uncomment(Text *text)
        }
 }
 
-int setcurr_tab (Text *text)
+int setcurr_tab_spaces (Text *text, int space)
 {
        int i = 0;
        int test = 0;
-       char *word = ":";
-       char *comm = "#";
-       char back_words[4][7] = {"return", "break", "pass", "yield"};
+       const char *word = ":";
+       const char *comm = "#";
+       const char indent= (text->flags & TXT_TABSTOSPACES) ? ' ' : '\t';
+       static char *back_words[]= {"return", "break", "continue", "pass", "yield", NULL};
        if (!text) return 0;
        if (!text->curl) return 0;
-       
-       while (text->curl->line[i] == '\t')
+
+       while (text->curl->line[i] == indent)
        {
-               //we only count thos tabs that are before any text or before the curs;
+               //we only count those tabs/spaces that are before any text or before the curs;
                if (i == text->curc)
                {
                        return i;
@@ -2718,18 +2719,18 @@ int setcurr_tab (Text *text)
                        }
                }
                if (indent) {
-                       i++;
+                       i += space;
                }
        }
 
-       for(test=0; test < 4; test++)
+       for(test=0; back_words[test]; test++)
        {
-               //if there are these 4 key words then remove a tab because we are done with the block
+               /* if there are these key words then remove a tab because we are done with the block */
                if(strstr(text->curl->line, back_words[test]) && i > 0)
                {
                        if(strcspn(text->curl->line, back_words[test]) < strcspn(text->curl->line, comm))
                        {
-                               i--;
+                               i -= space;
                        }
                }
        }
index 57816b7e47068ba7629416824c9f29ce36715787..d05d8ccbc0880efd106acc5261f6e5534910db87 100644 (file)
@@ -403,6 +403,73 @@ void colorband_table_RGBA(ColorBand *coba, float **array, int *size)
                do_colorband(coba, (float)a/(float)CM_TABLE, &(*array)[a*4]);
 }
 
+int vergcband(const void *a1, const void *a2)
+{
+       const CBData *x1=a1, *x2=a2;
+
+       if( x1->pos > x2->pos ) return 1;
+       else if( x1->pos < x2->pos) return -1;
+       return 0;
+}
+
+CBData *colorband_element_add(struct ColorBand *coba, float position)
+{
+       int a;
+
+       if(coba->tot==MAXCOLORBAND) {
+               return NULL;
+       }
+       else if(coba->tot > 0) {
+               CBData *xnew;
+               float col[4];
+
+               do_colorband(coba, position, col);
+
+               xnew = &coba->data[coba->tot];
+               xnew->pos = position;
+
+               xnew->r = col[0];
+               xnew->g = col[1];
+               xnew->b = col[2];
+               xnew->a = col[3];
+       }
+
+       coba->tot++;
+       coba->cur = coba->tot-1;
+
+       for(a = 0; a < coba->tot; a++)
+               coba->data[a].cur = a;
+
+       qsort(coba->data, coba->tot, sizeof(CBData), vergcband);
+
+       for(a = 0; a < coba->tot; a++) {
+               if(coba->data[a].cur == coba->cur) {
+                       coba->cur = a;
+                       break;
+               }
+       }
+
+       return coba->data + coba->cur;
+}
+
+int colorband_element_remove(struct ColorBand *coba, int index)
+{
+       int a;
+
+       if(coba->tot < 2)
+               return 0;
+
+       if(index < 0 || index >= coba->tot)
+               return 0;
+
+       for(a = index; a < coba->tot; a++) {
+               coba->data[a] = coba->data[a + 1];
+       }
+       if(coba->cur) coba->cur--;
+       coba->tot--;
+       return 1;
+}
+
 /* ******************* TEX ************************ */
 
 void free_texture(Tex *tex)
index 388a9176d53d0322fd7f02c123af949e78684c77..f3da20f91c2a5422e1ea51b26f7c2f37e42d3017 100644 (file)
@@ -40,10 +40,10 @@ extern "C" {
 
 /* init */
 void unit_qt(float q[4]);
-void copy_qt_qt(float q[4], float a[4]);
+void copy_qt_qt(float q[4], const float a[4]);
 
 /* arithmetic */
-void mul_qt_qtqt(float q[4], float a[4], float b[4]);
+void mul_qt_qtqt(float q[4], const float a[4], const float b[4]);
 void mul_qt_v3(float q[4], float r[3]);
 void mul_qt_fl(float q[4], float f);
 void mul_fac_qt_fl(float q[4], float f);
@@ -51,6 +51,7 @@ void mul_fac_qt_fl(float q[4], float f);
 void sub_qt_qtqt(float q[4], float a[4], float b[4]);
 
 void invert_qt(float q[4]);
+void invert_qt_qt(float *q1, const float *q2);
 void conjugate_qt(float q[4]);
 float dot_qtqt(float a[4], float b[4]);
 void normalize_qt(float q[4]);
@@ -72,6 +73,7 @@ void tri_to_quat(float q[4], float a[3], float b[3], float c[3]);
 void vec_to_quat(float q[4], float vec[3], short axis, short upflag);
 /* note: v1 and v2 must be normalized */
 void rotation_between_vecs_to_quat(float q[4], const float v1[3], const float v2[3]);
+void rotation_between_quats_to_quat(float q[4], const float q1[4], const float q2[4]);
 
 /* TODO: don't what this is, but it's not the same as mat3_to_quat */
 void mat3_to_quat_is_ok(float q[4], float mat[3][3]);
index 02d5fb27dc90a4ac9ddac0a3a20e8967a090d06a..15135e08225366408557b6e9bd9152d91fee4315 100644 (file)
@@ -126,6 +126,7 @@ MINLINE int compare_v3v3(float a[3], float b[3], float limit);
 MINLINE int compare_len_v3v3(float a[3], float b[3], float limit);
 
 MINLINE int compare_v4v4(float a[4], float b[4], float limit);
+MINLINE int equals_v4v4(float a[4], float b[4]);
 
 /********************************** Angles ***********************************/
 /* - angle with 2 arguments is angle between vector                          */
index f8ebc3938a1d8302153d012f87c35c54c41ec4f5..bc3584db03effa1597108d59e4cc064889db0bf5 100644 (file)
@@ -58,6 +58,8 @@ struct direntry{
        char    *path;
 #if (defined(WIN32) || defined(WIN64)) && (_MSC_VER>=1500)
        struct _stat64 s;
+#elif defined(__MINGW32__)
+       struct _stati64 s;
 #else
        struct  stat s;
 #endif
index 6e8f46224882865edc387043f2cfb1d4fba36098..6c06da2e32dbb7061117ddcbd8566ef33c4e5588 100644 (file)
@@ -309,6 +309,7 @@ void mul_v3_m4v3(float *in, float mat[][4], float *vec)
        in[2]= x*mat[0][2] + y*mat[1][2] + mat[2][2]*vec[2] + mat[3][2];
 }
 
+/* same as mul_m4_v3() but doesnt apply translation component */
 void mul_mat3_m4_v3(float mat[][4], float *vec)
 {
        float x,y;
index 6b5bf7743ef695a01740b2c90d980f1c07801c34..a8cacb60f05788018a468edee28b4a339ebb644a 100644 (file)
@@ -36,7 +36,7 @@ void unit_qt(float *q)
        q[1]= q[2]= q[3]= 0.0f;
 }
 
-void copy_qt_qt(float *q1, float *q2)
+void copy_qt_qt(float *q1, const float *q2)
 {
        q1[0]= q2[0];
        q1[1]= q2[1];
@@ -49,7 +49,7 @@ int is_zero_qt(float *q)
        return (q[0] == 0 && q[1] == 0 && q[2] == 0 && q[3] == 0);
 }
 
-void mul_qt_qtqt(float *q, float *q1, float *q2)
+void mul_qt_qtqt(float *q, const float *q1, const float *q2)
 {
        float t0,t1,t2;
 
@@ -104,6 +104,12 @@ void invert_qt(float *q)
        mul_qt_fl(q, 1.0f/f);
 }
 
+void invert_qt_qt(float *q1, const float *q2)
+{
+       copy_qt_qt(q1, q2);
+       invert_qt(q1);
+}
+
 /* simple mult */
 void mul_qt_fl(float *q, float f)
 {
@@ -336,6 +342,23 @@ void rotation_between_vecs_to_quat(float *q, const float v1[3], const float v2[3
        axis_angle_to_quat(q, axis, angle);
 }
 
+void rotation_between_quats_to_quat(float *q, const float q1[4], const float q2[4])
+{
+       float tquat[4];
+       double dot = 0.0f;
+       int x;
+
+       copy_qt_qt(tquat, q1);
+       conjugate_qt(tquat);
+       dot = 1.0f / dot_qtqt(tquat, tquat);
+
+       for(x = 0; x < 4; x++)
+               tquat[x] *= dot;
+
+       mul_qt_qtqt(q, tquat, q2);
+}
+
+
 void vec_to_quat(float *q,float *vec, short axis, short upflag)
 {
        float q2[4], nor[3], *fp, mat[3][3], angle, si, co, x2, y2, z2, len1;
index fa8d1a30269c01a58f39683b6dff35a160642df3..84d96d1d22aa9121b2c8e972d991f129310f43db 100644 (file)
@@ -409,6 +409,11 @@ MINLINE int equals_v3v3(float *v1, float *v2)
        return ((v1[0]==v2[0]) && (v1[1]==v2[1]) && (v1[2]==v2[2]));
 }
 
+MINLINE int equals_v4v4(float *v1, float *v2)
+{
+       return ((v1[0]==v2[0]) && (v1[1]==v2[1]) && (v1[2]==v2[2]) && (v1[3]==v2[3]));
+}
+
 MINLINE int compare_v3v3(float *v1, float *v2, float limit)
 {
        if(fabs(v1[0]-v2[0])<limit)
index f4679aa4dcf733e0ef934358b354c734365483d8..edb6aecabb14a0c5bffcabc14da8872a5e59ff21 100644 (file)
  * Some really low-level file thingies.
  */
 
-/* needed for mingw & _stat64i32 */
-#ifdef FREE_WINDOWS
-# define __MSVCRT_VERSION__ 0x0800
-#endif
-
 #include <sys/types.h>
 #include <stdio.h>
 #include <stdlib.h>    
@@ -255,6 +250,8 @@ void BLI_builddir(char *dirname, char *relname)
 // Excluding other than current MSVC compiler until able to test.
 #if (defined(WIN32) || defined(WIN64)) && (_MSC_VER>=1500)
                                        _stat64(dlink->name,&files[actnum].s);
+#elif defined(__MINGW32__)
+                                       _stati64(dlink->name,&files[actnum].s);
 #else
                                        stat(dlink->name,&files[actnum].s);
 #endif
@@ -449,14 +446,14 @@ int BLI_exist(char *name)
        if (len > 3 && ( tmp[len-1]=='\\' || tmp[len-1]=='/') ) tmp[len-1] = '\0';
        res = _stat(tmp, &st);
        if (res == -1) return(0);
-#elif defined(WIN32) && defined(__MINGW32__)
-       struct stat st;
+#elif defined(__MINGW32__)
+       struct _stati64 st;
        char tmp[FILE_MAXDIR+FILE_MAXFILE];
        int len, res;
        BLI_strncpy(tmp, name, FILE_MAXDIR+FILE_MAXFILE);
        len = strlen(tmp);
        if (len > 3 && ( tmp[len-1]=='\\' || tmp[len-1]=='/') ) tmp[len-1] = '\0';
-       res = stat(tmp, &st);
+       res = _stati64(tmp, &st);
        if (res) return(0);
 #else
        struct stat st;
index 3514eb91dd5c4d7da0ac04fe6fe3364c80367918..c050f25256adf3a3a8d01f3831e3252428ff388d 100644 (file)
@@ -3298,6 +3298,7 @@ static void direct_link_mesh(FileData *fd, Mesh *mesh)
        mesh->msticky= newdataadr(fd, mesh->msticky);
        mesh->dvert= newdataadr(fd, mesh->dvert);
        
+       /* animdata */
        mesh->adt= newdataadr(fd, mesh->adt);
        direct_link_animdata(fd, mesh->adt);
 
@@ -11065,6 +11066,56 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
                }
        }
 
+       if (main->versionfile < 253 || (main->versionfile == 253 && main->subversionfile < 1))
+               {
+                       Object *ob;
+
+                       for(ob = main->object.first; ob; ob = ob->id.next) {
+                               ModifierData *md;
+                               for(md= ob->modifiers.first; md; md= md->next) {
+                                       if (md->type == eModifierType_Smoke) {
+                                               SmokeModifierData *smd = (SmokeModifierData *)md;
+
+                                               if((smd->type & MOD_SMOKE_TYPE_DOMAIN) && smd->domain)
+                                               {
+                                                       smd->domain->vorticity = 2.0f;
+                                                       smd->domain->time_scale = 1.0f;
+
+                                                       if(!(smd->domain->flags & (1<<4)))
+                                                               continue;
+
+                                                       /* delete old MOD_SMOKE_INITVELOCITY flag */
+                                                       smd->domain->flags &= ~(1<<4);
+
+                                                       /* for now just add it to all flow objects in the scene */
+                                                       {
+                                                               Object *ob2;
+                                                               for(ob2 = main->object.first; ob2; ob2 = ob2->id.next) {
+                                                                       ModifierData *md2;
+                                                                       for(md2= ob2->modifiers.first; md2; md2= md2->next) {
+                                                                               if (md2->type == eModifierType_Smoke) {
+                                                                                       SmokeModifierData *smd2 = (SmokeModifierData *)md2;
+
+                                                                                       if((smd2->type & MOD_SMOKE_TYPE_FLOW) && smd2->flow)
+                                                                                       {
+                                                                                               smd2->flow->flags |= MOD_SMOKE_FLOW_INITVELOCITY;
+                                                                                       }
+                                                                               }
+                                                                       }
+                                                               }
+                                                       }
+
+                                               }
+                                               else if((smd->type & MOD_SMOKE_TYPE_FLOW) && smd->flow)
+                                               {
+                                                       smd->flow->vel_multi = 1.0f;
+                                               }
+
+                                       }
+                               }
+                       }
+               }
+
        /* put compatibility code here until next subversion bump */
        {
        }
@@ -11681,6 +11732,9 @@ static void expand_mesh(FileData *fd, Main *mainvar, Mesh *me)
        TFace *tf;
        int a, i;
        
+       if(me->adt)
+               expand_animdata(fd, mainvar, me->adt);
+               
        for(a=0; a<me->totcol; a++) {
                expand_doit(fd, mainvar, me->mat[a]);
        }
index bee1b0a5388fee21f2dede2f7fbee5c1ff0cb419..eab6a4c2b5559791d52800ef2c84e5756ce62493 100644 (file)
@@ -1538,6 +1538,7 @@ static void write_meshs(WriteData *wd, ListBase *idbase)
 
                        /* direct data */
                        if (mesh->id.properties) IDP_WriteProperty(mesh->id.properties, wd);
+                       if (mesh->adt) write_animdata(wd, mesh->adt);
 
                        writedata(wd, DATA, sizeof(void *)*mesh->totcol, mesh->mat);
 
index f8e793bd1781f99a354c2e27db6babdc15c41fb6..7db20fea6eb81f3032295375fa3537f3608cadc5 100644 (file)
@@ -1752,9 +1752,8 @@ EditBone *ED_armature_bone_get_mirrored(ListBase *edbo, EditBone *ebo)
        
        if (ebo == NULL)
                return NULL;
-       
-       BLI_strncpy(name, ebo->name, sizeof(name));
-       bone_flip_name(name, 0);                // 0 = don't strip off number extensions
+
+       flip_side_name(name, ebo->name, FALSE);
        
        for (eboflip= edbo->first; eboflip; eboflip=eboflip->next) {
                if (ebo != eboflip) {
@@ -2328,12 +2327,10 @@ void add_primitive_bone(Scene *scene, View3D *v3d, RegionView3D *rv3d)
        Object *obedit= scene->obedit; // XXX get from context
        float           obmat[3][3], curs[3], viewmat[3][3], totmat[3][3], imat[3][3];
        EditBone        *bone;
-       
-       VECCOPY(curs, give_cursor(scene, v3d)); 
 
        /* Get inverse point for head and orientation for tail */
        invert_m4_m4(obedit->imat, obedit->obmat);
-       mul_m4_v3(obedit->imat, curs);
+       mul_v3_m4v3(curs, obedit->imat, give_cursor(scene, v3d));
 
        if (rv3d && (U.flag & USER_ADD_VIEWALIGNED))
                copy_m3_m4(obmat, rv3d->viewmat);
@@ -2348,7 +2345,7 @@ void add_primitive_bone(Scene *scene, View3D *v3d, RegionView3D *rv3d)
        /*      Create a bone   */
        bone= ED_armature_edit_bone_add(obedit->data, "Bone");
 
-       VECCOPY(bone->head, curs);
+       copy_v3_v3(bone->head, curs);
        
        if (rv3d && (U.flag & USER_ADD_VIEWALIGNED))
                add_v3_v3v3(bone->tail, bone->head, imat[1]);   // bone with unit length 1
@@ -2941,17 +2938,14 @@ static int armature_fill_bones_exec (bContext *C, wmOperator *op)
        }
        else if (count == 1) {
                EditBonePoint *ebp;
-               float *fp, curs[3];
+               float curs[3];
                
                /* Get Points - selected joint */
                ebp= (EditBonePoint *)points.first;
                
                /* Get points - cursor (tail) */
-               fp= give_cursor(scene, v3d);
-               VECCOPY (curs, fp);     
-               
                invert_m4_m4(obedit->imat, obedit->obmat);
-               mul_m4_v3(obedit->imat, curs);
+               mul_v3_m4v3(curs, obedit->imat, give_cursor(scene, v3d));
                
                /* Create a bone */
                newbone= add_points_bone(obedit, ebp->vec, curs);
@@ -2979,15 +2973,13 @@ static int armature_fill_bones_exec (bContext *C, wmOperator *op)
                /* find which one should be the 'head' */
                if ((ebp->head_owner && ebp2->head_owner) || (ebp->tail_owner && ebp2->tail_owner)) {
                        /* rule: whichever one is closer to 3d-cursor */
-                       float curs[3], *fp= give_cursor(scene, v3d);
+                       float curs[3];
                        float vecA[3], vecB[3];
                        float distA, distB;
                        
                        /* get cursor location */
-                       VECCOPY(curs, fp);      
-                       
                        invert_m4_m4(obedit->imat, obedit->obmat);
-                       mul_m4_v3(obedit->imat, curs);
+                       mul_v3_m4v3(curs, obedit->imat, give_cursor(scene, v3d));
                        
                        /* get distances */
                        sub_v3_v3v3(vecA, ebp->vec, curs);
@@ -3007,12 +2999,12 @@ static int armature_fill_bones_exec (bContext *C, wmOperator *op)
                
                /* assign head/tail combinations */
                if (headtail == 2) {
-                       VECCOPY(head, ebp->vec);
-                       VECCOPY(tail, ebp2->vec);
+                       copy_v3_v3(head, ebp->vec);
+                       copy_v3_v3(tail, ebp2->vec);
                }
                else if (headtail == 1) {
-                       VECCOPY(head, ebp2->vec);
-                       VECCOPY(tail, ebp->vec);
+                       copy_v3_v3(head, ebp2->vec);
+                       copy_v3_v3(tail, ebp->vec);
                }
                
                /* add new bone and parent it to the appropriate end */
@@ -3095,16 +3087,16 @@ static void bones_merge(Object *obedit, EditBone *start, EditBone *end, EditBone
         *      - parent = parent of start
         */
        if ((start->flag & BONE_TIPSEL) && ((start->flag & BONE_SELECTED) || start==arm->act_edbone)==0) {
-               VECCOPY(head, start->tail);
+               copy_v3_v3(head, start->tail);
        }
        else {
-               VECCOPY(head, start->head);
+               copy_v3_v3(head, start->head);
        }
        if ((end->flag & BONE_ROOTSEL) && ((end->flag & BONE_SELECTED) || end==arm->act_edbone)==0) {
-               VECCOPY(tail, end->head);
+               copy_v3_v3(tail, end->head);
        }
        else {
-               VECCOPY(tail, end->tail);
+               copy_v3_v3(tail, end->tail);
        }
        newbone= add_points_bone(obedit, head, tail);
        newbone->parent = start->parent;
@@ -3376,8 +3368,8 @@ static int armature_extrude_exec(bContext *C, wmOperator *op)
                                        newbone = MEM_callocN(sizeof(EditBone), "extrudebone");
                                        
                                        if (do_extrude==1) {
-                                               VECCOPY (newbone->head, ebone->tail);
-                                               VECCOPY (newbone->tail, newbone->head);
+                                               copy_v3_v3(newbone->head, ebone->tail);
+                                               copy_v3_v3(newbone->tail, newbone->head);
                                                newbone->parent = ebone;
                                                
                                                newbone->flag = ebone->flag & BONE_TIPSEL;      // copies it, in case mirrored bone
@@ -3385,8 +3377,8 @@ static int armature_extrude_exec(bContext *C, wmOperator *op)
                                                if (newbone->parent) newbone->flag |= BONE_CONNECTED;
                                        }
                                        else {
-                                               VECCOPY(newbone->head, ebone->head);
-                                               VECCOPY(newbone->tail, ebone->head);
+                                               copy_v3_v3(newbone->head, ebone->head);
+                                               copy_v3_v3(newbone->tail, ebone->head);
                                                newbone->parent= ebone->parent;
                                                
                                                newbone->flag= BONE_TIPSEL;
@@ -3476,7 +3468,7 @@ static int armature_bone_primitive_add_exec(bContext *C, wmOperator *op)
        
        RNA_string_get(op->ptr, "name", name);
        
-       VECCOPY(curs, give_cursor(CTX_data_scene(C),CTX_wm_view3d(C))); 
+       copy_v3_v3(curs, give_cursor(CTX_data_scene(C),CTX_wm_view3d(C)));      
 
        /* Get inverse point for head and orientation for tail */
        invert_m4_m4(obedit->imat, obedit->obmat);
@@ -3495,7 +3487,7 @@ static int armature_bone_primitive_add_exec(bContext *C, wmOperator *op)
        /*      Create a bone   */
        bone= ED_armature_edit_bone_add(obedit->data, name);
 
-       VECCOPY(bone->head, curs);
+       copy_v3_v3(bone->head, curs);
        
        if(rv3d && (U.flag & USER_ADD_VIEWALIGNED))
                add_v3_v3v3(bone->tail, bone->head, imat[1]);   // bone with unit length 1
@@ -3565,17 +3557,17 @@ static int armature_subdivide_exec(bContext *C, wmOperator *op)
                        BLI_addtail(arm->edbo, newbone);
                        
                        /* calculate location of newbone->head */
-                       VECCOPY(val1, ebone->head);
-                       VECCOPY(val2, ebone->tail);
-                       VECCOPY(val3, newbone->head);
+                       copy_v3_v3(val1, ebone->head);
+                       copy_v3_v3(val2, ebone->tail);
+                       copy_v3_v3(val3, newbone->head);
                        
                        val3[0]= val1[0]*cutratio + val2[0]*cutratioI;
                        val3[1]= val1[1]*cutratio + val2[1]*cutratioI;
                        val3[2]= val1[2]*cutratio + val2[2]*cutratioI;
                        
-                       VECCOPY(newbone->head, val3);
-                       VECCOPY(newbone->tail, ebone->tail);
-                       VECCOPY(ebone->tail, newbone->head);
+                       copy_v3_v3(newbone->head, val3);
+                       copy_v3_v3(newbone->tail, ebone->tail);
+                       copy_v3_v3(ebone->tail, newbone->head);
                        
                        newbone->rad_head= 0.5f * (ebone->rad_head + ebone->rad_tail);
                        ebone->rad_tail= newbone->rad_head;
@@ -3793,7 +3785,7 @@ void ARMATURE_OT_switch_direction(wmOperatorType *ot)
 static void bone_connect_to_existing_parent(EditBone *bone)
 {
        bone->flag |= BONE_CONNECTED;
-       VECCOPY(bone->head, bone->parent->tail);
+       copy_v3_v3(bone->head, bone->parent->tail);
        bone->rad_head = bone->parent->rad_tail;
 }
 
@@ -3821,7 +3813,7 @@ static void bone_connect_to_new_parent(ListBase *edbo, EditBone *selbone, EditBo
                selbone->flag |= BONE_CONNECTED;
                sub_v3_v3v3(offset, actbone->tail, selbone->head);
                
-               VECCOPY(selbone->head, actbone->tail);
+               copy_v3_v3(selbone->head, actbone->tail);
                selbone->rad_head= actbone->rad_tail;
                
                add_v3_v3(selbone->tail, offset);
@@ -4594,7 +4586,7 @@ static void add_vgroups__mapFunc(void *userData, int index, float *co, float *no
        /* DerivedMesh mapFunc for getting final coords in weight paint mode */
 
        float (*verts)[3] = userData;
-       VECCOPY(verts[index], co);
+       copy_v3_v3(verts[index], co);
 }
 
 static void envelope_bone_weighting(Object *ob, Mesh *mesh, float (*verts)[3], int numbones, Bone **bonelist, bDeformGroup **dgrouplist, bDeformGroup **dgroupflip, float (*root)[3], float (*tip)[3], int *selected, float scale)
@@ -4721,18 +4713,17 @@ void add_verts_to_dgroups(Scene *scene, Object *ob, Object *par, int heat, int m
                
                /* compute root and tip */
                if (bbone) {
-                       VECCOPY(root[j], bbone[segments].mat[3]);
-                       mul_m4_v3(bone->arm_mat, root[j]);
+                       mul_v3_m4v3(root[j], bone->arm_mat, bbone[segments].mat[3]);
                        if ((segments+1) < bone->segments) {
-                               VECCOPY(tip[j], bbone[segments+1].mat[3])
-                               mul_m4_v3(bone->arm_mat, tip[j]);
+                               mul_v3_m4v3(tip[j], bone->arm_mat, bbone[segments+1].mat[3]);
+                       }
+                       else {
+                               copy_v3_v3(tip[j], bone->arm_tail);
                        }
-                       else
-                               VECCOPY(tip[j], bone->arm_tail)
                }
                else {
-                       VECCOPY(root[j], bone->arm_head);
-                       VECCOPY(tip[j], bone->arm_tail);
+                       copy_v3_v3(root[j], bone->arm_head);
+                       copy_v3_v3(tip[j], bone->arm_tail);
                }
                
                mul_m4_v3(par->obmat, root[j]);
@@ -4749,11 +4740,10 @@ void add_verts_to_dgroups(Scene *scene, Object *ob, Object *par, int heat, int m
                /* find flipped group */
                if (dgroup && mirror) {
                        char name[32];
-                       
-                       BLI_strncpy(name, dgroup->name, 32);
+
                        // 0 = don't strip off number extensions
-                       bone_flip_name(name, 0);
-                       
+                       flip_side_name(name, dgroup->name, FALSE);
+
                        for (curdg = ob->defbase.first; curdg; curdg=curdg->next) {
                                if (!strcmp(curdg->name, name))
                                        break;
@@ -4789,7 +4779,7 @@ void add_verts_to_dgroups(Scene *scene, Object *ob, Object *par, int heat, int m
        /* transform verts to global space */
        for (i=0; i < mesh->totvert; i++) {
                if (!vertsfilled)
-                       VECCOPY(verts[i], mesh->mvert[i].co)
+                       copy_v3_v3(verts[i], mesh->mvert[i].co);
                mul_m4_v3(ob->obmat, verts[i]);
        }
 
@@ -5027,14 +5017,14 @@ static int pose_clear_rot_exec(bContext *C, wmOperator *op)
                                float eul[3], oldeul[3], quat1[4] = {0};
                                
                                if (pchan->rotmode == ROT_MODE_QUAT) {
-                                       QUATCOPY(quat1, pchan->quat);
+                                       copy_qt_qt(quat1, pchan->quat);
                                        quat_to_eul( oldeul,pchan->quat);
                                }
                                else if (pchan->rotmode == ROT_MODE_AXISANGLE) {
                                        axis_angle_to_eulO( oldeul, EULER_ORDER_DEFAULT,pchan->rotAxis, pchan->rotAngle);
                                }
                                else {
-                                       VECCOPY(oldeul, pchan->eul);
+                                       copy_v3_v3(oldeul, pchan->eul);
                                }
                                
                                eul[0]= eul[1]= eul[2]= 0.0f;
@@ -5057,7 +5047,7 @@ static int pose_clear_rot_exec(bContext *C, wmOperator *op)
                                        eulO_to_axis_angle( pchan->rotAxis, &pchan->rotAngle,eul, EULER_ORDER_DEFAULT);
                                }
                                else {
-                                       VECCOPY(pchan->eul, eul);
+                                       copy_v3_v3(pchan->eul, eul);
                                }
                        }
                }                                               // Duplicated in source/blender/editors/object/object_transform.c
@@ -5548,8 +5538,7 @@ static int armature_flip_names_exec (bContext *C, wmOperator *op)
        /* loop through selected bones, auto-naming them */
        CTX_DATA_BEGIN(C, EditBone *, ebone, selected_editable_bones)
        {
-               BLI_strncpy(newname, ebone->name, sizeof(newname));
-               bone_flip_name(newname, 1);             // 1 = do strip off number extensions
+               flip_side_name(newname, ebone->name, TRUE); // 1 = do strip off number extensions
                ED_armature_bone_rename(arm, ebone->name, newname);
        }
        CTX_DATA_END;
index 6b71ed1ca7a1e34b015b7f7c94e3b92023fa62bd..633b0b48a383ce904db69b85f0053bf3cb3dba74 100644 (file)
@@ -897,7 +897,6 @@ static int pose_paste_exec (bContext *C, wmOperator *op)
        Scene *scene= CTX_data_scene(C);
        Object *ob= CTX_data_active_object(C);
        bPoseChannel *chan, *pchan;
-       char name[32];
        int flip= RNA_boolean_get(op->ptr, "flipped");
        
        /* sanity checks */
@@ -913,10 +912,12 @@ static int pose_paste_exec (bContext *C, wmOperator *op)
        for (chan= g_posebuf->chanbase.first; chan; chan=chan->next) {
                if (chan->flag & POSE_KEY) {
                        /* get the name - if flipping, we must flip this first */
-                       BLI_strncpy(name, chan->name, sizeof(name));
+                       char name[32];
                        if (flip)
-                               bone_flip_name(name, 0);                /* 0 = don't strip off number extensions */
-                               
+                               flip_side_name(name, chan->name, 0);            /* 0 = don't strip off number extensions */
+                       else
+                               BLI_strncpy(name, chan->name, sizeof(name));
+
                        /* only copy when channel exists, poses are not meant to add random channels to anymore */
                        pchan= get_pose_channel(ob->pose, name);
                        
@@ -1431,7 +1432,6 @@ static int pose_flip_names_exec (bContext *C, wmOperator *op)
 {
        Object *ob= CTX_data_active_object(C);
        bArmature *arm;
-       char newname[32];
        
        /* paranoia checks */
        if (ELEM(NULL, ob, ob->pose)) 
@@ -1441,8 +1441,8 @@ static int pose_flip_names_exec (bContext *C, wmOperator *op)
        /* loop through selected bones, auto-naming them */
        CTX_DATA_BEGIN(C, bPoseChannel*, pchan, selected_pose_bones)
        {
-               BLI_strncpy(newname, pchan->name, sizeof(newname));
-               bone_flip_name(newname, 1);     // 1 = do strip off number extensions
+               char newname[32];
+               flip_side_name(newname, pchan->name, TRUE);
                ED_armature_bone_rename(arm, pchan->name, newname);
        }
        CTX_DATA_END;
@@ -1546,10 +1546,8 @@ void pose_activate_flipped_bone(Scene *scene)
                
                if(arm->act_bone) {
                        char name[32];
-                       
-                       BLI_strncpy(name, arm->act_bone->name, 32);
-                       bone_flip_name(name, 1);        // 0 = do not strip off number extensions
-                       
+                       flip_side_name(name, arm->act_bone->name, TRUE);
+
                        pchanf= get_pose_channel(ob->pose, name);
                        if(pchanf && pchanf->bone != arm->act_bone) {
                                arm->act_bone->flag &= ~BONE_SELECTED;
index 8d8dac33f9f1c66eeee66bb8fe1f2e3a83d488fc..d38c91da5c5c363de21c9bdbe91c0b5a74a827bb 100644 (file)
@@ -884,7 +884,7 @@ static void calc_shapeKeys(Object *obedit)
 
                                                                                fp+= 3; curofp+= 3;
                                                                        }
-                                                                       fp[0]= ofp[0];
+                                                                       fp[0]= curofp[0];
 
                                                                        if(apply_offset) {
                                                                                /* apply alfa offsets */
@@ -914,7 +914,7 @@ static void calc_shapeKeys(Object *obedit)
                                                                if (index >= 0) {
                                                                        curofp= ofp + index;
                                                                        VECCOPY(fp, curofp);
-                                                                       fp[3]= curofp[4];
+                                                                       fp[3]= curofp[3];
 
                                                                        if(apply_offset) {
                                                                                VECADD(fp, fp, ofs[i]);
index cecca2e9636d2e28340e8e2f1aba7165668e47c3..dff37c0a60c092363e34af98dc19866ba9f53dab 100644 (file)
 /* DataToC output of file <startup_blend> */
 
-int datatoc_startup_blend_size= 310404;
+int datatoc_startup_blend_size= 353564;
 char datatoc_startup_blend[]= {
- 66, 76, 69, 78,
- 68, 69, 82, 95,118, 50, 53, 51, 82, 69, 78, 68, 32,  0,  0,  0, 24,245,203,  1,  0,  0,  0,  0,  1,  0,  0,  0,  1,  0,  0,  0,
-250,  0,  0,  0, 83, 99,101,110,101,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 71, 76, 79, 66,
- 16,  1,  0,  0, 24,244,203,  1,201,  0,  0,  0,  1,  0,  0,  0, 32, 32, 32, 48,  0,  0,  0,  0,250,  0,  0,  0,  1,  0,  0,  1,
-144,199, 61,  2,144, 57, 63,  2,  0, 16,  0,  0,128, 32,  4,  0, 67, 58, 92, 68,111, 99,117,109,101,110,116,115, 32, 97,110,100,
- 32, 83,101,116,116,105,110,103,115, 92, 80,104,111,101,110,105,120, 92, 65,112,112,108,105, 99, 97,116,105,111,110, 32, 68, 97,
-116, 97, 92, 66,108,101,110,100,101,114, 32, 70,111,117,110,100, 97,116,105,111,110, 92, 66,108,101,110,100,101,114, 92, 50, 46,
- 53, 51, 92, 99,111,110,102,105,103, 92,115,116, 97,114,116,117,112, 46, 98,108,101,110,100,  0,176, 23,159,  0,154,104,157,  0,
-136,  6,  0,  0,  1,  0,  0,  0,184,244,203,  1, 40, 68,224,  5, 32,  0,  0,  0, 24,245,203,  1,141, 60,121,  0,104, 11,  6,  6,
- 24,245,203,  1, 32,  0,  0,  0, 24,245,203,  1, 32,  0,  0,  0,144,199, 61,  2, 40, 68,224,  5,239, 61,121,  0, 24,245,203,  1,
-144,&