Parsing maya

Started by
3 comments, last by oski 20 years, 9 months ago
I need to parse a maya file and spit out some information on the polygon cubes in a scene. It should be pretty simple to do...I just don''t know where to start. Anybody have any good tips or know of some good sources to look at? Thanks in advance.
Advertisement
Are you talking about the .ma, .mb, or...
Here was a sample output of a .ma with just a cube and cylinder:
//Maya ASCII 4.5 scene//Name: Test.ma//Last modified: Tue, Jul 08, 2003 06:34:03 PMrequires maya "4.5";currentUnit -l centimeter -a degree -t film;fileInfo "application" "maya";fileInfo "product" "Maya Unlimited 4.5";fileInfo "version" "4.5";fileInfo "cutIdentifier" "200208160001";fileInfo "osv" "Microsoft Windows XP Professional Service Pack 1 (Build 2600)\n";createNode transform -s -n "persp";	setAttr ".v" no;	setAttr ".t" -type "double3" 28 21 28 ;	setAttr ".r" -type "double3" -27.938352729602379 44.999999999999972 -4.7228827447146885e-014 ;createNode camera -s -n "perspShape" -p "persp";	setAttr -k off ".v" no;	setAttr ".fl" 34.999999999999993;	setAttr ".coi" 44.821869662029947;	setAttr ".imn" -type "string" "persp";	setAttr ".den" -type "string" "persp_depth";	setAttr ".man" -type "string" "persp_mask";	setAttr ".hc" -type "string" "viewSet -p %camera";createNode transform -s -n "top";	setAttr ".v" no;	setAttr ".t" -type "double3" 0 100 0 ;	setAttr ".r" -type "double3" -89.999999999999986 0 0 ;createNode camera -s -n "topShape" -p "top";	setAttr -k off ".v" no;	setAttr ".rnd" no;	setAttr ".coi" 100;	setAttr ".ow" 30;	setAttr ".imn" -type "string" "top";	setAttr ".den" -type "string" "top_depth";	setAttr ".man" -type "string" "top_mask";	setAttr ".hc" -type "string" "viewSet -t %camera";	setAttr ".o" yes;createNode transform -s -n "front";	setAttr ".v" no;	setAttr ".t" -type "double3" 0 0 100 ;createNode camera -s -n "frontShape" -p "front";	setAttr -k off ".v" no;	setAttr ".rnd" no;	setAttr ".coi" 100;	setAttr ".ow" 30;	setAttr ".imn" -type "string" "front";	setAttr ".den" -type "string" "front_depth";	setAttr ".man" -type "string" "front_mask";	setAttr ".hc" -type "string" "viewSet -f %camera";	setAttr ".o" yes;createNode transform -s -n "side";	setAttr ".v" no;	setAttr ".t" -type "double3" 100 0 0 ;	setAttr ".r" -type "double3" 0 89.999999999999986 0 ;createNode camera -s -n "sideShape" -p "side";	setAttr -k off ".v" no;	setAttr ".rnd" no;	setAttr ".coi" 100;	setAttr ".ow" 30;	setAttr ".imn" -type "string" "side";	setAttr ".den" -type "string" "side_depth";	setAttr ".man" -type "string" "side_mask";	setAttr ".hc" -type "string" "viewSet -s %camera";	setAttr ".o" yes;createNode transform -n "pCone1";createNode mesh -n "pConeShape1" -p "pCone1";	setAttr -k off ".v";	setAttr ".vir" yes;	setAttr ".vif" yes;	setAttr ".uvst[0].uvsn" -type "string" "map1";	setAttr ".cuvs" -type "string" "map1";createNode transform -n "pCylinder1";createNode mesh -n "pCylinderShape1" -p "pCylinder1";	setAttr -k off ".v";	setAttr ".vir" yes;	setAttr ".vif" yes;	setAttr ".uvst[0].uvsn" -type "string" "map1";	setAttr ".cuvs" -type "string" "map1";createNode lightLinker -n "lightLinker1";createNode brush -n "brush1";createNode displayLayerManager -n "layerManager";createNode displayLayer -n "defaultLayer";createNode renderLayerManager -n "renderLayerManager";createNode renderLayer -n "defaultRenderLayer";createNode renderLayer -s -n "globalRender";createNode polyCone -n "polyCone1";createNode polyCylinder -n "polyCylinder1";	setAttr ".sc" 1;	setAttr ".tx" 1;select -ne :time1;	setAttr ".o" 1;select -ne :renderPartition;	setAttr -s 2 ".st";select -ne :renderGlobalsList1;select -ne :defaultShaderList1;	setAttr -s 2 ".s";select -ne :postProcessList1;	setAttr -s 2 ".p";select -ne :lightList1;select -ne :initialShadingGroup;	setAttr -s 2 ".dsm";	setAttr ".ro" yes;select -ne :initialParticleSE;	setAttr ".ro" yes;connectAttr "polyCone1.out" "pConeShape1.i";connectAttr "polyCylinder1.out" "pCylinderShape1.i";connectAttr ":defaultLightSet.msg" "lightLinker1.lnk[0].llnk";connectAttr ":initialShadingGroup.msg" "lightLinker1.lnk[0].olnk";connectAttr ":defaultLightSet.msg" "lightLinker1.lnk[1].llnk";connectAttr ":initialParticleSE.msg" "lightLinker1.lnk[1].olnk";connectAttr "layerManager.dli[0]" "defaultLayer.id";connectAttr "renderLayerManager.rlmi[0]" "defaultRenderLayer.rlid";connectAttr "lightLinker1.msg" ":lightList1.ln" -na;connectAttr "pConeShape1.iog" ":initialShadingGroup.dsm" -na;connectAttr "pCylinderShape1.iog" ":initialShadingGroup.dsm" -na;// End of Test.ma


So my questions is: Instead of writing a parser for their script, why not just create a simple plug-in and export the raw data? That would be a lot easier...

EDIT: By the way, is this in the right forum? What does NeHe have to do with Maya...

-UltimaX-

"You wished for a white christmas... Now go shovel your wishes!"

[edited by - UltimaX on July 8, 2003 6:50:12 PM]
First of all, I wouldn''t try and parse a .mb file. Secondly, writing a plug-in to export the raw data would be much better. So, I guess my question still remains. Any ideas on how to do that?

By the way, the only reason I posted this on nehe was because I know a lot of game devs use maya to model things and then export the data so they can use it in their game engines. So, I thought, I would ask here. Do you know of a better to place (another forum) to ask this question?

Thanks.
If you use Maya 4.5 I could send you mine. It works but it''s not finished. It only handles static objects, and you can only use the "Export Selected" option. The object has to be a polygon (Mesh) and it has to be triangulated. It exports the mesh, textures, materials, etc. You can add to it though and make it better. I just made a simple one for now to test my engine.

BTW: I was just wondering, the forum is not no biggie

-UltimaX-

"You wished for a white christmas... Now go shovel your wishes!"
that would be awesome. send it to oski722000@yahoo.com if you don''t mind.

thanks a lot and i''ll let you know if have and more questions.

This topic is closed to new replies.

Advertisement