{ Export Sheep s2.7 v 1.3 by Exper Giovanni Rubaltelli - http://exper.3drecursions.com Email: exper AT 3drecursions DOT com This script Export the current selected flame to a file compatible for ES (ElectricSheep) 2.7 server submission. Due to future ES Server changes there's three parameters that can be modified at the end of this comment: w := 800; h := 592; quality := 2000; they are render width, height and quality. Released under GPL License http://www.gnu.org/copyleft/gpl.html see the file COPYING for the license covering this software. Credits or donations are not mandatory but very appreciated expecially when using "Export Sheep" in commercial productions. It can be used on "Apophysis 2.07 beta", "Apophysis 2.06c beta", "Apophysis 2.06 beta", "Apophysis 2.06 beta Z+", "Apophysis 2.06c 3D hack" and newer versions Supported Variatons: linear, sinusoidal, spherical, swirl, horseshoe, polar, handkerchief, heart, disc, spiral, hyperbolic, diamond, ex, julia, bent, waves, fisheye, popcorn, exponential, power, cosine, rings, fan, blob, pdj, fan2, rings2, eyefish, bubble, cylinder, perspective, noise, julian, juliascope, blur, gaussian_blur, radial_blur, pie, ngon, curl, rectangles, arch, tangent, square, rays, blade, secant2, cross, disc2, super_shape, flower, conic, parabola, split, move. Banned Variations: twintrian Changelog v 1.3 - 13 October 2009 Dropped 'twintrian' variation (currently banned in ES server) Support FinalXForm enabling/disabling via Apophysis UI Support consistent Preview of the exported Flame Major code optimization related to Variations check Resolved a minor quirk related to FinalXForm Added post-export hints: Show a message when unsupported Variations are dropped Show a message when FinaXForm is disabled using Apo's FX button Show a message when the 5 Variations limit is exceeded v 1.2 - 9 October 2009 Resolved a bad bug related to the 5 Variations limit check Added a small optimization to the code v 1.1 - 9 October 2009 Support for the 5 Variations limit per XForm v 1.0 - 19 June 2008 Major code update/optimization regarding FinalXForm handling Smaller and more compact script code Support for unamed flames v 0.7 - 17 June 2008 Blazing faster when used on big flame-packs v 0.6 - 15 June 2008 Minor code clean up v 0.5 - 14 June 2008 Resolved a couple of minor bugs v 0.4 - 13 June 2008 Resolved a minor bug regarding FinalXForm handling Minor code optimization and clean up v 0.3 - 12 June 2008 Faster browsing for big Flame files Code clean up v 0.2 - 11 June 2008 Code optimization v 0.1 - 10 June 2008 First internal implementation adapting RenderFlam3 script Useless code removed } // // ES Server parameters // w := 800; h := 592; quality := 2000; // // Preview parameters // pSampleDensity:=5; pOversample:=1; pFilterRadius:=0.4; msgv:=0; msgf:=0; msge:=0; apov:=ProgramVersionString; print('Apophysis version: "'+ apov +'"'); print(''); if (apov='Apophysis 2.07 beta') or (apov='Apophysis 2.06c 3D hack') then apov:=1; else begin apot:=apov[11]; apot:=StrToInt(apot); if(apot>2) then apov:=1; else if(apot=2)then begin apot:=apov[13]; apot:=StrToInt(apot); if(apot>0) then apov:=1; else begin apot:=apov[14]; apot:=StrToInt(apot); if(apot>=6) then apov:=1; end; end; if(apov<>1) then begin ShowMessage('Usupported Apophysis version. Currently supported version is: Apophysis 2.06c beta'); exit; end; end; // // Apophysis variations check against Flam3 // some old variables are needed (backward compatibility) // tflameName := flame.name; StoreFlame(0); LoadFlame(0); SetActiveTransform(0); with Transform do begin radial_blur_angle:=0; rings2_val:=0; fan2_x:=0; fan2_y:=0; blob_low:=0; blob_high:=0; blob_waves:=0; pdj_a:=0; pdj_b:=0; pdj_c:=0; pdj_d:=0; perspective_angle:=0; perspective_dist:=0; julian_power:=0; julian_dist:=0; juliascope_power:=0; juliascope_dist:=0; curl_c1:=0; curl_c2:=0; move_x:=0; move_y:=0; ngon_sides:=0; ngon_power:=0; ngon_circle:=0; ngon_corners:=0; disc2_rot:=0; disc2_twist:=0; rectangles_x:=0; rectangles_y:=0; super_shape_m:=0; super_shape_n1:=0; super_shape_n2:=0; super_shape_n3:=0; super_shape_rnd:=0; super_shape_holes:=0; flower_petals:=0; flower_holes:=0; conic_eccentricity:=0; conic_holes:=0; parabola_height:=0; parabola_width:=0; pie_slices:=0; pie_thickness:=0; pie_rotation:=0; split_xsize:=0; split_ysize:=0; end; GetFlame(0); if(apov>0) then begin for i := 0 to Transforms do begin SetActiveTransform(i); with Transform do begin for xv:=0 to NVARS-1 do begin if(variation[xv]<>0) then begin if (variationname(xv)<>'linear') and (variationname(xv)<>'sinusoidal') and (variationname(xv)<>'spherical') and (variationname(xv)<>'swirl') and (variationname(xv)<>'horseshoe') and (variationname(xv)<>'polar') and (variationname(xv)<>'handkerchief') and (variationname(xv)<>'heart') and (variationname(xv)<>'disc') and (variationname(xv)<>'spiral') and (variationname(xv)<>'hyperbolic') and (variationname(xv)<>'diamond') and (variationname(xv)<>'ex') and (variationname(xv)<>'julia') and (variationname(xv)<>'bent') and (variationname(xv)<>'waves') and (variationname(xv)<>'fisheye') and (variationname(xv)<>'popcorn') and (variationname(xv)<>'exponential') and (variationname(xv)<>'power') and (variationname(xv)<>'cosine') and (variationname(xv)<>'rings') and (variationname(xv)<>'fan') and (variationname(xv)<>'blob') and (variationname(xv)<>'pdj') and (variationname(xv)<>'fan2') and (variationname(xv)<>'rings2') and (variationname(xv)<>'eyefish') and (variationname(xv)<>'bubble') and (variationname(xv)<>'cylinder') and (variationname(xv)<>'perspective') and (variationname(xv)<>'noise') and (variationname(xv)<>'julian') and (variationname(xv)<>'juliascope') and (variationname(xv)<>'blur') and (variationname(xv)<>'gaussian_blur') and (variationname(xv)<>'radial_blur') and (variationname(xv)<>'pie') and (variationname(xv)<>'ngon') and (variationname(xv)<>'curl') and (variationname(xv)<>'rectangles') and (variationname(xv)<>'arch') and (variationname(xv)<>'tangent') and (variationname(xv)<>'square') and (variationname(xv)<>'rays') and (variationname(xv)<>'blade') and (variationname(xv)<>'secant') and (variationname(xv)<>'cross') and (variationname(xv)<>'disc2') and (variationname(xv)<>'super_shape') and (variationname(xv)<>'flower') and (variationname(xv)<>'conic') and (variationname(xv)<>'parabola') and (variationname(xv)<>'split') and (variationname(xv)<>'move') then begin variation[xv]:=0; msgv:=1; end; end; end; end; end; end; flameName:=GetSaveFileName; outputPath:=ExtractFilePath(flameName); flameName:=ExtractFileName(flameName); // // "RAW-Write Flame" setup and writing // fxf:=0; outputpath := Trim(outputPath); print('Saving to ' + outputpath + flameName); ShowStatus('Saving to ' + outputpath + flameName); FileList := TStringList.Create; tpost:=0; oScale:=flame.Scale; flame.Width := w; flame.Height := h; SetRenderBounds; { raw flame write} with flame do begin nScale:=oScale / 100 * flame.Width; nScale:=nScale * (2^Flame.Zoom); Flame.Zoom:=0; data:='0) then data:= data + ' rotate="' + FloatToStr(-(180*Flame.Angle)/PI) + '"'; else data:= data + ' rotate="0"'; data:= data + ' supersample="3" filter="1" filter_shape="gaussian" quality="' + IntToStr(quality) + '" passes="1" temporal_samples="1000"'; data:= data + ' background="0 0 0" brightness="' + FloatToStr(brightness) + '" gamma="' + FloatToStr(gamma) + '" vibrancy="' + FloatToStr(vibrancy)+ '"'; data:= data + ' estimator_radius="11" estimator_minimum="0" estimator_curve="0.6" gamma_threshold="0.01" interpolation_space="log">'; FileList.Add(data); end; { Write transform parameters } for i := 0 to Transforms do begin SetActiveTransform(i); with Transform do begin maxv:=0; data:=''; if (i1) or (b<>0) or (c<>0) or (d<>1) or (e<>0) or (f<>0) or (variation[0]<>1) then begin if (Flame.FinalXformEnabled=true) then begin fxf:=1; data:=data + ' 0 then begin if (Flame.FinalXformEnabled=true) then begin fxf:=1; data:=data + ' 0 then data:=data + ' symmetry="'+FloatToStr(symmetry)+'"'; for nvar:=0 to NVARS - 1 do begin if (variation[nvar]<>0) then begin inc(maxv); if(maxv<6) then begin if (variationname(nvar)='secant') then data:=data + ' secant2="' + FloatToStr(variation[nvar]) + '"'; else data:=data + ' ' + variationname(nvar) + '="' + FloatToStr(variation[nvar]) + '"'; end; else begin variation[nvar]:=0; msge:=1; end; end; end; maxv:=0; tb:=transform.coefs[0,1]-(transform.coefs[0,1]*2); tc:=transform.coefs[1,0]-(transform.coefs[1,0]*2); tf:=transform.coefs[2,1]-(transform.coefs[2,1]*2); data:=data + ' coefs="' + FloatToStr(transform.coefs[0,0]) + ' ' + FloatToStr(tb) + ' ' + FloatToStr(tc) + ' ' + FloatToStr(transform.coefs[1,1]) + ' ' + FloatToStr(transform.coefs[2,0]) + ' ' + FloatToStr(tf) + '"'; if(post[0,0]<>1) or (post[0,1]<>0) or (post[1,0]<>0) or (post[1,1]<>1) or (post[2,0]<>0) or (post[2,1]<>0) then tpost:=1; if(tpost=1) then begin tb:=transform.post[0,1]-(transform.post[0,1]*2); tc:=transform.post[1,0]-(transform.post[1,0]*2); tf:=transform.post[2,1]-(transform.post[2,1]*2); data:=data + ' post="' + FloatToStr(post[0,0]) + ' ' + FloatToStr(tb) + ' ' + FloatToStr(tc) + ' ' + FloatToStr(post[1,1]) + ' ' + FloatToStr(post[2,0]) + ' ' + FloatToStr(tf) + '"'; end; tpost:=0; for nvar:=0 to NVARS - 1 do begin if variation[nvar]<>0 then begin inc(maxv); if(variationname(nvar)='radial_blur') then data:=data + ' radial_blur_angle="' + FloatToStr(radial_blur_angle) + '"'; if(variationname(nvar)='rings2') then data:=data + ' rings2_val="' + FloatToStr(rings2_val) + '"'; if(variationname(nvar)='fan2') then data:=data + ' fan2_x="' + FloatToStr(fan2_x) + '"' + ' fan2_y="' + FloatToStr(fan2_y) + '"'; if(variationname(nvar)='blob') then data:=data + ' blob_low="' + FloatToStr(blob_low) + '"' + ' blob_high="' + FloatToStr(blob_high) + '"' + ' blob_waves="' + FloatToStr(blob_waves) + '"'; if(variationname(nvar)='pdj') then data:=data + ' pdj_a="' + FloatToStr(pdj_a) + '"' + ' pdj_b="' + FloatToStr(pdj_b) + '"' + ' pdj_c="' + FloatToStr(pdj_c) + '"' + ' pdj_d="' + FloatToStr(pdj_d) + '"'; if(variationname(nvar)='perspective') then data:=data + ' perspective_angle="' + FloatToStr(perspective_angle) + '"' + ' perspective_dist="' + FloatToStr(perspective_dist) + '"'; if(variationname(nvar)='julian') then data:=data + ' julian_power="' + FloatToStr(julian_power) + '"' + ' julian_dist="' + FloatToStr(julian_dist) + '"'; if(variationname(nvar)='juliascope') then data:=data + ' juliascope_power="' + FloatToStr(juliascope_power) + '"' + ' juliascope_dist="' + FloatToStr(juliascope_dist) + '"'; if(variationname(nvar)='curl') then data:=data + ' curl_c1="' + FloatToStr(curl_c1) + '"' + ' curl_c2="' + FloatToStr(curl_c2) + '"'; if(variationname(nvar)='move') then data:=data + ' move_x="' + FloatToStr(move_x) + '"' + ' move_y="' + FloatToStr(move_y) + '"'; if(variationname(nvar)='ngon') then data:=data + ' ngon_sides="' + FloatToStr(ngon_sides) + '"' + ' ngon_power="' + FloatToStr(ngon_power) + '"' + ' ngon_circle="' + FloatToStr(ngon_circle) + '"' + ' ngon_corners="' + FloatToStr(ngon_corners) + '"'; if(variationname(nvar)='disc2') then data:=data + ' disc2_rot="' + FloatToStr(disc2_rot) + '"' + ' disc2_twist="' + FloatToStr(disc2_twist) + '"'; if(variationname(nvar)='rectangles') then data:=data + ' rectangles_x="' + FloatToStr(rectangles_x) + '"' + ' rectangles_y="' + FloatToStr(rectangles_y) + '"'; if(variationname(nvar)='super_shape') then data:=data + ' super_shape_m="' + FloatToStr(super_shape_m) + '"' + ' super_shape_n1="' + FloatToStr(super_shape_n1) + '"' + ' super_shape_n2="' + FloatToStr(super_shape_n2) + '"' + ' super_shape_n3="' + FloatToStr(super_shape_n3) + '"' + ' super_shape_rnd="' + FloatToStr(super_shape_rnd) + '"' + ' super_shape_holes="' + FloatToStr(super_shape_holes) + '"' if(variationname(nvar)='flower') then data:=data + ' flower_petals="' + FloatToStr(flower_petals) + '"' + ' flower_holes="' + FloatToStr(flower_holes) + '"'; if(variationname(nvar)='conic') then data:=data + ' conic_eccentricity="' + FloatToStr(conic_eccentricity) + '"' + ' conic_holes="' + FloatToStr(conic_holes) + '"'; if(variationname(nvar)='parabola') then data:=data + ' parabola_height="' + FloatToStr(parabola_height) + '"' + ' parabola_width="' + FloatToStr(parabola_width) + '"'; if(variationname(nvar)='pie') then data:=data + ' pie_slices="' + FloatToStr(pie_slices) + '"' + ' pie_thickness="' + FloatToStr(pie_thickness) + '"' + ' pie_rotation="' + FloatToStr(pie_rotation) + '"'; if(variationname(nvar)='split') then data:=data + ' split_xsize="' + FloatToStr(split_xsize) + '"' + ' split_ysize="' + FloatToStr(split_ysize) + '"'; end; end; end; if (i' FileList.Add(data); end; end; end; { Write palette data } for i := 0 to 255 do begin FileList.Add(' '); end; FileList.Add(''); FileList.SaveToFile(outputPath + flameName); FileList.Free; SetFlameFile(outputPath + flameName); Preview; msg:='Exported File:'#13#10+outputPath + flameName; if(msgv=1) or (msgf=1) or (msge=1) then begin msg:=msg+#13#10#13#10'WARNING'#13#10; if(msgv=1) then msg:=msg + '=> Some unsupported Variations was dropped!'#13#10; if(msgf=1) then msg:=msg + '=> FinaXForm was disabled using Apophysis FX button!'#13#10; if(msge=1) then msg:=msg + '=> 5 Variations per XForm limit was exceeded!'; end; ShowMessage(msg); UpdateFlame := False;