@@ -1943,6 +1943,20 @@ def upgrade(self):
19431943 issueDetails = Property (str , issueDetails .fget , constant = True )
19441944
19451945
1946+ def getPreferredNodeConstructor (nodeType : str , default : Type [BaseNode ]= Node ):
1947+ """ Returns a Node Constructor to initialize Node.
1948+
1949+ Args:
1950+ nodeType: Node Plugin/Descriptor name.
1951+ default: The Default Node constructor if the nodeType does not have a constructor defined.
1952+ """
1953+ constructors = {
1954+ "Backdrop" : Backdrop ,
1955+ }
1956+
1957+ return constructors .get (nodeType , default )
1958+
1959+
19461960def nodeFactory (nodeDict , name = None , template = False , uidConflict = False ):
19471961 """
19481962 Create a node instance by deserializing the given node data.
@@ -2036,7 +2050,8 @@ def nodeFactory(nodeDict, name=None, template=False, uidConflict=False):
20362050 break
20372051
20382052 if compatibilityIssue is None :
2039- node = Node (nodeType , position , uid = uid , ** inputs , ** internalInputs , ** outputs )
2053+ NodeType = getPreferredNodeConstructor (nodeType )
2054+ node = NodeType (nodeType , position , uid = uid , ** inputs , ** internalInputs , ** outputs )
20402055 else :
20412056 logging .debug ("Compatibility issue detected for node '{}': {}" .format (name , compatibilityIssue .name ))
20422057 node = CompatibilityNode (nodeType , nodeDict , position , compatibilityIssue )
0 commit comments