fix something
- use index to accelerate generate - fix auto suffix problem - improve progrssbar
This commit is contained in:
parent
6d68766370
commit
9cd2f93b8b
|
@ -176,12 +176,19 @@ BOOL scriptDatabase::finalJob() {
|
||||||
sqlite3_exec(db, "commit;", NULL, NULL, NULL);
|
sqlite3_exec(db, "commit;", NULL, NULL, NULL);
|
||||||
|
|
||||||
//create index for quick select in following app
|
//create index for quick select in following app
|
||||||
/*sqlite3_exec(db, "begin;", NULL, NULL, NULL);
|
sqlite3_exec(db, "begin;", NULL, NULL, NULL);
|
||||||
sqlite3_exec(db, "CREATE INDEX [quick_where1] ON bIn (thisobj)", NULL, NULL, NULL);
|
sqlite3_exec(db, "CREATE INDEX [quick_where1] ON behavior ([parent])", NULL, NULL, NULL);
|
||||||
sqlite3_exec(db, "CREATE INDEX [quick_where2] ON bOut (thisobj)", NULL, NULL, NULL);
|
sqlite3_exec(db, "CREATE INDEX [quick_where2] ON pOper ([belong_to], [thisobj])", NULL, NULL, NULL);
|
||||||
sqlite3_exec(db, "CREATE INDEX [quick_where3] ON pIn (thisobj)", NULL, NULL, NULL);
|
sqlite3_exec(db, "CREATE INDEX [quick_where3] ON pTarget ([belong_to])", NULL, NULL, NULL);
|
||||||
sqlite3_exec(db, "CREATE INDEX [quick_where4] ON pOut (thisobj)", NULL, NULL, NULL);
|
sqlite3_exec(db, "CREATE INDEX [quick_where4] ON bIn ([belong_to])", NULL, NULL, NULL);
|
||||||
sqlite3_exec(db, "commit;", NULL, NULL, NULL);*/
|
sqlite3_exec(db, "CREATE INDEX [quick_where5] ON bOut ([belong_to])", NULL, NULL, NULL);
|
||||||
|
sqlite3_exec(db, "CREATE INDEX [quick_where6] ON pIn ([belong_to], [thisobj])", NULL, NULL, NULL);
|
||||||
|
sqlite3_exec(db, "CREATE INDEX [quick_where7] ON pOut ([belong_to], [thisobj])", NULL, NULL, NULL);
|
||||||
|
sqlite3_exec(db, "CREATE INDEX [quick_where8] ON pLocal ([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_where11] ON elink ([belong_to])", NULL, NULL, NULL);
|
||||||
|
sqlite3_exec(db, "commit;", NULL, NULL, NULL);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -484,14 +484,14 @@ void IteratepLocalData(CKParameterLocal* p, scriptDatabase* db, dbScriptDataStru
|
||||||
if (unknowType || t == CKPGUID_VOIDBUF || t == CKPGUID_SHADER || t == CKPGUID_TECHNIQUE || t == CKPGUID_PASS) {
|
if (unknowType || t == CKPGUID_VOIDBUF || t == CKPGUID_SHADER || t == CKPGUID_TECHNIQUE || t == CKPGUID_PASS) {
|
||||||
//dump data
|
//dump data
|
||||||
unsigned char* cptr = (unsigned char*)p->GetReadDataPtr(false);
|
unsigned char* cptr = (unsigned char*)p->GetReadDataPtr(false);
|
||||||
char temp[4];
|
char temp[8];
|
||||||
int cc = 0, rcc = 0, pos = 0;
|
int cc = 0, rcc = 0, pos = 0;
|
||||||
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_pLocalData->data.clear();
|
||||||
for (int i = 0; i < rcc; i++) {
|
for (int i = 0; i < rcc; i++) {
|
||||||
sprintf(temp, "%02X", cptr[i]);
|
sprintf(temp, "0x%02X", cptr[i]);
|
||||||
|
|
||||||
helper->_db_pLocalData->data += temp;
|
helper->_db_pLocalData->data += temp;
|
||||||
if (i != rcc - 1)
|
if (i != rcc - 1)
|
||||||
|
|
|
@ -75,7 +75,8 @@ void PluginMenuCallback(int commandID) {
|
||||||
ofn.lpstrFile = file;
|
ofn.lpstrFile = file;
|
||||||
ofn.lpstrFile[0] = '\0';
|
ofn.lpstrFile[0] = '\0';
|
||||||
ofn.nMaxFile = 1024;
|
ofn.nMaxFile = 1024;
|
||||||
ofn.lpstrFilter = "Database file(*.db)\0*.db\0All files(*.*)\0*.*\0";
|
ofn.lpstrFilter = "Database file(*.db)\0*.db\0";
|
||||||
|
ofn.lpstrDefExt = "db";
|
||||||
ofn.lpstrFileTitle = NULL;
|
ofn.lpstrFileTitle = NULL;
|
||||||
ofn.nMaxFileTitle = 0;
|
ofn.nMaxFileTitle = 0;
|
||||||
ofn.lpstrInitialDir = NULL;
|
ofn.lpstrInitialDir = NULL;
|
||||||
|
|
|
@ -2,7 +2,7 @@ import sqlite3
|
||||||
import DecoratorConstValue as dcv
|
import DecoratorConstValue as dcv
|
||||||
import json
|
import json
|
||||||
import CustomConfig
|
import CustomConfig
|
||||||
import sys
|
import Progressbar
|
||||||
|
|
||||||
def run():
|
def run():
|
||||||
exportDb = sqlite3.connect(CustomConfig.export_db)
|
exportDb = sqlite3.connect(CustomConfig.export_db)
|
||||||
|
@ -22,24 +22,15 @@ def run():
|
||||||
# decorate each graph
|
# decorate each graph
|
||||||
print('Generating graph...')
|
print('Generating graph...')
|
||||||
currentGraphBlockCell = {}
|
currentGraphBlockCell = {}
|
||||||
percentageAll = len(graphList)
|
Progressbar.initProgressbar(len(graphList))
|
||||||
if percentageAll == 0:
|
|
||||||
percentageAll = 1
|
|
||||||
percentageNow = 0
|
|
||||||
percentageCache = 0
|
|
||||||
#debug
|
|
||||||
# graphList=graphList[int(percentageAll*3/4):]
|
|
||||||
for i in graphList:
|
for i in graphList:
|
||||||
sys.stdout.write('\r[{}{}]{}%'.format(int(percentageCache / 5) * '#',(20 - int(percentageCache / 5)) * '=', percentageCache))
|
|
||||||
sys.stdout.flush()
|
|
||||||
|
|
||||||
currentGraphBlockCell.clear()
|
currentGraphBlockCell.clear()
|
||||||
buildBlock(exportDb, decorateDb, i, currentGraphBlockCell)
|
buildBlock(exportDb, decorateDb, i, currentGraphBlockCell)
|
||||||
graphPIO = buildCell(exportDb, decorateDb, i, currentGraphBlockCell)
|
graphPIO = buildCell(exportDb, decorateDb, i, currentGraphBlockCell)
|
||||||
buildLink(exportDb, decorateDb, i, currentGraphBlockCell, graphPIO)
|
buildLink(exportDb, decorateDb, i, currentGraphBlockCell, graphPIO)
|
||||||
|
|
||||||
percentageNow += 1
|
Progressbar.stepProgressbar()
|
||||||
percentageCache = int(100 * percentageNow / percentageAll)
|
Progressbar.finProgressbar()
|
||||||
|
|
||||||
# export information
|
# export information
|
||||||
print('Generating info...')
|
print('Generating info...')
|
||||||
|
|
29
SuperScriptViewer/Progressbar.py
Normal file
29
SuperScriptViewer/Progressbar.py
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
import sys
|
||||||
|
|
||||||
|
value_All = 0
|
||||||
|
value_Now = 0
|
||||||
|
progressbar_span = 2
|
||||||
|
progressbar_count = int(100/progressbar_span)
|
||||||
|
|
||||||
|
def initProgressbar(all):
|
||||||
|
global value_Now, value_All
|
||||||
|
value_All = all
|
||||||
|
value_Now = 0
|
||||||
|
|
||||||
|
sys.stdout.write('[{}] 0%'.format(progressbar_count * '='))
|
||||||
|
sys.stdout.flush()
|
||||||
|
|
||||||
|
def stepProgressbar():
|
||||||
|
global value_Now, value_All
|
||||||
|
value_Now += 1
|
||||||
|
if (value_Now > value_All):
|
||||||
|
value_Now = value_All
|
||||||
|
|
||||||
|
percentage = int(value_Now / value_All * 100)
|
||||||
|
percentage_bar = int(value_Now / value_All * progressbar_count)
|
||||||
|
sys.stdout.write('\r[{}{}] {}%'.format(percentage_bar * '#',(progressbar_count - percentage_bar) * '=', percentage))
|
||||||
|
sys.stdout.flush()
|
||||||
|
|
||||||
|
def finProgressbar():
|
||||||
|
sys.stdout.write('\r[{}] 100%\n'.format(progressbar_count * '#'))
|
||||||
|
sys.stdout.flush()
|
|
@ -30,6 +30,9 @@
|
||||||
<Compile Include="DecoratorCore.py">
|
<Compile Include="DecoratorCore.py">
|
||||||
<SubType>Code</SubType>
|
<SubType>Code</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Include="Progressbar.py">
|
||||||
|
<SubType>Code</SubType>
|
||||||
|
</Compile>
|
||||||
<Compile Include="ServerCore.py">
|
<Compile Include="ServerCore.py">
|
||||||
<SubType>Code</SubType>
|
<SubType>Code</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user