Changeset View
Changeset View
Standalone View
Standalone View
source/blender/io/collada/Materials.cpp
| Context not available. | |||||
| nodeAddLink(ntree, from_node, from_socket, to_node, to_socket); | nodeAddLink(ntree, from_node, from_socket, to_node, to_socket); | ||||
| } | } | ||||
| void MaterialNode::add_link(bNode *from_node, const char* from_label, bNode *to_node, const char* to_label) | |||||
| { | |||||
| bNodeSocket *from_socket = nodeFindSocket(from_node, SOCK_OUT, from_label); | |||||
| bNodeSocket *to_socket = nodeFindSocket(to_node, SOCK_IN, to_label); | |||||
| if (from_socket && to_socket) { | |||||
| nodeAddLink(ntree, from_node, from_socket, to_node, to_socket); | |||||
| } | |||||
| } | |||||
| void MaterialNode::set_reflectivity(COLLADAFW::FloatOrParam &val) | void MaterialNode::set_reflectivity(COLLADAFW::FloatOrParam &val) | ||||
| { | { | ||||
| float reflectivity = val.getFloatValue(); | float reflectivity = val.getFloatValue(); | ||||
gaiaclary: Suggest to encapsulate this change into an overwritten method:
void MaterialNode::add_link… | |||||
Not Done Inline Actionswhat if from_socket is NULL ? gaiaclary: what if from_socket is NULL ? | |||||
Not Done Inline Actionssame as above gaiaclary: same as above | |||||
Done Inline ActionsThe code right above this does nodeFindSocket(..., "Emission") without checking for NULL, so I assumed I didn't need to. What do you want to do if it's NULL? scurest: The code right above this does nodeFindSocket(..., "Emission") without checking for NULL, so I… | |||||
| Context not available. | |||||
| else if (cot.isTexture()) { | else if (cot.isTexture()) { | ||||
| bNode *texture_node = add_texture_node(cot, -300, locy, "Emission"); | bNode *texture_node = add_texture_node(cot, -300, locy, "Emission"); | ||||
| if (texture_node != nullptr) { | if (texture_node != nullptr) { | ||||
| add_link(texture_node, 0, shader_node, 0); | add_link(texture_node, "Color", shader_node, "Emission"); | ||||
| } | } | ||||
| } | } | ||||
| Context not available. | |||||
Suggest to encapsulate this change into an overwritten method:
void MaterialNode::add_link(bNode *from_node, const char* from_label, bNode *to_node, const char* to_label)