onionskin change
This commit is contained in:
@@ -334,4 +334,19 @@ namespace anm2ed::anm2
|
||||
|
||||
return time;
|
||||
}
|
||||
|
||||
int Item::frame_index_from_time_get(float time)
|
||||
{
|
||||
if (frames.empty()) return -1;
|
||||
if (time <= 0.0f) return 0;
|
||||
|
||||
float duration{};
|
||||
for (auto [i, frame] : std::views::enumerate(frames))
|
||||
{
|
||||
duration += frame.duration;
|
||||
if (time < duration) return (int)i;
|
||||
}
|
||||
|
||||
return (int)frames.size() - 1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,6 +26,7 @@ namespace anm2ed::anm2
|
||||
void frames_generate_from_grid(glm::ivec2, glm::ivec2, glm::ivec2, int, int, int);
|
||||
void frames_sort_by_at_frame();
|
||||
int frame_index_from_at_frame_get(int);
|
||||
int frame_index_from_time_get(float);
|
||||
float frame_time_from_index_get(int);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user