finish SSMaterializer plugin version refactor.
This commit is contained in:
parent
1de5483432
commit
5f715de4a9
|
@ -1,5 +1,4 @@
|
||||||
LIBRARY "SuperScriptMaterializer"
|
LIBRARY "SuperScriptMaterializer"
|
||||||
DESCRIPTION 'Fuck Virtools'
|
|
||||||
|
|
||||||
EXPORTS
|
EXPORTS
|
||||||
GetVirtoolsPluginInfoCount
|
GetVirtoolsPluginInfoCount
|
||||||
|
|
|
@ -114,8 +114,9 @@
|
||||||
<ClInclude Include="doc_export.hpp" />
|
<ClInclude Include="doc_export.hpp" />
|
||||||
<ClInclude Include="string_helper.hpp" />
|
<ClInclude Include="string_helper.hpp" />
|
||||||
<ClInclude Include="virtools_compatible.hpp" />
|
<ClInclude Include="virtools_compatible.hpp" />
|
||||||
<ClInclude Include="vt_menu.h" />
|
<ClInclude Include="vt_menu.hpp" />
|
||||||
<ClInclude Include="stdafx.h" />
|
<ClInclude Include="stdafx.h" />
|
||||||
|
<ClInclude Include="vt_player.hpp" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="database.cpp" />
|
<ClCompile Include="database.cpp" />
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
<ClInclude Include="stdafx.h">
|
<ClInclude Include="stdafx.h">
|
||||||
<Filter>头文件</Filter>
|
<Filter>头文件</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="vt_menu.h">
|
<ClInclude Include="vt_menu.hpp">
|
||||||
<Filter>头文件</Filter>
|
<Filter>头文件</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="virtools_compatible.hpp">
|
<ClInclude Include="virtools_compatible.hpp">
|
||||||
|
@ -39,6 +39,9 @@
|
||||||
<ClInclude Include="string_helper.hpp">
|
<ClInclude Include="string_helper.hpp">
|
||||||
<Filter>头文件</Filter>
|
<Filter>头文件</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="vt_player.hpp">
|
||||||
|
<Filter>头文件</Filter>
|
||||||
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="database.cpp">
|
<ClCompile Include="database.cpp">
|
||||||
|
|
|
@ -84,14 +84,23 @@ namespace SSMaterializer {
|
||||||
|
|
||||||
// append new one
|
// append new one
|
||||||
mStmtCache.push_back(stmt);
|
mStmtCache.push_back(stmt);
|
||||||
|
return stmt;
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL SSMaterializerDatabase::Init() {
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL SSMaterializerDatabase::Finalize() {
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma endregion
|
#pragma endregion
|
||||||
|
|
||||||
#pragma region sub-database constructor and deconstructor
|
#pragma region sub-database constructor, deconstructor and help functions
|
||||||
|
|
||||||
DocumentDatabase::DocumentDatabase(const char* file, CKParameterManager* paramManager) :
|
DocumentDatabase::DocumentDatabase(const char* file, CKParameterManager* paramManager) :
|
||||||
SSMaterializerDatabase(file), m_pAttrUniqueEnsurance(), mDbHelper(paramManager) {
|
SSMaterializerDatabase(file), mUniqueAttr(), mUniqueObj(), mDbHelper(paramManager) {
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -108,6 +117,30 @@ namespace SSMaterializer {
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BOOL DocumentDatabase::is_attr_duplicated(DataStruct::EXPAND_CK_ID parents) {
|
||||||
|
// check duplication
|
||||||
|
if (mUniqueAttr.find(parents) != mUniqueAttr.end()) {
|
||||||
|
//existing item. skip it to make sure unique
|
||||||
|
return TRUE;
|
||||||
|
} else {
|
||||||
|
//add this item
|
||||||
|
mUniqueAttr.insert(parents);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL DocumentDatabase::is_obj_duplicated(DataStruct::EXPAND_CK_ID parents) {
|
||||||
|
// check duplication
|
||||||
|
if (mUniqueObj.find(parents) != mUniqueObj.end()) {
|
||||||
|
//existing item. skip it to make sure unique
|
||||||
|
return TRUE;
|
||||||
|
} else {
|
||||||
|
//add this item
|
||||||
|
mUniqueObj.insert(parents);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#pragma endregion
|
#pragma endregion
|
||||||
|
|
||||||
#pragma region table, index creation functions
|
#pragma region table, index creation functions
|
||||||
|
@ -116,6 +149,9 @@ namespace SSMaterializer {
|
||||||
if (result != SQLITE_OK) { return FALSE; }
|
if (result != SQLITE_OK) { return FALSE; }
|
||||||
|
|
||||||
BOOL DocumentDatabase::Init() {
|
BOOL DocumentDatabase::Init() {
|
||||||
|
// execute parent first
|
||||||
|
if (!SSMaterializerDatabase::Init()) return FALSE;
|
||||||
|
|
||||||
int result;
|
int result;
|
||||||
|
|
||||||
//Init table
|
//Init table
|
||||||
|
@ -149,6 +185,9 @@ if (result != SQLITE_OK) { return FALSE; }
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL DocumentDatabase::Finalize() {
|
BOOL DocumentDatabase::Finalize() {
|
||||||
|
// execute parent first
|
||||||
|
if (!SSMaterializerDatabase::Finalize()) return FALSE;
|
||||||
|
|
||||||
//create index for quick select in SuperScriptDecorator
|
//create index for quick select in SuperScriptDecorator
|
||||||
int result;
|
int result;
|
||||||
|
|
||||||
|
@ -165,14 +204,16 @@ if (result != SQLITE_OK) { return FALSE; }
|
||||||
SafeSqlExec("CREATE INDEX [quick_where10] ON [script_bLink] ([parent])");
|
SafeSqlExec("CREATE INDEX [quick_where10] ON [script_bLink] ([parent])");
|
||||||
SafeSqlExec("CREATE INDEX [quick_where11] ON [script_elink] ([parent])");
|
SafeSqlExec("CREATE INDEX [quick_where11] ON [script_elink] ([parent])");
|
||||||
SafeSqlExec("CREATE INDEX [quick_where12] ON [script_pAttr] ([thisobj])");
|
SafeSqlExec("CREATE INDEX [quick_where12] ON [script_pAttr] ([thisobj])");
|
||||||
SafeSqlExec("CREATE INDEX [quick_where13] ON [array_cell] ([parent])");
|
SafeSqlExec("CREATE INDEX [quick_where13] ON [data] ([parent])");
|
||||||
SafeSqlExec("CREATE INDEX [quick_where14] ON [data] ([parent])");
|
|
||||||
SafeSqlExec("commit;");
|
SafeSqlExec("commit;");
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL EnvironmentDatabase::Init() {
|
BOOL EnvironmentDatabase::Init() {
|
||||||
|
// execute parent first
|
||||||
|
if (!SSMaterializerDatabase::Init()) return FALSE;
|
||||||
|
|
||||||
int result;
|
int result;
|
||||||
|
|
||||||
//init table
|
//init table
|
||||||
|
@ -190,6 +231,9 @@ if (result != SQLITE_OK) { return FALSE; }
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL EnvironmentDatabase::Finalize() {
|
BOOL EnvironmentDatabase::Finalize() {
|
||||||
|
// execute parent first
|
||||||
|
if (!SSMaterializerDatabase::Finalize()) return FALSE;
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -393,18 +437,7 @@ if (stmt == NULL) { \
|
||||||
sqlite3_step(stmt);
|
sqlite3_step(stmt);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DocumentDatabase::write_script_pAttr(DataStruct::dbdoc_script_pAttr& data, BOOL* already_exist) {
|
void DocumentDatabase::write_script_pAttr(DataStruct::dbdoc_script_pAttr& data) {
|
||||||
// check duplication first
|
|
||||||
if (m_pAttrUniqueEnsurance.find(data.thisobj) != m_pAttrUniqueEnsurance.end()) {
|
|
||||||
//existing item. skip it to make sure unique
|
|
||||||
*already_exist = TRUE;
|
|
||||||
return;
|
|
||||||
} else {
|
|
||||||
//add this item
|
|
||||||
m_pAttrUniqueEnsurance.insert(data.thisobj);
|
|
||||||
*already_exist = FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
// then check database validation
|
// then check database validation
|
||||||
if (mDb == NULL) return;
|
if (mDb == NULL) return;
|
||||||
|
|
||||||
|
|
|
@ -311,8 +311,8 @@ namespace SSMaterializer {
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
sqlite3_stmt* CreateStmt(const char* stmt);
|
sqlite3_stmt* CreateStmt(const char* stmt);
|
||||||
virtual BOOL Init() = 0;
|
virtual BOOL Init();
|
||||||
virtual BOOL Finalize() = 0;
|
virtual BOOL Finalize();
|
||||||
|
|
||||||
sqlite3* mDb;
|
sqlite3* mDb;
|
||||||
std::vector<sqlite3_stmt*> mStmtCache;
|
std::vector<sqlite3_stmt*> mStmtCache;
|
||||||
|
@ -336,7 +336,7 @@ namespace SSMaterializer {
|
||||||
void write_script_pLink(DataStruct::dbdoc_script_pLink& data);
|
void write_script_pLink(DataStruct::dbdoc_script_pLink& data);
|
||||||
void write_script_pOper(DataStruct::dbdoc_script_pOper& data);
|
void write_script_pOper(DataStruct::dbdoc_script_pOper& data);
|
||||||
void write_script_eLink(DataStruct::dbdoc_script_eLink& data);
|
void write_script_eLink(DataStruct::dbdoc_script_eLink& data);
|
||||||
void write_script_pAttr(DataStruct::dbdoc_script_pAttr& data, BOOL* already_exist);
|
void write_script_pAttr(DataStruct::dbdoc_script_pAttr& data);
|
||||||
|
|
||||||
void write_msg(DataStruct::dbdoc_msg& data);
|
void write_msg(DataStruct::dbdoc_msg& data);
|
||||||
|
|
||||||
|
@ -346,11 +346,15 @@ namespace SSMaterializer {
|
||||||
|
|
||||||
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_obj_duplicated(DataStruct::EXPAND_CK_ID parents);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
BOOL Init() override;
|
BOOL Init() override;
|
||||||
BOOL Finalize() override;
|
BOOL Finalize() override;
|
||||||
|
|
||||||
std::set<DataStruct::EXPAND_CK_ID> m_pAttrUniqueEnsurance;
|
std::set<DataStruct::EXPAND_CK_ID> mUniqueAttr;
|
||||||
|
std::set<DataStruct::EXPAND_CK_ID> mUniqueObj;
|
||||||
};
|
};
|
||||||
|
|
||||||
class EnvironmentDatabase : public SSMaterializerDatabase {
|
class EnvironmentDatabase : public SSMaterializerDatabase {
|
||||||
|
|
|
@ -337,21 +337,23 @@ namespace SSMaterializer {
|
||||||
* we need check possible duplication here.
|
* we need check possible duplication here.
|
||||||
*/
|
*/
|
||||||
void Proc_pAttr(CKContext* ctx, Database::DocumentDatabase* mDb, CKParameter* cache) {
|
void Proc_pAttr(CKContext* ctx, Database::DocumentDatabase* mDb, CKParameter* cache) {
|
||||||
|
// check duplication
|
||||||
|
if (mDb->is_attr_duplicated(cache->GetID())) return;
|
||||||
|
|
||||||
// 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());
|
CopyCKString(mDb->mDbHelper.script_pAttr.name, cache->GetName());
|
||||||
CopyCKParamTypeStr(mDb->mDbHelper.script_pAttr.type, cache->GetType(), mDb->mDbHelper.param_manager);
|
CopyCKParamTypeStr(mDb->mDbHelper.script_pAttr.type, cache->GetType(), mDb->mDbHelper.param_manager);
|
||||||
CopyGuid(mDb->mDbHelper.script_pAttr.type_guid, cache->GetGUID());
|
CopyGuid(mDb->mDbHelper.script_pAttr.type_guid, cache->GetGUID());
|
||||||
|
|
||||||
BOOL already_exist = FALSE;
|
mDb->write_script_pAttr(mDb->mDbHelper.script_pAttr);
|
||||||
mDb->write_script_pAttr(mDb->mDbHelper.script_pAttr, &already_exist);
|
|
||||||
if (!already_exist) {
|
|
||||||
// not duplicated, continue write some properties to indicate the host of this attribute
|
|
||||||
CKObject* host = cache->GetOwner();
|
|
||||||
DataDictWritter("attr.host_id", (long)host->GetID(), mDb, cache->GetID());
|
|
||||||
DataDictWritter("attr.host_name", host->GetName(), mDb, cache->GetID());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
// continue write some properties to indicate the host of this attribute
|
||||||
|
CKObject* host = cache->GetOwner();
|
||||||
|
// write owner id
|
||||||
|
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) {
|
||||||
|
@ -507,7 +509,7 @@ namespace SSMaterializer {
|
||||||
mDb->mDbHelper.array_cell.row = row;
|
mDb->mDbHelper.array_cell.row = row;
|
||||||
mDb->mDbHelper.array_cell.parent = parents;
|
mDb->mDbHelper.array_cell.parent = parents;
|
||||||
|
|
||||||
Utils::StdstringPrintf(mDb->mDbHelper.array_cell.showcase, "%d", &((int*)cache->GetElement(row, col)));
|
Utils::StdstringPrintf(mDb->mDbHelper.array_cell.showcase, "%d", *((int*)cache->GetElement(row, col)));
|
||||||
mDb->mDbHelper.array_cell.inner_param = -1;
|
mDb->mDbHelper.array_cell.inner_param = -1;
|
||||||
|
|
||||||
mDb->write_array_cell(mDb->mDbHelper.array_cell);
|
mDb->write_array_cell(mDb->mDbHelper.array_cell);
|
||||||
|
@ -519,7 +521,7 @@ namespace SSMaterializer {
|
||||||
mDb->mDbHelper.array_cell.row = row;
|
mDb->mDbHelper.array_cell.row = row;
|
||||||
mDb->mDbHelper.array_cell.parent = parents;
|
mDb->mDbHelper.array_cell.parent = parents;
|
||||||
|
|
||||||
Utils::StdstringPrintf(mDb->mDbHelper.array_cell.showcase, "%f", &((float*)cache->GetElement(row, col)));
|
Utils::StdstringPrintf(mDb->mDbHelper.array_cell.showcase, "%f", *((float*)cache->GetElement(row, col)));
|
||||||
mDb->mDbHelper.array_cell.inner_param = -1;
|
mDb->mDbHelper.array_cell.inner_param = -1;
|
||||||
|
|
||||||
mDb->write_array_cell(mDb->mDbHelper.array_cell);
|
mDb->write_array_cell(mDb->mDbHelper.array_cell);
|
||||||
|
@ -585,13 +587,21 @@ namespace SSMaterializer {
|
||||||
#pragma region data process
|
#pragma region data process
|
||||||
|
|
||||||
void DigObjectData(CKObject* o, Database::DocumentDatabase* mDb, DataStruct::EXPAND_CK_ID parents) {
|
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() : "", mDb, parents);
|
||||||
|
DataDictWritter("obj.classid", (long)o->GetClassID(), mDb, parents);
|
||||||
|
DataDictWritter("obj.type", o->GetClassNameA(), 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
|
||||||
|
// so we don't need to check its duplication.
|
||||||
CKGUID t = p->GetGUID();
|
CKGUID t = p->GetGUID();
|
||||||
CKParameterType pt = p->GetType();
|
CKParameterType pt = p->GetType();
|
||||||
BOOL unknowType = FALSE;
|
|
||||||
|
|
||||||
// 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;
|
||||||
|
@ -601,15 +611,13 @@ namespace SSMaterializer {
|
||||||
CopyCKParamTypeStr(str_typename, pt, mDb->mDbHelper.param_manager);
|
CopyCKParamTypeStr(str_typename, pt, mDb->mDbHelper.param_manager);
|
||||||
DataDictWritter("typename", str_typename.c_str(), mDb, parents);
|
DataDictWritter("typename", str_typename.c_str(), mDb, parents);
|
||||||
|
|
||||||
if (!(t.d1 & t.d2)) unknowType = TRUE;
|
|
||||||
|
|
||||||
// value object
|
// value object
|
||||||
if (p->GetParameterClassID() && p->GetValueObject(false)) {
|
if (p->GetParameterClassID() && p->GetValueObject(false)) {
|
||||||
CKObject* vobj = p->GetValueObject(false);
|
CKObject* vobj = p->GetValueObject(false);
|
||||||
DataDictWritter("vobj.id", (long)vobj->GetID(), mDb, parents);
|
// write its id
|
||||||
DataDictWritter("vobj.name", vobj->GetName() ? vobj->GetName() : "", mDb, parents);
|
DataDictWritter("vobj", (long)vobj->GetID(), mDb, parents);
|
||||||
DataDictWritter("vobj.classid", (long)vobj->GetClassID(), mDb, parents);
|
// write more data for its id
|
||||||
DataDictWritter("vobj.type", vobj->GetClassNameA(), mDb, parents);
|
DigObjectData(vobj, mDb, vobj->GetID());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -656,7 +664,6 @@ namespace SSMaterializer {
|
||||||
}
|
}
|
||||||
if (t == CKPGUID_MATRIX) {
|
if (t == CKPGUID_MATRIX) {
|
||||||
VxMatrix mat;
|
VxMatrix mat;
|
||||||
char position[128];
|
|
||||||
memcpy(&mat, p->GetReadDataPtr(false), sizeof(mat));
|
memcpy(&mat, p->GetReadDataPtr(false), sizeof(mat));
|
||||||
|
|
||||||
static std::string str_matrix;
|
static std::string str_matrix;
|
||||||
|
@ -738,10 +745,9 @@ namespace SSMaterializer {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
unknowType = TRUE;
|
|
||||||
//if it gets here, we have no idea what it really is. so simply dump it.
|
//if it gets here, we have no idea what it really is. so simply dump it.
|
||||||
//buffer-like
|
//buffer-like
|
||||||
if (unknowType || t == CKPGUID_VOIDBUF
|
if (t == CKPGUID_VOIDBUF
|
||||||
#if defined(VIRTOOLS_50) || defined(VIRTOOLS_40) || defined(VIRTOOLS_35)
|
#if defined(VIRTOOLS_50) || defined(VIRTOOLS_40) || defined(VIRTOOLS_35)
|
||||||
|| t == CKPGUID_SHADER || t == CKPGUID_TECHNIQUE || t == CKPGUID_PASS
|
|| t == CKPGUID_SHADER || t == CKPGUID_TECHNIQUE || t == CKPGUID_PASS
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
#include "vt_menu.h"
|
#include "vt_menu.hpp"
|
||||||
#include "vt_player.h"
|
#include "vt_player.hpp"
|
||||||
|
|
||||||
#if defined(VIRTOOLS_PLUGIN)
|
#if defined(VIRTOOLS_PLUGIN)
|
||||||
PluginInterface* s_Plugininterface = NULL;
|
PluginInterface* s_Plugininterface = NULL;
|
||||||
|
@ -29,7 +29,7 @@ SuperScriptMaterializer theApp;
|
||||||
BOOL SuperScriptMaterializer::InitInstance() {
|
BOOL SuperScriptMaterializer::InitInstance() {
|
||||||
CWinApp::InitInstance();
|
CWinApp::InitInstance();
|
||||||
|
|
||||||
strcpy(g_PluginInfo0.m_Name, "Super Script Materializer");
|
strcpy(g_PluginInfo0.m_Name, "SSMaterializer");
|
||||||
g_PluginInfo0.m_PluginType = PluginInfo::PT_EDITOR;
|
g_PluginInfo0.m_PluginType = PluginInfo::PT_EDITOR;
|
||||||
g_PluginInfo0.m_PluginType = (PluginInfo::PLUGIN_TYPE)(g_PluginInfo0.m_PluginType | PluginInfo::PTF_RECEIVENOTIFICATION);
|
g_PluginInfo0.m_PluginType = (PluginInfo::PLUGIN_TYPE)(g_PluginInfo0.m_PluginType | PluginInfo::PTF_RECEIVENOTIFICATION);
|
||||||
g_PluginInfo0.m_PluginCallback = PluginCallback;
|
g_PluginInfo0.m_PluginCallback = PluginCallback;
|
||||||
|
|
|
@ -4,6 +4,8 @@
|
||||||
//
|
//
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#define _WIN32_WINNT 0x0A00
|
||||||
|
|
||||||
#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
|
#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
|
||||||
|
|
||||||
#include <afxwin.h> // MFC core and standard components
|
#include <afxwin.h> // MFC core and standard components
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#include "virtools_compatible.h"
|
#include "virtools_compatible.hpp"
|
||||||
|
|
||||||
#if defined(VIRTOOLS_50) && defined(VIRTOOLS_STANDALONE)
|
#if defined(VIRTOOLS_50) && defined(VIRTOOLS_STANDALONE)
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#include "vt_menu.h"
|
#include "vt_menu.hpp"
|
||||||
#include "database.h"
|
#include "database.hpp"
|
||||||
#include "script_export.h"
|
#include "doc_export.hpp"
|
||||||
#include "env_export.h"
|
#include "env_export.hpp"
|
||||||
|
|
||||||
#if defined(VIRTOOLS_PLUGIN)
|
#if defined(VIRTOOLS_PLUGIN)
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@ void InitMenu() {
|
||||||
if (!s_Plugininterface)
|
if (!s_Plugininterface)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
s_MainMenu = s_Plugininterface->AddPluginMenu("Super Script Materializer", 20, NULL, (VoidFunc1Param)PluginMenuCallback);
|
s_MainMenu = s_Plugininterface->AddPluginMenu("SSMaterializer", 20, NULL, (VoidFunc1Param)PluginMenuCallback);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RemoveMenu() {
|
void RemoveMenu() {
|
||||||
|
@ -47,23 +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 all scripts");
|
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");
|
||||||
//===========================freeze chirs241097 code for future expand
|
|
||||||
//s_Plugininterface->AddPluginMenuItem(s_MainMenu, -1, NULL, TRUE);
|
|
||||||
|
|
||||||
////note : sub menu must have independent command ids that must be >=0
|
|
||||||
//CMenu* sub0 = s_Plugininterface->AddPluginMenuItem(s_MainMenu, 0, "Fsck /dev/sdb", FALSE, TRUE);//bb manipulation
|
|
||||||
|
|
||||||
//s_Plugininterface->AddPluginMenuItem(sub0, 1, "Fsck /dev/sdb1");//modify bb proto
|
|
||||||
//s_Plugininterface->AddPluginMenuItem(sub0, 2, "Fsck /dev/sdb2");//not implemented
|
|
||||||
|
|
||||||
//s_Plugininterface->AddPluginMenuItem(s_MainMenu, -1, NULL, TRUE);
|
|
||||||
//s_Plugininterface->AddPluginMenuItem(s_MainMenu, 10, "Exit Fsck");
|
|
||||||
|
|
||||||
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.
|
||||||
|
@ -88,21 +77,18 @@ void PluginMenuCallback(int commandID) {
|
||||||
DeleteFile(file.c_str());
|
DeleteFile(file.c_str());
|
||||||
|
|
||||||
//Init resources
|
//Init resources
|
||||||
DocumentDatabase* _db = new DocumentDatabase();
|
SSMaterializer::Database::DocumentDatabase* db =
|
||||||
dbDocDataStructHelper* _helper = new dbDocDataStructHelper();
|
new SSMaterializer::Database::DocumentDatabase(file.c_str(), ctx->GetParameterManager());
|
||||||
_db->Open(file.c_str());
|
|
||||||
_helper->Init(ctx->GetParameterManager());
|
|
||||||
|
|
||||||
//iterate item
|
//iterate item
|
||||||
IterateScript(ctx, _db, _helper);
|
SSMaterializer::DocumentExporter::IterateScript(ctx, db);
|
||||||
|
SSMaterializer::DocumentExporter::IterateMessage(ctx, db);
|
||||||
|
SSMaterializer::DocumentExporter::IterateArray(ctx, db);
|
||||||
|
|
||||||
//Close all resources
|
//Close all resources
|
||||||
_helper->dispose();
|
delete db;
|
||||||
_db->Close();
|
|
||||||
delete _helper;
|
|
||||||
delete _db;
|
|
||||||
|
|
||||||
ctx->OutputToConsole("[Super Script Materializer] Done");
|
ctx->OutputToConsole("[SSMaterializer] Done");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
|
@ -115,28 +101,22 @@ void PluginMenuCallback(int commandID) {
|
||||||
DeleteFile(file.c_str());
|
DeleteFile(file.c_str());
|
||||||
|
|
||||||
//Init
|
//Init
|
||||||
EnvironmentDatabase* _db = new EnvironmentDatabase();
|
SSMaterializer::Database::EnvironmentDatabase* db =
|
||||||
dbEnvDataStructHelper* _helper = new dbEnvDataStructHelper();
|
new SSMaterializer::Database::EnvironmentDatabase(file.c_str());
|
||||||
_db->Open(file.c_str());
|
|
||||||
_helper->Init();
|
|
||||||
|
|
||||||
//iterate parameter operation/param
|
//iterate parameter operation/param
|
||||||
IterateParameterOperation(ctx->GetParameterManager(), _db, _helper);
|
SSMaterializer::EnvironmentExporter::IterateParameterOperation(ctx->GetParameterManager(), db);
|
||||||
IterateParameter(ctx->GetParameterManager(), _db, _helper);
|
SSMaterializer::EnvironmentExporter::IterateParameter(ctx->GetParameterManager(), db);
|
||||||
IterateMessage(ctx->GetMessageManager(), _db, _helper);
|
SSMaterializer::EnvironmentExporter::IterateAttribute(ctx->GetAttributeManager(), db);
|
||||||
IterateAttribute(ctx->GetAttributeManager(), _db, _helper);
|
SSMaterializer::EnvironmentExporter::IteratePlugin(CKGetPluginManager(), db);
|
||||||
IteratePlugin(CKGetPluginManager(), _db, _helper);
|
|
||||||
#if !defined(VIRTOOLS_21)
|
#if !defined(VIRTOOLS_21)
|
||||||
IterateVariable(ctx->GetVariableManager(), _db, _helper);
|
SSMaterializer::EnvironmentExporter::IterateVariable(ctx->GetVariableManager(), db);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//release all
|
//release all
|
||||||
_helper->dispose();
|
delete db;
|
||||||
_db->Close();
|
|
||||||
delete _helper;
|
|
||||||
delete _db;
|
|
||||||
|
|
||||||
ctx->OutputToConsole("[Super Script Materializer] Done");
|
ctx->OutputToConsole("[SSMaterializer] Done");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
|
|
|
@ -1,9 +1,8 @@
|
||||||
#if !defined(_YYCDLL_VT_MENU_H__IMPORTED_)
|
#pragma once
|
||||||
#define _YYCDLL_VT_MENU_H__IMPORTED_
|
|
||||||
|
|
||||||
#if defined(VIRTOOLS_PLUGIN)
|
#if defined(VIRTOOLS_PLUGIN)
|
||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
#include "database.h"
|
#include "database.hpp"
|
||||||
|
|
||||||
void PluginCallback(PluginInfo::CALLBACK_REASON reason, PluginInterface* plugininterface);
|
void PluginCallback(PluginInfo::CALLBACK_REASON reason, PluginInterface* plugininterface);
|
||||||
|
|
||||||
|
@ -14,5 +13,3 @@ void PluginMenuCallback(int commandID);
|
||||||
|
|
||||||
BOOL OpenFileDialog(std::string* returned_file);
|
BOOL OpenFileDialog(std::string* returned_file);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
|
|
@ -1,6 +1,6 @@
|
||||||
#include "vt_player.h"
|
#include "vt_player.hpp"
|
||||||
#include "script_export.h"
|
#include "doc_export.hpp"
|
||||||
#include "env_export.h"
|
#include "env_export.hpp"
|
||||||
|
|
||||||
#if defined(VIRTOOLS_STANDALONE)
|
#if defined(VIRTOOLS_STANDALONE)
|
||||||
|
|
||||||
|
|
|
@ -1,13 +1,10 @@
|
||||||
#if !defined(_YYCDLL_VT_PLAYER_H__IMPORTED_)
|
#pragma once
|
||||||
#define _YYCDLL_VT_PLAYER_H__IMPORTED_
|
|
||||||
|
|
||||||
#if defined(VIRTOOLS_STANDALONE)
|
#if defined(VIRTOOLS_STANDALONE)
|
||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
#include "database.h"
|
#include "database.hpp"
|
||||||
|
|
||||||
void PlayerMain(const char* virtools_composition, const char* script_db_path, const char* env_db_path);
|
void PlayerMain(const char* virtools_composition, const char* script_db_path, const char* env_db_path);
|
||||||
void CommonAssert(BOOL condition, const char* desc);
|
void CommonAssert(BOOL condition, const char* desc);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
|
Loading…
Reference in New Issue
Block a user