Fixed automatic naming of visuals for non-native controls
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / controls / control / control-data-impl.cpp
index 304ba78..ffcfdd7 100644 (file)
@@ -439,21 +439,20 @@ void Control::Impl::RegisterVisual( Property::Index index, Toolkit::Visual::Base
   // ( If the control has been type registered )
   if( visual.GetName().empty() )
   {
-    // Check if the control has been type registered:
-    TypeInfo typeInfo = TypeRegistry::Get().GetTypeInfo( typeid( mControlImpl ) );
-    if( typeInfo )
+    try
     {
-      // Check if the property index has been registered:
-      Property::IndexContainer indices;
-      typeInfo.GetPropertyIndices( indices );
-      Property::IndexContainer::Iterator iter = std::find( indices.Begin(), indices.End(), index );
-      if( iter != indices.End() )
+      std::string visualName = self.GetPropertyName( index );
+      if( !visualName.empty() )
       {
-        // If it has, then get it's name and use that for the visual
-        std::string visualName = typeInfo.GetPropertyName( index );
+        DALI_LOG_INFO( gLogFilter, Debug::Concise, "Setting visual name for property %d to %s\n",
+                       index, visualName.c_str() );
         visual.SetName( visualName );
       }
     }
+    catch( Dali::DaliException e )
+    {
+      DALI_LOG_WARNING( "Attempting to register visual without a registered property, index: %d\n", index );
+    }
   }
 
   if( !visualReplaced ) // New registration entry
@@ -603,11 +602,14 @@ Dali::Animation Control::Impl::CreateTransition( const Toolkit::TransitionData&
 
       if( visual )
       {
+        DALI_LOG_INFO( gLogFilter, Debug::Concise, "CreateTransition: Found visual for %s\n",
+                       visual.GetName().c_str() );
         Internal::Visual::Base& visualImpl = Toolkit::GetImplementation( visual );
         visualImpl.AnimateProperty( transition, *animator );
       }
       else
       {
+        DALI_LOG_INFO( gLogFilter, Debug::Concise, "CreateTransition: Could not find visual. Trying actors");
         // Otherwise, try any actor children of control (Including the control)
         Actor child = mControlImpl.Self().FindChildByName( animator->objectName );
         if( child )