Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoerg Mueller <nexyon@gmail.com>2011-07-07 00:26:56 +0400
committerJoerg Mueller <nexyon@gmail.com>2011-07-07 00:26:56 +0400
commit34c5784f992f64e52f5b07e0f457ec53d9709874 (patch)
treeedad94020584cc192007960edf17da0957a66c51
parent44220bba7a8f2f09264ea1e581096d65a00579e4 (diff)
parenta83c3c0b1422713d8553965988c3096955eaa452 (diff)
Merging trunk up to r38167.
-rw-r--r--doc/python_api/examples/bge.texture.1.py38
-rw-r--r--doc/python_api/examples/bge.texture.py32
-rw-r--r--doc/python_api/examples/blf.py42
-rw-r--r--doc/python_api/rst/bge.logic.rst2
-rw-r--r--doc/python_api/rst/bge.texture.rst451
-rw-r--r--intern/ghost/intern/GHOST_SystemCocoa.mm9
-rw-r--r--intern/ghost/intern/GHOST_SystemX11.cpp2
-rw-r--r--intern/smoke/intern/WAVELET_NOISE.h5
-rw-r--r--source/blender/avi/AVI_avi.h11
-rw-r--r--source/blender/avi/CMakeLists.txt1
-rw-r--r--source/blender/avi/SConscript2
-rw-r--r--source/blender/avi/intern/avi.c12
-rw-r--r--source/blender/avi/intern/options.c2
-rw-r--r--source/blender/blenkernel/intern/anim.c19
-rw-r--r--source/blender/blenkernel/intern/material.c6
-rw-r--r--source/blender/blenlib/BLI_math_base.h4
-rw-r--r--source/blender/blenlib/BLI_winstuff.h9
-rw-r--r--source/blender/blenlib/intern/storage.c2
-rw-r--r--source/blender/editors/object/object_relations.c1
-rw-r--r--source/blender/editors/space_sequencer/sequencer_draw.c10
-rw-r--r--source/blender/editors/space_sequencer/sequencer_edit.c26
-rw-r--r--source/blender/imbuf/intern/util.c1
-rw-r--r--source/blender/nodes/intern/TEX_nodes/TEX_texture.c18
-rw-r--r--source/blender/render/intern/source/rendercore.c6
-rw-r--r--source/blender/render/intern/source/shadeinput.c8
-rw-r--r--source/gameengine/Ketsji/KX_PythonInit.cpp4
26 files changed, 673 insertions, 50 deletions
diff --git a/doc/python_api/examples/bge.texture.1.py b/doc/python_api/examples/bge.texture.1.py
new file mode 100644
index 00000000000..5b387c8659c
--- /dev/null
+++ b/doc/python_api/examples/bge.texture.1.py
@@ -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
index 00000000000..b27c357b1ee
--- /dev/null
+++ b/doc/python_api/examples/bge.texture.py
@@ -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
index 00000000000..c91b41bec36
--- /dev/null
+++ b/doc/python_api/examples/blf.py
@@ -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")
diff --git a/doc/python_api/rst/bge.logic.rst b/doc/python_api/rst/bge.logic.rst
index 0af4a1184d6..f7163ea928e 100644
--- a/doc/python_api/rst/bge.logic.rst
+++ b/doc/python_api/rst/bge.logic.rst
@@ -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
index 00000000000..49016d1e03d
--- /dev/null
+++ b/doc/python_api/rst/bge.texture.rst
@@ -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
diff --git a/intern/ghost/intern/GHOST_SystemCocoa.mm b/intern/ghost/intern/GHOST_SystemCocoa.mm
index 69423f2dfbf..bb3d6e3aee3 100644
--- a/intern/ghost/intern/GHOST_SystemCocoa.mm
+++ b/intern/ghost/intern/GHOST_SystemCocoa.mm
@@ -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);
diff --git a/intern/ghost/intern/GHOST_SystemX11.cpp b/intern/ghost/intern/GHOST_SystemX11.cpp
index c53bf7de36c..49c330dfd58 100644
--- a/intern/ghost/intern/GHOST_SystemX11.cpp
+++ b/intern/ghost/intern/GHOST_SystemX11.cpp
@@ -1175,8 +1175,10 @@ 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!) */
#ifdef __sun__
diff --git a/intern/smoke/intern/WAVELET_NOISE.h b/intern/smoke/intern/WAVELET_NOISE.h
index edbf4254199..66dfb95d143 100644
--- a/intern/smoke/intern/WAVELET_NOISE.h
+++ b/intern/smoke/intern/WAVELET_NOISE.h
@@ -45,6 +45,11 @@
#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";
diff --git a/source/blender/avi/AVI_avi.h b/source/blender/avi/AVI_avi.h
index 85685e2bd4c..1446971a8ac 100644
--- a/source/blender/avi/AVI_avi.h
+++ b/source/blender/avi/AVI_avi.h
@@ -55,11 +55,12 @@
#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;
diff --git a/source/blender/avi/CMakeLists.txt b/source/blender/avi/CMakeLists.txt
index b62e0cc5afd..bae61fd678b 100644
--- a/source/blender/avi/CMakeLists.txt
+++ b/source/blender/avi/CMakeLists.txt
@@ -27,6 +27,7 @@
set(INC
.
../../../intern/guardedalloc
+ ../blenlib
)
set(INC_SYS
diff --git a/source/blender/avi/SConscript b/source/blender/avi/SConscript
index 0bf8c3c74db..4d2ce8fd845 100644
--- a/source/blender/avi/SConscript
+++ b/source/blender/avi/SConscript
@@ -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] )
diff --git a/source/blender/avi/intern/avi.c b/source/blender/avi/intern/avi.c
index 82bf3a3d21b..ff3aafbf065 100644
--- a/source/blender/avi/intern/avi.c
+++ b/source/blender/avi/intern/avi.c
@@ -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;
diff --git a/source/blender/avi/intern/options.c b/source/blender/avi/intern/options.c
index edb708d8a69..96c62843436 100644
--- a/source/blender/avi/intern/options.c
+++ b/source/blender/avi/intern/options.c
@@ -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) {
diff --git a/source/blender/blenkernel/intern/anim.c b/source/blender/blenkernel/intern/anim.c
index 0747d87a0ab..8aa816f9cb5 100644
--- a/source/blender/blenkernel/intern/anim.c
+++ b/source/blender/blenkernel/intern/anim.c
@@ -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);
diff --git a/source/blender/blenkernel/intern/material.c b/source/blender/blenkernel/intern/material.c
index 334f018efc9..2f29074834b 100644
--- a/source/blender/blenkernel/intern/material.c
+++ b/source/blender/blenkernel/intern/material.c
@@ -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)
diff --git a/source/blender/blenlib/BLI_math_base.h b/source/blender/blenlib/BLI_math_base.h
index 6ff57b08724..b5bab6f15be 100644
--- a/source/blender/blenlib/BLI_math_base.h
+++ b/source/blender/blenlib/BLI_math_base.h
@@ -39,6 +39,10 @@
#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
diff --git a/source/blender/blenlib/BLI_winstuff.h b/source/blender/blenlib/BLI_winstuff.h
index d0eb3c7d67d..e0c819c2dba 100644
--- a/source/blender/blenlib/BLI_winstuff.h
+++ b/source/blender/blenlib/BLI_winstuff.h
@@ -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_
diff --git a/source/blender/blenlib/intern/storage.c b/source/blender/blenlib/intern/storage.c
index e9db148e992..41eedef8835 100644
--- a/source/blender/blenlib/intern/storage.c
+++ b/source/blender/blenlib/intern/storage.c
@@ -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;
diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c
index f3b67867d7f..285b08c521b 100644
--- a/source/blender/editors/object/object_relations.c
+++ b/source/blender/editors/object/object_relations.c
@@ -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);
}
diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c b/source/blender/editors/space_sequencer/sequencer_draw.c
index e1efd5b4622..1ed262c3e23 100644
--- a/source/blender/editors/space_sequencer/sequencer_draw.c
+++ b/source/blender/editors/space_sequencer/sequencer_draw.c
@@ -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;
diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c
index 46638007fb1..4252d051154 100644
--- a/source/blender/editors/space_sequencer/sequencer_edit.c
+++ b/source/blender/editors/space_sequencer/sequencer_edit.c
@@ -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;
diff --git a/source/blender/imbuf/intern/util.c b/source/blender/imbuf/intern/util.c
index fe85f63e109..6db8dcc06cf 100644
--- a/source/blender/imbuf/intern/util.c
+++ b/source/blender/imbuf/intern/util.c
@@ -113,6 +113,7 @@ const char *imb_ext_movie[] = {
".m4v",
".m2v",
".m2t",
+ ".m2ts",
".mts",
".mv",
".avs",
diff --git a/source/blender/nodes/intern/TEX_nodes/TEX_texture.c b/source/blender/nodes/intern/TEX_nodes/TEX_texture.c
index d4d77b5fd5a..c58595866af 100644
--- a/source/blender/nodes/intern/TEX_nodes/TEX_texture.c
+++ b/source/blender/nodes/intern/TEX_nodes/TEX_texture.c
@@ -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) {
diff --git a/source/blender/render/intern/source/rendercore.c b/source/blender/render/intern/source/rendercore.c
index 2fa6bed5aae..3aca334cffe 100644
--- a/source/blender/render/intern/source/rendercore.c
+++ b/source/blender/render/intern/source/rendercore.c
@@ -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;
diff --git a/source/blender/render/intern/source/shadeinput.c b/source/blender/render/intern/source/shadeinput.c
index a1b79346824..eab66aaf2ec 100644
--- a/source/blender/render/intern/source/shadeinput.c
+++ b/source/blender/render/intern/source/shadeinput.c
@@ -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;
diff --git a/source/gameengine/Ketsji/KX_PythonInit.cpp b/source/gameengine/Ketsji/KX_PythonInit.cpp
index c8a6ae5a6d0..a927de60cd8 100644
--- a/source/gameengine/Ketsji/KX_PythonInit.cpp
+++ b/source/gameengine/Ketsji/KX_PythonInit.cpp
@@ -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);