mirror of
https://port.numenaute.org/aleajactaest/khanat-code-old.git
synced 2024-11-22 23:06:18 +00:00
Changed: Max plugins now share the same NeL context.
This commit is contained in:
parent
9fdb2b48de
commit
6ded4286b3
10 changed files with 87 additions and 17 deletions
|
@ -12,6 +12,8 @@
|
|||
**********************************************************************/
|
||||
#include "ligoscape_utility.h"
|
||||
#include "nel/misc/app_context.h"
|
||||
#include <nel/misc/debug.h>
|
||||
#include "../../plugin_max/nel_3dsmax_shared/nel_3dsmax_shared.h"
|
||||
|
||||
extern ClassDesc2* GetLigoscapeDesc();
|
||||
|
||||
|
@ -26,6 +28,13 @@ int controlsInit = FALSE;
|
|||
|
||||
BOOL WINAPI DllMain(HINSTANCE hinstDLL,ULONG fdwReason,LPVOID lpvReserved)
|
||||
{
|
||||
// initialize nel context
|
||||
if (!NLMISC::INelContext::isContextInitialised())
|
||||
{
|
||||
new NLMISC::CLibraryContext(GetSharedNelContext());
|
||||
nldebug("NeL Ligoscape Utility: DllMain");
|
||||
}
|
||||
|
||||
hInstance = hinstDLL; // Hang on to this DLL's instance handle.
|
||||
|
||||
if (!controlsInit)
|
||||
|
|
|
@ -27,7 +27,10 @@ BOOL APIENTRY DllMain( HANDLE hModule,
|
|||
{
|
||||
// initialize nel context
|
||||
if (!NLMISC::INelContext::isContextInitialised())
|
||||
new NLMISC::CApplicationContext();
|
||||
{
|
||||
GetSharedNelContext();
|
||||
nldebug("NeL 3ds Max Shared: DllMain");
|
||||
}
|
||||
|
||||
switch (ul_reason_for_call)
|
||||
{
|
||||
|
@ -51,10 +54,20 @@ void init ()
|
|||
// The static allocator
|
||||
static CPatchAllocator Allocator;
|
||||
|
||||
NEL_3DSMAX_SHARED_API CPatchAllocator& GetAllocator ()
|
||||
NEL_3DSMAX_SHARED_API CPatchAllocator &GetAllocator ()
|
||||
{
|
||||
// Init fonction
|
||||
init ();
|
||||
|
||||
return Allocator;
|
||||
}
|
||||
|
||||
NEL_3DSMAX_SHARED_API NLMISC::INelContext &GetSharedNelContext()
|
||||
{
|
||||
if (!NLMISC::INelContext::isContextInitialised())
|
||||
{
|
||||
new NLMISC::CApplicationContext();
|
||||
NLMISC::createDebug();
|
||||
}
|
||||
return NLMISC::INelContext::getInstance();
|
||||
}
|
||||
|
|
|
@ -14,11 +14,14 @@
|
|||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
class CPatchAllocator;
|
||||
|
||||
#ifdef NEL_3DSMAX_SHARED_EXPORTS
|
||||
#define NEL_3DSMAX_SHARED_API __declspec(dllexport)
|
||||
#else
|
||||
#define NEL_3DSMAX_SHARED_API __declspec(dllimport)
|
||||
#endif
|
||||
|
||||
extern NEL_3DSMAX_SHARED_API CPatchAllocator& GetAllocator ();
|
||||
extern NEL_3DSMAX_SHARED_API CPatchAllocator& GetAllocator();
|
||||
|
||||
extern NEL_3DSMAX_SHARED_API NLMISC::INelContext &GetSharedNelContext();
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
#include "nel_export.h"
|
||||
#include "nel/3d/register_3d.h"
|
||||
#include "nel/misc/app_context.h"
|
||||
#include "../nel_3dsmax_shared/nel_3dsmax_shared.h"
|
||||
|
||||
|
||||
extern ClassDesc2* GetCNelExportDesc();
|
||||
|
@ -30,7 +31,10 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL,ULONG fdwReason,LPVOID lpvReserved)
|
|||
{
|
||||
// initialize nel context
|
||||
if (!NLMISC::INelContext::isContextInitialised())
|
||||
new NLMISC::CApplicationContext();
|
||||
{
|
||||
new NLMISC::CLibraryContext(GetSharedNelContext());
|
||||
nldebug("NeL Export: DllMain");
|
||||
}
|
||||
|
||||
hInstance = hinstDLL; // Hang on to this DLL's instance handle.
|
||||
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
#include "PO2RPO.h"
|
||||
#include "nel/misc/debug.h"
|
||||
#include "nel/misc/app_context.h"
|
||||
#include "../nel_3dsmax_shared/nel_3dsmax_shared.h"
|
||||
|
||||
extern ClassDesc2* GetPO2RPODesc();
|
||||
extern ClassDesc* GetRPODesc();
|
||||
|
@ -38,6 +39,12 @@ int controlsInit = FALSE;
|
|||
|
||||
BOOL WINAPI DllMain(HINSTANCE hinstDLL,ULONG fdwReason,LPVOID lpvReserved)
|
||||
{
|
||||
if (!NLMISC::INelContext::isContextInitialised())
|
||||
{
|
||||
new NLMISC::CLibraryContext(GetSharedNelContext());
|
||||
nldebug("NeL Export: DllMain");
|
||||
}
|
||||
|
||||
if(fdwReason == DLL_PROCESS_ATTACH)
|
||||
{
|
||||
// Hang on to this DLL's instance handle.
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
#include "editpat.h"
|
||||
|
||||
#include <nel/misc/debug.h>
|
||||
#include "../nel_3dsmax_shared/nel_3dsmax_shared.h"
|
||||
|
||||
HINSTANCE hInstance;
|
||||
int controlsInit = FALSE;
|
||||
|
@ -24,6 +25,13 @@ using namespace NLMISC;
|
|||
/** public functions **/
|
||||
BOOL WINAPI DllMain(HINSTANCE hinstDLL,ULONG fdwReason,LPVOID lpvReserved)
|
||||
{
|
||||
// initialize nel context
|
||||
if (!NLMISC::INelContext::isContextInitialised())
|
||||
{
|
||||
new NLMISC::CLibraryContext(GetSharedNelContext());
|
||||
nldebug("NeL Patch Edit: DllMain");
|
||||
}
|
||||
|
||||
if (fdwReason == DLL_PROCESS_ATTACH)
|
||||
{
|
||||
hInstance = hinstDLL;
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
#include "nel_patch_paint.h"
|
||||
#include "nel/misc/debug.h"
|
||||
#include "nel/misc/app_context.h"
|
||||
#include "../nel_3dsmax_shared/nel_3dsmax_shared.h"
|
||||
|
||||
HINSTANCE hInstance;
|
||||
int controlsInit = FALSE;
|
||||
|
@ -13,7 +14,10 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL,ULONG fdwReason,LPVOID lpvReserved)
|
|||
{
|
||||
// initialize nel context
|
||||
if (!NLMISC::INelContext::isContextInitialised())
|
||||
new NLMISC::CApplicationContext();
|
||||
{
|
||||
new NLMISC::CLibraryContext(GetSharedNelContext());
|
||||
nldebug("NeL Patch Paint: DllMain");
|
||||
}
|
||||
|
||||
hInstance = hinstDLL;
|
||||
|
||||
|
|
|
@ -1,11 +1,19 @@
|
|||
#include "vertex_tree_paint.h"
|
||||
#include "../nel_3dsmax_shared/nel_3dsmax_shared.h"
|
||||
|
||||
|
||||
HINSTANCE hInstance;
|
||||
|
||||
|
||||
BOOL WINAPI DllMain(HINSTANCE hinstDLL,ULONG fdwReason,LPVOID lpvReserved)
|
||||
{
|
||||
// initialize nel context
|
||||
if (!NLMISC::INelContext::isContextInitialised())
|
||||
{
|
||||
new NLMISC::CLibraryContext(GetSharedNelContext());
|
||||
nldebug("NeL Vertex Tree Paint: DllMain");
|
||||
}
|
||||
|
||||
hInstance = hinstDLL; // Hang on to this DLL's instance handle.
|
||||
|
||||
switch (fdwReason) {
|
||||
|
@ -16,31 +24,31 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL,ULONG fdwReason,LPVOID lpvReserved)
|
|||
}
|
||||
|
||||
return (TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
__declspec( dllexport ) const TCHAR* LibDescription()
|
||||
{
|
||||
{
|
||||
return GetString(IDS_LIBDESCRIPTION);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
__declspec( dllexport ) int LibNumberClasses()
|
||||
{
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
__declspec( dllexport ) ClassDesc* LibClassDesc(int i)
|
||||
{
|
||||
{
|
||||
switch(i) {
|
||||
case 0: return GetVertexPaintDesc();
|
||||
default: return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
__declspec( dllexport ) ULONG LibVersion()
|
||||
{
|
||||
{
|
||||
return VERSION_3DSMAX;
|
||||
}
|
||||
}
|
||||
|
||||
// Let the plug-in register itself for deferred loading
|
||||
__declspec( dllexport ) ULONG CanAutoDefer()
|
||||
|
@ -49,11 +57,11 @@ __declspec( dllexport ) ULONG CanAutoDefer()
|
|||
}
|
||||
|
||||
TCHAR *GetString(int id)
|
||||
{
|
||||
{
|
||||
static TCHAR buf[256];
|
||||
|
||||
if (hInstance)
|
||||
return LoadString(hInstance, id, buf, sizeof(buf)) ? buf : NULL;
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -19,6 +19,15 @@
|
|||
#include "istdplug.h"
|
||||
#include "modstack.h"
|
||||
|
||||
#ifdef min
|
||||
#undef min
|
||||
#endif
|
||||
#ifdef max
|
||||
#undef max
|
||||
#endif
|
||||
#define NL_MAP_ASSERT
|
||||
#include <nel/misc/debug.h>
|
||||
|
||||
|
||||
#define VERTEX_TREE_PAINT_CLASS_ID Class_ID(0x40c7005e, 0x2a95082c)
|
||||
#define CID_PAINT (CID_USER+0x439c)
|
||||
|
|
|
@ -16,7 +16,9 @@
|
|||
|
||||
#include "tile_utility.h"
|
||||
#include <nel/misc/common.h>
|
||||
#include <nel/misc/debug.h>
|
||||
#include "nel/misc/app_context.h"
|
||||
#include "../nel_3dsmax_shared/nel_3dsmax_shared.h"
|
||||
#include <vector>
|
||||
|
||||
extern ClassDesc2* GetTile_utilityDesc();
|
||||
|
@ -35,7 +37,10 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL,ULONG fdwReason,LPVOID lpvReserved)
|
|||
{
|
||||
// initialize nel context
|
||||
if (!NLMISC::INelContext::isContextInitialised())
|
||||
new NLMISC::CApplicationContext();
|
||||
{
|
||||
new NLMISC::CLibraryContext(GetSharedNelContext());
|
||||
nldebug("NeL Tile Utility: DllMain");
|
||||
}
|
||||
|
||||
hInstance = hinstDLL; // Hang on to this DLL's instance handle.
|
||||
|
||||
|
|
Loading…
Reference in a new issue