6 from __future__ import absolute_import
7 #Init has to be imported first because it has code to workaround the python bug where relative imports don't work if the module is imported as a main module.
10 from fabmetheus_utilities.geometry.geometry_utilities import evaluate
13 __author__ = 'Enrique Perez (perez_enrique@yahoo.com)'
14 __credits__ = 'Art of Illusion <http://www.artofillusion.org/>'
15 __date__ = '$Date: 2008/02/05 $'
16 __license__ = 'GNU Affero General Public License http://www.gnu.org/licenses/agpl.html'
19 def processElementNode(elementNode):
20 "Process the xml element."
21 functions = elementNode.getXMLProcessor().functions
22 if len(functions) < 1:
23 print('Warning, there are no functions in processElementNode in statement for:')
26 function = functions[-1]
27 evaluate.setLocalAttribute(elementNode)
28 if elementNode.xmlObject.value == None:
29 print('Warning, elementNode.xmlObject.value is None in processElementNode in statement for:')
32 localValue = evaluate.getEvaluatedExpressionValueBySplitLine(elementNode, elementNode.xmlObject.value)
33 keywords = elementNode.xmlObject.key.split('.')
34 if len(keywords) == 0:
35 print('Warning, there are no keywords in processElementNode in statement for:')
38 firstWord = keywords[0]
39 if len(keywords) == 1:
40 function.localDictionary[firstWord] = localValue
42 attributeName = keywords[-1]
44 if firstWord == 'self':
45 object = function.classObject
47 object = function.localDictionary[firstWord]
48 for keywordIndex in xrange(1, len(keywords) - 1):
49 object = object._getAccessibleAttribute(keywords[keywordIndex])
50 object._setAccessibleAttribute(attributeName, localValue)