Skip to content

Commit

Permalink
Merge commit '2174a2118b589b4b6805f901ffff2e29f5e32259'
Browse files Browse the repository at this point in the history
  • Loading branch information
panzergame committed Jul 18, 2017
2 parents 330e7a4 + 2174a21 commit 676f604
Show file tree
Hide file tree
Showing 32 changed files with 349 additions and 206 deletions.
4 changes: 2 additions & 2 deletions build_files/buildbot/slave_compile.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,8 @@ def parse_header_file(filename, define):
chroot_name = 'buildbot_' + deb_name + '_i686'
cuda_chroot_name = 'buildbot_' + deb_name + '_x86_64'
targets = ['player', 'blender', 'cuda']
cmake_extra_options.extend(["-DCMAKE_C_COMPILER=/usr/bin/gcc-6",
"-DCMAKE_CXX_COMPILER=/usr/bin/g++-6"])
cmake_extra_options.extend(["-DCMAKE_C_COMPILER=/usr/bin/gcc-7",
"-DCMAKE_CXX_COMPILER=/usr/bin/g++-7"])

cmake_options.append("-C" + os.path.join(blender_dir, cmake_config_file))

Expand Down
26 changes: 23 additions & 3 deletions doc/python_api/sphinx_doc_gen.py
Original file line number Diff line number Diff line change
Expand Up @@ -1639,6 +1639,11 @@ def write_sphinx_conf_py(basepath):
fw("version = '%s - API'\n" % BLENDER_VERSION_DOTS)
fw("release = '%s - API'\n" % BLENDER_VERSION_DOTS)

# Quiet file not in table-of-contents warnings.
fw("exclude_patterns = [\n")
fw(" 'include__bmesh.rst',\n")
fw("]\n\n")

if ARGS.sphinx_theme != 'default':
fw("html_theme = '%s'\n" % ARGS.sphinx_theme)

Expand All @@ -1659,6 +1664,24 @@ def write_sphinx_conf_py(basepath):
fw("}\n\n")

fw("latex_documents = [ ('contents', 'contents.tex', 'Blender Index', 'Blender Foundation', 'manual'), ]\n")

# Workaround for useless links leading to compile errors
# See https://github.com/sphinx-doc/sphinx/issues/3866
fw(r"""
from sphinx.domains.python import PythonDomain
class PatchedPythonDomain(PythonDomain):
def resolve_xref(self, env, fromdocname, builder, typ, target, node, contnode):
if 'refspecific' in node:
del node['refspecific']
return super(PatchedPythonDomain, self).resolve_xref(
env, fromdocname, builder, typ, target, node, contnode)
def setup(sphinx):
sphinx.override_domain(PatchedPythonDomain)
""")
# end workaround

file.close()


Expand Down Expand Up @@ -1697,9 +1720,6 @@ def write_rst_contents(basepath):
for info, info_desc in INFO_DOCS:
fw(" %s <%s>\n\n" % (info_desc, info))
fw("\n")
fw("- :ref:`Blender/Python Add-on Tutorial: a step by step guide on")
fw(" how to write an add-on from scratch <blender_manual:advanced_scripting_addon_tutorial>`\n")
fw("\n")

fw(title_string("Application Modules", "=", double=True))
fw(".. toctree::\n")
Expand Down
11 changes: 7 additions & 4 deletions intern/cycles/kernel/kernel_accumulate.h
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,9 @@ ccl_device_inline void path_radiance_init(PathRadiance *L, int use_light_pass)
#ifdef __SHADOW_TRICKS__
L->path_total = make_float3(0.0f, 0.0f, 0.0f);
L->path_total_shaded = make_float3(0.0f, 0.0f, 0.0f);
L->shadow_color = make_float3(0.0f, 0.0f, 0.0f);
L->shadow_background_color = make_float3(0.0f, 0.0f, 0.0f);
L->shadow_radiance_sum = make_float3(0.0f, 0.0f, 0.0f);
L->shadow_throughput = 0.0f;
#endif

#ifdef __DENOISING_FEATURES__
Expand Down Expand Up @@ -680,11 +682,12 @@ ccl_device_inline float3 path_radiance_sum_shadowcatcher(KernelGlobals *kg,
const float shadow = path_radiance_sum_shadow(L);
float3 L_sum;
if(kernel_data.background.transparent) {
*alpha = 1.0f-shadow;
L_sum = make_float3(0.0f, 0.0f, 0.0f);
*alpha = 1.0f - L->shadow_throughput * shadow;
L_sum = L->shadow_radiance_sum;
}
else {
L_sum = L->shadow_color * shadow;
L_sum = L->shadow_background_color * L->shadow_throughput * shadow +
L->shadow_radiance_sum;
}
return L_sum;
}
Expand Down
9 changes: 7 additions & 2 deletions intern/cycles/kernel/kernel_path.h
Original file line number Diff line number Diff line change
Expand Up @@ -643,11 +643,16 @@ ccl_device_inline float kernel_path_integrate(KernelGlobals *kg,
#ifdef __SHADOW_TRICKS__
if((sd.object_flag & SD_OBJECT_SHADOW_CATCHER)) {
if(state.flag & PATH_RAY_CAMERA) {
state.flag |= (PATH_RAY_SHADOW_CATCHER | PATH_RAY_SHADOW_CATCHER_ONLY | PATH_RAY_STORE_SHADOW_INFO);
state.flag |= (PATH_RAY_SHADOW_CATCHER |
PATH_RAY_SHADOW_CATCHER_ONLY |
PATH_RAY_STORE_SHADOW_INFO);
state.catcher_object = sd.object;
if(!kernel_data.background.transparent) {
L->shadow_color = indirect_background(kg, &emission_sd, &state, &ray);
L->shadow_background_color =
indirect_background(kg, &emission_sd, &state, &ray);
}
L->shadow_radiance_sum = path_radiance_clamp_and_sum(kg, L);
L->shadow_throughput = average(throughput);
}
}
else {
Expand Down
15 changes: 9 additions & 6 deletions intern/cycles/kernel/kernel_path_branched.h
Original file line number Diff line number Diff line change
Expand Up @@ -499,13 +499,16 @@ ccl_device float kernel_branched_path_integrate(KernelGlobals *kg,

#ifdef __SHADOW_TRICKS__
if((sd.object_flag & SD_OBJECT_SHADOW_CATCHER)) {
if(state.flag & PATH_RAY_CAMERA) {
state.flag |= (PATH_RAY_SHADOW_CATCHER | PATH_RAY_SHADOW_CATCHER_ONLY | PATH_RAY_STORE_SHADOW_INFO);
state.catcher_object = sd.object;
if(!kernel_data.background.transparent) {
L->shadow_color = indirect_background(kg, &emission_sd, &state, &ray);
}
state.flag |= (PATH_RAY_SHADOW_CATCHER |
PATH_RAY_SHADOW_CATCHER_ONLY |
PATH_RAY_STORE_SHADOW_INFO);
state.catcher_object = sd.object;
if(!kernel_data.background.transparent) {
L->shadow_background_color =
indirect_background(kg, &emission_sd, &state, &ray);
}
L->shadow_radiance_sum = path_radiance_clamp_and_sum(kg, L);
L->shadow_throughput = average(throughput);
}
else {
state.flag &= ~PATH_RAY_SHADOW_CATCHER_ONLY;
Expand Down
8 changes: 7 additions & 1 deletion intern/cycles/kernel/kernel_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -515,7 +515,13 @@ typedef ccl_addr_space struct PathRadiance {
float3 path_total_shaded;

/* Color of the background on which shadow is alpha-overed. */
float3 shadow_color;
float3 shadow_background_color;

/* Path radiance sum and throughput at the moment when ray hits shadow
* catcher object.
*/
float3 shadow_radiance_sum;
float shadow_throughput;
#endif

#ifdef __DENOISING_FEATURES__
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,13 +125,21 @@ ccl_device void kernel_holdout_emission_blurring_pathtermination_ao(
#ifdef __SHADOW_TRICKS__
if((sd->object_flag & SD_OBJECT_SHADOW_CATCHER)) {
if(state->flag & PATH_RAY_CAMERA) {
state->flag |= (PATH_RAY_SHADOW_CATCHER | PATH_RAY_SHADOW_CATCHER_ONLY | PATH_RAY_STORE_SHADOW_INFO);
PathRadiance *L = &kernel_split_state.path_radiance[ray_index];
state->flag |= (PATH_RAY_SHADOW_CATCHER |
PATH_RAY_SHADOW_CATCHER_ONLY |
PATH_RAY_STORE_SHADOW_INFO);
state->catcher_object = sd->object;
if(!kernel_data.background.transparent) {
PathRadiance *L = &kernel_split_state.path_radiance[ray_index];
ccl_global Ray *ray = &kernel_split_state.ray[ray_index];
L->shadow_color = indirect_background(kg, &kernel_split_state.sd_DL_shadow[ray_index], state, ray);
L->shadow_background_color = indirect_background(
kg,
&kernel_split_state.sd_DL_shadow[ray_index],
state,
ray);
}
L->shadow_radiance_sum = path_radiance_clamp_and_sum(kg, L);
L->shadow_throughput = average(throughput);
}
}
else {
Expand Down
2 changes: 1 addition & 1 deletion source/blender/blenkernel/intern/editderivedmesh.c
Original file line number Diff line number Diff line change
Expand Up @@ -2641,7 +2641,7 @@ static void statvis_calc_distort(
vertexCos[BM_elem_index_get(l_iter->next->v)]);
}
else {
BM_loop_calc_face_normal(l_iter, no_corner);
BM_loop_calc_face_normal_safe(l_iter, no_corner);
}
/* simple way to detect (what is most likely) concave */
if (dot_v3v3(f_no, no_corner) < 0.0f) {
Expand Down
12 changes: 6 additions & 6 deletions source/blender/blenlib/intern/noise.c
Original file line number Diff line number Diff line change
Expand Up @@ -1395,9 +1395,9 @@ static float voronoi_CrS(float x, float y, float z)
static float cellNoiseU(float x, float y, float z)
{
/* avoid precision issues on unit coordinates */
x = (x + 0.000001f)*0.999999f;
y = (y + 0.000001f)*0.999999f;
z = (z + 0.000001f)*0.999999f;
x = (x + 0.000001f)*1.00001f;
y = (y + 0.000001f)*1.00001f;
z = (z + 0.000001f)*1.00001f;

int xi = (int)(floor(x));
int yi = (int)(floor(y));
Expand All @@ -1417,9 +1417,9 @@ float cellNoise(float x, float y, float z)
void cellNoiseV(float x, float y, float z, float ca[3])
{
/* avoid precision issues on unit coordinates */
x = (x + 0.000001f)*0.999999f;
y = (y + 0.000001f)*0.999999f;
z = (z + 0.000001f)*0.999999f;
x = (x + 0.000001f)*1.00001f;
y = (y + 0.000001f)*1.00001f;
z = (z + 0.000001f)*1.00001f;

int xi = (int)(floor(x));
int yi = (int)(floor(y));
Expand Down
48 changes: 41 additions & 7 deletions source/blender/bmesh/intern/bmesh_queries.c
Original file line number Diff line number Diff line change
Expand Up @@ -1511,12 +1511,11 @@ float BM_loop_calc_face_angle(const BMLoop *l)
* Calculate the normal at this loop corner or fallback to the face normal on straight lines.
*
* \param l The loop to calculate the normal at
* \param epsilon: Value to avoid numeric errors (1e-5f works well).
* \param r_normal Resulting normal
*/
void BM_loop_calc_face_normal(const BMLoop *l, float r_normal[3])
float BM_loop_calc_face_normal_safe_ex(const BMLoop *l, const float epsilon_sq, float r_normal[3])
{
#define FEPSILON 1e-5f

/* Note: we cannot use result of normal_tri_v3 here to detect colinear vectors (vertex on a straight line)
* from zero value, because it does not normalize both vectors before making crossproduct.
* Instead of adding two costly normalize computations, just check ourselves for colinear case. */
Expand All @@ -1525,20 +1524,55 @@ void BM_loop_calc_face_normal(const BMLoop *l, float r_normal[3])
sub_v3_v3v3(v1, l->prev->v->co, l->v->co);
sub_v3_v3v3(v2, l->next->v->co, l->v->co);

const float fac = (v2[0] == 0.0f) ? ((v2[1] == 0.0f) ? ((v2[2] == 0.0f) ? 0.0f : v1[2] / v2[2]) : v1[1] / v2[1]) : v1[0] / v2[0];
const float fac =
((v2[0] == 0.0f) ?
((v2[1] == 0.0f) ?
((v2[2] == 0.0f) ? 0.0f : v1[2] / v2[2]) : v1[1] / v2[1]) : v1[0] / v2[0]);

mul_v3_v3fl(v_tmp, v2, fac);
sub_v3_v3(v_tmp, v1);
if (fac != 0.0f && !is_zero_v3(v1) && len_manhattan_v3(v_tmp) > FEPSILON) {
if (fac != 0.0f && !is_zero_v3(v1) && len_squared_v3(v_tmp) > epsilon_sq) {
/* Not co-linear, we can compute crossproduct and normalize it into normal. */
cross_v3_v3v3(r_normal, v1, v2);
normalize_v3(r_normal);
return normalize_v3(r_normal);
}
else {
copy_v3_v3(r_normal, l->f->no);
return 0.0f;
}
}

/**
* #BM_loop_calc_face_normal_safe_ex with pre-defined sane epsilon.
*
* Since this doesn't scale baed on triangle size, fixed value works well.
*/
float BM_loop_calc_face_normal_safe(const BMLoop *l, float r_normal[3])
{
return BM_loop_calc_face_normal_safe_ex(l, 1e-5f, r_normal);
}

#undef FEPSILON
/**
* \brief BM_loop_calc_face_normal
*
* Calculate the normal at this loop corner or fallback to the face normal on straight lines.
*
* \param l The loop to calculate the normal at
* \param r_normal Resulting normal
* \return The length of the cross product (double the area).
*/
float BM_loop_calc_face_normal(const BMLoop *l, float r_normal[3])
{
float v1[3], v2[3];
sub_v3_v3v3(v1, l->prev->v->co, l->v->co);
sub_v3_v3v3(v2, l->next->v->co, l->v->co);

cross_v3_v3v3(r_normal, v1, v2);
const float len = normalize_v3(r_normal);
if (UNLIKELY(len == 0.0f)) {
copy_v3_v3(r_normal, l->f->no);
}
return len;
}

/**
Expand Down
4 changes: 3 additions & 1 deletion source/blender/bmesh/intern/bmesh_queries.h
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,9 @@ BMLoop *BM_loop_find_prev_nodouble(BMLoop *l, BMLoop *l_stop, const float eps_sq
BMLoop *BM_loop_find_next_nodouble(BMLoop *l, BMLoop *l_stop, const float eps_sq);

float BM_loop_calc_face_angle(const BMLoop *l) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL();
void BM_loop_calc_face_normal(const BMLoop *l, float r_normal[3]) ATTR_NONNULL();
float BM_loop_calc_face_normal(const BMLoop *l, float r_normal[3]) ATTR_NONNULL();
float BM_loop_calc_face_normal_safe(const BMLoop *l, float r_normal[3]) ATTR_NONNULL();
float BM_loop_calc_face_normal_safe_ex(const BMLoop *l, const float epsilon, float r_normal[3]) ATTR_NONNULL();
void BM_loop_calc_face_direction(const BMLoop *l, float r_normal[3]);
void BM_loop_calc_face_tangent(const BMLoop *l, float r_tangent[3]);

Expand Down
10 changes: 5 additions & 5 deletions source/blender/bmesh/operators/bmo_primitive.c
Original file line number Diff line number Diff line change
Expand Up @@ -839,7 +839,7 @@ void BM_mesh_calc_uvs_grid(
const float dx = 1.0f / (float)(x_segments - 1);
const float dy = 1.0f / (float)(y_segments - 1);
float x = 0.0f;
float y = 0.0f;
float y = dy;

int loop_index;

Expand All @@ -854,16 +854,16 @@ void BM_mesh_calc_uvs_grid(

switch (loop_index) {
case 0:
x += dx;
y -= dy;
break;
case 1:
y += dy;
x += dx;
break;
case 2:
x -= dx;
y += dy;
break;
case 3:
y -= dy;
x -= dx;
break;
default:
break;
Expand Down
2 changes: 1 addition & 1 deletion source/blender/collada/AnimationExporter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -530,7 +530,7 @@ void AnimationExporter::dae_baked_animation(std::vector<float> &fra, Object *ob_

addSampler(sampler);

std::string target = translate_id(bone_name) + "/transform";
std::string target = get_joint_id(bone, ob_arm) + "/transform";
addChannel(COLLADABU::URI(empty, sampler_id), target);

closeAnimation();
Expand Down
2 changes: 1 addition & 1 deletion source/blender/editors/animation/anim_markers.c
Original file line number Diff line number Diff line change
Expand Up @@ -895,7 +895,7 @@ static int ed_marker_move_modal(bContext *C, wmOperator *op, const wmEvent *even
case PADENTER:
case LEFTMOUSE:
case MIDDLEMOUSE:
if (WM_modal_tweak_exit(event, mm->event_type)) {
if (WM_event_is_modal_tweak_exit(event, mm->event_type)) {
ed_marker_move_exit(C, op);
WM_event_add_notifier(C, NC_SCENE | ND_MARKERS, NULL);
WM_event_add_notifier(C, NC_ANIMATION | ND_MARKERS, NULL);
Expand Down
6 changes: 5 additions & 1 deletion source/blender/editors/mesh/editmesh_select.c
Original file line number Diff line number Diff line change
Expand Up @@ -446,6 +446,9 @@ BMVert *EDBM_vert_find_nearest_ex(
unsigned int index;
BMVert *eve;

/* No afterqueue (yet), so we check it now, otherwise the bm_xxxofs indices are bad. */
ED_view3d_backbuf_validate(vc);

index = ED_view3d_backbuf_sample_rect(
vc, vc->mval, dist_px, bm_wireoffs, 0xFFFFFF, &dist_test);
eve = index ? BM_vert_at_index_find_or_table(bm, index - 1) : NULL;
Expand Down Expand Up @@ -630,7 +633,8 @@ BMEdge *EDBM_edge_find_nearest_ex(
float dist_test = 0.0f;
unsigned int index;
BMEdge *eed;


/* No afterqueue (yet), so we check it now, otherwise the bm_xxxofs indices are bad. */
ED_view3d_backbuf_validate(vc);

index = ED_view3d_backbuf_sample_rect(vc, vc->mval, dist_px, bm_solidoffs, bm_wireoffs, &dist_test);
Expand Down
4 changes: 2 additions & 2 deletions source/blender/editors/object/object_transform.c
Original file line number Diff line number Diff line change
Expand Up @@ -923,8 +923,8 @@ static int object_origin_set_exec(bContext *C, wmOperator *op)

cent[2] = 0.0f;

cu->xof = cu->xof - (cent[0] / cu->fsize);
cu->yof = cu->yof - (cent[1] / cu->fsize);
cu->xof = cu->xof - cent[0];
cu->yof = cu->yof - cent[1];

tot_change++;
cu->id.tag |= LIB_TAG_DOIT;
Expand Down
Loading

0 comments on commit 676f604

Please sign in to comment.