-
Notifications
You must be signed in to change notification settings - Fork 154
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1355 from DarcJC/dev/darc/rpc
New node register system
- Loading branch information
Showing
5 changed files
with
620 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,60 @@ | ||
|
||
#include "zeno/zeno.h" | ||
#include "zeno/utils/logger.h" | ||
#include "zeno/PrimitiveObject.h" | ||
#include "zeno/types/UserData.h" | ||
#include "zeno/utils/PropertyVisitor.h" | ||
#include "roads/roads.h" | ||
|
||
template <typename ...Args> | ||
inline void RoadsAssert(const bool Expr, const std::string& InMsg = "[Roads] Assert Failed", Args... args) { | ||
if (!Expr) { | ||
zeno::log_error(InMsg, args...); | ||
} | ||
} | ||
|
||
template <typename GridType = roads::Point> | ||
roads::DynamicGrid<GridType> BuildGridFromPrimitive(const zeno::AttrVector<zeno::vec3f>& DataSource, int32_t Nx, int32_t Ny) { | ||
RoadsAssert(Nx * Ny <= DataSource.size()); | ||
|
||
roads::DynamicGrid<GridType> Grid(Nx, Ny); | ||
for (size_t i = 0; i < Nx * Ny; ++i) { | ||
Grid[i] = DataSource[i]; | ||
} | ||
|
||
return Grid; | ||
} | ||
|
||
namespace { | ||
using namespace zeno; | ||
|
||
struct CalcPathCost_Simple : public INode { | ||
void apply() override; | ||
}; | ||
struct CalcPathCost_Simple : public zeno::reflect::IParameterAutoNode<CalcPathCost_Simple> { | ||
ZENO_GENERATE_NODE_BODY(CalcPathCost_Simple); | ||
|
||
ZENDEFNODE( | ||
CalcPathCost_Simple, | ||
{ | ||
{ | ||
{ "prim" }, | ||
{ "string", "output_channel", "path_cost" }, | ||
}, | ||
{}, | ||
{}, | ||
{ | ||
"Unreal" | ||
} | ||
} | ||
) | ||
std::shared_ptr<zeno::PrimitiveObject> Primitive; | ||
ZENO_DECLARE_INPUT_FIELD(Primitive, "Prim"); | ||
ZENO_DECLARE_OUTPUT_FIELD(Primitive, "Prim"); | ||
|
||
void CalcPathCost_Simple::apply() { | ||
} | ||
std::string OutputChannel; | ||
ZENO_DECLARE_INPUT_FIELD(OutputChannel, "OutputChannel", false, "", "path_cost"); | ||
|
||
std::string SizeXChannel; | ||
ZENO_DECLARE_INPUT_FIELD(SizeXChannel, "UserData_NxChannel", false, "", "nx"); | ||
|
||
std::string SizeYChannel; | ||
ZENO_DECLARE_INPUT_FIELD(SizeYChannel, "UserData_NyChannel", false, "", "ny"); | ||
|
||
int Nx = 0; | ||
ZENO_BINDING_PRIMITIVE_USERDATA(Primitive, Nx, SizeXChannel, false); | ||
|
||
int Ny = 0; | ||
ZENO_BINDING_PRIMITIVE_USERDATA(Primitive, Ny, SizeYChannel, false); | ||
|
||
zeno::AttrVector<vec3f> PositionList {}; | ||
ZENO_BINDING_PRIMITIVE_ATTRIBUTE(Primitive, PositionList, "pos", zeno::reflect::EZenoPrimitiveAttr::VERT); | ||
|
||
void apply() override { | ||
BuildGridFromPrimitive(PositionList, Nx, Ny); | ||
zeno::log_info("aaa: {} {}", AutoParameter->Nx, AutoParameter->Ny); | ||
} | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -106,6 +106,8 @@ struct INode { | |
} | ||
|
||
ZENO_API TempNodeCaller temp_node(std::string const &id); | ||
|
||
friend struct reflect; | ||
}; | ||
|
||
} |
Oops, something went wrong.