svn merge ^/trunk/blender -r43976:43995

This commit is contained in:
Campbell Barton 2012-02-09 01:53:14 +00:00
commit ac4484b239
14 changed files with 1657 additions and 1758 deletions

@ -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):

@ -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);

@ -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'}

@ -750,6 +750,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"

@ -361,7 +361,22 @@ void bmesh_create_uvsphere_exec(BMesh *bm, BMOperator *op)
if (a)
BMO_Finish_Op(bm, &bmop);
BMO_CallOpf(bm, "removedoubles verts=%fv dist=%f", VERT_MARK, 0.001f);
{
float len, len2, vec2[3];
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 */
BMO_CallOpf(bm, "removedoubles verts=%fv dist=%f", VERT_MARK, MIN2(len, len2) / 3.0f);
}
/* and now do imat */
BM_ITER(eve, &iter, bm, BM_VERTS_OF_MESH, NULL) {

@ -1711,6 +1711,18 @@ void EDBM_select_swap(BMEditMesh *em) /* exported for UV */
// if (EM_texFaceCheck())
}
static void linked_limit_default(bContext *C, wmOperator *op)
{
if(!RNA_struct_property_is_set(op->ptr, "limit")) {
Object *obedit= CTX_data_edit_object(C);
BMEditMesh *em= ((Mesh *)obedit->data)->edit_btmesh;
if(em->selectmode == SCE_SELECT_FACE)
RNA_boolean_set(op->ptr, "limit", TRUE);
else
RNA_boolean_set(op->ptr, "limit", FALSE);
}
}
static int select_linked_pick_invoke(bContext *C, wmOperator *op, wmEvent *event)
{
Object *obedit= CTX_data_edit_object(C);
@ -1722,7 +1734,13 @@ static int select_linked_pick_invoke(bContext *C, wmOperator *op, wmEvent *event
BMEdge *e, *eed;
BMFace *efa;
int sel= !RNA_boolean_get(op->ptr, "deselect");
int limit;
linked_limit_default(C, op);
limit = RNA_boolean_get(op->ptr, "limit");
/* unified_finednearest needs ogl */
view3d_operator_needs_opengl(C);
@ -1739,12 +1757,6 @@ static int select_linked_pick_invoke(bContext *C, wmOperator *op, wmEvent *event
vc.mval[1]= event->mval[1];
/* return warning! */
/*if (limit) {
int retval= select_linked_limited_invoke(&vc, 0, sel);
WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit);
return retval;
}*/
if ( unified_findnearest(&vc, &eve, &eed, &efa)==0 ) {
WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit);
@ -1758,14 +1770,16 @@ static int select_linked_pick_invoke(bContext *C, wmOperator *op, wmEvent *event
if (efa == NULL)
return OPERATOR_CANCELLED;
BM_ITER(e, &iter, bm, BM_EDGES_OF_MESH, NULL) {
if (!BM_TestHFlag(e, BM_SEAM)) BMO_SetFlag(bm, e, BM_SELECT);
else BMO_ClearFlag(bm, e, BM_SELECT); /* is this needed ? */
if (limit) {
BM_ITER(e, &iter, bm, BM_EDGES_OF_MESH, NULL) {
if (!BM_TestHFlag(e, BM_SEAM)) BMO_SetFlag(bm, e, BM_SELECT);
else BMO_ClearFlag(bm, e, BM_SELECT); /* is this needed ? */
}
}
/* walk */
BMW_Init(&walker, bm, BMW_ISLAND,
BMW_MASK_NOP, BM_SELECT, BMW_MASK_NOP, BMW_MASK_NOP,
BMW_MASK_NOP, limit ? BM_SELECT : BMW_MASK_NOP, BMW_MASK_NOP, BMW_MASK_NOP,
BMW_NIL_LAY);
e = BMW_Begin(&walker, efa);
@ -1821,7 +1835,7 @@ void MESH_OT_select_linked_pick(wmOperatorType *ot)
}
static int select_linked_exec(bContext *C, wmOperator *UNUSED(op))
static int select_linked_exec(bContext *C, wmOperator *op)
{
Object *obedit= CTX_data_edit_object(C);
BMEditMesh *em= ((Mesh*)obedit->data)->edit_btmesh;
@ -1831,6 +1845,12 @@ static int select_linked_exec(bContext *C, wmOperator *UNUSED(op))
BMEdge *e;
BMWalker walker;
int limit;
linked_limit_default(C, op);
limit = RNA_boolean_get(op->ptr, "limit");
if (em->selectmode == SCE_SELECT_FACE) {
BMFace *efa;
@ -1843,13 +1863,15 @@ static int select_linked_exec(bContext *C, wmOperator *UNUSED(op))
}
}
BM_ITER(e, &iter, bm, BM_EDGES_OF_MESH, NULL) {
if (!BM_TestHFlag(e, BM_SEAM)) BMO_SetFlag(bm, e, BM_SELECT);
else BMO_ClearFlag(bm, e, BM_SELECT); /* is this needed ? */
if (limit) {
BM_ITER(e, &iter, bm, BM_EDGES_OF_MESH, NULL) {
if (!BM_TestHFlag(e, BM_SEAM)) BMO_SetFlag(bm, e, BM_SELECT);
else BMO_ClearFlag(bm, e, BM_SELECT); /* is this needed ? */
}
}
BMW_Init(&walker, bm, BMW_ISLAND,
BMW_MASK_NOP, BM_SELECT, BMW_MASK_NOP, BMW_MASK_NOP,
BMW_MASK_NOP, limit ? BM_SELECT : BMW_MASK_NOP, BMW_MASK_NOP, BMW_MASK_NOP,
BMW_NIL_LAY);
BM_ITER(efa, &iter, em->bm, BM_FACES_OF_MESH, NULL) {

@ -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));

@ -2077,8 +2077,15 @@ void node_tex_coord(vec3 I, vec3 N, mat4 toworld,
/* textures */
void node_tex_blend(vec3 co, out float fac)
void node_tex_gradient(vec3 co, out vec4 color, out float fac)
{
color = vec4(1.0);
fac = 1.0;
}
void node_tex_checker(vec3 co, vec4 color1, vec4 color2, float scale, out vec4 color, out float fac)
{
color = vec4(1.0);
fac = 1.0;
}
@ -2088,11 +2095,6 @@ void node_tex_clouds(vec3 co, float size, out vec4 color, out float fac)
fac = 1.0;
}
void node_tex_distnoise(vec3 co, float size, float distortion, out float fac)
{
fac = 1.0;
}
void node_tex_environment(vec3 co, sampler2D ima, out vec4 color)
{
float u = (atan(co.y, co.x) + M_PI)/(2.0*M_PI);
@ -2106,88 +2108,19 @@ void node_tex_image(vec3 co, sampler2D ima, out vec4 color)
color = texture2D(ima, co.xy);
}
void node_tex_magic(vec3 p, float turbulence, float n, out vec4 color)
{
float turb = turbulence/5.0;
float x = sin((p.x + p.y + p.z)*5.0);
float y = cos((-p.x + p.y - p.z)*5.0);
float z = -cos((-p.x - p.y + p.z)*5.0);
if(n > 0.0) {
x *= turb;
y *= turb;
z *= turb;
y = -cos(x-y+z);
y *= turb;
if(n > 1.0) {
x= cos(x-y-z);
x *= turb;
if(n > 2.0) {
z= sin(-x-y-z);
z *= turb;
if(n > 3.0) {
x= -cos(-x+y-z);
x *= turb;
if(n > 4.0) {
y= -sin(-x+y+z);
y *= turb;
if(n > 5.0) {
y= -cos(-x+y+z);
y *= turb;
if(n > 6.0) {
x= cos(x+y+z);
x *= turb;
if(n > 7.0) {
z= sin(x+y-z);
z *= turb;
if(n > 8.0) {
x= -cos(-x-y+z);
x *= turb;
if(n > 9.0) {
y= -sin(x-y+z);
y *= turb;
}
}
}
}
}
}
}
}
}
}
if(turb != 0.0) {
turb *= 2.0;
x /= turb;
y /= turb;
z /= turb;
}
color = vec4(0.5 - x, 0.5 - y, 0.5 - z, 1.0);
}
void node_tex_marble(vec3 co, float size, float turbulence, out float fac)
void node_tex_magic(vec3 p, float scale, float distortion, out vec4 color, out float fac)
{
color = vec4(1.0);
fac = 1.0;
}
void node_tex_musgrave(vec3 co, float size, float dimension, float lacunarity, float octaves, float offset, float gain, out float fac)
void node_tex_musgrave(vec3 co, float scale, float detail, float dimension, float lacunarity, float offset, float gain, out vec4 color, out float fac)
{
color = vec4(1.0);
fac = 1.0;
}
void node_tex_noise(vec3 co, out vec4 color, out float fac)
void node_tex_noise(vec3 co, float scale, float detail, float distortion, out vec4 color, out float fac)
{
color = vec4(1.0);
fac = 1.0;
@ -2198,19 +2131,15 @@ void node_tex_sky(vec3 co, out vec4 color)
color = vec4(1.0);
}
void node_tex_stucci(vec3 co, float size, float turbulence, out float fac)
{
fac = 1.0;
}
void node_tex_voronoi(vec3 co, float size, float weight1, float weight2, float weight3, float weight4, float exponent, out vec4 color, out float fac)
void node_tex_voronoi(vec3 co, float scale, out vec4 color, out float fac)
{
color = vec4(1.0);
fac = 1.0;
}
void node_tex_wood(vec3 co, float size, float turbulence, out float fac)
void node_tex_wave(vec3 co, float scale, float distortion, float detail, float detail_scale, out vec4 color, out float fac)
{
color = vec4(1.0);
fac = 1.0;
}

File diff suppressed because it is too large Load Diff

@ -1166,7 +1166,7 @@ PyDoc_STRVAR(Matrix_invert_doc,
"\n"
" Set the matrix to its inverse.\n"
"\n"
" .. note:: :exc:`ValueError` exception is raised.\n"
" .. note:: When the matrix cant be inverted a :exc:`ValueError` exception is raised.\n"
"\n"
" .. seealso:: <http://en.wikipedia.org/wiki/Inverse_matrix>\n"
);
@ -1240,7 +1240,7 @@ PyDoc_STRVAR(Matrix_inverted_doc,
" :return: the inverted matrix.\n"
" :rtype: :class:`Matrix`\n"
"\n"
" .. note:: :exc:`ValueError` exception is raised.\n"
" .. note:: When the matrix cant be inverted a :exc:`ValueError` exception is raised.\n"
);
static PyObject *Matrix_inverted(MatrixObject *self)
{

@ -720,7 +720,7 @@ PyDoc_STRVAR(M_Noise_voronoi_doc,
" :arg exponent: The exponent for Minkovsky distance metric.\n"
" :type exponent: float\n"
" :return: A list of distances to the four closest features and their locations.\n"
" :rtype: list of four floats, list of four :class:`mathutils.Vector`s\n"
" :rtype: list of four floats, list of four :class:`mathutils.Vector` types\n"
);
static PyObject *M_Noise_voronoi(PyObject *UNUSED(self), PyObject *args)
{