[fix] fix some bugs
- fix decorator throw a error when a attribute was connected to a pIn - fix CKCID_PARAMETERVARIABLE support
This commit is contained in:
parent
9cd2f93b8b
commit
cd562ede42
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -4,6 +4,7 @@
|
||||||
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
|
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
|
||||||
|
|
||||||
*.db
|
*.db
|
||||||
|
*.db-journal
|
||||||
|
|
||||||
# User-specific files
|
# User-specific files
|
||||||
*.rsuser
|
*.rsuser
|
||||||
|
|
|
@ -9,6 +9,14 @@
|
||||||
<Configuration>VT35</Configuration>
|
<Configuration>VT35</Configuration>
|
||||||
<Platform>x64</Platform>
|
<Platform>x64</Platform>
|
||||||
</ProjectConfiguration>
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="VT4|Win32">
|
||||||
|
<Configuration>VT4</Configuration>
|
||||||
|
<Platform>Win32</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="VT4|x64">
|
||||||
|
<Configuration>VT4</Configuration>
|
||||||
|
<Platform>x64</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
<ProjectConfiguration Include="VT5|Win32">
|
<ProjectConfiguration Include="VT5|Win32">
|
||||||
<Configuration>VT5</Configuration>
|
<Configuration>VT5</Configuration>
|
||||||
<Platform>Win32</Platform>
|
<Platform>Win32</Platform>
|
||||||
|
@ -37,9 +45,18 @@
|
||||||
<UseOfMfc>Dynamic</UseOfMfc>
|
<UseOfMfc>Dynamic</UseOfMfc>
|
||||||
<CharacterSet>MultiByte</CharacterSet>
|
<CharacterSet>MultiByte</CharacterSet>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='VT4|Win32'" Label="Configuration">
|
||||||
|
<PlatformToolset>v142</PlatformToolset>
|
||||||
|
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||||
|
<UseOfMfc>Dynamic</UseOfMfc>
|
||||||
|
<CharacterSet>MultiByte</CharacterSet>
|
||||||
|
</PropertyGroup>
|
||||||
<PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='VT5|x64'">
|
<PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='VT5|x64'">
|
||||||
<PlatformToolset>v142</PlatformToolset>
|
<PlatformToolset>v142</PlatformToolset>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='VT4|x64'" Label="Configuration">
|
||||||
|
<PlatformToolset>v142</PlatformToolset>
|
||||||
|
</PropertyGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||||
<ImportGroup Label="ExtensionSettings">
|
<ImportGroup Label="ExtensionSettings">
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
|
@ -51,17 +68,27 @@
|
||||||
<LinkIncremental>true</LinkIncremental>
|
<LinkIncremental>true</LinkIncremental>
|
||||||
<IntDir>Temp\$(Configuration)\</IntDir>
|
<IntDir>Temp\$(Configuration)\</IntDir>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='VT4|Win32'">
|
||||||
|
<OutDir>E:\Virtools\Virtools Dev 4.0\InterfacePlugins\</OutDir>
|
||||||
|
<LinkIncremental>true</LinkIncremental>
|
||||||
|
<IntDir>Temp\$(Configuration)\</IntDir>
|
||||||
|
</PropertyGroup>
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='VT5|Win32'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='VT5|Win32'">
|
||||||
<ClCompile>
|
<ClCompile>
|
||||||
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
|
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='VT4|Win32'">
|
||||||
|
<ClCompile>
|
||||||
|
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
|
||||||
|
</ClCompile>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='VT5|Win32'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='VT5|Win32'">
|
||||||
<ClCompile>
|
<ClCompile>
|
||||||
<WarningLevel>Level3</WarningLevel>
|
<WarningLevel>Level3</WarningLevel>
|
||||||
<AdditionalIncludeDirectories>D:\CppLib\SQLite\sqlite-amalgamation-3310100;E:\Virtools\Virtools Dev 5.0\Sdk\Includes;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>D:\CppLib\SQLite\sqlite-amalgamation-3310100;E:\Virtools\Virtools Dev 5.0\Sdk\Includes;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
<Optimization>Disabled</Optimization>
|
<Optimization>Disabled</Optimization>
|
||||||
<PreprocessorDefinitions>WIN32;_WINDOWS;_USRDLL;VX_MEM_RELEASE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>WIN32;_WINDOWS;_USRDLL;VIRTOOLS_5;VX_MEM_RELEASE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
|
@ -76,15 +103,43 @@
|
||||||
<ModuleDefinitionFile>SuperScriptMaterializer.def</ModuleDefinitionFile>
|
<ModuleDefinitionFile>SuperScriptMaterializer.def</ModuleDefinitionFile>
|
||||||
</Link>
|
</Link>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='VT4|Win32'">
|
||||||
|
<ClCompile>
|
||||||
|
<WarningLevel>Level3</WarningLevel>
|
||||||
|
<AdditionalIncludeDirectories>D:\CppLib\SQLite\sqlite-amalgamation-3310100;E:\Virtools\Virtools Dev 4.0\Sdk\Includes;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
|
<Optimization>Disabled</Optimization>
|
||||||
|
<PreprocessorDefinitions>WIN32;_WINDOWS;_USRDLL;VIRTOOLS_4;VX_MEM_RELEASE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<OutputFile>E:\Virtools\Virtools Dev 4.0\InterfacePlugins\$(ProjectName).dll</OutputFile>
|
||||||
|
</Link>
|
||||||
|
<Link>
|
||||||
|
<AdditionalLibraryDirectories>D:\CppLib\SQLite\sqlite-dll-win32-x86-3310100;E:\Virtools\Virtools Dev 4.0\Sdk\Lib\Win32\Release;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||||
|
<AdditionalDependencies>vxmath.lib;DllEditor.lib;ck2.lib;InterfaceControls.lib;CKControls.lib;sqlite3.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
<ProgramDatabaseFile>E:\Virtools\Virtools Dev 4.0\InterfacePlugins\$(ProjectName).pdb</ProgramDatabaseFile>
|
||||||
|
<SubSystem>Windows</SubSystem>
|
||||||
|
<ModuleDefinitionFile>SuperScriptMaterializer.def</ModuleDefinitionFile>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='VT5|x64'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='VT5|x64'">
|
||||||
<Link>
|
<Link>
|
||||||
<ModuleDefinitionFile>SuperScriptMaterializer.def</ModuleDefinitionFile>
|
<ModuleDefinitionFile>SuperScriptMaterializer.def</ModuleDefinitionFile>
|
||||||
</Link>
|
</Link>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='VT4|x64'">
|
||||||
|
<Link>
|
||||||
|
<ModuleDefinitionFile>SuperScriptMaterializer.def</ModuleDefinitionFile>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='VT35|Win32'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='VT35|Win32'">
|
||||||
<Link>
|
<Link>
|
||||||
<ModuleDefinitionFile>SuperScriptMaterializer.def</ModuleDefinitionFile>
|
<ModuleDefinitionFile>SuperScriptMaterializer.def</ModuleDefinitionFile>
|
||||||
</Link>
|
</Link>
|
||||||
|
<ClCompile>
|
||||||
|
<PreprocessorDefinitions>VIRTOOLS_35;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
</ClCompile>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='VT35|x64'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='VT35|x64'">
|
||||||
<Link>
|
<Link>
|
||||||
|
|
|
@ -12,8 +12,9 @@ void dbScriptDataStructHelper::init(CKParameterManager* paramManager) {
|
||||||
_db_bOut = new db_bOut();
|
_db_bOut = new db_bOut();
|
||||||
_db_bLink = new db_bLink();
|
_db_bLink = new db_bLink();
|
||||||
_db_pLocal = new db_pLocal();
|
_db_pLocal = new db_pLocal();
|
||||||
|
_db_pAttr = new db_pAttr();
|
||||||
_db_pLink = new db_pLink();
|
_db_pLink = new db_pLink();
|
||||||
_db_pLocalData = new db_pLocalData();
|
_db_pData = new db_pData();
|
||||||
_db_pOper = new db_pOper();
|
_db_pOper = new db_pOper();
|
||||||
_db_eLink = new db_eLink();
|
_db_eLink = new db_eLink();
|
||||||
|
|
||||||
|
@ -32,9 +33,10 @@ void dbScriptDataStructHelper::dispose() {
|
||||||
delete _db_bIn;
|
delete _db_bIn;
|
||||||
delete _db_bOut;
|
delete _db_bOut;
|
||||||
delete _db_bLink;
|
delete _db_bLink;
|
||||||
delete _db_pLocalData;
|
delete _db_pData;
|
||||||
delete _db_pLink;
|
delete _db_pLink;
|
||||||
delete _db_pLocal;
|
delete _db_pLocal;
|
||||||
|
delete _db_pAttr;
|
||||||
delete _db_pOper;
|
delete _db_pOper;
|
||||||
delete _db_eLink;
|
delete _db_eLink;
|
||||||
|
|
||||||
|
@ -71,7 +73,7 @@ void dbEnvDataStructHelper::dispose() {
|
||||||
|
|
||||||
void database::open(const char* file) {
|
void database::open(const char* file) {
|
||||||
db = NULL;
|
db = NULL;
|
||||||
stmtCache = new std::vector<sqlite3_stmt*>(13, NULL);
|
stmtCache = new std::vector<sqlite3_stmt*>(15, NULL);
|
||||||
|
|
||||||
//open db
|
//open db
|
||||||
int result;
|
int result;
|
||||||
|
@ -97,6 +99,8 @@ void database::close() {
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL scriptDatabase::init() {
|
BOOL scriptDatabase::init() {
|
||||||
|
pAttrUniqueEnsurance = new std::set<EXPAND_CK_ID>();
|
||||||
|
|
||||||
int result;
|
int result;
|
||||||
result = sqlite3_exec(db, "PRAGMA synchronous = OFF;", NULL, NULL, NULL);
|
result = sqlite3_exec(db, "PRAGMA synchronous = OFF;", NULL, NULL, NULL);
|
||||||
if (result != SQLITE_OK) return FALSE;
|
if (result != SQLITE_OK) return FALSE;
|
||||||
|
@ -142,7 +146,7 @@ BOOL scriptDatabase::init() {
|
||||||
NULL, NULL, NULL);
|
NULL, NULL, NULL);
|
||||||
if (result != SQLITE_OK) return FALSE;
|
if (result != SQLITE_OK) return FALSE;
|
||||||
result = sqlite3_exec(db,
|
result = sqlite3_exec(db,
|
||||||
"CREATE TABLE pLocalData([field] TEXT, [data] TEXT, [belong_to] INTEGER);",
|
"CREATE TABLE pData([field] TEXT, [data] TEXT, [belong_to] INTEGER);",
|
||||||
NULL, NULL, NULL);
|
NULL, NULL, NULL);
|
||||||
if (result != SQLITE_OK) return FALSE;
|
if (result != SQLITE_OK) return FALSE;
|
||||||
result = sqlite3_exec(db,
|
result = sqlite3_exec(db,
|
||||||
|
@ -157,6 +161,10 @@ BOOL scriptDatabase::init() {
|
||||||
"CREATE TABLE eLink([export_obj] INTEGER, [internal_obj] INTEGER, [is_in] INTEGER, [index] INTEGER, [belong_to] INTEGER);",
|
"CREATE TABLE eLink([export_obj] INTEGER, [internal_obj] INTEGER, [is_in] INTEGER, [index] INTEGER, [belong_to] INTEGER);",
|
||||||
NULL, NULL, NULL);
|
NULL, NULL, NULL);
|
||||||
if (result != SQLITE_OK) return FALSE;
|
if (result != SQLITE_OK) return FALSE;
|
||||||
|
result = sqlite3_exec(db,
|
||||||
|
"CREATE TABLE pAttr([thisobj] INTEGER, [name] TEXT, [type] TEXT, [type_guid] TEXT);",
|
||||||
|
NULL, NULL, NULL);
|
||||||
|
if (result != SQLITE_OK) return FALSE;
|
||||||
|
|
||||||
result = sqlite3_exec(db, "commit;", NULL, NULL, NULL);
|
result = sqlite3_exec(db, "commit;", NULL, NULL, NULL);
|
||||||
if (result != SQLITE_OK) return FALSE;
|
if (result != SQLITE_OK) return FALSE;
|
||||||
|
@ -188,8 +196,10 @@ BOOL scriptDatabase::finalJob() {
|
||||||
sqlite3_exec(db, "CREATE INDEX [quick_where9] ON pLink ([belong_to])", NULL, NULL, NULL);
|
sqlite3_exec(db, "CREATE INDEX [quick_where9] ON pLink ([belong_to])", NULL, NULL, NULL);
|
||||||
sqlite3_exec(db, "CREATE INDEX [quick_where10] ON bLink ([belong_to])", NULL, NULL, NULL);
|
sqlite3_exec(db, "CREATE INDEX [quick_where10] ON bLink ([belong_to])", NULL, NULL, NULL);
|
||||||
sqlite3_exec(db, "CREATE INDEX [quick_where11] ON elink ([belong_to])", NULL, NULL, NULL);
|
sqlite3_exec(db, "CREATE INDEX [quick_where11] ON elink ([belong_to])", NULL, NULL, NULL);
|
||||||
|
sqlite3_exec(db, "CREATE INDEX [quick_where12] ON pAttr ([thisobj])", NULL, NULL, NULL);
|
||||||
sqlite3_exec(db, "commit;", NULL, NULL, NULL);
|
sqlite3_exec(db, "commit;", NULL, NULL, NULL);
|
||||||
|
|
||||||
|
delete pAttrUniqueEnsurance;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -422,11 +432,11 @@ void scriptDatabase::write_pLink(db_pLink* data) {
|
||||||
sqlite3_step(stmt);
|
sqlite3_step(stmt);
|
||||||
}
|
}
|
||||||
|
|
||||||
void scriptDatabase::write_pLocalData(db_pLocalData* data) {
|
void scriptDatabase::write_pData(db_pData* data) {
|
||||||
if (db == NULL) return;
|
if (db == NULL) return;
|
||||||
|
|
||||||
sqlite3_stmt* stmt = NULL;
|
sqlite3_stmt* stmt = NULL;
|
||||||
tryGetStmt(10, "INSERT INTO pLocalData VALUES (?, ?, ?)");
|
tryGetStmt(10, "INSERT INTO pData VALUES (?, ?, ?)");
|
||||||
sqlite3_reset(stmt);
|
sqlite3_reset(stmt);
|
||||||
|
|
||||||
sqlite3_bind_text(stmt, 1, data->field.c_str(), -1, SQLITE_TRANSIENT);
|
sqlite3_bind_text(stmt, 1, data->field.c_str(), -1, SQLITE_TRANSIENT);
|
||||||
|
@ -464,6 +474,26 @@ void scriptDatabase::write_eLink(db_eLink* data) {
|
||||||
sqlite3_step(stmt);
|
sqlite3_step(stmt);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BOOL scriptDatabase::write_pAttr(db_pAttr* data) {
|
||||||
|
if (db == NULL) return TRUE;
|
||||||
|
|
||||||
|
if (pAttrUniqueEnsurance->find(data->thisobj) != pAttrUniqueEnsurance->end())
|
||||||
|
return FALSE; //existing item. skip it to make sure unique
|
||||||
|
pAttrUniqueEnsurance->insert(data->thisobj); //add this item
|
||||||
|
|
||||||
|
sqlite3_stmt* stmt = NULL;
|
||||||
|
tryGetStmt(13, "INSERT INTO pAttr VALUES (?, ?, ?, ?)");
|
||||||
|
sqlite3_reset(stmt);
|
||||||
|
|
||||||
|
sqlite3_bind_int(stmt, 1, data->thisobj);
|
||||||
|
sqlite3_bind_text(stmt, 2, data->name.c_str(), -1, SQLITE_TRANSIENT);
|
||||||
|
sqlite3_bind_text(stmt, 3, data->type.c_str(), -1, SQLITE_TRANSIENT);
|
||||||
|
sqlite3_bind_text(stmt, 4, data->type_guid.c_str(), -1, SQLITE_TRANSIENT);
|
||||||
|
sqlite3_step(stmt);
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
void envDatabase::write_envOp(db_envOp* data) {
|
void envDatabase::write_envOp(db_envOp* data) {
|
||||||
if (db == NULL) return;
|
if (db == NULL) return;
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
#include <set>
|
||||||
|
|
||||||
#define STRINGCACHE_SIZE 25565
|
#define STRINGCACHE_SIZE 25565
|
||||||
|
|
||||||
|
@ -16,8 +17,9 @@ enum bLinkInputOutputType {
|
||||||
enum pLinkInputOutputType {
|
enum pLinkInputOutputType {
|
||||||
pLinkInputOutputType_PIN,
|
pLinkInputOutputType_PIN,
|
||||||
pLinkInputOutputType_POUT,
|
pLinkInputOutputType_POUT,
|
||||||
pLinkInputOutputType_PLOCAL, //when using pLocal, omit [index] and [input_is_bb]
|
pLinkInputOutputType_PLOCAL, //when using pLocal, omit [index] and [input_is_bb], [input_index] set -1
|
||||||
pLinkInputOutputType_PTARGET //when using pTarget, omit [index] and [input_is_bb]
|
pLinkInputOutputType_PTARGET, //when using pTarget, omit [index] and [input_is_bb], [input_index] set -1
|
||||||
|
pLinkInputOutputType_PATTR //when using pAttr, omit [index] and [input_is_bb], [input_index] set -1
|
||||||
};
|
};
|
||||||
|
|
||||||
#pragma region data struct define
|
#pragma region data struct define
|
||||||
|
@ -106,11 +108,18 @@ typedef struct {
|
||||||
EXPAND_CK_ID belong_to;
|
EXPAND_CK_ID belong_to;
|
||||||
}db_pLocal;
|
}db_pLocal;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
EXPAND_CK_ID thisobj;
|
||||||
|
std::string name;
|
||||||
|
std::string type;
|
||||||
|
std::string type_guid;
|
||||||
|
}db_pAttr;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
std::string field;
|
std::string field;
|
||||||
std::string data;
|
std::string data;
|
||||||
EXPAND_CK_ID belong_to;
|
EXPAND_CK_ID belong_to;
|
||||||
}db_pLocalData;
|
}db_pData;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
EXPAND_CK_ID input;
|
EXPAND_CK_ID input;
|
||||||
|
@ -226,8 +235,9 @@ class dbScriptDataStructHelper {
|
||||||
db_bOut* _db_bOut;
|
db_bOut* _db_bOut;
|
||||||
db_bLink* _db_bLink;
|
db_bLink* _db_bLink;
|
||||||
db_pLocal* _db_pLocal;
|
db_pLocal* _db_pLocal;
|
||||||
|
db_pAttr* _db_pAttr;
|
||||||
db_pLink* _db_pLink;
|
db_pLink* _db_pLink;
|
||||||
db_pLocalData* _db_pLocalData;
|
db_pData* _db_pData;
|
||||||
db_pOper* _db_pOper;
|
db_pOper* _db_pOper;
|
||||||
db_eLink* _db_eLink;
|
db_eLink* _db_eLink;
|
||||||
};
|
};
|
||||||
|
@ -271,13 +281,16 @@ class scriptDatabase : public database {
|
||||||
void write_bLink(db_bLink* data);
|
void write_bLink(db_bLink* data);
|
||||||
void write_pLocal(db_pLocal* data);
|
void write_pLocal(db_pLocal* data);
|
||||||
void write_pLink(db_pLink* data);
|
void write_pLink(db_pLink* data);
|
||||||
void write_pLocalData(db_pLocalData* data);
|
void write_pData(db_pData* data);
|
||||||
void write_pOper(db_pOper* data);
|
void write_pOper(db_pOper* data);
|
||||||
void write_eLink(db_eLink* data);
|
void write_eLink(db_eLink* data);
|
||||||
|
BOOL write_pAttr(db_pAttr* data);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
BOOL init();
|
BOOL init();
|
||||||
BOOL finalJob();
|
BOOL finalJob();
|
||||||
|
|
||||||
|
std::set<EXPAND_CK_ID>* pAttrUniqueEnsurance;
|
||||||
};
|
};
|
||||||
|
|
||||||
class envDatabase : public database {
|
class envDatabase : public database {
|
||||||
|
|
|
@ -4,10 +4,11 @@
|
||||||
|
|
||||||
#define changeSuffix(a) prefix[endIndex]='\0';strcat(prefix,a)
|
#define changeSuffix(a) prefix[endIndex]='\0';strcat(prefix,a)
|
||||||
#define copyGuid(guid,str) sprintf(helper->_stringCache,"%d,%d",guid.d1,guid.d2);str=helper->_stringCache;
|
#define copyGuid(guid,str) sprintf(helper->_stringCache,"%d,%d",guid.d1,guid.d2);str=helper->_stringCache;
|
||||||
|
#define safeStringCopy(storage,str) storage=(str)?(str):"";
|
||||||
|
|
||||||
#pragma region inline func
|
#pragma region inline func
|
||||||
|
|
||||||
inline void generate_pLink_in_pIn(CKContext* ctx, CKParameterIn* cache, scriptDatabase* db, dbScriptDataStructHelper* helper, EXPAND_CK_ID parents, EXPAND_CK_ID grandparents, int index, BOOL executedFromBB, BOOL isTarget) {
|
void generate_pLink_in_pIn(CKContext* ctx, CKParameterIn* cache, scriptDatabase* db, dbScriptDataStructHelper* helper, EXPAND_CK_ID parents, EXPAND_CK_ID grandparents, int index, BOOL executedFromBB, BOOL isTarget) {
|
||||||
//WARNING: i only choose one between [DirectSource] and [SharedSource] bucause i don't find any pIn both have these two field
|
//WARNING: i only choose one between [DirectSource] and [SharedSource] bucause i don't find any pIn both have these two field
|
||||||
CKParameter* directSource = NULL;
|
CKParameter* directSource = NULL;
|
||||||
CKObject* ds_Owner = NULL;
|
CKObject* ds_Owner = NULL;
|
||||||
|
@ -15,26 +16,45 @@ inline void generate_pLink_in_pIn(CKContext* ctx, CKParameterIn* cache, scriptDa
|
||||||
CKBehavior* ss_Owner = NULL;
|
CKBehavior* ss_Owner = NULL;
|
||||||
if (directSource = cache->GetDirectSource()) {
|
if (directSource = cache->GetDirectSource()) {
|
||||||
helper->_db_pLink->input = directSource->GetID();
|
helper->_db_pLink->input = directSource->GetID();
|
||||||
if (directSource->GetClassID() == CKCID_PARAMETERLOCAL) {
|
if (directSource->GetClassID() == CKCID_PARAMETERLOCAL || directSource->GetClassID() == CKCID_PARAMETERVARIABLE) {
|
||||||
//pLocal
|
//pLocal
|
||||||
helper->_db_pLink->input_obj = directSource->GetID();
|
helper->_db_pLink->input_obj = directSource->GetID();
|
||||||
helper->_db_pLink->input_type = pLinkInputOutputType_PLOCAL;
|
helper->_db_pLink->input_type = pLinkInputOutputType_PLOCAL;
|
||||||
helper->_db_pLink->input_is_bb = FALSE;
|
helper->_db_pLink->input_is_bb = FALSE;
|
||||||
helper->_db_pLink->input_index = -1;
|
helper->_db_pLink->input_index = -1;
|
||||||
} else {
|
} else {
|
||||||
//pOut
|
//WARNING: when GetClassID() return CKDataArray there are untested code
|
||||||
|
//pParam from bb pOut / pOper pOut / object Attribute / CKDataArray
|
||||||
ds_Owner = directSource->GetOwner();
|
ds_Owner = directSource->GetOwner();
|
||||||
helper->_db_pLink->input_obj = ds_Owner->GetID();
|
switch (ds_Owner->GetClassID()) {
|
||||||
helper->_db_pLink->input_type = pLinkInputOutputType_POUT;
|
case CKCID_BEHAVIOR:
|
||||||
//WARNING: untested doe to GetClassID() may have chance to return Attributes or CKDataArray accoring to document
|
helper->_db_pLink->input_obj = ds_Owner->GetID();
|
||||||
if (helper->_db_pLink->input_is_bb = (ds_Owner->GetClassID() != CKCID_PARAMETEROPERATION)) {
|
helper->_db_pLink->input_type = pLinkInputOutputType_POUT;
|
||||||
//bb
|
helper->_db_pLink->input_is_bb = TRUE;
|
||||||
helper->_db_pLink->input_index = ((CKBehavior*)ds_Owner)->GetOutputParameterPosition((CKParameterOut*)directSource);
|
helper->_db_pLink->input_index = ((CKBehavior*)ds_Owner)->GetOutputParameterPosition((CKParameterOut*)directSource);
|
||||||
|
break;
|
||||||
} else {
|
case CKCID_PARAMETEROPERATION:
|
||||||
//pOper
|
helper->_db_pLink->input_obj = ds_Owner->GetID();
|
||||||
helper->_db_pLink->input_index = 0;
|
helper->_db_pLink->input_type = pLinkInputOutputType_POUT;
|
||||||
|
helper->_db_pLink->input_is_bb = FALSE;
|
||||||
|
helper->_db_pLink->input_index = 0;
|
||||||
|
break;
|
||||||
|
case CKCID_DATAARRAY:
|
||||||
|
// dataarray, see as virtual bb pLocal shortcut
|
||||||
|
helper->_db_pLink->input_obj = directSource->GetID();
|
||||||
|
helper->_db_pLink->input_type = pLinkInputOutputType_PATTR;
|
||||||
|
helper->_db_pLink->input_is_bb = FALSE;
|
||||||
|
helper->_db_pLink->input_index = -1;
|
||||||
|
proc_pAttr(ctx, db, helper, directSource);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
//normal object, see as virtual bb pLocal shortcut
|
||||||
|
helper->_db_pLink->input_obj = directSource->GetID();
|
||||||
|
helper->_db_pLink->input_type = pLinkInputOutputType_PATTR;
|
||||||
|
helper->_db_pLink->input_is_bb = FALSE;
|
||||||
|
helper->_db_pLink->input_index = -1;
|
||||||
|
proc_pAttr(ctx, db, helper, directSource);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -72,7 +92,7 @@ inline void generate_pLink_in_pIn(CKContext* ctx, CKParameterIn* cache, scriptDa
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void proc_pTarget(CKContext* ctx, CKParameterIn* cache, scriptDatabase* db, dbScriptDataStructHelper* helper, EXPAND_CK_ID parents, EXPAND_CK_ID grandparents) {
|
void proc_pTarget(CKContext* ctx, CKParameterIn* cache, scriptDatabase* db, dbScriptDataStructHelper* helper, EXPAND_CK_ID parents, EXPAND_CK_ID grandparents) {
|
||||||
helper->_db_pTarget->thisobj = cache->GetID();
|
helper->_db_pTarget->thisobj = cache->GetID();
|
||||||
helper->_db_pTarget->name = cache->GetName();
|
helper->_db_pTarget->name = cache->GetName();
|
||||||
helper->_db_pTarget->type = helper->_parameterManager->ParameterTypeToName(cache->GetType());
|
helper->_db_pTarget->type = helper->_parameterManager->ParameterTypeToName(cache->GetType());
|
||||||
|
@ -99,7 +119,7 @@ inline void proc_pTarget(CKContext* ctx, CKParameterIn* cache, scriptDatabase* d
|
||||||
generate_pLink_in_pIn(ctx, cache, db, helper, parents, grandparents, -1, TRUE, TRUE);
|
generate_pLink_in_pIn(ctx, cache, db, helper, parents, grandparents, -1, TRUE, TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void proc_pIn(CKContext* ctx, CKParameterIn* cache, scriptDatabase* db, dbScriptDataStructHelper* helper, EXPAND_CK_ID parents, EXPAND_CK_ID grandparents, int index, BOOL executedFromBB) {
|
void proc_pIn(CKContext* ctx, CKParameterIn* cache, scriptDatabase* db, dbScriptDataStructHelper* helper, EXPAND_CK_ID parents, EXPAND_CK_ID grandparents, int index, BOOL executedFromBB) {
|
||||||
helper->_db_pIn->thisobj = cache->GetID();
|
helper->_db_pIn->thisobj = cache->GetID();
|
||||||
helper->_db_pIn->index = index;
|
helper->_db_pIn->index = index;
|
||||||
helper->_db_pIn->name = cache->GetName();
|
helper->_db_pIn->name = cache->GetName();
|
||||||
|
@ -130,7 +150,7 @@ inline void proc_pIn(CKContext* ctx, CKParameterIn* cache, scriptDatabase* db, d
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void proc_pOut(CKContext* ctx, CKParameterOut* cache, scriptDatabase* db, dbScriptDataStructHelper* helper, EXPAND_CK_ID parents, EXPAND_CK_ID grandparents, int index, BOOL executedFromBB) {
|
void proc_pOut(CKContext* ctx, CKParameterOut* cache, scriptDatabase* db, dbScriptDataStructHelper* helper, EXPAND_CK_ID parents, EXPAND_CK_ID grandparents, int index, BOOL executedFromBB) {
|
||||||
helper->_db_pOut->thisobj = cache->GetID();
|
helper->_db_pOut->thisobj = cache->GetID();
|
||||||
helper->_db_pOut->index = index;
|
helper->_db_pOut->index = index;
|
||||||
helper->_db_pOut->name = cache->GetName();
|
helper->_db_pOut->name = cache->GetName();
|
||||||
|
@ -191,7 +211,7 @@ inline void proc_pOut(CKContext* ctx, CKParameterOut* cache, scriptDatabase* db,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void proc_bIn(CKBehaviorIO* cache, scriptDatabase* db, dbScriptDataStructHelper* helper, EXPAND_CK_ID parents, int index) {
|
void proc_bIn(CKBehaviorIO* cache, scriptDatabase* db, dbScriptDataStructHelper* helper, EXPAND_CK_ID parents, int index) {
|
||||||
helper->_db_bIn->thisobj = cache->GetID();
|
helper->_db_bIn->thisobj = cache->GetID();
|
||||||
helper->_db_bIn->index = index;
|
helper->_db_bIn->index = index;
|
||||||
helper->_db_bIn->name = cache->GetName();
|
helper->_db_bIn->name = cache->GetName();
|
||||||
|
@ -200,7 +220,7 @@ inline void proc_bIn(CKBehaviorIO* cache, scriptDatabase* db, dbScriptDataStruct
|
||||||
db->write_bIn(helper->_db_bIn);
|
db->write_bIn(helper->_db_bIn);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void proc_bOut(CKBehaviorIO* cache, scriptDatabase* db, dbScriptDataStructHelper* helper, EXPAND_CK_ID parents, int index) {
|
void proc_bOut(CKBehaviorIO* cache, scriptDatabase* db, dbScriptDataStructHelper* helper, EXPAND_CK_ID parents, int index) {
|
||||||
helper->_db_bOut->thisobj = cache->GetID();
|
helper->_db_bOut->thisobj = cache->GetID();
|
||||||
helper->_db_bOut->index = index;
|
helper->_db_bOut->index = index;
|
||||||
helper->_db_bOut->name = cache->GetName();
|
helper->_db_bOut->name = cache->GetName();
|
||||||
|
@ -209,7 +229,7 @@ inline void proc_bOut(CKBehaviorIO* cache, scriptDatabase* db, dbScriptDataStruc
|
||||||
db->write_bOut(helper->_db_bOut);
|
db->write_bOut(helper->_db_bOut);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void proc_bLink(CKBehaviorLink* cache, scriptDatabase* db, dbScriptDataStructHelper* helper, EXPAND_CK_ID parents) {
|
void proc_bLink(CKBehaviorLink* cache, scriptDatabase* db, dbScriptDataStructHelper* helper, EXPAND_CK_ID parents) {
|
||||||
CKBehaviorIO* io = cache->GetInBehaviorIO();
|
CKBehaviorIO* io = cache->GetInBehaviorIO();
|
||||||
CKBehavior* beh = io->GetOwner();
|
CKBehavior* beh = io->GetOwner();
|
||||||
helper->_db_bLink->input = io->GetID();
|
helper->_db_bLink->input = io->GetID();
|
||||||
|
@ -229,7 +249,7 @@ inline void proc_bLink(CKBehaviorLink* cache, scriptDatabase* db, dbScriptDataSt
|
||||||
db->write_bLink(helper->_db_bLink);
|
db->write_bLink(helper->_db_bLink);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void proc_pLocal(CKParameterLocal* cache, scriptDatabase* db, dbScriptDataStructHelper* helper, EXPAND_CK_ID parents, BOOL is_setting) {
|
void proc_pLocal(CKParameterLocal* cache, scriptDatabase* db, dbScriptDataStructHelper* helper, EXPAND_CK_ID parents, BOOL is_setting) {
|
||||||
helper->_db_pLocal->thisobj = cache->GetID();
|
helper->_db_pLocal->thisobj = cache->GetID();
|
||||||
helper->_db_pLocal->name = cache->GetName() ? cache->GetName() : "";
|
helper->_db_pLocal->name = cache->GetName() ? cache->GetName() : "";
|
||||||
CKParameterType vaildTypeChecker = cache->GetType();
|
CKParameterType vaildTypeChecker = cache->GetType();
|
||||||
|
@ -242,10 +262,10 @@ inline void proc_pLocal(CKParameterLocal* cache, scriptDatabase* db, dbScriptDat
|
||||||
db->write_pLocal(helper->_db_pLocal);
|
db->write_pLocal(helper->_db_pLocal);
|
||||||
|
|
||||||
//export plocal metadata
|
//export plocal metadata
|
||||||
IteratepLocalData(cache, db, helper, cache->GetID());
|
DigParameterData(cache, db, helper, cache->GetID());
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void proc_pOper(CKContext* ctx, CKParameterOperation* cache, scriptDatabase* db, dbScriptDataStructHelper* helper, EXPAND_CK_ID parents) {
|
void proc_pOper(CKContext* ctx, CKParameterOperation* cache, scriptDatabase* db, dbScriptDataStructHelper* helper, EXPAND_CK_ID parents) {
|
||||||
helper->_db_pOper->thisobj = cache->GetID();
|
helper->_db_pOper->thisobj = cache->GetID();
|
||||||
helper->_db_pOper->op = helper->_parameterManager->OperationGuidToName(cache->GetOperationGuid());
|
helper->_db_pOper->op = helper->_parameterManager->OperationGuidToName(cache->GetOperationGuid());
|
||||||
copyGuid(cache->GetOperationGuid(), helper->_db_pOper->op_guid);
|
copyGuid(cache->GetOperationGuid(), helper->_db_pOper->op_guid);
|
||||||
|
@ -259,24 +279,41 @@ inline void proc_pOper(CKContext* ctx, CKParameterOperation* cache, scriptDataba
|
||||||
proc_pOut(ctx, cache->GetOutParameter(), db, helper, cache->GetID(), parents, 0, FALSE);
|
proc_pOut(ctx, cache->GetOutParameter(), db, helper, cache->GetID(), parents, 0, FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void proc_pAttr(CKContext* ctx, scriptDatabase* db, dbScriptDataStructHelper* helper, CKParameter* cache) {
|
||||||
|
//write self first to detect conflict
|
||||||
|
helper->_db_pAttr->thisobj = cache->GetID();
|
||||||
|
safeStringCopy(helper->_db_pAttr->name, cache->GetName());
|
||||||
|
CKParameterType vaildTypeChecker = cache->GetType();
|
||||||
|
if (vaildTypeChecker != -1) helper->_db_pAttr->type = helper->_parameterManager->ParameterTypeToName(cache->GetType()); //known types
|
||||||
|
else helper->_db_pAttr->type = "!!UNKNOW TYPE!!"; //unknow type
|
||||||
|
copyGuid(cache->GetGUID(), helper->_db_pAttr->type_guid);
|
||||||
|
|
||||||
|
if (!db->write_pAttr(helper->_db_pAttr))
|
||||||
|
return;
|
||||||
|
|
||||||
|
//not duplicated, continue write property
|
||||||
|
CKObject* host = cache->GetOwner();
|
||||||
|
helper_pDataExport("attr.host_id", (long)host->GetID(), db, helper, cache->GetID());
|
||||||
|
helper_pDataExport("attr.host_name", host->GetName(), db, helper, cache->GetID());
|
||||||
|
}
|
||||||
|
|
||||||
//============================helper for pLocal data export
|
//============================helper for pLocal data export
|
||||||
inline void helper_pLocalDataExport(const char* field, const char* data, scriptDatabase* db, dbScriptDataStructHelper* helper, EXPAND_CK_ID parents) {
|
void helper_pDataExport(const char* field, const char* data, scriptDatabase* db, dbScriptDataStructHelper* helper, EXPAND_CK_ID parents) {
|
||||||
helper->_db_pLocalData->field = field;
|
helper->_db_pData->field = field;
|
||||||
helper->_db_pLocalData->data = data;
|
helper->_db_pData->data = data;
|
||||||
helper->_db_pLocalData->belong_to = parents;
|
helper->_db_pData->belong_to = parents;
|
||||||
|
|
||||||
db->write_pLocalData(helper->_db_pLocalData);
|
db->write_pData(helper->_db_pData);
|
||||||
}
|
}
|
||||||
inline void helper_pLocalDataExport(const char* field, float data, scriptDatabase* db, dbScriptDataStructHelper* helper, EXPAND_CK_ID parents) {
|
void helper_pDataExport(const char* field, float data, scriptDatabase* db, dbScriptDataStructHelper* helper, EXPAND_CK_ID parents) {
|
||||||
char str[32];
|
char str[32];
|
||||||
sprintf(str, "%f", data);
|
sprintf(str, "%f", data);
|
||||||
helper_pLocalDataExport(field, str, db, helper, parents);
|
helper_pDataExport(field, str, db, helper, parents);
|
||||||
}
|
}
|
||||||
inline void helper_pLocalDataExport(const char* field, long data, scriptDatabase* db, dbScriptDataStructHelper* helper, EXPAND_CK_ID parents) {
|
void helper_pDataExport(const char* field, long data, scriptDatabase* db, dbScriptDataStructHelper* helper, EXPAND_CK_ID parents) {
|
||||||
char str[32];
|
char str[32];
|
||||||
ltoa(data, str, 10);
|
ltoa(data, str, 10);
|
||||||
helper_pLocalDataExport(field, str, db, helper, parents);
|
helper_pDataExport(field, str, db, helper, parents);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -363,7 +400,7 @@ void IterateBehavior(CKContext* ctx, CKBehavior* bhv, scriptDatabase* db, dbScri
|
||||||
IterateBehavior(ctx, bhv->GetSubBehavior(i), db, helper, bhv->GetID());
|
IterateBehavior(ctx, bhv->GetSubBehavior(i), db, helper, bhv->GetID());
|
||||||
}
|
}
|
||||||
|
|
||||||
void IteratepLocalData(CKParameterLocal* p, scriptDatabase* db, dbScriptDataStructHelper* helper, EXPAND_CK_ID parents) {
|
void DigParameterData(CKParameterLocal* p, scriptDatabase* db, dbScriptDataStructHelper* helper, EXPAND_CK_ID parents) {
|
||||||
CKGUID t = p->GetGUID();
|
CKGUID t = p->GetGUID();
|
||||||
BOOL unknowType = FALSE;
|
BOOL unknowType = FALSE;
|
||||||
|
|
||||||
|
@ -372,15 +409,15 @@ void IteratepLocalData(CKParameterLocal* p, scriptDatabase* db, dbScriptDataStru
|
||||||
//nothing
|
//nothing
|
||||||
if (t == CKPGUID_NONE) return;
|
if (t == CKPGUID_NONE) return;
|
||||||
if (p->GetParameterClassID() && p->GetValueObject(false)) {
|
if (p->GetParameterClassID() && p->GetValueObject(false)) {
|
||||||
helper_pLocalDataExport("id", (long)p->GetValueObject(false)->GetID(), db, helper, parents);
|
helper_pDataExport("id", (long)p->GetValueObject(false)->GetID(), db, helper, parents);
|
||||||
helper_pLocalDataExport("name", p->GetValueObject(false)->GetName(), db, helper, parents);
|
helper_pDataExport("name", p->GetValueObject(false)->GetName(), db, helper, parents);
|
||||||
helper_pLocalDataExport("type", p->GetValueObject(false)->GetClassNameA(), db, helper, parents);
|
helper_pDataExport("type", p->GetValueObject(false)->GetClassNameA(), db, helper, parents);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
//float
|
//float
|
||||||
if (t == CKPGUID_FLOAT || t == CKPGUID_ANGLE || t == CKPGUID_PERCENTAGE || t == CKPGUID_TIME
|
if (t == CKPGUID_FLOAT || t == CKPGUID_ANGLE || t == CKPGUID_PERCENTAGE || t == CKPGUID_TIME
|
||||||
|| t == CKPGUID_FLOATSLIDER) {
|
|| t == CKPGUID_FLOATSLIDER) {
|
||||||
helper_pLocalDataExport("float-data", *(float*)(p->GetReadDataPtr(false)), db, helper, parents);
|
helper_pDataExport("float-data", *(float*)(p->GetReadDataPtr(false)), db, helper, parents);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
//int
|
//int
|
||||||
|
@ -391,22 +428,22 @@ void IteratepLocalData(CKParameterLocal* p, scriptDatabase* db, dbScriptDataStru
|
||||||
|| t == CKPGUID_LIGHTTYPE || t == CKPGUID_SPRITEALIGN || t == CKPGUID_DIRECTION || t == CKPGUID_LAYERTYPE
|
|| t == CKPGUID_LIGHTTYPE || t == CKPGUID_SPRITEALIGN || t == CKPGUID_DIRECTION || t == CKPGUID_LAYERTYPE
|
||||||
|| t == CKPGUID_COMPOPERATOR || t == CKPGUID_BINARYOPERATOR || t == CKPGUID_SETOPERATOR
|
|| t == CKPGUID_COMPOPERATOR || t == CKPGUID_BINARYOPERATOR || t == CKPGUID_SETOPERATOR
|
||||||
|| t == CKPGUID_OBSTACLEPRECISION || t == CKPGUID_OBSTACLEPRECISIONBEH) {
|
|| t == CKPGUID_OBSTACLEPRECISION || t == CKPGUID_OBSTACLEPRECISIONBEH) {
|
||||||
helper_pLocalDataExport("int-data", (long)(*(int*)(p->GetReadDataPtr(false))), db, helper, parents);
|
helper_pDataExport("int-data", (long)(*(int*)(p->GetReadDataPtr(false))), db, helper, parents);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (t == CKPGUID_VECTOR) {
|
if (t == CKPGUID_VECTOR) {
|
||||||
VxVector vec;
|
VxVector vec;
|
||||||
memcpy(&vec, p->GetReadDataPtr(false), sizeof(vec));
|
memcpy(&vec, p->GetReadDataPtr(false), sizeof(vec));
|
||||||
helper_pLocalDataExport("vector.x", vec.x, db, helper, parents);
|
helper_pDataExport("vector.x", vec.x, db, helper, parents);
|
||||||
helper_pLocalDataExport("vector.y", vec.y, db, helper, parents);
|
helper_pDataExport("vector.y", vec.y, db, helper, parents);
|
||||||
helper_pLocalDataExport("vector.z", vec.z, db, helper, parents);
|
helper_pDataExport("vector.z", vec.z, db, helper, parents);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (t == CKPGUID_2DVECTOR) {
|
if (t == CKPGUID_2DVECTOR) {
|
||||||
Vx2DVector vec;
|
Vx2DVector vec;
|
||||||
memcpy(&vec, p->GetReadDataPtr(false), sizeof(vec));
|
memcpy(&vec, p->GetReadDataPtr(false), sizeof(vec));
|
||||||
helper_pLocalDataExport("2dvector.x", vec.x, db, helper, parents);
|
helper_pDataExport("2dvector.x", vec.x, db, helper, parents);
|
||||||
helper_pLocalDataExport("2dvector.y", vec.y, db, helper, parents);
|
helper_pDataExport("2dvector.y", vec.y, db, helper, parents);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (t == CKPGUID_MATRIX) {
|
if (t == CKPGUID_MATRIX) {
|
||||||
|
@ -417,7 +454,7 @@ void IteratepLocalData(CKParameterLocal* p, scriptDatabase* db, dbScriptDataStru
|
||||||
for (int i = 0; i < 4; ++i) {
|
for (int i = 0; i < 4; ++i) {
|
||||||
for (int j = 0; j < 4; ++j) {
|
for (int j = 0; j < 4; ++j) {
|
||||||
sprintf(position, "matrix[%d][%d]", i, j);
|
sprintf(position, "matrix[%d][%d]", i, j);
|
||||||
helper_pLocalDataExport(position, mat[i][j], db, helper, parents);
|
helper_pDataExport(position, mat[i][j], db, helper, parents);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
@ -425,10 +462,10 @@ void IteratepLocalData(CKParameterLocal* p, scriptDatabase* db, dbScriptDataStru
|
||||||
if (t == CKPGUID_COLOR) {
|
if (t == CKPGUID_COLOR) {
|
||||||
VxColor col;
|
VxColor col;
|
||||||
memcpy(&col, p->GetReadDataPtr(false), sizeof(col));
|
memcpy(&col, p->GetReadDataPtr(false), sizeof(col));
|
||||||
helper_pLocalDataExport("color.r", col.r, db, helper, parents);
|
helper_pDataExport("color.r", col.r, db, helper, parents);
|
||||||
helper_pLocalDataExport("color.g", col.g, db, helper, parents);
|
helper_pDataExport("color.g", col.g, db, helper, parents);
|
||||||
helper_pLocalDataExport("color.b", col.b, db, helper, parents);
|
helper_pDataExport("color.b", col.b, db, helper, parents);
|
||||||
helper_pLocalDataExport("color.a", col.a, db, helper, parents);
|
helper_pDataExport("color.a", col.a, db, helper, parents);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (t == CKPGUID_2DCURVE) {
|
if (t == CKPGUID_2DCURVE) {
|
||||||
|
@ -441,27 +478,27 @@ void IteratepLocalData(CKParameterLocal* p, scriptDatabase* db, dbScriptDataStru
|
||||||
endIndex = strlen(prefix);
|
endIndex = strlen(prefix);
|
||||||
|
|
||||||
changeSuffix(".pos.x");
|
changeSuffix(".pos.x");
|
||||||
helper_pLocalDataExport(prefix, c->GetControlPoint(i)->GetPosition().x, db, helper, parents);
|
helper_pDataExport(prefix, c->GetControlPoint(i)->GetPosition().x, db, helper, parents);
|
||||||
changeSuffix(".pos.y");
|
changeSuffix(".pos.y");
|
||||||
helper_pLocalDataExport(prefix, c->GetControlPoint(i)->GetPosition().y, db, helper, parents);
|
helper_pDataExport(prefix, c->GetControlPoint(i)->GetPosition().y, db, helper, parents);
|
||||||
changeSuffix(".islinear");
|
changeSuffix(".islinear");
|
||||||
helper_pLocalDataExport(prefix, (long)c->GetControlPoint(i)->IsLinear(), db, helper, parents);
|
helper_pDataExport(prefix, (long)c->GetControlPoint(i)->IsLinear(), db, helper, parents);
|
||||||
if (c->GetControlPoint(i)->IsTCB()) {
|
if (c->GetControlPoint(i)->IsTCB()) {
|
||||||
changeSuffix(".bias");
|
changeSuffix(".bias");
|
||||||
helper_pLocalDataExport(prefix, c->GetControlPoint(i)->GetBias(), db, helper, parents);
|
helper_pDataExport(prefix, c->GetControlPoint(i)->GetBias(), db, helper, parents);
|
||||||
changeSuffix(".continuity");
|
changeSuffix(".continuity");
|
||||||
helper_pLocalDataExport(prefix, c->GetControlPoint(i)->GetContinuity(), db, helper, parents);
|
helper_pDataExport(prefix, c->GetControlPoint(i)->GetContinuity(), db, helper, parents);
|
||||||
changeSuffix(".tension");
|
changeSuffix(".tension");
|
||||||
helper_pLocalDataExport(prefix, c->GetControlPoint(i)->GetTension(), db, helper, parents);
|
helper_pDataExport(prefix, c->GetControlPoint(i)->GetTension(), db, helper, parents);
|
||||||
} else {
|
} else {
|
||||||
changeSuffix(".intangent.x");
|
changeSuffix(".intangent.x");
|
||||||
helper_pLocalDataExport(prefix, c->GetControlPoint(i)->GetInTangent().x, db, helper, parents);
|
helper_pDataExport(prefix, c->GetControlPoint(i)->GetInTangent().x, db, helper, parents);
|
||||||
changeSuffix(".intangent.y");
|
changeSuffix(".intangent.y");
|
||||||
helper_pLocalDataExport(prefix, c->GetControlPoint(i)->GetInTangent().y, db, helper, parents);
|
helper_pDataExport(prefix, c->GetControlPoint(i)->GetInTangent().y, db, helper, parents);
|
||||||
changeSuffix(".outtangent.x");
|
changeSuffix(".outtangent.x");
|
||||||
helper_pLocalDataExport(prefix, c->GetControlPoint(i)->GetOutTangent().x, db, helper, parents);
|
helper_pDataExport(prefix, c->GetControlPoint(i)->GetOutTangent().x, db, helper, parents);
|
||||||
changeSuffix(".outtangent.y");
|
changeSuffix(".outtangent.y");
|
||||||
helper_pLocalDataExport(prefix, c->GetControlPoint(i)->GetOutTangent().y, db, helper, parents);
|
helper_pDataExport(prefix, c->GetControlPoint(i)->GetOutTangent().y, db, helper, parents);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
@ -470,11 +507,11 @@ void IteratepLocalData(CKParameterLocal* p, scriptDatabase* db, dbScriptDataStru
|
||||||
char* cptr = (char*)p->GetReadDataPtr(false);
|
char* cptr = (char*)p->GetReadDataPtr(false);
|
||||||
int cc = p->GetDataSize();
|
int cc = p->GetDataSize();
|
||||||
|
|
||||||
helper->_db_pLocalData->data.clear();
|
helper->_db_pData->data.clear();
|
||||||
helper->_db_pLocalData->data.insert(0, cptr, 0, cc);
|
helper->_db_pData->data.insert(0, cptr, 0, cc);
|
||||||
helper->_db_pLocalData->field = "str";
|
helper->_db_pData->field = "str";
|
||||||
helper->_db_pLocalData->belong_to = p->GetID();
|
helper->_db_pData->belong_to = p->GetID();
|
||||||
db->write_pLocalData(helper->_db_pLocalData);
|
db->write_pData(helper->_db_pData);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -489,24 +526,24 @@ void IteratepLocalData(CKParameterLocal* p, scriptDatabase* db, dbScriptDataStru
|
||||||
rcc = cc = p->GetDataSize();
|
rcc = cc = p->GetDataSize();
|
||||||
if (rcc > 1024) rcc = 1024;
|
if (rcc > 1024) rcc = 1024;
|
||||||
|
|
||||||
helper->_db_pLocalData->data.clear();
|
helper->_db_pData->data.clear();
|
||||||
for (int i = 0; i < rcc; i++) {
|
for (int i = 0; i < rcc; i++) {
|
||||||
sprintf(temp, "0x%02X", cptr[i]);
|
sprintf(temp, "0x%02X", cptr[i]);
|
||||||
|
|
||||||
helper->_db_pLocalData->data += temp;
|
helper->_db_pData->data += temp;
|
||||||
if (i != rcc - 1)
|
if (i != rcc - 1)
|
||||||
helper->_db_pLocalData->data += ", ";
|
helper->_db_pData->data += ", ";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rcc == cc)
|
if (rcc == cc)
|
||||||
helper->_db_pLocalData->field = "dump.data";
|
helper->_db_pData->field = "dump.data";
|
||||||
else
|
else
|
||||||
helper->_db_pLocalData->field = "dump.partial_data";
|
helper->_db_pData->field = "dump.partial_data";
|
||||||
helper->_db_pLocalData->belong_to = p->GetID();
|
helper->_db_pData->belong_to = p->GetID();
|
||||||
db->write_pLocalData(helper->_db_pLocalData);
|
db->write_pData(helper->_db_pData);
|
||||||
|
|
||||||
//dump data length
|
//dump data length
|
||||||
helper_pLocalDataExport("dump.length", (long)cc, db, helper, parents);
|
helper_pDataExport("dump.length", (long)cc, db, helper, parents);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,22 +4,23 @@
|
||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
#include "database.h"
|
#include "database.h"
|
||||||
|
|
||||||
inline void generate_pLink_in_pIn(CKContext* ctx, CKParameterIn* cache, scriptDatabase* db, dbScriptDataStructHelper* helper, EXPAND_CK_ID parents, EXPAND_CK_ID grandparents, int index, BOOL executedFromBB, BOOL isTarget);
|
void generate_pLink_in_pIn(CKContext* ctx, CKParameterIn* cache, scriptDatabase* db, dbScriptDataStructHelper* helper, EXPAND_CK_ID parents, EXPAND_CK_ID grandparents, int index, BOOL executedFromBB, BOOL isTarget);
|
||||||
inline void proc_pTarget(CKContext* ctx, CKParameterIn* cache, scriptDatabase* db, dbScriptDataStructHelper* helper, EXPAND_CK_ID parents, EXPAND_CK_ID grandparents);
|
void proc_pTarget(CKContext* ctx, CKParameterIn* cache, scriptDatabase* db, dbScriptDataStructHelper* helper, EXPAND_CK_ID parents, EXPAND_CK_ID grandparents);
|
||||||
inline void proc_pIn(CKContext* ctx, CKParameterIn* cache, scriptDatabase* db, dbScriptDataStructHelper* helper, EXPAND_CK_ID parents, EXPAND_CK_ID grandparents, int index, BOOL executedFromBB);
|
void proc_pIn(CKContext* ctx, CKParameterIn* cache, scriptDatabase* db, dbScriptDataStructHelper* helper, EXPAND_CK_ID parents, EXPAND_CK_ID grandparents, int index, BOOL executedFromBB);
|
||||||
inline void proc_pOut(CKContext* ctx, CKParameterOut* cache, scriptDatabase* db, dbScriptDataStructHelper* helper, EXPAND_CK_ID parents, EXPAND_CK_ID grandparents, int index, BOOL executedFromBB);
|
void proc_pOut(CKContext* ctx, CKParameterOut* cache, scriptDatabase* db, dbScriptDataStructHelper* helper, EXPAND_CK_ID parents, EXPAND_CK_ID grandparents, int index, BOOL executedFromBB);
|
||||||
inline void proc_bIn(CKBehaviorIO* cache, scriptDatabase* db, dbScriptDataStructHelper* helper, EXPAND_CK_ID parents, int index);
|
void proc_bIn(CKBehaviorIO* cache, scriptDatabase* db, dbScriptDataStructHelper* helper, EXPAND_CK_ID parents, int index);
|
||||||
inline void proc_bOut(CKBehaviorIO* cache, scriptDatabase* db, dbScriptDataStructHelper* helper, EXPAND_CK_ID parents, int index);
|
void proc_bOut(CKBehaviorIO* cache, scriptDatabase* db, dbScriptDataStructHelper* helper, EXPAND_CK_ID parents, int index);
|
||||||
inline void proc_bLink(CKBehaviorLink* cache, scriptDatabase* db, dbScriptDataStructHelper* helper, EXPAND_CK_ID parents);
|
void proc_bLink(CKBehaviorLink* cache, scriptDatabase* db, dbScriptDataStructHelper* helper, EXPAND_CK_ID parents);
|
||||||
inline void proc_pLocal(CKParameterLocal* cache, scriptDatabase* db, dbScriptDataStructHelper* helper, EXPAND_CK_ID parents, BOOL is_setting);
|
void proc_pLocal(CKParameterLocal* cache, scriptDatabase* db, dbScriptDataStructHelper* helper, EXPAND_CK_ID parents, BOOL is_setting);
|
||||||
inline void proc_pOper(CKContext* ctx, CKParameterOperation* cache, scriptDatabase* db, dbScriptDataStructHelper* helper, EXPAND_CK_ID parents);
|
void proc_pOper(CKContext* ctx, CKParameterOperation* cache, scriptDatabase* db, dbScriptDataStructHelper* helper, EXPAND_CK_ID parents);
|
||||||
|
void proc_pAttr(CKContext* ctx, scriptDatabase* db, dbScriptDataStructHelper* helper, CKParameter* cache);
|
||||||
|
|
||||||
inline void helper_pLocalDataExport(const char* field, long data, scriptDatabase* db, dbScriptDataStructHelper* helper, EXPAND_CK_ID parents);
|
void helper_pDataExport(const char* field, long data, scriptDatabase* db, dbScriptDataStructHelper* helper, EXPAND_CK_ID parents);
|
||||||
inline void helper_pLocalDataExport(const char* field, float data, scriptDatabase* db, dbScriptDataStructHelper* helper, EXPAND_CK_ID parents);
|
void helper_pDataExport(const char* field, float data, scriptDatabase* db, dbScriptDataStructHelper* helper, EXPAND_CK_ID parents);
|
||||||
inline void helper_pLocalDataExport(const char* field, const char* data, scriptDatabase* db, dbScriptDataStructHelper* helper, EXPAND_CK_ID parents);
|
void helper_pDataExport(const char* field, const char* data, scriptDatabase* db, dbScriptDataStructHelper* helper, EXPAND_CK_ID parents);
|
||||||
|
|
||||||
void IterateBehavior(CKContext* ctx, CKBehavior* bhv, scriptDatabase* db, dbScriptDataStructHelper* helper, EXPAND_CK_ID parents);
|
void IterateBehavior(CKContext* ctx, CKBehavior* bhv, scriptDatabase* db, dbScriptDataStructHelper* helper, EXPAND_CK_ID parents);
|
||||||
void IterateScript(CKContext* ctx, scriptDatabase* db, dbScriptDataStructHelper* helper);
|
void IterateScript(CKContext* ctx, scriptDatabase* db, dbScriptDataStructHelper* helper);
|
||||||
void IteratepLocalData(CKParameterLocal* pl, scriptDatabase* db, dbScriptDataStructHelper* helper, EXPAND_CK_ID parents);
|
void DigParameterData(CKParameterLocal* pl, scriptDatabase* db, dbScriptDataStructHelper* helper, EXPAND_CK_ID parents);
|
||||||
|
|
||||||
#endif
|
#endif
|
|
@ -25,6 +25,7 @@ class dbPLinkInputOutputType(object):
|
||||||
POUT = 1
|
POUT = 1
|
||||||
PLOCAL = 2
|
PLOCAL = 2
|
||||||
PTARGET = 3
|
PTARGET = 3
|
||||||
|
PATTR = 4
|
||||||
|
|
||||||
class dbBLinkInputOutputType(object):
|
class dbBLinkInputOutputType(object):
|
||||||
INPUT = 0
|
INPUT = 0
|
||||||
|
@ -41,6 +42,7 @@ class LocalUsageType(object):
|
||||||
PIN = 0
|
PIN = 0
|
||||||
POUT = 1
|
POUT = 1
|
||||||
PLOCAL = 2
|
PLOCAL = 2
|
||||||
|
PATTR = 3
|
||||||
|
|
||||||
class JsonCustomEncoder(json.JSONEncoder):
|
class JsonCustomEncoder(json.JSONEncoder):
|
||||||
def default(self, field):
|
def default(self, field):
|
||||||
|
|
|
@ -434,6 +434,18 @@ def buildCell(exDb, deDb, target, currentGraphBlockCell):
|
||||||
else:
|
else:
|
||||||
cache = localUsageCounter[i[0]]
|
cache = localUsageCounter[i[0]]
|
||||||
|
|
||||||
|
cache.count+=1
|
||||||
|
cache.lastUse = i[6]
|
||||||
|
cache.lastDirection = 0
|
||||||
|
cache.lastIndex = i[9]
|
||||||
|
elif (i[3] == dcv.dbPLinkInputOutputType.PATTR): # for attribute using
|
||||||
|
if i[2] not in createdShortcut:
|
||||||
|
cache = dcv.LocalUsageItem(0, True, dcv.LocalUsageType.PATTR)
|
||||||
|
localUsageCounter[i[2]] = cache
|
||||||
|
createdShortcut.add(i[2])
|
||||||
|
else:
|
||||||
|
cache = localUsageCounter[i[2]]
|
||||||
|
|
||||||
cache.count+=1
|
cache.count+=1
|
||||||
cache.lastUse = i[6]
|
cache.lastUse = i[6]
|
||||||
cache.lastDirection = 0
|
cache.lastDirection = 0
|
||||||
|
@ -500,6 +512,8 @@ def buildCell(exDb, deDb, target, currentGraphBlockCell):
|
||||||
tableName = 'pIn'
|
tableName = 'pIn'
|
||||||
elif (cache.internal_type == dcv.LocalUsageType.POUT):
|
elif (cache.internal_type == dcv.LocalUsageType.POUT):
|
||||||
tableName = 'pOut'
|
tableName = 'pOut'
|
||||||
|
elif (cache.internal_type == dcv.LocalUsageType.PATTR):
|
||||||
|
tableName = 'pAttr'
|
||||||
else:
|
else:
|
||||||
tableName = 'pLocal'
|
tableName = 'pLocal'
|
||||||
exCur.execute("SELECT [name], [type] FROM {} WHERE [thisobj] == ?".format(tableName), (i,))
|
exCur.execute("SELECT [name], [type] FROM {} WHERE [thisobj] == ?".format(tableName), (i,))
|
||||||
|
@ -598,7 +612,11 @@ def buildLink(exDb, deDb, target, currentGraphBlockCell, graphPIO):
|
||||||
(x1, y1) = computLinkPTerminal(i[2], 0, i[5], currentGraphBlockCell)
|
(x1, y1) = computLinkPTerminal(i[2], 0, i[5], currentGraphBlockCell)
|
||||||
deCur.execute("INSERT INTO link VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);",
|
deCur.execute("INSERT INTO link VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);",
|
||||||
(target, -1, i[0], i[1], i[2], i[6], 0, 0, i[5], i[9], x1, y1, x2, y2))
|
(target, -1, i[0], i[1], i[2], i[6], 0, 0, i[5], i[9], x1, y1, x2, y2))
|
||||||
|
elif (i[3] == dcv.dbPLinkInputOutputType.PATTR):
|
||||||
|
(x1, y1) = computLinkPTerminal(i[0], 0, -1, currentGraphBlockCell)
|
||||||
|
(x2, y2) = computLinkPTerminal(i[6], 0, i[9], currentGraphBlockCell)
|
||||||
|
deCur.execute("INSERT INTO link VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);",
|
||||||
|
(target, -1, i[0], i[1], i[2], i[6], 0, 0, -1, i[9], x1, y1, x2, y2))
|
||||||
else:
|
else:
|
||||||
if i[2] in blockSet: # process protencial pOut(shortcut) (because plocal input/input_obj
|
if i[2] in blockSet: # process protencial pOut(shortcut) (because plocal input/input_obj
|
||||||
# output/output_obj is same, so don't need add for them)
|
# output/output_obj is same, so don't need add for them)
|
||||||
|
@ -653,6 +671,6 @@ def buildInfo(exDb, deDb):
|
||||||
deCur = deDb.cursor()
|
deCur = deDb.cursor()
|
||||||
|
|
||||||
# export local data (including proto bb internal data)
|
# export local data (including proto bb internal data)
|
||||||
exCur.execute("SELECT * FROM pLocalData;")
|
exCur.execute("SELECT * FROM pData;")
|
||||||
for i in exCur.fetchall():
|
for i in exCur.fetchall():
|
||||||
deCur.execute("INSERT INTO info VALUES (?, ?, ?)", (i[2], i[0], i[1]))
|
deCur.execute("INSERT INTO info VALUES (?, ?, ?)", (i[2], i[0], i[1]))
|
|
@ -11,6 +11,10 @@
|
||||||
<OutputPath>.</OutputPath>
|
<OutputPath>.</OutputPath>
|
||||||
<Name>SuperScriptViewer</Name>
|
<Name>SuperScriptViewer</Name>
|
||||||
<RootNamespace>SuperScriptViewer</RootNamespace>
|
<RootNamespace>SuperScriptViewer</RootNamespace>
|
||||||
|
<LaunchProvider>Standard Python launcher</LaunchProvider>
|
||||||
|
<CommandLineArguments>
|
||||||
|
</CommandLineArguments>
|
||||||
|
<EnableNativeCodeDebugging>False</EnableNativeCodeDebugging>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
|
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
|
||||||
<DebugSymbols>true</DebugSymbols>
|
<DebugSymbols>true</DebugSymbols>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user