Skip to content

Commit

Permalink
Fix types and typos in LODManager causing issues. Disable some eslint…
Browse files Browse the repository at this point in the history
… rules.
  • Loading branch information
digisomni committed Feb 9, 2024
1 parent 1ba840b commit 62d2db2
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 23 deletions.
4 changes: 2 additions & 2 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -225,8 +225,8 @@ module.exports = {
"no-unreachable-loop": "error",
"no-unsafe-optional-chaining": "error",
"no-unsafe-call": "off",
"@typescript-eslint/no-unsafe-assignment": ["warn"],
"@typescript-eslint/no-unsafe-member-access": ["warn"],
"@typescript-eslint/no-unsafe-assignment": ["off"],
"@typescript-eslint/no-unsafe-member-access": ["off"],
"@typescript-eslint/no-unsafe-argument": ["warn"],
"@typescript-eslint/no-unsafe-call": ["warn"],
"no-useless-backreference": "error",
Expand Down
26 changes: 13 additions & 13 deletions src/modules/scene/LODManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,19 +77,19 @@ export const AutoTargets: { [key in MeshTypes.LOD.Levels]?: AutoTarget } = {

export class LODManager {
public static parseMeshName(name: string): {
prefix?: string;
lodLevel?: string;
name?: string;
suffix?: string;
prefix: string | null;
lodLevel: string | null;
name: string | null;
suffix: string | null;
} {
const lodPattern = /^(?<prefix>.*)_(?<lodLevel>LOD[0-4])(?<suffix>.*)?$/u;
const match = name.match(lodPattern);

return {
prefix: match?.groups?.prefix,
lodLevel: match?.groups?.lodLevel,
prefix: match?.groups?.prefix ?? null,
lodLevel: match?.groups?.lodLevel ?? null,
name,
suffix: match?.groups?.suffix,
suffix: match?.groups?.suffix ?? null,
};
}

Expand All @@ -99,7 +99,8 @@ export class LODManager {

const meshMetadata = new MeshTypes.Metadata();

if (meshExtras === null || meshExtras === undefined && parentExtras !== null || parentExtras !== undefined) {
if ((meshExtras === null || meshExtras === undefined)
&& (parentExtras !== null && parentExtras !== undefined)) {
meshMetadata.vircadia_lod_mode = parentExtras?.vircadia_lod_mode;
meshMetadata.vircadia_lod_auto = parentExtras?.vircadia_lod_auto;
meshMetadata.vircadia_lod_distance = parentExtras?.vircadia_lod_distance;
Expand Down Expand Up @@ -202,12 +203,12 @@ export class LODManager {
}

const roots: {
prefix: string | undefined;
suffix: string | undefined;
name: string | undefined;
prefix: string | null;
suffix: string | null;
name: string | null;
mesh: Mesh;
metadata: MeshTypes.Metadata;
lodLevel: string | undefined;
lodLevel: string | null;
simplificationSettings: ISimplificationSettings[];
}[] = [];

Expand Down Expand Up @@ -307,7 +308,6 @@ export class LODManager {

break;
}
// FIXME: ??? TS
case MeshTypes.LOD.Modes.SIZE: {
let sizeTarget =
SizeTargets[level as keyof typeof SizeTargets];
Expand Down
16 changes: 8 additions & 8 deletions types/vircadia_gameUse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ export namespace glTF {
}

export class Metadata implements MetadataInterface {
public vircadia_lod_mode = null;
public vircadia_lod_auto = null;
public vircadia_lod_distance = null;
public vircadia_lod_size = null;
public vircadia_lod_hide = null;
public vircadia_billboard_mode = null;
public vircadia_lightmap_default = null;
public vircadia_lightmap_texcoord = null;
public vircadia_lod_mode: LOD.Modes | null = null;
public vircadia_lod_auto: boolean | null = null;
public vircadia_lod_distance: number | null = null;
public vircadia_lod_size: number | null = null;
public vircadia_lod_hide: number | null = null;
public vircadia_billboard_mode: string | null = null;
public vircadia_lightmap_default: string | null = null;
public vircadia_lightmap_texcoord: number | null = null;
}

export namespace LOD {
Expand Down

0 comments on commit 62d2db2

Please sign in to comment.