📄 brushattributesdialog.cpp
字号:
m_Wavy = FALSE ;
m_Area = FALSE ;
break ;
case IDRB_CLIP :
case IDRB_HINT :
case IDRB_SUBTRACT :
GetDlgItem( IDC_BRUSHTRANSLUCENT )->EnableWindow( FALSE ) ;
GetDlgItem( IDC_BRUSHDETAIL )->EnableWindow( FALSE ) ;
GetDlgItem( IDC_BRUSHWAVY )->EnableWindow( FALSE ) ;
GetDlgItem( IDC_BRUSHAREA )->EnableWindow( FALSE ) ;
GetDlgItem( IDC_BRUSHSHEET )->EnableWindow( FALSE );
m_Detail = FALSE ;
m_Wavy = FALSE ;
m_Area = FALSE ;
m_Translucent = FALSE ;
break ;
}
int NumBrushes = SelBrushList_GetSize (m_pDoc->pSelBrushes);
for (int i = 0; i < NumBrushes; ++i)
{
Brush *pBrush = SelBrushList_GetBrush (m_pDoc->pSelBrushes, i);
switch( m_BrushType )
{
case IDRB_EMPTY :
Brush_SetArea (pBrush, GE_FALSE);
break ;
case IDRB_SOLID :
Brush_SetTranslucent (pBrush, GE_FALSE);
Brush_SetWavy (pBrush, GE_FALSE);
// Brush_SetArea (pBrush, GE_FALSE);
break ;
case IDRB_WINDOW :
Brush_SetWavy (pBrush, GE_FALSE);
Brush_SetArea (pBrush, GE_FALSE);
Brush_SetTranslucent (pBrush, GE_TRUE);
Brush_SetDetail (pBrush, GE_TRUE);
Brush_SetSheet (pBrush, GE_FALSE);
break ;
case IDRB_CLIP :
case IDRB_HINT :
case IDRB_SUBTRACT :
Brush_SetTranslucent (pBrush, GE_FALSE);
Brush_SetDetail (pBrush, GE_FALSE);
Brush_SetWavy (pBrush, GE_FALSE);
Brush_SetArea (pBrush, GE_FALSE);
Brush_SetSheet (pBrush, GE_FALSE);
break ;
}
}
}
EnableTranslucency ();
EnableHullsize ();
}
void CBrushAttributesDialog::AssignCurrentToValues()
{
m_pDoc = CGlobals::GetActiveDocument();
if (ThisDocIsValid(m_pDoc)) // post 0.57
{
char const *pName;
int NumBrushes = SelBrushList_GetSize (m_pDoc->pSelBrushes);
int i;
// update user flags
unsigned long UserFlags = 0;
for (i = 0; i < m_ContentsList.GetCount (); ++i)
{
if (m_ContentsList.GetCheck (i) == 1)
{
unsigned long Value;
Value = m_ContentsList.GetItemData (i);
UserFlags |= Value;
}
}
for (i = 0; i < NumBrushes; ++i)
{
Brush *pBrush = SelBrushList_GetBrush (m_pDoc->pSelBrushes, i);
pName = Brush_GetName (pBrush);
// Flags for the Types (RB's) are always up to date.
if( strcmp( pName, m_Name ) )
{
Brush_SetName (pBrush, m_Name);
}
// Turn on any chosen flags
Brush_SetDetail (pBrush, m_Detail);
Brush_SetWavy (pBrush, m_Wavy);
Brush_SetArea (pBrush, m_Area);
Brush_SetTranslucent (pBrush, m_Translucent);
Brush_SetFlocking (pBrush, m_Flocking);
Brush_SetSheet (pBrush, m_Sheet);
if (m_Hollow) // g3dc
{
Brush_SetHullSize (pBrush, m_HullSize);
}
Brush_SetUserFlags (pBrush, UserFlags);
Brush_UpdateChildFaces(pBrush);
}
m_pDoc->SetModifiedFlag( ) ;
}
}
void CBrushAttributesDialog::AssignCurrentToViews()
{
m_pDoc = CGlobals::GetActiveDocument();
if (ThisDocIsValid(m_pDoc)) // post 0.57
{
// Be very careful when speccing flags for UpdateAllViews()
// The wrong flags at the wrong time will totally screw things up
m_pDoc->UpdateAllViews(UAV_ALL3DVIEWS | REBUILD_QUICK, NULL); // does update ortho views
// m_pDoc->UpdateAllViews(UAV_ALL3DVIEWS, NULL); // won't update orthoviews
}
}
void CBrushAttributesDialog::SetDialogFields (void)
{
m_pDoc = CGlobals::GetActiveDocument();
if (ThisDocIsValid(m_pDoc)) // post 0.57
{
Brush *pBrush = SelBrushList_GetBrush (m_pDoc->pSelBrushes, 0);
if (pBrush != NULL)
{
m_Wavy =Brush_IsWavy (pBrush) ? TRUE : FALSE ;
m_Area =Brush_IsArea (pBrush) ? TRUE : FALSE ;
m_Translucent =Brush_IsTranslucent(pBrush) ? TRUE : FALSE ;
m_Detail =Brush_IsDetail (pBrush) ? TRUE : FALSE ;
m_Hollow =Brush_IsHollow (pBrush) ? TRUE : FALSE ;
m_Flocking =Brush_IsFlocking (pBrush) ? TRUE : FALSE ;
m_Sheet =Brush_IsSheet (pBrush) ? TRUE : FALSE ;
m_Name =(CString)Brush_GetName (pBrush);
m_HullSize =Brush_GetHullSize (pBrush);
if (m_HullSize < 1.0f)
{
m_HullSize = 1.0f;
}
BrushColor =Brush_GetColor (pBrush);
m_BrushType = BrushFlagsToIndex( ) ;
SetFlagsToBrushType() ;
BrushOptionsFromType () ;
// set user contents flags...
if(m_ContentsList) // post 0.57
m_ContentsList.ResetContent ();
/* unsigned long UserFlags = Brush_GetUserFlags (pBrush);
ContentsTable *ContentsList = EntityTable_GetContentsList (Level_GetEntityDefs (m_pDoc->pLevel));
for (int i = 0; i < ContentsList->nEntries; ++i)
{
int Index;
ContentsTableEntry *pEntry;
pEntry = &(ContentsList->Entries[i]);
Index = m_ContentsList.AddString (pEntry->Name);
if (Index != LB_ERR)
{
m_ContentsList.SetItemData (Index, pEntry->Value);
m_ContentsList.SetCheck (Index, (UserFlags & pEntry->Value) ? 1 : 0);
}
}
EntityTable_FreeContentsList (&ContentsList);
*/
EnableTranslucency ();
EnableHullsize ();
}
}
}
void CBrushAttributesDialog::PostNcDestroy()
{
m_pDoc = CGlobals::GetActiveDocument();
if (m_pDoc) // Don't use ThisDocIsValid() here
{
;;
}
// delete this;
}
// Make it possible for the document to update the attributes
// in the dialog when we switch focus to a new current brush...
void CBrushAttributesDialog::UpdateBrushFocus ()
{
// SetDialogFields ();
UpdateData(FALSE); // Update dialog from members
}
void CBrushAttributesDialog::OnKillfocusName()
{
CString lastValue = m_Name;
CString currentValue;
GetDlgItemText(IDC_NAME, currentValue);
if (currentValue == "")
{
this->SetDlgItemText(IDC_NAME, lastValue);
return;
}
}
// this just prevents an endless loop requesting data if
// the user blanks this edit box
void CBrushAttributesDialog::OnKillfocusHullsize()
{
int lastValue = m_HullSize;
if (GetDlgItemInt(IDC_HULLSIZE) == NULL)
{
this->SetDlgItemInt(IDC_HULLSIZE, lastValue);
return;
}
}
/*
void CBrushAttributesDialog::OnCancel()
{
m_pDoc = CGlobals::GetActiveDocument();
if (m_pDoc != NULL)
{
m_pDoc->mpBrushAttributes = NULL;
}
// DestroyWindow();
}
*/
void CBrushAttributesDialog::OnCancel()
{
return;
}
void CBrushAttributesDialog::OnApply()
{
m_pDoc = CGlobals::GetActiveDocument();
if (m_pDoc) // post 0.57
{
if (UpdateData(TRUE))
{
AssignCurrentToValues();
AssignCurrentToViews();
// post 0.57 for putting 'Rebuild' button on Texture view
if(!Level_RebuildBspAlways(m_pDoc->pLevel))
{
m_pDoc->mpMainFrame->SendMessageToDescendants(WM_COMMAND, IDC_BTN_REBUILD_COMMAND);
CGlobals::g_iRebuildClickCount = 0;
}
if (m_pDoc->mpMainFrame) // post 0.57
m_pDoc->mpMainFrame->UpdateMainControls();
// DestroyWindow();
}
}
}
void CBrushAttributesDialog::OnBrushsolid()
{
OnRadioButton() ;
}
void CBrushAttributesDialog::OnBrushclip()
{
OnRadioButton() ;
}
void CBrushAttributesDialog::OnBrushwindow()
{
OnRadioButton() ;
}
void CBrushAttributesDialog::OnBrushhint()
{
OnRadioButton() ;
}
void CBrushAttributesDialog::OnBrushsubtract()
{
OnRadioButton() ;
}
void CBrushAttributesDialog::OnBrushempty()
{
OnRadioButton ();
}
void CBrushAttributesDialog::OnRadioButton( void )
{
int OldBrushType ;
OldBrushType = m_BrushType ;
UpdateData(TRUE);
if( OldBrushType == IDRB_WINDOW )
{
m_Detail = FALSE ;
}
BrushOptionsFromType( ) ;
UpdateData(FALSE);
}
void CBrushAttributesDialog::OnBrushtranslucent()
{
m_Translucent = !m_Translucent;
EnableTranslucency ();
}
void CBrushAttributesDialog::OnBrushhollow()
{
m_Hollow = !m_Hollow;
EnableHullsize ();
}
void CBrushAttributesDialog::OnBrushflocking()
{
m_Flocking = !m_Flocking;
}
void CBrushAttributesDialog::OnBrushsheet()
{
m_Sheet = !m_Sheet;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -