Skip to content
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

fix: slots of nodes in render graph editor won’t change interactively #352

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion Source/Falcor/RenderGraph/RenderGraphUI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1066,7 +1066,8 @@ namespace Falcor
RenderPass* pNodeRenderPass = mpRenderGraph->getPass(currentPass.first).get();
nameString = currentPass.first;

if (!mpNodeGraphEditor->getAllNodesOfType(currentPassUI.mGuiNodeID, nullptr, false))
ImVector<ImGui::Node*> nodesOut;
if (!mpNodeGraphEditor->getAllNodesOfType(currentPassUI.mGuiNodeID, &nodesOut, false))
{
float2 nextPosition = mAddedFromDragAndDrop ? mNewNodeStartPosition : getNextNodePosition(mpRenderGraph->getPassIndex(nameString));

Expand All @@ -1075,6 +1076,13 @@ namespace Falcor
ImVec2(nextPosition.x, nextPosition.y));
mAddedFromDragAndDrop = false;
}
else
{
for (auto& node : nodesOut)
{
node->updateSlotNames(inputsString.c_str(), outputsString.c_str());
}
}
}

updatePins();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1975,6 +1975,11 @@ namespace ImGui {
isOpen = true;
}

IMGUI_API void Node::updateSlotNames(const char* inputSlotNamesSeparatedBySemicolons, const char* outputSlotNamesSeparatedBySemicolons) {
InputsCount = ProcessSlotNamesSeparatedBySemicolons<IMGUINODE_MAX_INPUT_SLOTS>(inputSlotNamesSeparatedBySemicolons, InputNames);
OutputsCount = ProcessSlotNamesSeparatedBySemicolons<IMGUINODE_MAX_OUTPUT_SLOTS>(outputSlotNamesSeparatedBySemicolons, OutputNames);
}

/*
bool FieldInfo::copyFrom(const FieldInfo &f) {
if (!isCompatibleWith(f)) return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,7 @@ namespace ImGui {
inline int getNumInputSlots() const { return InputsCount; }
inline int getNumOutputSlots() const { return OutputsCount; }
inline void setOpen(bool flag) { isOpen = flag; }
IMGUI_API void updateSlotNames(const char* inputSlotNamesSeparatedBySemicolons = NULL, const char* outputSlotNamesSeparatedBySemicolons = NULL);

protected:
FieldInfoVector fields; // I guess you can just skip these at all and implement virtual methods... but it was supposed to be useful...
Expand Down