Effectively acts like a container for MeshModelSource objects.
More...
#include <Mesh/DataStructures/meshmodellibrary.h>
The main purpose of this class is to provide a single place from which clients can retrieve a MeshModel with a given model id. A MeshModelLibrary can hold other MeshModelLibrary instances, searching recursively (depth first) for a requested model id.
◆ MeshModelLibrary() [1/3]
Creates an empty library.
◆ MeshModelLibrary() [2/3]
- Parameters
-
lib | The library to make a copy of. |
When lib is copied, the items it contains are not copied. Instead, the new MeshModelLibrary instance will hold references to the same things as lib. Therefore, the client needs to ensure that these contents remain valid for as long as the copy is in use. In particular, if lib is rebuilt as a result of a workspace operation's inputs being updated, the original copy of it should also be updated to prevent that copy from trying to use objects which might no longer exist.
◆ MeshModelLibrary() [3/3]
- Parameters
-
lib | The library to make a copy of |
◆ ~MeshModelLibrary()
The destructor destroys the library, but not the things it contains.
◆ add() [1/2]
- Parameters
-
library | The sub-library to add to this library. |
- Returns
- True if library could be added or false if it is already a direct sub-library of this one.
◆ add() [2/2]
- Parameters
-
source | The model source to add to the library. |
If a source with the same id as source is already present in the library, this function will not add source. Instead, the old source is retained and the function returns false. Note that this test is only performed for model sources held directly by this library, not for any of the sub-libraries it also might hold. This allows a library to provide model sources which override those specified in any sub-libraries.
- Returns
- True if source could be added.
◆ clearSources()
Clears all model sources from the library. Note that the model sources are not deleted. This function merely clears the list of sources the library keeps internally.
◆ clearSubLibraries()
void clearSubLibraries |
( |
| ) |
|
Clears all sub-libraries from this library. Note that the sub-libraries are not deleted. This function merely clears the list of sub-libraries this library keeps internally.
◆ getMeshModelSource()
- Parameters
-
id | The id of the model source to retrieve. |
- Returns
- The mesh model source corresponding to the specified model id, or a null pointer if no such model source could be found. Note that if a sub-library supplies a source for a given id but for some reason the source fails to generate a model, any source in any other sub-library which also matches the id will never be seen. The first source matching id is always returned whether or not it is able to successfully obtain a model (since this is not usually known at the time getMeshModelSource() is called).
◆ getSourceIds()
- Parameters
-
recursive | Whether or not to recursively retrieve IDs from sub-libraries. |
- Returns
- A QStringList containing the IDs of all MeshModelSource objects contained within this MeshModelLibrary (and optionally its child libraries).
◆ operator=()
◆ remove() [1/3]
bool remove |
( |
const QString & |
id | ) |
|
- Parameters
-
id | The id of the model source to remove from the library. |
- Returns
- True if a source exists in the library with the specified id and it could be removed.
◆ remove() [2/3]
- Parameters
-
library | The sub-library to remove from this library. |
- Returns
- True if library is a sub-library directly held by this library and it could be removed. It will not be removed if it is not an immediate sub-library but is held more deeply in the sub-library hierachy.
◆ remove() [3/3]
- Parameters
-
source | The model source to remove from the library. |
Note that this function is slower than the remove(const String&) version due to how the data is stored internally. Access is optimized for lookups based on the id string, so searching for a particular model source object is O(n) where n is the number of source this library holds directly (but is not affected by any sub-libraries).
- Returns
- True if source exists in the library and could be removed.