17
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-10-17 19:09:25 +02:00
Files
maszyna/application/editoruipanels.cppm
maj00r ce5ee288ff fix the clang CI build
Every module unit now includes the standard headers it uses. Declarations
reaching a unit only through an imported module's global module fragment
are reachable but not visible, so ADL misses the free operators older
libstdc++ declares beside a type - reproduced on ubuntu 24.04 (libstdc++
13), where gl/vao.cpp could not compare vector iterators.

Also drops a stale editor/editorSettings.hpp from the MSVC source list,
which broke the Windows configure step, silences the deliberate
include-in-purview warning in the glm wrapper, and removes GCC support:
clang or MSVC only.
2026-09-09 22:52:28 +02:00

143 lines
3.4 KiB
C++

module;
#include <string>
#include <utility>
#include "global_include/interfaces/ITexture_macros.h"
#include <memory>
#include <vector>
export module eu07.simcore:editoruipanels;
import :fwd;
import eu07.application.uilayer;
import eu07.utilities.classes;
export {
/*
This Source Code Form is subject to the
terms of the Mozilla Public License, v.
2.0. If a copy of the MPL was not
distributed with this file, You can
obtain one at
http://mozilla.org/MPL/2.0/.
*/
/*
// helper, associated bool is set when the primary value was changed and expects processing at the observer's leisure
template<typename Type_>
using changeable = std::pair<Type_, bool>;
// helper, holds a set of changeable properties for a scene node
struct item_properties {
scene::basic_node const *node { nullptr }; // properties' owner
changeable<std::string> name {};
changeable<glm::dvec3> location {};
changeable<glm::vec3> rotation {};
};
*/
class itemproperties_panel : public ui_panel
{
public:
itemproperties_panel(std::string const &Name, bool const Isopen) : ui_panel(Name, Isopen) {}
// non-const node pointer so the transform editor in render() can mutate
// position/rotation/scale of TAnimModel nodes in place. Other node types
// are still treated as read-only.
void update(scene::basic_node *Node);
void render() override;
private:
// methods
void update_group();
bool render_group();
// renders DragFloat3/DragScalarN widgets for position, rotation and scale
// of the currently bound TAnimModel; no-op for other node subclasses.
void render_transform_editor();
// members
scene::basic_node *m_node{nullptr}; // scene node bound to the panel
scene::group_handle m_grouphandle{null_handle}; // scene group bound to the panel
std::string m_groupprefix;
std::vector<text_line> m_grouplines;
};
class brush_object_list : public ui_panel
{
private:
int idx;
static bool VectorGetter(void *data, int idx, const char **out_text);
std::string Template;
public:
brush_object_list(std::string const &Name, bool const Isopen);
void render() override;
void update(std::string nodeTemplate);
// class use
std::vector<std::string> Objects;
std::string *GetRandomObject();
bool useRandom = {false};
float spacing{1.0f};
};
class nodebank_panel : public ui_panel
{
public:
enum edit_mode
{
MODIFY,
COPY,
ADD,
BRUSH
};
edit_mode mode = MODIFY;
nodebank_panel(std::string const &Name, bool const Isopen);
void nodebank_reload();
void render() override;
void add_template(const std::string &desc);
const std::string *get_active_template();
private:
// methods:
std::string generate_node_label(std::string Input) const;
// members:
std::vector<std::pair<std::string, std::shared_ptr<std::string>>> m_nodebank;
char m_nodesearch[128];
std::shared_ptr<std::string> m_selectedtemplate;
};
class functions_panel : public ui_panel
{
public:
enum rotation_mode
{
RANDOM,
FIXED,
DEFAULT
};
rotation_mode rot_mode = DEFAULT;
float rot_value = 0.0f;
bool rot_from_last = false;
functions_panel(std::string const &Name, bool const Isopen) : ui_panel(Name, Isopen) {}
void update(scene::basic_node const *Node);
void render() override;
private:
// methods
// members
scene::basic_node const *m_node{nullptr}; // scene node bound to the panel
scene::group_handle m_grouphandle{null_handle}; // scene group bound to the panel
std::string m_groupprefix;
std::vector<text_line> m_grouplines;
};
} // export