Skip to content

Commit

Permalink
Project Settings: add loading
Browse files Browse the repository at this point in the history
  • Loading branch information
LeoVgr committed Jan 7, 2025
1 parent 4621dc6 commit 122c877
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 8 deletions.
8 changes: 8 additions & 0 deletions bin/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -3545,6 +3545,14 @@ div.gradient-box {
.project-settings h1 {
margin: 5px 5px 5px 10px;
}
.project-settings .loading {
display: flex;
margin-left: 10px;
}
.project-settings .loading .ico {
margin-right: 5px;
align-self: center;
}
.project-settings .body {
width: 100%;
height: 100%;
Expand Down
10 changes: 10 additions & 0 deletions bin/style.less
Original file line number Diff line number Diff line change
Expand Up @@ -4142,6 +4142,16 @@ div.gradient-box {
margin: 5px 5px 5px 10px;
}

.loading {
display: flex;
margin-left: 10px;

.ico {
margin-right: 5px;
align-self: center;
}
}

.body {
width: 100%;
height:100%;
Expand Down
30 changes: 22 additions & 8 deletions hide/view/settings/ProjectSettings.hx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ typedef LocalSetting = {

enum Filter {
NONE;
LOD;
MATLIB;
RENDERPROPS;
}
Expand All @@ -18,15 +17,13 @@ class ProjectSettings extends hide.ui.View<{}> {

public static var MATLIB_ENTRY = "materialLibraries";
public static var RENDERPROPS_ENTRY = "scene.renderProps";
public static var LOD_ENTRY = "lods.screenRatio";

var settings : Array<LocalSetting>;
var currentFilter = Filter.NONE;

public function new( ?state ) {
super(state);
settings = [];
getPropsFiles(ide.projectDir);
settings = null;
}

override function getTitle() {
Expand All @@ -37,6 +34,25 @@ class ProjectSettings extends hide.ui.View<{}> {
keys.register("undo", function() undo.undo());
keys.register("redo", function() undo.redo());

new Element('<div class="project-settings">
<h1>Project settings</h1>
<div class="loading">
<div class="ico ico-spinner fa-spin"></div>
<p>Loading settings ...</p>
</div>
</div>').appendTo(element);
}

override function onActivate() {
super.onActivate();

if (settings != null)
return;

settings = [];
getPropsFiles(ide.projectDir);

element.empty();
var root = new Element('<div class="project-settings">
<h1>Project settings</h1>
<div class="body">
Expand All @@ -46,9 +62,8 @@ class ProjectSettings extends hide.ui.View<{}> {
<p>Filter : </p>
<select class="filter">
<option value="0" selected>None</option>
<option value="1">LODs</option>
<option value="2">Material libraries</option>
<option value="3">Render props</option>
<option value="1">Material libraries</option>
<option value="2">Render props</option>
</select>
</div>
</div>
Expand Down Expand Up @@ -86,7 +101,6 @@ class ProjectSettings extends hide.ui.View<{}> {

var filtered = false;
if (!currentFilter.match(Filter.NONE)) {
filtered = filtered || currentFilter.match(Filter.LOD) && !Reflect.hasField(s.content, LOD_ENTRY);
filtered = filtered || currentFilter.match(Filter.MATLIB) && !Reflect.hasField(s.content, MATLIB_ENTRY);
filtered = filtered || currentFilter.match(Filter.RENDERPROPS) && !Reflect.hasField(s.content, RENDERPROPS_ENTRY);
}
Expand Down

0 comments on commit 122c877

Please sign in to comment.