Pythin allows you to enumerate through lists, collections, a bit like in VB with the "for each ... in ..." which allows you to get to the individual items a lot quicker...
import xml.dom.minidom
#assign Application to a smaller variable
app = Application
#get the all the passes in the scene
oPasses = app.ActiveProject.ActiveScene.Passes
#new XML doc
doc =
xml.dom.minidom.Document()
#root element
passList = doc.createElement("PassList")
doc.appendChild(passList)
#pass elements
for oPass in oPasses:
# get each pass directly, its faster and you get to the objects you want quicker...
passElem = doc.createElement
(oPass.Name)
passList.appendChild(passElem)
#render options for each pass
rOptElem = doc.createElement("RenderOptions")
#rOptions = oPass.NestedObjects(3).Parameters I'm still on 4.2 so I don't have access to "NestedObjects", so I use this instead :
rOptions = app.EnumElements(oPass)(3).Parameters
#render option's parameters and values
for oParam in rOptions: #first syntax error
# if
rOptions.Value: Here, you're trying to get to the value of a Collection, not an individual Parameter...
if oParam.Value:
parElem =
doc.createElement(oParam.Name)
rOptElem.appendChild
(parElem)
parTxt = doc.createTextNode(oParam.Value)
parElem.appendChild(parTxt)
...
Hopefully that gets you on your way, I can't go on too much further as I'm missing "NestedObjects"