Merging r42461 through r42481 from trunk into soc-2011-tomato

This commit is contained in:
Sergey Sharybin 2011-12-07 09:24:45 +00:00
commit f354d44cba
14 changed files with 113 additions and 63 deletions

@ -157,7 +157,7 @@ def validate_arguments(args, bc):
'WITH_BF_JEMALLOC', 'WITH_BF_STATICJEMALLOC', 'BF_JEMALLOC', 'BF_JEMALLOC_INC', 'BF_JEMALLOC_LIBPATH', 'BF_JEMALLOC_LIB', 'BF_JEMALLOC_LIB_STATIC',
'BUILDBOT_BRANCH',
'WITH_BF_3DMOUSE', 'WITH_BF_STATIC3DMOUSE', 'BF_3DMOUSE', 'BF_3DMOUSE_INC', 'BF_3DMOUSE_LIB', 'BF_3DMOUSE_LIBPATH', 'BF_3DMOUSE_LIB_STATIC',
'WITH_BF_CYCLES', 'WITH_BF_CYCLES_CUDA_BINARIES' 'BF_CYCLES_CUDA_NVCC', 'BF_CYCLES_CUDA_NVCC',
'WITH_BF_CYCLES', 'WITH_BF_CYCLES_CUDA_BINARIES' 'BF_CYCLES_CUDA_NVCC', 'BF_CYCLES_CUDA_NVCC', 'WITH_BF_CYCLES_CUDA_THREADED_COMPILE',
'WITH_BF_OIIO', 'WITH_BF_STATICOIIO', 'BF_OIIO', 'BF_OIIO_INC', 'BF_OIIO_LIB', 'BF_OIIO_LIB_STATIC', 'BF_OIIO_LIBPATH',
'WITH_BF_BOOST', 'WITH_BF_STATICBOOST', 'BF_BOOST', 'BF_BOOST_INC', 'BF_BOOST_LIB', 'BF_BOOST_LIB_STATIC', 'BF_BOOST_LIBPATH'
]
@ -545,6 +545,7 @@ def read_opts(env, cfg, args):
localopts.AddVariables(
(BoolVariable('WITH_BF_CYCLES', 'Build with the Cycles engine', True)),
(BoolVariable('WITH_BF_CYCLES_CUDA_BINARIES', 'Build with precompiled CUDA binaries', False)),
(BoolVariable('WITH_BF_CYCLES_CUDA_THREADED_COMPILE', 'Build several render kernels at once (using BF_NUMJOBS)', False)),
('BF_CYCLES_CUDA_NVCC', 'CUDA nvcc compiler path', ''),
('BF_CYCLES_CUDA_BINARIES_ARCH', 'CUDA architectures to compile binaries for', []),

@ -129,7 +129,7 @@ include_directories(${INC})
add_library(cycles_kernel ${SRC} ${SRC_HEADERS} ${SRC_SVM_HEADERS})
if(WITH_CYCLES_OPTIMIZED_KERNEL)
SET_SOURCE_FILES_PROPERTIES(kernel_optimized.cpp PROPERTIES COMPILE_FLAGS ${CYCLES_OPTIMIZED_KERNEL_FLAGS})
set_source_files_properties(kernel_optimized.cpp PROPERTIES COMPILE_FLAGS "${CYCLES_OPTIMIZED_KERNEL_FLAGS}")
endif()
if(WITH_CYCLES_CUDA)

@ -34,6 +34,7 @@ if env['WITH_BF_CYCLES_CUDA_BINARIES']:
# dependencies
dependencies = ['kernel.cu'] + kernel.Glob('*.h') + kernel.Glob('../util/*.h') + kernel.Glob('svm/*.h')
last_cubin_file = None
# add command for each cuda architecture
for arch in cuda_archs:
@ -45,6 +46,12 @@ if env['WITH_BF_CYCLES_CUDA_BINARIES']:
kernel.Depends(cubin_file, dependencies)
kernel_binaries.append(cubin_file)
if not env['WITH_BF_CYCLES_CUDA_THREADED_COMPILE']:
# trick to compile one kernel at a time to reduce memory usage
if last_cubin_file:
kernel.Depends(cubin_file, last_cubin_file)
last_cubin_file = cubin_file
Return('kernel_binaries')

@ -60,6 +60,7 @@
#include "BKE_texture.h"
#include "BKE_multires.h"
#include "BKE_armature.h"
#include "BKE_deform.h"
#ifdef WITH_GAMEENGINE
#include "BKE_navmesh_conversion.h"
@ -625,40 +626,49 @@ void weight_to_rgb(float r_rgb[3], const float weight)
r_rgb[1]= blend * (1.0f-((weight-0.75f)*4.0f));
r_rgb[2]= 0.0f;
}
else {
/* exceptional value, unclamped or nan,
* avoid uninitialized memory use */
r_rgb[0]= 1.0f;
r_rgb[1]= 0.0f;
r_rgb[2]= 1.0f;
}
}
/* draw_flag's for calc_weightpaint_vert_color */
enum {
CALC_WP_MULTIPAINT= (1<<0),
CALC_WP_AUTO_NORMALIZE= (1<<1),
CALC_WP_AUTO_NORMALIZE= (1<<1)
};
static void calc_weightpaint_vert_color(Object *ob, ColorBand *coba, int vert, unsigned char *col, char *dg_flags, int selected, int UNUSED(unselected), const int draw_flag)
{
Mesh *me = ob->data;
float colf[4], input = 0.0f;
int i;
float input = 0.0f;
int make_black= FALSE;
if (me->dvert) {
MDeformVert *dvert= &me->dvert[vert];
if ((selected > 1) && (draw_flag & CALC_WP_MULTIPAINT)) {
int was_a_nonzero= FALSE;
for (i=0; i<me->dvert[vert].totweight; i++) {
int i;
MDeformWeight *dw= dvert->dw;
for (i = dvert->totweight; i > 0; i--, dw++) {
/* in multipaint, get the average if auto normalize is inactive
* get the sum if it is active */
if(dg_flags[me->dvert[vert].dw[i].def_nr]) {
if(me->dvert[vert].dw[i].weight) {
input+= me->dvert[vert].dw[i].weight;
if (dg_flags[dw->def_nr]) {
if (dw->weight) {
input += dw->weight;
was_a_nonzero= TRUE;
}
}
}
/* make it black if the selected groups have no weight on a vertex */
if(was_a_nonzero == FALSE) {
if (was_a_nonzero == FALSE) {
make_black = TRUE;
}
else if ((draw_flag & CALC_WP_AUTO_NORMALIZE) == FALSE) {
@ -667,11 +677,7 @@ static void calc_weightpaint_vert_color(Object *ob, ColorBand *coba, int vert, u
}
else {
/* default, non tricky behavior */
for (i=0; i<me->dvert[vert].totweight; i++) {
if (me->dvert[vert].dw[i].def_nr==ob->actdef-1) {
input+=me->dvert[vert].dw[i].weight;
}
}
input= defvert_find_weight(dvert, ob->actdef-1);
}
}
@ -680,20 +686,23 @@ static void calc_weightpaint_vert_color(Object *ob, ColorBand *coba, int vert, u
col[2] = 0;
col[1] = 0;
col[0] = 255;
return;
}
else {
float colf[4];
CLAMP(input, 0.0f, 1.0f);
CLAMP(input, 0.0f, 1.0f);
colf[0]= colf[1]= colf[2]= -1;
if(coba)
do_colorband(coba, input, colf);
else
weight_to_rgb(colf, input);
col[3] = (unsigned char)(colf[0] * 255.0f);
col[2] = (unsigned char)(colf[1] * 255.0f);
col[1] = (unsigned char)(colf[2] * 255.0f);
col[0] = 255;
if(coba)
do_colorband(coba, input, colf);
else
weight_to_rgb(colf, input);
col[3] = (unsigned char)(colf[0] * 255.0f);
col[2] = (unsigned char)(colf[1] * 255.0f);
col[1] = (unsigned char)(colf[2] * 255.0f);
col[0] = 255;
}
}
static ColorBand *stored_cb= NULL;

@ -1581,7 +1581,7 @@ typedef struct WipeZone {
static void precalc_wipe_zone(WipeZone *wipezone, WipeVars *wipe, int xo, int yo)
{
wipezone->flip = (wipe->angle < 0);
wipezone->angle = pow(fabsf(wipe->angle)/45.0f, log(xo)/M_LN2);
wipezone->angle = tan(DEG2RAD(fabsf(wipe->angle)));
wipezone->xo = xo;
wipezone->yo = yo;
wipezone->width = (int)(wipe->edgeWidth*((xo+yo)/2.0f));

@ -1232,7 +1232,7 @@ int BKE_tracking_next(MovieTrackingContext *context)
if(marker && (marker->flag&MARKER_DISABLED)==0) {
#ifdef WITH_LIBMV
int width, height, origin[2], tracked= 0, need_readjust= 0;
float pos[2], margin[2];
float pos[2], margin[2], dim[2];
double x1, y1, x2, y2;
ImBuf *ibuf= NULL;
MovieTrackingMarker marker_new, *marker_keyed;
@ -1248,7 +1248,8 @@ int BKE_tracking_next(MovieTrackingContext *context)
else nextfra= curfra+1;
/* margin from frame boundaries */
sub_v2_v2v2(margin, track->pat_max, track->pat_min);
sub_v2_v2v2(dim, track->pat_max, track->pat_min);
margin[0]= margin[1]= MAX2(dim[0], dim[1]) / 2.0f;
margin[0]= MAX2(margin[0], (float)track->margin / ibuf_new->x);
margin[1]= MAX2(margin[1], (float)track->margin / ibuf_new->y);
@ -1361,7 +1362,7 @@ int BKE_tracking_next(MovieTrackingContext *context)
{
/* check if there's no keyframe/tracked markers before tracking marker.
if so -- create disabled marker before currently tracking "segment" */
put_disabled_marker(track, marker, 1, 0);
put_disabled_marker(track, marker, !context->backwards, 0);
}
}
@ -1385,7 +1386,7 @@ int BKE_tracking_next(MovieTrackingContext *context)
/* make currently tracked segment be finished with disabled marker */
#pragma omp critical
{
put_disabled_marker(track, &marker_new, 0, 0);
put_disabled_marker(track, &marker_new, context->backwards, 0);
}
} else {
marker_new= *marker;

@ -1575,7 +1575,7 @@ void MESH_OT_separate(wmOperatorType *ot)
ot->poll= ED_operator_editmesh;
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
ot->flag= OPTYPE_UNDO;
ot->prop= RNA_def_enum(ot->srna, "type", prop_separate_types, 0, "Type", "");
}

@ -1608,21 +1608,37 @@ void ED_vgroup_mirror(Object *ob, const short mirror_weights, const short flip_v
sel, sel_mirr, \
flip_map, flip_map_len, \
mirror_weights, flip_vgroups, \
all_vgroups, act_vgroup \
all_vgroups, def_nr \
)
EditVert *eve, *eve_mirr;
MDeformVert *dvert, *dvert_mirr;
short sel, sel_mirr;
int *flip_map, flip_map_len;
const int act_vgroup= ob->actdef > 0 ? ob->actdef-1 : 0;
const int def_nr= ob->actdef-1;
if(mirror_weights==0 && flip_vgroups==0)
if ( (mirror_weights==0 && flip_vgroups==0) ||
(BLI_findlink(&ob->defbase, def_nr) == NULL) )
{
return;
}
flip_map= all_vgroups ?
defgroup_flip_map(ob, &flip_map_len, FALSE) :
defgroup_flip_map_single(ob, &flip_map_len, FALSE, act_vgroup);
if (flip_vgroups) {
flip_map= all_vgroups ?
defgroup_flip_map(ob, &flip_map_len, FALSE) :
defgroup_flip_map_single(ob, &flip_map_len, FALSE, def_nr);
BLI_assert(flip_map != NULL);
if (flip_map == NULL) {
/* something went wrong!, possibly no groups */
return;
}
}
else {
flip_map= NULL;
flip_map_len= 0;
}
/* only the active group */
if(ob->type == OB_MESH) {
@ -1631,8 +1647,7 @@ void ED_vgroup_mirror(Object *ob, const short mirror_weights, const short flip_v
if (em) {
if(!CustomData_has_layer(&em->vdata, CD_MDEFORMVERT)) {
MEM_freeN(flip_map);
return;
goto cleanup;
}
EM_cache_x_mirror_vert(ob, em);
@ -1654,7 +1669,6 @@ void ED_vgroup_mirror(Object *ob, const short mirror_weights, const short flip_v
eve->tmp.v= eve_mirr->tmp.v= NULL;
}
}
BKE_mesh_end_editmesh(me, em);
}
else {
@ -1664,8 +1678,7 @@ void ED_vgroup_mirror(Object *ob, const short mirror_weights, const short flip_v
const int use_vert_sel= (me->editflag & ME_EDIT_VERT_SEL) != 0;
if (me->dvert == NULL) {
MEM_freeN(flip_map);
return;
goto cleanup;
}
if (!use_vert_sel) {
@ -1712,8 +1725,7 @@ void ED_vgroup_mirror(Object *ob, const short mirror_weights, const short flip_v
if(lt->editlatt) lt= lt->editlatt->latt;
if(lt->pntsu == 1 || lt->dvert == NULL) {
MEM_freeN(flip_map);
return;
goto cleanup;
}
/* unlike editmesh we know that by only looping over the first hald of
@ -1749,9 +1761,11 @@ void ED_vgroup_mirror(Object *ob, const short mirror_weights, const short flip_v
}
}
MEM_freeN(flip_map);
cleanup:
if (flip_map) MEM_freeN(flip_map);
#undef VGROUP_MIRR_OP
}
static void vgroup_remap_update_users(Object *ob, int *map)
@ -2733,6 +2747,7 @@ static int set_active_group_exec(bContext *C, wmOperator *op)
int nr= RNA_enum_get(op->ptr, "group");
ob->actdef= nr+1;
BLI_assert(ob->actdef >= 0);
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
WM_event_add_notifier(C, NC_GEOM|ND_DATA, ob);
@ -2811,7 +2826,7 @@ static int vgroup_do_remap(Object *ob, char *name_array, wmOperator *op)
MDeformVert *dvert= NULL;
bDeformGroup *def;
int def_tot = BLI_countlist(&ob->defbase);
int *sort_map_update= MEM_mallocN(MAX_VGROUP_NAME * sizeof(int) * def_tot + 1, "sort vgroups"); /* needs a dummy index at the start*/
int *sort_map_update= MEM_mallocN(sizeof(int) * (def_tot + 1), "sort vgroups"); /* needs a dummy index at the start*/
int *sort_map= sort_map_update + 1;
char *name;
int i;
@ -2820,6 +2835,8 @@ static int vgroup_do_remap(Object *ob, char *name_array, wmOperator *op)
for(def= ob->defbase.first, i=0; def; def=def->next, i++){
sort_map[i]= BLI_findstringindex(&ob->defbase, name, offsetof(bDeformGroup, name));
name += MAX_VGROUP_NAME;
BLI_assert(sort_map[i] != -1);
}
if(ob->mode == OB_MODE_EDIT) {
@ -2861,6 +2878,7 @@ static int vgroup_do_remap(Object *ob, char *name_array, wmOperator *op)
vgroup_remap_update_users(ob, sort_map_update);
ob->actdef= sort_map_update[ob->actdef];
BLI_assert(ob->actdef >= 0);
MEM_freeN(sort_map_update);

@ -1022,6 +1022,7 @@ static int weight_sample_group_exec(bContext *C, wmOperator *op)
view3d_set_viewcontext(C, &vc);
vc.obact->actdef= type + 1;
BLI_assert(vc.obact->actdef >= 0);
DAG_id_tag_update(&vc.obact->id, OB_RECALC_DATA);
WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, vc.obact);
@ -1879,10 +1880,13 @@ static int wpaint_stroke_test_start(bContext *C, wmOperator *op, wmEvent *UNUSED
if(pchan) {
bDeformGroup *dg= defgroup_find_name(ob, pchan->name);
if(dg==NULL)
if(dg==NULL) {
dg= ED_vgroup_add_name(ob, pchan->name); /* sets actdef */
else
}
else {
ob->actdef= 1 + defgroup_find_index(ob, dg);
BLI_assert(ob->actdef >= 0);
}
}
}
}
@ -1954,7 +1958,7 @@ static void wpaint_stroke_update_step(bContext *C, struct PaintStroke *stroke, P
wpi.defbase_tot= wpd->defbase_tot;
wpi.defbase_sel= MEM_mallocN(wpi.defbase_tot*sizeof(char), "wpi.defbase_sel");
wpi.defbase_tot_sel= get_selected_defgroups(ob, wpi.defbase_sel, wpi.defbase_tot);
if(wpi.defbase_tot_sel == 0 && ob->actdef) wpi.defbase_tot_sel = 1;
if(wpi.defbase_tot_sel == 0 && ob->actdef > 0) wpi.defbase_tot_sel = 1;
wpi.defbase_tot_unsel= wpi.defbase_tot - wpi.defbase_tot_sel;
wpi.vgroup_mirror= wpd->vgroup_mirror;
wpi.lock_flags= wpd->lock_flags;

@ -605,15 +605,11 @@ static void node_draw_basis(const bContext *C, ARegion *ar, SpaceNode *snode, bN
iconofs= rct->xmax - 7.0f;
if(node->typeinfo->flag & NODE_PREVIEW) {
int icon_id;
float alpha = (node->flag & (NODE_ACTIVE_ID|NODE_DO_OUTPUT))? 1.0f: 0.5f;
if(node->flag & (NODE_ACTIVE_ID|NODE_DO_OUTPUT))
icon_id= ICON_MATERIAL;
else
icon_id= ICON_MATERIAL_DATA;
iconofs-=iconbutw;
uiDefIconBut(node->block, LABEL, B_REDR, icon_id, iconofs, rct->ymax-NODE_DY,
iconbutw, UI_UNIT_Y, NULL, 0.0, 0.0, 1.0, 0.5, "");
uiDefIconBut(node->block, LABEL, B_REDR, ICON_MATERIAL, iconofs, rct->ymax-NODE_DY,
iconbutw, UI_UNIT_Y, NULL, 0.0, 0.0, 1.0, alpha, "");
}
if(node->type == NODE_GROUP) {

@ -397,6 +397,8 @@ static int tree_element_active_defgroup(bContext *C, Scene *scene, TreeElement *
ob= (Object *)tselem->id;
if(set) {
ob->actdef= te->index+1;
BLI_assert(ob->actdef >= 0);
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
WM_event_add_notifier(C, NC_OBJECT|ND_TRANSFORM, ob);
}

@ -219,7 +219,7 @@ typedef struct Object {
ListBase controllers; /* game logic controllers */
ListBase actuators; /* game logic actuators */
float bbsize[3];
float bbsize[3] DNA_DEPRECATED;
short index; /* custom index, for renderpasses */
unsigned short actdef; /* current deformation group, note: index starts at 1 */
float col[4]; /* object color */

@ -365,6 +365,17 @@ static void rna_Node_update(Main *bmain, Scene *scene, PointerRNA *ptr)
node_update(bmain, scene, ntree, node);
}
static void rna_Node_material_update(Main *bmain, Scene *scene, PointerRNA *ptr)
{
bNodeTree *ntree= (bNodeTree*)ptr->id.data;
bNode *node= (bNode*)ptr->data;
if(node->id)
nodeSetActive(ntree, node);
node_update(bmain, scene, ntree, node);
}
static void rna_NodeGroup_update(Main *bmain, Scene *scene, PointerRNA *ptr)
{
bNodeTree *ntree= (bNodeTree*)ptr->id.data;
@ -1119,7 +1130,7 @@ static void def_sh_material(StructRNA *srna)
RNA_def_property_struct_type(prop, "Material");
RNA_def_property_flag(prop, PROP_EDITABLE);
RNA_def_property_ui_text(prop, "Material", "");
RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_material_update");
prop = RNA_def_property(srna, "use_diffuse", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "custom1", SH_NODE_MAT_DIFF);

@ -82,9 +82,10 @@ int bpy_pydriver_create_dict(void)
}
/* add noise to global namespace */
mod= PyImport_ImportModuleLevel((char *)"mathutils.noise", NULL, NULL, NULL, 0);
mod= PyImport_ImportModuleLevel((char *)"mathutils", NULL, NULL, NULL, 0);
if (mod) {
PyDict_SetItemString(bpy_pydriver_Dict, "noise", mod);
PyObject *modsub= PyDict_GetItemString(PyModule_GetDict(mod), "noise");
PyDict_SetItemString(bpy_pydriver_Dict, "noise", modsub);
Py_DECREF(mod);
}