Skip to content

Commit

Permalink
Merge pull request #3076 from shun-iwasawa/fix_duration_item_in_clapp…
Browse files Browse the repository at this point in the history
…erboard

Fix Duration Items in Clapperboard to Show Output Range
  • Loading branch information
RodneyBaker committed Jan 30, 2020
2 parents a2795f2 + 4848836 commit 512d609
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions toonz/sources/toonzlib/boardsettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ std::wstring type2String(BoardItem::Type type) { return strs.value(type, L""); }
BoardItem::Type string2Type(std::wstring str) {
return strs.key(str, BoardItem::TypeCount);
}
};
}; // namespace

BoardItem::BoardItem() {
m_name = "Item";
Expand All @@ -46,6 +46,15 @@ BoardItem::BoardItem() {
}

QString BoardItem::getContentText(ToonzScene *scene) {
auto getDuration = [&]() {
TOutputProperties *oprop = scene->getProperties()->getOutputProperties();
int from, to, step;
if (oprop->getRange(from, to, step))
return to - from + 1;
else
return scene->getFrameCount();
};

switch (m_type) {
case FreeText:
return m_text;
Expand All @@ -57,19 +66,19 @@ QString BoardItem::getContentText(ToonzScene *scene) {
return QString::fromStdWString(scene->getSceneName());
break;
case Duration_Frame:
return QString::number(scene->getFrameCount());
return QString::number(getDuration());
break;
case Duration_SecFrame: {
TOutputProperties *oprop = scene->getProperties()->getOutputProperties();
int fps = (int)oprop->getFrameRate();
int frame = scene->getFrameCount();
int frame = getDuration();
return QString("%1 + %2").arg(QString::number(frame / fps),
QString::number(frame % fps));
} break;
case Duration_HHMMSSFF: {
TOutputProperties *oprop = scene->getProperties()->getOutputProperties();
int fps = (int)oprop->getFrameRate();
int frame = scene->getFrameCount();
int frame = getDuration();
int hh = frame / (fps * 60 * 60);
frame -= hh * fps * 60 * 60;
int mm = frame / (fps * 60);
Expand Down

0 comments on commit 512d609

Please sign in to comment.