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