Subversion Repository Public Repository

Divide-Framework

This repository has no backups
This repository's network speed is throttled to 100KB/sec

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
#include <CEGUI/CEGUI.h>
#include "Headers/GUIEditor.h"

#include "GUI/Headers/GUI.h"
#include "GUI/Headers/GUIConsole.h"
#include "Core/Headers/Application.h"
#include "Core/Headers/ParamHandler.h"
#include "Core/Math/Headers/Transform.h"
#include "Managers/Headers/AIManager.h"
#include "Managers/Headers/SceneManager.h"

namespace Divide {

GUIEditor::GUIEditor() : _init(false), 
                         _wasControlClick(false),
                         _createNavMeshQueued(false),
                         _pauseSelectionTracking(false),
                         _editorWindow(nullptr),
                         _currentSelection(nullptr)
{
    _saveSelectionButton = nullptr;
    _deleteSelectionButton = nullptr;

    for (U8 i = 0; i < ToggleButtons_PLACEHOLDER; ++i) {
        _toggleButtons[i] = nullptr;
    }

    for (U8 i = 0; i < TransformFields_PLACEHOLDER; ++i) {
        for (U8 j = 0; j < ControlField_PLACEHOLDER; ++j) {
            _currentValues[i][j] = 0.0;
            _valuesField[i][j] = nullptr;
            _transformButtonsInc[i][j] = nullptr;
            _transformButtonsDec[i][j] = nullptr;
        }
        _currentValues[i][CONTROL_FIELD_GRANULARITY] = 1.0;
    }
}

GUIEditor::~GUIEditor()
{
    _init = false;
}

bool GUIEditor::init() {
    if (_init) {
        ERROR_FN(Locale::get("ERROR_EDITOR_DOUBLE_INIT"));
        return false;
    }

    PRINT_FN(Locale::get("GUI_EDITOR_INIT"));
    // Get a local pointer to the CEGUI Window Manager, Purely for convenience to reduce typing
    CEGUI::WindowManager *pWindowManager = CEGUI::WindowManager::getSingletonPtr();
    // load the editor Window from the layout file
	const stringImpl& layoutFile = ParamHandler::getInstance().getParam<stringImpl>("GUI.editorLayout");
    _editorWindow = pWindowManager->loadLayoutFromFile(layoutFile.c_str());

    if (_editorWindow) {
         // Add the Window to the GUI Root Sheet
         CEGUI_DEFAULT_CONTEXT.getRootWindow()->addChild(_editorWindow);
         // Now register the handlers for the events (Clicking, typing, etc)
         RegisterHandlers();
    } else {
         // Loading layout from file, failed, so output an error Message.
         CEGUI::Logger::getSingleton().logEvent("Error: Unable to load the Editor from .layout");
         ERROR_FN(Locale::get("ERROR_EDITOR_LAYOUT_FILE"),layoutFile.c_str());
         return false;
    }

    setVisible(false);

    _init = true;
    PRINT_FN(Locale::get("GUI_EDITOR_CREATED"));
    return true;
}

bool GUIEditor::Handle_ChangeSelection(SceneGraphNode* const newNode) {
    _currentSelection = newNode;
    if (isVisible()) {
        UpdateControls();
    }
    return true;
}

void GUIEditor::TrackSelection() {
    if (_currentSelection && !_pauseSelectionTracking) {
        PhysicsComponent* const selectionTransform = _currentSelection->getComponent<PhysicsComponent>();
        const vec3<F32>& localPosition = selectionTransform->getPosition();
        const vec3<F32>& localScale = selectionTransform->getScale();
        vec3<F32> localOrientation = Divide::getEuler(selectionTransform->getOrientation(), true);

        _currentValues[TRANSFORM_POSITION][CONTROL_FIELD_X] = localPosition.x;
        _currentValues[TRANSFORM_POSITION][CONTROL_FIELD_Y] = localPosition.y;
        _currentValues[TRANSFORM_POSITION][CONTROL_FIELD_Z] = localPosition.z;

        _currentValues[TRANSFORM_ROTATION][CONTROL_FIELD_X] = localOrientation.x;
        _currentValues[TRANSFORM_ROTATION][CONTROL_FIELD_Y] = localOrientation.y;
        _currentValues[TRANSFORM_ROTATION][CONTROL_FIELD_Z] = localOrientation.z;

        _currentValues[TRANSFORM_SCALE][CONTROL_FIELD_X] = localScale.x;
        _currentValues[TRANSFORM_SCALE][CONTROL_FIELD_Y] = localScale.y;
        _currentValues[TRANSFORM_SCALE][CONTROL_FIELD_Z] = localScale.z;

        for (U8 i = 0; i < TransformFields_PLACEHOLDER; ++i) {
            // Skip granularity
            for (U8 j = 0; j < ControlField_PLACEHOLDER - 1; ++j) {
                _valuesField[i][j]->setText(CEGUI::PropertyHelper<F32>::toString(_currentValues[i][j]));
            }
        }

        RenderingComponent* rComp = _currentSelection->getComponent<RenderingComponent>();
        _toggleButtons[TOGGLE_SKELETONS]->setSelected(rComp->renderSkeleton());
        _toggleButtons[TOGGLE_SHADOW_MAPPING]->setSelected(rComp->castsShadows());
        _toggleButtons[TOGGLE_WIREFRAME]->setSelected(rComp->renderWireframe());
        _toggleButtons[TOGGLE_BOUNDING_BOXES]->setSelected(rComp->renderBoundingBox());
    }
}

void GUIEditor::UpdateControls() {
    bool hasValidTransform = false;
    if (_currentSelection) {
        hasValidTransform = (_currentSelection->getComponent<PhysicsComponent>() != nullptr);
        _toggleButtons[TOGGLE_WIREFRAME]->setEnabled(true);
        _toggleButtons[TOGGLE_BOUNDING_BOXES]->setEnabled(true);
        _toggleButtons[TOGGLE_SKELETONS]->setEnabled(true);
        _toggleButtons[TOGGLE_SHADOW_MAPPING]->setEnabled(LightManager::getInstance().shadowMappingEnabled());
    }

    if (!hasValidTransform) {
        for (U8 i = 0; i < TransformFields_PLACEHOLDER; ++i) {
            // Skip granularity
            for (U8 j = 0; j < ControlField_PLACEHOLDER - 1; ++j) {
                _valuesField[i][j]->setText("N/A");
                _valuesField[i][j]->setEnabled(false);
                _transformButtonsInc[i][j]->setEnabled(false);
                _transformButtonsDec[i][j]->setEnabled(false);
            }
        }
        _deleteSelectionButton->setEnabled(false);
        _saveSelectionButton->setEnabled(false);
        _toggleButtons[TOGGLE_WIREFRAME]->setEnabled(false);
        _toggleButtons[TOGGLE_WIREFRAME]->setSelected(false);
        _toggleButtons[TOGGLE_BOUNDING_BOXES]->setEnabled(false);
        _toggleButtons[TOGGLE_BOUNDING_BOXES]->setSelected(false);
        _toggleButtons[TOGGLE_SKELETONS]->setEnabled(false);
        _toggleButtons[TOGGLE_SKELETONS]->setSelected(false);
        _toggleButtons[TOGGLE_SHADOW_MAPPING]->setEnabled(false);
        _toggleButtons[TOGGLE_SHADOW_MAPPING]->setSelected(false);
    } else {
         for (U8 i = 0; i < TransformFields_PLACEHOLDER; ++i) {
            // Skip granularity
            for (U8 j = 0; j < ControlField_PLACEHOLDER - 1; ++j) {
                _valuesField[i][j]->setText(CEGUI::PropertyHelper<F32>::toString(_currentValues[i][j]));
                _valuesField[i][j]->setEnabled(true);
                _transformButtonsInc[i][j]->setEnabled(true);
                _transformButtonsDec[i][j]->setEnabled(true);
            }
        }
        _deleteSelectionButton->setEnabled(true);
        _saveSelectionButton->setEnabled(true);
    }
    _toggleButtons[TOGGLE_POST_FX]->setSelected(GFX_DEVICE.postProcessingEnabled());
    _toggleButtons[TOGGLE_FOG]->setSelected(ParamHandler::getInstance().getParam<bool>("rendering.enableFog", false));

    bool depthPreview = ParamHandler::getInstance().getParam<bool>("postProcessing.fullScreenDepthBuffer", false);
    _toggleButtons[TOGGLE_DEPTH_PREVIEW]->setSelected(depthPreview);
}

void GUIEditor::setVisible(bool visible) {
    UpdateControls();
     _editorWindow->setVisible(visible);
}

bool GUIEditor::isVisible() {
    return _editorWindow->isVisible();
}

bool GUIEditor::update(const U64 deltaTime) {
    _wasControlClick = false;
    bool state = true;
  	if (_createNavMeshQueued) {
        state = false;
        // Check if we already have a NavMesh created
        AI::Navigation::NavigationMesh* temp = AI::AIManager::getInstance().getNavMesh(AI::AIEntity::AGENT_RADIUS_SMALL);
        // Check debug rendering status
		AI::AIManager::getInstance().toggleNavMeshDebugDraw(_toggleButtons[TOGGLE_NAV_MESH_DRAW]->isSelected());
        // Create a new NavMesh if we don't currently have one
        if (!temp) {
            temp = MemoryManager_NEW AI::Navigation::NavigationMesh();
        }
        // Set it's file name
		temp->setFileName(GET_ACTIVE_SCENE()->getName());
        // Try to load it from file
		bool loaded = temp->load(nullptr);
		if (!loaded) {
            // If we failed to load it from file, we need to build it first
			loaded = temp->build(nullptr, AI::Navigation::NavigationMesh::CreationCallback(), false);
            // Then save it to file
			temp->save();
		}
        // If we loaded/built the NavMesh correctly, add it to the AIManager
		if (loaded) {
			state = AI::AIManager::getInstance().addNavMesh(AI::AIEntity::AGENT_RADIUS_SMALL, temp);
		}

		_createNavMeshQueued = false;
	}

    if (isVisible()) {
        TrackSelection();
    }
	return state;
}

void GUIEditor::RegisterHandlers() {
    CEGUI::Window* EditorBar = static_cast<CEGUI::Window*>(_editorWindow->getChild("MenuBar"));
    EditorBar->subscribeEvent(CEGUI::Window::EventMouseButtonUp,
                              CEGUI::Event::Subscriber(&GUIEditor::Handle_MenuBarClickOn, this));

    for (U16 i = 0; i < EditorBar->getChildCount(); ++i) { 
        EditorBar->getChildElementAtIdx(i)->subscribeEvent(CEGUI::Window::EventMouseButtonUp, 
                                                           CEGUI::Event::Subscriber(&GUIEditor::Handle_MenuBarClickOn, this));
    }

    // Save Scene Button
    {
        CEGUI::Window* saveSceneButton = static_cast<CEGUI::Window*>(EditorBar->getChild("SaveSceneButton"));
        saveSceneButton->subscribeEvent(CEGUI::PushButton::EventClicked, 
                                        CEGUI::Event::Subscriber(&GUIEditor::Handle_SaveScene, this));
    }
    // Save Selection Button
    { 
        _saveSelectionButton = static_cast<CEGUI::Window*>(EditorBar->getChild("SaveSelectionButton"));
        _saveSelectionButton->subscribeEvent(CEGUI::PushButton::EventClicked,
                                             CEGUI::Event::Subscriber(&GUIEditor::Handle_SaveSelection, this));
    }
    // Delete Selection Button
    {
        _deleteSelectionButton = static_cast<CEGUI::Window*>(EditorBar->getChild("DeleteSelection"));
        _deleteSelectionButton->subscribeEvent(CEGUI::PushButton::EventClicked, 
                                               CEGUI::Event::Subscriber(&GUIEditor::Handle_DeleteSelection, this));
    }
    // Generate NavMesh button
    {
        CEGUI::Window* createNavMeshButton = static_cast<CEGUI::Window*>(EditorBar->getChild("NavMeshButton"));
        createNavMeshButton->subscribeEvent(CEGUI::PushButton::EventClicked, 
                                            CEGUI::Event::Subscriber(&GUIEditor::Handle_CreateNavMesh, this));
    }
    // Reload Scene Button
    {
        CEGUI::Window* reloadSceneButton = static_cast<CEGUI::Window*>(EditorBar->getChild("ReloadSceneButton"));
        reloadSceneButton->subscribeEvent(CEGUI::PushButton::EventClicked,
                                          CEGUI::Event::Subscriber(&GUIEditor::Handle_ReloadScene, this));
    }
    // Print SceneGraph Button
    {
        CEGUI::Window* dumpSceneGraphButton = static_cast<CEGUI::Window*>(EditorBar->getChild("DumpSceneGraphTree"));
        dumpSceneGraphButton->subscribeEvent(CEGUI::PushButton::EventClicked, 
                                             CEGUI::Event::Subscriber(&GUIEditor::Handle_PrintSceneGraph, this));
    }
    CEGUI::ToggleButton* toggleButton = nullptr;
    // Toggle Wireframe rendering
    {
        _toggleButtons[TOGGLE_WIREFRAME] = static_cast<CEGUI::ToggleButton*>(EditorBar->getChild("ToggleWireframe"));
        toggleButton = _toggleButtons[TOGGLE_WIREFRAME];
        toggleButton->subscribeEvent(CEGUI::ToggleButton::EventSelectStateChanged,
                                     CEGUI::Event::Subscriber(&GUIEditor::Handle_WireframeToggle, this));
    }
    // Toggle Depth Preview
    {
        _toggleButtons[TOGGLE_DEPTH_PREVIEW]= static_cast<CEGUI::ToggleButton*>(EditorBar->getChild("ToggleDepthPreview"));
        toggleButton = _toggleButtons[TOGGLE_DEPTH_PREVIEW];
        toggleButton->subscribeEvent(CEGUI::ToggleButton::EventSelectStateChanged,
                                     CEGUI::Event::Subscriber(&GUIEditor::Handle_DepthPreviewToggle, this));
    }
    // Toggle Shadows
    {
        _toggleButtons[TOGGLE_SHADOW_MAPPING] = static_cast<CEGUI::ToggleButton*>(EditorBar->getChild("ToggleShadowMapping"));
        toggleButton = _toggleButtons[TOGGLE_SHADOW_MAPPING];
        toggleButton->subscribeEvent(CEGUI::ToggleButton::EventSelectStateChanged,
                                     CEGUI::Event::Subscriber(&GUIEditor::Handle_ShadowMappingToggle, this));    
    }
    // Toggle Fog
    {
        _toggleButtons[TOGGLE_FOG] = static_cast<CEGUI::ToggleButton*>(EditorBar->getChild("ToggleFog"));
        toggleButton = _toggleButtons[TOGGLE_FOG];
        toggleButton->subscribeEvent(CEGUI::ToggleButton::EventSelectStateChanged,
                                     CEGUI::Event::Subscriber(&GUIEditor::Handle_FogToggle, this));
    }
    // Toggle PostFX
    {
        _toggleButtons[TOGGLE_POST_FX] = static_cast<CEGUI::ToggleButton*>(EditorBar->getChild("TogglePostFX"));
        toggleButton = _toggleButtons[TOGGLE_POST_FX];
        toggleButton->subscribeEvent(CEGUI::ToggleButton::EventSelectStateChanged,
                                     CEGUI::Event::Subscriber(&GUIEditor::Handle_PostFXToggle, this));
    }
    // Toggle Bounding Boxes
    {
        _toggleButtons[TOGGLE_BOUNDING_BOXES] = static_cast<CEGUI::ToggleButton*>(EditorBar->getChild("ToggleBoundingBoxes"));
        toggleButton = _toggleButtons[TOGGLE_BOUNDING_BOXES];
        toggleButton->subscribeEvent(CEGUI::ToggleButton::EventSelectStateChanged,
                                     CEGUI::Event::Subscriber(&GUIEditor::Handle_BoundingBoxesToggle, this));
    }
    // Toggle NavMesh Rendering
    {
        _toggleButtons[TOGGLE_NAV_MESH_DRAW] = static_cast<CEGUI::ToggleButton*>(EditorBar->getChild("DebugDraw"));
        toggleButton = _toggleButtons[TOGGLE_NAV_MESH_DRAW];
        toggleButton->subscribeEvent(CEGUI::ToggleButton::EventSelectStateChanged,
                                     CEGUI::Event::Subscriber(&GUIEditor::Handle_DrawNavMeshToggle, this));
    }
    // Toggle Skeleton Rendering
    {
        _toggleButtons[TOGGLE_SKELETONS] = static_cast<CEGUI::ToggleButton*>(EditorBar->getChild("ToggleSkeletons"));
        toggleButton = _toggleButtons[TOGGLE_SKELETONS];
        toggleButton->subscribeEvent(CEGUI::ToggleButton::EventSelectStateChanged,
                                     CEGUI::Event::Subscriber(&GUIEditor::Handle_SkeletonsToggle, this));
    }

    CEGUI::Editbox* field = nullptr;
    // Type new X Position
    {
        _valuesField[TRANSFORM_POSITION][CONTROL_FIELD_X] = static_cast<CEGUI::Editbox*>(EditorBar->getChild("XPositionValue"));
        field = _valuesField[TRANSFORM_POSITION][CONTROL_FIELD_X];
        field->subscribeEvent(CEGUI::Editbox::EventTextAccepted,
                              CEGUI::Event::Subscriber(&GUIEditor::Handle_PositionXChange, this));
        field->subscribeEvent(CEGUI::Editbox::EventInputCaptureGained,
                              CEGUI::Event::Subscriber(&GUIEditor::Handle_EditFieldClick, this));
        field->setValidationString(CEGUI::String("^[-+]?[0-9]{1,10}([.][0-9]{1,10})?$"));
    }
    // Type new Y Position
    {
        _valuesField[TRANSFORM_POSITION][CONTROL_FIELD_Y] = static_cast<CEGUI::Editbox*>(EditorBar->getChild("YPositionValue"));
        field = _valuesField[TRANSFORM_POSITION][CONTROL_FIELD_Y];
        field->subscribeEvent(CEGUI::Editbox::EventTextAccepted,
                              CEGUI::Event::Subscriber(&GUIEditor::Handle_PositionYChange, this));
        field->subscribeEvent(CEGUI::Editbox::EventInputCaptureGained,
                              CEGUI::Event::Subscriber(&GUIEditor::Handle_EditFieldClick, this));
        field->setValidationString(CEGUI::String("^[-+]?[0-9]{1,10}([.][0-9]{1,10})?$"));
    }
    // Type new Z Position
    {
        _valuesField[TRANSFORM_POSITION][CONTROL_FIELD_Z] = static_cast<CEGUI::Editbox*>(EditorBar->getChild("ZPositionValue"));
        field = _valuesField[TRANSFORM_POSITION][CONTROL_FIELD_Z];
        field->subscribeEvent(CEGUI::Editbox::EventTextAccepted,
                              CEGUI::Event::Subscriber(&GUIEditor::Handle_PositionZChange, this));
        field->subscribeEvent(CEGUI::Editbox::EventInputCaptureGained,
                              CEGUI::Event::Subscriber(&GUIEditor::Handle_EditFieldClick, this));
        field->setValidationString(CEGUI::String("^[-+]?[0-9]{1,10}([.][0-9]{1,10})?$"));
    }

    // Type new Position Granularity
    {
        _valuesField[TRANSFORM_POSITION][CONTROL_FIELD_GRANULARITY] = 
                                                    static_cast<CEGUI::Editbox*>(EditorBar->getChild("PositionGranularityValue"));
        field = _valuesField[TRANSFORM_POSITION][CONTROL_FIELD_GRANULARITY];
        field->subscribeEvent(CEGUI::Editbox::EventTextAccepted, 
                              CEGUI::Event::Subscriber(&GUIEditor::Handle_PositionGranularityChange, this));
        field->setText(CEGUI::PropertyHelper<F32>::toString(_currentValues[TRANSFORM_POSITION][CONTROL_FIELD_GRANULARITY]));
        field->setValidationString(CEGUI::String("^[-+]?[0-9]{1,10}([.][0-9]{1,10})?$"));
    }
    // Type new X Rotation
    {
        _valuesField[TRANSFORM_ROTATION][CONTROL_FIELD_X] = static_cast<CEGUI::Editbox*>(EditorBar->getChild("XRotationValue"));
        field = _valuesField[TRANSFORM_ROTATION][CONTROL_FIELD_X];
        field->subscribeEvent(CEGUI::Editbox::EventTextAccepted, 
                              CEGUI::Event::Subscriber(&GUIEditor::Handle_RotationXChange, this));
        field->subscribeEvent(CEGUI::Editbox::EventInputCaptureGained,
                              CEGUI::Event::Subscriber(&GUIEditor::Handle_EditFieldClick, this));
        field->setValidationString(CEGUI::String("^[-+]?[0-9]{1,10}([.][0-9]{1,10})?$"));
    }
    // Type new Y Rotation
    {
        _valuesField[TRANSFORM_ROTATION][CONTROL_FIELD_Y] = static_cast<CEGUI::Editbox*>(EditorBar->getChild("YRotationValue"));
        field = _valuesField[TRANSFORM_ROTATION][CONTROL_FIELD_Y];
        field->subscribeEvent(CEGUI::Editbox::EventTextAccepted,
                              CEGUI::Event::Subscriber(&GUIEditor::Handle_RotationYChange, this));
        field->subscribeEvent(CEGUI::Editbox::EventInputCaptureGained,
                              CEGUI::Event::Subscriber(&GUIEditor::Handle_EditFieldClick, this));
        field->setValidationString(CEGUI::String("^[-+]?[0-9]{1,10}([.][0-9]{1,10})?$"));
    }
    // Type new Z Rotation
    {
        _valuesField[TRANSFORM_ROTATION][CONTROL_FIELD_Z] = static_cast<CEGUI::Editbox*>(EditorBar->getChild("ZRotationValue"));
        field = _valuesField[TRANSFORM_ROTATION][CONTROL_FIELD_Z];
        field->subscribeEvent(CEGUI::Editbox::EventTextAccepted, 
                              CEGUI::Event::Subscriber(&GUIEditor::Handle_RotationZChange, this));
        field->subscribeEvent(CEGUI::Editbox::EventInputCaptureGained, 
                              CEGUI::Event::Subscriber(&GUIEditor::Handle_EditFieldClick, this));
        field->setValidationString(CEGUI::String("^[-+]?[0-9]{1,10}([.][0-9]{1,10})?$"));
    }
    // Type new Rotation Granularity
    {
        _valuesField[TRANSFORM_ROTATION][CONTROL_FIELD_GRANULARITY] =
                                                    static_cast<CEGUI::Editbox*>(EditorBar->getChild("RotationGranularityValue"));
        field = _valuesField[TRANSFORM_ROTATION][CONTROL_FIELD_GRANULARITY];
        field->subscribeEvent(CEGUI::Editbox::EventTextAccepted, 
                              CEGUI::Event::Subscriber(&GUIEditor::Handle_RotationGranularityChange, this));
        field->setText(CEGUI::PropertyHelper<F32>::toString(_currentValues[TRANSFORM_ROTATION][CONTROL_FIELD_GRANULARITY]));
        field->setValidationString(CEGUI::String("^[-+]?[0-9]{1,10}([.][0-9]{1,10})?$"));
    }
    // Type new X Scale
    {
        _valuesField[TRANSFORM_SCALE][CONTROL_FIELD_X] = static_cast<CEGUI::Editbox*>(EditorBar->getChild("XScaleValue"));
        field = _valuesField[TRANSFORM_SCALE][CONTROL_FIELD_X];
        field->subscribeEvent(CEGUI::Editbox::EventTextAccepted, 
                              CEGUI::Event::Subscriber(&GUIEditor::Handle_ScaleXChange, this));
        field->subscribeEvent(CEGUI::Editbox::EventInputCaptureGained, 
                              CEGUI::Event::Subscriber(&GUIEditor::Handle_EditFieldClick, this));
        field->setValidationString(CEGUI::String("^[-+]?[0-9]{1,10}([.][0-9]{1,10})?$"));
    }
    // Type new Y Scale
    {
        _valuesField[TRANSFORM_SCALE][CONTROL_FIELD_Y] = static_cast<CEGUI::Editbox*>(EditorBar->getChild("YScaleValue"));
        field = _valuesField[TRANSFORM_SCALE][CONTROL_FIELD_Y];
        field->subscribeEvent(CEGUI::Editbox::EventTextAccepted, 
                              CEGUI::Event::Subscriber(&GUIEditor::Handle_ScaleYChange, this));
        field->subscribeEvent(CEGUI::Editbox::EventInputCaptureGained, 
                              CEGUI::Event::Subscriber(&GUIEditor::Handle_EditFieldClick, this));
        field->setValidationString(CEGUI::String("^[-+]?[0-9]{1,10}([.][0-9]{1,10})?$"));
    }
    // Type new Z Scale
    {
        _valuesField[TRANSFORM_SCALE][CONTROL_FIELD_Z] = static_cast<CEGUI::Editbox*>(EditorBar->getChild("ZScaleValue"));
        field = _valuesField[TRANSFORM_SCALE][CONTROL_FIELD_Z];
        field->subscribeEvent(CEGUI::Editbox::EventTextAccepted, 
                              CEGUI::Event::Subscriber(&GUIEditor::Handle_ScaleZChange, this));
        field->subscribeEvent(CEGUI::Editbox::EventInputCaptureGained, 
                              CEGUI::Event::Subscriber(&GUIEditor::Handle_EditFieldClick, this));
        field->setValidationString(CEGUI::String("^[-+]?[0-9]{1,10}([.][0-9]{1,10})?$"));
    }
    // Type new Scale Granularity
    {
        _valuesField[TRANSFORM_SCALE][CONTROL_FIELD_GRANULARITY] =
                                                        static_cast<CEGUI::Editbox*>(EditorBar->getChild("ScaleGranularityValue"));
        field = _valuesField[TRANSFORM_SCALE][CONTROL_FIELD_GRANULARITY];
        field->subscribeEvent(CEGUI::Editbox::EventTextAccepted,
                              CEGUI::Event::Subscriber(&GUIEditor::Handle_ScaleGranularityChange, this));
        field->setText(CEGUI::PropertyHelper<F32>::toString(_currentValues[TRANSFORM_SCALE][CONTROL_FIELD_GRANULARITY]));
        field->setValidationString(CEGUI::String("^[-+]?[0-9]{1,10}([.][0-9]{1,10})?$"));
    }
    CEGUI::Window* transformButton = nullptr;
    // Increment X Position
    {
        _transformButtonsInc[TRANSFORM_POSITION][CONTROL_FIELD_X] = EditorBar->getChild("IncPositionXButton");
        transformButton = _transformButtonsInc[TRANSFORM_POSITION][CONTROL_FIELD_X];
        transformButton->subscribeEvent(CEGUI::PushButton::EventClicked,
                                        CEGUI::Event::Subscriber(&GUIEditor::Handle_IncrementPositionX, this));
    }
    // Decrement X Position
    {
        _transformButtonsDec[TRANSFORM_POSITION][CONTROL_FIELD_X] = EditorBar->getChild("DecPositionXButton");
        transformButton = _transformButtonsDec[TRANSFORM_POSITION][CONTROL_FIELD_X];
        transformButton->subscribeEvent(CEGUI::PushButton::EventClicked, 
                                        CEGUI::Event::Subscriber(&GUIEditor::Handle_DecrementPositionX, this));
    }
    // Increment Y Position
    {
        _transformButtonsInc[TRANSFORM_POSITION][CONTROL_FIELD_Y]  = EditorBar->getChild("IncPositionYButton");
        transformButton = _transformButtonsInc[TRANSFORM_POSITION][CONTROL_FIELD_Y];
        transformButton->subscribeEvent(CEGUI::PushButton::EventClicked, 
                                        CEGUI::Event::Subscriber(&GUIEditor::Handle_IncrementPositionY, this));
    }
    // Decrement Y Position
    {
        _transformButtonsDec[TRANSFORM_POSITION][CONTROL_FIELD_Y] = EditorBar->getChild("DecPositionYButton");
        transformButton = _transformButtonsDec[TRANSFORM_POSITION][CONTROL_FIELD_Y];
        transformButton->subscribeEvent(CEGUI::PushButton::EventClicked, 
                                        CEGUI::Event::Subscriber(&GUIEditor::Handle_DecrementPositionY, this));
    }
    // Increment Z Position
    {
        _transformButtonsInc[TRANSFORM_POSITION][CONTROL_FIELD_Z] = EditorBar->getChild("IncPositionZButton");
        transformButton = _transformButtonsInc[TRANSFORM_POSITION][CONTROL_FIELD_Z];
        transformButton->subscribeEvent(CEGUI::PushButton::EventClicked, 
                                        CEGUI::Event::Subscriber(&GUIEditor::Handle_IncrementPositionZ, this));
    }
    // Decrement Z Position
    {
        _transformButtonsDec[TRANSFORM_POSITION][CONTROL_FIELD_Z] = EditorBar->getChild("DecPositionZButton");
        transformButton = _transformButtonsDec[TRANSFORM_POSITION][CONTROL_FIELD_Z];
        transformButton->subscribeEvent(CEGUI::PushButton::EventClicked, 
                                        CEGUI::Event::Subscriber(&GUIEditor::Handle_DecrementPositionZ, this));
    }
    // Increment Position Granularity
    {
        _transformButtonsInc[TRANSFORM_POSITION][CONTROL_FIELD_GRANULARITY] = EditorBar->getChild("IncPositionGranButton");
        transformButton = _transformButtonsInc[TRANSFORM_POSITION][CONTROL_FIELD_GRANULARITY];
        transformButton->subscribeEvent(CEGUI::PushButton::EventClicked, 
                                        CEGUI::Event::Subscriber(&GUIEditor::Handle_IncrementPositionGranularity, this));
    }
    // Decrement Position Granularity
    {
        _transformButtonsDec[TRANSFORM_ROTATION][CONTROL_FIELD_GRANULARITY] = EditorBar->getChild("DecPositionGranButton");
        transformButton = _transformButtonsDec[TRANSFORM_ROTATION][CONTROL_FIELD_GRANULARITY];
        transformButton->subscribeEvent(CEGUI::PushButton::EventClicked, 
                                        CEGUI::Event::Subscriber(&GUIEditor::Handle_DecrementPositionGranularity, this));
    }
    // Increment X Rotation
    {
        _transformButtonsInc[TRANSFORM_ROTATION][CONTROL_FIELD_X] = EditorBar->getChild("IncRotationXButton");
        transformButton = _transformButtonsInc[TRANSFORM_ROTATION][CONTROL_FIELD_X];
        transformButton->subscribeEvent(CEGUI::PushButton::EventClicked, 
                                        CEGUI::Event::Subscriber(&GUIEditor::Handle_IncrementRotationX, this));
    }
    // Decrement X Rotation
    {
        _transformButtonsDec[TRANSFORM_ROTATION][CONTROL_FIELD_X] = EditorBar->getChild("DecRotationXButton");
        transformButton = _transformButtonsDec[TRANSFORM_ROTATION][CONTROL_FIELD_X];
        transformButton->subscribeEvent(CEGUI::PushButton::EventClicked, 
                                        CEGUI::Event::Subscriber(&GUIEditor::Handle_DecrementRotationX, this));
    }
    // Increment Y Rotation
    {
        _transformButtonsInc[TRANSFORM_ROTATION][CONTROL_FIELD_Y] = EditorBar->getChild("IncRotationYButton");
        transformButton = _transformButtonsInc[TRANSFORM_ROTATION][CONTROL_FIELD_Y];
        transformButton->subscribeEvent(CEGUI::PushButton::EventClicked, 
                                        CEGUI::Event::Subscriber(&GUIEditor::Handle_IncrementRotationY, this));
    }
    // Decrement Y Rotation
    {
        _transformButtonsDec[TRANSFORM_ROTATION][CONTROL_FIELD_Y] = EditorBar->getChild("DecRotationYButton");
        transformButton = _transformButtonsDec[TRANSFORM_ROTATION][CONTROL_FIELD_Y];
        transformButton->subscribeEvent(CEGUI::PushButton::EventClicked, 
                                        CEGUI::Event::Subscriber(&GUIEditor::Handle_DecrementRotationY, this));
    }
    // Increment Z Rotation
    {
        _transformButtonsInc[TRANSFORM_ROTATION][CONTROL_FIELD_Z] = EditorBar->getChild("IncRotationZButton");
        transformButton = _transformButtonsInc[TRANSFORM_ROTATION][CONTROL_FIELD_Z];
        transformButton->subscribeEvent(CEGUI::PushButton::EventClicked, 
                                        CEGUI::Event::Subscriber(&GUIEditor::Handle_IncrementRotationZ, this));
    }
    // Decrement Z Rotation
    {
        _transformButtonsDec[TRANSFORM_ROTATION][CONTROL_FIELD_Z] = EditorBar->getChild("DecRotationZButton");
        transformButton = _transformButtonsDec[TRANSFORM_ROTATION][CONTROL_FIELD_Z];
        transformButton->subscribeEvent(CEGUI::PushButton::EventClicked, 
                                        CEGUI::Event::Subscriber(&GUIEditor::Handle_DecrementRotationZ, this));
    }
    // Increment Rotation Granularity
    {
        _transformButtonsInc[TRANSFORM_ROTATION][CONTROL_FIELD_GRANULARITY] = EditorBar->getChild("IncRotationGranButton");
        transformButton = _transformButtonsInc[TRANSFORM_ROTATION][CONTROL_FIELD_GRANULARITY];
        transformButton->subscribeEvent(CEGUI::PushButton::EventClicked,
                                        CEGUI::Event::Subscriber(&GUIEditor::Handle_IncrementRotationGranularity, this));
    }
    // Decrement Rotation Granularity
    {
        _transformButtonsDec[TRANSFORM_ROTATION][CONTROL_FIELD_GRANULARITY] = EditorBar->getChild("DecRotationGranButton");
        transformButton = _transformButtonsDec[TRANSFORM_ROTATION][CONTROL_FIELD_GRANULARITY];
        transformButton->subscribeEvent(CEGUI::PushButton::EventClicked, 
                                        CEGUI::Event::Subscriber(&GUIEditor::Handle_DecrementRotationGranularity, this));
    }
    // Increment X Scale
    {
        _transformButtonsInc[TRANSFORM_SCALE][CONTROL_FIELD_X] = EditorBar->getChild("IncScaleXButton");
        _transformButtonsInc[TRANSFORM_SCALE][CONTROL_FIELD_X];
        transformButton->subscribeEvent(CEGUI::PushButton::EventClicked, 
                                        CEGUI::Event::Subscriber(&GUIEditor::Handle_IncrementScaleX, this));
    }
    // Decrement X Scale
    {
        _transformButtonsDec[TRANSFORM_SCALE][CONTROL_FIELD_X] = EditorBar->getChild("DecScaleXButton");
        transformButton = _transformButtonsDec[TRANSFORM_SCALE][CONTROL_FIELD_X];
        transformButton->subscribeEvent(CEGUI::PushButton::EventClicked, 
                                        CEGUI::Event::Subscriber(&GUIEditor::Handle_DecrementScaleX, this));
    }
    // Increment Y Scale
    {
        _transformButtonsInc[TRANSFORM_SCALE][CONTROL_FIELD_Y]= EditorBar->getChild("IncScaleYButton");
        transformButton = _transformButtonsInc[TRANSFORM_SCALE][CONTROL_FIELD_Y];
        transformButton->subscribeEvent(CEGUI::PushButton::EventClicked, 
                                        CEGUI::Event::Subscriber(&GUIEditor::Handle_IncrementScaleY, this));
    }
    // Decrement Y Scale
    {
        _transformButtonsDec[TRANSFORM_SCALE][CONTROL_FIELD_Y] = EditorBar->getChild("DecScaleYButton");
        transformButton = _transformButtonsDec[TRANSFORM_SCALE][CONTROL_FIELD_Y];
        transformButton->subscribeEvent(CEGUI::PushButton::EventClicked,
                                        CEGUI::Event::Subscriber(&GUIEditor::Handle_DecrementScaleY, this));
    }
    // Increment Z Scale
    {
        _transformButtonsInc[TRANSFORM_SCALE][CONTROL_FIELD_Z] = EditorBar->getChild("IncScaleZButton");
        transformButton = _transformButtonsInc[TRANSFORM_SCALE][CONTROL_FIELD_Z];
        transformButton->subscribeEvent(CEGUI::PushButton::EventClicked, 
                                        CEGUI::Event::Subscriber(&GUIEditor::Handle_IncrementScaleZ, this));
    }
    // Decrement Z Scale
    {
        _transformButtonsDec[TRANSFORM_SCALE][CONTROL_FIELD_Z] = EditorBar->getChild("DecScaleZButton");
        transformButton = _transformButtonsDec[TRANSFORM_SCALE][CONTROL_FIELD_Z];
        transformButton->subscribeEvent(CEGUI::PushButton::EventClicked, 
                                        CEGUI::Event::Subscriber(&GUIEditor::Handle_DecrementScaleZ, this));
    }
    // Increment Scale Granularity
    {
        _transformButtonsInc[TRANSFORM_SCALE][CONTROL_FIELD_GRANULARITY] = EditorBar->getChild("IncScaleGranButton");
        transformButton = _transformButtonsInc[TRANSFORM_SCALE][CONTROL_FIELD_GRANULARITY];
        transformButton->subscribeEvent(CEGUI::PushButton::EventClicked, 
                                        CEGUI::Event::Subscriber(&GUIEditor::Handle_IncrementScaleGranularity, this));
    }
    // Decrement Scale Granularity
    {
        _transformButtonsDec[TRANSFORM_SCALE][CONTROL_FIELD_GRANULARITY] = EditorBar->getChild("DecScaleGranButton");
        transformButton = _transformButtonsDec[TRANSFORM_SCALE][CONTROL_FIELD_GRANULARITY];
        transformButton->subscribeEvent(CEGUI::PushButton::EventClicked, 
                                        CEGUI::Event::Subscriber(&GUIEditor::Handle_DecrementScaleGranularity, this));
    }
}

bool GUIEditor::Handle_MenuBarClickOn(const CEGUI::EventArgs &e) {
    _wasControlClick = true;
    return true;
}

bool GUIEditor::Handle_EditFieldClick(const CEGUI::EventArgs &e) {
    _pauseSelectionTracking = true;
    return true;
}

bool GUIEditor::Handle_CreateNavMesh(const CEGUI::EventArgs &e) {
    D_PRINT_FN("[Editor]: NavMesh creation queued!");
	GUI::getInstance().getConsole()->setVisible(true);
	_createNavMeshQueued = true;
	return true;
}

bool GUIEditor::Handle_SaveScene(const CEGUI::EventArgs &e) {
    D_PRINT_FN("[Editor]: Saving scene!");
    return true;
}

bool GUIEditor::Handle_SaveSelection(const CEGUI::EventArgs &e) {
    D_PRINT_FN("[Editor]: Saving selection!");
    return true;
}

bool GUIEditor::Handle_DeleteSelection(const CEGUI::EventArgs &e) {
    D_PRINT_FN("[Editor]: Deleting selection!");
    return true;
}

bool GUIEditor::Handle_ReloadScene(const CEGUI::EventArgs &e) {
    D_PRINT_FN("[Editor]: Reloading scene!");
    return true;
}

bool GUIEditor::Handle_PrintSceneGraph(const CEGUI::EventArgs &e) {
    D_PRINT_FN("[Editor]:Printing scene graph!");
    GET_ACTIVE_SCENEGRAPH()->print();
    return true;
}

bool GUIEditor::Handle_WireframeToggle(const CEGUI::EventArgs &e) {
    if ( _toggleButtons[TOGGLE_WIREFRAME]->isSelected() ) {
        D_PRINT_FN("[Editor]: Wireframe rendering enabled!");
    } else {
        D_PRINT_FN("[Editor]: Wireframe rendering disabled!");
    }
    if (_currentSelection) {
        _currentSelection->getComponent<RenderingComponent>()->renderWireframe(_toggleButtons[TOGGLE_WIREFRAME]->isSelected());
    }
    return true;
}

bool GUIEditor::Handle_DepthPreviewToggle(const CEGUI::EventArgs &e) {
    if ( _toggleButtons[TOGGLE_DEPTH_PREVIEW]->isSelected() ) {
        D_PRINT_FN("[Editor]: Depth Preview enabled!");
    } else {
        D_PRINT_FN("[Editor]: Depth Preview disabled!");
    }
    ParamHandler::getInstance().setParam("postProcessing.fullScreenDepthBuffer", 
                                         _toggleButtons[TOGGLE_DEPTH_PREVIEW]->isSelected());
    return true;
}

bool GUIEditor::Handle_ShadowMappingToggle(const CEGUI::EventArgs &e) {
    if ( _toggleButtons[TOGGLE_SHADOW_MAPPING]->isSelected() ) {
        D_PRINT_FN("[Editor]: Shadow Mapping enabled!");
    } else {
        D_PRINT_FN("[Editor]: Shadow Mapping disabled!");
    }
    if (_currentSelection) {
        _currentSelection->getComponent<RenderingComponent>()->castsShadows(_toggleButtons[TOGGLE_SHADOW_MAPPING]->isSelected());
    }
    return true;
}

bool GUIEditor::Handle_FogToggle(const CEGUI::EventArgs &e) {
    if (_toggleButtons[TOGGLE_FOG]->isSelected() ) {
        D_PRINT_FN("[Editor]: Fog enabled!");
    } else {
        D_PRINT_FN("[Editor]: Fog disabled!");
    }

    ParamHandler::getInstance().setParam("rendering.enableFog", _toggleButtons[TOGGLE_FOG]->isSelected());

    return true;
}

bool GUIEditor::Handle_PostFXToggle(const CEGUI::EventArgs &e) {
    if ( _toggleButtons[TOGGLE_POST_FX]->isSelected() ) {
        D_PRINT_FN("[Editor]: PostFX enabled!");
    } else {
        D_PRINT_FN("[Editor]: PostFX disabled!");
    }
    GFX_DEVICE.postProcessingEnabled(_toggleButtons[TOGGLE_POST_FX]->isSelected());
    return true;
}

bool GUIEditor::Handle_BoundingBoxesToggle(const CEGUI::EventArgs &e) {
    if ( _toggleButtons[TOGGLE_BOUNDING_BOXES]->isSelected() ) {
        D_PRINT_FN("[Editor]: Bounding Box rendering enabled!");
    } else {
        D_PRINT_FN("[Editor]: Bounding Box rendering disabled!");
    }
    if (_currentSelection) {
        RenderingComponent* rComp = _currentSelection->getComponent<RenderingComponent>();
        rComp->renderBoundingBox(_toggleButtons[TOGGLE_BOUNDING_BOXES]->isSelected());
    }
    return true;
}

bool GUIEditor::Handle_DrawNavMeshToggle(const CEGUI::EventArgs &e) {
    if ( _toggleButtons[TOGGLE_NAV_MESH_DRAW]->isSelected() ) {
        D_PRINT_FN("[Editor]: NavMesh rendering enabled!");
    } else {
        D_PRINT_FN("[Editor]: NavMesh rendering disabled!");
    }
    AI::AIManager::getInstance().toggleNavMeshDebugDraw(_toggleButtons[TOGGLE_NAV_MESH_DRAW]->isSelected());
    return true;
}

bool GUIEditor::Handle_SkeletonsToggle(const CEGUI::EventArgs &e) {
    if ( _toggleButtons[TOGGLE_SKELETONS]->isSelected() ) {
        D_PRINT_FN("[Editor]: Skeleton rendering enabled!");
    } else {
        D_PRINT_FN("[Editor]: Skeleton rendering disabled!");
    }

    if (_currentSelection) {
        _currentSelection->getComponent<RenderingComponent>()->renderSkeleton(_toggleButtons[TOGGLE_SKELETONS]->isSelected());
    }
    return true;
}

bool GUIEditor::Handle_PositionXChange(const CEGUI::EventArgs &e) {
    D_PRINT_FN("[Editor]: Position X changed via text edit!");
    F32 x = CEGUI::PropertyHelper<F32>::fromString(_valuesField[TRANSFORM_POSITION][CONTROL_FIELD_X]->getText());
    _currentValues[TRANSFORM_POSITION][CONTROL_FIELD_X] = x;
    _currentSelection->getComponent<PhysicsComponent>()->setPositionX(_currentValues[TRANSFORM_POSITION][CONTROL_FIELD_X]);
    _pauseSelectionTracking = false;
    return true;
}

bool GUIEditor::Handle_PositionYChange(const CEGUI::EventArgs &e) {
    D_PRINT_FN("[Editor]: Position Y changed via text edit!");
    F32 y = CEGUI::PropertyHelper<F32>::fromString(_valuesField[TRANSFORM_POSITION][CONTROL_FIELD_Y]->getText());
    _currentValues[TRANSFORM_POSITION][CONTROL_FIELD_Y] = y;
    _currentSelection->getComponent<PhysicsComponent>()->setPositionY(_currentValues[TRANSFORM_POSITION][CONTROL_FIELD_Y]);
    _pauseSelectionTracking = false;
    return true;
}

bool GUIEditor::Handle_PositionZChange(const CEGUI::EventArgs &e) {
    D_PRINT_FN("[Editor]: Position Z changed via text edit!");
    F32 z = CEGUI::PropertyHelper<F32>::fromString(_valuesField[TRANSFORM_POSITION][CONTROL_FIELD_Z]->getText());
    _currentValues[TRANSFORM_POSITION][CONTROL_FIELD_Z] = z;
    _currentSelection->getComponent<PhysicsComponent>()->setPositionZ(_currentValues[TRANSFORM_POSITION][CONTROL_FIELD_Z]);
    _pauseSelectionTracking = false;
    return true;
}

bool GUIEditor::Handle_PositionGranularityChange(const CEGUI::EventArgs &e) {
    D_PRINT_FN("[Editor]: Position Granularity changed via text edit!");
    F32 gran = CEGUI::PropertyHelper<F32>::fromString(_valuesField[TRANSFORM_POSITION][CONTROL_FIELD_GRANULARITY]->getText());
    _currentValues[TRANSFORM_POSITION][CONTROL_FIELD_GRANULARITY] = gran;
    CLAMP<F32>(_currentValues[TRANSFORM_POSITION][CONTROL_FIELD_GRANULARITY], 0.0000001f, 10000000.0f);
    CEGUI::String granStr = CEGUI::PropertyHelper<F32>::toString(_currentValues[TRANSFORM_POSITION][CONTROL_FIELD_GRANULARITY]);
    _valuesField[TRANSFORM_POSITION][CONTROL_FIELD_GRANULARITY]->setText(granStr);
    return true;
}

bool GUIEditor::Handle_RotationXChange(const CEGUI::EventArgs &e) {
    D_PRINT_FN("[Editor]: Rotation X changed via text edit!");
    F32 x = CEGUI::PropertyHelper<F32>::fromString(_valuesField[TRANSFORM_ROTATION][CONTROL_FIELD_X]->getText());
    _currentValues[TRANSFORM_ROTATION][CONTROL_FIELD_X] = x;
    CLAMP<F32>(_currentValues[TRANSFORM_ROTATION][CONTROL_FIELD_X], -360.0f, 360.0f);
    CEGUI::String xStr = CEGUI::PropertyHelper<F32>::toString(_currentValues[TRANSFORM_ROTATION][CONTROL_FIELD_X]);
    _valuesField[TRANSFORM_ROTATION][CONTROL_FIELD_X]->setText(xStr);
    PhysicsComponent* pComp = _currentSelection->getComponent<PhysicsComponent>();
    pComp->setRotation(vec3<F32>(_currentValues[TRANSFORM_ROTATION][CONTROL_FIELD_X],
                                 _currentValues[TRANSFORM_ROTATION][CONTROL_FIELD_Y],
                                 _currentValues[TRANSFORM_ROTATION][CONTROL_FIELD_Z]));
    _pauseSelectionTracking = false;
    return true;
}

bool GUIEditor::Handle_RotationYChange(const CEGUI::EventArgs &e) {
    D_PRINT_FN("[Editor]: Rotation Y changed via text edit!");
    F32 y = CEGUI::PropertyHelper<F32>::fromString(_valuesField[TRANSFORM_ROTATION][CONTROL_FIELD_Y]->getText());
    _currentValues[TRANSFORM_ROTATION][CONTROL_FIELD_Y] = y;
    CLAMP<F32>(_currentValues[TRANSFORM_ROTATION][CONTROL_FIELD_Y], -360.0f, 360.0f);
    CEGUI::String yStr = CEGUI::PropertyHelper<F32>::toString(_currentValues[TRANSFORM_ROTATION][CONTROL_FIELD_Y]);
    _valuesField[TRANSFORM_ROTATION][CONTROL_FIELD_Y]->setText(yStr);
    PhysicsComponent* pComp = _currentSelection->getComponent<PhysicsComponent>();
    pComp->setRotation(vec3<F32>(_currentValues[TRANSFORM_ROTATION][CONTROL_FIELD_X],
                                 _currentValues[TRANSFORM_ROTATION][CONTROL_FIELD_Y],
                                 _currentValues[TRANSFORM_ROTATION][CONTROL_FIELD_Z]));
    _pauseSelectionTracking = false;
    return true;
}

bool GUIEditor::Handle_RotationZChange(const CEGUI::EventArgs &e) {
    D_PRINT_FN("[Editor]: Position X changed via text edit!");
    F32 z = CEGUI::PropertyHelper<F32>::fromString(_valuesField[TRANSFORM_ROTATION][CONTROL_FIELD_Z]->getText());
    _currentValues[TRANSFORM_ROTATION][CONTROL_FIELD_Z] = z;
    CLAMP<F32>(_currentValues[TRANSFORM_ROTATION][CONTROL_FIELD_Z], -360.0f, 360.0f);
    CEGUI::String zStr = CEGUI::PropertyHelper<F32>::toString(_currentValues[TRANSFORM_ROTATION][CONTROL_FIELD_Z]);
    _valuesField[TRANSFORM_ROTATION][CONTROL_FIELD_Z]->setText(zStr);
    PhysicsComponent* pComp = _currentSelection->getComponent<PhysicsComponent>();
    pComp->setRotation(vec3<F32>(_currentValues[TRANSFORM_ROTATION][CONTROL_FIELD_X],
                                 _currentValues[TRANSFORM_ROTATION][CONTROL_FIELD_Y],
                                 _currentValues[TRANSFORM_ROTATION][CONTROL_FIELD_Z]));
    _pauseSelectionTracking = false;
    return true;
}

bool GUIEditor::Handle_RotationGranularityChange(const CEGUI::EventArgs &e) {
    D_PRINT_FN("[Editor]: Rotation Granularity changed via text edit!");
    F32 gran = CEGUI::PropertyHelper<F32>::fromString(_valuesField[TRANSFORM_ROTATION][CONTROL_FIELD_GRANULARITY]->getText());
    _currentValues[TRANSFORM_ROTATION][CONTROL_FIELD_GRANULARITY] = gran;
    CLAMP<F32>(_currentValues[TRANSFORM_ROTATION][CONTROL_FIELD_GRANULARITY], 0.0000001f, 359.0f);
    CEGUI::String granStr = CEGUI::PropertyHelper<F32>::toString(_currentValues[TRANSFORM_ROTATION][CONTROL_FIELD_GRANULARITY]);
    _valuesField[TRANSFORM_ROTATION][CONTROL_FIELD_GRANULARITY]->setText(granStr);
    return true;
}

bool GUIEditor::Handle_ScaleXChange(const CEGUI::EventArgs &e) {
    D_PRINT_FN("[Editor]: Scale X changed via text edit!");
    F32 x = CEGUI::PropertyHelper<F32>::fromString(_valuesField[TRANSFORM_SCALE][CONTROL_FIELD_X]->getText());
    _currentValues[TRANSFORM_SCALE][CONTROL_FIELD_X] = x;
    _currentSelection->getComponent<PhysicsComponent>()->setScaleX(_currentValues[TRANSFORM_SCALE][CONTROL_FIELD_X]);
    _pauseSelectionTracking = false;
    return true;
}

bool GUIEditor::Handle_ScaleYChange(const CEGUI::EventArgs &e) {
    D_PRINT_FN("[Editor]: Scale Y changed via text edit!");
    F32 y = CEGUI::PropertyHelper<F32>::fromString(_valuesField[TRANSFORM_SCALE][CONTROL_FIELD_Y]->getText());
    _currentValues[TRANSFORM_SCALE][CONTROL_FIELD_Y] = y;
    _currentSelection->getComponent<PhysicsComponent>()->setScaleY(_currentValues[TRANSFORM_SCALE][CONTROL_FIELD_Y]);
    _pauseSelectionTracking = false;
    return true;
}

bool GUIEditor::Handle_ScaleZChange(const CEGUI::EventArgs &e) {
    D_PRINT_FN("[Editor]: Scale Z changed via text edit!");
    F32 z = CEGUI::PropertyHelper<F32>::fromString(_valuesField[TRANSFORM_SCALE][CONTROL_FIELD_Z]->getText());
    _currentValues[TRANSFORM_SCALE][CONTROL_FIELD_Z] = z;
    _currentSelection->getComponent<PhysicsComponent>()->setScaleZ(_currentValues[TRANSFORM_SCALE][CONTROL_FIELD_Z]);
    _pauseSelectionTracking = false;
    return true;
}

bool GUIEditor::Handle_ScaleGranularityChange(const CEGUI::EventArgs &e) {
    D_PRINT_FN("[Editor]: Scale Granularity changed via text edit!");
    F32 gran = CEGUI::PropertyHelper<F32>::fromString(_valuesField[TRANSFORM_SCALE][CONTROL_FIELD_GRANULARITY]->getText());
    _currentValues[TRANSFORM_SCALE][CONTROL_FIELD_GRANULARITY] = gran;
    CLAMP<F32>(_currentValues[TRANSFORM_SCALE][CONTROL_FIELD_GRANULARITY], 0.0000001f, 10000000.0f);
    CEGUI::String granStr = CEGUI::PropertyHelper<F32>::toString(_currentValues[TRANSFORM_SCALE][CONTROL_FIELD_GRANULARITY]);
    _valuesField[TRANSFORM_SCALE][CONTROL_FIELD_GRANULARITY]->setText(granStr);
    return true;
}

bool GUIEditor::Handle_IncrementPositionX(const CEGUI::EventArgs &e) {
    D_PRINT_FN("[Editor]: Position X incremented via button!");
    // If we don't have a selection, the button is disabled
    assert(_currentSelection != nullptr);
    _currentValues[TRANSFORM_POSITION][CONTROL_FIELD_X] += _currentValues[TRANSFORM_POSITION][CONTROL_FIELD_GRANULARITY];
    _currentSelection->getComponent<PhysicsComponent>()->setPositionX(_currentValues[TRANSFORM_POSITION][CONTROL_FIELD_X]);
    return true;
}

bool GUIEditor::Handle_DecrementPositionX(const CEGUI::EventArgs &e) {
    D_PRINT_FN("[Editor]: Position X decremented via button!");
    // If we don't have a selection, the button is disabled
    assert(_currentSelection != nullptr);
    _currentValues[TRANSFORM_POSITION][CONTROL_FIELD_X] -= _currentValues[TRANSFORM_POSITION][CONTROL_FIELD_GRANULARITY];
    _currentSelection->getComponent<PhysicsComponent>()->setPositionX(_currentValues[TRANSFORM_POSITION][CONTROL_FIELD_X]);
    return true;
}

bool GUIEditor::Handle_IncrementPositionY(const CEGUI::EventArgs &e) {
    D_PRINT_FN("[Editor]: Position Y incremented via button!");
    // If we don't have a selection, the button is disabled
    assert(_currentSelection != nullptr);
    _currentValues[TRANSFORM_POSITION][CONTROL_FIELD_Y] += _currentValues[TRANSFORM_POSITION][CONTROL_FIELD_GRANULARITY];
    _currentSelection->getComponent<PhysicsComponent>()->setPositionY(_currentValues[TRANSFORM_POSITION][CONTROL_FIELD_Y]);
    return true;
}

bool GUIEditor::Handle_DecrementPositionY(const CEGUI::EventArgs &e) {
    D_PRINT_FN("[Editor]: Position Y decremented via button!");
    // If we don't have a selection, the button is disabled
    assert(_currentSelection != nullptr);
    _currentValues[TRANSFORM_POSITION][CONTROL_FIELD_Y] -= _currentValues[TRANSFORM_POSITION][CONTROL_FIELD_GRANULARITY];
    _currentSelection->getComponent<PhysicsComponent>()->setPositionY(_currentValues[TRANSFORM_POSITION][CONTROL_FIELD_Y]);
    return true;
}

bool GUIEditor::Handle_IncrementPositionZ(const CEGUI::EventArgs &e) {
    D_PRINT_FN("[Editor]: Position Z incremented via button!");
    // If we don't have a selection, the button is disabled
    assert(_currentSelection != nullptr);
    _currentValues[TRANSFORM_POSITION][CONTROL_FIELD_Z] += _currentValues[TRANSFORM_POSITION][CONTROL_FIELD_GRANULARITY];
    _currentSelection->getComponent<PhysicsComponent>()->setPositionZ(_currentValues[TRANSFORM_POSITION][CONTROL_FIELD_Z]);
    return true;
}

bool GUIEditor::Handle_DecrementPositionZ(const CEGUI::EventArgs &e) {
    D_PRINT_FN("[Editor]: Position Z decremented via button!");
    // If we don't have a selection, the button is disabled
    assert(_currentSelection != nullptr);
    _currentValues[TRANSFORM_POSITION][CONTROL_FIELD_Z] -= _currentValues[TRANSFORM_POSITION][CONTROL_FIELD_GRANULARITY];
    _currentSelection->getComponent<PhysicsComponent>()->setPositionZ(_currentValues[TRANSFORM_POSITION][CONTROL_FIELD_Z]);
    return true;
}

bool GUIEditor::Handle_IncrementPositionGranularity(const CEGUI::EventArgs &e) {
    D_PRINT_FN("[Editor]: Position Granularity incremented via button!");
    F32 pos = std::min(_currentValues[TRANSFORM_POSITION][CONTROL_FIELD_GRANULARITY] * 10.0f, 10000000.0f);
    _currentValues[TRANSFORM_POSITION][CONTROL_FIELD_GRANULARITY] = pos;
    CEGUI::String posStr = CEGUI::PropertyHelper<F32>::toString(_currentValues[TRANSFORM_POSITION][CONTROL_FIELD_GRANULARITY]);
    _valuesField[TRANSFORM_POSITION][CONTROL_FIELD_GRANULARITY]->setText(posStr);
    return true;
}

bool GUIEditor::Handle_DecrementPositionGranularity(const CEGUI::EventArgs &e) {
    D_PRINT_FN("[Editor]: Position Granularity decremented via button!");
    F32 pos = std::max(_currentValues[TRANSFORM_POSITION][CONTROL_FIELD_GRANULARITY] / 10.0f, 0.0000001f);
    _currentValues[TRANSFORM_POSITION][CONTROL_FIELD_GRANULARITY] = pos;
    CEGUI::String posStr = CEGUI::PropertyHelper<F32>::toString(_currentValues[TRANSFORM_POSITION][CONTROL_FIELD_GRANULARITY]);
    _valuesField[TRANSFORM_POSITION][CONTROL_FIELD_GRANULARITY]->setText(posStr);
    return true;
}

bool GUIEditor::Handle_IncrementRotationX(const CEGUI::EventArgs &e) {
    D_PRINT_FN("[Editor]: Rotation X incremented via button!");
    assert(_currentSelection != nullptr);
    _currentValues[TRANSFORM_ROTATION][CONTROL_FIELD_X] += _currentValues[TRANSFORM_ROTATION][CONTROL_FIELD_GRANULARITY];
    PhysicsComponent* pComp = _currentSelection->getComponent<PhysicsComponent>();
    pComp->setRotation(vec3<F32>(_currentValues[TRANSFORM_ROTATION][CONTROL_FIELD_X],
                                 _currentValues[TRANSFORM_ROTATION][CONTROL_FIELD_Y],
                                 _currentValues[TRANSFORM_ROTATION][CONTROL_FIELD_Z]));
    return true;
}

bool GUIEditor::Handle_DecrementRotationX(const CEGUI::EventArgs &e) {
    D_PRINT_FN("[Editor]: Rotation X decremented via button!");
    assert(_currentSelection != nullptr);
    _currentValues[TRANSFORM_ROTATION][CONTROL_FIELD_X] -= _currentValues[TRANSFORM_ROTATION][CONTROL_FIELD_GRANULARITY];
    PhysicsComponent* pComp = _currentSelection->getComponent<PhysicsComponent>();
    pComp->setRotation(vec3<F32>(_currentValues[TRANSFORM_ROTATION][CONTROL_FIELD_X],
                                 _currentValues[TRANSFORM_ROTATION][CONTROL_FIELD_Y],
                                 _currentValues[TRANSFORM_ROTATION][CONTROL_FIELD_Z]));
    return true;
}

bool GUIEditor::Handle_IncrementRotationY(const CEGUI::EventArgs &e) {
    D_PRINT_FN("[Editor]: Rotation Y incremented via button!");
    assert(_currentSelection != nullptr);
    _currentValues[TRANSFORM_ROTATION][CONTROL_FIELD_Y] += _currentValues[TRANSFORM_ROTATION][CONTROL_FIELD_GRANULARITY];
    PhysicsComponent* pComp = _currentSelection->getComponent<PhysicsComponent>();
    pComp->setRotation(vec3<F32>(_currentValues[TRANSFORM_ROTATION][CONTROL_FIELD_X],
                                 _currentValues[TRANSFORM_ROTATION][CONTROL_FIELD_Y],
                                 _currentValues[TRANSFORM_ROTATION][CONTROL_FIELD_Z]));
    return true;
}

bool GUIEditor::Handle_DecrementRotationY(const CEGUI::EventArgs &e) {
    D_PRINT_FN("[Editor]: Rotation Y decremented via button!");
    assert(_currentSelection != nullptr);
    _currentValues[TRANSFORM_ROTATION][CONTROL_FIELD_Y] -= _currentValues[TRANSFORM_ROTATION][CONTROL_FIELD_GRANULARITY];
    PhysicsComponent* pComp = _currentSelection->getComponent<PhysicsComponent>();
    pComp->setRotation(vec3<F32>(_currentValues[TRANSFORM_ROTATION][CONTROL_FIELD_X],
                                 _currentValues[TRANSFORM_ROTATION][CONTROL_FIELD_Y],
                                 _currentValues[TRANSFORM_ROTATION][CONTROL_FIELD_Z]));
    return true;
}

bool GUIEditor::Handle_IncrementRotationZ(const CEGUI::EventArgs &e) {
    D_PRINT_FN("[Editor]: Rotation Z incremented via button!");
    assert(_currentSelection != nullptr);
    _currentValues[TRANSFORM_ROTATION][CONTROL_FIELD_Z] += _currentValues[TRANSFORM_ROTATION][CONTROL_FIELD_GRANULARITY];
    PhysicsComponent* pComp = _currentSelection->getComponent<PhysicsComponent>();
    pComp->setRotation(vec3<F32>(_currentValues[TRANSFORM_ROTATION][CONTROL_FIELD_X],
                                 _currentValues[TRANSFORM_ROTATION][CONTROL_FIELD_Y],
                                 _currentValues[TRANSFORM_ROTATION][CONTROL_FIELD_Z]));
    return true;
}

bool GUIEditor::Handle_DecrementRotationZ(const CEGUI::EventArgs &e) {
    D_PRINT_FN("[Editor]: Rotation Z decremented via button!");
    assert(_currentSelection != nullptr);
    _currentValues[TRANSFORM_ROTATION][CONTROL_FIELD_Z] -= _currentValues[TRANSFORM_ROTATION][CONTROL_FIELD_GRANULARITY];
    PhysicsComponent* pComp = _currentSelection->getComponent<PhysicsComponent>();
    pComp->setRotation(vec3<F32>(_currentValues[TRANSFORM_ROTATION][CONTROL_FIELD_X],
                                 _currentValues[TRANSFORM_ROTATION][CONTROL_FIELD_Y],
                                 _currentValues[TRANSFORM_ROTATION][CONTROL_FIELD_Z]));
    return true;
}

bool GUIEditor::Handle_IncrementRotationGranularity(const CEGUI::EventArgs &e) {
    D_PRINT_FN("[Editor]: Rotation Granularity incremented via button!");
    F32 gran = std::min(_currentValues[TRANSFORM_ROTATION][CONTROL_FIELD_GRANULARITY] * 10.0f, 359.0f);
    _currentValues[TRANSFORM_ROTATION][CONTROL_FIELD_GRANULARITY] = gran;
    CEGUI::String granStr = CEGUI::PropertyHelper<F32>::toString(_currentValues[TRANSFORM_ROTATION][CONTROL_FIELD_GRANULARITY]);
    _valuesField[TRANSFORM_ROTATION][CONTROL_FIELD_GRANULARITY]->setText(granStr);
    return true;
}

bool GUIEditor::Handle_DecrementRotationGranularity(const CEGUI::EventArgs &e) {
    D_PRINT_FN("[Editor]: Rotation Granularity decremented via button!");
    F32 gran = std::max(_currentValues[TRANSFORM_ROTATION][CONTROL_FIELD_GRANULARITY] / 10.0f, 0.0000001f);
    _currentValues[TRANSFORM_ROTATION][CONTROL_FIELD_GRANULARITY] = gran;
    CEGUI::String granStr = CEGUI::PropertyHelper<F32>::toString(_currentValues[TRANSFORM_ROTATION][CONTROL_FIELD_GRANULARITY]);
    _valuesField[TRANSFORM_ROTATION][CONTROL_FIELD_GRANULARITY]->setText(granStr);
    return true;
}

bool GUIEditor::Handle_IncrementScaleX(const CEGUI::EventArgs &e) {
    D_PRINT_FN("[Editor]: Scale X incremented via button!");
    assert(_currentSelection != nullptr);
    _currentValues[TRANSFORM_SCALE][CONTROL_FIELD_X] += _currentValues[TRANSFORM_SCALE][CONTROL_FIELD_GRANULARITY];
    _currentSelection->getComponent<PhysicsComponent>()->setScaleX(_currentValues[TRANSFORM_SCALE][CONTROL_FIELD_X]);
    return true;
}

bool GUIEditor::Handle_DecrementScaleX(const CEGUI::EventArgs &e) {
    D_PRINT_FN("[Editor]: Scale X decremented via button!");
    assert(_currentSelection != nullptr);
    _currentValues[TRANSFORM_SCALE][CONTROL_FIELD_X] -= _currentValues[TRANSFORM_SCALE][CONTROL_FIELD_GRANULARITY];
    _currentSelection->getComponent<PhysicsComponent>()->setScaleX(_currentValues[TRANSFORM_SCALE][CONTROL_FIELD_X]);
    return true;
}

bool GUIEditor::Handle_IncrementScaleY(const CEGUI::EventArgs &e) {
    D_PRINT_FN("[Editor]: Scale Y incremented via button!");
    assert(_currentSelection != nullptr);
    _currentValues[TRANSFORM_SCALE][CONTROL_FIELD_Y] += _currentValues[TRANSFORM_SCALE][CONTROL_FIELD_GRANULARITY];
    _currentSelection->getComponent<PhysicsComponent>()->setScaleY(_currentValues[TRANSFORM_SCALE][CONTROL_FIELD_Y]);
    return true;
}

bool GUIEditor::Handle_DecrementScaleY(const CEGUI::EventArgs &e) {
    D_PRINT_FN("[Editor]: Scale Y decremented via button!");
    assert(_currentSelection != nullptr);
    _currentValues[TRANSFORM_SCALE][CONTROL_FIELD_Y] -= _currentValues[TRANSFORM_SCALE][CONTROL_FIELD_GRANULARITY];
    _currentSelection->getComponent<PhysicsComponent>()->setScaleY(_currentValues[TRANSFORM_SCALE][CONTROL_FIELD_Y]);
    return true;
}

bool GUIEditor::Handle_IncrementScaleZ(const CEGUI::EventArgs &e) {
    D_PRINT_FN("[Editor]: Scale Z incremented via button!");
    assert(_currentSelection != nullptr);
    _currentValues[TRANSFORM_SCALE][CONTROL_FIELD_Z] += _currentValues[TRANSFORM_SCALE][CONTROL_FIELD_GRANULARITY];
    _currentSelection->getComponent<PhysicsComponent>()->setScaleZ(_currentValues[TRANSFORM_SCALE][CONTROL_FIELD_Z]);
    return true;
}

bool GUIEditor::Handle_DecrementScaleZ(const CEGUI::EventArgs &e) {
    D_PRINT_FN("[Editor]: Scale Z decremented via button!");
    _currentValues[TRANSFORM_SCALE][CONTROL_FIELD_Z] -= _currentValues[TRANSFORM_SCALE][CONTROL_FIELD_GRANULARITY];
    _currentSelection->getComponent<PhysicsComponent>()->setScaleZ(_currentValues[TRANSFORM_SCALE][CONTROL_FIELD_Z]);
    return true;
}

bool GUIEditor::Handle_IncrementScaleGranularity(const CEGUI::EventArgs &e) {
    D_PRINT_FN("[Editor]: Scale Granularity incremented via button!");
    F32 gran = std::min(_currentValues[TRANSFORM_SCALE][CONTROL_FIELD_GRANULARITY] * 10.0f, 10000000.0f);
    _currentValues[TRANSFORM_SCALE][CONTROL_FIELD_GRANULARITY] = gran;
    CEGUI::String granStr = CEGUI::PropertyHelper<F32>::toString(_currentValues[TRANSFORM_SCALE][CONTROL_FIELD_GRANULARITY]);
    _valuesField[TRANSFORM_SCALE][CONTROL_FIELD_GRANULARITY]->setText(granStr);
    return true;
}

bool GUIEditor::Handle_DecrementScaleGranularity(const CEGUI::EventArgs &e) {
    D_PRINT_FN("[Editor]: Scale Granularity decremented via button!");
    F32 gran = std::max(_currentValues[TRANSFORM_SCALE][CONTROL_FIELD_GRANULARITY] / 10.0f, 0.0000001f);
    _currentValues[TRANSFORM_SCALE][CONTROL_FIELD_GRANULARITY] = gran;
    CEGUI::String granStr = CEGUI::PropertyHelper<F32>::toString(_currentValues[TRANSFORM_SCALE][CONTROL_FIELD_GRANULARITY]);
    _valuesField[TRANSFORM_SCALE][CONTROL_FIELD_GRANULARITY]->setText(granStr);
    return true;
}

}; //namespace Divide

Commits for Divide-Framework/trunk/Source Code/GUI/GUIEditor/GUIEditor.cpp

Diff revisions: vs.
Revision Author Commited Message
331 Diff Diff IonutCava picture IonutCava Sat 06 Dec, 2014 20:53:45 +0000

[Ionut]
- Limited line length to 132 characters to improve readability and diff-comparisons
- Refactored memory allocation/deallocation functions
- Fixed a few compatibility issues with HashMap.h
- Fixed a bug in GPU Skinning shaders (cast a float to int)

330 Diff Diff IonutCava picture IonutCava Fri 10 Oct, 2014 17:19:11 +0000

[Ionut]
- New rendering algorithm :
— Perform second pass for visible nodes gathering all render commands and uploading them to an indirect draw buffer
— Render geometry with indirect draw commands
— Removed per-node range binding of the node buffer. Instead, bind the entire buffer once and index data in shaders
— Use “baseInstance” parameter from IndirectDrawCommand as a node buffer index
— Prefer DSA extensions for updating buffer data where applicable
- Moved all rendering specific code from SceneGraphNode to a new RenderingComponent
- Optimized “toString” utility function

329 Diff Diff IonutCava picture IonutCava Tue 07 Oct, 2014 12:51:37 +0000

[Ionut]
- Modified material class and shaders to support multiple BRDFs (currently, only Flat, Phong and Blinn-Phong supported with Cook-Torrance and Oren-Nayar in future commits)
- Optimized transform updates and queries
- Fixed an indirect draw command (no buffer was bound to GL_DRAW_INDIRECT_BUFFER, violating a core requirement)

325 Diff Diff IonutCava picture IonutCava Wed 17 Sep, 2014 20:06:13 +0000

[Ionut]
- Reworked transform system:
— Parent transform chain system moved from Transform class to the PhysicsComponent
— PhysicsComponent now returns all transform values needed both global and local (still needs heavy optimization and caching)

- Reworked SceneGraph node management:
— Proper ref counting of SceneNodes and proper removing of resource (ResourceCache is now empty on destruction, as it should be)
— Removed parent transform tracking as that’s the PhysicsComponent’s responsibility
— Only nodes loaded via the ResourceCache are allowed to be added to the SceneGraph (added proper loaders for Impostors, Sky, etc)

- Optimized some of the math classes (mat4, mat3)

322 Diff Diff IonutCava picture IonutCava Sat 06 Sep, 2014 20:33:47 +0000

[Ionut]
- Refactored most of Boost related code to be C++11 based
— Boost is only used for ThreadPool, Mutex handling, XML parsing and networking (ASIO)
— Function binds, threads, regex, NonCopyable base, Hashing algorithms and more are now using C++11 libraries
- Replaced all FOR_EACH calls with standard, range, “for” calls

321 Diff Diff IonutCava picture IonutCava Wed 03 Sep, 2014 22:05:15 +0000

[Ionut]
- Added support (and enabled by default) for the EASTL library (http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2271.html / https://github.com/paulhodge/EASTL)
— Strings, vectors and hash_maps can be combined from EASTL, STL and Boost (not all combinations work. e.g. EASTL strings with STL/Boost containers due to the lack of a proper hash function)

318 Diff Diff IonutCava picture IonutCava Sat 30 Aug, 2014 17:35:53 +0000

[Ionut]
- Wrapped the entire code in a “Divide” namespace
- VertexBuffers now call “shrink_to_fit” on all internal data storage
- Improved some vector performance by preferring “emplace_back” instead of “push_back” + proepr usage of reserve / resize
- Wrapped OIS specific types and classes in Divide::Input namespace
- Added the messageBox.layout file (forgot it in the previous few commits)

311 Diff Diff IonutCava picture IonutCava Mon 18 Aug, 2014 21:40:52 +0000

[Ionut]
- Added a basic AESOP implementation
- Moved all AI related classes under the “AI” namespace

310 Diff Diff IonutCava picture IonutCava Sun 17 Aug, 2014 23:31:04 +0000

[Ionut]
- Some cleanups in AI related classes

308 IonutCava picture IonutCava Sat 16 Aug, 2014 19:49:31 +0000

[Ionut]
- Moved Transform from SceneGraphNode to PhysicsComponent and modified BoundingBox update system based on transform update
- Added PhysicsAsset to PhysicsComponent for interfacing with PshysicsAPIs (e.g. PhysXActor inherits PhysicsAsset)
- PhysicsAsset keeps track of the parent PhysicsComponent to have direct access to a node’s transform
- Rewrote GUIConsole to only print items when visible, and use a single circular buffer for entries.
- Updated GUI input system to match the interface that both Kernel and SceneManager share (should probably abstract all the input methods in a class and have Kernel, SceneManager, Scene and GUI inherit from that. In next commit.)
- Updated CEGUI to probably match the OIS states(mouse, keyboard, etc) and properly inject time inputs.