Skip to content

Commit

Permalink
Merge branch 'master' of github.com:nocturnal/Helium
Browse files Browse the repository at this point in the history
  • Loading branch information
andyburke committed Sep 23, 2010
2 parents d40160e + dbd80d4 commit c02a0ae
Show file tree
Hide file tree
Showing 47 changed files with 805 additions and 800 deletions.
7 changes: 3 additions & 4 deletions Core/Asset/AssetClass.cpp
Expand Up @@ -25,10 +25,9 @@ std::map< tstring, AssetFactory* > AssetClass::s_AssetFactories;
REFLECT_DEFINE_ABSTRACT( AssetClass );
void AssetClass::EnumerateClass( Reflect::Compositor<AssetClass>& comp )
{
comp.AddField( &AssetClass::m_Description, "m_Description" );
comp.AddField( &AssetClass::m_Tags, "m_Tags" );

comp.AddField( &AssetClass::m_Path, "m_Path", Reflect::FieldFlags::Hide );
comp.AddField( &AssetClass::m_Description, "m_Description" );
comp.AddField( &AssetClass::m_Tags, "m_Tags" );
comp.AddField( &AssetClass::m_Path, "m_Path", Reflect::FieldFlags::Hide );
}

AssetClass::AssetClass()
Expand Down
4 changes: 3 additions & 1 deletion Core/MRUData.h
Expand Up @@ -7,9 +7,11 @@

namespace Helium
{
class CORE_API MRUData : public Reflect::ConcreteInheritor< MRUData, Reflect::Element >
class CORE_API MRUData : public Reflect::Element
{
public:
REFLECT_DECLARE_CLASS( MRUData, Reflect::Element );

const std::vector< Helium::Path >& GetPaths() const;
void SetPaths( const std::vector< Helium::Path >& paths );

Expand Down
4 changes: 3 additions & 1 deletion Core/Project.h
Expand Up @@ -6,9 +6,11 @@

namespace Helium
{
class CORE_API Project : public Reflect::ConcreteInheritor< Project, Reflect::Element >
class CORE_API Project : public Reflect::Element
{
public:
REFLECT_DECLARE_CLASS( Project, Reflect::Element );

Project( const Path& path = TXT( "" ) );
virtual ~Project();

Expand Down
6 changes: 4 additions & 2 deletions Core/SceneGraph/CameraSettings.h
Expand Up @@ -51,9 +51,11 @@ namespace Helium

typedef ShadingModes::ShadingMode ShadingMode;

class CORE_API CameraSettings : public Reflect::ConcreteInheritor< CameraSettings, Reflect::Element >
class CORE_API CameraSettings : public Reflect::Element
{
public:
public:
REFLECT_DECLARE_CLASS( CameraSettings, Reflect::Element );

CameraSettings();

public:
Expand Down
4 changes: 3 additions & 1 deletion Core/SceneGraph/GridSettings.h
Expand Up @@ -25,9 +25,11 @@ namespace Helium
}
typedef GridUnits::GridUnit GridUnit;

class CORE_API GridSettings : public Reflect::ConcreteInheritor< GridSettings, Reflect::Element >
class CORE_API GridSettings : public Reflect::Element
{
public:
REFLECT_DECLARE_CLASS( GridSettings, Reflect::Element );

GridSettings( const tstring& version = TXT( "" ),
GridUnit units = GridUnits::Meters,
u32 width = 12,
Expand Down
2 changes: 1 addition & 1 deletion Core/SceneGraph/PropertiesManager.cpp
Expand Up @@ -143,7 +143,7 @@ void PropertiesManager::GenerateProperties( PropertiesThreadArgs& args )
M_PanelCreators currentPanels;

#ifdef SCENE_DEBUG_PROPERTIES_GENERATOR
Log::Print("Object type %s:\n", typeid(*(*itr)).name());
Log::Print("Object type %s:\n", (*itr)->GetClass()->m_ShortName.c_str() );
#endif

{
Expand Down
137 changes: 66 additions & 71 deletions Core/SceneGraph/Resource.cpp
Expand Up @@ -19,15 +19,15 @@ using namespace Helium::SceneGraph;
ResourceTracker::ResourceTracker(IDirect3DDevice9* device)
: m_Device (device)
{
if (!IndexResource::s_MemoryPool.Valid())
{
IndexResource::s_MemoryPool = Profile::Memory::CreatePool( TXT( "Direct3D Index Data" ) );
}

if (!VertexResource::s_MemoryPool.Valid())
{
VertexResource::s_MemoryPool = Profile::Memory::CreatePool( TXT( "Direct3D Vertex Data" ) );
}
if (!IndexResource::s_MemoryPool.Valid())
{
IndexResource::s_MemoryPool = Profile::Memory::CreatePool( TXT( "Direct3D Index Data" ) );
}

if (!VertexResource::s_MemoryPool.Valid())
{
VertexResource::s_MemoryPool = Profile::Memory::CreatePool( TXT( "Direct3D Vertex Data" ) );
}
}

ResourceTracker::~ResourceTracker()
Expand All @@ -37,115 +37,110 @@ ResourceTracker::~ResourceTracker()

void ResourceTracker::ResetState()
{
m_Indices = NULL;
m_Vertices = NULL;
m_VertexFormat = ElementFormats[ ElementTypes::Unknown ];
m_Indices = NULL;
m_Vertices = NULL;
m_VertexFormat = ElementFormats[ ElementTypes::Unknown ];
}

void ResourceTracker::Register(Resource* resource)
{
Insert<S_Resource>::Result inserted = m_Resources.insert( resource );
HELIUM_ASSERT(inserted.second);
Insert<S_Resource>::Result inserted = m_Resources.insert( resource );
HELIUM_ASSERT(inserted.second);
}

void ResourceTracker::Release(Resource* resource)
{
m_Resources.erase( resource );
m_Resources.erase( resource );
}

void ResourceTracker::DeviceLost()
{
S_Resource::const_iterator itr = m_Resources.begin();
S_Resource::const_iterator end = m_Resources.end();
for ( ; itr != end ; ++itr )
{
if ( !(*itr)->IsManaged() )
S_Resource::const_iterator itr = m_Resources.begin();
S_Resource::const_iterator end = m_Resources.end();
for ( ; itr != end ; ++itr )
{
(*itr)->Delete();
if ( !(*itr)->IsManaged() )
{
(*itr)->Delete();
}
}
}
}

void ResourceTracker::DeviceReset()
{
S_Resource::const_iterator itr = m_Resources.begin();
S_Resource::const_iterator end = m_Resources.end();
for ( ; itr != end ; ++itr )
{
if ( !(*itr)->IsManaged() )
S_Resource::const_iterator itr = m_Resources.begin();
S_Resource::const_iterator end = m_Resources.end();
for ( ; itr != end ; ++itr )
{
(*itr)->Create();
if ( !(*itr)->IsManaged() )
{
(*itr)->Create();
}
}
}
}

void Resource::Create()
{
if ( !m_IsCreated )
{
m_IsCreated = true;

if (Allocate())
if ( !m_IsCreated )
{
Populate();
m_IsCreated = true;

if (Allocate())
{
Populate();
}
}
}
}

void Resource::Delete()
{
if ( m_IsCreated )
{
m_IsCreated = false;
if ( m_IsCreated )
{
m_IsCreated = false;

Release();
}
Release();
}
}

void Resource::Update()
{
if (m_IsCreated)
{
if (m_IsDirty || IsManaged())
if (m_IsCreated)
{
if (!m_IsDirty && IsManaged())
{
Log::Debug( TXT( "Re-creating non-default resource '%s'...\n" ), typeid(*this).name() );
}

Delete();
Create();
if (m_IsDirty || IsManaged())
{
Delete();
Create();
}
else
{
Populate();
}
}
else
{
Populate();
Create();
}
}
else
{
Create();
}
}

void Resource::Populate()
{
if (m_Populator.Valid())
{
PopulateArgs args ( m_Type, m_BaseIndex = 0, Lock() );

if (args.m_Buffer)
if (m_Populator.Valid())
{
u32 offset = args.m_Offset;
PopulateArgs args ( m_Type, m_BaseIndex = 0, Lock() );

m_Populator.Invoke( &args );
if (args.m_Buffer)
{
u32 offset = args.m_Offset;

HELIUM_ASSERT( args.m_Offset == ( offset + ElementSizes[ m_ElementType ] * m_ElementCount ) );
m_Populator.Invoke( &args );

Unlock();
}
else
{
HELIUM_BREAK(); // this is BAD
HELIUM_ASSERT( args.m_Offset == ( offset + ElementSizes[ m_ElementType ] * m_ElementCount ) );

Unlock();
}
else
{
HELIUM_BREAK(); // this is BAD
}
}
}
}
1 change: 1 addition & 0 deletions Core/SceneGraph/Scene.cpp
Expand Up @@ -468,6 +468,7 @@ Undo::CommandPtr Scene::ImportSceneNodes( Reflect::V_Element& elements, ImportAc
V_SceneNodeSmartPtr::const_iterator end = createdNodes.end();
for ( ; itr != end; ++itr )
{
(*itr)->SetOwner( this );
(*itr)->Initialize();

if ( importFlags & ImportFlags::Select )
Expand Down
4 changes: 3 additions & 1 deletion Core/SceneGraph/SceneSettings.h
Expand Up @@ -9,9 +9,11 @@ namespace Helium
{
namespace SceneGraph
{
class CORE_API SceneSettings : public Reflect::ConcreteInheritor< SceneSettings, Reflect::Element >
class CORE_API SceneSettings : public Reflect::Element
{
public:
REFLECT_DECLARE_CLASS( SceneSettings, Reflect::Element );

SceneSettings();

MRUData* GetMRU();
Expand Down
4 changes: 3 additions & 1 deletion Core/SceneGraph/ViewportSettings.h
Expand Up @@ -49,9 +49,11 @@ namespace Helium
}
typedef ViewColorModes::ViewColorMode ViewColorMode;

class CORE_API ViewportSettings : public Reflect::ConcreteInheritor< ViewportSettings, Reflect::Element >
class CORE_API ViewportSettings : public Reflect::Element
{
public:
REFLECT_DECLARE_CLASS( ViewportSettings, Reflect::Element );

ViewportSettings();

ViewColorMode GetColorMode() const;
Expand Down
4 changes: 3 additions & 1 deletion Core/SettingsManager.h
Expand Up @@ -13,9 +13,11 @@ namespace Helium

typedef std::map< Reflect::TypeID, Reflect::ElementPtr > M_Settings;

class CORE_API SettingsManager : public Reflect::ConcreteInheritor< SettingsManager, Reflect::Element >
class CORE_API SettingsManager : public Reflect::Element
{
public:
REFLECT_DECLARE_CLASS( SettingsManager, Reflect::Element );

SettingsManager()
{
}
Expand Down
20 changes: 2 additions & 18 deletions Editor/Commands/BuildCommand.cpp
Expand Up @@ -228,30 +228,14 @@ void BuildCommand::Except( const Helium::Exception& ex, const Asset::AssetClassP
// for this option if it becomes useful.
Debug::ProcessException( ex );
tstring type;
try
{
type = typeid(ex).name();
size_t pos = type.find_first_of(" ");
if (pos != tstring::npos && pos < type.length()-1)
{
type = type.substr( pos+1 );
}
}
catch ( const std::exception& ) // we catch std::exception here to handle call to typeid failing above
{
type = "Exception";
}
tostringstream message;
if (assetClass.ReferencesObject())
{
message << type << " while building '" << assetClass->GetFullName() << "': " << ex.What() << std::endl;
message << "Exception while building '" << assetClass->GetFullName() << "': " << ex.What() << std::endl;
}
else
{
message << type << ": " << ex.What() << std::endl;
message << "Exception: " << ex.What() << std::endl;
}
Log::Error( "%s", message.str().c_str() );
Expand Down
4 changes: 3 additions & 1 deletion Editor/Inspect/Canvas.h
Expand Up @@ -17,9 +17,11 @@ namespace Helium
typedef Helium::SmartPtr< Widget > (*WidgetCreator)( Inspect::Control* control );
typedef std::map< i32, WidgetCreator > WidgetCreators;

class Canvas : public Reflect::AbstractInheritor< Canvas, Inspect::Canvas >, public wxEvtHandler
class Canvas : public Inspect::Canvas, public wxEvtHandler
{
public:
REFLECT_DECLARE_ABSTRACT( Canvas, Inspect::Canvas );

Canvas();
~Canvas();

Expand Down
4 changes: 3 additions & 1 deletion Editor/Inspect/StripCanvas.h
Expand Up @@ -8,9 +8,11 @@ namespace Helium
{
namespace Editor
{
class StripCanvas : public Reflect::ConcreteInheritor< StripCanvas, Canvas >
class StripCanvas : public Canvas
{
public:
REFLECT_DECLARE_CLASS( StripCanvas, Canvas );

// this is where tree-specific wx code happens
StripCanvas();

Expand Down
4 changes: 3 additions & 1 deletion Editor/Inspect/StripCanvasWidget.h
Expand Up @@ -11,9 +11,11 @@ namespace Helium
{
class StripCanvasWidget;

class StripCanvasWidget : public Reflect::ConcreteInheritor<StripCanvasWidget, Widget>
class StripCanvasWidget : public Widget
{
public:
REFLECT_DECLARE_CLASS( StripCanvasWidget, Widget );

StripCanvasWidget()
: m_ContainerControl( NULL )
, m_ContainerWindow( NULL )
Expand Down

0 comments on commit c02a0ae

Please sign in to comment.