fix scroll node, improve animation panel

This commit is contained in:
2019-10-18 22:53:17 +02:00
parent 266573e9b4
commit 467e83b69e
8 changed files with 176 additions and 67 deletions

View File

@@ -48,7 +48,8 @@ class NodePanelAnimation : public Node
NodeButtonCustom* btn_up = nullptr;
NodeButtonCustom* btn_down = nullptr;
NodeButtonCustom* btn_duplicate = nullptr;
NodeScroll* m_container = nullptr;
Node* m_layers_container = nullptr;
Node* m_frames_container = nullptr;
NodeAnimationFrame* m_selected_frame = nullptr;
NodeAnimationTimeline* m_timeline = nullptr;
int m_selected_frame_index = -1;
@@ -68,6 +69,32 @@ public:
//////////////////////////////////////////////////////////////////////////
class NodeAnimationFilm : public NodeBorder
{
public:
using this_class = NodeAnimationFilm;
using parent = NodeBorder;
virtual Node* clone_instantiate() const override { return new this_class; }
virtual void init() override
{
parent::init();
init_template_file("data/dialogs/panel-animation.xml", "tpl-film");
}
std::shared_ptr<NodeAnimationFrame> add_frame(int duration)
{
auto b = add_child_ref<NodeAnimationFrame>();
b->SetWidth(30 * duration + 5 * (duration - 1));
//b->SetFlexGrow(duration);
b->SetHeightP(100);
b->SetMargin(0, 5, 0, 0);
return b;
}
};
//////////////////////////////////////////////////////////////////////////
class NodeAnimationLayer : public NodeBorder
{
bool m_selected = false;
@@ -76,7 +103,6 @@ class NodeAnimationLayer : public NodeBorder
glm::vec4 m_color_hover = glm::vec4(.5, .5, .5, 1);
NodeText* m_label = nullptr;
NodeCheckBox* m_visibility = nullptr;
NodeScroll* m_container = nullptr;
public:
std::function<void(NodeAnimationLayer* target)> on_selected;
std::function<void(NodeAnimationLayer* target, bool visible)> on_visibility_changed;
@@ -91,8 +117,7 @@ public:
virtual void draw() override;
void init_controls();
std::shared_ptr<NodeAnimationFrame> add_frame(int duration);
void set_text(const std::string& text) { m_label->set_text(text.c_str()); }
void set_selected(bool selected) { m_selected = selected; }
void set_chekcbox(bool checked) { m_visibility->set_value(checked); }
};
};