-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Runtime token support #1157
Runtime token support #1157
Conversation
… on inputs. Remove hard-coded logic to always make tokens invisible.
@@ -39,6 +39,11 @@ PvtInput::PvtInput(const RtIdentifier& name, const RtIdentifier& type, uint32_t | |||
|
|||
bool PvtInput::isConnectable(const PvtOutput* output) const | |||
{ | |||
if (isToken() || output->isToken()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Disallow connections.
@@ -148,6 +166,24 @@ class PvtInput : public PvtPort | |||
} | |||
} | |||
|
|||
bool isUIVisible() const |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wrote some wrappers for reuse.
@@ -901,7 +917,16 @@ namespace | |||
for (PvtObject* obj : src->getInputs()) | |||
{ | |||
const PvtInput* input = obj->asA<PvtInput>(); | |||
ValueElementPtr destPort = destNodeDef->addInput(input->getName().str(), input->getType().str()); | |||
ValueElementPtr destPort = nullptr; | |||
if (input->isToken()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
File save.
@@ -200,6 +200,12 @@ namespace | |||
const uint32_t flags = elem->asA<Input>()->getIsUniform() ? RtPortFlag::UNIFORM : 0; | |||
port = schema.createInput(portName, portType, flags); | |||
} | |||
else if (elem->isA<Token>()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
File read.
@@ -1299,20 +1300,35 @@ TEST_CASE("Runtime: FileIo NodeGraph", "[runtime]") | |||
// Create a nodegraph. | |||
mx::RtNodeGraph graph = stage->createPrim(mx::RtNodeGraph::typeName()); | |||
graph.createInput(IN, mx::RtType::FLOAT); | |||
graph.createInput(TOKEN1, mx::RtType::FLOAT, mx::RtPortFlag::UNIFORM | mx::RtPortFlag::TOKEN); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Basic test for create and connectivity.
… connected is visible.
@@ -487,7 +492,17 @@ namespace | |||
if (!socket) | |||
{ | |||
const RtIdentifier inputType(elem->getType()); | |||
RtInput input = nodegraph.createInput(socketName, inputType); | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a suggestion, but you could convert this into one or two lines if you wanted to:
const uint32_t flags = elem->isA() ? RtPortFlag::UNIFORM | RtPortFlag::TOKEN : 0;
RtInput input = nodegraph.createInput(socketName, inputType, flags);
or even:
RtInput input = nodegraph.createInput(socketName, inputType, elem->isA() ? RtPortFlag::UNIFORM | RtPortFlag::TOKEN : 0);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can do the first. Bit too hard to read the second :).
v = destNodeGraph->addInput(nodegraphInput.getName().str(), nodegraphInput.getType().str()); | ||
if (nodegraphInput.isToken()) | ||
{ | ||
v = destNodeGraph->addToken(nodegraphInput.getName().str()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Question out of curiousity. If addInput takes a type as a second parameter, shouldn't addToken as well so you don't need two lines to accomplish what could be done on one line?
This PR adds a tangent input to the glTF PBR, similar to how it's done in the standard surface.
Update #1159
Add in support for
<token>
as a runtime "input" which is marked as a token.Example nodegraph with token called
mytoken
which is marked as non-visible.Would look like this graphically:
With the contents looking like this (token in "neon pink").
Based on the current specification
<token>
elements are not connectable.Unit test will produce this file: