3D editor DeleD V2.45CE plugin SDK for windows.

Headers, Bindings, Libraries for use with FreeBASIC, Please include example of use to help ensure they are tested and usable.
Post Reply
D.J.Peters
Posts: 8586
Joined: May 28, 2005 3:28
Contact:

3D editor DeleD V2.45CE plugin SDK for windows.

Post by D.J.Peters »

DeleD CE 3D editor is a Win32 application and good for game level desing and for creating lightmaps.

With the plugin SDK you can write your own file im- or exporter
or extend the functionality of the DeleD 3D editor with FreeBASIC.

homepage: http://www.delgine.com

download: https://sourceforge.net/projects/deled/ ... e/download

The help file for the plugin SDK and examples are in the DeleD CE V2.45 download included.

file: "pluginsdk.bi"

Code: Select all

#ifndef __pluginsdk__
#define __pluginsdk__

#ifndef __FB_WIN32__
#error 666: a DeleD plugin must be build as Windows DLL !
#endif

#ifndef __FB_64BIT__
#else
#error 666: a DeleD plugin must be build as a 32-bit Windows DLL !
#endif

#ifndef HWND ' if windows.bi are not included before
type HWND as any ptr
#endif

#ifndef PChar
type PChar as zstring ptr
#endif

Extern "Windows-MS" 'all stdcall without name decoration @XX

' Callback Record Definition 
'--------------------------------------------------------------------------------
 
' DeleD's plugin architecture is based on swapping scene data between the plugin and DeleD itself.
' You execute the callback method everytime you want to swap data between the plugin and DeleD.
' You pass the callback method a variable of type TCallBackRecord. 
' This is a structure that holds the actual information being passed between the plugin and DeleD. 
' It tells DeleD what to do (RequestID), 
' contains the actual data coming from the plugin (RequestXML) 
' and has room for DeleD to store its answer (ResponseXML), if needed.

' The TCallBackRecord structure is defined like this: 
type TCallBackRecord
  as long  RequestID    ' reason for executing callback (0,1 or 2)
  as PChar RequestXML   ' XML data send by the plugin to DeleD
  as PChar ResponseXML  ' XML data send by DeleD to the plugin
  as long  ResponseSize ' size of the response XML data in bytes
end type

' You can either get data from DeleD or send data to DeleD. 
' The RequestID element of the TCallBackRecord structure 
' is used to specify what you want to do. 
' It can have the following values: 0,1 or 2. 
' It is good practice to define these values as constants, 
' so it becomes more clear what they mean.
const as long PR_GETMEM  = 0
const as long PR_GETDATA = 1
const as long PR_SETDATA = 2
' When retrieving data from DeleD, use PR_GETMEM and PR_GETDATA. 
' When sending data to DeleD, use PR_SETDATA.

' Callback Procedure 
'--------------------------------------------------------------------------------
' Communication between the plugin and DeleD takes place 
' by executing a socalled callback procedure from within the plugin. 
' This procedure resides in DeleD itself and a pointer 
' to that procedure is provided to the plugin on initialization. 
' Initialization of plugins happens automatically when DeleD scans 
' for valid plugin DLL files on start-up. 
' When executing the callback procedure within the plugin, 
' you are actually executing a procedure of DeleD. 
' The callback procedure needs to be defined in your plugin in the following manner:
type TCallBackProc as function(byref ACallBackRecord as TCallBackRecord) as long
' it returns <> PE_NOERROR incase of an error 
const as long PE_NOERROR = 0


' This chapter lists all methods that should be exported through a DeleD plugin DLL file.
'--------------------------------------------------------------------------------
declare function PluginName as PChar
' This function returns a pointer to a character string containing 
' the name of the plugin as being displayed in the Plugin menu with DeleD. 
' Typically, this character string is between 10 and 20 characters in size. 

declare function PluginDescription as PChar
' This function returns a pointer to a character string containing the description of the plugin. 
' This description is displayed in the Plugin window within DeleD. 

declare function PluginDeleDVersion as PChar
' This function returns a pointer to a character string showing
' the minimal version of DeleD needed to execute this plugin. 
' DeleD uses this version number to determine if the plugin can be run and thus, 
' if it should be listed in the Plugin menu. 
' (eg."1.6" or "2.45")

declare function PluginVersion as PChar
' This function returns a pointer to a character string showing 
' the current version of the plugin itself. 
' (eg."1.0")

declare function PluginAuthor as PChar
' This function returns a pointer to a character string showing 
' the name of the author of the plugin. 

declare function PluginEmail as PChar
' This function returns a pointer to a character string showing the emailaddress of the author of the plugin. 

declare sub PluginSetCallback(byval aCallBackProc as TCallBackProc)
' At startup, DeleD initializes all available plugins and calls 
' the PluginSetCallback routine automatically for each plugin. 
' This procedure saves a pointer to DeleD's callback routine 
' (as provided in the TCallBack parameter) into a parameter local to the plugin. 
' The plugin then uses that local parameter to issue a callback to DeleD. 

declare sub PluginExecute
' This procedure is executed when the user executes 
' a plugin from the Plugin menu within DeleD. 

' Optional:
declare sub PluginInitialize(byval aMainWindow as HWND)
' If a plugin exports this procedure, DeleD calls it with the handle to the DeleD Main Window. 
' Use this handle to better integrate your plugin within the main application. 

end extern

#endif __pluginsdk__
A simple test compile it as a 32-bit Windows DLL and put it in the DeleD plugin folder.
Start or restart DeleD and show the plugin dialog.

Joshy

Code: Select all

#include once "pluginsdk.bi" ' DeleD plugin API

Extern "Windows-MS" 'all stdcall without name decoration @XX

function PluginName() as PChar export
  return @"senseless"
end function

function PluginDescription as PChar  export
  return @"a senseless plugin !"
end function

function PluginDeleDVersion as PChar  export
  return @"1.6"
end function

function PluginVersion as PChar  export
  return @"1.0"
end function

function PluginAuthor as PChar  export
  return @"polygon"
end function 

function PluginEmail as PChar export
  return @"guru@GPU.paradies"
end function

sub PluginSetCallback(byval aCallBackProc as TCallBackProc)  export
  beep ' PluginSetCallback called by DeleD !
end sub

sub PluginExecute export
  beep ' user called PluginExecute !
end sub

sub PluginInitialize(byval aMainWindow as HWND)  export
  beep
  print ' PluginInitialize with window handle called by DeleD !
end sub

end extern
Last edited by D.J.Peters on Oct 12, 2022 18:37, edited 1 time in total.
D.J.Peters
Posts: 8586
Joined: May 28, 2005 3:28
Contact:

Re: 3D editor DeleD V2.45CE plugin SDK for windows.

Post by D.J.Peters »

sing: "Ups I did it again" :lol:

Here are I posted the DeleD plugin API ~10 years before

i get older

Joshy
Kuron
Posts: 34
Joined: Jul 26, 2005 3:22
Location: Nashville

Re: 3D editor DeleD V2.45CE plugin SDK for windows.

Post by Kuron »

Don't feel bad, I have found myself asking a question on some forums, that I actually answered several years previously.
Post Reply