diff options
Diffstat (limited to 'source/blender')
12 files changed, 38 insertions, 33 deletions
diff --git a/source/blender/blenkernel/intern/library_query.c b/source/blender/blenkernel/intern/library_query.c index 4074e0f0dc6..317f743acf1 100644 --- a/source/blender/blenkernel/intern/library_query.c +++ b/source/blender/blenkernel/intern/library_query.c @@ -1094,7 +1094,7 @@ bool BKE_library_id_can_use_idtype(ID *id_owner, const short id_type_used) return true; #endif case ID_ME: - return ELEM(id_type_used, ID_ME, ID_KE, ID_MA); + return ELEM(id_type_used, ID_ME, ID_KE, ID_MA, ID_IM); case ID_CU: return ELEM(id_type_used, ID_OB, ID_KE, ID_MA, ID_VF); case ID_MB: diff --git a/source/blender/blenkernel/intern/node.c b/source/blender/blenkernel/intern/node.c index b76fd49fc9c..ab9e2665ff0 100644 --- a/source/blender/blenkernel/intern/node.c +++ b/source/blender/blenkernel/intern/node.c @@ -3173,13 +3173,17 @@ void nodeSynchronizeID(bNode *node, bool copy_to_id) void nodeLabel(bNodeTree *ntree, bNode *node, char *label, int maxlen) { + label[0] = '\0'; + if (node->label[0] != '\0') { BLI_strncpy(label, node->label, maxlen); } else if (node->typeinfo->labelfunc) { node->typeinfo->labelfunc(ntree, node, label, maxlen); } - else { + + /* The previous methods (labelfunc) could not provide an adequate label for the node. */ + if (label[0] == '\0') { /* Kind of hacky and weak... Ideally would be better to use RNA here. :| */ const char *tmp = CTX_IFACE_(BLT_I18NCONTEXT_ID_NODETREE, node->typeinfo->ui_name); if (tmp == node->typeinfo->ui_name) { diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index dcd993838e6..8c5e947d004 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -4119,10 +4119,6 @@ static void lib_link_material(FileData *fd, Main *main) IDP_LibLinkProperty(ma->id.properties, fd); lib_link_animdata(fd, &ma->id, ma->adt); - /* Link ID Properties -- and copy this comment EXACTLY for easy finding - * of library blocks that implement this.*/ - IDP_LibLinkProperty(ma->id.properties, fd); - ma->ipo = newlibadr_us(fd, ma->id.lib, ma->ipo); // XXX deprecated - old animation system ma->group = newlibadr_us(fd, ma->id.lib, ma->group); diff --git a/source/blender/compositor/nodes/COM_LuminanceMatteNode.cpp b/source/blender/compositor/nodes/COM_LuminanceMatteNode.cpp index 382296a7f3a..de6ad3df030 100644 --- a/source/blender/compositor/nodes/COM_LuminanceMatteNode.cpp +++ b/source/blender/compositor/nodes/COM_LuminanceMatteNode.cpp @@ -37,14 +37,11 @@ void LuminanceMatteNode::convertToOperations(NodeConverter &converter, const Com NodeOutput *outputSocketImage = this->getOutputSocket(0); NodeOutput *outputSocketMatte = this->getOutputSocket(1); - ConvertRGBToYUVOperation *rgbToYUV = new ConvertRGBToYUVOperation(); LuminanceMatteOperation *operationSet = new LuminanceMatteOperation(); operationSet->setSettings((NodeChroma *)editorsnode->storage); - converter.addOperation(rgbToYUV); converter.addOperation(operationSet); - converter.mapInputSocket(inputSocket, rgbToYUV->getInputSocket(0)); - converter.addLink(rgbToYUV->getOutputSocket(), operationSet->getInputSocket(0)); + converter.mapInputSocket(inputSocket, operationSet->getInputSocket(0)); converter.mapOutputSocket(outputSocketMatte, operationSet->getOutputSocket(0)); SetAlphaOperation *operation = new SetAlphaOperation(); diff --git a/source/blender/compositor/operations/COM_LuminanceMatteOperation.cpp b/source/blender/compositor/operations/COM_LuminanceMatteOperation.cpp index 3be5447db3b..1401ab56fbd 100644 --- a/source/blender/compositor/operations/COM_LuminanceMatteOperation.cpp +++ b/source/blender/compositor/operations/COM_LuminanceMatteOperation.cpp @@ -22,6 +22,10 @@ #include "COM_LuminanceMatteOperation.h" #include "BLI_math.h" +extern "C" { +#include "IMB_colormanagement.h" +} + LuminanceMatteOperation::LuminanceMatteOperation() : NodeOperation() { addInputSocket(COM_DT_COLOR); @@ -43,41 +47,34 @@ void LuminanceMatteOperation::deinitExecution() void LuminanceMatteOperation::executePixelSampled(float output[4], float x, float y, PixelSampler sampler) { float inColor[4]; + this->m_inputImageProgram->readSampled(inColor, x, y, sampler); const float high = this->m_settings->t1; const float low = this->m_settings->t2; + const float luminance = IMB_colormanagement_get_luminance(inColor); float alpha; - - this->m_inputImageProgram->readSampled(inColor, x, y, sampler); /* one line thread-friend algorithm: - * output[0] = max(inputValue[3], min(high, max(low, ((inColor[0] - low) / (high - low)))); + * output[0] = min(inputValue[3], min(1.0f, max(0.0f, ((luminance - low) / (high - low)))); */ /* test range */ - if (inColor[0] > high) { + if (luminance > high) { alpha = 1.0f; } - else if (inColor[0] < low) { + else if (luminance < low) { alpha = 0.0f; } else { /*blend */ - alpha = (inColor[0] - low) / (high - low); + alpha = (luminance - low) / (high - low); } - /* store matte(alpha) value in [0] to go with * COM_SetAlphaOperation and the Value output */ /* don't make something that was more transparent less transparent */ - if (alpha < inColor[3]) { - output[0] = alpha; - } - else { - /* leave now it was before */ - output[0] = inColor[3]; - } + output[0] = min_ff(alpha, inColor[3]); } diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c index ab8370f77e7..2b2c6998eb4 100644 --- a/source/blender/makesrna/intern/rna_nodetree.c +++ b/source/blender/makesrna/intern/rna_nodetree.c @@ -5286,14 +5286,14 @@ static void def_cmp_luma_matte(StructRNA *srna) prop = RNA_def_property(srna, "limit_max", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "t1"); RNA_def_property_float_funcs(prop, NULL, "rna_Matte_t1_set", NULL); - RNA_def_property_range(prop, 0.0f, 1.0f); + RNA_def_property_ui_range(prop, 0, 1, 0.1f, 3); RNA_def_property_ui_text(prop, "High", "Values higher than this setting are 100% opaque"); RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update"); prop = RNA_def_property(srna, "limit_min", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "t2"); RNA_def_property_float_funcs(prop, NULL, "rna_Matte_t2_set", NULL); - RNA_def_property_range(prop, 0.0f, 1.0f); + RNA_def_property_ui_range(prop, 0, 1, 0.1f, 3); RNA_def_property_ui_text(prop, "Low", "Values lower than this setting are 100% keyed"); RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update"); } @@ -5396,14 +5396,14 @@ static void def_cmp_channel_matte(StructRNA *srna) prop = RNA_def_property(srna, "limit_max", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "t1"); RNA_def_property_float_funcs(prop, NULL, "rna_Matte_t1_set", NULL); - RNA_def_property_range(prop, 0.0f, 1.0f); + RNA_def_property_ui_range(prop, 0, 1, 0.1f, 3); RNA_def_property_ui_text(prop, "High", "Values higher than this setting are 100% opaque"); RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update"); prop = RNA_def_property(srna, "limit_min", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "t2"); RNA_def_property_float_funcs(prop, NULL, "rna_Matte_t2_set", NULL); - RNA_def_property_range(prop, 0.0f, 1.0f); + RNA_def_property_ui_range(prop, 0, 1, 0.1f, 3); RNA_def_property_ui_text(prop, "Low", "Values lower than this setting are 100% keyed"); RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update"); } diff --git a/source/blender/makesrna/intern/rna_object_force.c b/source/blender/makesrna/intern/rna_object_force.c index 031b0bdec99..9265c7b62cf 100644 --- a/source/blender/makesrna/intern/rna_object_force.c +++ b/source/blender/makesrna/intern/rna_object_force.c @@ -1265,7 +1265,8 @@ static void rna_def_field(BlenderRNA *brna) prop = RNA_def_property(srna, "size", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "f_size"); - RNA_def_property_range(prop, 0.0f, 10.0f); + RNA_def_property_range(prop, 0.0f, FLT_MAX); + RNA_def_property_ui_range(prop, 0.0f, 10.0f, 1.0f, 3); RNA_def_property_ui_text(prop, "Size", "Size of the turbulence"); RNA_def_property_update(prop, 0, "rna_FieldSettings_update"); @@ -1289,7 +1290,8 @@ static void rna_def_field(BlenderRNA *brna) prop = RNA_def_property(srna, "distance_max", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "maxdist"); - RNA_def_property_range(prop, 0.0f, 1000.0f); + RNA_def_property_range(prop, 0.0f, FLT_MAX); + RNA_def_property_ui_range(prop, 0.0f, 1000.0f, 1.0f, 3); RNA_def_property_ui_text(prop, "Maximum Distance", "Maximum distance for the field to work"); RNA_def_property_update(prop, 0, "rna_FieldSettings_update"); diff --git a/source/blender/nodes/composite/nodes/node_composite_hueSatVal.c b/source/blender/nodes/composite/nodes/node_composite_hueSatVal.c index 952ba78aff3..124e33d186f 100644 --- a/source/blender/nodes/composite/nodes/node_composite_hueSatVal.c +++ b/source/blender/nodes/composite/nodes/node_composite_hueSatVal.c @@ -37,8 +37,8 @@ static bNodeSocketTemplate cmp_node_hue_sat_in[] = { { SOCK_RGBA, 1, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, { SOCK_FLOAT, 1, N_("Hue"), 0.5f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR}, - { SOCK_FLOAT, 1, N_("Saturation"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR}, - { SOCK_FLOAT, 1, N_("Value"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR}, + { SOCK_FLOAT, 1, N_("Saturation"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 2.0f, PROP_FACTOR}, + { SOCK_FLOAT, 1, N_("Value"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 2.0f, PROP_FACTOR}, { SOCK_FLOAT, 1, N_("Fac"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR}, { -1, 0, "" } }; diff --git a/source/blender/nodes/composite/nodes/node_composite_image.c b/source/blender/nodes/composite/nodes/node_composite_image.c index bd7c4df317f..7712d7d0e71 100644 --- a/source/blender/nodes/composite/nodes/node_composite_image.c +++ b/source/blender/nodes/composite/nodes/node_composite_image.c @@ -341,6 +341,7 @@ void register_node_type_cmp_image(void) node_type_init(&ntype, node_composit_init_image); node_type_storage(&ntype, "ImageUser", node_composit_free_image, node_composit_copy_image); node_type_update(&ntype, cmp_node_image_update, NULL); + node_type_label(&ntype, node_image_label); nodeRegisterType(&ntype); } diff --git a/source/blender/nodes/intern/node_util.c b/source/blender/nodes/intern/node_util.c index dd5715891d5..43d4136d556 100644 --- a/source/blender/nodes/intern/node_util.c +++ b/source/blender/nodes/intern/node_util.c @@ -91,6 +91,12 @@ void node_blend_label(bNodeTree *UNUSED(ntree), bNode *node, char *label, int ma BLI_strncpy(label, IFACE_(name), maxlen); } +void node_image_label(bNodeTree *UNUSED(ntree), bNode *node, char *label, int maxlen) +{ + /* if there is no loaded image, return an empty string, and let nodeLabel() fill in the proper type translation. */ + BLI_strncpy(label, (node->id) ? node->id->name + 2 : "", maxlen); +} + void node_math_label(bNodeTree *UNUSED(ntree), bNode *node, char *label, int maxlen) { const char *name; diff --git a/source/blender/nodes/intern/node_util.h b/source/blender/nodes/intern/node_util.h index 2e20a8e79d4..b4437dfcb78 100644 --- a/source/blender/nodes/intern/node_util.h +++ b/source/blender/nodes/intern/node_util.h @@ -72,6 +72,7 @@ extern void *node_initexec_curves(struct bNodeExecContext *context, struct bNode /**** Labels ****/ void node_blend_label(struct bNodeTree *ntree, struct bNode *node, char *label, int maxlen); +void node_image_label(struct bNodeTree *ntree, struct bNode *node, char *label, int maxlen); void node_math_label(struct bNodeTree *ntree, struct bNode *node, char *label, int maxlen); void node_vect_math_label(struct bNodeTree *ntree, struct bNode *node, char *label, int maxlen); void node_filter_label(struct bNodeTree *ntree, struct bNode *node, char *label, int maxlen); diff --git a/source/blender/nodes/texture/nodes/node_texture_image.c b/source/blender/nodes/texture/nodes/node_texture_image.c index 9b13589f3e1..8e9821c0fcb 100644 --- a/source/blender/nodes/texture/nodes/node_texture_image.c +++ b/source/blender/nodes/texture/nodes/node_texture_image.c @@ -106,6 +106,7 @@ void register_node_type_tex_image(void) node_type_init(&ntype, init); node_type_storage(&ntype, "ImageUser", node_free_standard_storage, node_copy_standard_storage); node_type_exec(&ntype, NULL, NULL, exec); - + node_type_label(&ntype, node_image_label); + nodeRegisterType(&ntype); } |