add param export and add some id attr in html

This commit is contained in:
yyc12345 2020-04-23 22:54:37 +08:00
parent 896a821fe5
commit d601cef30f
6 changed files with 98 additions and 14 deletions

View File

@ -38,10 +38,12 @@ void dbScriptDataStructHelper::dispose() {
void dbEnvDataStructHelper::init() {
_db_envOp = new db_envOp;
_db_envParam = new db_envParam;
}
void dbEnvDataStructHelper::dispose() {
delete _db_envOp;
delete _db_envParam;
}
#pragma endregion
@ -175,7 +177,11 @@ BOOL envDatabase::init() {
if (result != SQLITE_OK) return FALSE;
result = sqlite3_exec(db,
"CREATE TABLE op([funcptr] INTEGER, [in1_guid_1] INTEGER, [in1_guid_2] INTEGER, [in2_guid_1] INTEGER, [in2_guid_2] INTEGER, [out_guid_1] INTEGER, [out_guid_2] INTEGER, [op_guid_1] INTEGER, [op_guid_2] INTEGER, [op_name] TEXT, [op_code] INTEGER);",
"CREATE TABLE op([funcptr] INTEGER, [in1_guid] TEXT, [in2_guid] TEXT, [out_guid] TEXT, [op_guid] INTEGER, [op_name] TEXT, [op_code] INTEGER);",
NULL, NULL, &errmsg);
if (result != SQLITE_OK) return FALSE;
result = sqlite3_exec(db,
"CREATE TABLE param([index] INTEGER, [guid] TEXT, [derived_from] TEXT, [type_name] TEXT, [default_size] INTEGER, [func_CreateDefault] INTEGER, [func_Delete] INTEGER, [func_SaveLoad] INTEGER, [func_Check] INTEGER, [func_Copy] INTEGER, [func_String] INTEGER, [func_UICreator] INTEGER, [creator_plugin_id] INTEGER, [dw_param] INTEGER, [dw_flags] INTEGER, [cid] INTEGER, [saver_manager] TEXT);",
NULL, NULL, &errmsg);
if (result != SQLITE_OK) return FALSE;
@ -394,7 +400,7 @@ void scriptDatabase::write_eLink(db_eLink* data) {
void envDatabase::write_envOp(db_envOp* data) {
if (db == NULL) return;
sprintf(commandStr, "INSERT INTO op VALUES (%d, %d, %d, %d, %d, %d, %d, %d, %d, '%s', %d);",
sprintf(commandStr, "INSERT INTO op VALUES (%d, '%d,%d', '%d,%d', '%d,%d', '%d,%d', '%s', %d);",
data->funcPtr,
data->in1_guid[0],
data->in1_guid[1],
@ -410,5 +416,33 @@ void envDatabase::write_envOp(db_envOp* data) {
sqlite3_exec(db, commandStr, NULL, NULL, &errmsg);
}
void envDatabase::write_envParam(db_envParam* data) {
if (db == NULL) return;
sprintf(commandStr, "INSERT INTO param VALUES (%d, '%d,%d', '%d,%d', '%s', %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, '%d,%d');",
data->index,
data->guid[0],
data->guid[1],
data->derived_from[0],
data->derived_from[1],
data->type_name,
data->default_size,
data->func_CreateDefault,
data->func_Delete,
data->func_SaveLoad,
data->func_Check,
data->func_Copy,
data->func_String,
data->func_UICreator,
data->creator_plugin_id,
data->dw_param,
data->dw_flags,
data->cid,
data->saver_manager[0],
data->saver_manager[1]);
sqlite3_exec(db, commandStr, NULL, NULL, &errmsg);
}
#pragma endregion

View File

@ -151,6 +151,26 @@ typedef struct {
CKOperationType op_code;
}db_envOp;
typedef struct {
CKParameterType index;
CKDWORD guid[2];
CKDWORD derived_from[2];
char type_name[1024];
int default_size;
CK_PARAMETERCREATEDEFAULTFUNCTION func_CreateDefault;
CK_PARAMETERDELETEFUNCTION func_Delete;
CK_PARAMETERSAVELOADFUNCTION func_SaveLoad;
CK_PARAMETERCHECKFUNCTION func_Check;
CK_PARAMETERCOPYFUNCTION func_Copy;
CK_PARAMETERSTRINGFUNCTION func_String;
CK_PARAMETERUICREATORFUNCTION func_UICreator;
int creator_plugin_id;
CKDWORD dw_param;
CKDWORD dw_flags;
CKDWORD cid;
CKDWORD saver_manager[2];
}db_envParam;
#pragma endregion
class dbScriptDataStructHelper {
@ -180,6 +200,7 @@ class dbEnvDataStructHelper {
void dispose();
db_envOp* _db_envOp;
db_envParam* _db_envParam;
};
@ -221,6 +242,7 @@ class scriptDatabase : public database {
class envDatabase : public database {
public:
void write_envOp(db_envOp* data);
void write_envParam(db_envParam* data);
protected:
BOOL init();

View File

@ -11,8 +11,7 @@ void IterateParameterOperation(CKParameterManager* parameterManager, envDatabase
//fill basic data
helper->_db_envOp->op_code = i;
_guid = parameterManager->OperationCodeToGuid(i);
helper->_db_envOp->op_guid[0] = _guid.d1;
helper->_db_envOp->op_guid[1] = _guid.d2;
cp_guid(helper->_db_envOp->op_guid, _guid);
strcpy(helper->_db_envOp->op_name, parameterManager->OperationCodeToName(i));
//allocate mem
@ -25,12 +24,9 @@ void IterateParameterOperation(CKParameterManager* parameterManager, envDatabase
parameterManager->GetAvailableOperationsDesc(_guid, NULL, NULL, NULL, opList);
for (int j = 0; j < cacheListCount; j++) {
helper->_db_envOp->in1_guid[0] = opList[j].P1Guid.d1;
helper->_db_envOp->in1_guid[1] = opList[j].P1Guid.d2;
helper->_db_envOp->in2_guid[0] = opList[j].P2Guid.d1;
helper->_db_envOp->in2_guid[1] = opList[j].P2Guid.d2;
helper->_db_envOp->out_guid[0] = opList[j].ResGuid.d1;
helper->_db_envOp->out_guid[1] = opList[j].ResGuid.d2;
cp_guid(helper->_db_envOp->in1_guid, opList[j].P1Guid);
cp_guid(helper->_db_envOp->in2_guid, opList[j].P2Guid);
cp_guid(helper->_db_envOp->out_guid, opList[j].ResGuid);
helper->_db_envOp->funcPtr = opList[j].Fct;
db->write_envOp(helper->_db_envOp);
@ -38,4 +34,32 @@ void IterateParameterOperation(CKParameterManager* parameterManager, envDatabase
}
if (opList != NULL) free(opList);
}
void IterateParameter(CKParameterManager* parameterManager, envDatabase* db, dbEnvDataStructHelper* helper) {
int count = parameterManager->GetParameterTypesCount();
CKParameterTypeDesc* desc = NULL;
for (int i = 0; i < count; i++) {
desc = parameterManager->GetParameterTypeDescription(i);
helper->_db_envParam->index = desc->Index;
cp_guid(helper->_db_envParam->guid, desc->Guid);
cp_guid(helper->_db_envParam->derived_from, desc->DerivedFrom);
strcpy(helper->_db_envParam->type_name, desc->TypeName.CStr());
helper->_db_envParam->default_size = desc->DefaultSize;
helper->_db_envParam->func_CreateDefault = desc->CreateDefaultFunction;
helper->_db_envParam->func_Delete = desc->DeleteFunction;
helper->_db_envParam->func_SaveLoad = desc->SaveLoadFunction;
helper->_db_envParam->func_Check = desc->CheckFunction;
helper->_db_envParam->func_Copy = desc->CopyFunction;
helper->_db_envParam->func_String = desc->StringFunction;
helper->_db_envParam->func_UICreator = desc->UICreatorFunction;
helper->_db_envParam->creator_plugin_id = desc->CreatorDll != NULL ? desc->CreatorDll->m_PluginDllIndex : -1;
helper->_db_envParam->dw_param = desc->dwParam;
helper->_db_envParam->dw_flags = desc->dwFlags;
helper->_db_envParam->cid = desc->Cid;
cp_guid(helper->_db_envParam->saver_manager, desc->Saver_Manager);
db->write_envParam(helper->_db_envParam);
}
}

View File

@ -4,6 +4,9 @@
#include "stdafx.h"
#include "database.h"
#define cp_guid(x,y) x[0]=y.d1;x[1]=y.d2
void IterateParameterOperation(CKParameterManager* parameterManager, envDatabase* db, dbEnvDataStructHelper* helper);
void IterateParameter(CKParameterManager* parameterManager, envDatabase* db, dbEnvDataStructHelper* helper);
#endif

View File

@ -112,8 +112,9 @@ void PluginMenuCallback(int commandID) {
_db->open(file);
_helper->init();
//iterate parameter operation
//iterate parameter operation/param
IterateParameterOperation(ctx->GetParameterManager(), _db, _helper);
IterateParameter(ctx->GetParameterManager(), _db, _helper);
//release all
_helper->dispose();

View File

@ -11,7 +11,7 @@
<body style="display: flex; flex-flow: row; height: 100%; width: 100%; margin: 0; padding: 0;">
<div style="display: flex; flex-flow: column; height: 100%; width: 80%; margin: 0; padding: 0;">
<div style="display: flex; background: #cfcfcf; flex-flow: row; width: 100%; height: 50px; overflow: scroll;">
<div id="hamburgerMenu" style="display: flex; background: #cfcfcf; flex-flow: row; width: 100%; height: 50px; overflow: scroll;">
<p class="hamburger"><a href="/index"><b>Script Hierarchy</b></a></p>
@ -25,7 +25,7 @@
</div>
<div style="background: #7f7f7f; width: 100%; height: 100%; overflow: scroll; position: relative;">
<div id="graphContainer" style="background: #7f7f7f; width: 100%; height: 100%; overflow: scroll; position: relative;">
<div>
{# blocks content #}
{% for i in blocks %}
@ -79,7 +79,7 @@
</div>
</div>
<div style="display: flex; flex-flow: column; background: #cfcfcf; height: 100%; width: 20%; margin: 0; padding: 0; border-left: 1px solid black;">
<div id="sidepanelContainer" style="display: flex; flex-flow: column; background: #cfcfcf; height: 100%; width: 20%; margin: 0; padding: 0; border-left: 1px solid black;">
<div style="display: flex; flex-flow: row; height: 30px; width: 100%; margin: 0; padding: 0; border-bottom: 1px solid black;">
<div class="tabitem tabitem1 tabitem-activated" style="height: 100%; width: 33.33%; text-align: center;" onclick="sidePanelSwitcher(0);"><b style="margin: 0;" class="tabitem tabitem1 tabitem-activated">Properties</b></div>
<div class="tabitem tabitem2 tabitem-deactivated" style="height: 100%; width: 33.33%; text-align: center;" onclick="sidePanelSwitcher(1);"><b style="margin: 0;" class="tabitem tabitem2 tabitem-deactivated">Display</b></div>