Beispiel #1
0
void Xrefutil::AddNewXrefScene(HWND hWnd)
{
    // *** AddNewXrefScene ***
    //
    // Add new XRef'd Scene to current scene -- simply get the
    // name of the .MAX file, and use RootNode::AddNewXRefFile
    // to hook that xref'd scene into the current scene hierarchy
    //
    // Note: Don't confuse XRef scenes with XRef objects.
    // XRef scenes live as special children of the (single) root
    // node of the current scene, basically as "XRef'd root nodes"
    // of the external scene.  Note that merged-in XRef Root Nodes
    // can come from original scenes that already had another scene
    // xref'd in, and so-on.  See the SDK documentation on the 
    // various XRef Scene APIs on the INode object, keeping in mind
    // that these APIs only function when the INode is in fact the
    // root node of the scene.
    //
    
    TSTR filename = _T("");
    INode * pRootNode = m_pInterface->GetRootNode();
    if (!pRootNode) {
        // well, this is actually _really_ bad, but we just exit
        return;
    }
    if (!DoOpenSaveDialog(filename, true)) {
        // either cancel or fail, just return
        return;
    }    
	AssetUser asset = IAssetManager::GetInstance()->GetAsset(filename,kXRefAsset);
    pRootNode->AddNewXRefFile(asset, TRUE);
    m_pInterface->RedrawViews(m_pInterface->GetTime());
}
Beispiel #2
0
void Xrefutil::ConvertSelectedToXrefScene(HWND hWnd)
{
    // *** ConvertSelectedToXrefScene ***
    //
    // Relatively simple -- take the selected nodes, save them out
    // to a new .MAX file, delete the selected nodes from the 
    // current scene, and then do a RootNode->AddNewXRefFile
    // with the just-saved MAX file.
	
    INode * pNode = NULL;
    TSTR filename = _T("");
    int i;
	
    INode * pRootNode = m_pInterface->GetRootNode();
    if (!pRootNode) {
        // well, this is actually _really_ bad, but we just exit
        return;
    }
    if (m_pInterface->GetSelNodeCount() == 0) {
        ::MessageBox(hWnd, GetString(IDS_ERR3), ERROR_TITLE, MB_ICONSTOP | MB_OK);
        return;
    }
	
    Tab<INode *> nodetab;
    nodetab.ZeroCount();
	nodetab.Shrink();
    for (i = 0; i < m_pInterface->GetSelNodeCount(); i++) {
        pNode = m_pInterface->GetSelNode(i);
        nodetab.Append(1, &pNode, 5);
    }
	
    if (!DoOpenSaveDialog(filename)) {
        // either cancel or fail, just return
        return;
    }
	
    m_pInterface->FileSaveSelected(filename);
	
    // delete selected nodes, don't refresh yet
    for (i = 0; i < nodetab.Count(); i++) {
        nodetab[i]->Delete(0,TRUE);
    }

	AssetUser asset = IAssetManager::GetInstance()->GetAsset(filename,kXRefAsset);
    // add in the nodes we saved out as an xref'd scene
    pRootNode->AddNewXRefFile(asset, TRUE);
    
    m_pInterface->RedrawViews(m_pInterface->GetTime());
	
}