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

Node Definition Creation in Graph Editor #1404

Closed

Conversation

kwokcb
Copy link
Contributor

@kwokcb kwokcb commented Jul 11, 2023

Integration

  • nodedef creation has been hooked up into "create definition" workflow in node editor.
    • For now only the node category and a compound node graph is required with all other arguments being optional.
    • A single document on disk is created in a default "user library" location, unless an explicit file location is specified.
    • The "user library" will be loaded by default on startup if it's exists.
    • New definitions can be manually reloaded within a work session as desired.
    • Users can still add in additional library paths from the command line as before.
Publishing_V1.mp4

@lfl-eholthouser: leaving ping as your the gate-keeper for this. It's the same change from an older PR but extracted out. Only the GraphEditor changes are new. The rest are inherited from #1403.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only files in MaterialXGraphEditor are new. Rest are from the other PR.

@@ -50,18 +51,57 @@ std::string getNodeDefId(const std::string& val)

} // anonymous namespace

bool NodeDefParameters::generateIdentifiers(mx::NodeGraphPtr nodeGraph)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

node identifier creator.

_initial(false),
_delete(false),
_fileDialogSave(FileDialog::EnterNewFilename),
_fileDialogCreateDefinition(FileDialog::EnterNewFilename),
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New dialog for definition save.

@@ -130,8 +175,24 @@ void Graph::loadStandardLibraries()
// Initialize the standard library.
try
{
// Emit the folders and search path if custom libraries are specified.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check for default "user library" definitions.

std::vector<mx::OutputPtr> outputs = nodeGraph->getOutputs();
if (doc && !outputs.empty())
{
parameters.generateIdentifiers(nodeGraph);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

UI value extraction and cleanup before calling creator.

}
}

void Graph::addCreateDefinitionPopup()
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the main UI.

  • Version and namespace are optionally enabled UI
  • "Custom" library location enabling allows for a file dialog to be used to specific a specific custom location (vs the default user location).

static std::string fileName;
static bool useExplicitFile = false;
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(0, 0));
ImGui::Checkbox("Custom Location", &useExplicitFile);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Custom save location UI.

@@ -3365,6 +3744,18 @@ void Graph::propertyEditor()
ImGui::SetWindowFontScale(1.0f);
ImGui::EndPopup();
}

if (_currUiNode->getNodeGraph() != nullptr)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Exposure of definition creation for nodegraphs in property editor.

@@ -32,13 +32,64 @@ struct Link
}
};

class NodeDefParameters
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Block of possible creation parameters filled in the ui and passed to the method to perform creation and save.

@@ -126,6 +127,10 @@ int main(int argc, char* const argv[])
{
libraryFolders.push_back(nextToken);
}
else if (token == "--userLibrary")
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Allow for custom default location of "user library" on startup.

@kwokcb kwokcb closed this Oct 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant