33#ifndef DVD_EDITOR_UTILS_H_
34#define DVD_EDITOR_UTILS_H_
39enum class PushConstantType;
42 bool InputDoubleN(
const char* label,
double* v,
int components,
const char* display_format, ImGuiInputTextFlags extra_flags);
43 bool InputDouble2(
const char* label,
double v[2],
const char* display_format, ImGuiInputTextFlags extra_flags);
44 bool InputDouble3(
const char* label,
double v[3],
const char* display_format, ImGuiInputTextFlags extra_flags);
45 bool InputDouble4(
const char* label,
double v[4],
const char* display_format, ImGuiInputTextFlags extra_flags);
59 {0.8f, 0.1f, 0.15f, 1.f},
60 {0.2f, 0.7f, 0.2f, 1.f},
61 {0.1f, 0.25f, 0.8f, 1.f}
64 {0.9f, 0.2f, 0.2f, 1.f},
65 {0.3f, 0.8f, 0.3f, 1.f},
66 {0.2f, 0.35f, 0.8f, 1.f}
70 "X",
"Y",
"Z",
"W",
"U",
"V",
"T"
73 template<
typename T,
bool SeparateActivate,
typename Pred>
81 template<
typename T,
size_t N,
bool isSl
ider>
85 ImGuiInputTextFlags flags,
87 const char* format =
"%.2f");
89 template<
typename T,
size_t N,
bool isSl
ider>
92 const char*
const compLabels[],
94 ImGuiInputTextFlags flags,
100 const char* format =
"%.2f");
102 template<
typename T,
bool isSl
ider>
112 ImVec4 buttonColourHovered,
113 ImVec4 buttonColourActive,
114 ImGuiInputTextFlags flags,
115 const char* format =
"%.2f");
117 const char*
GetFormat(ImGuiDataType dataType,
const char* input,
bool hex);
121 template<
typename Pred>
123 template<
typename Pred>
126 template<
typename FieldDataType,
typename ComponentType,
size_t num_comp>
129 template<
typename FieldDataType,
typename ComponentType,
size_t num_comp,
bool IsSl
ider>
132 template<
typename T,
size_t num_rows>
143 ImVec4 buttonColourHovered,
144 ImVec4 buttonColourActive);
167#pragma warning(disable: 4127)
DrawReturnValue DrawVec(ImGuiDataType data_type, const char *label, T *values, ImGuiInputTextFlags flags, T resetValue=0, const char *format="%.2f")
const char * PushedToolTip()
void PushTooltip(const char *tooltip)
void PushNarrowLabelWidth()
void RegisterUndo(Editor &editor, PushConstantType type, const T &oldVal, const T &newVal, const char *name, Pred &&dataSetter)
F32 GetLineHeight() noexcept
void PopNarrowLabelWidth()
void OpenCenteredPopup(const char *name, ImGui::ImGuiPopupFlags popup_flags=0)
static const ImVec4 Colours[]
bool colourInput4(Editor &parent, EditorComponentField &field)
static const ImVec4 ColoursHovered[]
constexpr F32 LabelColumnWidth
void PushButtonStyle(bool bold, ImVec4 buttonColour, ImVec4 buttonColourHovered, ImVec4 buttonColourActive)
ImGuiInputTextFlags GetDefaultFlagsForField(const EditorComponentField &field)
bool colourInput3(Editor &parent, EditorComponentField &field)
bool inputOrSlider(Editor &parent, const bool isSlider, const char *label, const F32 stepIn, ImGuiDataType data_type, EditorComponentField &field, ImGuiInputTextFlags flags, const char *format)
void PrintColouredText(const std::string_view text, const ImVec4 &colour)
bool inputMatrix(Editor &parent, const char *label, const F32 stepIn, const ImGuiDataType data_type, EditorComponentField &field, const ImGuiInputTextFlags flags, const char *format)
const char * GetFormat(ImGuiDataType dataType, const char *input, bool hex)
constexpr F32 LabelColumnWidthNarrow
ImGuiInputTextFlags GetDefaultFlagsForSettings(bool readOnly, bool hex)
DrawReturnValue DrawVecComponent(ImGuiDataType data_type, const char *label, T &value, T resetValue, T minValue, T maxValue, T step, T stepFast, ImVec4 buttonColour, ImVec4 buttonColourHovered, ImVec4 buttonColourActive, ImGuiInputTextFlags flags, const char *format="%.2f")
constexpr const char * FieldLabels[]
void BeginPropertyTable(I32 numComponents, const char *label)
Handle console commands that start with a forward slash.
ImGuiKey DivideKeyToImGuiKey(const Input::KeyCode key) noexcept
bool InputDouble4(const char *label, double v[4], const char *display_format, ImGuiInputTextFlags extra_flags)
bool InputDouble3(const char *label, double v[3], const char *display_format, ImGuiInputTextFlags extra_flags)
bool InputDouble2(const char *label, double v[2], const char *display_format, ImGuiInputTextFlags extra_flags)
bool InputDoubleN(const char *label, double *v, int components, const char *display_format, ImGuiInputTextFlags extra_flags)