mirror of
https://github.com/dhewm/dhewm3.git
synced 2024-11-26 22:31:17 +00:00
Fix Light Editor in Radiant (#456)
When selecting a light in the Radiant (builtin Windows-only level editor)
and pressing `j`, the light editor opened (as expected) but said that
no entity was selected.
That was because com_editorActive was false, most probably because of
e8a1eb8b
Fix mouse remaining ungrabbed when running map from Radiant
which sets com_editorActive to false (via com->ActivateTool(false)) if
the Radiant window loses focus, which should be the case when opening
the light editor window.
`com_editors & EDITOR_RADIANT` is != 0 as long as the radiant is
running, no matter which window currently has focus, so it works better.
This commit is contained in:
parent
6dfada9af0
commit
a2929d9062
1 changed files with 10 additions and 5 deletions
|
@ -40,6 +40,11 @@ If you have questions concerning this license or the applicable additional terms
|
|||
#define DEBUG_NEW new
|
||||
#endif
|
||||
|
||||
// returns true if light editor has been opened in D3Radiant,
|
||||
// false if it has been opened from within a running game
|
||||
static bool InRadiant() {
|
||||
return (com_editors & EDITOR_RADIANT) != 0;
|
||||
}
|
||||
|
||||
void CLightInfo::Defaults() {
|
||||
pointLight = true;
|
||||
|
@ -327,7 +332,7 @@ void CLightDlg::DoDataExchange(CDataExchange* pDX)
|
|||
{
|
||||
CDialog::DoDataExchange(pDX);
|
||||
//{{AFX_DATA_MAP(CLightDlg)
|
||||
if ( com_editorActive ) {
|
||||
if ( InRadiant() ) {
|
||||
DDX_Control(pDX, IDC_LIGHTPREVIEW, m_wndPreview);
|
||||
}
|
||||
DDX_Control(pDX, IDC_COMBO_TEXTURE, m_wndLights);
|
||||
|
@ -571,7 +576,7 @@ void CLightDlg::UpdateLightInfoFromDialog( void ) {
|
|||
|
||||
void CLightDlg::SaveLightInfo( const idDict *differences ) {
|
||||
|
||||
if ( com_editorActive ) {
|
||||
if ( InRadiant() ) {
|
||||
|
||||
// used from Radiant
|
||||
for ( brush_t *b = selected_brushes.next; b && b != &selected_brushes; b = b->next ) {
|
||||
|
@ -654,7 +659,7 @@ BOOL CLightDlg::OnInitDialog()
|
|||
|
||||
LoadLightTextures();
|
||||
|
||||
if ( com_editorActive ) {
|
||||
if ( InRadiant() ) {
|
||||
m_wndPreview.setDrawable(m_drawMaterial);
|
||||
}
|
||||
|
||||
|
@ -729,7 +734,7 @@ void CLightDlg::UpdateDialog( bool updateChecks )
|
|||
lightInfo.Defaults();
|
||||
lightInfoOriginal.Defaults ();
|
||||
|
||||
if ( com_editorActive ) {
|
||||
if ( InRadiant() ) {
|
||||
// used from Radiant
|
||||
entity_t *e = SingleLightSelected();
|
||||
if ( e ) {
|
||||
|
@ -902,7 +907,7 @@ void CLightDlg::OnSelchangeComboTexture()
|
|||
if (sel >= 0) {
|
||||
m_wndLights.GetLBText(sel, str);
|
||||
m_drawMaterial->setMedia(str);
|
||||
if ( com_editorActive ) {
|
||||
if ( InRadiant() ) {
|
||||
m_wndPreview.RedrawWindow();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue