* Entity Inspector->smartedit: enable array, target, targetname, skin attribute types
* Entity Inspector->smartedit: enable texture attribute type, add full shader path autocompletion * fix lags, caused by texture entries autocompletion
This commit is contained in:
parent
286f784ecf
commit
565f7fc6db
|
|
@ -52,11 +52,12 @@
|
||||||
/// array an array of strings - value is a semi-colon-delimited string
|
/// array an array of strings - value is a semi-colon-delimited string
|
||||||
/// integer an integer value
|
/// integer an integer value
|
||||||
/// boolean an integer - shows as a checkbox - true = non-zero
|
/// boolean an integer - shows as a checkbox - true = non-zero
|
||||||
/// integer2 two integer values
|
/// integer2 two integer values //not supported
|
||||||
/// integer3 three integer values
|
/// integer3 three integer values //not supported
|
||||||
/// real3 three floating-point values
|
/// real floating-point value
|
||||||
/// angle specialisation of real - Yaw angle
|
/// angle specialisation of real - Yaw angle
|
||||||
/// direction specialisation of real - Yaw angle, -1 = down, -2 = up
|
/// direction specialisation of real - Yaw angle, -1 = down, -2 = up
|
||||||
|
/// real3 three floating-point values
|
||||||
/// angles specialisation of real3 - Pitch Yaw Roll
|
/// angles specialisation of real3 - Pitch Yaw Roll
|
||||||
/// color specialisation of real3 - RGB floating-point colour
|
/// color specialisation of real3 - RGB floating-point colour
|
||||||
/// target a string that uniquely identifies an entity or group of entities
|
/// target a string that uniquely identifies an entity or group of entities
|
||||||
|
|
@ -233,16 +234,16 @@ std::size_t write( const char* data, std::size_t length ){
|
||||||
};
|
};
|
||||||
|
|
||||||
bool attributeSupported( const char* name ){
|
bool attributeSupported( const char* name ){
|
||||||
return string_equal( name, "real" )
|
return string_equal( name, "string" )
|
||||||
|
|| string_equal( name, "array" )
|
||||||
|| string_equal( name, "integer" )
|
|| string_equal( name, "integer" )
|
||||||
|| string_equal( name, "boolean" )
|
|| string_equal( name, "boolean" )
|
||||||
|| string_equal( name, "string" )
|
|| string_equal( name, "integer2" )
|
||||||
|| string_equal( name, "array" )
|
|
||||||
|| string_equal( name, "flag" )
|
|
||||||
|| string_equal( name, "real3" )
|
|
||||||
|| string_equal( name, "integer3" )
|
|| string_equal( name, "integer3" )
|
||||||
|| string_equal( name, "direction" )
|
|| string_equal( name, "real" )
|
||||||
|| string_equal( name, "angle" )
|
|| string_equal( name, "angle" )
|
||||||
|
|| string_equal( name, "direction" )
|
||||||
|
|| string_equal( name, "real3" )
|
||||||
|| string_equal( name, "angles" )
|
|| string_equal( name, "angles" )
|
||||||
|| string_equal( name, "color" )
|
|| string_equal( name, "color" )
|
||||||
|| string_equal( name, "target" )
|
|| string_equal( name, "target" )
|
||||||
|
|
@ -251,7 +252,7 @@ bool attributeSupported( const char* name ){
|
||||||
|| string_equal( name, "texture" )
|
|| string_equal( name, "texture" )
|
||||||
|| string_equal( name, "model" )
|
|| string_equal( name, "model" )
|
||||||
|| string_equal( name, "skin" )
|
|| string_equal( name, "skin" )
|
||||||
|| string_equal( name, "integer2" );
|
|| string_equal( name, "flag" );
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef std::map<CopiedString, ListAttributeType> ListAttributeTypes;
|
typedef std::map<CopiedString, ListAttributeType> ListAttributeTypes;
|
||||||
|
|
|
||||||
|
|
@ -224,6 +224,17 @@ ShaderAttribute( const char* key ) : StringAttribute( key ){
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class TextureAttribute : public StringAttribute
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
TextureAttribute( const char* key ) : StringAttribute( key ){
|
||||||
|
if( string_empty( GlobalRadiant().getGameDescriptionKeyValue( "show_wads" ) ) )
|
||||||
|
GlobalAllShadersEntryCompletion::instance().connect( StringAttribute::getEntry() ); // with textures/
|
||||||
|
else
|
||||||
|
GlobalTextureEntryCompletion::instance().connect( StringAttribute::getEntry() ); // w/o
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
class ColorAttribute : public EntityAttribute
|
class ColorAttribute : public EntityAttribute
|
||||||
{
|
{
|
||||||
|
|
@ -1079,18 +1090,23 @@ Creators m_creators;
|
||||||
public:
|
public:
|
||||||
EntityAttributeFactory(){
|
EntityAttributeFactory(){
|
||||||
m_creators.insert( Creators::value_type( "string", &StatelessAttributeCreator<StringAttribute>::create ) );
|
m_creators.insert( Creators::value_type( "string", &StatelessAttributeCreator<StringAttribute>::create ) );
|
||||||
m_creators.insert( Creators::value_type( "color", &StatelessAttributeCreator<ColorAttribute>::create ) );
|
m_creators.insert( Creators::value_type( "array", &StatelessAttributeCreator<StringAttribute>::create ) );
|
||||||
m_creators.insert( Creators::value_type( "integer", &StatelessAttributeCreator<StringAttribute>::create ) );
|
m_creators.insert( Creators::value_type( "integer", &StatelessAttributeCreator<StringAttribute>::create ) );
|
||||||
m_creators.insert( Creators::value_type( "real", &StatelessAttributeCreator<StringAttribute>::create ) );
|
|
||||||
m_creators.insert( Creators::value_type( "shader", &StatelessAttributeCreator<ShaderAttribute>::create ) );
|
|
||||||
m_creators.insert( Creators::value_type( "boolean", &StatelessAttributeCreator<BooleanAttribute>::create ) );
|
m_creators.insert( Creators::value_type( "boolean", &StatelessAttributeCreator<BooleanAttribute>::create ) );
|
||||||
|
m_creators.insert( Creators::value_type( "real", &StatelessAttributeCreator<StringAttribute>::create ) );
|
||||||
m_creators.insert( Creators::value_type( "angle", &StatelessAttributeCreator<AngleAttribute>::create ) );
|
m_creators.insert( Creators::value_type( "angle", &StatelessAttributeCreator<AngleAttribute>::create ) );
|
||||||
m_creators.insert( Creators::value_type( "direction", &StatelessAttributeCreator<DirectionAttribute>::create ) );
|
m_creators.insert( Creators::value_type( "direction", &StatelessAttributeCreator<DirectionAttribute>::create ) );
|
||||||
m_creators.insert( Creators::value_type( "angles", &StatelessAttributeCreator<AnglesAttribute>::create ) );
|
|
||||||
m_creators.insert( Creators::value_type( "model", &StatelessAttributeCreator<ModelAttribute>::create ) );
|
|
||||||
m_creators.insert( Creators::value_type( "sound", &StatelessAttributeCreator<SoundAttribute>::create ) );
|
|
||||||
m_creators.insert( Creators::value_type( "vector3", &StatelessAttributeCreator<Vector3Attribute>::create ) );
|
m_creators.insert( Creators::value_type( "vector3", &StatelessAttributeCreator<Vector3Attribute>::create ) );
|
||||||
m_creators.insert( Creators::value_type( "real3", &StatelessAttributeCreator<Vector3Attribute>::create ) );
|
m_creators.insert( Creators::value_type( "real3", &StatelessAttributeCreator<Vector3Attribute>::create ) );
|
||||||
|
m_creators.insert( Creators::value_type( "angles", &StatelessAttributeCreator<AnglesAttribute>::create ) );
|
||||||
|
m_creators.insert( Creators::value_type( "color", &StatelessAttributeCreator<ColorAttribute>::create ) );
|
||||||
|
m_creators.insert( Creators::value_type( "target", &StatelessAttributeCreator<StringAttribute>::create ) );
|
||||||
|
m_creators.insert( Creators::value_type( "targetname", &StatelessAttributeCreator<StringAttribute>::create ) );
|
||||||
|
m_creators.insert( Creators::value_type( "sound", &StatelessAttributeCreator<SoundAttribute>::create ) );
|
||||||
|
m_creators.insert( Creators::value_type( "shader", &StatelessAttributeCreator<ShaderAttribute>::create ) );
|
||||||
|
m_creators.insert( Creators::value_type( "texture", &StatelessAttributeCreator<TextureAttribute>::create ) );
|
||||||
|
m_creators.insert( Creators::value_type( "model", &StatelessAttributeCreator<ModelAttribute>::create ) );
|
||||||
|
m_creators.insert( Creators::value_type( "skin", &StatelessAttributeCreator<StringAttribute>::create ) );
|
||||||
}
|
}
|
||||||
EntityAttribute* create( const char* type, const char* name ){
|
EntityAttribute* create( const char* type, const char* name ){
|
||||||
Creators::iterator i = m_creators.find( type );
|
Creators::iterator i = m_creators.find( type );
|
||||||
|
|
|
||||||
|
|
@ -37,9 +37,14 @@ template<typename StringList>
|
||||||
class EntryCompletion
|
class EntryCompletion
|
||||||
{
|
{
|
||||||
GtkListStore* m_store;
|
GtkListStore* m_store;
|
||||||
IdleDraw m_idleUpdate;
|
bool m_invalid;
|
||||||
public:
|
public:
|
||||||
EntryCompletion() : m_store( 0 ), m_idleUpdate( UpdateCaller( *this ) ){
|
EntryCompletion() : m_store( 0 ), m_invalid( true ){
|
||||||
|
}
|
||||||
|
|
||||||
|
static gboolean focus_in( GtkEntry* entry, GdkEventFocus *event, EntryCompletion* self ){
|
||||||
|
self->update();
|
||||||
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void connect( GtkEntry* entry ){
|
void connect( GtkEntry* entry ){
|
||||||
|
|
@ -48,13 +53,14 @@ void connect( GtkEntry* entry ){
|
||||||
|
|
||||||
fill();
|
fill();
|
||||||
|
|
||||||
StringList().connect( IdleDraw::QueueDrawCaller( m_idleUpdate ) );
|
StringList().connect( InvalidateCaller( *this ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
GtkEntryCompletion* completion = gtk_entry_completion_new();
|
GtkEntryCompletion* completion = gtk_entry_completion_new();
|
||||||
gtk_entry_set_completion( entry, completion );
|
gtk_entry_set_completion( entry, completion );
|
||||||
gtk_entry_completion_set_model( completion, GTK_TREE_MODEL( m_store ) );
|
gtk_entry_completion_set_model( completion, GTK_TREE_MODEL( m_store ) );
|
||||||
gtk_entry_completion_set_text_column( completion, 0 );
|
gtk_entry_completion_set_text_column( completion, 0 );
|
||||||
|
g_signal_connect( G_OBJECT( entry ), "focus_in_event", G_CALLBACK( focus_in ), this );
|
||||||
}
|
}
|
||||||
|
|
||||||
void append( const char* string ){
|
void append( const char* string ){
|
||||||
|
|
@ -66,6 +72,7 @@ typedef MemberCaller1<EntryCompletion, const char*, &EntryCompletion::append> Ap
|
||||||
|
|
||||||
void fill(){
|
void fill(){
|
||||||
StringList().forEach( AppendCaller( *this ) );
|
StringList().forEach( AppendCaller( *this ) );
|
||||||
|
m_invalid = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void clear(){
|
void clear(){
|
||||||
|
|
@ -73,19 +80,26 @@ void clear(){
|
||||||
}
|
}
|
||||||
|
|
||||||
void update(){
|
void update(){
|
||||||
|
if( m_invalid ){
|
||||||
clear();
|
clear();
|
||||||
fill();
|
fill();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
typedef MemberCaller<EntryCompletion, &EntryCompletion::update> UpdateCaller;
|
|
||||||
|
void invalidate(){
|
||||||
|
m_invalid = true;
|
||||||
|
}
|
||||||
|
typedef MemberCaller<EntryCompletion, &EntryCompletion::invalidate> InvalidateCaller;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/* loaded ( shaders + textures ) */
|
||||||
class TextureNameList
|
class TextureNameList
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
void forEach( const ShaderNameCallback& callback ) const {
|
void forEach( const ShaderNameCallback& callback ) const {
|
||||||
for ( QERApp_ActiveShaders_IteratorBegin(); !QERApp_ActiveShaders_IteratorAtEnd(); QERApp_ActiveShaders_IteratorIncrement() )
|
for ( QERApp_ActiveShaders_IteratorBegin(); !QERApp_ActiveShaders_IteratorAtEnd(); QERApp_ActiveShaders_IteratorIncrement() )
|
||||||
{
|
{
|
||||||
IShader *shader = QERApp_ActiveShaders_IteratorCurrent();
|
const IShader *shader = QERApp_ActiveShaders_IteratorCurrent();
|
||||||
|
|
||||||
if ( shader_equal_prefix( shader->getName(), "textures/" ) ) {
|
if ( shader_equal_prefix( shader->getName(), "textures/" ) ) {
|
||||||
callback( shader->getName() + 9 );
|
callback( shader->getName() + 9 );
|
||||||
|
|
@ -99,7 +113,21 @@ void connect( const SignalHandler& update ) const {
|
||||||
|
|
||||||
typedef Static< EntryCompletion<TextureNameList> > GlobalTextureEntryCompletion;
|
typedef Static< EntryCompletion<TextureNameList> > GlobalTextureEntryCompletion;
|
||||||
|
|
||||||
|
/* shaders + loaded textures */
|
||||||
|
class AllShadersNameList
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
void forEach( const ShaderNameCallback& callback ) const {
|
||||||
|
GlobalShaderSystem().foreachShaderName( callback );
|
||||||
|
}
|
||||||
|
void connect( const SignalHandler& update ) const {
|
||||||
|
TextureBrowser_addActiveShadersChangedCallback( update );
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef Static< EntryCompletion<AllShadersNameList> > GlobalAllShadersEntryCompletion;
|
||||||
|
|
||||||
|
/* shaders + may also include plain textures, loaded before first use */
|
||||||
class ShaderList
|
class ShaderList
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user