Skip to content

Commit 93a79a6

Browse files
committed
Merge pull request #2454 from paroj:ovisup
2 parents 1d77931 + 788b783 commit 93a79a6

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

modules/ovis/include/opencv2/ovis.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,8 @@ class CV_EXPORTS_W WindowScene {
109109
CV_WRAP virtual void setEntityProperty(const String& name, int prop, const Scalar& value) = 0;
110110

111111
/// @overload
112-
CV_WRAP virtual void setEntityProperty(const String& name, int prop, const String& value) = 0;
112+
CV_WRAP virtual void setEntityProperty(const String& name, int prop, const String& value,
113+
int subEntityIdx = -1) = 0;
113114

114115
/**
115116
* get the property of an entity

modules/ovis/src/ovis.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -687,7 +687,7 @@ class WindowSceneImpl : public WindowScene
687687
frameCtrlrs.erase(animstate);
688688
}
689689

690-
void setEntityProperty(const String& name, int prop, const String& value) CV_OVERRIDE
690+
void setEntityProperty(const String& name, int prop, const String& value, int subEntityIdx) CV_OVERRIDE
691691
{
692692
CV_Assert(prop == ENTITY_MATERIAL);
693693
SceneNode& node = _getSceneNode(sceneMgr, name);
@@ -698,13 +698,18 @@ class WindowSceneImpl : public WindowScene
698698
Camera* cam = dynamic_cast<Camera*>(node.getAttachedObject(name));
699699
if(cam)
700700
{
701+
CV_Assert(subEntityIdx == -1 && "Camera Entities do not have SubEntities");
701702
cam->setMaterial(mat);
702703
return;
703704
}
704705

705706
Entity* ent = dynamic_cast<Entity*>(node.getAttachedObject(name));
706707
CV_Assert(ent && "invalid entity");
707-
ent->setMaterial(mat);
708+
709+
if (subEntityIdx < 0)
710+
ent->setMaterial(mat);
711+
else
712+
ent->getSubEntities()[subEntityIdx]->setMaterial(mat);
708713
}
709714

710715
void setEntityProperty(const String& name, int prop, const Scalar& value) CV_OVERRIDE

0 commit comments

Comments
 (0)