fix various bugs including exporting and analysing

This commit is contained in:
yyc12345 2023-02-23 22:08:17 +08:00
parent ec128f3b9c
commit a27b87af79
2 changed files with 35 additions and 17 deletions

View File

@ -82,7 +82,7 @@ class BlocksFactory(object):
# read datas
for (output_obj, output_type, output_is_bb, ) in envir.m_Cursor.fetchall():
# check dup
if output_obj in envir.m_WalkedOper or output_obj not in self.__AllOper:
if output_obj in envir.m_WalkedOper:
continue
envir.m_WalkedOper.add(output_obj)
@ -91,7 +91,8 @@ class BlocksFactory(object):
opers.add(output_obj)
else:
# this oper point to non-pIn, should be add into result
results.add(output_obj)
if envir.m_Depth != 0: # omit BB
results.add(envir.m_QueryOper)
# recursive calling opers to get root
for oper in opers:
@ -180,7 +181,7 @@ class BlocksFactory(object):
# we need add it manually
self.__AllOper.remove(operid)
bb.m_LowerOper.NewLayer(DecoratorData.TreeLayout.NO_REFERENCE_LAYER, DecoratorData.TreeLayout.NO_START_POS_OF_REF_LAYER)
bb.m_LowerOper.NewItem(self.m_Graph.m_BBDict[operid])
bb.m_LowerOper.NewItem(self.m_Graph.m_OperDict[operid])
# gotten "root" is oper's CKID, so use depth 1 to cheat this function
self.__RecursiveBuildOper(BuildOperEnvironment(

View File

@ -32,7 +32,7 @@ namespace SSMaterializer {
CKParameter* directSource = NULL;
CKObject* ds_Owner = NULL;
CKParameterIn* sharedSource = NULL;
CKBehavior* ss_Owner = NULL;
CKObject* ss_Owner = NULL;
// first, we analyse eLink
// check whether this is export parameter and write to database
@ -113,23 +113,40 @@ namespace SSMaterializer {
if (sharedSource = analysed_pin->GetSharedSource()) {
//pIn from BB
mDb->mDbHelper.script_pLink.input = sharedSource->GetID();
ss_Owner = (CKBehavior*)sharedSource->GetOwner();
ss_Owner = sharedSource->GetOwner();
mDb->mDbHelper.script_pLink.input_obj = ss_Owner->GetID();
if (ss_Owner->IsUsingTarget() && (ss_Owner->GetTargetParameter() == sharedSource)) {
//pTarget
mDb->mDbHelper.script_pLink.input_type = DataStruct::pLinkInputOutputType_PTARGET;
mDb->mDbHelper.script_pLink.input_is_bb = TRUE;
mDb->mDbHelper.script_pLink.input_index = -1; // omit
switch (ss_Owner->GetClassID()) {
case CKCID_BEHAVIOR: // CKBehavior
{
if (((CKBehavior*)ss_Owner)->IsUsingTarget() && (((CKBehavior*)ss_Owner)->GetTargetParameter() == sharedSource)) {
//pTarget
mDb->mDbHelper.script_pLink.input_type = DataStruct::pLinkInputOutputType_PTARGET;
mDb->mDbHelper.script_pLink.input_is_bb = TRUE;
mDb->mDbHelper.script_pLink.input_index = -1; // omit
} else {
//pIn
mDb->mDbHelper.script_pLink.input_type = DataStruct::pLinkInputOutputType_PIN;
mDb->mDbHelper.script_pLink.input_is_bb = TRUE;
mDb->mDbHelper.script_pLink.input_index = ss_Owner->GetInputParameterPosition(sharedSource);
} else {
//pIn
mDb->mDbHelper.script_pLink.input_type = DataStruct::pLinkInputOutputType_PIN;
mDb->mDbHelper.script_pLink.input_is_bb = TRUE;
mDb->mDbHelper.script_pLink.input_index = ((CKBehavior*)ss_Owner)->GetInputParameterPosition(sharedSource);
}
break;
}
case CKCID_PARAMETEROPERATION: // CKParameterOperation
{
//pOper only have pIn.
mDb->mDbHelper.script_pLink.input_type = DataStruct::pLinkInputOutputType_PIN;
mDb->mDbHelper.script_pLink.input_is_bb = TRUE;
mDb->mDbHelper.script_pLink.input_index = ((CKParameterOperation*)ss_Owner)->GetInParameter1() == sharedSource ? 0 : 1;
break;
}
default:
// the unexpected value. according to SDK manual,
// there are only 2 possible types
return;
}
}
// if the header of pLink has been analysed successfully,