Skip to content

Commit d40cffc

Browse files
committed
gh-87: rework ui xml markup and rtti improvements
- ui markup stores elements tree template - ui markup instantiated using rtti clone - ui binding reworked - simplify, add multi-way bindins - ui bindable now any rtti object - support rtti clone op - support rtti save & load type refs - refactor rtti annotations
1 parent 4f14824 commit d40cffc

File tree

94 files changed

+1238
-1384
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

94 files changed

+1238
-1384
lines changed
Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -25,24 +25,20 @@
2525
/* SOFTWARE. */
2626
/**********************************************************************************/
2727

28-
#include "ui_bindable.hpp"
28+
#pragma once
2929

30-
namespace wmoge {
31-
32-
void UiBindable::set_bind_info(UiBindInfo info) {
33-
m_bind_info = std::move(info);
34-
}
30+
#include "core/ref.hpp"
3531

36-
void UiBindable::notify_changed(Strid poperty_id) const {
37-
m_bind_info.notify_changed(poperty_id);
38-
}
32+
namespace wmoge {
3933

40-
UiElement* UiBindable::find_element_by(Strid tag) const {
41-
return m_bind_info.find_element(tag);
42-
}
34+
class EdtSceneChunk : public RefCnt {
35+
public:
36+
private:
37+
};
4338

44-
UiElement* UiBindable::get_root_element() const {
45-
return m_bind_info.root_element;
46-
}
39+
class EdtScene : public RefCnt {
40+
public:
41+
private:
42+
};
4743

48-
}// namespace wmoge
44+
}// namespace wmoge
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
/**********************************************************************************/
2+
/* Wmoge game engine */
3+
/* Available at github https://github.com/EgorOrachyov/wmoge */
4+
/**********************************************************************************/
5+
/* MIT License */
6+
/* */
7+
/* Copyright (c) 2023 Egor Orachyov */
8+
/* */
9+
/* Permission is hereby granted, free of charge, to any person obtaining a copy */
10+
/* of this software and associated documentation files (the "Software"), to deal */
11+
/* in the Software without restriction, including without limitation the rights */
12+
/* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell */
13+
/* copies of the Software, and to permit persons to whom the Software is */
14+
/* furnished to do so, subject to the following conditions: */
15+
/* */
16+
/* The above copyright notice and this permission notice shall be included in all */
17+
/* copies or substantial portions of the Software. */
18+
/* */
19+
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR */
20+
/* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, */
21+
/* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE */
22+
/* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER */
23+
/* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, */
24+
/* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE */
25+
/* SOFTWARE. */
26+
/**********************************************************************************/
27+
28+
#pragma once
29+
30+
namespace wmoge {
31+
32+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
/**********************************************************************************/
2+
/* Wmoge game engine */
3+
/* Available at github https://github.com/EgorOrachyov/wmoge */
4+
/**********************************************************************************/
5+
/* MIT License */
6+
/* */
7+
/* Copyright (c) 2023 Egor Orachyov */
8+
/* */
9+
/* Permission is hereby granted, free of charge, to any person obtaining a copy */
10+
/* of this software and associated documentation files (the "Software"), to deal */
11+
/* in the Software without restriction, including without limitation the rights */
12+
/* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell */
13+
/* copies of the Software, and to permit persons to whom the Software is */
14+
/* furnished to do so, subject to the following conditions: */
15+
/* */
16+
/* The above copyright notice and this permission notice shall be included in all */
17+
/* copies or substantial portions of the Software. */
18+
/* */
19+
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR */
20+
/* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, */
21+
/* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE */
22+
/* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER */
23+
/* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, */
24+
/* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE */
25+
/* SOFTWARE. */
26+
/**********************************************************************************/
27+
28+
#pragma once
29+
30+
namespace wmoge {
31+
32+
}

editor/icons/atlas.asset

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
version: 1
33
uuid: 0
44
loader: IconAtlasAssetLoader
5-
rtti: Icon
5+
rtti: IconAtlas
66
deps: [ ]
77
import_data:
88
rtti: IconAtlasImportData

editor/styles/dark.style

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ m_desc:
1111
child_border_size: 2
1212
popup_rounding: 0
1313
popup_border_size: 1
14-
frame_padding: 18 6
14+
frame_padding: 18 0
1515
frame_rounding: 6
1616
frame_border_size: 3
1717
menu_item_tab_size: 36
18-
item_spacing: 20 12
18+
item_spacing: 20 10
1919
item_inner_spacing: 8 4
2020
cell_padding: 16 10
2121
touch_extra_padding: 0 0

editor/views/window_main.xml

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
1-
<UiMainWindow
2-
tag="window_main"
3-
title="Wmoge Engine"
4-
meta:bindable="TestWindowMain">
5-
<UiMainWindow.menu_bar>
1+
<UiMainWindow tag="window_main" title="Wmoge Engine">
2+
<menu_bar>
63
<UiMenuBar tag="main_menu_bar">
74
<UiMenu name="File">
85
<UiSeparatorText label="SCENE" sub_style="separator"/>
@@ -20,6 +17,11 @@
2017
<UiMenuItem label="New Project"/>
2118
<UiMenuItem label="Open Project" disabled="true"/>
2219
<UiMenuItem label="Open Project Recent" selected="true"/>
20+
<UiMenuItem>
21+
<bindings>
22+
<UiBinding property="label" data_path="m_text" type="ToTarget"/>
23+
</bindings>
24+
</UiMenuItem>
2325
</UiMenu>
2426
<UiMenu name="Edit">
2527
</UiMenu>
@@ -31,15 +33,12 @@
3133
</UiMenu>
3234
<UiMenu name="Debug">
3335
<UiSeparatorText label="UI" sub_style="separator"/>
34-
<UiMenuItem
35-
label="Reload ui"
36-
bind:disabled="item_reload_ui_disabled"
37-
bind:on_click="item_reload_ui_on_click"/>
36+
<UiMenuItem label="Reload ui"/>
3837
</UiMenu>
3938
<UiMenu name="Help">
4039
</UiMenu>
4140
</UiMenuBar>
42-
</UiMainWindow.menu_bar>
41+
</menu_bar>
4342

4443
<UiDockSpace name="main_dock_space">
4544
<UiDockWindow title="Hierarchy" sub_style="panel">
@@ -50,6 +49,11 @@
5049
</UiDockWindow>
5150
<UiDockWindow title="Properties" sub_style="panel">
5251
<UiStackPanel>
52+
<UiSliderInt label="Bound int" value_min="0" value_max="10">
53+
<bindings>
54+
<UiBinding property="value" data_path="m_value" type="ToSource"/>
55+
</bindings>
56+
</UiSliderInt>
5357
<UiTextWrapped text="Here will be panel with properties of the seleceted entity. Visit link to get more information"/>
5458
<UiTextLink text="https://github.com/EgorOrachyov/wmoge"/>
5559
</UiStackPanel>

engine/code/asset/asset.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ namespace wmoge {
104104
};
105105

106106
WG_RTTI_CLASS_BEGIN(Asset) {
107-
WG_RTTI_META_DATA(RttiUiHint("Base class for any engine asset"));
107+
WG_RTTI_META_DATA({RttiUiHint("Base class for any engine asset")});
108108
WG_RTTI_FACTORY();
109109
WG_RTTI_FIELD(m_id, {RttiNoSaveLoad});
110110
WG_RTTI_FIELD(m_uuid, {RttiNoSaveLoad});

engine/code/asset/asset_import_data.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ namespace wmoge {
7575
};
7676

7777
WG_RTTI_CLASS_BEGIN(AssetImportData) {
78-
WG_RTTI_META_DATA(RttiUiName("Asset import data"), RttiUiHint("Asset manager assosiated data to import asset"));
78+
WG_RTTI_META_DATA({RttiUiName("Asset import data"), RttiUiHint("Asset manager assosiated data to import asset")});
7979
WG_RTTI_FACTORY();
8080
WG_RTTI_FIELD(source_files, {RttiOptional});
8181
WG_RTTI_METHOD(has_soruce_files, {}, {});

engine/code/asset/asset_loader.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ namespace wmoge {
8585
};
8686

8787
WG_RTTI_CLASS_BEGIN(AssetLoader) {
88-
WG_RTTI_META_DATA(RttiUiHint("Interface for an asset loader to implement custom loading"));
88+
WG_RTTI_META_DATA({RttiUiHint("Interface for an asset loader to implement custom loading")});
8989
}
9090
WG_RTTI_END;
9191

engine/code/asset/asset_meta.hpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
#include "core/string_id.hpp"
3636
#include "core/uuid.hpp"
3737
#include "rtti/traits.hpp"
38+
#include "rtti/type_ref.hpp"
3839

3940
#include <cinttypes>
4041
#include <optional>
@@ -64,7 +65,6 @@ namespace wmoge {
6465
};
6566

6667
WG_RTTI_STRUCT_BEGIN(AssetDataMeta) {
67-
WG_RTTI_META_DATA();
6868
WG_RTTI_FIELD(uuid, {RttiOptional});
6969
WG_RTTI_FIELD(hash, {RttiOptional});
7070
WG_RTTI_FIELD(size, {RttiOptional});
@@ -82,7 +82,7 @@ namespace wmoge {
8282

8383
UUID uuid;
8484
int version = 0;
85-
Strid rtti;
85+
RttiRefClass rtti;
8686
Strid loader;
8787
Strid importer;
8888
std::vector<Strid> deps;
@@ -92,7 +92,6 @@ namespace wmoge {
9292
};
9393

9494
WG_RTTI_STRUCT_BEGIN(AssetMeta) {
95-
WG_RTTI_META_DATA();
9695
WG_RTTI_FIELD(uuid, {RttiOptional});
9796
WG_RTTI_FIELD(version, {RttiOptional});
9897
WG_RTTI_FIELD(rtti, {});

0 commit comments

Comments
 (0)