GDevelop Core
Core library for developing platforms and tools compatible with GDevelop.
|
A list of objects containers, useful for accessing objects in a scoped way, along with methods to access them. More...
#include <ObjectsContainersList.h>
Public Types | |
enum | VariableExistence { DoesNotExist , Exists , GroupIsEmpty , ExistsOnlyOnSomeObjectsOfTheGroup } |
Public Member Functions | |
bool | HasObjectOrGroupNamed (const gd::String &name) const |
Check if the specified object or group exists. | |
bool | HasObjectNamed (const gd::String &name) const |
Check if the specified object exists ignoring groups. | |
VariableExistence | HasObjectOrGroupWithVariableNamed (const gd::String &objectOrGroupName, const gd::String &variableName) const |
Check if the specified object or group has the specified variable in its declared variables. | |
bool | HasObjectOrGroupVariablesContainer (const gd::String &objectOrGroupName, const gd::VariablesContainer &variablesContainer) const |
Check if the specified object or group has the specified variables container. | |
const gd::VariablesContainer * | GetObjectOrGroupVariablesContainer (const gd::String &objectOrGroupName) const |
Return the container of the variables for the specified object or group of objects. | |
gd::Variable::Type | GetTypeOfObjectOrGroupVariable (const gd::String &objectOrGroupName, const gd::String &variableName) const |
Get a type from an object/group variable. | |
gd::String | GetTypeOfObject (const gd::String &objectName) const |
Get a type from an object/group name. More... | |
bool | HasBehaviorInObjectOrGroup (const gd::String &objectOrGroupName, const gd::String &behaviorName) const |
Check if an object or all object of a group has a behavior. | |
gd::String | GetTypeOfBehaviorInObjectOrGroup (const gd::String &objectOrGroupName, const gd::String &behaviorName, bool searchInGroups=true) const |
Get the type of a behavior if an object or all objects of a group has it. | |
gd::String | GetTypeOfBehavior (const gd::String &behaviorName, bool searchInGroups=true) const |
Get a type from a behavior name. More... | |
std::vector< gd::String > | GetBehaviorsOfObject (const gd::String &objectName, bool searchInGroups=true) const |
Get behaviors of an object/group. More... | |
std::vector< gd::String > | GetBehaviorNamesInObjectOrGroup (const gd::String &objectOrGroupName, const gd::String &behaviorType, bool searchInGroups=true) const |
Get behaviors of an object/group of a given behavior type. More... | |
std::vector< gd::String > | GetAnimationNamesOfObject (const gd::String &objectOrGroupName) const |
Get the animation names of an object/group. More... | |
std::vector< gd::String > | ExpandObjectName (const gd::String &objectOrGroupName, const gd::String &onlyObjectToSelectIfPresent="") const |
Return a list containing all objects referred to by the group. If an object name is passed, then only this object name is returned. More... | |
void | ForEachObject (std::function< void(const gd::Object &object)> fn) const |
void | ForEachNameMatchingSearch (const gd::String &search, std::function< void(const gd::String &name, const gd::ObjectConfiguration *objectConfiguration)> fn) const |
Call the callback for each object or group name matching the search passed in parameter. | |
void | ForEachObjectOrGroupVariableMatchingSearch (const gd::String &objectOrGroupName, const gd::String &search, std::function< void(const gd::String &variableName, const gd::Variable &variable)> fn) const |
Call the callback for each variable of the object (or group) matching the search passed in parameter. | |
const gd::ObjectsContainer::SourceType | GetObjectsContainerSourceType (const gd::String &objectOrGroupName) const |
Return the source type of the container for the specified object or group of objects. | |
const ObjectsContainer * | GetObjectsContainerFromObjectName (const gd::String &objectOrGroupName) const |
const gd::ObjectsContainer & | GetObjectsContainer (std::size_t index) const |
Return a the objects container at position index. More... | |
std::size_t | GetObjectsContainersCount () const |
Return the number of objects containers. | |
ObjectsContainersList () | |
Static Public Member Functions | |
static ObjectsContainersList | MakeNewEmptyObjectsContainersList () |
static ObjectsContainersList | MakeNewObjectsContainersListForProjectAndLayout (const gd::Project &project, const gd::Layout &layout) |
static ObjectsContainersList | MakeNewObjectsContainersListForProject (const gd::Project &project) |
static ObjectsContainersList | MakeNewObjectsContainersListForContainers (const gd::ObjectsContainer &globalObjectsContainer, const gd::ObjectsContainer &objectsContainer) |
static ObjectsContainersList | MakeNewObjectsContainersListForContainer (const gd::ObjectsContainer &objectsContainer) |
A list of objects containers, useful for accessing objects in a scoped way, along with methods to access them.
|
inline |
Do not use - should be private but accessible to let Emscripten create a temporary.
std::vector< gd::String > gd::ObjectsContainersList::ExpandObjectName | ( | const gd::String & | objectOrGroupName, |
const gd::String & | onlyObjectToSelectIfPresent = "" |
||
) | const |
Return a list containing all objects referred to by the group. If an object name is passed, then only this object name is returned.
If onlyObjectToSelectIfPresent is set and present in the group(s), only this object will be returned. This is useful for considering this object as the "currently selected" object, when generating a condition or an action.
std::vector< gd::String > gd::ObjectsContainersList::GetAnimationNamesOfObject | ( | const gd::String & | objectOrGroupName | ) | const |
Get the animation names of an object/group.
std::vector< gd::String > gd::ObjectsContainersList::GetBehaviorNamesInObjectOrGroup | ( | const gd::String & | objectOrGroupName, |
const gd::String & | behaviorType, | ||
bool | searchInGroups = true |
||
) | const |
Get behaviors of an object/group of a given behavior type.
std::vector< gd::String > gd::ObjectsContainersList::GetBehaviorsOfObject | ( | const gd::String & | objectName, |
bool | searchInGroups = true |
||
) | const |
Get behaviors of an object/group.
const gd::ObjectsContainer & gd::ObjectsContainersList::GetObjectsContainer | ( | std::size_t | index | ) | const |
Return a the objects container at position index.
ObjectsContainer
may contain cloned objects (in the case of ProjectScopedContainers::MakeNewProjectScopedContainersForEventsBasedObject
) or "fake" objects used by events like parameters. They must not be used to edit the objects. Search for "ProjectScopedContainers wrongly containing temporary objects containers or objects" in the codebase. const ObjectsContainer * gd::ObjectsContainersList::GetObjectsContainerFromObjectName | ( | const gd::String & | objectOrGroupName | ) | const |
Get the objects container for for the specified object or group of objects.
gd::String gd::ObjectsContainersList::GetTypeOfBehavior | ( | const gd::String & | behaviorName, |
bool | searchInGroups = true |
||
) | const |
Get a type from a behavior name.
gd::String gd::ObjectsContainersList::GetTypeOfObject | ( | const gd::String & | objectName | ) | const |
Get a type from an object/group name.