Beispiel #1
0
    def read(self, element):
        #print( "%s - ProcessNode::read" % element.tag)
        # Store attributes
        for key, value in element.attrib.iteritems():
            # Convert text to booleans where appropriate
            if value in ["True", "False"]:
                value = (value == "True")
            self.setAttribute(key, value)

        # Read child elements
        for child in element:
            childType = child.tag
            #print( elementType )

            # Read Description elements 
            if childType == 'Description':
                description = Description()
                description.read(child)
                self.addElement( description )

            # Read DynamicParameter elements
            elif childType == 'DynamicParameter':
                for key, value in child.attrib.iteritems():
                    if key == 'param':
                        self._dynamicParams.append(value)

            # Otherwise, allow the subclasses to read elements
            else:
                #print( "%s - ProcessNode::read child - %s" % (element.tag, child.tag))
                childElement = self.readChild(child)
                if childElement != None:
                    self.addElement( childElement )

        # Initialize data structures after reading all attributes and child elements
        self.readInitialize()
Beispiel #2
0
    def read(self, element):
        #print( "%s - ProcessNode::read" % element.tag)
        # Store attributes
        for key, value in element.attrib.iteritems():
            # Convert text to booleans where appropriate
            if value in ["True", "False"]:
                value = (value == "True")
            self.setAttribute(key, value)

        # Read child elements
        for child in element:
            childType = child.tag
            #print( elementType )

            # Read Description elements
            if childType == 'Description':
                description = Description()
                description.read(child)
                self.addElement(description)

            # Read DynamicParameter elements
            elif childType == 'DynamicParameter':
                for key, value in child.attrib.iteritems():
                    if key == 'param':
                        self._dynamicParams.append(value)

            # Otherwise, allow the subclasses to read elements
            else:
                #print( "%s - ProcessNode::read child - %s" % (element.tag, child.tag))
                childElement = self.readChild(child)
                if childElement != None:
                    self.addElement(childElement)

        # Initialize data structures after reading all attributes and child elements
        self.readInitialize()
Beispiel #3
0
    def read(self, element, strict=False):
        #print( "%s - ProcessNode::read" % element.tag)
        # Store attributes
        for key, value in element.attrib.iteritems():
            # Convert text to booleans where appropriate
            if value in ["True", "False"]:
                value = (value == "True")
            self.setAttribute(key, value)

        elementType = self.getElementType(element.tag)

        # Read child elements
        for child in element:
            childType = self.getElementType(child.tag)
            #print( childType )

            # Read Description elements
            if childType == 'Description':
                description = Description()
                description.read(child)
                self.addElement(description)

            # Read DynamicParameter elements
            elif childType == 'DynamicParameter':
                if getFeatureCompatibility() & featureSets["Autodesk"]:
                    for key, value in child.attrib.iteritems():
                        if key == 'param':
                            self._dynamicParams.append(value)
                else:
                    msg = "Unsupported feature : DynamicParameter element"
                    if strict:
                        raise Errors.UnsupportedExtensionError(msg)
                    else:
                        print("ProcessNode::read - %s" % msg)

            # Otherwise, allow the subclasses to read elements
            else:
                #print( "%s - ProcessNode::read child - %s" % (elementType, childType))
                childElement = self.readChild(child)
                if childElement != None:
                    self.addElement(childElement)

        # Initialize data structures after reading all attributes and child elements
        self.readInitialize()
Beispiel #4
0
    def read(self, element, strict=False):
        #print( "%s - ProcessNode::read" % element.tag)
        # Store attributes
        for key, value in element.attrib.iteritems():
            # Convert text to booleans where appropriate
            if value in ["True", "False"]:
                value = (value == "True")
            self.setAttribute(key, value)

        # Read child elements
        for child in element:
            childType = child.tag
            #print( elementType )

            # Read Description elements 
            if childType == 'Description':
                description = Description()
                description.read(child)
                self.addElement( description )

            # Read DynamicParameter elements
            elif childType == 'DynamicParameter':
                if getFeatureCompatibility() & featureSets["Autodesk"]:
                    for key, value in child.attrib.iteritems():
                        if key == 'param':
                            self._dynamicParams.append(value)
                else:
                    msg = "Unsupported feature : DynamicParameter element"
                    if strict:
                        raise Errors.UnsupportedExtensionError(msg)
                    else:
                        print( "ProcessNode::read - %s" % msg )

            # Otherwise, allow the subclasses to read elements
            else:
                #print( "%s - ProcessNode::read child - %s" % (element.tag, child.tag))
                childElement = self.readChild(child)
                if childElement != None:
                    self.addElement( childElement )

        # Initialize data structures after reading all attributes and child elements
        self.readInitialize()