Skip to content

Commit

Permalink
remove Exocortex (remote diagnostic) and RLM (licensing) libraries to…
Browse files Browse the repository at this point in the history
… make it easier to port.
  • Loading branch information
bhouston committed Dec 12, 2014
1 parent eac88d9 commit 87737af
Show file tree
Hide file tree
Showing 28 changed files with 26 additions and 860 deletions.
1 change: 0 additions & 1 deletion 3DSMax/AlembicCurves.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
#include "AlembicXform.h"
#include "SceneEnumProc.h"
#include "utility.h"
#include "ExocortexCoreServicesAPI.h"
#include "AlembicMetadataUtils.h"
#include <surf_api.h>

Expand Down
1 change: 0 additions & 1 deletion 3DSMax/AlembicIntermediatePolyMesh.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#include "stdafx.h"
#include "AlembicIntermediatePolyMesh.h"
#include "ExocortexCoreServicesAPI.h"



Expand Down
142 changes: 0 additions & 142 deletions 3DSMax/AlembicLicensing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,94 +19,14 @@ using namespace std;
#define EC_ASSERT(a)
#endif


#include "RlmSingleton.h"

bool g_bVerboseLogging = false;

#if defined( EXOCORTEX_RLM_ONLY )
#include "RlmSingletonDeclarations.h"
#endif // EXOCORTEX_RLM_ONLY

boost::mutex gGlobalLock;

int s_alembicLicense = -1;

int GetAlembicLicense() {
return ALEMBIC_WRITER_LICENSE;
/*
boost::mutex::scoped_lock writeLock( gGlobalLock );
static string pluginName(PLUGIN_NAME);
if( s_alembicLicense != ALEMBIC_NO_LICENSE ) {
return s_alembicLicense;
}
#if MAX_PRODUCT_YEAR_NUMBER < 2013
bool bIsSlave = ( GET_MAX_INTERFACE()->InSlaveMode() > 0 );
#else
bool bIsSlave = (bool)GET_MAX_INTERFACE()->IsNetworkRenderServer();
#endif
bool isWriterLicense = !bIsSlave;
bool isForceReader = ( getenv("EXOCORTEX_ALEMBIC_FORCE_READER") != NULL );
bool isForceWriter = ( getenv("EXOCORTEX_ALEMBIC_FORCE_WRITER") != NULL );
bool isNoDemo = ( getenv("EXOCORTEX_ALEMBIC_NO_DEMO") != NULL );
if( isForceReader && isForceWriter ) {
ESS_LOG_ERROR( "Both environment variables EXOCORTEX_ALEMBIC_FORCE_READER and EXOCORTEX_ALEMBIC_FORCE_WRITER defined, these conflict" );
}
if( isWriterLicense ) {
if( isForceReader ) {
ESS_LOG_WARNING( "Environment variable EXOCORTEX_ALEMBIC_FORCE_READER defined, forcing usage of read-only license." );
isWriterLicense = false;
}
}
if( ! isWriterLicense ) {
if( isForceWriter ) {
ESS_LOG_WARNING( "Environment variable EXOCORTEX_ALEMBIC_FORCE_WRITER defined, forcing usage of write-capable license." );
isWriterLicense = true;
}
}
vector<RlmProductID> rlmProductIds;
int pluginLicenseResult;
if( isWriterLicense ) {
RlmProductID pluginLicenseIds[] = ALEMBIC_WRITER_LICENSE_IDS;
for( int i = 0; i < sizeof( pluginLicenseIds ) / sizeof( RlmProductID ); i ++ ) {
rlmProductIds.push_back( pluginLicenseIds[i] );
}
pluginLicenseResult = ALEMBIC_WRITER_LICENSE;
}
else {
RlmProductID pluginLicenseIds[] = ALEMBIC_READER_LICENSE_IDS;
for( int i = 0; i < sizeof( pluginLicenseIds ) / sizeof( RlmProductID ); i ++ ) {
rlmProductIds.push_back( pluginLicenseIds[i] );
}
pluginLicenseResult = ALEMBIC_READER_LICENSE;
}
ESS_LOG_INFO( "Looking for RLM license for " << pluginName << "..." );
Exocortex::RlmSingleton& rlmSingleton = Exocortex::RlmSingleton::getSingleton();
if( rlmSingleton.checkoutLicense( "", pluginName, rlmProductIds ) ) {
s_alembicLicense = pluginLicenseResult;
}
else {
if( isNoDemo ) {
s_alembicLicense = ALEMBIC_INVALID_LICENSE;
}
else {
s_alembicLicense = ALEMBIC_DEMO_LICENSE;
}
}
ESS_LOG_INFO( "writerLicense:"<<isWriterLicense<<" slave: "<<bIsSlave<<" forceReader: "<<isForceReader<<" forceWriter: "<<isForceWriter<<" noDemo: "<<isNoDemo<<" result: "<<s_alembicLicense);
return s_alembicLicense;*/
}

bool HasAlembicInvalidLicense() {
Expand All @@ -122,65 +42,3 @@ bool HasAlembicReaderLicense() {
}


#ifdef EXOCORTEX_SERVICES

void MaxLogSink(const char* szLogMessage, Exocortex::ecLogLevel::Value level ) {
switch( level ) {
case Exocortex::ecLogLevel::Info:
//mprintf( EC_UTF8_to_TCHAR( "Exocortex Alembic: %s\n" ), EC_UTF8_to_TCHAR( szLogMessage ) );
break;
case Exocortex::ecLogLevel::Warning:
mprintf( EC_UTF8_to_TCHAR( "Exocortex Alembic Warning: %s\n" ), EC_UTF8_to_TCHAR( szLogMessage ) );
break;
case Exocortex::ecLogLevel::Error:
mprintf( EC_UTF8_to_TCHAR( "Exocortex Alembic Error: %s\n" ), EC_UTF8_to_TCHAR( szLogMessage ) );
break;
}
}

// trick from: http://www.codeproject.com/KB/DLL/DLLModuleFileName.aspx
EXTERN_C IMAGE_DOS_HEADER __ImageBase;

namespace Exocortex {
void essOnDemandInitialization() {


char* loggingEnv = getenv("EXOCORTEX_ALEMBIC_VERBOSE_LOGGING");
if(loggingEnv){
g_bVerboseLogging = boost::iequals(loggingEnv, "true");
}

static string pluginName(PLUGIN_NAME);

char szTempPath[4096];
GetTempPathA( 4096, szTempPath );

char szLogPath[4096];
sprintf_s( szLogPath, 4096, "%sExocortexAlembic", szTempPath );

essInitialize( pluginName.c_str(), PLUGIN_MAJOR_VERSION, PLUGIN_MINOR_VERSION, szLogPath, MaxLogSink );
ESS_LOG_WARNING( "Exocortex Alembic logs location: " << szLogPath );
//ESS_LOG_INFO( "------------------------------------------------------------------------------------------" );
ESS_LOG_WARNING("Exocortex Crate "<<PLUGIN_MAJOR_VERSION<<"."<<PLUGIN_MINOR_VERSION<<"."<<crate_BUILD_VERSION);
ESS_LOG_WARNING( "Build date: " << __DATE__ << " " << __TIME__ );
OSVERSIONINFOEXA ver;
ZeroMemory(&ver, sizeof(OSVERSIONINFOEXA));
ver.dwOSVersionInfoSize = sizeof(ver);
if (GetVersionExA( (OSVERSIONINFOA*) &ver) != FALSE) {
char szOsVersion[4096];
sprintf_s(szOsVersion, 4096, "OS version: %d.%d.%d (%s) 0x%x-0x%x",
ver.dwMajorVersion, ver.dwMinorVersion, ver.dwBuildNumber,
ver.szCSDVersion, ver.wSuiteMask, ver.wProductType);
ESS_LOG_INFO( szOsVersion );
}
char szExePath[_MAX_PATH];
GetModuleFileNameA( NULL, szExePath, _MAX_PATH );
ESS_LOG_INFO( "Executable path: " << szExePath );

char szDllPath[_MAX_PATH];
GetModuleFileNameA((HINSTANCE)&__ImageBase, szDllPath, _MAX_PATH);
ESS_LOG_INFO( "Dll path: " << szDllPath );
ESS_LOG_INFO( "------------------------------------------------------------------------------------------" );
}
}
#endif // EXOCORTEX_SERVICES
10 changes: 0 additions & 10 deletions 3DSMax/AlembicLicensing.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@

//#include "ExocortexServicesProxy.h"

#define ALEMBIC_WRITER_LICENSE_IDS { RlmProductID( "alembic_3dsmax", 10 ), RlmProductID( "alembic", 10 ) }
#define ALEMBIC_READER_LICENSE_IDS { RlmProductID( "alembic_3dsmax", 10 ), RlmProductID( "alembic_reader", 10 ), RlmProductID( "alembic", 10 ) }

#define ALEMBIC_NO_LICENSE -1
#define ALEMBIC_DEMO_LICENSE 0
#define ALEMBIC_WRITER_LICENSE 1
Expand All @@ -33,12 +30,5 @@ bool HasAlembicInvalidLicense();
bool HasAlembicWriterLicense();
bool HasAlembicReaderLicense();

#if defined( EXOCORTEX_SERVICES )

#include "ExocortexCoreServicesAPI.h"

// insert 3DS MAX function wrappers here. TODO

#endif

#endif // __ALEMBIC_LICENSING_H
27 changes: 2 additions & 25 deletions 3DSMax/AlembicMAXScript.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include "AlembicXformUtilities.h"
#include "AlembicXformController.h"
#include "AlembicCameraUtilities.h"
#include "AlembicLicensing.h"
#include "AlembicParticles.h"
#include "SceneEnumProc.h"
#include "AlembicDefinitions.h"
Expand Down Expand Up @@ -384,7 +385,7 @@ int ExocortexAlembicStaticInterface::ExocortexHasModifierErrorOccurred()

int ExocortexAlembicStaticInterface::ExocortexMemoryDiagnostics()
{
Exocortex::essLogWarning( "Exocortex Memory Diagnostics -----------------------------------------------------" );
ESS_LOG_WARNING( "Exocortex Memory Diagnostics -----------------------------------------------------" );
#ifdef _DEBUG
//Exocortex::essLogActiveAllocations();
#endif
Expand Down Expand Up @@ -628,33 +629,21 @@ int ExocortexAlembicStaticInterface_ExocortexAlembicImportJobs( CONST_2013 MCHAR

} catch( boost::exception& e ) {
ESS_LOG_ERROR(__FILE__ << "(line " << __LINE__ << "). A boost::exception occurred: " << boost::diagnostic_information(e) );
Exocortex::essLogStackTrace();
Exocortex::essSendErrorReport( "boost::exception" );
GET_MAX_INTERFACE()->ProgressEnd();
InstanceMap_Clear();
return alembic_failure;
} catch ( std::exception& e ) {
ESS_LOG_ERROR(__FILE__ << "(line " << __LINE__ << "). An std::exception occurred: " << e.what());
Exocortex::essLogStackTrace();
char szBuffer[1024*4];
sprintf_s( szBuffer, 1024*4, "std::exception: %s", e.what() );
Exocortex::essSendErrorReport( szBuffer );
GET_MAX_INTERFACE()->ProgressEnd();
InstanceMap_Clear();
return alembic_failure;
} catch( std::string& str ) {
ESS_LOG_ERROR(__FILE__ << "(line " << __LINE__ << "). A string exception was thrown: " << str);
Exocortex::essLogStackTrace();
char szBuffer[1024*4];
sprintf_s( szBuffer, 1024*4, "C++ String Exception: %s", str.c_str() );
Exocortex::essSendErrorReport( szBuffer );
GET_MAX_INTERFACE()->ProgressEnd();
InstanceMap_Clear();
return alembic_failure;
} catch (...) {
ESS_LOG_ERROR(__FILE__ << "(line " << __LINE__ << "). An unknown error occurred");
Exocortex::essLogStackTrace();
Exocortex::essSendErrorReport( "unknown C++ exception" );
GET_MAX_INTERFACE()->ProgressEnd();
InstanceMap_Clear();
return alembic_failure;
Expand Down Expand Up @@ -1052,30 +1041,18 @@ int ExocortexAlembicStaticInterface_ExocortexAlembicExportJobs( CONST_2013 MCHAR

} catch( boost::exception& e ) {
ESS_LOG_ERROR(__FILE__ << "(line " << __LINE__ << "). A boost::exception occurred: " << boost::diagnostic_information(e) );
Exocortex::essLogStackTrace();
Exocortex::essSendErrorReport( "boost::exception" );
GET_MAX_INTERFACE()->ProgressEnd();
return alembic_failure;
} catch ( std::exception& e ) {
ESS_LOG_ERROR(__FILE__ << "(line " << __LINE__ << "). An std::exception occurred: " << e.what());
Exocortex::essLogStackTrace();
char szBuffer[1024*4];
sprintf_s( szBuffer, 1024*4, "std::exception: %s", e.what() );
Exocortex::essSendErrorReport( szBuffer );
GET_MAX_INTERFACE()->ProgressEnd();
return alembic_failure;
} catch( std::string& str ) {
ESS_LOG_ERROR(__FILE__ << "(line " << __LINE__ << "). A string exception was thrown: " << str);
Exocortex::essLogStackTrace();
char szBuffer[1024*4];
sprintf_s( szBuffer, 1024*4, "C++ String Exception: %s", str.c_str() );
Exocortex::essSendErrorReport( szBuffer );
GET_MAX_INTERFACE()->ProgressEnd();
return alembic_failure;
} catch (...) {
ESS_LOG_ERROR(__FILE__ << "(line " << __LINE__ << "). An unknown error occurred");
Exocortex::essLogStackTrace();
Exocortex::essSendErrorReport( "unknown C++ exception" );
GET_MAX_INTERFACE()->ProgressEnd();
return alembic_failure;
}
Expand Down
1 change: 0 additions & 1 deletion 3DSMax/AlembicParticlesExtInterface.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#include "ExocortexCoreServicesAPI.h"
#include <IParticleObjectExt.h>

class AlembicParticles;
Expand Down
32 changes: 0 additions & 32 deletions 3DSMax/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,11 @@ project ( Max${Max_VERSION}ExocortexAlembic${crate_VERSION} )

INCLUDE(../../ExocortexCMakeShared.txt NO_POLICY_SCOPE)

if( Exocortex_SERVICES OR Exocortex_RLM_ONLY )
include_directories( ${Rlm_INCLUDE_DIR} )
include_directories( ${Exocortex_INCLUDE_DIR} )
endif()

if( Exocortex_SERVICES )
add_definitions( "-DEXOCORTEX_SERVICES" )
endif()

#add_definitions( "-DEXOCORTEX_BETA_EXPIRY_DATE=1343692800" ) # 1343692800 - July 31, 2012
add_definitions( -D_SCL_SECURE_NO_WARNINGS )
add_definitions( -D_CRT_SECURE_NO_WARNINGS )
add_definitions( -Dcrate_Max_Version=${Max_VERSION} )



if( Max_VERSION MATCHES "2013")
add_definitions( -D_UNICODE )
add_definitions( -DUNICODE )
Expand Down Expand Up @@ -94,14 +83,6 @@ SOURCE_GROUP("_Maxscripts" FILES ${Scripts})

setup_precompiled_header( ${BASE_DIR} ${Sources} )

if( Exocortex_SERVICES OR Exocortex_RLM_ONLY )
include_directories( ${Rlm_INCLUDE_DIR} )
include_directories( ${Exocortex_INCLUDE_DIR} )
endif()

if( Exocortex_SERVICES OR Exocortex_RLM_ONLY )
link_directories( ${Rlm_LIBRARYDIR} )
endif()

IF( WIN32 )
IF( ${ALEMBIC64} )
Expand All @@ -128,24 +109,15 @@ link_directories( ${TP_DIR_LIBRARY} )
include_directories( ${TPL_DIR_INCLUDE} )
link_directories( ${TPL_DIR_LIBRARY} )

if( Exocortex_RLM_ONLY )
link_directories( ${Rlm_LIBRARYDIR} )
endif()

add_library( ${PROJECT_NAME} SHARED ${Sources} ${Includes} ${LOCAL_CMAKE_FILE_NAME} ${Scripts} )

TARGET_LINK_LIBRARIES( ${PROJECT_NAME}
CommonUtils
${Exocortex_LIBRARIES}
${ALL_ALEMBIC_LIBS}
${3DSMAX_LIBRARIES}
${Rlm_LIBRARIES}
)
ADD_DEPENDENCIES( ${PROJECT_NAME} AlembicAbcGeom )




SET_TARGET_PROPERTIES( ${PROJECT_NAME} PROPERTIES SUFFIX ".dlu" )

set( PluginDirectory "${CMAKE_CURRENT_SOURCE_DIR}/Plugin" )
Expand All @@ -156,7 +128,6 @@ copy_directory( "${BASE_DIR}/MaxScripts" ${PluginDirectory} )
get_target_property( OutputFilePath ${PROJECT_NAME} LOCATION )

copy_file_to_directory( ${OutputFilePath} ${PluginDirectory} )
copy_file_to_directory( ${RER_DEPENDENCIES} ${PluginDirectory} )

SET( Install_DIR ${Exocortex_INSTALL_BASE_DIR}/Max${Max_VERSION}/ )

Expand All @@ -166,6 +137,3 @@ copy_directory( "${BASE_DIR}/MaxScripts" ${Install_DIR} )

get_target_property( Install_TARGET ${PROJECT_NAME} LOCATION )
copy_file_to_directory( ${Install_TARGET} ${Install_DIR} )

copy_file_to_directory( ${RER_DEPENDENCIES} ${Install_DIR} )
copy_file_to_directory( ${EAH_DEPENDENCIES} ${Install_DIR} )
25 changes: 0 additions & 25 deletions 3DSMax/ExocortexServicesProxy.h

This file was deleted.

1 change: 0 additions & 1 deletion 3DSMax/alembic.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#ifndef _ALEMBIC_H_
#define _ALEMBIC_H_

#include "ExocortexCoreServicesAPI.h"
#include "AlembicDefinitions.h"
#include "AlembicLicensing.h"

Expand Down
Loading

0 comments on commit 87737af

Please sign in to comment.