Skip to content

Commit 1f21446

Browse files
committed
Fix a few UUID problems
1 parent 45ccd34 commit 1f21446

File tree

4 files changed

+32
-7
lines changed

4 files changed

+32
-7
lines changed

src/modelFormat.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,7 @@ export const ajCodec = new Blockbench.Codec('ajmodel', {
398398
meta: {
399399
format: ajCodec.format.id,
400400
format_version: FORMAT_VERSION,
401-
uuid: Project.animated_java_uuid,
401+
uuid: Project.animated_java_uuid || guid(),
402402
},
403403
animated_java: {
404404
settings: exportAnimatedJavaProjectSettings(),
@@ -615,11 +615,11 @@ export const ajModelFormat = new Blockbench.ModelFormat({
615615
},
616616
},
617617

618-
onSetup() {
619-
if (Project?.animated_java_settings) {
618+
onSetup(project: ModelProject, newModel = true) {
619+
if (project.animated_java_settings) {
620620
// Project Settings
621-
Project.animated_java_settings = getDefaultProjectSettings()
622-
for (const setting of Object.values(Project.animated_java_settings)) {
621+
project.animated_java_settings = getDefaultProjectSettings()
622+
for (const setting of Object.values(project.animated_java_settings)) {
623623
setting._onInit()
624624
}
625625
// Exporter Settings
@@ -631,7 +631,8 @@ export const ajModelFormat = new Blockbench.ModelFormat({
631631
setting._onInit()
632632
}
633633
}
634-
Project.animated_java_exporter_settings = settings
634+
if (newModel) project.animated_java_uuid = guid()
635+
project.animated_java_exporter_settings = settings
635636
}
636637
Group.all.forEach(v => v.createUniqueName())
637638
},

src/projectSettings.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,9 @@ export function getDefaultProjectSettings(): IAnimatedJavaProjectSettings {
143143
description: TRANSLATIONS.project_namespace.description,
144144
defaultValue: '',
145145
docsLink: '/docs/project_settings#project_namespace',
146+
get subtext() {
147+
return Project?.animated_java_uuid
148+
},
146149
},
147150
function onUpdate(setting) {
148151
if (setting.value === '')

src/settings.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ export interface ISettingOptions<V> {
2525
* A list of paragraphs to display in the description of the setting.
2626
*/
2727
description: string[]
28+
/**
29+
* A string to display below the setting's value in the settings dialog.
30+
*/
31+
subtext?: string
2832
/**
2933
* The default value of the setting.
3034
*/
@@ -56,6 +60,7 @@ export class Setting<V, R = any> extends Subscribable<R> {
5660
resettable?: boolean
5761
docsLink?: string
5862
dependsOn?: SettingID[]
63+
subtext?: string
5964

6065
private _initialized: boolean
6166
private _updating: boolean
@@ -82,6 +87,7 @@ export class Setting<V, R = any> extends Subscribable<R> {
8287
this.resettable = options.resettable
8388
this.docsLink = options.docsLink
8489
this.dependsOn = options.dependsOn
90+
this.subtext = options.subtext
8591

8692
this._value = this.defaultValue
8793
this.lastValue = this.defaultValue

src/ui/components/settingContainer.svelte

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,11 @@
7676

7777
<slot name="beneath" />
7878

79-
<div class="spacer" />
79+
{#if setting.subtext}
80+
<div class="subtext">{setting.subtext}</div>
81+
{:else}
82+
<div class="spacer" />
83+
{/if}
8084

8185
{#if descriptionVisible}
8286
<div
@@ -132,6 +136,17 @@
132136
margin-bottom: 0px;
133137
}
134138
139+
div.subtext {
140+
font-style: italic;
141+
font-size: 0.8em;
142+
color: var(--color-subtle_text);
143+
text-align: center;
144+
margin-top: 1px;
145+
margin-bottom: 1px;
146+
cursor: text;
147+
user-select: text;
148+
}
149+
135150
div.setting {
136151
display: flex;
137152
align-items: center;

0 commit comments

Comments
 (0)