Merge branch 'master' into blender2.8

This commit is contained in:
2017-11-23 19:16:11 +01:00
8 changed files with 59 additions and 37 deletions

View File

@@ -46,7 +46,10 @@ ccl_device float svm_gradient(float3 p, NodeGradientType type)
return atan2f(y, x) / M_2PI_F + 0.5f;
}
else {
float r = fmaxf(1.0f - sqrtf(x*x + y*y + z*z), 0.0f);
/* Bias a little bit for the case where p is a unit length vector,
* to get exactly zero instead of a small random value depending
* on float precision. */
float r = fmaxf(0.999999f - sqrtf(x*x + y*y + z*z), 0.0f);
if(type == NODE_BLEND_QUADRATIC_SPHERE)
return r*r;

View File

@@ -236,10 +236,17 @@ bool RenderBuffers::get_pass_rect(PassType type, float exposure, int sample, int
int size = params.width*params.height;
if(components == 1) {
if(components == 1 && type == PASS_RENDER_TIME) {
/* Render time is not stored by kernel, but measured per tile. */
float val = (float) (1000.0 * render_time/(params.width * params.height * sample));
for(int i = 0; i < size; i++, pixels++) {
pixels[0] = val;
}
}
else if(components == 1) {
assert(pass.components == components);
/* scalar */
/* Scalar */
if(type == PASS_DEPTH) {
for(int i = 0; i < size; i++, in += pass_stride, pixels++) {
float f = *in;
@@ -264,12 +271,6 @@ bool RenderBuffers::get_pass_rect(PassType type, float exposure, int sample, int
}
}
#endif
else if(type == PASS_RENDER_TIME) {
float val = (float) (1000.0 * render_time/(params.width * params.height * sample));
for(int i = 0; i < size; i++, pixels++) {
pixels[0] = val;
}
}
else {
for(int i = 0; i < size; i++, in += pass_stride, pixels++) {
float f = *in;

View File

@@ -480,19 +480,19 @@ class RENDER_PT_encoding(RenderButtonsPanel, Panel):
pbox.prop(ffmpeg, "max_b_frames", text="")
pbox.enabled = ffmpeg.use_max_b_frames
split = layout.split()
split.enabled = ffmpeg.constant_rate_factor == 'NONE'
col = split.column()
col.label(text="Rate:")
col.prop(ffmpeg, "video_bitrate")
col.prop(ffmpeg, "minrate", text="Minimum")
col.prop(ffmpeg, "maxrate", text="Maximum")
col.prop(ffmpeg, "buffersize", text="Buffer")
if ffmpeg.constant_rate_factor == 'NONE':
split = layout.split()
col = split.column()
col.label(text="Rate:")
col.prop(ffmpeg, "video_bitrate")
col.prop(ffmpeg, "minrate", text="Minimum")
col.prop(ffmpeg, "maxrate", text="Maximum")
col.prop(ffmpeg, "buffersize", text="Buffer")
col = split.column()
col.label(text="Mux:")
col.prop(ffmpeg, "muxrate", text="Rate")
col.prop(ffmpeg, "packetsize", text="Packet Size")
col = split.column()
col.label(text="Mux:")
col.prop(ffmpeg, "muxrate", text="Rate")
col.prop(ffmpeg, "packetsize", text="Packet Size")
layout.separator()
@@ -500,10 +500,10 @@ class RENDER_PT_encoding(RenderButtonsPanel, Panel):
if ffmpeg.format != 'MP3':
layout.prop(ffmpeg, "audio_codec", text="Audio Codec")
row = layout.row()
row.enabled = ffmpeg.audio_codec != 'NONE'
row.prop(ffmpeg, "audio_bitrate")
row.prop(ffmpeg, "audio_volume", slider=True)
if ffmpeg.audio_codec != 'NONE':
row = layout.row()
row.prop(ffmpeg, "audio_bitrate")
row.prop(ffmpeg, "audio_volume", slider=True)
class RENDER_PT_bake(RenderButtonsPanel, Panel):

View File

@@ -1554,18 +1554,21 @@ class VIEW3D_MT_object_specials(Menu):
use_shading_nodes = context.view_render.use_shading_nodes
if use_shading_nodes:
try:
value = lamp.node_tree.nodes["Emission"].inputs["Strength"].default_value
except AttributeError:
value = None
emission_node = None
if lamp.node_tree:
for node in lamp.node_tree.nodes:
if getattr(node, "type", None) == 'EMISSION':
emission_node = node
break
if value is not None:
if emission_node is not None:
props = layout.operator("wm.context_modal_mouse", text="Strength")
props.data_path_iter = "selected_editable_objects"
props.data_path_item = "data.node_tree.nodes[\"Emission\"].inputs[\"Strength\"].default_value"
props.data_path_item = "data.node_tree" \
".nodes[\"" + emission_node.name + "\"]" \
".inputs[\"Strength\"].default_value"
props.header_text = "Lamp Strength: %.3f"
props.input_scale = 0.1
del value
if lamp.type == 'AREA':
props = layout.operator("wm.context_modal_mouse", text="Size X")

View File

@@ -3348,7 +3348,10 @@ float calc_gradient(vec3 p, int gradient_type)
return atan(y, x) / (M_PI * 2) + 0.5;
}
else {
float r = max(1.0 - sqrt(x * x + y * y + z * z), 0.0);
/* Bias a little bit for the case where p is a unit length vector,
* to get exactly zero instead of a small random value depending
* on float precision. */
float r = max(0.999999 - sqrt(x * x + y * y + z * z), 0.0);
if (gradient_type == 5) { /* quadratic sphere */
return r * r;
}

View File

@@ -5245,7 +5245,7 @@ static void rna_def_scene_ffmpeg_settings(BlenderRNA *brna)
};
static const EnumPropertyItem ffmpeg_crf_items[] = {
{FFM_CRF_NONE, "NONE", 0, "None; use constant bit-rate",
{FFM_CRF_NONE, "NONE", 0, "None; use custom bitrate",
"Use constant bit rate, rather than constant output quality"},
{FFM_CRF_LOSSLESS, "LOSSLESS", 0, "Lossless", ""},
{FFM_CRF_PERC_LOSSLESS, "PERC_LOSSLESS", 0, "Perceptually lossless", ""},

View File

@@ -348,7 +348,9 @@ static void ntree_shader_link_builtin_group_normal(
* some internal re-linking in order to avoid cycles.
*/
bNode *group_output_node = ntreeFindType(group_ntree, NODE_GROUP_OUTPUT);
BLI_assert(group_output_node != NULL);
if (group_output_node == NULL) {
return;
}
bNodeSocket *group_output_node_displacement_socket =
nodeFindSocket(group_output_node,
SOCK_IN,

View File

@@ -921,6 +921,17 @@ bool RE_WriteRenderResult(ReportList *reports, RenderResult *rr, const char *fil
}
}
/* We only store RGBA passes as half float, for
* others precision loss can be problematic. */
bool pass_half_float = half_float &&
(STREQ(rp->chan_id, "RGB") ||
STREQ(rp->chan_id, "RGBA") ||
STREQ(rp->chan_id, "R") ||
STREQ(rp->chan_id, "G") ||
STREQ(rp->chan_id, "B") ||
STREQ(rp->chan_id, "A"));
for (int a = 0; a < rp->channels; a++) {
/* Save Combined as RGBA if single layer save. */
char passname[EXR_PASS_MAXNAME];
@@ -936,10 +947,9 @@ bool RE_WriteRenderResult(ReportList *reports, RenderResult *rr, const char *fil
layname[0] = '\0';
}
/* Add channel. */
IMB_exr_add_channel(exrhandle, layname, passname, viewname,
rp->channels, rp->channels * rr->rectx, rp->rect + a,
STREQ(rp->name, RE_PASSNAME_Z) ? false : half_float);
pass_half_float);
}
}
}