//********************************** Banshee Engine (www.banshee3d.com) **************************************************// //**************** Copyright (c) 2016 Marko Pintera (marko.pintera@gmail.com). All rights reserved. **********************// #pragma once #include "BsEditorPrerequisites.h" #include "Utility/BsModule.h" namespace bs { /** @addtogroup Scene-Editor * @{ */ /** * Handles scene object and resource selection. Triggeres events when selection changes and allows the user to query * current selection state. */ class BS_ED_EXPORT Selection : public Module { public: Selection(); ~Selection(); /** Returns a currently selected set of scene objects. */ const Vector& getSceneObjects() const; /** Sets a new set of scene objects to select, replacing the old ones. */ void setSceneObjects(const Vector& sceneObjects); /** Returns a currently selected set of resource paths. */ const Vector& getResourcePaths() const; /** Sets a new set of resource paths to select, replacing the old ones. */ void setResourcePaths(const Vector& paths); /** Returns a currently selected set of resource UUIDs. */ Vector getResourceUUIDs() const; /** Sets a new set of resource UUIDs to select, replacing the old ones. */ void setResourceUUIDs(const Vector& UUIDs); /** Deselects all currently selected scene objects. */ void clearSceneSelection(); /** Deselects all currently selected resources. */ void clearResourceSelection(); /** Pings the scene object, highlighting it in its respective editors. */ void ping(const HSceneObject& sceneObject); /** * Pings the resource, highlighting it in its respective editors. * * @param[in] resourcePath Resource path relative to the project library resources folder. */ void ping(const Path& resourcePath); /** Triggered when one or multiple scene objects is being added to the selection. */ Event&)> onSceneObjectsAdded; /** Triggered when one or multiple resources are being added to the selection. */ Event&)> onResourcesAdded; /** Triggered when one or multiple scene objects is being removed from the selection. */ Event&)> onSceneObjectsRemoved; /** Triggered when one or multiple resources are being removed from the selection. */ Event&)> onResourcesRemoved; /** * Triggered whenever scene object or resource selection changes. The provided parameters will contain the newly * selected objects/resource paths. */ Event&, const Vector&)> onSelectionChanged; /** * Triggered when a scene object ping is requested. Ping usually means the object will be highlighted in its * respective editors. */ Event onSceneObjectPing; /** * Triggered when a resource ping is requested. Ping usually means the object will be highlighted in its respective * editors. */ Event onResourcePing; private: /** Triggered when the scene object selection in the scene tree view changes. */ void sceneSelectionChanged(); /** Triggered when the resource selection in the resource tree view changes. */ void resourceSelectionChanged(); /** Updates scene and resource tree views with new selection. */ void updateTreeViews(); /** Removes any destroyed scene objects from the provided scene object list. */ void pruneDestroyedSceneObjects(Vector& sceneObjects) const; mutable Vector mSelectedSceneObjects; Vector mSelectedResourcePaths; HMessage mSceneSelectionChangedConn; HMessage mResourceSelectionChangedConn; mutable Vector mTempPrune; mutable Vector mTempSceneObjects; mutable Vector mTempResources; }; /** @} */ }