/
SelectionInterface.h
53 lines (41 loc) · 1.2 KB
/
SelectionInterface.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#pragma once
#include <pybind11/pybind11.h>
#include "iscript.h"
#include "selectionlib.h"
#include <map>
#include "SceneGraphInterface.h"
namespace script
{
// ========== Selection Handling ==========
// Wrap around the SelectionSystem::Visitor interface
class SelectionVisitorWrapper :
public SelectionSystem::Visitor
{
public:
void visit(const scene::INodePtr& node) const override
{
// Wrap this method to python
PYBIND11_OVERLOAD_PURE(
void, /* Return type */
SelectionSystem::Visitor, /* Parent class */
visit, /* Name of function in C++ (must match Python name) */
ScriptSceneNode(node) /* Argument(s) */
);
}
};
class SelectionInterface :
public IScriptInterface
{
public:
// SelectionSystem wrappers
const SelectionInfo& getSelectionInfo();
void foreachSelected(const SelectionSystem::Visitor& visitor);
void foreachSelectedComponent(const SelectionSystem::Visitor& visitor);
void setSelectedAll(int selected);
void setSelectedAllComponents(int selected);
ScriptSceneNode ultimateSelected();
ScriptSceneNode penultimateSelected();
// IScriptInterface implementation
void registerInterface(py::module& scope, py::dict& globals) override;
};
} // namespace script