Merged revision(s) 58424-58448 from trunk/blender into soc-2013-dingto

Had to resolve manual conflict in addon/ui.py and blender/blender_sync.cpp due to Non-Progressive integrator, which is enabled in my branch.
This commit is contained in:
Thomas Dinges 2013-07-20 15:46:49 +00:00
commit 19b5fc17dc
41 changed files with 389 additions and 77 deletions

@ -347,10 +347,6 @@ void AUD_FFMPEGReader::seek(int position)
uint64_t st_time = m_formatCtx->start_time;
uint64_t seek_pos = ((uint64_t)position) * ((uint64_t)AV_TIME_BASE) / ((uint64_t)m_specs.rate);
if (seek_pos < 0) {
seek_pos = 0;
}
if (st_time != AV_NOPTS_VALUE) {
seek_pos += st_time;
}

@ -46,6 +46,36 @@ class AddPresetIntegrator(AddPresetBase, Operator):
preset_subdir = "cycles/integrator"
class AddPresetSampling(AddPresetBase, Operator):
'''Add a Sampling Preset'''
bl_idname = "render.cycles_sampling_preset_add"
bl_label = "Add Sampling Preset"
preset_menu = "CYCLES_MT_sampling_presets"
preset_defines = [
"cycles = bpy.context.scene.cycles"
]
preset_values = [
"cycles.samples",
"cycles.preview_samples",
"cycles.aa_samples",
"cycles.preview_aa_samples",
"cycles.diffuse_samples",
"cycles.glossy_samples",
"cycles.transmission_samples",
"cycles.ao_samples",
"cycles.mesh_light_samples",
"cycles.subsurface_samples",
"cycles.no_caustics",
"cycles.blur_glossy",
"cycles.squared_samples",
"cycles.progressive"
]
preset_subdir = "cycles/sampling"
def register():
pass

@ -150,6 +150,11 @@ class CyclesRenderSettings(bpy.types.PropertyGroup):
description="Use progressive sampling of lighting",
default=True,
)
cls.squared_samples = BoolProperty(
name="Squared Samples",
description="Square sampling values for easier artist control",
default=False,
)
cls.samples = IntProperty(
name="Samples",

@ -23,6 +23,14 @@ import bpy
from bpy.types import Panel, Menu, Operator
class CYCLES_MT_sampling_presets(Menu):
bl_label = "Sampling Presets"
preset_subdir = "cycles/sampling"
preset_operator = "script.execute_preset"
COMPAT_ENGINES = {'CYCLES'}
draw = Menu.draw_preset
class CYCLES_MT_integrator_presets(Menu):
bl_label = "Integrator Presets"
preset_subdir = "cycles/integrator"
@ -52,20 +60,28 @@ class CyclesRender_PT_sampling(CyclesButtonsPanel, Panel):
scene = context.scene
cscene = scene.cycles
device_type = context.user_preferences.system.compute_device_type
row = layout.row(align=True)
row.menu("CYCLES_MT_sampling_presets", text=bpy.types.CYCLES_MT_sampling_presets.bl_label)
row.operator("render.cycles_sampling_preset_add", text="", icon="ZOOMIN")
row.operator("render.cycles_sampling_preset_add", text="", icon="ZOOMOUT").remove_active = True
row = layout.row()
row.prop(cscene, "progressive")
row.prop(cscene, "squared_samples")
split = layout.split()
col = split.column()
col.prop(cscene, "progressive")
sub = col.column(align=True)
sub.label("Settings:")
sub.prop(cscene, "seed")
sub.prop(cscene, "sample_clamp")
if cscene.progressive:
col = split.column()
col.label(text="Samples:")
sub = col.column(align=True)
sub.label(text="Samples:")
sub.prop(cscene, "samples", text="Render")
sub.prop(cscene, "preview_samples", text="Preview")
else:
@ -74,8 +90,8 @@ class CyclesRender_PT_sampling(CyclesButtonsPanel, Panel):
sub.prop(cscene, "preview_aa_samples", text="Preview")
col = split.column()
col.label(text="Samples:")
sub = col.column(align=True)
sub.label(text="Samples:")
sub.prop(cscene, "diffuse_samples", text="Diffuse")
sub.prop(cscene, "glossy_samples", text="Glossy")
sub.prop(cscene, "transmission_samples", text="Transmission")

@ -154,10 +154,16 @@ void BlenderSync::sync_light(BL::Object b_parent, int persistent_id[OBJECT_PERSI
light->shader = used_shaders[0];
/* shadow */
PointerRNA cscene = RNA_pointer_get(&b_scene.ptr, "cycles");
PointerRNA clamp = RNA_pointer_get(&b_lamp.ptr, "cycles");
light->cast_shadow = get_boolean(clamp, "cast_shadow");
light->use_mis = get_boolean(clamp, "use_multiple_importance_sampling");
light->samples = get_int(clamp, "samples");
int samples = get_int(clamp, "samples");
if(get_boolean(cscene, "squared_samples"))
light->samples = samples * samples;
else
light->samples = samples;
/* visibility */
uint visibility = object_ray_visibility(b_ob);
@ -174,6 +180,7 @@ void BlenderSync::sync_background_light()
BL::World b_world = b_scene.world();
if(b_world) {
PointerRNA cscene = RNA_pointer_get(&b_scene.ptr, "cycles");
PointerRNA cworld = RNA_pointer_get(&b_world.ptr, "cycles");
bool sample_as_light = get_boolean(cworld, "sample_as_light");
@ -188,8 +195,13 @@ void BlenderSync::sync_background_light()
{
light->type = LIGHT_BACKGROUND;
light->map_resolution = get_int(cworld, "sample_map_resolution");
light->samples = get_int(cworld, "samples");
light->shader = scene->default_background;
int samples = get_int(cworld, "samples");
if(get_boolean(cscene, "squared_samples"))
light->samples = samples * samples;
else
light->samples = samples;
light->tag_update(scene);
light_map.set_recalc(b_world);

@ -191,14 +191,33 @@ void BlenderSync::sync_integrator()
}
#endif
integrator->diffuse_samples = get_int(cscene, "diffuse_samples");
integrator->glossy_samples = get_int(cscene, "glossy_samples");
integrator->transmission_samples = get_int(cscene, "transmission_samples");
integrator->ao_samples = get_int(cscene, "ao_samples");
integrator->mesh_light_samples = get_int(cscene, "mesh_light_samples");
integrator->subsurface_samples = get_int(cscene, "subsurface_samples");
integrator->progressive = get_boolean(cscene, "progressive");
int diffuse_samples = get_int(cscene, "diffuse_samples");
int glossy_samples = get_int(cscene, "glossy_samples");
int transmission_samples = get_int(cscene, "transmission_samples");
int ao_samples = get_int(cscene, "ao_samples");
int mesh_light_samples = get_int(cscene, "mesh_light_samples");
int subsurface_samples = get_int(cscene, "subsurface_samples");
if(get_boolean(cscene, "squared_samples")) {
integrator->diffuse_samples = diffuse_samples * diffuse_samples;
integrator->glossy_samples = glossy_samples * glossy_samples;
integrator->transmission_samples = transmission_samples * transmission_samples;
integrator->ao_samples = ao_samples * ao_samples;
integrator->mesh_light_samples = mesh_light_samples * mesh_light_samples;
integrator->subsurface_samples = subsurface_samples * subsurface_samples;
}
else {
integrator->diffuse_samples = diffuse_samples;
integrator->glossy_samples = glossy_samples;
integrator->transmission_samples = transmission_samples;
integrator->ao_samples = ao_samples;
integrator->mesh_light_samples = mesh_light_samples;
integrator->subsurface_samples = subsurface_samples;
}
if(experimental)
integrator->sampling_pattern = (SamplingPattern)RNA_enum_get(&cscene, "sampling_pattern");
@ -300,8 +319,13 @@ void BlenderSync::sync_render_layers(BL::SpaceView3D b_v3d, const char *layer)
render_layer.use_localview = false;
render_layer.bound_samples = (use_layer_samples == 1);
if(use_layer_samples != 2)
render_layer.samples = b_rlay->samples();
if(use_layer_samples != 2) {
int samples = b_rlay->samples();
if(get_boolean(cscene, "squared_samples"))
render_layer.samples = samples * samples;
else
render_layer.samples = samples;
}
}
first_layer = false;
@ -385,24 +409,36 @@ SessionParams BlenderSync::get_session_params(BL::RenderEngine b_engine, BL::Use
params.background = background;
/* samples */
int samples = get_int(cscene, "samples");
int aa_samples = get_int(cscene, "aa_samples");
int preview_samples = get_int(cscene, "preview_samples");
int preview_aa_samples = get_int(cscene, "preview_aa_samples");
if(get_boolean(cscene, "squared_samples")) {
samples = samples * samples;
aa_samples = aa_samples * aa_samples;
preview_samples = preview_samples * preview_samples;
preview_aa_samples = preview_aa_samples * preview_aa_samples;
}
if(get_boolean(cscene, "progressive") == 0) {
if(background) {
params.samples = get_int(cscene, "aa_samples");
params.samples = aa_samples;
}
else {
params.samples = get_int(cscene, "preview_aa_samples");
params.samples = preview_aa_samples;
if(params.samples == 0)
params.samples = 65536;
params.samples = USHRT_MAX;
}
}
else {
if(background) {
params.samples = get_int(cscene, "samples");
params.samples = samples;
}
else {
params.samples = get_int(cscene, "preview_samples");
params.samples = preview_samples;
if(params.samples == 0)
params.samples = 65536;
params.samples = USHRT_MAX;
}
}

@ -307,8 +307,7 @@ public:
void task_add(DeviceTask& task)
{
/* split task into smaller ones, more than number of threads for uneven
* workloads where some parts of the image render slower than others */
/* split task into smaller ones */
list<DeviceTask> tasks;
task.split(tasks, TaskScheduler::num_threads());

@ -786,7 +786,7 @@ void Session::update_status_time(bool show_pause, bool show_done)
substatus += string_printf(", Sample %d/%d", sample, num_samples);
}
}
else if(tile_manager.num_samples == 65536)
else if(tile_manager.num_samples == USHRT_MAX)
substatus = string_printf("Path Tracing Sample %d", sample+1);
else
substatus = string_printf("Path Tracing Sample %d/%d", sample+1, tile_manager.num_samples);

@ -186,12 +186,12 @@ void TaskScheduler::init(int num_threads)
do_exit = false;
if(num_threads == 0) {
/* automatic number of threads will be main thread + num cores */
/* automatic number of threads */
num_threads = system_cpu_thread_count();
}
else {
/* main thread will also work, for fixed threads we count it too */
num_threads -= 1;
/* manual number of threads */
num_threads;
}
/* launch threads that will be waiting for work */

@ -94,8 +94,8 @@ public:
static void init(int num_threads = 0);
static void exit();
/* number of threads that can work on tasks, main thread counts too */
static int num_threads() { return threads.size() + 1; }
/* number of threads that can work on task */
static int num_threads() { return threads.size(); }
/* test if any session is using the scheduler */
static bool active() { return users != 0; }

@ -0,0 +1,16 @@
import bpy
cycles = bpy.context.scene.cycles
cycles.squared_samples = True
cycles.samples = 24
cycles.preview_samples = 24
cycles.aa_samples = 8
cycles.preview_aa_samples = 8
cycles.diffuse_samples = 3
cycles.glossy_samples = 2
cycles.transmission_samples = 2
cycles.ao_samples = 1
cycles.mesh_light_samples = 2
cycles.subsurface_samples = 2

@ -0,0 +1,16 @@
import bpy
cycles = bpy.context.scene.cycles
cycles.squared_samples = True
cycles.samples = 12
cycles.preview_samples = 12
cycles.aa_samples = 4
cycles.preview_aa_samples = 4
cycles.diffuse_samples = 3
cycles.glossy_samples = 2
cycles.transmission_samples = 2
cycles.ao_samples = 1
cycles.mesh_light_samples = 2
cycles.subsurface_samples = 2

@ -362,7 +362,7 @@ class DATA_PT_paragraph(CurveButtonsPanel, Panel):
col = split.column(align=True)
col.label(text="Spacing:")
col.prop(text, "space_character", text="Character")
col.prop(text, "space_character", text="Letter")
col.prop(text, "space_word", text="Word")
col.prop(text, "space_line", text="Line")

@ -339,6 +339,11 @@ class MASK_MT_select(Menu):
layout.separator()
layout.operator("mask.select_more")
layout.operator("mask.select_less")
layout.separator()
layout.operator("mask.select_all").action = 'TOGGLE'
layout.operator("mask.select_all", text="Inverse").action = 'INVERT'

@ -2540,7 +2540,7 @@ class VIEW3D_PT_view3d_display(Panel):
view = context.space_data
scene = context.scene
gs = scene.game_settings
ob = context.object
obj = context.object
col = layout.column()
col.prop(view, "show_only_render")
@ -2580,6 +2580,8 @@ class VIEW3D_PT_view3d_display(Panel):
if view.use_matcap:
col.template_icon_view(view, "matcap_icon")
col.prop(view, "show_backface_culling")
if obj and obj.mode == 'EDIT' and view.viewport_shade not in {'BOUNDBOX', 'WIREFRAME'}:
col.prop(view, "show_occlude_wire")
layout.separator()

@ -116,14 +116,9 @@ void BLI_ghash_insert(GHash *gh, void *key, void *val)
void *BLI_ghash_lookup(GHash *gh, const void *key)
{
unsigned int hash;
const unsigned int hash = gh->hashfp(key) % gh->nbuckets;
Entry *e;
if (!gh) return NULL;
hash = gh->hashfp(key) % gh->nbuckets;
for (e = gh->buckets[hash]; e; e = e->next) {
if (gh->cmpfp(key, e->key) == 0) {
return e->val;

@ -72,7 +72,7 @@ struct BVHTree {
/* optimization, ensure we stay small */
BLI_STATIC_ASSERT((sizeof(void *) == 8 && sizeof(BVHTree) <= 48) ||
(sizeof(void *) == 4 && sizeof(BVHTree) <= 32),
"over sized");
"over sized")
typedef struct BVHOverlapData {
BVHTree *tree1, *tree2;
@ -603,6 +603,7 @@ static void build_implicit_tree_helper(BVHTree *tree, BVHBuildHelper *data)
data->branches_on_level[0] = 1;
/* We could stop the loop first (but I am lazy to find out when) */
/* note: this often causes integer overflow, may be worth avoiding? - campbell */
for (depth = 1; depth < 32; depth++) {
data->branches_on_level[depth] = data->branches_on_level[depth - 1] * data->tree_type;
data->leafs_per_child[depth] = data->leafs_per_child[depth - 1] / data->tree_type;

@ -390,6 +390,8 @@ void ED_operatortypes_mask(void)
WM_operatortype_append(MASK_OT_select_circle);
WM_operatortype_append(MASK_OT_select_linked_pick);
WM_operatortype_append(MASK_OT_select_linked);
WM_operatortype_append(MASK_OT_select_more);
WM_operatortype_append(MASK_OT_select_less);
/* hide/reveal */
WM_operatortype_append(MASK_OT_hide_view_clear);
@ -466,6 +468,9 @@ void ED_keymap_mask(wmKeyConfig *keyconf)
kmi = WM_keymap_add_item(keymap, "MASK_OT_select_lasso", EVT_TWEAK_A, KM_ANY, KM_CTRL | KM_SHIFT | KM_ALT, 0);
RNA_boolean_set(kmi->ptr, "deselect", TRUE);
WM_keymap_add_item(keymap, "MASK_OT_select_more", PADPLUSKEY, KM_PRESS, KM_CTRL, 0);
WM_keymap_add_item(keymap, "MASK_OT_select_less", PADMINUS, KM_PRESS, KM_CTRL, 0);
/* hide/reveal */
WM_keymap_add_item(keymap, "MASK_OT_hide_view_clear", HKEY, KM_PRESS, KM_ALT, 0);
kmi = WM_keymap_add_item(keymap, "MASK_OT_hide_view_set", HKEY, KM_PRESS, 0, 0);

@ -88,6 +88,8 @@ void MASK_OT_select_lasso(struct wmOperatorType *ot);
void MASK_OT_select_circle(struct wmOperatorType *ot);
void MASK_OT_select_linked_pick(struct wmOperatorType *ot);
void MASK_OT_select_linked(struct wmOperatorType *ot);
void MASK_OT_select_more(struct wmOperatorType *ot);
void MASK_OT_select_less(struct wmOperatorType *ot);
int ED_mask_spline_select_check(struct MaskSpline *spline);
int ED_mask_layer_select_check(struct MaskLayer *masklay);

@ -470,7 +470,7 @@ void MASK_OT_select_border(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Border Select";
ot->description = "Select markers using border selection";
ot->description = "Select curve points using border selection";
ot->idname = "MASK_OT_select_border";
/* api callbacks */
@ -521,7 +521,7 @@ static int do_lasso_select_mask(bContext *C, const int mcords[][2], short moves,
float screen_co[2];
/* marker in screen coords */
/* point in screen coords */
ED_mask_point_pos__reverse(sa, ar,
point_deform->bezt.vec[1][0], point_deform->bezt.vec[1][1],
&screen_co[0], &screen_co[1]);
@ -569,7 +569,7 @@ void MASK_OT_select_lasso(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Lasso Select";
ot->description = "Select markers using lasso selection";
ot->description = "Select curve points using lasso selection";
ot->idname = "MASK_OT_select_lasso";
/* api callbacks */
@ -670,7 +670,7 @@ void MASK_OT_select_circle(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Circle Select";
ot->description = "Select markers using circle selection";
ot->description = "Select curve points using circle selection";
ot->idname = "MASK_OT_select_circle";
/* api callbacks */
@ -784,7 +784,7 @@ void MASK_OT_select_linked(wmOperatorType *ot)
/* identifiers */
ot->name = "Select Linked All";
ot->idname = "MASK_OT_select_linked";
ot->description = "Select all vertices linked to the active mesh";
ot->description = "Select all curve points linked to already selected ones";
/* api callbacks */
ot->exec = mask_select_linked_exec;
@ -793,3 +793,115 @@ void MASK_OT_select_linked(wmOperatorType *ot)
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
/**************** Select more/less **************/
static int mask_select_more_less(bContext *C, bool more)
{
Mask *mask = CTX_data_edit_mask(C);
MaskLayer *masklay;
for (masklay = mask->masklayers.first; masklay; masklay = masklay->next) {
MaskSpline *spline;
if (masklay->restrictflag & (MASK_RESTRICT_VIEW | MASK_RESTRICT_SELECT)) {
continue;
}
for (spline = masklay->splines.first; spline; spline = spline->next) {
int i;
bool start_sel, end_sel, prev_sel, cur_sel, cyclic = spline->flag & MASK_SPLINE_CYCLIC;
/* reselect point if any handle is selected to make the result more predictable */
for (i = 0; i < spline->tot_point; i++) {
BKE_mask_point_select_set(spline->points + i, MASKPOINT_ISSEL_ANY(spline->points + i));
}
/* select more/less does not affect empty/single point splines */
if (spline->tot_point < 2) {
continue;
}
if (cyclic) {
start_sel = !!MASKPOINT_ISSEL_KNOT(spline->points);
end_sel = !!MASKPOINT_ISSEL_KNOT(&spline->points[spline->tot_point - 1]);
}
for (i = 0; i < spline->tot_point; i++) {
if (i == 0 && !cyclic) {
continue;
}
prev_sel = (i > 0) ? !!MASKPOINT_ISSEL_KNOT(&spline->points[i - 1]) : end_sel;
cur_sel = !!MASKPOINT_ISSEL_KNOT(&spline->points[i]);
if (cur_sel != more) {
if (prev_sel == more) {
BKE_mask_point_select_set(&spline->points[i], more);
}
i++;
}
}
for (i = spline->tot_point - 1; i >= 0; i--) {
if (i == spline->tot_point - 1 && !cyclic) {
continue;
}
prev_sel = (i < spline->tot_point - 1) ? !!MASKPOINT_ISSEL_KNOT(&spline->points[i + 1]) : start_sel;
cur_sel = !!MASKPOINT_ISSEL_KNOT(&spline->points[i]);
if (cur_sel != more) {
if (prev_sel == more) {
BKE_mask_point_select_set(&spline->points[i], more);
}
i--;
}
}
}
}
WM_event_add_notifier(C, NC_MASK | ND_SELECT, mask);
return OPERATOR_FINISHED;
}
static int mask_select_more_exec(bContext *C, wmOperator *UNUSED(op))
{
return mask_select_more_less(C, true);
}
void MASK_OT_select_more(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Select More";
ot->idname = "MASK_OT_select_more";
ot->description = "Select more spline points connected to initial selection";
/* api callbacks */
ot->exec = mask_select_more_exec;
ot->poll = ED_maskedit_mask_poll;
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
static int mask_select_less_exec(bContext *C, wmOperator *UNUSED(op))
{
return mask_select_more_less(C, false);
}
void MASK_OT_select_less(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Select Less";
ot->idname = "MASK_OT_select_less";
ot->description = "Deselect spline points at the boundary of each selection region";
/* api callbacks */
ot->exec = mask_select_less_exec;
ot->poll = ED_maskedit_mask_poll;
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}

@ -460,7 +460,7 @@ BMVert *EDBM_vert_find_nearest(ViewContext *vc, float *r_dist, const bool sel, c
0, NULL, NULL);
}
eve = BM_vert_at_index(vc->em->bm, index - 1);
eve = index ? BM_vert_at_index(vc->em->bm, index - 1) : NULL;
if (eve && distance < *r_dist) {
*r_dist = distance;
@ -552,7 +552,7 @@ BMEdge *EDBM_edge_find_nearest(ViewContext *vc, float *r_dist)
view3d_validate_backbuf(vc);
index = view3d_sample_backbuf_rect(vc, vc->mval, 50, bm_solidoffs, bm_wireoffs, &distance, 0, NULL, NULL);
eed = BM_edge_at_index(vc->em->bm, index - 1);
eed = index ? BM_edge_at_index(vc->em->bm, index - 1) : NULL;
if (eed && distance < *r_dist) {
*r_dist = distance;
@ -625,7 +625,7 @@ BMFace *EDBM_face_find_nearest(ViewContext *vc, float *r_dist)
view3d_validate_backbuf(vc);
index = view3d_sample_backbuf(vc, vc->mval[0], vc->mval[1]);
efa = BM_face_at_index(vc->em->bm, index - 1);
efa = index ? BM_face_at_index(vc->em->bm, index - 1) : NULL;
if (efa) {
struct { float mval_fl[2]; float dist; BMFace *toFace; } data;

@ -138,7 +138,7 @@ static void delete_customdata_layer(Mesh *me, CustomDataLayer *layer)
BM_data_layer_free_n(me->edit_btmesh->bm, data, type, n);
}
else {
CustomData_free_layer(data, type, tot, n);
CustomData_free_layer(data, type, tot, layer_index + n);
BKE_mesh_update_customdata_pointers(me, true);
}
}

@ -1200,7 +1200,7 @@ bool ED_mesh_pick_face(bContext *C, Object *ob, const int mval[2], unsigned int
*index = view3d_sample_backbuf(&vc, mval[0], mval[1]);
}
if ((*index) <= 0 || (*index) > (unsigned int)me->totpoly)
if ((*index) == 0 || (*index) > (unsigned int)me->totpoly)
return false;
(*index)--;
@ -1321,7 +1321,7 @@ bool ED_mesh_pick_vert(bContext *C, Object *ob, const int mval[2], unsigned int
*index = view3d_sample_backbuf(&vc, mval[0], mval[1]);
}
if ((*index) <= 0 || (*index) > (unsigned int)me->totvert)
if ((*index) == 0 || (*index) > (unsigned int)me->totvert)
return false;
(*index)--;

@ -333,7 +333,7 @@ int imapaint_pick_face(ViewContext *vc, const int mval[2], unsigned int *index,
/* sample only on the exact position */
*index = view3d_sample_backbuf(vc, mval[0], mval[1]);
if ((*index) <= 0 || (*index) > (unsigned int)totface) {
if ((*index) == 0 || (*index) > (unsigned int)totface) {
return 0;
}

@ -3092,6 +3092,7 @@ static void draw_em_fancy(Scene *scene, ARegion *ar, View3D *v3d,
BMFace *efa_act = BM_mesh_active_face_get(em->bm, false, true); /* annoying but active faces is stored differently */
BMEdge *eed_act = NULL;
BMVert *eve_act = NULL;
bool use_occlude_wire = (v3d->flag2 & V3D_OCCLUDE_WIRE) && (dt > OB_WIRE);
// if (cageDM) BLI_assert(!(cageDM->dirty & DM_DIRTY_NORMALS));
if (finalDM) BLI_assert(!(finalDM->dirty & DM_DIRTY_NORMALS));
@ -3130,7 +3131,13 @@ static void draw_em_fancy(Scene *scene, ARegion *ar, View3D *v3d,
}
}
else if (dt > OB_WIRE) {
if (check_object_draw_texture(scene, v3d, dt)) {
if (use_occlude_wire) {
glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE);
finalDM->drawMappedFaces(finalDM, draw_em_fancy__setFaceOpts,
GPU_enable_material, NULL, me->edit_btmesh, 0);
glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
}
else if (check_object_draw_texture(scene, v3d, dt)) {
if (draw_glsl_material(scene, ob, v3d, dt)) {
glFrontFace((ob->transflag & OB_NEG_SCALE) ? GL_CW : GL_CCW);
@ -3171,8 +3178,8 @@ static void draw_em_fancy(Scene *scene, ARegion *ar, View3D *v3d,
finalDM->drawEdges(finalDM, 1, 0);
}
}
if (me->drawflag & ME_DRAWFACES) { /* transp faces */
if ((me->drawflag & ME_DRAWFACES) && (use_occlude_wire == false)) { /* transp faces */
unsigned char col1[4], col2[4], col3[4];
#ifdef WITH_FREESTYLE
unsigned char col4[4];
@ -3311,6 +3318,11 @@ static void draw_em_fancy(Scene *scene, ARegion *ar, View3D *v3d,
bglPolygonOffset(rv3d->dist, 0.0);
GPU_disable_material();
}
#if 0 /* currently not needed */
else if (use_occlude_wire) {
bglPolygonOffset(rv3d->dist, 0.0);
}
#endif
}
/* Mesh drawing routines */

@ -47,6 +47,7 @@ set(SRC
../include/BIF_glutil.h
../include/ED_anim_api.h
../include/ED_armature.h
../include/ED_buttons.h
../include/ED_clip.h
../include/ED_curve.h
../include/ED_datafiles.h

@ -266,7 +266,7 @@ static PyObject *Stroke_stroke_vertices_begin(BPy_Stroke *self, PyObject *args,
}
PyDoc_STRVAR(Stroke_stroke_vertices_end_doc,
".. method:: strokeVerticesEnd()\n"
".. method:: stroke_vertices_end()\n"
"\n"
" Returns a StrokeVertexIterator pointing after the last StrokeVertex\n"
" of the Stroke.\n"

@ -742,12 +742,16 @@ static void shade_one_light(GPUShadeInput *shi, GPUShadeResult *shr, GPULamp *la
}
if (lamp->mode & LA_ONLYSHADOW) {
GPUNodeLink *rgb;
GPU_link(mat, "shade_only_shadow", i, shadfac,
GPU_dynamic_uniform(&lamp->dynenergy, GPU_DYNAMIC_LAMP_DYNENERGY, lamp->ob), &shadfac);
GPU_link(mat, "shade_mul", shi->rgb, GPU_uniform(lamp->shadow_color), &rgb);
GPU_link(mat, "mtex_rgb_invert", rgb, &rgb);
if (!(lamp->mode & LA_NO_DIFF)) {
GPU_link(mat, "mix_mult", shadfac, shr->diff,
GPU_uniform(lamp->shadow_color), &shr->diff);
GPU_link(mat, "shade_only_shadow_diffuse", shadfac, rgb,
shr->diff, &shr->diff);
}
if (!(lamp->mode & LA_NO_SPEC))

@ -61,7 +61,7 @@
/* the types are from the jpeg lib */
static void jpeg_error(j_common_ptr cinfo)
#ifdef __GNUC__
__attribute__((noreturn));
__attribute__((noreturn))
#endif
;
static void init_source(j_decompress_ptr cinfo);

@ -279,6 +279,8 @@ typedef struct View3D {
#define V3D_RENDER_BORDER 2048
#define V3D_SOLID_MATCAP 4096 /* user flag */
#define V3D_SHOW_SOLID_MATCAP 8192 /* runtime flag */
#define V3D_OCCLUDE_WIRE 16384
/* View3D->around */
#define V3D_CENTER 0

@ -972,7 +972,7 @@ static int rna_Mesh_polygon_string_layers_length(PointerRNA *ptr)
}
/* Skin vertices */
DEFINE_CUSTOMDATA_LAYER_COLLECTION(skin_vertice, vdata, CD_MVERT_SKIN);
DEFINE_CUSTOMDATA_LAYER_COLLECTION(skin_vertice, vdata, CD_MVERT_SKIN)
static char *rna_MeshSkinVertexLayer_path(PointerRNA *ptr)
{

@ -1921,6 +1921,11 @@ static void rna_def_space_view3d(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Backface Culling", "Use back face culling to hide the back side of faces");
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
prop = RNA_def_property(srna, "show_occlude_wire", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag2", V3D_OCCLUDE_WIRE);
RNA_def_property_ui_text(prop, "Hidden Wire", "Use hidden wireframe display");
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
prop = RNA_def_property(srna, "lock_camera", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag2", V3D_LOCK_CAMERA);
RNA_def_property_ui_text(prop, "Lock Camera to View", "Enable view navigation within the camera view");

@ -2085,8 +2085,9 @@ static KX_GameObject *gameobject_from_blenderobject(
case OB_FONT:
{
bool do_color_management = !(blenderscene->gm.flag & GAME_GLSL_NO_COLOR_MANAGEMENT);
/* font objects have no bounding box */
gameobj = new KX_FontObject(kxscene,KX_Scene::m_callbacks, rendertools, ob);
gameobj = new KX_FontObject(kxscene,KX_Scene::m_callbacks, rendertools, ob, do_color_management);
/* add to the list only the visible fonts */
if ((ob->lay & kxscene->GetBlenderScene()->lay) != 0)

@ -367,7 +367,7 @@ PyObject *SCA_JoystickSensor::pyattr_get_axis_single(void *self_v, const KX_PYAT
SCA_Joystick *joy = ((SCA_JoystickManager *)self->m_eventmgr)->GetJoystickDevice(self->m_joyindex);
if (self->m_joymode != KX_JOYSENSORMODE_AXIS_SINGLE) {
PyErr_SetString(PyExc_TypeError, "val = sensor.axisSingle: Joystick Sensor, not 'Single Axis' type");
PyErr_SetString(PyExc_AttributeError, "val = sensor.axisSingle: Joystick Sensor, not 'Single Axis' type");
return NULL;
}

@ -30,16 +30,10 @@ Import ('env')
source_files = [
'bmfont.cpp',
'GPC_Canvas.cpp',
'GPC_Engine.cpp',
'GPC_KeyboardDevice.cpp',
'GPC_MouseDevice.cpp',
'GPC_RawImage.cpp',
'GPC_RawLoadDotBlendArray.cpp',
'GPC_RawLogoArrays.cpp',
'GPC_RenderTools.cpp',
'GPC_System.cpp',
]
incs = [

@ -56,6 +56,7 @@ set(INC_SYS
../../../../intern/moto/include
${GLEW_INCLUDE_PATH}
${PYTHON_INCLUDE_DIRS}
${BOOST_INCLUDE_DIR}
)
set(SRC
@ -81,4 +82,11 @@ if(WITH_INTERNATIONAL)
add_definitions(-DWITH_INTERNATIONAL)
endif()
if(WITH_AUDASPACE)
list(APPEND INC
../../../../intern/audaspace/intern
)
add_definitions(-DWITH_AUDASPACE)
endif()
blender_add_lib_nolist(ge_player_ghost "${SRC}" "${INC}" "${INC_SYS}")

@ -99,6 +99,12 @@ extern "C"
#include "GHOST_IWindow.h"
#include "GHOST_Rect.h"
#ifdef WITH_AUDASPACE
# include "AUD_C-API.h"
# include "AUD_I3DDevice.h"
# include "AUD_IDevice.h"
#endif
static void frameTimerProc(GHOST_ITimerTask* task, GHOST_TUns64 time);
static GHOST_ISystem* fSystem = 0;
@ -725,6 +731,15 @@ bool GPG_Application::startEngine(void)
if (m_startScene->gm.stereoflag == STEREO_DOME)
m_ketsjiengine->InitDome(m_startScene->gm.dome.res, m_startScene->gm.dome.mode, m_startScene->gm.dome.angle, m_startScene->gm.dome.resbuf, m_startScene->gm.dome.tilt, m_startScene->gm.dome.warptext);
// initialize 3D Audio Settings
AUD_I3DDevice* dev = AUD_get3DDevice();
if (dev)
{
dev->setSpeedOfSound(m_startScene->audio.speed_of_sound);
dev->setDopplerFactor(m_startScene->audio.doppler_factor);
dev->setDistanceModel(AUD_DistanceModel(m_startScene->audio.distance_model));
}
#ifdef WITH_PYTHON
// Set the GameLogic.globalDict from marshal'd data, so we can
// load new blend files and keep data in GameLogic.globalDict

@ -1031,10 +1031,9 @@ int main(int argc, char** argv)
* removal is needed else the system will free an already freed value */
system->removeEventConsumer(&app);
/* nodesystem relies on blendfile data, free it first */
free_nodesystem();
BLO_blendfiledata_free(bfd);
/* G.main == bfd->main, it gets referenced in free_nodesystem so we can't have a dangling pointer */
G.main = NULL;
if (python_main) MEM_freeN(python_main);
}
} while (exitcode == KX_EXIT_REQUEST_RESTART_GAME || exitcode == KX_EXIT_REQUEST_START_OTHER_GAME);
@ -1052,6 +1051,13 @@ int main(int argc, char** argv)
}
}
/* refer to WM_exit_ext() and free_blender(),
* these are not called in the player but we need to match some of there behavior here,
* if the order of function calls or blenders state isn't matching that of blender proper,
* we may get troubles later on */
free_nodesystem();
// Cleanup
RNA_exit();
BLF_exit();

@ -43,6 +43,7 @@ incs = [
'#intern/guardedalloc',
'#intern/moto/include',
'#intern/container',
'#intern/audaspace/intern',
'#source/gameengine/Rasterizer/RAS_OpenGLRasterizer',
'#source/gameengine/BlenderRoutines',
'#source/gameengine/Converter',
@ -70,6 +71,7 @@ incs = [
]
incs.append(env['BF_PTHREADS_INC'])
incs.append(env['BF_BOOST_INC'])
defs = [
'GLEW_STATIC',

@ -76,12 +76,14 @@ static std::vector<STR_String> split_string(STR_String str)
KX_FontObject::KX_FontObject(void* sgReplicationInfo,
SG_Callbacks callbacks,
RAS_IRenderTools* rendertools,
Object *ob):
Object *ob,
bool do_color_management):
KX_GameObject(sgReplicationInfo, callbacks),
m_object(ob),
m_dpi(72),
m_resolution(1.f),
m_rendertools(rendertools)
m_rendertools(rendertools),
m_do_color_management(do_color_management)
{
Curve *text = static_cast<Curve *> (ob->data);
m_text = split_string(text->str);
@ -174,6 +176,15 @@ void KX_FontObject::DrawText()
/* update the animated color */
this->GetObjectColor().getValue(m_color);
/* Font Objects don't use the glsl shader, this color management code is copied from gpu_shader_material.glsl */
float color[4];
if (m_do_color_management) {
linearrgb_to_srgb_v4(color, m_color);
}
else {
copy_v4_v4(color, m_color);
}
/* HARDCODED MULTIPLICATION FACTOR - this will affect the render resolution directly */
const float RES = BGE_FONT_RES * m_resolution;
@ -201,7 +212,7 @@ void KX_FontObject::DrawText()
mat[13] -= spacing[1];
mat[14] -= spacing[2];
}
m_rendertools->RenderText3D(m_fontid, m_text[i], int(size), m_dpi, m_color, mat, aspect);
m_rendertools->RenderText3D(m_fontid, m_text[i], int(size), m_dpi, color, mat, aspect);
}
}

@ -42,7 +42,8 @@ public:
KX_FontObject(void* sgReplicationInfo,
SG_Callbacks callbacks,
RAS_IRenderTools* rendertools,
Object *ob);
Object *ob,
bool do_color_management);
virtual ~KX_FontObject();
@ -69,6 +70,8 @@ protected:
class RAS_IRenderTools* m_rendertools; //needed for drawing routine
bool m_do_color_management;
#ifdef WITH_PYTHON
static PyObject* pyattr_get_text(void* self_v, const KX_PYATTRIBUTE_DEF *attrdef);
static int pyattr_set_text(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);