Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only show usable animators in graph #178

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/app/GUI/graphboxeslist.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 6 additions & 0 deletions src/core/Animators/eboxorsound.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
3 changes: 3 additions & 0 deletions src/core/Animators/eboxorsound.h
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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;
Expand Down
7 changes: 7 additions & 0 deletions src/core/Properties/property.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,13 @@ bool Property::prp_isParentBoxSelected() const {
return false;
}

bool Property::prp_isParentBoxGraphSelected() const
{
const auto pBox = getFirstAncestor<eBoxOrSound>();
if (pBox) { return pBox->isGraphSelected(); }
return false;
}

#include "canvas.h"
void Property::prp_selectionChangeTriggered(const bool shiftPressed) {
if(!mParentScene) return;
Expand Down
1 change: 1 addition & 0 deletions src/core/Properties/property.h
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,7 @@ class CORE_EXPORT Property : public SingleWidgetTarget {
}

bool prp_isParentBoxSelected() const;
bool prp_isParentBoxGraphSelected() const;

bool prp_drawsOnCanvas() const
{ return mDrawOnCanvas; }
Expand Down
4 changes: 3 additions & 1 deletion src/core/canvasselectedboxesactions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -439,6 +439,7 @@ void Canvas::addBoxToSelection(BoundingBox * const box)
});

box->setSelected(true);
box->setGraphSelected(true);
schedulePivotUpdate();

sortSelectedBoxesDesc();
Expand All @@ -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); }
Expand Down
Loading