diff --git a/Keishiki/UI.cpp b/Keishiki/UI.cpp index a34d721..0a51655 100644 --- a/Keishiki/UI.cpp +++ b/Keishiki/UI.cpp @@ -1288,6 +1288,7 @@ namespace K::UI { tl_end_begin = {tl_init_pos.x, ImGui::GetCursorScreenPos().y}; + // Handle layer reordering if (move_from != -1 && move_to != -1) { // do layer move if (no_selection) std::swap(s.layers[move_to], s.layers[move_from]); @@ -1694,7 +1695,7 @@ namespace K::UI { }, it->resource); u32 id = 0; if (ImGui::BeginCombo("##source", r_name)) { - ImGui::TextUnformatted("--Resources--"); + ImGui::TextUnformatted("----Resources----"); for (auto& [file, res_v] : Resource::resources) if (auto *res = std::get_if>(&res_v)) { ImGui::PushID(id++); @@ -1703,7 +1704,7 @@ namespace K::UI { it->resource = res; it->dims->val = ShaderGraph::XY{static_cast(res->w), static_cast(res->h)}; 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) @@ -1711,16 +1712,41 @@ namespace K::UI { ImGui::PopID(); } - ImGui::TextUnformatted("--Compositions--"); + ImGui::TextUnformatted("----Compositions----"); for (auto& comp : app_state.project.compositions) { + // todo skip comps that induce a cycle ImGui::PushID(id++); const bool is_selected = r_name == comp.name.c_str(); // lol if (ImGui::Selectable(comp.name.c_str(), is_selected)) { - it->resource = ∁ - it->dims->val = ShaderGraph::XY{static_cast(comp.width), static_cast(comp.height)}; - it->frame->val = ShaderGraph::T_Map::type(0); - if (std::visit([](auto&& arg){ return arg == nullptr; }, it->frame->connection.p)) - s.layers[s.active].track.ExposeUniform(s, *it->frame); + 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( + &sampler.resource)) { + if (this_lambda(**res, this_lambda) == false) + return false; + } + } + return true; + }; + + return iter(c, iter); + }; + + if (dfs(comp)) { + it->resource = ∁ + it->dims->val = ShaderGraph::XY{static_cast(comp.width), + static_cast(comp.height)}; + it->frame->val = ShaderGraph::T_Map::type(0); + if (std::visit([](auto &&arg) { return arg == nullptr; }, + 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) diff --git a/Keishiki/include/Keishiki.h b/Keishiki/include/Keishiki.h index e866884..ef4eefc 100644 --- a/Keishiki/include/Keishiki.h +++ b/Keishiki/include/Keishiki.h @@ -36,9 +36,6 @@ namespace K { render_fb = BGFX_INVALID_HANDLE; f32 proj[16], transform[16], view[16]; - // Dependence - Vector> depends_on{}; // todo use flat_map instead - void Setup(); i32 GetFrame(u32 frame); void Destroy(); diff --git a/TODO.md b/TODO.md index 68c20d7..8c584c1 100644 --- a/TODO.md +++ b/TODO.md @@ -5,29 +5,50 @@ - Video import (research opencv libavcodec etc) - maybe https://superuser.com/a/1397578 - Blender previews resource + - assimp or call into blender executable? - Data models - Dump and read back state, (de)serialization!!! - Undo's - Node groups - Motion blur + - Do multisampling, should be fast enough - 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 +- Pulses + - use convolution with interps + ## UI - Copy & Paste - 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 ## IO -- Clipboard pending SDL3 +- Clipboard via SDL3 - 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 - Simple 3D engine + - Particles + - Just look at the performance in https://github.com/CHCTW/DirectX12-Framework-!!! - Flat sets and flat maps pending compiler support - 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 - 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)