svn merge -r 16411:16453 https://svn.blender.org/svnroot/bf-blender/trunk/blender
authorDaniel Genrich <daniel.genrich@gmx.net>
Wed, 10 Sep 2008 10:53:38 +0000 (10:53 +0000)
committerDaniel Genrich <daniel.genrich@gmx.net>
Wed, 10 Sep 2008 10:53:38 +0000 (10:53 +0000)
66 files changed:
CMakeLists.txt
intern/ghost/GHOST_ISystem.h
intern/ghost/GHOST_Types.h
intern/ghost/intern/GHOST_SystemCarbon.cpp
intern/ghost/intern/GHOST_SystemCarbon.h
intern/ghost/intern/GHOST_SystemWin32.cpp
intern/ghost/intern/GHOST_SystemWin32.h
intern/ghost/intern/GHOST_SystemX11.cpp
intern/ghost/intern/GHOST_SystemX11.h
intern/ghost/intern/GHOST_WindowX11.cpp
intern/ghost/intern/GHOST_WindowX11.h
release/scripts/scripttemplate_gamelogic.py [new file with mode: 0644]
release/scripts/scripttemplate_gamelogic_basic.py [new file with mode: 0644]
source/blender/blenkernel/intern/armature.c
source/blender/blenkernel/intern/modifier.c
source/blender/blenkernel/intern/particle_system.c
source/blender/blenkernel/intern/subsurf_ccg.c
source/blender/blenlib/BLI_arithb.h
source/blender/blenlib/intern/arithb.c
source/blender/include/BIF_meshlaplacian.h
source/blender/include/blendef.h
source/blender/nodes/intern/CMP_nodes/CMP_tonemap.c
source/blender/python/BPY_interface.c
source/blender/python/api2_2x/Lamp.c
source/blender/python/api2_2x/MTex.c
source/blender/python/api2_2x/MTex.h
source/blender/python/api2_2x/Material.c
source/blender/python/api2_2x/Particle.c
source/blender/python/api2_2x/World.c
source/blender/python/api2_2x/doc/Lamp.py
source/blender/python/api2_2x/doc/Material.py
source/blender/python/api2_2x/doc/Texture.py
source/blender/python/api2_2x/doc/World.py
source/blender/render/intern/source/convertblender.c
source/blender/render/intern/source/rendercore.c
source/blender/render/intern/source/renderdatabase.c
source/blender/render/intern/source/zbuf.c
source/blender/src/buttons_editing.c
source/blender/src/buttons_logic.c
source/blender/src/buttons_object.c
source/blender/src/buttons_shading.c
source/blender/src/drawaction.c
source/blender/src/drawgpencil.c
source/blender/src/drawipo.c
source/blender/src/drawview.c
source/blender/src/editmesh_loop.c
source/blender/src/editmesh_tools.c
source/blender/src/editobject.c
source/blender/src/editscreen.c
source/blender/src/gpencil.c
source/blender/src/header_view3d.c
source/blender/src/meshlaplacian.c
source/blender/src/resources.c
source/blender/src/space.c
source/blender/src/transform_orientations.c
source/blender/src/usiblender.c
source/gameengine/Converter/KX_ConvertSensors.cpp
source/gameengine/GamePlayer/CMakeLists.txt
source/gameengine/GamePlayer/ghost/GPG_Application.cpp
source/gameengine/GamePlayer/ghost/GPG_Application.h
source/gameengine/GamePlayer/ghost/GPG_ghost.cpp
source/gameengine/Ketsji/KX_GameObject.cpp
source/gameengine/Ketsji/KX_GameObject.h
source/gameengine/Ketsji/KX_Light.cpp
source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp
source/gameengine/PyDoc/KX_GameObject.py

index 97113c22f980e61e050c5b2f3b0352d0788dd7a2..4c1b863178f444556c166295418d1729b7f610ce 100644 (file)
@@ -64,6 +64,7 @@ OPTION(WITH_OPENEXR           "Enable OpenEXR Support (http://www.openexr.com)"       ON)
 OPTION(WITH_FFMPEG             "Enable FFMPeg Support (http://ffmpeg.mplayerhq.hu/)"   OFF)
 OPTION(WITH_OPENAL             "Enable OpenAL Support (http://www.openal.org)"         ON)
 OPTION(WITH_OPENMP             "Enable OpenMP (has to be supported by the compiler)"   OFF)
+OPTION(WITH_WEBPLUGIN          "Enable Web Plugin (Mozilla-Unix only)"                 OFF)
 
 IF(NOT WITH_GAMEENGINE AND WITH_PLAYER)
   MESSAGE("WARNING: WITH_PLAYER needs WITH_GAMEENGINE")
@@ -456,6 +457,13 @@ SUBDIRS(
 # Blender Application
 SUBDIRS(source/creator)
 
+#-----------------------------------------------------------------------------
+# Blender WebPlugin
+IF(WITH_WEBPLUGIN) 
+  SET(MOZILLA_DIR "${CMAKE_SOURCE_DIR}/../gecko-sdk/" CACHE PATH "Gecko SDK path")
+  SET(WITH_PLAYER ON)
+ENDIF(WITH_WEBPLUGIN)
+
 #-----------------------------------------------------------------------------
 # Blender Player
 IF(WITH_PLAYER)
index 2ad2e9ddce71d1f36138823d535017b067c7096f..baf0cb813f84af7a40273a9b206d8be8f834d5b7 100644 (file)
@@ -224,13 +224,15 @@ public:
         * @param       state           The state of the window when opened.
         * @param       type            The type of drawing context installed in this window.
         * @param       stereoVisual    Create a stereo visual for quad buffered stereo.
+        * @param       parentWindow    Parent (embedder) window
         * @return      The new window (or 0 if creation failed).
         */
        virtual GHOST_IWindow* createWindow(
                const STR_String& title,
                GHOST_TInt32 left, GHOST_TInt32 top, GHOST_TUns32 width, GHOST_TUns32 height,
                GHOST_TWindowState state, GHOST_TDrawingContextType type,
-               const bool stereoVisual) = 0;
+               const bool stereoVisual,
+               const GHOST_TEmbedderWindowID parentWindow = 0) = 0;
 
        /**
         * Dispose a window.
index f81192f1887f8ee626f491b872ec2dc1f178db20..6b1295f649b32d24633cda2e0299d7d400318ca4 100644 (file)
@@ -100,6 +100,7 @@ typedef enum {
        GHOST_kWindowStateMaximized,
        GHOST_kWindowStateMinimized,
        GHOST_kWindowStateFullScreen,
+       GHOST_kWindowStateEmbedded,
        GHOST_kWindowState8Normal = 8,
        GHOST_kWindowState8Maximized,
        GHOST_kWindowState8Minimized,
@@ -392,6 +393,15 @@ typedef struct {
 } GHOST_DisplaySetting;
 
 
+#ifdef _WIN32
+typedef long GHOST_TEmbedderWindowID;
+#endif // _WIN32
+
+#ifndef _WIN32
+// I can't use "Window" from "<X11/Xlib.h>" because it conflits with Window defined in winlay.h
+typedef int GHOST_TEmbedderWindowID;
+#endif // _WIN32
+
 /**
  * A timer task callback routine.
  * @param task The timer task object.
index 78c25997806f12792f35635b7f2a0ded5f657a00..067c8deee32c391375b8a172d8f1b30fcd02599c 100644 (file)
@@ -402,7 +402,8 @@ GHOST_IWindow* GHOST_SystemCarbon::createWindow(
        GHOST_TUns32 height,
        GHOST_TWindowState state,
        GHOST_TDrawingContextType type,
-       bool stereoVisual
+       bool stereoVisual,
+       const GHOST_TEmbedderWindowID parentWindow
 )
 {
     GHOST_IWindow* window = 0;
index 2afc8e0885a3b50f4bba438fa2664950a3b312ff..2a1d63257843ba49d6135f2269faa35a58f13923 100644 (file)
@@ -103,6 +103,7 @@ public:
         * @param       height  The height the window.
         * @param       state   The state of the window when opened.
         * @param       type    The type of drawing context installed in this window.
+        * @param       parentWindow    Parent (embedder) window
         * @return      The new window (or 0 if creation failed).
         */
        virtual GHOST_IWindow* createWindow(
@@ -113,7 +114,8 @@ public:
                GHOST_TUns32 height,
                GHOST_TWindowState state,
                GHOST_TDrawingContextType type,
-               const bool stereoVisual
+               const bool stereoVisual,
+               const GHOST_TEmbedderWindowID parentWindow = 0 
        );
        
        /***************************************************************************************
index 7bc20d3873900efb007ec238ab3859a8bc8777dc..feb0fe39040eb8bebf567d558fb5d97b57da01e4 100644 (file)
@@ -169,7 +169,7 @@ GHOST_IWindow* GHOST_SystemWin32::createWindow(
        const STR_String& title, 
        GHOST_TInt32 left, GHOST_TInt32 top, GHOST_TUns32 width, GHOST_TUns32 height,
        GHOST_TWindowState state, GHOST_TDrawingContextType type,
-       bool stereoVisual)
+       bool stereoVisual, const GHOST_TEmbedderWindowID parentWindow )
 {
        GHOST_Window* window = 0;
        window = new GHOST_WindowWin32 (title, left, top, width, height, state, type, stereoVisual);
index c26ef25e366048d506e9709a810350cc8e6353cd..00f7af0016258c8c4086e7f85ddc945bb2f72cdc 100644 (file)
@@ -109,13 +109,14 @@ public:
         * @param       height  The height the window.
         * @param       state   The state of the window when opened.
         * @param       type    The type of drawing context installed in this window.
+        * @param       parentWindow    Parent (embedder) window
         * @return      The new window (or 0 if creation failed).
         */
        virtual GHOST_IWindow* createWindow(
                const STR_String& title,
                GHOST_TInt32 left, GHOST_TInt32 top, GHOST_TUns32 width, GHOST_TUns32 height,
                GHOST_TWindowState state, GHOST_TDrawingContextType type,
-               const bool stereoVisual);
+               const bool stereoVisual, const GHOST_TEmbedderWindowID parentWindow = 0 );
 
        /***************************************************************************************
         ** Event management functionality
index 3003e0b8b1431a75c8adacb9664d41b4578c0f2a..1b90831986d57d6634ab4c25ff99400a1e5a4312 100644 (file)
@@ -191,6 +191,7 @@ getMainDisplayDimensions(
         * @param       height  The height the window.
         * @param       state   The state of the window when opened.
         * @param       type    The type of drawing context installed in this window.
+        * @param       parentWindow    Parent (embedder) window
         * @return      The new window (or 0 if creation failed).
         */
        GHOST_IWindow* 
@@ -203,14 +204,18 @@ createWindow(
        GHOST_TUns32 height,
        GHOST_TWindowState state,
        GHOST_TDrawingContextType type,
-       bool stereoVisual
+       bool stereoVisual,
+       const GHOST_TEmbedderWindowID parentWindow
 ){
        GHOST_WindowX11 * window = 0;
        
        if (!m_display) return 0;
        
+
+       
+
        window = new GHOST_WindowX11 (
-               this,m_display,title, left, top, width, height, state, type, stereoVisual
+               this,m_display,title, left, top, width, height, state, parentWindow, type, stereoVisual
        );
 
        if (window) {
@@ -511,7 +516,9 @@ GHOST_SystemX11::processEvent(XEvent *xe)
                        }
                        break;
                }
-                       
+               
+               case DestroyNotify:
+                       ::exit(-1);     
                // We're not interested in the following things.(yet...)
                case NoExpose : 
                case GraphicsExpose :
index 726cdfb2fff03bb459579bb6966b322b45fa00e9..c67f7d81e6027f9fd2bac58d31bb482feb07e9dc 100644 (file)
@@ -108,6 +108,7 @@ public:
         * @param       state           The state of the window when opened.
         * @param       type            The type of drawing context installed in this window.
         * @param       stereoVisual    Create a stereo visual for quad buffered stereo.
+        * @param       parentWindow    Parent (embedder) window
         * @return      The new window (or 0 if creation failed).
         */
                GHOST_IWindow* 
@@ -119,9 +120,10 @@ public:
                GHOST_TUns32 height,
                GHOST_TWindowState state,
                GHOST_TDrawingContextType type,
-               const bool stereoVisual
+               const bool stereoVisual,
+               const GHOST_TEmbedderWindowID parentWindow = 0 
        );
-        
+
        /**
         * @section Interface Inherited from GHOST_ISystem 
         */
index a98a59377c703054b13f2e5bb511f8f7c5bbfce0..7b0606c40b7ce7dab306f8db1870f7ac72d4f18c 100644 (file)
@@ -138,6 +138,7 @@ GHOST_WindowX11(
        GHOST_TUns32 width,     
        GHOST_TUns32 height,
        GHOST_TWindowState state,
+       const GHOST_TEmbedderWindowID parentWindow,
        GHOST_TDrawingContextType type,
        const bool stereoVisual
 ) :
@@ -205,21 +206,57 @@ GHOST_WindowX11(
 
        // create the window!
 
-       m_window = 
-               XCreateWindow(
-                       m_display, 
-                       RootWindow(m_display, m_visual->screen), 
-                       left,
-                       top,
-                       width,
-                       height,
-                       0, // no border.
-                       m_visual->depth,
-                       InputOutput, 
-                       m_visual->visual,
-                       CWBorderPixel|CWColormap|CWEventMask, 
-                       &xattributes
-               );
+       ;
+       if (parentWindow == 0) {
+               m_window = 
+                       XCreateWindow(
+                               m_display, 
+                               RootWindow(m_display, m_visual->screen), 
+                               left,
+                               top,
+                               width,
+                               height,
+                               0, // no border.
+                               m_visual->depth,
+                               InputOutput, 
+                               m_visual->visual,
+                               CWBorderPixel|CWColormap|CWEventMask, 
+                               &xattributes
+                       );
+       } else {
+
+               Window root_return;
+               int x_return,y_return;
+               unsigned int w_return,h_return,border_w_return,depth_return;
+               GHOST_TInt32 screen_x, screen_y;
+               
+               XGetGeometry(m_display, parentWindow, &root_return, &x_return, &y_return,
+                       &w_return, &h_return, &border_w_return, &depth_return );
+
+               left = 0;
+               top = 0;
+               width = w_return;
+               height = h_return;
+
+
+               m_window = XCreateWindow(
+                               m_display, 
+                               parentWindow,  // reparent against embedder 
+                               left,
+                               top,
+                               width,
+                               height,
+                               0, // no border.
+                               m_visual->depth,
+                               InputOutput, 
+                               m_visual->visual,
+                               CWBorderPixel|CWColormap|CWEventMask, 
+                               &xattributes
+                       );
+
+               XSelectInput(m_display , parentWindow, SubstructureNotifyMask);
+               
+       }       
        
        
        // Are we in fullscreen mode - then include
index 1203dbde80dc1b39f4663830f09a457c0d5ba756..abb5c131cb74fa1cfac0483abfe95b7cae78d0e1 100644 (file)
@@ -64,6 +64,7 @@ public:
         * @param width         The width the window.
         * @param height        The height the window.
         * @param state         The state the window is initially opened with.
+        * @param parentWindow  Parent (embedder) window
         * @param type          The type of drawing context installed in this window.
         * @param stereoVisual  Stereo visual for quad buffered stereo.
         */
@@ -76,6 +77,7 @@ public:
                GHOST_TUns32 width,     
                GHOST_TUns32 height,
                GHOST_TWindowState state,
+               const GHOST_TEmbedderWindowID parentWindow,
                GHOST_TDrawingContextType type = GHOST_kDrawingContextTypeNone,
                const bool stereoVisual = false
        );
diff --git a/release/scripts/scripttemplate_gamelogic.py b/release/scripts/scripttemplate_gamelogic.py
new file mode 100644 (file)
index 0000000..1709525
--- /dev/null
@@ -0,0 +1,93 @@
+#!BPY
+"""
+Name: 'GameLogic Example'
+Blender: 245
+Group: 'ScriptTemplate'
+Tooltip: 'Script template with examples of how to use game logic'
+"""
+
+from Blender import Window
+import bpy
+
+script_data = \
+'''
+# GameLogic has been added to the global namespace no need to import
+
+# for keyboard event comparison
+# import GameKeys 
+
+# support for Vector(), Matrix() types and advanced functions like AngleBetweenVecs(v1,v2) and RotationMatrix(...)
+# import Mathutils 
+
+# for functions like getWindowWidth(), getWindowHeight()
+# import Rasterizer
+
+def main():
+       cont = GameLogic.getCurrentController()
+       
+       # The KX_GameObject that owns this controller.
+       own = cont.getOwner()
+       
+       # for scripts that deal with spacial logic
+       own_pos = own.getPosition() 
+       
+       
+       # Some example functions, remove to write your own script.
+       # check for a positive sensor, will run on any object without errors.
+       print 'Logic info for KX_GameObject', own.getName()
+       input = False
+       
+       for sens in cont.getSensors():
+               # The sensor can be on another object, we may want to use it
+               own_sens = sens.getOwner()
+               print '    sensor:', sens.getName(),
+               if sens.isPositive():
+                       print '(true)'
+                       input = True
+               else:
+                       print '(false)'
+       
+       for actu in cont.getActuators():
+               # The actuator can be on another object, we may want to use it
+               own_actu = actu.getOwner()
+               print '    actuator:', sens.getName()
+               
+               # This runs the actuator or turns it off
+               # note that actuators will continue to run unless explicitly turned off.
+               if input:
+                       GameLogic.addActiveActuator(actu, True)
+               else:
+                       GameLogic.addActiveActuator(actu, False)
+       
+       # Its also good practice to get sensors and actuators by names
+       # so any changes to their order wont break the script.
+       
+       # sens_key = cont.getSensor('key_sensor')
+       # actu_motion = cont.getActuator('motion')
+       
+       
+       # Loop through all other objects in the scene
+       sce = GameLogic.getCurrentScene()
+       print 'Scene Objects:', sce.getName()
+       for ob in sce.getObjectList():
+               print '   ', ob.getName(), ob.getPosition()
+       
+       
+       # Example where collision objects are checked for their properties
+       # adding to our objects "life" property
+       """
+       actu_collide = cont.getSensor('collision_sens')
+       for ob in actu_collide.getHitObjectList():
+               # Check to see the object has this property
+               if hasattr(ob, 'life'):
+                       own.life += ob.life
+                       ob.life = 0
+       print own.life
+       """\r
+main()
+'''
+
+new_text = bpy.data.texts.new('gamelogic_example.py')
+new_text.write(script_data)
+bpy.data.texts.active = new_text
+Window.RedrawAll()
diff --git a/release/scripts/scripttemplate_gamelogic_basic.py b/release/scripts/scripttemplate_gamelogic_basic.py
new file mode 100644 (file)
index 0000000..dfd52a9
--- /dev/null
@@ -0,0 +1,33 @@
+#!BPY
+"""
+Name: 'GameLogic Template'
+Blender: 245
+Group: 'ScriptTemplate'
+Tooltip: 'Basic template for new game logic scripts'
+"""
+
+from Blender import Window
+import bpy
+
+script_data = \
+'''
+def main():
+
+       cont = GameLogic.getCurrentController()
+       own = cont.getOwner()
+       
+       sens = cont.getSensor('mySensor')
+       actu = cont.getActuator('myActuator')
+       
+       if sens.isPositive():
+               GameLogic.addActiveActuator(actu, True)
+       else:
+               GameLogic.addActiveActuator(actu, False)
+
+main()
+'''
+
+new_text = bpy.data.texts.new('gamelogic_example.py')
+new_text.write(script_data)
+bpy.data.texts.active = new_text
+Window.RedrawAll()
index fb7d59c137acbaa231bbfd47703e4ca64e725969..720ed0513ed4a0dd9db6eeba4c7cb2920bc3d8c1 100644 (file)
@@ -1690,7 +1690,7 @@ static void initialize_posetree(struct Object *ob, bPoseChannel *pchan_tip)
 were executed & assigned. Now as last we do an IK pass */
 static void execute_posetree(Object *ob, PoseTree *tree)
 {
-       float R_parmat[3][3];
+       float R_parmat[3][3], identity[3][3];
        float iR_parmat[3][3];
        float R_bonemat[3][3];
        float goalrot[3][3], goalpos[3];
@@ -1699,7 +1699,8 @@ static void execute_posetree(Object *ob, PoseTree *tree)
        float irest_basis[3][3], full_basis[3][3];
        float end_pose[4][4], world_pose[4][4];
        float length, basis[3][3], rest_basis[3][3], start[3], *ikstretch=NULL;
-       int a, flag, hasstretch=0;
+       float resultinf=0.0f;
+       int a, flag, hasstretch=0, resultblend=0;
        bPoseChannel *pchan;
        IK_Segment *seg, *parent, **iktree, *iktarget;
        IK_Solver *solver;
@@ -1844,6 +1845,12 @@ static void execute_posetree(Object *ob, PoseTree *tree)
                                Mat4MulMat4(goal, rootmat, goalinv);
                                VECCOPY(polepos, goal[3]);
                                poleconstrain= 1;
+
+                               /* for pole targets, we blend the result of the ik solver
+                                * instead of the target position, otherwise we can't get
+                                * a smooth transition */
+                               resultblend= 1;
+                               resultinf= target->con->enforce;
                                
                                if(data->flag & CONSTRAINT_IK_GETANGLE) {
                                        poleangledata= data;
@@ -1853,7 +1860,7 @@ static void execute_posetree(Object *ob, PoseTree *tree)
                }
 
                /* do we need blending? */
-               if (target->con->enforce!=1.0) {
+               if (!resultblend && target->con->enforce!=1.0) {
                        float q1[4], q2[4], q[4];
                        float fac= target->con->enforce;
                        float mfac= 1.0-fac;
@@ -1903,7 +1910,7 @@ static void execute_posetree(Object *ob, PoseTree *tree)
        tree->basis_change= MEM_mallocN(sizeof(float[3][3])*tree->totchannel, "ik basis change");
        if(hasstretch)
                ikstretch= MEM_mallocN(sizeof(float)*tree->totchannel, "ik stretch");
-               
+       
        for(a=0; a<tree->totchannel; a++) {
                IK_GetBasisChange(iktree[a], tree->basis_change[a]);
                
@@ -1931,6 +1938,12 @@ static void execute_posetree(Object *ob, PoseTree *tree)
                        VecMulf(tree->basis_change[a][1], stretch);
                        VecMulf(tree->basis_change[a][2], stretch);
                }
+
+               if(resultblend && resultinf!=1.0f) {
+                       Mat3One(identity);
+                       Mat3BlendMat3(tree->basis_change[a], identity,
+                               tree->basis_change[a], resultinf);
+               }
                
                IK_FreeSegment(iktree[a]);
        }
index 4c74fe1cca2c8f551cc218669bbc7793f4456de3..936081ab94fca7c04cf2f651ae09f74d86dcfa7f 100644 (file)
@@ -793,12 +793,18 @@ static DerivedMesh *arrayModifier_doArray(ArrayModifierData *amd,
        if(amd->fit_type == MOD_ARR_FITCURVE && amd->curve_ob) {
                Curve *cu = amd->curve_ob->data;
                if(cu) {
+                       float tmp_mat[3][3];
+                       float scale;
+                       
+                       object_to_mat3(amd->curve_ob, tmp_mat);
+                       scale = Mat3ToScalef(tmp_mat);
+                               
                        if(!cu->path) {
                                cu->flag |= CU_PATH; // needed for path & bevlist
                                makeDispListCurveTypes(amd->curve_ob, 0);
                        }
                        if(cu->path)
-                               length = cu->path->totdist;
+                               length = scale*cu->path->totdist;
                }
        }
 
index 96eb4d5d8e3d14888f8d1a1a96dbda21fcebaa07..71dd2f64c72e99eb4333637957676e77d0a8e44b 100644 (file)
@@ -3875,7 +3875,7 @@ static void boid_body(BoidVecFunc *bvf, ParticleData *pa, ParticleSystem *psys,
                state->vel[2]=0.0;
                state->co[2]=part->groundz;
 
-               if(psys->keyed_ob){
+               if(psys->keyed_ob && (psys->keyed_ob->type == OB_MESH)){
                        Object *zob=psys->keyed_ob;
                        int min_face;
                        float co1[3],co2[3],min_d=2.0,min_w[4],imat[4][4];
index f334fc39daa1c351ecb66c9e10ac69d404b64eaa..d7e9fd556b639f6baaf994b54379d3a5f2df175d 100644 (file)
@@ -700,6 +700,7 @@ DerivedMesh *ss_to_cdderivedmesh(CCGSubSurf *ss, int ssFromEditmesh,
        for(index = 0; index < totedge; index++) {
                CCGEdge *e = edgeMap2[index];
                unsigned int flags = 0;
+               char bweight = 0;
                int edgeIdx = GET_INT_FROM_POINTER(ccgSubSurf_getEdgeEdgeHandle(ss, e));
 
                if(!ccgSubSurf_getEdgeNumFaces(ss, e)) flags |= ME_LOOSEEDGE;
@@ -710,12 +711,14 @@ DerivedMesh *ss_to_cdderivedmesh(CCGSubSurf *ss, int ssFromEditmesh,
                        dm->getEdge(dm, edgeIdx, &origMed);
 
                        flags |= origMed.flag;
+                       bweight = origMed.bweight;
                }
 
                for(x = 0; x < edgeSize - 1; x++) {
                        med->v1 = getEdgeIndex(ss, e, x, edgeSize);
                        med->v2 = getEdgeIndex(ss, e, x + 1, edgeSize);
                        med->flag = flags;
+                       med->bweight = bweight;
                        *origIndex = ccgDM_getEdgeMapIndex(NULL, ss, e);
                        ++med;
                        ++origIndex;
index 4448231b2b4d80744a947a6e1b4851937c2558f0..6e54fae58d0eace41f87af0e4fea48dbbc3a84b8 100644 (file)
@@ -164,6 +164,7 @@ void Mat3Inv(float m1[][3], float m2[][3]);
 void Mat3CpyMat4(float m1[][3],float m2[][4]);
 void Mat4CpyMat3(float m1[][4], float m2[][3]); 
 
+void Mat3BlendMat3(float out[][3], float dst[][3], float src[][3], float srcweight);
 void Mat4BlendMat4(float out[][4], float dst[][4], float src[][4], float srcweight);
 
 float Det2x2(float a,float b,float c, float d);
index 50f8ba0fcde8e26602fceac38c6f943a8ae3fd14..f89f90f70455f5dccbfd05e56bb825871524f63c 100644 (file)
@@ -759,6 +759,28 @@ void Mat4MulSerie(float answ[][4], float m1[][4],
        }
 }
 
+void Mat3BlendMat3(float out[][3], float dst[][3], float src[][3], float srcweight)
+{
+       float squat[4], dquat[4], fquat[4];
+       float ssize[3], dsize[3], fsize[4];
+       float rmat[3][3], smat[3][3];
+       
+       Mat3ToQuat(dst, dquat);
+       Mat3ToSize(dst, dsize);
+
+       Mat3ToQuat(src, squat);
+       Mat3ToSize(src, ssize);
+       
+       /* do blending */
+       QuatInterpol(fquat, dquat, squat, srcweight);
+       VecLerpf(fsize, dsize, ssize, srcweight);
+
+       /* compose new matrix */
+       QuatToMat3(fquat, rmat);
+       SizeToMat3(fsize, smat);
+       Mat3MulMat3(out, rmat, smat);
+}
+
 void Mat4BlendMat4(float out[][4], float dst[][4], float src[][4], float srcweight)
 {
        float squat[4], dquat[4], fquat[4];
index 9fb8aad0eb671a04310117f63874ca0bdd9f9579..71db8d0bba2fc83fc6a7f6cbf3ff06ae881fc93a 100644 (file)
@@ -47,7 +47,7 @@ struct EditMesh;
 struct LaplacianSystem;
 typedef struct LaplacianSystem LaplacianSystem;
 
-LaplacianSystem *laplacian_construct_begin(int totvert, int totface);
+LaplacianSystem *laplacian_construct_begin(int totvert, int totface, int lsq);
 
 void laplacian_add_vertex(LaplacianSystem *sys, float *co, int pinned);
 void laplacian_add_triangle(LaplacianSystem *sys, int v1, int v2, int v3);
index 228530db4458616abd2d7573ec06ddeb217c15d4..a7f7bc2e4b86e48fcd93cae0635fae87ceaa4a8f 100644 (file)
 #define B_SEL_END              168
 #define B_MAN_MODE             169
 #define B_NDOF                 170
+#define B_VIEW_BUTSEDIT        171
 
 /* IPO: 200 */
 #define B_IPOHOME              201
index 5e1803a6774baedb90cdbf81b1c60d582a003c1e..950ad97a397fd4e87187713df14c13eb7e749acd 100644 (file)
@@ -130,13 +130,16 @@ static void node_composit_exec_tonemap(void *data, bNode *node, bNodeStack **in,
        if ((img==NULL) || (out[0]->hasoutput==0)) return;
 
        if (img->type != CB_RGBA)
-               new = typecheck_compbuf(img, CB_RGBA);
-       else
-               new = dupalloc_compbuf(img);
+               img = typecheck_compbuf(img, CB_RGBA);
+       
+       new = dupalloc_compbuf(img);
 
        tonemap(node->storage, new, img);
 
        out[0]->data = new;
+       
+       if(img!=in[0]->data)
+               free_compbuf(img);
 }
 
 static void node_composit_init_tonemap(bNode* node)
index 05254bca8c07e3c8358c22184ba72e2dad065b6c..c91aabc4a024ce63c2ebaa692f8d07d6b238cd08 100644 (file)
@@ -778,9 +778,6 @@ int BPY_run_script(Script *script)
        PyObject *py_dict, *py_res, *pyarg;
        Text *text = NULL;
        BPy_constant *info;
-       int len;
-       
-       FILE *fp = NULL;
        
        PyGILState_STATE gilstate = PyGILState_Ensure();
        
@@ -825,12 +822,8 @@ int BPY_run_script(Script *script)
                Py_INCREF( Py_None );
                pyarg = Py_None;
        } else {
-               if (BLI_exists(script->scriptname)) {
-                       fp = fopen( script->scriptname, "rb" );
-               }
-               
-               if( !fp ) {
-                       printf( "Error loading script: couldn't open file %s\n", script->scriptname );
+               if (!BLI_exists(script->scriptname)) {
+                       printf( "Script does not exit %s\n", script->scriptname );
                        free_libblock( &G.main->script, script );
                        PyGILState_Release(gilstate);
                        return 0;
@@ -875,51 +868,17 @@ int BPY_run_script(Script *script)
        if (text) {
                py_res = RunPython( text, py_dict );
        } else {
+               char pystring[sizeof(script->scriptname) + 15];
+               sprintf(pystring, "execfile(r'%s')", script->scriptname);
+               py_res = PyRun_String( pystring, Py_file_input, py_dict, py_dict );
+       }
+
+       if( !py_res ) {         /* Failed execution of the script */
                /* Previously we used PyRun_File to run directly the code on a FILE 
                * object, but as written in the Python/C API Ref Manual, chapter 2,
                * 'FILE structs for different C libraries can be different and 
                * incompatible'.
                * So now we load the script file data to a buffer */
-               char *buffer=NULL, *buffer_ofs=NULL, *b_to, *b_from;
-               
-               fseek( fp, 0L, SEEK_END );
-               len = ftell( fp );
-               fseek( fp, 0L, SEEK_SET );
-       
-               buffer = buffer_ofs = MEM_mallocN( len + 2, "pyfilebuf" );      /* len+2 to add '\n\0' */
-               len = fread( buffer, 1, len, fp );
-       
-               buffer[len] = '\n';     /* fix syntax error in files w/o eol */
-               buffer[len + 1] = '\0';
-               
-               
-               /* fast clean-up of dos cr/lf line endings, remove convert '\r\n's to '\n' */
-               if (*buffer_ofs == '\r' && *(buffer_ofs+1) == '\n') {
-                       buffer_ofs++;
-               }
-               b_from = b_to = buffer_ofs;
-               
-               while(*b_from != '\0') {
-                       if (*b_from == '\r' && *( b_from+1 ) == '\n') {
-                               b_from++;
-                       }
-                       if (b_from != b_to) {
-                               *b_to = *b_from;
-                       }
-                       b_to++;
-                       b_from++;
-               }
-               *b_to = '\0';
-               /* done cleaning the string */
-               
-               fclose( fp );
-               
-               py_res = PyRun_String( buffer_ofs, Py_file_input, py_dict, py_dict );
-               MEM_freeN( buffer );
-       }
-
-       if( !py_res ) {         /* Failed execution of the script */
-
                BPY_Err_Handle( script->id.name + 2 );
                ReleaseGlobalDictionary( py_dict );
                script->py_globaldict = NULL;
index 2e58cb71b90efabc3f48a150ce8ffdbbb32b094e..1b9b1041aeef4871307a0d48dfa5fdc841c56370 100644 (file)
@@ -39,6 +39,7 @@
 #include "BSE_editipo.h"
 #include "mydevice.h"
 #include "Ipo.h"
+#include "MTex.h" 
 #include "constant.h"
 #include "gen_utils.h"
 #include "gen_library.h"
@@ -206,6 +207,7 @@ static PyObject *Lamp_getQuad2( BPy_Lamp * self );
 static PyObject *Lamp_getCol( BPy_Lamp * self );
 static PyObject *Lamp_getIpo( BPy_Lamp * self );
 static PyObject *Lamp_getComponent( BPy_Lamp * self, void * closure );
+static PyObject *Lamp_getTextures( BPy_Lamp * self );
 static PyObject *Lamp_clearIpo( BPy_Lamp * self );
 static PyObject *Lamp_insertIpoKey( BPy_Lamp * self, PyObject * args );
 static PyObject *Lamp_oldsetIpo( BPy_Lamp * self, PyObject * args );
@@ -500,6 +502,10 @@ static PyGetSetDef BPy_Lamp_getseters[] = {
         (getter)Lamp_getComponent, (setter)Lamp_setComponent,
         "Lamp color blue component",
         (void *)EXPP_LAMP_COMP_B},
+       {"textures",
+        (getter)Lamp_getTextures, (setter)NULL,
+     "The Lamp's texture list as a tuple",
+        NULL},
        {"Modes",
         (getter)Lamp_getModesConst, (setter)NULL,
         "Dictionary of values for 'mode' attribute",
@@ -1393,6 +1399,30 @@ static PyObject *Lamp_getTypesConst( void )
                                      "Photon", EXPP_LAMP_TYPE_YF_PHOTON );
 }
 
+static PyObject *Lamp_getTextures( BPy_Lamp * self )
+{
+       int i;
+       PyObject *tuple;
+
+       /* build a texture list */
+       tuple = PyTuple_New( MAX_MTEX );
+       if( !tuple )
+               return EXPP_ReturnPyObjError( PyExc_MemoryError,
+                                             "couldn't create PyTuple" );
+
+       for( i = 0; i < MAX_MTEX; ++i ) {
+               struct MTex *mtex = self->lamp->mtex[i];
+               if( mtex ) {
+                       PyTuple_SET_ITEM( tuple, i, MTex_CreatePyObject( mtex, ID_LA ) );
+               } else {
+                       Py_INCREF( Py_None );
+                       PyTuple_SET_ITEM( tuple, i, Py_None );
+               }
+       }
+
+       return tuple;
+}
+
 /* #####DEPRECATED###### */
 
 static PyObject *Lamp_oldsetSamples( BPy_Lamp * self, PyObject * args )
index a95836f0596e68a0da2058e9f015e70480dc7542..fa7c62ac8d6398ddc20af518608814a8ea230b56 100644 (file)
@@ -26,6 +26,7 @@
  *
  * ***** END GPL LICENSE BLOCK *****
 */
+
 #include "MTex.h" /*This must come first*/
 
 #include "BKE_utildefines.h"
@@ -252,7 +253,7 @@ PyObject *MTex_Init( void )
        return submodule;
 }
 
-PyObject *MTex_CreatePyObject( MTex * mtex )
+PyObject *MTex_CreatePyObject( MTex * mtex, unsigned short type )
 {
        BPy_MTex *pymtex;
 
@@ -262,6 +263,7 @@ PyObject *MTex_CreatePyObject( MTex * mtex )
                                              "couldn't create BPy_MTex PyObject" );
 
        pymtex->mtex = mtex;
+       pymtex->type = type;
        return ( PyObject * ) pymtex;
 }
 
@@ -286,7 +288,12 @@ static int MTex_compare( BPy_MTex * a, BPy_MTex * b )
 
 static PyObject *MTex_repr( BPy_MTex * self )
 {
-       return PyString_FromFormat( "[MTex]" );
+       if( self->type == ID_MA )
+               return PyString_FromFormat( "[MTex (Material)]" );
+       else if( self->type == ID_LA )
+               return PyString_FromFormat( "[MTex (Lamp)]" );
+       else
+               return PyString_FromFormat( "[MTex (World)]" );
 }
 
 
@@ -350,6 +357,10 @@ static int MTex_setObject( BPy_MTex *self, PyObject *value, void *closure)
 
 static PyObject *MTex_getUVLayer( BPy_MTex *self, void *closure )
 {
+       if( self->type != ID_MA )
+               return EXPP_ReturnPyObjError( PyExc_AttributeError,
+                               "not a Material MTex object" );
+
        return PyString_FromString(self->mtex->uvname);
 }
 
@@ -364,6 +375,10 @@ static int MTex_setUVLayer( BPy_MTex *self, PyObject *value, void *closure)
 
 static PyObject *MTex_getMapTo( BPy_MTex *self, void *closure )
 {
+       if( self->type != ID_MA )
+               return EXPP_ReturnPyObjError( PyExc_AttributeError,
+                               "not a Material MTex object" );
+
        return PyInt_FromLong( self->mtex->mapto );
 }
 
@@ -371,18 +386,20 @@ static int MTex_setMapTo( BPy_MTex *self, PyObject *value, void *closure)
 {
        int mapto;
 
-       if( !PyInt_Check( value ) ) {
+       if( self->type != ID_MA )
+               return EXPP_ReturnIntError( PyExc_AttributeError,
+                               "not a material MTex object" );
+
+       if( !PyInt_Check( value ) )
                return EXPP_ReturnIntError( PyExc_TypeError,
-                       "expected an int" );
-       }
+                               "expected an int" );
 
        mapto = PyInt_AsLong( value );
 
        /* This method is deprecated anyway. */
-       if ( mapto < 0 || mapto > 16383 ) {
+       if ( mapto < 0 || mapto > 16383 )
                return EXPP_ReturnIntError( PyExc_ValueError,
                        "Value must be a sum of values from Texture.MapTo dictionary" );
-       }
 
        self->mtex->mapto = (short)mapto;
 
@@ -400,11 +417,9 @@ static int MTex_setCol( BPy_MTex *self, PyObject *value, void *closure)
        float rgb[3];
        int i;
 
-       if( !PyArg_ParseTuple( value, "fff",
-               &rgb[0], &rgb[1], &rgb[2] ) )
-
+       if( !PyArg_ParseTuple( value, "fff", &rgb[0], &rgb[1], &rgb[2] ) )
                return EXPP_ReturnIntError( PyExc_TypeError,
-                                             "expected tuple of 3 floats" );
+                               "expected tuple of 3 floats" );
 
        for( i = 0; i < 3; ++i )
                if( rgb[i] < 0 || rgb[i] > 1 )
@@ -478,117 +493,84 @@ static PyObject *MTex_getColFac( BPy_MTex *self, void *closure )
 
 static int MTex_setColFac( BPy_MTex *self, PyObject *value, void *closure)
 {
-       float f;
-
-       if ( !PyFloat_Check( value ) )
-               return EXPP_ReturnIntError( PyExc_TypeError,
-                                               "expected a float" );
-
-       f = (float)PyFloat_AsDouble(value);
-
-       if (f < 0 || f > 1)
-               return EXPP_ReturnIntError( PyExc_ValueError,
-                                             "values must be in range [0,1]" );
-
-       self->mtex->colfac = f;
-
-       return 0;
+       return EXPP_setFloatRange( value, &self->mtex->colfac, 0.0f, 1.0f );
 }
 
 static PyObject *MTex_getNorFac( BPy_MTex *self, void *closure )
 {
+       if( self->type == ID_LA )
+               return EXPP_ReturnPyObjError( PyExc_AttributeError,
+                               "not a material or world MTex object" );
+
        return PyFloat_FromDouble(self->mtex->norfac);
 }
 
 static int MTex_setNorFac( BPy_MTex *self, PyObject *value, void *closure)
 {
-       float f;
-
-       if ( !PyFloat_Check( value ) )
-               return EXPP_ReturnIntError( PyExc_TypeError,
-                                               "expected a float" );
-
-       f = (float)PyFloat_AsDouble(value);
-
-       if (f < 0 || f > 25)
-               return EXPP_ReturnIntError( PyExc_ValueError,
-                                             "values must be in range [0,25]" );
-
-       self->mtex->norfac = f;
-
-       return 0;
+       switch( self->type )
+       {
+       case ID_WO:
+               return EXPP_setFloatRange( value, &self->mtex->norfac, 0.0f, 1.0f );
+       case ID_MA:
+               return EXPP_setFloatRange( value, &self->mtex->norfac, 0.0f, 25.0f );
+       default:
+               return EXPP_ReturnIntError( PyExc_AttributeError,
+                               "not a material or world MTex object" );
+       }
 }
 
 static PyObject *MTex_getVarFac( BPy_MTex *self, void *closure )
 {
+       if( self->type == ID_LA )
+               return EXPP_ReturnPyObjError( PyExc_AttributeError,
+                               "not a material or world MTex object" );
+
        return PyFloat_FromDouble(self->mtex->varfac);
 }
 
 static int MTex_setVarFac( BPy_MTex *self, PyObject *value, void *closure)
 {
-       float f;
-
-       if ( !PyFloat_Check( value ) )
-               return EXPP_ReturnIntError( PyExc_TypeError,
-                                               "expected a float" );
-
-       f = (float)PyFloat_AsDouble(value);
-
-       if (f < 0 || f > 1)
-               return EXPP_ReturnIntError( PyExc_ValueError,
-                                             "values must be in range [0,1]" );
+       if( self->type == ID_LA )
+               return EXPP_ReturnIntError( PyExc_AttributeError,
+                               "not a material or world MTex object" );
 
-       self->mtex->varfac = f;
-
-       return 0;
+       return EXPP_setFloatRange( value, &self->mtex->varfac, 0.0f, 1.0f );
 }
 
 static PyObject *MTex_getDispFac( BPy_MTex *self, void *closure )
 {
+       if( self->type != ID_MA )
+               return EXPP_ReturnPyObjError( PyExc_AttributeError,
+                               "not a material MTex object" );
+
        return PyFloat_FromDouble(self->mtex->dispfac);
 }
 
 static int MTex_setDispFac( BPy_MTex *self, PyObject *value, void *closure)
 {
-       float f;
-
-       if ( !PyFloat_Check( value ) )
-               return EXPP_ReturnIntError( PyExc_TypeError,
-                                               "expected a float" );
-
-       f = (float)PyFloat_AsDouble(value);
-
-       if (f < 0 || f > 1)
-               return EXPP_ReturnIntError( PyExc_ValueError,
-                                             "values must be in range [0,1]" );
-
-       self->mtex->dispfac = f;
+       if( self->type != ID_MA )
+               return EXPP_ReturnIntError( PyExc_AttributeError,
+                               "not a material MTex object" );
 
-       return 0;
+       return EXPP_setFloatRange( value, &self->mtex->dispfac, 0.0f, 1.0f );
 }
 
 static PyObject *MTex_getWarpFac( BPy_MTex *self, void *closure )
 {
+       if( self->type != ID_MA )
+               return EXPP_ReturnPyObjError( PyExc_AttributeError,
+                               "not a material MTex object" );
+
        return PyFloat_FromDouble(self->mtex->warpfac);
 }
 
 static int MTex_setWarpFac( BPy_MTex *self, PyObject *value, void *closure)
 {
-       float f;
+       if( self->type != ID_MA )
+               return EXPP_ReturnIntError( PyExc_AttributeError,
+                               "not a material MTex object" );
 
-       if ( !PyFloat_Check( value ) )
-               return EXPP_ReturnIntError( PyExc_TypeError,
-                                               "expected a float" );
-
-       f = (float)PyFloat_AsDouble(value);
-
-       if (f < 0 || f > 1)
-               return EXPP_ReturnIntError( PyExc_ValueError,
-                                             "values must be in range [0,1]" );
-
-       self->mtex->warpfac = f;
-
-       return 0;
+       return EXPP_setFloatRange( value, &self->mtex->warpfac, 0.0f, 1.0f );
 }
 
 static PyObject *MTex_getOfs( BPy_MTex *self, void *closure )
@@ -601,16 +583,24 @@ static int MTex_setOfs( BPy_MTex *self, PyObject *value, void *closure)
 {
        float f[3];
        int i;
+       float max;
 
        if( !PyArg_ParseTuple( value, "fff", &f[0], &f[1], &f[2] ) )
-
                return EXPP_ReturnIntError( PyExc_TypeError,
                                              "expected tuple of 3 floats" );
 
+       if( self->type == ID_MA )
+               max = 10.0f;
+       else
+               max = 20.0f;
+
        for( i = 0; i < 3; ++i )
-               if( f[i] < -10 || f[i] > 10 )
-                       return EXPP_ReturnIntError( PyExc_ValueError,
-                                             "values must be in range [-10,10]" );
+               if( f[i] < -max || f[i] > max ) {
+                       char errstr[64];
+                       sprintf( errstr, "values must be in range [-%6.0f,%6.0f]",
+                                       max, max );
+                       return EXPP_ReturnIntError( PyExc_ValueError, errstr );
+               }
 
        self->mtex->ofs[0] = f[0];
        self->mtex->ofs[1] = f[1];
@@ -649,6 +639,10 @@ static int MTex_setSize( BPy_MTex *self, PyObject *value, void *closure)
 
 static PyObject *MTex_getMapping( BPy_MTex *self, void *closure )
 {
+       if( self->type != ID_MA )
+               return EXPP_ReturnPyObjError( PyExc_AttributeError,
+                               "not a material MTex object" );
+
        return PyInt_FromLong( self->mtex->mapping );
 }
 
@@ -656,6 +650,11 @@ static int MTex_setMapping( BPy_MTex *self, PyObject *value, void *closure)
 {
        int n;
 
+       if( self->type != ID_MA )
+               return EXPP_ReturnIntError( PyExc_AttributeError,
+                               "not a material MTex object" );
+
+
        if ( !PyInt_Check( value ) )
                return EXPP_ReturnIntError( PyExc_TypeError,
                                "Value must be member of Texture.Mappings dictionary" );
@@ -664,8 +663,7 @@ static int MTex_setMapping( BPy_MTex *self, PyObject *value, void *closure)
 
 /*     if (n != MTEX_FLAT && n != MTEX_TUBE && n != MTEX_CUBE &&
                n != MTEX_SPHERE) */
-       if (n < 0 || n > 3)
-       {
+       if (n < 0 || n > 3) {
                return EXPP_ReturnIntError( PyExc_ValueError,
                            "Value must be member of Texture.Mappings dictionary" );
        }
@@ -696,6 +694,10 @@ static int MTex_setFlag( BPy_MTex *self, PyObject *value, void *closure)
 
 static PyObject *MTex_getProjX( BPy_MTex *self, void *closure )
 {
+       if( self->type != ID_MA )
+               return EXPP_ReturnPyObjError( PyExc_AttributeError,
+                               "not a material MTex object" );
+
        return PyInt_FromLong( self->mtex->projx );
 }
 
@@ -703,6 +705,10 @@ static int MTex_setProjX( BPy_MTex *self, PyObject *value, void *closure)
 {
        int proj;
 
+       if( self->type != ID_MA )
+               return EXPP_ReturnIntError( PyExc_AttributeError,
+                               "not a material MTex object" );
+
        if( !PyInt_Check( value ) ) {
                return EXPP_ReturnIntError( PyExc_TypeError,
                        "Value must be a member of Texture.Proj dictionary" );
@@ -722,6 +728,10 @@ static int MTex_setProjX( BPy_MTex *self, PyObject *value, void *closure)
 
 static PyObject *MTex_getProjY( BPy_MTex *self, void *closure )
 {
+       if( self->type != ID_MA )
+               return EXPP_ReturnPyObjError( PyExc_AttributeError,
+                               "not a material MTex object" );
+
        return PyInt_FromLong( self->mtex->projy );
 }
 
@@ -729,6 +739,10 @@ static int MTex_setProjY( BPy_MTex *self, PyObject *value, void *closure )
 {
        int proj;
 
+       if( self->type != ID_MA )
+               return EXPP_ReturnIntError( PyExc_AttributeError,
+                               "not a material MTex object" );
+
        if( !PyInt_Check( value ) ) {
                return EXPP_ReturnIntError( PyExc_TypeError,
                        "Value must be a member of Texture.Proj dictionary" );
@@ -748,6 +762,10 @@ static int MTex_setProjY( BPy_MTex *self, PyObject *value, void *closure )
 
 static PyObject *MTex_getProjZ( BPy_MTex *self, void *closure )
 {
+       if( self->type != ID_MA )
+               return EXPP_ReturnPyObjError( PyExc_AttributeError,
+                               "not a material MTex object" );
+
        return PyInt_FromLong( self->mtex->projz );
 }
 
@@ -755,6 +773,10 @@ static int MTex_setProjZ( BPy_MTex *self, PyObject *value, void *closure)
 {
        int proj;
 
+       if( self->type != ID_MA )
+               return EXPP_ReturnIntError( PyExc_AttributeError,
+                               "not a material MTex object" );
+
        if( !PyInt_Check( value ) ) {
                return EXPP_ReturnIntError( PyExc_TypeError,
                        "Value must be a member of Texture.Proj dictionary" );
@@ -776,12 +798,14 @@ static PyObject *MTex_getMapToFlag( BPy_MTex *self, void *closure )
 {
        int flag = GET_INT_FROM_POINTER(closure);
 
+       if( self->type != ID_MA )
+               return EXPP_ReturnPyObjError( PyExc_AttributeError,
+                               "not a material MTex object" );
+
        if ( self->mtex->mapto & flag )
-       {
                return PyInt_FromLong( ( self->mtex->maptoneg & flag ) ? -1 : 1 );
-       } else {
+       else
                return PyInt_FromLong( 0 );
-       }
 }
 
 static int MTex_setMapToFlag( BPy_MTex *self, PyObject *value, void *closure)
@@ -789,14 +813,17 @@ static int MTex_setMapToFlag( BPy_MTex *self, PyObject *value, void *closure)
        int flag = GET_INT_FROM_POINTER(closure);
        int intVal;
 
+       if( self->type != ID_MA )
+               return EXPP_ReturnIntError( PyExc_AttributeError,
+                               "not a material MTex object" );
+
        if ( !PyInt_Check( value ) )
                return EXPP_ReturnIntError( PyExc_TypeError,
                                "expected an int");
 
-       intVal = PyInt_AsLong( value );
+       intVal = PyInt_AsLong( value ) ;
 
-       if (flag == MAP_COL || flag == MAP_COLSPEC || flag == MAP_COLMIR ||
-               flag == MAP_WARP) {
+       if( flag & ( MAP_COL | MAP_COLSPEC | MAP_COLMIR | MAP_WARP ) ) {
                if (intVal < 0 || intVal > 1) {
                        return EXPP_ReturnIntError( PyExc_ValueError,
                                "value for that mapping must be 0 or 1" );
index 5e67ebc47caa4ccb38c64e77ba8536f6a61c480e..b6c98a40d2ebfebe03ad76160190a039c7fcc307 100644 (file)
 /* Python BPy_MTex structure definition                                      */
 /*****************************************************************************/
 
+#define        MATERIAL_MTEX_TYPE      1
+#define        WORLD_MTEX_TYPE 2
+#define        LAMP_MTEX_TYPE  3
+
 typedef struct {
        PyObject_HEAD
        MTex * mtex;
+       unsigned short type;
 } BPy_MTex;
 
 extern PyTypeObject MTex_Type;
 
 #define BPy_MTex_Check(v)  ((v)->ob_type == &MTex_Type)
 
-
 /*****************************************************************************/
 /* Module Blender.Texture.MTex - public functions                            */
 /*****************************************************************************/
 
 PyObject *MTex_Init( void );
-PyObject *MTex_CreatePyObject( struct MTex *obj );
+PyObject *MTex_CreatePyObject( struct MTex *obj, unsigned short type );
 MTex *MTex_FromPyObject( PyObject * py_obj );
 
 
index 54c2d9b20bd09e3e728c1ef2ba00897b23d9cf00..e32b87da240a0e46340c51f1ec7348b04eb55ea9 100644 (file)
@@ -555,6 +555,7 @@ static int Material_setSssFront( BPy_Material * self, PyObject * value );
 static int Material_setSssBack( BPy_Material * self, PyObject * value );
 static int Material_setSssBack( BPy_Material * self, PyObject * value );
 static int Material_setTexChannel( BPy_Material * self, PyObject * value );
+static int Material_setTextures( BPy_Material * self, PyObject * value );
 
 static PyObject *Material_getColorComponent( BPy_Material * self,
                                                        void * closure );
@@ -1168,6 +1169,10 @@ static PyGetSetDef BPy_Material_getseters[] = {
         (getter)Material_getColorband, (setter)Material_setColorband,
         "The specular colorband for this material",
         (void *) 1},
+       {"textures",
+        (getter)Material_getTextures, (setter)Material_setTextures,
+        "The Material's texture list as a tuple",
+        NULL},
        
        /* SSS settings */
        {"enableSSS",
@@ -1737,28 +1742,24 @@ static PyObject* Material_getSssBack( BPy_Material * self )
 static PyObject *Material_getTextures( BPy_Material * self )
 {
        int i;
-       struct MTex *mtex;
-       PyObject *t[MAX_MTEX];
        PyObject *tuple;
 
        /* build a texture list */
-       for( i = 0; i < MAX_MTEX; ++i ) {
-               mtex = self->material->mtex[i];
+       tuple = PyTuple_New( MAX_MTEX );
+       if( !tuple )
+               return EXPP_ReturnPyObjError( PyExc_MemoryError,
+                                             "couldn't create PyTuple" );
 
+       for( i = 0; i < MAX_MTEX; ++i ) {
+               struct MTex *mtex = self->material->mtex[i];
                if( mtex ) {
-                       t[i] = MTex_CreatePyObject( mtex );
+                       PyTuple_SET_ITEM( tuple, i, MTex_CreatePyObject( mtex, ID_MA ) );
                } else {
                        Py_INCREF( Py_None );
-                       t[i] = Py_None;
+                       PyTuple_SET_ITEM( tuple, i, Py_None );
                }
        }
 
-       /* turn the array into a tuple */
-       tuple = Py_BuildValue( "NNNNNNNNNNNNNNNNNN", t[0], t[1], t[2], t[3], t[4], t[5], t[6], t[7], t[8], t[9], t[10], t[11], t[12], t[13], t[14], t[15], t[16], t[17] );
-       if( !tuple )
-               return EXPP_ReturnPyObjError( PyExc_MemoryError,
-                                             "Material_getTextures: couldn't create PyTuple" );
-
        return tuple;
 }
 
@@ -2432,14 +2433,83 @@ static PyObject *Material_setTexture( BPy_Material * self, PyObject * args )
        Py_RETURN_NONE;
 }
 
+static int Material_setTextures( BPy_Material * self, PyObject * value )
+{
+       int i;
+
+       if( !PyList_Check( value ) && !PyTuple_Check( value ) )
+               return EXPP_ReturnIntError( PyExc_TypeError,
+                                               "expected tuple or list of integers" );
+
+       /* don't allow more than MAX_MTEX items */
+       if( PySequence_Size(value) > MAX_MTEX )
+               return EXPP_ReturnIntError( PyExc_AttributeError,
+                                               "size of sequence greater than number of allowed textures" );
+
+       /* get a fast sequence; in Python 2.5, this just return the original
+        * list or tuple and INCREFs it, so we must DECREF */
+       value = PySequence_Fast( value, "" );
+
+       /* check the list for valid entries */
+       for( i= 0; i < PySequence_Size(value) ; ++i ) {
+               PyObject *item = PySequence_Fast_GET_ITEM( value, i );
+               if( item != Py_None && !BPy_MTex_Check( item ) ) {
+                       Py_DECREF(value);
+                       return EXPP_ReturnIntError( PyExc_TypeError,
+                                       "expected tuple or list containing MTex objects and NONE" );
+               }
+       }
+
+       /* for each MTex object, copy to this structure */
+       for( i= 0; i < PySequence_Size(value) ; ++i ) {
+               PyObject *item = PySequence_Fast_GET_ITEM( value, i );
+               struct MTex *mtex = self->material->mtex[i];
+               if( item != Py_None ) {
+                       BPy_MTex *obj = (BPy_MTex *)item;
+
+                       /* if MTex is already at this location, just skip it */
+                       if( obj->mtex == mtex ) continue;
+
+                       /* create a new entry if needed, otherwise update reference count
+                        * for texture that is being replaced */
+                       if( !mtex )
+                               mtex = self->material->mtex[i] = add_mtex(  );
+                       else
+                               mtex->tex->id.us--;
+
+                       /* copy the data */
+                       mtex->tex = obj->mtex->tex;
+                       id_us_plus( &mtex->tex->id );
+                       mtex->texco = obj->mtex->texco;
+                       mtex->mapto = obj->mtex->mapto;
+               }
+       }
+
+       /* now go back and free any entries now marked as None */
+       for( i= 0; i < PySequence_Size(value) ; ++i ) {
+               PyObject *item = PySequence_Fast_GET_ITEM( value, i );
+               struct MTex *mtex = self->material->mtex[i];
+               if( item == Py_None && mtex ) {
+                       mtex->tex->id.us--;
+                       MEM_freeN( mtex );
+                       self->material->mtex[i] = NULL;
+               } 
+       }
+
+       Py_DECREF(value);
+       return 0;
+}
+
 static PyObject *Material_clearTexture( BPy_Material * self, PyObject * value )
 {
        int texnum = (int)PyInt_AsLong(value);
        struct MTex *mtex;
        /* non ints will be -1 */
-       if( ( texnum < 0 ) || ( texnum >= MAX_MTEX ) )
-               return EXPP_ReturnPyObjError( PyExc_TypeError,
-                                             "expected int in [0,9]" );
+       if( ( texnum < 0 ) || ( texnum >= MAX_MTEX ) ) {
+               char errstr[64];
+               sprintf( errstr, "expected int in [0,%d]", MAX_MTEX );
+               return EXPP_ReturnPyObjError( PyExc_TypeError, errstr );
+       }
 
        mtex = self->material->mtex[texnum];
        if( mtex ) {
index bc65426e16c1e332fde279c4e896e7568bda2db1..893ee077d67e789407628e1e4ac3cdd1c612fa0b 100644 (file)
@@ -526,15 +526,18 @@ throws NameError if name not found
 
 PyObject *M_ParticleSys_Get( PyObject * self, PyObject * args ) 
 {
+#if 1
+       return EXPP_ReturnPyObjError( PyExc_NotImplementedError,
+               "Particle.Get() not implemented" );
+#else
        ParticleSettings *psys_iter;
        char *name = NULL;
-#if 0
 
        ParticleSystem *blparticlesys = 0;
        Object *ob;
 
        PyObject *partsyslist,*current;
-#endif
+
        if( !PyArg_ParseTuple( args, "|s", &name ) )
                return EXPP_ReturnPyObjError( PyExc_TypeError,
                                "expected string argument" );
@@ -577,7 +580,6 @@ PyObject *M_ParticleSys_Get( PyObject * self, PyObject * args )
                }
                
                while( psys_iter ){
-#if 0
                        pyobj = ParticleSystem_CreatePyObject( psys_iter);
                        if( !pyobj){
                                Py_DECREF( pylist );
@@ -586,7 +588,6 @@ PyObject *M_ParticleSys_Get( PyObject * self, PyObject * args )
                                        "could not create ParticleSystem PyObject");
                        }
                        PyList_SET_ITEM( pylist, index, pyobj);
-#endif
                        printf("name is %s\n", psys_iter->id.name+2);
                        psys_iter = psys_iter->id.next;
                        index++;
@@ -596,10 +597,6 @@ PyObject *M_ParticleSys_Get( PyObject * self, PyObject * args )
                        
        }
                        
-               
-
-#if 0
-
        for( ob = G.main->particlesystem.first; ob; ob = ob->id.next )
                if( !strcmp( name, ob->id.name + 2 ) )
                        break;
@@ -626,7 +623,6 @@ PyObject *M_ParticleSys_Get( PyObject * self, PyObject * args )
        }
 
        return partsyslist;
-
 #endif
 }
 
index 6021f8552adbe00fa1acce34cefb8094b52cdd3f..3901e8296fb0508c831b070bc0c3543274f895e9 100644 (file)
@@ -52,6 +52,7 @@
 #include "BIF_space.h"
 #include "mydevice.h"
 #include "Ipo.h"
+#include "MTex.h"
 #include "gen_utils.h"
 #include "gen_library.h"
 
@@ -99,6 +100,7 @@ static PyObject *World_getScriptLinks( BPy_World * self, PyObject * value );
 static PyObject *World_addScriptLink( BPy_World * self, PyObject * args );
 static PyObject *World_clearScriptLinks( BPy_World * self, PyObject * args );
 static PyObject *World_setCurrent( BPy_World * self );
+static PyObject *World_getTextures( BPy_World * self );
 static PyObject *World_copy( BPy_World * self );
 
 
@@ -250,6 +252,9 @@ static PyGetSetDef BPy_World_getseters[] = {
         "world mist settings", NULL},
        {"ipo", (getter)World_getIpo, (setter)World_setIpo,
         "world ipo", NULL},
+    {"textures", (getter)World_getTextures, (setter)NULL,
+     "The World's texture list as a tuple",
+     NULL},
        {NULL,NULL,NULL,NULL,NULL}  /* Sentinel */
 };
 
@@ -1029,3 +1034,27 @@ static PyObject *World_insertIpoKey( BPy_World * self, PyObject * args )
 
        Py_RETURN_NONE;
 }
+
+static PyObject *World_getTextures( BPy_World * self )
+{
+       int i;
+       PyObject *tuple;
+
+       /* build a texture list */
+       tuple = PyTuple_New( MAX_MTEX );
+       if( !tuple )
+               return EXPP_ReturnPyObjError( PyExc_MemoryError,
+                                             "couldn't create PyTuple" );
+
+       for( i = 0; i < MAX_MTEX; ++i ) {
+               struct MTex *mtex = self->world->mtex[i];
+               if( mtex ) {
+                       PyTuple_SET_ITEM( tuple, i, MTex_CreatePyObject( mtex, ID_WO ) );
+               } else {
+                       Py_INCREF( Py_None );
+                       PyTuple_SET_ITEM( tuple, i, Py_None );
+               }
+       }
+
+       return tuple;
+}
index a7a1fb9462014186fbd6888b2bd0929fc2f0909d..162d94ccff318b82349c1ff2b8ee03967394f81a 100644 (file)
@@ -161,6 +161,8 @@ class Lamp:
        @type type:  int
        @ivar falloffType:  Lamp falloff type.  See L{Falloffs} for values.
        @type falloffType:  int
+       @type textures: a tuple of Blender MTex objects.
+       @ivar textures: The Lamp's texture list.  Empty texture channels contains None.
 
        @warning: Most member variables assume values in some [Min, Max] interval.
                When trying to set them, the given parameter will be clamped to lie in
index 02f7edd77f533d5fdb7132670e10ed763a96cfd6..05497cf551c551a13369467a555adeb2ddd978da 100644 (file)
@@ -338,7 +338,9 @@ class Material:
                        ch.append(4)
                        mat.enabledTextures = ch
                        print mat.enabledTextures # will print: [0, 4, 6]
-       
+
+       @type textures: a tuple of Blender MTex objects.
+       @ivar textures: the Material's Texture list.  Empty texture channels contains None.
        @ivar enableSSS:  If True, subsurface scattering will be rendered on this material.
        @type enableSSS:  bool
        @ivar sssScale:  If True, subsurface scattering will be rendered on this material.
index cebb7de70115b6e36cebd40b498a1b9ba16089e2..223c5e6ebddb7089667523a6335fdae879cd88be 100644 (file)
@@ -500,48 +500,84 @@ class MTex:
        This object links a material to a texture. It allows the same texture to be
        used in several different ways.
 
-       @ivar tex: The Texture this is linked to.
-       @type tex: Blender Texture
-       @ivar texco: Texture coordinates ("Map input"). See L{TexCo}
-       @ivar mapto: "Map to" field of texture. OR'd values of L{MapTo}
-       @ivar object: Object whose space to use when texco is Object
-       @type object: Blender Object
-       @ivar col: Color that the texture blends with
-       @ivar dvar: Value that the texture blends with when not blending colors
-       @ivar blendmode: Texture blending mode. L{BlendModes}
-       @ivar colfac: Factor by which texture affects color
-       @ivar norfac: Factor by which texture affects normal
-       @ivar varfac: Factor by which texture affects most variables
-       @ivar dispfac: Factor by which texture affects displacement
-       @ivar warpfac: Factor by which texture affects warp
-       @ivar ofs: Offset to adjust texture space
-       @ivar size: Size to scale texture space
-       @ivar mapping: Mapping of texture coordinates (flat, cube, etc.). L{Mappings}
-       @ivar stencil: Stencil mode
-       @ivar neg: Negate texture values mode
-       @ivar noRGB: Convert texture RGB values to intensity values
-       @ivar correctNor: Correct normal mapping for Texture space and Object space
-       @ivar fromDupli: Dupli's instanced from verts, faces or particles, inherit texture coordinate from their parent
-       @ivar fromOrig: Dupli's derive their object coordinates from the original objects transformation
-       @ivar xproj: Projection of X axis to Texture space. L{Proj}
-       @ivar yproj: Projection of Y axis to Texture space. L{Proj}
-       @ivar zproj: Projection of Z axis to Texture space. L{Proj}
-       @ivar mtCol: How texture maps to color
-       @ivar mtNor: How texture maps to normals
-       @ivar mtCsp: How texture maps to specularity color
-       @ivar mtCmir: How texture maps to mirror color
-       @ivar mtRef: How texture maps to reflectivity
-       @ivar mtSpec: How texture maps to specularity
-       @ivar mtEmit: How texture maps to emit value
-       @ivar mtAlpha: How texture maps to alpha value
-       @ivar mtHard: How texture maps to hardness
-       @ivar mtRayMir: How texture maps to RayMir value
-       @ivar mtTranslu: How texture maps to translucency
-       @ivar mtAmb: How texture maps to ambient value
-       @ivar mtDisp: How texture maps to displacement
-       @ivar mtWarp: How texture maps to warp
-       @ivar uvlayer: The name of the UV Layer this texture is mapped to (when left blank uses render layer)
-       @type uvlayer: string
+    @type blendmode: int
+    @ivar blendmode: Texture blending mode. See L{BlendModes}
+    @type col: tuple
+    @ivar col: Color that the texture blends with.  Range of.
+    @type colfac: float
+    @ivar colfac: Factor by which texture affects color.
+    @ivar correctNor: Correct normal mapping for Texture space and Object space.
+    @type correctNor: boolean
+    @type dispfac: float
+    @ivar dispfac: Factor by which texture affects displacement.
+    @type dvar: float
+    @ivar dvar: Value that the texture blends with when not blending colors.
+    @type fromDupli: boolean
+    @ivar fromDupli: Duplis instanced from verts, faces or particles, inherit texture coordinate from their parent.
+    @type fromOrig: boolean
+    @ivar fromOrig: Duplis derive their object coordinates from the original objects transformation.
+    @type mapping: int
+    @ivar mapping: Mapping of texture coordinates (flat, cube, etc.).  See L{Mappings}.
+    @type mapto: int
+    @ivar mapto: "Map to" field of texture. OR'd values of L{MapTo}.
+    @ivar mtAlpha: How texture maps to alpha value.
+    @type mtAlpha: int
+    @ivar mtAmb: How texture maps to ambient value.
+    @type mtAmb: int
+    @ivar mtCmir: How texture maps to mirror color.
+    @type mtCmir: int
+    @ivar mtCol: How texture maps to color.
+    @type mtCol: int
+    @ivar mtCsp: How texture maps to specularity color
+    @type mtCsp: int
+    @ivar mtDisp: How texture maps to displacement
+    @type mtDisp: int
+    @ivar mtEmit: How texture maps to emit value
+    @type mtEmit: int
+    @ivar mtHard: How texture maps to hardness
+    @type mtHard: int
+    @ivar mtNor: How texture maps to normals
+    @type mtNor: int
+    @ivar mtRayMir: How texture maps to RayMir value
+    @type mtRayMir: int
+    @ivar mtRef: How texture maps to reflectivity
+    @type mtRef: int
+    @ivar mtSpec: How texture maps to specularity
+    @type mtSpec: int
+    @ivar mtTranslu: How texture maps to translucency
+    @type mtTranslu: int
+    @ivar mtWarp: How texture maps to warp
+    @type mtWarp: int
+    @ivar neg: Negate texture values mode
+    @type neg: boolean
+    @ivar norfac: Factor by which texture affects normal
+    @type norfac: float
+    @ivar noRGB: Convert texture RGB values to intensity values
+    @type noRGB: boolean
+    @ivar object: Object whose space to use when texco is Object
+    @type object: Blender Object or None
+    @type ofs: tuple
+    @ivar ofs: Offset to adjust texture space
+    @type size: tuple
+    @ivar size: Size to scale texture space
+    @ivar stencil: Stencil mode
+    @type stencil: boolean
+    @ivar tex: The Texture this is linked to.
+    @type tex: Blender Texture
+    @ivar texco: Texture coordinates ("Map input"). See L{TexCo}
+    @type texco: int
+    @ivar uvlayer: The name of the UV Layer this texture is mapped to (when left blank uses render layer)
+    @type uvlayer: string
+    @type varfac: float
+    @ivar varfac: Factor by which texture affects most variables
+    @type warpfac: float
+    @ivar warpfac: Factor by which texture affects warp
+    @type xproj: int
+    @ivar xproj: Projection of X axis to Texture space. See L{Proj}
+    @type yproj: int
+    @ivar yproj: Projection of Y axis to Texture space. See L{Proj}
+    @type zproj: int
+    @ivar zproj: Projection of Z axis to Texture space. See L{Proj}
        """
 
        def getIpo():
index d9e9bae750dc6e57f50e3cf94e2de0c9806cb70a..d8052c609cda909ca61d6629af52ad767a1763c1 100644 (file)
@@ -82,6 +82,8 @@ class World:
        @ivar mist: the mist parameters  of a world object. See getMist for the semantics of these parameters. 
        @type ipo: Blender Ipo
        @ivar ipo: The world type ipo linked to this world object.
+       @type textures: a tuple of Blender MTex objects.
+       @ivar textures: The World's texture list.  Empty texture channels contains None.
        """
 
        def getRange():
index 9ee6f873f3f441477d0fcd56b0b89b0eb3e00bf6..322d2066a6cc5fea220af68447692a16e703aa0a 100644 (file)
@@ -4578,17 +4578,19 @@ static int allow_render_object(Object *ob, int nolamps, int onlyselected, Object
 static int allow_render_dupli_instance(Render *re, DupliObject *dob, Object *obd)
 {
        ParticleSystem *psys;
-       Material ***material;
+       Material *ma;
        short a, *totmaterial;
 
-       /* don't allow objects with halos */
+       /* don't allow objects with halos. we need to have
+        * all halo's to sort them globally in advance */
        totmaterial= give_totcolp(obd);
-       material= give_matarar(obd);
 
-       if(totmaterial && material) {
-               for(a= 0; a<*totmaterial; a++)
-                       if((*material)[a] && (*material)[a]->mode & MA_HALO)
+       if(totmaterial) {
+               for(a= 0; a<*totmaterial; a++) {
+                       ma= give_current_material(obd, a);
+                       if(ma && (ma->mode & MA_HALO))
                                return 0;
+               }
        }
 
        for(psys=obd->particlesystem.first; psys; psys=psys->next)
index 5b8cedfce78901990f9ddfa92ac7f0094f6afd98..bda02bea8d7a832c44d74c851a25ec570f21fe93 100644 (file)
@@ -158,7 +158,7 @@ static int calchalo_z(HaloRen *har, int zz)
 {
        
        if(har->type & HA_ONLYSKY) {
-               if(zz!=0x7FFFFFFF) zz= - 0x7FFFFF;
+               if(zz < 0x7FFFFFF0) zz= - 0x7FFFFF;     /* edge render messes zvalues */
        }
        else {
                zz= (zz>>8);
index 98b1426e8ff2a6b41c3aba19295ff0818b95575e..d44b49cc7065a812d603db7928141e2f247235b9 100644 (file)
@@ -483,16 +483,16 @@ void RE_set_customdata_names(ObjectRen *obr, CustomData *data)
           DerivedMesh which stores the layers is freed */
        
        CustomDataLayer *layer;
-       int numlayers, i, mtfn, mcn;
+       int numtf = 0, numcol = 0, i, mtfn, mcn;
 
        if (CustomData_has_layer(data, CD_MTFACE)) {
-               numlayers= CustomData_number_of_layers(data, CD_MTFACE);
-               obr->mtface= MEM_callocN(sizeof(*obr->mtface)*numlayers, "mtfacenames");
+               numtf= CustomData_number_of_layers(data, CD_MTFACE);
+               obr->mtface= MEM_callocN(sizeof(*obr->mtface)*numtf, "mtfacenames");
        }
 
        if (CustomData_has_layer(data, CD_MCOL)) {
-               numlayers= CustomData_number_of_layers(data, CD_MCOL);
-               obr->mcol= MEM_callocN(sizeof(*obr->mcol)*numlayers, "mcolnames");
+               numcol= CustomData_number_of_layers(data, CD_MCOL);
+               obr->mcol= MEM_callocN(sizeof(*obr->mcol)*numcol, "mcolnames");
        }
 
        for (i=0, mtfn=0, mcn=0; i < data->totlayer; i++) {
@@ -500,12 +500,12 @@ void RE_set_customdata_names(ObjectRen *obr, CustomData *data)
 
                if (layer->type == CD_MTFACE) {
                        strcpy(obr->mtface[mtfn++], layer->name);
-                       obr->actmtface= layer->active_rnd;
+                       obr->actmtface= CLAMPIS(layer->active_rnd, 0, numtf);
                        obr->bakemtface= layer->active;
                }
                else if (layer->type == CD_MCOL) {
                        strcpy(obr->mcol[mcn++], layer->name);
-                       obr->actmcol= layer->active_rnd;
+                       obr->actmcol= CLAMPIS(layer->active_rnd, 0, numcol);
                }
        }
 }
index be55544360563a44625dae1a6bc52110ae272e89..76a47a11338fd080084a1f36f24ca29a5df8be85 100644 (file)
@@ -2981,10 +2981,11 @@ void RE_zbuf_accumulate_vecblur(NodeBlurData *nbd, int xsize, int ysize, float *
 {
        ZSpan zspan;
        DrawBufPixel *rectdraw, *dr;
-       static float jit[16][2];
+       static float jit[256][2];
        float v1[3], v2[3], v3[3], v4[3], fx, fy;
-       float *rectvz, *dvz, *dimg, *dvec1, *dvec2, *dz, *dz1, *dz2, *rectz, *minvecbufrect= NULL;
-       float maxspeedsq= (float)nbd->maxspeed*nbd->maxspeed;
+       float *rectvz, *dvz, *dimg, *dvec1, *dvec2, *dz, *dz1, *dz2, *rectz;
+       float *minvecbufrect= NULL, *rectweight, *rw, *rectmax, *rm, *ro;
+       float maxspeedsq= (float)nbd->maxspeed*nbd->maxspeed, totfac;
        int y, x, step, maxspeed=nbd->maxspeed, samples= nbd->samples;
        int tsktsk= 0;
        static int firsttime= 1;
@@ -3003,6 +3004,9 @@ void RE_zbuf_accumulate_vecblur(NodeBlurData *nbd, int xsize, int ysize, float *
        rectmove= MEM_mapallocN(xsize*ysize, "rectmove");
        rectdraw= MEM_mapallocN(sizeof(DrawBufPixel)*xsize*ysize, "rect draw");
        zspan.rectp= (int *)rectdraw;
+
+       rectweight= MEM_mapallocN(sizeof(float)*xsize*ysize, "rect weight");
+       rectmax= MEM_mapallocN(sizeof(float)*xsize*ysize, "rect max");
        
        /* debug... check if PASS_VECTOR_MAX still is in buffers */
        dvec1= vecbufrect;
@@ -3142,7 +3146,7 @@ void RE_zbuf_accumulate_vecblur(NodeBlurData *nbd, int xsize, int ysize, float *
        dm= rectmove;
        dvec1= vecbufrect;
        for(x=xsize*ysize; x>0; x--, dm++, dvec1+=4) {
-               if(dvec1[0]!=0.0f || dvec1[1]!=0.0f || dvec1[2]!=0.0f || dvec1[3]!=0.0f)
+               if((dvec1[0]!=0.0f || dvec1[1]!=0.0f || dvec1[2]!=0.0f || dvec1[3]!=0.0f))
                        *dm= 255;
        }
        
@@ -3151,9 +3155,12 @@ void RE_zbuf_accumulate_vecblur(NodeBlurData *nbd, int xsize, int ysize, float *
        /* has to become static, the init-jit calls a random-seed, screwing up texture noise node */
        if(firsttime) {
                firsttime= 0;
-               BLI_initjit(jit[0], 16);
+               BLI_initjit(jit[0], 256);
        }
        
+       memset(newrect, 0, sizeof(float)*xsize*ysize*4);
+       totfac= 0.0f;
+
        /* accumulate */
        samples/= 2;
        for(step= 1; step<=samples; step++) {
@@ -3161,7 +3168,7 @@ void RE_zbuf_accumulate_vecblur(NodeBlurData *nbd, int xsize, int ysize, float *
                int side;
                
                for(side=0; side<2; side++) {
-                       float blendfac= 1.0f/((ABS(step)*2+side)+1), ipodata[4];
+                       float blendfac, ipodata[4];
                        
                        /* clear zbuf, if we draw future we fill in not moving pixels */
                        if(0)
@@ -3193,30 +3200,32 @@ void RE_zbuf_accumulate_vecblur(NodeBlurData *nbd, int xsize, int ysize, float *
                        
                        set_quad_bezier_ipo(0.5f + 0.5f*speedfac, ipodata);
                        
-                       for(fy= -0.5f+jit[step & 15][0], y=0; y<ysize; y++, fy+=1.0f) {
-                               for(fx= -0.5f+jit[step & 15][1], x=0; x<xsize; x++, fx+=1.0f, dimg+=4, dz1+=4, dz2+=4, dm++, dz++) {
+                       for(fy= -0.5f+jit[step & 255][0], y=0; y<ysize; y++, fy+=1.0f) {
+                               for(fx= -0.5f+jit[step & 255][1], x=0; x<xsize; x++, fx+=1.0f, dimg+=4, dz1+=4, dz2+=4, dm++, dz++) {
                                        if(*dm>1) {
+                                               float jfx = fx + 0.5f;
+                                               float jfy = fy + 0.5f;
                                                DrawBufPixel col;
                                                
                                                /* make vertices */
                                                if(nbd->curved) {       /* curved */
                                                        quad_bezier_2d(v1, dz1, dz1+2, ipodata);
-                                                       v1[0]+= fx; v1[1]+= fy; v1[2]= *dz;
+                                                       v1[0]+= jfx; v1[1]+= jfy; v1[2]= *dz;
 
                                                        quad_bezier_2d(v2, dz1+4, dz1+4+2, ipodata);
-                                                       v2[0]+= fx+1.0f; v2[1]+= fy; v2[2]= *dz;
+                                                       v2[0]+= jfx+1.0f; v2[1]+= jfy; v2[2]= *dz;
 
                                                        quad_bezier_2d(v3, dz2+4, dz2+4+2, ipodata);
-                                                       v3[0]+= fx+1.0f; v3[1]+= fy+1.0f; v3[2]= *dz;
+                                                       v3[0]+= jfx+1.0f; v3[1]+= jfy+1.0f; v3[2]= *dz;
                                                        
                                                        quad_bezier_2d(v4, dz2, dz2+2, ipodata);
-                                                       v4[0]+= fx; v4[1]+= fy+1.0f; v4[2]= *dz;
+                                                       v4[0]+= jfx; v4[1]+= jfy+1.0f; v4[2]= *dz;
                                                }
                                                else {
-                                                       v1[0]= speedfac*dz1[0]+fx;                      v1[1]= speedfac*dz1[1]+fy;                      v1[2]= *dz;
-                                                       v2[0]= speedfac*dz1[4]+fx+1.0f;         v2[1]= speedfac*dz1[5]+fy;                      v2[2]= *dz;
-                                                       v3[0]= speedfac*dz2[4]+fx+1.0f;         v3[1]= speedfac*dz2[5]+fy+1.0f;         v3[2]= *dz;
-                                                       v4[0]= speedfac*dz2[0]+fx;                      v4[1]= speedfac*dz2[1]+fy+1.0f;         v4[2]= *dz;
+                                                       v1[0]= speedfac*dz1[0]+jfx;                     v1[1]= speedfac*dz1[1]+jfy;                     v1[2]= *dz;
+                                                       v2[0]= speedfac*dz1[4]+jfx+1.0f;                v2[1]= speedfac*dz1[5]+jfy;                     v2[2]= *dz;
+                                                       v3[0]= speedfac*dz2[4]+jfx+1.0f;                v3[1]= speedfac*dz2[5]+jfy+1.0f;                v3[2]= *dz;
+                                                       v4[0]= speedfac*dz2[0]+jfx;                     v4[1]= speedfac*dz2[1]+jfy+1.0f;                v4[2]= *dz;
                                                }
                                                if(*dm==255) col.alpha= 1.0f;
                                                else if(*dm<2) col.alpha= 0.0f;
@@ -3229,26 +3238,59 @@ void RE_zbuf_accumulate_vecblur(NodeBlurData *nbd, int xsize, int ysize, float *
                                dz1+=4;
                                dz2+=4;
                        }
-                       
+
+                       /* blend with a falloff. this fixes the ugly effect you get with
+                        * a fast moving object. then it looks like a solid object overlayed
+                        * over a very transparent moving version of itself. in reality, the
+                        * whole object should become transparent if it is moving fast, be
+                        * we don't know what is behind it so we don't do that. this hack
+                        * overestimates the contribution of foreground pixels but looks a
+                        * bit better without a sudden cutoff. */
+                       blendfac= ((samples - step)/(float)samples);
+                       /* smoothstep to make it look a bit nicer as well */
+                       blendfac= 3.0f*pow(blendfac, 2.0f) - 2.0f*pow(blendfac, 3.0f);
+
                        /* accum */
-                       for(dr= rectdraw, dz2=newrect, x= xsize*ysize-1; x>=0; x--, dr++, dz2+=4) {
+                       rw= rectweight;
+                       rm= rectmax;
+                       for(dr= rectdraw, dz2=newrect, x= xsize*ysize-1; x>=0; x--, dr++, dz2+=4, rw++, rm++) {
                                if(dr->colpoin) {
-                                       float bfac= dr->alpha*blendfac*dr->colpoin[3];
-                                       float mf= 1.0f - bfac;
+                                       float bfac= dr->alpha*blendfac;
                                        
-                                       dz2[0]= mf*dz2[0] + bfac*dr->colpoin[0];
-                                       dz2[1]= mf*dz2[1] + bfac*dr->colpoin[1];
-                                       dz2[2]= mf*dz2[2] + bfac*dr->colpoin[2];
-                                       dz2[3]= mf*dz2[3] + bfac*dr->colpoin[3];
+                                       dz2[0] += bfac*dr->colpoin[0];
+                                       dz2[1] += bfac*dr->colpoin[1];
+                                       dz2[2] += bfac*dr->colpoin[2];
+                                       dz2[3] += bfac*dr->colpoin[3];
+
+                                       *rw += bfac;
+                                       *rm= MAX2(*rm, bfac);
                                }
                        }
                }
        }
        
+       /* blend between original images and accumulated image */
+       rw= rectweight;
+       rm= rectmax;
+       ro= imgrect;
+       dm= rectmove;
+       for(dz2=newrect, x= xsize*ysize-1; x>=0; x--, dz2+=4, ro+=4, rw++, rm++, dm++) {
+               float mfac = *rm;
+               float fac = (*rw == 0.0f)? 0.0f: mfac/(*rw);
+               float nfac = 1.0f - mfac;
+
+               dz2[0]= fac*dz2[0] + nfac*ro[0];
+               dz2[1]= fac*dz2[1] + nfac*ro[1];
+               dz2[2]= fac*dz2[2] + nfac*ro[2];
+               dz2[3]= fac*dz2[3] + nfac*ro[3];
+       }
+
        MEM_freeN(rectz);
        MEM_freeN(rectmove);
        MEM_freeN(rectdraw);
        MEM_freeN(rectvz);
+       MEM_freeN(rectweight);
+       MEM_freeN(rectmax);
        if(minvecbufrect) MEM_freeN(vecbufrect);  /* rects were swapped! */
        zbuf_free_span(&zspan);
 }
index c83d7b2e12443a8581bb4126aab75da0fdb9e1ef..425ec8956cbd1dcb21fe71440b1b915c937d4335 100644 (file)
@@ -1573,6 +1573,18 @@ static void build_uvlayer_menu_vars(CustomData *data, char **menu_string,
        }
 }
 
+void set_wave_uvlayer(void *arg1, void *arg2)
+{
+       WaveModifierData *wmd=arg1;
+       CustomDataLayer *layer = arg2;
+
+       /*check we have UV layers*/
+       if (wmd->uvlayer_tmp < 1) return;
+       layer = layer + (wmd->uvlayer_tmp-1);
+       
+       strcpy(wmd->uvlayer_name, layer->name);
+}
+
 void set_displace_uvlayer(void *arg1, void *arg2)
 {
        DisplaceModifierData *dmd=arg1;
@@ -1843,6 +1855,8 @@ static void draw_modifier(uiBlock *block, Object *ob, ModifierData *md, int *xco
                y -= 18;
 
                if (!isVirtual && (md->type!=eModifierType_Collision)) {
+                       uiSetButLock(object_data_is_libdata(ob), ERROR_LIBDATA_MESSAGE); /* only here obdata, the rest of modifiers is ob level */
+
                        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");
@@ -1858,6 +1872,8 @@ static void draw_modifier(uiBlock *block, Object *ob, ModifierData *md, int *xco
                                uiButSetFunc(but, modifiers_copyModifier, ob, md);
                        }
                        uiBlockEndAlign(block);
+                       
+                       uiSetButLock(ob && ob->id.lib, ERROR_LIBDATA_MESSAGE);
                }
 
                lx = x + 10;
@@ -2193,7 +2209,7 @@ static void draw_modifier(uiBlock *block, Object *ob, ModifierData *md, int *xco
                                      0.0, 1.0, 0, 0, "Set the UV layer to use");
                                MEM_freeN(strtmp);
                                i = CustomData_get_layer_index(fdata, CD_MTFACE);
-                               uiButSetFunc(but, set_displace_uvlayer, wmd,
+                               uiButSetFunc(but, set_wave_uvlayer, wmd,
                                             &fdata->layers[i]);
                        }
                        if(wmd->texmapping == MOD_DISP_MAP_OBJECT) {
@@ -2540,7 +2556,7 @@ static void editing_panel_modifiers(Object *ob)
        block= uiNewBlock(&curarea->uiblocks, "editing_panel_modifiers", UI_EMBOSS, UI_HELV, curarea->win);
        if( uiNewPanel(curarea, block, "Modifiers", "Editing", 640, 0, 318, 204)==0) return;
        
-       uiSetButLock(object_data_is_libdata(ob), ERROR_LIBDATA_MESSAGE);
+       uiSetButLock((ob && ob->id.lib), ERROR_LIBDATA_MESSAGE);
        uiNewPanelHeight(block, 204);
 
        uiDefBlockBut(block, modifiers_add_menu, ob, "Add Modifier", 0, 190, 130, 20, "Add a new modifier");
index df76534f3f5f53a3e1919c869f51ab0029da9043..934ff9e008a8f8a86254053ddb68ed2dad887d83 100644 (file)
@@ -3379,7 +3379,8 @@ void logic_buts(void)
                                        uiBlockSetEmboss(block, UI_EMBOSSM);
                                        uiDefIconButBitS(block, TOG, SENS_DEL, B_DEL_SENS, ICON_X,      xco, yco, 22, 19, &sens->flag, 0, 0, 0, 0, "Delete Sensor");
                                        if (pin)
-                                               uiDefIconButBitS(block, ICONTOG, SENS_PIN, B_REDR, (sens->flag & SENS_PIN) ? ICON_PIN_DEHLT:ICON_PIN_HLT, (short)(xco+width-44), yco, 22, 19, &sens->flag, 0, 0, 0, 0, "Display when not linked to a visible states controller");
+                                               uiDefIconButBitS(block, ICONTOG, SENS_PIN, B_REDR, ICON_PIN_DEHLT, (short)(xco+width-44), yco, 22, 19, &sens->flag, 0, 0, 0, 0, "Display when not linked to a visible states controller");
+                                       
                                        uiDefIconButBitS(block, ICONTOG, SENS_SHOW, B_REDR, ICON_RIGHTARROW, (short)(xco+width-22), yco, 22, 19, &sens->flag, 0, 0, 0, 0, "Sensor settings");
 
                                        ycoo= yco;
@@ -3456,7 +3457,7 @@ void logic_buts(void)
                                        uiBlockSetEmboss(block, UI_EMBOSSM);
                                        uiDefIconButBitS(block, TOG, ACT_DEL, B_DEL_ACT, ICON_X,        xco, yco, 22, 19, &act->flag, 0, 0, 0, 0, "Delete Actuator");
                                        if (pin)
-                                               uiDefIconButBitS(block, ICONTOG, ACT_PIN, B_REDR, (act->flag & ACT_PIN) ? ICON_PIN_DEHLT:ICON_PIN_HLT, (short)(xco+width-44), yco, 22, 19, &act->flag, 0, 0, 0, 0, "Display when not linked to a visible states controller");
+                                               uiDefIconButBitS(block, ICONTOG, ACT_PIN, B_REDR, ICON_PIN_DEHLT, (short)(xco+width-44), yco, 22, 19, &act->flag, 0, 0, 0, 0, "Display when not linked to a visible states controller");
                                        uiDefIconButBitS(block, ICONTOG, ACT_SHOW, B_REDR, ICON_RIGHTARROW, (short)(xco+width-22), yco, 22, 19, &act->flag, 0, 0, 0, 0, "Display the actuator");
                                        
                                        if(act->flag & ACT_SHOW) {
index 18384dd90b3ddc4af06d6df9b9a8e056c27161e4..0f968a7c60c85b851cc7af7ad711fe581301d655 100644 (file)
@@ -3001,7 +3001,7 @@ void do_effects_panels(unsigned short event)
                if(ob && (psys=psys_get_current(ob))){
                        if(psys->part) {
                                if(psys->part->id.us>1){
-                                       if(okee("Make local")){
+                                       if(okee("Make Single User")){
                                                part=psys_copy_settings(psys->part);
                                                part->id.us=1;
                                                psys->part->id.us--;
index 3f65f686e93e21679fcc9b69a84fc7dae3ccad99..6d5e1a62ad4967c9ffba2f51bcfb68d503b48192 100644 (file)
@@ -211,6 +211,7 @@ static void load_image_cb(char *str, void *ima_pp_v, void *iuser_v) /* called fr
                        if(GS(tex->id.name)==ID_TE) {
                                BIF_preview_changed(ID_TE);
                                allqueue(REDRAWBUTSSHADING, 0);
+                               allqueue(REDRAWVIEW3D, 0);
                                allqueue(REDRAWOOPS, 0);
                        }
                }
index 0782ccfc7ee1ab0fdf000637c9519d6bc043deee..33eb5262c3dcf0f91f8f50e224e99d6710f44993 100644 (file)
@@ -682,6 +682,18 @@ static void draw_channel_names(void)
                                                        special= ICON_SEQUENCE;
                                                }
                                                        break;
+                                               case SPACE_IMAGE:
+                                               {
+                                                       SpaceImage *sima= sa->spacedata.first;
+                                                       
+                                                       if (sima->image)
+                                                               sprintf(name, "Image: %s", sima->image->id.name+2);
+                                                       else
+                                                               sprintf(name, "Image: <None>");
+                                                               
+                                                       special= ICON_IMAGE_COL;
+                                               }
+                                                       break;
                                                
                                                default:
                                                {
index 6e8970522180f96ad0b994972e1436813783f8cd..fb21d94f39a42305751103fb41abf8043176e5b1 100644 (file)
@@ -98,6 +98,8 @@
 void gp_ui_activelayer_cb (void *gpd, void *gpl)
 {
        gpencil_layer_setactive(gpd, gpl);
+       
+       scrarea_queue_winredraw(curarea);
        allqueue(REDRAWACTION, 0);
 }
 
@@ -109,6 +111,8 @@ void gp_ui_renamelayer_cb (void *gpd_arg, void *gpl_arg)
        
        BLI_uniquename(&gpd->layers, gpl, "GP_Layer", offsetof(bGPDlayer, info[0]), 128);
        gpencil_layer_setactive(gpd, gpl);
+       
+       scrarea_queue_winredraw(curarea);
        allqueue(REDRAWACTION, 0);
 }
 
@@ -116,6 +120,8 @@ void gp_ui_renamelayer_cb (void *gpd_arg, void *gpl_arg)
 void gp_ui_addlayer_cb (void *gpd, void *dummy)
 {
        gpencil_layer_addnew(gpd);
+       
+       scrarea_queue_winredraw(curarea);
        allqueue(REDRAWACTION, 0);
 }
 
@@ -123,6 +129,8 @@ void gp_ui_addlayer_cb (void *gpd, void *dummy)
 void gp_ui_dellayer_cb (void *gpd, void *dummy)
 {
        gpencil_layer_delactive(gpd);
+       
+       scrarea_queue_winredraw(curarea);
        allqueue(REDRAWACTION, 0);
 }
 
@@ -133,6 +141,8 @@ void gp_ui_delstroke_cb (void *gpd, void *gpl)
        
        gpencil_layer_setactive(gpd, gpl);
        gpencil_frame_delete_laststroke(gpf);
+       
+       scrarea_queue_winredraw(curarea);
 }
 
 /* delete active frame of active layer */
@@ -143,6 +153,7 @@ void gp_ui_delframe_cb (void *gpd, void *gpl)
        gpencil_layer_setactive(gpd, gpl);
        gpencil_layer_delframe(gpl, gpf);
        
+       scrarea_queue_winredraw(curarea);
        allqueue(REDRAWACTION, 0);
 }
 
@@ -151,6 +162,8 @@ void gp_ui_convertlayer_cb (void *gpd, void *gpl)
 {
        gpencil_layer_setactive(gpd, gpl);
        gpencil_convert_menu();
+       
+       scrarea_queue_winredraw(curarea);
 }
 
 /* ------- Drawing Code ------- */
index 9b5be04eac114d11da2ea3872e57be33b7ce2e62..87e36c4ad2429b4364a762d5b88852a5601a7adf 100644 (file)
@@ -921,6 +921,13 @@ void drawscroll(int disptype)
                
                BIF_ThemeColor(TH_TEXT);
                val= ipogrid_startx;
+               
+               if (ELEM3(curarea->spacetype, SPACE_SEQ, SPACE_SOUND, SPACE_TIME)) {    /* prevents printing twice same frame */
+                       while(ipogrid_dx < 0.9999f) {
+                               ipogrid_dx *= 2.0f;
+                               dfac*= 2.0f;
+                       }
+               }               
                while(fac < hor.xmax) {
                        
                        if(curarea->spacetype==SPACE_OOPS) { 
index f8d77698489e05b4d7bb2076fe6b994a63ab042a..42576c901d7692eb9ad245f558d79fccd048ec6c 100644 (file)
 #include "BIF_verse.h"
 #endif
 
+#include "BDR_drawaction.h"
 #include "BDR_drawmesh.h"
 #include "BDR_drawobject.h"
 #include "BDR_editobject.h"
@@ -1207,60 +1208,196 @@ void drawname(Object *ob)
        BMF_DrawString(G.font, ob->id.name+2);
 }
 
-
-static void draw_selected_name(Object *ob)
+static char *get_cfra_marker_name()
 {
-       char info[128];
-       short offset=30;
+       ListBase *markers= &G.scene->markers;
+       TimeMarker *m1, *m2;
+       
+       /* search through markers for match */
+       for (m1=markers->first, m2=markers->last; m1 && m2; m1=m1->next, m2=m2->prev) {
+               if (m1->frame==CFRA)
+                       return m1->name;
+               if (m2->frame==CFRA)
+                       return m2->name;
+               
+               if (m1 == m2)
+                       break;
+       }
+       
+       return NULL;
+}
 
-       if(ob->type==OB_ARMATURE) {
-               bArmature *arm= ob->data;
-               char *name= NULL;
+// TODO: move this func into some keyframing API
+short ob_cfra_has_keyframe (Object *ob)
+{
+       // fixme... this is slow!
+       if (ob) {
+               ListBase keys = {NULL, NULL};
+               ActKeyColumn *ak, *akn;
+               Key *key= ob_get_key(ob);
+               int cfra, found= 0;
                
-               if(ob==G.obedit) {
-                       EditBone *ebo;
-                       for (ebo=G.edbo.first; ebo; ebo=ebo->next){
-                               if ((ebo->flag & BONE_ACTIVE) && (ebo->layer & arm->layer)) {
-                                       name= ebo->name;
+               /* check active action */
+               if (ob->action) {
+                       /* get keyframes of action */
+                       action_to_keylist(ob->action, &keys, NULL, NULL);
+                       
+                       cfra= frame_to_float(CFRA);
+                       cfra= get_action_frame(ob, cfra);
+                       
+                       /* check if a keyframe occurs on current frame */
+                       for (ak=keys.first, akn=keys.last; ak && akn; ak=ak->next, akn=akn->prev) {
+                               if (cfra == ak->cfra) {
+                                       found= 1;
+                                       break;
+                               }
+                               else if (cfra == akn->cfra) {
+                                       found= 1;
                                        break;
                                }
+                               
+                               if (ak == akn)
+                                       break;
                        }
+                       
+                       /* free temp list */
+                       BLI_freelistN(&keys);
+                       keys.first= keys.last= NULL;
+                       
+                       /* return if found */
+                       if (found) return 1;
                }
-               else if(ob->pose && (ob->flag & OB_POSEMODE)) {
-                       bPoseChannel *pchan;
-                       for(pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
-                               if((pchan->bone->flag & BONE_ACTIVE) && (pchan->bone->layer & arm->layer)) {
-                                       name= pchan->name;
+               
+               /* accumulate keyframes for available ipo's */
+               if (ob->ipo)
+                       ipo_to_keylist(ob->ipo, &keys, NULL, NULL);
+               if (key)
+                       ipo_to_keylist(key->ipo, &keys, NULL, NULL);
+               
+               if (keys.first) {
+                       cfra= frame_to_float(CFRA);
+                       found= 0;
+                               
+                       /* check if a keyframe occurs on current frame */
+                       for (ak=keys.first, akn=keys.last; ak && akn; ak=ak->next, akn=akn->prev) {
+                               if (IS_EQ(cfra, ak->cfra)) {
+                                       found= 1;
+                                       break;
+                               }
+                               else if (IS_EQ(cfra, akn->cfra)) {
+                                       found= 1;
                                        break;
                                }
+                               
+                               if (ak == akn)
+                                       break;
                        }
+                       
+                       /* free temp list */
+                       BLI_freelistN(&keys);
+                       keys.first= keys.last= NULL;
+                       
+                       /* return if found */
+                       if (found) return 1;
                }
-               if(name)
-                       sprintf(info, "(%d) %s %s", CFRA, ob->id.name+2, name);
-               else
-                       sprintf(info, "(%d) %s", CFRA, ob->id.name+2);
-       }
-       else if(ob->type==OB_MESH) {
-               Key *key= NULL;
-               KeyBlock *kb = NULL;
-               char shapes[75];
-               
-               shapes[0] = 0;
-               key = ob_get_key(ob);
-               if(key){
-                       kb = BLI_findlink(&key->block, ob->shapenr-1);
-                       if(kb){
-                               sprintf(shapes, ": %s ", kb->name);             
-                               if(ob->shapeflag == OB_SHAPE_LOCK){
-                                       sprintf(shapes, "%s (Pinned)",shapes);
+       }
+       
+       /* couldn't find a keyframe */
+       return 0;
+}
+
+/* draw info beside axes in bottom left-corner: 
+ *     framenum, object name, bone name (if available), marker name (if available)
+ */
+static void draw_selected_name(Object *ob)
+{
+       char info[256], *markern;
+       short offset=30;
+       
+       /* get name of marker on current frame (if available) */
+       markern= get_cfra_marker_name();
+       
+       /* check if there is an object */
+       if(ob) {
+               /* name(s) to display depends on type of object */
+               if(ob->type==OB_ARMATURE) {
+                       bArmature *arm= ob->data;
+                       char *name= NULL;
+                       
+                       /* show name of active bone too (if possible) */
+                       if(ob==G.obedit) {
+                               EditBone *ebo;
+                               for (ebo=G.edbo.first; ebo; ebo=ebo->next){
+                                       if ((ebo->flag & BONE_ACTIVE) && (ebo->layer & arm->layer)) {
+                                               name= ebo->name;
+                                               break;
+                                       }
+                               }
+                       }
+                       else if(ob->pose && (ob->flag & OB_POSEMODE)) {
+                               bPoseChannel *pchan;
+                               for(pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
+                                       if((pchan->bone->flag & BONE_ACTIVE) && (pchan->bone->layer & arm->layer)) {
+                                               name= pchan->name;
+                                               break;
+                                       }
+                               }
+                       }
+                       if(name && markern)
+                               sprintf(info, "(%d) %s %s <%s>", CFRA, ob->id.name+2, name, markern);
+                       else if(name)
+                               sprintf(info, "(%d) %s %s", CFRA, ob->id.name+2, name);
+                       else
+                               sprintf(info, "(%d) %s", CFRA, ob->id.name+2);
+               }
+               else if(ELEM3(ob->type, OB_MESH, OB_LATTICE, OB_CURVE)) {
+                       Key *key= NULL;
+                       KeyBlock *kb = NULL;
+                       char shapes[75];
+                       
+                       /* try to display active shapekey too */
+                       shapes[0] = 0;
+                       key = ob_get_key(ob);
+                       if(key){
+                               kb = BLI_findlink(&key->block, ob->shapenr-1);
+                               if(kb){
+                                       sprintf(shapes, ": %s ", kb->name);             
+                                       if(ob->shapeflag == OB_SHAPE_LOCK){
+                                               sprintf(shapes, "%s (Pinned)",shapes);
+                                       }
                                }
                        }
+                       
+                       if(markern)
+                               sprintf(info, "(%d) %s %s <%s>", CFRA, ob->id.name+2, shapes, markern);
+                       else
+                               sprintf(info, "(%d) %s %s", CFRA, ob->id.name+2, shapes);
                }
-               sprintf(info, "(%d) %s %s", CFRA, ob->id.name+2, shapes);
+               else {
+                       /* standard object */
+                       if (markern)
+                               sprintf(info, "(%d) %s <%s>", CFRA, ob->id.name+2, markern);
+                       else
+                               sprintf(info, "(%d) %s", CFRA, ob->id.name+2);
+               }
+                       
+               /* colour depends on whether there is a keyframe */
+               if (ob_cfra_has_keyframe(ob))
+                       BIF_ThemeColor(TH_VERTEX_SELECT);
+               else
+                       BIF_ThemeColor(TH_TEXT_HI);
        }
-       else sprintf(info, "(%d) %s", CFRA, ob->id.name+2);
-
-       BIF_ThemeColor(TH_TEXT_HI);
+       else {
+               /* no object */
+               if (markern)
+                       sprintf(info, "(%d) <%s>", CFRA, markern);
+               else
+                       sprintf(info, "(%d)", CFRA);
+               
+               /* colour is always white */
+               BIF_ThemeColor(TH_TEXT_HI);
+       }
+       
        if (U.uiflag & USER_SHOW_ROTVIEWICON)
                offset = 14 + (U.rvisize * 2);
 
@@ -3257,7 +3394,7 @@ void drawview3dspace(ScrArea *sa, void *spacedata)
        }
 
        ob= OBACT;
-       if(ob && (U.uiflag & USER_DRAWVIEWINFO)
+       if(U.uiflag & USER_DRAWVIEWINFO
                draw_selected_name(ob);
        
        draw_area_emboss(sa);
index 4ac5072b21295574c267794b8d6ae789f0351f7c..2c5386b86b66e81c4a7dea33cbe716ad7d5396bd 100644 (file)
@@ -745,9 +745,9 @@ void KnifeSubdivide(char mode)
                        eed= eed->next;
                }
                
-               if      (mode==KNIFE_EXACT)    esubdivideflag(1, 0, B_KNIFE|B_PERCENTSUBD,1,SUBDIV_SELECT_ORIG);
-               else if (mode==KNIFE_MIDPOINT) esubdivideflag(1, 0, B_KNIFE,1,SUBDIV_SELECT_ORIG);
-               else if (mode==KNIFE_MULTICUT) esubdivideflag(1, 0, B_KNIFE,numcuts,SUBDIV_SELECT_ORIG);
+               if(mode==KNIFE_EXACT) esubdivideflag(SELECT, 0, B_KNIFE|B_PERCENTSUBD,1,SUBDIV_SELECT_ORIG);
+               else if (mode==KNIFE_MIDPOINT) esubdivideflag(SELECT, 0, B_KNIFE,1,SUBDIV_SELECT_ORIG);
+               else if (mode==KNIFE_MULTICUT) esubdivideflag(SELECT, 0, B_KNIFE,numcuts,SUBDIV_SELECT_ORIG);
 
                eed=em->edges.first;
                while(eed){
index c2fccb0e50f0d9b110a31a72b3d7d800a8f88bfa..fe4c98aa4de72bfd78edcf44dd0841ae60ed1d23 100644 (file)
@@ -2698,16 +2698,21 @@ void esubdivideflag(int flag, float rad, int beauty, int numcuts, int seltype)
        free_tagged_edges_faces(em->edges.first, em->faces.first); 
        
        if(seltype == SUBDIV_SELECT_ORIG  && G.qual  != LR_CTRLKEY) {
+               /* bugfix: vertex could get flagged as "not-selected"
+               // solution: clear flags before, not at the same time as setting SELECT flag -dg
+               */
                for(eed = em->edges.first;eed;eed = eed->next) {
-                       if(eed->f2 & EDGENEW || eed->f2 & EDGEOLD) {
-                               eed->f |= flag;
-                               EM_select_edge(eed,1); 
-                               
-                       }else{
+                       if(!(eed->f2 & EDGENEW || eed->f2 & EDGEOLD)) {
                                eed->f &= !flag;
                                EM_select_edge(eed,0); 
                        }
-               }   
+               }
+               for(eed = em->edges.first;eed;eed = eed->next) {
+                       if(eed->f2 & EDGENEW || eed->f2 & EDGEOLD) {
+                               eed->f |= flag;
+                               EM_select_edge(eed,1);
+                       }
+               }
        } else if ((seltype == SUBDIV_SELECT_INNER || seltype == SUBDIV_SELECT_INNER_SEL)|| G.qual == LR_CTRLKEY) {
                for(eed = em->edges.first;eed;eed = eed->next) {
                        if(eed->f2 & EDGEINNER) {
index 2094074e3f3297084478d1d8111ec629447486d1..e05d1c519d568b97adf8625bd4b4937da4fbaf95 100644 (file)
@@ -3023,6 +3023,10 @@ void convertmenu(void)
                basedel = NULL;                         
        }
        
+       /* delete object should renew depsgraph */
+       if(nr==2)
+               DAG_scene_sort(G.scene);
+
        /* texspace and normals */
        if(!basen) BASACT= base;
 
@@ -4134,6 +4138,7 @@ void apply_object( void )
        } 
        else {
                ob= OBACT;
+               if(ob==0) return;
                
                if ((ob->pose) && (ob->flag & OB_POSEMODE))
                        evt = pupmenu("Apply Object%t|Current Pose as RestPose%x3");
index 1cd8733a7ea05248797aee7f833e0618382e4e0d..976e58ed10219a8d617e9404aa40f81701001b8a 100644 (file)
@@ -1023,8 +1023,11 @@ int blender_test_break(void)
        return (G.afbreek==1);
 }
 
-void reset_autosave(void) {
-       window_set_timer(mainwin, U.savetime*60*1000, AUTOSAVE_FILE);
+void reset_autosave(void) 
+{
+       if(U.flag & USER_AUTOSAVE) {
+               window_set_timer(mainwin, U.savetime*60*1000, AUTOSAVE_FILE);
+       }
 }
 
 /* ************ handlers ************** */
index fa3ada89a3a1cade818ab9f0bb0c958cf96d1614..c7540bc4a1f25c11b99784c253f2e12dbc3a18f2 100644 (file)
@@ -224,8 +224,8 @@ bGPDlayer *gpencil_layer_addnew (bGPdata *gpd)
        BLI_addtail(&gpd->layers, gpl);
        
        /* set basic settings */
-       gpl->color[3]= 1.0f;
-       gpl->thickness = 1;
+       gpl->color[3]= 0.9f;
+       gpl->thickness = 3;
        
        /* auto-name */
        sprintf(gpl->info, "GP_Layer");
@@ -247,8 +247,7 @@ bGPdata *gpencil_data_addnew (void)
        gpd= MEM_callocN(sizeof(bGPdata), "GreasePencilData");
        
        /* initial settings */
-               /* it is quite useful to be able to see this info, so on by default */
-       gpd->flag = GP_DATA_DISPINFO;
+       gpd->flag = (GP_DATA_DISPINFO|GP_DATA_EXPAND);
        
        return gpd;
 }
index c8a006a8221661df1c8fa773d2bd3d1b69af0ed5..704d4bdea5450e1159bbb9b96e31db97654345a0 100644 (file)
@@ -5387,7 +5387,11 @@ void do_view3d_buttons(short event)
        case B_MAN_MODE:
                allqueue(REDRAWVIEW3D, 1);
                break;          
-
+       case B_VIEW_BUTSEDIT:
+               allqueue(REDRAWVIEW3D, 1);
+               allqueue(REDRAWBUTSEDIT, 1);
+               break;
+               
        default:
 
                if(event>=B_LAY && event<B_LAY+31) {
@@ -5680,7 +5684,7 @@ void view3d_buttons(void)
                }
        } else {
                if (G.obedit==NULL && (G.f & (G_VERTEXPAINT|G_WEIGHTPAINT|G_TEXTUREPAINT))) {
-                       uiDefIconButBitI(block, TOG, G_FACESELECT, B_REDR, ICON_FACESEL_HLT,xco,0,XIC,YIC, &G.f, 0, 0, 0, 0, "Painting Mask (FKey)");
+                       uiDefIconButBitI(block, TOG, G_FACESELECT, B_VIEW_BUTSEDIT, ICON_FACESEL_HLT,xco,0,XIC,YIC, &G.f, 0, 0, 0, 0, "Painting Mask (FKey)");
                        xco+= XIC+10;
                } else {
                        /* Manipulators arnt used in weight paint mode */
index 2de6367c9ada00600c70f4b6ad3955c2e30004aa..96349e8fb9833411335ab78903ae917de7c8919b 100644 (file)
@@ -204,7 +204,7 @@ static void laplacian_triangle_weights(LaplacianSystem *sys, int f, int i1, int
        v3= sys->verts[i3];
 
        /* instead of *0.5 we divided by the number of faces of the edge, it still
-          needs to be varified that this is indeed the correct thing to do! */
+          needs to be verified that this is indeed the correct thing to do! */
        t1= cotan_weight(v1, v2, v3)/laplacian_edge_count(sys->edgehash, i2, i3);
        t2= cotan_weight(v2, v3, v1)/laplacian_edge_count(sys->edgehash, i3, i1);
        t3= cotan_weight(v3, v1, v2)/laplacian_edge_count(sys->edgehash, i1, i2);
@@ -229,7 +229,7 @@ static void laplacian_triangle_weights(LaplacianSystem *sys, int f, int i1, int
        }
 }
 
-LaplacianSystem *laplacian_system_construct_begin(int totvert, int totface)
+LaplacianSystem *laplacian_system_construct_begin(int totvert, int totface, int lsq)
 {
        LaplacianSystem *sys;
 
@@ -248,6 +248,8 @@ LaplacianSystem *laplacian_system_construct_begin(int totvert, int totface)
        /* create opennl context */
        nlNewContext();
        nlSolverParameteri(NL_NB_VARIABLES, totvert);
+       if(lsq)
+               nlSolverParameteri(NL_LEAST_SQUARES, NL_TRUE);
 
        sys->context= nlGetCurrent();
 
@@ -631,7 +633,7 @@ void heat_bone_weighting(Object *ob, Mesh *me, float (*verts)[3], int numbones,
        }
 
        /* create laplacian */
-       sys = laplacian_system_construct_begin(me->totvert, totface);
+       sys = laplacian_system_construct_begin(me->totvert, totface, 1);
 
        sys->heat.mesh= me;
        sys->heat.verts= verts;
@@ -933,7 +935,7 @@ void rigid_deform_begin(EditMesh *em)
        }
 
        /* create laplacian */
-       sys = laplacian_system_construct_begin(totvert, totface);
+       sys = laplacian_system_construct_begin(totvert, totface, 0);
 
        sys->rigid.mesh= em;
        sys->rigid.R = MEM_callocN(sizeof(float)*3*3*totvert, "RigidDeformR");
index acd14aae7a58daacf758ccfd8a75b15af96d818f..1bef10d0415815cc22c85e2e462178f6779fce9c 100644 (file)
@@ -753,6 +753,8 @@ char *BIF_ThemeColorsPup(int spacetype)
                        str += sprintf(str, "Transition Strip %%x%d|", TH_SEQ_TRANSITION);
                        str += sprintf(str, "Meta Strip %%x%d|", TH_SEQ_META);
                        str += sprintf(str, "Current Frame %%x%d", TH_CFRAME);
+                       str += sprintf(str, "Keyframe %%x%d|", TH_VERTEX_SELECT);
+                       str += sprintf(str, "Draw Action %%x%d|", TH_BONE_POSE);
                        break;
                case SPACE_SOUND:
                        str += sprintf(str, "Grid %%x%d|", TH_GRID);
index fe06f66bec7d994ca470186461cb83d5cf3ea210..749b097a21b2713b25858b5c649e6bb285605da6 100644 (file)
@@ -2062,6 +2062,7 @@ static void winqreadview3dspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
                                        if (G.f & (G_VERTEXPAINT|G_WEIGHTPAINT|G_TEXTUREPAINT)){
                                                G.f ^= G_FACESELECT;
                                                allqueue(REDRAWVIEW3D, 1);
+                                               allqueue(REDRAWBUTSEDIT, 1);
                                        }
                                        else if(G.f & G_PARTICLEEDIT) {
                                                PE_radialcontrol_start(RADIALCONTROL_SIZE);
index 9c7a2f67b89561b9c08028959cdf95ae676f1122..fc9dfbb902e39b6c91999cb1912d4b0c36888ea7 100644 (file)
@@ -352,7 +352,7 @@ char * BIF_menustringTransformOrientation(char *title) {
        char *str_menu, *p;
        
        
-       str_menu = MEM_callocN(strlen(menu) + strlen(title) + 40 * BIF_countTransformOrientation(), "UserTransSpace from matrix");
+       str_menu = MEM_callocN(strlen(menu) + strlen(title) + 1 + 40 * BIF_countTransformOrientation(), "UserTransSpace from matrix");
        p = str_menu;
        
        p += sprintf(str_menu, "%s", title);
index 901daf0ee582b1005ccb2ae5ac6675a16c2ee542..aa49065320b099ec11687f8effe2cbaa91131faa 100644 (file)
@@ -484,11 +484,20 @@ static void init_userdef_file(void)
                bTheme *btheme;
                for(btheme= U.themes.first; btheme; btheme= btheme->next) {
                        char *col;
+                       
+                       /* IPO Editor: Handles/Vertices */
                        col = btheme->tipo.vertex;
                        SETCOL(btheme->tipo.handle_vertex, col[0], col[1], col[2], 255);
                        col = btheme->tipo.vertex_select;
                        SETCOL(btheme->tipo.handle_vertex_select, col[0], col[1], col[2], 255);
                        btheme->tipo.handle_vertex_size= btheme->tipo.vertex_size;
+                       
+                       /* Sequence/Image Editor: colors for GPencil text */
+                       col = btheme->tv3d.bone_pose;
+                       SETCOL(btheme->tseq.bone_pose, col[0], col[1], col[2], 255);
+                       SETCOL(btheme->tima.bone_pose, col[0], col[1], col[2], 255);
+                       col = btheme->tv3d.vertex_select;
+                       SETCOL(btheme->tseq.vertex_select, col[0], col[1], col[2], 255);
                }
        }
 
index 74819431858a3c03ab9a80ad1aacc0a1071f586a..f16855955ffd566ae1f3168cf611a3647afcc625 100644 (file)
@@ -781,6 +781,13 @@ void BL_ConvertSensors(struct Object* blenderobject,
                                                "logic may be incorrect\n", sens->name, i+1, sens->totlinks, blenderobject->id.name+2);
                                }
                        }
+                       // special case: Keyboard sensor with no link
+                       // this combination is usually used for key logging. 
+                       if (sens->type == SENS_KEYBOARD && sens->totlinks == 0) {
+                               // Force the registration so that the sensor runs
+                               gamesensor->IncLink();
+                       }
+                               
                        // done with gamesensor
                        gamesensor->Release();
                        
index ff1040bfb401bae1781239ee76341b6a17359f1a..fc5912155cf0c0a626277e9941c1e8cf0994288b 100644 (file)
@@ -25,3 +25,7 @@
 # ***** END GPL LICENSE BLOCK *****
 
 SUBDIRS(common ghost)
+
+IF(WITH_WEBPLUGIN) 
+  SUBDIRS(xembed)
+ENDIF(WITH_WEBPLUGIN)
index 806216e05bb324ffe9ec7eb3871adab7876e5f61..3d9ae66c9ea3b0490899ccd5ddf4047635565e44 100644 (file)
@@ -129,7 +129,8 @@ GPG_Application::GPG_Application(GHOST_ISystem* system)
          m_blendermat(0),
          m_blenderglslmat(0),
          m_pyGlobalDictString(0),
-         m_pyGlobalDictString_Length(0)
+         m_pyGlobalDictString_Length(0),
+         m_isEmbedded(false)
 {
        fSystem = system;
 }
@@ -325,6 +326,26 @@ bool GPG_Application::startWindow(STR_String& title,
        return success;
 }
 
+bool GPG_Application::startEmbeddedWindow(STR_String& title,
+       const GHOST_TEmbedderWindowID parentWindow, 
+       const bool stereoVisual, 
+       const int stereoMode) {
+
+       m_mainWindow = fSystem->createWindow(title, 0, 0, 0, 0, GHOST_kWindowStateNormal,
+               GHOST_kDrawingContextTypeOpenGL, stereoVisual, parentWindow);
+
+       if (!m_mainWindow) {
+               printf("error: could not create main window\n");
+               exit(-1);
+       }
+       m_isEmbedded = true;
+
+       bool success = initEngine(m_mainWindow, stereoMode);
+       if (success) {
+               success = startEngine();
+       }
+       return success;
+}
 
 
 bool GPG_Application::startFullScreen(
@@ -887,7 +908,7 @@ bool GPG_Application::handleKey(GHOST_IEvent* event, bool isDown)
                GHOST_TEventKeyData* keyData = static_cast<GHOST_TEventKeyData*>(eventData);
                //no need for this test
                //if (fSystem->getFullScreen()) {
-                       if (keyData->key == GHOST_kKeyEsc && !m_keyboard->m_hookesc) {
+                       if (keyData->key == GHOST_kKeyEsc && !m_keyboard->m_hookesc && !m_isEmbedded) {
                                m_exitRequested = KX_EXIT_REQUEST_OUTSIDE;
                        }
                //}
index 5242a41980825b76c023fcd7699d19aad771abd0..7fc369fc0fd0ca93aa035ea76ead8a1745dddba5 100644 (file)
@@ -62,6 +62,7 @@ public:
                        bool startWindow(STR_String& title, int windowLeft, int windowTop, int windowWidth, int windowHeight,
                        const bool stereoVisual, const int stereoMode);
                        bool startFullScreen(int width, int height, int bpp, int frequency, const bool stereoVisual, const int stereoMode);
+                       bool startEmbeddedWindow(STR_String& title, const GHOST_TEmbedderWindowID parent_window, const bool stereoVisual, const int stereoMode);
 #ifdef WIN32
                        bool startScreenSaverFullScreen(int width, int height, int bpp, int frequency, const bool stereoVisual, const int stereoMode);
                        bool startScreenSaverPreview(HWND parentWindow, const bool stereoVisual, const int stereoMode);
@@ -143,6 +144,8 @@ protected:
        bool m_engineInitialized;
        /** Engine state. */
        bool m_engineRunning;
+       /** Running on embedded window */
+       bool m_isEmbedded;
 
        /** the gameengine itself */
        KX_KetsjiEngine* m_ketsjiengine;
index cc781a38bbb8ec267a073352fffbc62fd80974e1..d44e983af89b63167cbade75a1553c8e04e3c263 100644 (file)
@@ -178,6 +178,9 @@ void usage(char* program)
        printf("                   anaglyph         (Red-Blue glasses)\n");
        printf("                   vinterlace       (Vertical interlace for autostereo display)\n");
        printf("                             depending on the type of stereo you want\n");
+#ifndef _WIN32
+       printf("  -i: parent windows ID \n");
+#endif
 #ifdef _WIN32
        printf("  -c: keep console window open\n");
 #endif
@@ -297,6 +300,9 @@ int main(int argc, char** argv)
        int fullScreenFrequency = 60;
        char* pyGlobalDictString = NULL; /* store python dict data between blend file loading */
        int pyGlobalDictString_Length = 0;
+       GHOST_TEmbedderWindowID parentWindow = 0;
+
+
        
 #ifdef __linux__
 #ifdef __alpha__
@@ -457,6 +463,16 @@ int main(int argc, char** argv)
                                usage(argv[0]);
                                return 0;
                                break;
+#ifndef _WIN32
+                       case 'i':
+                               i++;
+                               if ( (i + 1) < argc )
+                                       parentWindow = atoi(argv[i++]);                                         
+#ifndef NDEBUG
+                               printf("XWindows ID = %d\n", parentWindow);
+#endif //NDEBUG
+
+#endif  // _WIN32                      
                        case 'c':
                                i++;
                                closeConsole = false;
@@ -729,7 +745,10 @@ int main(int argc, char** argv)
                                                                else
 #endif
                                                                {
-                                                                       app.startWindow(title, windowLeft, windowTop, windowWidth, windowHeight,
+                                                                                                                                                                                                               if (parentWindow != 0)
+                                                                               app.startEmbeddedWindow(title, parentWindow, stereoWindow, stereomode);
+                                                                       else
+                                                                               app.startWindow(title, windowLeft, windowTop, windowWidth, windowHeight,
                                                                                stereoWindow, stereomode);
                                                                }
                                                        }
index 27a955b3105c951a8f77e6e350a8151c0b58c7c1..0e5956d4fdb3c5b61f70b86fca47abb96fb5d898 100644 (file)
@@ -235,11 +235,12 @@ void KX_GameObject::SetParent(KX_Scene *scene, KX_GameObject* obj)
                        m_pPhysicsController1->SuspendDynamics(true);
                }
                // Set us to our new scale, position, and orientation
-               scale1[0] = scale1[0]/scale2[0];
-               scale1[1] = scale1[1]/scale2[1];
-               scale1[2] = scale1[2]/scale2[2];
+               scale2[0] = 1.0/scale2[0];
+               scale2[1] = 1.0/scale2[1];
+               scale2[2] = 1.0/scale2[2];
+               scale1 = scale1 * scale2;
                MT_Matrix3x3 invori = obj->NodeGetWorldOrientation().inverse();
-               MT_Vector3 newpos = invori*(NodeGetWorldPosition()-obj->NodeGetWorldPosition())*scale1;
+               MT_Vector3 newpos = invori*(NodeGetWorldPosition()-obj->NodeGetWorldPosition())*scale2;
 
                NodeSetLocalScale(scale1);
                NodeSetLocalPosition(MT_Point3(newpos[0],newpos[1],newpos[2]));
@@ -914,6 +915,7 @@ void KX_GameObject::Suspend()
 PyMethodDef KX_GameObject::Methods[] = {
        {"getPosition", (PyCFunction) KX_GameObject::sPyGetPosition, METH_NOARGS},
        {"setPosition", (PyCFunction) KX_GameObject::sPySetPosition, METH_O},
+       {"setWorldPosition", (PyCFunction) KX_GameObject::sPySetWorldPosition, METH_O},
        {"getLinearVelocity", (PyCFunction) KX_GameObject::sPyGetLinearVelocity, METH_VARARGS},
        {"setLinearVelocity", (PyCFunction) KX_GameObject::sPySetLinearVelocity, METH_VARARGS},
        {"getAngularVelocity", (PyCFunction) KX_GameObject::sPyGetAngularVelocity, METH_VARARGS},
@@ -1576,6 +1578,19 @@ PyObject* KX_GameObject::PySetPosition(PyObject* self, PyObject* value)
        return NULL;
 }
 
+PyObject* KX_GameObject::PySetWorldPosition(PyObject* self, PyObject* value)
+{
+       MT_Point3 pos;
+       if (PyVecTo(value, pos))
+       {
+               NodeSetWorldPosition(pos);
+               NodeUpdateGS(0.f,true);
+               Py_RETURN_NONE;
+       }
+
+       return NULL;
+}
+
 PyObject* KX_GameObject::PyGetPhysicsId(PyObject* self)
 {
        KX_IPhysicsController* ctrl = GetPhysicsController();
index 98b3f3b4c3f42b195efbb990fbf286915ff8aa05..2da0be4df251721230484d32df91c4defd427b00 100644 (file)
@@ -754,6 +754,7 @@ public:
 
        KX_PYMETHOD_NOARGS(KX_GameObject,GetPosition);
        KX_PYMETHOD_O(KX_GameObject,SetPosition);
+       KX_PYMETHOD_O(KX_GameObject,SetWorldPosition);
        KX_PYMETHOD_VARARGS(KX_GameObject,GetLinearVelocity);
        KX_PYMETHOD_VARARGS(KX_GameObject,SetLinearVelocity);
        KX_PYMETHOD_VARARGS(KX_GameObject,GetAngularVelocity);
index 979015532e3f93060096f5be34b785a0634f8083..e0f171e78e0f0d5c836d5709c51ef72542d419dd 100644 (file)
@@ -65,6 +65,13 @@ KX_LightObject::KX_LightObject(void* sgReplicationInfo,SG_Callbacks callbacks,
 
 KX_LightObject::~KX_LightObject()
 {
+       GPULamp *lamp;
+
+       if((lamp = GetGPULamp())) {
+               float obmat[4][4] = {{0}};
+               GPU_lamp_update(lamp, 0, obmat);
+       }
+
        m_rendertools->RemoveLight(&m_lightobj);
 }
 
index 228709999a5fcdc885bdae6448a89da9a2600e4d..0747761ea0ad1efc9a97db02b8f7d8178f6028ae 100644 (file)
@@ -443,11 +443,12 @@ void      CcdPhysicsEnvironment::updateCcdPhysicsController(CcdPhysicsController* ctr
        // this function is used when the collisionning group of a controller is changed
        // remove and add the collistioning object
        btRigidBody* body = ctrl->GetRigidBody();
-       btVector3 inertia;
+       btVector3 inertia(0.0,0.0,0.0);
 
        m_dynamicsWorld->removeCollisionObject(body);
        body->setCollisionFlags(newCollisionFlags);
-       body->getCollisionShape()->calculateLocalInertia(newMass, inertia);
+       if (newMass)
+               body->getCollisionShape()->calculateLocalInertia(newMass, inertia);
        body->setMassProps(newMass, inertia);
        m_dynamicsWorld->addCollisionObject(body, newCollisionGroup, newCollisionMask);
        // to avoid nasty interaction, we must update the property of the controller as well
index 9729b14a43f436e7964418453df9b84f82b88a51..ff9b4ffc95bed19dfe1d90d4bd5363cfad838533 100644 (file)
@@ -58,7 +58,16 @@ class KX_GameObject:
                """
        def setPosition(pos):
                """
-               Sets the game object's position.
+               Sets the game object's position. 
+               Global coordinates for root object, local for child objects.
+               
+               
+               @type pos: [x, y, z]
+               @param pos: the new position, in local coordinates.
+               """
+       def setWorldPosition(pos):
+               """
+               Sets the game object's position in world coordinates regardless if the object is root or child.
                
                @type pos: [x, y, z]
                @param pos: the new position, in world coordinates.