merge runk 16887:16950
authorMartin Poirier <theeth@yahoo.com>
Mon, 6 Oct 2008 17:37:03 +0000 (17:37 +0000)
committerMartin Poirier <theeth@yahoo.com>
Mon, 6 Oct 2008 17:37:03 +0000 (17:37 +0000)
70 files changed:
config/linux2-config.py
doc/blender-scons.txt
extern/bullet2/src/BulletCollision/CollisionShapes/btTriangleIndexVertexArray.cpp
extern/bullet2/src/BulletSoftBody/btSoftBody.cpp
extern/bullet2/src/LinearMath/btScalar.h
intern/elbeem/intern/mvmcoords.cpp
release/scripts/vrml97_export.py
source/blender/blenkernel/BKE_blender.h
source/blender/blenkernel/BKE_displist.h
source/blender/blenkernel/BKE_global.h
source/blender/blenkernel/BKE_writeffmpeg.h
source/blender/blenkernel/intern/DerivedMesh.c
source/blender/blenkernel/intern/curve.c
source/blender/blenkernel/intern/displist.c
source/blender/blenkernel/intern/exotic.c
source/blender/blenkernel/intern/fluidsim.c
source/blender/blenkernel/intern/idprop.c
source/blender/blenkernel/intern/particle_system.c
source/blender/blenkernel/intern/pointcache.c
source/blender/blenkernel/intern/writeffmpeg.c
source/blender/blenlib/intern/util.c
source/blender/blenloader/intern/readfile.c
source/blender/gpu/intern/gpu_codegen.c
source/blender/gpu/intern/gpu_draw.c
source/blender/gpu/intern/gpu_material.c
source/blender/include/BDR_editobject.h
source/blender/include/BDR_gpencil.h
source/blender/include/BIF_editaction.h
source/blender/include/BSE_seqaudio.h
source/blender/makesdna/DNA_object_fluidsim.h
source/blender/makesdna/DNA_userdef_types.h
source/blender/python/BPY_interface.c
source/blender/python/api2_2x/NMesh.c
source/blender/python/api2_2x/doc/Object.py
source/blender/render/intern/source/convertblender.c
source/blender/src/SConscript
source/blender/src/autoarmature.c
source/blender/src/buttons_editing.c
source/blender/src/buttons_logic.c
source/blender/src/buttons_scene.c
source/blender/src/buttons_shading.c
source/blender/src/drawarmature.c
source/blender/src/drawgpencil.c
source/blender/src/drawobject.c
source/blender/src/drawseq.c
source/blender/src/drawtext.c
source/blender/src/drawview.c
source/blender/src/edit.c
source/blender/src/editaction_gpencil.c
source/blender/src/editmesh.c
source/blender/src/editobject.c
source/blender/src/editsound.c
source/blender/src/gpencil.c
source/blender/src/header_action.c
source/blender/src/header_view3d.c
source/blender/src/interface.c
source/blender/src/retopo.c
source/blender/src/seqaudio.c
source/blender/src/space.c
source/blender/src/toets.c
source/blender/src/transform_conversions.c
source/blender/src/transform_manipulator.c
source/blender/src/usiblender.c
source/blender/src/view.c
source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp
source/gameengine/Converter/KX_ConvertActuators.cpp
source/gameengine/GamePlayer/ghost/GPG_ghost.cpp
source/gameengine/Ketsji/KX_PythonInit.cpp
tools/Blender.py
tools/btools.py

index cd7e6659af1cc7d3cd2a0a30431f0059a9ad7cdd..2b7bf074f83eb14a29a6e26207bc814886a4e1f5 100644 (file)
@@ -143,21 +143,21 @@ BF_FFMPEG_LIB = ''
 BF_FFMPEG_INC = '${BF_FFMPEG}/include'
 BF_FFMPEG_LIBPATH='${BF_FFMPEG}/lib'
 
+# enable ogg, vorbis and theora in ffmpeg
+WITH_BF_OGG = 'false'  # -DWITH_OGG 
+BF_OGG = '/usr'
+BF_OGG_INC = '${BF_OGG}/include'
+BF_OGG_LIB = 'ogg vorbis theoraenc theoradec'
+
 WITH_BF_OPENJPEG = 'true' 
 BF_OPENJPEG = '#extern/libopenjpeg'
 BF_OPENJPEG_LIB = ''
-# Uncomment the following two lines to use system's ffmpeg
-# BF_FFMPEG = '/usr'
-# BF_FFMPEG_LIB = 'avformat avcodec swscale avutil'
 BF_OPENJPEG_INC = '${BF_OPENJPEG}/include'
 BF_OPENJPEG_LIBPATH='${BF_OPENJPEG}/lib'
 
 WITH_BF_REDCODE = 'false'  
 BF_REDCODE = '#extern/libredcode'
 BF_REDCODE_LIB = ''
-# Uncomment the following two lines to use system's ffmpeg
-# BF_FFMPEG = '/usr'
-# BF_FFMPEG_LIB = 'avformat avcodec swscale avutil'
 BF_REDCODE_INC = '${BF_REDCODE}/include'
 BF_REDCODE_LIBPATH='${BF_REDCODE}/lib'
 
index a7bbd28764e40f41f077a463b005d7e6b4516c55..8578d3f2fd42a987848bc66d6339f820f676e424 100644 (file)
@@ -58,6 +58,13 @@ $Id$
     $BLENDERHOME/config/(platform)-config.py. After the build successfully
     completes, you can find everything you need in BF_INSTALLDIR.
 
+    If you want to create the installer package of Blender on Windows you'll
+    need to install nullsoft scriptable install system from http://nsis.sf.net.
+    As an extra dependency, you need the MoreInfo plugin too. The creation of
+    the installer is tied into the build process and can be triggered with:
+
+        % scons nsis
+
 
     Configuring the build
     ---------------------
@@ -166,18 +173,6 @@ $Id$
     debug symbols.  Also note that BF_QUICKDEBUG and BF_DEBUG_LIBS are combined;
     for example, setting BF_QUICKDEBUG won't overwrite the contents of BF_DEBUG_LIBS.
 
-
-    Not installing
-    --------------
-
-    If you dont want to install the build result, you can use the following option either
-    on the commandline or in your user-config.py :
-
-        WITHOUT_BF_INSTALL='true'
-
-    by default, this is set to 'false', and so the build is installed
-
-
     Supported toolset
     -----------------
 
@@ -194,7 +189,6 @@ $Id$
     specify what toolset to use
 
         % scons BF_TOOLSET=msvc
-        % scons BF_TOOLSET=mstoolkit
         % scons BF_TOOLSET=mingw
 
     If you have only the toolkit installed, you will also need to give
index 8d634a6714393d4b04eeee2ba38287dbb2a35bd4..b962829041ac80a881abdd418d8ae2d0e1a1b88f 100644 (file)
@@ -16,6 +16,7 @@ subject to the following restrictions:
 #include "btTriangleIndexVertexArray.h"
 
 btTriangleIndexVertexArray::btTriangleIndexVertexArray(int numTriangles,int* triangleIndexBase,int triangleIndexStride,int numVertices,btScalar* vertexBase,int vertexStride)
+: m_hasAabb(0)
 {
        btIndexedMesh mesh;
 
index 0a27dbcedb5f8d17558a1c5d00eb271b5d195245..1604167b6efa7e674ab9d8c4ab1d51f7736fa7bc 100644 (file)
@@ -2439,6 +2439,10 @@ void                             btSoftBody::PSolve_RContacts(btSoftBody* psb,btScalar kst,btScalar ti)
        for(int i=0,ni=psb->m_rcontacts.size();i<ni;++i)
        {
                const RContact&         c=psb->m_rcontacts[i];
+               ///skip object that don't have collision response
+               if (!psb->getWorldInfo()->m_dispatcher->needsResponse(psb,c.m_cti.m_body))
+                       continue;
+
                const sCti&                     cti=c.m_cti;    
                const btVector3         va=cti.m_body->getVelocityInLocalPoint(c.m_c1)*dt;
                const btVector3         vb=c.m_node->m_x-c.m_node->m_q; 
index fa0262940ef33d1e7ba9949ba78d7bd50cdad14b..e8433405b20a61e04cd6582116a4ad9e2fb0b36e 100644 (file)
@@ -141,6 +141,10 @@ inline int btGetVersion()
 /// older compilers (gcc 3.x) and Sun needs double version of sqrt etc.
 /// exclude Apple Intel (i's assumed to be a Macbook or new Intel Dual Core Processor)
 #if defined (__sun) || defined (__sun__) || defined (__sparc) || (defined (__APPLE__) && ! defined (__i386__))
+/* XXX Need to fix these... needed for SunOS 5.8 */
+#define sinf(a)         sin((double)(a))
+#define cosf(a)         cos((double)(a))
+#define fabsf(a)        fabs((double)(a))
 //use slow double float precision operation on those platforms
 #ifndef BT_USE_DOUBLE_PRECISION
 #define BT_FORCE_DOUBLE_FUNCTIONS
index ac954b956d046b055e16418a4411857ed0b5cd21..03f6482ae84003c93dfe674015937903b2cf1475 100644 (file)
@@ -98,9 +98,9 @@ void MeanValueMeshCoords::computeWeights(vector<ntlVec3Gfx> &reference_vertices,
                if(mvmFullDebug) errMsg("MeanValueMeshCoords::computeWeights","c="<<c<<" phi="<<phi<<" d="<<d);
                //if (c[0] > 1. || c[0] < 0. || c[1] > 1. || c[1] < 0. || c[2] > 1. || c[2] < 0.) continue;
 
-               s[0] = sqrtf((float)(1.-c[0]*c[0]));
-               s[1] = sqrtf((float)(1.-c[1]*c[1]));
-               s[2] = sqrtf((float)(1.-c[2]*c[2]));
+               s[0] = sqrt((float)(1.-c[0]*c[0]));
+               s[1] = sqrt((float)(1.-c[1]*c[1]));
+               s[2] = sqrt((float)(1.-c[2]*c[2]));
 
                if(mvmFullDebug) errMsg("MeanValueMeshCoords::computeWeights","s");
                if (s[0] <= cEPS || s[1] <= cEPS || s[2] <= cEPS) {
index b28c7f5bbdc615506c299afdc07f12d6e5624d30..db21cabe14fc6e6ae9cb11544ac172678300ce97 100644 (file)
@@ -206,7 +206,7 @@ class VRML2Export:
                if scene != inlines[0]:
                        return
                else:
-                       for i in range(allinlines):
+                       for i in xrange(allinlines):
                                nameinline=inlines[i].getName()
                                if (nameinline not in self.namesStandard) and (i > 0):
                                        self.writeIndented("DEF %s Inline {\n" % \
@@ -219,7 +219,7 @@ class VRML2Export:
        def writeScript(self):
                textEditor = Blender.Text.Get() 
                alltext = len(textEditor)
-               for i in range(alltext):
+               for i in xrange(alltext):
                        nametext = textEditor[i].getName()
                        nlines = textEditor[i].getNLines()
                        if (self.proto == 1):
@@ -227,14 +227,14 @@ class VRML2Export:
                                        nametext == "proto.txt") and (nlines != None):
                                        nalllines = len(textEditor[i].asLines())
                                        alllines = textEditor[i].asLines()
-                                       for j in range(nalllines):
+                                       for j in xrange(nalllines):
                                                self.writeIndented(alllines[j] + "\n")
                        elif (self.proto == 0):
                                if (nametext == "route" or nametext == "route.js" or \
                                        nametext == "route.txt") and (nlines != None):
                                        nalllines = len(textEditor[i].asLines())
                                        alllines = textEditor[i].asLines()
-                                       for j in range(nalllines):
+                                       for j in xrange(nalllines):
                                                self.writeIndented(alllines[j] + "\n")
                self.writeIndented("\n")
 
@@ -556,31 +556,28 @@ class VRML2Export:
                issmooth = 0
 
                maters = me.materials
-               nummats = self.getNumMaterials(me)
+               nummats = len(me.materials)
 
                # Vertex and Face colors trump materials and image textures
                if (self.facecolors or self.vcolors):
                        if nummats > 0:
-                               if maters[0]:
-                                       self.writeShape(ob, me, 0, None)
-                               else:
-                                       self.writeShape(ob, me, -1, None)
+                               self.writeShape(ob, me, 0, None)
                        else:
                                self.writeShape(ob, me, -1, None)
-               # Do meshes with materials, possible with image textures
+
+               # Do meshes with materials, possibly with image textures
                elif nummats > 0:
-                       for matnum in range(len(maters)):
-                               if maters[matnum]:
-                                       images = []
-                                       if me.faceUV:
-                                               images = self.getImages(me, matnum)
-                                               if len(images) > 0:
-                                                       for image in images:
-                                                               self.writeShape(ob, me, matnum, image)
-                                               else:
-                                                       self.writeShape(ob, me, matnum, None)
+                       for matnum in xrange(len(maters)):
+                               images = []
+                               if me.faceUV:
+                                       images = self.getImages(me, matnum)
+                                       if len(images) > 0:
+                                               for image in images:
+                                                       self.writeShape(ob, me, matnum, image)
                                        else:
                                                self.writeShape(ob, me, matnum, None)
+                               else:
+                                       self.writeShape(ob, me, matnum, None)
                else:
                        if me.faceUV:
                                images = self.getImages(me, -1)
@@ -608,15 +605,6 @@ class VRML2Export:
                                                imageNames[imName]=1
                return images
 
-       def getNumMaterials(self, me):
-               # Oh silly Blender, why do you sometimes have 'None' as
-               # a member of the me.materials array?
-               num = 0
-               for mat in me.materials:
-                       if mat:
-                               num = num + 1
-               return num
-
        def writeCoordinates(self, me, meshName):
                coordName = "coord_%s" % (meshName)
                # look up coord name, use it if available
@@ -644,20 +632,43 @@ class VRML2Export:
                self.writeIndented("}\n", -1)
                self.writeIndented("\n")
 
+       def testShape(self, ob, me, matnum, image):
+               if ( (matnum == -1) and (image == None) ):
+                       if ( len(me.faces) > 0 ):
+                               return True
+               # Check if any faces the material or image
+               for face in me.faces:
+                       if (matnum == -1):
+                               if (f.image == image):
+                                       return True
+                       elif (image == None):
+                               if (face.mat == matnum):
+                                       return True
+                       else:
+                               if ((face.image == image) and (face.mat == matnum)):
+                                       return True
+
+               return False
+
        def writeShape(self, ob, me, matnum, image):
-               # Note: at this point it is assumed for matnum!=-1 that the 
-               # material in me.materials[matnum] is not equal to 'None'.
-               # Such validation should be performed by the function that
-               # calls this one.
+               # matnum == -1  means don't check the face.mat
+               # image == None means don't check face.image
+
+               if ( not self.testShape(ob, me, matnum, image) ):
+                       return False
+
                self.writeIndented("Shape {\n",1)
 
                self.writeIndented("appearance Appearance {\n", 1)
                if (matnum != -1):
                        mater = me.materials[matnum]
-                       self.writeMaterial(mater, self.cleanStr(mater.name,''))
-                       if (mater.mode & Blender.Material.Modes['TEXFACE']):
-                               if image != None:
-                                       self.writeImageTexture(image.name, image.filename)
+                       if (mater):
+                               self.writeMaterial(mater, self.cleanStr(mater.name,''))
+                               if (mater.mode & Blender.Material.Modes['TEXFACE']):
+                                       if image != None:
+                                               self.writeImageTexture(image.name, image.filename)
+                       else:
+                               self.writeDefaultMaterial()     
                else:
                        if image != None:
                                self.writeImageTexture(image.name, image.filename)
@@ -668,6 +679,8 @@ class VRML2Export:
 
                self.writeIndented("}\n", -1)
 
+               return True
+
        def writeGeometry(self, ob, me, matnum, image):
 
                #-- IndexedFaceSet or IndexedLineSet
@@ -723,7 +736,7 @@ class VRML2Export:
                        indexStr = ""
                        if (matnum == -1) or (face.mat == matnum):
                                if (face.image == image):
-                                       for i in range(len(face.verts)):
+                                       for i in xrange(len(face.verts)):
                                                uv = face.uv[i]
                                                indexStr += "%s " % (j)
                                                coordStr += "%s %s, " % \
@@ -770,13 +783,13 @@ class VRML2Export:
                cols = [None] * len(me.verts)
 
                for face in me.faces:
-                       for vind in range(len(face.v)):
+                       for vind in xrange(len(face.v)):
                                vertex = face.v[vind]
                                i = vertex.index
                                if cols[i] == None:
                                        cols[i] = face.col[vind]
                                        
-               for i in range(len(me.verts)):
+               for i in xrange(len(me.verts)):
                        aColor = self.rgbToFS(cols[i])
                        self.writeUnindented("%s\n" % aColor)
 
@@ -784,6 +797,23 @@ class VRML2Export:
                self.writeIndented("]\n",-1)
                self.writeIndented("}\n",-1)
 
+       def writeDefaultMaterial(self):
+               matName = "default"
+
+               # look up material name, use it if available
+               if self.matNames.has_key(matName):
+                       self.writeIndented("material USE MA_%s\n" % matName)
+                       self.matNames[matName]+=1
+                       return;
+
+               self.matNames[matName]=1
+               self.writeIndented("material DEF MA_%s Material {\n" % matName, 1)
+               self.writeIndented("diffuseColor 0.8 0.8 0.8\n")
+               self.writeIndented("specularColor 1.0 1.0 1.0\n")
+               self.writeIndented("shininess 0.5\n")
+               self.writeIndented("transparency 0.0\n")
+               self.writeIndented("}\n",-1)
+
        def writeMaterial(self, mat, matName):
                # look up material name, use it if available
                if self.matNames.has_key(matName):
index 0105587c5b484d0f5c4eec17fa60eb77101b9c26..421b4300c8a6e2c20e4baff3d90a32b8222a5501 100644 (file)
@@ -41,7 +41,7 @@ struct ListBase;
 struct MemFile;
 
 #define BLENDER_VERSION                        247
-#define BLENDER_SUBVERSION             9
+#define BLENDER_SUBVERSION             10
 
 #define BLENDER_MINVERSION             245
 #define BLENDER_MINSUBVERSION  15
index d6b438a3010dc25f9cd59ace7192dc3379aa6b9f..a534dcc3669a15b15fc5462cfdd618727c804df1 100644 (file)
 #define DL_FRONT_CURVE 4
 #define DL_BACK_CURVE  8
 
-#define DL_SURFINDEX(cyclu, cyclv, sizeu, sizev)           \
-\
-if( (cyclv)==0 && a==(sizev)-1) break;             \
-if(cyclu) {                                                \
-       p1= sizeu*a;                                        \
-               p2= p1+ sizeu-1;                                    \
-                       p3= p1+ sizeu;                                      \
-                               p4= p2+ sizeu;                                      \
-                                       b= 0;                                               \
-}                                                          \
-else {                                             \
-       p2= sizeu*a;                                        \
-               p1= p2+1;                                           \
-                       p4= p2+ sizeu;                                      \
-                               p3= p1+ sizeu;                                      \
-                                       b= 1;                                               \
-}                                                          \
-if( (cyclv) && a==sizev-1) {                       \
-       p3-= sizeu*sizev;                                   \
-               p4-= sizeu*sizev;                                   \
-}
-
 
 /* prototypes */
 
@@ -114,6 +92,7 @@ extern void makeDispListMBall(struct Object *ob);
 extern void shadeDispList(struct Base *base);
 extern void shadeMeshMCol(struct Object *ob, struct Mesh *me);
 
+int surfindex_displist(DispList *dl, int a, int *b, int *p1, int *p2, int *p3, int *p4);
 void imagestodisplist(void);
 void reshadeall_displist(void);
 void filldisplist(struct ListBase *dispbase, struct ListBase *to);
index 1cc336db69e640be86dabada852f7bef973426ce..3a2dca525b8d484e23b2a6020dd6c48e8ce7eab8 100644 (file)
@@ -157,10 +157,10 @@ typedef struct Global {
 /* **************** GLOBAL ********************* */
 
 /* G.f */
-#define G_DISABLE_OK   (1 <<  0)
+#define G_RENDER_OGL   (1 <<  0)
 #define G_PLAYANIM             (1 <<  1)
 /* also uses G_FILE_AUTOPLAY */
-#define G_SIMULATION   (1 <<  3)
+#define G_RENDER_SHADOW        (1 <<  3)
 #define G_BACKBUFSEL   (1 <<  4)
 #define G_PICKSEL              (1 <<  5)
 #define G_DRAWNORMALS  (1 <<  6)
index 7819919fba888e4b8ec4ca40ddd25ff887cb3662..02f7ba6f8602861b3805d404f075c773efe5eccd 100644 (file)
@@ -44,15 +44,7 @@ extern "C" {
 #define FFMPEG_XVID     7
 #define FFMPEG_FLV      8
 #define FFMPEG_MKV      9
-
-#define FFMPEG_CODEC_MPEG1 0
-#define FFMPEG_CODEC_MPEG2 1
-#define FFMPEG_CODEC_MPEG4 2
-#define FFMPEG_CODEC_HUFFYUV 3
-#define FFMPEG_CODEC_DV 4
-#define FFMPEG_CODEC_H264 5
-#define FFMPEG_CODEC_XVID 6
-#define FFMPEG_CODEC_FLV1 7
+#define FFMPEG_OGG      10
 
 #define FFMPEG_PRESET_NONE 0
 #define FFMPEG_PRESET_DVD  1
index d4b17f97ad9191e433d40b5ad46b55adc7f43447..b7f068c936b1ad983f4ccabaef7a1a39e7907158 100644 (file)
@@ -2701,17 +2701,22 @@ static void mesh_build_data(Object *ob, CustomDataMask dataMask)
                if( (G.f & G_WEIGHTPAINT) && ob==obact ) {
                        MCol *wpcol = (MCol*)calc_weightpaint_colors(ob);
                        int layernum = CustomData_number_of_layers(&me->fdata, CD_MCOL);
+                       int prevactive = CustomData_get_active_layer(&me->fdata, CD_MCOL);
+                       int prevrender = CustomData_get_render_layer(&me->fdata, CD_MCOL);
 
                        /* ugly hack here, we temporarily add a new active mcol layer with
                           weightpaint colors in it, that is then duplicated in CDDM_from_mesh */
                        CustomData_add_layer(&me->fdata, CD_MCOL, CD_ASSIGN, wpcol, me->totface);
                        CustomData_set_layer_active(&me->fdata, CD_MCOL, layernum);
+                       CustomData_set_layer_render(&me->fdata, CD_MCOL, layernum);
 
                        mesh_calc_modifiers(ob, NULL, &ob->derivedDeform,
                                            &ob->derivedFinal, 0, 1,
                                            needMapping, dataMask, -1);
 
                        CustomData_free_layer_active(&me->fdata, CD_MCOL, me->totface);
+                       CustomData_set_layer_active(&me->fdata, CD_MCOL, prevactive);
+                       CustomData_set_layer_render(&me->fdata, CD_MCOL, prevrender);
                } else {
                        mesh_calc_modifiers(ob, NULL, &ob->derivedDeform,
                                            &ob->derivedFinal, G.rendering, 1,
index c29a92558d644a21eeac5c57efd317efa8e1a799..b090ac2b538466081caa7dc58f167af137fbe179 100644 (file)
@@ -832,7 +832,9 @@ void makeNurbcurve(Nurb *nu, float *coord_array, float *tilt_array, float *radiu
        if(len==0) return;
        sum= (float *)MEM_callocN(sizeof(float)*len, "makeNurbcurve1");
        
-       resolu= (resolu*SEGMENTSU(nu))+1;
+       resolu= (resolu*SEGMENTSU(nu));
+       if((nu->flagu & CU_CYCLIC)==0) resolu++;
+       
        if(resolu==0) {
                MEM_freeN(sum);
                return;
@@ -842,7 +844,8 @@ void makeNurbcurve(Nurb *nu, float *coord_array, float *tilt_array, float *radiu
        ustart= fp[nu->orderu-1];
        if(nu->flagu & CU_CYCLIC) uend= fp[nu->pntsu+nu->orderu-1];
        else uend= fp[nu->pntsu];
-       ustep= (uend-ustart)/(resolu-1);
+       ustep= (uend-ustart)/(resolu - ((nu->flagu & CU_CYCLIC) ? 0 : 1));
+       
        basisu= (float *)MEM_mallocN(sizeof(float)*KNOTSU(nu), "makeNurbcurve3");
 
        if(nu->flagu & CU_CYCLIC) cycl= nu->orderu-1; 
@@ -1678,7 +1681,9 @@ void makeBevelList(Object *ob)
                        }
                        else if((nu->type & 7)==CU_NURBS) {
                                if(nu->pntsv==1) {
-                                       len= (resolu*SEGMENTSU(nu))+1;
+                                       len= (resolu*SEGMENTSU(nu));
+                                       if((nu->flagu & CU_CYCLIC)==0) len++;
+                                       
                                        bl= MEM_callocN(sizeof(BevList)+len*sizeof(BevPoint), "makeBevelList3");
                                        BLI_addtail(&(cu->bev), bl);
                                        bl->nr= len;
index be24d1d247423993ab0ddb593e7c73d1d1d4edb2..bf17f0cecbc4c7c92f033e97e8c5bd2c7b0c5f42 100644 (file)
@@ -206,8 +206,9 @@ void addnormalsDispList(Object *ob, ListBase *lb)
                                ndata= dl->nors;
                                
                                for(a=0; a<dl->parts; a++) {
-       
-                                       DL_SURFINDEX(dl->flag & DL_CYCL_U, dl->flag & DL_CYCL_V, dl->nr, dl->parts);
+                                       
+                                       if (surfindex_displist(dl, a, &b, &p1, &p2, &p3, &p4)==0)
+                                               break;
        
                                        v1= vdata+ 3*p1; 
                                        n1= ndata+ 3*p1;
@@ -271,6 +272,33 @@ void count_displist(ListBase *lb, int *totvert, int *totface)
        }
 }
 
+int surfindex_displist(DispList *dl, int a, int *b, int *p1, int *p2, int *p3, int *p4)
+{
+       if((dl->flag & DL_CYCL_V)==0 && a==(dl->parts)-1) {
+               return 0;
+       }
+       
+       if(dl->flag & DL_CYCL_U) {
+               (*p1)= dl->nr*a;
+               (*p2)= (*p1)+ dl->nr-1;
+               (*p3)= (*p1)+ dl->nr;
+               (*p4)= (*p2)+ dl->nr;
+               (*b)= 0;
+       } else {
+               (*p2)= dl->nr*a;
+               (*p1)= (*p2)+1;
+               (*p4)= (*p2)+ dl->nr;
+               (*p3)= (*p1)+ dl->nr;
+               (*b)= 1;
+       }
+       
+       if( (dl->flag & DL_CYCL_U) && a==dl->parts-1) {                     \
+               (*p3)-= dl->nr*dl->parts;                                   \
+               (*p4)-= dl->nr*dl->parts;                                   \
+       }
+       
+       return 1;
+}
 
 /* ***************************** shade displist. note colors now are in rgb(a) order ******************** */
 
@@ -858,12 +886,14 @@ static void curve_to_displist(Curve *cu, ListBase *nubase, ListBase *dispbase)
                                }
                        }
                        else if((nu->type & 7)==CU_NURBS) {
-                               len= (resolu*SEGMENTSU(nu))+1;
+                               len= (resolu*SEGMENTSU(nu));
+                               if((nu->flagu & CU_CYCLIC)==0) len++;
                                
                                dl= MEM_callocN(sizeof(DispList), "makeDispListsurf");
                                dl->verts= MEM_callocN(len*3*sizeof(float), "dlverts");
                                BLI_addtail(dispbase, dl);
                                dl->parts= 1;
+                               
                                dl->nr= len;
                                dl->col= nu->mat_nr;
                                dl->charidx = nu->charidx;
@@ -1253,13 +1283,40 @@ static void curve_calc_modifiers_post(Object *ob, ListBase *nurb, ListBase *disp
 
        for (; md; md=md->next) {
                ModifierTypeInfo *mti = modifierType_getInfo(md->type);
-
+               
                if ((md->mode & required_mode) != required_mode) continue;
                if (mti->isDisabled && mti->isDisabled(md)) continue;
                if (mti->type!=eModifierTypeType_OnlyDeform && mti->type!=eModifierTypeType_DeformOrConstruct) continue;
 
-               for (dl=dispbase->first; dl; dl=dl->next) {
-                       mti->deformVerts(md, ob, NULL, (float(*)[3]) dl->verts, (dl->type==DL_INDEX3)?dl->nr:dl->parts*dl->nr);
+               /* need to put all verts in 1 block for curve deform */
+               if(md->type==eModifierType_Curve) {
+                       float *allverts, *fp;
+                       int totvert= 0;
+                       
+                       for (dl=dispbase->first; dl; dl=dl->next)
+                               totvert+= (dl->type==DL_INDEX3)?dl->nr:dl->parts*dl->nr;
+                       
+                       fp= allverts= MEM_mallocN(totvert*sizeof(float)*3, "temp vert");
+                       for (dl=dispbase->first; dl; dl=dl->next) {
+                               int offs= 3 * ((dl->type==DL_INDEX3)?dl->nr:dl->parts*dl->nr);
+                               memcpy(fp, dl->verts, sizeof(float) * offs);
+                               fp+= offs;
+                       }
+                       
+                       mti->deformVerts(md, ob, NULL, (float(*)[3]) allverts, totvert);
+                       
+                       fp= allverts;
+                       for (dl=dispbase->first; dl; dl=dl->next) {
+                               int offs= 3 * ((dl->type==DL_INDEX3)?dl->nr:dl->parts*dl->nr);
+                               memcpy(dl->verts, fp, sizeof(float) * offs);
+                               fp+= offs;
+                       }
+                       MEM_freeN(allverts);
+               }
+               else {
+                       for (dl=dispbase->first; dl; dl=dl->next) {
+                               mti->deformVerts(md, ob, NULL, (float(*)[3]) dl->verts, (dl->type==DL_INDEX3)?dl->nr:dl->parts*dl->nr);
+                       }
                }
        }
 
@@ -1281,7 +1338,8 @@ static void displist_surf_indices(DispList *dl)
        
        for(a=0; a<dl->parts; a++) {
                
-               DL_SURFINDEX(dl->flag & DL_CYCL_U, dl->flag & DL_CYCL_V, dl->nr, dl->parts);
+               if (surfindex_displist(dl, a, &b, &p1, &p2, &p3, &p4)==0)
+                       break;
                
                for(; b<dl->nr; b++, index+=4) {        
                        index[0]= p1;
index 479be2ee6446b9a07b4ad4b560a83f66f9bfdde8..561b564ac39657a9009225773bc2476d9704bd47 100644 (file)
@@ -2097,8 +2097,10 @@ static void displist_to_mesh(DispList *dlfirst)
                        }
 
                        for(a=0; a<dl->parts; a++) {
-
-                               DL_SURFINDEX(dl->flag & DL_CYCL_U, dl->flag & DL_CYCL_V, dl->nr, dl->parts);
+                               
+                               if (surfindex_displist(dl, a, &b, &p1, &p2, &p3, &p4)==0)
+                                       break;
+                               
                                p1+= startve; 
                                p2+= startve; 
                                p3+= startve; 
index 9c1b3ee5a8d4642e2f62e17b56903fcc414b2095..4580c6cbf8ba649ad9b32a553836022cc9cfb610 100644 (file)
@@ -77,7 +77,7 @@ void fluidsim_init(FluidsimModifierData *fluidmd)
                if(!fss)
                        return;
                
-               fss->type = 0;
+               fss->type = OB_FSBND_NOSLIP;
                fss->show_advancedoptions = 0;
 
                fss->resolutionxyz = 50;
index 0a140ebaba14f9a764ef6c6113136f40995d6db1..f83f66daa852579693ef0eae8844205bddf619f2 100644 (file)
@@ -111,6 +111,7 @@ void IDP_ResizeArray(IDProperty *prop, int newlen)
        newp->type = prop->type;
        newp->flag = prop->flag;
        newp->data.val = prop->data.val;
+       newp->data.val2 = prop->data.val2;
 
        return newp;
  }
@@ -219,6 +220,10 @@ IDProperty *IDP_CopyGroup(IDProperty *prop)
        return newp;
 }
 
+/*
+ replaces a property with the same name in a group, or adds 
+ it if the propery doesn't exist.
+*/
 void IDP_ReplaceInGroup(IDProperty *group, IDProperty *prop)
 {
        IDProperty *loop;
@@ -229,8 +234,7 @@ void IDP_ReplaceInGroup(IDProperty *group, IDProperty *prop)
                        
                        BLI_remlink(&group->data.group, loop);
                        IDP_FreeProperty(loop);
-                       MEM_freeN(loop);
-                       
+                       MEM_freeN(loop);                        
                        return;
                }
        }
@@ -262,7 +266,7 @@ int IDP_InsertToGroup(IDProperty *group, IDProperty *previous, IDProperty *pnew)
        }
        
        group->len++;
-       
+
        BLI_insertlink(&group->data.group, previous, pnew);
        return 1;
 }
@@ -348,6 +352,7 @@ IDProperty *IDP_GetProperties(ID *id, int create_if_needed)
                if (create_if_needed) {
                        id->properties = MEM_callocN(sizeof(IDProperty), "IDProperty");
                        id->properties->type = IDP_GROUP;
+                       strcpy(id->name, "top_level_group");
                }
                return id->properties;
        }
@@ -423,7 +428,7 @@ IDProperty *IDP_New(int type, IDPropertyTemplate val, char *name)
        return prop;
 }
 
-/*NOTE: this will free all child properties of list arrays and groups!
+/*NOTE: this will free all child properties including list arrays and groups!
   Also, note that this does NOT unlink anything!  Plus it doesn't free
   the actual IDProperty struct either.*/
 void IDP_FreeProperty(IDProperty *prop)
@@ -441,7 +446,8 @@ void IDP_FreeProperty(IDProperty *prop)
        }
 }
 
-/*Unlinks any IDProperty<->ID linkage that might be going on.*/
+/*Unlinks any IDProperty<->ID linkage that might be going on.
+  note: currently unused.*/
 void IDP_UnlinkProperty(IDProperty *prop)
 {
        switch (prop->type) {
index 8f7a90625ba1916ab8dd0c2534e15fdb3eaa8f62..4a4278a05f8f4ad6c5a97db5bb26235ba8d2caa5 100644 (file)
@@ -3973,9 +3973,6 @@ static void dynamics_step(Object *ob, ParticleSystem *psys, ParticleSystemModifi
                        }
                        pa->size=psys_get_size(ob,ma,psmd,icu_esize,psys,part,pa,vg_size);
 
-                       if(part->type==PART_REACTOR)
-                               initialize_particle(pa,p,ob,psys,psmd);
-
                        reset_particle(pa,psys,psmd,ob,dtime,cfra,vg_vel,vg_tan,vg_rot);
 
                        if(cfra>pa->time && part->flag & PART_LOOP && part->type!=PART_HAIR){
index 43805959e620f2a5d456c79d14dba472c5f514f9..d4676653a4e007ad3bd499ebc571cc301ef6732e 100644 (file)
 #include <unistd.h>
 #endif
 
+#ifdef _WIN32
+#ifndef snprintf
+#define snprintf _snprintf
+#endif
+#endif
+
 /* Creating ID's */
 
 void BKE_ptcache_id_from_softbody(PTCacheID *pid, Object *ob, SoftBody *sb)
@@ -164,6 +170,9 @@ void BKE_ptcache_ids_from_object(ListBase *lb, Object *ob)
        - stack_index: index in the modifier stack. we can have cache for more then one stack_index
 */
 
+#define MAX_PTCACHE_PATH FILE_MAX
+#define MAX_PTCACHE_FILE ((FILE_MAXDIR+FILE_MAXFILE)*2)
+
 static int ptcache_path(PTCacheID *pid, char *filename)
 {
        Library *lib;
@@ -172,7 +181,7 @@ static int ptcache_path(PTCacheID *pid, char *filename)
        lib= (pid)? pid->ob->id.lib: NULL;
 
        if (G.relbase_valid || lib) {
-               char file[FILE_MAX]; /* we dont want the dir, only the file */
+               char file[MAX_PTCACHE_PATH]; /* we dont want the dir, only the file */
                char *blendfilename;
 
                blendfilename= (lib)? lib->filename: G.sce;
@@ -184,7 +193,7 @@ static int ptcache_path(PTCacheID *pid, char *filename)
                if (i > 6)
                        file[i-6] = '\0';
                
-               sprintf(filename, "//"PTCACHE_PATH"%s", file); /* add blend file name to pointcache dir */
+               snprintf(filename, MAX_PTCACHE_PATH, "//"PTCACHE_PATH"%s", file); /* add blend file name to pointcache dir */
                BLI_convertstringcode(filename, blendfilename);
                BLI_add_slash(filename);
                return strlen(filename);
@@ -192,7 +201,7 @@ static int ptcache_path(PTCacheID *pid, char *filename)
        
        /* use the temp path. this is weak but better then not using point cache at all */
        /* btempdir is assumed to exist and ALWAYS has a trailing slash */
-       sprintf(filename, "%s"PTCACHE_PATH"%d", btempdir, abs(getpid()));
+       snprintf(filename, MAX_PTCACHE_PATH, "%s"PTCACHE_PATH"%d", btempdir, abs(getpid()));
        BLI_add_slash(filename);
        return strlen(filename);
 }
@@ -215,13 +224,13 @@ static int BKE_ptcache_id_filename(PTCacheID *pid, char *filename, int cfra, sho
        idname = (pid->ob->id.name+2);
        /* convert chars to hex so they are always a valid filename */
        while('\0' != *idname) {
-               sprintf(newname, "%02X", (char)(*idname++));
+               snprintf(newname, MAX_PTCACHE_FILE, "%02X", (char)(*idname++));
                newname+=2;
                len += 2;
        }
        
        if (do_ext) {
-               sprintf(newname, "_%06d_%02d"PTCACHE_EXT, cfra, pid->stack_index); /* always 6 chars */
+               snprintf(newname, MAX_PTCACHE_FILE, "_%06d_%02d"PTCACHE_EXT, cfra, pid->stack_index); /* always 6 chars */
                len += 16;
        }
        
@@ -290,9 +299,10 @@ void BKE_ptcache_id_clear(PTCacheID *pid, int mode, int cfra)
        /* mode is same as fopen's modes */
        DIR *dir; 
        struct dirent *de;
-       char path[FILE_MAX];
-       char filename[(FILE_MAXDIR+FILE_MAXFILE)*2];
-       char path_full[(FILE_MAXDIR+FILE_MAXFILE)*2];
+       char path[MAX_PTCACHE_PATH];
+       char filename[MAX_PTCACHE_FILE];
+       char path_full[MAX_PTCACHE_FILE];
+       char ext[MAX_PTCACHE_PATH];
 
        if(!pid->cache)
                return;
@@ -315,9 +325,11 @@ void BKE_ptcache_id_clear(PTCacheID *pid, int mode, int cfra)
                dir = opendir(path);
                if (dir==NULL)
                        return;
+
+               snprintf(ext, sizeof(ext), "_%02d"PTCACHE_EXT, pid->stack_index);
                
                while ((de = readdir(dir)) != NULL) {
-                       if (strstr(de->d_name, PTCACHE_EXT)) { /* do we have the right extension?*/
+                       if (strstr(de->d_name, ext)) { /* do we have the right extension?*/
                                if (strncmp(filename, de->d_name, len ) == 0) { /* do we have the right prefix */
                                        if (mode == PTCACHE_CLEAR_ALL) {
                                                BLI_join_dirfile(path_full, path, de->d_name);
@@ -326,8 +338,9 @@ void BKE_ptcache_id_clear(PTCacheID *pid, int mode, int cfra)
                                                /* read the number of the file */
                                                int frame, len2 = strlen(de->d_name);
                                                char num[7];
+
                                                if (len2 > 15) { /* could crash if trying to copy a string out of this range*/
-                                                       strncpy(num, de->d_name + (strlen(de->d_name) - 15), 6);
+                                                       BLI_strncpy(num, de->d_name + (strlen(de->d_name) - 15), sizeof(num));
                                                        frame = atoi(num);
                                                        
                                                        if((mode==PTCACHE_CLEAR_BEFORE && frame < cfra) || 
@@ -353,7 +366,7 @@ void BKE_ptcache_id_clear(PTCacheID *pid, int mode, int cfra)
 
 int BKE_ptcache_id_exist(PTCacheID *pid, int cfra)
 {
-       char filename[(FILE_MAXDIR+FILE_MAXFILE)*2];
+       char filename[MAX_PTCACHE_FILE];
 
        if(!pid->cache)
                return 0;
@@ -499,8 +512,8 @@ int BKE_ptcache_object_reset(Object *ob, int mode)
 /* Use this when quitting blender, with unsaved files */
 void BKE_ptcache_remove(void)
 {
-       char path[FILE_MAX];
-       char path_full[FILE_MAX];
+       char path[MAX_PTCACHE_PATH];
+       char path_full[MAX_PTCACHE_PATH];
        int rmdir = 1;
        
        ptcache_path(NULL, path);
index 64af8258f80bb69aded4c1b2623b04d1370039cc..cef6f802729cf5e13f53337b68a22fb72232b43a 100644 (file)
@@ -230,6 +230,10 @@ static const char** get_file_extensions(int format)
                static const char * rv[] = { ".mkv", NULL };
                return rv;
        }
+       case FFMPEG_OGG: {
+               static const char * rv[] = { ".ogg", ".ogv", NULL };
+               return rv;
+       }
        default:
                return NULL;
        }
@@ -251,14 +255,18 @@ static void write_video_frame(AVFrame* frame)
                AVPacket packet;
                av_init_packet(&packet);
 
+               if (c->coded_frame->pts != AV_NOPTS_VALUE) {
 #ifdef FFMPEG_CODEC_TIME_BASE
-               packet.pts = av_rescale_q(c->coded_frame->pts,
-                                         c->time_base,
-                                         video_stream->time_base);
+                       packet.pts = av_rescale_q(c->coded_frame->pts,
+                                                 c->time_base,
+                                                 video_stream->time_base);
 #else
-               packet.pts = c->coded_frame->pts;
+                       packet.pts = c->coded_frame->pts;
 #endif
-               fprintf(stderr, "Video Frame PTS: %lld\n", packet.pts);
+                       fprintf(stderr, "Video Frame PTS: %lld\n", packet.pts);
+               } else {
+                       fprintf(stderr, "Video Frame PTS: not set\n");
+               }
                if (c->coded_frame->key_frame)
                        packet.flags |= PKT_FLAG_KEY;
                packet.stream_index = video_stream->index;
@@ -669,6 +677,8 @@ void start_ffmpeg_impl(struct RenderData *rd, int rectx, int recty)
        switch(ffmpeg_type) {
        case FFMPEG_AVI:
        case FFMPEG_MOV:
+       case FFMPEG_OGG:
+       case FFMPEG_MKV:
                fmt->video_codec = ffmpeg_codec;
                break;
        case FFMPEG_DV:
index 442a629b12d9366e5e0da57b3c8ade05546bd500..013b9e0bb1b49fde7ffa8c615e793edfd48eacbc 100644 (file)
@@ -893,7 +893,10 @@ void BLI_cleanup_file(const char *relabase, char *dir)
         */
        
 #ifdef WIN32
-       if(dir[0]=='.') {       /* happens for example in FILE_MAIN */
+       
+       /* Note, this should really be moved to the file selector,
+        * since this function is used in many areas */
+       if(strcmp(dir, ".")==0) {       /* happens for example in FILE_MAIN */
           get_default_root(dir);
           return;
        }       
@@ -1182,7 +1185,7 @@ int BLI_convertstringcode(char *path, const char *basepath)
         * Add a / prefix and lowercase the driveletter, remove the :
         * C:\foo.JPG -> /c/foo.JPG */
        
-       if (tmp[1] == ':' && isalpha(tmp[0]) && (tmp[2]=='\\' || tmp[2]=='/') ) {
+       if (isalpha(tmp[0]) && tmp[1] == ':' && (tmp[2]=='\\' || tmp[2]=='/') ) {
                tmp[1] = tolower(tmp[0]); /* replace ':' with driveletter */
                tmp[0] = '/'; 
                /* '\' the slash will be converted later */
index c918a82f36af050a3027e6e549864559c733481f..bc9b646551670828dd7b30b9dd2d76be23e5f538 100644 (file)
@@ -7944,9 +7944,27 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
                        la->sky_exposure= 1.0f;
                }
        }
+       
+       /* BGE message actuators needed OB prefix, very confusing */
+       if (main->versionfile < 247 || (main->versionfile == 247 && main->subversionfile < 10)) {
+               bActuator *act;
+               Object *ob;
                
-               
-               
+               for(ob = main->object.first; ob; ob= ob->id.next) {
+                       for(act= ob->actuators.first; act; act= act->next) {
+                               if (act->type == ACT_MESSAGE) {
+                                       bMessageActuator *msgAct = (bMessageActuator *) act->data;
+                                       if (strlen(msgAct->toPropName) > 2) {
+                                               /* strip first 2 chars, would have only worked if these were OB anyway */
+                                               strncpy(msgAct->toPropName, msgAct->toPropName+2, sizeof(msgAct->toPropName));
+                                       } else {
+                                               msgAct->toPropName[0] = '\0';
+                                       }
+                               }
+                       }
+               }
+       }
+       
        /* WATCH IT!!!: pointers from libdata have not been converted yet here! */
        /* WATCH IT 2!: Userdef struct init has to be in src/usiblender.c! */
 
index 1c29bdc8741d46772d8b5b816e76e4f068d7eb69..94c1910e3bc4494aabfbedb10b03bd0a0b60924a 100644 (file)
@@ -516,10 +516,14 @@ static void codegen_set_unique_ids(ListBase *nodes)
                                                input->texid = GET_INT_FROM_POINTER(BLI_ghash_lookup(bindhash, input->ima));
                                }
                                else {
-                                       /* input is user created texture, we know there there is
-                                          only one, so assign new texid */
-                                       input->bindtex = 1;
-                                       input->texid = texid++;
+                                       if (!BLI_ghash_haskey(bindhash, input->tex)) {
+                                               /* input is user created texture, check tex pointer */
+                                               input->texid = texid++;
+                                               input->bindtex = 1;
+                                               BLI_ghash_insert(bindhash, input->tex, SET_INT_IN_POINTER(input->texid));
+                                       }
+                                       else
+                                               input->texid = GET_INT_FROM_POINTER(BLI_ghash_lookup(bindhash, input->tex));
                                }
 
                                /* make sure this pixel is defined exactly once */
@@ -836,11 +840,9 @@ void GPU_pass_bind(GPUPass *pass, double time)
                if (input->ima)
                        input->tex = GPU_texture_from_blender(input->ima, input->iuser, time);
 
-               if(input->ima || input->tex) {
-                       if(input->tex) {
-                               GPU_texture_bind(input->tex, input->texid);
-                               GPU_shader_uniform_texture(shader, input->shaderloc, input->tex);
-                       }
+               if(input->tex && input->bindtex) {
+                       GPU_texture_bind(input->tex, input->texid);
+                       GPU_shader_uniform_texture(shader, input->shaderloc, input->tex);
                }
        }
 }
@@ -871,9 +873,9 @@ void GPU_pass_unbind(GPUPass *pass)
                return;
 
        for (input=inputs->first; input; input=input->next) {
-               if (input->tex)
-                       if(input->bindtex)
-                               GPU_texture_unbind(input->tex);
+               if(input->tex && input->bindtex)
+                       GPU_texture_unbind(input->tex);
+
                if (input->ima)
                        input->tex = 0;
        }
index 700dd6dedb238eb5066abf182a7b3021f713ffe3..85a1a059b75e41b13333306ce42554b0bffb9a69 100644 (file)
@@ -1046,7 +1046,7 @@ int GPU_scene_object_lights(Scene *scene, Object *ob, int lay, float viewmat[][4
                
                if(la->type==LA_SUN) {
                        /* sun lamp */
-                       VECCOPY(position, base->object->obmat[2]);
+                       VECCOPY(direction, base->object->obmat[2]);
                        direction[3]= 0.0;
 
                        glLightfv(GL_LIGHT0+count, GL_POSITION, direction); 
index d4da2866d968881d1e0dd36a7b68fda65689a555..6dff5802c31ab6aea21c8b04d7bcbb10fcc73553 100644 (file)
@@ -1145,6 +1145,8 @@ void GPU_shaderesult_set(GPUShadeInput *shi, GPUShadeResult *shr)
        if((G.fileflags & G_FILE_GLSL_NO_LIGHTS) || (ma->mode & MA_SHLESS)) {
                shr->combined = shi->rgb;
                shr->alpha = shi->alpha;
+               GPU_link(mat, "set_rgb", shi->rgb, &shr->diff);
+               GPU_link(mat, "set_rgb_zero", &shr->spec);
        }
        else {
                if(GPU_link_changed(shi->emit) || ma->emit != 0.0f) {
index bc95c221b511e7a82ded3c9f6155c7d976f17c2c..11e6478f29a41fc6fe5e297133641933fc113114 100644 (file)
@@ -76,6 +76,7 @@ void link_to_scene(unsigned short nr);
 void make_links_menu(void);
 void make_links(short event);
 void make_duplilist_real(void);
+void make_object_duplilist_real(struct Base *base);
 void apply_objects_locrot(void);
 void apply_objects_scale(void);
 void apply_objects_rot(void);
index 9b9294b0343fab9c34db32b5cf04c0fe4661b7a7..82263c8cda776a9e6d2d0e32b238c4cf38d9c172 100644 (file)
@@ -57,10 +57,13 @@ struct bGPDframe *gpencil_frame_addnew(struct bGPDlayer *gpl, int cframe);
 struct bGPDlayer *gpencil_layer_addnew(struct bGPdata *gpd);
 struct bGPdata *gpencil_data_addnew(void);
 
+struct bGPDframe *gpencil_frame_duplicate(struct bGPDframe *src);
+struct bGPDlayer *gpencil_layer_duplicate(struct bGPDlayer *src);
 struct bGPdata *gpencil_data_duplicate(struct bGPdata *gpd);
 
 struct bGPdata *gpencil_data_getactive(struct ScrArea *sa);
 short gpencil_data_setactive(struct ScrArea *sa, struct bGPdata *gpd);
+struct ScrArea *gpencil_data_findowner(struct bGPdata *gpd);
 
 void gpencil_frame_delete_laststroke(struct bGPDframe *gpf);
 
@@ -79,7 +82,6 @@ void gpencil_delete_menu(void);
 void gpencil_convert_operation(short mode);
 void gpencil_convert_menu(void);
 
-//short gpencil_paint(short mousebutton);
 short gpencil_do_paint(struct ScrArea *sa, short mousebutton);
 
 #endif /*  BDR_GPENCIL_H */
index 1425cf6a67c51c3dabdea5129de762aaa9393127..ae330b30d81f02c0a2a3f216b411eb3c33bde7f3 100644 (file)
@@ -201,6 +201,10 @@ void delete_gpencil_layers(void);
 void delete_gplayer_frames(struct bGPDlayer *gpl);
 void duplicate_gplayer_frames(struct bGPDlayer *gpd);
 
+void free_gpcopybuf(void);
+void copy_gpdata(void);
+void paste_gpdata(void);
+
 void snap_gplayer_frames(struct bGPDlayer *gpl, short mode);
 void mirror_gplayer_frames(struct bGPDlayer *gpl, short mode);
 
index 9b2c21a08170a483db4329e94066adf5bd7e1d99..64aa50c661daf83b4f41e827523b5c110048c468 100644 (file)
 #ifndef BSE_SEQAUDIO_H
 #define BSE_SEQAUDIO_H
 
+#ifndef DISABLE_SDL
 #include "SDL.h"
+#endif
+
 /* muha, we don't init (no SDL_main)! */
 #ifdef main
 #      undef main
 #endif
 
 #include "DNA_sound_types.h"
+#include "BLO_sys_types.h"
 
 void audio_mixdown();
 void audio_makestream(bSound *sound);
-void audiostream_play(Uint32 startframe, Uint32 duration, int mixdown);
-void audiostream_fill(Uint8* mixdown, int len);
-void audiostream_start(Uint32 frame);
-void audiostream_scrub(Uint32 frame);
+void audiostream_play(uint32_t startframe, uint32_t duration, int mixdown);
+void audiostream_fill(uint8_t* mixdown, int len);
+void audiostream_start(uint32_t frame);
+void audiostream_scrub(uint32_t frame);
 void audiostream_stop(void);
 int audiostream_pos(void);
 
index fde1ce57875827fc8d9d2e25b272c68179eecffd..2914330a2b0bc62289fc6243a125cf5933dba5f7 100644 (file)
@@ -142,7 +142,7 @@ typedef struct FluidsimSettings {
 #define OB_FLUIDSIM_PARTICLE    64
 #define OB_FLUIDSIM_CONTROL    128
 
-#define OB_TYPEFLAG_START       0
+#define OB_TYPEFLAG_START       7
 #define OB_FSGEO_THIN           (1<<(OB_TYPEFLAG_START+1))
 #define OB_FSBND_NOSLIP         (1<<(OB_TYPEFLAG_START+2))
 #define OB_FSBND_PARTSLIP       (1<<(OB_TYPEFLAG_START+3))
index ead1df4ddac3ee6946af860700b202a07060d33a..fdf08c737982da3c4fe2ab7f02878a7376a1d8cc 100644 (file)
@@ -189,8 +189,8 @@ typedef struct UserDef {
        struct ListBase themes;
        short undosteps;
        short undomemory;
-       short gp_manhattendist, gp_euclideandist, pad;
-       short curssize;
+       short gp_manhattendist, gp_euclideandist, gp_eraser;
+       short gp_settings;
        short tb_leftmouse, tb_rightmouse;
        struct SolidLight light[3];
        short tw_hotspot, tw_flag, tw_handlesize, tw_size;
@@ -206,7 +206,7 @@ typedef struct UserDef {
        short smooth_viewtx;    /* miliseconds to spend spinning the view */
        short glreslimit;
        short ndof_pan, ndof_rotate;
-       short pads[2];
+       short curssize, pad;
 //     char pad[8];
        char versemaster[160];
        char verseuser[160];
@@ -326,5 +326,8 @@ extern UserDef U; /* from usiblender.c !!!! */
 
 /* tw_flag (transform widget) */
 
+/* gp_settings (Grease Pencil Settings) */
+#define GP_PAINT_DOSMOOTH      (1<<0)
+
 
 #endif
index 1c56709111f35f6d2fbc574c5631cffbea2465dd..29ef6c5da1d28ea371231857bca7931773294887 100644 (file)
@@ -95,6 +95,7 @@
 PyObject *bpy_pydriver_Dict = NULL;
 PyObject *bpy_orig_syspath_List = NULL;
 
+
 /*
  * set up a weakref list for Armatures
  *    creates list in __main__ module dict 
@@ -194,7 +195,7 @@ void BPY_start_python( int argc, char **argv )
        //stuff for Registry module
        bpy_registryDict = PyDict_New(  );/* check comment at start of this file */
        if( !bpy_registryDict )
-               printf( "Error: Couldn't create the Registry Python Dictionary!" );
+               printf( "Warning: Couldn't create the Registry Python Dictionary!" );
        Py_SetProgramName( "blender" );
 
        /* Py_Initialize() will attempt to import the site module and
@@ -222,11 +223,11 @@ void BPY_start_python( int argc, char **argv )
        
        //Start the interpreter
        Py_Initialize(  );
+       
        PySys_SetArgv( argc_copy, argv_copy );
-
        /* Initialize thread support (also acquires lock) */
        PyEval_InitThreads();
-
+       
        //Overrides __import__
        init_ourImport(  );
        init_ourReload(  );
@@ -236,7 +237,6 @@ void BPY_start_python( int argc, char **argv )
 
        //Look for a python installation
        init_syspath( first_time ); /* not first_time: some msgs are suppressed */
-
        py_tstate = PyGILState_GetThisThreadState();
        PyEval_ReleaseThread(py_tstate);
 
@@ -289,9 +289,6 @@ void syspath_append( char *dirname )
 {
        PyObject *mod_sys= NULL, *dict= NULL, *path= NULL, *dir= NULL;
        short ok=1;
-       PyErr_Clear(  );
-
-       dir = PyString_FromString( dirname );
 
        mod_sys = PyImport_ImportModule( "sys" );       /* new ref */
        
@@ -303,16 +300,19 @@ void syspath_append( char *dirname )
                }
        } else {
                /* cant get the sys module */
+               /* PyErr_Clear(); is called below */
                ok = 0;
        }
        
+       dir = PyString_FromString( dirname );
+       
        if (ok && PySequence_Contains(path, dir)==0) { /* Only add if we need to */
-               if (ok && PyList_Append( path, dir ) != 0) /* decref below */
+               if (PyList_Append( path, dir ) != 0) /* decref below */
                        ok = 0; /* append failed */
        }
        
        if( (ok==0) || PyErr_Occurred(  ) )
-               fprintf(stderr, "could import or build sys.path\n" );
+               fprintf(stderr, "Warning: could import or build sys.path\n" );
        
        PyErr_Clear();
        Py_DECREF( dir );
@@ -333,8 +333,10 @@ void init_syspath( int first_time )
                d = PyModule_GetDict( mod );
                EXPP_dict_set_item_str( d, "progname", PyString_FromString( bprogname ) );
                Py_DECREF( mod );
-       } else
-               printf( "Warning: could not set Blender.sys.progname\n" );
+       } else {
+               printf( "Warning: could not set Blender.sys\n" );
+               PyErr_Clear();
+       }
 
        progname = BLI_last_slash( bprogname ); /* looks for the last dir separator */
 
@@ -393,7 +395,8 @@ void init_syspath( int first_time )
                
                Py_DECREF( mod );
        } else{
-               printf("import of sys module failed\n");
+               PyErr_Clear( );
+               printf("Warning: import of sys module failed\n");
        }
 }
 
@@ -406,13 +409,14 @@ void BPY_rebuild_syspath( void )
 
        mod = PyImport_ImportModule( "sys" );   
        if (!mod) {
-               printf("error: could not import python sys module. some modules may not import.\n");
+               printf("Warning: could not import python sys module. some modules may not import.\n");
+               PyErr_Clear(  );
                PyGILState_Release(gilstate);
                return;
        }
        
        if (!bpy_orig_syspath_List) { /* should never happen */
-               printf("error refershing python path\n");
+               printf("Warning: cant refresh python path, bpy_orig_syspath_List is NULL\n");
                Py_DECREF(mod);
                PyGILState_Release(gilstate);
                return;
@@ -1228,6 +1232,8 @@ static int bpy_pydriver_create_dict(void)
                PyDict_SetItemString(d, "Blender", mod);
                PyDict_SetItemString(d, "b", mod);
                Py_DECREF(mod);
+       } else {
+               PyErr_Clear();
        }
 
        mod = PyImport_ImportModule("math");
@@ -1245,6 +1251,8 @@ static int bpy_pydriver_create_dict(void)
                PyDict_SetItemString(d, "noise", mod);
                PyDict_SetItemString(d, "n", mod);
                Py_DECREF(mod);
+       } else {
+               PyErr_Clear();
        }
 
        /* If there's a Blender text called pydrivers.py, import it.
@@ -1270,6 +1278,8 @@ static int bpy_pydriver_create_dict(void)
                        PyDict_SetItemString(d, "ob", fcn);
                        Py_DECREF(fcn);
                }
+       } else {
+               PyErr_Clear();
        }
        
        /* TODO - change these */
@@ -1282,6 +1292,8 @@ static int bpy_pydriver_create_dict(void)
                        PyDict_SetItemString(d, "me", fcn);
                        Py_DECREF(fcn);
                }
+       } else {
+               PyErr_Clear();
        }
 
        /* ma(matname) == Blender.Material.Get(matname) */
@@ -1293,6 +1305,8 @@ static int bpy_pydriver_create_dict(void)
                        PyDict_SetItemString(d, "ma", fcn);
                        Py_DECREF(fcn);
                }
+       } else {
+               PyErr_Clear();
        }
 
        return 0;
@@ -2828,11 +2842,18 @@ static PyObject *blender_import( PyObject * self, PyObject * args )
        char *name;
        PyObject *globals = NULL, *locals = NULL, *fromlist = NULL;
        PyObject *m;
-
+       //PyObject_Print(args, stderr, 0);
+#if (PY_VERSION_HEX >= 0x02060000)
+       int dummy_val; /* what does this do?*/
+       
+       if( !PyArg_ParseTuple( args, "s|OOOi:bimport",
+                              &name, &globals, &locals, &fromlist, &dummy_val) )
+               return NULL;
+#else
        if( !PyArg_ParseTuple( args, "s|OOO:bimport",
                               &name, &globals, &locals, &fromlist ) )
                return NULL;
-
+#endif
        m = PyImport_ImportModuleEx( name, globals, locals, fromlist );
 
        if( m )
index 28407f174dac5a17b0e9c7a54913b07a667594f1..2e82c55155f6de287c5da6190cb070587171c040 100644 (file)
@@ -2158,8 +2158,8 @@ static PyObject *new_NMesh_displist(ListBase *lb, Object *ob)
 
                        for(a=0; a<dl->parts; a++) {
                                
-                               DL_SURFINDEX(dl->flag & DL_CYCL_U, dl->flag & DL_CYCL_V, dl->nr, dl->parts);
-                               
+                               if (surfindex_displist(dl, a, &b, &p1, &p2, &p3, &p4)==0)
+                                       break;
                                
                                for(; b<dl->nr; b++) {
                                        vidx[0] = p2 + ioffset;
index 49cb14d1e664d5ce9b9ecaf9d384e6432d72d03f..d56a547911ede3fb69ec60bce355ab60213572ff 100644 (file)
@@ -264,7 +264,7 @@ class Object:
 
        B{Note}:
        When dealing with properties and functions such as LocX/RotY/getLocation(), getSize() and getEuler(),
-       keep in mind that these transformation properties are relative to the object's parent (if any).
+       keep in mind that these transformation properties are relative to the object itself, ignoring any other transformations.
 
        To get these values in worldspace (taking into account vertex parents, constraints, etc.)
        pass the argument 'worldspace' to these functions.
@@ -780,9 +780,9 @@ class Object:
                """
                @type space: string
                @param space: The desired space for the size:
-                       - localspace: (default) relative to the object's parent;
-                       - worldspace: absolute, taking vertex parents, tracking and
-                                       Ipo's into account;
+                       - localspace: (default) location without other transformations
+                       - worldspace: location taking vertex parents, tracking and
+                                       Ipos into account
                Returns the object's localspace rotation as Euler rotation vector (rotX, rotY, rotZ).  Angles are in radians.
                @rtype: Py_Euler
                @return: A python Euler. Data is wrapped when euler is present.
@@ -812,9 +812,9 @@ class Object:
                """
                @type space: string
                @param space: The desired space for the location:
-                       - localspace: (default) relative to the object's parent;
-                       - worldspace: absolute, taking vertex parents, tracking and
-                               Ipo's into account;
+                       - localspace: (default) location without other transformations
+                       - worldspace: location taking vertex parents, tracking and
+                               Ipos into account
                Returns the object's location (x, y, z).
                @return: (x, y, z)
 
@@ -895,9 +895,9 @@ class Object:
                """
                @type space: string
                @param space: The desired space for the size:
-                       - localspace: (default) relative to the object's parent;
-                       - worldspace: absolute, taking vertex parents, tracking and
-                               Ipo's into account;
+                       - localspace: (default) location without other transformations
+                       - worldspace: location taking vertex parents, tracking and
+                                       Ipos into account
                Returns the object's size.
                @return: (SizeX, SizeY, SizeZ)
                @note: the worldspace size will not return negative (flipped) scale values.
index 05e2d0a521afc8dc1020f9b427a31dde7943b147..2d229cb33878568cdbbaf1646121e06d4b08d595 100644 (file)
@@ -2443,7 +2443,6 @@ static int dl_surf_to_renderdata(ObjectRen *obr, DispList *dl, Material **matar,
        VlakRen *vlr, *vlr1, *vlr2, *vlr3;
        Curve *cu= ob->data;
        float *data, n1[3];
-       /*float flen; - as yet unused */
        int u, v, orcoret= 0;
        int p1, p2, p3, p4, a;
        int sizeu, nsizeu, sizev, nsizev;
@@ -2515,7 +2514,8 @@ static int dl_surf_to_renderdata(ObjectRen *obr, DispList *dl, Material **matar,
                        vlr= RE_findOrAddVlak(obr, obr->totvlak++);
                        vlr->v1= v1; vlr->v2= v2; vlr->v3= v3; vlr->v4= v4;
                        
-                       /* flen= CalcNormFloat4(vlr->v4->co, vlr->v3->co, vlr->v2->co, vlr->v1->co, n1); - as yet unused */
+                       CalcNormFloat4(vlr->v4->co, vlr->v3->co, vlr->v2->co, vlr->v1->co, n1);
+                       
                        VECCOPY(vlr->n, n1);
                        
                        vlr->mat= matar[ dl->col];
@@ -2787,8 +2787,10 @@ static void init_render_curve(Render *re, ObjectRen *obr, int timeoffset)
                                        for(a=0; a<dl->parts; a++) {
 
                                                frontside= (a >= dl->nr/2);
-
-                                               DL_SURFINDEX(dl->flag & DL_CYCL_U, dl->flag & DL_CYCL_V, dl->nr, dl->parts);
+                                               
+                                               if (surfindex_displist(dl, a, &b, &p1, &p2, &p3, &p4)==0)
+                                                       break;
+                                               
                                                p1+= startvert;
                                                p2+= startvert;
                                                p3+= startvert;
index c421d1e83880353bc3eb45ecf967c7b76d96f645..5365908c130b9dfede32a60d6cb1a872f6f3d93d 100644 (file)
@@ -65,6 +65,9 @@ if env['WITH_BF_FFMPEG'] == 1:
     defs.append('WITH_FFMPEG')
     incs += ' ' + env['BF_FFMPEG_INC']
 
+if env['WITH_BF_OGG'] == 1:
+    defs.append('WITH_OGG')
+
 if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw'):
     incs += ' ' + env['BF_PTHREADS_INC']
 
index 5e4b52c08a6cbcdf793931f4a4ad919308436e7c..b0a7a2ab5cc72a7d4ebd56822f5c3af98648d934 100644 (file)
@@ -78,7 +78,7 @@ struct RigNode;
 struct RigArc;
 struct RigEdge;
 
-#define USE_THREADS
+//#define USE_THREADS
 
 typedef struct RigGraph {
        ListBase        arcs;
index 59652b6e68c9a0afc45191c388fa31f959e2dcbf..aaa0215b8108f10e8e98513b79445b654ce13c9f 100644 (file)
@@ -1250,6 +1250,7 @@ static void modifiers_convertParticles(void *obv, void *mdv)
        ModifierData *md = mdv;
        ParticleSystem *psys;
        ParticleCacheKey *key, **cache;
+       ParticleSettings *part;
        Mesh *me;
        MVert *mvert;
        MEdge *medge;
@@ -1262,78 +1263,90 @@ static void modifiers_convertParticles(void *obv, void *mdv)
        if(G.f & G_PARTICLEEDIT) return;
 
        psys=((ParticleSystemModifierData *)md)->psys;
+       part= psys->part;
 
-       if(psys->part->draw_as != PART_DRAW_PATH || psys->pathcache == 0) return;
+       if(part->draw_as == PART_DRAW_GR || part->draw_as == PART_DRAW_OB) {
+               make_object_duplilist_real(NULL);
+       }
+       else {
+               if(part->draw_as != PART_DRAW_PATH || psys->pathcache == 0)
+                       return;
 
-       totpart= psys->totcached;
-       totchild= psys->totchildcache;
+               totpart= psys->totcached;
+               totchild= psys->totchildcache;
 
-       if(totchild && (psys->part->draw&PART_DRAW_PARENT)==0)
-               totpart= 0;
+               if(totchild && (part->draw&PART_DRAW_PARENT)==0)
+                       totpart= 0;
 
-       /* count */
-       cache= psys->pathcache;
-       for(a=0; a<totpart; a++) {
-               key= cache[a];
-               totvert+= key->steps+1;
-               totedge+= key->steps;
-       }
+               /* count */
+               cache= psys->pathcache;
+               for(a=0; a<totpart; a++) {
+                       key= cache[a];
+                       totvert+= key->steps+1;
+                       totedge+= key->steps;
+               }
 
-       cache= psys->childcache;
-       for(a=0; a<totchild; a++) {
-               key= cache[a];
-               totvert+= key->steps+1;
-               totedge+= key->steps;
-       }
+               cache= psys->childcache;
+               for(a=0; a<totchild; a++) {
+                       key= cache[a];
+                       totvert+= key->steps+1;
+                       totedge+= key->steps;
+               }
+
+               if(totvert==0) return;
 
-       if(totvert==0) return;
-
-       /* add new mesh */
-       obn= add_object(OB_MESH);
-       me= obn->data;
-       
-       me->totvert= totvert;
-       me->totedge= totedge;
-       
-       me->mvert= CustomData_add_layer(&me->vdata, CD_MVERT, CD_CALLOC, NULL, totvert);
-       me->medge= CustomData_add_layer(&me->edata, CD_MEDGE, CD_CALLOC, NULL, totedge);
-       me->mface= CustomData_add_layer(&me->fdata, CD_MFACE, CD_CALLOC, NULL, 0);
-       
-       mvert= me->mvert;
-       medge= me->medge;
-
-       /* copy coordinates */
-       cache= psys->pathcache;
-       for(a=0; a<totpart; a++) {
-               key= cache[a];
-               kmax= key->steps;
-               for(k=0; k<=kmax; k++,key++,cvert++,mvert++) {
-                       VECCOPY(mvert->co,key->co);
-                       if(k) {
-                               medge->v1= cvert-1;
-                               medge->v2= cvert;
-                               medge->flag= ME_EDGEDRAW|ME_EDGERENDER|ME_LOOSEEDGE;
-                               medge++;
+               /* add new mesh */
+               obn= add_object(OB_MESH);
+               me= obn->data;
+               
+               me->totvert= totvert;
+               me->totedge= totedge;
+               
+               me->mvert= CustomData_add_layer(&me->vdata, CD_MVERT, CD_CALLOC, NULL, totvert);
+               me->medge= CustomData_add_layer(&me->edata, CD_MEDGE, CD_CALLOC, NULL, totedge);
+               me->mface= CustomData_add_layer(&me->fdata, CD_MFACE, CD_CALLOC, NULL, 0);
+               
+               mvert= me->mvert;
+               medge= me->medge;
+
+               /* copy coordinates */
+               cache= psys->pathcache;
+               for(a=0; a<totpart; a++) {
+                       key= cache[a];
+                       kmax= key->steps;
+                       for(k=0; k<=kmax; k++,key++,cvert++,mvert++) {
+                               VECCOPY(mvert->co,key->co);
+                               if(k) {
+                                       medge->v1= cvert-1;
+                                       medge->v2= cvert;
+                                       medge->flag= ME_EDGEDRAW|ME_EDGERENDER|ME_LOOSEEDGE;
+                                       medge++;
+                               }
                        }
                }
-       }
 
-       cache=psys->childcache;
-       for(a=0; a<totchild; a++) {
-               key=cache[a];
-               kmax=key->steps;
-               for(k=0; k<=kmax; k++,key++,cvert++,mvert++) {
-                       VECCOPY(mvert->co,key->co);
-                       if(k) {
-                               medge->v1=cvert-1;
-                               medge->v2=cvert;
-                               medge->flag= ME_EDGEDRAW|ME_EDGERENDER|ME_LOOSEEDGE;
-                               medge++;
+               cache=psys->childcache;
+               for(a=0; a<totchild; a++) {
+                       key=cache[a];
+                       kmax=key->steps;
+                       for(k=0; k<=kmax; k++,key++,cvert++,mvert++) {
+                               VECCOPY(mvert->co,key->co);
+                               if(k) {
+                                       medge->v1=cvert-1;
+                                       medge->v2=cvert;
+                                       medge->flag= ME_EDGEDRAW|ME_EDGERENDER|ME_LOOSEEDGE;
+                                       medge++;
+                               }
                        }
                }
        }
 
        DAG_scene_sort(G.scene);
+
+       allqueue(REDRAWVIEW3D, 0);
+       allqueue(REDRAWOOPS, 0);
+       
+       BIF_undo_push("Convert particles to mesh object(s).");
 }
 
 static void modifiers_applyModifier(void *obv, void *mdv)
@@ -1872,8 +1885,15 @@ static void draw_modifier(uiBlock *block, Object *ob, ModifierData *md, int *xco
 
                        uiBlockBeginAlign(block);
                        if (md->type==eModifierType_ParticleSystem) {
-                               but = uiDefBut(block, BUT, B_MODIFIER_RECALC, "Convert",        lx,(cy-=19),60,19, 0, 0, 0, 0, 0, "Convert the current particles to a mesh object");
-                               uiButSetFunc(but, modifiers_convertParticles, ob, md);
+                               ParticleSystem *psys;
+                       psys= ((ParticleSystemModifierData *)md)->psys;
+
+                       if(!(G.f & G_PARTICLEEDIT)) {
+                                       if(ELEM3(psys->part->draw_as, PART_DRAW_PATH, PART_DRAW_GR, PART_DRAW_OB) && psys->pathcache) {
+                                               but = uiDefBut(block, BUT, B_MODIFIER_RECALC, "Convert",        lx,(cy-=19),60,19, 0, 0, 0, 0, 0, "Convert the current particles to a mesh object");
+                                               uiButSetFunc(but, modifiers_convertParticles, ob, md);
+                                       }
+                               }
                        }
                        else{
                                but = uiDefBut(block, BUT, B_MODIFIER_RECALC, "Apply",  lx,(cy-=19),60,19, 0, 0, 0, 0, 0, "Apply the current modifier and remove from the stack");
@@ -4954,9 +4974,7 @@ void do_meshbuts(unsigned short event)
                if( select_area(SPACE_VIEW3D)) spin_mesh(G.scene->toolsettings->step, G.scene->toolsettings->degr, 0, 1);
                break;
        case B_EXTR:
-               G.f |= G_DISABLE_OK;
                if( select_area(SPACE_VIEW3D)) extrude_mesh();
-               G.f -= G_DISABLE_OK;
                break;
        case B_SCREW:
                if( select_area(SPACE_VIEW3D)) screw_mesh(G.scene->toolsettings->step, G.scene->toolsettings->turn);
@@ -4965,9 +4983,7 @@ void do_meshbuts(unsigned short event)
                if( select_area(SPACE_VIEW3D)) extrude_repeat_mesh(G.scene->toolsettings->step, G.scene->toolsettings->extr_offs);
                break;
        case B_SPLIT:
-               G.f |= G_DISABLE_OK;
                split_mesh();
-               G.f -= G_DISABLE_OK;
                break;
        case B_REMDOUB:
                count= removedoublesflag(1, 0, G.scene->toolsettings->doublimit);
index a54f20b85c2b2805de532e1d03fe1fc94cc69bb9..fb206fed15e3b52a80f3f470b16cf5d42e312649 100644 (file)
@@ -2565,29 +2565,19 @@ static short draw_actuatorbuttons(Object *ob, bActuator *act, uiBlock *block, sh
        case ACT_MESSAGE:
                ma = act->data;
 
-#define MESSAGE_SENSOR_TO_FIELD_WORKS  /* Really?  Not really.  Don't remove this ifdef yet */
-
-#ifdef MESSAGE_SENSOR_TO_FIELD_WORKS
                ysize = 4 + (3 * 24); /* footer + number of lines * 24 pixels/line */
-#else
-               ysize = 4 + (2 * 24); /* footer + number of lines * 24 pixels/line */
-#endif
+       
                glRects(xco, yco-ysize, xco+width, yco);
                uiEmboss((float)xco,        (float)yco-ysize,
                                 (float)xco+width,  (float)yco, 1);
 
                myline=1;
 
-
-#ifdef MESSAGE_SENSOR_TO_FIELD_WORKS
                /* line 1: To */
                uiDefBut(block, TEX, 1, "To: ",
                        (xco+10), (yco-(myline++*24)), (width-20), 19,
                        &ma->toPropName, 0, 31, 0, 0,
-                       "Optional send message to objects with this name only (Prefix name with OB)"
-                       ", or empty to broadcast");
-
-#endif
+                       "Optional send message to objects with this name only, or empty to broadcast");
 
                /* line 2: Message Subject */
                uiDefBut(block, TEX, 1, "Subject: ",
@@ -3031,62 +3021,33 @@ static uiBlock *advanced_bullet_menu(void *arg_ob)
 {
        uiBlock *block;
        Object *ob = arg_ob;
-       short yco = 105, xco = 0;
-
-       /* create a BulletSoftBody structure if not already existing */
-       if ((ob->body_type & OB_BODY_TYPE_SOFT) && !ob->bsoft)
-               ob->bsoft = bsbNew();
+       short yco = 20, xco = 0;
 
        block= uiNewBlock(&curarea->uiblocks, "advanced_bullet_options", UI_EMBOSS, UI_HELV, curarea->win);
        /* use this for a fake extra empy space around the buttons */
-       uiDefBut(block, LABEL, 0, "", -5, -10, 255, 140, NULL, 0, 0, 0, 0, "");
+       uiDefBut(block, LABEL, 0, "", -10, -10, 380, 60, NULL, 0, 0, 0, 0, "");
 
-               if (ob->gameflag & OB_SOFT_BODY) {
+       if (ob->gameflag & OB_SOFT_BODY) {
 
                if (ob->bsoft)
                {
-                       xco = 0;
-                       uiDefButF(block, NUMSLI, 0, "LinStiff", xco, yco, 238, 19, 
-                               &ob->bsoft->linStiff, 0.0, 1.0, 1, 0,
-                               "Linear stiffness of the soft body links");
-                       yco -= 25;
-                       xco = 0;
 
-                       uiDefButBitI(block, TOG, OB_BSB_SHAPE_MATCHING, 0, "Shape matching", 
-                               xco, yco, 118, 19, &ob->bsoft->flag, 0, 0, 0, 0, 
-                               "Enable soft body shape matching goal");
-                       
-                       uiDefButBitI(block, TOG, OB_BSB_BENDING_CONSTRAINTS, 0, "Bending Constraints", 
-                               xco+=120, yco, 118, 19, &ob->bsoft->flag, 0, 0, 0, 0, 
-                               "Enable bending constraints");
-
-                       yco -= 25;
-                       xco = 0;
-                       uiDefButBitI(block, TOG, OB_BSB_COL_CL_RS, 0, "Cluster Col. RS", 
-                               xco, yco, 118, 19, &ob->bsoft->collisionflags, 0, 0, 0, 0, 
+                       uiBlockBeginAlign(block);
+                       uiDefButBitI(block, TOG, OB_BSB_COL_CL_RS, 0, "Cluster Collision RS", 
+                               xco, yco, 180, 19, &ob->bsoft->collisionflags, 0, 0, 0, 0, 
                                "Enable cluster collision between soft and rigid body");
-                       uiDefButBitI(block, TOG, OB_BSB_COL_CL_SS, 0, "Cluster Col. SS", 
-                               xco+=120, yco, 118, 19, &ob->bsoft->collisionflags, 0, 0, 0, 0, 
+                       uiDefButBitI(block, TOG, OB_BSB_COL_CL_SS, 0, "Cluster Collision SS", 
+                               xco+=180, yco, 180, 19, &ob->bsoft->collisionflags, 0, 0, 0, 0, 
                                "Enable cluster collision between soft and soft body");
-                       yco -= 25;
+                       yco -= 20;
                        xco = 0;
-                       uiDefButI(block, NUM, REDRAWVIEW3D, "Clus.It.",         
-                               xco, yco, 118, 19, &ob->bsoft->numclusteriterations, 1.0, 128., 
+                       uiDefButI(block, NUM, 0, "Cluster Iter.",               
+                               xco, yco, 180, 19, &ob->bsoft->numclusteriterations, 1.0, 128., 
                                0, 0, "Specify the number of cluster iterations");
-
-                       uiDefButI(block, NUM, REDRAWVIEW3D, "piterations",              
-                               xco+=120, yco, 118, 19, &ob->bsoft->piterations, 0, 10, 
+                       uiDefButI(block, NUM, 0, "Position Iter.",              
+                               xco+=180, yco, 180, 19, &ob->bsoft->piterations, 0, 10, 
                                0, 0, "Position solver iterations");
-
-                       yco -= 25;
-                       xco = 0;
-                       uiDefButF(block, NUMSLI, REDRAWVIEW3D, "Friction",              
-                               xco, yco, 118, 19, &ob->bsoft->kDF, 0.0, 1., 
-                               0, 0, "Dynamic Friction");
-
-                       uiDefButF(block, NUMSLI, REDRAWVIEW3D, "kMT",           
-                               xco+=120, yco, 118, 19, &ob->bsoft->kMT, 0, 1,
-                               0, 0, "Pose matching coefficient");
+                       uiBlockEndAlign(block);
 
                        /*
                        //too complex tweaking, disable for now
@@ -3113,22 +3074,18 @@ static uiBlock *advanced_bullet_menu(void *arg_ob)
                
                xco = 0;
 
-               uiDefButBitI(block, TOG, OB_ACTOR, 0, "Sensor actor",
-                                       xco, yco, 118, 19, &ob->gameflag, 0, 0, 0, 0,
-                                       "Objects that are detected by the Near and Radar sensor");
-
                if (ob->gameflag & OB_DYNAMIC) {
                        if (ob->margin < 0.001f)
                                ob->margin = 0.06f;
                        uiDefButF(block, NUM, 0, "Margin", 
-                                       xco+120, yco, 118, 19, &ob->margin, 0.001, 1.0, 1, 0, 
+                                       xco, yco, 170, 19, &ob->margin, 0.001, 1.0, 1, 0, 
                                        "Collision margin");
                } else {
                        uiDefButF(block, NUM, 0, "Margin", 
-                                       xco+120, yco, 118, 19, &ob->margin, 0.0, 1.0, 1, 0, 
+                                       xco, yco, 170, 19, &ob->margin, 0.0, 1.0, 1, 0, 
                                        "Collision margin");
                }
-               yco -= 25;
+               yco -= 20;
                xco = 0;
                
        
@@ -3152,73 +3109,114 @@ static void buttons_bullet(uiBlock *block, Object *ob)
                ob->body_type = OB_BODY_TYPE_DYNAMIC;
        else if (ob->gameflag & OB_RIGID_BODY)
                ob->body_type = OB_BODY_TYPE_RIGID;
-       else
+       else {
                ob->body_type = OB_BODY_TYPE_SOFT;
+               /* create the structure here because we display soft body buttons in the main panel */
+               if (!ob->bsoft)
+                       ob->bsoft = bsbNew();
+       }
 
        uiBlockBeginAlign(block);
 
        //only enable game soft body if Blender Soft Body exists
        but = uiDefButS(block, MENU, REDRAWVIEW3D, 
                        "Object type%t|No collision%x0|Static%x1|Dynamic%x2|Rigid body%x3|Soft body%x4", 
-                       10, 205, 120, 19, &ob->body_type, 0, 0, 0, 0, "Selects the type of physical representation");
+                       10, 205, 100, 19, &ob->body_type, 0, 0, 0, 0, "Selects the type of physical representation");
        uiButSetFunc(but, check_body_type, but, ob);
 
        if (ob->gameflag & OB_COLLISION) {
 
+               uiDefButBitI(block, TOG, OB_ACTOR, 0, "Actor",
+                                       110, 205, 50, 19, &ob->gameflag, 0, 0, 0, 0,
+                                       "Objects that are detected by the Near and Radar sensor");
+
                        
 
-                       uiDefButBitI(block, TOG, OB_GHOST, B_REDR, "Ghost", 
-                               135,205,55,19, 
+               uiDefButBitI(block, TOG, OB_GHOST, B_REDR, "Ghost", 
+                                       160,205,50,19, 
                                        &ob->gameflag, 0, 0, 0, 0, 
                                        "Objects that don't restitute collisions (like a ghost)");
 
                //uiBlockSetCol(block, TH_BUT_SETTING1);
                uiDefBlockBut(block, advanced_bullet_menu, ob, 
                                          "Advanced Settings", 
-                                         200, 205, 150, 19, "Display collision advanced settings");
+                                         210, 205, 140, 19, "Display collision advanced settings");
                //uiBlockSetCol(block, TH_BUT_SETTING2);
 
 
                if(ob->gameflag & OB_DYNAMIC) {
 
+                       if (!(ob->gameflag & OB_SOFT_BODY))
+                       {
+
                                uiDefButF(block, NUM, B_DIFF, "Mass:", 10, 185, 130, 19, 
                                                &ob->mass, 0.01, 10000.0, 10, 2, 
                                                "The mass of the Object");
+                               
+                               uiDefButF(block, NUM, REDRAWVIEW3D, "Radius:", 140, 185, 130, 19, 
+                                                       &ob->inertia, 0.01, 10.0, 10, 2, 
+                                                       "Radius for Bounding sphere and Fh/Fh Rot");
+                               
+                               uiDefButBitI(block, TOG, OB_COLLISION_RESPONSE, B_REDR, "No sleeping", 270,185,80,19, 
+                                               &ob->gameflag, 0, 0, 0, 0, 
+                                               "Disable auto (de)activation");
 
-                               if (!(ob->gameflag & OB_SOFT_BODY))
-                               {
+                               uiDefButF(block, NUMSLI, B_DIFF, "Damp ", 10, 165, 150, 19, 
+                                               &ob->damping, 0.0, 1.0, 10, 0, 
+                                               "General movement damping");
+                               uiDefButF(block, NUMSLI, B_DIFF, "RotDamp ", 160, 165, 190, 19, 
+                                               &ob->rdamping, 0.0, 1.0, 10, 0, 
+                                               "General rotation damping");
 
-                                       
-                                       uiDefButF(block, NUM, REDRAWVIEW3D, "Radius:", 140, 185, 130, 19, 
-                                                               &ob->inertia, 0.01, 10.0, 10, 2, 
-                                                               "Radius for Bounding sphere and Fh/Fh Rot");
-                                       
-                                       uiDefButBitI(block, TOG, OB_COLLISION_RESPONSE, B_REDR, "No sleeping", 270,185,80,19, 
-                                                       &ob->gameflag, 0, 0, 0, 0, 
-                                                       "Disable auto (de)activation");
-
-                                       uiDefButF(block, NUMSLI, B_DIFF, "Damp ", 10, 165, 150, 19, 
-                                                       &ob->damping, 0.0, 1.0, 10, 0, 
-                                                       "General movement damping");
-                                       uiDefButF(block, NUMSLI, B_DIFF, "RotDamp ", 160, 165, 190, 19, 
-                                                       &ob->rdamping, 0.0, 1.0, 10, 0, 
-                                                       "General rotation damping");
-
-                                       uiDefButBitI(block, TOG, OB_DO_FH, B_DIFF, "Do Fh", 10,145,50,19, 
-                                                       &ob->gameflag, 0, 0, 0, 0, 
-                                                       "Use Fh settings in Materials");
-                                       uiDefButBitI(block, TOG, OB_ROT_FH, B_DIFF, "Rot Fh", 60,145,50,19, 
-                                                       &ob->gameflag, 0, 0, 0, 0, 
-                                                       "Use face normal to rotate Object");
-                                       /* Form factor is hooked up in Bullet, to scale inertia tensor */
-
-                                       uiDefButF(block, NUM, B_DIFF, "Form:", 110, 145, 120, 19, 
-                                                       &ob->formfactor, 0.01, 100.0, 10, 0, 
-                                                       "Form factor scales the inertia tensor");
-                               }
+                               uiDefButBitI(block, TOG, OB_DO_FH, B_DIFF, "Do Fh", 10,145,50,19, 
+                                               &ob->gameflag, 0, 0, 0, 0, 
+                                               "Use Fh settings in Materials");
+                               uiDefButBitI(block, TOG, OB_ROT_FH, B_DIFF, "Rot Fh", 60,145,50,19, 
+                                               &ob->gameflag, 0, 0, 0, 0, 
+                                               "Use face normal to rotate Object");
+                               /* Form factor is hooked up in Bullet, to scale inertia tensor */
+
+                               uiDefButF(block, NUM, B_DIFF, "Form:", 110, 145, 120, 19, 
+                                               &ob->formfactor, 0.01, 100.0, 10, 0, 
+                                               "Form factor scales the inertia tensor");
+                       } else {
+                               uiDefButF(block, NUM, B_DIFF, "Mass:", 10, 185, 110, 19, 
+                                               &ob->mass, 0.01, 10000.0, 10, 2, 
+                                               "The mass of the Object");
+
+                               if (ob->bsoft) {
+                                       uiDefButBitI(block, TOG, OB_BSB_SHAPE_MATCHING, B_REDR, "Shape Match", 
+                                                       120, 185, 110, 19, &ob->bsoft->flag, 0, 0, 0, 0, 
+                                                       "Enable soft body shape matching goal");
 
+                                       uiDefButBitI(block, TOG, OB_BSB_BENDING_CONSTRAINTS, 0, "Bending Const.", 
+                                                       230, 185, 120, 19, &ob->bsoft->flag, 0, 0, 0, 0, 
+                                                       "Enable bending constraints");
+
+                                       uiDefButF(block, NUMSLI, 0, "LinStiff ", 10, 165, 170, 19, 
+                                                       &ob->bsoft->linStiff, 0.0, 1.0, 1, 0,
+                                                       "Linear stiffness of the soft body links");
+
+                                       uiDefButF(block, NUMSLI, 0, "Friction ",                
+                                                       180, 165, 170, 19, &ob->bsoft->kDF, 0.0, 1., 
+                                                       0, 0, "Dynamic Friction");
+
+                                       if (ob->bsoft->flag & OB_BSB_SHAPE_MATCHING) {
+                                               uiDefButF(block, NUMSLI, 0, "kMT ",             
+                                                               10, 145, 170, 19, &ob->bsoft->kMT, 0, 1,
+                                                               0, 0, "Shape matching threshold");
+                                       }
+                               }
+                       }
                                
+               } else {
+                       /* static object can also have a sphere bound shape, radius is used */
+                       if ((ob->gameflag & OB_BOUNDS) && (ob->boundtype == OB_BOUND_SPHERE)) {
+                               uiDefButF(block, NUM, REDRAWVIEW3D, "Radius:", 10, 185, 130, 19, 
+                                                       &ob->inertia, 0.01, 10.0, 10, 2, 
+                                                       "Radius for Bounding sphere");
                        }
+               }
 
                uiBlockEndAlign(block);
 
index 8ea71ce38dcb19338d65d5c9246d523e20d7fb1b..74725b99fea79408db778437bbc6ff241000def6 100644 (file)
@@ -1859,7 +1859,12 @@ static char* ffmpeg_format_pup(void)
        }
        return string;
 #endif
-       strcpy(formatstring, "FFMpeg format: %%t|%s %%x%d|%s %%x%d|%s %%x%d|%s %%x%d|%s %%x%d|%s %%x%d|%s %%x%d|%s %%x%d|%s %%x%d");
+       strcpy(formatstring, "FFMpeg format: %%t|%s %%x%d|%s %%x%d|%s %%x%d|%s %%x%d|%s %%x%d|%s %%x%d|%s %%x%d|%s %%x%d"
+#if 0
+/* ifdef WITH_OGG, disabled, since broken within ffmpeg bundled with blender */
+             "|%s %%x%d"
+#endif
+             "|%s %%x%d");
        sprintf(string, formatstring,
                "MPEG-1", FFMPEG_MPEG1,
                "MPEG-2", FFMPEG_MPEG2,
@@ -1869,6 +1874,10 @@ static char* ffmpeg_format_pup(void)
                "DV", FFMPEG_DV,
               "H264", FFMPEG_H264,
               "XVid", FFMPEG_XVID,
+#if 0 
+/* ifdef WITH_OGG, disabled, since broken within ffmpeg bundled with blender */
+              "OGG", FFMPEG_OGG,
+#endif
               "FLV", FFMPEG_FLV);
        return string;
 }
@@ -1893,7 +1902,13 @@ static char* ffmpeg_preset_pup(void)
 static char* ffmpeg_codec_pup(void) {
        static char string[2048];
        char formatstring[2048];
-       strcpy(formatstring, "FFMpeg format: %%t|%s %%x%d|%s %%x%d|%s %%x%d|%s %%x%d|%s %%x%d|%s %%x%d|%s %%x%d|%s %%x%d");
+       strcpy(formatstring, 
+             "FFMpeg format: %%t"
+             "|%s %%x%d|%s %%x%d|%s %%x%d|%s %%x%d|%s %%x%d|%s %%x%d|%s %%x%d"
+#ifdef WITH_OGG
+             "|%s %%x%d"
+#endif
+             "|%s %%x%d");
        sprintf(string, formatstring,
                "MPEG1", CODEC_ID_MPEG1VIDEO,
                "MPEG2", CODEC_ID_MPEG2VIDEO,
@@ -1902,7 +1917,10 @@ static char* ffmpeg_codec_pup(void) {
               "DV", CODEC_ID_DVVIDEO,
                "H264", CODEC_ID_H264,
               "XVid", CODEC_ID_XVID,
-              "FlashVideo1", CODEC_ID_FLV1 );
+#ifdef WITH_OGG
+              "Theora", CODEC_ID_THEORA,
+#endif
+              "FlashVideo1", CODEC_ID_FLV1);
        return string;
 
 }
@@ -1910,12 +1928,20 @@ static char* ffmpeg_codec_pup(void) {
 static char* ffmpeg_audio_codec_pup(void) {
        static char string[2048];
        char formatstring[2048];
-       strcpy(formatstring, "FFMpeg format: %%t|%s %%x%d|%s %%x%d|%s %%x%d|%s %%x%d|%s %%x%d");
+       strcpy(formatstring, 
+             "FFMpeg format: %%t|%s %%x%d|%s %%x%d|%s %%x%d"
+#ifdef WITH_OGG
+             "|%s %%x%d"
+#endif
+             "|%s %%x%d");
        sprintf(string, formatstring,
                "MP2", CODEC_ID_MP2,
                "MP3", CODEC_ID_MP3,
                "AC3", CODEC_ID_AC3,
                "AAC", CODEC_ID_AAC,
+#ifdef WITH_OGG
+              "Vorbis", CODEC_ID_VORBIS,
+#endif
               "PCM", CODEC_ID_PCM_S16LE);
        return string;
 
@@ -2910,8 +2936,8 @@ static void render_panel_ffmpeg_video(void)
                                 0, 1, 0,0, "Autosplit output at 2GB boundary.");
        
        
-       if (ELEM3(G.scene->r.ffcodecdata.type, FFMPEG_AVI, 
-                 FFMPEG_MOV, FFMPEG_MKV)) {
+       if (ELEM4(G.scene->r.ffcodecdata.type, FFMPEG_AVI, 
+                 FFMPEG_MOV, FFMPEG_MKV, FFMPEG_OGG)) {
                uiDefBut(block, LABEL, 0, "Codec", 
                                xcol1, yofs-44, 110, 20, 0, 0, 0, 0, 0, "");
                uiDefButI(block, MENU,B_REDR, ffmpeg_codec_pup(), 
index c377168bdb8f722e48f7ee01738492097960aec4..056ecd5d36ccf5ffd7220d70fb9332ac2a887ad5 100644 (file)
@@ -2428,6 +2428,7 @@ void do_lampbuts(unsigned short event)
        case B_SHADBUF:
                la= G.buts->lockpoin; 
                la->mode &= ~LA_SHAD_RAY;
+               BIF_preview_changed(ID_LA);
                allqueue(REDRAWBUTSSHADING, 0); 
                allqueue(REDRAWVIEW3D, 0);              
                break;
@@ -2437,6 +2438,7 @@ void do_lampbuts(unsigned short event)
                /* yafray: 'softlight' uses it's own shadbuf. flag.
                   Must be cleared here too when switching from ray shadow */
                la->mode &= ~LA_YF_SOFT;
+               BIF_preview_changed(ID_LA);
                allqueue(REDRAWBUTSSHADING, 0);
                allqueue(REDRAWVIEW3D, 0);      
                break;
index f050a7303809d14720d0b2dc24f8e65c697ec02a..2d41e01f7e4f2f44a51d94e66ccd5e8c866f1226 100644 (file)
@@ -2506,7 +2506,7 @@ int draw_armature(Base *base, int dt, int flag)
        bArmature *arm= ob->data;
        int retval= 0;
 
-       if(G.f & G_SIMULATION)
+       if(G.f & G_RENDER_SHADOW)
                return 1;
        
        if(dt>OB_WIRE && arm->drawtype!=ARM_LINE) {
index b38bd6b2b63e6020cd5662c8274bf39d338bb164..769fabae1dbb50747ec719b2440a223be9f95cf3 100644 (file)
@@ -433,13 +433,18 @@ static void gp_draw_stroke_point (bGPDspoint *points, short thickness, short sfl
                        co[1]= (points->y / 1000 * winy);
                }
                
-               /* if thickness is less than GP_DRAWTHICKNESS_SPECIAL, simple opengl point will do */
-               if (thickness < GP_DRAWTHICKNESS_SPECIAL) {
+               /* if thickness is less than GP_DRAWTHICKNESS_SPECIAL, simple dot looks ok
+                *      - also mandatory in if Image Editor 'image-based' dot
+                */
+               if ( (thickness < GP_DRAWTHICKNESS_SPECIAL) ||
+                        ((curarea->spacetype==SPACE_IMAGE) && (sflag & GP_STROKE_2DSPACE)) )
+               {
                        glBegin(GL_POINTS);
                                glVertex2fv(co);
                        glEnd();
                }
-               else {
+               else 
+               {
                        /* draw filled circle as is done in circf (but without the matrix push/pops which screwed things up) */
                        GLUquadricObj *qobj = gluNewQuadric(); 
                        
@@ -495,7 +500,7 @@ static void gp_draw_stroke (bGPDspoint *points, int totpoints, short thickness,
                                                        short debug, int offsx, int offsy, int winx, int winy)
 {      
        /* if thickness is less than GP_DRAWTHICKNESS_SPECIAL, 'smooth' opengl lines look better
-        *      - but NOT if Image Editor 'image-based' stroke
+        *      - 'smooth' opengl lines are also required if Image Editor 'image-based' stroke
         */
        if ( (thickness < GP_DRAWTHICKNESS_SPECIAL) || 
                 ((curarea->spacetype==SPACE_IMAGE) && (dflag & GP_DRAWDATA_ONLYV2D)) ) 
index b7aa29e2482388aec8b24b6c5aeb24a0477ebf1e..722b430714bc22ba910c966cd4f86816dec1b7e8 100644 (file)
@@ -281,7 +281,7 @@ void drawaxes(float size, int flag, char drawtype)
        float v2[3]= {0.0, 0.0, 0.0};
        float v3[3]= {0.0, 0.0, 0.0};
 
-       if(G.f & G_SIMULATION)
+       if(G.f & G_RENDER_SHADOW)
                return;
        
        switch(drawtype) {
@@ -666,7 +666,7 @@ static void drawlamp(Object *ob)
        float imat[4][4], curcol[4];
        char col[4];
 
-       if(G.f & G_SIMULATION)
+       if(G.f & G_RENDER_SHADOW)
                return;
        
        la= ob->data;
@@ -958,7 +958,7 @@ static void drawcamera(Object *ob, int flag)
        float vec[8][4], tmat[4][4], fac, facx, facy, depth;
        int i;
 
-       if(G.f & G_SIMULATION)
+       if(G.f & G_RENDER_SHADOW)
                return;
 
        cam= ob->data;
@@ -1768,7 +1768,7 @@ static void draw_verse_debug(Object *ob, EditMesh *em)
        float v1[3], v2[3], v3[3], v4[3], fvec[3], col[3];
        char val[32];
 
-       if(G.f & G_SIMULATION)
+       if(G.f & G_RENDER_SHADOW)
                return;
        
        if(G.vd->zbuf && (G.vd->flag & V3D_ZBUF_SELECT)==0)
@@ -1834,7 +1834,7 @@ static void draw_em_measure_stats(Object *ob, EditMesh *em)
        char conv_float[5]; /* Use a float conversion matching the grid size */
        float area, col[3]; /* area of the face,  color of the text to draw */
        
-       if(G.f & G_SIMULATION)
+       if(G.f & (G_RENDER_OGL|G_RENDER_SHADOW))
                return;
 
        /* make the precission of the pronted value proportionate to the gridsize */
@@ -4001,16 +4001,17 @@ static void drawnurb(Base *base, Nurb *nurb, int dt)
                        int skip= nu->resolu/16;
                        
                        while (nr-->0) { /* accounts for empty bevel lists */
+                               float fac= bevp->radius * G.scene->editbutsize;
                                float ox,oy,oz; // Offset perpendicular to the curve
                                float dx,dy,dz; // Delta along the curve
                                
-                               ox = bevp->radius*bevp->mat[0][0];
-                               oy = bevp->radius*bevp->mat[0][1];
-                               oz = bevp->radius*bevp->mat[0][2];
+                               ox = fac*bevp->mat[0][0];
+                               oy = fac*bevp->mat[0][1];
+                               oz = fac*bevp->mat[0][2];
                        
-                               dx = bevp->radius*bevp->mat[2][0];
-                               dy = bevp->radius*bevp->mat[2][1];
-                               dz = bevp->radius*bevp->mat[2][2];
+                               dx = fac*bevp->mat[2][0];
+                               dy = fac*bevp->mat[2][1];
+                               dz = fac*bevp->mat[2][2];
 
                                glBegin(GL_LINE_STRIP);
                                glVertex3f(bevp->x - ox - dx, bevp->y - oy - dy, bevp->z - oz - dz);
@@ -5164,7 +5165,7 @@ void draw_object(Base *base, int flag)
        }
 
        /* draw extra: after normal draw because of makeDispList */
-       if(dtx && !(G.f & G_SIMULATION)) {
+       if(dtx && !(G.f & (G_RENDER_OGL|G_RENDER_SHADOW))) {
                if(dtx & OB_AXIS) {
                        drawaxes(1.0f, flag, OB_ARROWS);
                }
@@ -5185,7 +5186,8 @@ void draw_object(Base *base, int flag)
        }
 
        if(dt<OB_SHADED) {
-               if(/*(ob->gameflag & OB_ACTOR) &&*/ (ob->gameflag & OB_DYNAMIC)) {
+               if((ob->gameflag & OB_DYNAMIC) || 
+                       ((ob->gameflag & OB_BOUNDS) && (ob->boundtype == OB_BOUND_SPHERE))) {
                        float tmat[4][4], imat[4][4], vec[3];
 
                        vec[0]= vec[1]= vec[2]= 0.0;
@@ -5204,7 +5206,7 @@ void draw_object(Base *base, int flag)
 
        if(warning_recursive) return;
        if(base->flag & (OB_FROMDUPLI|OB_RADIO)) return;
-       if(G.f & G_SIMULATION) return;
+       if(G.f & G_RENDER_SHADOW) return;
 
        /* object centers, need to be drawn in viewmat space for speed, but OK for picking select */
        if(ob!=OBACT || (G.f & (G_VERTEXPAINT|G_TEXTUREPAINT|G_WEIGHTPAINT))==0) {
index d7346a1ed21e2aa729e0766a660324f7d4ef9e89..d54046a260ec6a68d8cfeed35a9b1dfac68f5211 100644 (file)
@@ -348,7 +348,7 @@ static void drawseqwave(Sequence *seq, float x1, float y1, float x2, float y2, i
        
        signed short* s;
        bSound *sound;
-       Uint8 *stream;
+       uint8_t *stream;
        
        audio_makestream(seq->sound);
        if(seq->sound==NULL || seq->sound->stream==NULL) return;
index dbb3aaf767298004d56685ef312ff9ab604420b4..ccf602542d2e23aba3053dcc8599d71fb83f6ea5 100644 (file)
@@ -149,7 +149,8 @@ static int doc_scroll= 0;
 static int jump_to= 0;
 static double last_jump= 0;
 
-static BMF_Font *spacetext_get_font(SpaceText *st) {
+static BMF_Font *spacetext_get_font(SpaceText *st) 
+{
        static BMF_Font *scr12= NULL;
        static BMF_Font *scr15= NULL;
        
@@ -166,7 +167,8 @@ static BMF_Font *spacetext_get_font(SpaceText *st) {
        }
 }
 
-static int spacetext_get_fontwidth(SpaceText *st) {
+static int spacetext_get_fontwidth(SpaceText *st) 
+{
        return BMF_GetCharacterWidth(spacetext_get_font(st), ' ');
 }
 
@@ -175,7 +177,8 @@ static int *temp_char_accum= NULL;
 static int temp_char_len= 0;
 static int temp_char_pos= 0;
 
-static void temp_char_write(char c, int accum) {
+static void temp_char_write(char c, int accum) 
+{
        if (temp_char_len==0 || temp_char_pos>=temp_char_len) {
                char *nbuf; int *naccum;
                int olen= temp_char_len;
@@ -205,7 +208,8 @@ static void temp_char_write(char c, int accum) {
        else temp_char_pos++;
 }
 
-void free_txt_data(void) {
+void free_txt_data(void) 
+{
        txt_free_cut_buffer();
        
        if (g_find_str) MEM_freeN(g_find_str);
@@ -214,7 +218,8 @@ void free_txt_data(void) {
        if (temp_char_accum) MEM_freeN(temp_char_accum);        
 }
 
-static int render_string (SpaceText *st, char *in) {
+static int render_string (SpaceText *st, char *in) 
+{
        int r = 0, i = 0;
        
        while(*in) {
@@ -262,6 +267,7 @@ static int find_builtinfunc(char *string)
 static int find_specialvar(char *string) 
 {
        int i = 0;
+       
        if (string[0]=='d' && string[1]=='e' && string[2]=='f')
                i = 3;
        else if (string[0]=='c' && string[1]=='l' && string[2]=='a' && string[3]=='s' && string[4]=='s')
@@ -275,6 +281,7 @@ static int find_specialvar(char *string)
 static void print_format(SpaceText *st, TextLine *line) {
        int i, a;
        char *s, *f;
+       
        s = line->line;
        f = line->format;
        for (a=0; *s; s++) {
@@ -289,7 +296,8 @@ static void print_format(SpaceText *st, TextLine *line) {
 #endif // not used
 
 /* Ensures the format string for the given line is long enough, reallocating as needed */
-static int check_format_len(TextLine *line, unsigned int len) {
+static int check_format_len(TextLine *line, unsigned int len) 
+{
        if (line->format) {
                if (strlen(line->format) < len) {
                        MEM_freeN(line->format);
@@ -316,7 +324,8 @@ static int check_format_len(TextLine *line, unsigned int len) {
  * It is terminated with a null-terminator '\0' followed by a continuation
  * flag indicating whether the line is part of a multi-line string.
  */
-void txt_format_line(SpaceText *st, TextLine *line, int do_next) {
+void txt_format_line(SpaceText *st, TextLine *line, int do_next) 
+{
        char *str, *fmt, orig, cont, find, prev = ' ';
        int len, i;
 
@@ -436,7 +445,8 @@ void txt_format_text(SpaceText *st)
                txt_format_line(st, linep, 0);
 }
 
-static void format_draw_color(char formatchar) {
+static void format_draw_color(char formatchar) 
+{
        switch (formatchar) {
                case '_': /* Whitespace */
                        break;
@@ -509,8 +519,8 @@ static int text_draw_wrapped(SpaceText *st, char *str, int x, int y, int w, char
 static int text_draw(SpaceText *st, char *str, int cshift, int maxwidth, int draw, int x, int y, char *format)
 {
        int r=0, w= 0;
-       char *in;
        int *acc;
+       char *in;
 
        w= render_string(st, str);
        if(w<cshift ) return 0; /* String is shorter than shift */
@@ -672,8 +682,10 @@ static void set_cursor_to_pos (SpaceText *st, int x, int y, int sel)
        if(!sel) txt_pop_sel(text);
 }
 
-static int get_wrap_width(SpaceText *st) {
+static int get_wrap_width(SpaceText *st) 
+{
        int x, max;
+       
        x= st->showlinenrs ? TXT_OFFSET + TEXTXLOC : TXT_OFFSET;
        max= (curarea->winx-x)/spacetext_get_fontwidth(st);
        return max>8 ? max : 8;
@@ -681,7 +693,8 @@ static int get_wrap_width(SpaceText *st) {
 
 #if 0 // not used 
 /* Returns the number of wrap points (or additional lines) in the given string */
-static int get_wrap_points(SpaceText *st, char *line) {
+static int get_wrap_points(SpaceText *st, char *line) 
+{
        int start, end, taboffs, i, max, count;
        
        if (!st->wordwrap) return 0;
@@ -706,7 +719,8 @@ static int get_wrap_points(SpaceText *st, char *line) {
 #endif // not used
 
 /* Sets (offl, offc) for transforming (line, curs) to its wrapped position */
-static void wrap_offset(SpaceText *st, TextLine *linein, int cursin, int *offl, int *offc) {
+static void wrap_offset(SpaceText *st, TextLine *linein, int cursin, int *offl, int *offc) 
+{
        Text *text;
        TextLine *linep;
        int i, j, start, end, chars, max, chop;
@@ -770,8 +784,10 @@ static void wrap_offset(SpaceText *st, TextLine *linein, int cursin, int *offl,
        }
 }
 
-static int get_char_pos(SpaceText *st, char *line, int cur) {
+static int get_char_pos(SpaceText *st, char *line, int cur)
+{
        int a=0, i;
+       
        for (i=0; i<cur && line[i]; i++) {
                if (line[i]=='\t')
                        a += st->tabnumber-a%st->tabnumber;
@@ -781,7 +797,8 @@ static int get_char_pos(SpaceText *st, char *line, int cur) {
        return a;
 }
 
-static void draw_markers(SpaceText *st) {
+static void draw_markers(SpaceText *st) 
+{
        Text *text= st->text;
        TextMarker *marker, *next;
        TextLine *top, *bottom, *line;
@@ -852,7 +869,8 @@ static void draw_markers(SpaceText *st) {
        }
 }
 
-static void draw_cursor(SpaceText *st) {
+static void draw_cursor(SpaceText *st) 
+{
        Text *text= st->text;
        int vcurl, vcurc, vsell, vselc, hidden=0;
        int offl, offc, x, y, w, i;
@@ -1154,10 +1172,10 @@ static void do_textscroll(SpaceText *st, int mode)
 
 static void do_selection(SpaceText *st, int selecting)
 {
-       short mval[2], old[2];
        int sell, selc;
        int linep2, charp2;
        int first= 1;
+       short mval[2], old[2];
 
        getmouseco_areawin(mval);
        old[0]= mval[0];
@@ -1191,7 +1209,8 @@ static void do_selection(SpaceText *st, int selecting)
 
                        scrarea_do_windraw(curarea);
                        screen_swapbuffers();
-               } else if (!st->wordwrap && (mval[0]<0 || mval[0]>curarea->winx)) {
+               } 
+               else if (!st->wordwrap && (mval[0]<0 || mval[0]>curarea->winx)) {
                        if (mval[0]>curarea->winx) st->left++;
                        else if (mval[0]<0 && st->left>0) st->left--;
                        
@@ -1201,7 +1220,8 @@ static void do_selection(SpaceText *st, int selecting)
                        screen_swapbuffers();
                        
                        PIL_sleep_ms(10);
-               } else if (first || old[0]!=mval[0] || old[1]!=mval[1]) {
+               } 
+               else if (first || old[0]!=mval[0] || old[1]!=mval[1]) {
                        set_cursor_to_pos(st, mval[0], mval[1], 1);
 
                        scrarea_do_windraw(curarea);
@@ -1210,7 +1230,8 @@ static void do_selection(SpaceText *st, int selecting)
                        old[0]= mval[0];
                        old[1]= mval[1];
                        first= 1;
-               } else {
+               } 
+               else {
                        BIF_wait_for_statechange();
                }
        }
@@ -1227,10 +1248,10 @@ static void do_selection(SpaceText *st, int selecting)
 static int do_suggest_select(SpaceText *st)
 {
        SuggItem *item, *first, *last, *sel;
-       short mval[2];
        TextLine *tmp;
        int l, x, y, w, h, i;
        int tgti, *top;
+       short mval[2];
        
        if (!st || !st->text) return 0;
        if (!texttool_text_is_active(st->text)) return 0;
@@ -1276,7 +1297,8 @@ static int do_suggest_select(SpaceText *st)
        return 1;
 }
 
-static void pop_suggest_list() {
+static void pop_suggest_list() 
+{
        SuggItem *item, *sel;
        int *top, i;
 
@@ -1452,8 +1474,10 @@ void draw_suggestion_list(SpaceText *st)
        }
 }
 
-static short check_blockhandler(SpaceText *st, short handler) {
+static short check_blockhandler(SpaceText *st, short handler) 
+{
        short a;
+       
        for(a=0; a<SPACE_MAXHANDLER; a+=2)
                if (st->blockhandler[a]==handler) return 1;
        return 0;
@@ -1488,10 +1512,11 @@ static void text_panel_find(short cntrl)        // TEXT_HANDLER_FIND
 }
 
 /* mode: 0 find only, 1 replace/find, 2 mark all occurrences */
-void find_and_replace(SpaceText *st, short mode) {
-       char *tmp;
+void find_and_replace(SpaceText *st, short mode) 
+{
        Text *start= NULL, *text= st->text;
        int flags, first= 1;
+       char *tmp;
 
        if (!check_blockhandler(st, TEXT_HANDLER_FIND)) {
                toggle_blockhandler(st->area, TEXT_HANDLER_FIND, UI_PNL_TO_MOUSE);
@@ -1549,7 +1574,8 @@ void find_and_replace(SpaceText *st, short mode) {
        } while (mode==2);
 }
 
-static void do_find_buttons(val) {
+static void do_find_buttons(val) 
+{
        Text *text;
        SpaceText *st;
        char *tmp;
@@ -1607,11 +1633,11 @@ void drawtextspace(ScrArea *sa, void *spacedata)
 {
        SpaceText *st= curarea->spacedata.first;
        Text *text;
-       int i, x, y;
        TextLine *tmp;
-       char linenr[12];
        float col[3];
+       int i, x, y;
        int linecount = 0;
+       char linenr[12];
 
        if (st==NULL || st->spacetype != SPACE_TEXT) return;
 
@@ -1776,8 +1802,8 @@ void txt_write_file(Text *text)
 {
        FILE *fp;
        TextLine *tmp;
-       int res;
        struct stat st;
+       int res;
        char file[FILE_MAXDIR+FILE_MAXFILE];
        
        /* Do we need to get a filename? */
@@ -1860,7 +1886,8 @@ void unlink_text(Text *text)
        }
 }
 
-int jumptoline_interactive(SpaceText *st) {
+int jumptoline_interactive(SpaceText *st) 
+{
        short nlines= txt_get_span(st->text->lines.first, st->text->lines.last)+1;
        short tmp= txt_get_span(st->text->lines.first, st->text->curl)+1;
 
@@ -1993,8 +2020,8 @@ static char *winNewLine(char *buffer)
        return(output);
 }
 
-void txt_paste_clipboard(Text *text) {
-
+void txt_paste_clipboard(Text *text) 
+{
        char * buff;
        char *temp_buff;
        
@@ -2011,10 +2038,12 @@ void txt_paste_clipboard(Text *text) {
 void get_selection_buffer(Text *text)
 {
        char *buff = getClipboard(1);
+       
        txt_insert_buf(text, buff);
 }
 
-void txt_copy_clipboard(Text *text) {
+void txt_copy_clipboard(Text *text) 
+{
        char *temp;
 
        txt_copy_selectbuffer(text);
@@ -2032,8 +2061,8 @@ void txt_copy_clipboard(Text *text) {
 
 void run_python_script(SpaceText *st)
 {
-       char *py_filename;
        Text *text=st->text;
+       char *py_filename;
 
        if (!BPY_txt_do_python_Text(text)) {
                int lineno = BPY_Err_getLinenumber();
@@ -2061,12 +2090,14 @@ void run_python_script(SpaceText *st)
 static void set_tabs(Text *text)
 {
        SpaceText *st = curarea->spacedata.first;
+       
        st->currtab_set = setcurr_tab(text);
 }
 
-static void wrap_move_bol(SpaceText *st, short sel) {
-       int offl, offc, lin;
+static void wrap_move_bol(SpaceText *st, short sel) 
+{
        Text *text= st->text;
+       int offl, offc, lin;
 
        lin= txt_get_span(text->lines.first, text->sell);
        wrap_offset(st, text->sell, text->selc, &offl, &offc);
@@ -2081,9 +2112,10 @@ static void wrap_move_bol(SpaceText *st, short sel) {
        }
 }
 
-static void wrap_move_eol(SpaceText *st, short sel) {
-       int offl, offc, lin, startl, c;
+static void wrap_move_eol(SpaceText *st, short sel)
+{
        Text *text= st->text;
+       int offl, offc, lin, startl, c;
 
        lin= txt_get_span(text->lines.first, text->sell);
        wrap_offset(st, text->sell, text->selc, &offl, &offc);
@@ -2104,9 +2136,10 @@ static void wrap_move_eol(SpaceText *st, short sel) {
        }
 }
 
-static void wrap_move_up(SpaceText *st, short sel) {
-       int offl, offl_1, offc, fromline, toline, c, target;
+static void wrap_move_up(SpaceText *st, short sel) 
+{
        Text *text= st->text;
+       int offl, offl_1, offc, fromline, toline, c, target;
 
        wrap_offset(st, text->sell, 0, &offl_1, &offc);
        wrap_offset(st, text->sell, text->selc, &offl, &offc);
@@ -2132,20 +2165,26 @@ static void wrap_move_up(SpaceText *st, short sel) {
        if (sel) {
                txt_undo_add_toop(text, UNDO_STO, fromline, text->selc, toline, c);
                if (toline<fromline) text->sell= text->sell->prev;
-               if (c>text->sell->len) c= text->sell->len;
-               text->selc= c;
-       } else {
+               if(text->sell) {
+                       if (c>text->sell->len) c= text->sell->len;
+                       text->selc= c;
+               }
+       } 
+       else if(text->curl) {
                txt_undo_add_toop(text, UNDO_CTO, fromline, text->curc, toline, c);
                if (toline<fromline) text->curl= text->curl->prev;
-               if (c>text->curl->len) c= text->curl->len;
-               text->curc= c;
-               txt_pop_sel(text);
+               if(text->curl) {
+                       if (c>text->curl->len) c= text->curl->len;
+                       text->curc= c;
+                       txt_pop_sel(text);
+               }
        }
 }
 
-static void wrap_move_down(SpaceText *st, short sel) {
-       int offl, startoff, offc, fromline, toline, c, target;
+static void wrap_move_down(SpaceText *st, short sel) 
+{
        Text *text= st->text;
+       int offl, startoff, offc, fromline, toline, c, target;
 
        wrap_offset(st, text->sell, text->selc, &offl, &offc);
        fromline= toline= txt_get_span(text->lines.first, text->sell);
@@ -2173,18 +2212,24 @@ static void wrap_move_down(SpaceText *st, short sel) {
        if (sel) {
                txt_undo_add_toop(text, UNDO_STO, fromline, text->selc, toline, c);
                if (toline>fromline) text->sell= text->sell->next;
-               if (c>text->sell->len) c= text->sell->len;
-               text->selc= c;
-       } else {
+               if(text->sell) {
+                       if (c>text->sell->len) c= text->sell->len;
+                       text->selc= c;
+               }
+       } 
+       else if(text->curl) {
                txt_undo_add_toop(text, UNDO_CTO, fromline, text->curc, toline, c);
                if (toline>fromline) text->curl= text->curl->next;
-               if (c>text->curl->len) c= text->curl->len;
-               text->curc= c;
-               txt_pop_sel(text);
+               if(text->curl) {
+                       if (c > text->curl->len) c= text->curl->len;
+                       text->curc= c;
+                       txt_pop_sel(text);
+               }
        }
 }
 
-static void get_suggest_prefix(Text *text, int offset) {
+static void get_suggest_prefix(Text *text, int offset) 
+{
        int i, len;
        char *line, tmp[256];
 
@@ -2206,10 +2251,11 @@ static void get_suggest_prefix(Text *text, int offset) {
        texttool_suggest_prefix(tmp);
 }
 
-static void confirm_suggestion(Text *text, int skipleft) {
+static void confirm_suggestion(Text *text, int skipleft) 
+{
+       SuggItem *sel;
        int i, over=0;
        char *line;
-       SuggItem *sel;
 
        if (!text) return;
        if (!texttool_text_is_active(text)) return;
@@ -2239,7 +2285,8 @@ static void confirm_suggestion(Text *text, int skipleft) {
        texttool_text_clear();
 }
 
-static short do_texttools(SpaceText *st, char ascii, unsigned short evnt, short val) {
+static short do_texttools(SpaceText *st, char ascii, unsigned short evnt, short val) 
+{
        int draw=0, tools=0, swallow=0, scroll=1;
        if (!texttool_text_is_active(st->text)) return 0;
        if (!st->text || st->text->id.lib) return 0;
@@ -2398,7 +2445,8 @@ static short do_texttools(SpaceText *st, char ascii, unsigned short evnt, short
        return swallow;
 }
 
-static short do_markers(SpaceText *st, char ascii, unsigned short evnt, short val) {
+static short do_markers(SpaceText *st, char ascii, unsigned short evnt, short val) 
+{
        Text *text;
        TextMarker *marker, *mrk, *nxt;
        int c, s, draw=0, swallow=0;
@@ -2565,12 +2613,12 @@ static short do_markers(SpaceText *st, char ascii, unsigned short evnt, short va
 
 void winqreadtextspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
 {
-       unsigned short event= evt->event;
-       short val= evt->val;
-       char ascii= evt->ascii;
        SpaceText *st= curarea->spacedata.first;
        Text *text;
        int do_draw=0, p;
+       unsigned short event= evt->event;
+       short val= evt->val;
+       char ascii= evt->ascii;
        
        if (st==NULL || st->spacetype != SPACE_TEXT) return;
        
@@ -3177,11 +3225,11 @@ void winqreadtextspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
 
 static void draw_brackets(SpaceText *st)
 {
-       char ch;
-       int b, c, startc, endc, find, stack;
-       int viewc, viewl, offl, offc, x, y;
        TextLine *startl, *endl, *linep;
        Text *text = st->text;
+       int b, c, startc, endc, find, stack;
+       int viewc, viewl, offl, offc, x, y;
+       char ch;
 
        if (!text || !text->curl) return;
 
@@ -3300,13 +3348,15 @@ static int check_delim(char ch)
        return 0;
 }
 
-static int check_digit(char ch) {
+static int check_digit(char ch) 
+{
        if (ch < '0') return 0;
        if (ch <= '9') return 1;
        return 0;
 }
 
-static int check_identifier(char ch) {
+static int check_identifier(char ch) 
+{
        if (ch < '0') return 0;
        if (ch <= '9') return 1;
        if (ch < 'A') return 0;
@@ -3316,7 +3366,8 @@ static int check_identifier(char ch) {
        return 0;
 }
 
-static int check_whitespace(char ch) {
+static int check_whitespace(char ch) 
+{
        if (ch == ' ' || ch == '\t' || ch == '\r' || ch == '\n')
                return 1;
        return 0;
@@ -3326,9 +3377,9 @@ void convert_tabs (struct SpaceText *st, int tab)
 {
        Text *text = st->text;
        TextLine *tmp;
+       size_t a, j;
        char *check_line, *new_line;
        int extra, number; //unknown for now
-       size_t a, j;
        
        if (!text) return;
        
index 1f2d501f09ff85b9f86573e68e2f2f13fcb25b93..a169848aa627fff60f1caf45800fde771ca7fda7 100644 (file)
@@ -3131,13 +3131,9 @@ void drawview3dspace(ScrArea *sa, void *spacedata)
        }
        
        if(v3d->drawtype > OB_WIRE) {
-               if(G.f & G_SIMULATION)
-                       glClearColor(0.0, 0.0, 0.0, 0.0); 
-               else {
-                       float col[3];
-                       BIF_GetThemeColor3fv(TH_BACK, col);
-                       glClearColor(col[0], col[1], col[2], 0.0); 
-               }
+               float col[3];
+               BIF_GetThemeColor3fv(TH_BACK, col);
+               glClearColor(col[0], col[1], col[2], 0.0); 
                glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
                
                glLoadIdentity();
@@ -3427,8 +3423,9 @@ void drawview3d_render(struct View3D *v3d, float viewmat[][4], int winx, int win
        }
        glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
 
-       /* abuse! to make sure it doesnt draw the helpstuff */
-       G.f |= G_SIMULATION;
+       G.f |= G_RENDER_OGL;
+       if(shadow)
+               G.f |= G_RENDER_SHADOW;
 
        /* first draw set */
        if(G.scene->set) {
@@ -3497,14 +3494,14 @@ void drawview3d_render(struct View3D *v3d, float viewmat[][4], int winx, int win
                glDisable(GL_DEPTH_TEST);
        }
        
-       if(v3d->gpd) {
-               /* draw grease-pencil overlays 
+       if((v3d->gpd) && (v3d->flag2 & V3D_DISPGP)) {
+               /* draw grease-pencil overlays (only if enabled)
                 * WARNING: view matrices are altered here!
                 */
                draw_gpencil_oglrender(v3d, winx, winy);
        }
        
-       G.f &= ~G_SIMULATION;
+       G.f &= ~(G_RENDER_OGL|G_RENDER_SHADOW);
 
        if(!shadow) {
                glFlush();
index 87bb6f9e94ebbbdeb67a206410ed07d4535a6d9e..a80e7b6c3602a34aa38410d744ca35b10a267164 100644 (file)
@@ -138,8 +138,6 @@ extern void uvedit_selectionCB(short selecting, Object *editobj,
 
 static void circle_selectCB(select_CBfunc func);
 
-/* local protos ---------------*/
-static void snap_curs_to_firstsel(void);
 
 /* flag==2 only border, flag==3 cross+border
    flag==5 cross + border + start&end frame
@@ -1548,72 +1546,6 @@ void snap_curs_to_active()
        allqueue(REDRAWVIEW3D, 0);
 }
 
-static void snap_curs_to_firstsel()
-{
-       TransVert *tv;
-       Base *base;
-       float *curs, bmat[3][3], vec[3], min[3], max[3], centroid[3];
-       int count;
-
-       curs= give_cursor();
-
-       count= 0;
-       INIT_MINMAX(min, max);
-       centroid[0]= centroid[1]= centroid[2]= 0.0;
-
-       if(G.obedit) {
-               tottrans=0;
-               
-               if ELEM6(G.obedit->type, OB_ARMATURE, OB_LATTICE, OB_MESH, OB_SURF, OB_CURVE, OB_MBALL) 
-                       make_trans_verts(bmat[0], bmat[1], 0);
-               if(tottrans==0) return;
-               
-               Mat3CpyMat4(bmat, G.obedit->obmat);
-               
-               tv= transvmain;
-               VECCOPY(vec, tv->loc);
-                       /*Mat3MulVecfl(bmat, vec);
-                       VecAddf(vec, vec, G.obedit->obmat[3]);
-                       VecAddf(centroid, centroid, vec);
-                       DO_MINMAX(vec, min, max);*/
-               
-               if(G.vd->around==V3D_CENTROID) {
-                       VecMulf(vec, 1.0/(float)tottrans);
-                       VECCOPY(curs, vec);
-               }
-               else {
-                       curs[0]= vec[0];
-                       curs[1]= vec[1];
-                       curs[2]= vec[2];
-               }
-               MEM_freeN(transvmain);
-               transvmain= 0;
-       }
-       else {
-               base= (G.scene->base.first);
-               while(base) {
-                       if(((base)->flag & SELECT) && ((base)->lay & G.vd->lay) ) {
-                               VECCOPY(vec, base->object->obmat[3]);
-                               VecAddf(centroid, centroid, vec);
-                               DO_MINMAX(vec, min, max);
-                               count++;
-                       }
-                       base= base->next;
-               }
-               if(count) {
-                       if(G.vd->around==V3D_CENTROID) {
-                               VecMulf(centroid, 1.0/(float)count);
-                               VECCOPY(curs, centroid);
-                       }
-                       else {
-                               curs[0]= (min[0]+max[0])/2;
-                               curs[1]= (min[1]+max[1])/2;
-                               curs[2]= (min[2]+max[2])/2;
-                       }
-               }
-       }
-       allqueue(REDRAWVIEW3D, 0);
-}
 
 void snap_to_center()
 {
index 14269080b1f69b441d3caa378bf59bd083254f89..1f30b83c6b3472c6871f8ea8e9a01e6df0153857 100644 (file)
@@ -362,23 +362,224 @@ void duplicate_gplayer_frames (bGPDlayer *gpl)
                /* duplicate this frame */
                if (gpf->flag & GP_FRAME_SELECT) {
                        bGPDframe *gpfd; 
-                       bGPDstroke *gps;
                        
                        /* duplicate frame, and deselect self */
-                       gpfd= MEM_dupallocN(gpf);
+                       gpfd= gpencil_frame_duplicate(gpf);
                        gpf->flag &= ~GP_FRAME_SELECT;
                        
-                       /* duplicate list of strokes too */
-                       duplicatelist(&gpfd->strokes, &gpf->strokes);
+                       BLI_insertlinkafter(&gpl->frames, gpf, gpfd);
+               }
+       }
+}
+
+/* -------------------------------------- */
+/* Copy and Paste Tools */
+/* - The copy/paste buffer currently stores a set of GP_Layers, with temporary
+ *     GP_Frames with the necessary strokes
+ * - Unless there is only one element in the buffer, names are also tested to check for compatability.
+ * - All pasted frames are offset by the same amount. This is calculated as the difference in the times of
+ *     the current frame and the 'first keyframe' (i.e. the earliest one in all channels).
+ * - The earliest frame is calculated per copy operation.
+ */
+/* globals for copy/paste data (like for other copy/paste buffers) */
+ListBase gpcopybuf = {NULL, NULL};
+static float gpcopy_firstframe= 999999999.0f;
+
+/* This function frees any MEM_calloc'ed copy/paste buffer data */
+void free_gpcopybuf ()
+{
+       free_gpencil_layers(&gpcopybuf); 
+       
+       gpcopybuf.first= gpcopybuf.last= NULL;
+       gpcopy_firstframe= 999999999.0f;
+}
+
+/* This function adds data to the copy/paste buffer, freeing existing data first
+ * Only the selected action channels gets their selected keyframes copied.
+ */
+void copy_gpdata ()
+{
+       ListBase act_data = {NULL, NULL};
+       bActListElem *ale;
+       int filter;
+       void *data;
+       short datatype;
+       
+       /* clear buffer first */
+       free_gpcopybuf();
+       
+       /* get data */
+       data= get_action_context(&datatype);
+       if (data == NULL) return;
+       if (datatype != ACTCONT_GPENCIL) return;
+       
+       /* filter data */
+       filter= (ACTFILTER_VISIBLE | ACTFILTER_SEL);
+       actdata_filter(&act_data, filter, data, datatype);
+       
+       /* assume that each of these is an ipo-block */
+       for (ale= act_data.first; ale; ale= ale->next) {
+               bGPDlayer *gpls, *gpln;
+               bGPDframe *gpf, *gpfn;
+               
+               /* get new layer to put into buffer */
+               gpls= (bGPDlayer *)ale->data;
+               gpln= MEM_callocN(sizeof(bGPDlayer), "GPCopyPasteLayer");
+               
+               gpln->frames.first= gpln->frames.last= NULL;
+               strcpy(gpln->info, gpls->info);
+               
+               BLI_addtail(&gpcopybuf, gpln);
+               
+               /* loop over frames, and copy only selected frames */
+               for (gpf= gpls->frames.first; gpf; gpf= gpf->next) {
+                       /* if frame is selected, make duplicate it and its strokes */
+                       if (gpf->flag & GP_FRAME_SELECT) {
+                               /* add frame to buffer */
+                               gpfn= gpencil_frame_duplicate(gpf);
+                               BLI_addtail(&gpln->frames, gpfn);
+                               
+                               /* check if this is the earliest frame encountered so far */
+                               if (gpf->framenum < gpcopy_firstframe)
+                                       gpcopy_firstframe= gpf->framenum;
+                       }
+               }
+       }
+       
+       /* check if anything ended up in the buffer */
+       if (ELEM(NULL, gpcopybuf.first, gpcopybuf.last))
+               error("Nothing copied to buffer");
+       
+       /* free temp memory */
+       BLI_freelistN(&act_data);
+}
+
+void paste_gpdata ()
+{
+       ListBase act_data = {NULL, NULL};
+       bActListElem *ale;
+       int filter;
+       void *data;
+       short datatype;
+       
+       short no_name= 0;
+       float offset = CFRA - gpcopy_firstframe;
+       
+       /* check if buffer is empty */
+       if (ELEM(NULL, gpcopybuf.first, gpcopybuf.last)) {
+               error("No data in buffer to paste");
+               return;
+       }
+       /* check if single channel in buffer (disregard names if so)  */
+       if (gpcopybuf.first == gpcopybuf.last)
+               no_name= 1;
+       
+       /* get data */
+       data= get_action_context(&datatype);
+       if (data == NULL) return;
+       if (datatype != ACTCONT_GPENCIL) return;
+       
+       /* filter data */
+       filter= (ACTFILTER_VISIBLE | ACTFILTER_SEL | ACTFILTER_FOREDIT);
+       actdata_filter(&act_data, filter, data, datatype);
+       
+       /* from selected channels */
+       for (ale= act_data.first; ale; ale= ale->next) {
+               bGPDlayer *gpld= (bGPDlayer *)ale->data;
+               bGPDlayer *gpls= NULL;
+               bGPDframe *gpfs, *gpf;
+               
+               /* find suitable layer from buffer to use to paste from */
+               for (gpls= gpcopybuf.first; gpls; gpls= gpls->next) {
+                       /* check if layer name matches */
+                       if ((no_name) || (strcmp(gpls->info, gpld->info)==0))
+                               break;
+               }
+               
+               /* this situation might occur! */
+               if (gpls == NULL)
+                       continue;
+               
+               /* add frames from buffer */
+               for (gpfs= gpls->frames.first; gpfs; gpfs= gpfs->next) {
+                       /* temporarily apply offset to buffer-frame while copying */
+                       gpfs->framenum += offset;
                        
-                       /* dupalloc only makes another copy of mem, but doesn't adjust pointers */
-                       for (gps= gpfd->strokes.first; gps; gps= gps->next) {
-                               gps->points= MEM_dupallocN(gps->points);
+                       /* get frame to copy data into (if no frame returned, then just ignore) */
+                       gpf= gpencil_layer_getframe(gpld, gpfs->framenum, 1);
+                       if (gpf) {
+                               bGPDstroke *gps, *gpsn;
+                               ScrArea *sa;
+                               
+                               /* get area that gp-data comes from */
+                               sa= gpencil_data_findowner((bGPdata *)ale->owner);                              
+                               
+                               /* this should be the right frame... as it may be a pre-existing frame, 
+                                * must make sure that only compatible stroke types get copied over 
+                                *      - we cannot just add a duplicate frame, as that would cause errors
+                                *      - need to check for compatible types to minimise memory usage (copying 'junk' over)
+                                */
+                               for (gps= gpfs->strokes.first; gps; gps= gps->next) {
+                                       short stroke_ok;
+                                       
+                                       /* if there's an area, check that it supports this type of stroke */
+                                       if (sa) {
+                                               stroke_ok= 0;
+                                               
+                                               /* check if spacetype supports this type of stroke
+                                                *      - NOTE: must sync this with gp_paint_initstroke() in gpencil.c
+                                                */
+                                               switch (sa->spacetype) {
+                                                       case SPACE_VIEW3D: /* 3D-View: either screen-aligned or 3d-space */
+                                                               if ((gps->flag == 0) || (gps->flag & GP_STROKE_3DSPACE))
+                                                                       stroke_ok= 1;
+                                                               break;
+                                                               
+                                                       case SPACE_NODE: /* Nodes Editor: either screen-aligned or view-aligned */
+                                                       case SPACE_IMAGE: /* Image Editor: either screen-aligned or view\image-aligned */
+                                                               if ((gps->flag == 0) || (gps->flag & GP_STROKE_2DSPACE))
+                                                                       stroke_ok= 1;
+                                                               break;
+                                                               
+                                                       case SPACE_SEQ: /* Sequence Editor: either screen-aligned or view-aligned */
+                                                               if ((gps->flag == 0) || (gps->flag & GP_STROKE_2DIMAGE))
+                                                                       stroke_ok= 1;
+                                                               break;
+                                               }
+                                       }
+                                       else
+                                               stroke_ok= 1;
+                                       
+                                       /* if stroke is ok, we make a copy of this stroke and add to frame */
+                                       if (stroke_ok) {
+                                               /* make a copy of stroke, then of its points array */
+                                               gpsn= MEM_dupallocN(gps);
+                                               gpsn->points= MEM_dupallocN(gps->points);
+                                               
+                                               /* append stroke to frame */
+                                               BLI_addtail(&gpf->strokes, gpsn);
+                                       }
+                               }
+                               
+                               /* if no strokes (i.e. new frame) added, free gpf */
+                               if (gpf->strokes.first == NULL)
+                                       gpencil_layer_delframe(gpld, gpf);
                        }
                        
-                       BLI_insertlinkafter(&gpl->frames, gpf, gpfd);
+                       /* unapply offset from buffer-frame */
+                       gpfs->framenum -= offset;
                }
        }
+       
+       /* free temp memory */
+       BLI_freelistN(&act_data);
+       
+       /* undo and redraw stuff */
+       allqueue(REDRAWVIEW3D, 0);
+       //allqueue(REDRAWNODES, 0);
+       allqueue(REDRAWACTION, 0);
+       BIF_undo_push("Paste Grease Pencil Frames");
 }
 
 /* -------------------------------------- */
index 25e7c50b07e3e1acf74c5d5ecdfb7a7c60975db2..e96c3f6d40f285f2e7db8bdd576b6a62d2fde70a 100644 (file)
@@ -892,7 +892,7 @@ void make_editMesh()
                return;
        }
 #endif
-
+       
        /* because of reload */
        free_editMesh(em);
        
@@ -914,8 +914,11 @@ void make_editMesh()
                strcpy(G.editModeTitleExtra, "(Key) ");
                key_to_mesh(actkey, me);
                tot= actkey->totelem;
+               /* undo-ing in past for previous editmode sessions gives corrupt 'keyindex' values */
+               undo_editmode_clear();
        }
 
+       
        /* make editverts */
        CustomData_copy(&me->vdata, &em->vdata, CD_MASK_EDITMESH, CD_CALLOC, 0);
        mvert= me->mvert;
index 250332c4afa80ee120e2de8776d8fc23b191c97d..4a70e89dd075db4fb2924e8060608930aff631d1 100644 (file)
@@ -5404,10 +5404,51 @@ void adduplicate(int mode, int dupflag)
        }
 }
 
-void make_duplilist_real()
+void make_object_duplilist_real(Base *base)
 {
-       Base *base, *basen;
+       Base *basen;
        Object *ob;
+       ListBase *lb;
+       DupliObject *dob;
+
+       if(!base && !(base = BASACT))
+               return;
+
+       if(!(base->object->transflag & OB_DUPLI))
+               return;
+
+       lb= object_duplilist(G.scene, base->object);
+       
+       for(dob= lb->first; dob; dob= dob->next) {
+               ob= copy_object(dob->ob);
+               /* font duplis can have a totcol without material, we get them from parent
+               * should be implemented better...
+               */
+               if(ob->mat==NULL) ob->totcol= 0;
+               
+               basen= MEM_dupallocN(base);
+               basen->flag &= ~OB_FROMDUPLI;
+               BLI_addhead(&G.scene->base, basen);     /* addhead: othwise eternal loop */
+               basen->object= ob;
+               ob->ipo= NULL;          /* make sure apply works */
+               ob->parent= ob->track= NULL;
+               ob->disp.first= ob->disp.last= NULL;
+               ob->transflag &= ~OB_DUPLI;     
+               
+               Mat4CpyMat4(ob->obmat, dob->mat);
+               apply_obmat(ob);
+       }
+       
+       copy_object_set_idnew(0);
+       
+       free_object_duplilist(lb);
+       
+       base->object->transflag &= ~OB_DUPLI;   
+}
+
+void make_duplilist_real()
+{
+       Base *base;
        /*      extern ListBase duplilist; */
        
        if(okee("Make dupli objects real")==0) return;
@@ -5417,37 +5458,7 @@ void make_duplilist_real()
        base= FIRSTBASE;
        while(base) {
                if TESTBASE(base) {
-                       
-                       if(base->object->transflag & OB_DUPLI) {
-                               ListBase *lb= object_duplilist(G.scene, base->object);
-                               DupliObject *dob;
-                               
-                               for(dob= lb->first; dob; dob= dob->next) {
-                                       ob= copy_object(dob->ob);
-                                       /* font duplis can have a totcol without material, we get them from parent
-                                       * should be implemented better...
-                                       */
-                                       if(ob->mat==NULL) ob->totcol= 0;
-                                       
-                                       basen= MEM_dupallocN(base);
-                                       basen->flag &= ~OB_FROMDUPLI;
-                                       BLI_addhead(&G.scene->base, basen);     /* addhead: othwise eternal loop */
-                                       basen->object= ob;
-                                       ob->ipo= NULL;          /* make sure apply works */
-                                       ob->parent= ob->track= NULL;
-                                       ob->disp.first= ob->disp.last= NULL;
-                                       ob->transflag &= ~OB_DUPLI;     
-                                       
-                                       Mat4CpyMat4(ob->obmat, dob->mat);
-                                       apply_obmat(ob);
-                               }
-                               
-                               copy_object_set_idnew(0);
-                               
-                               free_object_duplilist(lb);
-                               
-                               base->object->transflag &= ~OB_DUPLI;   
-                       }
+                       make_object_duplilist_real(base);
                }
                base= base->next;
        }
index c6ecc8d58650fffeb81e696ac22d8a9311a75ea0..95b3a3d30214046e0428040bf2c64fc3f19527fe 100644 (file)
@@ -95,7 +95,7 @@ static SND_SceneHandle ghSoundScene=NULL;
 static SND_AudioDeviceInterfaceHandle ghAudioDeviceInterface=NULL;
 
 /* que? why only here? because of the type define? */
-static bSound *sound_find_sound(char *id_name);
+//static bSound *sound_find_sound(char *id_name);
 static void sound_read_wav_data(bSound * sound, PackedFile * pf);
 void winqreadsoundspace(struct ScrArea *sa, void *spacedata, struct BWinEvent *evt);
 /*  void sound_stop_all_sounds(void); already in BIF_editsound.h */
@@ -1022,7 +1022,7 @@ void sound_play_sound(bSound *sound)
 }
 
 
-
+#if 0
 static bSound *sound_find_sound(char *id_name)
 {
        bSound *sound;
@@ -1039,6 +1039,7 @@ static bSound *sound_find_sound(char *id_name)
        
        return sound;
 }
+#endif
 
 void sound_init_audio(void)
 {
index b9488d20200259f7dc0ea855a810b8c98a657cb9..f6703fbe66b0c948b5418aa0800fea2498a31bc2 100644 (file)
@@ -63,6 +63,7 @@
 #include "BKE_armature.h"
 #include "BKE_curve.h"
 #include "BKE_image.h"
+#include "BKE_library.h"
 
 #include "BIF_gl.h"
 #include "BIF_glutil.h"
@@ -111,7 +112,7 @@ void free_gpencil_strokes (bGPDframe *gpf)
                gpsn= gps->next;
                
                /* free stroke memory arrays, then stroke itself */
-               MEM_freeN(gps->points);
+               if (gps->points) MEM_freeN(gps->points);
                BLI_freelinkN(&gpf->strokes, gps);
        }
 }
@@ -134,7 +135,7 @@ void free_gpencil_frames (bGPDlayer *gpl)
        }
 }
 
-/* Free all of the gp-layers for a viewport (list should be &G.vd->gpd or so) */
+/* Free all of the gp-layers for a viewport (list should be &gpd->layers or so) */
 void free_gpencil_layers (ListBase *list) 
 {
        bGPDlayer *gpl, *gpln;
@@ -254,13 +255,63 @@ bGPdata *gpencil_data_addnew (void)
 
 /* -------- Data Duplication ---------- */
 
+/* make a copy of a given gpencil frame */
+bGPDframe *gpencil_frame_duplicate (bGPDframe *src)
+{
+       bGPDstroke *gps, *gpsd;
+       bGPDframe *dst;
+       
+       /* error checking */
+       if (src == NULL)
+               return NULL;
+               
+       /* make a copy of the source frame */
+       dst= MEM_dupallocN(src);
+       
+       /* copy strokes */
+       dst->strokes.first = dst->strokes.last= NULL;
+       for (gps= src->strokes.first; gps; gps= gps->next) {
+               /* make copy of source stroke, then adjust pointer to points too */
+               gpsd= MEM_dupallocN(gps);
+               gpsd->points= MEM_dupallocN(gps->points);
+               
+               BLI_addtail(&dst->strokes, gpsd);
+       }
+       
+       /* return new frame */
+       return dst;
+}
+
+/* make a copy of a given gpencil layer */
+bGPDlayer *gpencil_layer_duplicate (bGPDlayer *src)
+{
+       bGPDframe *gpf, *gpfd;
+       bGPDlayer *dst;
+       
+       /* error checking */
+       if (src == NULL)
+               return NULL;
+               
+       /* make a copy of source layer */
+       dst= MEM_dupallocN(src);
+       
+       /* copy frames */
+       dst->frames.first= dst->frames.last= NULL;
+       for (gpf= src->frames.first; gpf; gpf= gpf->next) {
+               /* make a copy of source stroke */
+               gpfd= gpencil_frame_duplicate(gpf);
+               BLI_addtail(&dst->frames, gpfd);
+       }
+       
+       /* return new layer */
+       return dst;
+}
+
 /* make a copy of a given gpencil datablock */
 bGPdata *gpencil_data_duplicate (bGPdata *src)
 {
+       bGPDlayer *gpl, *gpld;
        bGPdata *dst;
-       bGPDlayer *gpld, *gpls;
-       bGPDframe *gpfd, *gpfs;
-       bGPDstroke *gps;
        
        /* error checking */
        if (src == NULL)
@@ -270,25 +321,11 @@ bGPdata *gpencil_data_duplicate (bGPdata *src)
        dst= MEM_dupallocN(src);
        
        /* copy layers */
-       duplicatelist(&dst->layers, &src->layers);
-       
-       for (gpld=dst->layers.first, gpls=src->layers.first; gpld && gpls; 
-                gpld=gpld->next, gpls=gpls->next) 
-       {
-               /* copy frames */
-               duplicatelist(&gpld->frames, &gpls->frames);
-               
-               for (gpfd=gpld->frames.first, gpfs=gpls->frames.first; gpfd && gpfs;
-                        gpfd=gpfd->next, gpfs=gpfs->next) 
-               {
-                       /* copy strokes */
-                       duplicatelist(&gpfd->strokes, &gpfs->strokes);
-                       
-                       for (gps= gpfd->strokes.first; gps; gps= gps->next) 
-                       {
-                               gps->points= MEM_dupallocN(gps->points);
-                       }
-               }
+       dst->layers.first= dst->layers.last= NULL;
+       for (gpl= src->layers.first; gpl; gpl= gpl->next) {
+               /* make a copy of source layer and its data */
+               gpld= gpencil_layer_duplicate(gpl);
+               BLI_addtail(&dst->layers, gpld);
        }
        
        /* return new */
@@ -414,6 +451,30 @@ short gpencil_data_setactive (ScrArea *sa, bGPdata *gpd)
        return 0;
 }
 
+/* return the ScrArea that has the given GP-datablock
+ *     - assumes that only searching in current screen
+ *     - is based on GP-datablocks only being able to 
+ *       exist for one area at a time (i.e. not multiuser)
+ */
+ScrArea *gpencil_data_findowner (bGPdata *gpd)
+{
+       ScrArea *sa;
+       
+       /* error checking */
+       if (gpd == NULL)
+               return NULL;
+               
+       /* loop over all scrareas for current screen, and check if that area has this gpd */
+       for (sa= G.curscreen->areabase.first; sa; sa= sa->next) {
+               /* use get-active func to see if match */
+               if (gpencil_data_getactive(sa) == gpd)
+                       return sa;
+       }
+       
+       /* not found */
+       return NULL;
+}
+
 /* -------- GP-Frame API ---------- */
 
 /* delete the last stroke of the given frame */
@@ -538,6 +599,7 @@ bGPDframe *gpencil_layer_getframe (bGPDlayer *gpl, int cframe, short addnew)
                else {
                        /* unresolved errogenous situation! */
                        printf("Error: cannot find appropriate gp-frame \n");
+                       /* gpl->actframe should still be NULL */
                }
        }
        else {
@@ -546,6 +608,7 @@ bGPDframe *gpencil_layer_getframe (bGPDlayer *gpl, int cframe, short addnew)
                        gpl->actframe= gpencil_frame_addnew(gpl, cframe);
                else {
                        /* don't do anything... this may be when no frames yet! */
+                       /* gpl->actframe should still be NULL */
                }
        }
        
@@ -791,7 +854,7 @@ static void gp_stroke_to_bezier (bGPDlayer *gpl, bGPDstroke *gps, Curve *cu)
                /* set settings */
                bezt->h1= bezt->h2= HD_FREE;
                bezt->f1= bezt->f2= bezt->f3= SELECT;
-               bezt->radius = bezt->weight = pt->pressure * gpl->thickness;
+               bezt->radius = bezt->weight = pt->pressure * gpl->thickness * 0.1;
        }
        
        /* must calculate handles or else we crash */
@@ -816,17 +879,20 @@ static void gp_layer_to_curve (bGPdata *gpd, bGPDlayer *gpl, short mode)
        /* only convert if there are any strokes on this layer's frame to convert */
        if (gpf->strokes.first == NULL)
                return;
-               
-       /* initialise the curve */      
-       cu= add_curve(gpl->info, 1);
-       cu->flag |= CU_3D;
        
-       /* init the curve object (remove rotation and assign curve data to it) */
+       /* init the curve object (remove rotation and get curve data from it)
+        *      - must clear transforms set on object, as those skew our results
+        */
        add_object_draw(OB_CURVE);
        ob= OBACT;
        ob->loc[0]= ob->loc[1]= ob->loc[2]= 0;
        ob->rot[0]= ob->rot[1]= ob->rot[2]= 0;
-       ob->data= cu;
+       cu= ob->data;
+       cu->flag |= CU_3D;
+       
+       /* rename object and curve to layer name */
+       rename_id((ID *)ob, gpl->info);
+       rename_id((ID *)cu, gpl->info);
        
        /* add points to curve */
        for (gps= gpf->strokes.first; gps; gps= gps->next) {
@@ -865,25 +931,26 @@ static void gp_stroke_to_bonechain (bGPDlayer *gpl, bGPDstroke *gps, bArmature *
                VecCopyf(ebo->tail, p3db);
                
                /* add new bone - note: sync with editarmature.c::add_editbone() */
-               BLI_strncpy(ebo->name, "Stroke", 32);
-               unique_editbone_name(bones, ebo->name);
-               
-               BLI_addtail(bones, ebo);
-               
-               ebo->flag |= BONE_CONNECTED;
-               ebo->weight= 1.0F;
-               ebo->dist= 0.25F;
-               ebo->xwidth= 0.1;
-               ebo->zwidth= 0.1;
-               ebo->ease1= 1.0;
-               ebo->ease2= 1.0;
-               ebo->rad_head= pt->pressure * gpl->thickness * 0.1;
-               ebo->rad_tail= ptn->pressure * gpl->thickness * 0.1;
-               ebo->segments= 1;
-               ebo->layer= arm->layer;
+               {
+                       BLI_strncpy(ebo->name, "Stroke", 32);
+                       unique_editbone_name(bones, ebo->name);
+                       
+                       BLI_addtail(bones, ebo);
+                       
+                       ebo->flag |= BONE_CONNECTED;
+                       ebo->weight= 1.0F;
+                       ebo->dist= 0.25F;
+                       ebo->xwidth= 0.1;
+                       ebo->zwidth= 0.1;
+                       ebo->ease1= 1.0;
+                       ebo->ease2= 1.0;
+                       ebo->rad_head= pt->pressure * gpl->thickness * 0.1;
+                       ebo->rad_tail= ptn->pressure * gpl->thickness * 0.1;
+                       ebo->segments= 1;
+                       ebo->layer= arm->layer;
+               }
                
                /* set parenting */
-               // TODO: also adjust roll....
                ebo->parent= prev;
        }
 }
@@ -904,22 +971,43 @@ static void gp_layer_to_armature (bGPdata *gpd, bGPDlayer *gpl, short mode)
        /* only convert if there are any strokes on this layer's frame to convert */
        if (gpf->strokes.first == NULL)
                return;
-               
-       /* initialise the armature */   
-       arm= add_armature(gpl->info);
        
-       /* init the armature object (remove rotation and assign armature data to it) */
+       /* init the armature object (remove rotation and assign armature data to it) 
+        *      - must clear transforms set on object, as those skew our results
+        */
        add_object_draw(OB_ARMATURE);
        ob= OBACT;
        ob->loc[0]= ob->loc[1]= ob->loc[2]= 0;
        ob->rot[0]= ob->rot[1]= ob->rot[2]= 0;
-       ob->data= arm;
+       arm= ob->data;
+       
+       /* rename object and armature to layer name */
+       rename_id((ID *)ob, gpl->info);
+       rename_id((ID *)arm, gpl->info);
        
        /* convert segments to bones, strokes to bone chains */
        for (gps= gpf->strokes.first; gps; gps= gps->next) {
                gp_stroke_to_bonechain(gpl, gps, arm, &bones);
        }
        
+       /* adjust roll of bones
+        *      - set object as EditMode object, but need to clear afterwards!
+        *      - use 'align to world z-up' option
+        */
+       {
+               /* set our data as if we're in editmode to fool auto_align_armature() */
+               G.obedit= ob;
+               G.edbo.first = bones.first;
+               G.edbo.last = bones.last;
+               
+               /* WARNING: need to make sure this magic number doesn't change */
+               auto_align_armature(2); 
+               
+               /* clear editbones (not needed anymore) */
+               G.edbo.first= G.edbo.last= NULL;
+               G.obedit= NULL;
+       }
+       
        /* flush editbones to armature */
        editbones_to_armature(&bones, ob);
        if (bones.first) BLI_freelistN(&bones);
@@ -990,12 +1078,15 @@ void gpencil_convert_menu (void)
 /* maximum sizes of gp-session buffer */
 #define GP_STROKE_BUFFER_MAX   5000
 
-/* Hardcoded sensitivity thresholds... */
+/* Macros for accessing sensitivity thresholds... */
        /* minimum number of pixels mouse should move before new point created */
-#define MIN_MANHATTEN_PX       U.gp_manhattendist
+#define MIN_MANHATTEN_PX       (U.gp_manhattendist)
        /* minimum length of new segment before new point can be added */
-#define MIN_EUCLIDEAN_PX       U.gp_euclideandist
+#define MIN_EUCLIDEAN_PX       (U.gp_euclideandist)
 
+/* macro to test if only converting endpoints - only for use when converting!  */      
+#define GP_BUFFER2STROKE_ENDPOINTS ((gpd->flag & GP_DATA_EDITPAINT) && (G.qual & LR_CTRLKEY))
+       
 /* ------ */
 
 /* Temporary 'Stroke' Operation data */
@@ -1013,6 +1104,10 @@ typedef struct tGPsdata {
        
        short mval[2];          /* current mouse-position */
        short mvalo[2];         /* previous recorded mouse-position */
+       
+       short pressure;         /* current stylus pressure */
+       short opressure;        /* previous stylus pressure */
+       
        short radius;           /* radius of influence for eraser */
 } tGPsdata;
 
@@ -1180,6 +1275,34 @@ static short gp_stroke_addpoint (tGPsdata *p, short mval[2], float pressure)
                return GP_STROKEADD_NORMAL;
 }
 
+/* smooth a stroke (in buffer) before storing it */
+static void gp_stroke_smooth (tGPsdata *p)
+{
+       bGPdata *gpd= p->gpd;
+       int i=0, cmx=gpd->sbuffer_size;
+       
+       /* only smooth if smoothing is enabled, and we're not doing a straight line */
+       if ( !(U.gp_settings & GP_PAINT_DOSMOOTH) || GP_BUFFER2STROKE_ENDPOINTS)
+               return;
+       
+       /* don't try if less than 2 points in buffer */
+       if ((cmx <= 2) || (gpd->sbuffer == NULL))
+               return;
+       
+       /* apply weighting-average (note doing this along path sequentially does introduce slight error) */
+       for (i=0; i < gpd->sbuffer_size; i++) {
+               tGPspoint *pc= (((tGPspoint *)gpd->sbuffer) + i);
+               tGPspoint *pb= (i-1 > 0)?(pc-1):(pc);
+               tGPspoint *pa= (i-2 > 0)?(pc-2):(pb);
+               tGPspoint *pd= (i+1 < cmx)?(pc+1):(pc);
+               tGPspoint *pe= (i+2 < cmx)?(pc+2):(pd);
+               
+               pc->x= (short)(0.1*pa->x + 0.2*pb->x + 0.4*pc->x + 0.2*pd->x + 0.1*pe->x);
+               pc->y= (short)(0.1*pa->y + 0.2*pb->y + 0.4*pc->y + 0.2*pd->y + 0.1*pe->y);
+       }
+}
+
+
 /* make a new stroke from the buffer data */
 static void gp_stroke_newfrombuffer (tGPsdata *p)
 {
@@ -1188,9 +1311,6 @@ static void gp_stroke_newfrombuffer (tGPsdata *p)
        bGPDspoint *pt;
        tGPspoint *ptc;
        int i, totelem;
-
-       /* macro to test if only converting endpoints  */       
-       #define GP_BUFFER2STROKE_ENDPOINTS ((gpd->flag & GP_DATA_EDITPAINT) && (G.qual & LR_CTRLKEY))
        
        /* get total number of points to allocate space for:
         *      - in 'Draw Mode', holding the Ctrl-Modifier will only take endpoints
@@ -1261,9 +1381,6 @@ static void gp_stroke_newfrombuffer (tGPsdata *p)
        
        /* add stroke to frame */
        BLI_addtail(&p->gpf->strokes, gps);
-       
-       /* undefine macro to test if only converting endpoints  */      
-       #undef GP_BUFFER2STROKE_ENDPOINTS
 }
 
 /* --- 'Eraser' for 'Paint' Tool ------ */
@@ -1662,7 +1779,6 @@ static void gp_paint_initstroke (tGPsdata *p, short paintmode)
                                break;
                        case SPACE_SEQ:
                        {
-                               /* for now, this is not applicable here... */
                                p->gpd->sbuffer_sflag |= GP_STROKE_2DIMAGE;
                        }
                                break;
@@ -1682,6 +1798,9 @@ static void gp_paint_strokeend (tGPsdata *p)
 {
        /* check if doing eraser or not */
        if ((p->gpd->sbuffer_sflag & GP_STROKE_ERASER) == 0) {
+               /* smooth stroke before transferring? */
+               gp_stroke_smooth(p);
+               
                /* transfer stroke to frame */
                gp_stroke_newfrombuffer(p);
        }
@@ -1715,7 +1834,6 @@ static void gp_paint_cleanup (tGPsdata *p)
 short gpencil_paint (short mousebutton, short paintmode)
 {
        tGPsdata p;
-       float opressure, pressure;
        short ok = GP_STROKEADD_NORMAL;
        
        /* init paint-data */
@@ -1735,14 +1853,15 @@ short gpencil_paint (short mousebutton, short paintmode)
        
        /* init drawing-device settings */
        getmouseco_areawin(p.mval);
-       pressure = get_pressure();
+       p.pressure = get_pressure();
        
        p.mvalo[0]= p.mval[0];
        p.mvalo[1]= p.mval[1];
-       opressure= pressure;
+       p.opressure= p.pressure;
        
-       /* radius for eraser circle is thickness^2 */
-       p.radius= p.gpl->thickness * p.gpl->thickness;
+       /* radius for eraser circle is defined in userprefs now */
+       // TODO: make this more easily tweaked... 
+       p.radius= U.gp_eraser;
        
        /* start drawing eraser-circle (if applicable) */
        if (paintmode == GP_PAINTMODE_ERASER)
@@ -1754,8 +1873,8 @@ short gpencil_paint (short mousebutton, short paintmode)
         *      - not erasing
         */
        if (paintmode != GP_PAINTMODE_ERASER) {
-               if (!(pressure >= 0.99f) || (p.gpd->flag & GP_DATA_EDITPAINT)) { 
-                       gp_stroke_addpoint(&p, p.mval, pressure);
+               if (!(p.pressure >= 0.99f) || (p.gpd->flag & GP_DATA_EDITPAINT)) { 
+                       gp_stroke_addpoint(&p, p.mval, p.pressure);
                }
        }
        
@@ -1763,7 +1882,7 @@ short gpencil_paint (short mousebutton, short paintmode)
        do {
                /* get current user input */
                getmouseco_areawin(p.mval);
-               pressure = get_pressure();
+               p.pressure = get_pressure();
                
                /* only add current point to buffer if mouse moved (otherwise wait until it does) */
                if (paintmode == GP_PAINTMODE_ERASER) {
@@ -1775,10 +1894,11 @@ short gpencil_paint (short mousebutton, short paintmode)
                        
                        p.mvalo[0]= p.mval[0];
                        p.mvalo[1]= p.mval[1];
+                       p.opressure= p.pressure;
                }
                else if (gp_stroke_filtermval(&p, p.mval, p.mvalo)) {
                        /* try to add point */
-                       ok= gp_stroke_addpoint(&p, p.mval, pressure);
+                       ok= gp_stroke_addpoint(&p, p.mval, p.pressure);
                        
                        /* handle errors while adding point */
                        if ((ok == GP_STROKEADD_FULL) || (ok == GP_STROKEADD_OVERFLOW)) {
@@ -1786,8 +1906,8 @@ short gpencil_paint (short mousebutton, short paintmode)
                                gp_paint_strokeend(&p);
                                
                                /* start a new stroke, starting from previous point */
-                               gp_stroke_addpoint(&p, p.mvalo, opressure);
-                               ok= gp_stroke_addpoint(&p, p.mval, pressure);
+                               gp_stroke_addpoint(&p, p.mvalo, p.opressure);
+                               ok= gp_stroke_addpoint(&p, p.mval, p.pressure);
                        }
                        else if (ok == GP_STROKEADD_INVALID) {
                                /* the painting operation cannot continue... */
@@ -1802,7 +1922,7 @@ short gpencil_paint (short mousebutton, short paintmode)
                        
                        p.mvalo[0]= p.mval[0];
                        p.mvalo[1]= p.mval[1];
-                       opressure= pressure;
+                       p.opressure= p.pressure;
                }
                else
                        BIF_wait_for_statechange();
@@ -1820,7 +1940,7 @@ short gpencil_paint (short mousebutton, short paintmode)
        
        /* check size of buffer before cleanup, to determine if anything happened here */
        if (paintmode == GP_PAINTMODE_ERASER) {
-               ok= 1; // fixme
+               ok= 1; /* assume that we did something... */
                draw_sel_circle(NULL, p.mvalo, 0, p.radius, 0);
        }
        else
index 2834a41e9ecfe0d3ed0b84f577871197c95c4444..0cd5fcba27122416b273a13f32eb676df5511453 100644 (file)
@@ -285,10 +285,16 @@ void do_action_buttons(unsigned short event)
                        
                /* copy/paste buttons in Action Editor header */
                case B_ACTCOPYKEYS:
-                       copy_actdata();
+                       if (G.saction->mode == SACTCONT_GPENCIL)
+                               copy_gpdata();
+                       else
+                               copy_actdata();
                        break;
                case B_ACTPASTEKEYS:
-                       paste_actdata();
+                       if (G.saction->mode == SACTCONT_GPENCIL)
+                               paste_gpdata();
+                       else
+                               paste_actdata();
                        break;
 
                case B_ACTPIN:  /* __PINFAKE */
@@ -1735,20 +1741,24 @@ void action_buttons(void)
                uiClearButLock();
                
                xco += 8;
-               
-               /* COPY PASTE */
-               uiBlockBeginAlign(block);
-               if (curarea->headertype==HEADERTOP) {
-                       uiDefIconBut(block, BUT, B_ACTCOPYKEYS, ICON_COPYUP,    xco,0,XIC,YIC, 0, 0, 0, 0, 0, "Copies the selected keyframes from the selected channel(s) to the buffer");
-                       uiDefIconBut(block, BUT, B_ACTPASTEKEYS, ICON_PASTEUP,  xco+=XIC,0,XIC,YIC, 0, 0, 0, 0, 0, "Pastes the keyframes from the buffer");
-               }
-               else {
-                       uiDefIconBut(block, BUT, B_ACTCOPYKEYS, ICON_COPYDOWN,  xco,0,XIC,YIC, 0, 0, 0, 0, 0, "Copies the selected keyframes from the selected channel(s) to the buffer");
-                       uiDefIconBut(block, BUT, B_ACTPASTEKEYS, ICON_PASTEDOWN,        xco+=XIC,0,XIC,YIC, 0, 0, 0, 0, 0, "Pastes the keyframes from the buffer");
-               }
-               uiBlockEndAlign(block);
-               xco += (XIC + 8);
-               
+       }
+       
+       
+       /* COPY PASTE */
+       uiBlockBeginAlign(block);
+       if (curarea->headertype==HEADERTOP) {
+               uiDefIconBut(block, BUT, B_ACTCOPYKEYS, ICON_COPYUP,    xco,0,XIC,YIC, 0, 0, 0, 0, 0, "Copies the selected keyframes from the selected channel(s) to the buffer");
+               uiDefIconBut(block, BUT, B_ACTPASTEKEYS, ICON_PASTEUP,  xco+=XIC,0,XIC,YIC, 0, 0, 0, 0, 0, "Pastes the keyframes from the buffer");
+       }
+       else {
+               uiDefIconBut(block, BUT, B_ACTCOPYKEYS, ICON_COPYDOWN,  xco,0,XIC,YIC, 0, 0, 0, 0, 0, "Copies the selected keyframes from the selected channel(s) to the buffer");
+               uiDefIconBut(block, BUT, B_ACTPASTEKEYS, ICON_PASTEDOWN,        xco+=XIC,0,XIC,YIC, 0, 0, 0, 0, 0, "Pastes the keyframes from the buffer");
+       }
+       uiBlockEndAlign(block);
+       xco += (XIC + 8);
+       
+       
+       if (G.saction->mode != SACTCONT_GPENCIL) {
                /* draw AUTOSNAP */
                if (G.saction->flag & SACTION_DRAWTIME) {
                        uiDefButC(block, MENU, B_REDR,
index 9a2f907fa12577b7a8088f3a2db9c1546fa0bc2b..4cef7a1cb3ec12657d0b108c2e815ab35a9c2e29 100644 (file)
@@ -5796,6 +5796,7 @@ void view3d_buttons(void)
                                uiDefIconTextButS(block, ICONTEXTROW,B_REDR, ICON_SMOOTHCURVE, propfalloff_pup(), xco,0,XIC+10,YIC, &(G.scene->prop_mode), 0.0, 0.0, 0, 0, "Proportional Edit Falloff (Hotkey: Shift O) ");
                                xco+= XIC+10;
                        }
+                       uiBlockEndAlign(block);
                        xco+= 10;
                }
 
@@ -5835,6 +5836,7 @@ void view3d_buttons(void)
                                uiDefIconButBitS(block, TOG, V3D_ZBUF_SELECT, B_REDR, ICON_ORTHO, xco,0,XIC,YIC, &G.vd->flag, 1.0, 0.0, 0, 0, "Occlude background geometry");
                                xco+= XIC;
                        }
+                       uiBlockEndAlign(block);
                        xco+= 20;
                }
                else if(G.f & G_PARTICLEEDIT) {
@@ -5850,6 +5852,7 @@ void view3d_buttons(void)
                                uiDefIconButBitS(block, TOG, V3D_ZBUF_SELECT, B_REDR, ICON_ORTHO, xco,0,XIC,YIC, &G.vd->flag, 1.0, 0.0, 0, 0, "Limit selection to visible (clipped with depth buffer)");
                                xco+= XIC;
                        }
+                       uiBlockEndAlign(block);
                        xco+= 20;
                }
 
index a8c23864afd78f1ddef5a50aeb45bffe2d5bf7ff..7c1a4668a56483bc4a35d36ce72b3e2942df6a62 100644 (file)
@@ -1843,13 +1843,14 @@ static int ui_do_but_TEX(uiBut *but)
                        }
                        /* cut & copy */
                        else if ( (dev==XKEY) || (dev==CKEY) ) {
-                               /* copy the contents to the copypaste buffer */
+                               /* copy the contents to the clipboard */
                                for(x= but->selsta; x <= but->selend; x++) {
                                        if (x==but->selend)
                                                buf[x] = '\0';
                                        else
                                                buf[(x - but->selsta)] = str[x];
                                }
+                               putClipboard(buf, 0);
                                
                                /* for cut only, delete the selection afterwards */
                                if (dev==XKEY) {
index 5118744127c0dd76490597955558e3e1cf405878..b6f14b9bb682797bd26add2f92301411a8728351 100644 (file)
@@ -86,7 +86,23 @@ typedef struct RetopoPaintHit {
 } RetopoPaintHit;
 
 static void retopo_do_2d(View3D *v3d, double proj[2], float *v, char adj);
-static void retopo_paint_debug_print(RetopoPaintData *rpd);
+
+#if 0
+static void retopo_paint_debug_print(RetopoPaintData *rpd)
+{
+       RetopoPaintLine *l;
+       RetopoPaintPoint *p;
+       
+       for(l= rpd->lines.first; l; l= l->next) {
+               printf("Line:\n");
+               for(p= l->points.first; p; p= p->next) {
+                       printf("   Point(%d: %d,%d)\n",p->index,p->loc.x,p->loc.y);
+               }
+       }
+       
+       fflush(stdout);
+}
+#endif
 
 /* Painting */
 RetopoPaintData *get_retopo_paint_data(void)
@@ -708,17 +724,22 @@ RetopoPaintData *retopo_paint_data_copy(RetopoPaintData *rpd)
 
        memcpy(copy,rpd,sizeof(RetopoPaintData));
        copy->lines.first= copy->lines.last= NULL;
+       copy->nearest.next= copy->nearest.prev= NULL;
+       copy->nearest.line= NULL;
+       copy->nearest.first= 0;
+       
        for(l= rpd->lines.first; l; l= l->next) {
-               lcp= MEM_mallocN(sizeof(RetopoPaintLine),"RetopoPaintLineCopy");
-               memcpy(lcp,l,sizeof(RetopoPaintLine));
-               BLI_addtail(&copy->lines,lcp);
+               lcp= MEM_dupallocN(l);
+               BLI_addtail(&copy->lines, lcp);
                
                lcp->hitlist.first= lcp->hitlist.last= NULL;
                lcp->points.first= lcp->points.last= NULL;
+               lcp->cyclic= NULL;
+               
                for(p= l->points.first; p; p= p->next) {
-                       pcp= MEM_mallocN(sizeof(RetopoPaintPoint),"RetopoPaintPointCopy");
-                       memcpy(pcp,p,sizeof(RetopoPaintPoint));
-                       BLI_addtail(&lcp->points,pcp);
+                       pcp= MEM_dupallocN(p);
+                       BLI_addtail(&lcp->points, pcp);
+                       pcp->eve= NULL;
                }
        }
 
@@ -904,18 +925,3 @@ void retopo_free_view_data(View3D *v3d)
                v3d->retopo_view_data= NULL;
        }
 }
-
-static void retopo_paint_debug_print(RetopoPaintData *rpd)
-{
-       RetopoPaintLine *l;
-       RetopoPaintPoint *p;
-
-       for(l= rpd->lines.first; l; l= l->next) {
-               printf("Line:\n");
-               for(p= l->points.first; p; p= p->next) {
-                       printf("   Point(%d: %d,%d)\n",p->index,p->loc.x,p->loc.y);
-               }
-       }
-
-       fflush(stdout);
-}
index 1e0c8099dea979ef21f60a4cd1e3286c125a05e1..9b4e33616255fdab9bdfe3bad2d733b2b316da29 100644 (file)
@@ -86,7 +86,7 @@
 #include "blendef.h"
 
 
-static void audio_fill(void *mixdown, Uint8 *sstream, int len);
+static void audio_fill(void *mixdown, uint8_t *sstream, int len);
 /* ************ GLOBALS ************* */
 
 static int audio_pos;
@@ -208,7 +208,7 @@ void audio_mixdown()
 #endif
 }
 
-void audiostream_fill(Uint8 *mixdown, int len)
+void audiostream_fill(uint8_t *mixdown, int len)
 {    
        int oldcfra = CFRA;
        int i;
@@ -229,7 +229,7 @@ void audiostream_fill(Uint8 *mixdown, int len)
 }
 
 
-static void audio_levels(Uint8 *buf, int len, float db, float facf, float pan)
+static void audio_levels(uint8_t *buf, int len, float db, float facf, float pan)
 {
        int i;
        float facl, facr, fac;
@@ -294,9 +294,9 @@ void audio_makestream(bSound *sound)
 
 #ifndef DISABLE_SDL
 static void audio_fill_ram_sound(Sequence *seq, void * mixdown, 
-                                Uint8 * sstream, int len)
+                                uint8_t * sstream, int len)
 {
-       Uint8* cvtbuf;
+       uint8_t* cvtbuf;
        bSound* sound;
        float facf;
 
@@ -312,12 +312,12 @@ static void audio_fill_ram_sound(Sequence *seq, void * mixdown,
                        facf = 1.0;
                }
                cvtbuf = malloc(len);                                   
-               memcpy(cvtbuf, ((Uint8*)sound->stream)+(seq->curpos & (~3)), len);
+               memcpy(cvtbuf, ((uint8_t*)sound->stream)+(seq->curpos & (~3)), len);
                audio_levels(cvtbuf, len, seq->level, facf, seq->pan);
                if (!mixdown) {
                        SDL_MixAudio(sstream, cvtbuf, len, SDL_MIX_MAXVOLUME);
                } else {
-                       SDL_MixAudio((Uint8*)mixdown, cvtbuf, len, SDL_MIX_MAXVOLUME);
+                       SDL_MixAudio((uint8_t*)mixdown, cvtbuf, len, SDL_MIX_MAXVOLUME);
                }
                free(cvtbuf);
        }
@@ -327,10 +327,10 @@ static void audio_fill_ram_sound(Sequence *seq, void * mixdown,
 
 #ifndef DISABLE_SDL
 static void audio_fill_hd_sound(Sequence *seq, 
-                               void * mixdown, Uint8 * sstream, 
+                               void * mixdown, uint8_t * sstream, 
                                int len)
 {
-       Uint8* cvtbuf;
+       uint8_t* cvtbuf;
        float facf;
 
        if ((seq->curpos >= 0) &&
@@ -354,7 +354,7 @@ static void audio_fill_hd_sound(Sequence *seq,
                        SDL_MixAudio(sstream, 
                                     cvtbuf, len, SDL_MIX_MAXVOLUME);
                } else {
-                       SDL_MixAudio((Uint8*)mixdown, 
+                       SDL_MixAudio((uint8_t*)mixdown, 
                                     cvtbuf, len, SDL_MIX_MAXVOLUME);
                }
                free(cvtbuf);
@@ -365,7 +365,7 @@ static void audio_fill_hd_sound(Sequence *seq,
 
 #ifndef DISABLE_SDL
 static void audio_fill_seq(Sequence * seq, void * mixdown,
-                          Uint8 *sstream, int len, int advance_only)
+                          uint8_t *sstream, int len, int advance_only)
 {
        while(seq) {
                if (seq->type == SEQ_META &&
@@ -419,7 +419,7 @@ static void audio_fill_seq(Sequence * seq, void * mixdown,
 #endif
 
 #ifndef DISABLE_SDL
-static void audio_fill(void *mixdown, Uint8 *sstream, int len)
+static void audio_fill(void *mixdown, uint8_t *sstream, int len)
 {    
        Editing *ed;
        Sequence *seq;
@@ -467,7 +467,7 @@ static int audio_init(SDL_AudioSpec *desired)
 }
 #endif
 
-static int audiostream_play_seq(Sequence * seq, Uint32 startframe)
+static int audiostream_play_seq(Sequence * seq, uint32_t startframe)
 {
        char name[FILE_MAXDIR+FILE_MAXFILE];
        int have_sound = 0;
@@ -510,7 +510,7 @@ static int audiostream_play_seq(Sequence * seq, Uint32 startframe)
        return have_sound;
 }
 
-void audiostream_play(Uint32 startframe, Uint32 duration, int mixdown)
+void audiostream_play(uint32_t startframe, uint32_t duration, int mixdown)
 {
 #ifndef DISABLE_SDL
        static SDL_AudioSpec desired;
@@ -557,12 +557,12 @@ void audiostream_play(Uint32 startframe, Uint32 duration, int mixdown)
 #endif
 }
 
-void audiostream_start(Uint32 frame)
+void audiostream_start(uint32_t frame)
 {
        audiostream_play(frame, 0, 0);
 }
 
-void audiostream_scrub(Uint32 frame)
+void audiostream_scrub(uint32_t frame)
 {
        if (U.mixbufsize) audiostream_play(frame, 4096/U.mixbufsize, 0);
 }
index 0339747ec667fb4d169ec8b206752962c75ad195..cb838dc0b262f0045947715daecbb4cd278bbeca 100644 (file)
@@ -197,7 +197,7 @@ extern void StartKetsjiShellSimulation(ScrArea *area, char* startscenename, stru
  * When the mipmap setting changes, we want to redraw the view right
  * away to reflect this setting.
  */
-static void space_mipmap_button_function(int event);
+//static void space_mipmap_button_function(int event);
 
 static void free_soundspace(SpaceSound *ssound);
 
@@ -3316,13 +3316,14 @@ void initipo(ScrArea *sa)
 
 /* ******************** SPACE: INFO ********************** */
 
+#if 0
 static void space_mipmap_button_function(int event) {
        GPU_set_mipmap(!(U.gameflags & USER_DISABLE_MIPMAP));
 
        allqueue(REDRAWVIEW3D, 0);
 }
 
-#if 0
+
 static void space_sound_button_function(int event)
 {
        int a;
@@ -4110,14 +4111,22 @@ void drawinfospace(ScrArea *sa, void *spacedata)
                uiDefBut(block, LABEL,0,"Grease Pencil:",
                        (xpos+(2*edgsp)+(3*midsp)+(3*mpref)+spref),y6label,mpref,buth,
                        0, 0, 0, 0, 0, "");
-
+               
                uiBlockBeginAlign(block);
                uiDefButS(block, NUM, 0, "Manhatten Dist:",
-                       (xpos+(4*midsp)+(3*mpref)+mpref),y5,mpref,buth,
+                       (xpos+(4*midsp)+(3*mpref)+spref),y5,(spref*1.5),buth,
                        &(U.gp_manhattendist), 0, 100, 0, 0, "Pixels moved by mouse per axis when drawing stroke");
                uiDefButS(block, NUM, 0, "Euclidean Dist:",
-                       (xpos+(5*midsp)+(3*mpref)+(2*mpref)),y5,mpref,buth,
+                       (xpos+(5*midsp)+(3*mpref)+(spref*2.5)),y5,(spref*1.5),buth,
                        &(U.gp_euclideandist), 0, 100, 0, 0, "Distance moved by mouse when drawing stroke (in pixels) to include");
+               
+               
+               uiDefButS(block, NUM, 0, "Eraser Radius:",
+                       (xpos+(7*midsp)+(3*mpref)+(3.75*spref)),y5,spref*1.5,buth,
+                       &(U.gp_eraser), 0, 100, 0, 0, "Radius of eraser 'brush'");
+               uiDefButBitS(block, TOG, GP_PAINT_DOSMOOTH, 0,"Smooth Stroke",
+                       (xpos+(8*midsp)+(3*mpref)+(5*spref)),y5,spref,buth,
+                       &(U.gp_settings), 0, 100, 0, 0, "Smooth the final stroke");
                uiBlockEndAlign(block);
        
        } else if(U.userpref == 2) { /* language & colors */
index bb2e83d8fa5363cbe94004ea783d8d67248dbd4c..162d652afd13b3bde7e1f41847de769d6e69c2bf 100644 (file)
@@ -375,6 +375,7 @@ void persptoetsen(unsigned short event)
                                q1[1]= q1[2]= 0.0;
                                q1[3]= si;
                                QuatMul(G.vd->viewquat, G.vd->viewquat, q1);
+                               G.vd->view= 0;
                        }
                        if(event==PAD2 || event==PAD8) {
                                /* horizontal axis */
@@ -389,6 +390,7 @@ void persptoetsen(unsigned short event)
                                q1[2]*= si;
                                q1[3]*= si;
                                QuatMul(G.vd->viewquat, G.vd->viewquat, q1);
+                               G.vd->view= 0;
                        }
                }
 
index 70dcb58b87c5b8ef826c50c09754732840d06c5b..00937e893f1be4afed10d4ea57b736eb1a9134ff 100644 (file)
@@ -1428,7 +1428,10 @@ static void createTransCurveVerts(TransInfo *t)
                        if (propmode && head != tail)
                                calc_distanceCurveVerts(head, tail-1);
                        
-                       testhandlesNurb(nu); /* sets the handles based on their selection, do this after the data is copied to the TransData */
+                       /* TODO - in the case of tilt and radius we can also avoid allocating the initTransDataCurveHandes
+                        * but for now just dont change handle types */
+                       if (ELEM(t->mode, TFM_CURVE_SHRINKFATTEN, TFM_TILT) == 0)
+                               testhandlesNurb(nu); /* sets the handles based on their selection, do this after the data is copied to the TransData */
                }
                else {
                        TransData *head, *tail;
@@ -2518,6 +2521,7 @@ static void posttrans_gpd_clean (bGPdata *gpd)
                 * (these need to be sorted as they are isolated)
                 */
                for (gpf= gpl->frames.first; gpf; gpf= gpfn) {
+                       short added= 0;
                        gpfn= gpf->next;
                        
                        if (gpf->flag & GP_FRAME_SELECT) {
@@ -2531,10 +2535,11 @@ static void posttrans_gpd_clean (bGPdata *gpd)
                                        /* if current (gpf) occurs after this one in buffer, add! */
                                        if (gfs->framenum < gpf->framenum) {
                                                BLI_insertlinkafter(&sel_buffer, gfs, gpf);
+                                               added= 1;
                                                break;
                                        }
                                }
-                               if (gfs == NULL)
+                               if (added == 0)
                                        BLI_addhead(&sel_buffer, gpf);
                        }
                }
@@ -2552,12 +2557,9 @@ static void posttrans_gpd_clean (bGPdata *gpd)
                }
                
                /* loop 2: remove duplicates of frames in buffers */
-               //gfs= sel_buffer.first;
-               //gfsn= gfs->next;
-               
                for (gpf= gpl->frames.first; gpf && sel_buffer.first; gpf= gpfn) {
                        gpfn= gpf->next;
-                        
+                       
                        /* loop through sel_buffer, emptying stuff from front of buffer if ok */
                        for (gfs= sel_buffer.first; gfs && gpf; gfs= gfsn) {
                                gfsn= gfs->next;
@@ -3899,7 +3901,17 @@ void special_aftertrans_update(TransInfo *t)
                        /* remove duplicate frames and also make sure points are in order! */
                        if ((cancelled == 0) || (duplicate))
                        {
-                               posttrans_gpd_clean(data);
+                               ScrArea *sa;
+                               
+                               /* BAD... we need to loop over all screen areas for current screen...
+                                *      - sync this with actdata_filter_gpencil() in editaction.c 
+                                */
+                               for (sa= G.curscreen->areabase.first; sa; sa= sa->next) {
+                                       bGPdata *gpd= gpencil_data_getactive(sa);
+                                       
+                                       if (gpd) 
+                                               posttrans_gpd_clean(gpd);
+                               }
                        }
                }
                
index 709879f142bb552fe23418453ceba66e1f716359..b5a5ecd05cef9c0ac3c89d66ea2c54578de71e31 100644 (file)
@@ -282,8 +282,17 @@ int calc_manipulator_stats(ScrArea *sa)
                                        bezt= nu->bezt;
                                        a= nu->pntsu;
                                        while(a--) {
-                                               /* exception */
-                                               if( (bezt->f1 & SELECT) + (bezt->f2 & SELECT) + (bezt->f3 & SELECT) > SELECT ) {
+                                               /* exceptions
+                                                * if handles are hidden then only check the center points.
+                                                * If 2 or more are selected then only use the center point too.
+                                                */
+                                               if (G.f & G_HIDDENHANDLES) {
+                                                       if (bezt->f2 & SELECT) {
+                                                               calc_tw_center(bezt->vec[1]);
+                                                               totsel++;
+                                                       }
+                                               }
+                                               else if ( (bezt->f1 & SELECT) + (bezt->f2 & SELECT) + (bezt->f3 & SELECT) > SELECT ) {
                                                        calc_tw_center(bezt->vec[1]);
                                                        totsel++;
                                                }
index 7de866ccfb7e2df2561d974b71870c7cbfe2183d..762264d5bc55addb453b549bc56a25c48052cce5 100644 (file)
@@ -203,6 +203,9 @@ static void init_userdef_file(void)
     if (U.ndof_rotate==0) {
         U.ndof_rotate = 100;
    }
+       if (U.gp_eraser == 0) {
+               U.gp_eraser= 25;
+       }
 
        if(U.flag & USER_CUSTOM_RANGE) 
                vDM_ColorBand_store(&U.coba_weight); /* signal for derivedmesh to use colorband */
@@ -503,10 +506,11 @@ static void init_userdef_file(void)
                        col = btheme->tv3d.vertex_select;
                        SETCOL(btheme->tseq.vertex_select, col[0], col[1], col[2], 255);
                }
-               
+       }
+       if ((G.main->versionfile < 247) || (G.main->versionfile == 247 && G.main->subversionfile <= 9)) {
                /* define grease-pencil distances */
-               U.gp_manhattendist= 3;
-               U.gp_euclideandist= 20;
+               U.gp_manhattendist= 2;
+               U.gp_euclideandist= 15;
        }
 
        /* GL Texture Garbage Collection (variable abused above!) */
@@ -1135,6 +1139,7 @@ void exit_usiblender(void)
        free_matcopybuf();
        free_ipocopybuf();
        free_actcopybuf();
+       free_gpcopybuf();
        free_vertexpaint();
        free_texttools();
        
index d54683429327e5aea1bc464122accc057a9e943d..6f558152ac700c69ca415542bd21b235287bcfff 100644 (file)
@@ -1266,7 +1266,6 @@ void viewmove(int mode)
                        mvalo[1]= mval[1];
 
                        if(G.f & G_PLAYANIM) inner_play_anim_loop(0, 0);
-                       if(G.f & G_SIMULATION) break;
 
                        /* If in retopo paint mode, update lines */
                        if(retopo_mesh_paint_check() && G.vd->retopo_view_data) {
index 0d58810e1561f3c9ce7191dc8c1b35b9d87a34b8..1110c4e0b4819c39cbfaff434a2d6cd162ec0157 100644 (file)
@@ -135,15 +135,6 @@ extern "C" void StartKetsjiShell(struct ScrArea *area,
                bool frameRate = (SYS_GetCommandLineInt(syshandle, "show_framerate", 0) != 0);
                bool game2ipo = (SYS_GetCommandLineInt(syshandle, "game2ipo", 0) != 0);
                bool displaylists = (SYS_GetCommandLineInt(syshandle, "displaylists", 0) != 0);
-               bool usemat = false, useglslmat = false;
-
-               if(GLEW_ARB_multitexture && GLEW_VERSION_1_1)
-                       usemat = (SYS_GetCommandLineInt(syshandle, "blender_material", 1) != 0);
-
-               if(GPU_extensions_minimum_support())
-                       useglslmat = (SYS_GetCommandLineInt(syshandle, "blender_glsl_material", 1) != 0);
-               else if(G.fileflags & G_FILE_GAME_MAT_GLSL)
-                       usemat = false;
 
                // create the canvas, rasterizer and rendertools
                RAS_ICanvas* canvas = new KX_BlenderCanvas(area);
@@ -316,10 +307,18 @@ extern "C" void StartKetsjiShell(struct ScrArea *area,
                        if (always_use_expand_framing)
                                sceneconverter->SetAlwaysUseExpandFraming(true);
 
-                       if(usemat && (G.fileflags & G_FILE_GAME_MAT))
-                               sceneconverter->SetMaterials(true);
-                       if(useglslmat && (G.fileflags & G_FILE_GAME_MAT_GLSL))
-                               sceneconverter->SetGLSLMaterials(true);
+                       bool usemat = false, useglslmat = false;
+
+                       if(GLEW_ARB_multitexture && GLEW_VERSION_1_1)
+                               usemat = true;
+
+                       if(GPU_extensions_minimum_support())
+                               useglslmat = true;
+                       else if(G.fileflags & G_FILE_GAME_MAT_GLSL)
+                               usemat = false;
+
+                       sceneconverter->SetMaterials(usemat && (G.fileflags & G_FILE_GAME_MAT));
+                       sceneconverter->SetGLSLMaterials(useglslmat && (G.fileflags & G_FILE_GAME_MAT_GLSL));
                                        
                        KX_Scene* startscene = new KX_Scene(keyboarddevice,
                                mousedevice,
index d5f304c38e7040bc9ce2941dfafe6e88d492b539..4f152acc918ee83ef862bf777f6d87d48356722b 100644 (file)
@@ -291,15 +291,19 @@ void BL_ConvertActuators(char* maggiename,
                                STR_String toPropName = (msgAct->toPropName
                                        ? (char*) msgAct->toPropName
                                        : "");
-                                       /**
-                                       * Get the Message Subject to send.
+                               /* BGE Wants "OB" prefix */
+                               if (toPropName != "")
+                                       toPropName = "OB" + toPropName;
+                               
+                               /**
+                               * Get the Message Subject to send.
                                */
                                STR_String subject = (msgAct->subject
                                        ? (char*) msgAct->subject
                                        : "");
                                
-                                       /**
-                                       * Get the bodyType
+                               /**
+                               * Get the bodyType
                                */
                                int bodyType = msgAct->bodyType;
                                
index 9700e6387f270d665affdee80037987dbd1a5ce6..fbb8d6530ba53717c33b32416226bef549091809 100644 (file)
@@ -659,7 +659,9 @@ int main(int argc, char** argv)
                                                Main *maggie = bfd->main;
                                                Scene *scene = bfd->curscene;
                                                G.main = maggie;
-                                               G.fileflags  = bfd->fileflags;
+
+                                               if (firstTimeRunning)
+                                                       G.fileflags  = bfd->fileflags;
 
                                                //Seg Fault; icon.c gIcons == 0
                                                BKE_icons_init(1);
index fc836234e2bba801edbb8d98e9e4320098d2a653..cdf7ebd0943e94cb1a31d178b7e65ddf99e4f1d6 100644 (file)
@@ -1077,9 +1077,17 @@ PyObject *KXpy_import(PyObject *self, PyObject *args)
        PyObject *fromlist = NULL;
        PyObject *l, *m, *n;
 
+#if (PY_VERSION_HEX >= 0x02060000)
+       int dummy_val; /* what does this do?*/
+       
+       if (!PyArg_ParseTuple(args, "s|OOOi:m_import",
+               &name, &globals, &locals, &fromlist, &dummy_val))
+           return NULL;
+#else
        if (!PyArg_ParseTuple(args, "s|OOO:m_import",
                &name, &globals, &locals, &fromlist))
            return NULL;
+#endif
 
        /* check for builtin modules */
        m = PyImport_AddModule("sys");
@@ -1492,6 +1500,7 @@ int saveGamePythonConfig( char **marshal_buffer)
                }
                Py_DECREF(gameLogic);
        } else {
+               PyErr_Clear();
                printf("Error, GameLogic failed to import GameLogic.globalDict will be lost\n");
        }
        return marshal_length;
@@ -1505,10 +1514,17 @@ int loadGamePythonConfig(char *marshal_buffer, int marshal_length)
 
                if (gameLogic) {
                        PyObject* pyGlobalDict = PyMarshal_ReadObjectFromString(marshal_buffer, marshal_length);
-
                        if (pyGlobalDict) {
-                               PyDict_SetItemString(PyModule_GetDict(gameLogic), "globalDict", pyGlobalDict); // Same as importing the module.
+                               PyObject* pyGlobalDict_orig = PyDict_GetItemString(PyModule_GetDict(gameLogic), "globalDict"); // Same as importing the module.
+                               if (pyGlobalDict_orig) {
+                                       PyDict_Clear(pyGlobalDict_orig);
+                                       PyDict_Update(pyGlobalDict_orig, pyGlobalDict);
+                               } else {
+                                       /* this should not happen, but cant find the original globalDict, just assign it then */
+                                       PyDict_SetItemString(PyModule_GetDict(gameLogic), "globalDict", pyGlobalDict); // Same as importing the module.
+                               }
                                Py_DECREF(gameLogic);
+                               Py_DECREF(pyGlobalDict);
                                return 1;
                        } else {
                                Py_DECREF(gameLogic);
@@ -1516,6 +1532,7 @@ int loadGamePythonConfig(char *marshal_buffer, int marshal_length)
                                printf("Error could not marshall string\n");
                        }
                } else {
+                       PyErr_Clear();
                        printf("Error, GameLogic failed to import GameLogic.globalDict will be lost\n");
                }       
        }
index 47bc5e9fa722f3670591290ac3af99b461964c91..330a371381721cedcb6a366705c28b16b27bad03 100644 (file)
@@ -176,6 +176,8 @@ def setup_syslibs(lenv):
             syslibs += Split(lenv['BF_OPENEXR_LIB'])
     if lenv['WITH_BF_FFMPEG']:
         syslibs += Split(lenv['BF_FFMPEG_LIB'])
+        if lenv['WITH_BF_OGG']:
+            syslibs += Split(lenv['BF_OGG_LIB'])
     if lenv['WITH_BF_SDL']:
         syslibs += Split(lenv['BF_SDL_LIB'])
     if not lenv['WITH_BF_STATICOPENGL']:
index 58b667b486f4e208ed1a155615b50f228b0088d4..4c5e0dd3527582e334e018f84b39d40a0453b8a3 100755 (executable)
@@ -35,6 +35,7 @@ def validate_arguments(args, bc):
             'WITH_BF_OPENEXR', 'BF_OPENEXR', 'BF_OPENEXR_INC', 'BF_OPENEXR_LIB', 'BF_OPENEXR_LIBPATH', 'WITH_BF_STATICOPENEXR', 'BF_OPENEXR_LIB_STATIC',
             'WITH_BF_DDS',
             'WITH_BF_FFMPEG', 'BF_FFMPEG_LIB','BF_FFMPEG_EXTRA', 'BF_FFMPEG',  'BF_FFMPEG_INC',
+            'WITH_BF_OGG', 'BF_OGG', 'BF_OGG_LIB',
             'WITH_BF_JPEG', 'BF_JPEG', 'BF_JPEG_INC', 'BF_JPEG_LIB', 'BF_JPEG_LIBPATH',
             'WITH_BF_PNG', 'BF_PNG', 'BF_PNG_INC', 'BF_PNG_LIB', 'BF_PNG_LIBPATH',
             'BF_TIFF', 'BF_TIFF_INC',
@@ -194,6 +195,10 @@ def read_opts(cfg, args):
         ('BF_FFMPEG_INC', 'FFMPEG includes', ''),
         ('BF_FFMPEG_LIBPATH', 'FFMPEG library path', ''),
         
+        (BoolOption('WITH_BF_OGG', 'Use OGG, THEORA, VORBIS in FFMPEG if true',
+                    'false')),
+        ('BF_OGG', 'OGG base path', ''),
+        ('BF_OGG_LIB', 'OGG library', ''),
 
         (BoolOption('WITH_BF_JPEG', 'Use JPEG if true', 'true')),
         ('BF_JPEG', 'JPEG base path', ''),