namespace Internal
{
-ImageAttachmentPtr ImageAttachment::New( const SceneGraph::Node& parentNode )
+ImageAttachmentPtr ImageAttachment::New( Stage& stage, const SceneGraph::Node& parentNode )
{
- StagePtr stage = Stage::GetCurrent();
-
- ImageAttachmentPtr attachment( new ImageAttachment( *stage ) );
+ ImageAttachmentPtr attachment( new ImageAttachment( stage ) );
// Transfer object ownership of scene-object to message
SceneGraph::ImageAttachment* sceneObject = CreateSceneObject();
- AttachToNodeMessage( stage->GetUpdateManager(), parentNode, sceneObject );
+ AttachToNodeMessage( stage.GetUpdateManager(), parentNode, sceneObject );
// Keep raw pointer for message passing
attachment->mSceneObject = sceneObject;
/**
* An attachment for rendering images in various ways.
- * The default geometry scaling mode is ScaleToFill.
*/
class ImageAttachment : public RenderableAttachment
{
/**
* Create a new ImageAttachment.
+ * @param[in] stage The stage to use for messaging
* @param[in] parentNode The node to attach a scene-object to.
* @return A smart-pointer to the newly allocated ImageAttachment.
*/
- static ImageAttachmentPtr New( const SceneGraph::Node& parentNode );
+ static ImageAttachmentPtr New( Stage& stage, const SceneGraph::Node& parentNode );
/**
* Sets image rendered by the attachment.
/**
* First stage construction of a ImageAttachment.
* @param[in] stage Used to send messages to scene-graph.
- * @param[in] image A pointer to the image to display or NULL to not render anything.
*/
ImageAttachment(Stage& stage);
namespace Internal
{
-MeshAttachmentPtr MeshAttachment::New( const SceneGraph::Node& parentNode )
+MeshAttachmentPtr MeshAttachment::New( Stage& stage, const SceneGraph::Node& parentNode )
{
- StagePtr stage = Stage::GetCurrent();
-
- MeshAttachmentPtr attachment( new MeshAttachment( *stage ) );
+ MeshAttachmentPtr attachment( new MeshAttachment( stage ) );
// Transfer object ownership of scene-object to message
SceneGraph::MeshAttachment* sceneObject = SceneGraph::MeshAttachment::New();
- AttachToNodeMessage( stage->GetUpdateManager(), parentNode, sceneObject );
+ AttachToNodeMessage( stage.GetUpdateManager(), parentNode, sceneObject );
// Keep raw pointer for message passing
attachment->mSceneObject = sceneObject;
/**
* Create an initialised MeshAttachment.
+ * @param[in] stage The stage to use for messaging
* @param[in] parentNode The node to attach a scene-object to.
* This will not be displayed until a mesh is added with SetMesh().
* @return A handle to a newly allocated Dali resource.
*/
- static MeshAttachmentPtr New( const SceneGraph::Node& parentNode );
+ static MeshAttachmentPtr New( Stage& stage, const SceneGraph::Node& parentNode );
/**
* Set the mesh to be rendererd by this attachment
namespace Internal
{
-TextAttachmentPtr TextAttachment::New( const SceneGraph::Node& parentNode, const Integration::TextArray& text, FontPointer font )
+TextAttachmentPtr TextAttachment::New( Stage& stage, const SceneGraph::Node& parentNode, const Integration::TextArray& text, FontPointer font )
{
- StagePtr stage = Stage::GetCurrent();
-
- TextAttachmentPtr attachment( new TextAttachment( *stage ) );
+ TextAttachmentPtr attachment( new TextAttachment( stage ) );
// Second-phase construction
// Transfer object ownership of scene-object to message
SceneGraph::TextAttachment* sceneObject = SceneGraph::TextAttachment::New();
- AttachToNodeMessage( stage->GetUpdateManager(), parentNode, sceneObject );
+ AttachToNodeMessage( stage.GetUpdateManager(), parentNode, sceneObject );
// Keep raw pointer for message passing
attachment->mSceneObject = sceneObject;
/**
* Create a new TextAttachment.
+ * @param[in] stage The stage to use for messaging
* @param[in] parentNode The node to attach a scene-object to.
* @param [in] text The text which will be displayed.
* @param [in] font The font which will be used for the text.
* @return A smart-pointer to the newly allocated TextAttachment.
*/
- static TextAttachmentPtr New( const SceneGraph::Node& parentNode, const Integration::TextArray& text, FontPointer font );
+ static TextAttachmentPtr New( Stage& stage, const SceneGraph::Node& parentNode, const Integration::TextArray& text, FontPointer font );
/**
* Set the text label displayed by the attachment
actor->Initialize();
// Create the attachment
- actor->mImageAttachment = ImageAttachment::New( *actor->mNode );
+ actor->mImageAttachment = ImageAttachment::New( *actor->mStage, *actor->mNode );
actor->Attach( *actor->mImageAttachment );
return actor;
actor->Initialize();
// Create the attachment
- actor->mMeshAttachment = MeshAttachment::New( *actor->mNode );
+ actor->mMeshAttachment = MeshAttachment::New( *actor->mStage, *actor->mNode );
actor->Attach(*actor->mMeshAttachment);
actor->SetCullFace( Dali::CullBack );
MeshActorPtr MeshActor::New(ModelDataPtr modelData, Dali::Entity entity)
{
- MeshActorPtr actor(new MeshActor());
- // Second-phase construction
- actor->Initialize();
+ MeshActorPtr actor = MeshActor::New();
- // Create the attachment
- actor->mMeshAttachment = MeshAttachment::New( *actor->mNode );
- actor->Attach(*actor->mMeshAttachment);
actor->SetName(entity.GetName());
- actor->SetCullFace( Dali::CullBack );
DALI_ASSERT_ALWAYS(entity.NumberOfMeshes() == 1 && "Dali does not support multiple meshes per node in the model");
actor->Initialize();
//create the attachment
- actor->mTextAttachment = TextAttachment::New( *actor->mNode, Integration::TextArray(), fontPtr );
+ actor->mTextAttachment = TextAttachment::New( *actor->mStage, *actor->mNode, Integration::TextArray(), fontPtr );
actor->Attach(*actor->mTextAttachment);
// Note: SetTextStyle() MUST be called before SetText(), to ensure