Merge commit '057272347486efe5046691f32f51604e3a594e6a'
This commit is contained in:
commit
6a500345b4
4
deps/ox/src/ox/oc/write.hpp
vendored
4
deps/ox/src/ox/oc/write.hpp
vendored
@ -27,7 +27,7 @@ class OrganicClawWriter {
|
|||||||
friend Result<Buffer> writeOC(const auto &val) noexcept;
|
friend Result<Buffer> writeOC(const auto &val) noexcept;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
Json::Value m_json;
|
Json::Value m_json{Json::Value(Json::objectValue)};
|
||||||
Json::ArrayIndex m_fieldIt = 0;
|
Json::ArrayIndex m_fieldIt = 0;
|
||||||
int m_unionIdx = -1;
|
int m_unionIdx = -1;
|
||||||
|
|
||||||
@ -215,7 +215,7 @@ Error OrganicClawWriter::field(const char *key, const T *val) noexcept {
|
|||||||
OrganicClawWriter w;
|
OrganicClawWriter w;
|
||||||
ModelHandlerInterface<OrganicClawWriter, OpType::Write> handler{&w};
|
ModelHandlerInterface<OrganicClawWriter, OpType::Write> handler{&w};
|
||||||
oxReturnError(model(&handler, val));
|
oxReturnError(model(&handler, val));
|
||||||
if (!w.m_json.isNull()) {
|
if (!w.m_json.empty() || m_json.isArray()) {
|
||||||
value(key) = w.m_json;
|
value(key) = w.m_json;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
2
deps/ox/src/ox/preloader/platspecs.hpp
vendored
2
deps/ox/src/ox/preloader/platspecs.hpp
vendored
@ -51,7 +51,7 @@ constexpr std::size_t alignOf(const T &v) noexcept {
|
|||||||
typename PlatSpec::PtrType p = 0;
|
typename PlatSpec::PtrType p = 0;
|
||||||
return PlatSpec::alignOf(p);
|
return PlatSpec::alignOf(p);
|
||||||
} else {
|
} else {
|
||||||
AlignmentCatcher<NativePlatSpec> c;
|
AlignmentCatcher<PlatSpec> c;
|
||||||
oxAssert(model(c.interface(), &v), "Could not get alignment for type");
|
oxAssert(model(c.interface(), &v), "Could not get alignment for type");
|
||||||
return c.biggestAlignment;
|
return c.biggestAlignment;
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,8 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <functional>
|
||||||
|
|
||||||
#include <imgui.h>
|
#include <imgui.h>
|
||||||
|
|
||||||
#include <turbine/context.hpp>
|
#include <turbine/context.hpp>
|
||||||
@ -59,6 +61,12 @@ bool FileComboBox(
|
|||||||
ox::StringView fileExt,
|
ox::StringView fileExt,
|
||||||
size_t &selectedIdx) noexcept;
|
size_t &selectedIdx) noexcept;
|
||||||
|
|
||||||
|
bool ListBox(
|
||||||
|
ox::CStringView name,
|
||||||
|
std::function<ox::CStringView(size_t)> const&f,
|
||||||
|
size_t strCnt,
|
||||||
|
size_t &selIdx) noexcept;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param name
|
* @param name
|
||||||
|
@ -113,24 +113,34 @@ bool FileComboBox(
|
|||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ListBox(ox::CStringView name, ox::SpanView<ox::String> const&list, size_t &selIdx) noexcept {
|
bool ListBox(
|
||||||
|
ox::CStringView name,
|
||||||
|
std::function<ox::CStringView(size_t)> const&f,
|
||||||
|
size_t strCnt,
|
||||||
|
size_t &selIdx) noexcept {
|
||||||
auto out = false;
|
auto out = false;
|
||||||
if (ImGui::BeginListBox(name.c_str())) {
|
if (ImGui::BeginListBox(name.c_str())) {
|
||||||
for (auto i = 0u; auto const&obj : list) {
|
for (auto i = 0u; i < strCnt; ++i) {
|
||||||
|
auto str = f(i);
|
||||||
ig::IDStackItem const idStackItem2(static_cast<int>(i));
|
ig::IDStackItem const idStackItem2(static_cast<int>(i));
|
||||||
if (ImGui::Selectable(obj.c_str(), selIdx == i)) {
|
if (ImGui::Selectable(str.c_str(), selIdx == i)) {
|
||||||
if (i != selIdx) {
|
if (i != selIdx) {
|
||||||
selIdx = i;
|
selIdx = i;
|
||||||
out = true;
|
out = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
++i;
|
|
||||||
}
|
}
|
||||||
ImGui::EndListBox();
|
ImGui::EndListBox();
|
||||||
}
|
}
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool ListBox(ox::CStringView name, ox::SpanView<ox::String> const&list, size_t &selIdx) noexcept {
|
||||||
|
return ig::ListBox(name, [list](size_t i) -> ox::CStringView {
|
||||||
|
return list[i];
|
||||||
|
}, list.size(), selIdx);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
FilePicker::FilePicker(
|
FilePicker::FilePicker(
|
||||||
studio::StudioContext &sctx,
|
studio::StudioContext &sctx,
|
||||||
|
Loading…
Reference in New Issue
Block a user