Add basic supported nodes #1

Merged
Bogdan Nagirniak merged 5 commits from add-basic-nodes into matx-export-material 2023-08-24 10:23:00 +02:00
2 changed files with 11 additions and 3 deletions
Showing only changes of commit 8c4ad6140d - Show all commits

View File

@ -21,6 +21,12 @@ set(INC
${CMAKE_BINARY_DIR}/source/blender/makesrna
)
if(WITH_HYDRA)
list(APPEND INC
../../io/usd
)
add_definitions(-DWITH_HYDRA)
endif()
set(SRC
nodes/node_shader_add_shader.cc

View File

@ -5,6 +5,8 @@
#include "node.h"
#include "image.h"
#include "hydra/image.h"
#include "DEG_depsgraph_query.h"
namespace blender::nodes::materialx {
@ -22,13 +24,13 @@ MaterialXTexImageNode::MaterialXTexImageNode(MaterialX::DocumentPtr doc,
MaterialX::NodePtr MaterialXTexImageNode::convert()
{
const Image *image = (Image *)node->id;
const NodeTexImage *tex = static_cast<NodeTexImage *>(node->storage);
Image *image = (Image *)node->id;
NodeTexImage *tex = static_cast<NodeTexImage *>(node->storage);
Scene *scene = DEG_get_input_scene(depsgraph);
Main *bmain = DEG_get_bmain(depsgraph);
std::string image_path;
#ifdef WITH_HYDRA
image_path = cache_or_get_image_file(bmain, scene, image, &tex->iuser);
image_path = io::hydra::cache_or_get_image_file(bmain, scene, image, &tex->iuser);
#endif
MaterialX::NodePtr uv_node = doc->addNode("texcoord", MaterialX::EMPTY_STRING, "vector2");