-
Notifications
You must be signed in to change notification settings - Fork 7
Merging develop #38
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
Merging develop #38
Conversation
…nux, including .desktop file and PNG icon
… install MCP variant optionally
…ew function models from selected nodes and replace them with FunctionCall in the source model
…unctionExtractor - Introduced a new struct `ExtractNameEntry` in `ModelEditor.h` to manage extraction name editing state, including a stable key, editable name, and type. - Added vectors to store proposed and edited input/output names for extraction. - Implemented a unit test in `FunctionExtractor_tests.cpp` to verify that custom names for function arguments and outputs are applied correctly and remain unique during extraction.
…e quality and best practices
…ude initial steps for understanding recent commits
… enhance user experience with back/forward navigation
…thods for program builds
…che loading conditions
…flag for fullscreen state
…of 'Matrix' for improved clarity
…ius_playground into 3dJan/UX2
…apability and update MainWindow to toggle span mode
…text menu for creating nodes in the editor
…s and inlining optimization
…de IDs; update OutputPortReferenceAnalyzer to utilize this method for marking reachable nodes
…d related nodes; update legacy references to support new naming convention
…ace ".matrix" with ".result" in output resolution logic
… unary, binary, and ternary operations
…rs and restore metadata; improve input handling in NodeBase [ToOCLVisitor] Update output port references from "Matrix" to "Result" for consistency in output resolution logic
…st files [GladiusLib_tests.cpp] Refactor tests to include utility functions for 3MF file handling and implement parameterized tests for bounding box validation
…renceAnalyzer functionality
…nt BeamLatticeExporter
… enum for acceleration type and update related methods
…mpute spatial gradients using central finite differences and mirror referenced function inputs
- Introduced the FunctionGradient node to compute the normalized gradient of a referenced function. - Implemented necessary methods for resolving function IDs, updating inputs and outputs, and validating configurations. - Enhanced the Assembly and Model classes to accommodate FunctionGradient nodes. - Updated the NodeFactory to create FunctionGradient instances. - Added UI controls for FunctionGradient in NodeView, allowing users to select scalar outputs and vector inputs. - Implemented visitor patterns for FunctionGradient in various visitors (ToCommandStreamVisitor, ToOCLVisitor, Visitor). - Ensured proper integration with existing nodes and error handling for invalid configurations.
…ctionality and behavior
…3djan/FixResourceOrder) and update SHA
…p size control Replace the combo widgets with button-driven popups for FunctionGradient scalar/vector selection to avoid dangling references in the node editor. Use ModelEditor->showPopupMenu to open per-node popups, capture data by-value, and apply selections by updating the node, setting m_parameterChanged, and marking the model as modified when available Replace ImGui::SeparatorText with a plain header text for the gradient section Add a Step Size DragFloat control that clamps negative values to zero, ensures the parameter is set modifiable, sets m_parameterChanged, and marks the model modified on change
…d avoid backup during async refresh - ToOCLVisitor: add checks and early returns for missing/unused gradient output, null assembly, missing referenced model, wrong output type, unconsumed output, missing/invalid vector input and missing step size; emit a safe float3(0.0f) fallback (inlined or as local var) instead of throwing to make OCL generation resilient - Writer3mf: detect functions containing FunctionGradient nodes and skip 3MF serialization while logging a warning to avoid NodeTypeMap/runtime errors; add TODO for future full serialization support - Document: comment out saveBackup() call in refreshModelAsync to prevent backups being triggered during asynchronous model refresh
…, cache lowered functions, validate configurations, wire parameters and replace FunctionGradient nodes with FunctionCall; include parameter copying, consumer rewiring, name sanitization and error reporting
…ector to ignore non-gradient nodes during detection
…ngth to B, zero to C and one to D
…creating FunctionGradient nodes from FunctionCall and run lowering pass with error reporting - Add functionCallControls to create a FunctionGradient from a FunctionCall (set function id, register inputs/outputs, copy parameter links or values, mark outputs used) - Add "Create Function Gradient" button invocation in node content rendering - Add "Lower Function Gradients" button and logic in functionGradientControls to run nodes::LowerFunctionGradient, collect/report errors, update assembly/model state and notify ModelEditor - Add m_lowerGradientMessage and m_lowerGradientMessageIsError members for feedback display - Add necessary include for nodes/LowerFunctionGradient and <exception> - Wrap lowering/creation operations in try/catch and surface messages; set m_parameterChanged/m_modelChanged when modifications occur
…n UI, run lowering pass during assembly flattening, and fix mask wiring in lowering
…t lowering, reuse and error reporting; add ToOclVisitor fallback test to FunctionGradient_tests
…rough lowering and OCL emission - Add FieldNames::Gradient and FieldNames::Magnitude constants - Extend FunctionGradient type rule to include Gradient (float3) and Magnitude (float) - Preserve and create Gradient and Magnitude output ports in FunctionGradient::updateInternalOutputs - In LowerFunctionGradient, register Gradient and Magnitude inputs on synthesized end node and wire: - raw gradient -> mask -> Gradient input (Multiplication) - length -> mask -> Magnitude input (Multiplication) - In ToOclVisitor, emit raw gradient and magnitude outputs (support inlining where possible or emit defined variables)
…xtension, lowering, and NormalizeDistanceField Add comprehensive architecture and design documents to thegreatplan: - gladius/thegreatplan/3mf-volumetric-implementation.md: describe 3MF volumetric & implicit namespaces, node graph model, pipeline, data types, and integration guidance - gladius/thegreatplan/FunctionGradientExtension.md: document FunctionGradient extension (raw gradient and magnitude outputs), codegen/inlining behavior, masking/zero-gradient handling, and tests - gladius/thegreatplan/FunctionGradientLowering.md: specify LowerFunctionGradient pass, function synthesis, caching, replacement algorithm, helpers, edge cases, and tests - gladius/thegreatplan/NormalizeDistanceFieldNode.md: propose NormalizeDistanceField node, lowering approach using FunctionGradient.magnitude, API/UX, testing and rollout plan - gladius/thegreatplan/more_ideas.md: add brief notes for mesh→beam-lattice importer and gradient node idea Provide implementation notes, testing strategy, and rollout guidance to enable subsequent implementation and integration
…nt and magnitude outputs Add assertions and new tests to verify FunctionGradient exposes Gradient and Magnitude outputs and that ToOclVisitor emits gradient/magnitude-related variables when those outputs are used. Update LowerFunctionGradient_tests to expect lowered functions to include Gradient and Magnitude outputs so lowering and OCL emission behavior are validated
…I, and 3MF/OCL support
- Introduce NormalizeDistanceField node (DerivedNodes.h / DerivedNodes.cpp)
- mirror referenced function inputs as arguments, provide FunctionId and StepSize params
- add selection/validation helpers and getters/setters for configuration
- Implement LowerNormalizeDistanceField lowering pass (new LowerNormalizeDistanceField.{h,cpp})
- find NormalizeDistanceField nodes, create helper functions that mirror referenced inputs
- compose normalization by creating helper FunctionCall, FunctionGradient, Max (epsilon), and Division nodes
- rewire consumers to normalized output, remove original NormalizeDistanceField node
- add error reporting, sanitization, parameter copying and linking utilities
- Wire lowering into assembly flattening (Document.cpp)
- run LowerNormalizeDistanceField after LowerFunctionGradient and before OptimizeOutputs
- UI: add creation and lowering controls in NodeView (NodeView.h / NodeView.cpp)
- allow creating a NormalizeDistanceField from a FunctionCall and lowering selected nodes interactively
- add status messaging for lowering results
- Visitor and OCL: add visitor hook and annotate ToOCL fallback output
- add NormalizeDistanceField visit methods (Visitor.h / Visitor.cpp)
- add nodesfwd entries and FieldNames for new params
- annotate FunctionGradient fallback in ToOCLVisitor output for diagnostics
- 3MF: mark import/export behavior for unsupported nodes
- add TODO comments in Importer3mf for NormalizeDistanceField/FunctionGradient import
- update Writer3mf to detect and skip functions containing FunctionGradient or NormalizeDistanceField with a warning
- Misc: add helper declarations and plumbing to support new node and lowering
…g, UI, OCL and tests - Importer3mf: map new 3MF node types (BeamLattice, FunctionGradient, NormalizeDistance) and allow dynamic inputs for FunctionCall/FunctionGradient/NormalizeDistance; initialize parameters (FunctionId/StepSize) and read selected scalar/vector names for implicit nodes - Writer3mf: add serialization for FunctionGradient nodes (emit scalar/vector selection, function resource and step constant) and update unsupported-node detection to skip NormalizeDistanceField until serialization is implemented - nodes/DerivedNodes: rename FunctionGradient vector output to NormalizedGradient and update type rules/ports and NormalizeDistanceField outputs to use Result per spec - nodes/LowerFunctionGradient: wire normalized gradient output through lowering, register mirrored NormalizedGradient input and rewire consumers accordingly - nodes/OptimizeOutputs & nodes/ToOCLVisitor: update consumers and inlining logic to reference NormalizedGradient - nodes/nodesfwd: add FieldNames::NormalizedGradient and adjust StepSize identifier - ui/NodeView: implement full NormalizeDistanceField configuration UI (select scalar output, select vector input, step size control, validation, and lowering button) with diagnostics and guarded lowering - tests: add NormalizeDistanceField unit tests covering inputs/outputs, defaults, lowering behavior (helper function, FunctionGradient creation, Division node), category and description - vcpkg overlay: update lib3mf REF and SHA to volumetric_beamlattice_gradient branch - docs: remove obsolete 3mf-volumetric-implementation.md Ensure consistency across nodes and lowering for normalized gradient handling and preserve backward compatibility where applicable
…umetric_beamlattice_gradient
Update CPACK_PACKAGE_VERSION_PATCH in CMakeLists, installDir in CMakePresets.json, revision in src/version.h, and version-string in vcpkg.json
3d jan/extended volumetric spec
…de *.txt and LICENSE in install patterns
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.
Pull Request Overview
This PR merges the develop branch into the current branch, introducing significant improvements across Linux desktop integration, build infrastructure, node graph capabilities, and codebase architecture. Key changes include:
- Enhanced Linux desktop integration with
.desktoplauncher and icon installation - New
FunctionGradientandNormalizeDistanceFieldnodes for advanced implicit modeling - Improved build system with version bump to 1.2.15 and dependency updates
- UI enhancements including function navigation history, node extraction refactoring, and multi-monitor fullscreen support
- New test infrastructure for output port reference analysis and gradient operations
Reviewed Changes
Copilot reviewed 72 out of 80 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
vcpkg.json, version.h |
Version bump to 1.2.15 |
vcpkg-overlay-ports/lib3mf* |
Removed unused lib3mflinux_ overlay, updated lib3mf reference |
thegreatplan/*.md |
Added comprehensive design documents for gradient nodes, distance field normalization, and function extraction |
tests/unittests/*_tests.cpp |
New test suites for FunctionGradient, NormalizeDistanceField, OutputPortReferenceAnalyzer, and FunctionExtractor |
tests/integrationtests/* |
Parameterized integration tests for bounding box validation across all 3MF files |
src/ui/* |
Major UI enhancements: navigation history, function extraction dialog, beam lattice import, multi-monitor support |
src/nodes/* |
Core node system additions: FunctionGradient, NormalizeDistanceField, lowering transformations, reference analyzer |
src/nodes/ToOCLVisitor.* |
Extended OpenCL code generation for gradient nodes with inlining optimizations |
src/nodes/NodeBase.* |
Improved parameter type updating with metadata preservation |
src/mcp/* |
MCP integration improvements for graph layout detection |
src/io/3mf/* |
New BeamLatticeExporter for 3MF beam lattice export |
|
|
||
| std::unordered_set<std::string> const & getUnsupported3mfFiles() | ||
| { | ||
| static std::unordered_set<std::string> const unsupported{ |
Copilot
AI
Oct 22, 2025
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.
The unsupported file list hardcodes "3mf-implicit.3mf" with a comment referencing GLA-OpenCL-45. Consider adding the ticket reference as an inline comment or using a more descriptive name to clarify why this file is excluded, improving maintainability when the issue is resolved.
| static std::unordered_set<std::string> const unsupported{ | |
| static std::unordered_set<std::string> const unsupported{ | |
| // Excluded due to known issue tracked in GLA-OpenCL-45 |
| { | ||
| auto const color = m_lowerGradientMessageIsError ? ImVec4(1.f, 0.4f, 0.4f, 1.f) | ||
| : ImVec4(0.6f, 0.8f, 1.f, 1.f); | ||
| ImGui::TextColored(color, "%s", m_lowerGradientMessage.c_str()); |
Copilot
AI
Oct 22, 2025
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.
[nitpick] Using "%s" format specifier with c_str() is correct to prevent format string injection vulnerabilities. However, consider simplifying by using ImGui::TextColored(color, m_lowerGradientMessage.c_str()) directly since the message doesn't contain format specifiers, or ensure consistent use of the safer pattern throughout the codebase.
| ImGui::TextColored(color, "%s", m_lowerGradientMessage.c_str()); | |
| ImGui::TextColored(color, m_lowerGradientMessage.c_str()); |
| // The gradient output is always consumed if the gradient node exists | ||
| // (it needs to evaluate the function to compute the gradient) | ||
| auto const & gradientOutputs = gradientNode.getOutputs(); | ||
| auto gradientOutIter = gradientOutputs.find(FieldNames::NormalizedGradient); |
Copilot
AI
Oct 22, 2025
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.
The code checks for FieldNames::NormalizedGradient but based on the node design in other files, the output field should be FieldNames::Vector. Verify the correct field name is used; this may prevent proper optimization of the gradient node's scalar output consumption.
| auto gradientOutIter = gradientOutputs.find(FieldNames::NormalizedGradient); | |
| auto gradientOutIter = gradientOutputs.find(FieldNames::Vector); |
| // Check if parameter already exists and has a different type | ||
| const auto iter = m_parameter.find(expectedName); | ||
| OptionalSource source; | ||
| ParameterId existingId{-1}; |
Copilot
AI
Oct 22, 2025
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.
Using -1 as a sentinel value for ParameterId is type-unsafe. Consider using std::optional<ParameterId> or defining a named constant like InvalidParameterId to make the intent clearer and prevent potential type confusion.
| char filenameBuf[512]; | ||
| size_t copyLen = std::min(m_filename.length(), sizeof(filenameBuf) - 1); | ||
| std::memcpy(filenameBuf, m_filename.c_str(), copyLen); | ||
| filenameBuf[copyLen] = '\0'; | ||
| if (ImGui::InputText("##filename", filenameBuf, sizeof(filenameBuf))) | ||
| { | ||
| m_filename = filenameBuf; |
Copilot
AI
Oct 22, 2025
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.
Manual buffer management with memcpy is error-prone. Since this uses ImGui's InputText with imgui_stdlib.h included (line 8), use ImGui::InputText("##filename", &m_filename) directly which accepts std::string* and eliminates the manual buffer handling.
| char filenameBuf[512]; | |
| size_t copyLen = std::min(m_filename.length(), sizeof(filenameBuf) - 1); | |
| std::memcpy(filenameBuf, m_filename.c_str(), copyLen); | |
| filenameBuf[copyLen] = '\0'; | |
| if (ImGui::InputText("##filename", filenameBuf, sizeof(filenameBuf))) | |
| { | |
| m_filename = filenameBuf; | |
| if (ImGui::InputText("##filename", &m_filename)) | |
| { | |
| // m_filename is updated automatically |
This pull request introduces several improvements and new features to the Gladius project, focusing on enhanced Linux desktop integration, a more flexible beam lattice acceleration structure, build and packaging improvements, and codebase maintainability. The most significant updates are grouped as follows:
Linux Desktop Integration and Packaging Improvements:
.desktoplauncher and icon for Linux, improving desktop environment integration. The icon is now installed in the system icon theme directory, and the desktop entry is generated from a template (gladius/cmake/desktop/gladius.desktop.in) and installed system-wide. [1] [2]Beam Lattice Acceleration Refactor:
useVoxelAccelerationwith a newBeamLatticeAccelerationenum, allowing explicit selection between BVH and Voxel acceleration structures. This change improves code clarity and extensibility inBeamLatticeResource. [1] [2] [3] [4] [5] [6]Build System and Versioning Updates:
installtarget now depends on building all targets to avoid packaging incomplete builds. [1] [2] [3] [4]OpenCL Program Management Enhancements:
CLProgram, enabled binary caching by default, and introduced new signature helpers for cache management. [1] [2] [3]Codebase Maintenance and Minor Improvements:
Document.cpp, commented out unusedsaveBackup()call, and updated the document refresh and optimization logic for improved maintainability. [1] [2] [3] [4] [5]