コード例 #1
0
ファイル: Animator Bar.cpp プロジェクト: aolko/construct
void AnimatorBar::FrameSerialize(CArchive& ar)
{
	if(ar.IsLoading())
	{
		POSITION Pos = film_strip.GetFirstSelectedItemPosition();
		
		int Count;
		ar >> Count;
		vector<int> ToSelect;

		for(int a = 0; a < Count; a ++)
		{
			application->resources.images.push_back(CImageResource());
			application->resources.images_changed = true;
			CImageResource* image = &application->resources.images.back();
			image->Serialize(ar);
			image->m_FixedID = application->m_ImageFixID++;

			POSITION pos = film_strip.GetFirstSelectedItemPosition();
		
			if(pos)
			{
				if(m_pCurrentAnimation->supportsFrames())
				{
					int nItem = film_strip.GetNextSelectedItem(pos);
					m_pCurrentAnimation->m_Images.insert( m_pCurrentAnimation->m_Images.begin() + nItem + a, image->m_FixedID);
					ToSelect.push_back(nItem + a);
				}
			}

			else
			{
				if(m_pCurrentAnimation->supportsFrames())
				{
					m_pCurrentAnimation->m_Images.push_back( image->m_FixedID);
					ToSelect.push_back(m_pCurrentAnimation->m_Images.size());
				}
			}			

			int iFrameTime = 0;
			ar >> iFrameTime;
			
			if(m_pCurrentAnimation->supportsFrames())
			{
				m_pCurrentAnimation->m_FrameTimes.push_back(iFrameTime);
			}
		}

		UpdateFilmStrip();
		for(int c = 0 ; c < ToSelect.size(); c++)
			film_strip.SetItemState (ToSelect[c], LVIS_SELECTED, LVIS_SELECTED);
	}
コード例 #2
0
void CAnimationEditorDlg::FrameSerialize(CArchive& ar)
{
	// This function is only called for copying and pasting frames

	if(ar.IsLoading())
	{
		POSITION pos = m_Frames.GetFirstSelectedItemPosition();
		int count;
		ar >> count;
		vector<int> ToSelect;
		for(int a = 0; a < count; a ++)
		{
			m_pApplication->m_imageBank.push_back(CImageResource());
			m_pApplication->m_imageBankHasChanged = true;
			CImageResource* image = &m_pApplication->m_imageBank.back();
			image->Serialize(ar);
			image->m_FixedID = m_pApplication->m_ImageFixID++;

			POSITION pos = m_Frames.GetFirstSelectedItemPosition();
			if(pos)
			{
				int nItem = m_Frames.GetNextSelectedItem(pos);
				m_CurrentAnimation->m_Images.insert( m_CurrentAnimation->m_Images.begin() + nItem + a, image->m_FixedID);
				ToSelect.push_back(nItem + a);
			}
			else
			{
				m_CurrentAnimation->m_Images.push_back( image->m_FixedID);
				ToSelect.push_back(m_CurrentAnimation->m_Images.size());
			}			

			int iFrameTime = 0;
			ar >> iFrameTime;
			m_CurrentAnimation->m_FrameTimes.push_back(iFrameTime);
		}

		UpdateList();
		for(int c = 0 ; c < ToSelect.size(); c++)
			m_Frames.SetItemState (ToSelect[c], LVIS_SELECTED, LVIS_SELECTED);

	}