Skip to content

Commit

Permalink
Merge pull request #1471 from manongjohn/onionskin_opacity_control
Browse files Browse the repository at this point in the history
Onion Skin Opacity control
  • Loading branch information
manongjohn committed May 19, 2024
2 parents 4de0457 + 8bf7d37 commit 59c100c
Show file tree
Hide file tree
Showing 10 changed files with 464 additions and 58 deletions.
16 changes: 11 additions & 5 deletions toonz/sources/include/toonz/onionskinmask.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,21 +62,26 @@ class DVAPI OnionSkinMask {

int getMos(int index) const {
assert(0 <= index && index < (int)m_mos.size());
return m_mos[index];
return m_mos[index].first;
}

int getFos(int index) const {
assert(0 <= index && index < (int)m_fos.size());
return m_fos[index];
return m_fos[index].first;
}

void setMos(int drow, bool on); //!< Sets a Mobile OS frame shifted by drow
//! around current xsheet frame
void setFos(int row,
bool on); //!< Sets a Fixed OS frame to the specified xsheet row

bool isMos(int drow) const;
bool isFos(int row) const;
void setMosOpacity(int drow, double opacity);
double getMosOpacity(int drow);
void setFosOpacity(int row, double opacity);
double getFosOpacity(int row);

bool isMos(int drow);
bool isFos(int row);

bool getMosRange(int &drow0, int &drow1) const;

Expand Down Expand Up @@ -146,7 +151,8 @@ since underlying onion-skinned drawings must be visible.
void clearGhostFlipKey() { m_ghostFlipKeys.clear(); }

private:
std::vector<int> m_fos, m_mos; //!< Fixed and Mobile Onion Skin indices
std::vector<std::pair<int, double>> m_fos,
m_mos; //!< Fixed and Mobile Onion Skin indices and opacity
bool m_enabled; //!< Whether onion skin is enabled
bool m_wholeScene; //!< Whether the OS works on the entire scene
bool m_everyFrame; //!< Whether the OS renders every frame or only on new exposures.
Expand Down
1 change: 1 addition & 0 deletions toonz/sources/include/toonz/stageplayer.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ class DVAPI Player {

int m_onionSkinDistance; //!< Temporal distance from an onion skin
//!'companion' (supposedly)
double m_fade; //! Onion skin opacity to use. -1 = autocalculated

int m_ancestorColumnIndex; //!< Index of this object's hierarchycal root
//!(top-most column)
Expand Down
1 change: 1 addition & 0 deletions toonz/sources/toonz/sceneviewer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2474,6 +2474,7 @@ void SceneViewer::drawSceneOverlay() {
player.m_guidedBackStroke = -1;
player.m_isVisibleinOSM = false;
player.m_onionSkinDistance = c_noOnionSkin;
player.m_fade = -1.0;
player.m_dpiAff = getDpiAffine(sl, frameId);
player.m_ancestorColumnIndex = -1;
player.m_opacity = scene->getOverlayOpacity();
Expand Down
1 change: 1 addition & 0 deletions toonz/sources/toonz/xshcolumnviewer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2683,6 +2683,7 @@ void ColumnTransparencyPopup::onSliderChange(int val) {
m_value->setText(QString::number(val));
connect(m_value, SIGNAL(textChanged(const QString &)), this,
SLOT(onValueChanged(const QString &)));
onSliderReleased();
}

//----------------------------------------------------------------
Expand Down

0 comments on commit 59c100c

Please sign in to comment.