QUOTE
I'm looking into Python now...it's kicking my butt.
Stop stop stop. You can never get code done if you just go about it just as long as i get this step done you will potentially fall into some sort of will never become usefull spagetti, limbo. You must understand what it is your deeming the computer to do on BOTH ends before you can attempt to do a code.
QUOTE(Duckspeaker @ 06/09/09, 06:15 PM) [snapback]309191[/snapback]
Not really...the rotation in the XML is stored differently so I was anticipating having to write something to convert it to Maya friendly...I shouldn't have brought it up, as it distracts from the goal of first getting the information out. ![]()
You mean like axis angles or?
So answer yourself following questions:
Does it need to be ready on monday*Do you need to change that code. Odds are you will when you do one bad step in the beginning can cause you headaches beyond untold nightmares in the future. A ten minute botch up 6 mnths from now can mean 6 MONTHS of workDo you need to import or extend the data for animation? Do you really ever need to? See if you do all youve done so far may be down the drain.Do you understand how maya works? Do you really... i mean many users who have used maya for 3 years dont have a clue. That is why they have hard time doing scripting in maya.Is the file format forever fixed, if it is you can just write the parser yourself. IF NOT use a generic xml parser and only concentrate on understanding the tree structural leaves. Then if more vocabulary appears elsewhere you can just understand magically what you already have understanding of.does the data need to be refreshhed form fileCode is like investment into a share, know it before you invest in it.Do you understand what the difference between a database and a node network. See you can treat maya as a database, IF you are very careful not to try to overstep your bounds. In genaral maya hates it, so it helps to know up front.If you answer yes to 2,3,5 then design a bit up front, we can help.
if you answer yes to 3 or 6 write a node. It may seem surprising but its not actually much more code for your part, its just a lot scarier but the chasm is as wide its just 12 stories higher than the other.
this is a special case. Where you go and say to your boss, can i have that in writing please. Because WHEN the s thits the fan you can just tell your boss i told you so. Else its better to work 2 hours a day for 4 weeks rather than 8 hours brute forcing. Just as long as you dont overdo it. In this case i would buy the code form somebody, trust me its cheaper on long run.
Pasring a file into python
should look something like this didnt test wrote out of my head.
CODE
from xml.dom.ext.reader import Sax2
from xml.dom import EMPTY_NAMESPACE
reader = Sax2.Reader()
doc = reader.fromStream(open('filename.xml'))
objects= doc.getElementsByTagName('Object')
#mayacode for locating object
for obj in objects:
instances= obj.getElementsByTagName('Instance')
#mayacode for making a new isntace
for inst in instances:
trans=inst.getElementsByTagName('Translation')
dataInTransform=trans[0].data
#transform instance
trans=inst.getElementsByTagName('Rotation')
...
PS i moved the entire thread to python, leaving link in the mel forum thisway the path stays intact