Radiant:
binds...
* Tab: focus camera on selected
menus...
* Modify->Nudge:+ Nudge +Z, Nudge -Z
misc...
* improvement of: Scale tool: now scales bbox by gridsize increment
* snap transform origin for rotate 90' commands, if one is not custom (is good to stay on grid)
* 2d camera icon in ZY, ZX views represents yaw aswell
* M3 camera direction control: disabled snapping
* M3 camera direction control: affect yaw instead of doing pitch > 90' in ZY, ZX views
* fix of: ctrl+m3 in 2d, release ctrl, then m3: m3 drag works like with ctrl pressed
* removed 2 buttons mouse option: was only affecting m3 camera control binds
* fix of: press any modifier (ctrl/shift/alt) + any mouse, release modifier, then mouse = chase mouse broken
* removed 'Right Button Activates Context Menu' preference
* brushExport plugin, prtview plugin, bobToolz::Polygon Builder, about, textures reset, messagebox windows live on top of main window
* removed 'Update views on camera move' option: camera icon updating is enough quick
* fix: bobToolz::split patch rows+columns - works if rows = 3 ( clos and rows were mixed up in general )
* entitySetColour, entityNormalizeColour are undoable
* bobToolz::splitPatch commands place result into parent entity (worldspawn or group one)
* bobToolz::mergePatches places result into last selected patch's parent entity
* bobToolz::mergePatches: remove left empty group entities
* SelectAllOfType works for group entities, whose brush(es) are selected (no parent node selection needed).
Algorithm is: get [ent inspector's keyName field(if visible) or classname]'s keyValues of selected ents ('no key' counts, as property, too);
Then select ents with according keyName+keyValues; Worldspawn is omitted;
Otherwise (nothing or worldspawn selected) select primitives, holding selected texture;
in 'Faces' component mode = select specifically faces, holding selected texture;
* SelectAllOfType selects child primitives of group entities
* ExpandSelectionToEntities works for worldspawn entity too
This commit is contained in:
@@ -319,6 +319,57 @@ void Select_Invert(){
|
||||
Scene_Invert_Selection( GlobalSceneGraph() );
|
||||
}
|
||||
|
||||
//interesting printings
|
||||
class ExpandSelectionToEntitiesWalker_dbg : public scene::Graph::Walker
|
||||
{
|
||||
mutable std::size_t m_depth;
|
||||
NodeSmartReference worldspawn;
|
||||
public:
|
||||
ExpandSelectionToEntitiesWalker_dbg() : m_depth( 0 ), worldspawn( Map_FindOrInsertWorldspawn( g_map ) ){
|
||||
}
|
||||
bool pre( const scene::Path& path, scene::Instance& instance ) const {
|
||||
++m_depth;
|
||||
globalOutputStream() << "pre depth_" << m_depth;
|
||||
globalOutputStream() << " path.size()_" << path.size();
|
||||
if ( path.top().get() == worldspawn )
|
||||
globalOutputStream() << " worldspawn";
|
||||
if( path.top().get().isRoot() )
|
||||
globalOutputStream() << " path.top().get().isRoot()";
|
||||
Entity* entity = Node_getEntity( path.top() );
|
||||
if ( entity != 0 ){
|
||||
globalOutputStream() << " entity!=0";
|
||||
if( entity->isContainer() ){
|
||||
globalOutputStream() << " entity->isContainer()";
|
||||
}
|
||||
globalOutputStream() << " classname_" << entity->getKeyValue( "classname" );
|
||||
}
|
||||
globalOutputStream() << "\n";
|
||||
// globalOutputStream() << "" << ;
|
||||
// globalOutputStream() << "" << ;
|
||||
// globalOutputStream() << "" << ;
|
||||
// globalOutputStream() << "" << ;
|
||||
return true;
|
||||
}
|
||||
void post( const scene::Path& path, scene::Instance& instance ) const {
|
||||
globalOutputStream() << "post depth_" << m_depth;
|
||||
globalOutputStream() << " path.size()_" << path.size();
|
||||
if ( path.top().get() == worldspawn )
|
||||
globalOutputStream() << " worldspawn";
|
||||
if( path.top().get().isRoot() )
|
||||
globalOutputStream() << " path.top().get().isRoot()";
|
||||
Entity* entity = Node_getEntity( path.top() );
|
||||
if ( entity != 0 ){
|
||||
globalOutputStream() << " entity!=0";
|
||||
if( entity->isContainer() ){
|
||||
globalOutputStream() << " entity->isContainer()";
|
||||
}
|
||||
globalOutputStream() << " classname_" << entity->getKeyValue( "classname" );
|
||||
}
|
||||
globalOutputStream() << "\n";
|
||||
--m_depth;
|
||||
}
|
||||
};
|
||||
|
||||
class ExpandSelectionToEntitiesWalker : public scene::Graph::Walker
|
||||
{
|
||||
mutable std::size_t m_depth;
|
||||
@@ -330,17 +381,21 @@ bool pre( const scene::Path& path, scene::Instance& instance ) const {
|
||||
++m_depth;
|
||||
|
||||
// ignore worldspawn
|
||||
NodeSmartReference me( path.top().get() );
|
||||
if ( me == worldspawn ) {
|
||||
return false;
|
||||
}
|
||||
// NodeSmartReference me( path.top().get() );
|
||||
// if ( me == worldspawn ) {
|
||||
// return false;
|
||||
// }
|
||||
|
||||
if ( m_depth == 2 ) { // entity depth
|
||||
// traverse and select children if any one is selected
|
||||
bool beselected = false;
|
||||
if ( instance.childSelected() ) {
|
||||
Instance_setSelected( instance, true );
|
||||
beselected = true;
|
||||
if( path.top().get() != worldspawn ){
|
||||
Instance_setSelected( instance, true );
|
||||
}
|
||||
}
|
||||
return Node_getEntity( path.top() )->isContainer() && instance.isSelected();
|
||||
return Node_getEntity( path.top() )->isContainer() && beselected;
|
||||
}
|
||||
else if ( m_depth == 3 ) { // primitive depth
|
||||
Instance_setSelected( instance, true );
|
||||
@@ -522,20 +577,20 @@ inline Quaternion quaternion_for_axis90( axis_t axis, sign_t sign ){
|
||||
|
||||
void Select_RotateAxis( int axis, float deg ){
|
||||
if ( fabs( deg ) == 90.f ) {
|
||||
GlobalSelectionSystem().rotateSelected( quaternion_for_axis90( (axis_t)axis, ( deg > 0 ) ? eSignPositive : eSignNegative ) );
|
||||
GlobalSelectionSystem().rotateSelected( quaternion_for_axis90( (axis_t)axis, ( deg > 0 ) ? eSignPositive : eSignNegative ), true );
|
||||
}
|
||||
else
|
||||
{
|
||||
switch ( axis )
|
||||
{
|
||||
case 0:
|
||||
GlobalSelectionSystem().rotateSelected( quaternion_for_matrix4_rotation( matrix4_rotation_for_x_degrees( deg ) ) );
|
||||
GlobalSelectionSystem().rotateSelected( quaternion_for_matrix4_rotation( matrix4_rotation_for_x_degrees( deg ) ), false );
|
||||
break;
|
||||
case 1:
|
||||
GlobalSelectionSystem().rotateSelected( quaternion_for_matrix4_rotation( matrix4_rotation_for_y_degrees( deg ) ) );
|
||||
GlobalSelectionSystem().rotateSelected( quaternion_for_matrix4_rotation( matrix4_rotation_for_y_degrees( deg ) ), false );
|
||||
break;
|
||||
case 2:
|
||||
GlobalSelectionSystem().rotateSelected( quaternion_for_matrix4_rotation( matrix4_rotation_for_z_degrees( deg ) ) );
|
||||
GlobalSelectionSystem().rotateSelected( quaternion_for_matrix4_rotation( matrix4_rotation_for_z_degrees( deg ) ), false );
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -613,18 +668,32 @@ class EntityFindByPropertyValueWalker : public scene::Graph::Walker
|
||||
{
|
||||
const PropertyValues& m_propertyvalues;
|
||||
const char *m_prop;
|
||||
const NodeSmartReference worldspawn;
|
||||
public:
|
||||
EntityFindByPropertyValueWalker( const char *prop, const PropertyValues& propertyvalues )
|
||||
: m_propertyvalues( propertyvalues ), m_prop( prop ){
|
||||
: m_propertyvalues( propertyvalues ), m_prop( prop ), worldspawn( Map_FindOrInsertWorldspawn( g_map ) ){
|
||||
}
|
||||
bool pre( const scene::Path& path, scene::Instance& instance ) const {
|
||||
if( !path.top().get().visible() ){
|
||||
return false;
|
||||
}
|
||||
// ignore worldspawn
|
||||
if ( path.top().get() == worldspawn ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Entity* entity = Node_getEntity( path.top() );
|
||||
if ( entity != 0
|
||||
&& propertyvalues_contain( m_propertyvalues, entity->getKeyValue( m_prop ) ) ) {
|
||||
Instance_getSelectable( instance )->setSelected( true );
|
||||
if ( entity != 0 ){
|
||||
if( propertyvalues_contain( m_propertyvalues, entity->getKeyValue( m_prop ) ) ) {
|
||||
Instance_getSelectable( instance )->setSelected( true );
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
else if( path.size() > 2 && !path.top().get().isRoot() ){
|
||||
Selectable* selectable = Instance_getSelectable( instance );
|
||||
if( selectable != 0 )
|
||||
selectable->setSelected( true );
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -638,9 +707,37 @@ class EntityGetSelectedPropertyValuesWalker : public scene::Graph::Walker
|
||||
{
|
||||
PropertyValues& m_propertyvalues;
|
||||
const char *m_prop;
|
||||
const NodeSmartReference worldspawn;
|
||||
public:
|
||||
EntityGetSelectedPropertyValuesWalker( const char *prop, PropertyValues& propertyvalues )
|
||||
: m_propertyvalues( propertyvalues ), m_prop( prop ){
|
||||
: m_propertyvalues( propertyvalues ), m_prop( prop ), worldspawn( Map_FindOrInsertWorldspawn( g_map ) ){
|
||||
}
|
||||
bool pre( const scene::Path& path, scene::Instance& instance ) const {
|
||||
Entity* entity = Node_getEntity( path.top() );
|
||||
if ( entity != 0 ){
|
||||
if( path.top().get() != worldspawn ){
|
||||
Selectable* selectable = Instance_getSelectable( instance );
|
||||
if ( ( selectable != 0 && selectable->isSelected() ) || instance.childSelected() ) {
|
||||
if ( !propertyvalues_contain( m_propertyvalues, entity->getKeyValue( m_prop ) ) ) {
|
||||
m_propertyvalues.push_back( entity->getKeyValue( m_prop ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
};
|
||||
/*
|
||||
class EntityGetSelectedPropertyValuesWalker : public scene::Graph::Walker
|
||||
{
|
||||
PropertyValues& m_propertyvalues;
|
||||
const char *m_prop;
|
||||
mutable bool m_selected_children;
|
||||
const NodeSmartReference worldspawn;
|
||||
public:
|
||||
EntityGetSelectedPropertyValuesWalker( const char *prop, PropertyValues& propertyvalues )
|
||||
: m_propertyvalues( propertyvalues ), m_prop( prop ), m_selected_children( false ), worldspawn( Map_FindOrInsertWorldspawn( g_map ) ){
|
||||
}
|
||||
bool pre( const scene::Path& path, scene::Instance& instance ) const {
|
||||
Selectable* selectable = Instance_getSelectable( instance );
|
||||
@@ -651,12 +748,27 @@ bool pre( const scene::Path& path, scene::Instance& instance ) const {
|
||||
if ( !propertyvalues_contain( m_propertyvalues, entity->getKeyValue( m_prop ) ) ) {
|
||||
m_propertyvalues.push_back( entity->getKeyValue( m_prop ) );
|
||||
}
|
||||
return false;
|
||||
}
|
||||
else{
|
||||
m_selected_children = true;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
void post( const scene::Path& path, scene::Instance& instance ) const {
|
||||
Entity* entity = Node_getEntity( path.top() );
|
||||
if( entity != 0 && m_selected_children ){
|
||||
m_selected_children = false;
|
||||
if( path.top().get() == worldspawn )
|
||||
return;
|
||||
if ( !propertyvalues_contain( m_propertyvalues, entity->getKeyValue( m_prop ) ) ) {
|
||||
m_propertyvalues.push_back( entity->getKeyValue( m_prop ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
*/
|
||||
void Scene_EntityGetPropertyValues( scene::Graph& graph, const char *prop, PropertyValues& propertyvalues ){
|
||||
graph.traverse( EntityGetSelectedPropertyValuesWalker( prop, propertyvalues ) );
|
||||
}
|
||||
@@ -994,7 +1106,7 @@ static gboolean rotatedlg_apply( GtkWidget *widget, RotateDialog* rotateDialog )
|
||||
command << "rotateSelectedEulerXYZ -x " << eulerXYZ[0] << " -y " << eulerXYZ[1] << " -z " << eulerXYZ[2];
|
||||
UndoableCommand undo( command.c_str() );
|
||||
|
||||
GlobalSelectionSystem().rotateSelected( quaternion_for_euler_xyz_degrees( eulerXYZ ) );
|
||||
GlobalSelectionSystem().rotateSelected( quaternion_for_euler_xyz_degrees( eulerXYZ ), false );
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user