Commit graph

50 commits

Author SHA1 Message Date
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
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
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
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
ChemicalXandco
acf1bf2116 [ui] grapheditor: explicitly pass selected nodes argument 2021-01-26 21:13:16 +00:00
ChemicalXandco
c253e7d363 [ui] add support for selecting multiple nodes at once 2021-01-15 18:16:45 +00:00
Fabien Castan
5fb6a5fb0f [ui] GraphEditor: only connect compatible attributes 2020-12-28 16:18:51 +01:00
Julien-Haudegond
5f444e6810 [ui] Commands: handle undo stack while computing and submitting
Computing: lock the undo stack at the current index to avoid going back too far and potentially alter computing process.
Submitting: clear the undo stack.
2020-09-02 11:30:12 +02:00
Yann Lanthony
400835d8f8 [core] Attribute: expose 'fullName' as property 2018-11-19 15:17:36 +01:00
Yann Lanthony
f415745a4a [ui] make Nodes moves undoable
Handle nodes move and auto-layout on Python side by using GraphLayout and MoveNodeCommand.

* Node QML component relies on underlying core.Node object's position
* MoveNodeCommand is called after a Node has been dragged
* partial/full auto-layout for specific graph operations (Duplication, Augmentation...) are now part of those operations
* serialized position in node data allows to properly restore nodes coordinates on undo/redo
* remove all layout/node moving code from QML
2018-07-26 22:46:22 +02:00
Yann Lanthony
830173047c [ui][commands] Duplicate/UpgradeNode: return created Node instances 2018-07-26 22:43:48 +02:00
Yann Lanthony
ac4772fc57 [ui][commands] add MoveNodeCommand
add undoable command to move a Node to a target position
2018-07-26 18:01:11 +02:00
Yann Lanthony
93dd055f72 [clean] fix variable names and typos
* node_factory & attribute_factory to camelCase
* fix depths variable in updateNodesTopologicalData
2018-07-26 12:11:43 +02:00
Yann Lanthony
dd3d9cd54b [core][ui] add upgradeAllNodes methods
+ check if node is upgradable in UpgradeNodeCommand
2018-07-20 17:55:30 +02:00
Yann Lanthony
2952e11691 [core] move duplicateNode methods to core.graph
handle this low-level operation engine side

* fix ListAttribute children links duplication
* handle CompatibilityNode duplication
* move corresponding unit test in test_graph.py
* [ui] add DuplicateNodeCommand
2018-07-19 13:50:45 +02:00
Yann Lanthony
a18d75c0f9 [ui][commands] expose UpgradeNode command 2018-07-19 13:50:45 +02:00
Yann Lanthony
33eb7f3a7f [core] introduce CompatibilityNode for improved scene compatibilities
Improve node serialization/deserialization to be able to recreate the exact same node in the graph when loading a meshroom project, even if the corresponding node's description has changed or does not exist anymore. This allows to recover already computed data on disk, without being impacted by changed uids. CompatibilityNode also provides an on-demand upgrade system to turn into a Node that meets the current node description (if possible).
 
* new abstract class BaseNode, base class for Node and CompatibiliyNode 
* Node: serialize everything needed to spawn a CompatibilityNode with precomputed outputs: inputs, uids, parallelization settings, unresolved internal folders and outputs
* node_factory: handles node deserialization and compatibility issues to create either a Node or a CompatibilityNode
* add compatibility unit tests
2018-07-19 13:50:45 +02:00
Yann Lanthony
1f675a0e42 [core] split graph.py into separate modules
core.graph is now splitted into: 
  * graph.py
  * node.py
  * attribute.py
2018-06-26 12:19:14 +02:00
Yann Lanthony
48ef285267 [commands] AddNode: convert list children attributes as link expression 2018-06-18 14:58:38 +02:00
Yann Lanthony
27555b1e7f [command] SetAttribute: use getExportValue to store previous value
keep track of link expressions
2018-06-18 14:58:37 +02:00
Yann Lanthony
d4c0d4cb36 [commands] AddNode: serialize links to other Attributes
avoid storing a reference to Attribute objects that might get deleted
2018-03-21 15:53:34 +01:00
Yann Lanthony
4f392a310b [commands] GroupedGraphModification: add 'disableUpdates' option
gives control over whether graph updates should be disabled during this grouped modification
2018-03-21 15:53:34 +01:00
Yann Lanthony
4ea793be74 [ui] return command result after pushing it to the undo stack
this allows to directly retrieve, for instance, the node created by UIGraph.addNode method
2018-01-12 13:59:07 +01:00
Yann Lanthony
614ef3a5d1 [graph] improve Node constructor arguments naming 2018-01-05 19:18:40 +01:00
Yann Lanthony
8c7a4bcc0f [commands] use addNewNode on RemoveNode.undo
use addNewNode to ensure node's internals are updated after creation
2017-12-19 15:02:45 +01:00
Yann Lanthony
06303c5773 [commands] add GraphModification on RemoveNode.undo
Avoid multiple graph updates on node/edges creation
2017-11-28 22:37:48 +01:00
Yann Lanthony
c3a1f05fdf [commands] introduce GroupedGraphModification
* allow to group graph modifications at undo/redo level
* add new EnableGraphUpdateCommand to change graph update behavior as a undoable command
2017-11-14 16:17:22 +01:00
Yann Lanthony
5f49e26216 [commands] ListAttributeAppendCommand: handle 'None' as value 2017-11-14 15:14:12 +01:00
Yann Lanthony
8b2224609c [commands] add higher-level error catching on undo/redo 2017-11-14 15:13:17 +01:00
Yann Lanthony
5d549e9155 [commands] SetAttribute: store previous primitive value 2017-11-14 14:56:19 +01:00
Yann Lanthony
f6ae3ae057 [ui] support for appending multiple elements to a ListAttribute at once 2017-11-07 20:34:33 +01:00
Yann Lanthony
9bc8eaeb1b [commands] improve AddNodeCommand
use node name instead of a direct reference to the Node
2017-11-07 20:27:52 +01:00
Yann Lanthony
e38f112c55 [core] fix memory management
* parent Nodes, Edges and Attributes to their respective models
* use weakrefs for those objects to avoid cyclic references
* add 'root' property on Attribute for parenting to List/GroupAttribute (parent still exists for Qt-style parenting)
* UI: update commands to match those changes
2017-11-07 20:18:17 +01:00
Yann Lanthony
c5ce41f49e [commands] fix missing import 2017-10-30 16:41:47 +01:00
Yann Lanthony
1ec966fe2c [commands] remove unnecessary updates
* Core Graph is now updated  internally when needed
* addNewNode already calls applyExpr on newly created node
2017-10-30 16:39:49 +01:00
Yann Lanthony
c30b92b695 [commands] add ListAttributeAppend/Remove commands 2017-10-24 19:04:04 +02:00
Yann Lanthony
61ade5bfa7 [graph] simplify methods related to Attribute values and links 2017-10-24 19:02:38 +02:00
Yann Lanthony
c004e2af91 [commands] use new Graph.attribute method 2017-10-19 17:48:27 +02:00
Yann Lanthony
fd0c209837 [commands] only re-create out edges when undoing RemoveNode
"in" edges are automatically recreated since serialized as a connection expression in Node's dict representation and resolved by addNode
2017-10-17 16:32:57 +02:00
Yann Lanthony
b27db8fc7a [commands] unify naming on edges source / destination 2017-10-13 16:35:03 +02:00
Yann Lanthony
d4509ec20e [commands] new AddEdge/RemoveEdge commands 2017-10-13 12:10:35 +02:00
Yann Lanthony
e4ccef2187 [commands] AddNode: resolve link expressions on redo 2017-10-13 10:49:30 +02:00
Yann Lanthony
e893a3dfc6 rename package 'processGraph' to 'core' 2017-10-09 12:16:20 +02:00
Yann Lanthony
b8eff927cc [python27] fix compatibility issues 2017-10-06 15:45:39 +02:00
Yann Lanthony
a81aa53a6b [processGraph] Attribute.value as an "hybrid" property
Use "hybrid" property to simplify naming of properties. No matter the backend used (qt or core), the property is always accessible via its name, without differently named getter or setter methods.
2017-10-02 17:47:39 +02:00
Yann Lanthony
c98b2b7b41 [commands] fix RemoveNode command
re-create deleted edges on undo
2017-10-02 16:14:46 +02:00
Yann Lanthony
e17d0ea240 [commands] expose and use more UndoStack properties 2017-10-02 15:10:04 +02:00
Yann Lanthony
48941a5782 [ui] first basic debugging UI + elementary commands
* nodes as a ListView (right click to delete a node)
* editable attributes 
* undo/redo for adding/removing nodes and attribute edition
2017-09-25 20:18:27 +02:00