Commit graph

93 commits

Author SHA1 Message Date
Candice Bentéjac
53de9090ca [tests] Replace desc.Node.internalFolder with {nodeCacheFolder} 2025-03-05 13:36:32 +00:00
Yann Lanthony
062bc3ca28 [core] ChoiceParam: add option to serialize overriden values
Introduce a new `saveValuesOverride` parameter on desc.ChoiceParam to define
whether to serialize the list of possible values if they have been overridden at runtime.
2025-02-21 10:45:26 +01:00
Yann Lanthony
90acb93ea8 [core] Trigger node desc creation callback only for explicit node creation
The desc.Node.onCreated callback is a hook in the Node API for developers to
write custom behavior on a node first initialization.
By being called in the core.Node constructor, this was triggered in several situations
that don't match this idea and with unpredictable side effects (graph loading, node re-creation on undo...).

* Make `onNodeCreated` callback an explicit method on desc.Node.
* Remove the call to node descriptor's `onNodeCreated` callback outside core.Node constructor.
* Trigger this callback on explicit node creation (adding new node to graph, init a graph from a template).
2025-02-14 11:42:22 +01:00
Yann Lanthony
0594f593f2 [core][graphIO] PartialSerializer: fix List/GroupAttribute link serialization
Ensure attribute input connection is serialized, even for List/GroupAttributes.
Note: while connecting GroupAttributes is not yet supported, this will benefit
this type of attribute once it is.
2025-02-06 18:19:19 +01:00
Yann Lanthony
25094ac877 [core] Handle missing link nodes when deserializing edges
Avoid uncaught errors when deserializing edges in case linked
nodes are missing.
Handle missing nodes the same way missing attributes are dealt with.
2025-02-06 16:46:05 +01:00
Yann Lanthony
87fbcee06d [core][graphIO] Improve node type version handling
* Deserialization: Replace the logic that defaulted the node type version to "0.0" when unspecified,
and assume that unspecified version on a node is targetting current node type version.
* Serialization: Only serialize node type versions for which a version info is available.

* Test suites:
  * Add helper context manager to manually override the version of a given node type.
  * Add new unit tests to cover version conflicts handling is various scenarios.
2025-02-06 16:46:05 +01:00
Yann Lanthony
4e29b83226 [test] Extra partial serialization tests 2025-02-06 16:46:05 +01:00
Yann Lanthony
9794f43ed1 [core] Graph: improved uid conflicts evaluation on deserialization
At the end of the deserialization process, solve node uid conflicts iteratively by node depths,
and only replace the conflicting nodes with a CompatibilityNode.

Add new test suite for testing uid conflict handling.
2025-02-06 16:46:04 +01:00
Yann Lanthony
45ef4b592d [core] Graph: add replaceNode method
Factorize the logic of replacing a node with another one and re-creating
output edges into `Graph.replaceNode`  and `Graph._restoreOutEdges`.
2025-02-06 16:46:04 +01:00
Yann Lanthony
bfc642e2dc [core] Add Graph.copy method
Add a new method to create a copy of a graph instance, relying on
chaining serialization and deserialization operations.
Add test suite to validate its behavior, and the underlying serialization processes.
2025-02-06 16:46:04 +01:00
Yann Lanthony
6b75dcb356 [core][graphIO] Introduce PartialGraphSerializer
Add a new serializer class to manage partial graph serialization logic,
ensuring to remove link expressions on attributes refering to nodes
that are not in the subset of nodes to serialize.
2025-02-06 16:46:04 +01:00
Yann Lanthony
a665200c38 [core] Introducing new graphIO module
Move Graph.IO internal class to its own module, and rename it to `GraphIO`.
This avoid nested classes within the core Graph class, and starts decoupling
the management of graph's IO from the logic of the graph itself.
2025-02-06 16:46:04 +01:00
Yann Lanthony
3064cb9b35 [core] CompatibilityNode: do not use link expressions as default values for unknown File attributes
When creating a compatibility description for an unknown attribute, do not
consider a link expression as the default value for a File attribute.
This is breaking how the link expression solving system works, as it's resetting
the attribute to its default value after applying the link.
If that expression is kept as the default value, it can be re-evaluated several
times incorrectly.
Added a test case that was failing before that change to illustrate the issue.
2025-02-06 16:46:04 +01:00
Yann Lanthony
4aec741a89 [core] Graph: add importGraphContent API
Extract the logic of importing the content of a graph within a graph instance from
the graph loading logic.
Add `Graph.importGraphContent` and `Graph.importGraphContentFromFile`
methods.
Use the deserialization API to load the content in another temporary graph instance,
to handle the renaming of nodes using the Graph API, rather than manipulating
entries in a raw dictionnary.
2025-02-06 16:46:04 +01:00
Yann Lanthony
75db9dc16c [tests] Add extra compatibility tests
Add a new test suite for graph template loading.
2025-02-06 16:46:04 +01:00
Fabien Castan
66e3dd409d
Merge pull request #2599 from alicevision/dev/qt6.6
Qt6.6.3 / PySide6.6.3.1 upgrade
2024-11-22 12:39:09 +00:00
Yann Lanthony
98f1a9d516 [tests] Update tests to load graphs with strictCompatibility
Update tests that should fail if nodes are loaded as
CompatibilityNodes (resulting in false positives).
2024-11-14 19:11:08 +01:00
Yann Lanthony
3218c41bdc [tests] Add strictCompatibility graph loading test 2024-11-14 19:11:08 +01:00
Candice Bentéjac
579371fd7c [qt6] Replace all PySide2/shiboken2 imports by PySide6/shiboken6 2024-11-07 18:08:54 +01:00
Yann Lanthony
3cc57f89e6 [tests] Attribute callback behavior on clearing upstream dynamic output 2024-10-28 10:33:05 +01:00
Yann Lanthony
7c21595da9 [tests] Test attribute callback behavior with dynamic outputs
New test suite that focuses on testing the behavior of the attribute
changes callback system when such an attribute is connected to
an upstream dynamic output value.
2024-10-26 23:39:11 +02:00
Yann Lanthony
e73e8f2fd7 [tests] Attribute callback behavior with upstream compound attributes
Test value change propagation and callback trigger
for attribute connected to Group and ListAttribues.
2024-10-25 18:53:02 +02:00
Yann Lanthony
31c5a5de5f [tests] Test graph loading behavior on connected attributes with callbacks 2024-10-25 18:44:05 +02:00
Yann Lanthony
4f82fa82ce [tests] Test suite for node attributeChanged callback mechanism
Suite of tests to validate the behavior of desc.Node 'on{Attribute}Changed' behavior.
2024-10-25 12:02:49 +02:00
Yann Lanthony
5b72131930 [tests] Add graph-testing fixtures
Introduce test fixture to simplify graph testing in isolation.
2024-10-25 11:47:33 +02:00
Candice Bentéjac
ec0721d381 [tests] Remove invalid= when the implicit argument is enough 2024-09-12 10:54:19 +02:00
Candice Bentéjac
41e885d9ff Linting: Clean-up files 2024-09-12 10:50:13 +02:00
Candice Bentéjac
d67062d39d [tests] Update unit tests with new UID system 2024-09-12 10:41:57 +02:00
Vincent Demoulin
ed4916e803 Update tests with init functions 2024-07-05 15:46:59 +02:00
Fabien Castan
020dbecc68 [core] attribute: new initValue, independant from the resetToDefaultValue
Avoid to evaluate the default value if we don't need to.
2024-06-15 18:05:24 +02:00
Fabien Castan
4e3f718786 [tests] add explicit check on the list of attribute names 2024-06-15 17:15:58 +02:00
Fabien Castan
c986b4a134 [common] DictModel get does not raise errors as in Python
getr raises an error if the key does not exist
2024-06-15 17:10:46 +02:00
Aurore LAFAURIE
57a1119b21 [tests] Update tests according to attribute enabled 2024-06-07 17:37:20 +02:00
Fabien Castan
a243ac3de2 [tests] Add a specific name for each graph 2024-05-29 23:01:41 +02:00
Aurore LAFAURIE
5101530b89 [tests] Add test for upgrade of nodes without computation 2024-05-27 22:03:42 +02:00
Fabien Servant
d8238517af Change camera models 2024-03-24 22:38:33 +01:00
Fabien Castan
c6d0933d4f [core] Value need to be exposed without quotes to allow to compose simple expressions
For instance, on the Meshing node "outputMesh" param expression is:
value="{cache}/{nodeType}/{uid0}/mesh.{outputMeshFileTypeValue}",

So the extension here should not contains quotes.
2024-02-02 20:14:15 +01:00
Fabien Castan
a35f1c72e2 [core] Update formatting with quotes for List and Group
If the joinChar is NOT space, we use global quotes.
If the joinChar is space, we use quotes per element.
2024-02-02 15:16:58 +01:00
demoulinv
a7fc167512 [core] String formatting of parameters with/without quotes to deal with spaces in strings
We have the problem of spaces in file paths, choices (like colorspace),
etc.
An empty list is not send to the command line.
An empty string is send to the command line as "".
Add new unit test to ensure it follows the expected rules.
2024-02-01 18:28:51 +01:00
Candice Bentéjac
f88e7d2a0a [tests] TemplatesVersion: Add message when compatibility assertion is raised
If a compatibility issue is found and the assertion is raised, a message
is now displayed to indicate which template (with its path) and which
node (with its node type) caused the issue.
2023-04-07 08:02:14 +01:00
Candice Bentéjac
b470078667 [tests] Add checks on internal attributes in the templatesVersion test
If some internal attributes are saved in the templates, their description
should be checked just like the input attributes to ensure there are no
conflicts.
2023-02-15 08:36:14 +00:00
Candice Bentéjac
10844747f0 [core] Do not write outputs, internal folder and parallelization in templates
For every node, the only information that is kept when saving a
template are the non-default input attributes' values as well as the
node's position.

The unit test checking the templates' nodes is updated to stop taking
outputs into account.
2022-10-21 16:54:17 +02:00
Candice Bentéjac
02f87ff634 [tests] Add a unit test to check for templates' versions
This test checks that there is no compatibility issue with the nodes
saved in the template files. It fails when an upgrade of a templates is
needed. Any template can still be opened even if its nodes are not up-to-
date, as they will be automatically upgraded.
2022-10-21 16:20:12 +02:00
Candice Bentéjac
5b45182bcb [tests] Check that UIDs are identical when writing and loading a graph 2022-09-26 18:18:14 +02:00
Fabien Castan
dd5aadd875
Merge pull request #1738 from alicevision/fix/undoDuplicatedNodes
Fix node duplication/removal behaviour
2022-08-01 15:56:48 +02:00
Candice Bentéjac
b77274a027 Store all duplicates of a node correctly upon their creation
Duplicates used to be stored in a dictionary with an entry being
"parent node": "duplicated node". On occasions where a single
parent node was duplicated more than once, the latest duplicated
 node erased the previous one(s), and these older ones were
"lost": after being created, there was no trace left of their
existence in the duplication operation. Undoing that duplication
operation was thus leaving these duplicated nodes out and not
removing them.

Duplicated nodes are now stored as "parent node": [list of
duplicated nodes] to keep track of all the created nodes,
effectively removing them upon an "undo".
2022-07-28 14:13:31 +02:00
Candice Bentéjac
8fb0c778d1 Add support for external pipelines using project files
- Support loading external pipelines as templates with project files
- Add template files for some standard pipelines
- Remove the hard-coded generation of new pipelines
- Update multiviewPipeline test: the multiviewPipeline test relied on the hard-coded generation of
pipelines.
2022-07-12 14:56:24 +02:00
Fabien Castan
18be350e6f
Merge pull request #1227 from ChemicalXandco/box_select
[ui] add support for selecting multiple nodes at once
2021-05-03 23:42:11 +02:00
ChemicalXandco
55b16bc6d3 [tests] update node duplication test 2021-02-03 22:29:31 +00:00
Fabien Castan
37d3008f9e [core] rename nodesOfType 2021-01-22 13:12:29 +01:00