Merging trunk up to r38167.
authorJoerg Mueller <nexyon@gmail.com>
Wed, 6 Jul 2011 20:26:56 +0000 (20:26 +0000)
committerJoerg Mueller <nexyon@gmail.com>
Wed, 6 Jul 2011 20:26:56 +0000 (20:26 +0000)
26 files changed:
doc/python_api/examples/bge.texture.1.py [new file with mode: 0644]
doc/python_api/examples/bge.texture.py [new file with mode: 0644]
doc/python_api/examples/blf.py [new file with mode: 0644]
doc/python_api/rst/bge.logic.rst
doc/python_api/rst/bge.texture.rst [new file with mode: 0644]
intern/ghost/intern/GHOST_SystemCocoa.mm
intern/ghost/intern/GHOST_SystemX11.cpp
intern/smoke/intern/WAVELET_NOISE.h
source/blender/avi/AVI_avi.h
source/blender/avi/CMakeLists.txt
source/blender/avi/SConscript
source/blender/avi/intern/avi.c
source/blender/avi/intern/options.c
source/blender/blenkernel/intern/anim.c
source/blender/blenkernel/intern/material.c
source/blender/blenlib/BLI_math_base.h
source/blender/blenlib/BLI_winstuff.h
source/blender/blenlib/intern/storage.c
source/blender/editors/object/object_relations.c
source/blender/editors/space_sequencer/sequencer_draw.c
source/blender/editors/space_sequencer/sequencer_edit.c
source/blender/imbuf/intern/util.c
source/blender/nodes/intern/TEX_nodes/TEX_texture.c
source/blender/render/intern/source/rendercore.c
source/blender/render/intern/source/shadeinput.c
source/gameengine/Ketsji/KX_PythonInit.cpp

diff --git a/doc/python_api/examples/bge.texture.1.py b/doc/python_api/examples/bge.texture.1.py
new file mode 100644 (file)
index 0000000..5b387c8
--- /dev/null
@@ -0,0 +1,38 @@
+"""
+Texture replacement
+++++++++++++++++++++++
+Example of how to replace a texture in game with an external image.
+createTexture() and removeTexture() are to be called from a module Python
+Controller.
+"""
+import bge
+from bge import logic
+from bge import texture        
+
+def createTexture(cont):
+    """Create a new Dynamic Texture"""
+    object = cont.owner
+       
+    # get the reference pointer (ID) of the internal texture
+    ID = VT.materialID(obj, 'IMoriginal.png')
+       
+    # create a texture object 
+    object_texture = texture.Texture(object, ID)
+       
+    # create a new source with an external image
+    url = logic.expandPath("//newtexture.jpg")
+    new_source = texture.ImageFFmpeg(url)
+       
+    # the texture has to be stored in a permanent Python object
+    logic.texture = object_texture
+       
+    # update/replace the texture
+    logic.texture.source = new_source
+    logic.texture.refresh(False)
+
+def removeTexture(cont):
+    """Delete the Dynamic Texture, reversing back the final to its original state."""
+    try:
+        del logic.texture
+    except:
+        pass
diff --git a/doc/python_api/examples/bge.texture.py b/doc/python_api/examples/bge.texture.py
new file mode 100644 (file)
index 0000000..b27c357
--- /dev/null
@@ -0,0 +1,32 @@
+"""
+Basic Video Playback
+++++++++++++++++++++++
+Example of how to replace a texture in game with a video. It needs to run everyframe
+"""
+import bge
+from bge import texture
+from bge import logic
+
+cont = logic.getCurrentController()
+obj = cont.owner
+       
+# the creation of the texture must be done once: save the 
+# texture object in an attribute of bge.logic module makes it persistent
+if not hasattr(logic, 'video'):
+       
+    # identify a static texture by name
+    matID = texture.materialID(obj, 'IMvideo.png')
+               
+    # create a dynamic texture that will replace the static texture
+    logic.video = texture.Texture(obj, matID)
+
+    # define a source of image for the texture, here a movie
+    movie = logic.expandPath('//trailer_400p.ogg')
+    logic.video.source = texture.VideoFFmpeg(movie)
+    logic.video.source.scale = True
+               
+    # quick off the movie, but it wont play in the background
+    logic.video.source.play()
+
+# you need to call this function every frame to ensure update of the texture.
+logic.video.refresh(True)
\ No newline at end of file
diff --git a/doc/python_api/examples/blf.py b/doc/python_api/examples/blf.py
new file mode 100644 (file)
index 0000000..c91b41b
--- /dev/null
@@ -0,0 +1,42 @@
+"""
+Hello World Text Example
+++++++++++++++++++++++++
+Blender Game Engine example of using the blf module. For this module to work we
+need to use the OpenGL wrapper :class:`~bgl` as well.
+"""
+# import game engine modules
+import bge
+from bge import render
+from bge import logic
+# import stand alone modules
+import bgl
+import blf
+
+def init():
+    """init function - runs once"""
+    # create a new font object, use external ttf file
+    font_path = logic.expandPath('//Zeyada.ttf')
+       # store the font indice - to use later
+    logic.font_id = blf.load(font_path)
+
+    # set the font drawing routine to run every frame   
+    scene = logic.getCurrentScene()
+    scene.post_draw=[write]
+
+def write():
+    """write on screen"""
+    width = render.getWindowWidth()
+    height = render.getWindowHeight()
+    
+    # OpenGL setup
+    bgl.glMatrixMode(bgl.GL_PROJECTION)
+    bgl.glLoadIdentity()
+    bgl.gluOrtho2D(0, width, 0, height)
+    bgl.glMatrixMode(bgl.GL_MODELVIEW)
+    bgl.glLoadIdentity()
+    
+    # BLF drawing routine
+    font_id = logic.font_id
+    blf.position(font_id, (width*0.2), (height*0.3), 0)
+    blf.size(font_id, 50, 72)
+    blf.draw(font_id, "Hello World")
index 0af4a1184d6cff20670aef013c3cbab1d028f815..f7163ea928e08104f1068790f5403b7f5c14bc40 100644 (file)
@@ -17,7 +17,7 @@ Module to access logic functions, imported automatically into the python control
    # To get the game object this controller is on:
    obj = cont.owner
 
-:class:`~bge.types.KX_GameObject` and :class:`~bge.types.KX_Camera` or :class:`bge.types.~KX_LightObject` methods are available depending on the type of object
+:class:`~bge.types.KX_GameObject` and :class:`~bge.types.KX_Camera` or :class:`~bge.types.KX_LightObject` methods are available depending on the type of object
 
 .. code-block:: python
 
diff --git a/doc/python_api/rst/bge.texture.rst b/doc/python_api/rst/bge.texture.rst
new file mode 100644 (file)
index 0000000..49016d1
--- /dev/null
@@ -0,0 +1,451 @@
+
+Game Engine bge.texture Module
+==============================
+
+.. note::
+       This documentation is still very weak, and needs some help! Right now they are mostly a collection
+       of the docstrings found in the bge.texture source code + some random places filled with text.
+
+*****
+Intro
+*****
+
+The bge.texture module allows you to manipulate textures during the game.
+
+Several sources for texture are possible: video files, image files, video capture, memory buffer, camera render or a mix of that.
+
+The video and image files can be loaded from the internet using an URL instead of a file name.
+
+In addition, you can apply filters on the images before sending them to the GPU, allowing video effect: blue screen, color band, gray, normal map.
+
+bge.texture uses FFmpeg to load images and videos. All the formats and codecs that FFmpeg supports are supported by this module, including but not limited to::
+
+       * AVI
+       * Ogg
+       * Xvid
+       * Theora
+       * dv1394 camera
+       * video4linux capture card (this includes many webcams)
+       * videoForWindows capture card (this includes many webcams)
+       * JPG 
+
+The principle is simple: first you identify a texture on an existing object using 
+the :materialID: function, then you create a new texture with dynamic content
+and swap the two textures in the GPU.
+
+The GE is not aware of the substitution and continues to display the object as always, 
+except that you are now in control of the texture.
+
+When the texture object is deleted, the new texture is deleted and the old texture restored.
+
+.. module:: bge.texture
+
+.. class:: VideoFFmpeg(file [, capture=-1, rate=25.0, width=0, height=0])
+
+       FFmpeg video source
+   
+       .. attribute:: status
+               video status
+               
+       .. attribute::  range
+               replay range
+               
+       .. attribute:: repeat
+               repeat count, -1 for infinite repeat
+               
+               :type: int
+       
+       .. attribute:: framerate
+               frame rate
+               
+               :type: float
+               
+       .. attribute:: valid
+               Tells if an image is available
+               
+               :type: bool
+               
+       .. attribute:: image
+               image data
+               
+       .. attribute:: size
+               image size
+               
+       .. attribute:: scale
+               fast scale of image (near neighbour)
+               
+       .. attribute:: flip
+               flip image vertically
+               
+       .. attribute:: filter
+               pixel filter
+               
+       .. attribute:: preseek
+               number of frames of preseek
+               
+               :type: int
+               
+       .. attribute:: deinterlace
+               deinterlace image
+               
+               :type: bool
+   
+       .. method:: play()
+               Play (restart) video
+               
+       .. method:: pause()
+               pause video
+               
+       .. method:: stop()
+               stop video (play will replay it from start)
+               
+       .. method:: refresh()
+               Refresh video - get its status
+
+.. class:: ImageFFmpeg(file)
+
+       FFmpeg image source
+       
+       .. attribute:: status
+               video status
+       
+       .. attribute:: valid
+               Tells if an image is available
+               
+               :type: bool
+               
+       .. attribute:: image
+               image data
+               
+       .. attribute:: size
+               image size
+               
+       .. attribute:: scale
+               fast scale of image (near neighbour)
+               
+       .. attribute:: flip
+               flip image vertically
+               
+       .. attribute:: filter
+               pixel filter
+               
+       .. method:: refresh()
+               Refresh image, i.e. load it
+               
+       .. method:: reload([newname])
+               Reload image, i.e. reopen it
+               
+.. class:: ImageBuff()
+       
+       Image source from image buffer
+       
+       .. attribute:: filter
+               pixel filter
+       
+       .. attribute:: flip
+               flip image vertically
+       
+       .. attribute:: image
+               image data
+       
+       .. method:: load(imageBuffer, width, height)
+               Load image from buffer
+       
+       .. method:: plot(imageBuffer, width, height, positionX, positionY)
+               update image buffer
+       
+       .. attribute:: scale
+               fast scale of image (near neighbour)
+       
+       .. attribute:: size
+               image size
+       
+       .. attribute:: valid
+               bool to tell if an image is available
+
+.. class:: ImageMirror(scene)
+       
+       Image source from mirror
+       
+       .. attribute:: alpha
+               use alpha in texture
+       
+       .. attribute:: background
+               background color
+       
+       .. attribute:: capsize
+               size of render area
+       
+       .. attribute:: clip
+               clipping distance
+       
+       .. attribute:: filter
+               pixel filter
+       
+       .. attribute:: flip
+               flip image vertically
+       
+       .. attribute:: image
+               image data
+       
+       .. method:: refresh(imageMirror)
+               Refresh image - invalidate its current content
+       
+       .. attribute:: scale
+               fast scale of image (near neighbour)
+       
+       .. attribute:: size
+               image size
+       
+       .. attribute:: valid
+               bool to tell if an image is available
+       
+       .. attribute:: whole
+               use whole viewport to render
+
+.. class:: ImageMix()
+       
+       Image mixer
+       
+       .. attribute:: filter
+               pixel filter
+       
+       .. attribute:: flip
+               flip image vertically
+       
+       .. method:: getSource(imageMix)
+               get image source
+       
+       .. method:: getWeight(imageMix)
+               get image source weight
+       
+       .. attribute:: image
+               image data
+       
+       .. method:: refresh(imageMix)
+               Refresh image - invalidate its current content
+       
+       .. attribute:: scale
+               fast scale of image (near neighbour)
+       
+       .. method:: setSource(imageMix)
+               set image source
+       
+       .. method:: setWeight(imageMix)
+               set image source weight
+       
+       .. attribute:: valid
+               bool to tell if an image is available
+
+.. class:: ImageRender(scene, camera)
+       
+       Image source from render
+       
+       .. attribute:: alpha
+               use alpha in texture
+       
+       .. attribute:: background
+               background color
+       
+       .. attribute:: capsize
+               size of render area
+       
+       .. attribute:: filter
+               pixel filter
+       
+       .. attribute:: flip
+               flip image vertically
+       
+       .. attribute:: image
+               image data
+       
+       .. method:: refresh(imageRender)
+               Refresh image - invalidate its current content
+       
+       .. attribute:: scale
+               fast scale of image (near neighbour)
+       
+       .. attribute:: size
+               image size
+       
+       .. attribute:: valid
+               bool to tell if an image is available
+       
+       .. attribute:: whole
+               use whole viewport to render
+
+.. class:: ImageViewport()
+       
+       Image source from viewport
+       
+       .. attribute:: alpha
+               use alpha in texture
+       
+       .. attribute:: capsize
+               size of viewport area being captured
+       
+       .. attribute:: filter
+               pixel filter
+       
+       .. attribute:: flip
+               flip image vertically
+       
+       .. attribute:: image
+               image data
+       
+       .. attribute:: position
+               upper left corner of captured area
+       
+       .. method:: refresh(imageViewport)
+               Refresh image - invalidate its current content
+       
+       .. attribute:: scale
+               fast scale of image (near neighbour)
+       
+       .. attribute:: size
+               image size
+       
+       .. attribute:: valid
+               bool to tell if an image is available
+       
+       .. attribute:: whole
+               use whole viewport to capture
+
+.. class:: Texture(gameObj)
+       
+       Texture objects
+       
+       .. attribute:: bindId
+               OpenGL Bind Name
+       
+       .. method:: close(texture)
+               Close dynamic texture and restore original
+       
+       .. attribute:: mipmap
+               mipmap texture
+       
+       .. method:: refresh(texture)
+               Refresh texture from source
+       
+       .. attribute:: source
+               source of texture
+
+.. class:: FilterBGR24()
+       
+       Source filter BGR24 objects
+
+.. class:: FilterBlueScreen()
+       
+       Filter for Blue Screen objects
+       
+       .. attribute:: color
+               blue screen color
+       
+       .. attribute:: limits
+               blue screen color limits
+       
+       .. attribute:: previous
+               previous pixel filter
+
+.. class:: FilterColor()
+       
+       Filter for color calculations
+       
+       .. attribute:: matrix
+               matrix [4][5] for color calculation
+       
+       .. attribute:: previous
+               previous pixel filter
+
+.. class:: FilterGray()
+       
+       Filter for gray scale effect
+       
+       .. attribute:: previous
+               previous pixel filter
+
+.. class:: FilterLevel()
+       
+       Filter for levels calculations
+       
+       .. attribute:: levels
+               levels matrix [4] (min, max)
+       
+       .. attribute:: previous
+               previous pixel filter
+
+.. class:: FilterNormal()
+       
+       Filter for Blue Screen objects
+       
+       .. attribute:: colorIdx
+               index of color used to calculate normal (0 - red, 1 - green, 2 - blue)
+       
+       .. attribute:: depth
+               depth of relief
+       
+       .. attribute:: previous
+               previous pixel filter
+
+.. class:: FilterRGB24()
+       
+       Returns a new input filter object to be used with :class:'ImageBuff' object when the image passed
+       to the ImageBuff.load() function has the 3-bytes pixel format BGR.
+
+.. class:: FilterRGBA32()
+       
+       Source filter RGBA32 objects
+
+.. function:: getLastError()
+       Last error that occurred in a bge.texture function.
+       
+       :return: the description of the last error occurred in a bge.texture function.
+       :rtype: string
+       
+.. function:: imageToArray(image,mode)
+       Returns a :class:`~bgl.buffer` corresponding to the current image stored in a texture source object.
+
+       :arg image: Image source object.
+       :type image: object of type :class:'VideoFFmpeg', :class:'ImageFFmpeg', :class:'ImageBuff', :class:'ImageMix', :class:'ImageRender', :class:'ImageMirror' or :class:'ImageViewport'
+       :arg mode: optional argument representing the pixel format. 
+|                   You can use the characters R, G, B for the 3 color channels, A for the alpha channel, 
+|                   0 to force a fixed 0 color channel and 1 to force a fixed 255 color channel.
+|                   Example: "BGR" will return 3 bytes per pixel with the Blue, Green and Red channels in that order. 
+|                            "RGB1" will return 4 bytes per pixel with the Red, Green, Blue channels in that order and the alpha channel forced to 255.
+|                   The default mode is "RGBA".
+
+       :type mode: string
+       :rtype: :class:`~bgl.buffer`
+       :return: A object representing the image as one dimensional array of bytes of size (pixel_size*width*height),
+       line by line starting from the bottom of the image. The pixel size and format is determined by the mode 
+       parameter.
+       
+.. function materialID(object,name)
+       Returns a numeric value that can be used in :class:'Texture' to create a dynamic texture.
+
+       The value corresponds to an internal material number that uses the texture identified
+       by name. name is a string representing a texture name with IM prefix if you want to
+       identify the texture directly.  This method works for basic tex face and for material,
+       provided the material has a texture channel using that particular texture in first
+       position of the texture stack.  name can also have MA prefix if you want to identify
+       the texture by material. In that case the material must have a texture channel in first
+       position.
+       
+       If the object has no material that matches name, it generates a runtime error. Use try/except to catch the exception.
+       
+       Ex: bge.texture.materialID(obj, 'IMvideo.png')
+       
+       :arg object: the game object that uses the texture you want to make dynamic
+       :type object: game object
+       :arg name: name of the texture/material you want to make dynamic. 
+       :type name: string
+       :rtype: integer
+
+.. function setLogFile(filename)
+       Sets the name of a text file in which runtime error messages will be written, in addition to the printing
+       of the messages on the Python console. Only the runtime errors specific to the VideoTexture module
+       are written in that file, ordinary runtime time errors are not written. 
+
+       :arg filename: name of error log file
+       :type filename: string
+       :rtype: integer
index 69423f2dfbf83c74cbf4e89997efdcad0a87b1fc..bb3d6e3aee331257e563f01162a1c68b43348faf 100644 (file)
@@ -1498,15 +1498,18 @@ GHOST_TSuccess GHOST_SystemCocoa::handleMouseEvent(void *eventPtr)
                                                GHOST_TInt32 x_mouse= mousePos.x;
                                                GHOST_TInt32 y_mouse= mousePos.y;
                                                GHOST_TInt32 x_accum, y_accum, x_cur, y_cur, x, y;
-                                               GHOST_Rect bounds, correctedBounds;
+                                               GHOST_Rect bounds, windowBounds, correctedBounds;
                                                
                                                /* fallback to window bounds */
                                                if(window->getCursorGrabBounds(bounds)==GHOST_kFailure)
                                                        window->getClientBounds(bounds);
                                                
                                                //Switch back to Cocoa coordinates orientation (y=0 at botton,the same as blender internal btw!), and to client coordinates
-                                               window->screenToClient(bounds.m_l, bounds.m_b, correctedBounds.m_l, correctedBounds.m_b);
-                                               window->screenToClient(bounds.m_r, bounds.m_t, correctedBounds.m_r, correctedBounds.m_t);
+                                               window->getClientBounds(windowBounds);
+                                               window->screenToClient(bounds.m_l, bounds.m_b, correctedBounds.m_l, correctedBounds.m_t);
+                                               window->screenToClient(bounds.m_r, bounds.m_t, correctedBounds.m_r, correctedBounds.m_b);
+                                               correctedBounds.m_b = (windowBounds.m_b - windowBounds.m_t) - correctedBounds.m_b;
+                                               correctedBounds.m_t = (windowBounds.m_b - windowBounds.m_t) - correctedBounds.m_t;
                                                
                                                //Update accumulation counts
                                                window->getCursorGrabAccum(x_accum, y_accum);
index c53bf7de36c3afbf58fcdb5dbddaf80d2678c69f..49c330dfd589b6e2d03900b7af88e6c65cf18834 100644 (file)
@@ -1175,7 +1175,9 @@ convertXKey(
                        GXMAP(type,XF86XK_AudioPrev,    GHOST_kKeyMediaFirst);
                        GXMAP(type,XF86XK_AudioRewind,  GHOST_kKeyMediaFirst);
                        GXMAP(type,XF86XK_AudioNext,    GHOST_kKeyMediaLast);
+#ifdef XF86XK_AudioForward /* Debian lenny's XF86keysym.h has no XF86XK_AudioForward define */
                        GXMAP(type,XF86XK_AudioForward, GHOST_kKeyMediaLast);
+#endif
 #endif
 
                                /* some extra sun cruft (NICE KEYBOARD!) */
index edbf4254199c69c5784e6190a7a5a684c4a6d15e..66dfb95d1436c9d3254960da53e4ebdaa366316d 100644 (file)
 
 #include <MERSENNETWISTER.h>
 
+#ifdef WIN32
+#include <float.h>
+#define isnan _isnan
+#endif
+
 // Tile file header, update revision upon any change done to the noise generator
 static const char tilefile_headerstring[] = "Noise Tile File rev. ";
 static const char tilefile_revision[] =  "001";
index 85685e2bd4cbafe3bdf75274962b241b1d7321ad..1446971a8ac7f34e4181e6179493c65aaa259675 100644 (file)
 #ifndef __AVI_H__
 #define __AVI_H__
 
+#include "MEM_sys_types.h"
 #include <stdio.h> /* for FILE */
 
 typedef struct _AviChunk {
   int fcc;
-  int size;
+  int64_t size;
 } AviChunk;
 
 typedef struct _AviList {
@@ -185,16 +186,16 @@ typedef struct _AviMovie {
 #define AVI_MOVIE_READ  0
 #define AVI_MOVIE_WRITE 1
        
-       unsigned long size;
+       int64_t size;
 
        AviMainHeader *header;
        AviStreamRec *streams;
        AviIndexEntry *entries;
        int index_entries;
        
-       int movi_offset;
-       int read_offset;
-       long *offset_table;
+       int64_t movi_offset;
+       int64_t read_offset;
+       int64_t *offset_table;
        
        /* Local data goes here */
        int interlace;
index b62e0cc5afd6b95e86c58d65269b224a4dded621..bae61fd678b268e45af48dbe0961e6db03cb522f 100644 (file)
@@ -27,6 +27,7 @@
 set(INC 
        .
        ../../../intern/guardedalloc
+       ../blenlib
 )
 
 set(INC_SYS
index 0bf8c3c74db3219d208b22b9f834ee5d014bcfdd..4d2ce8fd845026c656f00481705df0e8adab0896 100644 (file)
@@ -3,7 +3,7 @@ Import ('env')
 
 sources = env.Glob('intern/*.c')
 
-incs = '. #/intern/guardedalloc'
+incs = '. #/intern/guardedalloc ../blenlib'
 incs += ' ' + env['BF_JPEG_INC']
 
 env.BlenderLib ('bf_avi', sources, Split(incs), [], libtype=['core','player'], priority = [190,120] )
index 82bf3a3d21b76b9edc1a4190c059b24bdb0a783e..ff3aafbf0655b0517039908544243029922781a1 100644 (file)
@@ -42,6 +42,9 @@
 #include <ctype.h>
 
 #include "MEM_guardedalloc.h"
+#include "MEM_sys_types.h"
+
+#include "BLI_winstuff.h"
 
 #include "AVI_avi.h"
 #include "avi_intern.h"
@@ -593,7 +596,6 @@ AviError AVI_open_movie (const char *name, AviMovie *movie) {
 
        movie->movi_offset = ftell (movie->fp);
        movie->read_offset = movie->movi_offset;
-       if (AVI_DEBUG) printf ("movi_offset is %d\n", movie->movi_offset);
        
        /* Read in the index if the file has one, otherwise create one */
        if (movie->header->Flags & AVIF_HASINDEX) {
@@ -707,8 +709,8 @@ AviError AVI_open_compress (char *name, AviMovie *movie, int streams, ...) {
        AviList list;
        AviChunk chunk;
        int i;
-       int header_pos1, header_pos2;
-       int stream_pos1, stream_pos2;
+       int64_t header_pos1, header_pos2;
+       int64_t stream_pos1, stream_pos2;
 
        movie->type = AVI_MOVIE_WRITE;
        movie->fp = fopen (name, "wb");
@@ -718,7 +720,7 @@ AviError AVI_open_compress (char *name, AviMovie *movie, int streams, ...) {
        if (movie->fp == NULL)
                return AVI_ERROR_OPEN;
 
-       movie->offset_table = (long *) MEM_mallocN ((1+streams*2) * sizeof (long),"offsettable");
+       movie->offset_table = (int64_t *) MEM_mallocN ((1+streams*2) * sizeof (int64_t),"offsettable");
        
        for (i=0; i < 1 + streams*2; i++)
                movie->offset_table[i] = -1L;
@@ -897,7 +899,7 @@ AviError AVI_write_frame (AviMovie *movie, int frame_num, ...) {
        AviIndexEntry *temp;
        va_list ap;
        int stream;
-       long rec_off;
+       int64_t rec_off;
        AviFormat format;
        void *buffer;
        int size;
index edb708d8a691c349fb4cd4619cef9f571be2a916..96c62843436656215a67772ac971e3804bd2b473 100644 (file)
@@ -40,6 +40,8 @@
 #include "avi_intern.h"
 #include "endian.h"
 
+#include "BLI_winstuff.h"
+
 /* avi_set_compress_options gets its own file... now don't WE feel important? */
 
 AviError AVI_set_compress_option (AviMovie *movie, int option_type, int stream, AviOption option, void *opt_data) {
index 0747d87a0ab2c7a096e71ba1c40acaf085a6cd16..8aa816f9cb5b566b155386776c5cb5518358d578 100644 (file)
@@ -719,12 +719,13 @@ static void group_duplilist(ListBase *lb, Scene *scene, Object *ob, int level, i
                /* note, if you check on layer here, render goes wrong... it still deforms verts and uses parent imat */
                if(go->ob!=ob) {
                        
-                       /* Group Dupli Offset, should apply after everything else */
-                       if (group->dupli_ofs[0] || group->dupli_ofs[1] || group->dupli_ofs[2]) {
+                       /* group dupli offset, should apply after everything else */
+                       if(!is_zero_v3(group->dupli_ofs)) {
                                copy_m4_m4(tmat, go->ob->obmat);
                                sub_v3_v3v3(tmat[3], tmat[3], group->dupli_ofs);
                                mul_m4_m4m4(mat, tmat, ob->obmat);
-                       } else {
+                       }
+                       else {
                                mul_m4_m4m4(mat, go->ob->obmat, ob->obmat);
                        }
                        
@@ -1395,7 +1396,17 @@ static void new_particle_duplilist(ListBase *lb, ID *id, Scene *scene, Object *p
 
                        if(part->ren_as==PART_DRAW_GR && psys->part->draw & PART_DRAW_WHOLE_GR) {
                                for(go= part->dup_group->gobject.first, b=0; go; go= go->next, b++) {
-                                       mul_m4_m4m4(tmat, oblist[b]->obmat, pamat);
+
+                                       /* group dupli offset, should apply after everything else */
+                                       if(!is_zero_v3(part->dup_group->dupli_ofs)) {
+                                               copy_m4_m4(tmat, oblist[b]->obmat);
+                                               sub_v3_v3v3(tmat[3], tmat[3], part->dup_group->dupli_ofs);
+                                               mul_m4_m4m4(tmat, tmat, pamat);
+                                       }
+                                       else {
+                                               mul_m4_m4m4(tmat, oblist[b]->obmat, pamat);
+                                       }
+
                                        mul_mat3_m4_fl(tmat, size*scale);
                                        if(par_space_mat)
                                                mul_m4_m4m4(mat, tmat, par_space_mat);
index 334f018efc96cb4c7d3bc6b3b37728e310ecd520..2f29074834b825fe981a9d8b579ae0d4c462de10 100644 (file)
@@ -867,6 +867,10 @@ static void do_init_render_material(Material *ma, int r_mode, float *amb)
 
        if(ma->strand_surfnor > 0.0f)
                ma->mode_l |= MA_STR_SURFDIFF;
+
+       /* parses the geom+tex nodes */
+       if(ma->nodetree && ma->use_nodes)
+               ntreeShaderGetTexcoMode(ma->nodetree, r_mode, &ma->texco, &ma->mode_l);
 }
 
 static void init_render_nodetree(bNodeTree *ntree, Material *basemat, int r_mode, float *amb)
@@ -887,8 +891,6 @@ static void init_render_nodetree(bNodeTree *ntree, Material *basemat, int r_mode
                                init_render_nodetree((bNodeTree *)node->id, basemat, r_mode, amb);
                }
        }
-       /* parses the geom+tex nodes */
-       ntreeShaderGetTexcoMode(ntree, r_mode, &basemat->texco, &basemat->mode_l);
 }
 
 void init_render_material(Material *mat, int r_mode, float *amb)
index 6ff57b087247243dbbe901562151c7779dd2ec14..b5bab6f15be68fd0a66574f6f04196e8804a938f 100644 (file)
 #include <math.h>
 #include "BLI_math_inline.h"
 
+#ifdef __sun__
+#include <ieeefp.h> /* for finite() */
+#endif
+
 #ifndef M_PI
 #define M_PI        3.14159265358979323846
 #endif
index d0eb3c7d67d3d6a4713cf87c146cc9ac80ab4ec4..e0c819c2dba31327356ff2ccab1e5b7556b268b9 100644 (file)
@@ -98,6 +98,15 @@ extern "C" {
 typedef unsigned int mode_t;
 #endif
 
+/* use functions that take a 64 bit offset for files larger than 4GB */
+#ifndef FREE_WINDOWS
+#include <stdio.h>
+#define fseek(stream, offset, origin) _fseeki64(stream, offset, origin)
+#define ftell(stream) _ftelli64(stream)
+#define lseek(fd, offset, origin) _lseeki64(fd, offset, origin)
+#define tell(fd) _telli64(fd)
+#endif
+
 /* mingw using _SSIZE_T_ to declare ssize_t type */
 #ifndef _SSIZE_T_
 #define _SSIZE_T_
index e9db148e992753645bd34a7b30514a68c4d1aaf9..41eedef8835e9bfb748b8a09baac41f8bf6f3c75 100644 (file)
@@ -478,7 +478,7 @@ LinkNode *BLI_read_file_as_lines(const char *name)
        FILE *fp= fopen(name, "r");
        LinkNode *lines= NULL;
        char *buf;
-       int size;
+       int64_t size;
 
        if (!fp) return NULL;
                
index f3b67867d7ff45af18c6fadbda8d74650b52ec35..285b08c521bac37069d2116a19b448c9356c30f4 100644 (file)
@@ -1660,6 +1660,7 @@ void ED_object_single_users(Main *bmain, Scene *scene, int full)
 
        if(full) {
                single_obdata_users(bmain, scene, 0);
+               single_object_action_users(scene, 0);
                single_mat_users_expand(bmain);
                single_tex_users_expand(bmain);
        }
index e1efd5b4622835498627083945c9cc2f3ad1ae7e..1ed262c3e2310c9af9cae783f136c39d5900e935 100644 (file)
@@ -644,10 +644,12 @@ static void draw_seq_strip(Scene *scene, ARegion *ar, Sequence *seq, int outline
        if (G.moving && (seq->flag & SELECT)) {
                if(seq->flag & SEQ_OVERLAP) {
                        col[0]= 255; col[1]= col[2]= 40;
-               } else UI_GetColorPtrBlendShade3ubv(col, col, col, 0.0, 120);
+               }
+               else
+                       UI_GetColorPtrBlendShade3ubv(col, col, col, 0.0, 120+outline_tint);
        }
-
-       UI_GetColorPtrBlendShade3ubv(col, col, col, 0.0, outline_tint);
+       else
+               UI_GetColorPtrBlendShade3ubv(col, col, col, 0.0, outline_tint);
        
        glColor3ubv((GLubyte *)col);
        
@@ -970,7 +972,7 @@ static void draw_seq_strips(const bContext *C, Editing *ed, ARegion *ar)
                /* loop through strips, checking for those that are visible */
                for (seq= ed->seqbasep->first; seq; seq= seq->next) {
                        /* boundbox and selection tests for NOT drawing the strip... */
-                       if ((seq->flag & SELECT) == sel) continue;
+                       if ((seq->flag & SELECT) != sel) continue;
                        else if (seq == last_seq) continue;
                        else if (MIN2(seq->startdisp, seq->start) > v2d->cur.xmax) continue;
                        else if (MAX2(seq->enddisp, seq->start+seq->len) < v2d->cur.xmin) continue;
index 46638007fb1d038f72d9c7a04c3f6c9158eeba8b..4252d051154871879bf479929e447fa6a85c22eb 100644 (file)
@@ -125,6 +125,7 @@ typedef struct TransSeq {
        int startstill, endstill;
        int startdisp, enddisp;
        int startofs, endofs;
+       int anim_startofs, anim_endofs;
        /* int final_left, final_right; */ /* UNUSED */
        int len;
 } TransSeq;
@@ -732,8 +733,10 @@ static Sequence *cut_seq_hard(Scene *scene, Sequence * seq, int cutframe)
        ts.endstill= seq->endstill;
        ts.startdisp= seq->startdisp;
        ts.enddisp= seq->enddisp;
-       ts.startofs= seq->anim_startofs;
-       ts.endofs= seq->anim_endofs;
+       ts.startofs= seq->startofs;
+       ts.endofs= seq->endofs;
+       ts.anim_startofs= seq->anim_startofs;
+       ts.anim_endofs= seq->anim_endofs;
        ts.len= seq->len;
        
        /* First Strip! */
@@ -783,7 +786,7 @@ static Sequence *cut_seq_hard(Scene *scene, Sequence * seq, int cutframe)
                if ((seqn->startstill) && (cutframe == seqn->start + 1)) {
                        seqn->start = ts.start;
                        seqn->startstill= ts.start- cutframe;
-                       seqn->anim_endofs = ts.endofs;
+                       seqn->anim_endofs = ts.anim_endofs;
                        seqn->endstill = ts.endstill;
                }
                
@@ -792,8 +795,9 @@ static Sequence *cut_seq_hard(Scene *scene, Sequence * seq, int cutframe)
                        seqn->start = cutframe;
                        seqn->startstill = 0;
                        seqn->startofs = 0;
+                       seqn->endofs = ts.endofs;
                        seqn->anim_startofs += cutframe - ts.start;
-                       seqn->anim_endofs = ts.endofs;
+                       seqn->anim_endofs = ts.anim_endofs;
                        seqn->endstill = ts.endstill;
                }                               
                
@@ -828,6 +832,8 @@ static Sequence *cut_seq_soft(Scene *scene, Sequence * seq, int cutframe)
        ts.enddisp= seq->enddisp;
        ts.startofs= seq->startofs;
        ts.endofs= seq->endofs;
+       ts.anim_startofs= seq->anim_startofs;
+       ts.anim_endofs= seq->anim_endofs;
        ts.len= seq->len;
        
        /* First Strip! */
@@ -1781,19 +1787,21 @@ static int sequencer_separate_images_exec(bContext *C, wmOperator *op)
                                /* new seq */
                                se = give_stripelem(seq, cfra);
 
-                               seq_new= alloc_sequence(ed->seqbasep, start_ofs, seq->machine);
+                               seq_new= seq_dupli_recursive(scene, scene, seq, SEQ_DUPE_UNIQUE_NAME);
+                               BLI_addtail(&ed->seqbase, seq_new);
+
+                               seq_new->start= start_ofs;
                                seq_new->type= SEQ_IMAGE;
                                seq_new->len = 1;
                                seq_new->endstill = step-1;
 
                                /* new strip */
-                               seq_new->strip= strip_new= MEM_callocN(sizeof(Strip)*1, "strip");
+                               strip_new= seq_new->strip;
                                strip_new->len= 1;
                                strip_new->us= 1;
-                               strncpy(strip_new->dir, seq->strip->dir, FILE_MAXDIR-1);
 
                                /* new stripdata */
-                               strip_new->stripdata= se_new= MEM_callocN(sizeof(StripElem)*1, "stripelem");
+                               se_new= strip_new->stripdata;
                                BLI_strncpy(se_new->name, se->name, sizeof(se_new->name));
                                calc_sequence(scene, seq_new);
 
@@ -1805,8 +1813,6 @@ static int sequencer_separate_images_exec(bContext *C, wmOperator *op)
                                }
 
                                /* XXX, COPY FCURVES */
-                               strncpy(seq_new->name+2, seq->name+2, sizeof(seq->name)-2);
-                               seqbase_unique_name_recursive(&scene->ed->seqbase, seq_new);
 
                                cfra++;
                                start_ofs += step;
index fe85f63e109d048c3e3d1db15ee21c0b690c4bde..6db8dcc06cf1a88f75c75b872b4895db553d0852 100644 (file)
@@ -113,6 +113,7 @@ const char *imb_ext_movie[] = {
        ".m4v",
        ".m2v",
        ".m2t",
+       ".m2ts",
        ".mts",
        ".mv",
        ".avs",
index d4d77b5fd5afb201cc011e7a42b7e79c7df35d66..c58595866afc4c12a616aedd2e3946c2da0dfc7f 100644 (file)
@@ -49,18 +49,18 @@ static bNodeSocketType outputs[]= {
 
 static void colorfn(float *out, TexParams *p, bNode *node, bNodeStack **in, short thread)
 {
+       Tex *nodetex = (Tex *)node->id;
        static float red[] = {1,0,0,1};
        static float white[] = {1,1,1,1};
-       float *co = p->co;
-       
-       Tex *nodetex = (Tex *)node->id;
+       float co[3], dxt[3], dyt[3];
+
+       copy_v3_v3(co, p->co);
+       copy_v3_v3(dxt, p->dxt);
+       copy_v3_v3(dyt, p->dyt);
        
        if(node->custom2 || node->need_exec==0) {
                /* this node refers to its own texture tree! */
-               QUATCOPY(
-                       out,
-                       (fabs(co[0] - co[1]) < .01) ? white : red 
-               );
+               QUATCOPY(out, (fabs(co[0] - co[1]) < .01) ? white : red );
        }
        else if(nodetex) {
                TexResult texres;
@@ -70,9 +70,9 @@ static void colorfn(float *out, TexParams *p, bNode *node, bNodeStack **in, shor
                
                tex_input_rgba(col1, in[0], p, thread);
                tex_input_rgba(col2, in[1], p, thread);
-               
+
                texres.nor = nor;
-               textype = multitex_nodes(nodetex, co, p->dxt, p->dyt, p->osatex,
+               textype = multitex_nodes(nodetex, co, dxt, dyt, p->osatex,
                        &texres, thread, 0, p->shi, p->mtex);
                
                if(textype & TEX_RGB) {
index 2fa6bed5aae4141957958863027c804099187812..3aca334cffe096d74a57fd6a6d8e45a15f2972ee 100644 (file)
@@ -627,6 +627,12 @@ static void add_passes(RenderLayer *rl, int offset, ShadeInput *shi, ShadeResult
                                        *fp= (float)shi->obr->ob->index;
                                }
                                break;
+                       case SCE_PASS_INDEXMA:
+                               if(shi->vlr) {
+                                       fp= rpass->rect + offset;
+                                       *fp= (float)shi->mat->index;
+                               }
+                               break;
                        case SCE_PASS_MIST:
                                fp= rpass->rect + offset;
                                *fp= shr->mist;
index a1b79346824087d9751779e4bbed679028229888..eab66aaf2ec166fbb16480bba7d4c68e94c86a21 100644 (file)
@@ -771,7 +771,8 @@ void shade_input_set_uv(ShadeInput *shi)
                        t00= v3[axis1]-v1[axis1]; t01= v3[axis2]-v1[axis2];
                        t10= v3[axis1]-v2[axis1]; t11= v3[axis2]-v2[axis2];
 
-                       detsh= 1.0f/(t00*t11-t10*t01);
+                       detsh= (t00*t11-t10*t01);
+                       detsh= (detsh != 0.0f)? 1.0f/detsh: 0.0f;
                        t00*= detsh; t01*=detsh; 
                        t10*=detsh; t11*=detsh;
 
@@ -1272,8 +1273,9 @@ void shade_input_set_shade_texco(ShadeInput *shi)
                                s11= ho3[1]/ho3[3] - ho2[1]/ho2[3];
                                
                                detsh= s00*s11-s10*s01;
-                               s00/= detsh; s01/=detsh; 
-                               s10/=detsh; s11/=detsh;
+                               detsh= (detsh != 0.0f)? 1.0f/detsh: 0.0f;
+                               s00*= detsh; s01*=detsh; 
+                               s10*=detsh; s11*=detsh;
                                
                                /* recalc u and v again */
                                hox= x/Zmulx -1.0f;
index c8a6ae5a6d0d575ae363a01907c6eef30820b9b6..a927de60cd832aff7885a0806fdaa74f97779b7b 100644 (file)
@@ -327,7 +327,7 @@ static PyObject* gPyLoadGlobalDict(PyObject*)
 {
        char marshal_path[512];
        char *marshal_buffer = NULL;
-       unsigned int marshal_length;
+       size_t marshal_length;
        FILE *fp = NULL;
        int result;
 
@@ -338,7 +338,7 @@ static PyObject* gPyLoadGlobalDict(PyObject*)
        if (fp) {
                // obtain file size:
                fseek (fp, 0, SEEK_END);
-               marshal_length = ftell(fp);
+               marshal_length = (size_t)ftell(fp);
                rewind(fp);
 
                marshal_buffer = (char*)malloc (sizeof(char)*marshal_length);