string $material,$mat_name,$mat_list[],$mat_tip[]; int $mat_total=0; int $prew_icon_size=100; global string $out_file_tip="BMP"; global string $image_path="",$mayaray_path="d:\\mayaray\\"; int $single_frame = 1; float $startTime; global int $batch=0; global string $currentProject =""; global string $PovExe ="pvengine"; global int $render_time,$windowclosed=0; global int $prew_icon_size=120,$hf_gray_16=0,$max_intersections=64; global float $rad_brightness=3.3, $rad_count=100, $rad_dist_max=0,$rad_error_bound=.4,$rad_gray_tresh=0.5; global float $rad_low_error=0.8, $rad_min_reuse=0.015, $rad_neares_count=6, $rad_recursion_limit=1; global float $antialias_treshold=0.1,$jitter_amount=0.0,$antialias_depth=1,$quality=9; global string $antialias="on", $radiosity="on",$jitter="on",$photons="off"; global string $out_file_tip,$camera="persp"; global int $single_frame=1,$antialiasMethod=2; global float $adc_bailout=0.003922,$assumed_gamma=1.9,$AmbientR=1,$AmbientG=1,$AmbientB=1; global float $irid1=0.247059,$irid2=0.176471,$irid3=0.137255; global int $number_of_waves=10,$max_trace_level=10,$sky_sphere=0,$fog=0; global float $photon_spacing=0.02,$photon_count=0; //global int $select_job_num,$scene_opened_job_num,$scene_saved_job_num; global string $ImageFormatData[] = { // name width height aspect ratio // ----------------------------------------------- "320x240 320 240 1.333", "640x480 640 480 1.333", "1k_Square 1024 1024 1.000", "2k_Square 2048 2048 1.000", "3k_Square 3072 3072 1.000", "4k_Square 4096 4096 1.000", "CCIR_PAL/Quantel_PAL 720 576 1.333", "CCIR_601/Quantel_NTSC 720 486 1.333", "Full_1024 1024 768 1.333", "Full_1280/Screen 1280 1024 1.333", "HD_720 1280 720 1.777", "HD_1080 1920 1080 1.777", "NTSC_4d 646 485 1.333", "PAL_768 768 576 1.333", "PAL_780 780 576 1.333", "Targa_486_(tga) 512 486 1.333", "Targa_NTSC_(tga) 512 482 1.333", "Targa_PAL_(tga) 512 576 1.333" }; global proc kill_all_jobs() { global int $select_job_num,$scene_opened_job_num,$scene_saved_job_num; //save_globalsettings_todummy(); } ///////////////////////////////////////////////////// global proc int get_selected_material_no() { global int $mat_total; global string $material,$mat_name,$mat_list[],$mat_tip[]; int $mat_no=-1,$i; $num = `textScrollList -q -nsi MaterialListBox`; if($num!=1) return -1; string $sel[] = `textScrollList -q -si MaterialListBox`; for($i=0; $i<$mat_total; $i++) { if($mat_list[$i]==$sel[0]) { //$mat_prew_name = $mat_list[$i]; //$mat_prew_tip = $mat_tip[$i]; $mat_no = $i; } } return $mat_no; } ///******************************************** //// MALZEMELISTESINDE SEÇİLEN MALZEMENIN SAMPLE ICONU RENDER EDILMIŞSE OTOMATIK YUKLE global proc Mat_ListBox_selected() { global string $material,$mat_name,$mat_list[],$mat_tip[],$mayaray_path; $i = get_selected_material_no(); if($i==-1) return; $mat_prew_name = $mat_list[$i]; $mat_prew_tip = $mat_tip[$i]; string $image_prev_icon = $mayaray_path+"previews\\"+$mat_prew_name+".tga"; $ret2 = `filetest -w $image_prev_icon`; if($ret2) image -edit -image $image_prev_icon PreviewImage; else image -edit -image "" PreviewImage; } ///******************************************** global proc make_prew_scene() { global int $prew_icon_size=120; int $fileID; string $tirnak = "\""; string $mat_prew_name="",$mat_prew_tip; global int $mat_total=0; global string $material,$mat_name,$mat_list[],$mat_tip[]; global string $out_file_tip; global string $PovExe,$mayaray_path ; $i = get_selected_material_no(); if($i==-1) return; $mat_prew_name = $mat_list[$i]; $mat_prew_tip = $mat_tip[$i]; $image_prev_icon = $mayaray_path+"previews\\"+$mat_prew_name+".tga"; int $fileID = fopen( $mayaray_path+"temp\\"+"preview.pov", "w" ); fprint ($fileID,"#include "+$tirnak+$mayaray_path+"includes\\material_maya.inc "+$tirnak+"\n"); fprint ($fileID,"camera {\n location <0, 0, -5>\n direction <0, 0, 1.0>\n look_at <0, 0, 0>\n}\n"); fprint ($fileID,"sphere { <0.0, 0.0, 0.0>, 2\n "); fprint ($fileID,$mat_prew_tip+" { " + $mat_prew_name + " } \n } \n"); //finish {\n ambient 0.2\n diffuse 0.8\ phong 1\n"); //fprint ($fileID," }\n pigment { color red 1 green 0 blue 0 }\n}\n"); fprint ($fileID," plane { <0, 1, 0>, -2\n pigment {\n checker color <0, 0, 0>, color <1, 1, 1>\n } \n }\n"); fprint ($fileID,"plane { <0, 0, 1>, 4\n pigment {\n checker color <0, 0, 0>, color <1, 1, 1>\n } \n \n}"); fprint ($fileID,"light_source { <-22, 16, -12> color red 1 green 1 blue 1 }\n"); fclose($fileID); int $fileID = fopen( $mayaray_path+"temp\\preview.ini", "w" ); //fprint ($fileID,"All_Console=Off \nAll_File= \nBounding=On \nBounding_Threshold=3 \nBuffer_Output=Off"); //fprint ($fileID,"\nBuffer_Size=0 \nClock=0 \nCreate_Ini=rerun.ini \nCyclic_Animation=Off \nDebug_Console=On"); //print ($fileID,"\nDebug_File= \nDisplay_Gamma=2.2 \nDraw_Vistas=Off \nFatal_Console=On \nFatal_Error_Command="); //fprint ($fileID,"\nFatal_Error_Return= I \nFatal_File= \nField_Render=Off \n"); //Output_Alpha=On "); fprint ($fileID,"\nOutput_File_Name="); fprint ($fileID,$image_prev_icon+"\n"+"Output_to_File=On \nOutput_File_Type=T "); fprint ($fileID,"\nFinal_Clock=1 \nFinal_Frame=-1 \nHistogram_Name= \Histogram_Grid_Size=0.0 \nHistogram_Type=X ; NONE"); fprint ($fileID,"\nInitial_Clock=0 \nInitial_Frame=1 "); fprint ($fileID,"\nLibrary_Path= \nLight_Buffer=On \nOdd_Field=Off \Palette=3 \Post_Frame_Command= "); fprint ($fileID,"\nPost_Frame_Return= I \nPost_Scene_Command= \nPost_Scene_Return= I \nPreview_End_Size=1"); fprint ($fileID,"\nPreview_Start_Size=1 \nPre_Frame_Command= \nPre_Frame_Return= I \nPre_Scene_command="); fprint ($fileID,"\nPre_Scene_Return= I \nQuality=9 \nRemove_Bounds=On \nRender_Console=On"); fprint ($fileID,"\nRender_File= \nSampling_Method=1 \nSplit_Unions=Off"); //fprint ($fileID,"\nStatistic_Console=On \Statistic_File= \nSubset_End_Frame=-1 \nSubset_Start_Frame=-1 \nTest_Abort_Count=15"); //fprint ($fileID,"\nUser_Abort_Command= \nUser_Abort_Return= I \nVersion=3.1 \nVideo_Mode=0"); fprint ($fileID,"\nVista_Buffer=On \nWarning_Console=On \nWarning_File= \nBits_Per_Color=16"); fprint ($fileID,"\nWidth = "+$prew_icon_size); fprint ($fileID,"\nHeight = "+$prew_icon_size/1.25); //fprint ($fileID,"\nAntialias = 1 \nAntialias_Threshold = 0.3 \nJitter=On \nJitter_Amount = 1"); //fprint ($fileID,"\nAntialias_Depth = 2 \nSampling_Method = 2 \nPause_When_Done = Off"); fprint ($fileID,"\nDisplay = On \nVerbose = Off \nContinue_Trace = o"); fprint ($fileID,"\nTest_Abort = On \nInput_File_Name = "+$mayaray_path+"temp\\preview.pov"); fprint ($fileID,"\nOutput_File_Type = T \nPreview_Start_Size=1 \nPreview_End_Size=1 \n"); fclose($fileID); $RenderOption = ""; $RenderOption += " +H"+$prew_icon_size; $RenderOption += " +W"+$prew_icon_size; $RenderOption += " +o"+$image_prev_icon; system("del "+$image_prev_icon); string $cmd = $PovExe+" /render /rerun /exit "+$RenderOption+" +I"+$mayaray_path+"temp\\"+"preview.pov"; system($cmd); image -edit -image $image_prev_icon PreviewImage; } ///******************************************************************************** //// ANA WINDOW //// global proc POVmaterialchoser() { string $tirnak = "\""; global string $material,$mat_name,$mat_list[],$mat_tip[]; int $declare=0, $i; global int $mat_total=0; string $style1="textOnly"; string $style2="iconAndTextHorizontal"; int $height=30; global int $mat_total; global string $currentProject,$image_path,$mayaray_path; global int $render_time; $currentProject = `workspace -q -rd`; $image_path=$currentProject+"images/"; $image_path = fromNativePath( $image_path ); /////////////// //////////////// //int $a = `scriptJob -ro 1 -e "flushingScene" "scene_save()"`; $render_time=0; $mat_total=0; if(eval("window -q -ex PovRenderWindow")) { showWindow PovRenderWindow; return; } int $fileID = fopen( $mayaray_path+"includes\\"+"material_maya.inc", "r" ); while ( !`feof $fileID` ) { $s = `fgetword $fileID`; if($s=="#declare") { $declare=1; $mat_name = `fgetword $fileID`; //print($mat_name+" "); $mat_list[$mat_total]=$mat_name; } if($s=="{" || $s=="}") $declare=0; if(($s=="material" || $s=="texture" || $s=="finish" || $s=="pigment" || $s=="interior") && $declare>0) { $mat_tip[$mat_total++] = $s; // print($s+"\n "); $declare=0; } } window2(); setParent MaterialEditor; for($i=1;$i<$mat_total; $i++) { $command="material_ata("+$tirnak+$mat_list[$i]+$tirnak+", "+$tirnak+$mat_tip[$i]+$tirnak+")"; $pic=$mat_list[$i]+".bmp"; $nn = $mat_list[$i];//+$mat_tip[$i]; textScrollList -edit -append $nn MaterialListBox; } fclose($fileID); source "povrender.mel"; set_globalSettings_toUI(); getObject_InfoActivite(); /// selection changing durumlarında çalışacak back processi aktifleştirir $scene_opened_job_num = `scriptJob -p "PovRenderWindow" -e "SceneOpened" "scene_load()"`; //$scene_saved_job_num = `scriptJob -p "PovRenderWindow" -ro 1 -e "ToolChanged" "scene_save()"`; int $a = `scriptJob -p "PovRenderWindow" -uid "PovRenderWindow" "kill_all_jobs()"`; } /////************************************************************************************ global proc InfoYaz() { global float $startTime; // code that is being timed float $totalTime = `timerX -startTime $startTime`; if($totalTime>1) { $startTime = `timerX`; print ("Total Time: "+$totalTime+"\n"); } } ////********************************************************************************* global proc resOptionchanged() { $sel = `optionMenu -q -sl ResolutionPresetsMenu`; } //////****************************************************************************** /////////// WINDOW INTERFACE HAZIRLA ///////////////// global proc window2() { global int $prew_icon_size,$hf_gray_16,$max_intersections; global float $rad_brightness, $rad_count, $rad_dist_max,$rad_error_bound,$rad_gray_tresh; global float $rad_low_error, $rad_min_reuse, $rad_neares_count, $rad_recursion_limit; global float $antialias_treshold,$jitter_amount,$antialias_depth,$quality; global string $antialias, $radiosity,$jitter,$photons; global string $out_file_tip,$camera; global int $single_frame,$antialiasMethod; global string $ImageFormatData[],$PovExe; global float $adc_bailout,$assumed_gamma,$AmbientR,$AmbientG,$AmbientB; global float $irid1,$irid2,$irid3,$turb_depth; global int $number_of_waves,$max_trace_level,$sky_sphere,$fog; string $tirnak = "\""; global float $turb_depth,$omega,$lambda,$octaves,$fog_offset,$fog_alt,$Fog_Up; global float $fade_distance,$fade_power,$ior,$dispersion,$dispersion_samples,$interior; global float $skycolor1R, $skycolor1G, $skycolor1B,$skycolor2R, $skycolor2G, $skycolor2B; global int $sky_sphere,$fog; global float $photon_spacing,$photon_count; string $window = `window -titleBar true -w 200 -h 500 -sizeable true -menuBar true PovRenderWindow`; string $form = `formLayout`; string $tabs = `tabLayout -innerMarginWidth 5 -innerMarginHeight 5`; formLayout -edit -attachForm $tabs "top" 1 -attachForm $tabs "left" 0 -attachForm $tabs "bottom" 0 -attachForm $tabs "right" 0 $form; //string $RenderTab = `frameLayout -l "Render Options" -lv true optionsLayout`; //frameLayout -label "Render" -labelAlign "top" Render; scrollLayout -horizontalScrollBarThickness 16 -verticalScrollBarThickness 16 Render; columnLayout RGColLayout; frameLayout -label "Image Settings" -labelAlign "bottom" -cll true -w 500 -mh 5 -borderStyle "etchedIn" option1; columnLayout; rowLayout; setParent ..; rowColumnLayout -numberOfRows 1 asdas; button -w 100 -c ("PovRender \"\"") -l "Render Scene"; button -w 100 -c ("PovRenderSelected") -l "Render Selected"; button -w 100 -c ("PovBatchRender") -l "Render Sequence"; checkBox -label "RenderBack" -v false RenderBackCheck; setParent ..; // radioButtonGrp -numberOfRadioButtons 2 -l "Render To" -labelArray2 "Single" "Sequence" -cc "SingleFramAnimButtonClk" -sl $single_frame SingleFramAnimButton; textFieldGrp -cc "cc()" -label "File name" -w 200 -text "Test" file_name; textFieldGrp -cc "cc()" -label "Camera" -w 200 -text "persp" camera_name; optionMenu -cc "resOptionchanged" -label "Resolution Presets" ResolutionPresetsMenu; for($i = 0; $i | turb_depth Turb_Depth | omega Omega | lambda Lambda | octaves Octaves | fog_offset Fog_Offset | fog_alt Fog_Alt | up | TRANSFORMATION*/ /////////////////////////////////////////////////// setParent RGColLayout; frameLayout -label "Global Settings" -labelAlign "bottom" -cl true -cll true -w 500 -mh 5 -borderStyle "etchedIn" GlobSetting; columnLayout; rowLayout; setParent ..; ///////////////// GLOBAL SETTING KONTROLLERI ///////////////////// floatSliderGrp -label "adc_bailout" -cc "cc()" -field true -v $adc_bailout -pre 4 -min 0 -max 1 adc_bailout; floatSliderGrp -label "Assumed Gamma" -cc "cc()" -field true -v $assumed_gamma -pre 2 -min 0 -max 9 AssumedGamma; checkBox -label "hf_gray_16" -cc "cc()" -v $hf_gray_16 hf_gray_16; floatSliderGrp -label "max_intersections" -cc "cc()" -field true -v $max_intersections -pre 0 -min 0 -max 512 max_intersections; floatFieldGrp -numberOfFields 3 -label "irid wavelength" -cc "cc()" -pre 3 -value1 $irid1 -value2 $irid2 -value3 $irid3 irid_wavelength; floatSliderGrp -label "number_of_waves" -field true -cc "cc()" -v $number_of_waves -pre 0 -min 1 -max 32 number_of_waves; floatSliderGrp -label "max_trace_level" -field true -cc "cc()" -v $max_trace_level -pre 0 -min 1 -max 32 max_trace_level; //////////////////////////////////////////////////////////////// // rowColumnLayout -numberOfRows 1; setParent RGColLayout; frameLayout -label "Antialias Setting" -labelAlign "bottom" -cl true -cll true -w 500 -mh 5 -borderStyle "etchedIn" dasdoption; columnLayout; rowLayout; setParent ..; rowColumnLayout -numberOfRows 1; ///////// ANTIALIAS AYARLARI checkBox -label "Antialiasing" -cc "cc()" -v true Antialias ; optionMenu -label "Method" -cc "cc()" AntialiasMethod; menuItem -label "non-recursive"; menuItem -label "recursive super-sampling"; optionMenu -edit -sl $antialiasMethod AntialiasMethod; setParent ..; floatSliderGrp -label "Depth" -cc "cc()" -field true -v $antialias_depth -pre 0 -min 1 -max 9 AntialiasDepth; floatSliderGrp -label "Threshold" -cc "cc()" -field true -v $antialias_treshold -min 0 -max 1 Threshold; floatSliderGrp -label "Jitter" -cc "cc()" -field true -v $jitter_amount -min 0 -max 1 JitterAmount; floatSliderGrp -label "Quality" -cc "cc()" -field true -v $quality -pre 0 -min 1 -max 11 Quality; /////////////////////////////////////////// setParent RGColLayout; frameLayout -label "Animation Setting" -labelAlign "bottom" -cl true -cll true -w 500 -mh 5 -borderStyle "etchedIn" Animoption; columnLayout; rowLayout; setParent ..; intFieldGrp -label "start" -cc "cc()" -value1 0 StartTextField; intFieldGrp -label "stop" -cc "cc()" -value1 1 StopTextField; intFieldGrp -label "byframe" -cc "cc()" -value1 1 StepTextField; //////////////////////////////////////// setParent RGColLayout; frameLayout -label "Photon Setting" -labelAlign "bottom" -cl true -cll true -w 500 -mh 5 -borderStyle "etchedIn" photonsetting; columnLayout; rowLayout; setParent ..; checkBox -label "Use Photons" -cc "cc()" use_photons ; floatSliderGrp -label "Spacing" -cc "cc()" -field true -v $photon_spacing -pre 3 -min 0.001 -max 1.0 photon_spacing; floatSliderGrp -label "Count" -cc "cc()" -field true -v $photon_count -pre 1 -min 0 -max 400000.0 photon_count; ////////////////////////////////////////////////// setParent RGColLayout; frameLayout -label "Radiosity Setting" -labelAlign "bottom" -cl true -cll true -w 500 -mh 5 -borderStyle "etchedIn" option2; columnLayout; rowLayout; setParent ..; checkBox -label "Use Radiosity" -cc "cc()" radiosity ; floatSliderGrp -label "Brightness" -cc "cc()" -field true -v $rad_brightness -pre 3 -min 0.001 -max 15.0 Brightness; floatSliderGrp -label "Count" -cc "cc()" -field true -v $rad_count -pre 3 -min 1.0 -max 1600.0 Count; floatSliderGrp -label "Distance_Maximum" -cc "cc()" -field true -v $rad_dist_max -pre 1 -min 0.0 -max 10000.0 Distance; floatSliderGrp -label "Error_Bound" -cc "cc()" -field true -v $rad_error_bound -pre 5 -min 0.00001 -max 2 Error_Bound; floatSliderGrp -label "Gray Treshold" -cc "cc()" -field true -v $rad_gray_tresh -pre 5 -min 0.0 -max 1.0 GrayTreshold ; floatSliderGrp -label "Low Error Factor" -cc "cc()" -field true -v $rad_low_error -pre 2 -min 0.01 -max 100.0 Low_Error_Factor; floatSliderGrp -label "Minimum Reuse" -cc "cc()" -field true -v $rad_min_reuse -pre 5 -min 0.0 -max 10.0 MinimumReuse; floatSliderGrp -label "Nearest Count" -cc "cc()" -field true -v $rad_neares_count -pre 5 -min 1.0 -max 20.0 NearestCount; floatSliderGrp -label "Recursion Limit" -cc "cc()" -field true -v $rad_recursion_limit -pre 0 -min 1.0 -max 10.0 RecursionLimit; setParent RGColLayout; frameLayout -label "Extra Settings" -labelAlign "bottom" -cll true -w 500 -mh 5 -borderStyle "etchedIn" -cc "ptb_ui 0 1" -ec "ptb_ui 0 1" option3; columnLayout; ///////////////////////////////////////////////////////////////////////////////////////////////////////////// rowColumnLayout -numberOfColumns 3 -cs 1 20 -cs 2 20 -cs 3 20; setParent RGColLayout; textFieldGrp -label "Povray Exe" -w 200 -text "pvengine" PovExe; // textFieldGrp -edit -text $PovExe; button -w 100 -c ("deleteUI "+$window) -l "Close" CloseButton; // setParent RGColLayout; setParent $tabs; menu -label "File" -tearOff true; menuItem -label "New"; menuItem -label "Open"; menuItem -label "Save"; menuItem -divider true; menuItem -label "Quit"; menu -label "Help" -helpMenu true; menuItem -label "About Application..."; string $child2 = `rowColumnLayout -numberOfColumns 2`; button; button; button; setParent $tabs; //paneLayout -configuration "quad" MaterialEditor; scrollLayout -horizontalScrollBarThickness 16 -verticalScrollBarThickness 16 MaterialEditor ; columnLayout RGColLayout2; frameLayout -label "Material Setting" -labelAlign "bottom" -cl true -cll true -w 500 -mh 5 -borderStyle "etchedIn" MatLayout; columnLayout c1; rowColumnLayout -numberOfRows 1 -rowHeight 1 222; columnLayout; image -w $prew_icon_size -h $prew_icon_size PreviewImage; button -w 100 -c ("PovRender \"\"") -l "Render Scene"; button -w 100 -c ("make_prew_scene") -l "Preview" PreviewButton; button -w 100 -c ("material_ata") -l "Assign" MaterialAssignButton; button -w 100 -c ("material_detach") -l "Detach" MaterialDetachButton; setParent ..; textScrollList -h 200 -w 100 -sc "Mat_ListBox_selected" MaterialListBox; textFieldGrp -label "Material" -w 200 -text "" Matname; setParent RGColLayout2; frameLayout -label "Reserved" -labelAlign "bottom" -cl true -cll true -w 500 -mh 5 -borderStyle "etchedIn" option34; setParent c1 ; checkBox -label "photons" -v 0 -cc "set_obje(\"photons\")" photons; checkBox -label "reflect" -v 0 -cc "set_obje(\"reflect\")" reflect; checkBox -label "refract" -v 0 -cc "set_obje(\"refract\")" refract; checkBox -label "Hollow" -v 0 -cc "set_obje(\"hollow\")" hollow; checkBox -label "no_image" -v 0 -cc "set_obje(\"no_image\")" no_image; checkBox -label "no_reflection" -v 0 -cc "set_obje(\"no_reflection\")" no_reflection; checkBox -label "double_illuminate" -v 0 -cc "set_obje(\"double_illuminate\")" double_illuminate; checkBox -label "inverse" -v 0 -cc "set_obje(\"inverse\")" inverse; checkBox -label "Use Interior" -v $interior Interior ; floatSliderGrp -label "fade_distance" -cw1 50 -field true -v $fade_distance -pre 5 -min 0.00001 -max 2 fade_distance; floatSliderGrp -label "fade_power" -field true -v $fade_power -pre 5 -min 0.00001 -max 2 fade_power; floatSliderGrp -label "ior" -field true -v $ior -pre 5 -min 0.00001 -max 2 ior; floatSliderGrp -label "dispersion" -field true -v $dispersion -pre 5 -min 0.00001 -max 2 dispersion; floatSliderGrp -label "dispersion_samples" -field true -v $dispersion_samples -pre 5 -min 0.00001 -max 2 dispersion_samples; //rowColumnLayout -numberOfRows 2 r1; /*rowLayout r1; columnLayout c1; columnLayout c2; setParent.. ; */ // frameLayout -label "Radiosity Setting" -labelAlign "bottom" -cl true -cll true -w 500 -mh 5 -borderStyle "etchedIn" option33; // columnLayout; rowLayout; setParent ..; /* paneLayout -configuration "quad" MaterialEditor; columnLayout -w $prew_icon_size -h $prew_icon_size ColumnMEditor1; setParent..; columnLayout ColumnMEditor2; setParent..; columnLayout ColumnMEditor3; setParent..; columnLayout ColumnMEditor4;setParent..; //formLayout; setParent ColumnMEditor1; image -w $prew_icon_size -h $prew_icon_size -image "" PreviewImage; button -w 100 -c ("PovRender \"\"") -l "Render Scene"; button -w 100 -c ("make_prew_scene") -l "Preview" PreviewButton; button -w 100 -c ("material_ata") -l "Assign" MaterialAssignButton; button -w 100 -c ("material_detach") -l "Detach" MaterialDetachButton; checkBox -label "Use Interior" -v $interior Interior ; floatSliderGrp -label "fade_distance" -cw1 50 -field true -v $fade_distance -pre 5 -min 0.00001 -max 2 fade_distance; floatSliderGrp -label "fade_power" -field true -v $fade_power -pre 5 -min 0.00001 -max 2 fade_power; floatSliderGrp -label "ior" -field true -v $ior -pre 5 -min 0.00001 -max 2 ior; floatSliderGrp -label "dispersion" -field true -v $dispersion -pre 5 -min 0.00001 -max 2 dispersion; floatSliderGrp -label "dispersion_samples" -field true -v $dispersion_samples -pre 5 -min 0.00001 -max 2 dispersion_samples; setParent ColumnMEditor2; textScrollList -h 200 -w 100 -sc "Mat_ListBox_selected" MaterialListBox; textFieldGrp -label "Material" -w 200 -text "" Matname; setParent ColumnMEditor3; setParent ColumnMEditor4; scrollField; scrollLayout; columnLayout; button; button; button; text -label ""; string $child3 = `rowColumnLayout -numberOfColumns 2`; setParent $tabs; */ showWindow $window ; } ///********************************************* global proc material_detach() { string $tirnak = "\""; global string $mat_list[],$mat_tip[]; //select -r -hi; string $object[] = `ls -sl -ni -v`; int $mat_no; // objeye bir add attribute ile pov material name attributes u ayarlay?p (string olarak) bu degeri ona vermek laz?m :) // ve sende povray e export ederken bu attributes den texture stringini al?p gerekli yere yazmal?s?n. //print($material+"\n"); $mat_no = get_selected_material_no(); //if($mat_no==-1) return; for($obje2 in $object) { string $obje[] = `listRelatives -f -ni -s $obje2`; // $obje[0]=$obje2; string $q = "attributeQuery -n "+$obje[0]+"-ex pov_material"; string $q2 = "attributeQuery -n "+$obje[0]+"-ex pov_mattip"; if(eval($q)) { deleteAttr($obje[0]+".pov_material"); } if(eval($q2)) { deleteAttr($obje[0]+".pov_mattip"); } } } ////***************************************************************************** global proc set_obje(string $kontrol) { string $object[] = `ls -sl -ni -v`; int $t = `checkBox -q -v $kontrol`; for($obje2 in $object) { string $obje[] = `listRelatives -f -ni -s $obje2`; //AddAttribute($obje[0] , $kontrol, "bool", 1); $s= `attributeExists $kontrol $obje[0]`; if($s==0) addAttr -s 1 -ln $kontrol -at "bool" $obje[0]; string $d = "setAttr "+$obje[0]+"."+$kontrol+" "+$t; eval($d); } //select $selection_save; } ////***************************************************************************** global proc material_ata() { string $tirnak = "\""; global string $mat_list[],$mat_tip[]; //select -r -hi; string $object[] = `ls -sl -ni -v`; int $mat_no; // objeye bir add attribute ile pov material name attributes u ayarlay?p (string olarak) bu degeri ona vermek laz?m :) // ve sende povray e export ederken bu attributes den texture stringini al?p gerekli yere yazmal?s?n. //print($material+"\n"); // $selection_save = `ls -sl`; $mat_no = get_selected_material_no(); print($mat_no); if($mat_no==-1) return; for($obje2 in $object) { //select -r $obje2; string $obje[] = `listRelatives -f -ni -s $obje2`; // select -r $obje[0]; print($obje2); //$obje[0]=$obje2; AddStringAttribute($obje[0] , "pov_material", $mat_list[$mat_no]); AddStringAttribute($obje[0] , "pov_mattip", $mat_tip[$mat_no]); return; string $q = "attributeQuery -n "+$obje[0]+"-ex pov_material"; string $q2 = "attributeQuery -n "+$obje[0]+"-ex pov_mattip"; if(eval($q)) { string $s = getAttr($obje[0]+".pov_material"); } else { string $a = "addAttr -s 1 -ln pov_material -dt "+$tirnak+"string"+$tirnak; eval($a); } if(eval($q2)) { string $st = getAttr($obje[0]+".pov_mattip"); } else { string $at = "addAttr -s 1 -ln pov_mattip -dt "+$tirnak+"string"+$tirnak; eval($at); } string $s = "setAttr -type "+$tirnak+"string"+$tirnak+" "+$obje[0]+".pov_material "+$mat_list[$mat_no]; string $st = "setAttr -type "+$tirnak+"string"+$tirnak+" "+$obje[0]+".pov_mattip "+$mat_tip[$mat_no]; eval($s); eval($st); }; //select $selection_save; } global proc cc() { save_globalsettings_todummy(); } //////********************************************************************************* /// GLOBAL SETTINGLER DUMMY SETTING OBJESINE YAZAR global proc save_globalsettings_todummy() { global int $antialiasMethod; global string $antialias, $radiosity,$jitter,$camera,$photons; global float $antialias_treshold,$jitter_amount,$antialias_depth; global float $rad_brightness, $rad_count, $rad_dist_max,$rad_error_bound,$rad_gray_tresh,$quality; global float $rad_low_error, $rad_min_reuse, $rad_neares_count, $rad_recursion_limit; global float $adc_bailout,$assumed_gamma,$AmbientR,$AmbientG,$AmbientB,$irid1,$irid2,$irid3; global int $max_intersections,$hf_gray_16,$number_of_waves,$max_trace_level; global float $turb_depth,$omega,$lambda,$octaves,$fog_offset,$fog_alt,$Fog_Up; global float $fade_distance,$fade_power,$ior,$dispersion,$dispersion_samples,$interior; global float $skycolor1R, $skycolor1G, $skycolor1B,$skycolor2R, $skycolor2G, $skycolor2B; global int $sky_sphere,$fog; global float $photon_spacing,$photon_count; get_globalSettings_fromUI(); if (`objExists Mayaray_global_settings`) { //select -r Mayaray_global_settings; } else { createNode "transform" -n "Mayaray_global_settings"; parent Mayaray_global_settings persp ; addAttr -s 1 -ln camera -dt "string" Mayaray_global_settings; //$attr = AddStringAttribute("Mayaray_global_settings", "Radiosity", $radiosity ); addAttr -s 1 -ln radiosity -dt "string" Mayaray_global_settings; addAttr -s 1 -ln antialias -dt "string" Mayaray_global_settings; addAttr -s 1 -ln antialias_treshold -at "double" Mayaray_global_settings; addAttr -s 1 -ln jitter_amount -at "double" Mayaray_global_settings; addAttr -s 1 -ln antialias_depth -at "double" Mayaray_global_settings; addAttr -s 1 -ln rad_brightness -at "double" Mayaray_global_settings; addAttr -s 1 -ln rad_count -at "double" Mayaray_global_settings; addAttr -s 1 -ln rad_dist_max -at "double" Mayaray_global_settings; addAttr -s 1 -ln rad_error_bound -at "double" Mayaray_global_settings; addAttr -s 1 -ln rad_gray_tresh -at "double" Mayaray_global_settings; addAttr -s 1 -ln quality -at "double" Mayaray_global_settings; addAttr -s 1 -ln rad_low_error -at "double" Mayaray_global_settings; addAttr -s 1 -ln rad_min_reuse -at "double" Mayaray_global_settings; addAttr -s 1 -ln rad_neares_count -at "double" Mayaray_global_settings; addAttr -s 1 -ln rad_recursion_limit -at "double" Mayaray_global_settings; addAttr -s 1 -ln adc_bailout -at "double" Mayaray_global_settings; addAttr -s 1 -ln assumed_gamma -at "double" Mayaray_global_settings; addAttr -s 1 -ln AmbientR -at "double" Mayaray_global_settings; addAttr -s 1 -ln AmbientG -at "double" Mayaray_global_settings; addAttr -s 1 -ln AmbientB -at "double" Mayaray_global_settings; addAttr -s 1 -ln irid1 -at "double" Mayaray_global_settings; addAttr -s 1 -ln irid2 -at "double" Mayaray_global_settings; addAttr -s 1 -ln irid3 -at "double" Mayaray_global_settings; addAttr -s 1 -ln max_intersections -at "short" Mayaray_global_settings; addAttr -s 1 -ln hf_gray_16 -at "short" Mayaray_global_settings; addAttr -s 1 -ln number_of_waves -at "short" Mayaray_global_settings; addAttr -s 1 -ln max_trace_level -at "short" Mayaray_global_settings; addAttr -s 1 -ln use_photons -dt "string" Mayaray_global_settings; addAttr -s 1 -ln photon_spacing -at "double" Mayaray_global_settings; addAttr -s 1 -ln photon_count -at "double" Mayaray_global_settings; } ///// ATMOSFERIK ATTRIBLER if (`objExists Mayaray_sky_sphere`==0) ///// SKY SPHERE { createNode "transform" -n "Mayaray_sky_sphere"; parent Mayaray_sky_sphere persp ; addAttr -s 1 -ln sky_sphere -at "bool" Mayaray_sky_sphere; addAttr -s 1 -ln skycolor1R -at "double" Mayaray_sky_sphere; addAttr -s 1 -ln skycolor1G -at "double" Mayaray_sky_sphere; addAttr -s 1 -ln skycolor1B -at "double" Mayaray_sky_sphere; addAttr -s 1 -ln skycolor2R -at "double" Mayaray_sky_sphere; addAttr -s 1 -ln skycolor2G -at "double" Mayaray_sky_sphere; addAttr -s 1 -ln skycolor2B -at "double" Mayaray_sky_sphere; } if (`objExists Mayaray_fog`==0) ///// ATMOSFER FOG { createNode "transform" -n "Mayaray_fog"; parent Mayaray_fog persp ; addAttr -s 1 -ln fog -at "bool" Mayaray_fog; addAttr -s 1 -ln turb_depth -at "double" Mayaray_fog; addAttr -s 1 -ln omega -at "double" Mayaray_fog; addAttr -s 1 -ln lambda -at "double" Mayaray_fog; addAttr -s 1 -ln octaves -at "double" Mayaray_fog; addAttr -s 1 -ln fog_offset -at "double" Mayaray_fog; addAttr -s 1 -ln fog_alt -at "double" Mayaray_fog; addAttr -s 1 -ln Fog_Up -at "double" Mayaray_fog; } setAttr -type "string" Mayaray_global_settings.camera $camera; setAttr -type "string" Mayaray_global_settings.radiosity $radiosity; setAttr -type "string" Mayaray_global_settings.antialias $antialias; setAttr -type "string" Mayaray_global_settings.use_photons $photons; setAttr Mayaray_global_settings.antialias_treshold $antialias_treshold; setAttr Mayaray_global_settings.jitter_amount $jitter_amount; setAttr Mayaray_global_settings.antialias_depth $antialias_depth; setAttr Mayaray_global_settings.rad_brightness $rad_brightness; setAttr Mayaray_global_settings.rad_count $rad_count; setAttr Mayaray_global_settings.rad_dist_max $rad_dist_max; setAttr Mayaray_global_settings.rad_error_bound $rad_error_bound; setAttr Mayaray_global_settings.rad_gray_tresh $rad_gray_tresh; setAttr Mayaray_global_settings.quality $quality; setAttr Mayaray_global_settings.rad_low_error $rad_low_error; setAttr Mayaray_global_settings.rad_min_reuse $rad_min_reuse; setAttr Mayaray_global_settings.rad_neares_count $rad_neares_count; setAttr Mayaray_global_settings.rad_recursion_limit $rad_recursion_limit; setAttr Mayaray_global_settings.adc_bailout $adc_bailout; setAttr Mayaray_global_settings.assumed_gamma $assumed_gamma; setAttr Mayaray_global_settings.AmbientR $AmbientR; setAttr Mayaray_global_settings.AmbientG $AmbientG; setAttr Mayaray_global_settings.AmbientB $AmbientB; setAttr Mayaray_global_settings.irid1 $irid1; setAttr Mayaray_global_settings.irid2 $irid2; setAttr Mayaray_global_settings.irid3 $irid3; setAttr Mayaray_global_settings.max_intersections $max_intersections; setAttr Mayaray_global_settings.hf_gray_16 $hf_gray_16; setAttr Mayaray_global_settings.number_of_waves $number_of_waves; setAttr Mayaray_global_settings.max_trace_level $max_trace_level; setAttr Mayaray_global_settings.photon_spacing $photon_spacing; setAttr Mayaray_global_settings.photon_count $photon_count; setAttr Mayaray_fog.fog $fog; setAttr Mayaray_fog.turb_depth $turb_depth; setAttr Mayaray_fog.omega $omega; setAttr Mayaray_fog.lambda $lambda; setAttr Mayaray_fog.octaves $octaves; setAttr Mayaray_fog.fog_offset $fog_offset; setAttr Mayaray_fog.fog_alt $fog_alt; setAttr Mayaray_fog.Fog_Up $Fog_Up; setAttr Mayaray_sky_sphere.sky_sphere $sky_sphere; setAttr Mayaray_sky_sphere.skycolor1R $skycolor1R; setAttr Mayaray_sky_sphere.skycolor1G $skycolor1G; setAttr Mayaray_sky_sphere.skycolor1B $skycolor1B; setAttr Mayaray_sky_sphere.skycolor2R $skycolor2R; setAttr Mayaray_sky_sphere.skycolor2G $skycolor2G; setAttr Mayaray_sky_sphere.skycolor2B $skycolor2B; } global proc scene_load() { set_globalSettings_toUI(); } /* global proc scene_save() { //int $a = `scriptJob -ro 1 -e "flushingScene" "scene_save()"`; print("xxx"); $scene_saved_job_num = `scriptJob -ro 1 -e "ToolChanged" "scene_save()"`; save_globalsettings_todummy(); }*/