remove useless export. focus on main goal

This commit is contained in:
yyc12345 2023-02-19 14:47:10 +08:00
parent c02679fd9e
commit 44bb2eae02
11 changed files with 137 additions and 329 deletions

15
.gitignore vendored
View File

@ -1,15 +1,18 @@
## Ignore Visual Studio temporary files, build results, and # ============== My Options ==============
## files generated by popular Visual Studio add-ons.
##
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
# ignore generated Virtools.props # ignore generated Virtools.props
SuperScriptMaterializer/Virtools.props SuperScriptMaterializer/Virtools.props
GPVirtoolsStatic/Virtools.props
# ignore generated database # ignore generated database
*.db *.db
*.db-journal *.db-journal
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
##
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
# User-specific files # User-specific files
*.rsuser *.rsuser
*.suo *.suo
@ -363,3 +366,7 @@ MigrationBackup/
# Ionide (cross platform F# VS Code tools) working folder # Ionide (cross platform F# VS Code tools) working folder
.ionide/ .ionide/
# ============== My Options ==============
# force adding debug profile for SuperScriptMaterializer
!SuperScriptMaterializer/SuperScriptMaterializer.vcxproj.user

View File

@ -1,14 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ImportGroup Label="PropertySheets"/>
<PropertyGroup Label="UserMacros">
<BML_REPOSITORY>D:\BallanceModLoader</BML_REPOSITORY>
</PropertyGroup>
<PropertyGroup/>
<ItemDefinitionGroup/>
<ItemGroup>
<BuildMacro Include="BML_REPOSITORY">
<Value>$(BML_REPOSITORY)</Value>
</BuildMacro>
</ItemGroup>
</Project>

View File

@ -20,14 +20,14 @@
<PlatformToolset>v142</PlatformToolset> <PlatformToolset>v142</PlatformToolset>
<UseOfMfc>Dynamic</UseOfMfc> <UseOfMfc>Dynamic</UseOfMfc>
<CharacterSet>MultiByte</CharacterSet> <CharacterSet>MultiByte</CharacterSet>
<ConfigurationType>Application</ConfigurationType></PropertyGroup> <ConfigurationType>DynamicLibrary</ConfigurationType></PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<UseDebugLibraries>false</UseDebugLibraries> <UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset> <PlatformToolset>v142</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization> <WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet> <CharacterSet>MultiByte</CharacterSet>
<UseOfMfc>Dynamic</UseOfMfc> <UseOfMfc>Dynamic</UseOfMfc>
<ConfigurationType>Application</ConfigurationType></PropertyGroup> <ConfigurationType>DynamicLibrary</ConfigurationType></PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props"/> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props"/>
<ImportGroup Label="ExtensionSettings"> <ImportGroup Label="ExtensionSettings">
</ImportGroup> </ImportGroup>

View File

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LocalDebuggerCommand>$(VIRTOOLS_DEBUG_TARGET)</LocalDebuggerCommand>
<LocalDebuggerCommandArguments>$(VIRTOOLS_DEBUG_COMMANDLINE)</LocalDebuggerCommandArguments>
<LocalDebuggerWorkingDirectory>$(VIRTOOLS_DEBUG_ROOT)</LocalDebuggerWorkingDirectory>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LocalDebuggerCommand>$(VIRTOOLS_DEBUG_TARGET)</LocalDebuggerCommand>
<LocalDebuggerCommandArguments>$(VIRTOOLS_DEBUG_COMMANDLINE)</LocalDebuggerCommandArguments>
<LocalDebuggerWorkingDirectory>$(VIRTOOLS_DEBUG_ROOT)</LocalDebuggerWorkingDirectory>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
</PropertyGroup>
</Project>

View File

@ -10,8 +10,7 @@ namespace SSMaterializer {
script_bIn(), script_bOut(), script_bLink(), script_bIn(), script_bOut(), script_bLink(),
script_pIn(), script_pOut(), script_pLink(), script_eLink(), script_pIn(), script_pOut(), script_pLink(), script_eLink(),
script_pLocal(), script_pTarget(), script_pAttr(), script_pLocal(), script_pTarget(), script_pAttr(),
msg(), msg(), obj(),
_array(), array_header(), array_cell(),
data() { data() {
param_manager = paramManager; param_manager = paramManager;
} }
@ -118,7 +117,7 @@ namespace SSMaterializer {
#pragma region sub-database constructor, deconstructor and help functions #pragma region sub-database constructor, deconstructor and help functions
DocumentDatabase::DocumentDatabase(const char* file, CKParameterManager* paramManager) : DocumentDatabase::DocumentDatabase(const char* file, CKParameterManager* paramManager) :
SSMaterializerDatabase(), mUniqueAttr(), mUniqueObj(), mDbHelper(paramManager) { SSMaterializerDatabase(), mUniqueAttr(), /*mUniqueObj(), */mDbHelper(paramManager) {
FakeConstructor(file); FakeConstructor(file);
} }
@ -147,17 +146,17 @@ namespace SSMaterializer {
} }
} }
BOOL DocumentDatabase::is_obj_duplicated(DataStruct::EXPAND_CK_ID parents) { //BOOL DocumentDatabase::is_obj_duplicated(DataStruct::EXPAND_CK_ID parents) {
// check duplication // // check duplication
if (mUniqueObj.find(parents) != mUniqueObj.end()) { // if (mUniqueObj.find(parents) != mUniqueObj.end()) {
//existing item. skip it to make sure unique // //existing item. skip it to make sure unique
return TRUE; // return TRUE;
} else { // } else {
//add this item // //add this item
mUniqueObj.insert(parents); // mUniqueObj.insert(parents);
return FALSE; // return FALSE;
} // }
} //}
#pragma endregion #pragma endregion
@ -190,10 +189,7 @@ if (result != SQLITE_OK) { return FALSE; }
SafeSqlExec("CREATE TABLE [script_pAttr] ([thisobj] INTEGER, [name] TEXT, [type] TEXT, [type_guid] TEXT);"); SafeSqlExec("CREATE TABLE [script_pAttr] ([thisobj] INTEGER, [name] TEXT, [type] TEXT, [type_guid] TEXT);");
SafeSqlExec("CREATE TABLE [msg] ([index] INTEGER, [name] TEXT);"); SafeSqlExec("CREATE TABLE [msg] ([index] INTEGER, [name] TEXT);");
SafeSqlExec("CREATE TABLE [obj] ([id] INTEGER, [name] TEXT, [classid] INTEGER, [classtype] TEXT);");
SafeSqlExec("CREATE TABLE [array] ([thisobj] INTEGER, [name] TEXT, [rows] INTEGER, [columns] INTEGER);");
SafeSqlExec("CREATE TABLE [array_header] ([index] INTEGER, [name] TEXT, [type] INTEGER, [param_type] TEXT, [param_type_guid] TEXT, [parent] INTEGER);");
SafeSqlExec("CREATE TABLE [array_cell] ([row] INTEGER, [column] INTEGER, [showcase] TEXT, [inner_param] INTEGER, [parent] INTEGER);");
SafeSqlExec("CREATE TABLE [data] ([field] TEXT, [data] TEXT, [parent] INTEGER);"); SafeSqlExec("CREATE TABLE [data] ([field] TEXT, [data] TEXT, [parent] INTEGER);");
@ -482,45 +478,16 @@ if (stmt == NULL) { \
sqlite3_step(stmt); sqlite3_step(stmt);
} }
void DocumentDatabase::write_array(DataStruct::dbdoc_array& data) { void DocumentDatabase::write_obj(DataStruct::dbdoc_obj& data) {
if (mDb == NULL) return; if (mDb == NULL) return;
TryGetStmtCache("INSERT INTO [array] VALUES (?, ?, ?, ?)"); TryGetStmtCache("INSERT INTO [obj] VALUES (?, ?, ?, ?)");
sqlite3_reset(stmt); sqlite3_reset(stmt);
sqlite3_bind_int(stmt, 1, data.thisobj); sqlite3_bind_int(stmt, 1, data.id);
sqlite3_bind_text(stmt, 2, data.name.c_str(), -1, SQLITE_TRANSIENT); sqlite3_bind_text(stmt, 2, data.name.c_str(), -1, SQLITE_TRANSIENT);
sqlite3_bind_int(stmt, 3, data.rows); sqlite3_bind_int(stmt, 3, data.classid);
sqlite3_bind_int(stmt, 4, data.columns); sqlite3_bind_text(stmt, 4, data.classtype.c_str(), -1, SQLITE_TRANSIENT);
sqlite3_step(stmt);
}
void DocumentDatabase::write_array_header(DataStruct::dbdoc_array_header& data) {
if (mDb == NULL) return;
TryGetStmtCache("INSERT INTO [array_header] VALUES (?, ?, ?, ?, ?, ?)");
sqlite3_reset(stmt);
sqlite3_bind_int(stmt, 1, data.index);
sqlite3_bind_text(stmt, 2, data.name.c_str(), -1, SQLITE_TRANSIENT);
sqlite3_bind_int(stmt, 3, data.type);
sqlite3_bind_text(stmt, 4, data.param_type.c_str(), -1, SQLITE_TRANSIENT);
sqlite3_bind_text(stmt, 5, data.param_type_guid.c_str(), -1, SQLITE_TRANSIENT);
sqlite3_bind_int(stmt, 6, data.parent);
sqlite3_step(stmt);
}
void DocumentDatabase::write_array_cell(DataStruct::dbdoc_array_cell& data) {
if (mDb == NULL) return;
TryGetStmtCache("INSERT INTO [array_cell] VALUES (?, ?, ?, ?, ?)");
sqlite3_reset(stmt);
sqlite3_bind_int(stmt, 1, data.row);
sqlite3_bind_int(stmt, 2, data.column);
sqlite3_bind_text(stmt, 3, data.showcase.c_str(), -1, SQLITE_TRANSIENT);
sqlite3_bind_int(stmt, 4, data.inner_param);
sqlite3_bind_int(stmt, 5, data.parent);
sqlite3_step(stmt); sqlite3_step(stmt);
} }

View File

@ -154,28 +154,11 @@ namespace SSMaterializer {
std::string name; std::string name;
}; };
struct dbdoc_array { struct dbdoc_obj {
EXPAND_CK_ID thisobj; EXPAND_CK_ID id;
std::string name; std::string name;
int rows; CK_CLASSID classid;
int columns; std::string classtype;
};
struct dbdoc_array_header {
int index;
std::string name;
CK_ARRAYTYPE type;
std::string param_type;
std::string param_type_guid;
EXPAND_CK_ID parent;
};
struct dbdoc_array_cell {
int row;
int column;
std::string showcase;
EXPAND_CK_ID inner_param;
EXPAND_CK_ID parent;
}; };
struct dbdoc_data { struct dbdoc_data {
@ -278,10 +261,7 @@ namespace SSMaterializer {
dbdoc_script_pTarget script_pTarget; dbdoc_script_pTarget script_pTarget;
dbdoc_msg msg; dbdoc_msg msg;
dbdoc_obj obj;
dbdoc_array _array;
dbdoc_array_header array_header;
dbdoc_array_cell array_cell;
dbdoc_data data; dbdoc_data data;
}; };
@ -341,22 +321,19 @@ namespace SSMaterializer {
void write_script_pAttr(DataStruct::dbdoc_script_pAttr& data); void write_script_pAttr(DataStruct::dbdoc_script_pAttr& data);
void write_msg(DataStruct::dbdoc_msg& data); void write_msg(DataStruct::dbdoc_msg& data);
void write_obj(DataStruct::dbdoc_obj& data);
void write_array(DataStruct::dbdoc_array& data);
void write_array_header(DataStruct::dbdoc_array_header& data);
void write_array_cell(DataStruct::dbdoc_array_cell& data);
void write_data(DataStruct::dbdoc_data& data); void write_data(DataStruct::dbdoc_data& data);
BOOL is_attr_duplicated(DataStruct::EXPAND_CK_ID parents); BOOL is_attr_duplicated(DataStruct::EXPAND_CK_ID parents);
BOOL is_obj_duplicated(DataStruct::EXPAND_CK_ID parents); //BOOL is_obj_duplicated(DataStruct::EXPAND_CK_ID parents);
protected: protected:
virtual BOOL Init() override; virtual BOOL Init() override;
virtual BOOL Finalize() override; virtual BOOL Finalize() override;
std::set<DataStruct::EXPAND_CK_ID> mUniqueAttr; std::set<DataStruct::EXPAND_CK_ID> mUniqueAttr;
std::set<DataStruct::EXPAND_CK_ID> mUniqueObj; //std::set<DataStruct::EXPAND_CK_ID> mUniqueObj;
}; };
class EnvironmentDatabase : public SSMaterializerDatabase { class EnvironmentDatabase : public SSMaterializerDatabase {

View File

@ -219,9 +219,9 @@ namespace SSMaterializer {
void Proc_pTarget(CKContext* ctx, CKParameterIn* cache, Database::DocumentDatabase* mDb, DataStruct::EXPAND_CK_ID parents, DataStruct::EXPAND_CK_ID grandparents) { void Proc_pTarget(CKContext* ctx, CKParameterIn* cache, Database::DocumentDatabase* mDb, DataStruct::EXPAND_CK_ID parents, DataStruct::EXPAND_CK_ID grandparents) {
mDb->mDbHelper.script_pTarget.thisobj = cache->GetID(); mDb->mDbHelper.script_pTarget.thisobj = cache->GetID();
CopyCKString(mDb->mDbHelper.script_pTarget.name, cache->GetName()); Utils::CopyCKString(mDb->mDbHelper.script_pTarget.name, cache->GetName());
CopyCKParamTypeStr(mDb->mDbHelper.script_pTarget.type, cache->GetType(), mDb->mDbHelper.param_manager); Utils::CopyCKParamTypeStr(mDb->mDbHelper.script_pTarget.type, cache->GetType(), mDb->mDbHelper.param_manager);
CopyGuid(mDb->mDbHelper.script_pTarget.type_guid, cache->GetGUID()); Utils::CopyGuid(mDb->mDbHelper.script_pTarget.type_guid, cache->GetGUID());
mDb->mDbHelper.script_pTarget.parent = parents; mDb->mDbHelper.script_pTarget.parent = parents;
mDb->mDbHelper.script_pTarget.direct_source = cache->GetDirectSource() ? cache->GetDirectSource()->GetID() : -1; mDb->mDbHelper.script_pTarget.direct_source = cache->GetDirectSource() ? cache->GetDirectSource()->GetID() : -1;
mDb->mDbHelper.script_pTarget.shared_source = cache->GetSharedSource() ? cache->GetSharedSource()->GetID() : -1; mDb->mDbHelper.script_pTarget.shared_source = cache->GetSharedSource() ? cache->GetSharedSource()->GetID() : -1;
@ -235,9 +235,9 @@ namespace SSMaterializer {
void Proc_pIn(CKContext* ctx, CKParameterIn* cache, Database::DocumentDatabase* mDb, DataStruct::EXPAND_CK_ID parents, DataStruct::EXPAND_CK_ID grandparents, int index, BOOL executedFromBB) { void Proc_pIn(CKContext* ctx, CKParameterIn* cache, Database::DocumentDatabase* mDb, DataStruct::EXPAND_CK_ID parents, DataStruct::EXPAND_CK_ID grandparents, int index, BOOL executedFromBB) {
mDb->mDbHelper.script_pIn.thisobj = cache->GetID(); mDb->mDbHelper.script_pIn.thisobj = cache->GetID();
mDb->mDbHelper.script_pIn.index = index; mDb->mDbHelper.script_pIn.index = index;
CopyCKString(mDb->mDbHelper.script_pIn.name, cache->GetName()); Utils::CopyCKString(mDb->mDbHelper.script_pIn.name, cache->GetName());
CopyCKParamTypeStr(mDb->mDbHelper.script_pIn.type, cache->GetType(), mDb->mDbHelper.param_manager); Utils::CopyCKParamTypeStr(mDb->mDbHelper.script_pIn.type, cache->GetType(), mDb->mDbHelper.param_manager);
CopyGuid(mDb->mDbHelper.script_pIn.type_guid, cache->GetGUID()); Utils::CopyGuid(mDb->mDbHelper.script_pIn.type_guid, cache->GetGUID());
mDb->mDbHelper.script_pIn.parent = parents; mDb->mDbHelper.script_pIn.parent = parents;
mDb->mDbHelper.script_pIn.direct_source = cache->GetDirectSource() ? cache->GetDirectSource()->GetID() : -1; mDb->mDbHelper.script_pIn.direct_source = cache->GetDirectSource() ? cache->GetDirectSource()->GetID() : -1;
mDb->mDbHelper.script_pIn.shared_source = cache->GetSharedSource() ? cache->GetSharedSource()->GetID() : -1; mDb->mDbHelper.script_pIn.shared_source = cache->GetSharedSource() ? cache->GetSharedSource()->GetID() : -1;
@ -252,9 +252,9 @@ namespace SSMaterializer {
void Proc_pOut(CKContext* ctx, CKParameterOut* cache, Database::DocumentDatabase* mDb, DataStruct::EXPAND_CK_ID parents, DataStruct::EXPAND_CK_ID grandparents, int index, BOOL executedFromBB) { void Proc_pOut(CKContext* ctx, CKParameterOut* cache, Database::DocumentDatabase* mDb, DataStruct::EXPAND_CK_ID parents, DataStruct::EXPAND_CK_ID grandparents, int index, BOOL executedFromBB) {
mDb->mDbHelper.script_pOut.thisobj = cache->GetID(); mDb->mDbHelper.script_pOut.thisobj = cache->GetID();
mDb->mDbHelper.script_pOut.index = index; mDb->mDbHelper.script_pOut.index = index;
CopyCKString(mDb->mDbHelper.script_pOut.name, cache->GetName()); Utils::CopyCKString(mDb->mDbHelper.script_pOut.name, cache->GetName());
CopyCKParamTypeStr(mDb->mDbHelper.script_pOut.type, cache->GetType(), mDb->mDbHelper.param_manager); Utils::CopyCKParamTypeStr(mDb->mDbHelper.script_pOut.type, cache->GetType(), mDb->mDbHelper.param_manager);
CopyGuid(mDb->mDbHelper.script_pOut.type_guid, cache->GetGUID()); Utils::CopyGuid(mDb->mDbHelper.script_pOut.type_guid, cache->GetGUID());
mDb->mDbHelper.script_pOut.parent = parents; mDb->mDbHelper.script_pOut.parent = parents;
mDb->write_script_pOut(mDb->mDbHelper.script_pOut); mDb->write_script_pOut(mDb->mDbHelper.script_pOut);
@ -266,7 +266,7 @@ namespace SSMaterializer {
void Proc_bIn(CKBehaviorIO* cache, Database::DocumentDatabase* mDb, DataStruct::EXPAND_CK_ID parents, int index) { void Proc_bIn(CKBehaviorIO* cache, Database::DocumentDatabase* mDb, DataStruct::EXPAND_CK_ID parents, int index) {
mDb->mDbHelper.script_bIn.thisobj = cache->GetID(); mDb->mDbHelper.script_bIn.thisobj = cache->GetID();
mDb->mDbHelper.script_bIn.index = index; mDb->mDbHelper.script_bIn.index = index;
CopyCKString(mDb->mDbHelper.script_bIn.name, cache->GetName()); Utils::CopyCKString(mDb->mDbHelper.script_bIn.name, cache->GetName());
mDb->mDbHelper.script_bIn.parent = parents; mDb->mDbHelper.script_bIn.parent = parents;
mDb->write_script_bIn(mDb->mDbHelper.script_bIn); mDb->write_script_bIn(mDb->mDbHelper.script_bIn);
@ -275,7 +275,7 @@ namespace SSMaterializer {
void Proc_bOut(CKBehaviorIO* cache, Database::DocumentDatabase* mDb, DataStruct::EXPAND_CK_ID parents, int index) { void Proc_bOut(CKBehaviorIO* cache, Database::DocumentDatabase* mDb, DataStruct::EXPAND_CK_ID parents, int index) {
mDb->mDbHelper.script_bOut.thisobj = cache->GetID(); mDb->mDbHelper.script_bOut.thisobj = cache->GetID();
mDb->mDbHelper.script_bOut.index = index; mDb->mDbHelper.script_bOut.index = index;
CopyCKString(mDb->mDbHelper.script_bOut.name, cache->GetName()); Utils::CopyCKString(mDb->mDbHelper.script_bOut.name, cache->GetName());
mDb->mDbHelper.script_bOut.parent = parents; mDb->mDbHelper.script_bOut.parent = parents;
mDb->write_script_bOut(mDb->mDbHelper.script_bOut); mDb->write_script_bOut(mDb->mDbHelper.script_bOut);
@ -303,9 +303,9 @@ namespace SSMaterializer {
void Proc_pLocal(CKParameterLocal* cache, Database::DocumentDatabase* mDb, DataStruct::EXPAND_CK_ID parents, BOOL is_setting) { void Proc_pLocal(CKParameterLocal* cache, Database::DocumentDatabase* mDb, DataStruct::EXPAND_CK_ID parents, BOOL is_setting) {
mDb->mDbHelper.script_pLocal.thisobj = cache->GetID(); mDb->mDbHelper.script_pLocal.thisobj = cache->GetID();
CopyCKString(mDb->mDbHelper.script_pLocal.name, cache->GetName()); Utils::CopyCKString(mDb->mDbHelper.script_pLocal.name, cache->GetName());
CopyCKParamTypeStr(mDb->mDbHelper.script_pLocal.type, cache->GetType(), mDb->mDbHelper.param_manager); Utils::CopyCKParamTypeStr(mDb->mDbHelper.script_pLocal.type, cache->GetType(), mDb->mDbHelper.param_manager);
CopyGuid(mDb->mDbHelper.script_pLocal.type_guid, cache->GetGUID()); Utils::CopyGuid(mDb->mDbHelper.script_pLocal.type_guid, cache->GetGUID());
mDb->mDbHelper.script_pLocal.is_setting = is_setting; mDb->mDbHelper.script_pLocal.is_setting = is_setting;
mDb->mDbHelper.script_pLocal.parent = parents; mDb->mDbHelper.script_pLocal.parent = parents;
@ -318,7 +318,7 @@ namespace SSMaterializer {
void Proc_pOper(CKContext* ctx, CKParameterOperation* cache, Database::DocumentDatabase* mDb, DataStruct::EXPAND_CK_ID parents) { void Proc_pOper(CKContext* ctx, CKParameterOperation* cache, Database::DocumentDatabase* mDb, DataStruct::EXPAND_CK_ID parents) {
mDb->mDbHelper.script_pOper.thisobj = cache->GetID(); mDb->mDbHelper.script_pOper.thisobj = cache->GetID();
mDb->mDbHelper.script_pOper.op = mDb->mDbHelper.param_manager->OperationGuidToName(cache->GetOperationGuid()); mDb->mDbHelper.script_pOper.op = mDb->mDbHelper.param_manager->OperationGuidToName(cache->GetOperationGuid());
CopyGuid(mDb->mDbHelper.script_pOper.op_guid, cache->GetOperationGuid()); Utils::CopyGuid(mDb->mDbHelper.script_pOper.op_guid, cache->GetOperationGuid());
mDb->mDbHelper.script_pOper.parent = parents; mDb->mDbHelper.script_pOper.parent = parents;
mDb->write_script_pOper(mDb->mDbHelper.script_pOper); mDb->write_script_pOper(mDb->mDbHelper.script_pOper);
@ -342,9 +342,9 @@ namespace SSMaterializer {
// write self first to detect conflict // write self first to detect conflict
mDb->mDbHelper.script_pAttr.thisobj = cache->GetID(); mDb->mDbHelper.script_pAttr.thisobj = cache->GetID();
CopyCKString(mDb->mDbHelper.script_pAttr.name, cache->GetName()); Utils::CopyCKString(mDb->mDbHelper.script_pAttr.name, cache->GetName());
CopyCKParamTypeStr(mDb->mDbHelper.script_pAttr.type, cache->GetType(), mDb->mDbHelper.param_manager); Utils::CopyCKParamTypeStr(mDb->mDbHelper.script_pAttr.type, cache->GetType(), mDb->mDbHelper.param_manager);
CopyGuid(mDb->mDbHelper.script_pAttr.type_guid, cache->GetGUID()); Utils::CopyGuid(mDb->mDbHelper.script_pAttr.type_guid, cache->GetGUID());
mDb->write_script_pAttr(mDb->mDbHelper.script_pAttr); mDb->write_script_pAttr(mDb->mDbHelper.script_pAttr);
@ -352,17 +352,15 @@ namespace SSMaterializer {
CKObject* host = cache->GetOwner(); CKObject* host = cache->GetOwner();
// write owner id // write owner id
DataDictWritter("attr.owner", (long)host->GetID(), mDb, cache->GetID()); DataDictWritter("attr.owner", (long)host->GetID(), mDb, cache->GetID());
// write data for owner
DigObjectData(host, mDb, host->GetID());
} }
void Proc_Behavior(CKContext* ctx, CKBehavior* bhv, Database::DocumentDatabase* mDb, DataStruct::EXPAND_CK_ID parents) { void Proc_Behavior(CKContext* ctx, CKBehavior* bhv, Database::DocumentDatabase* mDb, DataStruct::EXPAND_CK_ID parents) {
//write self data //write self data
mDb->mDbHelper.script_behavior.thisobj = bhv->GetID(); mDb->mDbHelper.script_behavior.thisobj = bhv->GetID();
CopyCKString(mDb->mDbHelper.script_behavior.name, bhv->GetName()); Utils::CopyCKString(mDb->mDbHelper.script_behavior.name, bhv->GetName());
mDb->mDbHelper.script_behavior.type = bhv->GetType(); mDb->mDbHelper.script_behavior.type = bhv->GetType();
CopyCKString(mDb->mDbHelper.script_behavior.proto_name, bhv->GetPrototypeName()); Utils::CopyCKString(mDb->mDbHelper.script_behavior.proto_name, bhv->GetPrototypeName());
CopyGuid(mDb->mDbHelper.script_behavior.proto_guid, bhv->GetPrototypeGuid()); Utils::CopyGuid(mDb->mDbHelper.script_behavior.proto_guid, bhv->GetPrototypeGuid());
mDb->mDbHelper.script_behavior.flags = bhv->GetFlags(); mDb->mDbHelper.script_behavior.flags = bhv->GetFlags();
mDb->mDbHelper.script_behavior.priority = bhv->GetPriority(); mDb->mDbHelper.script_behavior.priority = bhv->GetPriority();
mDb->mDbHelper.script_behavior.version = bhv->GetVersion(); mDb->mDbHelper.script_behavior.version = bhv->GetVersion();
@ -437,197 +435,49 @@ namespace SSMaterializer {
#pragma endregion #pragma endregion
#pragma region message #pragma region message & obj
void IterateMessage(CKContext* ctx, Database::DocumentDatabase* mDb) { void IterateMessage(CKContext* ctx, Database::DocumentDatabase* mDb) {
CKMessageManager* msgManager = ctx->GetMessageManager(); CKMessageManager* msgManager = ctx->GetMessageManager();
int count = msgManager->GetMessageTypeCount(); int count = msgManager->GetMessageTypeCount();
for (int i = 0; i < count; i++) { for (int i = 0; i < count; i++) {
mDb->mDbHelper.msg.index = i; mDb->mDbHelper.msg.index = i;
CopyCKString(mDb->mDbHelper.msg.name, msgManager->GetMessageTypeName(i)); Utils::CopyCKString(mDb->mDbHelper.msg.name, msgManager->GetMessageTypeName(i));
mDb->write_msg(mDb->mDbHelper.msg); mDb->write_msg(mDb->mDbHelper.msg);
} }
} }
#pragma endregion static std::vector<CK_CLASSID> g_CommonClassId{
#if defined(VIRTOOLS_50) || defined(VIRTOOLS_40) || defined(VIRTOOLS_35)
// export video for non-21/25 virtools ver
CKCID_VIDEO,
#endif
// export beobj object will export almost objects
CKCID_OBJECTANIMATION, CKCID_ANIMATION, CKCID_BEOBJECT
};
void IterateObj(CKContext* ctx, Database::DocumentDatabase* mDb) {
for (auto it = g_CommonClassId.begin(); it != g_CommonClassId.end(); ++it) {
XObjectPointerArray objArray = ctx->GetObjectListByType(*it, TRUE);
int len = objArray.Size();
int scriptLen = 0;
for (int i = 0; i < len; i++) {
CKSceneObject* scene_obj = (CKSceneObject*)objArray.GetObjectA(i);
#pragma region array mDb->mDbHelper.obj.id = scene_obj->GetID();
Utils::CopyCKString(mDb->mDbHelper.obj.name, scene_obj->GetName());
void IterateArray(CKContext* ctx, Database::DocumentDatabase* mDb) { mDb->mDbHelper.obj.classid = scene_obj->GetClassID();
// get all array Utils::CopyCKClassId(mDb->mDbHelper.obj.classtype, scene_obj->GetClassID(), mDb->mDbHelper.param_manager);
XObjectPointerArray objArray = ctx->GetObjectListByType(CKCID_DATAARRAY, TRUE); mDb->write_obj(mDb->mDbHelper.obj);
CKDataArray* darray = NULL;
int len = objArray.Size();
for (int i = 0; i < len; i++) {
darray = (CKDataArray*)objArray.GetObjectA(i);
// dump self data first
mDb->mDbHelper._array.thisobj = darray->GetID();
CopyCKString(mDb->mDbHelper._array.name, darray->GetName());
mDb->mDbHelper._array.columns = darray->GetColumnCount();
mDb->mDbHelper._array.rows = darray->GetRowCount();
mDb->write_array(mDb->mDbHelper._array);
// dump column and row data
Proc_ArrayColumnRow(darray, mDb, darray->GetID());
}
}
void Proc_ArrayColumnRow(CKDataArray* cache, Database::DocumentDatabase* mDb, DataStruct::EXPAND_CK_ID parents) {
int columns = cache->GetColumnCount(), rows = cache->GetRowCount();
// we iterate columns to get data
// because the value type of one column is not changed,
// it is benefit to our export.
for (int col = 0; col < columns; ++col) {
// dump column self first
mDb->mDbHelper.array_header.index = col;
CopyCKString(mDb->mDbHelper.array_header.name, cache->GetColumnName(col));
CK_ARRAYTYPE coltype = cache->GetColumnType(col);
mDb->mDbHelper.array_header.type = coltype;
if (coltype == CKARRAYTYPE_PARAMETER) {
CKGUID guid = cache->GetColumnParameterGuid(col);
CopyGuid(mDb->mDbHelper.array_header.param_type_guid, guid);
CKSTRING pname = mDb->mDbHelper.param_manager->ParameterGuidToName(guid);
CopyCKString(mDb->mDbHelper.array_header.param_type, pname);
} else {
mDb->mDbHelper.array_header.param_type = "";
mDb->mDbHelper.array_header.param_type_guid = "";
} }
mDb->mDbHelper.array_header.parent = parents;
mDb->write_array_header(mDb->mDbHelper.array_header);
// write row data
switch (coltype) {
case CKARRAYTYPE_INT:
{
for (int row = 0; row < rows; ++row) {
mDb->mDbHelper.array_cell.column = col;
mDb->mDbHelper.array_cell.row = row;
mDb->mDbHelper.array_cell.parent = parents;
Utils::StdstringPrintf(mDb->mDbHelper.array_cell.showcase, "%d", *((int*)cache->GetElement(row, col)));
mDb->mDbHelper.array_cell.inner_param = -1;
mDb->write_array_cell(mDb->mDbHelper.array_cell);
}
}
break;
case CKARRAYTYPE_FLOAT:
{
for (int row = 0; row < rows; ++row) {
mDb->mDbHelper.array_cell.column = col;
mDb->mDbHelper.array_cell.row = row;
mDb->mDbHelper.array_cell.parent = parents;
Utils::StdstringPrintf(mDb->mDbHelper.array_cell.showcase, "%f", *((float*)cache->GetElement(row, col)));
mDb->mDbHelper.array_cell.inner_param = -1;
mDb->write_array_cell(mDb->mDbHelper.array_cell);
}
}
break;
case CKARRAYTYPE_STRING:
{
for (int row = 0; row < rows; ++row) {
mDb->mDbHelper.array_cell.column = col;
mDb->mDbHelper.array_cell.row = row;
mDb->mDbHelper.array_cell.parent = parents;
int count = cache->GetElementStringValue(row, col, NULL);
mDb->mDbHelper.array_cell.showcase.resize(count);
cache->GetElementStringValue(row, col, (char*)mDb->mDbHelper.array_cell.showcase.data());
mDb->mDbHelper.array_cell.inner_param = -1;
mDb->write_array_cell(mDb->mDbHelper.array_cell);
}
}
break;
case CKARRAYTYPE_OBJECT:
case CKARRAYTYPE_PARAMETER:
{
// due to Virtools shit document.
// although column has indicate current column is object or parameter.
// but it can not ensure value is CKParameter when column type is parameter.
// for example, Parameter - Array will return a CKDataArray, not CKParameter.
// so we put these 2 type together and check it in runtime to
// use different output.
CKObject* obj = NULL;
CKParameter* p = NULL;
CK_CLASSID objcls;
int param_size = 0;
BOOL need_evaluate = FALSE;
for (int row = 0; row < rows; ++row) {
mDb->mDbHelper.array_cell.column = col;
mDb->mDbHelper.array_cell.row = row;
mDb->mDbHelper.array_cell.parent = parents;
// check get status
obj = cache->GetElementObject(row, col);
if (obj == NULL) {
// fail to get obj
mDb->mDbHelper.array_cell.showcase = "(null)";
mDb->mDbHelper.array_cell.inner_param = -1;
} else {
// split normal obj and param obj
// use class id
objcls = obj->GetClassID();
if (objcls == CKCID_PARAMETER || objcls == CKCID_PARAMETERLOCAL || objcls == CKCID_PARAMETEROUT) {
need_evaluate = objcls == CKCID_PARAMETEROUT;
// CKParameter
p = (CKParameter*)obj;
param_size = p->GetStringValue(NULL, need_evaluate);
mDb->mDbHelper.array_cell.showcase.resize(param_size);
p->GetStringValue((char*)mDb->mDbHelper.array_cell.showcase.data(), need_evaluate);
mDb->mDbHelper.array_cell.inner_param = p->GetID();
// dig more data for it.
DigParameterData(p, mDb, p->GetID());
} else {
// normal CKObject
Utils::StdstringPrintf(mDb->mDbHelper.array_cell.showcase, "%s(%s)",
obj->GetName() ? obj->GetName() : "!!UNKNOW!!",
obj->GetClassNameA() ? obj->GetClassNameA() : "!!UNKNOW!!");
mDb->mDbHelper.array_cell.inner_param = obj->GetID();
// dig more data for it
DigObjectData(obj, mDb, obj->GetID());
}
}
mDb->write_array_cell(mDb->mDbHelper.array_cell);
}
}
break;
}
} }
} }
#pragma endregion #pragma endregion
#pragma region data process #pragma region data process
void DigObjectData(CKObject* o, Database::DocumentDatabase* mDb, DataStruct::EXPAND_CK_ID parents) {
// check duplication
// we use `parents` not o->GetID() because in some call they are not equal.
if (mDb->is_obj_duplicated(parents)) return;
DataDictWritter("obj.id", (long)o->GetID(), mDb, parents);
DataDictWritter("obj.name", o->GetName() ? o->GetName() : "!!UNKNOW!!", mDb, parents);
DataDictWritter("obj.classid", (long)o->GetClassID(), mDb, parents);
DataDictWritter("obj.type", o->GetClassNameA() ? o->GetClassNameA() : "!!UNKNOW!!", mDb, parents);
}
void DigParameterData(CKParameter* p, Database::DocumentDatabase* mDb, DataStruct::EXPAND_CK_ID parents) { void DigParameterData(CKParameter* p, Database::DocumentDatabase* mDb, DataStruct::EXPAND_CK_ID parents) {
// due to our algorithm, parameter can not be duplicated // due to our algorithm, parameter can not be duplicated
// so we don't need to check its duplication. // so we don't need to check its duplication.
@ -637,9 +487,9 @@ namespace SSMaterializer {
// export guid and type name corresponding with guid // export guid and type name corresponding with guid
static std::string str_guid; static std::string str_guid;
static std::string str_typename; static std::string str_typename;
CopyGuid(str_guid, t); Utils::CopyGuid(str_guid, t);
DataDictWritter("guid", str_guid.c_str(), mDb, parents); DataDictWritter("guid", str_guid.c_str(), mDb, parents);
CopyCKParamTypeStr(str_typename, pt, mDb->mDbHelper.param_manager); Utils::CopyCKParamTypeStr(str_typename, pt, mDb->mDbHelper.param_manager);
DataDictWritter("typename", str_typename.c_str(), mDb, parents); DataDictWritter("typename", str_typename.c_str(), mDb, parents);
// value object // value object
@ -647,8 +497,6 @@ namespace SSMaterializer {
CKObject* vobj = p->GetValueObject(false); CKObject* vobj = p->GetValueObject(false);
// write its id // write its id
DataDictWritter("vobj", (long)vobj->GetID(), mDb, parents); DataDictWritter("vobj", (long)vobj->GetID(), mDb, parents);
// write more data for its id
DigObjectData(vobj, mDb, vobj->GetID());
return; return;
} }

View File

@ -18,16 +18,12 @@ namespace SSMaterializer {
void Proc_pOper(CKContext* ctx, CKParameterOperation* cache, Database::DocumentDatabase* mDb, DataStruct::EXPAND_CK_ID parents); void Proc_pOper(CKContext* ctx, CKParameterOperation* cache, Database::DocumentDatabase* mDb, DataStruct::EXPAND_CK_ID parents);
void Proc_pAttr(CKContext* ctx, Database::DocumentDatabase* mDb, CKParameter* cache); void Proc_pAttr(CKContext* ctx, Database::DocumentDatabase* mDb, CKParameter* cache);
void Proc_Behavior(CKContext* ctx, CKBehavior* bhv, Database::DocumentDatabase* mDb, DataStruct::EXPAND_CK_ID parents); void Proc_Behavior(CKContext* ctx, CKBehavior* bhv, Database::DocumentDatabase* mDb, DataStruct::EXPAND_CK_ID parents);
void IterateScript(CKContext* ctx, Database::DocumentDatabase* mDb); void IterateScript(CKContext* ctx, Database::DocumentDatabase* mDb);
void IterateMessage(CKContext* ctx, Database::DocumentDatabase* mDb); void IterateMessage(CKContext* ctx, Database::DocumentDatabase* mDb);
void IterateObj(CKContext* ctx, Database::DocumentDatabase* mDb);
void IterateArray(CKContext* ctx, Database::DocumentDatabase* mDb);
void Proc_ArrayColumnRow(CKDataArray* cache, Database::DocumentDatabase* mDb, DataStruct::EXPAND_CK_ID parents);
void DigObjectData(CKObject* o, Database::DocumentDatabase* mDb, DataStruct::EXPAND_CK_ID parents);
void DigParameterData(CKParameter* p, Database::DocumentDatabase* mDb, DataStruct::EXPAND_CK_ID parents); void DigParameterData(CKParameter* p, Database::DocumentDatabase* mDb, DataStruct::EXPAND_CK_ID parents);
void DataDictWritter(const char* field, long data, Database::DocumentDatabase* mDb, DataStruct::EXPAND_CK_ID parents); void DataDictWritter(const char* field, long data, Database::DocumentDatabase* mDb, DataStruct::EXPAND_CK_ID parents);
void DataDictWritter(const char* field, float data, Database::DocumentDatabase* mDb, DataStruct::EXPAND_CK_ID parents); void DataDictWritter(const char* field, float data, Database::DocumentDatabase* mDb, DataStruct::EXPAND_CK_ID parents);

View File

@ -16,7 +16,7 @@ namespace SSMaterializer {
//fill basic data //fill basic data
mDb->mDbHelper.op.op_code = i; mDb->mDbHelper.op.op_code = i;
_guid = parameterManager->OperationCodeToGuid(i); _guid = parameterManager->OperationCodeToGuid(i);
CopyGuid(mDb->mDbHelper.op.op_guid, _guid); Utils::CopyGuid(mDb->mDbHelper.op.op_guid, _guid);
mDb->mDbHelper.op.op_name = parameterManager->OperationCodeToName(i); mDb->mDbHelper.op.op_name = parameterManager->OperationCodeToName(i);
//allocate mem //allocate mem
@ -29,9 +29,9 @@ namespace SSMaterializer {
parameterManager->GetAvailableOperationsDesc(_guid, NULL, NULL, NULL, opList); parameterManager->GetAvailableOperationsDesc(_guid, NULL, NULL, NULL, opList);
for (int j = 0; j < cacheListCount; j++) { for (int j = 0; j < cacheListCount; j++) {
CopyGuid(mDb->mDbHelper.op.in1_guid, opList[j].P1Guid); Utils::CopyGuid(mDb->mDbHelper.op.in1_guid, opList[j].P1Guid);
CopyGuid(mDb->mDbHelper.op.in2_guid, opList[j].P2Guid); Utils::CopyGuid(mDb->mDbHelper.op.in2_guid, opList[j].P2Guid);
CopyGuid(mDb->mDbHelper.op.out_guid, opList[j].ResGuid); Utils::CopyGuid(mDb->mDbHelper.op.out_guid, opList[j].ResGuid);
mDb->mDbHelper.op.funcPtr = opList[j].Fct; mDb->mDbHelper.op.funcPtr = opList[j].Fct;
mDb->write_op(mDb->mDbHelper.op); mDb->write_op(mDb->mDbHelper.op);
@ -48,8 +48,8 @@ namespace SSMaterializer {
desc = parameterManager->GetParameterTypeDescription(i); desc = parameterManager->GetParameterTypeDescription(i);
mDb->mDbHelper.param.index = desc->Index; mDb->mDbHelper.param.index = desc->Index;
CopyGuid(mDb->mDbHelper.param.guid, desc->Guid); Utils::CopyGuid(mDb->mDbHelper.param.guid, desc->Guid);
CopyGuid(mDb->mDbHelper.param.derived_from, desc->DerivedFrom); Utils::CopyGuid(mDb->mDbHelper.param.derived_from, desc->DerivedFrom);
mDb->mDbHelper.param.type_name = desc->TypeName.CStr(); mDb->mDbHelper.param.type_name = desc->TypeName.CStr();
mDb->mDbHelper.param.default_size = desc->DefaultSize; mDb->mDbHelper.param.default_size = desc->DefaultSize;
mDb->mDbHelper.param.func_CreateDefault = desc->CreateDefaultFunction; mDb->mDbHelper.param.func_CreateDefault = desc->CreateDefaultFunction;
@ -70,7 +70,7 @@ namespace SSMaterializer {
mDb->mDbHelper.param.dw_param = desc->dwParam; mDb->mDbHelper.param.dw_param = desc->dwParam;
mDb->mDbHelper.param.dw_flags = desc->dwFlags; mDb->mDbHelper.param.dw_flags = desc->dwFlags;
mDb->mDbHelper.param.cid = desc->Cid; mDb->mDbHelper.param.cid = desc->Cid;
CopyGuid(mDb->mDbHelper.param.saver_manager, desc->Saver_Manager); Utils::CopyGuid(mDb->mDbHelper.param.saver_manager, desc->Saver_Manager);
mDb->write_param(mDb->mDbHelper.param); mDb->write_param(mDb->mDbHelper.param);
} }
@ -82,11 +82,11 @@ namespace SSMaterializer {
mDb->mDbHelper.attr.index = i; mDb->mDbHelper.attr.index = i;
mDb->mDbHelper.attr.name = attrManager->GetAttributeNameByType(i); mDb->mDbHelper.attr.name = attrManager->GetAttributeNameByType(i);
mDb->mDbHelper.attr.category_index = attrManager->GetAttributeCategoryIndex(i); mDb->mDbHelper.attr.category_index = attrManager->GetAttributeCategoryIndex(i);
CopyCKString(mDb->mDbHelper.attr.category_name, attrManager->GetAttributeCategory(i)); Utils::CopyCKString(mDb->mDbHelper.attr.category_name, attrManager->GetAttributeCategory(i));
mDb->mDbHelper.attr.flags = attrManager->GetAttributeFlags(i); mDb->mDbHelper.attr.flags = attrManager->GetAttributeFlags(i);
mDb->mDbHelper.attr.param_index = attrManager->GetAttributeParameterType(i); mDb->mDbHelper.attr.param_index = attrManager->GetAttributeParameterType(i);
mDb->mDbHelper.attr.compatible_classid = attrManager->GetAttributeCompatibleClassId(i); mDb->mDbHelper.attr.compatible_classid = attrManager->GetAttributeCompatibleClassId(i);
CopyCKString(mDb->mDbHelper.attr.default_value, attrManager->GetAttributeDefaultValue(i)); Utils::CopyCKString(mDb->mDbHelper.attr.default_value, attrManager->GetAttributeDefaultValue(i));
mDb->write_attr(mDb->mDbHelper.attr); mDb->write_attr(mDb->mDbHelper.attr);
} }
@ -108,7 +108,7 @@ namespace SSMaterializer {
mDb->mDbHelper.plugin.plugin_index = plgEntry->m_PositionInDll; mDb->mDbHelper.plugin.plugin_index = plgEntry->m_PositionInDll;
mDb->mDbHelper.plugin.active = plgEntry->m_Active; mDb->mDbHelper.plugin.active = plgEntry->m_Active;
CopyGuid(mDb->mDbHelper.plugin.guid, plgInfo->m_GUID); Utils::CopyGuid(mDb->mDbHelper.plugin.guid, plgInfo->m_GUID);
mDb->mDbHelper.plugin.desc = plgInfo->m_Description.CStr(); mDb->mDbHelper.plugin.desc = plgInfo->m_Description.CStr();
mDb->mDbHelper.plugin.author = plgInfo->m_Author.CStr(); mDb->mDbHelper.plugin.author = plgInfo->m_Author.CStr();
mDb->mDbHelper.plugin.summary = plgInfo->m_Summary.CStr(); mDb->mDbHelper.plugin.summary = plgInfo->m_Summary.CStr();
@ -129,10 +129,10 @@ namespace SSMaterializer {
for (; !it.End(); it++) { for (; !it.End(); it++) {
varobj = it.GetVariable(); varobj = it.GetVariable();
mDb->mDbHelper.variable.name = it.GetName(); mDb->mDbHelper.variable.name = it.GetName();
CopyCKString(mDb->mDbHelper.variable.desciption, varobj->GetDescription()); Utils::CopyCKString(mDb->mDbHelper.variable.desciption, varobj->GetDescription());
mDb->mDbHelper.variable.flags = varobj->GetFlags(); mDb->mDbHelper.variable.flags = varobj->GetFlags();
mDb->mDbHelper.variable.type = varobj->GetType(); mDb->mDbHelper.variable.type = varobj->GetType();
CopyCKString(mDb->mDbHelper.variable.representation, varobj->GetRepresentation()); Utils::CopyCKString(mDb->mDbHelper.variable.representation, varobj->GetRepresentation());
varobj->GetStringValue(dataCopyCache); varobj->GetStringValue(dataCopyCache);
mDb->mDbHelper.variable.data = dataCopyCache.CStr(); mDb->mDbHelper.variable.data = dataCopyCache.CStr();

View File

@ -3,17 +3,29 @@
#include "stdafx.h" #include "stdafx.h"
#include <string> #include <string>
#define CopyGuid(str, guid) SSMaterializer::Utils::StdstringPrintf((str), "0x%08X, 0x%08X", (guid).d1, (guid).d2);
#define CopyCKString(storage, str) storage = (str) ? (str) : "!!UNKNOW!!";
#define CopyCKParamTypeStr(strl, ckpt, pm) if ((ckpt) != -1) (strl) = (pm)->ParameterTypeToName(ckpt);\
else (strl) = "!!UNKNOW!!";
namespace SSMaterializer { namespace SSMaterializer {
namespace Utils { namespace Utils {
constexpr const char g_Unknow[] = "!!UNKNOW!!";
void StdstringPrintf(std::string& strl, const char* format, ...); void StdstringPrintf(std::string& strl, const char* format, ...);
void StdstringVPrintf(std::string& strl, const char* format, va_list argptr); void StdstringVPrintf(std::string& strl, const char* format, va_list argptr);
void StdstringGetBase64(std::string& strl, const char* data, size_t datalen); void StdstringGetBase64(std::string& strl, const char* data, size_t datalen);
inline void CopyGuid(std::string& str, CKGUID& guid) {
StdstringPrintf(str, "0x%08X, 0x%08X", guid.d1, guid.d2);
}
inline void CopyCKString(std::string& storage, const char* str) {
storage = str == NULL ? g_Unknow : str;
}
inline void CopyCKParamTypeStr(std::string& strl, CKParameterType ckpt, CKParameterManager* pm) {
if (ckpt != -1) strl = pm->ParameterTypeToName(ckpt);
else strl = g_Unknow;
}
inline void CopyCKClassId(std::string& strl, CK_CLASSID clsid, CKParameterManager* pm) {
CKSTRING ckstr = pm->ParameterGuidToName(pm->ClassIDToGuid(clsid));
strl = ckstr == NULL ? g_Unknow : ckstr;
}
} }
} }

View File

@ -47,12 +47,12 @@ void RemoveMenu() {
void UpdateMenu() { void UpdateMenu() {
s_Plugininterface->ClearPluginMenu(s_MainMenu); //clear menu s_Plugininterface->ClearPluginMenu(s_MainMenu); //clear menu
s_Plugininterface->AddPluginMenuItem(s_MainMenu, 0, "Export document"); s_Plugininterface->AddPluginMenuItem(s_MainMenu, 0, "Export Document");
s_Plugininterface->AddPluginMenuItem(s_MainMenu, 1, "Export environment"); s_Plugininterface->AddPluginMenuItem(s_MainMenu, 1, "Export Environment");
s_Plugininterface->AddPluginMenuItem(s_MainMenu, -1, NULL, TRUE); s_Plugininterface->AddPluginMenuItem(s_MainMenu, -1, NULL, TRUE);
s_Plugininterface->AddPluginMenuItem(s_MainMenu, 2, "Report bug"); s_Plugininterface->AddPluginMenuItem(s_MainMenu, 2, "Report Bug");
s_Plugininterface->AddPluginMenuItem(s_MainMenu, 3, "Plugin homepage"); s_Plugininterface->AddPluginMenuItem(s_MainMenu, 3, "Plugin Homepage");
s_Plugininterface->UpdatePluginMenu(s_MainMenu); //update menu,always needed when you finished to update the menu s_Plugininterface->UpdatePluginMenu(s_MainMenu); //update menu,always needed when you finished to update the menu
//unless you want the menu not to have Virtools Dev main menu color scheme. //unless you want the menu not to have Virtools Dev main menu color scheme.
@ -83,7 +83,7 @@ void PluginMenuCallback(int commandID) {
//iterate item //iterate item
SSMaterializer::DocumentExporter::IterateScript(ctx, db); SSMaterializer::DocumentExporter::IterateScript(ctx, db);
SSMaterializer::DocumentExporter::IterateMessage(ctx, db); SSMaterializer::DocumentExporter::IterateMessage(ctx, db);
SSMaterializer::DocumentExporter::IterateArray(ctx, db); SSMaterializer::DocumentExporter::IterateObj(ctx, db);
//Close all resources //Close all resources
delete db; delete db;