29 std::vector<entt::meta_any>
objects{entt::meta_any{}};
150 void unselect(
bool clear_selection_tools =
true);
182 if(is_selected_impl(
entry,
object))
195 return selected && selected.type() == entt::resolve<T>();
228 if(active.type() == entt::resolve<T>())
230 return &active.cast<T&>();
240 if(active.type() == entt::resolve<T>())
242 return &active.cast<T&>();
251 std::vector<T*> result;
255 if(obj.type() == entt::resolve<T>())
257 result.emplace_back(&obj.cast<T&>());
267 std::vector<T*> result;
271 if(obj.type() == entt::resolve<T>())
273 result.emplace_back(&obj.cast<T&>());
283 std::vector<T> result;
287 if(obj.type() == entt::resolve<T>())
289 result.emplace_back(obj.cast<T>());
301 if(
focused.type() != entt::resolve<T>())
319 if(
focused.type() != entt::resolve<fs::path>())
331 if(
focused.type() == entt::resolve<T>())
346 unselect_impl(
entry);
352 bool selection_changed = old_selection.size() != new_selection.size();
353 if (!selection_changed && !old_selection.empty())
356 for (
size_t i = 0; i < old_selection.size() && !selection_changed; ++i)
358 if (i >= new_selection.size() || old_selection[i] != new_selection[i])
360 selection_changed =
true;
366 if (selection_changed)
369 queue_action(
"Unselect", std::make_shared<selection_action_t>(
this, old_selection, new_selection,
false));
379 if constexpr(std::is_same_v<T, entt::handle>)
382 if(
auto tag =
entry.template try_get<tag_component>())
384 hint =
tag->name +
" (Entity)";
402 bool selection_changed = old_selection.size() != new_selection.size();
403 if (!selection_changed)
406 for (
size_t i = 0; i < old_selection.size() && !selection_changed; ++i)
408 if (i >= new_selection.size() || old_selection[i] != new_selection[i])
410 selection_changed =
true;
416 if (selection_changed)
419 queue_action(
"Select " + hint, std::make_shared<selection_action_t>(
this, old_selection, new_selection,
true));
438 void do_action(
const std::string&
name,
const std::function<
void()>& action);
441 void do_action(
const std::string&
name,
const std::function<
void()>&
do_action,
const std::function<
void()>& undo_action);
444 void do_action(
const std::string&
name, std::shared_ptr<editing_action_t> action);
446 template<
typename ActionType,
typename... Args>
449 auto action = std::make_shared<ActionType>(std::forward<Args>(args)...);
453 void queue_action(
const std::string&
name,
const std::function<
void()>& action);
456 void queue_action(
const std::string&
name,
const std::function<
void()>&
do_action,
const std::function<
void()>& undo_action);
459 void queue_action(
const std::string&
name, std::shared_ptr<editing_action_t> action);
461 template<
typename ActionType,
typename... Args>
464 auto action = std::make_shared<ActionType>(std::forward<Args>(args)...);
478 auto undo() -> std::shared_ptr<editing_action_t>;
479 auto redo() -> std::shared_ptr<editing_action_t>;
491 void clear(
bool clear_unsaved =
true);
518 ImGuizmo::MODE
mode = ImGuizmo::LOCAL;
557 for (
const auto& obj : selection_snapshot)
563 if (obj.type() == entt::resolve<entt::handle>())
565 auto handle = obj.cast<
const entt::handle&>();
583 auto is_selected_impl(
const T&
entry,
const entt::meta_any& selected) ->
bool
585 if(selected.type() != entt::resolve<T>())
590 return selected.cast<
const T&>() ==
entry;
622 unselect_impl(
entry);
643 unselect_impl(
entry);
661 void unselect_impl(
const T&
entry)
666 return is_selected_impl(entry, el);
673 scene* scn =
nullptr;
674 std::stringstream cache;
678 struct selection_cache
680 std::vector<hpp::uuid> uids;
683 std::map<std::string, scene_cache> caches_;
684 selection_cache selection_cache_;
687 void load_checkpoint(
rtti::context& ctx, scene_cache&
cache,
bool recover_selection =
false);
689 std::shared_ptr<int> sentinel_ = std::make_shared<int>(0);
691 bool waiting_for_compilation_before_play_{};
692 bool has_unsaved_changes_;
696 auto prompt_save_changes(
rtti::context& ctx,
const std::function<
void()>& on_save,
const std::function<
void()>& on_continue) -> bool;
std::chrono::duration< float > delta_t
path resolve_protocol(const path &_path)
Given the specified path/filename, resolve the final full filename. This will be based on either the ...
Hash specialization for batch_key to enable use in std::unordered_map.
@ immediate
Schedule load on thread pool now (default, backward compatible).
Thread-safe handle to an asset.
bool show_reflection_probe
bool show_particle_emitter
bool show_particle_emitter
bool show_particle_emitter_direction
bool show_particle_emitter_bounds
math::vec4 selection_wireframe_color
bool show_selection_outline
float selection_wireframe_thickness
bool show_component_gizmos
bool show_reflection_probe
bool show_particle_emitter_shape
bool show_model_submesh_bounds
bool show_selection_wireframe
std::vector< entt::meta_any > objects
math::vec3 translation_snap
float rotation_degree_snap
auto has_pending_actions() const -> bool
auto is_prefab_mode() const -> bool
auto get_active_scene(rtti::context &ctx) -> scene *
auto get_selections() const -> hpp::span< const entt::meta_any >
auto try_get_active_selection_as() -> T *
void on_play_begin(rtti::context &ctx)
bool show_grid
enable editor grid
void on_play_after_end(rtti::context &ctx)
auto is_focused(const T &entry) -> bool
auto try_get_selections_as() const -> std::vector< const T * >
auto get_select_mode() const -> select_mode
bool wireframe_selection
enable wireframe selection
ImGuizmo::OPERATION operation
current manipulation gizmo operation.
void push_undo_stack_enabled(bool enabled)
void unselect(const T &entry)
ImGuizmo::MODE mode
current manipulation gizmo space.
void queue_action(const std::string &name, Args &&... args)
void on_action_executed(std::shared_ptr< editing_action_t > action)
void focus_path(const fs::path &object)
auto get_selections() -> hpp::span< entt::meta_any >
auto undo() -> std::shared_ptr< editing_action_t >
void pop_undo_stack_enabled()
auto init(rtti::context &ctx) -> bool
billboard_gizmos billboard_data
void on_play_before_begin(rtti::context &ctx)
auto can_undo() const -> bool
void on_frame_update(rtti::context &ctx, delta_t)
void select(const T &entry, select_mode mode=select_mode::normal, std::string hint="")
void on_script_recompile(rtti::context &ctx, const std::string &protocol, uint64_t version)
auto is_selected_type() -> bool
void clear(bool clear_unsaved=true)
auto has_unsaved_changes() const -> bool
auto is_selected(const T &entry) -> bool
auto get_active_selection() const -> const entt::meta_any &
std::vector< std::shared_ptr< editing_action_t > > pending_actions
auto get_active_selection_as() const -> const T &
void sanity_check_selection_data()
entt::handle prefab_entity
void foucs_asset(const asset_handle< T > &entry)
auto can_redo() const -> bool
void try_unselect()
Clears the selection data if it maches the type.
bool show_icon_gizmos
enable editor icon gizmos
void restore_selection_impl(const std::vector< entt::meta_any > &selection_snapshot)
auto try_get_active_focus_as() const -> const T *
void sync_prefab_entity(rtti::context &ctx, entt::handle entity, const asset_handle< prefab > &pfb)
void clear_unsaved_changes()
selection selection_data
selection data containing selected object
void queue_action(const std::string &name, const std::function< void()> &action)
bool auto_rebuild_reflection_probes
auto try_get_active_selection_as() const -> const T *
void do_action(const std::string &name, const std::function< void()> &action)
auto get_active_selection() -> entt::meta_any &
auto try_get_selections_as_copy() const -> std::vector< T >
auto redo() -> std::shared_ptr< editing_action_t >
void sync_prefab_instances(rtti::context &ctx, scene *scn)
void on_prefab_updated(const asset_handle< prefab > &pfb)
auto try_get_selections_as() -> std::vector< T * >
void unload_scenes_scripting(const std::vector< scene * > &scenes)
void enter_prefab_mode(rtti::context &ctx, const asset_handle< prefab > &prefab, bool auto_save=false)
std::stack< bool > undo_stack_enabled
void do_action(const std::string &name, Args &&... args)
auto deinit(rtti::context &ctx) -> bool
void add_action(const std::string &name, std::shared_ptr< editing_action_t > action, bool immediate=true)
void focus(entt::meta_any object)
Selects an object. Can be anything.
auto get_pending_actions_count() const -> size_t
auto is_focused(const asset_handle< T > &entry) -> bool
void exit_prefab_mode(rtti::context &ctx, save_option save_changes=save_option::prompt)
inverse_kinematics ik_data
undo_redo_stack undo_stack
void save_prefab_changes(rtti::context &ctx)
editing_mode current_mode
asset_handle< prefab > edited_prefab
snap snap_data
snap data containging various snap options
void unselect(bool clear_selection_tools=true)
Clears the selection data.
Represents a generic prefab with a buffer for serialized data.
Represents a scene in the ACE framework, managing entities and their relationships.
auto can_undo() const -> bool
auto can_redo() const -> bool