From faa4917b54a9aa0c917366728c5c1ff04e83d785 Mon Sep 17 00:00:00 2001 From: shun-iwasawa Date: Wed, 10 Jun 2020 03:04:35 +0900 Subject: [PATCH] fix pegbar lost on exploding subxsheet --- toonz/sources/toonz/subscenecommand.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/toonz/sources/toonz/subscenecommand.cpp b/toonz/sources/toonz/subscenecommand.cpp index 3a6c4ccf..ea478fb1 100644 --- a/toonz/sources/toonz/subscenecommand.cpp +++ b/toonz/sources/toonz/subscenecommand.cpp @@ -538,6 +538,11 @@ void bringObjectOut(TStageObject *obj, TXsheet *xsh, assert(id.isPegbar()); pegbarIndex++; TStageObjectId outerId = TStageObjectId::PegbarId(pegbarIndex); + // find the first available pegbar id + while (xsh->getStageObjectTree()->getStageObject(outerId, false)) { + pegbarIndex++; + outerId = TStageObjectId::PegbarId(pegbarIndex); + } TStageObject *outerObj = xsh->getStageObjectTree()->getStageObject(outerId, true); outerObj->setDagNodePos((*it)->getDagNodePos()); @@ -600,8 +605,8 @@ set explodeStageObjects( if (!onlyColumn) { // add a pegbar to represent the table TStageObject *table = subXsh->getStageObject(TStageObjectId::TableId); - /*- 空いてるIndexまでpegbarIndexを進める -*/ - int pegbarIndex = 2; + // find the first available pegbar index + int pegbarIndex = 0; while ( outerTree->getStageObject(TStageObjectId::PegbarId(pegbarIndex), false)) pegbarIndex++;