MaterialX: fix review comments #19

Merged
Bogdan Nagirniak merged 10 commits from matx-fix-review-comments into matx-export-material 2023-09-14 02:01:04 +02:00
4 changed files with 5 additions and 4 deletions
Showing only changes of commit 2938eec7a0 - Show all commits

View File

@ -225,7 +225,7 @@ typedef int (*NodeGPUExecFunction)(struct GPUMaterial *mat,
struct bNodeExecData *execdata,
struct GPUNodeStack *in,
struct GPUNodeStack *out);
typedef void (*NodeMaterialXExecFunction)(void *data,
typedef void (*NodeMaterialXFunction)(void *data,
struct bNode *node,
struct bNodeSocket *out);
@ -343,7 +343,7 @@ typedef struct bNodeType {
/* gpu */
NodeGPUExecFunction gpu_fn;
/* MaterialX */
NodeMaterialXExecFunction materialx_fn;
NodeMaterialXFunction materialx_fn;
/* Get an instance of this node's compositor operation. Freeing the instance is the
* responsibility of the caller. */

View File

@ -88,7 +88,7 @@ void MaterialData::init()
}
}
}
else {
else
#endif
{
usd_material = usd::create_usd_material(export_context, material_path, (Material *)id, "st");

View File

@ -145,6 +145,7 @@ set(LIB
)
if(WITH_MATERIALX)
add_definitions(-DWITH_MATERIALX)
list(APPEND SRC
materialx/material.cc
materialx/node_item.cc

View File

@ -25,7 +25,7 @@
#ifdef WITH_MATERIALX
# include "materialx/node_parser.h"
#else
# define NODE_SHADER_MATERIALX_BEGIN NodeMaterialXExecFunction node_shader_materialx = nullptr;
# define NODE_SHADER_MATERIALX_BEGIN NodeMaterialXFunction node_shader_materialx = nullptr;
# define NODE_SHADER_MATERIALX_END
#endif
BogdanNagirniak marked this conversation as resolved
Review

Seems could be simpliifed to:

#  define NODE_SHADER_MATERIALX_BEGIN \
    void *node_shader_materialx = nullptr;
#  define NODE_SHADER_MATERIALX_END

Export code would be:

NODE_SHADER_MATERIALX_BEGIN
#ifdef WITH_MATERIALX
{
....
}
#endif
NODE_SHADER_MATERIALX_END
Seems could be simpliifed to: ``` # define NODE_SHADER_MATERIALX_BEGIN \ void *node_shader_materialx = nullptr; # define NODE_SHADER_MATERIALX_END ``` Export code would be: ``` NODE_SHADER_MATERIALX_BEGIN #ifdef WITH_MATERIALX { .... } #endif NODE_SHADER_MATERIALX_END ```