-
Notifications
You must be signed in to change notification settings - Fork 47
/
General.h
126 lines (103 loc) · 3.75 KB
/
General.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
#pragma once
#include <list>
#include <string>
#include "icommandsystem.h"
#include "iscenegraph.h"
#include "ientity.h"
#include "math/Vector3.h"
#include "math/AABB.h"
namespace selection
{
namespace algorithm
{
const char* const RKEY_FREE_OBJECT_ROTATION = "user/ui/rotateObjectsIndependently";
typedef std::list<std::string> ClassnameList;
/**
* greebo: This selects each visible entity in the subgraph whose classname matches
* the given list.
*/
class EntitySelectByClassnameWalker :
public scene::NodeVisitor
{
const ClassnameList& _classnames;
public:
EntitySelectByClassnameWalker(const ClassnameList& classnames);
bool pre(const scene::INodePtr& node);
private:
bool entityMatches(Entity* entity) const;
};
/**
* greebo: "Select All of Type" expands the selection to all items
* of similar type. The exact action depends on the current selection.
*
* For entities: all entities of the same classname as the selection are selected.
*
* For primitives: all items having the current shader (as selected in the texture
* browser) are selected.
*
* For faces: all faces carrying the current shader (as selected in the texture
* browser) are selected.
*/
void selectAllOfType(const cmd::ArgumentList& args);
/**
* greebo: Hides all selected nodes in the scene.
*/
void hideSelected(const cmd::ArgumentList& args);
/**
* greebo: Hides everything that is not selected.
*/
void hideDeselected(const cmd::ArgumentList& args);
/**
* greebo: Clears the hidden flag of all nodes in the scene.
*/
void showAllHidden(const cmd::ArgumentList& args);
/**
* greebo: Each selected item will be deselected and vice versa.
*/
void invertSelection(const cmd::ArgumentList& args);
/**
* greebo: Removes all selected nodes. If entities end up with
* no child nodes, the empty container is removed as well.
*
* Note: this is the command target, it triggers an UndoableCommand.
* Use deleteSelection() to just remove the selection without
* disrupting the undo stack.
*/
void deleteSelectionCmd(const cmd::ArgumentList& args);
/**
* greebo: Deletes all selected nodes including empty entities.
*
* Note: this command does not create an UndoableCommand, it only
* contains the deletion algorithm.
*/
void deleteSelection();
/**
* greebo: As the name says, these are the various selection routines.
*/
void selectInside(const cmd::ArgumentList& args);
void selectTouching(const cmd::ArgumentList& args);
void selectCompleteTall(const cmd::ArgumentList& args);
// Returns the center point of the current selection (or <0,0,0> if nothing selected).
Vector3 getCurrentSelectionCenter();
// Returns the AABB of the current selection (invalid bounds if nothing is selected).
// Use the bool to specify whether you want to have the light volumes calculated in
// in their entirety.
AABB getCurrentSelectionBounds(bool considerLightVolumes);
// Returns the AABB of the current selection (invalid bounds if nothing is selected).
// This will call getCurrentSelectionBounds(true) in its implementation.
AABB getCurrentSelectionBounds();
// Calculates the axis-aligned bounding box of the selection components.
AABB getCurrentComponentSelectionBounds();
// Finds the index of the selected entity and primitive and
// writes the result back into the given numbers. Does nothing if no selection is present.
void getSelectionIndex(std::size_t& ent, std::size_t& brush);
/**
* Snaps the current (component) selection to the grid.
*/
void snapSelectionToGrid(const cmd::ArgumentList& args);
/**
* Connect the various events to the functions in this namespace
*/
void registerCommands();
} // namespace algorithm
} // namespace selection