* View->Show->Entity Connections option

This commit is contained in:
Garux 2017-10-27 18:18:11 +03:00
parent 80faa85d36
commit bd28ec81f7
7 changed files with 36 additions and 8 deletions

View File

@ -128,6 +128,8 @@ virtual void setShowNames( bool showNames ) = 0;
virtual bool getShowNames() = 0;
virtual void setShowBboxes( bool showBboxes ) = 0;
virtual bool getShowBboxes() = 0;
virtual void setShowConnections( bool showConnections ) = 0;
virtual bool getShowConnections() = 0;
virtual void setShowNamesDist( int dist ) = 0;
virtual int getShowNamesDist() = 0;
virtual void setShowNamesRatio( int ratio ) = 0;

View File

@ -114,6 +114,7 @@ Counter* EntityKeyValues::m_counter = 0;
bool g_showNames = true;
bool g_showBboxes = false;
bool g_showConnections = true;
int g_showNamesDist = 512;
int g_showNamesRatio = 64;
bool g_showTargetNames = false;
@ -278,6 +279,12 @@ void setShowBboxes( bool showBboxes ){
bool getShowBboxes(){
return g_showBboxes;
}
void setShowConnections( bool showConnections ){
g_showConnections = showConnections;
}
bool getShowConnections(){
return g_showConnections;
}
void setShowNamesDist( int dist ){
g_showNamesDist = dist;
}
@ -409,6 +416,7 @@ void Entity_Construct( EGameType gameType ){
GlobalPreferenceSystem().registerPreference( "SI_ShowNames", BoolImportStringCaller( g_showNames ), BoolExportStringCaller( g_showNames ) );
GlobalPreferenceSystem().registerPreference( "SI_ShowBboxes", BoolImportStringCaller( g_showBboxes ), BoolExportStringCaller( g_showBboxes ) );
GlobalPreferenceSystem().registerPreference( "SI_ShowConnections", BoolImportStringCaller( g_showConnections ), BoolExportStringCaller( g_showConnections ) );
GlobalPreferenceSystem().registerPreference( "SI_ShowNamesDist", IntImportStringCaller( g_showNamesDist ), IntExportStringCaller( g_showNamesDist ) );
GlobalPreferenceSystem().registerPreference( "SI_ShowNamesRatio", IntImportStringCaller( g_showNamesRatio ), IntExportStringCaller( g_showNamesRatio ) );
GlobalPreferenceSystem().registerPreference( "SI_ShowTargetNames", BoolImportStringCaller( g_showTargetNames ), BoolExportStringCaller( g_showTargetNames ) );

View File

@ -41,6 +41,7 @@ void Entity_Destroy();
extern bool g_showNames;
extern bool g_showBboxes;
extern bool g_showConnections;
extern int g_showNamesDist;
extern int g_showNamesRatio;
extern bool g_showTargetNames;

View File

@ -34,4 +34,4 @@ targetables_t* getTargetables( const char* targetname ){
return &g_targetnames[targetname];
}
Shader* RenderableTargetingEntity::m_state;
//Shader* RenderableTargetingEntity::m_state;

View File

@ -289,7 +289,7 @@ const TargetingEntities& get() const {
};
#if 0
class RenderableTargetingEntity
{
TargetingEntity& m_targets;
@ -314,13 +314,13 @@ void render( Renderer& renderer, const VolumeTest& volume, const Vector3& world_
}
}
};
#endif
class RenderableTargetingEntities
{
const TargetingEntities& m_targets;
mutable RenderablePointVector m_target_lines;
public:
static Shader* m_state;
//static Shader* m_state;
RenderableTargetingEntities( const TargetingEntities& targets )
: m_targets( targets ), m_target_lines( GL_LINES ){
@ -416,6 +416,7 @@ const TargetingEntities& getTargeting() const {
}
};
#include "entity.h"
class RenderableConnectionLines : public Renderable
{
@ -432,10 +433,12 @@ void detach( TargetableInstance& instance ){
}
void renderSolid( Renderer& renderer, const VolumeTest& volume ) const {
for ( TargetableInstances::const_iterator i = m_instances.begin(); i != m_instances.end(); ++i )
{
if ( ( *i )->path().top().get().visible() ) {
( *i )->render( renderer, volume );
if( g_showConnections ){
for ( TargetableInstances::const_iterator i = m_instances.begin(); i != m_instances.end(); ++i )
{
if ( ( *i )->path().top().get().visible() ) {
( *i )->render( renderer, volume );
}
}
}
}

View File

@ -2082,6 +2082,7 @@ GtkMenuItem* create_view_menu( MainFrame::EViewStyle style ){
create_check_menu_item_with_mnemonic( menu_in_menu, "Show Entity _Names", "ShowNames" );
create_check_menu_item_with_mnemonic( menu_in_menu, "Show Light Radiuses", "ShowLightRadiuses" );
create_check_menu_item_with_mnemonic( menu_in_menu, "Show Entity Boxes", "ShowBboxes" );
create_check_menu_item_with_mnemonic( menu_in_menu, "Show Entity Connections", "ShowConnections" );
menu_separator( menu_in_menu );

View File

@ -3184,6 +3184,18 @@ void ShowBboxesToggle(){
UpdateAllWindows();
}
void ShowConnectionsExport( const BoolImportCallback& importer ){
importer( GlobalEntityCreator().getShowConnections() );
}
typedef FreeCaller1<const BoolImportCallback&, ShowConnectionsExport> ShowConnectionsExportCaller;
ShowConnectionsExportCaller g_show_connections_caller;
ToggleItem g_show_connections( g_show_connections_caller );
void ShowConnectionsToggle(){
GlobalEntityCreator().setShowConnections( !GlobalEntityCreator().getShowConnections() );
g_show_connections.update();
UpdateAllWindows();
}
void ShowAnglesExport( const BoolImportCallback& importer ){
importer( GlobalEntityCreator().getShowAngles() );
}
@ -3324,6 +3336,7 @@ void XYShow_registerCommands(){
GlobalToggles_insert( "ShowAngles", FreeCaller<ShowAnglesToggle>(), ToggleItem::AddCallbackCaller( g_show_angles ) );
GlobalToggles_insert( "ShowNames", FreeCaller<ShowNamesToggle>(), ToggleItem::AddCallbackCaller( g_show_names ) );
GlobalToggles_insert( "ShowBboxes", FreeCaller<ShowBboxesToggle>(), ToggleItem::AddCallbackCaller( g_show_bboxes ) );
GlobalToggles_insert( "ShowConnections", FreeCaller<ShowConnectionsToggle>(), ToggleItem::AddCallbackCaller( g_show_connections ) );
GlobalToggles_insert( "ShowBlocks", FreeCaller<ShowBlocksToggle>(), ToggleItem::AddCallbackCaller( g_show_blocks ) );
GlobalToggles_insert( "ShowCoordinates", FreeCaller<ShowCoordinatesToggle>(), ToggleItem::AddCallbackCaller( g_show_coordinates ) );
GlobalToggles_insert( "ShowWindowOutline", FreeCaller<ShowOutlineToggle>(), ToggleItem::AddCallbackCaller( g_show_outline ) );