Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#5231: More footwork on getting it to compile again
- Loading branch information
1 parent
26a84ee
commit 9a9a1e5
Showing
44 changed files
with
695 additions
and
600 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
#pragma once | ||
|
||
#include "iselection.h" | ||
#include "scenelib.h" | ||
|
||
namespace scene | ||
{ | ||
|
||
// Checks the current selection to see whether it consists of | ||
// group nodes only. | ||
class GroupNodeChecker : | ||
public SelectionSystem::Visitor | ||
{ | ||
private: | ||
mutable bool _onlyGroups; | ||
mutable std::size_t _numGroups; | ||
mutable scene::INodePtr _firstGroupNode; | ||
|
||
public: | ||
GroupNodeChecker() : | ||
_onlyGroups(true), | ||
_numGroups(0) | ||
{} | ||
|
||
void visit(const scene::INodePtr& node) const | ||
{ | ||
if (!scene::hasChildPrimitives(node)) | ||
{ | ||
_onlyGroups = false; | ||
} | ||
else | ||
{ | ||
_numGroups++; | ||
|
||
if (!_firstGroupNode) | ||
{ | ||
_firstGroupNode = node; | ||
} | ||
} | ||
} | ||
|
||
// Returns true if the current selection consists of group nodes only | ||
// Returns false if any selected node is a non-group or if nothing is selected. | ||
bool onlyGroupsAreSelected() const | ||
{ | ||
return _numGroups > 0 && _onlyGroups; | ||
} | ||
|
||
// Returns the number of group nodes in the current selection | ||
std::size_t selectedGroupCount() const | ||
{ | ||
return _numGroups; | ||
} | ||
|
||
// Returns the first group node of the selection or NULL if nothing selected | ||
scene::INodePtr getFirstSelectedGroupNode() const | ||
{ | ||
return _firstGroupNode; | ||
} | ||
}; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#include "ModelFinder.h" | ||
|
||
#include "ientity.h" | ||
|
||
namespace scene | ||
{ | ||
|
||
ModelFinder::ModelFinder() : | ||
_onlyModels(true) | ||
{} | ||
|
||
void ModelFinder::visit(const scene::INodePtr& node) const | ||
{ | ||
Entity* entity = Node_getEntity(node); | ||
|
||
if (entity != nullptr && entity->isModel()) | ||
{ | ||
_modelList.push_back(node); | ||
} | ||
else | ||
{ | ||
_onlyModels = false; | ||
} | ||
} | ||
|
||
ModelFinder::ModelList& ModelFinder::getList() | ||
{ | ||
return _modelList; | ||
} | ||
|
||
bool ModelFinder::empty() const | ||
{ | ||
return _modelList.empty(); | ||
} | ||
|
||
bool ModelFinder::onlyModels() const | ||
{ | ||
return _onlyModels; | ||
} | ||
|
||
} // namespace |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#pragma once | ||
|
||
#include <vector> | ||
#include "iselection.h" | ||
#include "inode.h" | ||
|
||
namespace scene | ||
{ | ||
|
||
// Visitor that checks the current selection for models | ||
class ModelFinder : | ||
public SelectionSystem::Visitor | ||
{ | ||
public: | ||
typedef std::vector<scene::INodePtr> ModelList; | ||
|
||
private: | ||
mutable ModelList _modelList; | ||
mutable bool _onlyModels; | ||
|
||
public: | ||
ModelFinder(); | ||
|
||
/** | ||
* greebo: Visits every selected instance and adds all | ||
* models to the internal list | ||
*/ | ||
void visit(const scene::INodePtr& node) const; | ||
|
||
// greebo: Retrieves the result of the search | ||
ModelList& getList(); | ||
|
||
// Returns TRUE if no models were found. | ||
bool empty() const; | ||
|
||
// Returns TRUE if ONLY models were found, no other | ||
// objects like brushes, lights, etc. | ||
bool onlyModels() const; | ||
}; | ||
|
||
} // namespace |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.