Skip to content
This repository has been archived by the owner on Nov 2, 2021. It is now read-only.

Commit

Permalink
Add bindings for SceneGraphIterator
Browse files Browse the repository at this point in the history
Signed-off-by: Daniel W. S. Almeida <[email protected]>
  • Loading branch information
dwlsalmeida authored and violinyanev committed Jun 10, 2019
1 parent be664cd commit 41b5332
Show file tree
Hide file tree
Showing 3 changed files with 76 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/RamsesPython.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

#include "ramses-python/RamsesPython.h"
#include "ramses-python/Resource.h"
#include "ramses-python/SceneGraphIterator.h"
#include "ramses-client-api/SceneGraphIterator.h"

// Needed for stl <-> python conversions - don't remove!
#include "pybind11/stl.h"
Expand Down Expand Up @@ -236,4 +238,14 @@ PYBIND11_MODULE(RamsesPython, m)
.value("ERamsesObjectType_DataVector4i", ramses::ERamsesObjectType_DataVector4i , "ERamsesObjectType_DataVector4i")
.value("ERamsesObjectType_StreamTexture", ramses::ERamsesObjectType_StreamTexture , "ERamsesObjectType_StreamTexture")
.export_values();

class_<SceneGraphIterator>(m, "SceneGraphIterator")
.def(init<RamsesPython::Node&, ramses::ETreeTraversalStyle, ramses::ERamsesObjectType>())
.def("getNext", &SceneGraphIterator::getNext)
;

enum_<ramses::ETreeTraversalStyle>(m, "ETreeTraversalStyle")
.value("ETreeTraversalStyle_DepthFirst", ramses::ETreeTraversalStyle_DepthFirst)
.value("ETreeTraversalStyle_BreadthFirst", ramses::ETreeTraversalStyle_BreadthFirst)
;
}
30 changes: 30 additions & 0 deletions src/SceneGraphIterator.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// -------------------------------------------------------------------------
// Copyright (C) 2019 Daniel Werner Lima Souza de Almeida
// -------------------------------------------------------------------------
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at https://mozilla.org/MPL/2.0/.
// -------------------------------------------------------------------------

#include "ramses-python/SceneGraphIterator.h"
#include "ramses-client-api/SceneGraphIterator.h"
#include "ramses-client-api/RamsesObjectTypes.h"

namespace RamsesPython
{

SceneGraphIterator::SceneGraphIterator(RamsesPython::Node& startNode,
ramses::ETreeTraversalStyle traversalStyle,
ramses::ERamsesObjectType objectType)
:m_iter{*startNode.m_node, traversalStyle, objectType}
{

};

RamsesPython::Node SceneGraphIterator::getNext()
{
ramses::Node* next {m_iter.getNext()};
return RamsesPython::Node {next};
}

}
34 changes: 34 additions & 0 deletions src/include/ramses-python/SceneGraphIterator.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// -------------------------------------------------------------------------
// Copyright (C) 2019 Daniel Werner Lima Souza de Almeida
// -------------------------------------------------------------------------
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at https://mozilla.org/MPL/2.0/.
// -------------------------------------------------------------------------

#ifndef PYTHONRAMSES_SCENEGRAPHITERATOR_H
#define PYTHONRAMSES_SCENEGRAPHITERATOR_H

#include "ramses-python/Node.h"
#include "ramses-client-api/SceneGraphIterator.h"
#include "ramses-client-api/RamsesObjectTypes.h"

namespace RamsesPython
{

class SceneGraphIterator
{
public:
SceneGraphIterator(RamsesPython::Node& startNode,
ramses::ETreeTraversalStyle traversalStyle,
ramses::ERamsesObjectType objectType);

RamsesPython::Node getNext();

private:
ramses::SceneGraphIterator m_iter;
};

}

#endif

0 comments on commit 41b5332

Please sign in to comment.