Fix Cycles OSL script node not working in shader using bump, after node type refactoring.
This commit is contained in:
@@ -5062,12 +5062,10 @@ OSLNode::~OSLNode()
|
|||||||
|
|
||||||
ShaderNode *OSLNode::clone() const
|
ShaderNode *OSLNode::clone() const
|
||||||
{
|
{
|
||||||
OSLNode *node = new OSLNode(*this);
|
return OSLNode::create(this->inputs.size(), this);
|
||||||
node->type = new NodeType(*type);
|
|
||||||
return node;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
OSLNode* OSLNode::create(size_t num_inputs)
|
OSLNode* OSLNode::create(size_t num_inputs, const OSLNode *from)
|
||||||
{
|
{
|
||||||
/* allocate space for the node itself and parameters, aligned to 16 bytes
|
/* allocate space for the node itself and parameters, aligned to 16 bytes
|
||||||
* assuming that's the most parameter types need */
|
* assuming that's the most parameter types need */
|
||||||
@@ -5077,7 +5075,17 @@ OSLNode* OSLNode::create(size_t num_inputs)
|
|||||||
char *node_memory = (char*) operator new(node_size + inputs_size);
|
char *node_memory = (char*) operator new(node_size + inputs_size);
|
||||||
memset(node_memory, 0, node_size + inputs_size);
|
memset(node_memory, 0, node_size + inputs_size);
|
||||||
|
|
||||||
return new(node_memory) OSLNode();
|
if (!from) {
|
||||||
|
return new(node_memory) OSLNode();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
/* copy input default values and node type for cloning */
|
||||||
|
memcpy(node_memory + node_size, (char*)from + node_size, inputs_size);
|
||||||
|
|
||||||
|
OSLNode *node = new(node_memory) OSLNode(*from);
|
||||||
|
node->type = new NodeType(*(from->type));
|
||||||
|
return node;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
char* OSLNode::input_default_value()
|
char* OSLNode::input_default_value()
|
||||||
|
@@ -921,7 +921,7 @@ public:
|
|||||||
|
|
||||||
class OSLNode : public ShaderNode {
|
class OSLNode : public ShaderNode {
|
||||||
public:
|
public:
|
||||||
static OSLNode *create(size_t num_inputs);
|
static OSLNode *create(size_t num_inputs, const OSLNode *from = NULL);
|
||||||
~OSLNode();
|
~OSLNode();
|
||||||
|
|
||||||
ShaderNode *clone() const;
|
ShaderNode *clone() const;
|
||||||
|
Reference in New Issue
Block a user