Beer glass scene creation
This course contains a little bit of everything with modeling, UVing, texturing and dynamics in Maya, as well as compositing multilayered EXR's in Photoshop.
# 121 29-07-2006 , 07:58 PM
arneoog's Avatar
Registered User
Join Date: Mar 2006
Posts: 189
ehrm... user added image
heh... I don't know... ...do what you think is best user added image

could you explain it futher? :blush:

# 122 29-07-2006 , 09:47 PM
MattTheMan's Avatar
Registered User
Join Date: Apr 2005
Location: Fairfield, CT
Posts: 2,436
ok, so like I have a bunch of models, each individual polygon shapes. do you want me to return you a variable

string $meshes[number of meshes]

for your list on the left? and a few other arrays for the different settings?

You tell me how you want this part done user added image


Live the life you love, love the life you live
# 123 29-07-2006 , 10:23 PM
arneoog's Avatar
Registered User
Join Date: Mar 2006
Posts: 189
Ah...

Yes, I want the list to have the names of all the poly objects in the scene.
And if you click on one of them you get to control the settings for that object.

And if you creates a Diffuse Material Maya can create and assign a Lambert to the object you got selected.
Phong -> Phong
Specular -> Blinn
ect...
The sliders and color pickers in the Object Editor then remotly controlls the attributes on the Maya Materials.

<Phong>
<diffuse>SLIDER</diffuse>

Controlls the Color attr. in the Phong Material.


Hope this sounds possible to do user added image
And I hope you understood it :p

user added image

# 124 29-07-2006 , 11:02 PM
MattTheMan's Avatar
Registered User
Join Date: Apr 2005
Location: Fairfield, CT
Posts: 2,436
yeah, well I was thinking custom materials that don't show up in the material editor. I mean just in the indigo material editor thing. I guess they COULD be stored as other materials as a backup (so if you close the window or Maya you can keep going)

This is my explanation- i drew it quick

Attached Thumbnails

Live the life you love, love the life you live
# 125 29-07-2006 , 11:09 PM
arneoog's Avatar
Registered User
Join Date: Mar 2006
Posts: 189
Yepp, sounds great! user added image

But I'm going to bed (01:10 in the morning here user added image)
I will try to come up with some more features for this thing while I try to sleep user added image

I'm going to help you tomorrow, if it's needed user added image
And make more GUI! user added image

:zzz:

# 126 29-07-2006 , 11:22 PM
MattTheMan's Avatar
Registered User
Join Date: Apr 2005
Location: Fairfield, CT
Posts: 2,436
good night then user added image I'm going to quickly code in support for speculars.


Live the life you love, love the life you live
# 127 30-07-2006 , 05:22 PM
MattTheMan's Avatar
Registered User
Join Date: Apr 2005
Location: Fairfield, CT
Posts: 2,436
well... didn't get any speculars... but I did tie in the whole main UI thing. That's right- everything on the main UI (all settings, except for HDRI) work user added image

Code:
//-----------------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";
		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`;
}
//-----------------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 $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 $aria-label="User link" rel="noopener noreferrer nofollow" class="giveMeEllipsisa" 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>";
		$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 $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;
}


Live the life you love, love the life you live
# 128 30-07-2006 , 06:33 PM
arneoog's Avatar
Registered User
Join Date: Mar 2006
Posts: 189
Awasome! user added image
I added the things I've been scripting today too user added image
When you now click on the Browse button at the left og the HDR thingy
you get the File Browser up user added image
Haven't managed to make it work though... user added image

Also started on a System Config panel where you have to select some Indigo Folders...
This I hope will be stored in a txt file or something when this thing is done user added image
(For textures, hdri and automatic xml save)

Attached Files
File Type: txt maya to indigo xml converter.txt (24.0 KB, 384 views)
# 129 30-07-2006 , 07:02 PM
MattTheMan's Avatar
Registered User
Join Date: Apr 2005
Location: Fairfield, CT
Posts: 2,436
hmm... so is this added on to what I wrote????


Live the life you love, love the life you live
# 130 30-07-2006 , 07:25 PM
arneoog's Avatar
Registered User
Join Date: Mar 2006
Posts: 189
yepp

Edit:
Found this script:
Code:
      upAxis -q -axis;
Make the Y Z thing work user added image


Last edited by arneoog; 30-07-2006 at 07:43 PM.
# 131 30-07-2006 , 08:08 PM
MattTheMan's Avatar
Registered User
Join Date: Apr 2005
Location: Fairfield, CT
Posts: 2,436
no, what ima do is rotate everything -90 degrees on X (using the <matrix></matrix> xml keys> . Cuz what you posted changes the up axis, not the actual orientation of the models.

umm.. like the models change the same, just the up axis changes. user added image

oh well, I know what to do now anyway user added image


Live the life you love, love the life you live
# 132 30-07-2006 , 09:23 PM
MattTheMan's Avatar
Registered User
Join Date: Apr 2005
Location: Fairfield, CT
Posts: 2,436
added the much wanted UP AXIS SELECITION user added image :attn: user added image

and- here's the deal- IT ACTUALLY WORKS user added image :attn: user added image

Attached Files

Live the life you love, love the life you live
# 133 30-07-2006 , 10:45 PM
arneoog's Avatar
Registered User
Join Date: Mar 2006
Posts: 189
user added image :attn: user added image

Got to ask, does this work for the camera as well?
Haven't tested it yet... user added image

I will be making a new zip file tomorrow and name it
Maya To Indigo XML Converter v.0.6 BETA 3

Of course, only if it's okay for you user added image
user added image

# 134 30-07-2006 , 10:52 PM
MattTheMan's Avatar
Registered User
Join Date: Apr 2005
Location: Fairfield, CT
Posts: 2,436
oh, crap, no, doesn't work for camera yet user added image

and of course the file stuff is ok

oh, and arne- im not at me comp now, could you do a rotate command on the camera? center the pivot at (0,0,0) for all 3 camera elements (thru mel) and rotate all the camera elements 90 degrees around X? if the variable $upAxis == "Y"

thanks,
Matt user added image


Live the life you love, love the life you live
# 135 30-07-2006 , 10:57 PM
arneoog's Avatar
Registered User
Join Date: Mar 2006
Posts: 189
Okay

I'm not at my computer either... heh
I'm in the kitchen eating some leftover Taco user added image (the time is 00:59 am)

I will try and do that as soon as I get to my computer tomorrow :nod:

user added image

Posting Rules Forum Rules
You may not post new threads | You may not post replies | You may not post attachments | You may not edit your posts | BB code is On | Smilies are On | [IMG] code is On | HTML code is Off

Similar Threads