本文整理汇总了C++中GlobalSelectionSystem函数的典型用法代码示例。如果您正苦于以下问题:C++ GlobalSelectionSystem函数的具体用法?C++ GlobalSelectionSystem怎么用?C++ GlobalSelectionSystem使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GlobalSelectionSystem函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: resizeBrushesToBounds
void resizeBrushesToBounds(const AABB& aabb, const std::string& shader)
{
if (GlobalSelectionSystem().getSelectionInfo().brushCount == 0)
{
gtkutil::MessageBox::ShowError(_("No brushes selected."), GlobalMainFrame().getTopLevelWindow());
return;
}
GlobalSelectionSystem().foreachBrush([&] (Brush& brush)
{
brush.constructCuboid(aabb, shader, TextureProjection());
});
SceneChangeNotify();
}
示例2: cloneSelected
void cloneSelected(const cmd::ArgumentList& args)
{
// Check for the correct editing mode (don't clone components)
if (GlobalSelectionSystem().Mode() == SelectionSystem::eComponent) {
return;
}
UndoableCommand undo("cloneSelected");
// Create the list that will take the cloned instances
SelectionCloner::Map cloned;
SelectionCloner cloner;
GlobalSceneGraph().root()->traverse(cloner);
// Create a new namespace and move all cloned nodes into it
INamespacePtr clonedNamespace = GlobalNamespaceFactory().createNamespace();
assert(clonedNamespace != NULL);
// Move items into the temporary namespace, this will setup the links
clonedNamespace->connect(cloner.getCloneRoot());
// Get the namespace of the current map
scene::IMapRootNodePtr mapRoot = GlobalMapModule().getRoot();
if (mapRoot == NULL) return; // not map root (this can happen)
INamespacePtr nspace = mapRoot->getNamespace();
if (nspace)
{
// Prepare the nodes for import
nspace->ensureNoConflicts(cloner.getCloneRoot());
// Now move all nodes into the target namespace
nspace->connect(cloner.getCloneRoot());
}
// Unselect the current selection
GlobalSelectionSystem().setSelectedAll(false);
// Finally, move the cloned nodes to their destination and select them
cloner.moveClonedNodes(true);
if (registry::getValue<int>(RKEY_OFFSET_CLONED_OBJECTS) == 1)
{
// Move the current selection by one grid unit to the "right" and "downwards"
nudgeSelected(eNudgeDown);
nudgeSelected(eNudgeRight);
}
}
示例3: mergeSelectedBrushes
void mergeSelectedBrushes(const cmd::ArgumentList& args)
{
// Get the current selection
BrushPtrVector brushes = selection::algorithm::getSelectedBrushes();
if (brushes.empty()) {
rMessage() << _("CSG Merge: No brushes selected.") << std::endl;
wxutil::Messagebox::ShowError(_("CSG Merge: No brushes selected."));
return;
}
if (brushes.size() < 2) {
rMessage() << "CSG Merge: At least two brushes have to be selected.\n";
wxutil::Messagebox::ShowError("CSG Merge: At least two brushes have to be selected.");
return;
}
rMessage() << "CSG Merge: Merging " << brushes.size() << " brushes." << std::endl;
UndoableCommand undo("mergeSelectedBrushes");
// Take the last selected node as reference for layers and parent
scene::INodePtr merged = GlobalSelectionSystem().ultimateSelected();
scene::INodePtr parent = merged->getParent();
assert(parent != NULL);
// Create a new BrushNode
scene::INodePtr node = GlobalBrushCreator().createBrush();
// Insert the newly created brush into the (same) parent entity
parent->addChildNode(node);
// Move the new brush to the same layers as the merged one
node->assignToLayers(merged->getLayers());
// Get the contained brush
Brush* brush = Node_getBrush(node);
// Attempt to merge the selected brushes into the new one
if (!Brush_merge(*brush, brushes, true))
{
rWarning() << "CSG Merge: Failed - result would not be convex." << std::endl;
return;
}
ASSERT_MESSAGE(!brush->empty(), "brush left with no faces after merge");
// Remove the original brushes
for (BrushPtrVector::iterator i = brushes.begin(); i != brushes.end(); ++i)
{
scene::removeNodeFromParent(*i);
}
// Select the new brush
Node_setSelected(node, true);
rMessage() << "CSG Merge: Succeeded." << std::endl;
SceneChangeNotify();
}
示例4: onEntryActivated
void SelectionSetToolmenu::onEntryActivated()
{
// Create new selection set if possible
std::string name = _entry->get_entry()->get_text();
if (name.empty()) return;
// don't create empty sets
if (GlobalSelectionSystem().countSelected() == 0)
{
ui::IDialogPtr dialog = GlobalDialogManager().createMessageBox(
_("Cannot create selection set"),
_("Cannot create a selection set, there is nothing selected in the current scene."),
ui::IDialog::MESSAGE_CONFIRM);
dialog->run();
return;
}
ISelectionSetPtr set = GlobalSelectionSetManager().createSelectionSet(name);
assert(set != NULL);
set->assignFromCurrentScene();
// Clear the entry again
_entry->get_entry()->set_text("");
}
示例5: setFixedTessCmd
void PatchInspector::emitTesselation()
{
UndoableCommand setFixedTessCmd("patchSetFixedTesselation");
wxSpinCtrl* fixedSubdivX = findNamedObject<wxSpinCtrl>(this, "PatchInspectorSubdivisionsX");
wxSpinCtrl* fixedSubdivY = findNamedObject<wxSpinCtrl>(this, "PatchInspectorSubdivisionsY");
Subdivisions tess(
fixedSubdivX->GetValue(),
fixedSubdivY->GetValue()
);
bool fixed = findNamedObject<wxCheckBox>(this, "PatchInspectorFixedSubdivisions")->GetValue();
// Save the setting into the selected patch(es)
GlobalSelectionSystem().foreachPatch([&] (Patch& patch)
{
patch.setFixedSubdivisions(fixed, tess);
});
fixedSubdivX->Enable(fixed);
fixedSubdivY->Enable(fixed);
findNamedObject<wxStaticText>(this, "PatchInspectorSubdivisionsXLabel")->Enable(fixed);
findNamedObject<wxStaticText>(this, "PatchInspectorSubdivisionsYLabel")->Enable(fixed);
GlobalMainFrame().updateAllWindows();
}
示例6: blocker
void ModelCache::refreshSelectedModels(const cmd::ArgumentList& args)
{
// Disable screen updates for the scope of this function
ui::ScreenUpdateBlocker blocker(_("Processing..."), _("Reloading Models"));
// Find all models in the current selection
ModelFinder walker;
GlobalSelectionSystem().foreachSelected(walker);
// Remove the selected models from the cache
ModelFinder::ModelPaths models = walker.getModelPaths();
for (ModelFinder::ModelPaths::const_iterator i = models.begin();
i != models.end(); ++i)
{
ModelMap::iterator found = _modelMap.find(*i);
if (found != _modelMap.end())
{
_modelMap.erase(found);
}
}
// Traverse the entities and submit a refresh call
ModelFinder::Entities entities = walker.getEntities();
for (ModelFinder::Entities::const_iterator i = entities.begin();
i != entities.end(); ++i)
{
(*i)->refreshModel();
}
}
示例7: PasteToCamera
void PasteToCamera (void)
{
CamWnd& camwnd = *g_pParentWnd->GetCamWnd();
GlobalSelectionSystem().setSelectedAll(false);
UndoableCommand undo("pasteToCamera");
Selection_Paste();
// Work out the delta
Vector3 mid = selection::algorithm::getCurrentSelectionCenter();
Vector3 delta = vector3_snapped(camwnd.getCameraOrigin(), GlobalGrid().getGridSize()) - mid;
// Move to camera
GlobalSelectionSystem().translateSelected(delta);
}
示例8: Scene_BrushResize_Selected
void Scene_BrushResize_Selected(scene::Graph& graph, const AABB& bounds, const char* shader)
{
if(GlobalSelectionSystem().countSelected() != 0)
{
const scene::Path& path = GlobalSelectionSystem().ultimateSelected().path();
Brush* brush = Node_getBrush(path.top());
if(brush != 0)
{
TextureProjection projection;
TexDef_Construct_Default(projection);
Brush_ConstructCuboid(*brush, bounds, shader, projection);
SceneChangeNotify();
}
}
}
示例9: Entity_moveSelectedPrimitives
/// moves selected primitives to entity, which is or its primitive is ultimateSelected() or firstSelected()
void Entity_moveSelectedPrimitives( bool toLast ){
if ( GlobalSelectionSystem().countSelected() < 2 ) {
globalErrorStream() << "Source and target entity primitives should be selected!\n";
return;
}
const scene::Path& path = toLast? GlobalSelectionSystem().ultimateSelected().path() : GlobalSelectionSystem().firstSelected().path();
scene::Node& node = ( !Node_isEntity( path.top() ) && path.size() > 1 )? path.parent() : path.top();
if ( Node_isEntity( node ) && node_is_group( node ) ) {
StringOutputStream command;
command << "movePrimitivesToEntity " << makeQuoted( Node_getEntity( node )->getEntityClass().name() );
UndoableCommand undo( command.c_str() );
Scene_parentSelectedBrushesToEntity( GlobalSceneGraph(), node );
}
}
示例10: message
/**
* Callback common to all of the commands that trigger a processing by mesh
* visitor when selected. This callback does its own internal dispatch to
* distinctly handle the various commands.
*
* @param commandString The command token.
*/
void
MainMenu::CommandMeshVisitor(const std::string& commandString)
{
// Look up the registered mesh visitor for this command.
VisitorMap::const_iterator visitorMapIter = _visitorMap.find(commandString);
MeshVisitor *meshVisitor;
if (visitorMapIter == _visitorMap.end() ||
(meshVisitor = visitorMapIter->second) == NULL)
{
// That's odd, there isn't one. Bail out.
std::string message(commandString + ": " + DIALOG_INTERNAL_ERROR);
GenericPluginUI::ErrorReportDialog(DIALOG_ERROR_TITLE, message.c_str());
return;
}
// Let Radiant know the name of the operation responsible for the changes
// that are about to happen.
UndoableCommand undo(commandString.c_str());
// Apply the visitor to every selected mesh.
meshVisitor->ResetVisitedCount();
GlobalSelectionSystem().foreachSelected(*meshVisitor);
if (meshVisitor->GetVisitedCount() == 0)
{
// Warn if there weren't any meshes selected (so nothing happened).
GenericPluginUI::WarningReportDialog(DIALOG_WARNING_TITLE,
DIALOG_NOMESHES_MSG);
}
}
示例11: GlobalSelectionSystem
void LightNode::renderInactiveComponents(RenderableCollector& collector, const VolumeTest& volume, const bool selected) const
{
// greebo: We are not in component selection mode (and the light is still selected),
// check if we should draw the center of the light anyway
if (selected
&& GlobalSelectionSystem().ComponentMode() != SelectionSystem::eVertex
&& EntitySettings::InstancePtr()->alwaysShowLightVertices())
{
if (_light.isProjected())
{
EntitySettings& settings = *EntitySettings::InstancePtr();
const Vector3& colourStartEndInactive = settings.getLightVertexColour(EntitySettings::VERTEX_START_END_DESELECTED);
const Vector3& colourVertexInactive = settings.getLightVertexColour(EntitySettings::VERTEX_DESELECTED);
const_cast<Light&>(_light).colourLightStart() = colourStartEndInactive;
const_cast<Light&>(_light).colourLightEnd() = colourStartEndInactive;
const_cast<Light&>(_light).colourLightTarget() = colourVertexInactive;
const_cast<Light&>(_light).colourLightRight() = colourVertexInactive;
const_cast<Light&>(_light).colourLightUp() = colourVertexInactive;
// Render the projection points
_light.renderProjectionPoints(collector, volume, localToWorld());
}
else
{
const Vector3& colourVertexInactive = EntitySettings::InstancePtr()->getLightVertexColour(
EntitySettings::VERTEX_INACTIVE);
const_cast<Light&>(_light).getDoom3Radius().setCenterColour(colourVertexInactive);
_light.renderLightCentre(collector, volume, localToWorld());
}
}
}
示例12: NudgeSelection
void NudgeSelection (ENudgeDirection direction, float fAmount, EViewType viewtype)
{
AxisBase axes(AxisBase_forViewType(viewtype));
Vector3 view_direction(-axes.z);
Vector3 nudge(AxisBase_axisForDirection(axes, direction) * fAmount);
GlobalSelectionSystem().NudgeManipulator(nudge, view_direction);
}
示例13: evaluateTransform
void LightNode::evaluateTransform() {
if (getType() == TRANSFORM_PRIMITIVE) {
_light.translate(getTranslation());
_light.rotate(getRotation());
}
else {
// Check if the light center is selected, if yes, transform it, if not, it's a drag plane operation
if (GlobalSelectionSystem().ComponentMode() == SelectionSystem::eVertex) {
if (_lightCenterInstance.isSelected()) {
// Retrieve the translation and apply it to the temporary light center variable
// This adds the translation vector to the previous light origin
_light.getDoom3Radius().m_centerTransformed =
_light.getDoom3Radius().m_center + getTranslation();
}
if (_lightTargetInstance.isSelected()) {
// Delegate the work to the Light class
_light.translateLightTarget(getTranslation());
}
if (_lightRightInstance.isSelected()) {
// Save the new light_right vector
_light.rightTransformed() = _light.right() + getTranslation();
}
if (_lightUpInstance.isSelected()) {
// Save the new light_up vector
_light.upTransformed() = _light.up() + getTranslation();
}
if (_lightStartInstance.isSelected()) {
// Delegate the work to the Light class (including boundary checks)
_light.translateLightStart(getTranslation());
}
if (_lightEndInstance.isSelected()) {
// Save the new light_up vector
_light.endTransformed() = _light.end() + getTranslation();
}
// If this is a projected light, then it is likely for the according vertices to have changed, so update the projection
if (_light.isProjected()) {
// Call projection changed, so that the recalculation can be triggered (call for projection() would be ignored otherwise)
_light.projectionChanged();
// Recalculate the frustum
_light.projection();
}
}
else {
// Ordinary Drag manipulator
//m_dragPlanes.m_bounds = _light.aabb();
// greebo: Be sure to use the actual lightAABB for evaluating the drag operation, NOT
// the aabb() or localABB() method, that returns the bounding box including the light center,
// which may be positioned way out of the volume
m_dragPlanes.m_bounds = _light.lightAABB();
_light.setLightRadius(m_dragPlanes.evaluateResize(getTranslation(), rotation()));
}
}
}
示例14: GlobalSelectionSystem
// free all map elements, reinitialize the structures that depend on them
void Map::freeMap() {
map::PointFile::Instance().clear();
GlobalSelectionSystem().setSelectedAll(false);
GlobalSelectionSystem().setSelectedAllComponents(false);
GlobalShaderClipboard().clear();
GlobalRegion().clear();
m_resource->removeObserver(*this);
// Reset the resource pointer
m_resource = IMapResourcePtr();
GlobalLayerSystem().reset();
}
示例15: Select_SetShader
void Select_SetShader (const std::string& shader)
{
if (GlobalSelectionSystem().Mode() != SelectionSystem::eComponent) {
Scene_BrushSetShader_Selected(GlobalSceneGraph(), shader);
}
Scene_BrushSetShader_Component_Selected(GlobalSceneGraph(), shader);
}