1 /* Copyright (C) 2015 Wildfire Games.
2 * This file is part of 0 A.D.
4 * 0 A.D. is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 2 of the License, or
7 * (at your option) any later version.
9 * 0 A.D. is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with 0 A.D. If not, see <http://www.gnu.org/licenses/>.
18 #include "precompiled.h"
22 #include "Buttons/ToolButton.h"
23 #include "General/Datafile.h"
24 #include "ScenarioEditor/ScenarioEditor.h"
25 #include "ScenarioEditor/Tools/Common/ObjectSettings.h"
26 #include "ScenarioEditor/Tools/Common/MiscState.h"
27 #include "VariationControl.h"
29 #include "GameInterface/Messages.h"
31 #include "wx/busyinfo.h"
55 // Helper function for adding tooltips
56 static wxWindow
* Tooltipped(wxWindow
* window
, const wxString
& tip
)
58 window
->SetToolTip(tip
);
62 class ObjectBottomBar
: public wxPanel
67 Observable
<ObjectSettings
>& objectSettings
,
68 Observable
<AtObj
>& mapSettings
,
72 void OnFirstDisplay();
73 void ShowActorViewer(bool show
);
74 void OnSelectedObjectsChange(const std::vector
<AtlasMessage::ObjectID
>& selectedObjects
);
77 void OnViewerSetting(wxCommandEvent
& evt
);
78 void OnSelectAnim(wxCommandEvent
& evt
);
79 void OnSpeed(wxCommandEvent
& evt
);
81 bool m_ViewerWireframe
;
86 bool m_ViewerPolyCount
;
87 bool m_ViewerBoundingBox
;
88 bool m_ViewerAxesMarker
;
89 int m_ViewerPropPointsMode
; // 0 disabled, 1 for point markers, 2 for point markers + axes
91 wxPanel
* m_ViewerPanel
;
92 wxScrolledWindow
* m_TemplateNames
;
95 DECLARE_EVENT_TABLE();
98 struct ObjectSidebarImpl
100 ObjectSidebarImpl(ScenarioEditor
& scenarioEditor
) :
101 m_ObjectListBox(NULL
), m_ActorViewerActive(false),
102 m_ActorViewerEntity(_T("actor|structures/fndn_1x1.xml")),
103 m_ActorViewerAnimation(_T("idle")), m_ActorViewerSpeed(0.f
),
104 m_ObjectSettings(scenarioEditor
.GetObjectSettings())
108 wxListBox
* m_ObjectListBox
;
109 std::vector
<AtlasMessage::sObjectsListItem
> m_Objects
;
110 ObservableScopedConnection m_ToolConn
;
112 bool m_ActorViewerActive
;
113 wxString m_ActorViewerEntity
;
114 wxString m_ActorViewerAnimation
;
115 float m_ActorViewerSpeed
;
116 Observable
<ObjectSettings
>& m_ObjectSettings
;
118 void ActorViewerPostToGame()
120 POST_MESSAGE(SetActorViewer
, ((std::wstring
)m_ActorViewerEntity
.wc_str(), (std::wstring
)m_ActorViewerAnimation
.wc_str(), m_ObjectSettings
.GetPlayerID(), m_ActorViewerSpeed
, false));
124 ObjectSidebar::ObjectSidebar(
125 ScenarioEditor
& scenarioEditor
,
126 wxWindow
* sidebarContainer
,
127 wxWindow
* bottomBarContainer
129 : Sidebar(scenarioEditor
, sidebarContainer
, bottomBarContainer
),
130 p(new ObjectSidebarImpl(scenarioEditor
))
132 wxBoxSizer
* sizer
= new wxBoxSizer(wxHORIZONTAL
);
133 sizer
->Add(new wxStaticText(this, wxID_ANY
, _("Filter")), wxSizerFlags().Align(wxALIGN_CENTER
));
136 new wxTextCtrl(this, ID_ObjectFilter
),
137 _("Enter text to filter object list")
139 wxSizerFlags().Expand().Proportion(1)
141 m_MainSizer
->Add(sizer
, wxSizerFlags().Expand());
142 m_MainSizer
->AddSpacer(3);
144 // ------------------------------------------------------------------------------------------
146 wxArrayString strings
;
147 strings
.Add(_("Entities"));
148 strings
.Add(_("Actors (all)"));
149 wxChoice
* objectType
= new wxChoice(this, ID_ObjectType
, wxDefaultPosition
, wxDefaultSize
, strings
);
150 objectType
->SetSelection(0);
151 m_MainSizer
->Add(objectType
, wxSizerFlags().Expand());
152 m_MainSizer
->AddSpacer(3);
154 // ------------------------------------------------------------------------------------------
156 p
->m_ObjectListBox
= new wxListBox(this, ID_SelectObject
, wxDefaultPosition
, wxDefaultSize
, 0, NULL
, wxLB_SINGLE
|wxLB_HSCROLL
);
157 m_MainSizer
->Add(p
->m_ObjectListBox
, wxSizerFlags().Proportion(1).Expand());
158 m_MainSizer
->AddSpacer(3);
160 // ------------------------------------------------------------------------------------------
162 m_MainSizer
->Add(new wxButton(this, ID_ToggleViewer
, _("Switch to Actor Viewer")), wxSizerFlags().Expand());
164 // ------------------------------------------------------------------------------------------
166 m_BottomBar
= new ObjectBottomBar(
168 scenarioEditor
.GetObjectSettings(),
169 scenarioEditor
.GetMapSettings(),
173 p
->m_ToolConn
= scenarioEditor
.GetToolManager().GetCurrentTool().RegisterObserver(0, &ObjectSidebar::OnToolChange
, this);
176 ObjectSidebar::~ObjectSidebar()
181 void ObjectSidebar::OnToolChange(ITool
* tool
)
183 if (wxString(tool
->GetClassInfo()->GetClassName()) == _T("ActorViewerTool"))
185 p
->m_ActorViewerActive
= true;
186 p
->ActorViewerPostToGame();
187 wxDynamicCast(FindWindow(ID_ToggleViewer
), wxButton
)->SetLabel(_("Return to game view"));
191 p
->m_ActorViewerActive
= false;
192 wxDynamicCast(FindWindow(ID_ToggleViewer
), wxButton
)->SetLabel(_("Switch to Actor Viewer"));
195 static_cast<ObjectBottomBar
*>(m_BottomBar
)->ShowActorViewer(p
->m_ActorViewerActive
);
198 void ObjectSidebar::OnFirstDisplay()
200 static_cast<ObjectBottomBar
*>(m_BottomBar
)->OnFirstDisplay();
202 wxBusyInfo
busy (_("Loading list of objects"));
204 // Get the list of objects from the game
205 AtlasMessage::qGetObjectsList qry
;
207 p
->m_Objects
= *qry
.objects
;
208 // Display first group of objects
212 void ObjectSidebar::FilterObjects()
214 int filterType
= wxDynamicCast(FindWindow(ID_ObjectType
), wxChoice
)->GetSelection();
215 wxString filterName
= wxDynamicCast(FindWindow(ID_ObjectFilter
), wxTextCtrl
)->GetValue();
217 p
->m_ObjectListBox
->Freeze();
218 p
->m_ObjectListBox
->Clear();
219 for (std::vector
<AtlasMessage::sObjectsListItem
>::iterator it
= p
->m_Objects
.begin(); it
!= p
->m_Objects
.end(); ++it
)
221 if (it
->type
== filterType
)
223 wxString id
= it
->id
.c_str();
224 wxString name
= it
->name
.c_str();
226 if (name
.Lower().Find(filterName
.Lower()) != wxNOT_FOUND
)
228 p
->m_ObjectListBox
->Append(name
, new wxStringClientData(id
));
232 p
->m_ObjectListBox
->Thaw();
235 void ObjectSidebar::OnToggleViewer(wxCommandEvent
& WXUNUSED(evt
))
237 if (p
->m_ActorViewerActive
)
239 m_ScenarioEditor
.GetToolManager().SetCurrentTool(_T(""), NULL
);
243 m_ScenarioEditor
.GetToolManager().SetCurrentTool(_T("ActorViewerTool"), NULL
);
247 void ObjectSidebar::OnSelectType(wxCommandEvent
& WXUNUSED(evt
))
252 void ObjectSidebar::OnSelectObject(wxCommandEvent
& evt
)
254 if (evt
.GetInt() < 0)
257 wxString id
= static_cast<wxStringClientData
*>(evt
.GetClientObject())->GetData();
259 // Always update the actor viewer's state even if it's inactive,
260 // so it will be correct when first enabled
261 p
->m_ActorViewerEntity
= id
;
263 if (p
->m_ActorViewerActive
)
265 p
->ActorViewerPostToGame();
269 // On selecting an object, enable the PlaceObject tool with this object
270 m_ScenarioEditor
.GetToolManager().SetCurrentTool(_T("PlaceObject"), &id
);
274 void ObjectSidebar::OnSelectFilter(wxCommandEvent
& WXUNUSED(evt
))
279 BEGIN_EVENT_TABLE(ObjectSidebar
, Sidebar
)
280 EVT_CHOICE(ID_ObjectType
, ObjectSidebar::OnSelectType
)
281 EVT_TEXT(ID_ObjectFilter
, ObjectSidebar::OnSelectFilter
)
282 EVT_LISTBOX(ID_SelectObject
, ObjectSidebar::OnSelectObject
)
283 EVT_BUTTON(ID_ToggleViewer
, ObjectSidebar::OnToggleViewer
)
286 //////////////////////////////////////////////////////////////////////////
288 class PlayerComboBox
: public wxComboBox
291 PlayerComboBox(wxWindow
* parent
, Observable
<ObjectSettings
>& objectSettings
, Observable
<AtObj
>& mapSettings
)
292 : wxComboBox(parent
, ID_PlayerSelect
, wxEmptyString
, wxDefaultPosition
, wxDefaultSize
, 0, 0, wxCB_READONLY
)
293 , m_ObjectSettings(objectSettings
), m_MapSettings(mapSettings
)
295 m_ObjectConn
= m_ObjectSettings
.RegisterObserver(1, &PlayerComboBox::OnObjectSettingsChange
, this);
296 m_MapConn
= m_MapSettings
.RegisterObserver(1, &PlayerComboBox::OnMapSettingsChange
, this);
299 void SetPlayers(wxArrayString
& names
)
302 OnMapSettingsChange(m_MapSettings
);
307 ObservableScopedConnection m_ObjectConn
;
308 Observable
<ObjectSettings
>& m_ObjectSettings
;
309 ObservableScopedConnection m_MapConn
;
310 Observable
<AtObj
>& m_MapSettings
;
311 wxArrayString m_Players
;
313 void SetSelection(int playerID
)
315 // This control may not be loaded yet (before first display)
316 // or may have less items than we expect, which could cause
317 // an assertion failure, so handle that here
318 if ((unsigned int)playerID
< GetCount())
320 wxComboBox::SetSelection(playerID
);
325 wxComboBox::SetSelection(wxNOT_FOUND
);
329 void OnObjectSettingsChange(const ObjectSettings
& settings
)
331 SetSelection(settings
.GetPlayerID());
334 void OnMapSettingsChange(const AtObj
& settings
)
336 // Reload displayed player names
338 size_t numPlayers
= settings
["PlayerData"]["item"].count();
339 for (size_t i
= 0; i
<= numPlayers
&& i
< m_Players
.Count(); ++i
)
341 Append(m_Players
[i
]);
344 SetSelection(m_ObjectSettings
.GetPlayerID());
347 void OnSelect(wxCommandEvent
& evt
)
349 m_ObjectSettings
.SetPlayerID(evt
.GetInt());
350 m_ObjectSettings
.NotifyObserversExcept(m_ObjectConn
);
353 DECLARE_EVENT_TABLE();
355 BEGIN_EVENT_TABLE(PlayerComboBox
, wxComboBox
)
356 EVT_COMBOBOX(wxID_ANY
, PlayerComboBox::OnSelect
)
359 //////////////////////////////////////////////////////////////////////////
361 ObjectBottomBar::ObjectBottomBar(
363 Observable
<ObjectSettings
>& objectSettings
,
364 Observable
<AtObj
>& mapSettings
,
367 : wxPanel(parent
, wxID_ANY
), p(p
)
369 m_ViewerWireframe
= false;
370 m_ViewerMove
= false;
371 m_ViewerGround
= true;
372 m_ViewerWater
= false;
373 m_ViewerShadows
= true;
374 m_ViewerPolyCount
= false;
375 m_ViewerBoundingBox
= false;
376 m_ViewerAxesMarker
= false;
377 m_ViewerPropPointsMode
= 0;
379 wxSizer
* mainSizer
= new wxBoxSizer(wxHORIZONTAL
);
381 // --- viewer options panel -------------------------------------------------------------------------------
383 m_ViewerPanel
= new wxPanel(this, wxID_ANY
);
384 wxSizer
* viewerSizer
= new wxBoxSizer(wxHORIZONTAL
);
386 wxSizer
* viewerButtonsSizer
= new wxStaticBoxSizer(wxHORIZONTAL
, m_ViewerPanel
, _("Display settings"));
388 wxSizer
* viewerButtonsLeft
= new wxBoxSizer(wxVERTICAL
);
389 viewerButtonsLeft
->SetMinSize(110, -1);
390 viewerButtonsLeft
->Add(Tooltipped(new wxButton(m_ViewerPanel
, ID_ViewerWireframe
, _("Wireframe")), _("Toggle wireframe / solid rendering")), wxSizerFlags().Expand());
391 viewerButtonsLeft
->Add(Tooltipped(new wxButton(m_ViewerPanel
, ID_ViewerMove
, _("Move")), _("Toggle movement along ground when playing walk/run animations")), wxSizerFlags().Expand());
392 viewerButtonsLeft
->Add(Tooltipped(new wxButton(m_ViewerPanel
, ID_ViewerGround
, _("Ground")), _("Toggle the ground plane")), wxSizerFlags().Expand());
393 // TODO: disabled until http://trac.wildfiregames.com/ticket/2692 is fixed
394 wxButton
* waterButton
= new wxButton(m_ViewerPanel
, ID_ViewerWater
, _("Water"));
395 waterButton
->Enable(false);
396 viewerButtonsLeft
->Add(Tooltipped(waterButton
, _("Toggle the water plane")), wxSizerFlags().Expand());
397 viewerButtonsLeft
->Add(Tooltipped(new wxButton(m_ViewerPanel
, ID_ViewerShadows
, _("Shadows")), _("Toggle shadow rendering")), wxSizerFlags().Expand());
398 viewerButtonsLeft
->Add(Tooltipped(new wxButton(m_ViewerPanel
, ID_ViewerPolyCount
, _("Poly count")), _("Toggle polygon-count statistics - turn off ground and shadows for more useful data")), wxSizerFlags().Expand());
400 wxSizer
* viewerButtonsRight
= new wxBoxSizer(wxVERTICAL
);
401 viewerButtonsRight
->SetMinSize(110,-1);
402 viewerButtonsRight
->Add(Tooltipped(new wxButton(m_ViewerPanel
, ID_ViewerBoundingBox
, _("Bounding Boxes")), _("Toggle bounding boxes")), wxSizerFlags().Expand());
403 viewerButtonsRight
->Add(Tooltipped(new wxButton(m_ViewerPanel
, ID_ViewerAxesMarker
, _("Axes Marker")), _("Toggle the axes marker (R=X, G=Y, B=Z)")), wxSizerFlags().Expand());
404 viewerButtonsRight
->Add(Tooltipped(new wxButton(m_ViewerPanel
, ID_ViewerPropPoints
, _("Prop Points")), _("Toggle prop points (works best in wireframe mode)")), wxSizerFlags().Expand());
406 viewerButtonsSizer
->Add(viewerButtonsLeft
, wxSizerFlags().Expand());
407 viewerButtonsSizer
->Add(viewerButtonsRight
, wxSizerFlags().Expand());
410 viewerSizer
->Add(viewerButtonsSizer
, wxSizerFlags().Expand());
411 viewerSizer
->AddSpacer(3);
413 // --- animations panel -------------------------------------------------------------------------------
415 wxSizer
* viewerAnimSizer
= new wxStaticBoxSizer(wxVERTICAL
, m_ViewerPanel
, _("Animation"));
417 // TODO: this list should come from the actor
418 wxArrayString animChoices
;
419 AtObj
anims (Datafile::ReadList("animations"));
420 for (AtIter a
= anims
["item"]; a
.defined(); ++a
)
422 animChoices
.Add(wxString(*a
));
424 wxChoice
* viewerAnimSelector
= new wxChoice(m_ViewerPanel
, ID_ViewerAnimation
, wxDefaultPosition
, wxDefaultSize
, animChoices
);
425 viewerAnimSelector
->SetSelection(0);
426 viewerAnimSizer
->Add(viewerAnimSelector
, wxSizerFlags().Expand());
428 wxSizer
* viewerAnimSpeedSizer
= new wxBoxSizer(wxHORIZONTAL
);
429 viewerAnimSpeedSizer
->Add(new wxButton(m_ViewerPanel
, ID_ViewerPlay
, _("Play"), wxDefaultPosition
, wxSize(50, -1)), wxSizerFlags().Expand());
430 viewerAnimSpeedSizer
->Add(new wxButton(m_ViewerPanel
, ID_ViewerPause
, _("Pause"), wxDefaultPosition
, wxSize(50, -1)), wxSizerFlags().Expand());
431 viewerAnimSpeedSizer
->Add(new wxButton(m_ViewerPanel
, ID_ViewerSlow
, _("Slow"), wxDefaultPosition
, wxSize(50, -1)), wxSizerFlags().Expand());
432 viewerAnimSizer
->Add(viewerAnimSpeedSizer
);
434 viewerSizer
->Add(viewerAnimSizer
, wxSizerFlags().Expand());
436 // --- add viewer-specific options -------------------------------------------------------------------------------
438 m_ViewerPanel
->SetSizer(viewerSizer
);
439 mainSizer
->Add(m_ViewerPanel
, wxSizerFlags().Expand());
441 m_ViewerPanel
->Layout(); // prevents strange visibility glitch of the animation buttons on my machine (Vista 32-bit SP1) -- vtsj
442 m_ViewerPanel
->Show(false);
444 // --- add player/variation selection -------------------------------------------------------------------------------
446 wxSizer
* playerSelectionSizer
= new wxBoxSizer(wxHORIZONTAL
);
447 wxSizer
* playerVariationSizer
= new wxBoxSizer(wxVERTICAL
);
449 // TODO: make this a wxChoice instead
450 wxComboBox
* playerSelect
= new PlayerComboBox(this, objectSettings
, mapSettings
);
451 playerSelectionSizer
->Add(new wxStaticText(this, wxID_ANY
, _("Player:")), wxSizerFlags().Align(wxALIGN_CENTER
));
452 playerSelectionSizer
->AddSpacer(3);
453 playerSelectionSizer
->Add(playerSelect
);
455 playerVariationSizer
->Add(playerSelectionSizer
);
456 playerVariationSizer
->AddSpacer(3);
459 wxWindow
* variationSelect
= new VariationControl(this, objectSettings
);
460 variationSelect
->SetMinSize(wxSize(160, -1));
461 wxSizer
* variationSizer
= new wxStaticBoxSizer(wxVERTICAL
, this, _("Variation"));
462 variationSizer
->Add(variationSelect
, wxSizerFlags().Proportion(1).Expand());
463 playerVariationSizer
->Add(variationSizer
, wxSizerFlags().Proportion(1));
465 mainSizer
->AddSpacer(3);
466 mainSizer
->Add(playerVariationSizer
, wxSizerFlags().Expand());
468 // ----------------------------------------------------------------------------------
469 // --- display template name
470 wxSizer
* displaySizer
= new wxStaticBoxSizer(wxVERTICAL
, this, _("Selected entities"));
471 m_TemplateNames
= new wxScrolledWindow(this);
472 m_TemplateNames
->SetMinSize(wxSize(250, -1));
473 m_TemplateNames
->SetScrollRate(0, 5);
474 wxSizer
* scrollwindowSizer
= new wxBoxSizer(wxVERTICAL
);
475 m_TemplateNames
->SetSizer(scrollwindowSizer
);
476 displaySizer
->Add(m_TemplateNames
, wxSizerFlags().Proportion(1).Expand());
477 m_TemplateNames
->Layout();
478 mainSizer
->AddSpacer(3);
479 mainSizer
->Add(displaySizer
, wxSizerFlags().Proportion(1).Expand());
481 g_SelectedObjects
.RegisterObserver(0, &ObjectBottomBar::OnSelectedObjectsChange
, this);
486 static wxControl
* CreateTemplateNameObject(wxWindow
* parent
, const std::string templateName
, int counterTemplate
)
488 wxString
idTemplate(wxString::FromUTF8(templateName
.c_str()));
489 if (counterTemplate
> 1)
490 idTemplate
.Append(wxString::Format(wxT(" (%i)"), counterTemplate
));
492 wxStaticText
* templateNameObject
= new wxStaticText(parent
, wxID_ANY
, idTemplate
);
493 return templateNameObject
;
496 void ObjectBottomBar::OnSelectedObjectsChange(const std::vector
<AtlasMessage::ObjectID
>& selectedObjects
)
499 wxSizer
* sizer
= m_TemplateNames
->GetSizer();
502 AtlasMessage::qGetSelectedObjectsTemplateNames
objectTemplatesName(selectedObjects
);
503 objectTemplatesName
.Post();
504 std::vector
<std::string
> names
= *objectTemplatesName
.names
;
506 int counterTemplate
= 0;
507 std::string lastTemplateName
= "";
508 for (std::vector
<std::string
>::const_iterator it
= names
.begin(); it
!= names
.end(); ++it
)
510 if (lastTemplateName
== "")
511 lastTemplateName
= (*it
);
513 if (lastTemplateName
== (*it
))
519 sizer
->Add(CreateTemplateNameObject(m_TemplateNames
, lastTemplateName
, counterTemplate
), wxSizerFlags().Align(wxALIGN_LEFT
));
521 lastTemplateName
= (*it
);
524 // Add the remaining template
525 sizer
->Add(CreateTemplateNameObject(m_TemplateNames
, lastTemplateName
, counterTemplate
), wxSizerFlags().Align(wxALIGN_LEFT
));
528 sizer
->FitInside(m_TemplateNames
);
531 void ObjectBottomBar::OnFirstDisplay()
533 // We use messages here because the simulation is not init'd otherwise (causing a crash)
536 wxArrayString players
;
537 AtlasMessage::qGetPlayerDefaults qryPlayers
;
539 AtObj playerData
= AtlasObject::LoadFromJSON(*qryPlayers
.defaults
);
540 AtObj playerDefs
= *playerData
["PlayerData"];
541 for (AtIter p
= playerDefs
["item"]; p
.defined(); ++p
)
543 players
.Add(wxString(p
["Name"]));
545 wxDynamicCast(FindWindow(ID_PlayerSelect
), PlayerComboBox
)->SetPlayers(players
);
547 // Initialise the game with the default settings
548 POST_MESSAGE(SetViewParamB
, (AtlasMessage::eRenderView::ACTOR
, L
"wireframe", m_ViewerWireframe
));
549 POST_MESSAGE(SetViewParamB
, (AtlasMessage::eRenderView::ACTOR
, L
"walk", m_ViewerMove
));
550 POST_MESSAGE(SetViewParamB
, (AtlasMessage::eRenderView::ACTOR
, L
"ground", m_ViewerGround
));
551 POST_MESSAGE(SetViewParamB
, (AtlasMessage::eRenderView::ACTOR
, L
"water", m_ViewerWater
));
552 POST_MESSAGE(SetViewParamB
, (AtlasMessage::eRenderView::ACTOR
, L
"shadows", m_ViewerShadows
));
553 POST_MESSAGE(SetViewParamB
, (AtlasMessage::eRenderView::ACTOR
, L
"stats", m_ViewerPolyCount
));
554 POST_MESSAGE(SetViewParamB
, (AtlasMessage::eRenderView::ACTOR
, L
"bounding_box", m_ViewerBoundingBox
));
555 POST_MESSAGE(SetViewParamI
, (AtlasMessage::eRenderView::ACTOR
, L
"prop_points", m_ViewerPropPointsMode
));
558 void ObjectBottomBar::ShowActorViewer(bool show
)
560 m_ViewerPanel
->Show(show
);
564 void ObjectBottomBar::OnViewerSetting(wxCommandEvent
& evt
)
568 case ID_ViewerWireframe
:
569 m_ViewerWireframe
= !m_ViewerWireframe
;
570 POST_MESSAGE(SetViewParamB
, (AtlasMessage::eRenderView::ACTOR
, L
"wireframe", m_ViewerWireframe
));
573 m_ViewerMove
= !m_ViewerMove
;
574 POST_MESSAGE(SetViewParamB
, (AtlasMessage::eRenderView::ACTOR
, L
"walk", m_ViewerMove
));
576 case ID_ViewerGround
:
577 m_ViewerGround
= !m_ViewerGround
;
578 POST_MESSAGE(SetViewParamB
, (AtlasMessage::eRenderView::ACTOR
, L
"ground", m_ViewerGround
));
581 m_ViewerWater
= !m_ViewerWater
;
582 POST_MESSAGE(SetViewParamB
, (AtlasMessage::eRenderView::ACTOR
, L
"water", m_ViewerWater
));
584 case ID_ViewerShadows
:
585 m_ViewerShadows
= !m_ViewerShadows
;
586 POST_MESSAGE(SetViewParamB
, (AtlasMessage::eRenderView::ACTOR
, L
"shadows", m_ViewerShadows
));
588 case ID_ViewerPolyCount
:
589 m_ViewerPolyCount
= !m_ViewerPolyCount
;
590 POST_MESSAGE(SetViewParamB
, (AtlasMessage::eRenderView::ACTOR
, L
"stats", m_ViewerPolyCount
));
592 case ID_ViewerBoundingBox
:
593 m_ViewerBoundingBox
= !m_ViewerBoundingBox
;
594 POST_MESSAGE(SetViewParamB
, (AtlasMessage::eRenderView::ACTOR
, L
"bounding_box", m_ViewerBoundingBox
));
596 case ID_ViewerAxesMarker
:
597 m_ViewerAxesMarker
= !m_ViewerAxesMarker
;
598 POST_MESSAGE(SetViewParamB
, (AtlasMessage::eRenderView::ACTOR
, L
"axes_marker", m_ViewerAxesMarker
));
600 case ID_ViewerPropPoints
:
601 m_ViewerPropPointsMode
= (m_ViewerPropPointsMode
+1) % 3;
602 POST_MESSAGE(SetViewParamI
, (AtlasMessage::eRenderView::ACTOR
, L
"prop_points", m_ViewerPropPointsMode
));
607 void ObjectBottomBar::OnSelectAnim(wxCommandEvent
& evt
)
609 p
->m_ActorViewerAnimation
= evt
.GetString();
610 p
->ActorViewerPostToGame();
613 void ObjectBottomBar::OnSpeed(wxCommandEvent
& evt
)
617 case ID_ViewerPlay
: p
->m_ActorViewerSpeed
= 1.0f
; break;
618 case ID_ViewerPause
: p
->m_ActorViewerSpeed
= 0.0f
; break;
619 case ID_ViewerSlow
: p
->m_ActorViewerSpeed
= 0.1f
; break;
621 p
->ActorViewerPostToGame();
624 BEGIN_EVENT_TABLE(ObjectBottomBar
, wxPanel
)
625 EVT_BUTTON(ID_ViewerWireframe
, ObjectBottomBar::OnViewerSetting
)
626 EVT_BUTTON(ID_ViewerMove
, ObjectBottomBar::OnViewerSetting
)
627 EVT_BUTTON(ID_ViewerGround
, ObjectBottomBar::OnViewerSetting
)
628 EVT_BUTTON(ID_ViewerWater
, ObjectBottomBar::OnViewerSetting
)
629 EVT_BUTTON(ID_ViewerShadows
, ObjectBottomBar::OnViewerSetting
)
630 EVT_BUTTON(ID_ViewerPolyCount
, ObjectBottomBar::OnViewerSetting
)
631 EVT_CHOICE(ID_ViewerAnimation
, ObjectBottomBar::OnSelectAnim
)
632 EVT_BUTTON(ID_ViewerPlay
, ObjectBottomBar::OnSpeed
)
633 EVT_BUTTON(ID_ViewerPause
, ObjectBottomBar::OnSpeed
)
634 EVT_BUTTON(ID_ViewerSlow
, ObjectBottomBar::OnSpeed
)
635 EVT_BUTTON(ID_ViewerBoundingBox
, ObjectBottomBar::OnViewerSetting
)
636 EVT_BUTTON(ID_ViewerAxesMarker
, ObjectBottomBar::OnViewerSetting
)
637 EVT_BUTTON(ID_ViewerPropPoints
, ObjectBottomBar::OnViewerSetting
)