Sample Export Plugin Code

This simple PureBasic example show how export plugins can be written.

 

;Identifies what kind of plugin this is.
ProcedureDLL PLUGINCLASS(*inbuffer,insize,*outbuffer,outsize)
PokeL(*outbuffer,2)
EndProcedure

;Returns a string to use in the export dialog file pattern
ProcedureDLL PLUGINNAME(*inbuffer,insize,*outbuffer,outsize)
PokeS(*outbuffer,"Microsoft DirectX Model (*.x)|*.x")
EndProcedure

;Carries out the export.  The file name is followed by the actual csm file data
ProcedureDLL RUNPLUGIN(*inbuffer,insize,*outbuffer,outsize)
readmem(*inbuffer)
file$=
reads()

MessageRequester("Export X",file$,0)

CreateFile(0,file$)

 

;Write export data


CloseFile(0)

;Return a 1 to show that the plugin worked.
;If you want Cshop to save the lightmaps as bitmaps for you, Return a 2.

;Return a 0 if the plugin fails.

PokeL(*outbuffer,1)


EndProcedure