Welcome to the chatterbox...
ThatDude33 (174) maya->indigo exporter - 2006-05-26 09:13:35 Registered: unknown Posts: 119 I\'ve written a Maya->Indigo exporter!
Please test it!
no meshlights yet, it makes a default background light, triangulate mesh first-
Lambert materials are plain diffuse
Phong materials-
Color is actual color
Reflectivity is specular color
If you want a non-constant specular color (eg 1 0 1 instead of 1 1 1) you need to set reflectivity to 0 and use the reflected color gauge
Cosine power is specular sharpness (warning- it is multiplied by 10- eg. 12 is 120 and 0.3 is 3)
you need to use a camera- camera, aim, and up. Don\'t rename it.
//Script by Matt B. (ThatDude33) for export from Maya 6.5+ to Indigo 0.5.3
//Outputs in script window
//Copy-Paste results into XML file, run using Ini File.
//No edits should be neccesary
//Start Writing:
string $write = \"<?xml version=\'1.0\' standalone=no>\\n\";
$write += \"<!--Exported from Maya-->\\n\\n\";
proc vector normalize(vector $v){
float $len = sqrt($v.x*$v.x+$v.y*$v.y+$v.z*$v.z);
vector $n = <<$v.x/$len, $v.y/$len, $v.z/$len>>;
return $n;
}
//Will have a prompt window, but now uses settings from render globals
$write +=\"<scene>\\n\";
$write += \"\\n<renderer_settings>\\n\";
$write += \"\\t<width>\" + `getAttr defaultResolution.width` +\"</width>\\n\";
$write += \"\\t<height>\" + `getAttr defaultResolution.height` +\"</height>\\n\";
$write += \"\\t<metropolis>true</metropolis>\\n\";
$write += \"\\t<large_mutation_prob>0.2</large_mutation_prob>\\n\";
$write += \"\\t<max_change>0.025</max_change>\\n\";
$write += \"\\t<russian_roulette_live_prob>0.7</russian_roulette_live_prob>\\n\";
$write += \"\\t<max_depth>1000</max_depth>\\n\";
$write += \"\\t<bidirectional>true</bidirectional>\\n\";
$write += \"\\t<strata_width>10</strata_width>\\n\";
$write += \"\\t<frame_upload_period>20</frame_upload_period>\\n\";
$write += \"\\t<halt_time>-1</halt_time>\\n\";
$write += \"\\t<logging>true</logging>\\n\";
$write += \"\\t<image_save_period>30</image_save_period>\\n\";
$write += \"\\t<save_tonemapped_exr>false</save_tonemapped_exr>\\n\";
$write += \"\\t<save_untonemapped_exr>false</save_untonemapped_exr>\\n\";
$write += \"</renderer_settings>\\n\\n\";
$write += \"\\t<tonemapping>\\n\";
$write += \"\\t\\t<reinhard>\\n\";
$write += \"\\t\\t\\t<pre_scale>2.0</pre_scale>\\n\";
$write += \"\\t\\t\\t<post_scale>1.0</post_scale>\\n\";
$write += \"\\t\\t</reinhard>\\n\";
$write += \"\\n\\t\\t<colour_correction>1.0 1.0 1.0</colour_correction>\\n\";
$write += \"\\t</tonemapping>\\n\";
$write += \"<background>\\n<radiance>1 1 1</radiance>\\n</background>\\n\\n\";
$write += \"\\n<camera>\\n\";
float $px = `getAttr camera1.tx`;
float $py = `getAttr camera1.ty`;
float $pz = `getAttr camera1.tz`;
vector $pos = <<$px, $py, $pz>>;
float $tx = `getAttr camera1_aim.tx`;
float $ty = `getAttr camera1_aim.ty`;
float $tz = `getAttr camera1_aim.tz`;
vector $target= <<$tx, $ty, $tz>>;
vector $front = $target-$pos;
vector $dist = $front;
$front = normalize($front);
$write += \"\\t<pos>\"+$px+\" \"+$py+\" \"+$pz+\"</pos>\\n\";
float $ux = `getAttr camera1_up.tx`;
float $uy = `getAttr camera1_up.ty`;
float $uz = `getAttr camera1_up.tz`;
vector $up = <<$ux, $uy, $uz>>;
$up = $up - $pos;
$up = normalize($up);
$write += \"\\t<up>\"+$up.x+\" \"+$up.y+\" \"+$up.z+\"</up>\\n\";
$write += \"\\t<forewards>\"+$front.x+\" \"+$front.y+\" \"+$front.z+\"</forewards>\\n\";
float $fstop = 8;
if ($fstop < 1.0){
$fstop = 1.0;
}
if ($fstop > 22){
$fstop = 22;
}
float $aprad = 50/$fstop;
$aprad = $aprad/200;
$write += \"\\t<aperture_radius>\"+$aprad+\"</aperture_radius>\\n\";
float $FD = sqrt($dist.x*$dist.x+$dist.y*$dist.y+$dist.z*$dist.z);
$write += \"\\t<focus_distance>\"+$FD+\"</focus_distance>\\n\";
$write += \"\\t<aspect_ratio>\"+`getAttr defaultResolution.deviceAspectRatio`+\"</aspect_ratio>\\n\";
$write += \"\\t<sensor_width>0.036</sensor_width>\\n\";
$write += \"\\t<lens_sensor_dist>0.0523314</lens_sensor_dist>\\n\";
$write += \"\\t<white_balance>D65</white_balance>\\n\";
$write += \"</camera>\\n\\n\";
$write += \"\\t<!--Materials--!>\\n\";
$write += \"\\t<!--Some Credit to LaLiLuLeLo--!>\";
string $mats[] = `ls -mat`;
for ($one in $mats){
if (`objectType $one` == \"lambert\"){
$write+= \"\\n<material>\\n\";
$write += \"\\t<name>\"+$one+\"</name>\\n\";
$write += \"\\t<diffuse>\\n\";
float $color[] = `getAttr ($one + \".color\")`;
$write+=\"\\t\\t</colour>\"+$color[0]+\" \"+$color[1]+\" \"+$color[2]+\"</colour>\\n\";
$write += \"\\t</diffuse>\\n\";
$write += \"</material>\\n\";
}
if (`objectType $one` == \"phong\"){
$write += \"\\n<material>\\n\";
$write += \"\\t<phong>\\n\";
$write += \"\\t\\t<name>\"+$one+\"</name>\\n\";
float $col[] = `getAttr ($one + \".color\")`;
$write += \"\\t\\t<diffuse>\"+$col[0]+\" \"+$col[1]+\" \"+$col[2]+\"</diffuse>\\n\";
float $reflectivity = `getAttr($one +\".reflectivity\")`;
if ($reflectivity > 0.0){
$write += \"\\t\\t<specular>\"+$reflectivity+\" \"+$reflectivity+\" \"+$reflectivity+\"</specular>\\n\";
}
if ($reflectivity == 0.0){
float $refl[] = `getAttr ($one +\".reflectedColor\")`;
$write += \"\\t\\t<specular>\"+$refl[0]+\" \"+$refl[1]+\" \"+$refl[2]+\"</specular>\\n\";
}
float $exp = `getAttr ($one + \".cosinePower\")`;
float $exp = $exp * 10;
$write += \"\\t\\t<exponent>\"+$exp+\"</exponent>\\n\";
$write += \"\\t</phong>\\n\";
$write += \"</material>\\n\";
}
}
$write += \"\\t<!--Actual Model Starts Here. --!>\\n\";
string $shapes[] = `ls -s`;
for ($one in $shapes){
if(`objectType $one` == \"mesh\"){
int $nV[] = `polyEvaluate -v $one`;
int $nF[] = `polyEvaluate -f $one`;
int $x = 0;
$write += \"\\n<mesh>\\n\";
$write += \"\\t<name>\"+$one+\"</name>\\n\";
$write += \"\\t<embedded>\\n\";
for($x=0;$x < $nV[0];$x++){
string $cv = $one+\".vtx[\"+$x+\"]\";
float $pos[] = `pointPosition $cv`;
$write += \"\\t\\t<vertex pos=\'\"+$pos[0]+\" \"+$pos[1]+\" \"+$pos[2]+\"\'\";
float $normal[] = `polyNormalPerVertex -q -xyz $cv`;
$write += \" normal=\'\"+$normal[0]+\" \"+$normal[1]+\" \"+$normal[2]+\"\'\";
string $uv[] = `polyListComponentConversion -fv -tuv $cv`;
float $uvcoord[] = `polyEditUV -q $uv`;
$write += \" uv0=\'\"+$uvcoord[0]+\" \"+$uvcoord[1]+\"\'/>\\n\";
}
$write += \"\\t</embedded>\\n\";
$write += \"\\t<triangle_set>\\n\";
string $sg[] = `listConnections -type shadingEngine $one`;
string $mat[] = `listConnections $sg[0]`;
//$mat[2] holds the actual material.
$write += \"\\t<material_name>\"+$mat[2]+\"</material_name>\\n\";
for($x = 0;$x < $nF[0];$x++){
string $curface = $one +\".f[\"+$x+\"]\";
string $vfl[] = `polyListComponentConversion -ff -tvf $curface`;
$vfl = `filterExpand -sm 70 $vfl`;
$write +=\"\\t\\t<tri>\";
for ($v in $vfl){
string $vert[]=`polyListComponentConversion -fvf -tv $v`;
string $vnum = match(\"[0-9]+\",match(\"[0-9]+\\]\",$vert[0]));
int $conv = $vnum;
$write += $conv + \" \";
}
$write += \"</tri>\\n\";
}
$write += \"\\t</triangle_set>\\n\";
$write += \"\\t</embedded>\\n\";
$write += \"</mesh>\";
}
}
//Models
string $trans[] =`ls -s`;
for ($one in $trans) {
string $shape[] = `listRelatives -shapes $one`;
if (`objectType $one` == \"mesh\"){
$write += \"\\n\\n<model>\\n\\t<pos>0 0 0</pos>\";
$write += \"\\n\\t<scale>1</scale>\";
$write += \"\\n\\t<rotation><matrix>1 0 0 0 1 0 0 0 1</matrix></rotation>\";
$write += \"\\n\\t<mesh_name>\"+$one +\"</mesh_name>\\n</model>\";
}
}
$write += \"\\n</scene>\";
print($write);
if (`window -exists indOut`) deleteUI indOut;
window -title \"Output for Indigo Renderer\" indOut;
windowPref -wh 500 600 indOut;
rowLayout -h 600;
scrollField -w 480 -h 560 -editable false -tx $write;
showWindow indOut;
ThatDude33 (174) maya->indigo exporter - 2006-05-26 11:47:33 Registered: unknown Posts: 119 Arneoog fixed a MAJOR bug for me! Thanks Arneoog!!!
IT wouldn\'t load the file, since I had swapped the name of Lambert1 with InitialShadingInfo or something like that. Anyway, Arneoog saww and fixed. I think it works now :D
//Script by Matt B. (ThatDude33) for export from Maya 6.5+ to Indigo 0.5.3
//Fixed by Arne OOG
//Outputs in script window
//Copy-Paste results into XML file, run using Ini File.
//No edits should be neccesary
//Start Writing:
string $write = \"<?xml version=\'1.0\' standalone=no>\\n\";
$write += \"<!--Exported from Maya-->\\n\\n\";
proc vector normalize(vector $v){
float $len = sqrt($v.x*$v.x+$v.y*$v.y+$v.z*$v.z);
vector $n = <<$v.x/$len, $v.y/$len, $v.z/$len>>;
return $n;
}
//Will have a prompt window, but now uses settings from render globals
$write +=\"<scene>\\n\";
$write += \"\\n<renderer_settings>\\n\";
$write += \"\\t<width>\" + `getAttr defaultResolution.width` +\"</width>\\n\";
$write += \"\\t<height>\" + `getAttr defaultResolution.height` +\"</height>\\n\";
$write += \"\\t<metropolis>true</metropolis>\\n\";
$write += \"\\t<large_mutation_prob>0.2</large_mutation_prob>\\n\";
$write += \"\\t<max_change>0.025</max_change>\\n\";
$write += \"\\t<russian_roulette_live_prob>0.7</russian_roulette_live_prob>\\n\";
$write += \"\\t<max_depth>1000</max_depth>\\n\";
$write += \"\\t<bidirectional>true</bidirectional>\\n\";
$write += \"\\t<strata_width>10</strata_width>\\n\";
$write += \"\\t<frame_upload_period>20</frame_upload_period>\\n\";
$write += \"\\t<halt_time>-1</halt_time>\\n\";
$write += \"\\t<logging>true</logging>\\n\";
$write += \"\\t<image_save_period>30</image_save_period>\\n\";
$write += \"\\t<save_tonemapped_exr>false</save_tonemapped_exr>\\n\";
$write += \"\\t<save_untonemapped_exr>false</save_untonemapped_exr>\\n\";
$write += \"</renderer_settings>\\n\\n\";
$write += \"\\t<tonemapping>\\n\";
$write += \"\\t\\t<reinhard>\\n\";
$write += \"\\t\\t\\t<pre_scale>2.0</pre_scale>\\n\";
$write += \"\\t\\t\\t<post_scale>1.0</post_scale>\\n\";
$write += \"\\t\\t</reinhard>\\n\";
$write += \"\\n\\t\\t<colour_correction>1.0 1.0 1.0</colour_correction>\\n\";
$write += \"\\t</tonemapping>\\n\";
$write += \"<background>\\n<radiance>1 1 1</radiance>\\n</background>\\n\\n\";
$write += \"\\n<camera>\\n\";
float $px = `getAttr camera1.tx`;
float $py = `getAttr camera1.ty`;
float $pz = `getAttr camera1.tz`;
vector $pos = <<$px, $py, $pz>>;
float $tx = `getAttr camera1_aim.tx`;
float $ty = `getAttr camera1_aim.ty`;
float $tz = `getAttr camera1_aim.tz`;
vector $target= <<$tx, $ty, $tz>>;
vector $front = $target-$pos;
vector $dist = $front;
$front = normalize($front);
$write += \"\\t<pos>\"+$px+\" \"+$py+\" \"+$pz+\"</pos>\\n\";
float $ux = `getAttr camera1_up.tx`;
float $uy = `getAttr camera1_up.ty`;
float $uz = `getAttr camera1_up.tz`;
vector $up = <<$ux, $uy, $uz>>;
$up = $up - $pos;
$up = normalize($up);
$write += \"\\t<up>\"+$up.x+\" \"+$up.y+\" \"+$up.z+\"</up>\\n\";
$write += \"\\t<forwards>\"+$front.x+\" \"+$front.y+\" \"+$front.z+\"</forwards>\\n\";
float $fstop = 8;
if ($fstop < 1.0){
$fstop = 1.0;
}
if ($fstop > 22){
$fstop = 22;
}
float $aprad = 50/$fstop;
$aprad = $aprad/200;
$write += \"\\t<aperture_radius>\"+$aprad+\"</aperture_radius>\\n\";
float $FD = sqrt($dist.x*$dist.x+$dist.y*$dist.y+$dist.z*$dist.z);
$write += \"\\t<focus_distance>\"+$FD+\"</focus_distance>\\n\";
$write += \"\\t<aspect_ratio>\"+`getAttr defaultResolution.deviceAspectRatio`+\"</aspect_ratio>\\n\";
$write += \"\\t<sensor_width>0.036</sensor_width>\\n\";
$write += \"\\t<lens_sensor_dist>0.0523314</lens_sensor_dist>\\n\";
$write += \"\\t<white_balance>D65</white_balance>\\n\";
$write += \"</camera>\\n\\n\";
string $mats[] = `ls -mat`;
for ($one in $mats){
if (`objectType $one` == \"lambert\"){
$write+= \"\\n<material>\\n\";
$write += \"\\t<name>\"+$one+\"</name>\\n\";
$write += \"\\t<diffuse>\\n\";
float $color[] = `getAttr ($one + \".color\")`;
$write+=\"\\t\\t<colour>\"+$color[0]+\" \"+$color[1]+\" \"+$color[2]+\"</colour>\\n\";
$write += \"\\t</diffuse>\\n\";
$write += \"</material>\\n\";
}
if (`objectType $one` == \"phong\"){
$write += \"\\n<material>\\n\";
$write += \"\\t<phong>\\n\";
$write += \"\\t\\t<name>\"+$one+\"</name>\\n\";
float $col[] = `getAttr ($one + \".color\")`;
$write += \"\\t\\t<diffuse>\"+$col[0]+\" \"+$col[1]+\" \"+$col[2]+\"</diffuse>\\n\";
float $reflectivity = `getAttr($one +\".reflectivity\")`;
if ($reflectivity > 0.0){
$write += \"\\t\\t<specular>\"+$reflectivity+\" \"+$reflectivity+\" \"+$reflectivity+\"</specular>\\n\";
}
if ($reflectivity == 0.0){
float $refl[] = `getAttr ($one +\".reflectedColor\")`;
$write += \"\\t\\t<specular>\"+$refl[0]+\" \"+$refl[1]+\" \"+$refl[2]+\"</specular>\\n\";
}
float $exp = `getAttr ($one + \".cosinePower\")`;
float $exp = $exp * 10;
$write += \"\\t\\t<exponent>\"+$exp+\"</exponent>\\n\";
$write += \"\\t</phong>\\n\";
$write += \"</material>\\n\";
}
}
string $shapes[] = `ls -s`;
for ($one in $shapes){
if(`objectType $one` == \"mesh\"){
int $nV[] = `polyEvaluate -v $one`;
int $nF[] = `polyEvaluate -f $one`;
int $x = 0;
$write += \"\\n<mesh>\\n\";
$write += \"\\t<name>\"+$one+\"</name>\\n\";
$write += \"\\t<embedded>\\n\";
for($x=0;$x < $nV[0];$x++){
string $cv = $one+\".vtx[\"+$x+\"]\";
float $pos[] = `pointPosition $cv`;
$write += \"\\t\\t<vertex pos=\'\"+$pos[0]+\" \"+$pos[1]+\" \"+$pos[2]+\"\'\";
float $normal[] = `polyNormalPerVertex -q -xyz $cv`;
$write += \" normal=\'\"+$normal[0]+\" \"+$normal[1]+\" \"+$normal[2]+\"\'\";
string $uv[] = `polyListComponentConversion -fv -tuv $cv`;
float $uvcoord[] = `polyEditUV -q $uv`;
$write += \" uv0=\'\"+$uvcoord[0]+\" \"+$uvcoord[1]+\"\'/>\\n\";
}
$write += \"\\t<triangle_set>\\n\";
string $sg[] = `listConnections -type shadingEngine $one`;
string $mat[] = `listConnections $sg[0]`;
//$mat[2] holds the actual material.
$write += \"\\t<material_name>\"+$mat[2]+\"</material_name>\\n\";
for($x = 0;$x < $nF[0];$x++){
string $curface = $one +\".f[\"+$x+\"]\";
string $vfl[] = `polyListComponentConversion -ff -tvf $curface`;
$vfl = `filterExpand -sm 70 $vfl`;
$write +=\"\\t\\t<tri>\";
for ($v in $vfl){
string $vert[]=`polyListComponentConversion -fvf -tv $v`;
string $vnum = match(\"[0-9]+\",match(\"[0-9]+\\]\",$vert[0]));
int $conv = $vnum;
$write += $conv + \" \";
}
$write += \"</tri>\\n\";
}
$write += \"\\t</triangle_set>\\n\";
$write += \"\\t</embedded>\\n\";
$write += \"</mesh>\";
}
}
//Models
string $trans[] =`ls -s`;
for ($one in $trans) {
string $shape[] = `listRelatives -shapes $one`;
if (`objectType $one` == \"mesh\"){
$write += \"\\n\\n<model>\\n\\t<pos>0 0 0</pos>\";
$write += \"\\n\\t<scale>1</scale>\";
$write += \"\\n\\t<rotation><matrix>1 0 0 0 1 0 0 0 1</matrix></rotation>\";
$write += \"\\n\\t<mesh_name>\"+$one +\"</mesh_name>\\n</model>\";
}
}
$write += \"\\n</scene>\";
print($write);
if (`window -exists indOut`) deleteUI indOut;
window -title \"Output for Indigo Renderer\" indOut;
windowPref -wh 500 600 indOut;
rowLayout -h 600;
scrollField -w 480 -h 560 -editable false -tx $write;
showWindow indOut;
ThatDude33 (174) maya->indigo exporter - 2006-05-26 17:37:45 Registered: unknown Posts: 119 Updated and fixed some major bugs-
please test please
//Script by Matt B. (ThatDude33) for export from Maya 6.5+ to Indigo 0.5.3
//Fixed by Arne OOG
//Outputs in script window
//Copy-Paste results into XML file, run using Ini File.
//No edits should be neccesary
//Start Writing:
string $write = \"<?xml version=\'1.0\' standalone=no>\\n\";
$write += \"<!--Exported from Maya-->\\n\\n\";
proc vector normalize(vector $v){
float $len = sqrt($v.x*$v.x+$v.y*$v.y+$v.z*$v.z);
vector $n = <<$v.x/$len, $v.y/$len, $v.z/$len>>;
return $n;
}
//Will have a prompt window, but now uses settings from render globals
$write +=\"<scene>\\n\";
$write += \"\\n<renderer_settings>\\n\";
$write += \"\\t<width>\" + `getAttr defaultResolution.width` +\"</width>\\n\";
$write += \"\\t<height>\" + `getAttr defaultResolution.height` +\"</height>\\n\";
$write += \"\\t<metropolis>true</metropolis>\\n\";
$write += \"\\t<large_mutation_prob>0.2</large_mutation_prob>\\n\";
$write += \"\\t<max_change>0.025</max_change>\\n\";
$write += \"\\t<russian_roulette_live_prob>0.7</russian_roulette_live_prob>\\n\";
$write += \"\\t<max_depth>1000</max_depth>\\n\";
$write += \"\\t<bidirectional>true</bidirectional>\\n\";
$write += \"\\t<strata_width>10</strata_width>\\n\";
$write += \"\\t<frame_upload_period>20</frame_upload_period>\\n\";
$write += \"\\t<halt_time>-1</halt_time>\\n\";
$write += \"\\t<logging>true</logging>\\n\";
$write += \"\\t<image_save_period>30</image_save_period>\\n\";
$write += \"\\t<save_tonemapped_exr>false</save_tonemapped_exr>\\n\";
$write += \"\\t<save_untonemapped_exr>false</save_untonemapped_exr>\\n\";
$write += \"</renderer_settings>\\n\\n\";
$write += \"\\t<tonemapping>\\n\";
$write += \"\\t\\t<reinhard>\\n\";
$write += \"\\t\\t\\t<pre_scale>2.0</pre_scale>\\n\";
$write += \"\\t\\t\\t<post_scale>1.0</post_scale>\\n\";
$write += \"\\t\\t</reinhard>\\n\";
$write += \"\\n\\t\\t<colour_correction>1.0 1.0 1.0</colour_correction>\\n\";
$write += \"\\t</tonemapping>\\n\";
$write += \"<background>\\n<radiance>1 1 1</radiance>\\n</background>\\n\\n\";
$write += \"\\n<camera>\\n\";
float $px = `getAttr camera1.tx`;
float $py = `getAttr camera1.ty`;
float $pz = `getAttr camera1.tz`;
vector $pos = <<$px, $py, $pz>>;
float $tx = `getAttr camera1_aim.tx`;
float $ty = `getAttr camera1_aim.ty`;
float $tz = `getAttr camera1_aim.tz`;
vector $target= <<$tx, $ty, $tz>>;
vector $front = $target-$pos;
vector $dist = $front;
$front = normalize($front);
$write += \"\\t<pos>\"+$px+\" \"+$py+\" \"+$pz+\"</pos>\\n\";
float $ux = `getAttr camera1_up.tx`;
float $uy = `getAttr camera1_up.ty`;
float $uz = `getAttr camera1_up.tz`;
vector $up = <<$ux, $uy, $uz>>;
$up = $up - $pos;
$up = normalize($up);
$write += \"\\t<up>\"+$up.x+\" \"+$up.y+\" \"+$up.z+\"</up>\\n\";
$write += \"\\t<forwards>\"+$front.x+\" \"+$front.y+\" \"+$front.z+\"</forwards>\\n\";
float $fstop = 8;
if ($fstop < 1.0){
$fstop = 1.0;
}
if ($fstop > 22){
$fstop = 22;
}
float $aprad = 50/$fstop;
$aprad = $aprad/200;
$write += \"\\t<aperture_radius>\"+$aprad+\"</aperture_radius>\\n\";
float $FD = sqrt($dist.x*$dist.x+$dist.y*$dist.y+$dist.z*$dist.z);
$write += \"\\t<focus_distance>\"+$FD+\"</focus_distance>\\n\";
$write += \"\\t<aspect_ratio>\"+`getAttr defaultResolution.deviceAspectRatio`+\"</aspect_ratio>\\n\";
$write += \"\\t<sensor_width>0.036</sensor_width>\\n\";
$write += \"\\t<lens_sensor_dist>0.0523314</lens_sensor_dist>\\n\";
$write += \"\\t<white_balance>D65</white_balance>\\n\";
$write += \"</camera>\\n\\n\";
string $mats[] = `ls -mat`;
for ($one in $mats){
if (`objectType $one` == \"lambert\"){
$write+= \"\\n<material>\\n\";
if($one == \"initialMaterialInfo\"){
$one = \"lambert1\";
}
$write += \"\\t<name>\"+$one+\"</name>\\n\";
$write += \"\\t<diffuse>\\n\";
float $color[] = `getAttr ($one + \".color\")`;
$write+=\"\\t\\t<colour>\"+$color[0]+\" \"+$color[1]+\" \"+$color[2]+\"</colour>\\n\";
$write += \"\\t</diffuse>\\n\";
$write += \"</material>\\n\";
}
if (`objectType $one` == \"phong\"){
$write += \"\\n<material>\\n\";
$write += \"\\t\\t<name>\"+$one+\"</name>\\n\";
$write += \"\\t<phong>\\n\";
float $col[] = `getAttr ($one + \".color\")`;
$write += \"\\t\\t<diffuse>\"+$col[0]+\" \"+$col[1]+\" \"+$col[2]+\"</diffuse>\\n\";
float $reflectivity = `getAttr($one +\".reflectivity\")`;
if ($reflectivity > 0.0){
$write += \"\\t\\t<specular>\"+$reflectivity+\" \"+$reflectivity+\" \"+$reflectivity+\"</specular>\\n\";
}
if ($reflectivity == 0.0){
float $refl[] = `getAttr ($one +\".reflectedColor\")`;
$write += \"\\t\\t<specular>\"+$refl[0]+\" \"+$refl[1]+\" \"+$refl[2]+\"</specular>\\n\";
}
float $exp = `getAttr ($one + \".cosinePower\")`;
float $exp = $exp * 10;
$write += \"\\t\\t<exponent>\"+$exp+\"</exponent>\\n\";
$write += \"\\t</phong>\\n\";
$write += \"</material>\\n\";
}
}
string $shapes[] = `ls -s`;
for ($one in $shapes){
if(`objectType $one` == \"mesh\"){
int $nV[] = `polyEvaluate -v $one`;
int $nF[] = `polyEvaluate -f $one`;
int $x = 0;
$write += \"\\n<mesh>\\n\";
$write += \"\\t<name>\"+$one+\"</name>\\n\";
$write += \"\\t<embedded>\\n\";
for($x=0;$x < $nV[0];$x++){
string $cv = $one+\".vtx[\"+$x+\"]\";
float $pos[] = `pointPosition $cv`;
$write += \"\\t\\t<vertex pos=\'\"+$pos[0]+\" \"+$pos[1]+\" \"+$pos[2]+\"\'\";
float $normal[] = `polyNormalPerVertex -q -xyz $cv`;
$write += \" normal=\'\"+$normal[0]+\" \"+$normal[1]+\" \"+$normal[2]+\"\'\";
string $uv[] = `polyListComponentConversion -fv -tuv $cv`;
float $uvcoord[] = `polyEditUV -q $uv`;
$write += \" uv0=\'\"+$uvcoord[0]+\" \"+$uvcoord[1]+\"\'/>\\n\";
}
$write += \"\\t<triangle_set>\\n\";
string $sg[] = `listConnections -type shadingEngine $one`;
string $mat[] = `listConnections $sg[0]`;
//$mat[2] holds the actual material.
print(`listConnections $sg[0]`);
if ($mat[2] == \"initialMaterialInfo\"){
$mat[2] = $mat[0];
}
if ($mat[2] == \"renderPartition\"){
$mat[2] = $mat[3];
}
$write += \"\\t<material_name>\"+$mat[2]+\"</material_name>\\n\";
for($x = 0;$x < $nF[0];$x++){
string $curface = $one +\".f[\"+$x+\"]\";
string $vfl[] = `polyListComponentConversion -ff -tvf $curface`;
$vfl = `filterExpand -sm 70 $vfl`;
$write +=\"\\t\\t<tri>\";
for ($v in $vfl){
string $vert[]=`polyListComponentConversion -fvf -tv $v`;
string $vnum = match(\"[0-9]+\",match(\"[0-9]+\\]\",$vert[0]));
int $conv = $vnum;
$write += $conv + \" \";
}
$write += \"</tri>\\n\";
}
$write += \"\\t</triangle_set>\\n\";
$write += \"\\t</embedded>\\n\";
$write += \"</mesh>\";
}
}
//Models
string $trans[] =`ls -s`;
for ($one in $trans) {
string $shape[] = `listRelatives -shapes $one`;
if (`objectType $one` == \"mesh\"){
$write += \"\\n\\n<model>\\n\\t<pos>0 0 0</pos>\";
$write += \"\\n\\t<scale>1</scale>\";
$write += \"\\n\\t<rotation><matrix>1 0 0 0 1 0 0 0 1</matrix></rotation>\";
$write += \"\\n\\t<mesh_name>\"+$one +\"</mesh_name>\\n</model>\";
}
}
$write += \"\\n</scene>\";
print($write);
if (`window -exists indOut`) deleteUI indOut;
window -title \"Output for Indigo Renderer\" indOut;
windowPref -wh 500 600 indOut;
rowLayout -h 600;
scrollField -w 480 -h 560 -editable false -tx $write;
showWindow indOut;
ThatDude33 (174) maya->indigo exporter - 2006-06-05 16:25:04 Registered: unknown Posts: 119 Update!
Handles meshlights now!
Turn the mesh into a meshlight by turning up the incandescence tab in the material.
//Script by Matt B. (ThatDude33) for export from Maya 6.5+ to Indigo 0.5.3
//Fixed by Arne OOG
//Outputs in script window
//Copy-Paste results into XML file, run using Ini File.
//No edits should be neccesary
//Start Writing:
string $write = \"<?xml version=\'1.0\' standalone=no>\\n\";
$write += \"<!--Exported from Maya-->\\n\\n\";
proc vector normalize(vector $v){
float $len = sqrt($v.x*$v.x+$v.y*$v.y+$v.z*$v.z);
vector $n = <<$v.x/$len, $v.y/$len, $v.z/$len>>;
return $n;
}
//Will have a prompt window, but now uses settings from render globals
$write +=\"<scene>\\n\";
$write += \"\\n<renderer_settings>\\n\";
$write += \"\\t<width>\" + `getAttr defaultResolution.width` +\"</width>\\n\";
$write += \"\\t<height>\" + `getAttr defaultResolution.height` +\"</height>\\n\";
$write += \"\\t<metropolis>true</metropolis>\\n\";
$write += \"\\t<large_mutation_prob>0.2</large_mutation_prob>\\n\";
$write += \"\\t<max_change>0.025</max_change>\\n\";
$write += \"\\t<russian_roulette_live_prob>0.7</russian_roulette_live_prob>\\n\";
$write += \"\\t<max_depth>1000</max_depth>\\n\";
$write += \"\\t<bidirectional>false</bidirectional>\\n\";
$write += \"\\t<strata_width>10</strata_width>\\n\";
$write += \"\\t<frame_upload_period>20</frame_upload_period>\\n\";
$write += \"\\t<halt_time>-1</halt_time>\\n\";
$write += \"\\t<logging>true</logging>\\n\";
$write += \"\\t<image_save_period>30</image_save_period>\\n\";
$write += \"\\t<save_tonemapped_exr>false</save_tonemapped_exr>\\n\";
$write += \"\\t<save_untonemapped_exr>false</save_untonemapped_exr>\\n\";
$write += \"</renderer_settings>\\n\\n\";
$write += \"\\t<tonemapping>\\n\";
$write += \"\\t\\t<reinhard>\\n\";
$write += \"\\t\\t\\t<pre_scale>2.0</pre_scale>\\n\";
$write += \"\\t\\t\\t<post_scale>1.0</post_scale>\\n\";
$write += \"\\t\\t</reinhard>\\n\";
$write += \"\\n\\t\\t<colour_correction>1.0 1.0 1.0</colour_correction>\\n\";
$write += \"\\t</tonemapping>\\n\";
$write += \"<background>\\n<radiance>1 1 1</radiance>\\n</background>\\n\\n\";
$write += \"\\n<camera>\\n\";
float $px = `getAttr camera1.tx`;
float $py = `getAttr camera1.ty`;
float $pz = `getAttr camera1.tz`;
vector $pos = <<$px, $py, $pz>>;
float $tx = `getAttr camera1_aim.tx`;
float $ty = `getAttr camera1_aim.ty`;
float $tz = `getAttr camera1_aim.tz`;
vector $target= <<$tx, $ty, $tz>>;
vector $front = $target-$pos;
vector $dist = $front;
$front = normalize($front);
$write += \"\\t<pos>\"+$px+\" \"+$py+\" \"+$pz+\"</pos>\\n\";
float $ux = `getAttr camera1_up.tx`;
float $uy = `getAttr camera1_up.ty`;
float $uz = `getAttr camera1_up.tz`;
vector $up = <<$ux, $uy, $uz>>;
$up = $up - $pos;
$up = normalize($up);
$write += \"\\t<up>\"+$up.x+\" \"+$up.y+\" \"+$up.z+\"</up>\\n\";
$write += \"\\t<forwards>\"+$front.x+\" \"+$front.y+\" \"+$front.z+\"</forwards>\\n\";
float $fstop = 8;
if ($fstop < 1.0){
$fstop = 1.0;
}
if ($fstop > 22){
$fstop = 22;
}
float $aprad = 50/$fstop;
$aprad = $aprad/200;
$write += \"\\t<aperture_radius>\"+$aprad+\"</aperture_radius>\\n\";
float $FD = sqrt($dist.x*$dist.x+$dist.y*$dist.y+$dist.z*$dist.z);
$write += \"\\t<focus_distance>\"+$FD+\"</focus_distance>\\n\";
$write += \"\\t<aspect_ratio>\"+`getAttr defaultResolution.deviceAspectRatio`+\"</aspect_ratio>\\n\";
$write += \"\\t<sensor_width>0.036</sensor_width>\\n\";
$write += \"\\t<lens_sensor_dist>0.0523314</lens_sensor_dist>\\n\";
$write += \"\\t<white_balance>D65</white_balance>\\n\";
$write += \"</camera>\\n\\n\";
string $mats[] = `ls -mat`;
for ($one in $mats){
if (`objectType $one` == \"lambert\"){
float $inc[]=`getAttr ($one + \".incandescence\")`;
if ($inc[0] > 0.0){
break;
}
if ($inc[1] > 0.0){
break;
}
if ($inc[2] > 0.0){
break;
}
$write+= \"\\n<material>\\n\";
if($one == \"initialMaterialInfo\"){
$one = \"lambert1\";
}
$write += \"\\t<name>\"+$one+\"</name>\\n\";
$write += \"\\t<diffuse>\\n\";
float $color[] = `getAttr ($one + \".color\")`;
$write+=\"\\t\\t<colour>\"+$color[0]+\" \"+$color[1]+\" \"+$color[2]+\"</colour>\\n\";
$write += \"\\t</diffuse>\\n\";
$write += \"</material>\\n\";
}
if (`objectType $one` == \"phong\"){
$write += \"\\n<material>\\n\";
$write += \"\\t\\t<name>\"+$one+\"</name>\\n\";
$write += \"\\t<phong>\\n\";
float $col[] = `getAttr ($one + \".color\")`;
$write += \"\\t\\t<diffuse>\"+$col[0]+\" \"+$col[1]+\" \"+$col[2]+\"</diffuse>\\n\";
float $reflectivity = `getAttr($one +\".reflectivity\")`;
if ($reflectivity > 0.0){
$write += \"\\t\\t<specular>\"+$reflectivity+\" \"+$reflectivity+\" \"+$reflectivity+\"</specular>\\n\";
}
if ($reflectivity == 0.0){
float $refl[] = `getAttr ($one +\".reflectedColor\")`;
$write += \"\\t\\t<specular>\"+$refl[0]+\" \"+$refl[1]+\" \"+$refl[2]+\"</specular>\\n\";
}
float $exp = `getAttr ($one + \".cosinePower\")`;
float $exp = $exp * 10;
$write += \"\\t\\t<exponent>\"+$exp+\"</exponent>\\n\";
$write += \"\\t</phong>\\n\";
$write += \"</material>\\n\";
}
}
string $shapes[] = `ls -s`;
for ($one in $shapes){
if(`objectType $one` == \"mesh\"){
int $nV[] = `polyEvaluate -v $one`;
int $nF[] = `polyEvaluate -f $one`;
int $x = 0;
$write += \"\\n<mesh>\\n\";
$write += \"\\t<name>\"+$one+\"</name>\\n\";
$write += \"\\t<embedded>\\n\";
for($x=0;$x < $nV[0];$x++){
string $cv = $one+\".vtx[\"+$x+\"]\";
float $pos[] = `pointPosition $cv`;
$write += \"\\t\\t<vertex pos=\'\"+$pos[0]+\" \"+$pos[1]+\" \"+$pos[2]+\"\'\";
float $normal[] = `polyNormalPerVertex -q -xyz $cv`;
$normal[0] = -$normal[0];
$normal[1] = -$normal[1];
$normal[2] = -$normal[2];
$write += \" normal=\'\"+$normal[0]+\" \"+$normal[1]+\" \"+$normal[2]+\"\'\";
string $uv[] = `polyListComponentConversion -fv -tuv $cv`;
float $uvcoord[] = `polyEditUV -q $uv`;
$write += \" uv0=\'\"+$uvcoord[0]+\" \"+$uvcoord[1]+\"\'/>\\n\";
}
$write += \"\\t<triangle_set>\\n\";
string $sg[] = `listConnections -type shadingEngine $one`;
string $mat[] = `listConnections $sg[0]`;
//$mat[2] holds the actual material.
print(`listConnections $sg[0]`);
if ($mat[2] == \"initialMaterialInfo\"){
$mat[2] = $mat[0];
}
if ($mat[2] == \"renderPartition\"){
$mat[2] = $mat[3];
}
$write += \"\\t<material_name>\"+$mat[2]+\"</material_name>\\n\";
for($x = 0;$x < $nF[0];$x++){
string $curface = $one +\".f[\"+$x+\"]\";
string $vfl[] = `polyListComponentConversion -ff -tvf $curface`;
$vfl = `filterExpand -sm 70 $vfl`;
$write +=\"\\t\\t<tri>\";
for ($v in $vfl){
string $vert[]=`polyListComponentConversion -fvf -tv $v`;
string $vnum = match(\"[0-9]+\",match(\"[0-9]+\\]\",$vert[0]));
int $conv = $vnum;
$write += $conv + \" \";
}
$write += \"</tri>\\n\";
}
$write += \"\\t</triangle_set>\\n\";
$write += \"\\t</embedded>\\n\";
$write += \"</mesh>\";
}
}
//Models
string $trans[] =`ls -s`;
for ($one in $trans) {
if (`objectType $one` == \"mesh\"){
string $sg[] = `listConnections -t shadingEngine $one`;
if ($sg[0] == \"initialShadingGroup\"){
$sg[0] = \"lambert1\";
}
string $amat[] = `listConnections $sg[0]`;
if ($amat[2] == \"renderPartition\"){
$amat[2] = $amat[3];
}
float $inc[] = `getAttr ($amat[2]+\".incandescence\")`;
print($one + \"/:con \" + $amat[2]+\"\\n\");
if ($inc[1]+$inc[2]+$inc[0] ==0){
$write += \"\\n\\n<model>\\n\\t<pos>0 0 0</pos>\";
$write += \"\\n\\t<scale>1</scale>\";
$write += \"\\n\\t<normal_smoothing>true</normal_smoothing>\";
$write += \"\\n\\t<rotation><matrix>1 0 0 0 1 0 0 0 1</matrix></rotation>\";
$write += \"\\n\\t<mesh_name>\"+$one +\"</mesh_name>\\n</model>\";
}
if ($inc[1]+$inc[2]+$inc[0] >0){
$write += \"\\n<meshlight>\\n\";
$write += \"\\t<pos>0 0 0</pos>\\n\";
$write += \"\\t<scale>1</scale>\\n\";
$write += \"\\t<rotation>\\n\";
$write += \"\\t\\t<matrix>1 0 0 0 1 0 0 0 1</matrix>\\n\";
$write += \"\\t</rotation>\\n\";
$write += \"\\t<mesh_name>\"+$one+\"</mesh_name>\\n\";
$write += \"\\t<spectrum>\\n\";
float $rgb[3];
$rgb[0] = 256*$inc[0]*5;
$rgb[1] = 256*$inc[1]*5;
$rgb[2] = 256*$inc[2]*5;
$write += \"\\t\\t<rgb>\"+$rgb[0]+\" \"+$rgb[1]+\" \"+$rgb[2]+\"</rgb>\\n\";
$write += \"\\t<spectrum>\\n\";
$write += \"</meshlight>\\n\";
}
}
}
$write += \"\\n</scene>\";
if (`window -exists indOut`) deleteUI indOut;
window -title \"Output for Indigo Renderer\" indOut;
windowPref -wh 500 600 indOut;
rowLayout -h 600;
scrollField -w 480 -h 560 -editable false -tx $write;
showWindow indOut;
ThatDude33 (174) maya->indigo exporter - 2006-06-06 08:57:08 Registered: unknown Posts: 119 Update- you can choose skylight, physical sky, or none.
If you do chose physical sky, make a point light (don\'t rename) and position it where you want (assuming 0 0 0 is target)
//Script by Matt B. (ThatDude33) for export from Maya 6.5+ to Indigo 0.5.3
//Fixed by Arne OOG
//Outputs in script window
//Copy-Paste results into XML file, run using Ini File.
//No edits should be neccesary
//Start Writing:
string $write = \"<?xml version=\'1.0\' standalone=no>\\n\";
global proc vector normalize(vector $v){
float $len = sqrt($v.x*$v.x+$v.y*$v.y+$v.z*$v.z);
vector $n = <<$v.x/$len, $v.y/$len, $v.z/$len>>;
return $n;
}
if (`window -exists In`) deleteUI In;
window -title \"Maya->Indigo Settings\" In;
windowPref -wh 300 100 In;
columnLayout ColumnLayout;
frameLayout -labelVisible false -marginWidth 5 -marginHeight 5;
columnLayout;
text -label \"Render Settings\";
rowLayout -numberOfColumns 3;
string $physical = `button -label \"Physical Sky\"`;
string $sky = `button -label \"Skylight\"`;
string $none = `button -label \"None\"`;
button -edit -command (\"output physical\") $physical;
button -edit -command (\"output skylight\") $sky;
button -edit -command (\"output none\") $none;
showWindow In;
global proc output(string $selected){
string $write;
print $selected;
$write +=\"<scene>\\n\";
$write += \"\\n<renderer_settings>\\n\";
$write += \"\\t<width>\" + `getAttr defaultResolution.width` +\"</width>\\n\";
$write += \"\\t<height>\" + `getAttr defaultResolution.height` +\"</height>\\n\";
$write += \"\\t<metropolis>true</metropolis>\\n\";
$write += \"\\t<large_mutation_prob>0.2</large_mutation_prob>\\n\";
$write += \"\\t<max_change>0.025</max_change>\\n\";
$write += \"\\t<russian_roulette_live_prob>0.7</russian_roulette_live_prob>\\n\";
$write += \"\\t<max_depth>1000</max_depth>\\n\";
$write += \"\\t<bidirectional>false</bidirectional>\\n\";
$write += \"\\t<strata_width>10</strata_width>\\n\";
$write += \"\\t<frame_upload_period>20</frame_upload_period>\\n\";
$write += \"\\t<halt_time>-1</halt_time>\\n\";
$write += \"\\t<logging>true</logging>\\n\";
$write += \"\\t<image_save_period>30</image_save_period>\\n\";
$write += \"\\t<save_tonemapped_exr>false</save_tonemapped_exr>\\n\";
$write += \"\\t<save_untonemapped_exr>false</save_untonemapped_exr>\\n\";
$write += \"</renderer_settings>\\n\\n\";
$write += \"\\t<tonemapping>\\n\";
$write += \"\\t\\t<reinhard>\\n\";
$write += \"\\t\\t\\t<pre_scale>2.0</pre_scale>\\n\";
$write += \"\\t\\t\\t<post_scale>1.0</post_scale>\\n\";
$write += \"\\t\\t</reinhard>\\n\";
$write += \"\\n\\t\\t<colour_correction>1.0 1.0 1.0</colour_correction>\\n\";
$write += \"\\t</tonemapping>\\n\";
if ($selected == \"skylight\"){
$write += \"<background>\\n<radiance>1 1 1</radiance>\\n</background>\\n\\n\";
}
if ($selected == \"physical\"){
float $x = `getAttr pointLight1.tx`;
float $y = `getAttr pointLight1.ty`;
float $z = `getAttr pointLight1.tz`;
vector $sun = <<$x, $y, $z>>;
$sun = normalize($sun);
$write += \"\\n<skylight>\\n\\t<sundir>\"+$sun.x+\" \"+$sun.y+\" \"+$sun.z+\"</sundir>\\n\\t<turbidity>2.0</turbidity>\\n\\t<sky_gain>0.02</sky_gain>\\n</skylight>\\n\";
}
$write += \"\\n<camera>\\n\";
float $px = `getAttr camera1.tx`;
float $py = `getAttr camera1.ty`;
float $pz = `getAttr camera1.tz`;
vector $pos = <<$px, $py, $pz>>;
float $tx = `getAttr camera1_aim.tx`;
float $ty = `getAttr camera1_aim.ty`;
float $tz = `getAttr camera1_aim.tz`;
vector $target= <<$tx, $ty, $tz>>;
vector $front = $target-$pos;
vector $dist = $front;
$front = normalize($front);
$write += \"\\t<pos>\"+$px+\" \"+$py+\" \"+$pz+\"</pos>\\n\";
float $ux = `getAttr camera1_up.tx`;
float $uy = `getAttr camera1_up.ty`;
float $uz = `getAttr camera1_up.tz`;
vector $up = <<$ux, $uy, $uz>>;
$up = $up - $pos;
$up = normalize($up);
$write += \"\\t<up>\"+$up.x+\" \"+$up.y+\" \"+$up.z+\"</up>\\n\";
$write += \"\\t<forwards>\"+$front.x+\" \"+$front.y+\" \"+$front.z+\"</forwards>\\n\";
float $fstop = 8;
if ($fstop < 1.0){
$fstop = 1.0;
}
if ($fstop > 22){
$fstop = 22;
}
float $aprad = 50/$fstop;
$aprad = $aprad/200;
$write += \"\\t<aperture_radius>\"+$aprad+\"</aperture_radius>\\n\";
float $FD = sqrt($dist.x*$dist.x+$dist.y*$dist.y+$dist.z*$dist.z);
$write += \"\\t<focus_distance>\"+$FD+\"</focus_distance>\\n\";
$write += \"\\t<aspect_ratio>\"+`getAttr defaultResolution.deviceAspectRatio`+\"</aspect_ratio>\\n\";
$write += \"\\t<sensor_width>0.036</sensor_width>\\n\";
$write += \"\\t<lens_sensor_dist>0.0523314</lens_sensor_dist>\\n\";
$write += \"\\t<white_balance>D65</white_balance>\\n\";
$write += \"</camera>\\n\\n\";
string $mats[] = `ls -mat`;
for ($one in $mats){
if (`objectType $one` == \"lambert\"){
float $inc[]=`getAttr ($one + \".incandescence\")`;
if ($inc[0] > 0.0){
break;
}
if ($inc[1] > 0.0){
break;
}
if ($inc[2] > 0.0){
break;
}
$write+= \"\\n<material>\\n\";
if($one == \"initialMaterialInfo\"){
$one = \"lambert1\";
}
$write += \"\\t<name>\"+$one+\"</name>\\n\";
$write += \"\\t<diffuse>\\n\";
float $color[] = `getAttr ($one + \".color\")`;
$write+=\"\\t\\t<colour>\"+$color[0]+\" \"+$color[1]+\" \"+$color[2]+\"</colour>\\n\";
$write += \"\\t</diffuse>\\n\";
$write += \"</material>\\n\";
}
if (`objectType $one` == \"phong\"){
$write += \"\\n<material>\\n\";
$write += \"\\t\\t<name>\"+$one+\"</name>\\n\";
$write += \"\\t<phong>\\n\";
float $col[] = `getAttr ($one + \".color\")`;
$write += \"\\t\\t<diffuse>\"+$col[0]+\" \"+$col[1]+\" \"+$col[2]+\"</diffuse>\\n\";
float $reflectivity = `getAttr($one +\".reflectivity\")`;
if ($reflectivity > 0.0){
$write += \"\\t\\t<specular>\"+$reflectivity+\" \"+$reflectivity+\" \"+$reflectivity+\"</specular>\\n\";
}
if ($reflectivity == 0.0){
float $refl[] = `getAttr ($one +\".reflectedColor\")`;
$write += \"\\t\\t<specular>\"+$refl[0]+\" \"+$refl[1]+\" \"+$refl[2]+\"</specular>\\n\";
}
float $exp = `getAttr ($one + \".cosinePower\")`;
float $exp = $exp * 10;
$write += \"\\t\\t<exponent>\"+$exp+\"</exponent>\\n\";
$write += \"\\t</phong>\\n\";
$write += \"</material>\\n\";
}
}
string $shapes[] = `ls -s`;
for ($one in $shapes){
if(`objectType $one` == \"mesh\"){
int $nV[] = `polyEvaluate -v $one`;
int $nF[] = `polyEvaluate -f $one`;
int $x = 0;
$write += \"\\n<mesh>\\n\";
$write += \"\\t<name>\"+$one+\"</name>\\n\";
$write += \"\\t<embedded>\\n\";
for($x=0;$x < $nV[0];$x++){
string $cv = $one+\".vtx[\"+$x+\"]\";
float $pos[] = `pointPosition $cv`;
$write += \"\\t\\t<vertex pos=\'\"+$pos[0]+\" \"+$pos[1]+\" \"+$pos[2]+\"\'\";
float $normal[] = `polyNormalPerVertex -q -xyz $cv`;
$normal[0] = -$normal[0];
$normal[1] = -$normal[1];
$normal[2] = -$normal[2];
$write += \" normal=\'\"+$normal[0]+\" \"+$normal[1]+\" \"+$normal[2]+\"\'\";
string $uv[] = `polyListComponentConversion -fv -tuv $cv`;
float $uvcoord[] = `polyEditUV -q $uv`;
$write += \" uv0=\'\"+$uvcoord[0]+\" \"+$uvcoord[1]+\"\'/>\\n\";
}
$write += \"\\t<triangle_set>\\n\";
string $sg[] = `listConnections -type shadingEngine $one`;
string $mat[] = `listConnections $sg[0]`;
//$mat[2] holds the actual material.
print(`listConnections $sg[0]`);
if ($mat[2] == \"initialMaterialInfo\"){
$mat[2] = $mat[0];
}
if ($mat[2] == \"renderPartition\"){
$mat[2] = $mat[3];
}
$write += \"\\t<material_name>\"+$mat[2]+\"</material_name>\\n\";
for($x = 0;$x < $nF[0];$x++){
string $curface = $one +\".f[\"+$x+\"]\";
string $vfl[] = `polyListComponentConversion -ff -tvf $curface`;
$vfl = `filterExpand -sm 70 $vfl`;
$write +=\"\\t\\t<tri>\";
for ($v in $vfl){
string $vert[]=`polyListComponentConversion -fvf -tv $v`;
string $vnum = match(\"[0-9]+\",match(\"[0-9]+\\]\",$vert[0]));
int $conv = $vnum;
$write += $conv + \" \";
}
$write += \"</tri>\\n\";
}
$write += \"\\t</triangle_set>\\n\";
$write += \"\\t</embedded>\\n\";
$write += \"</mesh>\";
}
}
//Models
string $trans[] =`ls -s`;
for ($one in $trans) {
if (`objectType $one` == \"mesh\"){
string $sg[] = `listConnections -t shadingEngine $one`;
if ($sg[0] == \"initialShadingGroup\"){
$sg[0] = \"lambert1\";
}
string $amat[] = `listConnections $sg[0]`;
if ($amat[2] == \"renderPartition\"){
$amat[2] = $amat[3];
}
if ($amat[2] == \"defaultShaderList1\"){
$amat[2] = \"lambert1\";
}
float $inc[] = `getAttr ($amat[2]+\".incandescence\")`;
print($one + \"/:con \" + $amat[2]+\"\\n\");
if ($inc[1]+$inc[2]+$inc[0] ==0){
$write += \"\\n\\n<model>\\n\\t<pos>0 0 0</pos>\";
$write += \"\\n\\t<scale>1</scale>\";
$write += \"\\n\\t<normal_smoothing>true</normal_smoothing>\";
$write += \"\\n\\t<rotation><matrix>1 0 0 0 1 0 0 0 1</matrix></rotation>\";
$write += \"\\n\\t<mesh_name>\"+$one +\"</mesh_name>\\n</model>\";
}
if ($inc[1]+$inc[2]+$inc[0] >0){
$write += \"\\n<meshlight>\\n\";
$write += \"\\t<pos>0 0 0</pos>\\n\";
$write += \"\\t<scale>1</scale>\\n\";
$write += \"\\t<rotation>\\n\";
$write += \"\\t\\t<matrix>1 0 0 0 1 0 0 0 1</matrix>\\n\";
$write += \"\\t</rotation>\\n\";
$write += \"\\t<mesh_name>\"+$one+\"</mesh_name>\\n\";
$write += \"\\t<spectrum>\\n\";
float $rgb[3];
$rgb[0] = 256*$inc[0]*5;
$rgb[1] = 256*$inc[1]*5;
$rgb[2] = 256*$inc[2]*5;
$write += \"\\t<rgb>\\n\";
$write += \"\\t\\t<rgb>\"+$rgb[0]+\" \"+$rgb[1]+\" \"+$rgb[2]+\"</rgb>\\n\";
$write += \"\\t</rgb>\\n\";
$write += \"\\t</spectrum>\\n\";
$write += \"</meshlight>\\n\";
}
}
}
$write += \"\\n</scene>\";
if (`window -exists indOut`) deleteUI indOut;
window -title \"Output for Indigo Renderer\" indOut;
windowPref -wh 500 600 indOut;
rowLayout -h 600;
scrollField -w 480 -h 560 -editable false -tx $write;
showWindow indOut;
}
Arneoog (184) maya->indigo exporter - 2006-06-06 10:26:00 Registered: unknown Posts: 22 SUPER DUPER MEGA AWSOME!!! :D
This is starting to look extremly good!!!
ThatDude33 (174) maya->indigo exporter - 2006-06-28 18:34:30 Registered: unknown Posts: 119 well.. in case any of u were wondering... I am still working on the script- I have plans for a window for Indigo Material Editing and Creating-
ArneOOG is making an AWESOME gui for it now... so hang on there (tho I know that most of you people don't use Maya anyway :D)
Anyways- update soon
-Matt
You need to
log in in order to reply to this topic.
generated:January 6, 2009, 12:47 am
Generated on January 6, 2009, 12:47 am
Theme © 2006 Lionel Brits