Skip to content

Commit 9d3cd94

Browse files
committed
refact: lint
1 parent abd087f commit 9d3cd94

File tree

6 files changed

+17
-27
lines changed

6 files changed

+17
-27
lines changed

editor/src/editor/windows/effect-editor/converters/unity/colorConverter.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export function convertGradient(gradient: any): IConstantColor | IGradientColor
2121
const key = gradient[`key${i}`] ?? gradient[`m_ColorKeys`]?.[i];
2222
const timeRaw = gradient[`ctime${i}`] ?? gradient[`m_CTime${i}`] ?? 0;
2323
const time = typeof timeRaw === "number" ? timeRaw : parseFloat(timeRaw) / 65535;
24-
if (!key) continue;
24+
if (!key) {continue;}
2525
const r = key.r ?? key.m_R;
2626
const g = key.g ?? key.m_G;
2727
const b = key.b ?? key.m_B;
@@ -36,7 +36,7 @@ export function convertGradient(gradient: any): IConstantColor | IGradientColor
3636
const key = gradient[`key${i}`] ?? gradient[`m_AlphaKeys`]?.[i];
3737
const timeRaw = gradient[`atime${i}`] ?? gradient[`m_ATime${i}`] ?? 0;
3838
const time = typeof timeRaw === "number" ? timeRaw : parseFloat(timeRaw) / 65535;
39-
if (!key) continue;
39+
if (!key) {continue;}
4040
alphaKeys.push({
4141
time,
4242
value: parseFloat(key.a ?? key.m_A ?? "1"),

editor/src/editor/windows/effect-editor/converters/unity/particleSystemConverter.ts

Lines changed: 9 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,7 @@ function billboardFromRenderMode(renderMode: number | undefined): { isBillboardB
3838
4: { isBillboardBased: true, billboardMode: ParticleSystem.BILLBOARDMODE_Y },
3939
5: { isBillboardBased: true, billboardMode: ParticleSystem.BILLBOARDMODE_Y },
4040
};
41-
return renderMode !== undefined && renderMode in map
42-
? map[renderMode]
43-
: { isBillboardBased: true, billboardMode: ParticleSystem.BILLBOARDMODE_ALL };
41+
return renderMode !== undefined && renderMode in map ? map[renderMode] : { isBillboardBased: true, billboardMode: ParticleSystem.BILLBOARDMODE_ALL };
4442
}
4543

4644
/**
@@ -85,16 +83,8 @@ export function convertParticleSystem(unityPS: any, renderer: any): IParticleSys
8583
preWarmCycles: main.prewarm === "1" ? 100 : 0,
8684
isLocal: (getUnityProp(main, "simulationSpace") ?? main.simulationSpace) === "0",
8785

88-
color1: convertColor(
89-
maxColor
90-
? { r: maxColor.r ?? "1", g: maxColor.g ?? "1", b: maxColor.b ?? "1", a: maxColor.a ?? "1" }
91-
: { r: "1", g: "1", b: "1", a: "1" }
92-
),
93-
color2: convertColor(
94-
maxColor
95-
? { r: maxColor.r ?? "1", g: maxColor.g ?? "1", b: maxColor.b ?? "1", a: maxColor.a ?? "1" }
96-
: { r: "1", g: "1", b: "1", a: "1" }
97-
),
86+
color1: convertColor(maxColor ? { r: maxColor.r ?? "1", g: maxColor.g ?? "1", b: maxColor.b ?? "1", a: maxColor.a ?? "1" } : { r: "1", g: "1", b: "1", a: "1" }),
87+
color2: convertColor(maxColor ? { r: maxColor.r ?? "1", g: maxColor.g ?? "1", b: maxColor.b ?? "1", a: maxColor.a ?? "1" } : { r: "1", g: "1", b: "1", a: "1" }),
9888

9989
minInitialRotation: parseFloat(startRotation?.minScalar ?? startRotation?.scalar ?? "0"),
10090
maxInitialRotation: parseFloat(startRotation?.scalar ?? "0"),
@@ -221,7 +211,11 @@ export function convertParticleSystem(unityPS: any, renderer: any): IParticleSys
221211
}
222212

223213
// Rotation3DOverLife (if separate X, Y, Z)
224-
if (rotationOverLifetimeModule && isEnabled(rotationOverLifetimeModule) && (rotationOverLifetimeModule.separateAxes === "1" || getUnityProp(rotationOverLifetimeModule, "separateAxes") === "1")) {
214+
if (
215+
rotationOverLifetimeModule &&
216+
isEnabled(rotationOverLifetimeModule) &&
217+
(rotationOverLifetimeModule.separateAxes === "1" || getUnityProp(rotationOverLifetimeModule, "separateAxes") === "1")
218+
) {
225219
behaviors.push({
226220
type: "Rotation3DOverLife",
227221
angularVelocityX: convertMinMaxCurve(getUnityProp(rotationOverLifetimeModule, "x") ?? {}),
@@ -322,11 +316,7 @@ export function convertParticleSystem(unityPS: any, renderer: any): IParticleSys
322316
const sx = getUnityProp(noiseModule, "strengthX") ?? noiseModule.strengthX;
323317
const sy = getUnityProp(noiseModule, "strengthY") ?? noiseModule.strengthY;
324318
const sz = getUnityProp(noiseModule, "strengthZ") ?? noiseModule.strengthZ;
325-
config.noiseStrength = new Vector3(
326-
parseFloat(sx?.scalar ?? "0"),
327-
parseFloat(sy?.scalar ?? "0"),
328-
parseFloat(sz?.scalar ?? "0")
329-
);
319+
config.noiseStrength = new Vector3(parseFloat(sx?.scalar ?? "0"), parseFloat(sy?.scalar ?? "0"), parseFloat(sz?.scalar ?? "0"));
330320
}
331321

332322
config.behaviors = behaviors;

editor/src/editor/windows/effect-editor/converters/unity/shapeConverter.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ import { getUnityProp } from "./utils";
55
* Supports both property and m_Property names (Unity serialization).
66
*/
77
export function convertShape(shapeModule: any): any {
8-
if (!shapeModule) return { type: "point" };
8+
if (!shapeModule) {return { type: "point" };}
99
const enabled = getUnityProp(shapeModule, "enabled") ?? shapeModule.enabled;
10-
if (enabled !== "1") return { type: "point" };
10+
if (enabled !== "1") {return { type: "point" };}
1111

1212
const shapeType = String(getUnityProp(shapeModule, "type") ?? shapeModule.type ?? "0");
1313
const radiusObj = getUnityProp(shapeModule, "radius") ?? shapeModule.radius;

editor/src/editor/windows/effect-editor/converters/unity/utils.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
* Get Unity serialized property (supports both "name" and "m_name" for resilience).
77
*/
88
export function getUnityProp(obj: any, propName: string): any {
9-
if (obj == null) return undefined;
9+
if (obj == null) {return undefined;}
1010
const direct = obj[propName];
11-
if (direct !== undefined) return direct;
11+
if (direct !== undefined) {return direct;}
1212
const mName = "m_" + propName.charAt(0).toUpperCase() + propName.slice(1);
1313
return obj[mName];
1414
}

editor/src/editor/windows/effect-editor/converters/unity/valueConverter.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ export function convertAnimationCurve(curve: any, scalar: number = 1): Value {
8686
* Convert Unity MinMaxCurve to our Value (supports m_MinMaxState, m_Scalar, m_MaxCurve, etc.)
8787
*/
8888
export function convertMinMaxCurve(minMaxCurve: any): Value {
89-
if (!minMaxCurve) return { type: "ConstantValue", value: 1 };
89+
if (!minMaxCurve) {return { type: "ConstantValue", value: 1 };}
9090
const minMaxState = String(getUnityProp(minMaxCurve, "minMaxState") ?? minMaxCurve.minMaxState ?? "0");
9191
const scalar = parseFloat(getUnityProp(minMaxCurve, "scalar") ?? minMaxCurve.scalar ?? "1");
9292
const minScalar = parseFloat(getUnityProp(minMaxCurve, "minScalar") ?? minMaxCurve.minScalar ?? "0");

editor/src/editor/windows/effect-editor/converters/unityConverter.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ export async function convertUnityPrefabToData(
8787
}
8888
}
8989
}
90-
if (!root) return emptyIData();
90+
if (!root) {return emptyIData();}
9191
} else {
9292
const converted = convertGameObject(gameObject, components);
9393
root = convertToIDataFormat(converted);

0 commit comments

Comments
 (0)