1235 lines
39 KiB
C++
1235 lines
39 KiB
C++
/*
|
|
*=======================================================================================
|
|
* Name :PO_Inter.cpp
|
|
* Author :VL Date :22/05/97
|
|
* Description :DLL interface to manage Physical Objects (PO)
|
|
*=======================================================================================
|
|
* Modification -> Author : Date :
|
|
* Description :
|
|
*=======================================================================================
|
|
*/
|
|
|
|
#ifdef ACTIVE_EDITOR
|
|
|
|
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
|
|
#include "stdafx.h"
|
|
#include "ACP_Base.h"
|
|
#include "ITF.h"
|
|
#include "vig.h"
|
|
#include "incOPD.h"
|
|
#include "PODialog.h"
|
|
#include "x:\Cpa\Main\inc\_EditId.h"
|
|
#include "OIT.h"
|
|
|
|
//ROMTEAM WorldEditor (Nicu 28/10/97)
|
|
#include "ogd.h"
|
|
#include "po\postruc.h"
|
|
#include "x:\cpa\tempgrp\gliGLOU\MULTIDRV\inc\visus_st.h"
|
|
#include "DPT.h"
|
|
#define STR_LENGTH 200
|
|
#define NB_LENGTH 10
|
|
//ENDROMTEAM WorldEditor (Nicu)
|
|
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
|
|
|
|
// infos
|
|
static CString g_csOPDName = "Physical";
|
|
static CString g_csOPDAuthor = "Vincent Lhullier";
|
|
static CString g_csOPDVersion = "V 2.0.2 18/03/98";
|
|
static CString g_csOPDFrenchHelpFile = "";
|
|
static CString g_csOPDEnglishHelpFile = "";
|
|
|
|
BOOL g_bTipFirstTime = TRUE;
|
|
|
|
/*
|
|
*==============================================================================
|
|
Constants
|
|
*==============================================================================
|
|
*/
|
|
#define OPD_GetFullGeomSectionName 999
|
|
|
|
/*
|
|
*==============================================================================
|
|
Globals
|
|
*==============================================================================
|
|
*/
|
|
/* the DLL global definition */
|
|
tdstDLLIdentity g_stPOIdentity;
|
|
|
|
/*
|
|
----------------------------------------------------------------------------------------
|
|
Description : constructor
|
|
----------------------------------------------------------------------------------------
|
|
*/
|
|
POInterface::POInterface()
|
|
{
|
|
/* private internal */
|
|
m_p_stDLLIdentity = &g_stPOIdentity;
|
|
|
|
m_stBaseDLLDefinition.bCanOutputIn3DView = FALSE;
|
|
m_stBaseDLLDefinition.bCanBeRefreshedByEngine = FALSE;
|
|
|
|
SetCurrent( FALSE );
|
|
SetEditorInfo(g_csOPDName, g_csOPDAuthor, g_csOPDVersion, g_csOPDFrenchHelpFile, g_csOPDEnglishHelpFile);
|
|
|
|
/*
|
|
* set default value for dialog box
|
|
*/
|
|
m_p_oDlgVse = NULL;
|
|
m_p_oDlgList = NULL;
|
|
|
|
/*
|
|
* selected item
|
|
*/
|
|
m_p_oSelectedPO = NULL;
|
|
m_p_oSelectedActor = NULL;
|
|
|
|
//ROMTEAM WorldEditor (Cristian Stegaru 01/98)
|
|
m_bEPOListOK = FALSE;
|
|
//ENDROMTEAM WorldEditor (Cristian Stegaru)
|
|
|
|
}
|
|
|
|
/*
|
|
=======================================================================================
|
|
Specific functions
|
|
=======================================================================================
|
|
*/
|
|
void POInterface::fn_vDisplayPOInfo( EditorPO *_p_oPO )
|
|
{
|
|
if (m_p_oDlgVse)
|
|
m_p_oDlgVse->fn_vUpdateInfo( _p_oPO );
|
|
}
|
|
|
|
/*
|
|
*=======================================================================================
|
|
ACP Messages
|
|
*=======================================================================================
|
|
*/
|
|
|
|
/*
|
|
*=======================================================================================
|
|
Begin / End Methods
|
|
*=======================================================================================
|
|
*/
|
|
|
|
/*
|
|
----------------------------------------------------------------------------------------
|
|
Called just after DLL registration
|
|
----------------------------------------------------------------------------------------
|
|
*/
|
|
void POInterface::fn_vJustAfterRegistered()
|
|
{
|
|
/*
|
|
* Type of objects created
|
|
*/
|
|
CString a_csTypeOfObject[] = { C_szPhysicalObjectTypeName };
|
|
fn_vRegisterObjectsType(a_csTypeOfObject, 1);
|
|
|
|
/*
|
|
* object static init
|
|
*/
|
|
EditorPO::StaticInit();
|
|
}
|
|
|
|
/*
|
|
----------------------------------------------------------------------------------------
|
|
construct interface window
|
|
----------------------------------------------------------------------------------------
|
|
*/
|
|
void POInterface::fn_vConstruct()
|
|
{
|
|
/*~~~ In case of inactive editor, don't create dialogs ~~~*/
|
|
#ifndef __INACTIVE_INTERFACE__
|
|
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
|
|
|
|
/*
|
|
* Frame
|
|
*/
|
|
m_p_oSplitterLeft = new CSplitFrame () ;
|
|
m_p_oSplitterLeft->CreateBase ( "Physical Objects editor" , 1, 2, GetMainWorld () );
|
|
m_p_oSplitterLeft->m_iInitWidth = 200;
|
|
m_p_oSplitterLeft->mfn_vEnableCaption(FALSE);
|
|
m_p_oSplitterLeft->m_stWinRight.cLinkSame = FRM_C_MoveBottom;
|
|
m_p_oSplitterLeft->CreateSplitter( C_cVerticalSplitter , 2 );
|
|
|
|
/*
|
|
* save old resource handle and set the dll resource handle
|
|
*/
|
|
HINSTANCE hOldInst = AfxGetResourceHandle();
|
|
AfxSetResourceHandle( m_p_stDLLIdentity->hModule );
|
|
|
|
/*
|
|
* first pane : dialog to list all PO object
|
|
*/
|
|
m_p_oSplitterLeft->CreateView( 0, RUNTIME_CLASS( CPODlgList ), "LIST OF PHYSICAL", 0);
|
|
m_p_oDlgList = (CPODlgList *) m_p_oSplitterLeft->m_fn_p_oGetPane( 0 );
|
|
m_p_oDlgList->fn_vSetParentDLL( this );
|
|
|
|
/*
|
|
* second pane : dialog to edit VSE data
|
|
*/
|
|
m_p_oSplitterLeft->CreateView ( 1, RUNTIME_CLASS( CPODlgVse ), "CARACTERISTICS", C_wCaptionHeight ) ;
|
|
m_p_oDlgVse = (CPODlgVse *)m_p_oSplitterLeft-> m_fn_p_oGetPane ( 1 ) ;
|
|
m_p_oDlgVse->fn_vSetParentDLL ( this ) ;
|
|
fn_vDisplayPOInfo( NULL );
|
|
|
|
AfxSetResourceHandle( hOldInst );
|
|
|
|
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
|
|
#endif /*__INACTIVE_INTERFACE__*/
|
|
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
|
|
|
|
}
|
|
|
|
/*
|
|
----------------------------------------------------------------------------------------
|
|
Called before engine
|
|
----------------------------------------------------------------------------------------
|
|
*/
|
|
void POInterface::fn_vBeforeEngine(void)
|
|
{
|
|
// Frame
|
|
if(fn_bIsCurrentEditor())
|
|
{
|
|
g_oFrameGest.mfn_vSetRefresh(FALSE);
|
|
g_oFrameGest.mfn_vDisactivateWindow (m_p_oSplitterLeft) ;
|
|
g_oFrameGest.mfn_vSetRefresh(TRUE);
|
|
}
|
|
m_p_oDlgVse->m_fn_vSwapLOD( 0, TRUE, FALSE );
|
|
}
|
|
|
|
/*
|
|
----------------------------------------------------------------------------------------
|
|
Called before editor
|
|
----------------------------------------------------------------------------------------
|
|
*/
|
|
void POInterface::fn_vBeforeEditor(void)
|
|
{
|
|
if(fn_bIsCurrentEditor())
|
|
{
|
|
if (m_p_oDlgList)
|
|
m_p_oDlgList->fn_vRefreshListContent();
|
|
/*
|
|
* Frame
|
|
*/
|
|
g_oFrameGest.mfn_vSetRefresh(FALSE);
|
|
g_oFrameGest.mfn_vActivateWindow (m_p_oSplitterLeft) ;
|
|
g_oFrameGest.mfn_vSetRefresh(TRUE);
|
|
}
|
|
}
|
|
|
|
/*
|
|
=======================================================================================
|
|
Reinitialization methods
|
|
=======================================================================================
|
|
*/
|
|
|
|
|
|
/*
|
|
----------------------------------------------------------------------------------------
|
|
Description : called when root world change
|
|
----------------------------------------------------------------------------------------
|
|
*/
|
|
void POInterface::fn_vOnChangeRoot(void)
|
|
{
|
|
if ( fn_bIsCurrentEditor() )
|
|
{
|
|
if (m_p_oDlgList)
|
|
{
|
|
m_p_oDlgList->fn_vRefreshListContent();
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
/*
|
|
----------------------------------------------------------------------------------------
|
|
Description : called when device change
|
|
----------------------------------------------------------------------------------------
|
|
*/
|
|
void POInterface::fn_vOnChangeDevice(void)
|
|
{
|
|
fn_vOnChangeRoot();
|
|
}
|
|
|
|
/*
|
|
----------------------------------------------------------------------------------------
|
|
Description : called when world change
|
|
----------------------------------------------------------------------------------------
|
|
*/
|
|
void POInterface::fn_vOnChangeWorld(void)
|
|
{
|
|
fn_vOnChangeRoot();
|
|
}
|
|
|
|
/*
|
|
*=======================================================================================
|
|
Editor Messages
|
|
*=======================================================================================
|
|
*/
|
|
|
|
/*
|
|
----------------------------------------------------------------------------------------
|
|
Description :
|
|
----------------------------------------------------------------------------------------
|
|
*/
|
|
BOOL POInterface::fn_bAcceptModifCopy(CPA_List<CPA_SuperObject> *pListObjects, tdeStatus eStatus)
|
|
{
|
|
return (eStatus != C_AsConcernedDLL);
|
|
}
|
|
|
|
/*
|
|
----------------------------------------------------------------------------------------
|
|
Description : called when an object has been deleted
|
|
----------------------------------------------------------------------------------------
|
|
*/
|
|
void POInterface::fn_vOnModifDelete(CPA_List<EDT_SaveParents> *pListObjects, tdeTypeModif eType, tdeStatus eStatus)
|
|
{
|
|
if (m_p_oDlgList)
|
|
m_p_oDlgList->fn_vRefreshListContent();
|
|
}
|
|
|
|
/*
|
|
----------------------------------------------------------------------------------------
|
|
Description : called when an object has been modified
|
|
----------------------------------------------------------------------------------------
|
|
*/
|
|
void POInterface::fn_vOnModifParent(CPA_List<EDT_SaveParents> *pListObjects, tdeTypeModif eType, tdeStatus eStatus)
|
|
{
|
|
if (m_p_oDlgList)
|
|
m_p_oDlgList->fn_vRefreshListContent();
|
|
}
|
|
|
|
/*
|
|
----------------------------------------------------------------------------------------
|
|
Description : called when an object has been modified and copied
|
|
----------------------------------------------------------------------------------------
|
|
*/
|
|
void POInterface::fn_vOnModifCopy(CPA_List<EDT_SaveParents> *pListObjects, tdeTypeModif eType, tdeStatus eStatus)
|
|
{
|
|
if (m_p_oDlgList)
|
|
m_p_oDlgList->fn_vRefreshListContent();
|
|
}
|
|
|
|
/*
|
|
----------------------------------------------------------------------------------------
|
|
Description : called when object name has been modified
|
|
----------------------------------------------------------------------------------------
|
|
*/
|
|
void POInterface::fn_vOnModifName (CPA_SuperObject *pEdObj, CString csInitalName, CString csFinalName, tdeTypeModif eType, tdeStatus eStatus)
|
|
{
|
|
if (m_p_oDlgList)
|
|
m_p_oDlgList->fn_vRefreshListContent();
|
|
}
|
|
|
|
|
|
/*
|
|
----------------------------------------------------------------------------------------
|
|
Description : called when an object is selected
|
|
----------------------------------------------------------------------------------------
|
|
*/
|
|
void POInterface::fn_vOnSelect(CPA_SuperObject *pEdObj, tdeTypeModif eType, tdeStatus)
|
|
{
|
|
if( fn_bIsCurrentEditor() && ( eType == C_EDTDo) && (pEdObj) && (pEdObj->GetObject()) )
|
|
{
|
|
if (fn_bGetPOFromObject( pEdObj->GetObject() ) )
|
|
{
|
|
/*
|
|
* force current object to be the only one that is selected
|
|
*/
|
|
if (M_GetCountSelected() > 1)
|
|
{
|
|
M_CancelSelection();
|
|
GetInterface()->fn_vAddSelectedObject(pEdObj,FALSE);
|
|
}
|
|
}
|
|
m_p_oDlgList->fn_vSetCurrentItem( m_p_oSelectedPO, m_p_oSelectedActor );
|
|
}
|
|
/*
|
|
else
|
|
{
|
|
fn_vUnSelect();
|
|
m_p_oDlgVse->fn_vUpdateInfo(NULL);
|
|
}
|
|
*/
|
|
}
|
|
|
|
/*
|
|
=======================================================================================
|
|
Menu Methods
|
|
=======================================================================================
|
|
*/
|
|
//**************************************************************************************
|
|
//Begin Mircea Dunka 31 Aug 1998 - DialogBar interface
|
|
void POInterface::fn_vDefineDlgBarBtnIcon (tde_DlgBarCategory wCategory, tds_DlgBarBtn *_pDlgBarBtn)
|
|
{
|
|
if(wCategory == C_DlgBarCategoryEditor)
|
|
{
|
|
_pDlgBarBtn->hIcon = ::LoadIcon((HINSTANCE)(GetDLLIdentity()->hModule), MAKEINTRESOURCE(IDI_OPD_DLGBAR_ICON));
|
|
|
|
CString oCst;
|
|
oCst = "Physical";
|
|
if( (M_GetMainApp()) && (M_GetMainApp()->mp_oAppKeyboard) )
|
|
{
|
|
oCst += " (";
|
|
oCst += M_GetMainApp()->mp_oAppKeyboard->mfn_oConvertIniStringToKeyString((const CString*)&CString("Activate Physical Object Editor"));
|
|
oCst += ")";
|
|
}
|
|
strcpy(_pDlgBarBtn->szToolTip, (char*)(LPCTSTR)oCst);
|
|
_pDlgBarBtn->uID = (UINT)this;
|
|
}
|
|
}
|
|
//end Mircea Dunka 31 Aug 1998
|
|
|
|
/*
|
|
----------------------------------------------------------------------------------------
|
|
Description : define sub menu to enter this editor
|
|
----------------------------------------------------------------------------------------
|
|
*/
|
|
BOOL POInterface::fn_bDefineSubMenu(EDT_SubMenu *_p_oEDTSubMenu)
|
|
{
|
|
if (_p_oEDTSubMenu->GetSubMenuType() == C_SubMenuEditor)
|
|
{
|
|
CString oCst;
|
|
|
|
oCst = "Physical";
|
|
if( (M_GetMainApp()) && (M_GetMainApp()->mp_oAppKeyboard) )
|
|
{
|
|
oCst += "\t";
|
|
oCst += M_GetMainApp()->mp_oAppKeyboard->mfn_oConvertIniStringToKeyString((const CString*)&CString("Activate Physical Object Editor"));
|
|
}
|
|
|
|
if( fn_bIsCurrentEditor() )
|
|
_p_oEDTSubMenu->AddAnEntry(this, (char*)(LPCTSTR)oCst, IDM_EXIT,TRUE);
|
|
else
|
|
_p_oEDTSubMenu->AddAnEntry(this, (char*)(LPCTSTR)oCst, IDM_EDIT, FALSE, TRUE);
|
|
|
|
return TRUE;
|
|
}
|
|
|
|
return FALSE;
|
|
}
|
|
|
|
void POInterface::_OnSubMenuCommand(EDT_SubMenu *_p_oEDTSubMenu,UINT uiMsgID)
|
|
{
|
|
if(_p_oEDTSubMenu->GetSubMenuType() == C_SubMenuEditor)
|
|
_OnPopUpMenuCommand(uiMsgID);
|
|
}
|
|
|
|
/*
|
|
=======================================================================================
|
|
Popup menus method
|
|
=======================================================================================
|
|
*/
|
|
|
|
BOOL POInterface::fn_bDefinePopupMenu(EDT_PopUpMenu *pPopup, CPA_List<CPA_SuperObject> *pSelection, BOOL bIsAlone)
|
|
{
|
|
if(bIsAlone)
|
|
{
|
|
pPopup->AddAnEntry(this, "Exit Physical Object editor", IDM_EXIT);
|
|
return TRUE;
|
|
}
|
|
|
|
if( !fn_bIsCurrentEditor() )
|
|
{
|
|
if (fn_bGetPOFromListOrSelection( NULL ))
|
|
{
|
|
pPopup->AddAnEntry(this, "Edit physical object", IDM_EDIT);
|
|
return TRUE;
|
|
}
|
|
}
|
|
|
|
return FALSE;
|
|
}
|
|
|
|
void POInterface::_OnPopUpMenuCommand(UINT m_IDCmdMsg)
|
|
{
|
|
switch(m_IDCmdMsg)
|
|
{
|
|
case IDM_EDIT:
|
|
GetMainWorld()->fn_bActivateEditor(this,NULL); // open with selection
|
|
break;
|
|
case IDM_EXIT:
|
|
GetMainWorld()->fn_bCloseEditor(this);
|
|
break;
|
|
}
|
|
}
|
|
|
|
/*
|
|
=======================================================================================
|
|
Editor methods
|
|
=======================================================================================
|
|
*/
|
|
|
|
/*
|
|
----------------------------------------------------------------------------------------
|
|
Description : try to find a PO from a given object
|
|
_p_oObject-> given object
|
|
Returns (BOOL ) TRUE if selected object is alone and has a PO inside
|
|
----------------------------------------------------------------------------------------
|
|
*/
|
|
BOOL POInterface::fn_bGetPOFromObject( CPA_BaseObject *_p_oObject )
|
|
{
|
|
/* init */
|
|
//m_p_oSelectedPO = NULL;
|
|
//m_p_oSelectedActor = NULL;
|
|
|
|
if (_p_oObject == NULL)
|
|
return FALSE;
|
|
|
|
/*
|
|
* check if object is a PO object
|
|
*/
|
|
if (_p_oObject->fn_bIsOfType( C_szPhysicalObjectTypeName ) )
|
|
{
|
|
m_p_oSelectedPO = (EditorPO *) _p_oObject;
|
|
m_p_oSelectedActor = NULL;
|
|
return TRUE;
|
|
}
|
|
/*
|
|
* check if object is an IPO
|
|
*/
|
|
if (_p_oObject->fn_bIsOfType( C_szInstanciatedPhysicalObjectTypeName ) )
|
|
{
|
|
m_p_oSelectedPO = ((EditorIPO *) _p_oObject)->GetPhysicalObject();
|
|
m_p_oSelectedActor = NULL;
|
|
return TRUE;
|
|
}
|
|
/*
|
|
* check if object is an actor
|
|
*/
|
|
if (_p_oObject->fn_bIsOfType( C_szActorInstanceTypeName ))
|
|
{
|
|
m_p_oSelectedPO = NULL;
|
|
m_p_oSelectedActor = _p_oObject;
|
|
return TRUE;
|
|
}
|
|
|
|
char *szType = _p_oObject->fn_p_szGetType();
|
|
return FALSE;
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
----------------------------------------------------------------------------------------
|
|
Description : try to find a PO from list or selected object
|
|
pParam -> list of object (or NULL to take selected object )
|
|
Returns (BOOL ) TRUE if selected object is alone and has a PO inside
|
|
----------------------------------------------------------------------------------------
|
|
*/
|
|
BOOL POInterface::fn_bGetPOFromListOrSelection( CPA_List<CPA_BaseObject> *_p_oListObjects )
|
|
{
|
|
CPA_BaseObject *p_oObject;
|
|
|
|
/* init */
|
|
p_oObject = NULL;
|
|
|
|
if ( _p_oListObjects != NULL )
|
|
{
|
|
/*
|
|
* can be activate with only one object
|
|
*/
|
|
if ( _p_oListObjects->GetCount() == 1 )
|
|
{
|
|
p_oObject = _p_oListObjects->GetHead();
|
|
}
|
|
}
|
|
else
|
|
{
|
|
/*
|
|
* take selection has list of objects
|
|
*/
|
|
if (M_GetCountSelected() == 1)
|
|
{
|
|
p_oObject = M_GetSingleSelection()->GetObject();
|
|
}
|
|
}
|
|
|
|
return fn_bGetPOFromObject( p_oObject );
|
|
}
|
|
|
|
|
|
/*
|
|
----------------------------------------------------------------------------------------
|
|
Description : return TRUE if actor can be currently activated with a given list of
|
|
objects (or current selection if list of object is NULL )
|
|
pParam -> list of objects
|
|
Returns (BOOL) TRUE if PO editor can be activated
|
|
----------------------------------------------------------------------------------------
|
|
*/
|
|
BOOL POInterface::fn_bCanActivateEditor (CPA_List<CPA_BaseObject> *pParam)
|
|
{
|
|
/*~~~ In case of inactive editor, refuse access to editor ~~~*/
|
|
#ifdef __INACTIVE_INTERFACE__
|
|
return FALSE;
|
|
#endif /*__INACTIVE_INTERFACE__*/
|
|
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
|
|
|
|
return (!fn_bIsCurrentEditor() );
|
|
}
|
|
|
|
|
|
/*
|
|
----------------------------------------------------------------------------------------
|
|
Description : return TRUE if editaor can be closed.
|
|
Returns (BOOL)
|
|
----------------------------------------------------------------------------------------
|
|
*/
|
|
BOOL POInterface::fn_bCanCloseEditor (void)
|
|
{
|
|
return ( fn_bIsCurrentEditor() );
|
|
}
|
|
|
|
|
|
/*
|
|
----------------------------------------------------------------------------------------
|
|
Description : Activate editor with list of object or is back activated
|
|
pParam -> list of object
|
|
bBackActivated -> TRUE if editor is activate cause another editor closed
|
|
----------------------------------------------------------------------------------------
|
|
*/
|
|
void POInterface::fn_vOnActivateEditor(CPA_List<CPA_BaseObject> *pParam, BOOL bBackActivated /*=FALSE*/)
|
|
{
|
|
/*
|
|
* refresh list of PO
|
|
*/
|
|
m_p_oDlgList->fn_vRefreshListContent();
|
|
|
|
/*
|
|
* activate frame
|
|
*/
|
|
//g_oFrameGest.mfn_vSetRefresh(FALSE);
|
|
g_oFrameGest.mfn_vActivateWindow (m_p_oSplitterLeft) ;
|
|
//g_oFrameGest.mfn_vSetRefresh(TRUE);
|
|
|
|
if (!bBackActivated )
|
|
{
|
|
fn_bGetPOFromListOrSelection( pParam );
|
|
}
|
|
|
|
m_p_oDlgList->fn_vSetCurrentItem( m_p_oSelectedPO, m_p_oSelectedActor );
|
|
//m_p_oDlgVse->fn_vUpdateInfo(m_p_oSelectedPO);
|
|
|
|
// display Tip of the Day
|
|
GetInterface()->fn_vDisplayTipOfDay("POs", "OPT", g_bTipFirstTime);
|
|
g_bTipFirstTime = FALSE;
|
|
}
|
|
|
|
void POInterface::fn_vOnCloseEditor (void)
|
|
{
|
|
m_p_oDlgVse->m_fn_vSwapLOD( 0, TRUE, TRUE );
|
|
}
|
|
|
|
/*
|
|
*=======================================================================================
|
|
* General Purpose
|
|
*=======================================================================================
|
|
*/
|
|
|
|
/*
|
|
----------------------------------------------------------------------------------------
|
|
Description : do a query action
|
|
p_oSender -> DLL that query the action
|
|
WPARAM -> action
|
|
---------------------------------------------------------------------------------------
|
|
action -> OPD_ActionEncapsulateObject
|
|
LPARAM -> engine physical object (PO_tdxHandleToPhysicalObject)
|
|
Returns -> editor physical object (EditorPO *)
|
|
----------------------------------------------------------------------------------------
|
|
*/
|
|
long POInterface::OnQueryAction(CPA_EditorBase *p_oSender, WPARAM wParam, LPARAM lParam)
|
|
{
|
|
long lResult = 0;
|
|
PO_tdxHandleToPhysicalObject hPO;
|
|
EditorPO *p_oEditPO;
|
|
char *p_szSectionName;
|
|
char szFileName[SCR_CV_ui_Cfg_MaxLenName];
|
|
char szActionName[SCR_CV_ui_Cfg_MaxLenName];
|
|
char szName[SCR_CV_ui_Cfg_MaxLenName];
|
|
CPA_BaseObject *p_oOwner;
|
|
|
|
switch( wParam )
|
|
{
|
|
case OPD_ActionEncapsulateObject:
|
|
{
|
|
p_oOwner = (CPA_BaseObject *) p_oSender;
|
|
hPO = (PO_tdxHandleToPhysicalObject) lParam;
|
|
// search if object already exists
|
|
p_oEditPO = (EditorPO*)GetBaseObject( hPO, C_szPhysicalObjectTypeName );
|
|
if( p_oEditPO == NULL )
|
|
{
|
|
// new object
|
|
p_szSectionName = SCR_M_p_sz_Link_GetKey(SCR_fnp_st_Link_SearchValue(&PO_g_stLinkTable, (unsigned long) hPO));
|
|
SCR_fn_v_RdL0_SplitSectionName(p_szSectionName, szFileName, szActionName, szName);
|
|
|
|
//ROMTEAM WorldEditor (Cristian Stegaru 01/98)
|
|
|
|
BOOL bNeedAGeometricObject = mfn_bIsACandidateEPO (szName);
|
|
if (bNeedAGeometricObject)
|
|
p_oEditPO = mfn_pGetEPOwithGeomObjAttached (hPO, p_oOwner, p_szSectionName);
|
|
else
|
|
p_oEditPO = new EditorPO(this, hPO, p_oOwner, szName, szFileName, szActionName);
|
|
|
|
//ENDROMTEAM WorldEditor (Cristian Stegaru)
|
|
|
|
}
|
|
fn_vComputeBoundingVolume(p_oEditPO);
|
|
lResult = (long) p_oEditPO;
|
|
}
|
|
break;
|
|
|
|
case OPD_ActionSecondPass:
|
|
{
|
|
hPO = (PO_tdxHandleToPhysicalObject) lParam;
|
|
p_oEditPO = (EditorPO *) GetMainWorld () -> fn_p_oFindObjectWithEngine (hPO , C_szPhysicalObjectTypeName);
|
|
ASSERT (p_oEditPO);
|
|
p_oEditPO -> m_fn_vInitDataMembers (TRUE);
|
|
}
|
|
break;
|
|
|
|
case OPD_ActionCreateEmptyPO:
|
|
{
|
|
SCR_tdst_Link_Value *p_stLinkValue;
|
|
|
|
p_oOwner = (CPA_BaseObject *) p_oSender;
|
|
p_szSectionName = (char *) lParam;
|
|
/*
|
|
* look first if object exist
|
|
*/
|
|
p_stLinkValue = SCR_fnp_st_Link_SearchKey(&PO_g_stLinkTable, p_szSectionName );
|
|
if (p_stLinkValue == NULL)
|
|
{
|
|
hPO = NULL;
|
|
p_oEditPO = NULL;
|
|
}
|
|
else
|
|
{
|
|
hPO = (PO_tdxHandleToPhysicalObject) SCR_M_ul_Link_GetValue( p_stLinkValue );
|
|
p_oEditPO = (EditorPO*) GetBaseObject( hPO, C_szPhysicalObjectTypeName );
|
|
}
|
|
if (p_oEditPO == NULL)
|
|
{
|
|
SCR_fn_v_RdL0_SplitSectionName(p_szSectionName, szFileName, szActionName, szName);
|
|
p_oEditPO = new EditorPO( this, hPO, p_oOwner, szName, szFileName, szActionName);
|
|
}
|
|
lResult = (long) p_oEditPO;
|
|
}
|
|
break;
|
|
|
|
//ROMTEAM WorldEditor (Nicu 28/10/97)
|
|
case OPD_ActionCreateGeometricPO:
|
|
{
|
|
QueryActionParam *param = (QueryActionParam*)lParam;
|
|
p_szSectionName = param->m_csName.GetBuffer (param->m_csName.GetLength () + 1);
|
|
Geometry3D *g3d = param->m_p3DObject;
|
|
|
|
p_oOwner = (CPA_BaseObject *) p_oSender;
|
|
SCR_fn_v_RdL0_SplitSectionName(p_szSectionName, szFileName, szActionName, szName);
|
|
|
|
PO_tdxHandleToPhysicalObject hPO = mfn_hGethPOFromGeomObj (g3d);
|
|
ASSERT (hPO);
|
|
|
|
p_oEditPO = new EditorPO( this, hPO, p_oOwner, szName, szFileName, szActionName);
|
|
p_oEditPO->SetZone(3, g3d, FALSE);
|
|
p_oEditPO->m_iIdx = param->m_iIdx;
|
|
m_lstOfCandidateEPO.AddTail (p_oEditPO);
|
|
lResult = (long) p_oEditPO;
|
|
}
|
|
break;
|
|
//ENDROMTEAM WorldEditor (Nicu)
|
|
//CPA2 Stegaru Cristian 98-03
|
|
case OPD_GetFullGeomSectionName:
|
|
{
|
|
EditorPO *pPO = (EditorPO *)lParam;
|
|
CString *pcsFullGeomSectionName = new CString;
|
|
*pcsFullGeomSectionName = pPO->mfn_csGetFullGeomSectionName ();
|
|
lResult = (long)pcsFullGeomSectionName;
|
|
}
|
|
break;
|
|
//End CPA2 Stegaru Cristian 98-03
|
|
|
|
}
|
|
return lResult;
|
|
}
|
|
|
|
/*
|
|
=======================================================================================
|
|
Reachable Objects
|
|
=======================================================================================
|
|
*/
|
|
|
|
|
|
/*
|
|
----------------------------------------------------------------------------------------
|
|
Description : load engine struct associated with an empty CPA_BaseObject of
|
|
PhysicalObject type
|
|
p_oObject -> empty editor PO
|
|
Returns (BOOL ) TRUE if load success
|
|
----------------------------------------------------------------------------------------
|
|
*/
|
|
BOOL POInterface::fn_bLoadBaseObject( CPA_BaseObject *p_oObject )
|
|
{
|
|
BOOL bIsLoadingWorld;
|
|
BOOL bLoaded;
|
|
|
|
if ( strcmp( p_oObject->fn_p_szGetType(), C_szPhysicalObjectTypeName) == 0)
|
|
{
|
|
bIsLoadingWorld = GetInterface()->fn_bIsLoadingWorld();
|
|
GetInterface()->SetLoadingWorld( TRUE );
|
|
bLoaded = ((EditorPO *) p_oObject)->m_fn_bLoadEnginePO() ;
|
|
GetInterface()->SetLoadingWorld( bIsLoadingWorld );
|
|
return bLoaded;
|
|
}
|
|
return FALSE;
|
|
}
|
|
|
|
|
|
/*
|
|
=======================================================================================
|
|
OBJECT DLL FUNCTIONS OVERLOAD
|
|
=======================================================================================
|
|
*/
|
|
|
|
/*
|
|
----------------------------------------------------------------------------------------
|
|
create a new super object and new PO object
|
|
----------------------------------------------------------------------------------------
|
|
*/
|
|
CPA_SuperObject * POInterface::GetNewEditorInstance (HIE_tdxHandleToSuperObject hEngineInstance)
|
|
{
|
|
CPA_SuperObject *pSupObj;
|
|
|
|
pSupObj = GetInterface()->GetNewSuperObject(hEngineInstance, E_ss_NoSave);
|
|
fn_vBuildNewEditorInstance( pSupObj, hEngineInstance );
|
|
|
|
return pSupObj;
|
|
}
|
|
|
|
/*
|
|
----------------------------------------------------------------------------------------
|
|
encapsulate an engine IPO in a editor IPO
|
|
create the object but not the super object
|
|
----------------------------------------------------------------------------------------
|
|
*/
|
|
void POInterface::fn_vBuildNewEditorInstance (CPA_SuperObject *pEditorInstance, HIE_tdxHandleToSuperObject hEngineInstance)
|
|
{
|
|
PO_tdxHandleToPhysicalObject hEngineObject;
|
|
EditorPO *pEdObj;
|
|
char *p_szSectionName;
|
|
char szFileName[SCR_CV_ui_Cfg_MaxLenName];
|
|
char szActionName[SCR_CV_ui_Cfg_MaxLenName];
|
|
char szName[SCR_CV_ui_Cfg_MaxLenName];
|
|
SCR_tdst_Link_Table *pLT = &PO_g_stLinkTable;
|
|
// fbolefeysot - 06/08/98
|
|
// bidouille pour morphing premiere frame{
|
|
SCR_tdst_Link_Value *p_stLinkValue;
|
|
//END fbolefeysot}
|
|
CPA_BaseObjectList *p_oPOList;
|
|
|
|
hEngineObject = (PO_tdxHandleToPhysicalObject) HIE_fn_hGetSuperObjectObject(hEngineInstance);
|
|
|
|
// look if physical object editor doesn't till exist
|
|
p_oPOList = GetMainWorld()->fn_p_oGetOriginalObjectList( C_szPhysicalObjectTypeName );
|
|
pEdObj = (EditorPO *) p_oPOList->fn_p_oFindObjectWithdData( (void *) hEngineObject );
|
|
|
|
if (pEdObj == NULL)
|
|
{
|
|
|
|
// fbolefeysot - 06/08/98
|
|
// bidouille pour morphing premiere frame{
|
|
p_stLinkValue = SCR_fnp_st_Link_SearchValue(&PO_g_stLinkTable, (unsigned long) hEngineObject);
|
|
|
|
p_szSectionName = (p_stLinkValue) ? SCR_M_p_sz_Link_GetKey(p_stLinkValue) : NULL;
|
|
//END fbolefeysot}
|
|
|
|
if (p_szSectionName == NULL)
|
|
{
|
|
pEdObj = new EditorPO(this, hEngineObject, NULL);
|
|
pEdObj->SetExistingSection( FALSE );
|
|
pEdObj->fn_p_oGetPCSSection()->SetExistingSection(FALSE);
|
|
pEdObj->fn_p_oGetVSESection()->SetExistingSection(FALSE);
|
|
}
|
|
else
|
|
{
|
|
SCR_fn_v_RdL0_SplitSectionName(p_szSectionName, szFileName, szActionName, szName);
|
|
|
|
// create object
|
|
pEdObj = new EditorPO(this, hEngineObject, NULL, szName, szFileName, szActionName);
|
|
pEdObj->SetExistingSection(TRUE);
|
|
pEdObj->fn_p_oGetPCSSection()->SetExistingSection(TRUE);
|
|
pEdObj->fn_p_oGetVSESection()->SetExistingSection(TRUE);
|
|
}
|
|
}
|
|
|
|
pEditorInstance->SetObject(pEdObj);
|
|
}
|
|
|
|
/*
|
|
----------------------------------------------------------------------------------------
|
|
Duplicate an object
|
|
----------------------------------------------------------------------------------------
|
|
*/
|
|
CPA_BaseObject * POInterface::Duplicate (CPA_BaseObject *pObject, CPA_SuperObject *pNewSupObj)
|
|
{
|
|
return NULL;
|
|
}
|
|
|
|
/*
|
|
----------------------------------------------------------------------------------------
|
|
return TRUE if given type is PO type
|
|
----------------------------------------------------------------------------------------
|
|
*/
|
|
BOOL POInterface::fn_bCanHandleThisType(long lEngineType)
|
|
{
|
|
return (lEngineType == HIE_C_ulPO);
|
|
}
|
|
|
|
/*
|
|
----------------------------------------------------------------------------------------
|
|
Add PO type name to Dialog List
|
|
----------------------------------------------------------------------------------------
|
|
*/
|
|
void POInterface::fn_vInitListByType(CPA_World *pWorld)
|
|
{
|
|
pWorld->fn_vAddANewListByType (C_szPhysicalObjectTypeName, this);
|
|
}
|
|
|
|
|
|
/*
|
|
*==============================================================================
|
|
owner methods
|
|
*==============================================================================
|
|
*/
|
|
|
|
void POInterface::fn_vUnSelect()
|
|
{
|
|
// m_p_oSelectedPO = NULL;
|
|
}
|
|
|
|
void POInterface::fn_vNameChanged()
|
|
{
|
|
//m_p_oDlgList->fn_vUpdateSelection(E_lrm_ReinitList);
|
|
}
|
|
|
|
/*
|
|
----------------------------------------------------------------------------------------
|
|
Compute bounding volume of the physical object.
|
|
----------------------------------------------------------------------------------------
|
|
*/
|
|
void POInterface::fn_vComputeBoundingVolume(CPA_BaseObject *_pObj)
|
|
{
|
|
//ANNECY TQ 22/06/98{
|
|
EditorPO *pObj = (EditorPO *) _pObj;
|
|
PO_tdxHandleToPhysicalObject hPO;
|
|
GEO_tdxHandleToVisualSet hVisSet;
|
|
GEO_tdxHandleToBoundingSphere hBound;
|
|
ACP_tdxHandleOfObject hGeom;
|
|
MTH_tdxReal xThreshold;
|
|
MTH3D_tdstVector stCenter = {0,0,0};
|
|
MTH_tdxReal xRadius = 0.0;
|
|
|
|
hPO = (PO_tdxHandleToPhysicalObject) pObj->GetEngineStruct();
|
|
|
|
if (hPO == NULL)
|
|
return;
|
|
|
|
hVisSet = PO_fn_hGetVisualSet(hPO);
|
|
|
|
hBound = PO_fn_hGetBoundingVolume(hPO);
|
|
if(hBound == NULL)
|
|
GEO_fn_vCreateBoundingSphere(&hBound);
|
|
|
|
GLI_vGetVisualSetLOD(hVisSet, 0, &xThreshold, &hGeom);
|
|
GEO_fn_vAddObjectToSphere(hGeom, &stCenter, &xRadius);
|
|
GEO_fn_vSetBoundingSphere(hBound, &stCenter, xRadius);
|
|
PO_fn_vSetBoundingVolume(hPO, hBound);
|
|
GEO_fn_vUpdateGeometricSphere(pObj->fn_hGetEditorPOBoundingVolume(), hBound);
|
|
//ENDANNECY TQ}
|
|
|
|
}
|
|
|
|
/*
|
|
----------------------------------------------------------------------------------------
|
|
return bounding volume of physical object
|
|
----------------------------------------------------------------------------------------
|
|
*/
|
|
ACP_tdxHandleOfObject POInterface::fn_hGetBoundingVolume(CPA_BaseObject *_pObj)
|
|
{
|
|
EditorPO *pObj = (EditorPO *) _pObj;
|
|
PO_tdxHandleToPhysicalObject hPO = (PO_tdxHandleToPhysicalObject) pObj->GetEngineStruct();
|
|
|
|
fn_vComputeBoundingVolume( _pObj );
|
|
//ANNECY TQ 22/06/98{
|
|
return (pObj->fn_hGetEditorPOBoundingVolume());
|
|
//ENDANNECY TQ}
|
|
|
|
}
|
|
|
|
|
|
//ROMTEAM WorldEditor (Cristian Stegaru 01/98)
|
|
|
|
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
// Method : mfn_bIsACandidateEPO
|
|
// Date : 98-01
|
|
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
// Description :
|
|
// Author : Cristian Stegaru - CPA2
|
|
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
// Modification :
|
|
// Date :
|
|
// By :
|
|
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
BOOL POInterface::mfn_bIsACandidateEPO (const CString csName)
|
|
{
|
|
// look in m_lstOfCandidateEPO (that is loaded in fn_vBeforeEditor)
|
|
if (!m_bEPOListOK)
|
|
{
|
|
m_bEPOListOK = TRUE;
|
|
mfn_vFillListOfCandidateEPO ();
|
|
}
|
|
|
|
POSITION pos = m_lstNameOfCandidateEPO.GetHeadPosition ();
|
|
while (NULL != pos)
|
|
{
|
|
CString csCandidateName = m_lstNameOfCandidateEPO.GetNext (pos);
|
|
if (csName == csCandidateName)
|
|
return TRUE;
|
|
}
|
|
return FALSE;
|
|
}
|
|
|
|
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
// Method : mfn_iGetEPOIdx
|
|
// Date : 98-01
|
|
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
// Description :
|
|
// Author : Cristian Stegaru - CPA2
|
|
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
// Modification :
|
|
// Date :
|
|
// By :
|
|
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
int POInterface::mfn_iGetEPOIdx (CString csEPOName)
|
|
{
|
|
char szIdx [NB_LENGTH];
|
|
ASSERT (!m_csEPOFile.IsEmpty ());
|
|
if (GetPrivateProfileString (csEPOName, "IDX", NULL, szIdx, NB_LENGTH, m_csEPOFile))
|
|
{
|
|
int iIdx = atoi (szIdx);
|
|
return iIdx;
|
|
}
|
|
|
|
return -2;
|
|
}
|
|
|
|
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
// Method : mfn_vFillListOfCandidateEPO
|
|
// Date : 98-01
|
|
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
// Description :
|
|
// Author : Cristian Stegaru - CPA2
|
|
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
// Modification :
|
|
// Date :
|
|
// By :
|
|
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
void POInterface::mfn_vFillListOfCandidateEPO ()
|
|
{
|
|
char szCnt [NB_LENGTH], szEPOName [STR_LENGTH];
|
|
HINSTANCE hOldInst = AfxGetResourceHandle();
|
|
AfxSetResourceHandle (GetDLLIdentity()->hModule);
|
|
//compute the epo filename
|
|
//CPA2 Stegaru Cristian 98-04
|
|
CString csLevelsPath = fn_szGetLevelsDataPath (), csEPOFile;
|
|
///
|
|
char szBasePath [_MAX_PATH];
|
|
GetModuleFileName (NULL, szBasePath, _MAX_PATH);
|
|
CString csBasePath (szBasePath);
|
|
int iInx = csBasePath.ReverseFind ('\\');
|
|
ASSERT (-1 != iInx);
|
|
csBasePath = csBasePath.Left (iInx + 1);
|
|
//
|
|
csEPOFile = fn_p_szGetLevelName ();
|
|
csEPOFile = "\\" + csEPOFile + "\\" + csEPOFile + ".geo";
|
|
m_csEPOFile = csBasePath + csLevelsPath + csEPOFile;
|
|
//End CPA2 Stegaru Cristian 98-04
|
|
|
|
CString csMainSection;
|
|
csMainSection.LoadString (IDS_MAINSECTION);
|
|
|
|
int iCnt = 0;
|
|
itoa (iCnt++, szCnt, 10);
|
|
while (GetPrivateProfileString (csMainSection, szCnt, NULL, szEPOName, STR_LENGTH, m_csEPOFile))
|
|
{
|
|
CString csEPOName (szEPOName);
|
|
csEPOName.TrimRight ();
|
|
if ("##" != csEPOName)
|
|
m_lstNameOfCandidateEPO.AddTail (csEPOName);
|
|
itoa (iCnt++, szCnt, 10);
|
|
}
|
|
AfxSetResourceHandle(hOldInst);
|
|
}
|
|
|
|
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
// Method : fn_vBeforeSaveAll
|
|
// Date : 98-01
|
|
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
// Description :
|
|
// Author : Cristian Stegaru - CPA2
|
|
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
// Modification :
|
|
// Date :
|
|
// By :
|
|
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
void POInterface::fn_vBeforeSaveAll (void)
|
|
{
|
|
//save the info concerning the candidate EPO
|
|
HINSTANCE hOldInst = AfxGetResourceHandle();
|
|
AfxSetResourceHandle (GetDLLIdentity()->hModule);
|
|
CString csMainSection;
|
|
csMainSection.LoadString (IDS_MAINSECTION);
|
|
|
|
int iCnt = 0;
|
|
char szCnt[10];
|
|
POSITION pos = m_lstOfCandidateEPO.GetHeadPosition ();
|
|
while (NULL != pos)
|
|
{
|
|
EditorPO *pEPO = m_lstOfCandidateEPO.GetNext (pos);
|
|
ASSERT (pEPO);
|
|
BOOL bEPOHasAGeomObj = pEPO->mfn_bIsClone () && (NULL != pEPO->m_pGeom) && (pEPO->m_iIdx >= 0);
|
|
if (bEPOHasAGeomObj)
|
|
{
|
|
itoa (iCnt++, szCnt, 10);
|
|
WritePrivateProfileString (csMainSection, szCnt, pEPO->GetName (), m_csEPOFile);
|
|
((Shape3D*)pEPO->m_pGeom)->mfn_vSave (m_csEPOFile, pEPO->GetName (), pEPO->m_iIdx);
|
|
}
|
|
else if (mfn_bIsACandidateEPO (pEPO->GetName ())) //was loaded as a geometric object
|
|
{
|
|
itoa (iCnt++, szCnt, 10);
|
|
WritePrivateProfileString (csMainSection, szCnt, "##", m_csEPOFile);
|
|
}
|
|
}
|
|
AfxSetResourceHandle(hOldInst);
|
|
}
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
// Method : mfn_pGetGeomObjFromEPOName
|
|
// Date : 98-01
|
|
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
// Description :
|
|
// Author : Cristian Stegaru - CPA2
|
|
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
// Modification :
|
|
// Date :
|
|
// By :
|
|
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
Shape3D* POInterface::mfn_pGetGeomObjFromEPOName (CString csEPOName)
|
|
{
|
|
//geom obj stuff
|
|
ASSERT (!m_csEPOFile.IsEmpty ());
|
|
int iIdx = mfn_iGetEPOIdx (csEPOName);
|
|
CPA_ObjectDLLBase *p_oOGDDll = GetMainWorld()->GetObjectDLLWithName (C_szDLLGeometryName);
|
|
ASSERT (p_oOGDDll);
|
|
char szGeomObjName [STR_LENGTH];
|
|
GetPrivateProfileString (csEPOName, "NAME", NULL, szGeomObjName, STR_LENGTH, m_csEPOFile);
|
|
p_oOGDDll->OnQueryAction (this, C_uiSetName, (long)szGeomObjName);
|
|
//CPA2 Stegaru Cristian 98-04
|
|
// QueryActionParam *param = (QueryActionParam *)p_oOGDDll->OnQueryAction (this, C_uiCreateObject, iIdx);
|
|
QueryActionParam *param = (QueryActionParam *)p_oOGDDll->OnQueryAction (this, C_uiCreateCloneObject, iIdx);
|
|
//End CPA2 Stegaru Cristian 98-04
|
|
Shape3D *pGO = (Shape3D*)param->m_p3DObject;
|
|
ASSERT (pGO);
|
|
//assume there is a section from a previous save
|
|
pGO->SetExistingSection (TRUE);
|
|
delete param;
|
|
pGO->mfn_vLoad (m_csEPOFile, csEPOName);
|
|
|
|
return pGO;
|
|
}
|
|
|
|
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
// Method : mfn_hGethPOFromGeomObj
|
|
// Date : 98-01
|
|
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
// Description :
|
|
// Author : Cristian Stegaru - CPA2
|
|
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
// Modification :
|
|
// Date :
|
|
// By :
|
|
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
PO_tdxHandleToPhysicalObject POInterface::mfn_hGethPOFromGeomObj (Geometry3D *pG3D)
|
|
{
|
|
ASSERT (pG3D);
|
|
PO_tdxHandleToPhysicalObject hPO = new PO_tdstPhysicalObject_;
|
|
ASSERT (hPO);
|
|
hPO->_hCollideSet = NULL;
|
|
hPO->_hBoundingVolume = NULL;
|
|
struct GEO_tdstVisualSet_ *hVS = hPO->_hVisualSet = new struct GEO_tdstVisualSet_;
|
|
hVS->xLastDistance = 100000; ///hysteresys. Works with only one viewport.
|
|
hVS->xNbLodDefinitions = 1;
|
|
hVS->d_xThresholdsTable = new MTH_tdxReal;
|
|
*hVS->d_xThresholdsTable = 1e20f;
|
|
hVS->d_p_stLodDefinitions = new (struct GEO_tdstGeometricObject_*);
|
|
*hVS->d_p_stLodDefinitions = pG3D->GetStruct();
|
|
|
|
return hPO;
|
|
}
|
|
|
|
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
// Method : mfn_pGetEPOwithGeomObjAttached
|
|
// Date : 98-01
|
|
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
// Description :
|
|
// Author : Cristian Stegaru - CPA2
|
|
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
// Modification :
|
|
// Date :
|
|
// By :
|
|
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
EditorPO * POInterface::mfn_pGetEPOwithGeomObjAttached (PO_tdxHandleToPhysicalObject hPO, CPA_BaseObject * pOwner, char * szSection)
|
|
{
|
|
char szFileName[SCR_CV_ui_Cfg_MaxLenName];
|
|
char szActionName[SCR_CV_ui_Cfg_MaxLenName];
|
|
char szName[SCR_CV_ui_Cfg_MaxLenName];
|
|
ASSERT (szSection);
|
|
SCR_fn_v_RdL0_SplitSectionName(szSection, szFileName, szActionName, szName);
|
|
|
|
ASSERT (mfn_bIsACandidateEPO (szName)); //call this function only for candidate EPO
|
|
Shape3D *pGO = NULL;
|
|
pGO = mfn_pGetGeomObjFromEPOName (szName);
|
|
ASSERT (pGO);
|
|
if (hPO)
|
|
{
|
|
GMT_tdxHandleToGameMaterial hMaterial;
|
|
GEO_vGetGameMaterialOfIndexedTriangles (*hPO->_hVisualSet->d_p_stLodDefinitions, 0, &hMaterial);
|
|
|
|
struct GEO_tdstVisualSet_ *hVS = hPO->_hVisualSet;
|
|
*hVS->d_p_stLodDefinitions = pGO->GetStruct();
|
|
GEO_vSetGameMaterialOfIndexedTriangles (pGO->GetStruct(), 0, hMaterial);
|
|
}
|
|
else
|
|
{
|
|
hPO = mfn_hGethPOFromGeomObj (pGO);
|
|
}
|
|
|
|
EditorPO *p_oEditPO = new EditorPO(this, hPO, pOwner, szName, szFileName, szActionName);
|
|
|
|
ASSERT (p_oEditPO);
|
|
p_oEditPO->SetZone(3, pGO, FALSE);
|
|
p_oEditPO->m_iIdx = mfn_iGetEPOIdx (szName);
|
|
p_oEditPO->mfn_vSetClone (TRUE);
|
|
p_oEditPO->SetExistingSection (TRUE);
|
|
p_oEditPO->SetAvailable( TRUE );
|
|
p_oEditPO->fn_vNotifySave ();
|
|
m_lstOfCandidateEPO.AddTail (p_oEditPO);
|
|
|
|
return p_oEditPO;
|
|
}
|
|
|
|
//ENDROMTEAM WorldEditor (Cristian Stegaru)
|
|
|
|
#endif // ACTIVE_EDITOR
|