svn merge ^/trunk/blender -r48147:48153
This commit is contained in:
@@ -277,7 +277,7 @@ static void xml_read_integrator(const XMLReadState& state, pugi::xml_node node)
|
||||
|
||||
xml_read_bool(&integrator->transparent_shadows, node, "transparent_shadows");
|
||||
xml_read_bool(&integrator->no_caustics, node, "no_caustics");
|
||||
xml_read_float(&integrator->blur_glossy, node, "blur_glossy");
|
||||
xml_read_float(&integrator->filter_glossy, node, "blur_glossy");
|
||||
|
||||
xml_read_int(&integrator->seed, node, "seed");
|
||||
xml_read_float(&integrator->sample_clamp, node, "sample_clamp");
|
||||
|
||||
@@ -23,6 +23,7 @@ from bpy.types import Menu, Panel
|
||||
from bpy.types import (Brush,
|
||||
Lamp,
|
||||
Material,
|
||||
Object,
|
||||
ParticleSettings,
|
||||
Texture,
|
||||
World)
|
||||
@@ -80,6 +81,15 @@ def context_tex_datablock(context):
|
||||
return idblock
|
||||
|
||||
|
||||
def id_tex_datablock(bid):
|
||||
if isinstance(bid, Object):
|
||||
if bid.type == 'LAMP':
|
||||
return bid.data
|
||||
return bid.active_material
|
||||
|
||||
return bid
|
||||
|
||||
|
||||
class TextureButtonsPanel():
|
||||
bl_space_type = 'PROPERTIES'
|
||||
bl_region_type = 'WINDOW'
|
||||
@@ -114,7 +124,7 @@ class TEXTURE_PT_context_texture(TextureButtonsPanel, Panel):
|
||||
pin_id = space.pin_id
|
||||
|
||||
if space.use_pin_id and not isinstance(pin_id, Texture):
|
||||
idblock = pin_id
|
||||
idblock = id_tex_datablock(pin_id)
|
||||
pin_id = None
|
||||
|
||||
if not space.use_pin_id:
|
||||
|
||||
@@ -42,7 +42,7 @@ extern "C" {
|
||||
* and keep comment above the defines.
|
||||
* Use STRINGIFY() rather than defining with quotes */
|
||||
#define BLENDER_VERSION 263
|
||||
#define BLENDER_SUBVERSION 12
|
||||
#define BLENDER_SUBVERSION 13
|
||||
|
||||
#define BLENDER_MINVERSION 250
|
||||
#define BLENDER_MINSUBVERSION 0
|
||||
|
||||
@@ -46,6 +46,7 @@
|
||||
/* since we have versioning code here */
|
||||
#define DNA_DEPRECATED_ALLOW
|
||||
|
||||
#include "DNA_actuator_types.h"
|
||||
#include "DNA_anim_types.h"
|
||||
#include "DNA_constraint_types.h"
|
||||
#include "DNA_camera_types.h"
|
||||
@@ -1753,6 +1754,24 @@ void do_versions_ipos_to_animato(Main *main)
|
||||
ipo_to_animdata(id, ob->ipo, NULL, NULL, NULL);
|
||||
ob->ipo->id.us--;
|
||||
ob->ipo = NULL;
|
||||
|
||||
{
|
||||
/* If we have any empty action actuators, assume they were
|
||||
converted IPO Actuators using the object IPO */
|
||||
bActuator *act;
|
||||
bActionActuator *aa;
|
||||
|
||||
for (act = ob->actuators.first; act; act = act->next) {
|
||||
/* Any actuators set to ACT_IPO at this point are actually Action Actuators that
|
||||
need this converted IPO to finish converting the actuator. */
|
||||
if (act->type == ACT_IPO)
|
||||
{
|
||||
aa = (bActionActuator*)act->data;
|
||||
aa->act = ob->adt->action;
|
||||
act->type = ACT_ACTION;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -6982,6 +6982,21 @@ static void do_version_ntree_image_user_264(void *UNUSED(data), ID *UNUSED(id),
|
||||
}
|
||||
}
|
||||
|
||||
static void do_version_ntree_dilateerode_264(void *UNUSED(data), ID *UNUSED(id), bNodeTree *ntree)
|
||||
{
|
||||
bNode *node;
|
||||
|
||||
for (node = ntree->nodes.first; node; node = node->next) {
|
||||
if (node->type == CMP_NODE_DILATEERODE) {
|
||||
if (node->storage == NULL) {
|
||||
NodeDilateErode *data = MEM_callocN(sizeof(NodeDilateErode), __func__);
|
||||
data->falloff = PROP_SMOOTH;
|
||||
node->storage = data;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void do_versions(FileData *fd, Library *lib, Main *main)
|
||||
{
|
||||
/* WATCH IT!!!: pointers from libdata have not been converted */
|
||||
@@ -7789,6 +7804,13 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
|
||||
ma->strand_widthfade = 0.0f;
|
||||
}
|
||||
|
||||
if (main->versionfile < 263 || (main->versionfile == 263 && main->subversionfile < 13)) {
|
||||
bNodeTreeType *ntreetype = ntreeGetType(NTREE_COMPOSIT);
|
||||
|
||||
if (ntreetype && ntreetype->foreach_nodetree)
|
||||
ntreetype->foreach_nodetree(main, NULL, do_version_ntree_dilateerode_264);
|
||||
}
|
||||
|
||||
/* WATCH IT!!!: pointers from libdata have not been converted yet here! */
|
||||
/* WATCH IT 2!: Userdef struct init has to be in editors/interface/resources.c! */
|
||||
|
||||
|
||||
@@ -2558,11 +2558,11 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *main)
|
||||
for (ob = main->object.first; ob; ob = ob->id.next) {
|
||||
for (act = ob->actuators.first; act; act = act->next) {
|
||||
if (act->type == ACT_IPO) {
|
||||
// Create the new actuator
|
||||
/* Create the new actuator */
|
||||
ia = act->data;
|
||||
aa = MEM_callocN(sizeof(bActionActuator), "fcurve -> action actuator do_version");
|
||||
|
||||
// Copy values
|
||||
/* Copy values */
|
||||
aa->type = ia->type;
|
||||
aa->flag = ia->flag;
|
||||
aa->sta = ia->sta;
|
||||
@@ -2572,12 +2572,18 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *main)
|
||||
if (ob->adt)
|
||||
aa->act = ob->adt->action;
|
||||
|
||||
// Get rid of the old actuator
|
||||
/* Get rid of the old actuator */
|
||||
MEM_freeN(ia);
|
||||
|
||||
// Assign the new actuator
|
||||
/* Assign the new actuator */
|
||||
act->data = aa;
|
||||
act->type = act->otype = ACT_ACTION;
|
||||
|
||||
/* Fix for converting 2.4x files: if we don't have an action, but we have an
|
||||
object IPO, then leave the actuator as an IPO actuator for now and let the
|
||||
IPO conversion code handle it */
|
||||
if (ob->ipo && !aa->act)
|
||||
act->type = ACT_IPO;
|
||||
}
|
||||
else if (act->type == ACT_SHAPEACTION) {
|
||||
act->type = act->otype = ACT_ACTION;
|
||||
|
||||
@@ -117,6 +117,12 @@ void DilateErodeNode::convertToOperations(ExecutionSystem *graph, CompositorCont
|
||||
#endif
|
||||
operationx->setSubtract(editorNode->custom2 < 0);
|
||||
operationy->setSubtract(editorNode->custom2 < 0);
|
||||
|
||||
if (editorNode->storage) {
|
||||
NodeDilateErode *data = (NodeDilateErode *)editorNode->storage;
|
||||
operationx->setFalloff(data->falloff);
|
||||
operationy->setFalloff(data->falloff);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (editorNode->custom2 > 0) {
|
||||
|
||||
@@ -91,7 +91,7 @@ float *BlurBaseOperation::make_gausstab(int rad)
|
||||
|
||||
/* normalized distance from the current (inverted so 1.0 is close and 0.0 is far)
|
||||
* 'ease' is applied after, looks nicer */
|
||||
float *BlurBaseOperation::make_dist_fac_inverse(int rad)
|
||||
float *BlurBaseOperation::make_dist_fac_inverse(int rad, int falloff)
|
||||
{
|
||||
float *dist_fac_invert, val;
|
||||
int i, n;
|
||||
@@ -103,9 +103,26 @@ float *BlurBaseOperation::make_dist_fac_inverse(int rad)
|
||||
for (i = -rad; i <= rad; i++) {
|
||||
val = 1.0f - fabsf(((float)i / (float)rad));
|
||||
|
||||
/* ease - gives less hard lines for dilate/erode feather */
|
||||
val = (3.0f * val * val - 2.0f * val * val * val);
|
||||
|
||||
/* keep in sync with proportional_falloff_curve_only_items */
|
||||
switch (falloff) {
|
||||
case PROP_SMOOTH:
|
||||
/* ease - gives less hard lines for dilate/erode feather */
|
||||
val = (3.0f * val * val - 2.0f * val * val * val);
|
||||
break;
|
||||
case PROP_SPHERE:
|
||||
val = sqrtf(2.0f * val - val * val);
|
||||
break;
|
||||
case PROP_ROOT:
|
||||
val = sqrtf(val);
|
||||
break;
|
||||
case PROP_SHARP:
|
||||
val = val * val;
|
||||
break;
|
||||
case PROP_LIN:
|
||||
default:
|
||||
/* nothing */
|
||||
break;
|
||||
}
|
||||
dist_fac_invert[i + rad] = val;
|
||||
}
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ protected:
|
||||
NodeBlurData *data;
|
||||
BlurBaseOperation(DataType data_type);
|
||||
float *make_gausstab(int rad);
|
||||
float *make_dist_fac_inverse(int rad);
|
||||
float *make_dist_fac_inverse(int rad, int falloff);
|
||||
float size;
|
||||
bool deleteData;
|
||||
bool sizeavailable;
|
||||
|
||||
@@ -54,7 +54,7 @@ void GaussianAlphaXBlurOperation::initExecution()
|
||||
|
||||
this->rad = rad;
|
||||
this->gausstab = BlurBaseOperation::make_gausstab(rad);
|
||||
this->distbuf_inv = BlurBaseOperation::make_dist_fac_inverse(rad);
|
||||
this->distbuf_inv = BlurBaseOperation::make_dist_fac_inverse(rad, this->falloff);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -77,7 +77,7 @@ void GaussianAlphaXBlurOperation::updateGauss(MemoryBuffer **memoryBuffers)
|
||||
rad = 1;
|
||||
|
||||
this->rad = rad;
|
||||
this->distbuf_inv = BlurBaseOperation::make_dist_fac_inverse(rad);
|
||||
this->distbuf_inv = BlurBaseOperation::make_dist_fac_inverse(rad, this->falloff);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -30,6 +30,7 @@ class GaussianAlphaXBlurOperation : public BlurBaseOperation {
|
||||
private:
|
||||
float *gausstab;
|
||||
float *distbuf_inv;
|
||||
int falloff; /* falloff for distbuf_inv */
|
||||
bool do_subtract;
|
||||
int rad;
|
||||
void updateGauss(MemoryBuffer **memoryBuffers);
|
||||
@@ -58,5 +59,6 @@ public:
|
||||
* Set subtract for Dilate/Erode functionality
|
||||
*/
|
||||
void setSubtract(bool subtract) { this->do_subtract = subtract; }
|
||||
void setFalloff(int falloff) { this->falloff = falloff; }
|
||||
};
|
||||
#endif
|
||||
|
||||
@@ -54,7 +54,7 @@ void GaussianAlphaYBlurOperation::initExecution()
|
||||
|
||||
this->rad = rad;
|
||||
this->gausstab = BlurBaseOperation::make_gausstab(rad);
|
||||
this->distbuf_inv = BlurBaseOperation::make_dist_fac_inverse(rad);
|
||||
this->distbuf_inv = BlurBaseOperation::make_dist_fac_inverse(rad, this->falloff);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -77,7 +77,7 @@ void GaussianAlphaYBlurOperation::updateGauss(MemoryBuffer **memoryBuffers)
|
||||
rad = 1;
|
||||
|
||||
this->rad = rad;
|
||||
this->distbuf_inv = BlurBaseOperation::make_dist_fac_inverse(rad);
|
||||
this->distbuf_inv = BlurBaseOperation::make_dist_fac_inverse(rad, this->falloff);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -31,6 +31,7 @@ private:
|
||||
float *gausstab;
|
||||
float *distbuf_inv;
|
||||
bool do_subtract;
|
||||
int falloff;
|
||||
int rad;
|
||||
void updateGauss(MemoryBuffer **memoryBuffers);
|
||||
public:
|
||||
@@ -58,5 +59,6 @@ public:
|
||||
* Set subtract for Dilate/Erode functionality
|
||||
*/
|
||||
void setSubtract(bool subtract) { this->do_subtract = subtract; }
|
||||
void setFalloff(int falloff) { this->falloff = falloff; }
|
||||
};
|
||||
#endif
|
||||
|
||||
@@ -1769,8 +1769,13 @@ static void node_composit_buts_dilateerode(uiLayout *layout, bContext *UNUSED(C)
|
||||
{
|
||||
uiItemR(layout, ptr, "type", 0, NULL, ICON_NONE);
|
||||
uiItemR(layout, ptr, "distance", 0, NULL, ICON_NONE);
|
||||
if (RNA_enum_get(ptr, "type") == CMP_NODE_DILATEERODE_DISTANCE_THRESH) {
|
||||
uiItemR(layout, ptr, "edge", 0, NULL, ICON_NONE);
|
||||
switch (RNA_enum_get(ptr, "type")) {
|
||||
case CMP_NODE_DILATEERODE_DISTANCE_THRESH:
|
||||
uiItemR(layout, ptr, "edge", 0, NULL, ICON_NONE);
|
||||
break;
|
||||
case CMP_NODE_DILATEERODE_DISTANCE_FEATHER:
|
||||
uiItemR(layout, ptr, "falloff", 0, NULL, ICON_NONE);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -559,6 +559,11 @@ typedef struct NodeColorspill {
|
||||
float uspillr, uspillg, uspillb;
|
||||
} NodeColorspill;
|
||||
|
||||
typedef struct NodeDilateErode {
|
||||
char falloff;
|
||||
char pad[7];
|
||||
} NodeDilateErode;
|
||||
|
||||
typedef struct NodeTexBase {
|
||||
TexMapping tex_mapping;
|
||||
ColorMapping color_mapping;
|
||||
|
||||
@@ -41,6 +41,7 @@ extern EnumPropertyItem object_mode_items[];
|
||||
extern EnumPropertyItem metaelem_type_items[];
|
||||
|
||||
extern EnumPropertyItem proportional_falloff_items[];
|
||||
extern EnumPropertyItem proportional_falloff_curve_only_items[];
|
||||
extern EnumPropertyItem proportional_editing_items[];
|
||||
extern EnumPropertyItem snap_target_items[];
|
||||
extern EnumPropertyItem snap_element_items[];
|
||||
|
||||
@@ -135,6 +135,8 @@ static void rna_CurveMapping_clipmaxy_range(PointerRNA *ptr, float *min, float *
|
||||
|
||||
static char *rna_ColorRamp_path(PointerRNA *ptr)
|
||||
{
|
||||
char *path = NULL;
|
||||
|
||||
/* handle the cases where a single datablock may have 2 ramp types */
|
||||
if (ptr->id.data) {
|
||||
ID *id = ptr->id.data;
|
||||
@@ -145,16 +147,47 @@ static char *rna_ColorRamp_path(PointerRNA *ptr)
|
||||
Material *ma = (Material *)id;
|
||||
|
||||
if (ptr->data == ma->ramp_col)
|
||||
return BLI_strdup("diffuse_ramp");
|
||||
path = BLI_strdup("diffuse_ramp");
|
||||
else if (ptr->data == ma->ramp_spec)
|
||||
return BLI_strdup("specular_ramp");
|
||||
path = BLI_strdup("specular_ramp");
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case ID_NT:
|
||||
{
|
||||
bNodeTree *ntree = (bNodeTree *)id;
|
||||
bNode *node;
|
||||
PointerRNA node_ptr;
|
||||
char *node_path;
|
||||
|
||||
for (node = ntree->nodes.first; node; node = node->next) {
|
||||
if (ELEM3(node->type, SH_NODE_VALTORGB, CMP_NODE_VALTORGB, TEX_NODE_VALTORGB)) {
|
||||
if (node->storage == ptr->data) {
|
||||
/* all node color ramp properties called 'color_ramp'
|
||||
* prepend path from ID to the node
|
||||
*/
|
||||
RNA_pointer_create(id, &RNA_Node, node, &node_ptr);
|
||||
node_path = RNA_path_from_ID_to_struct(&node_ptr);
|
||||
path = BLI_sprintfN("%s.color_ramp", node_path);
|
||||
MEM_freeN(node_path);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
/* everything else just uses 'color_ramp' */
|
||||
path = BLI_strdup("color_ramp");
|
||||
break;
|
||||
}
|
||||
}
|
||||
else {
|
||||
/* everything else just uses 'color_ramp' */
|
||||
path = BLI_strdup("color_ramp");
|
||||
}
|
||||
|
||||
/* everything else just uses 'color_ramp' */
|
||||
return BLI_strdup("color_ramp");
|
||||
return path;
|
||||
}
|
||||
|
||||
static char *rna_ColorRampElement_path(PointerRNA *ptr)
|
||||
@@ -204,7 +237,6 @@ static char *rna_ColorRampElement_path(PointerRNA *ptr)
|
||||
}
|
||||
break;
|
||||
|
||||
/* TODO: node trees need special attention */
|
||||
case ID_NT:
|
||||
{
|
||||
bNodeTree *ntree = (bNodeTree *)id;
|
||||
|
||||
@@ -2068,11 +2068,21 @@ static void def_cmp_dilate_erode(StructRNA *srna)
|
||||
RNA_def_property_ui_text(prop, "Distance", "Distance to grow/shrink (number of iterations)");
|
||||
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
|
||||
|
||||
/* CMP_NODE_DILATEERODE_DISTANCE_THRESH only */
|
||||
prop = RNA_def_property(srna, "edge", PROP_FLOAT, PROP_NONE);
|
||||
RNA_def_property_float_sdna(prop, NULL, "custom3");
|
||||
RNA_def_property_range(prop, -100, 100);
|
||||
RNA_def_property_ui_text(prop, "Edge", "Edge to inset");
|
||||
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
|
||||
|
||||
RNA_def_struct_sdna_from(srna, "NodeDilateErode", "storage");
|
||||
|
||||
/* CMP_NODE_DILATEERODE_DISTANCE_FEATHER only */
|
||||
prop = RNA_def_property(srna, "falloff", PROP_ENUM, PROP_NONE);
|
||||
RNA_def_property_enum_sdna(prop, NULL, "falloff");
|
||||
RNA_def_property_enum_items(prop, proportional_falloff_curve_only_items);
|
||||
RNA_def_property_ui_text(prop, "Falloff", "Falloff type the feather");
|
||||
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
|
||||
}
|
||||
|
||||
static void def_cmp_scale(StructRNA *srna)
|
||||
|
||||
@@ -101,6 +101,16 @@ EnumPropertyItem proportional_falloff_items[] = {
|
||||
{0, NULL, 0, NULL, NULL}
|
||||
};
|
||||
|
||||
/* subset of the enum - only curves, missing random and const */
|
||||
EnumPropertyItem proportional_falloff_curve_only_items[] = {
|
||||
{PROP_SMOOTH, "SMOOTH", ICON_SMOOTHCURVE, "Smooth", "Smooth falloff"},
|
||||
{PROP_SPHERE, "SPHERE", ICON_SPHERECURVE, "Sphere", "Spherical falloff"},
|
||||
{PROP_ROOT, "ROOT", ICON_ROOTCURVE, "Root", "Root falloff"},
|
||||
{PROP_SHARP, "SHARP", ICON_SHARPCURVE, "Sharp", "Sharp falloff"},
|
||||
{PROP_LIN, "LINEAR", ICON_LINCURVE, "Linear", "Linear falloff"},
|
||||
{0, NULL, 0, NULL, NULL}
|
||||
};
|
||||
|
||||
|
||||
EnumPropertyItem proportional_editing_items[] = {
|
||||
{PROP_EDIT_OFF, "DISABLED", ICON_PROP_OFF, "Disable", "Proportional Editing disabled"},
|
||||
|
||||
@@ -146,6 +146,13 @@ static void node_composit_exec_dilateerode(void *UNUSED(data), bNode *node, bNod
|
||||
}
|
||||
}
|
||||
|
||||
static void node_composit_init_dilateerode(bNodeTree *UNUSED(ntree), bNode* node, bNodeTemplate *UNUSED(ntemp))
|
||||
{
|
||||
NodeDilateErode *data = MEM_callocN(sizeof(NodeDilateErode), "NodeDilateErode");
|
||||
data->falloff = PROP_SMOOTH;
|
||||
node->storage = data;
|
||||
}
|
||||
|
||||
void register_node_type_cmp_dilateerode(bNodeTreeType *ttype)
|
||||
{
|
||||
static bNodeType ntype;
|
||||
@@ -153,7 +160,10 @@ void register_node_type_cmp_dilateerode(bNodeTreeType *ttype)
|
||||
node_type_base(ttype, &ntype, CMP_NODE_DILATEERODE, "Dilate/Erode", NODE_CLASS_OP_FILTER, NODE_OPTIONS);
|
||||
node_type_socket_templates(&ntype, cmp_node_dilateerode_in, cmp_node_dilateerode_out);
|
||||
node_type_size(&ntype, 130, 100, 320);
|
||||
node_type_init(&ntype, node_composit_init_dilateerode);
|
||||
node_type_exec(&ntype, node_composit_exec_dilateerode);
|
||||
|
||||
node_type_storage(&ntype, "NodeDilateErode", node_free_standard_storage, node_copy_standard_storage);
|
||||
|
||||
nodeRegisterType(ttype, &ntype);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user