Show hidden objects in the status bar

This commit is contained in:
Marco Cawthorne 2021-06-07 11:30:54 +02:00
parent b972ae90af
commit 6a1ecee57b
3 changed files with 52 additions and 1 deletions

View file

@ -184,6 +184,9 @@ bool m_isRoot;
bool isRoot(){ bool isRoot(){
return m_isRoot; return m_isRoot;
} }
bool isHidden(){
return (m_state == eHidden) ? 1 : 0;
}
Node( Symbiot* symbiot, void* node, NodeTypeCastTable& casts ) : Node( Symbiot* symbiot, void* node, NodeTypeCastTable& casts ) :
m_state( eVisible ), m_state( eVisible ),
@ -381,6 +384,10 @@ inline bool Node_isPrimitive( scene::Node& node ){
#endif #endif
} }
inline bool Node_isHidden( scene::Node& node ){
return node.isHidden();
}
class ParentBrushes : public scene::Traversable::Walker class ParentBrushes : public scene::Traversable::Walker
{ {
scene::Node& m_parent; scene::Node& m_parent;

View file

@ -1799,6 +1799,42 @@ std::size_t Scene_countSelectedBrushes(scene::Graph &graph)
return count; return count;
} }
class CountHiddenBrushes : public scene::Graph::Walker {
std::size_t &m_count;
mutable std::size_t m_depth;
public:
CountHiddenBrushes(std::size_t &count) : m_count(count), m_depth(0)
{
m_count = 0;
}
bool pre(const scene::Path &path, scene::Instance &instance) const
{
if (++m_depth != 1 && path.top().get().isRoot()) {
return false;
}
if (Node_isHidden(path.top())) {
++m_count;
}
return true;
}
void post(const scene::Path &path, scene::Instance &instance) const
{
--m_depth;
}
};
std::size_t Scene_countHiddenBrushes(scene::Graph &graph)
{
std::size_t count;
graph.traverse(CountHiddenBrushes(count));
return count;
}
enum ENodeType { enum ENodeType {
eNodeUnknown, eNodeUnknown,
eNodeMap, eNodeMap,

View file

@ -98,11 +98,12 @@ void QE_InitVFS()
int g_numbrushes = 0; int g_numbrushes = 0;
int g_numentities = 0; int g_numentities = 0;
int g_numhidden = 0;
void QE_UpdateStatusBar() void QE_UpdateStatusBar()
{ {
char buffer[128]; char buffer[128];
sprintf(buffer, "Brushes: %d Entities: %d", g_numbrushes, g_numentities); sprintf(buffer, "Brushes: %d Entities: %d Hidden: %d", g_numbrushes, g_numentities, g_numhidden);
g_pParentWnd->SetStatusText(g_pParentWnd->m_brushcount_status, buffer); g_pParentWnd->SetStatusText(g_pParentWnd->m_brushcount_status, buffer);
} }
@ -122,6 +123,13 @@ void QE_entityCountChanged()
QE_UpdateStatusBar(); QE_UpdateStatusBar();
} }
std::size_t Scene_countHiddenBrushes(scene::Graph &graph);
void QE_hiddenCountChanged()
{
g_numhidden = Scene_countHiddenBrushes(GlobalSceneGraph());
QE_UpdateStatusBar();
}
bool ConfirmModified(const char *title) bool ConfirmModified(const char *title)
{ {
if (!Map_Modified(g_map)) { if (!Map_Modified(g_map)) {