Skip to content
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

Open
wants to merge 14 commits into
base: develop
Choose a base branch
from
Open

Conversation

waaake
Copy link
Contributor

@waaake waaake commented Oct 21, 2024

TCSR-1194

Feature Request

  • Added Backdrop Node
  • Notion of Region inside a Graph

Minor Fix

  • Added Key Press of Backspace to allow deletion in the graph.

@waaake waaake added the feature request feature request from the community label Oct 21, 2024
@waaake waaake self-assigned this Oct 21, 2024
@fabiencastan fabiencastan added majorFeature and removed feature request feature request from the community labels Oct 22, 2024
@cbentejac cbentejac added this to the Meshroom 2024.1.0 milestone Oct 23, 2024
Comment on lines 802 to 859
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,
)
]

Copy link
Contributor

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
Copy link
Contributor

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)

@waaake waaake marked this pull request as draft November 26, 2024 11:28
@waaake waaake force-pushed the dev/BackdropNode branch 2 times, most recently from 0a4bf9f to e73c4df Compare December 18, 2024 07:12
@waaake waaake marked this pull request as ready for review December 18, 2024 07:13
@waaake waaake requested a review from yann-lty December 18, 2024 07:13
Copy link

codecov bot commented Dec 18, 2024

Codecov Report

Attention: Patch coverage is 71.05263% with 22 lines in your changes missing coverage. Please review.

Project coverage is 69.92%. Comparing base (0586336) to head (e54d1a1).

Files with missing lines Patch % Lines
meshroom/core/node.py 46.15% 21 Missing ⚠️
meshroom/core/desc/node.py 96.15% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #2574      +/-   ##
===========================================
- Coverage    69.93%   69.92%   -0.02%     
===========================================
  Files          121      122       +1     
  Lines         7088     7151      +63     
===========================================
+ Hits          4957     5000      +43     
- Misses        2131     2151      +20     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

waaake added 11 commits January 1, 2025 20:04
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
waaake added 3 commits January 2, 2025 09:08
…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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants