mirror of https://github.com/axmolengine/axmol.git
add getMeshArrayByName method
This commit is contained in:
parent
4d08a08809
commit
0696041ea9
|
@ -684,7 +684,7 @@ Mesh* Sprite3D::getMeshByIndex(int index) const
|
||||||
return _meshes.at(index);
|
return _meshes.at(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**get SubMeshState by Name */
|
/**get Mesh by Name */
|
||||||
Mesh* Sprite3D::getMeshByName(const std::string& name) const
|
Mesh* Sprite3D::getMeshByName(const std::string& name) const
|
||||||
{
|
{
|
||||||
for (const auto& it : _meshes) {
|
for (const auto& it : _meshes) {
|
||||||
|
@ -694,6 +694,16 @@ Mesh* Sprite3D::getMeshByName(const std::string& name) const
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::vector<Mesh*> Sprite3D::getMeshArrayByName(const std::string& name) const
|
||||||
|
{
|
||||||
|
std::vector<Mesh*> meshes;
|
||||||
|
for (const auto& it : _meshes) {
|
||||||
|
if (it->getName() == name)
|
||||||
|
meshes.push_back(it);
|
||||||
|
}
|
||||||
|
return meshes;
|
||||||
|
}
|
||||||
|
|
||||||
MeshSkin* Sprite3D::getSkin() const
|
MeshSkin* Sprite3D::getSkin() const
|
||||||
{
|
{
|
||||||
for (const auto& it : _meshes) {
|
for (const auto& it : _meshes) {
|
||||||
|
|
|
@ -60,12 +60,15 @@ public:
|
||||||
void setTexture(const std::string& texFile);
|
void setTexture(const std::string& texFile);
|
||||||
void setTexture(Texture2D* texture);
|
void setTexture(Texture2D* texture);
|
||||||
|
|
||||||
/**get SubMeshState by index*/
|
/**get Mesh by index*/
|
||||||
Mesh* getMeshByIndex(int index) const;
|
Mesh* getMeshByIndex(int index) const;
|
||||||
|
|
||||||
/**get SubMeshState by Name */
|
/**get Mesh by Name, it returns the first one if there are more than one mesh with the same name */
|
||||||
Mesh* getMeshByName(const std::string& name) const;
|
Mesh* getMeshByName(const std::string& name) const;
|
||||||
|
|
||||||
|
/** get mesh array by name, returns all meshes with the given name */
|
||||||
|
std::vector<Mesh*> getMeshArrayByName(const std::string& name) const;
|
||||||
|
|
||||||
/**get mesh*/
|
/**get mesh*/
|
||||||
Mesh* getMesh() const { return _meshes.at(0); }
|
Mesh* getMesh() const { return _meshes.at(0); }
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue