Merge branch 'master' into blender2.8

This commit is contained in:
Campbell Barton 2018-02-14 01:06:41 +11:00
commit b330804ff3
18 changed files with 96 additions and 21 deletions

View File

@ -138,11 +138,11 @@ if builder.find('cmake') != -1:
blender_glibc = builder.split('_')[1]
if builder.endswith('x86_64_cmake'):
chroot_name = 'buildbot_squeeze_x86_64'
chroot_name = 'buildbot_jessie_x86_64'
bits = 64
blender_arch = 'x86_64'
elif builder.endswith('i686_cmake'):
chroot_name = 'buildbot_squeeze_i686'
chroot_name = 'buildbot_jessie_i686'
bits = 32
blender_arch = 'i686'

View File

@ -44,9 +44,9 @@ if "cmake" in builder:
"""
if builder.endswith('x86_64_cmake'):
chroot_name = 'buildbot_squeeze_x86_64'
chroot_name = 'buildbot_jessie_x86_64'
elif builder.endswith('i686_cmake'):
chroot_name = 'buildbot_squeeze_i686'
chroot_name = 'buildbot_jessie_i686'
if chroot_name:
chroot_prefix = ['schroot', '-c', chroot_name, '--']
"""

View File

@ -565,9 +565,12 @@ static void ExportCurveSegments(Scene *scene, Mesh *mesh, ParticleCurveData *CDa
return;
Attribute *attr_intercept = NULL;
Attribute *attr_index = NULL;
if(mesh->need_attribute(scene, ATTR_STD_CURVE_INTERCEPT))
attr_intercept = mesh->curve_attributes.add(ATTR_STD_CURVE_INTERCEPT);
if(mesh->need_attribute(scene, ATTR_STD_CURVE_INDEX))
attr_index = mesh->curve_attributes.add(ATTR_STD_CURVE_INDEX);
/* compute and reserve size of arrays */
for(int sys = 0; sys < CData->psys_firstcurve.size(); sys++) {
@ -612,12 +615,25 @@ static void ExportCurveSegments(Scene *scene, Mesh *mesh, ParticleCurveData *CDa
num_curve_keys++;
}
if(attr_index != NULL) {
attr_index->add(num_curves);
}
mesh->add_curve(num_keys, CData->psys_shader[sys]);
num_keys += num_curve_keys;
num_curves++;
}
}
if(attr_index != NULL) {
/* Normalize index to 0..1 range. */
float *curve_index = attr_index->data_float();
const float norm_factor = 1.0f / (float)num_curves;
for(int i = 0; i < num_curves; ++i) {
curve_index[i] *= norm_factor;
}
}
/* check allocation */
if((mesh->curve_keys.size() != num_keys) || (mesh->num_curves() != num_curves)) {
VLOG(1) << "Allocation failed, clearing data";

View File

@ -772,6 +772,7 @@ typedef enum AttributeStandard {
ATTR_STD_MOTION_VERTEX_NORMAL,
ATTR_STD_PARTICLE,
ATTR_STD_CURVE_INTERCEPT,
ATTR_STD_CURVE_INDEX,
ATTR_STD_PTEX_FACE_ID,
ATTR_STD_PTEX_UV,
ATTR_STD_VOLUME_DENSITY,

View File

@ -20,11 +20,13 @@ shader node_hair_info(
output float IsStrand = 0.0,
output float Intercept = 0.0,
output float Thickness = 0.0,
output normal TangentNormal = N)
output normal TangentNormal = N,
output float Index = 0)
{
getattribute("geom:is_curve", IsStrand);
getattribute("geom:curve_intercept", Intercept);
getattribute("geom:curve_thickness", Thickness);
getattribute("geom:curve_tangent_normal", TangentNormal);
getattribute("geom:curve_index", Index);
}

View File

@ -63,7 +63,7 @@ shader node_principled_bsdf(
BSDF = mixed_ss_base_color * bssrdf("principled", Normal, Subsurface * SubsurfaceRadius, SubsurfaceColor, "roughness", Roughness);
}
else {
BSDF = mixed_ss_base_color * bssrdf("principled_random_walk", Normal, Subsurface * SubsurfaceRadius, SubsurfaceColor, "roughness", Roughness);
BSDF = mixed_ss_base_color * bssrdf("principled_random_walk", Normal, Subsurface * SubsurfaceRadius, mixed_ss_base_color, "roughness", Roughness);
}
}
else {

View File

@ -187,7 +187,7 @@ ccl_device void svm_node_closure_bsdf(KernelGlobals *kg, ShaderData *sd, float *
if(bssrdf) {
bssrdf->radius = subsurface_radius * subsurface;
bssrdf->albedo = subsurface_color;
bssrdf->albedo = (subsurface_method == CLOSURE_BSSRDF_PRINCIPLED_ID)? subsurface_color: mixed_ss_base_color;
bssrdf->texture_blur = 0.0f;
bssrdf->sharpness = 0.0f;
bssrdf->N = N;

View File

@ -180,6 +180,8 @@ ccl_device void svm_node_hair_info(KernelGlobals *kg,
}
case NODE_INFO_CURVE_INTERCEPT:
break; /* handled as attribute */
case NODE_INFO_CURVE_INDEX:
break; /* handled as attribute */
case NODE_INFO_CURVE_THICKNESS: {
data = curve_thickness(kg, sd);
stack_store_float(stack, out_offset, data);

View File

@ -176,7 +176,8 @@ typedef enum NodeHairInfo {
NODE_INFO_CURVE_THICKNESS,
/*fade for minimum hair width transpency*/
/*NODE_INFO_CURVE_FADE,*/
NODE_INFO_CURVE_TANGENT_NORMAL
NODE_INFO_CURVE_TANGENT_NORMAL,
NODE_INFO_CURVE_INDEX,
} NodeHairInfo;
typedef enum NodeLightPath {

View File

@ -267,6 +267,8 @@ const char *Attribute::standard_name(AttributeStandard std)
return "particle";
case ATTR_STD_CURVE_INTERCEPT:
return "curve_intercept";
case ATTR_STD_CURVE_INDEX:
return "curve_index";
case ATTR_STD_PTEX_FACE_ID:
return "ptex_face_id";
case ATTR_STD_PTEX_UV:
@ -451,6 +453,9 @@ Attribute *AttributeSet::add(AttributeStandard std, ustring name)
case ATTR_STD_CURVE_INTERCEPT:
attr = add(name, TypeDesc::TypeFloat, ATTR_ELEMENT_CURVE_KEY);
break;
case ATTR_STD_CURVE_INDEX:
attr = add(name, TypeDesc::TypeFloat, ATTR_ELEMENT_CURVE);
break;
case ATTR_STD_GENERATED_TRANSFORM:
attr = add(name, TypeDesc::TypeMatrix, ATTR_ELEMENT_MESH);
break;

View File

@ -3572,6 +3572,7 @@ NODE_DEFINE(HairInfoNode)
#if 0 /*output for minimum hair width transparency - deactivated */
SOCKET_OUT_FLOAT(fade, "Fade");
#endif
SOCKET_OUT_FLOAT(index, "Index");
return type;
}
@ -3588,6 +3589,9 @@ void HairInfoNode::attributes(Shader *shader, AttributeRequestSet *attributes)
if(!intercept_out->links.empty())
attributes->add(ATTR_STD_CURVE_INTERCEPT);
if(!output("Index")->links.empty())
attributes->add(ATTR_STD_CURVE_INDEX);
}
ShaderNode::attributes(shader, attributes);
@ -3623,6 +3627,11 @@ void HairInfoNode::compile(SVMCompiler& compiler)
compiler.add_node(NODE_HAIR_INFO, NODE_INFO_CURVE_FADE, compiler.stack_assign(out));
}*/
out = output("Index");
if(!out->links.empty()) {
int attr = compiler.attribute(ATTR_STD_CURVE_INDEX);
compiler.add_node(NODE_ATTR, attr, compiler.stack_assign(out), NODE_ATTR_FLOAT);
}
}
void HairInfoNode::compile(OSLCompiler& compiler)

View File

@ -126,6 +126,8 @@ void ED_object_toggle_modes(struct bContext *C, eObjectMode mode);
#define EM_WAITCURSOR 4
#define EM_DO_UNDO 8
#define EM_IGNORE_LAYER 16
void ED_object_editmode_exit_ex(
struct bContext *C, struct WorkSpace *workspace, struct Scene *scene, struct Object *obedit, int flag);
void ED_object_editmode_exit(struct bContext *C, int flag);
void ED_object_editmode_enter(struct bContext *C, int flag);
bool ED_object_editmode_load(struct Object *obedit);

View File

@ -260,18 +260,20 @@ bool ED_object_editmode_load(Object *obedit)
return ED_object_editmode_load_ex(G.main, obedit, false);
}
void ED_object_editmode_exit(bContext *C, int flag)
/**
* \param C: Can be NULL, only if #EM_DO_UNDO isn't set.
* \param flag:
* - Only in exceptional cases should #EM_DO_UNDO NOT be in the flag.
* - If #EM_FREEDATA isn't in the flag, use ED_object_editmode_load directly.
*/
void ED_object_editmode_exit_ex(bContext *C, WorkSpace *workspace, Scene *scene, Object *obedit, int flag)
{
/* Note! only in exceptional cases should 'EM_DO_UNDO' NOT be in the flag */
/* Note! if 'EM_FREEDATA' isn't in the flag, use ED_object_editmode_load directly */
WorkSpace *workspace = CTX_wm_workspace(C);
Scene *scene = CTX_data_scene(C);
Object *obedit = CTX_data_edit_object(C);
BLI_assert(C || !(flag & EM_DO_UNDO));
const bool freedata = (flag & EM_FREEDATA) != 0;
if (flag & EM_WAITCURSOR) waitcursor(1);
if (ED_object_editmode_load_ex(CTX_data_main(C), obedit, freedata) == false) {
if (ED_object_editmode_load_ex(G.main, obedit, freedata) == false) {
/* in rare cases (background mode) its possible active object
* is flagged for editmode, without 'obedit' being set [#35489] */
workspace->object_mode &= ~OB_MODE_EDIT;
@ -303,7 +305,12 @@ void ED_object_editmode_exit(bContext *C, int flag)
if (flag & EM_DO_UNDO)
ED_undo_push(C, "Editmode");
WM_event_add_notifier(C, NC_SCENE | ND_MODE | NS_MODE_OBJECT, scene);
if (C != NULL) {
WM_event_add_notifier(C, NC_SCENE | ND_MODE | NS_MODE_OBJECT, scene);
}
else {
WM_main_add_notifier(NC_SCENE | ND_MODE | NS_MODE_OBJECT, scene);
}
workspace->object_mode &= ~OB_MODE_EDIT;
}
@ -314,6 +321,13 @@ void ED_object_editmode_exit(bContext *C, int flag)
DEG_id_tag_update(&scene->id, 0);
}
void ED_object_editmode_exit(bContext *C, int flag)
{
WorkSpace *workspace = CTX_wm_workspace(C);
Scene *scene = CTX_data_scene(C);
Object *obedit = CTX_data_edit_object(C);
ED_object_editmode_exit_ex(C, workspace, scene, obedit, flag);
}
void ED_object_editmode_enter(bContext *C, int flag)
{

View File

@ -455,9 +455,18 @@ static Scene *preview_prepare_scene(Main *bmain, Scene *scene, ID *id, int id_ty
}
else {
/* use current scene world to light sphere */
if (mat->pr_type == MA_SPHERE_A) {
if (mat->pr_type == MA_SPHERE_A && sp->pr_method == PR_BUTS_RENDER) {
/* Use current scene world to light sphere. */
sce->world = preview_get_localized_world(sp, scene->world);
}
else if (sce->world) {
/* Use a default world color. Using the current
* scene world can be slow if it has big textures. */
sce->world->use_nodes = false;
sce->world->horr = 0.5f;
sce->world->horg = 0.5f;
sce->world->horb = 0.5f;
}
}
if (sp->pr_method == PR_ICON_RENDER) {
@ -466,10 +475,6 @@ static Scene *preview_prepare_scene(Main *bmain, Scene *scene, ID *id, int id_ty
}
else {
set_preview_layer(view_layer, MA_SPHERE_A);
/* same as above, use current scene world to light sphere */
if (BKE_scene_use_new_shading_nodes(scene))
sce->world = preview_get_localized_world(sp, scene->world);
}
}
else {
@ -569,6 +574,14 @@ static Scene *preview_prepare_scene(Main *bmain, Scene *scene, ID *id, int id_ty
}
else {
set_preview_layer(view_layer, MA_LAMP);
if (sce->world) {
/* Only use lighting from the lamp. */
sce->world->use_nodes = false;
sce->world->horr = 0.0f;
sce->world->horg = 0.0f;
sce->world->horb = 0.0f;
}
}
for (Base *base = view_layer->object_bases.first; base; base = base->next) {

View File

@ -33,6 +33,7 @@ static bNodeSocketTemplate outputs[] = {
{ SOCK_FLOAT, 0, N_("Thickness"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
{ SOCK_VECTOR, 0, N_("Tangent Normal"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
/*{ SOCK_FLOAT, 0, N_("Fade"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},*/
{ SOCK_FLOAT, 0, "Index" },
{ -1, 0, "" }
};

View File

@ -102,6 +102,7 @@ void register_node_type_sh_tex_environment(void)
node_type_init(&ntype, node_shader_init_tex_environment);
node_type_storage(&ntype, "NodeTexEnvironment", node_free_standard_storage, node_copy_standard_storage);
node_type_gpu(&ntype, node_shader_gpu_tex_environment);
node_type_label(&ntype, node_image_label);
nodeRegisterType(&ntype);
}

View File

@ -126,6 +126,7 @@ void register_node_type_sh_tex_image(void)
node_type_init(&ntype, node_shader_init_tex_image);
node_type_storage(&ntype, "NodeTexImage", node_free_standard_storage, node_copy_standard_storage);
node_type_gpu(&ntype, node_shader_gpu_tex_image);
node_type_label(&ntype, node_image_label);
nodeRegisterType(&ntype);
}

View File

@ -122,6 +122,13 @@ add_test(
--python-text run_tests
)
add_test(
NAME boolean
COMMAND "$<TARGET_FILE:blender>" ${TEST_BLENDER_EXE_PARAMS}
${TEST_SRC_DIR}/modeling/bool_regression.blend
--python-text run_tests
)
add_test(
NAME split_faces
COMMAND "$<TARGET_FILE:blender>" ${TEST_BLENDER_EXE_PARAMS}