ComponentAnimationPlayer2D& ComponentAnimationPlayer2D::operator=(const ComponentAnimationPlayer2D& other)
{
    MyAssert( &other != this );

    ComponentBase::operator=( other );

    // TODO: replace this with a CopyComponentVariablesFromOtherObject... or something similar.
    m_AnimationIndex = other.m_AnimationIndex;
    m_AnimationTime = other.m_AnimationTime;
    m_FrameIndex = other.m_FrameIndex;

    SetAnimationFile( other.m_pAnimationFile );

    return *this;
}
void ComponentAnimationPlayer2D::ImportFromJSONObject(cJSON* jComponent, SceneID sceneid)
{
    ComponentBase::ImportFromJSONObject( jComponent, sceneid );

    cJSON* animfilestringobj = cJSON_GetObjectItem( jComponent, "AnimFile" );
    if( animfilestringobj )
    {
        EngineFileManager* pEngineFileManager = static_cast<EngineFileManager*>( m_pComponentSystemManager->GetEngineCore()->GetManagers()->GetFileManager() );
        MyFileObject* pFile = pEngineFileManager->RequestFile( animfilestringobj->valuestring, GetSceneID() );
        MyAssert( pFile );
        if( pFile )
        {
            SetAnimationFile( pFile );
            pFile->Release(); // free ref added by RequestFile
        }
    }
}
void* ComponentAnimationPlayer2D::OnDrop(ComponentVariable* pVar, bool changedByInterface, int x, int y)
{
    void* oldPointer = 0;

    DragAndDropItem* pDropItem = g_DragAndDropStruct.GetItem( 0 );

    if( pDropItem->m_Type == DragAndDropType_ComponentPointer )
    {
        //oldPointer = old component
        //(ComponentBase*)pDropItem->m_Value;
    }

    if( pDropItem->m_Type == DragAndDropType_GameObjectPointer )
    {
        //oldPointer = old gameobject
        //(GameObject*)pDropItem->m_Value;
    }

    if( pDropItem->m_Type == DragAndDropType_FileObjectPointer )
    {
        MyFileObject* pFile = (MyFileObject*)pDropItem->m_Value;
        MyAssert( pFile );

        if( strcmp( pFile->GetExtensionWithDot(), ".my2daniminfo" ) == 0 )
        {
            oldPointer = m_pAnimationFile;
            SetAnimationFile( pFile );

#if MYFW_USING_WX
            // update the panel so new filename shows up.
            g_pPanelWatch->GetVariableProperties( pVar->m_ControlID )->m_Description = m_pAnimationFile->GetFullPath();
#endif //MYFW_USING_WX
        }
    }

    return oldPointer;
}
Beispiel #4
0
	Animation::Animation(std::shared_ptr<MD5Anim> animation) : animation_time(0.0f) {
		SetAnimationFile(animation);
		this->animation_name = animation_file->GetFileName();
	}