Changed: Max plugins now share the same NeL context.

This commit is contained in:
kaetemi 2010-06-05 00:37:44 +02:00
parent cb176f9c1f
commit 196dc070e7
10 changed files with 87 additions and 17 deletions

View file

@ -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)

View file

@ -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)
{ {
@ -58,3 +61,13 @@ NEL_3DSMAX_SHARED_API CPatchAllocator& GetAllocator ()
return Allocator; return Allocator;
} }
NEL_3DSMAX_SHARED_API NLMISC::INelContext &GetSharedNelContext()
{
if (!NLMISC::INelContext::isContextInitialised())
{
new NLMISC::CApplicationContext();
NLMISC::createDebug();
}
return NLMISC::INelContext::getInstance();
}

View file

@ -14,6 +14,8 @@
// 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
@ -22,3 +24,4 @@
extern NEL_3DSMAX_SHARED_API CPatchAllocator& GetAllocator(); extern NEL_3DSMAX_SHARED_API CPatchAllocator& GetAllocator();
extern NEL_3DSMAX_SHARED_API NLMISC::INelContext &GetSharedNelContext();

View file

@ -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.

View file

@ -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.

View file

@ -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;

View file

@ -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;

View file

@ -1,4 +1,5 @@
#include "vertex_tree_paint.h" #include "vertex_tree_paint.h"
#include "../nel_3dsmax_shared/nel_3dsmax_shared.h"
HINSTANCE hInstance; HINSTANCE hInstance;
@ -6,6 +7,13 @@ 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) {

View file

@ -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)

View file

@ -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.