namespace Internal
{
-bool CameraActor::mFirstInstance = true;
-Actor::DefaultPropertyLookup* CameraActor::mDefaultCameraActorPropertyLookup = NULL;
namespace
{
TypeRegistration mType( typeid(Dali::CameraActor), typeid(Dali::Actor), Create );
-const std::string DEFAULT_CAMERA_ACTOR_PROPERTY_NAMES[] =
+const char* DEFAULT_CAMERA_ACTOR_PROPERTY_NAMES[] =
{
"type",
"projection-mode",
"view-matrix",
"invert-y-axis"
};
-const int DEFAULT_CAMERA_ACTOR_PROPERTY_COUNT = sizeof( DEFAULT_CAMERA_ACTOR_PROPERTY_NAMES ) / sizeof( std::string );
+const int DEFAULT_CAMERA_ACTOR_PROPERTY_COUNT = sizeof( DEFAULT_CAMERA_ACTOR_PROPERTY_NAMES ) / sizeof( DEFAULT_CAMERA_ACTOR_PROPERTY_NAMES[0] );
const Property::Type DEFAULT_CAMERA_ACTOR_PROPERTY_TYPES[DEFAULT_CAMERA_ACTOR_PROPERTY_COUNT] =
{
void CameraActor::OnInitialize()
{
- if(CameraActor::mFirstInstance)
- {
- mDefaultCameraActorPropertyLookup = new DefaultPropertyLookup();
- const int start = DEFAULT_ACTOR_PROPERTY_MAX_COUNT;
- for ( int i = 0; i < DEFAULT_CAMERA_ACTOR_PROPERTY_COUNT; ++i )
- {
- (*mDefaultCameraActorPropertyLookup)[DEFAULT_CAMERA_ACTOR_PROPERTY_NAMES[i]] = i + start;
- }
- CameraActor::mFirstInstance = false;
- }
}
CameraActor::CameraActor()
}
}
-const std::string& CameraActor::GetDefaultPropertyName( Property::Index index ) const
+const char* CameraActor::GetDefaultPropertyName( Property::Index index ) const
{
if(index < DEFAULT_ACTOR_PROPERTY_MAX_COUNT)
{
{
return DEFAULT_CAMERA_ACTOR_PROPERTY_NAMES[index];
}
- else
- {
- // index out-of-bounds
- static const std::string INVALID_PROPERTY_NAME;
- return INVALID_PROPERTY_NAME;
- }
+ return NULL;
}
}
{
Property::Index index = Property::INVALID_INDEX;
- DALI_ASSERT_DEBUG( NULL != mDefaultCameraActorPropertyLookup );
-
// Look for name in current class' default properties
- DefaultPropertyLookup::const_iterator result = mDefaultCameraActorPropertyLookup->find( name );
- if ( mDefaultCameraActorPropertyLookup->end() != result )
+ for( int i = 0; i < DEFAULT_CAMERA_ACTOR_PROPERTY_COUNT; ++i )
{
- index = result->second;
+ if( 0 == strcmp( name.c_str(), DEFAULT_CAMERA_ACTOR_PROPERTY_NAMES[ i ] ) ) // dont want to convert rhs to string
+ {
+ index = i + DEFAULT_ACTOR_PROPERTY_MAX_COUNT;
+ break;
+ }
}
- else
+
+ // If not found, check in base class
+ if( Property::INVALID_INDEX == index )
{
- // If not found, check in base class
index = Actor::GetDefaultPropertyIndex( name );
}