Merge branch 'master' into blender2.8

This commit is contained in:
Campbell Barton 2017-10-21 12:43:17 +11:00
commit b66728d63d
26 changed files with 208 additions and 130 deletions

View File

@ -64,9 +64,9 @@ def register():
# In this example, we need to see the main render image button and
# the material preview panel.
from bl_ui import (
properties_render,
properties_material,
)
properties_render,
properties_material,
)
properties_render.RENDER_PT_render.COMPAT_ENGINES.add(CustomRenderEngine.bl_idname)
properties_material.MATERIAL_PT_preview.COMPAT_ENGINES.add(CustomRenderEngine.bl_idname)
@ -75,9 +75,9 @@ def unregister():
bpy.utils.unregister_class(CustomRenderEngine)
from bl_ui import (
properties_render,
properties_material,
)
properties_render,
properties_material,
)
properties_render.RENDER_PT_render.COMPAT_ENGINES.remove(CustomRenderEngine.bl_idname)
properties_material.MATERIAL_PT_preview.COMPAT_ENGINES.remove(CustomRenderEngine.bl_idname)

View File

@ -168,7 +168,12 @@ bool RenderBuffers::copy_from_device(Device *from_device)
bool RenderBuffers::get_denoising_pass_rect(int offset, float exposure, int sample, int components, float *pixels)
{
float scale = 1.0f/sample;
float invsample = 1.0f/sample;
float scale = invsample;
bool variance = (offset == DENOISING_PASS_NORMAL_VAR) ||
(offset == DENOISING_PASS_ALBEDO_VAR) ||
(offset == DENOISING_PASS_DEPTH_VAR) ||
(offset == DENOISING_PASS_COLOR_VAR);
if(offset == DENOISING_PASS_COLOR) {
scale *= exposure;
@ -178,24 +183,51 @@ bool RenderBuffers::get_denoising_pass_rect(int offset, float exposure, int samp
}
offset += params.get_denoising_offset();
float *in = (float*)buffer.data_pointer + offset;
int pass_stride = params.get_passes_size();
int size = params.width*params.height;
if(components == 1) {
for(int i = 0; i < size; i++, in += pass_stride, pixels++) {
pixels[0] = in[0]*scale;
if(variance) {
/* Approximate variance as E[x^2] - 1/N * (E[x])^2, since online variance
* update does not work efficiently with atomics in the kernel. */
int mean_offset = offset - components;
float *mean = (float*)buffer.data_pointer + mean_offset;
float *var = (float*)buffer.data_pointer + offset;
assert(mean_offset >= 0);
if(components == 1) {
for(int i = 0; i < size; i++, mean += pass_stride, var += pass_stride, pixels++) {
pixels[0] = max(0.0f, var[0] - mean[0]*mean[0]*invsample)*scale;
}
}
}
else if(components == 3) {
for(int i = 0; i < size; i++, in += pass_stride, pixels += 3) {
pixels[0] = in[0]*scale;
pixels[1] = in[1]*scale;
pixels[2] = in[2]*scale;
else if(components == 3) {
for(int i = 0; i < size; i++, mean += pass_stride, var += pass_stride, pixels += 3) {
pixels[0] = max(0.0f, var[0] - mean[0]*mean[0]*invsample)*scale;
pixels[1] = max(0.0f, var[1] - mean[1]*mean[1]*invsample)*scale;
pixels[2] = max(0.0f, var[2] - mean[2]*mean[2]*invsample)*scale;
}
}
else {
return false;
}
}
else {
return false;
float *in = (float*)buffer.data_pointer + offset;
if(components == 1) {
for(int i = 0; i < size; i++, in += pass_stride, pixels++) {
pixels[0] = in[0]*scale;
}
}
else if(components == 3) {
for(int i = 0; i < size; i++, in += pass_stride, pixels += 3) {
pixels[0] = in[0]*scale;
pixels[1] = in[1]*scale;
pixels[2] = in[2]*scale;
}
}
else {
return false;
}
}
return true;

View File

@ -285,10 +285,10 @@ class DATA_PT_iksolver_itasc(ArmatureButtonsPanel, Panel):
row.prop(itasc, "damping_max", text="Damp", slider=True)
row.prop(itasc, "damping_epsilon", text="Eps", slider=True)
from bl_ui.properties_animviz import (
MotionPathButtonsPanel,
OnionSkinButtonsPanel,
)
from .properties_animviz import (
MotionPathButtonsPanel,
OnionSkinButtonsPanel,
)
class DATA_PT_motion_paths(MotionPathButtonsPanel, Panel):

View File

@ -323,10 +323,10 @@ class OBJECT_PT_duplication(ObjectButtonsPanel, Panel):
layout.prop(ob, "dupli_group", text="Group")
from bl_ui.properties_animviz import (
MotionPathButtonsPanel,
OnionSkinButtonsPanel,
)
from .properties_animviz import (
MotionPathButtonsPanel,
OnionSkinButtonsPanel,
)
class OBJECT_PT_motion_paths(MotionPathButtonsPanel, Panel):

View File

@ -22,7 +22,7 @@ from bpy.types import Panel, Menu
from rna_prop_ui import PropertyPanel
from bpy.app.translations import pgettext_iface as iface_
from bl_ui.properties_physics_common import (
from .properties_physics_common import (
point_cache_ui,
effector_weights_ui,
basic_force_field_settings_ui,

View File

@ -20,10 +20,10 @@
import bpy
from bpy.types import Menu, Panel
from bl_ui.properties_physics_common import (
point_cache_ui,
effector_weights_ui,
)
from .properties_physics_common import (
point_cache_ui,
effector_weights_ui,
)
def cloth_panel_enabled(md):

View File

@ -20,10 +20,10 @@
import bpy
from bpy.types import Panel, UIList
from bl_ui.properties_physics_common import (
point_cache_ui,
effector_weights_ui,
)
from .properties_physics_common import (
point_cache_ui,
effector_weights_ui,
)
class PHYSICS_UL_dynapaint_surfaces(UIList):

View File

@ -20,10 +20,10 @@
import bpy
from bpy.types import Panel
from bl_ui.properties_physics_common import (
basic_force_field_settings_ui,
basic_force_field_falloff_ui,
)
from .properties_physics_common import (
basic_force_field_settings_ui,
basic_force_field_falloff_ui,
)
class PhysicButtonsPanel:

View File

@ -20,7 +20,7 @@
import bpy
from bpy.types import Panel
from bl_ui.properties_physics_common import (
from .properties_physics_common import (
point_cache_ui,
effector_weights_ui,
)

View File

@ -20,10 +20,10 @@
import bpy
from bpy.types import Panel
from bl_ui.properties_physics_common import (
point_cache_ui,
effector_weights_ui,
)
from .properties_physics_common import (
point_cache_ui,
effector_weights_ui,
)
COMPAT_OB_TYPES = {'MESH', 'LATTICE', 'CURVE', 'SURFACE', 'FONT'}

View File

@ -26,10 +26,10 @@ from bpy.types import (
from rna_prop_ui import PropertyPanel
from bl_ui.properties_physics_common import (
point_cache_ui,
effector_weights_ui,
)
from .properties_physics_common import (
point_cache_ui,
effector_weights_ui,
)
class SCENE_MT_units_length_presets(Menu):

View File

@ -33,7 +33,7 @@ from bpy.types import (
from rna_prop_ui import PropertyPanel
from bl_ui.properties_paint_common import brush_texture_settings
from .properties_paint_common import brush_texture_settings
class TEXTURE_MT_specials(Menu):
@ -78,7 +78,7 @@ class TEXTURE_UL_texslots(UIList):
layout.label(text="", icon_value=icon)
from bl_ui.properties_material import active_node_mat
from .properties_material import active_node_mat
def context_tex_datablock(context):

View File

@ -21,14 +21,15 @@
import bpy
from bpy.types import Panel, Header, Menu, UIList
from bpy.app.translations import pgettext_iface as iface_
from bl_ui.properties_grease_pencil_common import (
GreasePencilDrawingToolsPanel,
GreasePencilStrokeEditPanel,
GreasePencilStrokeSculptPanel,
GreasePencilBrushPanel,
GreasePencilBrushCurvesPanel,
GreasePencilDataPanel,
GreasePencilPaletteColorPanel)
from .properties_grease_pencil_common import (
GreasePencilDrawingToolsPanel,
GreasePencilStrokeEditPanel,
GreasePencilStrokeSculptPanel,
GreasePencilBrushPanel,
GreasePencilBrushCurvesPanel,
GreasePencilDataPanel,
GreasePencilPaletteColorPanel,
)
class CLIP_UL_tracking_objects(UIList):
@ -1045,16 +1046,16 @@ class CLIP_PT_proxy(CLIP_PT_clip_view_panel, Panel):
# -----------------------------------------------------------------------------
# Mask (similar code in space_image.py, keep in sync)
from bl_ui.properties_mask_common import (
MASK_PT_mask,
MASK_PT_layers,
MASK_PT_spline,
MASK_PT_point,
MASK_PT_display,
MASK_PT_tools,
MASK_PT_transforms,
MASK_PT_add,
)
from .properties_mask_common import (
MASK_PT_mask,
MASK_PT_layers,
MASK_PT_spline,
MASK_PT_point,
MASK_PT_display,
MASK_PT_tools,
MASK_PT_transforms,
MASK_PT_add,
)
class CLIP_PT_mask_layers(MASK_PT_layers, Panel):

View File

@ -285,7 +285,7 @@ class DOPESHEET_MT_marker(Menu):
def draw(self, context):
layout = self.layout
from bl_ui.space_time import marker_menu_generic
from .space_time import marker_menu_generic
marker_menu_generic(layout)
st = context.space_data

View File

@ -26,7 +26,7 @@ class GRAPH_HT_header(Header):
bl_space_type = 'GRAPH_EDITOR'
def draw(self, context):
from bl_ui.space_dopesheet import dopesheet_filter
from .space_dopesheet import dopesheet_filter
layout = self.layout
toolsettings = context.tool_settings
@ -186,7 +186,7 @@ class GRAPH_MT_marker(Menu):
def draw(self, context):
layout = self.layout
from bl_ui.space_time import marker_menu_generic
from .space_time import marker_menu_generic
marker_menu_generic(layout)
# TODO: pose markers for action edit mode only?

View File

@ -20,21 +20,21 @@
import bpy
import math
from bpy.types import Header, Menu, Panel
from bl_ui.properties_paint_common import (
UnifiedPaintPanel,
brush_texture_settings,
brush_texpaint_common,
brush_mask_texture_settings,
)
from bl_ui.properties_grease_pencil_common import (
GreasePencilDrawingToolsPanel,
GreasePencilStrokeEditPanel,
GreasePencilStrokeSculptPanel,
GreasePencilBrushPanel,
GreasePencilBrushCurvesPanel,
GreasePencilDataPanel,
GreasePencilPaletteColorPanel
)
from .properties_paint_common import (
UnifiedPaintPanel,
brush_texture_settings,
brush_texpaint_common,
brush_mask_texture_settings,
)
from .properties_grease_pencil_common import (
GreasePencilDrawingToolsPanel,
GreasePencilStrokeEditPanel,
GreasePencilStrokeSculptPanel,
GreasePencilBrushPanel,
GreasePencilBrushCurvesPanel,
GreasePencilDataPanel,
GreasePencilPaletteColorPanel,
)
from bpy.app.translations import pgettext_iface as iface_
@ -545,14 +545,14 @@ class MASK_MT_editor_menus(Menu):
# Mask (similar code in space_clip.py, keep in sync)
# note! - panel placement does _not_ fit well with image panels... need to fix
from bl_ui.properties_mask_common import (
MASK_PT_mask,
MASK_PT_layers,
MASK_PT_spline,
MASK_PT_point,
MASK_PT_display,
MASK_PT_tools,
)
from .properties_mask_common import (
MASK_PT_mask,
MASK_PT_layers,
MASK_PT_spline,
MASK_PT_point,
MASK_PT_display,
MASK_PT_tools,
)
class IMAGE_PT_mask(MASK_PT_mask, Panel):

View File

@ -26,7 +26,7 @@ class NLA_HT_header(Header):
bl_space_type = 'NLA_EDITOR'
def draw(self, context):
from bl_ui.space_dopesheet import dopesheet_filter
from .space_dopesheet import dopesheet_filter
layout = self.layout
@ -124,7 +124,7 @@ class NLA_MT_marker(Menu):
def draw(self, context):
layout = self.layout
from bl_ui.space_time import marker_menu_generic
from .space_time import marker_menu_generic
marker_menu_generic(layout)

View File

@ -21,16 +21,16 @@ import bpy
import nodeitems_utils
from bpy.types import Header, Menu, Panel
from bpy.app.translations import pgettext_iface as iface_
from bl_ui.properties_grease_pencil_common import (
GreasePencilDrawingToolsPanel,
GreasePencilStrokeEditPanel,
GreasePencilStrokeSculptPanel,
GreasePencilBrushPanel,
GreasePencilBrushCurvesPanel,
GreasePencilDataPanel,
GreasePencilPaletteColorPanel,
GreasePencilToolsPanel
)
from .properties_grease_pencil_common import (
GreasePencilDrawingToolsPanel,
GreasePencilStrokeEditPanel,
GreasePencilStrokeSculptPanel,
GreasePencilBrushPanel,
GreasePencilBrushCurvesPanel,
GreasePencilDataPanel,
GreasePencilPaletteColorPanel,
GreasePencilToolsPanel
)
class NODE_HT_header(Header):

View File

@ -20,7 +20,7 @@
import bpy
from bpy.types import Header, Menu, Panel
from rna_prop_ui import PropertyPanel
from bl_ui.properties_grease_pencil_common import (
from .properties_grease_pencil_common import (
GreasePencilDataPanel,
GreasePencilPaletteColorPanel,
GreasePencilToolsPanel,
@ -276,7 +276,7 @@ class SEQUENCER_MT_marker(Menu):
def draw(self, context):
layout = self.layout
from bl_ui.space_time import marker_menu_generic
from .space_time import marker_menu_generic
marker_menu_generic(layout)
@ -1166,7 +1166,7 @@ class SEQUENCER_PT_view_safe_areas(SequencerButtonsPanel_Output, Panel):
self.layout.prop(st, "show_safe_areas", text="")
def draw(self, context):
from bl_ui.properties_data_camera import draw_display_safe_settings
from .properties_data_camera import draw_display_safe_settings
layout = self.layout
st = context.space_data

View File

@ -19,11 +19,11 @@
# <pep8 compliant>
import bpy
from bpy.types import Header, Menu, Panel
from bl_ui.properties_grease_pencil_common import (
from .properties_grease_pencil_common import (
GreasePencilDataPanel,
GreasePencilPaletteColorPanel,
)
from bl_ui.properties_paint_common import UnifiedPaintPanel
from .properties_paint_common import UnifiedPaintPanel
from bpy.app.translations import contexts as i18n_contexts

View File

@ -19,20 +19,20 @@
# <pep8 compliant>
import bpy
from bpy.types import Menu, Panel, UIList
from bl_ui.properties_grease_pencil_common import (
GreasePencilDrawingToolsPanel,
GreasePencilStrokeEditPanel,
GreasePencilInterpolatePanel,
GreasePencilStrokeSculptPanel,
GreasePencilBrushPanel,
GreasePencilBrushCurvesPanel
)
from bl_ui.properties_paint_common import (
UnifiedPaintPanel,
brush_texture_settings,
brush_texpaint_common,
brush_mask_texture_settings,
)
from .properties_grease_pencil_common import (
GreasePencilDrawingToolsPanel,
GreasePencilStrokeEditPanel,
GreasePencilInterpolatePanel,
GreasePencilStrokeSculptPanel,
GreasePencilBrushPanel,
GreasePencilBrushCurvesPanel
)
from .properties_paint_common import (
UnifiedPaintPanel,
brush_texture_settings,
brush_texpaint_common,
brush_mask_texture_settings,
)
class View3DPanel:

View File

@ -40,6 +40,9 @@ struct bAction;
struct Scene;
struct Speaker;
struct PointerRNA;
struct PropertyRNA;
/* ----------------------------- */
/* Data Management */
@ -103,6 +106,8 @@ bool BKE_nlatrack_has_animated_strips(struct NlaTrack *nlt);
bool BKE_nlatracks_have_animated_strips(ListBase *tracks);
void BKE_nlastrip_validate_fcurves(struct NlaStrip *strip);
bool BKE_nlastrip_has_curves_for_property(const struct PointerRNA *ptr, const struct PropertyRNA *prop);
void BKE_nla_validate_state(struct AnimData *adt);
/* ............ */

View File

@ -61,6 +61,7 @@
#include "BKE_curve.h"
#include "BKE_global.h"
#include "BKE_object.h"
#include "BKE_nla.h"
#include "RNA_access.h"
@ -335,7 +336,7 @@ FCurve *rna_get_fcurve_context_ui(
if (r_action) *r_action = NULL;
/* Special case for NLA Control Curves... */
if (ptr->type == &RNA_NlaStrip) {
if (BKE_nlastrip_has_curves_for_property(ptr, prop)) {
NlaStrip *strip = (NlaStrip *)ptr->data;
/* Set the special flag, since it cannot be a normal action/driver

View File

@ -1417,6 +1417,40 @@ void BKE_nlastrip_validate_fcurves(NlaStrip *strip)
}
}
/* Check if the given RNA pointer + property combo should be handled by
* NLA strip curves or not.
*/
bool BKE_nlastrip_has_curves_for_property(const PointerRNA *ptr, const PropertyRNA *prop)
{
/* sanity checks */
if (ELEM(NULL, ptr, prop))
return false;
/* 1) Must be NLA strip */
if (ptr->type == &RNA_NlaStrip) {
/* 2) Must be one of the predefined properties */
static PropertyRNA *prop_influence = NULL;
static PropertyRNA *prop_time = NULL;
static bool needs_init = true;
/* Init the properties on first use */
if (needs_init) {
prop_influence = RNA_struct_type_find_property(&RNA_NlaStrip, "influence");
prop_time = RNA_struct_type_find_property(&RNA_NlaStrip, "strip_time");
needs_init = false;
}
/* Check if match */
if (ELEM(prop, prop_influence, prop_time)) {
return true;
}
}
/* No criteria met */
return false;
}
/* Sanity Validation ------------------------------------ */
static bool nla_editbone_name_check(void *arg, const char *name)

View File

@ -1791,6 +1791,10 @@ static int insert_key_button_exec(bContext *C, wmOperator *op)
if (fcu) {
success = insert_keyframe_direct(op->reports, ptr, prop, fcu, cfra, ts->keyframe_type, 0);
}
else {
BKE_report(op->reports, RPT_ERROR,
"This property cannot be animated as it will not get updated correctly");
}
}
else if (UI_but_flag_is_set(but, UI_BUT_DRIVEN)) {
/* Driven property - Find driver */
@ -1886,7 +1890,7 @@ static int delete_key_button_exec(bContext *C, wmOperator *op)
}
if (ptr.id.data && ptr.data && prop) {
if (ptr.type == &RNA_NlaStrip) {
if (BKE_nlastrip_has_curves_for_property(&ptr, prop)) {
/* Handle special properties for NLA Strips, whose F-Curves are stored on the
* strips themselves. These are stored separately or else the properties will
* not have any effect.

View File

@ -183,13 +183,14 @@ void node_verify_socket_templates(bNodeTree *ntree, bNode *node)
{
bNodeType *ntype = node->typeinfo;
/* Don't try to match socket lists when there are no templates.
* This prevents group node sockets from being removed, without the need to explicitly
* check the node type here.
* This prevents dynamically generated sockets to be removed, like for
* group, image or render layer nodes. We have an explicit check for the
* render layer node since it still has fixed sockets too.
*/
if (ntype) {
if (ntype->inputs && ntype->inputs[0].type >= 0)
verify_socket_template_list(ntree, node, SOCK_IN, &node->inputs, ntype->inputs);
if (ntype->outputs && ntype->outputs[0].type >= 0)
if (ntype->outputs && ntype->outputs[0].type >= 0 && node->type != CMP_NODE_R_LAYERS)
verify_socket_template_list(ntree, node, SOCK_OUT, &node->outputs, ntype->outputs);
}
}