Пример #1
0
mEResult mCAseWriter::WriteAseFileData( mCScene const & a_sceneSource, mCIOStreamBinary & a_streamDest, SOptions const a_Options )
{
    s_bAscFormat = a_Options.m_bGothicAscFormat;
    a_streamDest.Write( GetTokenLine( "3DSMAX_ASCIIEXPORT", ( a_Options.m_bGothicAscFormat ? "110" : "200" ) ) );
    a_streamDest.Write( GetTokenLine( "COMMENT", "\"Created using Baltram's ASC and ASE file writer\"" ) );
    a_streamDest.Write( StartBlock( "SCENE" ) );
    a_streamDest.Write( GetTokenLine( "SCENE_FILENAME", "\"" + g_GetFileName( a_sceneSource.GetName() ) + "\"" ) );
    a_streamDest.Write( GetTokenLine( "SCENE_FIRSTFRAME", "0" ) );
    a_streamDest.Write( GetTokenLine( "SCENE_LASTFRAME", "100" ) );
    a_streamDest.Write( GetTokenLine( "SCENE_FRAMESPEED", "30" ) );
    a_streamDest.Write( GetTokenLine( "SCENE_TICKSPERFRAME", "160" ) );
    a_streamDest.Write( GetTokenLine( "SCENE_BACKGROUND_STATIC", "0.0000\t0.0000\t0.0000" ) );
    a_streamDest.Write( GetTokenLine( "SCENE_AMBIENT_STATIC", "0.0000\t0.0000\t0.0000" ) );
    a_streamDest.Write( EndBlock() );
    a_streamDest.Write( StartBlock( "MATERIAL_LIST" ) );
    mTArray< mCNode const * > arrNodes;
    a_sceneSource.GetNodesSortedByLinks( arrNodes );
    mCScene sceneTemp;
    mCScene const & sceneMaterials = s_bAscFormat ? sceneTemp : a_sceneSource;
    mCNode nodeBip01( "Bip01" );
    if ( s_bAscFormat )
    {
        arrNodes.InsertAt( 0, &nodeBip01 );
        for ( MIUInt u = a_sceneSource.GetNumNodes(); u--; )
        {
            mCNode const & nodeNode = *a_sceneSource.GetNodeAt( u );
            MIUInt uMaterialIndex = a_sceneSource.GetMaterialIndexByName( nodeNode.GetMaterialName() );
            if ( ( uMaterialIndex != MI_DW_INVALID ) && ( sceneTemp.GetNumMaterials() == 0 ) )
                sceneTemp.AddMaterial( *a_sceneSource.GetMaterialAt( uMaterialIndex ) );
        }
    }
    MIUInt const uMaterialCount = sceneMaterials.GetNumMaterials();
    a_streamDest.Write( GetTokenLine( "MATERIAL_COUNT", mCString().Format( "%u", uMaterialCount ) ) );
    for ( MIUInt u = 0; u != uMaterialCount; ++u )
    {
        a_streamDest.Write( StartBlock( mCString().Format( "MATERIAL %u", u ) ) );
        WriteMaterial( sceneMaterials.GetMaterialAt( u ), a_streamDest );
        a_streamDest.Write( EndBlock() );
    }
    a_streamDest.Write( EndBlock() );
    for ( MIUInt u = 0, ue = arrNodes.GetCount(); u != ue; ++u )
    {
        if ( u && ( !arrNodes[ u ]->GetName().CompareNoCase( "Bip01" ) ) )
            continue;
        a_streamDest.Write( StartBlock( ( arrNodes[ u ]->HasMesh() || arrNodes[ u ]->GetIsBone() || !u ) ? "GEOMOBJECT" : "HELPEROBJECT" ) );
        WriteNode( a_sceneSource, *arrNodes[ u ], a_streamDest, a_Options );
        a_streamDest.Write( EndBlock() );
    }
    if ( a_Options.m_bGothicAscFormat )
    {
        for ( MIUInt u = 0; u != a_sceneSource.GetNumNodes(); ++u )
            if ( a_sceneSource.GetNodeAt( u )->HasSkin() && a_sceneSource.GetNodeAt( u )->HasMesh() )
                WriteSkin( a_sceneSource, u, a_streamDest );
    }
    return mEResult_Ok;
}
Пример #2
0
/***************************************************
OnLClick
	is called by the grid control to inform the multislect
	class that the user has clicked a left mouse button
	over the grid area.
Params:
	col, row	- coordinates of the cell user clicked on
	nFlags		- additional information about the mouse click
Returns:
	<none>
*****************************************************/
void CUGMultiSelect::OnLClick(int col,long row, UINT nFlags)
{
	if(m_mode&UG_MULTISELECT_OFF)
		return;

	m_lastCol = col;
	m_lastRow = row;

	if(nFlags&MK_CONTROL){
		StartBlock(col,row);
	}
	else if(nFlags&MK_SHIFT){
		EndBlock(col,row);
	}
	else{
		AddTotalRangeToDrawHints(&m_ctrl->m_CUGGrid->m_drawHint);
		ClearAll();
		StartBlock(col,row);
	}
}
Пример #3
0
/***************************************************
OnKeyMove
	Is called when the user moves within the grid
	using the keyboard.
Params:
	col, row	- coordinates of of the cell that the
				  user has just mode to.
Returns:
	<none>
*****************************************************/
void CUGMultiSelect::OnKeyMove(int col,long row)
{
	if(m_mode&UG_MULTISELECT_OFF)
		return;

	if(col == m_lastCol && row == m_lastRow)
		return;

	if(GetKeyState(VK_SHIFT) <0)
	{
		EndBlock(col,row);
	}
	else if(GetKeyState(VK_CONTROL) <0)
	{
		StartBlock(col,row);
	}
	else
	{
		AddTotalRangeToDrawHints(&m_ctrl->m_CUGGrid->m_drawHint);
		ClearAll();
		StartBlock(col,row);
	}
}
Пример #4
0
/***************************************************
OnRClick
	is called by the grid control to inform the multislect
	class that the user has clicked a right mouse button
	over the grid area.
Params:
	col, row	- coordinates of the cell user clicked on
	nFlags		- additional information about the mouse click
Returns:
	<none>
*****************************************************/
void CUGMultiSelect::OnRClick(int col,long row, UINT nFlags)
{
	UNREFERENCED_PARAMETER(nFlags);

	if(m_mode&UG_MULTISELECT_OFF)
		return;
	
	if(IsSelected(col,row) == FALSE)
	{
		AddTotalRangeToDrawHints(&m_ctrl->m_CUGGrid->m_drawHint);
		ClearAll();
		StartBlock(col,row);
	}
}
Пример #5
0
string CObjectIStreamJson::ReadFileHeader(void)
{
    StartBlock('{');
    string str( ReadKey());
    if (TopFrame().HasTypeInfo()) {
        const string& tname = TopFrame().GetTypeInfo()->GetName();
        if (tname.empty()) {
            UndoClassMember();
        }
        if (str != tname) {
            if (str == NStr::Replace(tname,"-","_")) {
                return tname;
            }
        }
    }
    return str;
}
Пример #6
0
/***************************************************
ToggleCell
	function can be used to toggle cell's selected status.
	Although this function is not used by any of the grid's
	classes it can be called directly to (de)select cells.
Params:
	col, row	- coordinates of the cell to select/deselect
Returns:
	UG_SUCCESS, this function will never fail.
*****************************************************/
int CUGMultiSelect::ToggleCell(int col,long row)
{	
	if(m_mode&UG_MULTISELECT_OFF)
		return UG_SUCCESS;

	//find the block
	int found = FALSE;
	UG_MSList * next = m_list;

	while(next != NULL)
	{
		if(col == next->loCol && col == next->hiCol)
		{
			if(row == next->loRow && row == next->hiRow)
			{
				if(next->selected)
					next->selected = FALSE;
				else
					next->selected = TRUE;

				found = TRUE;
				break;
			}
		}
		next = next->next;
	}
	//if there is no entry for this cell then add an entry
	if(!found)
	{
		//check to see if this cell is in a block	
		int selected = IsSelected(col,row);
		//add the cell
		StartBlock(col,row);
		if(selected)
			m_currentItem->selected =	FALSE;
		else
			m_currentItem->selected =	TRUE;
	}

	return UG_SUCCESS;
}
Пример #7
0
void CObjectIStreamJson::ReadAnyContentObject(CAnyContentObject& obj)
{
    obj.Reset();
    string value;
    string name = ReadKey();
    obj.SetName(name);
    if (PeekChar(true) == '{') {
        StartBlock('{');        
        while (NextElement()) {
            name = ReadKey();
            value = ReadValue();
            if (name[0] != '#') {
                obj.AddAttribute(name,kEmptyStr,value);
            } else {
                obj.SetValue(value);
            }
        }
        EndBlock('}');
        return;
    }
    value = ReadValue();
    obj.SetValue(value);
}
Пример #8
0
// choice
void CObjectIStreamJson::BeginChoice(const CChoiceTypeInfo* choiceType)
{
    StartBlock((GetStackDepth() > 1 && FetchFrameFromTop(1).GetNotag()) ? 0 : '{');
}
Пример #9
0
// class
void CObjectIStreamJson::BeginClass(const CClassTypeInfo* classInfo)
{
    StartBlock((GetStackDepth() > 1 && FetchFrameFromTop(1).GetNotag()) ? 0 : '{');
}
Пример #10
0
// container
void CObjectIStreamJson::BeginContainer(const CContainerTypeInfo* containerType)
{
    StartBlock('[');
}