another dfs...

This commit is contained in:
lachrymaLF 2024-06-30 02:47:56 -04:00
parent 4b7e5e3018
commit 6e8b059af9
3 changed files with 58 additions and 19 deletions

View file

@ -1288,6 +1288,7 @@ namespace K::UI {
tl_end_begin = {tl_init_pos.x, ImGui::GetCursorScreenPos().y}; tl_end_begin = {tl_init_pos.x, ImGui::GetCursorScreenPos().y};
// Handle layer reordering
if (move_from != -1 && move_to != -1) { // do layer move if (move_from != -1 && move_to != -1) { // do layer move
if (no_selection) if (no_selection)
std::swap(s.layers[move_to], s.layers[move_from]); std::swap(s.layers[move_to], s.layers[move_from]);
@ -1694,7 +1695,7 @@ namespace K::UI {
}, it->resource); }, it->resource);
u32 id = 0; u32 id = 0;
if (ImGui::BeginCombo("##source", r_name)) { if (ImGui::BeginCombo("##source", r_name)) {
ImGui::TextUnformatted("--Resources--"); ImGui::TextUnformatted("----Resources----");
for (auto& [file, res_v] : Resource::resources) for (auto& [file, res_v] : Resource::resources)
if (auto *res = std::get_if<Resource::Resource<Resource::K_R_Still>>(&res_v)) { if (auto *res = std::get_if<Resource::Resource<Resource::K_R_Still>>(&res_v)) {
ImGui::PushID(id++); ImGui::PushID(id++);
@ -1703,7 +1704,7 @@ namespace K::UI {
it->resource = res; it->resource = res;
it->dims->val = ShaderGraph::XY{static_cast<f32>(res->w), static_cast<f32>(res->h)}; it->dims->val = ShaderGraph::XY{static_cast<f32>(res->w), static_cast<f32>(res->h)};
if (std::visit([](auto&& arg){ return arg != nullptr; }, it->frame->connection.p)) if (std::visit([](auto&& arg){ return arg != nullptr; }, it->frame->connection.p))
s.layers[s.active].track.HideUniform(s, *it->frame); VisualTrack::HideUniform(s, *it->frame);
} }
if (is_selected) if (is_selected)
@ -1711,16 +1712,41 @@ namespace K::UI {
ImGui::PopID(); ImGui::PopID();
} }
ImGui::TextUnformatted("--Compositions--"); ImGui::TextUnformatted("----Compositions----");
for (auto& comp : app_state.project.compositions) { for (auto& comp : app_state.project.compositions) {
// todo skip comps that induce a cycle
ImGui::PushID(id++); ImGui::PushID(id++);
const bool is_selected = r_name == comp.name.c_str(); // lol const bool is_selected = r_name == comp.name.c_str(); // lol
if (ImGui::Selectable(comp.name.c_str(), is_selected)) { if (ImGui::Selectable(comp.name.c_str(), is_selected)) {
auto dfs = [&s](CompositionState& c){
auto iter = [&s](CompositionState& c, auto& this_lambda) {
if (&s == &c)
return false;
else for (auto& layer : c.layers)
for (auto &sampler: layer.track.samplers) {
if (auto *res = std::get_if<CompositionState *>(
&sampler.resource)) {
if (this_lambda(**res, this_lambda) == false)
return false;
}
}
return true;
};
return iter(c, iter);
};
if (dfs(comp)) {
it->resource = &comp; it->resource = &comp;
it->dims->val = ShaderGraph::XY{static_cast<f32>(comp.width), static_cast<f32>(comp.height)}; it->dims->val = ShaderGraph::XY{static_cast<f32>(comp.width),
static_cast<f32>(comp.height)};
it->frame->val = ShaderGraph::T_Map<ShaderGraph::T_Int>::type(0); it->frame->val = ShaderGraph::T_Map<ShaderGraph::T_Int>::type(0);
if (std::visit([](auto&& arg){ return arg == nullptr; }, it->frame->connection.p)) if (std::visit([](auto &&arg) { return arg == nullptr; },
s.layers[s.active].track.ExposeUniform(s, *it->frame); it->frame->connection.p))
VisualTrack::ExposeUniform(s, *it->frame);
}
else
Log(K_L_Warning, "Dependency cycle detected! Composition will not be set for sampler.");
} }
if (is_selected) if (is_selected)

View file

@ -36,9 +36,6 @@ namespace K {
render_fb = BGFX_INVALID_HANDLE; render_fb = BGFX_INVALID_HANDLE;
f32 proj[16], transform[16], view[16]; f32 proj[16], transform[16], view[16];
// Dependence
Vector<std::pair<CompositionState*, u32>> depends_on{}; // todo use flat_map instead
void Setup(); void Setup();
i32 GetFrame(u32 frame); i32 GetFrame(u32 frame);
void Destroy(); void Destroy();

32
TODO.md
View file

@ -5,29 +5,50 @@
- Video import (research opencv libavcodec etc) - Video import (research opencv libavcodec etc)
- maybe https://superuser.com/a/1397578 - maybe https://superuser.com/a/1397578
- Blender previews resource - Blender previews resource
- assimp or call into blender executable?
- Data models - Data models
- Dump and read back state, (de)serialization!!! - Dump and read back state, (de)serialization!!!
- Undo's - Undo's
- Node groups - Node groups
- Motion blur - Motion blur
- Do multisampling, should be fast enough
- Text (idea: index-based evaluation in plugboard) - Text (idea: index-based evaluation in plugboard)
- Shapes (idea: embed glisp :mmtroll:, need to inquire -- still a lot of friction for simple shapes if we don't also get the glisp gizmos) - Shapes ideas:
- Backend:
- skia is too heavy probably
- investigate cpu-gpu shared buffers with blend2d
- or maybe fork nanovg?
- Frontend:
- AE-like interface
- canvas-like interface
- embed glisp maybe :mmtroll:
- inquire + still a lot of friction for simple shapes if we don't also get the glisp gizmos
- External data driving (csv, json or something else?) -- use a node to select source - External data driving (csv, json or something else?) -- use a node to select source
- Pulses
- use convolution with interps
## UI ## UI
- Copy & Paste - Copy & Paste
- Simple export - Simple export
## Audio
- SDL_mixer can do all of wav ogg flac mp3 opus
- don't care about output
- maybe add option in ui for ffmpeg muxing via syscalls
# Later # Later
## IO ## IO
- Clipboard pending SDL3 - Clipboard via SDL3
- OIIO output for more than PNG's - OIIO output for more than PNG's
- don't care about video export -- leave it for ffmpeg - don't care about encoding -- leave it to a ffmpeg syscall
## Compositor ## Compositor
- Simple 3D engine - Simple 3D engine
- Particles
- Just look at the performance in https://github.com/CHCTW/DirectX12-Framework-!!!
- Flat sets and flat maps pending compiler support - Flat sets and flat maps pending compiler support
- Random Idea: Array-eval nodes - Random Idea: Array-eval nodes
@ -37,8 +58,3 @@
- Viewport gizmos (Layer-specific & nodes -- can separate into different tools?) -- Not sure how to go about this - Viewport gizmos (Layer-specific & nodes -- can separate into different tools?) -- Not sure how to go about this
- Baku vec2 drag is good, color drag is not so necessary because imgui has a good picker - Baku vec2 drag is good, color drag is not so necessary because imgui has a good picker
## Audio
- Wait for SDL3!
- SDL_mixer will be able to do all of wav ogg flac mp3 opus, we live in good times
- output needs to be handled differently (if we care at all -- likely not)