-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Added Backdrop Node for Meshroom graph #2574
base: develop
Are you sure you want to change the base?
Conversation
e5b1ba2
to
50d7003
Compare
meshroom/core/desc.py
Outdated
class Backdrop(InputNode): | ||
""" A Backdrop for other nodes. | ||
""" | ||
|
||
# The internal inputs' of Backdrop Node needs a Integer Field to determine the font size for the comment | ||
internalInputs = [ | ||
StringParam( | ||
name="invalidation", | ||
label="Invalidation Message", | ||
description="A message that will invalidate the node's output folder.\n" | ||
"This is useful for development, we can invalidate the output of the node when we modify the code.\n" | ||
"It is displayed in bold font in the invalidation/comment messages tooltip.", | ||
value="", | ||
semantic="multiline", | ||
advanced=True, | ||
uidIgnoreValue="", # If the invalidation string is empty, it does not participate to the node's UID | ||
), | ||
StringParam( | ||
name="comment", | ||
label="Comments", | ||
description="User comments describing this specific node instance.\n" | ||
"It is displayed in regular font in the invalidation/comment messages tooltip.", | ||
value="", | ||
semantic="multiline", | ||
invalidate=False, | ||
), | ||
IntParam( | ||
name="fontSize", | ||
label="Font Size", | ||
description="The Font size for the User Comment on the Backdrop.", | ||
value=12, | ||
range=(6, 100, 1), | ||
), | ||
FloatParam( | ||
name="nodeWidth", | ||
label="Node Width", | ||
description="The Backdrop Node's Width.", | ||
value=600, | ||
range=None, | ||
enabled=False # Hidden always | ||
), | ||
FloatParam( | ||
name="nodeHeight", | ||
label="Node Height", | ||
description="The Backdrop Node's Height.", | ||
value=400, | ||
range=None, | ||
enabled=False # Hidden always | ||
), | ||
ColorParam( | ||
name="color", | ||
label="Color", | ||
description="Custom color for the node (SVG name or hexadecimal code).", | ||
value="", | ||
invalidate=False, | ||
) | ||
] | ||
|
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.
Is there a reason why we totally overwrite the internal inputs instead of using the ones from the parent class and adding "Font Size" to it?
With the current way, there's a lot of duplication and the "Node's Label" internal attribute is lost, which I think is a shame since we may want to name the backdrop itself, and not just use the "Comments" attribute. This would prevent having several backdrops named "Backdrop", "Backdrop2", "Backdrop3", and so on... if we want to name them. Similarly, the "Invalidation Message" is currently preserved although it has no impact anywhere so far.
@@ -135,7 +139,7 @@ Item { | |||
Keys.onPressed: { | |||
if (event.key === Qt.Key_F) { | |||
fit() | |||
} else if (event.key === Qt.Key_Delete) { | |||
} else if (event.key === Qt.Key_Delete || event.key === Qt.Key_Backspace) { // Backspace supports both Windows and MacOS Keyboards |
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.
Not directly related to this, but when a backdrop contains nodes, is there no way to remove the background only and not the background AND everything it contains? (that's a real question, not necessarily a change request)
0a4bf9f
to
e73c4df
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #2574 +/- ##
===========================================
- Coverage 69.93% 69.90% -0.03%
===========================================
Files 121 122 +1
Lines 7088 7158 +70
===========================================
+ Hits 4957 5004 +47
- Misses 2131 2154 +23 ☔ View full report in Codecov by Sentry. |
Attribute factory serves as a common place to initialize and group attributes and define an accessor to be able to retrieve the attributes
Backdrop Node serves as a Graphical Node allowing only internal attributes to be listed and can be serialized
Added Backdrop Node descriptor which is a derived Incomputable Node with Resizable Attribute Traits
The Loader allows loading Backdrop Component for backdrop nodes and Standard Node component for other nodes
…nstructor for Node Types
e73c4df
to
cf16a9d
Compare
…at a given index With the change in nodeRepeater to hold the Loader instead of active delegate, fetching the item at a given index involves getting the loader at index and then it's item. This function allows easy access to the item directly.
…m rather than the loader delegate
…tem rather than the loader delegate
cf16a9d
to
e54d1a1
Compare
When dragging a backdrop node from the left side the node has to be moved and resized at the same time and the same needs to be done when an undo is performed, in order to do that with a single undo, a grouping is necessary for the two operations
…y when the drag of the backdrop is complete
…UI Graph The disableAnimation flag would be used in the UI to control when an Animation is to occur
The Grouped UI Modfications can be used to disabled overall animations for the UI Graph when commands get executed during both undo and redo operation.
…for qml elements Used graph's disabledAnimation flag to halt the animations when a backdrop node is resized during an undo.
meshroom/core/desc/node.py
Outdated
] | ||
|
||
@classmethod | ||
def getInternalParameters(cls, traits: Traits) -> List[Union[StringParam, ColorParam, IntParam, FloatParam]]: |
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.
I don't see a reason to hardcode a list of specific param types. -> List[Attribute]
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.
I was hesitant to import Attribute just for this purpose, but it's updated now.
The brightness of the node's default color should remain low for the links to be visible. |
Copy-paste does not work: pcoip_client_cli_RbRMhBQYbj.mp4 |
meshroom/core/graph.py
Outdated
# Get the Node Constructor which should be initialized for the given node type | ||
# Node or Backdrop... | ||
NodeType = getPreferredNodeConstructor(nodeType) | ||
|
||
n = self.addNode(NodeType(nodeType, position=position, **kwargs), uniqueName=name) |
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.
Directly use a function to create the node, instead of a function to return the node type.
# Get the Node Constructor which should be initialized for the given node type | |
# Node or Backdrop... | |
NodeType = getPreferredNodeConstructor(nodeType) | |
n = self.addNode(NodeType(nodeType, position=position, **kwargs), uniqueName=name) | |
n = self.addNode(createNode(nodeType, position=position, **kwargs), uniqueName=name) |
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.
This has been updated.
@@ -0,0 +1,12 @@ | |||
""" Defines the Built in Plugins. |
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.
I would expect the embedded nodes to be in a folder loaded automatically by Meshroom, in the same way than we are doing for external nodes:
meshroom/nodes/utils/Backdrop.py
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.
Discussing with @yann-lty initially to have a way to register builtin plugins.
So have added this accordingly.
We can discuss and simplify this if needed 🙂
def initBuiltinNodePlugins(): | ||
""" Registers the Builtin plugins for Meshroom. | ||
""" | ||
registerNodeType(builtins.Backdrop) |
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.
We can remove that if we move it to the standard folder.
|
||
cursorShape: drag.active ? Qt.ClosedHandCursor : Qt.ArrowCursor | ||
|
||
/// Backdrop Resize Controls ??? |
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.
Why "???"
} | ||
|
||
/// | ||
/// Resize Bottom |
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.
Probably wants to be able to resize from the top too.
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.
Resize Top has been added.
if (root.height < 300) { | ||
root.height = 300; | ||
} |
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.
Probably want to declare this constant somewhere else.
This value is too big.
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.
set as const value of 200, which seems more reasonable.
/// | ||
/// Resize Bottom | ||
/// | ||
Rectangle { |
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.
It would be good to display a line on hover as we do between top widgets.
Would be used to save any node children for a given node, most likely a Backdrop node, could be extended in future for Group nodes or subGraph
[core] Graph: Updated addNode and pasteNode functions to refer to createNode method from core Node
…set to 200 by default Backdrop has a darker color compared to the base color to make the edges of nodes inside it visible
… halts animation while resizing operations
The node children are referenced later during the copy of the node and can be pasted to allow copying of the contents of the backdrop along with it
|
Currently the standard Nodes also have this behaviour, can be fixed in a separate one if you say or in this ? |
TCSR-1194
Feature Request
Minor Fix