diff --git a/src/app/GUI/graphboxeslist.cpp b/src/app/GUI/graphboxeslist.cpp index 230da9640..973ad1bb7 100644 --- a/src/app/GUI/graphboxeslist.cpp +++ b/src/app/GUI/graphboxeslist.cpp @@ -472,7 +472,9 @@ void KeysView::graphSetOnlySelectedVisible(const bool selectedOnly) { } bool KeysView::graphValidateVisible(GraphAnimator* const animator) { - if(graph_mOnlySelectedVisible){ + // https://github.com/friction2d/friction/issues/176 + if (!animator->prp_isParentBoxGraphSelected()) { return false; } + if (graph_mOnlySelectedVisible) { return animator->prp_isParentBoxSelected(); } return true; diff --git a/src/core/Animators/eboxorsound.cpp b/src/core/Animators/eboxorsound.cpp index c1d5fbeaf..ec029d5de 100644 --- a/src/core/Animators/eboxorsound.cpp +++ b/src/core/Animators/eboxorsound.cpp @@ -381,6 +381,12 @@ void eBoxOrSound::setSelected(const bool select) { emit selectionChanged(select); } +void eBoxOrSound::setGraphSelected(const bool select) +{ + if (mGraphSelected == select) { return; } + mGraphSelected = select; +} + void eBoxOrSound::select() { setSelected(true); } diff --git a/src/core/Animators/eboxorsound.h b/src/core/Animators/eboxorsound.h index 823a331be..61468d7ea 100644 --- a/src/core/Animators/eboxorsound.h +++ b/src/core/Animators/eboxorsound.h @@ -111,9 +111,11 @@ class CORE_EXPORT eBoxOrSound : public StaticComplexAnimator { bool isFrameFVisibleAndInDurationRect(const qreal relFrame) const; void setSelected(const bool select); + void setGraphSelected(const bool select); void select(); void deselect(); bool isSelected() const { return mSelected; } + bool isGraphSelected() const { return mGraphSelected; } void selectionChangeTriggered(const bool shiftPressed); void hide(); @@ -146,6 +148,7 @@ class CORE_EXPORT eBoxOrSound : public StaticComplexAnimator { void lockedChanged(bool); private: bool mSelected = false; + bool mGraphSelected = false; bool mVisible = true; bool mLocked = false; int mZListIndex = 0; diff --git a/src/core/Properties/property.cpp b/src/core/Properties/property.cpp index e8ca66ada..52979c320 100644 --- a/src/core/Properties/property.cpp +++ b/src/core/Properties/property.cpp @@ -362,6 +362,13 @@ bool Property::prp_isParentBoxSelected() const { return false; } +bool Property::prp_isParentBoxGraphSelected() const +{ + const auto pBox = getFirstAncestor(); + if (pBox) { return pBox->isGraphSelected(); } + return false; +} + #include "canvas.h" void Property::prp_selectionChangeTriggered(const bool shiftPressed) { if(!mParentScene) return; diff --git a/src/core/Properties/property.h b/src/core/Properties/property.h index a5875467a..9e30631f3 100644 --- a/src/core/Properties/property.h +++ b/src/core/Properties/property.h @@ -249,6 +249,7 @@ class CORE_EXPORT Property : public SingleWidgetTarget { } bool prp_isParentBoxSelected() const; + bool prp_isParentBoxGraphSelected() const; bool prp_drawsOnCanvas() const { return mDrawOnCanvas; } diff --git a/src/core/canvasselectedboxesactions.cpp b/src/core/canvasselectedboxesactions.cpp index bdd4bdfc2..191d0eb50 100644 --- a/src/core/canvasselectedboxesactions.cpp +++ b/src/core/canvasselectedboxesactions.cpp @@ -439,6 +439,7 @@ void Canvas::addBoxToSelection(BoundingBox * const box) }); box->setSelected(true); + box->setGraphSelected(true); schedulePivotUpdate(); sortSelectedBoxesDesc(); @@ -455,9 +456,10 @@ void Canvas::addBoxToSelection(BoundingBox * const box) } void Canvas::removeBoxFromSelection(BoundingBox * const box) { - if(!box->isSelected()) return; + if (!box->isSelected()) { return; } mSelectedBoxes.removeObj(box); box->setSelected(false); + box->setGraphSelected(false); schedulePivotUpdate(); //if(mCurrentMode == CanvasMode::paint) updatePaintBox(); if (mSelectedBoxes.isEmpty()) { setCurrentBox(nullptr); }