Skip to content

Commit 7c13acf

Browse files
committed
* FIX:[LE] ShapeTool
1 parent 390966f commit 7c13acf

File tree

5 files changed

+44
-8
lines changed

5 files changed

+44
-8
lines changed

Source/Editors/LevelEditor/Edit/ESceneShapeTools.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ void ESceneShapeTool::CreateControls()
1212
inherited::CreateDefaultControls(estDefault);
1313
AddControl (xr_new<TUI_ControlShapeAdd>(estDefault,etaAdd, this));
1414
pForm = xr_new< UIShapeTool>();
15+
((UIShapeTool*)pForm)->Tool = this;
1516
}
1617
//----------------------------------------------------
1718

@@ -81,11 +82,11 @@ void ESceneShapeTool::OnEditLevelBounds(bool recalc)
8182
void ESceneShapeTool::OnActivate()
8283
{
8384
inherited::OnActivate();
84-
//((TfraShape*)pFrame)->ebEditLevelBoundMode->Down = false;
85+
((UIShapeTool*)pForm)->EditLevelBound = false;
8586
}
8687

8788
void ESceneShapeTool::OnDeactivate()
8889
{
8990
inherited::OnDeactivate();
90-
//((TfraShape*)pFrame)->ebEditLevelBoundMode->Down = false;
91+
((UIShapeTool*)pForm)->EditLevelBound = false;
9192
}

Source/Editors/LevelEditor/Edit/EShape.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
#include "EShape.h"
66
#include "du_box.h"
77
#include "Scene.h"
8-
8+
#include "UI\Tools\UIShapeTool.h"
99
#define SHAPE_COLOR_TRANSP 0x3C808080
1010
#define SHAPE_COLOR_EDGE 0xFF202020
1111

@@ -469,10 +469,9 @@ void CEditShape::OnFrame()
469469
inherited::OnFrame();
470470
if(m_shape_type==eShapeLevelBound)
471471
{
472-
R_ASSERT(!"Ñîðÿí çàáûë ðåëèçîâàòü");
473-
/* TfraShape* F = (TfraShape*)ParentTool->pFrame;
474-
BOOL bVis = F->ebEditLevelBoundMode->Down;
475-
m_RT_Flags.set(flRT_Visible, bVis);*/
472+
UIShapeTool* F = (UIShapeTool*)FParentTools->pForm;
473+
BOOL bVis = F->EditLevelBound;
474+
m_RT_Flags.set(flRT_Visible, bVis);
476475
}
477476
}
478477

Source/Editors/LevelEditor/Edit/LevelPreferences.cpp

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,20 @@
77
#include "scene.h"
88
#include "ui_levelmain.h"
99
#include "ui_leveltools.h"
10+
#include "UI\UIObjectList.h"
1011
//---------------------------------------------------------------------------
1112

1213
void CLevelPreferences::Load(CInifile* I)
1314
{
14-
inherited::Load (I);
15+
inherited::Load (I);
16+
{
17+
OpenObjectList = R_BOOL_SAFE("windows", "object_list", false);
18+
19+
}
20+
{
21+
OpenProperties = R_BOOL_SAFE("windows", "properties", true);
22+
23+
}
1524
SceneToolsMapPairIt _I = Scene->FirstTool();
1625
SceneToolsMapPairIt _E = Scene->LastTool();
1726
for (; _I!=_E; _I++)
@@ -22,6 +31,8 @@ void CLevelPreferences::Load(CInifile* I)
2231
void CLevelPreferences::Save(CInifile* I)
2332
{
2433
inherited::Save (I);
34+
I->w_bool("windows", "object_list", OpenObjectList);
35+
I->w_bool("windows", "properties", OpenProperties);
2536
SceneToolsMapPairIt _I = Scene->FirstTool();
2637
SceneToolsMapPairIt _E = Scene->LastTool();
2738
for (; _I!=_E; _I++)

Source/Editors/LevelEditor/UI/Tools/UIShapeTool.cpp

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
#include "stdafx.h"
22
#include "UIShapeTool.h"
33
#include "EShape.h"
4+
#include "ESceneShapeTools.h"
45
UIShapeTool::UIShapeTool()
56
{
7+
Tool = nullptr;
68
m_AttachShape = false;
79
}
810

@@ -55,4 +57,24 @@ void UIShapeTool::Draw()
5557
ImGui::Indent(ImGui::GetTreeNodeToLabelSpacing());
5658
ImGui::TreePop();
5759
}
60+
ImGui::SetNextItemOpen(true, ImGuiCond_FirstUseEver);
61+
if (ImGui::TreeNode("Level Bound"))
62+
{
63+
ImGui::Unindent(ImGui::GetTreeNodeToLabelSpacing());
64+
{
65+
if (ImGui::Checkbox("Edit Level Bound", &EditLevelBound))
66+
{
67+
if (EditLevelBound)
68+
Tool->OnEditLevelBounds(false);
69+
}
70+
if(EditLevelBound)
71+
if (ImGui::Button("Recalc", ImVec2(-1, 0)))
72+
{
73+
Tool->OnEditLevelBounds(true);
74+
}
75+
}
76+
ImGui::Separator();
77+
ImGui::Indent(ImGui::GetTreeNodeToLabelSpacing());
78+
ImGui::TreePop();
79+
}
5880
}

Source/Editors/LevelEditor/UI/Tools/UIShapeTool.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
#pragma once
2+
class ESceneShapeTool;
23
class UIShapeTool :public UIToolCustom
34
{
45
public:
6+
ESceneShapeTool* Tool;
57
UIShapeTool();
68
virtual ~UIShapeTool();
79
virtual void Draw();
810
IC bool IsAttachShape()const { return m_AttachShape; }
911
IC bool IsSphereMode()const { return m_SphereMode; }
12+
bool EditLevelBound;
1013
IC void SetSphereMode(bool mode) { m_SphereMode = mode; }
1114
IC void SetAttachShape(bool mode) { m_AttachShape = mode; }
1215
private:

0 commit comments

Comments
 (0)