From 872df7861a1e8d22ef9355bcfefa9065e45c961c Mon Sep 17 00:00:00 2001 From: Zhou Zhenglong Date: Tue, 15 Oct 2024 19:50:24 +0800 Subject: [PATCH] add Color special handling --- native/tools/gfx-define-generator/generate.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/native/tools/gfx-define-generator/generate.js b/native/tools/gfx-define-generator/generate.js index 0a53870cd83..03ec2616826 100644 --- a/native/tools/gfx-define-generator/generate.js +++ b/native/tools/gfx-define-generator/generate.js @@ -289,6 +289,17 @@ for (const name of Object.keys(structMap)) { output += ` ) {}\n`; + if (name === 'Color') { + output += `\n`; + output += ` public set (x: number, y: number, z: number, w: number): Color {\n`; + output += ` this.x = x;\n`; + output += ` this.y = y;\n`; + output += ` this.z = z;\n`; + output += ` this.w = w;\n`; + output += ` return this;\n`; + output += ` }\n`; + } + if (!Object.keys(struct.member).some((k) => struct.member[k].readonly)) { output += `\n public copy (info: Readonly<${name}>): ${name} {\n`; for (const key in struct.member) {