forked from blender/blender
MaterialX: Implement export of Input nodes #20
No reviewers
Labels
No Label
No Milestone
2 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: DagerD/blender#20
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "Vasyl-Pidhirskyi/blender:BLEN-530"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Purpose
Add support for Input nodes.
Technical steps
Implemented get_value_default, get_output_default.
Fixed type conversion issue. Now type is converted even if a node is already in the graph.
Added:
Partially implemented:
Not implemented:
@ -53,2 +55,4 @@
private:
NodeItem get_input_default(const bNodeSocket &socket, NodeItem::Type to_type);
NodeItem get_output_default(const bNodeSocket &socket);
NodeItem get_value_default(const bNodeSocket &socket);
use one function here instead of 3
get_default(const bNodeSocket &socket, NodeItem::Type to_type)
@ -58,0 +64,4 @@
* res.set_input("coneangle", val(90.0f));
* res.set_input("maxdistance", maxdistance);
*/
NodeItem res = val(MaterialX::Color4(1.0f, 0.0f, 1.0f, 1.0f));
@ -80,0 +81,4 @@
{
/* TODO: some outputs expected be implemented within the next iteration (see nodedef
* <geompropvalue>) */
NodeItem res = val(MaterialX::Color4(1.0f, 0.0f, 1.0f, 1.0f));
Start with
NodeItem res = empty();
add checkif (STREQ(socket_out_->name, "Color"))
@ -80,0 +85,4 @@
if (STREQ(socket_out_->name, "Vector")) {
res = val(MaterialX::Vector3(1.0f, 1.0f, 1.0f));
}
if (STREQ(socket_out_->name, "Factor")) {
else if
@ -80,0 +90,4 @@
}
if (STREQ(socket_out_->name, "Alpha")) {
res = res.extract(3);
}
add
@ -41,1 +41,4 @@
NODE_SHADER_MATERIALX_BEGIN
{
/* TODO: This node doesn't have an implementation in MaterialX 1.38.6.*/
NOTE
insteadTODO
if there is no implementation in MatX. No need 1.38.6, justin MaterialX
@ -42,0 +42,4 @@
NODE_SHADER_MATERIALX_BEGIN
{
/* TODO: This node doesn't have an implementation in MaterialX 1.38.6.*/
return val(MaterialX::Vector3(1.0f, 1.0f, 1.0f));
return get_input_link("Normal", NodeItem::Type::Vector3);
@ -29,0 +36,4 @@
if (STREQ(socket_out_->name, "View Distance")) {
res = res.extract(2);
}
return res;
start from
empty()
, useelse if
@ -61,0 +64,4 @@
CLG_LogRef *LOG_MATERIALX_SHADER = materialx::LOG_MATERIALX_SHADER;
NodeItem res = empty();
const char *output_name = socket_out_->name;
maybe std::string name = socket_out_->name ?
@ -37,0 +38,4 @@
{
/* TODO: This node doesn't have an implementation in MaterialX 1.38.6.*/
NodeItem res = val(MaterialX::Vector3(1.0f, 1.0f, 1.0f));
if (STREQ(socket_out_->name, "Index") || STREQ(socket_out_->name, "Random") ||
use
std::string name = socket_out_->name
andELEM(name, ....)
@ -25,0 +29,4 @@
if (STREQ(socket_out_->name, "Radius") || STREQ(socket_out_->name, "Random")) {
res = res.extract(2);
}
return res;
I think
return get_output_default
can be used here@ -74,0 +74,4 @@
NODE_SHADER_MATERIALX_BEGIN
{
/* TODO: Partially implemented, some nodes don't have an implementation in MaterialX 1.38.6.
* some outputs expected be implemented within the next iteration*/
This node I think has to be implemented in this PR
@ -69,1 +69,4 @@
NODE_SHADER_MATERIALX_BEGIN
{
/* TODO: Partially implemented*/
I think it is implemented here, use NOTE that other properties of node are unsupported
@ -70,0 +71,4 @@
{
/* TODO: some output expected be implemented within the next iteration (see nodedef
* <geomcolor>)*/
NodeItem res = val(MaterialX::Color4(1.0f, 0.0f, 1.0f, 1.0f));
start from empty()
Node implementation is ok, small changes are required
@ -142,7 +152,7 @@ NodeItem NodeParser::get_input_default(const bNodeSocket &socket, NodeItem::Type
CLOG_WARN(LOG_MATERIALX_SHADER, "Unsupported socket type: %d", socket.type);
}
}
return res.convert(to_type);
I think this has to be reverted back, let to_type be here. It is always possible to use Type::Any
Looks good