Maya to Indigo XML converter

Announcements, requests and support regarding the MAYA exporter
User avatar
ThatDude33
Posts: 216
Joined: Wed Jul 05, 2006 1:26 pm
Contact:

Maya to Indigo XML converter

Post by ThatDude33 » Wed Jul 05, 2006 1:42 pm

Maya->Indigo

with ArneOOG for the GUI!

all is in the readme file (and what's not in there you can ask me and I will tell you)

http://www.savefile.com/files/6670423
Last edited by ThatDude33 on Tue Aug 01, 2006 10:01 am, edited 1 time in total.
Matt B. >>Maya To Indigo<<
Image

User avatar
arneoog
Indigo 100
Posts: 504
Joined: Sun Jun 25, 2006 2:19 am
Location: Norway
Contact:

Post by arneoog » Tue Jul 25, 2006 10:00 am

Yo! :D
Here's the latest version of the converter!
maya_to_indigo_xml_converter_beta0.2.zip

Here is what that works and not: ChangeLog
Arne OOG - My Portfolio

User avatar
ThatDude33
Posts: 216
Joined: Wed Jul 05, 2006 1:26 pm
Contact:

Post by ThatDude33 » Thu Jul 27, 2006 1:04 pm

hey arne! Just should thank you here as well for keeping this up... hard to work on this, and do my real job and others as well, but I will start again soon I promise :oops:

Also- I fixed (in an earlier thing) the big normal smoothing bug. At one point in the code, I was flipping ALL normals. I spotted that bugger and gave him a shaking lol :D

Anyway, again thanx arne :)
Matt B. >>Maya To Indigo<<
Image

User avatar
arneoog
Indigo 100
Posts: 504
Joined: Sun Jun 25, 2006 2:19 am
Location: Norway
Contact:

Post by arneoog » Thu Jul 27, 2006 11:30 pm

Oh, thanks :)
I understand, just get all you have to do done.
In the mean time I'm going to try and come up with some interesting features for it :D
Arne OOG - My Portfolio

User avatar
ThatDude33
Posts: 216
Joined: Wed Jul 05, 2006 1:26 pm
Contact:

Post by ThatDude33 » Mon Jul 31, 2006 9:29 am

and the newest addition :)

edit holy sh*t! I didn;t think it would be THIS long O.O

plz some moderator tell me if I need to host it somewhere, and I will

Code: Select all

//-----------------MAYA TO INDIGO XML CONVERTER------------------
//Credits:
//Matt B. (aka MattTheMan or ThatDude33) (converter engine)
//Arne OOG (aka arneoog) (interface)
//Outputs in script window
//Copy-Paste results into XML file, run using Ini File.
//No edits should be neccesary
//Start Writing:

//-----------------VECTOR CONFIG------------------

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;
}

//-----------------ABOUT MAYA TO INDIGO------------------

global proc abWin() 
{ 
window -title "About Maya to Indigo" -h 200 -w 300 About;
columnLayout;
text -label "About Maya to Indigo" -w 300 -h 40 -backgroundColor 1 1 1 -font "boldLabelFont" -align "center" ;

text -label "" -w 300 -align "center";
text -label "Creators:" -w 300 -font "boldLabelFont" -align "center";
text -label "Matt B. " -w 300 -align "center";
text -label "Arne OOG" -w 300 -align "center";
text -label "" -w 300 -align "center";

	separator -w 300;

text -label "" -w 300 -align "center";
text -label "Copyright © 2006" -w 300 -align "center";
			showWindow;
}

//-----------------MAYA TO INDIGO HELP------------------

global proc helpWin() 
{ 
window -title "Maya to Indigo Help" -h 220 -w 360 Help;
columnLayout;
text -label "Maya to Indigo Help" -w 360 -h 40 -backgroundColor 1 1 1 -font "boldLabelFont" -align "center" ;

text -label "" -w 360;
text -label "Things to remember before you generate the XML code" -w 360 -font "boldLabelFont";
text -label "- You must create a Camera" -w 360;
text -label "- You must triangulate every one of you meshes" -w 360;
text -label "- You must delet you history" -w 360;
text -label "" -w 360 -align "center";

			showWindow;
}

//-----------------OBJECT EDITOR------------------

global proc objectEditor() 
{ 
window -title "Object Editor" -h 340 -w 570 objE00444;
rowLayout -numberOfColumns 2 -columnWidth2 174 310;
scrollLayout -h 306 -w 170 -backgroundColor 1 1 1;
 			                setParent ..;
 			setParent ..;
columnLayout;
text -label "Material Settings" -w 400 -align "left" -font "boldLabelFont";
	separator -h 10 -w 400;
 			shelfLayout -width 390 -cellWidth 34 -cellHeight 34;
shelfButton -annotation "Diffuse Shader" -image "indigo_diffuce.bmp" -command "diffuce";
shelfButton -annotation "Phong Shader" -image "indigo_phong.bmp" -command "phong";
shelfButton -annotation "Specular Shader" -image "indigo_specular.bmp" -command "specular";
shelfButton -annotation "Mesh Light Shader" -image "indigo_meshLight.bmp" -command "meshlight";
shelfButton -annotation "Metal Shader" -image "indigo_metal.bmp" -command "metal";

 				setParent ..;

rowLayout -numberOfColumns 2 -columnWidth2 170 230;
text -label "Name Of Material Type" -w 170 -align "left";
textField -w 200;
 			                setParent ..;

	colorSliderGrp -h 25 -label "Diffuse" -rgb 0.5 0.5 0.5;

	colorSliderGrp -h 25 -label "Specular" -rgb 0 0 0;

	floatSliderGrp -h 25 -label "Exponent" -field true 
                -fieldMinValue -10000 -fieldMaxValue 10000 
                -minValue 0.001 -maxValue 10000 -value 10000;
	separator -h 10 -w 400;
text -label "" -h 20 -align "left";

optionMenu -label "Add Existing Materials";
		menuItem -label "?????";
text -label "" -align "left";
text -label "Object settings" -w 400 -align "left" -font "boldLabelFont";
	separator -h 10 -w 400;
checkBox -label "Normal Smoothing" -value 1;
 			                setParent ..;
 			setParent ..;

			showWindow;
}

//-----------------ACTIVATE FIELDS------------------

global proc int skylight() 
{ 
int $state = `checkBox -query -value SkylightCheckBox`; 

  if ($state == 0) 
    floatSliderGrp -edit -enable 0 turb; 
  else 
    floatSliderGrp -edit -enable 1 turb; 

  if ($state == 0) 
    floatSliderGrp -edit -enable 0 gain; 
  else 
    floatSliderGrp -edit -enable 1 gain; 
return $state;
} 

global proc string getenv(){
int $state = `checkBox -query -value SkylightCheckBox`;
string $retval;
if ($state == 1){
return "physical";
}
$state = `checkBox -query -value BgCheckBox`;
if ($state == 1){
return "skylight";
}
$state = `checkBox -query -value HDRCheckBox`;
if ($state == 1){
return "hdri";
}
if ($state == 0){
return "null";
}
}

global proc int bglight() 
{ 
int $state = `checkBox -query -value BgCheckBox`; 

  if ($state == 0) 
    floatSliderGrp -edit -enable 0 bgSlider; 
  else 
    floatSliderGrp -edit -enable 1 bgSlider; 
return $state;
} 

global proc int hdrlight() 
{ 
int $state = `checkBox -query -value HDRCheckBox`; 

  if ($state == 0) 
    attrNavigationControlGrp -edit -enable 0 hdrSlider; 
  else 
    attrNavigationControlGrp -edit -enable 1 hdrSlider; 
return $state;
} 

//-----------------CREATE STUFF------------------

proc sun() 
{sphere -r 0.5 -n Sun;} 

proc reclight() 
{ } 

proc indcamera() 
{camera -centerOfInterest 5 -focalLength 35 -lensSqueezeRatio 1 -cameraScale 1 
-horizontalFilmAperture 1.41732 -horizontalFilmOffset 0 -verticalFilmAperture 0.94488 
-verticalFilmOffset 0 -filmFit Fill -overscan 1 -motionBlur 0 -shutterAngle 144 
-nearClipPlane 0.01 -farClipPlane 1000 -orthographic 0 -orthographicWidth 30; 
objectMoveCommand; cameraMakeNode 3 "";} 

//-----------------THE CONTROL PANEL------------------

	window -title "Maya to Indigo XML converter - BETA 0.2" -h 600 -w 400 -menuBar true;

	menu -label "Edit" -tearOff true;

		menuItem -label "Save Settings";
		menuItem -label "Reset Settings";
		menuItem -divider true;
		menuItem -label "Close" -command "closeWindow";

	menu -label "Create" -tearOff true;

	menuItem -label "Lights" -subMenu true;
		menuItem -label "Sky Light" -command "sun";
		menuItem -label "Rectangle Light" -command "reclight";
 				setParent -menu ..;
	menuItem -label "Misc" -subMenu true;
		menuItem -label "Camera" -command "indcamera";

	menu -label "Tools" -tearOff true;

		menuItem -label "Object Editor"  -command "objectEditor";
		menuItem -label "Material Editor"  -command "materialEditor";
	
	menu -label "Help" -helpMenu true;
		menuItem -label "Maya to Indigo Help..." -command "helpWin";
		menuItem -label "Go to MayaToIndigo's homepage";
		menuItem -label "Go to Indigo renderer's homepage.";
		menuItem -divider true;
		menuItem -label "About Maya to Indigo..." -command "abWin";

columnLayout -columnAlign "center";
picture -image "mayatoindigo.bmp" -backgroundColor 1 1 1;

 		tabLayout;
 			shelfLayout Lights;
shelfButton -annotation "Sky Light" -image "indigo_sun.bmp" -command "sun";
shelfButton -annotation "Rectangle Light" -image "commandButton.xpm"  -command "reclight";
 				setParent ..;

 			shelfLayout Misc;
shelfButton -annotation "Camera" -image "indigo_camera.bmp"  -command "indcamera";
 				setParent ..;
 			setParent ..;
text -label "General settings" -w 400 -align "center" -font "boldLabelFont";

//-----------------SETTINGS------------------

frameLayout -collapsable true -label "Render Setting" -w 400;

 			columnLayout -columnAlign "center";
separator -w 400 -h 10;
text -label "Metropolis light transport settings" -w 400 -align "left" -font "boldLabelFont";

				checkBox -label "Metropolis" -value 1 Metrocb;			
				floatSliderGrp -h 25 -label "Large Mutation Prob" -field true -fieldMinValue -10000 -fieldMaxValue 10000 -minValue 0.001 -maxValue 1 -value 0.2 -precision 3 Largecb;
				floatSliderGrp -h 25 -label "Max Change" -field true -fieldMinValue -10000 -fieldMaxValue 10000 -minValue 0.001 -maxValue 0.1 -value 0.025 -precision 3 MaxCh;
separator -w 400 -h 10;
text -label "General tracing parameters" -w 400 -align "left" -font "boldLabelFont";

				floatSliderGrp -h 25 -label "Russian Roulette Live Prob" -field true -fieldMinValue -10000 -fieldMaxValue 10000 -minValue 0.001 -maxValue 1 -value 0.7 -precision 3 rrcb;
				floatSliderGrp -h 25 -label "Max Depth" -field true -fieldMinValue 1 -fieldMaxValue 1000 -minValue 1 -maxValue 1000 -value 1000 -precision 0 MaxDepth;
				checkBox -label "Bidirectional" Bidircb;
separator -w 400 -h 10;
text -label "Network rendering settings" -w 400 -align "left" -font "boldLabelFont";

				floatSliderGrp -h 25 -label "Frame Upload Period" -field true -fieldMinValue 1 -fieldMaxValue 60 -minValue 1 -maxValue 60 -value 20 -precision 0 FUP;
separator -w 400 -h 10;
text -label "Miscellaneous settings" -w 400 -align "left" -font "boldLabelFont";

				floatSliderGrp -h 25 -label "Image Save Period" -field true -fieldMinValue 1 -fieldMaxValue 60 -minValue 1 -maxValue 60 -value 30 -precision 0 ISP;
				floatSliderGrp -h 25 -label "Halt Time" -field true -fieldMinValue -5 -fieldMaxValue 5 -minValue -5 -maxValue 5 -value -1 -precision 0 HT;
optionMenu -label "What is your Up Axis" upAxis;
		menuItem -label "Y";
		menuItem -label "Z";

checkBox -label "Logging"  -value 1 Loggicb;

checkBox -label "Normal Smoothing" -value 1 Normacb;

checkBox -label "Save Tonemapped Exr" SaveTcb;

checkBox -label "Save Untonemapped Exr" SaveUcb;

 			                setParent ..;
 			setParent ..;

frameLayout -collapsable true -label "Tone Mapping- Reinhard" -w 400;

 			columnLayout -columnAlign "center";
		
				floatSliderGrp -h 25 -label "Pre Scale" -field true -fieldMinValue 0 -fieldMaxValue 10 -minValue 0.001 -maxValue 10 -value 2 -precision 3 PreScale;

				floatSliderGrp -h 25 -label "Post Scale" -field true -fieldMinValue 0 -fieldMaxValue 10 -minValue 0.001 -maxValue 10 -value 1 -precision 3 PostScale;

	
 			                setParent ..;
 			setParent ..;

frameLayout -collapsable true -label "Camera Setting" -w 400;

 			columnLayout -columnAlign "center";
			
				floatSliderGrp -h 25 -label "F/stop" -field true -fieldMinValue 1 -fieldMaxValue 32 -minValue 1 -maxValue 32 -value 8 -precision 1 FStop;
					separator -w 400 -h 12;

optionMenu -label "White Balance" Whitecb;
		menuItem -label "E";
		menuItem -label "D50";
		menuItem -label "D55";
		menuItem -label "D60";
		menuItem -label "D65";
		menuItem -label "D75";
		menuItem -label "A";
		menuItem -label "B";
		menuItem -label "C";
		menuItem -label "9300";
		menuItem -label "F2";
		menuItem -label "F7";
		menuItem -label "F11";

 			                setParent ..;
 			setParent ..;

frameLayout -collapsable true -label "Environment Setting" -w 400;

 			columnLayout -columnAlign "center";

				checkBox -label "Sky Light" -align "center"  -value 0 -changeCommand "skylight" SkylightCheckBox;
floatSliderGrp -h 25 -label "Turbidity" -field true -fieldMinValue -10000 -fieldMaxValue 10000 -minValue 0.1 -maxValue 5 -value 2 -precision 3 -enable 0  turb;
floatSliderGrp -h 25 -label "Sky Gain" -field true -fieldMinValue -0.0001 -fieldMaxValue 2 -minValue 0.0001 -maxValue 1 -value 0.05 -precision 4 -enable 0  gain;
	separator -w 400 -h 12;
				checkBox -label "Background Light" -align "center" -changeCommand "bglight" BgCheckBox;
	colorSliderGrp -h 25 -label "Background Light Color" -rgb 0.5 0.5 0.5 -enable 0 bgSlider;
	separator -w 400 -h 12;
				checkBox -label "HDR map" -align "center" -changeCommand "hdrlight" HDRCheckBox;
		attrNavigationControlGrp -l "HDR file" -enable 0 hdrSlider;

 			                setParent ..;
 			setParent ..;

button -w 400 -h 30 -label "Generate XML code" -align "center"  -command "indigoOutput";
			showWindow;

//-----------------TIEING SCRIPTS------------------

//--SliderGrps--

global proc string getLarge(){
float $larg = `floatSliderGrp -query -value Largecb`;
	return $larg;
}
global proc float getFStop(){
float $larg = `floatSliderGrp -query -value FStop`;
	return $larg;
}
global proc string getPreScale(){
float $larg = `floatSliderGrp -query -value PreScale`;
	return $larg;
}
global proc string getPostScale(){
float $larg = `floatSliderGrp -query -value PostScale`;
	return $larg;
}
global proc string getMch(){
float $mch = `floatSliderGrp -query -value MaxCh`;
	return $mch;
}
global proc string getRrlp(){
float $rrlp = `floatSliderGrp -query -value rrcb`;
	return $rrlp;
}
global proc string getMd(){
float $mch = `floatSliderGrp -query -value MaxDepth`;
	return $mch;
}
global proc string getTurb(){
 float $xyz = `floatSliderGrp -query -value turb`;
return $xyz;
}
global proc string getSGain(){
 float $zyx = `floatSliderGrp -query -value gain`;
return $zyx;
}
global proc string getfup(){
float $mch = `floatSliderGrp -query -value FUP`;
	return $mch;
}
global proc string getisp(){
float $mch = `floatSliderGrp -query -value ISP`;
	return $mch;
}
global proc string getht(){
float $mch = `floatSliderGrp -query -value HT`;
	return $mch;
}
//--CheckBoxes--

global proc string getMetro(){
int $metr = `checkBox -query -value Metrocb`;
if ($metr == 0)
return "false";
if ($metr == 1)
	return "true";
}

global proc string getBidir(){
int $bidi = `checkBox -query -value Bidircb`;
if ($bidi == 0)
return "false";
if ($bidi == 1)
	return "true";
}

global proc string getLoggi(){
int $logg = `checkBox -query -value Loggicb`;
if ($logg == 0)
return "false";
if ($logg == 1)
	return "true";
}


global proc string getNorma(){
int $norm = `checkBox -query -value Normacb`;
if ($norm == 0)
return "false";
if ($norm == 1)
	return "true";
}

global proc string getSaveT(){
int $savt = `checkBox -query -value SaveTcb`;
if ($savt == 0)
return "false";
if ($savt == 1)
	return "true";
}

global proc string getSaveU(){
int $savu = `checkBox -query -value SaveUcb`;
if ($savu == 0)
return "false";
if ($savu == 1)
	return "true";
}

//--OptionMenus--

global proc string getWB(){
return `optionMenu -query -value Whitecb`;
}

global proc string getupAxis(){
return `optionMenu -query -value upAxis`;
}
//-----------------THE XML CONVERTER------------------

global proc int indigoOutput(){	

string $metr = getMetro();
string $large = getLarge();
string $bidi = getBidir();
string $logg = getLoggi();
string $norm = getNorma();
string $savt = getSaveT();
string $savu = getSaveU();
string $mch = getMch();
string $rrlp = getRrlp();
string $md = getMd();
string $fup = getfup();
string $isp = getisp();
string $ht = getht();
string $PreScale = getPreScale();
string $PostScale = getPostScale();
float $FStop = getFStop();
string $WB = getWB();
string $upAxis = getupAxis();
string $write = "<?xml version='1.0' standalone=no>\n";

$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>"+$metr+"</metropolis>\n";
$write += "\t<large_mutation_prob>0.200</large_mutation_prob>\n";
$write += "\t<max_change>"+$mch+"</max_change>\n";
$write += "\t<russian_roulette_live_prob>"+$rrlp+"</russian_roulette_live_prob>\n";
$write += "\t<max_depth>"+$md+"</max_depth>\n";
$write += "\t<bidirectional>"+$bidi+"</bidirectional>\n";
$write += "\t<strata_width>10</strata_width>\n";
$write += "\t<frame_upload_period>"+$fup+"</frame_upload_period>\n";
$write += "\t<halt_time>"+$ht+"</halt_time>\n";
$write += "\t<logging>"+$logg+"</logging>\n";
$write += "\t<image_save_period>"+$isp+"</image_save_period>\n";
$write += "\t<save_tonemapped_exr>"+$savt+"</save_tonemapped_exr>\n";
$write += "\t<save_untonemapped_exr>"+$savu+"</save_untonemapped_exr>\n";
$write += "</renderer_settings>\n\n";
$write += "\t<tonemapping>\n";
$write += "\t\t<reinhard>\n";
$write += "\t\t\t<pre_scale>"+$PreScale+"</pre_scale>\n";
$write += "\t\t\t<post_scale>"+$PostScale+"</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 (getenv() == "skylight"){
float $col[3] = `colorSliderGrp -query -rgbValue bgSlider`;
$write += "<background>\n\t<spectrum>\n\t\t<rgb>\n\t\t\t<rgb>"+$col[0]+" "+$col[1]+" "+$col[2]+"</rgb>\n\t\t</rgb>\n\t</spectrum>\n</background>\n\n";
}
if (getenv() == "physical"){
float $x = `getAttr Sun.tx`;
float $y = `getAttr Sun.ty`;
float $z = `getAttr Sun.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>"+getTurb()+"</turbidity>\n\t<sky_gain>"+getSGain()+"</sky_gain>\n</skylight>\n";
}
print("\nenvset1-" +getenv()+"\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 = $FStop;
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>"+$WB+"</white_balance>\n";
$write += "</camera>\n\n";

string $mats[] = `ls -mat`;
for ($one in $mats){
float $inc[]=`getAttr ($one + ".incandescence")`;
		if ($inc[0]+$inc[1]+$inc[2] == 0.0){
	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\t<fresnel_scale>0.5</fresnel_scale>\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>"+$norm+"</normal_smoothing>";
			if ($upAxis == "Z"){
				$write += "\n\t<rotation><matrix>1 0 0 0 1 0 0 0 1</matrix></rotation>";
			}
			if ($upAxis == "Y"){
				$write += "\n\t<rotation><matrix>1 0 0 0 0 1 0 -1 0</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";
			if ($upAxis == "Z"){
				$write += "\n\t<rotation><matrix>1 0 0 0 1 0 0 0 1</matrix></rotation>";
			}
			if ($upAxis == "Y"){
				$write += "\n\t<rotation><matrix>1 0 0 0 0 1 0 -1 0</matrix></rotation>";
			}
			$write += "\t<mesh_name>"+$one+"</mesh_name>\n";
			$write += "\t<spectrum>\n";
			float $bbody2 = $inc[0]+$inc[1]+$inc[2];
			int $bbody = $bbody2 * 3000;
			$write += "\t<blackbody>\n";
			$write += "\t\t<temperature>"+$bbody+"</temperature>\n";
			$write += "\t\t<gain>1e-005</gain>\n";
			$write += "\t</blackbody>\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 492 -h 566 -editable false -tx $write;
showWindow indOut;
return 1;
}
[/code]
Matt B. >>Maya To Indigo<<
Image

User avatar
arneoog
Indigo 100
Posts: 504
Joined: Sun Jun 25, 2006 2:19 am
Location: Norway
Contact:

Maya To Indigo XML Converter BETA 0.3 for Indigo 0.6.1

Post by arneoog » Mon Aug 07, 2006 12:39 am

Desided to release BETA 0.3 for Indigo 0.6.1 now :)
maya_to_indigo_xml_converter_beta0.3.zip

Change Log
New Functions:
- Created a Icon Tool Bar
- Put all the General Settings inside a ScrollLayout
- Lot of new Icons
- Added a Progress Bar when you Generate the XML code

Not Working Functions:
- Object Editor
- Material Editor
- System Configurations
- Render Scene from Maya
- Rectangle Light
- UpAxis Changer (Please set to Z no matter what)
- HDR map option
- The Edit Menu


HelpFile
Arne OOG - My Portfolio

User avatar
psor
1st Place Winner
Posts: 1295
Joined: Sun Jun 25, 2006 1:25 am
Location: Berlin
Contact:

Post by psor » Mon Aug 07, 2006 12:50 am

:shock: ... arneoog, thanx a lot mate.

I'm not a Maya user but a friend of mine is and he will be very
happy about the release ... hehe. Now another friend needs his
XSI plugin ... :D :D :D ;)


take care
psor

User avatar
arneoog
Indigo 100
Posts: 504
Joined: Sun Jun 25, 2006 2:19 am
Location: Norway
Contact:

Post by arneoog » Mon Aug 07, 2006 1:07 am

Cool :D
Thanks to Matt B (ThatDude33) too, he is creating the Converter Engine ++ :D
There's not many Maya users here though... :?
Image
Arne OOG - My Portfolio

User avatar
OnoSendai
Developer
Posts: 6180
Joined: Sat May 20, 2006 6:16 pm
Location: Newcastle upon Tyne, UK
Contact:

Post by OnoSendai » Mon Aug 07, 2006 1:51 am

Thx Arneoog!

User avatar
ThatDude33
Posts: 216
Joined: Wed Jul 05, 2006 1:26 pm
Contact:

Post by ThatDude33 » Mon Aug 07, 2006 1:02 pm

I don't get any credit anymore :? I did a bunch (most) of the UI tying into the actual script and the converter engine itself, plz, I'm sorry arne for blocking ur spotlight, but this isn't fair :(

but HOLY CRAP~! This new release is GREAT :shock:

I will add the upvector specs for the camera tomorrow, and I also will try to get this baby to export some little .txt's :)

also- it will need to export a new INI file, which I can do easily, just overrite the old one, with new specs ;)

Shall be done tomorrow, then :)
Last edited by ThatDude33 on Mon Aug 07, 2006 11:23 pm, edited 1 time in total.
Matt B. >>Maya To Indigo<<
Image

User avatar
psor
1st Place Winner
Posts: 1295
Joined: Sun Jun 25, 2006 1:25 am
Location: Berlin
Contact:

Post by psor » Mon Aug 07, 2006 1:44 pm

Heya ThatDude33!

Sorry, shame on me ... :oops: :twisted: :shock: 8) :lol: :cry: :wink:

Thanx for your hard work too! :D :D :D :D ;)


take care
psor

User avatar
ThatDude33
Posts: 216
Joined: Wed Jul 05, 2006 1:26 pm
Contact:

Post by ThatDude33 » Tue Aug 08, 2006 10:33 am

UPVECTOR FOR CAMERAS- WORKS :) :) :)


edit- since this script is so damn long, I will wait for arne to host it :P

Anyway I am reading up on how to export .txt's directly from Maya :)
Matt B. >>Maya To Indigo<<
Image

User avatar
arneoog
Indigo 100
Posts: 504
Joined: Sun Jun 25, 2006 2:19 am
Location: Norway
Contact:

Maya To Indigo XML Converter BETA 0.4 for Indigo 0.6.1

Post by arneoog » Mon Aug 14, 2006 1:24 am

Done some work to make it much more user friendly :D
maya_to_indigo_xml_converter_beta0.4.zip


Change Log
New Functions:
- Made it more user friendly
- Fixed stupid green spot on the Icons
- HDR map option is kinda working (works if you corrects the file path so that Indigo can understand it)

Not Working Functions:
- Object Editor
- Material Editor
- System Configurations
- Render Scene from Maya
- Rectangle Light
- UpAxis Changer (Please set to Z no matter what)
- The Edit Menu


HelpFile

PS: Matt (ThatDude), Hoping for more greate stuff from you soon :D :wink:
Arne OOG - My Portfolio

User avatar
ThatDude33
Posts: 216
Joined: Wed Jul 05, 2006 1:26 pm
Contact:

Post by ThatDude33 » Mon Aug 14, 2006 2:04 am

oh yeah. Coding in speculars now, they will be blinns.

Also- I am making the HDR function work, actually using the file used as the HDR. I think though, for it to work you have to place the HDRI into the indigo folder, because Indigo reads stuff in accordance to where it is placed.

:)

I will post it when I finish it :)
Matt B. >>Maya To Indigo<<
Image

User avatar
arneoog
Indigo 100
Posts: 504
Joined: Sun Jun 25, 2006 2:19 am
Location: Norway
Contact:

Post by arneoog » Mon Aug 14, 2006 2:14 am

Cool! :D
Yeah I know, Now it sets the whole path C:/blah blah
And not the shorter Indigo needs ex: textures/hdr.exr
Will be great with Specular support :D

Does the new release work with you? 8)
Arne OOG - My Portfolio

Post Reply
28 posts

Who is online

Users browsing this forum: No registered users and 1 guest