mirror of
https://github.com/cocos/cocos4.git
synced 2026-11-19 14:52:40 +08:00
add line updateColor function (#317)
* add line setColor function * fix eslint * modify setColor to updateColor
This commit is contained in:
+10
-1
@@ -25,7 +25,7 @@
|
||||
import { ccclass, help, executeInEditMode, menu, tooltip, displayOrder, type, serializable,
|
||||
range, visible, override, displayName } from 'cc.decorator';
|
||||
import { Material, Texture2D } from '../asset/assets';
|
||||
import { Vec3, cclegacy, Vec4, Vec2, CCBoolean } from '../core';
|
||||
import { Vec3, cclegacy, Vec4, Vec2, CCBoolean, Color } from '../core';
|
||||
import { LineModel } from './models/line-model';
|
||||
import { builtinResMgr } from '../asset/asset-manager';
|
||||
import CurveRange from './animator/curve-range';
|
||||
@@ -296,6 +296,15 @@ export class Line extends ModelRenderer {
|
||||
}
|
||||
}
|
||||
|
||||
public updateColor (): void {
|
||||
if (this._color) {
|
||||
if (this._models[0]) {
|
||||
const lineModel = this._models[0] as LineModel;
|
||||
lineModel.addLineVertexData(this._positions, this._width, this._color);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected _onMaterialModified (index: number, material: Material | null): void {
|
||||
super._onMaterialModified(index, material);
|
||||
const matIns = this.getMaterialInstance(0);
|
||||
|
||||
Reference in New Issue
Block a user