Commit graph

237 commits

Author SHA1 Message Date
Aurore LAFAURIE
5d70a51285 [core] Set internal attributes when copy/pasting nodes 2024-04-26 15:56:26 +02:00
Candice Bentéjac
e9ee9f2315 Update ListAttributes identically when removing edges or nodes
The behaviour regarding `ListAttributes` was different depending on
whether an edge or a node was removed:
- if an edge was removed, the `ListAttribute` that was the destination
of that edge had its corresponding element completely removed;
- if a node was removed, the `ListAttribute` that was the destination
of one of the node's edges had its corresponding element reset, but not
removed.

With this behaviour, a user had different UIDs depending on whether
a single edge or the whole node had been removed where the UID should
always be identical.
2024-02-02 15:23:44 +01:00
Candice Bentéjac
610ac36376 [core] Preserve edges by recreating all the nodes during UID evaluation
Up until this commit, compatibility nodes (which necessarily had a version
or description issue) were ignored during the evaluation of UID conflicts,
as they had no UID.

This however created a bug, where already existing compatibility nodes
with inputs from nodes that triggered UID conflicts were losing their
input connections: when the node with the UID conflict was replaced with
a new compatibility node (with a UID conflict issue), the link was broken
and could not be resolved anymore as it lost any mention of the input
node's name. This was also valid for nodes without any compatibility issue
which had UID conflicted-nodes as their inputs.

Processing all the nodes in addition to those with a UID conflict issue
prevents this from happening: edges are correctly preserved.

This also fixes an issue that occurred when opening a project file that
contained nodes whose type was not recognized. Instead of raising an
"unknown node type" compatibility issue, "attribute is already connected"
errors were raised for the unrecognized nodes.
2023-07-24 15:26:37 +02:00
Candice Bentéjac
cdf5c6746f [core] Graph: Detect UID conflicts when loading a graph
When loading the graph, once all the nodes have been created and the
links resolved, the computed nodes' UID can be compared with those
stored in the graph.

If a mismatch is detected, the node that presents the UID conflict is
removed from the graph and replaced with a CompatibilityNode, set with
`UidConflict`.

Nodes that come from templates are ignored as no UID is stored in
templates. Similarly, nodes that are already Compatibility nodes are left
out as they do not have a UID.
2023-06-16 09:02:59 +02:00
Loïc Vital
750d2d9b34 [core] graph: propagate dependenciesOnly through flowEdges args 2023-06-15 02:10:18 -07:00
Loïc Vital
a30027bcf9 [core] use dependencies only for flow edges computation 2023-06-15 02:00:52 -07:00
Fabien Castan
ce2085faad
Merge pull request #1744 from alicevision/dev/internalAttributes
Add internal attributes in "Notes" tab
2023-03-05 13:46:47 +01:00
Candice Bentéjac
99b82e601f Ignore "Publish" nodes when loading a template unless specified otherwise
This commit adds an option to the "load" method, "publishOutputs", that
determines whether "Publish" nodes in a template project file should be
ignored during the graph's creation.

If "publishOutputs=True", then the "Publish" nodes from the template will
be added to the graph. "Publish" nodes in a project file that is not
a template will not be affected by this and will always be added to the
graph, as any other node.

This allows to have templates that are compatible with meshroom_batch,
which requires a "Publish" node when the --output option is specified,
while not having unneeded nodes in the UI or unneeded operations:
when --output is specified in meshroom_batch, "publishOutputs=True",
otherwise it will be set to False so that the "Publish" nodes are not
executed needlessly.
2023-02-27 18:34:51 +01:00
Candice Bentéjac
91db7657ac [core] Don't write "internalInputs" entry in templates if there are only default values
Non-default internal attributes need to be written in the templates,
but the "internalInputs" entry in the dictionary should not be written
at all if all the internal attributes are set to their default values.
2023-02-15 08:36:13 +00:00
Candice Bentéjac
fe3a0764b0 [core] Do not save default internal attributes in template mode 2023-02-15 08:36:11 +00:00
Candice Bentéjac
9bc9e2c129 Add "Notes" tab with "comment"/"invalid comment" attributes
Add two internal attributes, "Comment" and "Invalid comment", in
a specific "Notes" tab, which will contain any further internal
attribute. Internal attributes exist for all nodes.
2023-02-15 08:36:10 +00:00
Candice Bentéjac
635f85e7fd Remove all references to pyCompatibility
- "pyCompatibility.basestring" are replaced by standard Python3 "str"
- "Sequence" and "Iterable" from "collections" are now directly imported
with "collections.abc"
2022-12-05 17:16:21 +01:00
Fabien Castan
ffca9c68e3
Merge pull request #1824 from alicevision/dev/submitterJobTitles
[submitters] Add an option to update the job title on submitters
2022-12-05 16:22:33 +01:00
Candice Bentéjac
eac43c84c3 [submitters] Add an option to update the job title on submitters 2022-12-05 15:23:10 +01:00
Candice Bentéjac
b08f83552e [ui] Clear locally submitted nodes before loading a new graph
When loading a new graph while the opened one was locally computing nodes,
computations were automatically stopped to be able to load the new graph.
However, the computing chunks' status were not being updated before
the graphs were switched up. This meant that opening that previously
computing graph again would lead to a display in which nodes appeared to
be computing although there was no ongoing computations.
2022-11-28 10:06:57 +01: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
371c8a2238 [core] Do not write nodes' UIDs when saving templates 2022-10-21 16:20:37 +02:00
Fabien Castan
243c278bcc
Merge pull request #1778 from alicevision/dev/lv/useLastPathForOpenSave
Use most recent project as base folder for file dialogs
2022-09-28 23:06:54 +02:00
Loïc Vital
d0fcb67d1c [ui] rename Import Scene to Import Project for coherent naming 2022-09-23 11:22:36 +02:00
Candice Bentéjac
aa728919c8 [core] Explicitly set "template" key to false when saving as a regular file 2022-09-23 09:20:44 +02:00
Fabien Castan
27faf9f77c
Merge pull request #1758 from alicevision/dev/copyPasteNode
Support copying/pasting a node in the Graph Editor
2022-09-08 17:42:12 +02:00
Fabien Castan
267aff5a09
Merge pull request #1767 from alicevision/bugfix-tonode-submit
removed duplicated call to findnodes
2022-09-07 20:21:30 +02:00
Candice Bentéjac
d06acf6722 Reconnect copied/pasted nodes together but not to the graph
If several nodes are described in the clipboard and are supposed to
be connected with each other, reconnect them together, but do not
attempt to reconnect them to the graph they were copied from, even if
it is the current graph.
2022-09-06 11:13:29 +02:00
Matthieu Hog
f491b5a77b removed duplicated call to findnodes 2022-09-06 10:57:29 +02:00
Candice Bentéjac
c44b2a8c00 Add "minimal" mode for template files
Add a specific option to save a graph as a template ("Save As
Template") in "minimal" mode.

This mode only saves, for each node in the graph, the input and
output attributes whose values differ from the default ones. Any
attribute that is not serialized in the saved template file is
assumed to have its default value.
If a conflict is detected on a node when opening the template
file, it is logged but solved automatically.

The goal of this minimal mode is to prevent template files from
needing an update every single time a modification (may it be
minor or major) is done on a node description. Templates can
thus follow node changes and still be usable.
2022-09-06 09:43:19 +02:00
Candice Bentéjac
a33f79e4d7 Import a scene from an .mg file into the current graph
Add an "Import Scene" (Ctrl+Shift+I) option in the File menu
that allows to select an existing .mg file and import it in the
current graph.

The imported scene will automatically be placed below the lowest
existing node along the Y axis.
2022-08-31 10:50:35 +02:00
Candice Bentéjac
5b65866e49 [ui] Paste a node on the mouse's position
When creating a node with a "paste" operation, place the node
on the mouse's position in the graph instead of default position (0,0).

If the mouse is placed on an existing node, the pasted node will be
placed on the mouse's position plus an offset so that the pasted node
does not directly overlap with the existing node.
2022-08-19 12:02:09 +02:00
Candice Bentéjac
ddda62a652 Add node to graph with Ctrl+V if valid node content is in the clipboard
Attempt to paste the clipboard's content in the graph when Ctrl+V is
pressed. If the clipboard contains a valid node description, add the
corresponding node to the graph.
Otherwise, do nothing.
2022-08-19 12:00:16 +02:00
Candice Bentéjac
659c8a05ed Add abstract InitNode
InitNode is an abstract class which is meant to be inherited
by all the initialization nodes (such as CameraInit), included
those that might be created by the user.

InitNode contains methods that can be reimplemented by the
children classes if necessary.

This abstract class allows to keep on using scripts such as
meshroom_batch without having to modify them specifically or
being limited to using a CameraInit node.
2022-08-05 10:42:59 +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
945f59e00c Retrieve file features for templates
When a project file is opened as such, its filepath is stored
and all its features are retrieved as a consequence. Templates
were hard-coded instead of opened as files, so there never was
any need to load their features.

Now that .mg files can be opened both as projects and pipelines,
we need to retrieve the features in both cases, whether the filepath
is stored (file opened as project) or not (file opened as template).
This can be useful to retrieve the layout contained in the .mg file
for the pipeline, for example.
2022-07-21 15:28:36 +02:00
Fabien Castan
ae0c65f563 [core] do not use the task manager in batch command line tools
Avoid usage of multi-threading to launch the computation in command line
tools without interactive needs
2021-10-19 15:48:07 +02:00
Fabien Castan
f44e834970 [core] fix batch 2021-09-13 10:17:39 +02:00
Landrodie
79955ddae6 [core] Change attribute name and label properties
Adding new properties and updating the call to previous ones.
Properties are now :
* label : getLabel
* fullLabel : getFullLabel
* fullLabelToNode : getFullLabelToNode
* fullLabelToGraph : getFullLabelToGraph

Same for the name.
2021-08-23 17:52:40 +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
fdfabf0066 [ui] GraphEditor: use entire node selection when handling '_ from here' operations 2021-04-18 14:33:17 +01:00
ChemicalXandco
acf1bf2116 [ui] grapheditor: explicitly pass selected nodes argument 2021-01-26 21:13:16 +00:00
Fabien Castan
37d3008f9e [core] rename nodesOfType 2021-01-22 13:12:29 +01:00
ChemicalXandco
c253e7d363 [ui] add support for selecting multiple nodes at once 2021-01-15 18:16:45 +00:00
Fabien Castan
d291fcc39d [core] graph: use new dependenciesOnly option on graph operations
Input attribute to input attribute connection is not a real dependency between the nodes.
2020-12-14 19:02:49 +01:00
Fabien Castan
1102ce84e0 Merge branch 'develop' of github.com:alicevision/meshroom into dev/nodesAndTaskManager
Conflicts:
	meshroom/core/graph.py
	meshroom/ui/qml/main.qml
2020-12-01 20:02:43 +01:00
Julien-Haudegond
e91dab1a63 [core] Graph.canSubmitOrCompute: add documentation 2020-09-05 15:34:05 +02:00
Fabien Castan
44fe0620c7 [core] graph: fix retrieve first submitter 2020-09-05 01:18:03 +02:00
Fabien Castan
c8978cd792 [core] Graph.findNode: if multiple candidates, do not raise an error if one is the exact input 2020-09-04 19:51:07 +02:00
Julien-Haudegond
37c758c8da [core/tests] Graph: default startNodes parameter in dfsOnDiscover() 2020-09-04 15:39:27 +02:00
Julien-Haudegond
deaf1e3abb [core] Graph: fix reverse issue in dfs() 2020-09-04 15:35:48 +02:00
Julien-Haudegond
8499431dff [core] Graph: add getRootNodes() 2020-09-04 15:21:03 +02:00
Julien-Haudegond
44d019b7f0 [core] Graph: move reverse property from dfs() to Visitor class 2020-09-04 15:11:19 +02:00
Julien-Haudegond
e4a95e89dc [core] Graph: change signature of dfsOnFinish() 2020-09-04 13:05:18 +02:00