Skip to content

Commit

Permalink
User Experience Updates (#440)
Browse files Browse the repository at this point in the history
* Update parameters panel to enable visibility by default

Beginners should be able to see the parameter panel when they first use the software

* Allow viewport and node panels to use select all and clear hotkeys

* Clean up indentation
  • Loading branch information
r888800009 authored Sep 29, 2024
1 parent 2134952 commit 906a4ae
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 9 deletions.
26 changes: 26 additions & 0 deletions source/creator/package.d
Original file line number Diff line number Diff line change
Expand Up @@ -561,6 +561,32 @@ void incSelectAll() {
}
}

/**
Unselects nodes
*/
void incUnselectNodes() {
if (incArmedParameter()) return;
incSelectNode();
}

/**
ModelEdit common Hotkeys
this hotkeys are used in Viewport Panel and Node Panel
*/
void incModelEditorCommonHotKeys() {
import creator.core.input;
if (incEditMode != EditMode.ModelEdit)
return;

if (!incArmedParameter && (igIsWindowFocused(ImGuiFocusedFlags.ChildWindows) || igIsWindowHovered(ImGuiHoveredFlags.ChildWindows))) {
if (incShortcut("Ctrl+A"))
incSelectAll();

if (igIsKeyDown(ImGuiKey.Escape))
incUnselectNodes();
}
}

/**
Gets whether the node is in the selection
*/
Expand Down
9 changes: 1 addition & 8 deletions source/creator/panels/nodes.d
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import creator;
import creator.widgets;
import creator.ext;
import creator.core;
import creator.core.input;
import creator.utils;
import inochi2d;
import std.string;
Expand Down Expand Up @@ -476,13 +475,7 @@ protected:
override
void onUpdate() {

if (incEditMode == EditMode.ModelEdit) {
if (!incArmedParameter && (igIsWindowFocused(ImGuiFocusedFlags.ChildWindows) || igIsWindowHovered(ImGuiHoveredFlags.ChildWindows))) {
if (incShortcut("Ctrl+A")) {
incSelectAll();
}
}
}
incModelEditorCommonHotKeys();

if (incEditMode == EditMode.VertexEdit) {
incLabelOver(_("In vertex edit mode..."), ImVec2(0, 0), true);
Expand Down
2 changes: 1 addition & 1 deletion source/creator/panels/parameters.d
Original file line number Diff line number Diff line change
Expand Up @@ -1266,7 +1266,7 @@ protected:

public:
this() {
super("Parameters", _("Parameters"), false);
super("Parameters", _("Parameters"), true);
}
}

Expand Down
2 changes: 2 additions & 0 deletions source/creator/panels/viewport.d
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ protected:
auto drawList = igGetWindowDrawList();
auto window = igGetCurrentWindow();

incModelEditorCommonHotKeys();

// Draw viewport itself
ImVec2 currSize;
igGetContentRegionAvail(&currSize);
Expand Down

0 comments on commit 906a4ae

Please sign in to comment.