added outputImageTypes in node desc to update the viewer2D imageType combo box when double clicking a node

This commit is contained in:
Loïc Vital 2022-09-16 17:01:07 +02:00 committed by Fabien Castan
parent ab0e132121
commit fc5ab540f5
5 changed files with 18 additions and 1 deletions

View file

@ -489,6 +489,7 @@ class Node(object):
parallelization = None parallelization = None
documentation = '' documentation = ''
category = 'Other' category = 'Other'
outputImageTypes = ['image']
def __init__(self): def __init__(self):
pass pass

View file

@ -568,6 +568,9 @@ class BaseNode(BaseObject):
def getAttributes(self): def getAttributes(self):
return self._attributes return self._attributes
def getOutputImageTypes(self):
return self.nodeDesc.outputImageTypes
@Slot(str, result=bool) @Slot(str, result=bool)
def hasAttribute(self, name): def hasAttribute(self, name):
return name in self._attributes.keys() return name in self._attributes.keys()
@ -1053,6 +1056,7 @@ class BaseNode(BaseObject):
x = Property(float, lambda self: self._position.x, notify=positionChanged) x = Property(float, lambda self: self._position.x, notify=positionChanged)
y = Property(float, lambda self: self._position.y, notify=positionChanged) y = Property(float, lambda self: self._position.y, notify=positionChanged)
attributes = Property(BaseObject, getAttributes, constant=True) attributes = Property(BaseObject, getAttributes, constant=True)
outputImageTypes = Property(Variant, getOutputImageTypes, constant=True)
internalFolderChanged = Signal() internalFolderChanged = Signal()
internalFolder = Property(str, internalFolder.fget, notify=internalFolderChanged) internalFolder = Property(str, internalFolder.fget, notify=internalFolderChanged)
depthChanged = Signal() depthChanged = Signal()

View file

@ -299,3 +299,5 @@ Use a downscale factor of one (full-resolution) only if the quality of the input
uid=[], uid=[],
), ),
] ]
outputImageTypes = ['depth', 'sim']

View file

@ -165,6 +165,10 @@ FocusScope {
return ""; return "";
} }
function setImageTypes(types) {
imageType.types = types;
}
// context menu // context menu
property Component contextMenu: Menu { property Component contextMenu: Menu {
MenuItem { MenuItem {
@ -998,7 +1002,7 @@ FocusScope {
Layout.preferredWidth: 6.0 * Qt.application.font.pixelSize Layout.preferredWidth: 6.0 * Qt.application.font.pixelSize
flat: true flat: true
property var types: ["image", "depth", "sim"] property var types: ["image"]
property string type: enabled ? types[currentIndex] : types[0] property string type: enabled ? types[currentIndex] : types[0]
model: types model: types

View file

@ -890,6 +890,10 @@ ApplicationWindow {
return false; return false;
} }
function setImageTypes(types) {
viewer2D.setImageTypes(types);
}
} }
} }
@ -954,6 +958,8 @@ ApplicationWindow {
nodeTypesModel: _nodeTypes nodeTypesModel: _nodeTypes
onNodeDoubleClicked: { onNodeDoubleClicked: {
workspaceView.setImageTypes(node.outputImageTypes);
_reconstruction.setActiveNode(node); _reconstruction.setActiveNode(node);
let viewable = false; let viewable = false;