mirror of
https://github.com/alicevision/Meshroom.git
synced 2025-06-06 12:51:57 +02:00
[core] New dynamic output attributes
This commit is contained in:
parent
9a09310f07
commit
d5e356c0aa
6 changed files with 139 additions and 14 deletions
|
@ -14,7 +14,7 @@ import meshroom
|
|||
import meshroom.core
|
||||
from meshroom.common import BaseObject, DictModel, Slot, Signal, Property
|
||||
from meshroom.core import Version
|
||||
from meshroom.core.attribute import Attribute, ListAttribute
|
||||
from meshroom.core.attribute import Attribute, ListAttribute, GroupAttribute
|
||||
from meshroom.core.exception import StopGraphVisit, StopBranchVisit
|
||||
from meshroom.core.node import nodeFactory, Status, Node, CompatibilityNode
|
||||
|
||||
|
@ -320,7 +320,10 @@ class Graph(BaseObject):
|
|||
# that were computed.
|
||||
if not isTemplate: # UIDs are not stored in templates
|
||||
self._evaluateUidConflicts(graphData)
|
||||
self._applyExpr()
|
||||
try:
|
||||
self._applyExpr()
|
||||
except Exception as e:
|
||||
logging.warning(e)
|
||||
|
||||
return True
|
||||
|
||||
|
@ -548,12 +551,16 @@ class Graph(BaseObject):
|
|||
skippedEdges = {}
|
||||
if not withEdges:
|
||||
for n, attr in node.attributes.items():
|
||||
if attr.isOutput:
|
||||
# edges are declared in input with an expression linking
|
||||
# to another param (which could be an output)
|
||||
continue
|
||||
# find top-level links
|
||||
if Attribute.isLinkExpression(attr.value):
|
||||
skippedEdges[attr] = attr.value
|
||||
attr.resetToDefaultValue()
|
||||
# find links in ListAttribute children
|
||||
elif isinstance(attr, ListAttribute):
|
||||
elif isinstance(attr, (ListAttribute, GroupAttribute)):
|
||||
for child in attr.value:
|
||||
if Attribute.isLinkExpression(child.value):
|
||||
skippedEdges[child] = child.value
|
||||
|
@ -584,6 +591,7 @@ class Graph(BaseObject):
|
|||
|
||||
# re-create edges taking into account what has been duplicated
|
||||
for attr, linkExpression in duplicateEdges.items():
|
||||
logging.warning("attr={} linkExpression={}".format(attr.fullName, linkExpression))
|
||||
link = linkExpression[1:-1] # remove starting '{' and trailing '}'
|
||||
# get source node and attribute name
|
||||
edgeSrcNodeName, edgeSrcAttrName = link.split(".", 1)
|
||||
|
@ -1625,6 +1633,7 @@ def executeGraph(graph, toNodes=None, forceCompute=False, forceStatus=False):
|
|||
|
||||
for n, node in enumerate(nodes):
|
||||
try:
|
||||
node.preprocess()
|
||||
multiChunks = len(node.chunks) > 1
|
||||
for c, chunk in enumerate(node.chunks):
|
||||
if multiChunks:
|
||||
|
@ -1635,6 +1644,7 @@ def executeGraph(graph, toNodes=None, forceCompute=False, forceStatus=False):
|
|||
print('\n[{node}/{nbNodes}] {nodeName}'.format(
|
||||
node=n + 1, nbNodes=len(nodes), nodeName=node.nodeType))
|
||||
chunk.process(forceCompute)
|
||||
node.postprocess()
|
||||
except Exception as e:
|
||||
logging.error("Error on node computation: {}".format(e))
|
||||
graph.clearSubmittedNodes()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue