2 * Copyright (c) 2015 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
19 #include <dali/internal/event/common/property-buffer-impl.h> // Dali::Internal::PropertyBuffer
22 #include <dali/public-api/object/property-buffer.h> // Dali::Internal::PropertyBuffer
23 #include <dali/internal/event/common/object-impl-helper.h> // Dali::Internal::ObjectHelper
24 #include <dali/internal/event/common/property-helper.h> // DALI_PROPERTY_TABLE_BEGIN, DALI_PROPERTY, DALI_PROPERTY_TABLE_END
25 #include <dali/internal/update/common/scene-graph-property-buffer.h>
26 #include <dali/internal/update/manager/update-manager.h>
27 // @todo MESH_REWORK remove this comment - Don't include "stage.h" - use GetEventThreadServices() instead.
38 * |name |type |writable|animatable|constraint-input|enum for index-checking|
40 DALI_PROPERTY_TABLE_BEGIN
41 DALI_PROPERTY( "size", UNSIGNED_INTEGER, true, false, true, Dali::PropertyBuffer::Property::SIZE )
42 DALI_PROPERTY( "buffer-format", MAP, false, false, false, Dali::PropertyBuffer::Property::BUFFER_FORMAT )
43 DALI_PROPERTY_TABLE_END( DEFAULT_ACTOR_PROPERTY_START_INDEX )
45 const ObjectImplHelper<DEFAULT_PROPERTY_COUNT> PROPERTY_BUFFER_IMPL = { DEFAULT_PROPERTY_DETAILS };
47 } // unnamed namespace
49 PropertyBufferPtr PropertyBuffer::New()
51 return PropertyBufferPtr( new PropertyBuffer() );
54 void PropertyBuffer::SetSize( std::size_t size )
57 DALI_ASSERT_ALWAYS( false && "MESH_REWORK" );
60 std::size_t PropertyBuffer::GetSize() const
63 DALI_ASSERT_ALWAYS( false && "MESH_REWORK" );
68 void PropertyBuffer::SetData( void* data )
71 DALI_ASSERT_ALWAYS( false && "MESH_REWORK" );
74 Dali::Property::Index PropertyBuffer::GetPropertyIndex( const std::string name, std::size_t index )
77 DALI_ASSERT_ALWAYS( false && "MESH_REWORK" );
81 const SceneGraph::PropertyBuffer* PropertyBuffer::GetPropertyBufferSceneObject() const
86 unsigned int PropertyBuffer::GetDefaultPropertyCount() const
88 return PROPERTY_BUFFER_IMPL.GetDefaultPropertyCount();
91 void PropertyBuffer::GetDefaultPropertyIndices( Property::IndexContainer& indices ) const
93 PROPERTY_BUFFER_IMPL.GetDefaultPropertyIndices( indices );
96 const char* PropertyBuffer::GetDefaultPropertyName(Property::Index index) const
98 return PROPERTY_BUFFER_IMPL.GetDefaultPropertyName( index );
101 Property::Index PropertyBuffer::GetDefaultPropertyIndex( const std::string& name ) const
103 return PROPERTY_BUFFER_IMPL.GetDefaultPropertyIndex( name );
106 bool PropertyBuffer::IsDefaultPropertyWritable( Property::Index index ) const
108 return PROPERTY_BUFFER_IMPL.IsDefaultPropertyWritable( index );
111 bool PropertyBuffer::IsDefaultPropertyAnimatable( Property::Index index ) const
113 return PROPERTY_BUFFER_IMPL.IsDefaultPropertyAnimatable( index );
116 bool PropertyBuffer::IsDefaultPropertyAConstraintInput( Property::Index index ) const
118 return PROPERTY_BUFFER_IMPL.IsDefaultPropertyAConstraintInput( index );
121 Property::Type PropertyBuffer::GetDefaultPropertyType( Property::Index index ) const
123 return PROPERTY_BUFFER_IMPL.GetDefaultPropertyType( index );
126 void PropertyBuffer::SetDefaultProperty( Property::Index index,
127 const Property::Value& propertyValue )
131 case Dali::PropertyBuffer::Property::SIZE:
133 SetSize( propertyValue.Get<int>() );
136 case Dali::PropertyBuffer::Property::BUFFER_FORMAT:
138 DALI_ASSERT_ALWAYS( 0 && "MESH_REWORK" );
144 void PropertyBuffer::SetSceneGraphProperty( Property::Index index,
145 const PropertyMetadata& entry,
146 const Property::Value& value )
148 PROPERTY_BUFFER_IMPL.SetSceneGraphProperty( GetEventThreadServices(), this, index, entry, value );
151 Property::Value PropertyBuffer::GetDefaultProperty( Property::Index index ) const
153 Property::Value value;
157 case Dali::PropertyBuffer::Property::SIZE:
159 value = static_cast<int>( GetSize() ); // @todo MESH_REWORK Add a size_t type to PropertyValue
162 case Dali::PropertyBuffer::Property::BUFFER_FORMAT:
164 DALI_ASSERT_ALWAYS( 0 && "MESH_REWORK" );
171 const SceneGraph::PropertyOwner* PropertyBuffer::GetPropertyOwner() const
176 const SceneGraph::PropertyOwner* PropertyBuffer::GetSceneObject() const
181 const SceneGraph::PropertyBase* PropertyBuffer::GetSceneObjectAnimatableProperty( Property::Index index ) const
183 DALI_ASSERT_ALWAYS( IsPropertyAnimatable(index) && "Property is not animatable" );
184 const SceneGraph::PropertyBase* property = NULL;
188 property = PROPERTY_BUFFER_IMPL.GetRegisteredSceneGraphProperty(
190 &PropertyBuffer::FindAnimatableProperty,
191 &PropertyBuffer::FindCustomProperty,
194 if( property == NULL && index < DEFAULT_PROPERTY_MAX_COUNT )
196 DALI_ASSERT_ALWAYS( 0 && "Property is not animatable" );
203 const PropertyInputImpl* PropertyBuffer::GetSceneObjectInputProperty( Property::Index index ) const
205 const PropertyInputImpl* property = NULL;
209 const SceneGraph::PropertyBase* baseProperty =
210 PROPERTY_BUFFER_IMPL.GetRegisteredSceneGraphProperty( this,
211 &PropertyBuffer::FindAnimatableProperty,
212 &PropertyBuffer::FindCustomProperty,
214 property = static_cast<const PropertyInputImpl*>( baseProperty );
216 if( property == NULL && index < DEFAULT_PROPERTY_MAX_COUNT )
218 if( index == Dali::PropertyBuffer::Property::SIZE )
221 DALI_ASSERT_ALWAYS( 0 && "MESH_REWORK" );
229 int PropertyBuffer::GetPropertyComponentIndex( Property::Index index ) const
231 return PROPERTY_BUFFER_IMPL.GetPropertyComponentIndex( index );
234 bool PropertyBuffer::OnStage() const
239 void PropertyBuffer::Connect()
244 void PropertyBuffer::Disconnect()
249 PropertyBuffer::PropertyBuffer()
250 : mSceneObject(NULL),
255 } // namespace Internal