implement animation panel interaction
This commit is contained in:
@@ -1252,6 +1252,16 @@ void Canvas::layer_add(std::string name, std::shared_ptr<Layer> layer /*= nullpt
|
||||
}
|
||||
m_current_layer_idx = index;
|
||||
}
|
||||
|
||||
std::shared_ptr<Layer> Canvas::layer_with_id(uint32_t id)
|
||||
{
|
||||
auto layer = std::find_if(m_layers.begin(), m_layers.end(),
|
||||
[id](const auto& l) { return l->id == id; });
|
||||
if (layer != m_layers.end())
|
||||
return *layer;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void Canvas::layer_remove(int idx) // m_order index
|
||||
{
|
||||
LOG("canvas layer_remove %d", idx);
|
||||
@@ -1324,6 +1334,21 @@ void Canvas::layer_merge(int source_idx, int dest_idx) // m_layer index
|
||||
});
|
||||
}
|
||||
|
||||
int Canvas::anim_duration() const noexcept
|
||||
{
|
||||
int frames = 1;
|
||||
for (auto& l : m_layers)
|
||||
frames = glm::max(frames, l->total_duration());
|
||||
return frames;
|
||||
}
|
||||
|
||||
void Canvas::anim_goto_frame(int frame) noexcept
|
||||
{
|
||||
m_anim_frame = frame;
|
||||
for (auto& l : m_layers)
|
||||
l->goto_frame(frame);
|
||||
}
|
||||
|
||||
void Canvas::flood_fill(int layer, int plane, std::vector<glm::ivec2> pos, FloodData& plane_data,
|
||||
float threshold, glm::vec4 dest_color, std::unique_ptr<glm::vec4>& source_color)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user