Commit graph

79 commits

Author SHA1 Message Date
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
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
37a813e08a [core] Propagate Attribute.valueChanged to the owning Node through a Slot
Connecting the valueChanged signal to a lambda causes performance
issues with a large number of attributes when using the Pyside backend.
Connecting that signal to an intermediate Slot part of the Attribute class
improves performance dramatically.
Note: This has no comparable impact on the standalone backend.
2025-02-05 11:54:49 +01:00
Yann Lanthony
4686b0d85a [core] Attribute: remove emitSignals logic on value setting
With valueChanged signal being connected outside of the
Attribute's constructor, the emitSignals logic is not required to prevent
early valueChanged propagation.
2024-10-28 12:25:15 +01:00
Yann Lanthony
8e3b9873d9 [core] Clean-up unused code 2024-10-28 12:19:04 +01:00
Yann Lanthony
7fdb5cc734 [core] Handle attribute valueChanged callback at the Node level
Move the attributeChanged callback logic within Node, as this
is a Node level mecanism (callbacks being declared on the node desc).

This commit also moves the attribute valueChanged signal outside of
the Attribute's constructor.
This seems to be the root cause to undesired side-effects breaking Qt's evaluation
system, data model access and consequently Meshroom's UI.
2024-10-26 23:35:15 +02:00
Candice Bentéjac
b981ef651c [core] invalidate= becomes optional and is set to True by default
This will allow to simplify node descriptions as most of the attributes
are generally invalidating. Only non-invalidating attributes will need
to state explicitly `invalidate=False`.

For output attributes, which must not be invalidating, `invalidate` will
be automatically set to `False` at the attribute-level if it is set to
`True` in the description.
2024-09-12 10:54:17 +02:00
Candice Bentéjac
41e885d9ff Linting: Clean-up files 2024-09-12 10:50:13 +02:00
Candice Bentéjac
9973298746 [core] Simplify invalidation status for all the attributes
The UID system based on a UID index is removed and replaced by a single
UID per node.

Attributes will be included in the UID computation if the `invalidate`
is set to `True` in their description. This replaces the `uid=[]` /
`uid=[0]` element of the description.
2024-09-12 10:41:53 +02:00
Aurore LAFAURIE
019e137386 [ui/core] First version of For Loop implementation
If you connect a list to an attribute, you can iterate over the list as a for loop
2024-09-02 17:08:01 +02:00
Candice Bentéjac
17e8e3e315 [core] Add reference to attribute's instance type in descriptions 2024-08-13 15:34:17 +02:00
Candice Bentéjac
91b514cac5 [core] Attribute: Directly access description's type in getType()
The attributes' descriptions already have a `type` property which is
set with `self.__class__.__name__`. Instead of performing the same call
directly within the attributes, the `type` property of the description
is used.

In case a description would not have a standard type (i.e. anything that
may differ from the class name), this information will be propagated at
the attribute level instead of being lost.
2024-08-01 19:20:04 +02:00
Fabien Castan
3cc67fddfb [core] Propagate the onAttributeChanged notification to connected attributes 2024-06-28 19:56:47 +02:00
Aurore LAFAURIE
aacacb1d65 [core] Prevent bug from onAttributeChanged when setting value of self attribute 2024-06-20 11:54:30 +02:00
Fabien Castan
412c496804 [core] attr: ensure a unique id for each dynamic output attribute 2024-06-16 18:51:01 +02:00
Fabien Castan
695d590ea6 [core] attr: uid for dynamic output attributes use the node uid 2024-06-16 18:40:59 +02:00
Fabien Castan
c2a699e484 [core] attr: add comment 2024-06-16 18:39:34 +02:00
Fabien Castan
8aa76fd1d0 [core] try/except around calls to node's lambda 2024-06-15 18:05:25 +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
400246a529 [core] Attribute: fix initialization of attributes value 2024-05-29 23:01:41 +02:00
Fabien Castan
d2ad818b2c [core] all parameter types could now be used as output attribute 2024-05-27 22:03:43 +02:00
Fabien Castan
958f2edc99
Merge pull request #2395 from alicevision/dev/updateIntrinsicsWhileRemovingImages
[ui] Remove intrinsic if not used by any viewpoint
2024-05-23 14:28:13 +02:00
Fabien Castan
d9b4b26a69
Merge pull request #2382 from alicevision/dev/pushButtonAttribute
[core/ui] Add support for PushButton attribute
2024-05-17 20:11:40 +02:00
Aurore LAFAURIE
862c5506a9 [core] Remove of saving PushButton behavior 2024-05-15 17:15:46 +02:00
Aurore LAFAURIE
3f0e3e00c7 [core] Add iteration accessor on ListAttribute 2024-05-14 11:52:22 +02:00
Aurore LAFAURIE
55c657dc1d [core/ui] Modifiable label and description of node available 2024-04-25 17:03:33 +02:00
Aurore LAFAURIE
bb8b544550 [core] PushButton Description Conflict handled for function descripted 2024-04-25 17:01:54 +02:00
Aurore LAFAURIE
eb1a0faf97 [core] PushButton attribute implemented
Add PushButtonParam class and implement onAttributeClicked method
2024-04-24 15:29:08 +02:00
Aurore LAFAURIE
8e55257c59 [core] BugFix : Dynamic Param with onAttributeChanged behavior should not be applied if CompatibilityNode
If it is a CompatibilityNode, we should only get the value of the attribute to create fully all the attributes instead of throwing an error.
2024-04-23 12:42:36 +02:00
Aurore LAFAURIE
1b55dc8649 [ui] Attribute becomes grey in graph editor and attribute editor when connected but disabled
If attribute is disabled but has output connections, it becomes grey.
If the connection is removed while being disabled, it hides itself.

Both is working in GraphEditor on the nodes and in the AttributeEditor.
2024-04-19 17:16:20 +02:00
Aurore LAFAURIE
eda320374b [core] Bypass validation on values for ChoiceParams 2024-04-08 12:05:05 +02:00
Aurore LAFAURIE
498fd6cbd2 [core] Add new type of ChoiceParam that changes dynamically according to other values
Add new type of ChoiceParam that changes dynamically according to other
values.

When value of an attribute is changed onAttributeChanged is called,
allowing to have unique reaction within node files.

Also add of callDesc function to be able to have other functions such as
onNodeCreated at creation of node.
2024-03-28 12:06:40 +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
Abdelrahman AL MAROUK
b5093ac3a0 [ui] improve atts filtering and add search bar ...
...for node attributes and 3D inspector

- add search bar for node attributes
- add search bar for 3D inspector
- improve attributes filtering by adding more flexibility
and fixing some issues
2023-08-30 16:21:11 +02:00
Candice Bentéjac
e6bf7e6e2d [core] Add validValue and errorMessage support for ChoiceParams
ChoiceParams can now also have their `validValue` and `errorMessage`
parameters.

The `validValueChanged` is also emitted whenever a parameter's value
changes. This ensures that the `validValue` parameter is always re-
evaluated when the attribute is updated, even if `validValue` itself does
not change.
2023-08-22 11:22:11 +02:00
Candice Bentéjac
63bd6d61cd [core] Add new desc parameters to flag attributes with erroneous values
This commit adds two new description parameters:

- `validValue`, which is true if the value of the attribute is not
erroneous (i.e. valid for the type of the attribute but invalid in the
context of that specific attribute) and false otherwise. This holds a
different significance than the "validateValue" method, which only checks
if the parameter's value is expected with respect to the attribute's type.
For example, we could want an IntParam that flags any value that is not
even: an odd integer value would successfully go through the
"validateValue" method, but would then be flagged as an invalid value
at the attribute's level.

- `errorMessage`, an attribute-specific string that contains a message
explaining why the attribute's `validValue` parameter might be set to
false.

By default, all the attributes' values are valid, and they have no error
message.
2023-08-21 16:30:11 +02:00
Grégoire De Lillo
5a62157cdd [core] desc/attribute: Add brackets option for GroupAttribute
Add brackets option for GroupAttribute command line value.
Brackets is a two chars string. The GroupAttribute command line value is encapsulated between the two chars. (e.g. '[]')
2023-06-30 17:33:09 +02:00
Candice Bentéjac
311ab9cb40 [core] Add a property to ignore an attribute during the UID computation
By default, an attribute that belongs to the UID group 0 is taken into
the node's UID computation independently from its value, as long as it is
enabled.

When such an attribute is added to a node's list of attributes, it
automatically invalidates all computations made for this node prior to
its addition.

This commits adds a new attribute property, "uidIgnoreValue". This property
determines whether the attribute must be taken into consideration during
the node's UID computation: if the value of the attribute is the same as
"uidIgnoreValue", then it should be ignored; otherwise, it should be taken
into account. By default, "uidIgnoreValue" is set to "None", meaning that
any attribute that may be considered during the UID computation will be
taken into account.

In the context of the internal attributes, "uidIgnoreValue" is set to empty
string, so the "invalidation" attribute will not automatically
invalidate 100% of the nodes from existing graphs until its value is set
to a non-empty string.
2023-02-17 15:34:39 +01:00
Candice Bentéjac
330382ab0c Add "label" as an internal attribute
Setting the "label" internal attribute allows to give a custom
label to replace the node's default label.
2023-02-15 08:36:10 +00:00
Candice Bentéjac
909f38ccb8 [core] Check a graph exists before accessing its name
If the graph does not exist, return "UNDEFINED" as its name.
2023-02-03 17:43:31 +01: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
Candice Bentéjac
1f800aefd5 Compare attribute's resolved link with default value
If an attribute is a link, when checking whether its value is
the default value, only the resolved value should be compared
with the default one. Otherwise, the attribute's "isDefault"
property will always evaluate to True, even when a non-default
link has been provided.

This issue was especially evident with input File attributes,
for which the default value is generally '' (empty string); if a
link was set as a value (thus non-empty), its unresolved value
would still be '', thus setting the "isDefault" property to True.
2022-09-01 14:13:49 +02:00
Fabien Castan
b291a9ed07
Merge pull request #1727 from alicevision/dev/externalPipelines
Use project files to define pipelines
2022-07-26 15:06:16 +02:00
Candice Bentéjac
f2a904ac9b Fix compatibility with Python 3
- Import "collections" correctly depending on the version of
Python
- Fix regex that raised deprecation warnings in Python 3
2022-07-19 14:52:18 +02:00
Candice Bentéjac
708eb85c9c Evaluate variables in nodes' string parameters 2022-07-12 09:31:37 +02:00
Fabien Castan
af4dae9a77 Merge branch 'dev/ImageGalleryFilter' of https://github.com/N0Ls/meshroom into N0Ls-dev/ImageGalleryFilter 2021-09-01 11:03:55 +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
1704e8935d [core] fix upgrade for linked ListAttribute 2021-08-19 10:09:43 +02:00