- Timestamp:
- 07/28/16 20:31:39 (9 years ago)
- Location:
- trunk
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/nv/core/random.hh
r509 r511 480 480 } 481 481 482 NV_RTTI_DECLARE( nv::random_dist ) 483 482 484 #endif // NV_CORE_RANDOM_HH -
trunk/nv/core/types.hh
r503 r511 85 85 { 86 86 shash64 name; 87 shash64 desc; 87 88 sint32 value; 88 89 }; … … 124 125 type_creator union_field( const string_view& aname, TFIELD TOBJECT::*field, const string_view& control_name, ENUM_VALUE control_value, typename enable_if< !is_container<TFIELD>::value, void* >::type = nullptr ); 125 126 126 type_creator value( const string_view& aname, sint32 value );127 type_creator value( const string_view& aname, sint32 value, const string_view& desc = string_view() ); 127 128 private: 128 129 type_database* m_database; … … 287 288 } 288 289 289 inline type_creator type_creator::value( const string_view& aname, sint32 value )290 inline type_creator type_creator::value( const string_view& aname, sint32 value, const string_view& desc ) 290 291 { 291 292 NV_ASSERT( m_entry->field_list.empty(), "Type cannot have both enums and fields!" ); 292 293 type_enum e; 293 294 e.name = m_database->m_names.insert( aname ); 295 if ( !desc.empty() ) 296 e.desc = m_database->m_names.insert( desc ); 294 297 e.value = value; 295 298 m_entry->enum_list.push_back( e ); -
trunk/nv/engine/default_resource_manager.hh
r509 r511 55 55 return m_mesh_datas->resolve( h ); 56 56 } 57 lua::state* get_lua() { return m_lua; } 58 const type_database* get_type_db() { return m_lua->get_type_data()->get_type_database(); } 57 59 58 60 void reload_data(); -
trunk/nv/engine/model_manager.hh
r510 r511 95 95 }; 96 96 97 NV_RTTI_DECLARE_NAME( model_node_choice, "random_dist" ) 97 98 NV_RTTI_DECLARE_NAME( model, "model" ) 98 99 -
trunk/nv/lua/lua_state.hh
r509 r511 262 262 void unregister_object( ref object_index ); 263 263 264 template <typename E> 265 void register_enum() 266 { 267 register_enum( m_lua_types->get_type_database()->get_type<E>() ); 268 } 269 void register_enum( const type_entry* type ); 264 270 void register_enum( string_view name, int value ); 265 271 void register_singleton( string_view name, void* o ); -
trunk/src/lua/lua_state.cc
r509 r511 750 750 } 751 751 752 void nv::lua::state::register_enum( const type_entry* type ) 753 { 754 NV_ASSERT_ALWAYS( type, "type not found!" ); 755 NV_ASSERT_ALWAYS( !type->enum_list.empty(), "type not enum!" ); 756 type_database* db = type->type_db; 757 for ( auto e : type->enum_list ) 758 { 759 lua_pushinteger( m_state, e.value ); 760 lua_setglobal( m_state, db->resolve_name( e.name ).data() ); 761 } 762 } 763 752 764 void nv::lua::state::register_rtti_type( thash64 tid, lua_rtti_push_function p, lua_rtti_read_function r ) 753 765 {
Note: See TracChangeset
for help on using the changeset viewer.