42 template <
typename ToolType,
typename ElementType>
43 void register_tool(
const System& tool_system)
45 const auto k = key<ToolType, ElementType>();
46 m_tool_systems[k] = tool_system;
48 if (std::find(m_tool_types.begin(), m_tool_types.end(), k.first) == m_tool_types.end()) {
49 m_tool_types.push_back(k.first);
52 if (std::find(m_element_types.begin(), m_element_types.end(), k.second) ==
53 m_element_types.end()) {
54 m_element_types.push_back(k.second);
58 template <
typename ToolType,
typename ElementType>
59 void run(Registry& registry)
61 m_tool_systems[key<ToolType, ElementType>()](registry);
64 void run(entt::id_type tool_type, entt::id_type element_type, Registry& registry);
67 bool run_current(Registry& registry);
70 const std::vector<entt::id_type>& get_element_types()
const;
71 const std::vector<entt::id_type>& get_tool_types()
const;
73 std::vector<entt::id_type>& get_element_types();
74 std::vector<entt::id_type>& get_tool_types();
76 entt::id_type get_current_tool_type()
const;
77 entt::id_type get_current_element_type()
const;
79 bool has_backface_selection_tool()
const;
80 void enable_backface_selection_tool(
bool has_backfaces_tool);
82 void set_current_element_type(entt::id_type element_type);
84 void set_current_tool_type(entt::id_type tool_type);
87 void set_current_element_type()
89 set_current_element_type(entt::type_id<T>().hash());
93 void set_current_tool_type()
95 set_current_tool_type(entt::type_id<T>().hash());
99 using KeyType = std::pair<entt::id_type, entt::id_type>;
101 template <
typename ToolType,
typename ElementType>
102 static constexpr KeyType key()
104 return {entt::type_id<ToolType>().hash(), entt::type_id<ElementType>().hash()};
106 std::unordered_map<KeyType, System, utils::pair_hash> m_tool_systems;
107 std::vector<entt::id_type> m_tool_types;
108 std::vector<entt::id_type> m_element_types;
110 KeyType m_current_key = {0, 0};
112 bool m_has_backface_selection_tool =
true;