forked from blender/blender
matx-extend-create_node #25
@ -626,7 +626,7 @@ NodeItem::Type NodeItem::type() const
|
||||
return Type::Empty;
|
||||
}
|
||||
|
||||
NodeItem NodeItem::create_node(const std::string &category, NodeItem::Type type) const
|
||||
NodeItem NodeItem::create_node(const std::string &category, Type type) const
|
||||
{
|
||||
std::string type_str = this->type(type);
|
||||
CLOG_INFO(LOG_MATERIALX_SHADER, 2, "<%s type=%s>", category.c_str(), type_str.c_str());
|
||||
@ -635,9 +635,7 @@ NodeItem NodeItem::create_node(const std::string &category, NodeItem::Type type)
|
||||
return res;
|
||||
}
|
||||
|
||||
NodeItem NodeItem::create_node(const std::string &category,
|
||||
NodeItem::Type type,
|
||||
const std::map<std::string, NodeItem> &inputs) const
|
||||
NodeItem NodeItem::create_node(const std::string &category, Type type, const Inputs &inputs) const
|
||||
{
|
||||
NodeItem res = create_node(category, type);
|
||||
for (auto &it : inputs) {
|
||||
|
@ -15,6 +15,8 @@ namespace blender::nodes::materialx {
|
||||
* All work should be done via this class instead of using MaterialX API directly. */
|
||||
class NodeItem {
|
||||
public:
|
||||
using Inputs = std::vector<std::pair<std::string, NodeItem>>;
|
||||
|
||||
enum class Type {
|
||||
Any = 0,
|
||||
Empty,
|
||||
@ -108,8 +110,8 @@ class NodeItem {
|
||||
Type type() const;
|
||||
|
||||
/* Node functions */
|
||||
NodeItem create_node(const std::string &category, NodeItem::Type type) const;
|
||||
NodeItem create_node(const std::string &category, NodeItem::Type type, const std::map<std::string, NodeItem> &inputs) const;
|
||||
NodeItem create_node(const std::string &category, Type type) const;
|
||||
NodeItem create_node(const std::string &category, Type type, const Inputs &inputs) const;
|
||||
template<class T> void set_input(const std::string &in_name, const T &value, Type in_type);
|
||||
void set_input(const std::string &in_name, const NodeItem &item);
|
||||
NodeItem add_output(const std::string &out_name, Type out_type);
|
||||
|
@ -86,7 +86,7 @@ NodeItem NodeParser::create_node(const std::string &category, NodeItem::Type typ
|
||||
|
||||
NodeItem NodeParser::create_node(const std::string &category,
|
||||
NodeItem::Type type,
|
||||
const std::map<std::string, NodeItem> &inputs)
|
||||
const NodeItem::Inputs &inputs)
|
||||
{
|
||||
return empty().create_node(category, type, inputs);
|
||||
}
|
||||
|
@ -46,7 +46,7 @@ class NodeParser {
|
||||
NodeItem create_node(const std::string &category, NodeItem::Type type);
|
||||
NodeItem create_node(const std::string &category,
|
||||
NodeItem::Type type,
|
||||
const std::map<std::string, NodeItem> &inputs);
|
||||
const NodeItem::Inputs &inputs);
|
||||
NodeItem create_input(const std::string &name, const NodeItem &item);
|
||||
NodeItem create_output(const std::string &name, const NodeItem &item);
|
||||
NodeItem get_input_default(const std::string &name, NodeItem::Type to_type);
|
||||
|
Loading…
Reference in New Issue
Block a user