Skip to content

Commit

Permalink
Merge branch 'master' into improve-fbx-prim-merge
Browse files Browse the repository at this point in the history
  • Loading branch information
littlemine authored Aug 1, 2024
2 parents 18fbddd + 3362887 commit 9dd9c5f
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions projects/FBX/FBXSDK.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 <glm/glm.hpp>
#include <glm/gtc/matrix_transform.hpp>
#include <glm/gtc/type_ptr.hpp>
Expand Down Expand Up @@ -1479,4 +1480,43 @@ ZENDEFNODE(BoneTransformView, {
{},
{"debug"},
});

struct PrimAttrFlat : INode {
virtual void apply() override {
auto prim = get_input2<PrimitiveObject>("prim");
auto params = get_input2<std::string>("params");
std::vector<std::string> params_ = zeno::split_str(params, ',');
std::vector<float> values;
for (auto i = 0; i < prim->size(); i++) {
for (const auto& param: params_) {
auto value = prim->attr<vec3f>(param);
values.push_back(value[i][0]);
values.push_back(value[i][1]);
values.push_back(value[i][2]);
}
}

auto output = std::make_shared<zeno::PrimitiveObject>();
output->resize(values.size());
auto &value = output->add_attr<float>("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"},
});

}

0 comments on commit 9dd9c5f

Please sign in to comment.