You've already forked Nitro_Render_V3
mirror of
https://github.com/duckietm/Nitro_Render_V3.git
synced 2026-06-20 07:26:18 +00:00
🆕 Added support for JSON5
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import { IAssetManager, IAvatarFigureContainer, IAvatarImageListener } from '@nitrots/api';
|
||||
import { GetConfiguration } from '@nitrots/configuration';
|
||||
import { AvatarRenderLibraryEvent, GetEventDispatcher, NitroEvent, NitroEventType } from '@nitrots/events';
|
||||
import { parseConfigJsonFromResponse } from '@nitrots/utils';
|
||||
import { AvatarAssetDownloadLibrary } from './AvatarAssetDownloadLibrary';
|
||||
import { AvatarStructure } from './AvatarStructure';
|
||||
|
||||
@@ -57,11 +58,11 @@ export class AvatarAssetDownloadManager
|
||||
|
||||
try
|
||||
{
|
||||
responseData = await response.json();
|
||||
responseData = await parseConfigJsonFromResponse(response, url);
|
||||
}
|
||||
catch(parseErr)
|
||||
{
|
||||
throw new Error(`Invalid JSON in figure map "${ url }" — the URL may be wrong. Check "avatar.figuremap.url" in renderer-config.json (${ parseErr.message })`);
|
||||
throw new Error(`Invalid figure map "${ url }" — JSON/JSON5 parse failed. Check "avatar.figuremap.url" in renderer-config.json (${ parseErr.message })`);
|
||||
}
|
||||
|
||||
this.processFigureMap(responseData.libraries);
|
||||
|
||||
@@ -2,6 +2,7 @@ import { AvatarSetType, IAssetManager, IAvatarEffectListener, IAvatarFigureConta
|
||||
import { GetAssetManager } from '@nitrots/assets';
|
||||
import { GetConfiguration } from '@nitrots/configuration';
|
||||
import { GetEventDispatcher, NitroEventType } from '@nitrots/events';
|
||||
import { parseConfigJsonFromResponse } from '@nitrots/utils';
|
||||
import { AvatarAssetDownloadManager } from './AvatarAssetDownloadManager';
|
||||
import { AvatarFigureContainer } from './AvatarFigureContainer';
|
||||
import { AvatarImage } from './AvatarImage';
|
||||
@@ -87,11 +88,11 @@ export class AvatarRenderManager implements IAvatarRenderManager
|
||||
|
||||
try
|
||||
{
|
||||
this._structure.updateActions(await response.json());
|
||||
this._structure.updateActions(await parseConfigJsonFromResponse(response, url));
|
||||
}
|
||||
catch(parseErr)
|
||||
{
|
||||
throw new Error(`Invalid JSON from "${ url }" — the URL may be wrong and returning an HTML page instead of JSON. Check "avatar.actions.url" in renderer-config.json (${ parseErr.message })`);
|
||||
throw new Error(`Invalid avatar actions "${ url }" — JSON/JSON5 parse failed. Check "avatar.actions.url" in renderer-config.json (${ parseErr.message })`);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -120,11 +121,11 @@ export class AvatarRenderManager implements IAvatarRenderManager
|
||||
|
||||
try
|
||||
{
|
||||
this._structure.figureData.appendJSON(await response.json());
|
||||
this._structure.figureData.appendJSON(await parseConfigJsonFromResponse(response, url));
|
||||
}
|
||||
catch(parseErr)
|
||||
{
|
||||
throw new Error(`Invalid JSON from "${ url }" — the URL may be wrong and returning an HTML page instead of JSON. Check "avatar.figuredata.url" in renderer-config.json (${ parseErr.message })`);
|
||||
throw new Error(`Invalid figure data "${ url }" — JSON/JSON5 parse failed. Check "avatar.figuredata.url" in renderer-config.json (${ parseErr.message })`);
|
||||
}
|
||||
|
||||
this._structure.init();
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { IAssetManager, IAvatarEffectListener } from '@nitrots/api';
|
||||
import { GetConfiguration } from '@nitrots/configuration';
|
||||
import { AvatarRenderEffectLibraryEvent, GetEventDispatcher, NitroEvent, NitroEventType } from '@nitrots/events';
|
||||
import { parseConfigJsonFromResponse } from '@nitrots/utils';
|
||||
import { AvatarStructure } from './AvatarStructure';
|
||||
import { EffectAssetDownloadLibrary } from './EffectAssetDownloadLibrary';
|
||||
|
||||
@@ -48,11 +49,11 @@ export class EffectAssetDownloadManager
|
||||
|
||||
try
|
||||
{
|
||||
responseData = await response.json();
|
||||
responseData = await parseConfigJsonFromResponse(response, url);
|
||||
}
|
||||
catch(parseErr)
|
||||
{
|
||||
throw new Error(`Invalid JSON in effect map "${ url }" — the URL may be wrong. Check "avatar.effectmap.url" in renderer-config.json (${ parseErr.message })`);
|
||||
throw new Error(`Invalid effect map "${ url }" — JSON/JSON5 parse failed. Check "avatar.effectmap.url" in renderer-config.json (${ parseErr.message })`);
|
||||
}
|
||||
|
||||
this.processEffectMap(responseData.effects);
|
||||
|
||||
Reference in New Issue
Block a user