Commit 93a79a6f authored by Alexander Alekhin's avatar Alexander Alekhin

Merge pull request #2454 from paroj:ovisup

parents 1d77931b 788b7836
...@@ -109,7 +109,8 @@ public: ...@@ -109,7 +109,8 @@ public:
CV_WRAP virtual void setEntityProperty(const String& name, int prop, const Scalar& value) = 0; CV_WRAP virtual void setEntityProperty(const String& name, int prop, const Scalar& value) = 0;
/// @overload /// @overload
CV_WRAP virtual void setEntityProperty(const String& name, int prop, const String& value) = 0; CV_WRAP virtual void setEntityProperty(const String& name, int prop, const String& value,
int subEntityIdx = -1) = 0;
/** /**
* get the property of an entity * get the property of an entity
......
...@@ -687,7 +687,7 @@ public: ...@@ -687,7 +687,7 @@ public:
frameCtrlrs.erase(animstate); frameCtrlrs.erase(animstate);
} }
void setEntityProperty(const String& name, int prop, const String& value) CV_OVERRIDE void setEntityProperty(const String& name, int prop, const String& value, int subEntityIdx) CV_OVERRIDE
{ {
CV_Assert(prop == ENTITY_MATERIAL); CV_Assert(prop == ENTITY_MATERIAL);
SceneNode& node = _getSceneNode(sceneMgr, name); SceneNode& node = _getSceneNode(sceneMgr, name);
...@@ -698,13 +698,18 @@ public: ...@@ -698,13 +698,18 @@ public:
Camera* cam = dynamic_cast<Camera*>(node.getAttachedObject(name)); Camera* cam = dynamic_cast<Camera*>(node.getAttachedObject(name));
if(cam) if(cam)
{ {
CV_Assert(subEntityIdx == -1 && "Camera Entities do not have SubEntities");
cam->setMaterial(mat); cam->setMaterial(mat);
return; return;
} }
Entity* ent = dynamic_cast<Entity*>(node.getAttachedObject(name)); Entity* ent = dynamic_cast<Entity*>(node.getAttachedObject(name));
CV_Assert(ent && "invalid entity"); CV_Assert(ent && "invalid entity");
if (subEntityIdx < 0)
ent->setMaterial(mat); ent->setMaterial(mat);
else
ent->getSubEntities()[subEntityIdx]->setMaterial(mat);
} }
void setEntityProperty(const String& name, int prop, const Scalar& value) CV_OVERRIDE void setEntityProperty(const String& name, int prop, const Scalar& value) CV_OVERRIDE
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment