From a27b87af79b5557f4496446bfbd533847ec27659 Mon Sep 17 00:00:00 2001 From: yyc12345 Date: Thu, 23 Feb 2023 22:08:17 +0800 Subject: [PATCH] fix various bugs including exporting and analysing --- SuperScriptDecorator/DecoratorBB.py | 7 ++-- SuperScriptMaterializer/doc_export.cpp | 45 ++++++++++++++++++-------- 2 files changed, 35 insertions(+), 17 deletions(-) diff --git a/SuperScriptDecorator/DecoratorBB.py b/SuperScriptDecorator/DecoratorBB.py index 791a83b..1537fc5 100644 --- a/SuperScriptDecorator/DecoratorBB.py +++ b/SuperScriptDecorator/DecoratorBB.py @@ -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( diff --git a/SuperScriptMaterializer/doc_export.cpp b/SuperScriptMaterializer/doc_export.cpp index 972d11c..641c541 100644 --- a/SuperScriptMaterializer/doc_export.cpp +++ b/SuperScriptMaterializer/doc_export.cpp @@ -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,