Merging r48264 through r48276 from trunk into soc-2011-tomato

This commit is contained in:
Sergey Sharybin
2012-06-25 16:37:58 +00:00
15 changed files with 147 additions and 36 deletions

View File

@@ -14,7 +14,7 @@ sources.remove(path.join('kernel', 'kernel_optimized.cpp'))
incs = []
defs = []
cxxflags = []
cxxflags = Split(env['CXXFLAGS'])
defs.append('CCL_NAMESPACE_BEGIN=namespace ccl {')
defs.append('CCL_NAMESPACE_END=}')
@@ -58,9 +58,9 @@ if env['WITH_BF_RAYOPTIMIZATION']:
optim_sources = [path.join('kernel', 'kernel_optimized.cpp')]
cycles_optim = cycles.Clone()
cycles_optim.BlenderLib('bf_intern_cycles_optimized', optim_sources, incs, optim_defs, libtype=['intern'], priority=[10], compileflags=[None], cxx_compileflags=optim_cxxflags)
cycles_optim.BlenderLib('bf_intern_cycles_optimized', optim_sources, incs, optim_defs, libtype=['intern'], priority=[10], cxx_compileflags=optim_cxxflags)
cycles.BlenderLib('bf_intern_cycles', sources, incs, defs, libtype=['intern'], priority=[0], compileflags=[None], cxx_compileflags=cxxflags)
cycles.BlenderLib('bf_intern_cycles', sources, incs, defs, libtype=['intern'], priority=[0], cxx_compileflags=cxxflags)
# cuda kernel binaries
if env['WITH_BF_CYCLES_CUDA_BINARIES']:

View File

@@ -305,7 +305,7 @@ void BlenderSync::sync_objects(BL::SpaceView3D b_v3d, int motion)
for(; b_sce; b_sce = b_sce.background_set()) {
for(b_sce.objects.begin(b_ob); b_ob != b_sce.objects.end(); ++b_ob) {
bool hide = (render_layer.use_viewport_visibility)? b_ob->hide(): b_ob->hide_render();
uint ob_layer = get_layer(b_ob->layers());
uint ob_layer = get_layer(b_ob->layers(), b_ob->layers_local_view(), object_is_light(*b_ob));
hide = hide || !(ob_layer & scene_layer);
if(!hide) {

View File

@@ -219,7 +219,7 @@ void BlenderSync::sync_render_layers(BL::SpaceView3D b_v3d, const char *layer)
layer = layername.c_str();
}
else {
render_layer.scene_layer = get_layer(b_v3d.layers());
render_layer.scene_layer = get_layer(b_v3d.layers(), b_v3d.layers_local_view());
render_layer.layer = render_layer.scene_layer;
render_layer.holdout_layer = 0;
render_layer.material_override = PointerRNA_NULL;

View File

@@ -166,6 +166,28 @@ static inline uint get_layer(BL::Array<int, 20> array)
return layer;
}
static inline uint get_layer(BL::Array<int, 20> array, BL::Array<int, 8> local_array, bool is_light = false)
{
uint layer = 0;
for(uint i = 0; i < 20; i++)
if(array[i])
layer |= (1 << i);
if(is_light) {
/* consider lamps on all local view layers */
for(uint i = 0; i < 8; i++)
layer |= (1 << (20+i));
}
else {
for(uint i = 0; i < 8; i++)
if(local_array[i])
layer |= (1 << (20+i));
}
return layer;
}
#if 0
static inline float3 get_float3(PointerRNA& ptr, const char *name)
{

View File

@@ -191,7 +191,7 @@ __device int triangle_find_attribute(KernelGlobals *kg, ShaderData *sd, uint id)
attr_map = kernel_tex_fetch(__attributes_map, ++attr_offset);
/* return result */
return (attr_map.y == ATTR_ELEMENT_NONE)? ATTR_STD_NOT_FOUND: attr_map.z;
return (attr_map.y == ATTR_ELEMENT_NONE) ? (int)ATTR_STD_NOT_FOUND : attr_map.z;
}
__device float4 triangle_motion_vector(KernelGlobals *kg, ShaderData *sd)

View File

@@ -176,13 +176,15 @@ public: \
return MEM_mallocN(num_bytes, _id); \
} \
void operator delete(void *mem) { \
MEM_freeN(mem); \
if (mem) \
MEM_freeN(mem); \
} \
void *operator new[](size_t num_bytes) { \
return MEM_mallocN(num_bytes, _id "[]"); \
} \
void operator delete[](void *mem) { \
MEM_freeN(mem); \
if (mem) \
MEM_freeN(mem); \
} \
#endif

View File

@@ -2551,7 +2551,8 @@ static struct libmv_Tracks *libmv_tracks_new(ListBase *tracksbase, int width, in
if ((marker->flag & MARKER_DISABLED) == 0) {
libmv_tracksInsert(tracks, marker->framenr, tracknr,
marker->pos[0] * width, marker->pos[1] * height);
(marker->pos[0] + track->offset[0]) * width,
(marker->pos[1] + track->offset[1]) * height);
}
}

View File

@@ -33,11 +33,12 @@ extern "C" {
#include "COM_WorkScheduler.h"
#include "OCL_opencl.h"
static ThreadMutex compositorMutex = {{0}};
static ThreadMutex compositorMutex;
static char is_compositorMutex_init = FALSE;
void COM_execute(RenderData *rd, bNodeTree *editingtree, int rendering)
{
if (is_compositorMutex_init == FALSE) { /// TODO: move to blender startup phase
memset(&compositorMutex, 0, sizeof(compositorMutex));
BLI_mutex_init(&compositorMutex);
OCL_init();
WorkScheduler::initialize(); ///TODO: call workscheduler.deinitialize somewhere

View File

@@ -101,7 +101,14 @@ KeyingScreenOperation::TriangulationData *KeyingScreenOperation::buildVoronoiTri
else
tracksbase = BKE_tracking_get_active_tracks(tracking);
sites_total = BLI_countlist(tracksbase);
/* count sites */
for (track = (MovieTrackingTrack *) tracksbase->first, sites_total = 0; track; track = track->next) {
MovieTrackingMarker *marker = BKE_tracking_marker_get(track, clip_frame);
if ((marker->flag & MARKER_DISABLED) == 0) {
sites_total++;
}
}
if (!sites_total)
return NULL;
@@ -117,11 +124,17 @@ KeyingScreenOperation::TriangulationData *KeyingScreenOperation::buildVoronoiTri
sites = (VoronoiSite *) MEM_callocN(sizeof(VoronoiSite) * sites_total, "keyingscreen voronoi sites");
track = (MovieTrackingTrack *) tracksbase->first;
for (track = (MovieTrackingTrack *) tracksbase->first, i = 0; track; track = track->next, i++) {
VoronoiSite *site = &sites[i];
MovieTrackingMarker *marker = BKE_tracking_marker_get(track, clip_frame);
ImBuf *pattern_ibuf = BKE_tracking_get_pattern_imbuf(ibuf, track, marker, TRUE, FALSE);
VoronoiSite *site;
ImBuf *pattern_ibuf;
int j;
if (marker->flag & MARKER_DISABLED)
continue;
site = &sites[i];
pattern_ibuf = BKE_tracking_get_pattern_imbuf(ibuf, track, marker, TRUE, FALSE);
zero_v3(site->color);
for (j = 0; j < pattern_ibuf->x * pattern_ibuf->y; j++) {
if (pattern_ibuf->rect_float) {

View File

@@ -58,7 +58,8 @@ void NormalizeOperation::deinitExecution()
bool NormalizeOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output)
{
rcti imageInput;
if (this->cachedInstance) return false;
NodeOperation *operation = getInputOperation(0);
imageInput.xmax = operation->getWidth();
imageInput.xmin = 0;
@@ -92,8 +93,12 @@ void *NormalizeOperation::initializeTileData(rcti *rect, MemoryBuffer **memoryBu
float value;
while (p--) {
value = bc[0];
maxv = max(value, maxv);
minv = min(value, minv);
if ((value > maxv) && (value <= BLENDER_ZMAX)) {
maxv = value;
}
if ((value < minv) && (value >= -BLENDER_ZMAX)) {
minv = value;
}
bc += 4;
}

View File

@@ -1001,12 +1001,13 @@ static void mouse_mesh_loop(bContext *C, int mval[2], short extend, short ring)
BMEdge *eed;
int select = TRUE;
int dist = 50;
float mvalf[2];
em_setup_viewcontext(C, &vc);
vc.mval[0] = mval[0];
vc.mval[1] = mval[1];
mvalf[0] = (float)(vc.mval[0] = mval[0]);
mvalf[1] = (float)(vc.mval[1] = mval[1]);
em = vc.em;
/* no afterqueue (yet), so we check it now, otherwise the bm_xxxofs indices are bad */
view3d_validate_backbuf(&vc);
@@ -1041,26 +1042,59 @@ static void mouse_mesh_loop(bContext *C, int mval[2], short extend, short ring)
}
EDBM_selectmode_flush(em);
// if (EM_texFaceCheck())
/* sets as active, useful for other tools */
#if 0
if (select) {
if (em->selectmode & SCE_SELECT_VERTEX) {
/* TODO: would be nice if the edge vertex chosen here
* was the one closer to the selection pointer, instead
* of arbitrarily selecting the first one */
BM_select_history_store(em->bm, eed->v1);
/* Find nearest vert from mouse. */
float v1_co[2], v2_co[2];
/* We can't be sure this has already been set... */
ED_view3d_init_mats_rv3d(vc.obedit, vc.rv3d);
project_float_noclip(vc.ar, eed->v1->co, v1_co);
project_float_noclip(vc.ar, eed->v2->co, v2_co);
#if 0
printf("mouse to v1: %f\nmouse to v2: %f\n", len_squared_v2v2(mvalf, v1_co),
len_squared_v2v2(mvalf, v2_co));
#endif
if (len_squared_v2v2(mvalf, v1_co) < len_squared_v2v2(mvalf, v2_co))
BM_select_history_store(em->bm, eed->v1);
else
BM_select_history_store(em->bm, eed->v2);
}
else if (em->selectmode & SCE_SELECT_EDGE) {
BM_select_history_store(em->bm, eed);
}
/* TODO: would be nice if the nearest face that
* belongs to the selected edge could be set to
* active here in face select mode */
else if (em->selectmode & SCE_SELECT_FACE) {
/* Select the face of eed which is the nearest of mouse. */
BMFace *f, *efa = NULL;
BMIter iterf;
float best_dist = MAXFLOAT;
/* We can't be sure this has already been set... */
ED_view3d_init_mats_rv3d(vc.obedit, vc.rv3d);
BM_ITER_ELEM(f, &iterf, eed, BM_FACES_OF_EDGE) {
if (BM_elem_flag_test(f, BM_ELEM_SELECT)) {
float cent[3];
float co[2], tdist;
BM_face_calc_center_mean(f, cent);
project_float_noclip(vc.ar, cent, co);
tdist = len_squared_v2v2(mvalf, co);
if (tdist < best_dist) {
/* printf("Best face: %p (%f)\n", f, tdist);*/
best_dist = tdist;
efa = f;
}
}
}
if (efa) {
BM_active_face_set(em->bm, efa);
BM_select_history_store(em->bm, efa);
}
}
}
#endif
mouse_mesh(C, mval, select, TRUE, FALSE);
WM_event_add_notifier(C, NC_GEOM | ND_SELECT, vc.obedit);
}

View File

@@ -2795,6 +2795,14 @@ static void draw_viewport_fps(Scene *scene, ARegion *ar)
static void view3d_main_area_draw_objects(const bContext *C, ARegion *ar, const char **grid_unit);
static int view3d_main_area_do_render_draw(const bContext *C)
{
Scene *scene = CTX_data_scene(C);
RenderEngineType *type = RE_engines_find(scene->r.engine);
return (type && type->view_update && type->view_draw);
}
static int view3d_main_area_draw_engine(const bContext *C, ARegion *ar, int draw_border)
{
Scene *scene = CTX_data_scene(C);
@@ -3131,7 +3139,7 @@ void view3d_main_area_draw(const bContext *C, ARegion *ar)
int draw_border = (rv3d->persp == RV3D_CAMOB && (scene->r.mode & R_BORDER));
/* draw viewport using opengl */
if (v3d->drawtype != OB_RENDER || draw_border) {
if (v3d->drawtype != OB_RENDER || !view3d_main_area_do_render_draw(C) || draw_border) {
view3d_main_area_draw_objects(C, ar, &grid_unit);
ED_region_pixelspace(ar);
}

View File

@@ -1564,13 +1564,15 @@ static void endlocalview(Main *bmain, Scene *scene, ScrArea *sa)
static int localview_exec(bContext *C, wmOperator *UNUSED(unused))
{
Main *bmain = CTX_data_main(C);
View3D *v3d = CTX_wm_view3d(C);
if (v3d->localvd)
endlocalview(CTX_data_main(C), CTX_data_scene(C), CTX_wm_area(C));
else
initlocalview(CTX_data_main(C), CTX_data_scene(C), CTX_wm_area(C));
DAG_id_type_tag(bmain, ID_OB);
ED_area_tag_redraw(CTX_wm_area(C));
return OPERATOR_FINISHED;

View File

@@ -174,6 +174,11 @@ static void rna_Object_matrix_world_update(Main *bmain, Scene *scene, PointerRNA
rna_Object_internal_update(bmain, scene, ptr);
}
static void rna_Object_hide_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *UNUSED(ptr))
{
DAG_id_type_tag(bmain, ID_OB);
}
static void rna_Object_matrix_local_get(PointerRNA *ptr, float values[16])
{
Object *ob = ptr->id.data;
@@ -1971,6 +1976,12 @@ static void rna_def_object(BlenderRNA *brna)
RNA_def_property_flag(prop, PROP_LIB_EXCEPTION);
RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_layer_update");
prop = RNA_def_property(srna, "layers_local_view", PROP_BOOLEAN, PROP_LAYER_MEMBER);
RNA_def_property_boolean_sdna(prop, NULL, "lay", 0x01000000);
RNA_def_property_array(prop, 8);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_ui_text(prop, "Local View Layers", "3D local view layers the object is on");
prop = RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", SELECT);
RNA_def_property_ui_text(prop, "Select", "Object selection state");
@@ -2308,7 +2319,7 @@ static void rna_def_object(BlenderRNA *brna)
RNA_def_property_boolean_sdna(prop, NULL, "restrictflag", OB_RESTRICT_VIEW);
RNA_def_property_ui_text(prop, "Restrict View", "Restrict visibility in the viewport");
RNA_def_property_ui_icon(prop, ICON_RESTRICT_VIEW_OFF, 1);
RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_hide_update");
prop = RNA_def_property(srna, "hide_select", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "restrictflag", OB_RESTRICT_SELECT);
@@ -2320,7 +2331,7 @@ static void rna_def_object(BlenderRNA *brna)
RNA_def_property_boolean_sdna(prop, NULL, "restrictflag", OB_RESTRICT_RENDER);
RNA_def_property_ui_text(prop, "Restrict Render", "Restrict renderability");
RNA_def_property_ui_icon(prop, ICON_RESTRICT_RENDER_OFF, 1);
RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_hide_update");
/* anim */
rna_def_animdata_common(srna);
@@ -2579,6 +2590,12 @@ static void rna_def_object_base(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Layers", "Layers the object base is on");
RNA_def_property_boolean_funcs(prop, NULL, "rna_Base_layer_set");
RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Base_layer_update");
prop = RNA_def_property(srna, "layers_local_view", PROP_BOOLEAN, PROP_LAYER_MEMBER);
RNA_def_property_boolean_sdna(prop, NULL, "lay", 0x01000000);
RNA_def_property_array(prop, 8);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_ui_text(prop, "Local View Layers", "3D local view layers the object base is on");
prop = RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", BA_SELECT);

View File

@@ -1699,6 +1699,12 @@ static void rna_def_space_view3d(BlenderRNA *brna)
RNA_def_property_boolean_funcs(prop, NULL, "rna_SpaceView3D_layer_set");
RNA_def_property_ui_text(prop, "Visible Layers", "Layers visible in this 3D View");
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, "rna_SpaceView3D_layer_update");
prop = RNA_def_property(srna, "layers_local_view", PROP_BOOLEAN, PROP_LAYER_MEMBER);
RNA_def_property_boolean_sdna(prop, NULL, "lay", 0x01000000);
RNA_def_property_array(prop, 8);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_ui_text(prop, "Local View Layers", "Local view layers visible in this 3D View");
prop = RNA_def_property(srna, "layers_used", PROP_BOOLEAN, PROP_LAYER_MEMBER);
RNA_def_property_boolean_sdna(prop, NULL, "lay_used", 1);