Merged changes in the trunk up to revision 44039.

This commit is contained in:
Tamito Kajiyama 2012-02-12 00:09:48 +00:00
commit 5c5685f6c5
132 changed files with 2593 additions and 2449 deletions

@ -1490,10 +1490,9 @@ if(MSVC10)
endif()
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
if(WITH_IK_ITASC OR WITH_MOD_FLUID)
if(WITH_IK_ITASC)
message(WARNING "Using Clang as CXX compiler: disabling WITH_IK_ITASC and WITH_MOD_FLUID, these features will be missing.")
set(WITH_IK_ITASC OFF)
set(WITH_MOD_FLUID OFF)
endif()
endif()

@ -169,6 +169,7 @@ help:
@echo " * check_cppcheck - run blender source through cppcheck (C & C++)"
@echo " * check_splint - run blenders source through splint (C only)"
@echo " * check_sparse - run blenders source through sparse (C only)"
@echo " * check_spelling - check for spelling errors (Python only for now)"
@echo ""
@echo "Documentation Targets (not assosiated with building blender)"
@echo " * doc_py - generate sphinx python api docs"
@ -242,6 +243,9 @@ check_sparse:
$(CMAKE_CONFIG)
cd $(BUILD_DIR) ; python3 $(BLENDER_DIR)/build_files/cmake/cmake_static_check_sparse.py
check_spelling:
cd $(BUILD_DIR) ; PYTHONIOENCODING=utf_8 python3 $(BLENDER_DIR)/source/tools/spell_check_source.py `find $(BLENDER_DIR)/release/scripts -name "*.py" | sort`
# -----------------------------------------------------------------------------
# Documentation

@ -0,0 +1,32 @@
import os
def FindPython():
all_abi_flags = ['m', 'mu', '']
python = "/usr"
abi_flags = "m" # Most common for linux distros
version = "3.2"
# Determine ABI flags used on this system
include = os.path.join(python, "include")
for cur_flags in all_abi_flags:
inc = os.path.join(include, "python" + version + cur_flags, "Python.h")
if os.path.exists(inc):
abi_flags = cur_flags
break
# Determine whether python is in /usr/lib or /usr/lib64
lib32 = os.path.join(python, "lib", "python" + version, "sysconfig.py")
lib64 = os.path.join(python, "lib64", "python" + version, "sysconfig.py")
if os.path.exists(lib32):
libpath = "${BF_PYTHON}/lib"
elif os.path.exists(lib64):
libpath = "${BF_PYTHON}/lib64"
else:
# roll back to default value
libpath = "${BF_PYTHON}/lib"
return {'PYTHON': python,
"VERSION": version,
'LIBPATH': libpath,
'ABI_FLAGS': abi_flags}

@ -1,6 +1,8 @@
# find library directory
import platform
import os
from Modules.FindPython import FindPython
bitness = platform.architecture()[0]
if bitness == '64bit':
LCGDIR = '../lib/linux64'
@ -8,10 +10,12 @@ else:
LCGDIR = '../lib/linux'
LIBDIR = "#${LCGDIR}"
BF_PYTHON_ABI_FLAGS = 'm' # Most common for linux distros
BF_PYTHON = '/usr'
BF_PYTHON_LIBPATH = '${BF_PYTHON}/lib'
BF_PYTHON_VERSION = '3.2'
py = FindPython()
BF_PYTHON_ABI_FLAGS = py['ABI_FLAGS']
BF_PYTHON = py['PYTHON']
BF_PYTHON_LIBPATH = py['LIBPATH']
BF_PYTHON_VERSION = py['VERSION']
WITH_BF_STATICPYTHON = False
BF_PYTHON_INC = '${BF_PYTHON}/include/python${BF_PYTHON_VERSION}${BF_PYTHON_ABI_FLAGS}'
BF_PYTHON_BINARY = '${BF_PYTHON}/bin/python${BF_PYTHON_VERSION}'

@ -437,8 +437,9 @@ def set_quiet_output(env):
static_ob, shared_ob = SCons.Tool.createObjBuilders(env)
static_ob.add_action('.c', mycaction)
static_ob.add_action('.cpp', mycppaction)
static_ob.add_action('.cc', mycppaction)
shared_ob.add_action('.c', myshcaction)
shared_ob.add_action('.cpp', myshcppaction)
shared_ob.add_action('.cc', myshcppaction)
static_lib = SCons.Builder.Builder(action = mylibaction,
emitter = '$LIBEMITTER',
@ -648,8 +649,11 @@ def UnixPyBundle(target=None, source=None, env=None):
dir = os.path.join(env['BF_INSTALLDIR'], VERSION)
lib = env['BF_PYTHON_LIBPATH'].split(os.sep)[-1]
target_lib = "lib64" if lib == "lib64" else "lib"
py_src = env.subst( env['BF_PYTHON_LIBPATH'] + '/python'+env['BF_PYTHON_VERSION'] )
py_target = env.subst( dir + '/python/lib/python'+env['BF_PYTHON_VERSION'] )
py_target = env.subst( dir + '/python/' + target_lib + '/python'+env['BF_PYTHON_VERSION'] )
# This is a bit weak, but dont install if its been installed before, makes rebuilds quite slow.
if os.path.exists(py_target):

@ -1,13 +1,14 @@
*******************
GPU functions (gpu)
===================
*******************
.. module:: gpu
This module provides access to materials GLSL shaders.
*****
Intro
*****
=====
Module to provide functions concerning the GPU implementation in Blender, in particular
the GLSL shaders that blender generates automatically to render materials in the 3D view
@ -15,16 +16,15 @@ and in the game engine.
.. warning::
The API provided by this module should be consider unstable. The data exposed by the API
are are closely related to Blender's internal GLSL code and may change if the GLSL code
is modified (e.g. new uniform type).
The API provided by this module should be consider unstable. The data exposed by the API
are are closely related to Blender's internal GLSL code and may change if the GLSL code
is modified (e.g. new uniform type).
*********
Constants
*********
=========
--------------
GLSL data type
--------------
@ -59,15 +59,15 @@ See export_shader_
.. data:: GPU_DATA_3F
three floats
:value: 4
.. data:: GPU_DATA_4F
four floats
:value: 5
.. data:: GPU_DATA_9F
matrix 3x3 in column-major order
@ -86,448 +86,450 @@ See export_shader_
:value: 8
-----------------
GLSL uniform type
-----------------
.. _uniform-type:
Constants that specify the type of uniform used in a GLSL shader.
Constants that specify the type of uniform used in a GLSL shader.
The uniform type determines the data type, origin and method
of calculation used by Blender to compute the uniform value.
of calculation used by Blender to compute the uniform value.
The calculation of some of the uniforms is based on matrices available in the scene:
.. _mat4_cam_to_world:
.. _mat4_world_to_cam:
.. _mat4_cam_to_world:
.. _mat4_world_to_cam:
*mat4_cam_to_world*
Model matrix of the camera. OpenGL 4x4 matrix that converts
camera local coordinates to world coordinates. In blender this is obtained from the
'matrix_world' attribute of the camera object.
*mat4_cam_to_world*
Model matrix of the camera. OpenGL 4x4 matrix that converts
camera local coordinates to world coordinates. In blender this is obtained from the
'matrix_world' attribute of the camera object.
Some uniform will need the *mat4_world_to_cam*
matrix computed as the inverse of this matrix.
Some uniform will need the *mat4_world_to_cam*
matrix computed as the inverse of this matrix.
.. _mat4_object_to_world:
.. _mat4_world_to_object:
.. _mat4_object_to_world:
.. _mat4_world_to_object:
*mat4_object_to_world*
Model matrix of the object that is being rendered. OpenGL 4x4 matric that converts
object local coordinates to world coordinates. In blender this is obtained from the
'matrix_world' attribute of the object.
Some uniform will need the *mat4_world_to_object* matrix, computed as the inverse of this matrix.
.. _mat4_lamp_to_world:
.. _mat4_world_to_lamp:
*mat4_object_to_world*
Model matrix of the object that is being rendered. OpenGL 4x4 matric that converts
object local coordinates to world coordinates. In blender this is obtained from the
'matrix_world' attribute of the object.
*mat4_lamp_to_world*
Model matrix of the lamp lighting the object. OpenGL 4x4 matrix that converts lamp
local coordinates to world coordinates. In blender this is obtained from the
'matrix_world' attribute of the lamp object.
Some uniform will need the *mat4_world_to_lamp* matrix
computed as the inverse of this matrix.
Some uniform will need the *mat4_world_to_object* matrix, computed as the inverse of this matrix.
.. _mat4_lamp_to_world:
.. _mat4_world_to_lamp:
*mat4_lamp_to_world*
Model matrix of the lamp lighting the object. OpenGL 4x4 matrix that converts lamp
local coordinates to world coordinates. In blender this is obtained from the
'matrix_world' attribute of the lamp object.
Some uniform will need the *mat4_world_to_lamp* matrix
computed as the inverse of this matrix.
.. data:: GPU_DYNAMIC_OBJECT_VIEWMAT
The uniform is a 4x4 GL matrix that converts world coordinates to
camera coordinates (see mat4_world_to_cam_). Can be set once per frame.
There is at most one uniform of that type per shader.
The uniform is a 4x4 GL matrix that converts world coordinates to
camera coordinates (see mat4_world_to_cam_). Can be set once per frame.
There is at most one uniform of that type per shader.
:value: 1
:value: 1
.. data:: GPU_DYNAMIC_OBJECT_MAT
The uniform is a 4x4 GL matrix that converts object coordinates
to world coordinates (see mat4_object_to_world_). Must be set before drawing the object.
There is at most one uniform of that type per shader.
The uniform is a 4x4 GL matrix that converts object coordinates
to world coordinates (see mat4_object_to_world_). Must be set before drawing the object.
There is at most one uniform of that type per shader.
:value: 2
:value: 2
.. data:: GPU_DYNAMIC_OBJECT_VIEWIMAT
The uniform is a 4x4 GL matrix that converts coordinates
in camera space to world coordinates (see mat4_cam_to_world_).
Can be set once per frame.
There is at most one uniform of that type per shader.
The uniform is a 4x4 GL matrix that converts coordinates
in camera space to world coordinates (see mat4_cam_to_world_).
Can be set once per frame.
There is at most one uniform of that type per shader.
:value: 3
:value: 3
.. data:: GPU_DYNAMIC_OBJECT_IMAT
The uniform is a 4x4 GL matrix that converts world coodinates
to object coordinates (see mat4_world_to_object_).
Must be set before drawing the object.
There is at most one uniform of that type per shader.
:value: 4
The uniform is a 4x4 GL matrix that converts world coodinates
to object coordinates (see mat4_world_to_object_).
Must be set before drawing the object.
There is at most one uniform of that type per shader.
:value: 4
.. data:: GPU_DYNAMIC_OBJECT_COLOR
The uniform is a vector of 4 float representing a RGB color + alpha defined at object level.
Each values between 0.0 and 1.0. In blender it corresponds to the 'color' attribute of the object.
Must be set before drawing the object.
There is at most one uniform of that type per shader.
:value: 5
The uniform is a vector of 4 float representing a RGB color + alpha defined at object level.
Each values between 0.0 and 1.0. In blender it corresponds to the 'color' attribute of the object.
Must be set before drawing the object.
There is at most one uniform of that type per shader.
:value: 5
.. data:: GPU_DYNAMIC_LAMP_DYNVEC
The uniform is a vector of 3 float representing the direction of light in camera space.
In Blender, this is computed by
The uniform is a vector of 3 float representing the direction of light in camera space.
In Blender, this is computed by
mat4_world_to_cam_ * (-vec3_lamp_Z_axis)
mat4_world_to_cam_ * (-vec3_lamp_Z_axis)
as the lamp Z axis points to the opposite direction of light.
The norm of the vector should be unity. Can be set once per frame.
There is one uniform of that type per lamp lighting the material.
as the lamp Z axis points to the opposite direction of light.
The norm of the vector should be unity. Can be set once per frame.
There is one uniform of that type per lamp lighting the material.
:value: 6
:value: 6
.. data:: GPU_DYNAMIC_LAMP_DYNCO
The uniform is a vector of 3 float representing the position of the light in camera space.
Computed as
mat4_world_to_cam_ * vec3_lamp_pos
The uniform is a vector of 3 float representing the position of the light in camera space.
Computed as
mat4_world_to_cam_ * vec3_lamp_pos
Can be set once per frame.
There is one uniform of that type per lamp lighting the material.
:value: 7
Can be set once per frame.
There is one uniform of that type per lamp lighting the material.
:value: 7
.. data:: GPU_DYNAMIC_LAMP_DYNIMAT
The uniform is a 4x4 GL matrix that converts vector in camera space to lamp space.
Computed as
The uniform is a 4x4 GL matrix that converts vector in camera space to lamp space.
Computed as
mat4_world_to_lamp_ * mat4_cam_to_world_
mat4_world_to_lamp_ * mat4_cam_to_world_
Can be set once per frame.
There is one uniform of that type per lamp lighting the material.
Can be set once per frame.
There is one uniform of that type per lamp lighting the material.
:value: 8
:value: 8
.. data:: GPU_DYNAMIC_LAMP_DYNPERSMAT
The uniform is a 4x4 GL matrix that converts a vector in camera space to shadow buffer depth space.
Computed as
The uniform is a 4x4 GL matrix that converts a vector in camera space to shadow buffer depth space.
Computed as
mat4_perspective_to_depth_ * mat4_lamp_to_perspective_ * mat4_world_to_lamp_ * mat4_cam_to_world_.
mat4_perspective_to_depth_ * mat4_lamp_to_perspective_ * mat4_world_to_lamp_ * mat4_cam_to_world_.
.. _mat4_perspective_to_depth:
.. _mat4_perspective_to_depth:
*mat4_perspective_to_depth* is a fixed matrix defined as follow::
*mat4_perspective_to_depth* is a fixed matrix defined as follow::
0.5 0.0 0.0 0.5
0.0 0.5 0.0 0.5
0.0 0.0 0.5 0.5
0.0 0.0 0.0 1.0
0.5 0.0 0.0 0.5
0.0 0.5 0.0 0.5
0.0 0.0 0.5 0.5
0.0 0.0 0.0 1.0
This uniform can be set once per frame. There is one uniform of that type per lamp casting shadow in the scene.
This uniform can be set once per frame. There is one uniform of that type per lamp casting shadow in the scene.
:value: 9
:value: 9
.. data:: GPU_DYNAMIC_LAMP_DYNENERGY
The uniform is a single float representing the lamp energy. In blender it corresponds
to the 'energy' attribute of the lamp data block.
There is one uniform of that type per lamp lighting the material.
The uniform is a single float representing the lamp energy. In blender it corresponds
to the 'energy' attribute of the lamp data block.
There is one uniform of that type per lamp lighting the material.
:value: 10
:value: 10
.. data:: GPU_DYNAMIC_LAMP_DYNCOL
The uniform is a vector of 3 float representing the lamp color.
Color elements are between 0.0 and 1.0. In blender it corresponds
to the 'color' attribute of the lamp data block.
There is one uniform of that type per lamp lighting the material.
The uniform is a vector of 3 float representing the lamp color.
Color elements are between 0.0 and 1.0. In blender it corresponds
to the 'color' attribute of the lamp data block.
There is one uniform of that type per lamp lighting the material.
:value: 11
:value: 11
.. data:: GPU_DYNAMIC_SAMPLER_2DBUFFER
The uniform is an integer representing an internal texture used for certain effect
(color band, etc).
:value: 12
The uniform is an integer representing an internal texture used for certain effect
(color band, etc).
:value: 12
.. data:: GPU_DYNAMIC_SAMPLER_2DIMAGE
The uniform is an integer representing a texture loaded from an image file.
The uniform is an integer representing a texture loaded from an image file.
:value: 13
:value: 13
.. data:: GPU_DYNAMIC_SAMPLER_2DSHADOW
The uniform is an integer representing a shadow buffer corresponding to a lamp
casting shadow.
The uniform is an integer representing a shadow buffer corresponding to a lamp
casting shadow.
:value: 14
:value: 14
-------------------
GLSL attribute type
-------------------
.. _attribute-type:
Type of the vertex attribute used in the GLSL shader. Determines the mesh custom data
layer that contains the vertex attribute.
layer that contains the vertex attribute.
.. data:: CD_MTFACE
Vertex attribute is a UV Map. Data type is vector of 2 float.
Vertex attribute is a UV Map. Data type is vector of 2 float.
There can be more than one attribute of that type, they are differenciated by name.
In blender, you can retrieve the attribute data with:
There can be more than one attribute of that type, they are differenciated by name.
In blender, you can retrieve the attribute data with:
.. code-block:: python
.. code-block:: python
mesh.uv_textures[attribute['name']]
mesh.uv_textures[attribute["name"]]
:value: 5
:value: 5
.. data:: CD_MCOL
Vertex attribute is color layer. Data type is vector 4 unsigned byte (RGBA).
Vertex attribute is color layer. Data type is vector 4 unsigned byte (RGBA).
There can be more than one attribute of that type, they are differenciated by name.
In blender you can retrieve the attribute data with:
There can be more than one attribute of that type, they are differenciated by name.
In blender you can retrieve the attribute data with:
.. code-block:: python
.. code-block:: python
mesh.vertex_colors[attribute['name']]
mesh.vertex_colors[attribute["name"]]
:value: 6
:value: 6
.. data:: CD_ORCO
Vertex attribute is original coordinates. Data type is vector 3 float.
Vertex attribute is original coordinates. Data type is vector 3 float.
There can be only 1 attribute of that type per shader.
In blender you can retrieve the attribute data with:
.. code-block:: python
There can be only 1 attribute of that type per shader.
In blender you can retrieve the attribute data with:
mesh.vertices
.. code-block:: python
:value: 14
mesh.vertices
:value: 14
.. data:: CD_TANGENT
Vertex attribute is the tangent vector. Data type is vector 4 float.
Vertex attribute is the tangent vector. Data type is vector 4 float.
There can be only 1 attribute of that type per shader.
There is currently no way to retrieve this attribute data via the RNA API but a standalone
C function to compute the tangent layer from the other layers can be obtained from
blender.org.
There can be only 1 attribute of that type per shader.
There is currently no way to retrieve this attribute data via the RNA API but a standalone
C function to compute the tangent layer from the other layers can be obtained from
blender.org.
:value: 18
:value: 18
*********
Functions
*********
=========
.. _export_shader:
.. function:: export_shader(scene,material)
Extracts the GLSL shader producing the visual effect of material in scene for the purpose of
reusing the shader in an external engine. This function is meant to be used in material exporter
so that the GLSL shader can be exported entirely. The return value is a dictionary containing the
shader source code and all associated data.
Extracts the GLSL shader producing the visual effect of material in scene for the purpose of
reusing the shader in an external engine. This function is meant to be used in material exporter
so that the GLSL shader can be exported entirely. The return value is a dictionary containing the
shader source code and all associated data.
:arg scene: the scene in which the material in rendered.
:type scene: :class:`bpy.types.Scene`
:arg material: the material that you want to export the GLSL shader
:type material: :class:`bpy.types.Material`
:return: the shader source code and all associated data in a dictionary
:rtype: dictionary
:arg scene: the scene in which the material in rendered.
:type scene: :class:`bpy.types.Scene`
:arg material: the material that you want to export the GLSL shader
:type material: :class:`bpy.types.Material`
:return: the shader source code and all associated data in a dictionary
:rtype: dictionary
The dictionary contains the following elements:
The dictionary contains the following elements:
* ['fragment'] : string
fragment shader source code.
* ['vertex'] : string
vertex shader source code.
* ["fragment"] : string
fragment shader source code.
* ['uniforms'] : sequence
list of uniforms used in fragment shader, can be empty list. Each element of the
sequence is a dictionary with the following elements:
* ["vertex"] : string
vertex shader source code.
* ['varname'] : string
name of the uniform in the fragment shader. Always of the form 'unf<number>'.
* ["uniforms"] : sequence
list of uniforms used in fragment shader, can be empty list. Each element of the
sequence is a dictionary with the following elements:
* ['datatype'] : integer
data type of the uniform variable. Can be one of the following:
* ["varname"] : string
name of the uniform in the fragment shader. Always of the form 'unf<number>'.
* :data:`gpu.GPU_DATA_1I` : use glUniform1i
* :data:`gpu.GPU_DATA_1F` : use glUniform1fv
* :data:`gpu.GPU_DATA_2F` : use glUniform2fv
* :data:`gpu.GPU_DATA_3F` : use glUniform3fv
* :data:`gpu.GPU_DATA_4F` : use glUniform4fv
* :data:`gpu.GPU_DATA_9F` : use glUniformMatrix3fv
* :data:`gpu.GPU_DATA_16F` : use glUniformMatrix4fv
* ["datatype"] : integer
data type of the uniform variable. Can be one of the following:
* ['type'] : integer
type of uniform, determines the origin and method of calculation. See uniform-type_.
Depending on the type, more elements will be be present.
* :data:`gpu.GPU_DATA_1I` : use glUniform1i
* :data:`gpu.GPU_DATA_1F` : use glUniform1fv
* :data:`gpu.GPU_DATA_2F` : use glUniform2fv
* :data:`gpu.GPU_DATA_3F` : use glUniform3fv
* :data:`gpu.GPU_DATA_4F` : use glUniform4fv
* :data:`gpu.GPU_DATA_9F` : use glUniformMatrix3fv
* :data:`gpu.GPU_DATA_16F` : use glUniformMatrix4fv
* ['lamp'] : :class:`bpy.types.Object`
Reference to the lamp object from which the uniforms value are extracted. Set for the following uniforms types:
* ["type"] : integer
type of uniform, determines the origin and method of calculation. See uniform-type_.
Depending on the type, more elements will be be present.
.. hlist::
:columns: 3
* ["lamp"] : :class:`bpy.types.Object`
Reference to the lamp object from which the uniforms value are extracted. Set for the following uniforms types:
* :data:`gpu.GPU_DYNAMIC_LAMP_DYNVEC`
* :data:`gpu.GPU_DYNAMIC_LAMP_DYNCO`
* :data:`gpu.GPU_DYNAMIC_LAMP_DYNIMAT`
* :data:`gpu.GPU_DYNAMIC_LAMP_DYNPERSMAT`
* :data:`gpu.GPU_DYNAMIC_LAMP_DYNENERGY`
* :data:`gpu.GPU_DYNAMIC_LAMP_DYNCOL`
* :data:`gpu.GPU_DYNAMIC_SAMPLER_2DSHADOW`
.. hlist::
:columns: 3
Notes:
* :data:`gpu.GPU_DYNAMIC_LAMP_DYNVEC`
* :data:`gpu.GPU_DYNAMIC_LAMP_DYNCO`
* :data:`gpu.GPU_DYNAMIC_LAMP_DYNIMAT`
* :data:`gpu.GPU_DYNAMIC_LAMP_DYNPERSMAT`
* :data:`gpu.GPU_DYNAMIC_LAMP_DYNENERGY`
* :data:`gpu.GPU_DYNAMIC_LAMP_DYNCOL`
* :data:`gpu.GPU_DYNAMIC_SAMPLER_2DSHADOW`
* The uniforms :data:`gpu.GPU_DYNAMIC_LAMP_DYNVEC`, :data:`gpu.GPU_DYNAMIC_LAMP_DYNCO`, :data:`gpu.GPU_DYNAMIC_LAMP_DYNIMAT` and :data:`gpu.GPU_DYNAMIC_LAMP_DYNPERSMAT`
refer to the lamp object position and orientation, both of can be derived from the object world matrix:
Notes:
.. code-block:: python
obmat = uniform['lamp'].matrix_world
where obmat is the mat4_lamp_to_world_ matrix of the lamp as a 2 dimensional array,
the lamp world location location is in obmat[3].
* The uniform types :data:`gpu.GPU_DYNAMIC_LAMP_DYNENERGY` and :data:`gpu.GPU_DYNAMIC_LAMP_DYNCOL` refer to the lamp data bloc that you get from:
.. code-block:: python
la = uniform['lamp'].data
from which you get la.energy and la.color
* Lamp duplication is not supported: if you have duplicated lamps in your scene
(i.e. lamp that are instantiated by dupligroup, etc), this element will only
give you a reference to the orignal lamp and you will not know which instance
of the lamp it is refering too. You can still handle that case in the exporter
by distributing the uniforms amongst the duplicated lamps.
* ['image'] : :class:`bpy.types.Image`
Reference to the image databloc. Set for uniform type :data:`gpu.GPU_DYNAMIC_SAMPLER_2DIMAGE`. You can get the image data from:
* The uniforms :data:`gpu.GPU_DYNAMIC_LAMP_DYNVEC`, :data:`gpu.GPU_DYNAMIC_LAMP_DYNCO`, :data:`gpu.GPU_DYNAMIC_LAMP_DYNIMAT` and :data:`gpu.GPU_DYNAMIC_LAMP_DYNPERSMAT`
refer to the lamp object position and orientation, both of can be derived from the object world matrix:
.. code-block:: python
# full path to image file
uniform['image'].filepath
# image size as a 2-dimensional array of int
uniform['image'].size
obmat = uniform["lamp"].matrix_world
* ['texnumber'] : integer
Channel number to which the texture is bound when drawing the object.
Set for uniform types :data:`gpu.GPU_DYNAMIC_SAMPLER_2DBUFFER`, :data:`gpu.GPU_DYNAMIC_SAMPLER_2DIMAGE` and :data:`gpu.GPU_DYNAMIC_SAMPLER_2DSHADOW`.
where obmat is the mat4_lamp_to_world_ matrix of the lamp as a 2 dimensional array,
the lamp world location location is in obmat[3].
This is provided for information only: when reusing the shader outside blencer,
you are free to assign the textures to the channel of your choice and to pass
that number channel to the GPU in the uniform.
* The uniform types :data:`gpu.GPU_DYNAMIC_LAMP_DYNENERGY` and :data:`gpu.GPU_DYNAMIC_LAMP_DYNCOL` refer to the lamp data bloc that you get from:
* ['texpixels'] : byte array
texture data for uniform type :data:`gpu.GPU_DYNAMIC_SAMPLER_2DBUFFER`. Although
the corresponding uniform is a 2D sampler, the texture is always a 1D texture
of n x 1 pixel. The texture size n is provided in ['texsize'] element.
These texture are only used for computer generated texture (colorband, etc).
The texture data is provided so that you can make a real image out of it in the
exporter.
* ['texsize'] : integer
horizontal size of texture for uniform type :data:`gpu.GPU_DYNAMIC_SAMPLER_2DBUFFER`.
The texture data is in ['texpixels'].
.. code-block:: python
* ['attributes'] : sequence
list of attributes used in vertex shader, can be empty. Blender doesn't use
standard attributes except for vertex position and normal. All other vertex
attributes must be passed using the generic glVertexAttrib functions.
The attribute data can be found in the derived mesh custom data using RNA.
Each element of the sequence is a dictionary containing the following elements:
la = uniform["lamp"].data
* ['varname'] : string
name of the uniform in the vertex shader. Always of the form 'att<number>'.
from which you get la.energy and la.color
* ['datatype'] : integer
data type of vertex attribute, can be one of the following:
* Lamp duplication is not supported: if you have duplicated lamps in your scene
(i.e. lamp that are instantiated by dupligroup, etc), this element will only
give you a reference to the orignal lamp and you will not know which instance
of the lamp it is refering too. You can still handle that case in the exporter
by distributing the uniforms amongst the duplicated lamps.
* :data:`gpu.GPU_DATA_2F` : use glVertexAttrib2fv
* :data:`gpu.GPU_DATA_3F` : use glVertexAttrib3fv
* :data:`gpu.GPU_DATA_4F` : use glVertexAttrib4fv
* :data:`gpu.GPU_DATA_4UB` : use glVertexAttrib4ubv
* ["image"] : :class:`bpy.types.Image`
Reference to the image databloc. Set for uniform type :data:`gpu.GPU_DYNAMIC_SAMPLER_2DIMAGE`. You can get the image data from:
* ['number'] : integer
generic attribute number. This is provided for information only. Blender
doesn't use glBindAttribLocation to place generic attributes at specific location,
it lets the shader compiler place the attributes automatically and query the
placement with glGetAttribLocation. The result of this placement is returned in
this element.
.. code-block:: python
When using this shader in a render engine, you should either use
glBindAttribLocation to force the attribute at this location or use
glGetAttribLocation to get the placement chosen by the compiler of your GPU.
# full path to image file
uniform["image"].filepath
# image size as a 2-dimensional array of int
uniform["image"].size
* ['type'] : integer
type of the mesh custom data from which the vertex attribute is loaded.
See attribute-type_.
* ["texnumber"] : integer
Channel number to which the texture is bound when drawing the object.
Set for uniform types :data:`gpu.GPU_DYNAMIC_SAMPLER_2DBUFFER`, :data:`gpu.GPU_DYNAMIC_SAMPLER_2DIMAGE` and :data:`gpu.GPU_DYNAMIC_SAMPLER_2DSHADOW`.
* ['name'] : string or integer
custom data layer name, used for attribute type :data:`gpu.CD_MTFACE` and :data:`gpu.CD_MCOL`.
This is provided for information only: when reusing the shader outside blencer,
you are free to assign the textures to the channel of your choice and to pass
that number channel to the GPU in the uniform.
Example:
* ["texpixels"] : byte array
texture data for uniform type :data:`gpu.GPU_DYNAMIC_SAMPLER_2DBUFFER`. Although
the corresponding uniform is a 2D sampler, the texture is always a 1D texture
of n x 1 pixel. The texture size n is provided in ["texsize"] element.
These texture are only used for computer generated texture (colorband, etc).
The texture data is provided so that you can make a real image out of it in the
exporter.
.. code-block:: python
* ["texsize"] : integer
horizontal size of texture for uniform type :data:`gpu.GPU_DYNAMIC_SAMPLER_2DBUFFER`.
The texture data is in ["texpixels"].
* ["attributes"] : sequence
list of attributes used in vertex shader, can be empty. Blender doesn't use
standard attributes except for vertex position and normal. All other vertex
attributes must be passed using the generic glVertexAttrib functions.
The attribute data can be found in the derived mesh custom data using RNA.
Each element of the sequence is a dictionary containing the following elements:
* ["varname"] : string
name of the uniform in the vertex shader. Always of the form 'att<number>'.
* ["datatype"] : integer
data type of vertex attribute, can be one of the following:
* :data:`gpu.GPU_DATA_2F` : use glVertexAttrib2fv
* :data:`gpu.GPU_DATA_3F` : use glVertexAttrib3fv
* :data:`gpu.GPU_DATA_4F` : use glVertexAttrib4fv
* :data:`gpu.GPU_DATA_4UB` : use glVertexAttrib4ubv
* ["number"] : integer
generic attribute number. This is provided for information only. Blender
doesn't use glBindAttribLocation to place generic attributes at specific location,
it lets the shader compiler place the attributes automatically and query the
placement with glGetAttribLocation. The result of this placement is returned in
this element.
When using this shader in a render engine, you should either use
glBindAttribLocation to force the attribute at this location or use
glGetAttribLocation to get the placement chosen by the compiler of your GPU.
* ["type"] : integer
type of the mesh custom data from which the vertex attribute is loaded.
See attribute-type_.
* ["name"] : string or integer
custom data layer name, used for attribute type :data:`gpu.CD_MTFACE` and :data:`gpu.CD_MCOL`.
Example:
.. code-block:: python
import gpu
# get GLSL shader of material Mat.001 in scene Scene.001
scene = bpy.data.scenes["Scene.001"]
material = bpy.data.materials["Mat.001"]
shader = gpu.export_shader(scene,material)
# scan the uniform list and find the images used in the shader
for uniform in shader["uniforms"]:
if uniform["type"] == gpu.GPU_DYNAMIC_SAMPLER_2DIMAGE:
print("uniform {0} is using image {1}".format(uniform["varname"], uniform["image"].filepath))
# scan the attribute list and find the UV Map used in the shader
for attribute in shader["attributes"]:
if attribute["type"] == gpu.CD_MTFACE:
print("attribute {0} is using UV Map {1}".format(attribute["varname"], attribute["name"]))
import gpu
# get GLSL shader of material Mat.001 in scene Scene.001
scene = bpy.data.scenes['Scene.001']
material = bpy.data.materials['Mat.001']
shader = gpu.export_shader(scene,material)
# scan the uniform list and find the images used in the shader
for uniform in shader['uniforms']:
if uniform['type'] == gpu.GPU_DYNAMIC_SAMPLER_2DIMAGE:
print("uniform {0} is using image {1}".format(uniform['varname'], uniform['image'].filepath))
# scan the attribute list and find the UV Map used in the shader
for attribute in shader['attributes']:
if attribute['type'] == gpu.CD_MTFACE:
print("attribute {0} is using UV Map {1}".format(attribute['varname'], attribute['name']))
*****
Notes
*****
=====
.. _mat4_lamp_to_perspective:
1. Calculation of the *mat4_lamp_to_perspective* matrix for a spot lamp.
The following pseudo code shows how the *mat4_lamp_to_perspective* matrix is computed
The following pseudo code shows how the *mat4_lamp_to_perspective* matrix is computed
in blender for uniforms of :data:`gpu.GPU_DYNAMIC_LAMP_DYNPERSMAT` type::
#Get the lamp datablock with:
lamp=bpy.data.objects[uniform['lamp']].data
.. code-block:: python
#Compute the projection matrix:
# You will need these lamp attributes:
# lamp.clipsta : near clip plane in world unit
# lamp.clipend : far clip plane in world unit
# lamp.spotsize : angle in degree of the spot light
#Get the lamp datablock with:
lamp = bpy.data.objects[uniform["lamp"]].data
#The size of the projection plane is computed with the usual formula:
wsize = lamp.clista * tan(lamp.spotsize/2)
# Compute the projection matrix:
# You will need these lamp attributes:
# lamp.clipsta : near clip plane in world unit
# lamp.clipend : far clip plane in world unit
# lamp.spotsize : angle in degree of the spot light
#And the projection matrix:
mat4_lamp_to_perspective = glFrustum(-wsize,wsize,-wsize,wsize,lamp.clista,lamp.clipend)
# The size of the projection plane is computed with the usual formula:
wsize = lamp.clista * tan(lamp.spotsize/2)
#And the projection matrix:
mat4_lamp_to_perspective = glFrustum(-wsize, wsize, -wsize, wsize, lamp.clista, lamp.clipend)
2. Creation of the shadow map for a spot lamp.
The shadow map is the depth buffer of a render performed by placing the camera at the
spot light position. The size of the shadow map is given by the attribute lamp.bufsize :
spot light position. The size of the shadow map is given by the attribute lamp.bufsize :
shadow map size in pixel, same size in both dimensions.

@ -1143,7 +1143,9 @@ def rna2sphinx(BASEPATH):
fw("\n")
fw("Welcome, this document is an API reference for Blender %s. built %s.\n" % (version_string, bpy.app.build_date))
fw("\n")
fw("`A PDF version of this document is also available <blender_python_reference_%s.pdf>`_\n" % version_string_pdf)
# fw("`A PDF version of this document is also available <blender_python_reference_%s.pdf>`_\n" % version_string_pdf)
fw("`A compressed ZIP file of this site is available <blender_python_reference_%s.zip>`_\n" % version_string_pdf)
fw("\n")

@ -11,7 +11,8 @@
DO_UPLOAD=true
DO_EXE_BLENDER=true
DO_OUT_HTML=true
DO_OUT_PDF=true
DO_OUT_HTML_ZIP=true
DO_OUT_PDF=false
BLENDER="./blender.bin"
@ -61,6 +62,17 @@ if $DO_OUT_HTML ; then
# annoying bug in sphinx makes it very slow unless we do this. should report.
cd $SPHINXBASE
sphinx-build -n -b html sphinx-in sphinx-out
# ------------------------------------------------------------------------
# ZIP the HTML dir for upload
if $DO_OUT_HTML_ZIP ; then
# lame, temp rename dir
mv sphinx-out blender_python_reference_$BLENDER_VERSION
zip -r -9 blender_python_reference_$BLENDER_VERSION.zip blender_python_reference_$BLENDER_VERSION
mv blender_python_reference_$BLENDER_VERSION sphinx-out
fi
cd -
fi
@ -74,6 +86,7 @@ if $DO_OUT_PDF ; then
mv $SPHINXBASE/sphinx-out/contents.pdf $SPHINXBASE/sphinx-out/blender_python_reference_$BLENDER_VERSION.pdf
fi
# ----------------------------------------------------------------------------
# Upload to blender servers, comment this section for testing
@ -89,8 +102,14 @@ if $DO_UPLOAD ; then
# better redirect
ssh $SSH_USER@emo.blender.org 'echo "<html><head><title>Redirecting...</title><meta http-equiv=\"REFRESH\" content=\"0;url=../blender_python_api_'$BLENDER_VERSION'/\"></head><body>Redirecting...</body></html>" > '$SSH_UPLOAD'/250PythonDoc/index.html'
# rename so local PDF has matching name.
rsync --progress -avze "ssh -p 22" $SPHINXBASE/sphinx-out/blender_python_reference_$BLENDER_VERSION.pdf $SSH_HOST:$SSH_UPLOAD_FULL/blender_python_reference_$BLENDER_VERSION.pdf
if $DO_OUT_PDF ; then
# rename so local PDF has matching name.
rsync --progress -avze "ssh -p 22" $SPHINXBASE/sphinx-out/blender_python_reference_$BLENDER_VERSION.pdf $SSH_HOST:$SSH_UPLOAD_FULL/blender_python_reference_$BLENDER_VERSION.pdf
fi
if $DO_OUT_HTML_ZIP ; then
rsync --progress -avze "ssh -p 22" $SPHINXBASE/blender_python_reference_$BLENDER_VERSION.zip $SSH_HOST:$SSH_UPLOAD_FULL/blender_python_reference_$BLENDER_VERSION.zip
fi
fi

@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# The Original Code is Copyright (C) 2006, Blender Foundation
# All rights reserved.

@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# The Original Code is Copyright (C) 2008 by The Blender Foundation
# All rights reserved.

@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# The Original Code is Copyright (C) 2006, Blender Foundation
# All rights reserved.

@ -2780,21 +2780,23 @@ void btSoftBody::PSolve_RContacts(btSoftBody* psb, btScalar kst, btScalar ti)
{
const RContact& c = psb->m_rcontacts[i];
const sCti& cti = c.m_cti;
btRigidBody* tmpRigid = btRigidBody::upcast(cti.m_colObj);
const btVector3 va = tmpRigid ? tmpRigid->getVelocityInLocalPoint(c.m_c1)*dt : btVector3(0,0,0);
const btVector3 vb = c.m_node->m_x-c.m_node->m_q;
const btVector3 vr = vb-va;
const btScalar dn = btDot(vr, cti.m_normal);
if(dn<=SIMD_EPSILON)
{
const btScalar dp = btMin( (btDot(c.m_node->m_x, cti.m_normal) + cti.m_offset), mrg );
const btVector3 fv = vr - (cti.m_normal * dn);
// c0 is the impulse matrix, c3 is 1 - the friction coefficient or 0, c4 is the contact hardness coefficient
const btVector3 impulse = c.m_c0 * ( (vr - (fv * c.m_c3) + (cti.m_normal * (dp * c.m_c4))) * kst );
c.m_node->m_x -= impulse * c.m_c2;
if (tmpRigid)
tmpRigid->applyImpulse(impulse,c.m_c1);
if (cti.m_colObj->hasContactResponse()) {
btRigidBody* tmpRigid = btRigidBody::upcast(cti.m_colObj);
const btVector3 va = tmpRigid ? tmpRigid->getVelocityInLocalPoint(c.m_c1)*dt : btVector3(0,0,0);
const btVector3 vb = c.m_node->m_x-c.m_node->m_q;
const btVector3 vr = vb-va;
const btScalar dn = btDot(vr, cti.m_normal);
if(dn<=SIMD_EPSILON)
{
const btScalar dp = btMin( (btDot(c.m_node->m_x, cti.m_normal) + cti.m_offset), mrg );
const btVector3 fv = vr - (cti.m_normal * dn);
// c0 is the impulse matrix, c3 is 1 - the friction coefficient or 0, c4 is the contact hardness coefficient
const btVector3 impulse = c.m_c0 * ( (vr - (fv * c.m_c3) + (cti.m_normal * (dp * c.m_c4))) * kst );
c.m_node->m_x -= impulse * c.m_c2;
if (tmpRigid)
tmpRigid->applyImpulse(impulse,c.m_c1);
}
}
}
}

@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# The Original Code is Copyright (C) 2006, Blender Foundation
# All rights reserved.

@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# The Original Code is Copyright (C) 2011, Blender Foundation
# All rights reserved.

@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# The Original Code is Copyright (C) 2006, Blender Foundation
# All rights reserved.

@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# The Original Code is Copyright (C) 2011, Blender Foundation
# All rights reserved.

@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# The Original Code is Copyright (C) 2006, Blender Foundation
# All rights reserved.

@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# The Original Code is Copyright (C) 2006, Blender Foundation
# All rights reserved.

@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# The Original Code is Copyright (C) 2006, Blender Foundation
# All rights reserved.

@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# The Original Code is Copyright (C) 2006, Blender Foundation
# All rights reserved.

@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# The Original Code is Copyright (C) 2006, Blender Foundation
# All rights reserved.

@ -39,6 +39,9 @@ if env['OURPLATFORM'] in ('win32-vc', 'win64-vc'):
else:
cxxflags.append('-ffast-math'.split())
if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc'):
incs.append(env['BF_PTHREADS_INC'])
# optimized kernel
if env['WITH_BF_RAYOPTIMIZATION']:
optim_cxxflags = []

@ -191,14 +191,8 @@ void BlenderSession::render()
BL::RenderResult::layers_iterator b_iter;
BL::RenderLayers b_rr_layers(r.ptr);
int active = 0;
/* render each layer */
for(b_rr.layers.begin(b_iter); b_iter != b_rr.layers.end(); ++b_iter, ++active) {
/* single layer render */
if(r.use_single_layer())
active = b_rr_layers.active_index();
for(b_rr.layers.begin(b_iter); b_iter != b_rr.layers.end(); ++b_iter) {
/* set layer */
b_rlay = *b_iter;
@ -226,7 +220,7 @@ void BlenderSession::render()
session->reset(buffer_params, session_params.samples);
/* update scene */
sync->sync_data(b_v3d, active);
sync->sync_data(b_v3d, b_iter->name().c_str());
/* render */
session->start();
@ -394,7 +388,7 @@ void BlenderSession::get_progress(float& progress, double& total_time)
void BlenderSession::update_status_progress()
{
string status, substatus;
string timestatus, status, substatus;
float progress;
double total_time;
char time_str[128];
@ -403,13 +397,13 @@ void BlenderSession::update_status_progress()
get_progress(progress, total_time);
BLI_timestr(total_time, time_str);
status = "Elapsed: " + string(time_str) + " | " + status;
timestatus = "Elapsed: " + string(time_str) + " | ";
if(substatus.size() > 0)
status += " | " + substatus;
if(status != last_status) {
RE_engine_update_stats((RenderEngine*)b_engine.ptr.data, "", status.c_str());
RE_engine_update_stats((RenderEngine*)b_engine.ptr.data, "", (timestatus + status).c_str());
last_status = status;
}
if(progress != last_progress) {

@ -122,7 +122,7 @@ bool BlenderSync::sync_recalc()
return recalc;
}
void BlenderSync::sync_data(BL::SpaceView3D b_v3d, int layer)
void BlenderSync::sync_data(BL::SpaceView3D b_v3d, const char *layer)
{
sync_render_layers(b_v3d);
sync_integrator(layer);
@ -133,7 +133,7 @@ void BlenderSync::sync_data(BL::SpaceView3D b_v3d, int layer)
/* Integrator */
void BlenderSync::sync_integrator(int layer)
void BlenderSync::sync_integrator(const char *layer)
{
PointerRNA cscene = RNA_pointer_get(&b_scene.ptr, "cycles");
@ -155,7 +155,20 @@ void BlenderSync::sync_integrator(int layer)
integrator->no_caustics = get_boolean(cscene, "no_caustics");
integrator->seed = get_int(cscene, "seed");
integrator->layer_flag = render_layers[layer].layer;
/* render layer */
int active_layer = 0;
if(layer) {
for(int i = 0; i < render_layers.size(); i++) {
if(render_layers[i].name == layer) {
active_layer = i;
break;
}
}
}
integrator->layer_flag = render_layers[active_layer].layer;
if(integrator->modified(previntegrator))
integrator->tag_update(scene);
@ -208,6 +221,7 @@ void BlenderSync::sync_render_layers(BL::SpaceView3D b_v3d)
/* single layer for now */
RenderLayerInfo rlay;
rlay.name = b_rlay->name();
rlay.scene_layer = get_layer(b_scene.layers());
rlay.layer = get_layer(b_rlay->layers());
rlay.material_override = b_rlay->material_override();

@ -54,7 +54,7 @@ public:
/* sync */
bool sync_recalc();
void sync_data(BL::SpaceView3D b_v3d, int layer = 0);
void sync_data(BL::SpaceView3D b_v3d, const char *layer = 0);
void sync_camera(int width, int height);
void sync_view(BL::SpaceView3D b_v3d, BL::RegionView3D b_rv3d, int width, int height);
@ -70,7 +70,7 @@ private:
void sync_materials();
void sync_objects(BL::SpaceView3D b_v3d);
void sync_film();
void sync_integrator(int layer);
void sync_integrator(const char *layer);
void sync_view();
void sync_world();
void sync_render_layers(BL::SpaceView3D b_v3d);
@ -110,6 +110,7 @@ private:
material_override(PointerRNA_NULL)
{}
string name;
uint scene_layer;
uint layer;
BL::Material material_override;

@ -368,12 +368,13 @@ __device int shader_bsdf_sample(KernelGlobals *kg, const ShaderData *sd,
#else
label = svm_bsdf_sample(sd, sc, randu, randv, &eval, omega_in, domega_in, pdf);
#endif
if(*pdf != 0.0f) {
bsdf_eval_init(bsdf_eval, sc->type, eval*sc->weight, kernel_data.film.use_light_pass);
bsdf_eval_init(bsdf_eval, sc->type, eval*sc->weight, kernel_data.film.use_light_pass);
if(sd->num_closure > 1 && *pdf != 0.0f) {
float sweight = sc->sample_weight;
_shader_bsdf_multi_eval(sd, *omega_in, pdf, sampled, bsdf_eval, *pdf*sweight, sweight);
if(sd->num_closure > 1) {
float sweight = sc->sample_weight;
_shader_bsdf_multi_eval(sd, *omega_in, pdf, sampled, bsdf_eval, *pdf*sweight, sweight);
}
}
return label;

@ -27,28 +27,12 @@ __device void svm_node_brightness(ShaderData *sd, float *stack, uint in_color, u
float brightness = stack_load_float(stack, bright_offset);
float contrast = stack_load_float(stack, contrast_offset);
brightness *= 1.0f/100.0f;
float delta = contrast * (1.0f/200.0f);
float a = 1.0f - delta * 2.0f;
float b;
float a = 1.0f + contrast;
float b = brightness - contrast*0.5f;
/*
* The algorithm is by Werner D. Streidt
* (http://visca.com/ffactory/archives/5-99/msg00021.html)
* Extracted of OpenCV demhist.c
*/
if (contrast > 0.0f) {
a = (a > 0.0f? (1.0f / a): 0.0f);
b = a * (brightness - delta);
}
else {
delta *= -1.0f;
b = a * (brightness + delta);
}
color.x = a*color.x + b;
color.y = a*color.y + b;
color.z = a*color.z + b;
color.x = max(a*color.x + b, 0.0f);
color.y = max(a*color.y + b, 0.0f);
color.z = max(a*color.z + b, 0.0f);
if (stack_valid(out_color))
stack_store_float3(stack, out_color, color);

@ -84,8 +84,9 @@ __device uint phash(int kx, int ky, int kz, int3 p)
__device float floorfrac(float x, int* i)
{
*i = quick_floor(x);
return x - *i;
float f = floorf(x);
*i = (int)f;
return x - f;
}
__device float fade(float t)

@ -20,29 +20,54 @@
#define __UTIL_THREAD_H__
#include <boost/thread.hpp>
#include <pthread.h>
#include <queue>
#include "util_function.h"
CCL_NAMESPACE_BEGIN
#if 0
/* use boost for mutexes */
/* Use STL for threading */
using std::thread;
using std::thread_mutex;
typedef std::lock_guard thread_scoped_lock;
using std::condition_variable;
#else
/* Use boost for threading */
using boost::thread;
typedef boost::mutex thread_mutex;
typedef boost::mutex::scoped_lock thread_scoped_lock;
typedef boost::condition_variable thread_condition_variable;
#endif
/* own pthread based implementation, to avoid boost version conflicts with
dynamically loaded blender plugins */
class thread {
public:
thread(boost::function<void(void)> run_cb_)
{
joined = false;
run_cb = run_cb_;
pthread_create(&pthread_id, NULL, run, (void*)this);
}
~thread()
{
if(!joined)
join();
}
static void *run(void *arg)
{
((thread*)arg)->run_cb();;
return NULL;
}
bool join()
{
return pthread_join(pthread_id, NULL) == 0;
}
protected:
boost::function<void(void)> run_cb;
pthread_t pthread_id;
bool joined;
};
/* Thread Safe Queue to pass tasks from one thread to another. Tasks should be
* pushed into the queue, while the worker thread waits to pop the next task

@ -27,6 +27,12 @@
#include <stdio.h>
#include <stdlib.h>
/* absolute value */
template < class T >
inline T
ABS( T a )
{ return (0 < a) ? a : -a ; }
// hack for MSVC6.0 compiler
#ifdef _MSC_VER
#if _MSC_VER < 1300

@ -177,12 +177,6 @@ inline T
MAX( T a, T b )
{ return (a < b) ? b : a ; }
/* absolute value */
template < class T >
inline T
ABS( T a )
{ return (0 < a) ? a : -a ; }
/* sign of the value */
template < class T >
inline T

@ -717,10 +717,11 @@ GHOST_EventKey* GHOST_SystemWin32::processKeyEvent(GHOST_IWindow *window, RAWINP
if (key != GHOST_kKeyUnknown) {
char utf8_char[6] = {0} ;
char ascii = 0;
wchar_t utf16[2]={0};
BYTE state[256];
GetKeyboardState((PBYTE)state);
BYTE state[256] ={0};
GetKeyboardState(state);
if(ToUnicodeEx(vk, 0, state, utf16, 2, 0, system->m_keylayout))
WideCharToMultiByte(CP_UTF8, 0,
@ -728,9 +729,14 @@ GHOST_EventKey* GHOST_SystemWin32::processKeyEvent(GHOST_IWindow *window, RAWINP
(LPSTR) utf8_char, 5,
NULL,NULL); else *utf8_char = 0;
if(!keyDown) utf8_char[0] = '\0';
event = new GHOST_EventKey(system->getMilliSeconds(), keyDown ? GHOST_kEventKeyDown: GHOST_kEventKeyUp, window, key, (*utf8_char & 0x80)?'?':*utf8_char, utf8_char);
if(!keyDown) {utf8_char[0] = '\0'; ascii='\0';}
else ascii = utf8_char[0]& 0x80?'?':utf8_char[0];
if(0x80&state[VK_MENU]) utf8_char[0]='\0';
event = new GHOST_EventKey(system->getMilliSeconds(), keyDown ? GHOST_kEventKeyDown: GHOST_kEventKeyUp, window, key, ascii, utf8_char);
#ifdef GHOST_DEBUG
std::cout << ascii << std::endl;

@ -327,9 +327,6 @@ def refresh_script_paths():
_sys_path_ensure(path)
_presets = _os.path.join(_scripts[0], "presets") # FIXME - multiple paths
def preset_paths(subdir):
"""
Returns a list of paths for a specific preset.

@ -158,7 +158,7 @@ def bake_action(frame_start,
# -------------------------------------------------------------------------
# Create action
# in case animation data hassnt been created
# in case animation data hasn't been created
atd = obj.animation_data_create()
if action is None:
action = bpy.data.actions.new("Action")

@ -167,7 +167,7 @@ def edge_loops_from_faces(mesh, faces=None, seams=()):
flipped = False
while 1:
# from knowing the last 2, look for th next.
# from knowing the last 2, look for the next.
ed_adj = edges[context_loop[-1]]
if len(ed_adj) != 2:
# the original edge had 2 other edges
@ -175,7 +175,7 @@ def edge_loops_from_faces(mesh, faces=None, seams=()):
flipped = True # only flip the list once
context_loop.reverse()
ed_adj[:] = []
context_loop.append(other_dir) # save 1 lookiup
context_loop.append(other_dir) # save 1 look-up
ed_adj = edges[context_loop[-1]]
if len(ed_adj) != 2:
@ -375,7 +375,7 @@ def ngon_tesselate(from_data, indices, fix_loops=True):
if s1[0][1] == s1[-1][1]: # remove endpoints double
s1.pop()
s2[:] = [] # Empty this segment s2 so we dont use it again.
s2[:] = [] # Empty this segment s2 so we don't use it again.
return True
joining_segments = True

@ -44,7 +44,7 @@ changes have been made:
import os
import sys
TIMEOUT_STORAGE = 3 # Time in secs after which the rootmodules will be stored
TIMEOUT_STORAGE = 3 # Time in secs after which the root-modules will be stored
TIMEOUT_GIVEUP = 20 # Time in secs after which we give up
ROOT_MODULES = None
@ -53,7 +53,7 @@ ROOT_MODULES = None
def get_root_modules():
"""
Returns a list containing the names of all the modules available in the
folders of the pythonpath.
folders of the python-path.
:returns: modules
:rtype: list

@ -161,7 +161,7 @@ class ANIM_OT_keying_set_export(Operator):
class BakeAction(Operator):
"""Bake animation to an Action"""
"""Bake object/pose loc/scale/rotation animation to a new action"""
bl_idname = "nla.bake"
bl_label = "Bake Action"
bl_options = {'REGISTER', 'UNDO'}
@ -227,7 +227,7 @@ class BakeAction(Operator):
class ClearUselessActions(Operator):
"""Mark actions with no F-Curves for deletion after save+reload of """ \
"""Mark actions with no F-Curves for deletion after save & reload of """ \
"""file preserving \"action libraries\""""
bl_idname = "anim.clear_useless_actions"
bl_label = "Clear Useless Actions"

@ -143,6 +143,7 @@ class CLIP_OT_track_to_empty(Operator):
if constraint is None:
constraint = ob.constraints.new(type='FOLLOW_TRACK')
constraint.use_active_clip = False
constraint.clip = sc.clip
constraint.track = track.name
constraint.use_3d_position = False
@ -275,8 +276,8 @@ class CLIP_OT_delete_proxy(Operator):
class CLIP_OT_set_viewport_background(Operator):
"""Set current movie clip as a camera background in 3D viewport \
(works only when a 3D viewport is visible)"""
"""Set current movie clip as a camera background in 3D view-port """ \
"""(works only when a 3D view-port is visible)"""
bl_idname = "clip.set_viewport_background"
bl_label = "Set as Background"
@ -314,9 +315,9 @@ object's movement caused by this constraint"""
frame_current = scene.frame_current
matrices = []
# Find constraint which would eb converting
# Find constraint which would be converting
# TODO: several camera solvers and track followers would fail,
# but can't think about eal workflow where it'll be useful
# but can't think about real work-flow where it'll be useful
for x in ob.constraints:
if x.type in {'CAMERA_SOLVER', 'FOLLOW_TRACK', 'OBJECT_SOLVER'}:
con = x
@ -368,7 +369,7 @@ object's movement caused by this constraint"""
ob.animation_data_create()
# Apply matrices on object and insert keyframes
# Apply matrices on object and insert key-frames
i = 0
for x in range(sfra, efra + 1):
scene.frame_set(x)
@ -791,7 +792,7 @@ class CLIP_OT_setup_tracking_scene(Operator):
all_layers = self._mergeLayers(fg.layers, bg.layers)
# enshure all lamps are active on foreground and background
# ensure all lamps are active on foreground and background
has_lamp = False
has_mesh = False
for ob in scene.objects:

@ -128,7 +128,7 @@ class SaveDirty(Operator):
class ProjectEdit(Operator):
"""Edit a snapshot of the viewport in an external image editor"""
"""Edit a snapshot of the view-port in an external image editor"""
bl_idname = "image.project_edit"
bl_label = "Project Edit"
bl_options = {'REGISTER'}

@ -334,8 +334,8 @@ class ShapeTransfer(Operator):
orig_shape_coords = me_cos(ob_act.active_shape_key.data)
orig_normals = me_nos(me.vertices)
# the actual mverts location isn't as reliable as the base shape :S
# orig_coords = me_cos(me.vertices)
# actual mesh vertex location isn't as reliable as the base shape :S
#~ orig_coords = me_cos(me.vertices)
orig_coords = me_cos(me.shape_keys.key_blocks[0].data)
for ob_other in objects:
@ -653,8 +653,8 @@ class MakeDupliFace(Operator):
class IsolateTypeRender(Operator):
'''Hide unselected render objects of same type as active ''' \
'''by setting the hide render flag'''
"""Hide unselected render objects of same type as active """ \
"""by setting the hide render flag"""
bl_idname = "object.isolate_type_render"
bl_label = "Restrict Render Unselected"
bl_options = {'REGISTER', 'UNDO'}

@ -35,10 +35,11 @@ class AddPresetBase():
name="Name",
description="Name of the preset, used to make the path name",
maxlen=64,
options={'SKIP_SAVE'},
)
remove_active = bpy.props.BoolProperty(
default=False,
options={'HIDDEN'},
options={'HIDDEN', 'SKIP_SAVE'},
)
@staticmethod
@ -195,7 +196,7 @@ class ExecutePreset(Operator):
preset_class.preset_xml_map)
else:
self.report({'ERROR'}, "unknown filetype: %r" % ext)
return {'CANCELLED '}
return {'CANCELLED'}
return {'FINISHED'}
@ -427,7 +428,7 @@ class AddPresetInterfaceTheme(AddPresetBase, Operator):
class AddPresetKeyconfig(AddPresetBase, Operator):
'''Add a Keyconfig Preset'''
'''Add a Key-config Preset'''
bl_idname = "wm.keyconfig_preset_add"
bl_label = "Add Keyconfig Preset"
preset_menu = "USERPREF_MT_keyconfigs"

@ -25,7 +25,7 @@ from bpy.props import IntProperty
class SequencerCrossfadeSounds(Operator):
'''Do crossfading volume animation of two selected sound strips'''
'''Do cross-fading volume animation of two selected sound strips'''
bl_idname = "sequencer.crossfade_sounds"
bl_label = "Crossfade sounds"
@ -76,7 +76,7 @@ class SequencerCrossfadeSounds(Operator):
class SequencerCutMulticam(Operator):
'''Cut multicam strip and select camera'''
'''Cut multi-cam strip and select camera'''
bl_idname = "sequencer.cut_multicam"
bl_label = "Cut multicam"

@ -99,7 +99,7 @@ def extend(obj, operator, EXTEND_MODE):
iA = 1
iB = 0
# Set the target UV's touching source face, no tricky calc needed,
# Set the target UV's touching source face, no tricky calculations needed,
uvs_vhash_target[edgepair_inner_target[0]][:] = uvs_vhash_source[edgepair_inner_source[iA]]
uvs_vhash_target[edgepair_inner_target[1]][:] = uvs_vhash_source[edgepair_inner_source[iB]]
@ -156,8 +156,8 @@ def extend(obj, operator, EXTEND_MODE):
return
# Modes
# 0 unsearched
# 1:mapped, use search from this face. - removed!!
# 0 not yet searched for.
# 1:mapped, use search from this face - removed!
# 2:all siblings have been searched. don't search again.
face_modes = [0] * len(face_sel)
face_modes[face_act_local_index] = 1 # extend UV's from this face.

@ -246,10 +246,10 @@ def lightmap_uvpack(meshes,
pretty_faces = [prettyface(f) for f in face_sel if len(f.vertices) == 4]
# Do we have any tri's
# Do we have any triangles?
if len(pretty_faces) != len(face_sel):
# Now add tri's, not so simple because we need to pair them up.
# Now add triangles, not so simple because we need to pair them up.
def trylens(f):
# f must be a tri

@ -71,7 +71,7 @@ def pointInTri2D(v, v1, v2, v3):
mtx = Matrix((side1, side2, nor))
# Zero area 2d tri, even tho we throw away zerop area faces
# Zero area 2d tri, even tho we throw away zero area faces
# the projection UV can result in a zero area UV.
if not mtx.determinant():
dict_matrix[key] = None
@ -162,7 +162,7 @@ def island2Edge(island):
return length_sorted_edges, [v.to_3d() for v in unique_points.values()]
# ========================= NOT WORKING????
# Find if a points inside an edge loop, un-ordered.
# Find if a points inside an edge loop, unordered.
# pt is and x/y
# edges are a non ordered loop of edges.
# offsets are the edge x and y offset.

@ -21,15 +21,6 @@
# <pep8 compliant>
# History
#
# Originally written by Campbell Barton aka ideasman42
#
# 2009-11-01: * 2.5 port by Keith "Wahooney" Boshoff
# * Replaced old method with my own, speed is similar (about 0.001 sec on Suzanne)
# but results are far more accurate
#
def applyVertexDirt(me, blur_iterations, blur_strength, clamp_dirt, clamp_clean, dirt_only):
from mathutils import Vector

@ -397,7 +397,7 @@ class WM_OT_context_cycle_int(Operator):
exec("context.%s = value" % data_path)
if value != eval("context.%s" % data_path):
# relies on rna clamping int's out of the range
# relies on rna clamping integers out of the range
if self.reverse:
value = (1 << 31) - 1
else:
@ -731,7 +731,7 @@ class WM_OT_context_modal_mouse(Operator):
class WM_OT_url_open(Operator):
"Open a website in the Webbrowser"
"Open a website in the web-browser"
bl_idname = "wm.url_open"
bl_label = ""
@ -1180,7 +1180,7 @@ class WM_OT_copy_prev_settings(Operator):
class WM_OT_blenderplayer_start(Operator):
'''Launch the Blenderplayer with the current blendfile'''
'''Launch the blender-player with the current blend-file'''
bl_idname = "wm.blenderplayer_start"
bl_label = "Start"
@ -1202,7 +1202,7 @@ class WM_OT_blenderplayer_start(Operator):
class WM_OT_keyconfig_test(Operator):
"Test keyconfig for conflicts"
"Test key-config for conflicts"
bl_idname = "wm.keyconfig_test"
bl_label = "Test Key Configuration for Conflicts"

@ -217,7 +217,7 @@ class DATA_PT_active_spline(CurveButtonsPanelActive, Panel):
if is_poly:
# These settings are below but its easier to have
# poly's set aside since they use so few settings
# polys set aside since they use so few settings
row = layout.row()
row.label(text="Cyclic:")
row.prop(act_spline, "use_cyclic_u", text="U")
@ -250,7 +250,7 @@ class DATA_PT_active_spline(CurveButtonsPanelActive, Panel):
col = split.column()
col.prop(act_spline, "use_cyclic_v", text="V")
# its a surface, assume its a nurb.
# its a surface, assume its a nurbs
sub = col.column()
sub.active = (not act_spline.use_cyclic_v)
sub.prop(act_spline, "use_bezier_v", text="V")

@ -215,7 +215,7 @@ class PHYSICS_PT_dp_canvas_output(PhysicButtonsPanel, Panel):
# toggle active preview
layout.prop(surface, "preview_id")
# paintmap output
# paint-map output
row = layout.row()
row.prop_search(surface, "output_name_a", ob.data, "vertex_colors", text="Paintmap layer: ")
if surface.output_exists(object=ob, index=0):
@ -225,7 +225,7 @@ class PHYSICS_PT_dp_canvas_output(PhysicButtonsPanel, Panel):
row.operator("dpaint.output_toggle", icon=ic, text="").output = 'A'
# wetmap output
# wet-map output
row = layout.row()
row.prop_search(surface, "output_name_b", ob.data, "vertex_colors", text="Wetmap layer: ")
if surface.output_exists(object=ob, index=1):

@ -824,7 +824,6 @@ class TEXTURE_PT_mapping(TextureSlotPanel, Panel):
idblock = context_tex_datablock(context)
tex = context.texture_slot
# textype = context.texture
if not isinstance(idblock, Brush):
split = layout.split(percentage=0.3)
@ -912,7 +911,6 @@ class TEXTURE_PT_influence(TextureSlotPanel, Panel):
idblock = context_tex_datablock(context)
# textype = context.texture
tex = context.texture_slot
def factor_but(layout, toggle, factor, name):

@ -547,23 +547,15 @@ class CLIP_PT_display(Panel):
col = layout.column(align=True)
col.prop(sc, "show_marker_pattern", text="Pattern")
col.prop(sc, "show_marker_search", text="Search")
col.prop(sc, "show_pyramid_levels", text="Pyramid")
col.prop(sc, "show_track_path", text="Path")
row = col.row()
row.active = sc.show_track_path
row.prop(sc, "path_length", text="Length")
col.prop(sc, "show_disabled", "Disabled Tracks")
col.prop(sc, "show_names", text="Names and Status")
col.prop(sc, "show_bundles", text="3D Markers")
col.prop(sc, "show_names", text="Names and Status")
col.prop(sc, "show_tiny_markers", text="Compact Markers")
col.prop(sc, "use_mute_footage", text="Mute Footage")
col.prop(sc, "lock_selection")
col.prop(sc, "show_grease_pencil", text="Grease Pencil")
col.prop(sc, "use_mute_footage", text="Mute")
if sc.view == 'GRAPH':
col.prop(sc, "lock_time_cursor")
if sc.mode == 'DISTORTION':
col.prop(sc, "show_grid", text="Grid")
@ -571,15 +563,34 @@ class CLIP_PT_display(Panel):
elif sc.mode == 'RECONSTRUCTION':
col.prop(sc, "show_stable", text="Stable")
col.prop(sc, "lock_selection")
if sc.view == 'GRAPH':
col.prop(sc, "lock_time_cursor")
clip = sc.clip
if clip:
col.label(text="Display Aspect Ratio:")
col.prop(clip, "display_aspect", text="")
row = col.row()
row.prop(clip, "display_aspect", text="")
class CLIP_PT_marker_display(Panel):
bl_space_type = 'CLIP_EDITOR'
bl_region_type = 'UI'
bl_label = "Marker Display"
def draw(self, context):
layout = self.layout
sc = context.space_data
col = layout.column(align=True)
row = col.row()
row.prop(sc, "show_marker_pattern", text="Pattern")
row.prop(sc, "show_marker_search", text="Search")
col.prop(sc, "show_tiny_markers", text="Thin Markers")
col.prop(sc, "show_track_path", text="Path")
row = col.row()
row.active = sc.show_track_path
row.prop(sc, "path_length", text="Length")
class CLIP_PT_track_settings(Panel):

@ -273,7 +273,7 @@ class INFO_MT_add(Menu):
def draw(self, context):
layout = self.layout
# note, dont use 'EXEC_SCREEN' or operators wont get the 'v3d' context.
# note, don't use 'EXEC_SCREEN' or operators wont get the 'v3d' context.
layout.operator_context = 'EXEC_AREA'
@ -362,7 +362,7 @@ class INFO_MT_help(Menu):
layout = self.layout
layout.operator("wm.url_open", text="Manual", icon='HELP').url = 'http://wiki.blender.org/index.php/Doc:2.6/Manual'
layout.operator("wm.url_open", text="Release Log", icon='URL').url = 'http://www.blender.org/development/release-logs/blender-261/'
layout.operator("wm.url_open", text="Release Log", icon='URL').url = 'http://www.blender.org/development/release-logs/blender-262/'
layout.separator()

@ -49,8 +49,8 @@ class LOGIC_PT_properties(Panel):
sub.prop(prop, "name", text="")
row.prop(prop, "type", text="")
# get the property from the body, not the game property
# note, don't do this - it's too slow and body can potentually be a really long string.
# row.prop(ob.data, "body", text="")
# note, don't do this - it's too slow and body can potentially be a really long string.
#~ row.prop(ob.data, "body", text="")
row.label("See Text Object")
else:
props = layout.operator("object.game_property_new", text="Add Text Game Property", icon='ZOOMIN')

@ -143,7 +143,7 @@ class NLA_MT_edit(Menu):
layout.operator_menu_enum("anim.channels_move", "direction", text="Track Ordering...")
layout.separator()
# TODO: names of these tools for 'tweakmode' need changing?
# TODO: names of these tools for 'tweak-mode' need changing?
if scene.is_nla_tweakmode:
layout.operator("nla.tweakmode_exit", text="Stop Tweaking Strip Actions")
else:

@ -293,7 +293,7 @@ class USERPREF_PT_edit(Panel):
col.label(text="Grease Pencil:")
col.prop(edit, "grease_pencil_manhattan_distance", text="Manhattan Distance")
col.prop(edit, "grease_pencil_euclidean_distance", text="Euclidean Distance")
#col.prop(edit, "use_grease_pencil_simplify_stroke", text="Simplify Stroke")
#~ col.prop(edit, "use_grease_pencil_simplify_stroke", text="Simplify Stroke")
col.prop(edit, "grease_pencil_eraser_radius", text="Eraser Radius")
col.prop(edit, "use_grease_pencil_smooth_stroke", text="Smooth Stroke")
col.separator()
@ -316,7 +316,7 @@ class USERPREF_PT_edit(Panel):
sub = col.column()
# sub.active = edit.use_keyframe_insert_auto # incorrect, timeline can enable
#~ sub.active = edit.use_keyframe_insert_auto # incorrect, time-line can enable
sub.prop(edit, "use_keyframe_insert_available", text="Only Insert Available")
col.separator()
@ -833,7 +833,7 @@ from .space_userpref_keymap import InputKeyMapPanel
class USERPREF_MT_ndof_settings(Menu):
# accessed from the window keybindings in C (only)
# accessed from the window key-bindings in C (only)
bl_label = "3D Mouse Settings"
def draw(self, context):
@ -965,7 +965,7 @@ class USERPREF_PT_input(Panel, InputKeyMapPanel):
class USERPREF_MT_addons_dev_guides(Menu):
bl_label = "Development Guides"
# menu to open webpages with addons development guides
# menu to open web-pages with addons development guides
def draw(self, context):
layout = self.layout
layout.operator("wm.url_open", text="API Concepts", icon='URL').url = "http://wiki.blender.org/index.php/Dev:2.5/Py/API/Intro"
@ -1097,7 +1097,7 @@ class USERPREF_PT_addons(Panel):
else:
row.operator("wm.addon_enable", icon='CHECKBOX_DEHLT', text="", emboss=False).module = module_name
# Expanded UI (only if additional infos are available)
# Expanded UI (only if additional info is available)
if info["show_expanded"]:
if info["description"]:
split = colsub.row().split(percentage=0.15)

@ -180,7 +180,7 @@ class InputKeyMapPanel:
sub.prop(kmi, "propvalue", text="")
else:
# One day...
# sub.prop_search(kmi, "idname", bpy.context.window_manager, "operators_all", text="")
#~ sub.prop_search(kmi, "idname", bpy.context.window_manager, "operators_all", text="")
sub.prop(kmi, "idname", text="")
sub = split.column()

@ -751,6 +751,10 @@ class VIEW3D_MT_object_animation(Menu):
layout.operator("anim.keyframe_delete_v3d", text="Delete Keyframe...")
layout.operator("anim.keying_set_active_set", text="Change Keying Set...")
layout.separator()
layout.operator("nla.bake", text="Bake Action...")
class VIEW3D_MT_object_clear(Menu):
bl_label = "Clear"
@ -1642,8 +1646,8 @@ class VIEW3D_MT_edit_mesh_edges(Menu):
layout.operator("TRANSFORM_OT_edge_crease")
layout.operator("mesh.loop_multi_select", text="Edge Loop").ring = False
# uiItemO(layout, "Loopcut", 0, "mesh.loop_cut"); // CutEdgeloop(em, 1);
# uiItemO(layout, "Edge Slide", 0, "mesh.edge_slide"); // EdgeSlide(em, 0,0.0);
#~ uiItemO(layout, "Loopcut", 0, "mesh.loop_cut"); // CutEdgeloop(em, 1);
#~ uiItemO(layout, "Edge Slide", 0, "mesh.edge_slide"); // EdgeSlide(em, 0,0.0);
layout.operator("mesh.loop_multi_select", text="Edge Ring").ring = True

@ -1051,10 +1051,10 @@ class VIEW3D_PT_tools_weightpaint_options(Panel, View3DPaintPanel):
self.unified_paint_settings(col, context)
# Commented out because the Apply button isn't an operator yet, making these settings useless
# col.label(text="Gamma:")
# col.prop(wpaint, "gamma", text="")
# col.label(text="Multiply:")
# col.prop(wpaint, "mul", text="")
#~ col.label(text="Gamma:")
#~ col.prop(wpaint, "gamma", text="")
#~ col.label(text="Multiply:")
#~ col.prop(wpaint, "mul", text="")
# Also missing now:
# Soft, Vertex-Group, X-Mirror and "Clear" Operator.
@ -1081,10 +1081,10 @@ class VIEW3D_PT_tools_vertexpaint(Panel, View3DPaintPanel):
self.unified_paint_settings(col, context)
# Commented out because the Apply button isn't an operator yet, making these settings useless
# col.label(text="Gamma:")
# col.prop(vpaint, "gamma", text="")
# col.label(text="Multiply:")
# col.prop(vpaint, "mul", text="")
#~ col.label(text="Gamma:")
#~ col.prop(vpaint, "gamma", text="")
#~ col.label(text="Multiply:")
#~ col.prop(vpaint, "mul", text="")
# ********** default tools for texture-paint ****************

@ -326,7 +326,7 @@ class BUILTIN_KSI_WholeCharacter(KeyingSetInfo):
for i in range(3):
if not bone.lock_rotation[i]:
ksi.addProp(ks, bone, prop, i + 1) # i + 1, since here x,y,z = 1,2,3, and w=0
ksi.addProp(ks, bone, prop, i + 1) # i + 1, since here x/y/z = 1,2,3, and w=0
elif True not in bone.lock_rotation:
# if axis-angle rotations get locked as eulers, then it's too messy to allow anything
# other than all open unless we keyframe the whole lot

@ -15,7 +15,7 @@ class CustomMenu(bpy.types.Menu):
layout.label(text="Hello world!", icon='WORLD_DATA')
# use an operator enum property to populate a submenu
# use an operator enum property to populate a sub-menu
layout.operator_menu_enum("object.select_by_type",
property="type",
text="Select All by Type...",

@ -12,18 +12,18 @@
</style>
</head>
<body>
<p class="title"><b>Blender 2.61</b></p>
<p class="title"><b>Blender 2.62</b></p>
<p><br></p>
<p class="header"><b>About</b></p>
<p class="body">Welcome to Blender, the free, open source 3D application for modeling, animation, rendering, compositing, video editing and game creation. Blender is available for Linux, Mac OS X, Windows, Solaris and FreeBSD and has a large world-wide community.</p>
<p class="body">Blender can be used freely for any purpose, including commercial use and distribution. It's free and open-source software, released under the GNU GPL licence. The entire source code is available on our website.</p>
<p class="body">For more information, visit <a href="http://www.blender.org">blender.org</a>.</p>
<p><br></p>
<p class="header"><b>2.61</b></p>
<p class="body">The Blender Foundation and online developer community is proud to present Blender 2.61. This release is the second official stable release of the Blender 2.6 series, in which we will refine the 2.5 series and add exciting new features again.<a href="http://www.blender.org/development/release-logs/blender-261/">More information about this release</a>.</p>
<p class="header"><b>2.62</b></p>
<p class="body">The Blender Foundation and online developer community is proud to present Blender 2.62. This release is the third official stable release of the Blender 2.6 series, in which we will refine the 2.5 series and add exciting new features again.<a href="http://www.blender.org/development/release-logs/blender-262/">More information about this release</a>.</p>
<p><br></p>
<p class="header"><b>Bugs</b></p>
<p class="body">Although Blender 2.61 is considered a stable release, you may encounter a bug. If you do, please help us by posting it in the bug tracker or using Help → Report a Bug from inside Blender. If it wasnt reported yet, please log in (or register) and fill in detailed information about the error. Please post detailed instructions on how to reproduce it or post a .blend file showcasing the bug.</p>
<p class="body">Although Blender 2.62 is considered a stable release, you may encounter a bug. If you do, please help us by posting it in the bug tracker or using Help → Report a Bug from inside Blender. If it wasnt reported yet, please log in (or register) and fill in detailed information about the error. Please post detailed instructions on how to reproduce it or post a .blend file showcasing the bug.</p>
<p><br></p>
<p class="header"><b>Package Contents</b></p>
<p class="body">The downloaded Blender package includes:</p>
@ -47,7 +47,7 @@
<p class="header"><b>Links</b></p>
<p class="body">Users:</p>
<p class="body"> General information <a href="http://www.blender.org">www.blender.org</a> <br>
Full release log <a href="http://www.blender.org/development/release-logs/blender-261/">www.blender.org/development/release-logs/blender-261/</a><br>
Full release log <a href="http://www.blender.org/development/release-logs/blender-262/">www.blender.org/development/release-logs/blender-262/</a><br>
Tutorials <a href="http://www.blender.org/education-help/">www.blender.org/education-help/</a> <br>
Manual <a href="http://wiki.blender.org/index.php/Doc:Manual">wiki.blender.org/index.php/Doc:Manual</a><br>
User Forum <a href="http://www.blenderartists.org">www.blenderartists.org</a><br>

@ -197,7 +197,6 @@ void BLF_dir_free(char **dirs, int count);
#define BLF_KERNING_DEFAULT (1<<3)
#define BLF_MATRIX (1<<4)
#define BLF_ASPECT (1<<5)
#define BLF_TEXFILTER (1<<6)
#define BLF_DRAW_STR_DUMMY_MAX 1024

@ -54,8 +54,6 @@
#include "blf_internal_types.h"
#include "blf_internal.h"
#define _BLF_PADDING 3
#define _BLF_MIPMAP_LEVELS 3
GlyphCacheBLF *blf_glyph_cache_find(FontBLF *font, int size, int dpi)
{
@ -89,11 +87,7 @@ GlyphCacheBLF *blf_glyph_cache_new(FontBLF *font)
gc->cur_tex= -1;
gc->x_offs= 0;
gc->y_offs= 0;
/* Increase padding for each mipmap level: 0->3, 1->4, 2->6, 3->10, ... */
if (font->flags & BLF_TEXFILTER)
gc->pad= pow(2, _BLF_MIPMAP_LEVELS) + 2;
else
gc->pad= _BLF_PADDING;
gc->pad= 3;
gc->num_glyphs= font->face->num_glyphs;
gc->rem_glyphs= font->face->num_glyphs;
@ -302,17 +296,13 @@ void blf_glyph_free(GlyphBLF *g)
static void blf_texture_draw(float uv[2][2], float dx, float y1, float dx1, float y2)
{
/* When a string is being rendered as individual glyphs (as in the game
* engine), the leading edge needs to be raised a fraction to prevent
* z-fighting for kerned characters. - z0r */
const float twist = (dx1 - dx) * 0.0002f;
glBegin(GL_QUADS);
glTexCoord2f(uv[0][0], uv[0][1]);
glVertex3f(dx, y1, twist);
glVertex2f(dx, y1);
glTexCoord2f(uv[0][0], uv[1][1]);
glVertex3f(dx, y2, twist);
glVertex2f(dx, y2);
glTexCoord2f(uv[1][0], uv[1][1]);
glVertex2f(dx1, y2);
@ -415,15 +405,6 @@ int blf_glyph_render(FontBLF *font, GlyphBLF *g, float x, float y)
glBindTexture(GL_TEXTURE_2D, g->tex);
glTexSubImage2D(GL_TEXTURE_2D, 0, g->xoff, g->yoff, g->width, g->height, GL_ALPHA, GL_UNSIGNED_BYTE, g->bitmap);
if (font->flags & BLF_TEXFILTER) {
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_BASE_LEVEL, 0);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL,
_BLF_MIPMAP_LEVELS);
glGenerateMipmap(GL_TEXTURE_2D);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,
GL_LINEAR_MIPMAP_LINEAR);
}
glPopClientAttrib();
g->uv[0][0]= ((float)g->xoff) / ((float)gc->p2_width);

@ -51,7 +51,7 @@ extern "C" {
/* can be left blank, otherwise a,b,c... etc with no quotes */
#define BLENDER_VERSION_CHAR
/* alpha/beta/rc/release, docs use this */
#define BLENDER_VERSION_CYCLE beta
#define BLENDER_VERSION_CYCLE rc
extern char versionstr[]; /* from blender.c */

@ -74,7 +74,7 @@ void filepath_ffmpeg(char* string, struct RenderData* rd);
extern void ffmpeg_set_preset(struct RenderData *rd, int preset);
extern void ffmpeg_verify_image_type(struct RenderData *rd, struct ImageFormatData *imf);
extern void ffmpeg_verify_lossless_format(struct RenderData *rd, struct ImageFormatData *imf);
extern void ffmpeg_verify_codec_settings(struct RenderData *rd);
extern struct IDProperty *ffmpeg_property_add(struct RenderData *Rd, const char *type, int opt_index, int parent_index);
extern int ffmpeg_property_add_string(struct RenderData *rd, const char *type, const char *str);

@ -650,11 +650,11 @@ void defvert_remove_group(MDeformVert *dvert, MDeformWeight *dw)
dvert->dw[i]= dvert->dw[dvert->totweight];
}
memcpy(dw_new, dvert->dw, sizeof(MDeformWeight) * dvert->totweight);
MEM_freeN(dvert->dw);
#else
memcpy(dw_new, dvert->dw, sizeof(MDeformWeight)*i);
memcpy(dw_new+i, dvert->dw+i+1, sizeof(MDeformWeight)*(dvert->totweight-i));
#endif
MEM_freeN(dvert->dw);
}
dvert->dw = dw_new;
}

@ -398,8 +398,11 @@ static void build_dag_object(DagForest *dag, DagNode *scenenode, Scene *scene, O
// fprintf(stderr,"armature %s target :%s \n", ob->id.name, target->id.name);
node3 = dag_get_node(dag, ct->tar);
if (ct->subtarget[0])
if (ct->subtarget[0]) {
dag_add_relation(dag,node3,node, DAG_RL_OB_DATA|DAG_RL_DATA_DATA, cti->name);
if(ct->tar->type == OB_MESH)
node3->customdata_mask |= CD_MASK_MDEFORMVERT;
}
else if(ELEM3(con->type, CONSTRAINT_TYPE_FOLLOWPATH, CONSTRAINT_TYPE_CLAMPTO, CONSTRAINT_TYPE_SPLINEIK))
dag_add_relation(dag,node3,node, DAG_RL_DATA_DATA|DAG_RL_OB_DATA, cti->name);
else

@ -58,7 +58,7 @@ static IDType idtypes[]= {
{ ID_ID, "ID", "ids", 0}, /* plural is fake */
{ ID_IM, "Image", "images", IDTYPE_FLAGS_ISLINKABLE},
{ ID_IP, "Ipo", "ipos", IDTYPE_FLAGS_ISLINKABLE}, /* deprecated */
{ ID_KE, "Key", "keys", 0},
{ ID_KE, "Key", "shape_keys", 0},
{ ID_LA, "Lamp", "lamps", IDTYPE_FLAGS_ISLINKABLE},
{ ID_LI, "Library", "libraries", 0},
{ ID_LS, "FreestyleLineStyle", "linestyles", IDTYPE_FLAGS_ISLINKABLE},

@ -1315,7 +1315,7 @@ UvVertMap *make_uv_vert_map(struct MFace *mface, struct MTFace *tface, unsigned
for(a=0; a<totface; a++, mf++)
if(!selected || (!(mf->flag & ME_HIDE) && (mf->flag & ME_FACE_SEL)))
totuv += (mf->v4)? 4: 3;
if(totuv==0)
return NULL;

@ -4524,7 +4524,6 @@ void psys_make_billboard(ParticleBillboardData *bb, float xvec[3], float yvec[3]
madd_v3_v3fl(center, yvec, bb->offset[1]);
}
void psys_apply_hair_lattice(Scene *scene, Object *ob, ParticleSystem *psys)
{
ParticleSimulationData sim= {0};

@ -44,12 +44,12 @@
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
#include "BLI_utildefines.h"
#include "BLI_blenlib.h"
#include "BLI_edgehash.h"
#include "BLI_math.h"
#include "BLI_memarena.h"
#include "BLI_pbvh.h"
#include "BLI_utildefines.h"
#include "BKE_cdderivedmesh.h"
#include "BKE_global.h"

@ -49,6 +49,8 @@
# include "AUD_C-API.h"
#endif
#include "BLI_utildefines.h"
#include "BKE_global.h"
#include "BKE_idprop.h"
#include "BKE_main.h"
@ -250,7 +252,8 @@ static int write_video_frame(RenderData *rd, int cfra, AVFrame* frame, ReportLis
outsize = avcodec_encode_video(c, video_buffer, video_buffersize,
frame);
if (outsize != 0) {
if (outsize > 0) {
AVPacket packet;
av_init_packet(&packet);
@ -268,14 +271,13 @@ static int write_video_frame(RenderData *rd, int cfra, AVFrame* frame, ReportLis
packet.data = video_buffer;
packet.size = outsize;
ret = av_interleaved_write_frame(outfile, &packet);
} else {
ret = 0;
success = (ret == 0);
} else if (outsize < 0) {
success = 0;
}
if (ret != 0) {
success= 0;
if (!success)
BKE_report(reports, RPT_ERROR, "Error writing frame.");
}
return success;
}
@ -483,7 +485,7 @@ static AVStream* alloc_video_stream(RenderData *rd, int codec_id, AVFormatContex
if (!codec) return NULL;
/* Be sure to use the correct pixel format(e.g. RGB, YUV) */
if (codec->pix_fmts) {
c->pix_fmt = codec->pix_fmts[0];
} else {
@ -509,6 +511,12 @@ static AVStream* alloc_video_stream(RenderData *rd, int codec_id, AVFormatContex
c->pix_fmt = PIX_FMT_RGB32;
}
if ( codec_id == CODEC_ID_QTRLE ) {
if (rd->im_format.planes == R_IMF_PLANES_RGBA) {
c->pix_fmt = PIX_FMT_ARGB;
}
}
if ((of->oformat->flags & AVFMT_GLOBALHEADER)
// || !strcmp(of->oformat->name, "mp4")
// || !strcmp(of->oformat->name, "mov")
@ -538,7 +546,19 @@ static AVStream* alloc_video_stream(RenderData *rd, int codec_id, AVFormatContex
return NULL;
}
video_buffersize = avpicture_get_size(c->pix_fmt, c->width, c->height);
if ( codec_id == CODEC_ID_QTRLE ) {
// normally it should be enough to have buffer with actual image size,
// but some codecs like QTRLE might store extra information in this buffer,
// so it should be a way larger
// maximum video buffer size is 6-bytes per pixel, plus DPX header size (1664)
// (from FFmpeg sources)
int size = c->width * c->height;
video_buffersize = 7*size + 10000;
}
else
video_buffersize = avpicture_get_size(c->pix_fmt, c->width, c->height);
video_buffer = (uint8_t*)MEM_mallocN(video_buffersize*sizeof(uint8_t),
"FFMPEG video buffer");
@ -1200,12 +1220,14 @@ int ffmpeg_property_add_string(RenderData *rd, const char * type, const char * s
return 1;
}
static void ffmpeg_set_expert_options(RenderData *rd, int preset)
static void ffmpeg_set_expert_options(RenderData *rd)
{
int codec_id = rd->ffcodecdata.codec;
if(rd->ffcodecdata.properties)
IDP_FreeProperty(rd->ffcodecdata.properties);
if(preset == FFMPEG_PRESET_H264) {
if(codec_id == CODEC_ID_H264) {
/*
* All options here are for x264, but must be set via ffmpeg.
* The names are therefore different - Search for "x264 to FFmpeg option mapping"
@ -1248,6 +1270,12 @@ static void ffmpeg_set_expert_options(RenderData *rd, int preset)
if(rd->ffcodecdata.flags & FFMPEG_LOSSLESS_OUTPUT)
ffmpeg_property_add_string(rd, "video", "cqp:0");
}
#if 0 /* disabled for after release */
else if(codec_id == CODEC_ID_DNXHD) {
if(rd->ffcodecdata.flags & FFMPEG_LOSSLESS_OUTPUT)
ffmpeg_property_add_string(rd, "video", "mbd:rd");
}
#endif
}
void ffmpeg_set_preset(RenderData *rd, int preset)
@ -1317,7 +1345,6 @@ void ffmpeg_set_preset(RenderData *rd, int preset)
rd->ffcodecdata.mux_packet_size = 2048;
rd->ffcodecdata.mux_rate = 10080000;
ffmpeg_set_expert_options(rd, preset);
break;
case FFMPEG_PRESET_THEORA:
@ -1341,6 +1368,8 @@ void ffmpeg_set_preset(RenderData *rd, int preset)
break;
}
ffmpeg_set_expert_options(rd);
}
void ffmpeg_verify_image_type(RenderData *rd, ImageFormatData *imf)
@ -1388,11 +1417,9 @@ void ffmpeg_verify_image_type(RenderData *rd, ImageFormatData *imf)
}
}
void ffmpeg_verify_lossless_format(RenderData *rd, ImageFormatData *imf)
void ffmpeg_verify_codec_settings(RenderData *rd)
{
if(imf->imtype == R_IMF_IMTYPE_H264) {
ffmpeg_set_expert_options(rd, FFMPEG_PRESET_H264);
}
ffmpeg_set_expert_options(rd);
}
#endif

@ -4771,8 +4771,8 @@ static void lib_link_scene(FileData *fd, Main *main)
(void)marker;
#endif
if(sce->ed)
seq_update_muting(sce->ed);
seq_update_muting(sce->ed);
seq_update_sound_bounds_all(sce);
if(sce->nodetree) {
lib_link_ntree(fd, &sce->id, sce->nodetree);

@ -773,6 +773,27 @@ std::string AnimationExporter::create_4x4_source(std::vector<float> &frames , Ob
copy_m4_m4(mat, pchan->pose_mat);
UnitConverter converter;
// SECOND_LIFE_COMPATIBILITY
// AFAIK animation to second life is via BVH, but no
// reason to not have the collada-animation be correct
if(export_settings->second_life)
{
float temp[4][4];
copy_m4_m4(temp, bone->arm_mat);
temp[3][0] = temp[3][1] = temp[3][2] = 0.0f;
invert_m4(temp);
mult_m4_m4m4(mat, mat, temp);
if(bone->parent)
{
copy_m4_m4(temp, bone->parent->arm_mat);
temp[3][0] = temp[3][1] = temp[3][2] = 0.0f;
mult_m4_m4m4(mat, temp, mat);
}
}
float outmat[4][4];
converter.mat4_to_dae(outmat,mat);

@ -83,7 +83,9 @@ private:
public:
AnimationExporter(COLLADASW::StreamWriter *sw): COLLADASW::LibraryAnimations(sw) { this->sw = sw; }
AnimationExporter(COLLADASW::StreamWriter *sw, const ExportSettings *export_settings):
COLLADASW::LibraryAnimations(sw), export_settings(export_settings)
{ this->sw = sw; }
void exportAnimations(Scene *sce);
@ -92,6 +94,7 @@ public:
void operator() (Object *ob);
protected:
const ExportSettings *export_settings;
void dae_animation(Object* ob, FCurve *fcu, char* transformName , bool is_param, Material *ma = NULL);

@ -221,8 +221,31 @@ void ArmatureExporter::add_bone_transform(Object *ob_arm, Bone *bone, COLLADASW:
mult_m4_m4m4(mat, invpar, pchan->pose_mat);
}
else {
// get world-space from armature-space
mult_m4_m4m4(mat, ob_arm->obmat, pchan->pose_mat);
copy_m4_m4(mat, pchan->pose_mat);
// Why? Joint's localspace is still it's parent node
//get world-space from armature-space
//mult_m4_m4m4(mat, ob_arm->obmat, pchan->pose_mat);
}
// SECOND_LIFE_COMPATIBILITY
if(export_settings->second_life)
{
// Remove rotations vs armature from transform
// parent_rest_rot * mat * irest_rot
float temp[4][4];
copy_m4_m4(temp, bone->arm_mat);
temp[3][0] = temp[3][1] = temp[3][2] = 0.0f;
invert_m4(temp);
mult_m4_m4m4(mat, mat, temp);
if(bone->parent)
{
copy_m4_m4(temp, bone->parent->arm_mat);
temp[3][0] = temp[3][1] = temp[3][2] = 0.0f;
mult_m4_m4m4(mat, temp, mat);
}
}
TransformWriter::add_node_transform(node, mat,NULL );
@ -341,10 +364,16 @@ std::string ArmatureExporter::add_inv_bind_mats_source(Object *ob_arm, ListBase
{
std::string source_id = controller_id + BIND_POSES_SOURCE_ID_SUFFIX;
int totjoint = 0;
for (bDeformGroup *def = (bDeformGroup*)defbase->first; def; def = def->next) {
if (is_bone_defgroup(ob_arm, def))
totjoint++;
}
COLLADASW::FloatSourceF source(mSW);
source.setId(source_id);
source.setArrayId(source_id + ARRAY_ID_SUFFIX);
source.setAccessorCount(BLI_countlist(defbase));
source.setAccessorCount(totjoint); //BLI_countlist(defbase));
source.setAccessorStride(16);
source.setParameterTypeName(&COLLADASW::CSWC::CSW_VALUE_TYPE_FLOAT4x4);
@ -366,16 +395,27 @@ std::string ArmatureExporter::add_inv_bind_mats_source(Object *ob_arm, ListBase
for (bDeformGroup *def = (bDeformGroup*)defbase->first; def; def = def->next) {
if (is_bone_defgroup(ob_arm, def)) {
bPoseChannel *pchan = get_pose_channel(pose, def->name);
float mat[4][4];
float world[4][4];
float inv_bind_mat[4][4];
// make world-space matrix, arm_mat is armature-space
mult_m4_m4m4(world, ob_arm->obmat, pchan->bone->arm_mat);
// SECOND_LIFE_COMPATIBILITY
if(export_settings->second_life)
{
// Only translations, no rotation vs armature
float temp[4][4];
unit_m4(temp);
copy_v3_v3(temp[3], pchan->bone->arm_mat[3]);
mult_m4_m4m4(world, ob_arm->obmat, temp);
}
else
{
// make world-space matrix, arm_mat is armature-space
mult_m4_m4m4(world, ob_arm->obmat, pchan->bone->arm_mat);
}
invert_m4_m4(mat, world);
converter.mat4_to_dae(inv_bind_mat, mat);

@ -257,7 +257,7 @@ void DocumentExporter::exportCurrentScene(Scene *sce)
}
// <library_animations>
AnimationExporter ae(&sw);
AnimationExporter ae(&sw, this->export_settings);
ae.exportAnimations(sce);
// <library_controllers>

@ -31,6 +31,7 @@ struct ExportSettings
{
public:
bool selected;
bool second_life;
char *filepath;
};

@ -59,6 +59,7 @@ void TransformWriter::add_node_transform(COLLADASW::Node& node, float mat[][4],
void TransformWriter::add_node_transform_ob(COLLADASW::Node& node, Object *ob)
{
/*
float rot[3], loc[3], scale[3];
if (ob->parent) {
@ -91,6 +92,27 @@ void TransformWriter::add_node_transform_ob(COLLADASW::Node& node, Object *ob)
}
add_transform(node, loc, rot, scale);
*/
/* Using parentinv should allow use of existing curves */
// If parentinv is identity don't add it.
bool add_parinv = false;
for(int i = 0; i < 16; ++i)
{
float f = (i%4 == i/4) ? 1.0f : 0.0f ;
if(ob->parentinv[i%4][i/4] != f) add_parinv = true;
}
// Eat this 3ds Max et friends
if(add_parinv)
{
double dmat[4][4];
UnitConverter converter;
converter.mat4_to_dae_double(dmat, ob->parentinv);
node.addMatrix("parentinverse", dmat);
}
add_transform(node, ob->loc, ob->rot, ob->size);
}
void TransformWriter::add_node_transform_identity(COLLADASW::Node& node)

@ -49,11 +49,12 @@ extern "C"
return 0;
}
int collada_export(Scene *sce, const char *filepath, int selected)
int collada_export(Scene *sce, const char *filepath, int selected, int second_life)
{
ExportSettings export_settings;
export_settings.selected = selected != 0;
export_settings.second_life = second_life != 0;
export_settings.filepath = (char *)filepath;
/* annoying, collada crashes if file cant be created! [#27162] */

@ -37,7 +37,7 @@ extern "C" {
* both return 1 on success, 0 on error
*/
int collada_import(bContext *C, const char *filepath);
int collada_export(Scene *sce, const char *filepath, int selected);
int collada_export(Scene *sce, const char *filepath, int selected, int second_life);
#ifdef __cplusplus
}
#endif

@ -439,22 +439,28 @@ static void draw_marker(View2D *v2d, TimeMarker *marker, int cfra, int flag)
void draw_markers_time(const bContext *C, int flag)
{
ListBase *markers= ED_context_get_markers(C);
View2D *v2d= UI_view2d_fromcontext(C);
View2D *v2d;
TimeMarker *marker;
Scene *scene;
if (markers == NULL)
return;
scene = CTX_data_scene(C);
v2d = UI_view2d_fromcontext(C);
/* unselected markers are drawn at the first time */
for (marker= markers->first; marker; marker= marker->next) {
if ((marker->flag & SELECT) == 0)
draw_marker(v2d, marker, CTX_data_scene(C)->r.cfra, flag);
if ((marker->flag & SELECT) == 0) {
draw_marker(v2d, marker, scene->r.cfra, flag);
}
}
/* selected markers are drawn later */
for (marker= markers->first; marker; marker= marker->next) {
if (marker->flag & SELECT)
draw_marker(v2d, marker, CTX_data_scene(C)->r.cfra, flag);
if (marker->flag & SELECT) {
draw_marker(v2d, marker, scene->r.cfra, flag);
}
}
}
@ -550,7 +556,8 @@ static int ed_marker_add(bContext *C, wmOperator *UNUSED(op))
if (markers == NULL)
return OPERATOR_CANCELLED;
/* two markers can't be at the same place */
/* prefer not having 2 markers at the same place,
* though the user can move them to overlap once added */
for (marker= markers->first; marker; marker= marker->next) {
if (marker->frame == frame)
return OPERATOR_CANCELLED;

@ -3389,8 +3389,12 @@ static int convertspline(short type, Nurb *nu)
nu->orderu= 4;
nu->orderv= 1;
nu->type = type;
#if 0 /* UNUSED */
if(nu->flagu & CU_NURB_CYCLIC) c= nu->orderu-1;
else c= 0;
#endif
if(type== CU_NURBS) {
nu->flagu &= CU_NURB_CYCLIC; /* disable all flags except for cyclic */
nu->flagu |= CU_NURB_BEZIER;

@ -1117,14 +1117,6 @@ static int gp_session_initdata (bContext *C, tGPsdata *p)
p->custom_color[1]= 0.0f;
p->custom_color[2]= 0.5f;
p->custom_color[3]= 0.9f;
/* check that gpencil data is allowed to be drawn */
if ((sc->flag & SC_SHOW_GPENCIL)==0) {
p->status= GP_STATUS_ERROR;
if (G.f & G_DEBUG)
printf("Error: In active view, Grease Pencil not shown \n");
return 0;
}
}
break;

@ -5859,15 +5859,17 @@ static int ui_handle_list_event(bContext *C, wmEvent *event, ARegion *ar)
retval= WM_UI_HANDLER_BREAK;
}
else if(ELEM(event->type, WHEELUPMOUSE, WHEELDOWNMOUSE)) {
/* list template will clamp */
if(event->type == WHEELUPMOUSE)
pa->list_scroll--;
else
pa->list_scroll++;
if(pa->list_last_len > pa->list_size) {
/* list template will clamp */
if(event->type == WHEELUPMOUSE)
pa->list_scroll--;
else
pa->list_scroll++;
ED_region_tag_redraw(ar);
ED_region_tag_redraw(ar);
retval= WM_UI_HANDLER_BREAK;
retval= WM_UI_HANDLER_BREAK;
}
}
}

@ -103,7 +103,8 @@ static int eyedropper_cancel(bContext *C, wmOperator *op)
static void eyedropper_sample(bContext *C, Eyedropper *eye, int mx, int my)
{
if(RNA_property_type(eye->prop) == PROP_FLOAT) {
const int color_manage = CTX_data_scene(C)->r.color_mgt_flag & R_COLOR_MANAGEMENT;
Scene *scene = CTX_data_scene(C);
const int color_manage = scene->r.color_mgt_flag & R_COLOR_MANAGEMENT;
float col[4];
RNA_property_float_get_array(&eye->ptr, eye->prop, col);

@ -594,9 +594,9 @@ static void ui_theme_init_new(bTheme *btheme)
/* initialize default theme
Note: when you add new colors, created & saved themes need initialized
use function below, init_userdef_do_versions()
*/
* Note: when you add new colors, created & saved themes need initialized
* use function below, init_userdef_do_versions()
*/
void ui_theme_init_default(void)
{
bTheme *btheme;
@ -617,7 +617,9 @@ void ui_theme_init_default(void)
/* UI buttons */
ui_widget_color_init(&btheme->tui);
btheme->tui.iconfile[0]= 0;
btheme->tui.panel.show_header = FALSE;
SETCOL(btheme->tui.panel.header, 0, 0, 0, 25);
/* Bone Color Sets */
ui_theme_init_boneColorSets(btheme);

@ -1036,6 +1036,7 @@ static void make_prim(Object *obedit, int type, float mat[4][4], int tot, int se
float phi, phid, vec[3];
float q[4], cmat[3][3], nor[3]= {0.0, 0.0, 0.0};
short a, b;
float len, len2, vec2[3];
EM_clear_flag_all(em, SELECT);
@ -1117,7 +1118,19 @@ static void make_prim(Object *obedit, int type, float mat[4][4], int tot, int se
rotateflag(em, 2, v1->co, cmat);
}
removedoublesflag(em, 4, 0, 0.0001);
/* length of one segment on meridian */
len= 2*dia*sinf(phid / 2.0f);
/* length of one segment in shortest parallen */
vec[0]= dia*sinf(phid);
vec[1]= 0.0;
vec[2]= dia*cosf(phid);
mul_v3_m3v3(vec2, cmat, vec);
len2= len_v3v3(vec, vec2);
/* use shortest segment length divided by 3 as merge threshold */
removedoublesflag(em, 4, 0, MIN2(len, len2) / 3.0f);
/* and now do imat */
eve= em->verts.first;

@ -2482,6 +2482,8 @@ static void linked_limit_default(bContext *C, wmOperator *op)
EditMesh *em= BKE_mesh_get_editmesh(obedit->data);
if(em->selectmode == SCE_SELECT_FACE)
RNA_boolean_set(op->ptr, "limit", TRUE);
else
RNA_boolean_set(op->ptr, "limit", FALSE);
}
}

@ -380,8 +380,16 @@ static int ringsel_invoke (bContext *C, wmOperator *op, wmEvent *evt)
lcd = op->customdata;
if (lcd->em->selectmode == SCE_SELECT_FACE) {
PointerRNA props_ptr;
int extend = RNA_boolean_get(op->ptr, "extend");
ringsel_exit(op);
WM_operator_name_call(C, "MESH_OT_loop_select", WM_OP_INVOKE_REGION_WIN, NULL);
WM_operator_properties_create(&props_ptr, "MESH_OT_loop_select");
RNA_boolean_set(&props_ptr, "extend", extend);
WM_operator_name_call(C, "MESH_OT_loop_select", WM_OP_INVOKE_REGION_WIN, &props_ptr);
WM_operator_properties_free(&props_ptr);
return OPERATOR_CANCELLED;
}

@ -36,6 +36,7 @@
#include "ED_mball.h"
#include "ED_screen.h"
#include "ED_object.h"
#include "BLI_utildefines.h"
@ -77,5 +78,7 @@ void ED_keymap_metaball(wmKeyConfig *keyconf)
RNA_enum_set(kmi->ptr, "action", SEL_TOGGLE);
kmi = WM_keymap_add_item(keymap, "MBALL_OT_select_all", IKEY, KM_PRESS, KM_CTRL, 0);
RNA_enum_set(kmi->ptr, "action", SEL_INVERT);
ED_object_generic_keymap(keyconf, keymap, 3);
}

@ -586,7 +586,7 @@ static void draw_marker_areas(SpaceClip *sc, MovieTrackingTrack *track, MovieTra
}
/* pyramid */
if(sel && TRACK_SELECTED(track) && (sc->flag&SC_SHOW_PYRAMID_LEVELS) && (track->tracker==TRACKER_KLT) && (marker->flag&MARKER_DISABLED)==0) {
if(sel && TRACK_SELECTED(track) && (track->tracker==TRACKER_KLT) && (marker->flag&MARKER_DISABLED)==0) {
if(track->flag&TRACK_LOCKED) {
if(act) UI_ThemeColor(TH_ACT_MARKER);
else if(track->pat_flag&SELECT) UI_ThemeColorShade(TH_LOCK_MARKER, 64);
@ -1178,6 +1178,11 @@ static void draw_distortion(SpaceClip *sc, ARegion *ar, MovieClip *clip, int wid
while(layer) {
bGPDframe *frame= layer->frames.first;
if(layer->flag & GP_LAYER_HIDE) {
layer= layer->next;
continue;
}
glColor4fv(layer->color);
glLineWidth(layer->thickness);
glPointSize((float)(layer->thickness + 2));
@ -1307,7 +1312,7 @@ void clip_draw_grease_pencil(bContext *C, int onlyv2d)
MovieClip *clip= ED_space_clip(sc);
ImBuf *ibuf;
if((sc->flag&SC_SHOW_GPENCIL)==0 || !clip)
if(!clip)
return;
if(onlyv2d) {

@ -157,7 +157,7 @@ static SpaceLink *clip_new(const bContext *C)
sc= MEM_callocN(sizeof(SpaceClip), "initclip");
sc->spacetype= SPACE_CLIP;
sc->flag= SC_SHOW_MARKER_PATTERN|SC_SHOW_TRACK_PATH|SC_SHOW_GPENCIL|SC_MANUAL_CALIBRATION|SC_SHOW_GRAPH_TRACKS|SC_SHOW_GRAPH_FRAMES;
sc->flag= SC_SHOW_MARKER_PATTERN|SC_SHOW_TRACK_PATH|SC_MANUAL_CALIBRATION|SC_SHOW_GRAPH_TRACKS|SC_SHOW_GRAPH_FRAMES;
sc->zoom= 1.0f;
sc->path_length= 20;
sc->scopes.track_preview_height= 120;
@ -530,6 +530,12 @@ static void clip_keymap(struct wmKeyConfig *keyconf)
kmi= WM_keymap_add_item(keymap, "WM_OT_context_toggle", LKEY, KM_PRESS, 0, 0);
RNA_string_set(kmi->ptr, "data_path", "space_data.lock_selection");
kmi= WM_keymap_add_item(keymap, "WM_OT_context_toggle", DKEY, KM_PRESS, KM_ALT, 0);
RNA_string_set(kmi->ptr, "data_path", "space_data.show_disabled");
kmi= WM_keymap_add_item(keymap, "WM_OT_context_toggle", SKEY, KM_PRESS, KM_ALT, 0);
RNA_string_set(kmi->ptr, "data_path", "space_data.show_marker_search");
kmi= WM_keymap_add_item(keymap, "WM_OT_context_toggle", MKEY, KM_PRESS, 0, 0);
RNA_string_set(kmi->ptr, "data_path", "space_data.use_mute_footage");
@ -587,6 +593,7 @@ static void clip_refresh(const bContext *C, ScrArea *sa)
{
wmWindowManager *wm= CTX_wm_manager(C);
wmWindow *window= CTX_wm_window(C);
Scene *scene = CTX_data_scene(C);
SpaceClip *sc= (SpaceClip *)sa->spacedata.first;
ARegion *ar_main= BKE_area_find_region_type(sa, RGN_TYPE_WINDOW);
ARegion *ar_preview= clip_has_preview_region(C, sa);
@ -628,7 +635,7 @@ static void clip_refresh(const bContext *C, ScrArea *sa)
ED_area_tag_redraw(sa);
}
BKE_movieclip_user_set_frame(&sc->user, CTX_data_scene(C)->r.cfra);
BKE_movieclip_user_set_frame(&sc->user, scene->r.cfra);
}
/********************* main region ********************/

@ -594,7 +594,7 @@ static int image_view_selected_exec(bContext *C, wmOperator *UNUSED(op))
/* retrieve state */
sima= CTX_wm_space_image(C);
ar= CTX_wm_region(C);
scene= (Scene*)CTX_data_scene(C);
scene= CTX_data_scene(C);
obedit= CTX_data_edit_object(C);
ima= ED_space_image(sima);
@ -1445,7 +1445,7 @@ static int image_new_exec(bContext *C, wmOperator *op)
/* retrieve state */
sima= CTX_wm_space_image(C);
scene= (Scene*)CTX_data_scene(C);
scene= CTX_data_scene(C);
obedit= CTX_data_edit_object(C);
RNA_string_get(op->ptr, "name", name);

@ -581,7 +581,7 @@ static void image_refresh(const bContext *C, ScrArea *UNUSED(sa))
ima= ED_space_image(sima);
if(sima->iuser.flag & IMA_ANIM_ALWAYS)
BKE_image_user_calc_frame(&sima->iuser, CTX_data_scene(C)->r.cfra, 0);
BKE_image_user_calc_frame(&sima->iuser, scene->r.cfra, 0);
/* check if we have to set the image from the editmesh */
if(ima && (ima->source==IMA_SRC_VIEWER || sima->pin));

@ -1341,9 +1341,10 @@ typedef struct ImageSampleInfo {
static void sample_draw(const bContext *C, ARegion *ar, void *arg_info)
{
Scene *scene = CTX_data_scene(C);
ImageSampleInfo *info= arg_info;
ED_image_draw_info(ar, (CTX_data_scene(C)->r.color_mgt_flag & R_COLOR_MANAGEMENT), info->channels,
ED_image_draw_info(ar, (scene->r.color_mgt_flag & R_COLOR_MANAGEMENT), info->channels,
info->x, info->y, info->col, info->colf,
NULL, NULL /* zbuf - unused for nodes */
);

@ -325,20 +325,22 @@ static int sequencer_add_generic_strip_exec(bContext *C, wmOperator *op, SeqLoad
RNA_string_get(&itemptr, "name", file_only);
BLI_join_dirfile(seq_load.path, sizeof(seq_load.path), dir_only, file_only);
seq= seq_load_func(C, ed->seqbasep, &seq_load);
if(overlap == FALSE) {
if(seq_test_overlap(ed->seqbasep, seq)) shuffle_seq(ed->seqbasep, seq, scene);
seq = seq_load_func(C, ed->seqbasep, &seq_load);
if (seq) {
if(overlap == FALSE) {
if(seq_test_overlap(ed->seqbasep, seq)) shuffle_seq(ed->seqbasep, seq, scene);
}
}
}
RNA_END;
}
else {
/* single file */
seq= seq_load_func(C, ed->seqbasep, &seq_load);
if(overlap == FALSE) {
if(seq_test_overlap(ed->seqbasep, seq)) shuffle_seq(ed->seqbasep, seq, scene);
seq = seq_load_func(C, ed->seqbasep, &seq_load);
if (seq) {
if(overlap == FALSE) {
if(seq_test_overlap(ed->seqbasep, seq)) shuffle_seq(ed->seqbasep, seq, scene);
}
}
}
@ -711,7 +713,8 @@ static int sequencer_add_effect_strip_invoke(bContext *C, wmOperator *op, wmEven
if (is_type_set && type==SEQ_PLUGIN) {
/* only plugins need the file selector */
return WM_operator_filesel(C, op, event);
WM_event_add_fileselect(C, op);
return OPERATOR_RUNNING_MODAL;
}
else {
return sequencer_add_effect_strip_exec(C, op);

@ -1269,7 +1269,7 @@ static void do_view3d_region_buttons(bContext *C, void *UNUSED(index), int event
}
/* default for now */
WM_event_add_notifier(C, NC_SPACE|ND_SPACE_VIEW3D, ob);
WM_event_add_notifier(C, NC_SPACE|ND_SPACE_VIEW3D, v3d);
}
static void view3d_panel_object(const bContext *C, Panel *pa)

@ -3805,8 +3805,8 @@ static void SeqTransInfo(TransInfo *t, Sequence *seq, int *recursive, int *count
Scene * scene= t->scene;
int cfra= CFRA;
int left= seq_tx_get_final_left(seq, 0);
int right= seq_tx_get_final_right(seq, 0);
int left= seq_tx_get_final_left(seq, 1);
int right= seq_tx_get_final_right(seq, 1);
if (seq->depth == 0 && ((seq->flag & SELECT) == 0 || (seq->flag & SEQ_LOCK))) {
*recursive= 0;
@ -3906,7 +3906,7 @@ static void SeqTransInfo(TransInfo *t, Sequence *seq, int *recursive, int *count
static int SeqTransCount(TransInfo *t, ListBase *seqbase, int depth)
static int SeqTransCount(TransInfo *t, Sequence *parent, ListBase *seqbase, int depth)
{
Sequence *seq;
int tot= 0, recursive, count, flag;
@ -3914,11 +3914,15 @@ static int SeqTransCount(TransInfo *t, ListBase *seqbase, int depth)
for (seq= seqbase->first; seq; seq= seq->next) {
seq->depth= depth;
/* seq->tmp is used by seq_tx_get_final_{left,right} to check sequence's range and clamp to it if needed.
* it's first place where digging into sequences tree, so store link to parent here */
seq->tmp = parent;
SeqTransInfo(t, seq, &recursive, &count, &flag); /* ignore the flag */
tot += count;
if (recursive) {
tot += SeqTransCount(t, &seq->seqbase, depth+1);
tot += SeqTransCount(t, seq, &seq->seqbase, depth+1);
}
}
@ -4216,7 +4220,7 @@ static void createTransSeqData(bContext *C, TransInfo *t)
}
#endif
count = SeqTransCount(t, ed->seqbasep, 0);
count = SeqTransCount(t, NULL, ed->seqbasep, 0);
/* allocate memory for data */
t->total= count;

Some files were not shown because too many files have changed in this diff Show More