diff --git a/projects/FBX/FBXSDK.cpp b/projects/FBX/FBXSDK.cpp index 1674fc0738..93d390dd61 100644 --- a/projects/FBX/FBXSDK.cpp +++ b/projects/FBX/FBXSDK.cpp @@ -14,6 +14,7 @@ #include "zeno/types/PrimitiveObject.h" #include "zeno/utils/scope_exit.h" #include "zeno/funcs/PrimitiveUtils.h" +#include "zeno/utils/string.h" #include #include #include @@ -1479,4 +1480,43 @@ ZENDEFNODE(BoneTransformView, { {}, {"debug"}, }); + +struct PrimAttrFlat : INode { + virtual void apply() override { + auto prim = get_input2("prim"); + auto params = get_input2("params"); + std::vector params_ = zeno::split_str(params, ','); + std::vector values; + for (auto i = 0; i < prim->size(); i++) { + for (const auto& param: params_) { + auto value = prim->attr(param); + values.push_back(value[i][0]); + values.push_back(value[i][1]); + values.push_back(value[i][2]); + } + } + + auto output = std::make_shared(); + output->resize(values.size()); + auto &value = output->add_attr("value"); + for (auto i = 0; i < values.size(); i++) { + value[i] = values[i]; + } + + set_output("output", output); + } +}; + +ZENDEFNODE(PrimAttrFlat, { + { + "prim", + {"string", "params", "transform_r0,transform_r1,transform_r2"}, + }, + { + "output", + }, + {}, + {"debug"}, +}); + } \ No newline at end of file