Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[submodule "RLHD"]
path = RLHD
url = https://github.com/117HD/RLHD.git
branch = master
branch = master
[submodule "Tools/rlawt"]
path = Tools/rlawt
url = https://github.com/aHooder/rlawt
39 changes: 39 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# 117HD Editor design rules

These rules apply to the editor in `Tools/Dev`.

## Typography

- Use IBM Plex Sans for labels, buttons, menus, headings, help text, and body copy. Use `WorkspaceStyle.UI` for 400, `MEDIUM` for 500, and `SEMIBOLD` for 600.
- Use JetBrains Mono for values, IDs, gamevals, enum names, coordinates, shortcuts, and expressions such as `h == 63 && s > 0`. Use `WorkspaceStyle.MONO` for 400 and `MONO_SEMIBOLD` for 600.
- Use the bundled font faces through `WorkspaceStyle` and derive only the size. Give mixed labels and technical values separate components when practical. Avoid Swing's default fonts and synthetic bold or italic.
- Segmented controls use UI typography by default. Use `.values()` for segments that show values or enum names.

## Reusable UI

- Use the existing editor builders for buttons, text, selects, segmented controls, toggles, and modals. Start with `EditorButton`, `EditorText`, `EditorSelect`, `SegmentedControl`, `ToggleSwitch`, and `EditorModal`.
- Put reusable variants, icons, state styling, and interaction behavior in the shared editor components. Keep screen-specific data and action callbacks in the screen. Use `WorkspaceStyle` for palette tokens, SVG icons, and custom cursors.
- Use `PropertyRow` for aligned property fields, `PropertySection` for collapsible groups, `PopupLayer` for dropdowns, `HdContextMenu` for context menus, and `EditorScrollPane` where content needs scrolling.
- Check narrow docks and open menus against the handoff. Preserve control heights, align field edges, and keep labels and buttons clear of clipping. Verify hover, focus, selected, and disabled states when changing a shared component.
- Keep editor changes in this repository's developer tools. Use the existing reflection adapters when accessing RLHD internals.

### Adding editor controls

- Use `EditorButton.builder()` for actions and toggles. Omit a fixed size for text buttons so the label can fit.
- Use `EditorSearch.builder()` for search panels. Set the placeholder and `onChange` callback, and use `field()` to focus, clear, or read the search.
- Use `EditorButtonGroup.builder()` for content-width mode switches. Add `track()` for the viewport toolbar style. Use `SegmentedControl.builder()` for equal-width property options.
- Use `EditorPanels.stack()` for a transparent column and `EditorPanels.centered(component)` to preserve a control's preferred size inside a stretching panel.

Example for a filter and a viewport mode switch

```java
var filter = EditorSearch.builder("Filter by name")
.onChange(this::filterByName)
.build();

var modes = EditorButtonGroup.builder(List.of("Vanilla", "Override", "Split"))
.selected("Override")
.track()
.onChange(this::setPreviewMode)
.build();
```
48 changes: 48 additions & 0 deletions Tools/Dev/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ sourceSets.test.runtimeClasspath += sourceSets.developer.output

def lwjglVersion = '3.3.2'
dependencies {
add('developerImplementation', 'net.runelite:cache:1.13.+') {
exclude group: 'org.slf4j', module: 'slf4j-simple'
}

add('developerImplementation', 'org.mockito:mockito-core:5.14.2')

add('developerImplementation', platform("org.lwjgl:lwjgl-bom:$lwjglVersion"))
add('developerImplementation', "org.lwjgl:lwjgl")
add('developerImplementation', "org.lwjgl:lwjgl-assimp")
Expand All @@ -41,10 +47,52 @@ tasks.named('processDeveloperResources') {
}
}

tasks.register('simulatedRender', JavaExec) {
group = 'application'
description = 'Draws a cache scene with the real 117 HD renderer, without RuneLite'
dependsOn tasks.named('classes'), tasks.named('developerClasses')
classpath = sourceSets.developer.runtimeClasspath
mainClass = 'rs117.hd.dev.sceneloader.standalone.ui.HdPreview'
workingDir = project.rootProject.projectDir
jvmArgs '-ea', '-Xmx2G'
if (project.hasProperty('simArgs'))
args project.property('simArgs').toString().split('\\s+')
}

tasks.register('benchmark', JavaExec) {
group = 'verification'
description = 'Times 117 HD drawing a cache scene, and writes the frame timers to a CSV'
dependsOn tasks.named('classes'), tasks.named('developerClasses')
classpath = sourceSets.developer.runtimeClasspath
mainClass = 'rs117.hd.dev.sceneloader.standalone.headless.HdBenchmark'
workingDir = project.rootProject.projectDir
jvmArgs '-ea', '-Xmx2G'
if (project.hasProperty('simArgs'))
args project.property('simArgs').toString().split('\\s+')
}

tasks.register('developerJar', Jar) {
dependsOn tasks.named('classes'), tasks.named('developerClasses'), tasks.named('processDeveloperResources')
from sourceSets.developer.output
archiveClassifier.set('developer')
archiveFileName.set("${rootProject.name}-${project.version}-developer.jar")
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
}

tasks.register('devToolsEditor', JavaExec) {
group = 'application'
description = 'Opens the standalone 117HD Editor (Model Overrides, Environments and Definitions)'
dependsOn tasks.named('developerClasses')
classpath = sourceSets.developer.runtimeClasspath
mainClass = 'rs117.hd.dev.editor.EditorShell'
workingDir = project.rootProject.projectDir
jvmArgs '-ea', '-Xmx2G'
systemProperty 'rlhd.resource-path', project.file('src/main/resources').absolutePath
def environments = rootProject.file('environments.json')
if (environments.isFile())
systemProperty 'rlhd.environments-path', environments.absolutePath
if (project.hasProperty('editorCache'))
systemProperty 'rlhd.editor-cache', project.property('editorCache')
if (project.hasProperty('editorModel'))
systemProperty 'rlhd.editor-model', project.property('editorModel')
}
12 changes: 12 additions & 0 deletions Tools/Dev/java/rs117/hd/DeveloperConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,20 @@

import net.runelite.client.config.Config;
import net.runelite.client.config.ConfigGroup;
import net.runelite.client.config.ConfigItem;

@ConfigGroup("117hd-developer")
public interface DeveloperConfig extends Config {
String CONFIG_GROUP = "117hd-developer";

String KEY_CACHE_SCENE = "cacheScene";
@ConfigItem(
keyName = KEY_CACHE_SCENE,
name = "Cache Scene",
description = "Add the 117 HD Cache Scene sidebar, for loading any region straight from the cache without travelling there",
position = 1
)
default boolean cacheScene() {
return true;
}
}
39 changes: 38 additions & 1 deletion Tools/Dev/java/rs117/hd/DeveloperPlugin.java
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
package rs117.hd;

import com.google.inject.Provides;
import javax.annotation.Nullable;
import javax.inject.Inject;
import javax.inject.Provider;
import javax.inject.Singleton;
import lombok.extern.slf4j.Slf4j;
import net.runelite.client.callback.ClientThread;
import net.runelite.client.config.ConfigManager;
import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.events.ConfigChanged;
import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor;
import net.runelite.client.plugins.PluginManager;
import rs117.hd.dev.sceneloader.SceneLoader;
import rs117.hd.model.ModelExporter;
import rs117.hd.model.ModelImporter;
import rs117.hd.utils.Props;
Expand All @@ -34,9 +37,16 @@ public class DeveloperPlugin extends Plugin {
@Inject
private PluginManager pluginManager;

@Inject
private DeveloperConfig config;

private ModelExporter modelExporter;
private ModelImporter modelImporter;

// From 117 HD's injector, so it works with the running 117 HD's renderer, scene & managers
@Nullable
private volatile SceneLoader sceneLoader;

@Provides
DeveloperConfig provideConfig(ConfigManager configManager) {
return configManager.getConfig(DeveloperConfig.class);
Expand All @@ -57,12 +67,22 @@ protected void startUp() {
modelExporter = injector.getInstance(ModelExporter.class);
modelImporter = injector.getInstance(ModelImporter.class);

var loader = injector.getInstance(SceneLoader.class);
sceneLoader = loader;
if (config.cacheScene())
loader.startUp();

return true;
});
}

@Override
protected void shutDown() {
var loader = sceneLoader;
sceneLoader = null;
if (loader != null)
loader.shutDown();

clientThread.invoke(() -> {
if (modelImporter != null)
modelImporter.close();
Expand All @@ -72,4 +92,21 @@ protected void shutDown() {
modelExporter = null;
});
}

@Subscribe
public void onConfigChanged(ConfigChanged event) {
if (!event.getGroup().equals(DeveloperConfig.CONFIG_GROUP))
return;

if (event.getKey().equals(DeveloperConfig.KEY_CACHE_SCENE)) {
var loader = sceneLoader;
if (loader == null)
return;
if (config.cacheScene()) {
loader.startUp();
} else {
loader.shutDown();
}
}
}
}
Loading