mirror of
https://github.com/cocos/cocos4.git
synced 2026-11-19 14:52:40 +08:00
Add more feature cropping settings for RichText, Mask, Graphics, UISkew, AffineTransform. (#18284)
* Add more feature cropping settings for RichText, Mask, Graphics, UISkew, AffineTransform.
This commit is contained in:
@@ -160,6 +160,10 @@ cc.ReverseTime.initWithAction(): the action was already passed in.
|
||||
<!-- DEPRECATED -->
|
||||
cc.Animate.initWithAnimation(): animation must be non-NULL
|
||||
|
||||
### 1031
|
||||
|
||||
Set `setter` to boolean is deprecated. Please don not use like this again.
|
||||
|
||||
### 1100
|
||||
|
||||
Expected 'data' dict, but not found. Config file: %s
|
||||
@@ -2003,6 +2007,10 @@ Invalid RichText img tag! The sprite frame name can't be found in the ImageAtlas
|
||||
|
||||
Graphics: There is no model in %s.
|
||||
|
||||
### 4501
|
||||
|
||||
Graphics feature is not enabled in 'Project Settings -> Feature Cropping', %s
|
||||
|
||||
### 4600
|
||||
|
||||
Script attached to '%s' is missing or invalid.
|
||||
|
||||
@@ -54,9 +54,28 @@
|
||||
"f0416e68-0200-4b77-a926-4f9d16e494da"
|
||||
]
|
||||
},
|
||||
"rich-text": {
|
||||
"modules": ["rich-text"],
|
||||
"dependentModules": ["2d"]
|
||||
},
|
||||
"mask": {
|
||||
"modules": ["mask"],
|
||||
"dependentModules": ["2d"]
|
||||
},
|
||||
"graphics": {
|
||||
"modules": ["graphics"],
|
||||
"dependentModules": ["2d"]
|
||||
},
|
||||
"ui-skew": {
|
||||
"modules": ["ui-skew"],
|
||||
"dependentModules": ["2d"]
|
||||
},
|
||||
"ui": {
|
||||
"modules": ["ui", "2d"]
|
||||
},
|
||||
"affine-transform": {
|
||||
"modules": ["affine-transform"]
|
||||
},
|
||||
"particle": {
|
||||
"modules": ["particle"],
|
||||
"dependentAssets": [
|
||||
@@ -692,6 +711,18 @@
|
||||
"type": "boolean",
|
||||
"value": false,
|
||||
"internal": true
|
||||
},
|
||||
"USE_3D": {
|
||||
"comment": "An internal constant to indicate whether we're using 3d module.",
|
||||
"type": "boolean",
|
||||
"value": true,
|
||||
"internal": true
|
||||
},
|
||||
"USE_UI_SKEW": {
|
||||
"comment": "An internal constant to indicate whether we're using ui-skew module.",
|
||||
"type": "boolean",
|
||||
"value": true,
|
||||
"internal": true
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
THE SOFTWARE.
|
||||
*/
|
||||
|
||||
/** @mangle */
|
||||
class Aim {
|
||||
// vertex index in coordinates array
|
||||
public declare i: number;
|
||||
|
||||
@@ -26,7 +26,7 @@ import { Color, Vec3 } from '../../../../core';
|
||||
import { IAssembler } from '../../../renderer/base';
|
||||
import { MeshRenderData } from '../../../renderer/render-data';
|
||||
import { IBatcher } from '../../../renderer/i-batcher';
|
||||
import { Graphics } from '../../../components';
|
||||
import { Graphics } from '../../../components/graphics';
|
||||
import { LineCap, LineJoin, PointFlags } from '../types';
|
||||
import { earcut as Earcut } from './earcut';
|
||||
import { Impl, Point } from './impl';
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
|
||||
import { JSB } from 'internal:constants';
|
||||
import { Color, Vec2 } from '../../../../core';
|
||||
import { Graphics } from '../../../components';
|
||||
import { Graphics } from '../../../components/graphics';
|
||||
import { RenderData, MeshRenderData } from '../../../renderer/render-data';
|
||||
import { RenderDrawInfoType } from '../../../renderer/render-draw-info';
|
||||
import { arc, ellipse, roundRect, tesselateBezier } from '../helper';
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
|
||||
import { UIRenderer } from '../../../framework/ui-renderer';
|
||||
import { IAssemblerManager } from '../../../renderer/base';
|
||||
import { Graphics } from '../../../components';
|
||||
import { Graphics } from '../../../components/graphics';
|
||||
import { graphicsAssembler as graphics } from './graphics-assembler';
|
||||
|
||||
const graphicsAssemblerManager: IAssemblerManager = {
|
||||
|
||||
@@ -24,6 +24,5 @@
|
||||
|
||||
import './utils';
|
||||
|
||||
export * from './graphics';
|
||||
export * from './label';
|
||||
export * from './sprite';
|
||||
|
||||
@@ -23,12 +23,9 @@
|
||||
*/
|
||||
|
||||
export * from './label';
|
||||
export { Mask } from './mask';
|
||||
export { RichText } from './rich-text';
|
||||
export { Sprite } from './sprite';
|
||||
export { UIMeshRenderer } from './ui-mesh-renderer';
|
||||
export { LabelOutline } from './label-outline';
|
||||
export { Graphics } from './graphics';
|
||||
export { UIStaticBatch } from './ui-static-batch';
|
||||
export { LabelShadow } from './label-shadow';
|
||||
export { UIOpacity } from './ui-opacity';
|
||||
|
||||
@@ -30,7 +30,6 @@ export * from './canvas';
|
||||
export * from './ui-component';
|
||||
export * from './ui-renderer';
|
||||
export * from './ui-transform';
|
||||
export * from './ui-skew';
|
||||
export * from './deprecated';
|
||||
export * from './render-root-2d';
|
||||
export * from './sprite-renderer';
|
||||
|
||||
@@ -29,7 +29,7 @@ import { Mat4, Rect, Size, Vec2, Vec3, geometry, warnID, visibleRect, approx, EP
|
||||
import { director, DirectorEvent } from '../../game/director';
|
||||
import { NodeEventType } from '../../scene-graph/node-event';
|
||||
import { IMask } from '../../scene-graph/node-event-processor';
|
||||
import { Mask } from '../components/mask';
|
||||
import type { Mask } from '../components/mask';
|
||||
|
||||
const _vec2a = new Vec2();
|
||||
const _vec2b = new Vec2();
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
*/
|
||||
|
||||
import {
|
||||
graphicsAssembler,
|
||||
labelAssembler,
|
||||
spriteAssembler,
|
||||
} from './assembler';
|
||||
@@ -48,13 +47,11 @@ export {
|
||||
StencilManager,
|
||||
spriteAssembler, // use less
|
||||
labelAssembler, // use less
|
||||
graphicsAssembler, // use less
|
||||
};
|
||||
|
||||
cclegacy.UI = {
|
||||
MeshBuffer, // use less
|
||||
spriteAssembler, // use less
|
||||
graphicsAssembler, // use less
|
||||
labelAssembler, // use less
|
||||
RenderData,
|
||||
MeshRenderData,
|
||||
|
||||
@@ -38,7 +38,6 @@ export { Vec4, v4 } from './vec4';
|
||||
export { Quat, quat } from './quat';
|
||||
export { Mat3 } from './mat3';
|
||||
export { Mat4, mat4 } from './mat4';
|
||||
export { AffineTransform } from './affine-transform';
|
||||
export { Size, size } from './size';
|
||||
export { Rect, rect } from './rect';
|
||||
export { Color, color } from './color';
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
*/
|
||||
|
||||
import { EDITOR, DEV, TEST } from 'internal:constants';
|
||||
import { warnID, error, errorID, StringSubstitution } from '../platform/debug';
|
||||
import { warnID, error, errorID, StringSubstitution, logID } from '../platform/debug';
|
||||
import { IDGenerator } from './id-generator';
|
||||
|
||||
const tempCIDGenerator = new IDGenerator('TmpCId.');
|
||||
@@ -136,7 +136,7 @@ export const getset = ((): (object: Record<string | number, any>, propertyName:
|
||||
};
|
||||
return (object: Record<string | number, any>, propertyName: string, getter: Getter, setter?: Setter | boolean, enumerable = false, configurable = false): void => {
|
||||
if (typeof setter === 'boolean') {
|
||||
console.log('Set `setter` to boolean is deprecated. Please don not use like this again.');
|
||||
logID(1031);
|
||||
enumerable = setter;
|
||||
setter = undefined;
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ import { AttachUtil } from './AttachUtil';
|
||||
import { CCFactory } from './CCFactory';
|
||||
import { DragonBonesAsset } from './DragonBonesAsset';
|
||||
import { DragonBonesAtlasAsset } from './DragonBonesAtlasAsset';
|
||||
import { Graphics } from '../2d/components';
|
||||
import type { Graphics } from '../2d/components/graphics';
|
||||
import { CCArmatureDisplay } from './CCArmatureDisplay';
|
||||
import { MaterialInstance } from '../render-scene/core/material-instance';
|
||||
import { ArmatureSystem } from './ArmatureSystem';
|
||||
@@ -996,16 +996,22 @@ export class ArmatureDisplay extends UIRenderer {
|
||||
_updateDebugDraw (): void {
|
||||
if (this.debugBones) {
|
||||
if (!this._debugDraw) {
|
||||
const debugDrawNode = new Node('DEBUG_DRAW_NODE');
|
||||
let debugDrawNode: Node | null = new Node('DEBUG_DRAW_NODE');
|
||||
debugDrawNode.hideFlags |= CCObjectFlags.DontSave | CCObjectFlags.HideInHierarchy;
|
||||
const debugDraw = debugDrawNode.addComponent(Graphics);
|
||||
debugDraw.lineWidth = 1;
|
||||
debugDraw.strokeColor = new Color(255, 0, 0, 255);
|
||||
let debugDraw: Graphics | undefined;
|
||||
try {
|
||||
debugDraw = debugDrawNode.addComponent('cc.Graphics') as Graphics;
|
||||
debugDraw.lineWidth = 1;
|
||||
debugDraw.strokeColor = new Color(255, 0, 0, 255);
|
||||
|
||||
this._debugDraw = debugDraw;
|
||||
this._debugDraw = debugDraw;
|
||||
this._debugDraw.node.parent = this.node;
|
||||
} catch (e: any) {
|
||||
errorID(4501, e.message as string);
|
||||
debugDrawNode.destroy();
|
||||
debugDrawNode = null;
|
||||
}
|
||||
}
|
||||
|
||||
this._debugDraw.node.parent = this.node;
|
||||
} else if (this._debugDraw) {
|
||||
this._debugDraw.node.parent = null;
|
||||
}
|
||||
|
||||
@@ -26,10 +26,10 @@ import { EDITOR_NOT_IN_PREVIEW } from 'internal:constants';
|
||||
import { B2, getImplPtr, addImplPtrReference, addImplPtrReferenceWASM,
|
||||
getTSObjectFromWASMObjectPtr, removeImplPtrReference, removeImplPtrReferenceWASM, B2ObjectType } from './instantiated';
|
||||
import { IPhysicsWorld } from '../spec/i-physics-world';
|
||||
import { IVec2Like, Vec3, Quat, Vec2, toDegree, Rect, CCObjectFlags, js } from '../../core';
|
||||
import { IVec2Like, Vec3, Quat, Vec2, toDegree, Rect, CCObjectFlags, js, errorID } from '../../core';
|
||||
import { PHYSICS_2D_PTM_RATIO, ERaycast2DType, ERigidBody2DType } from '../framework/physics-types';
|
||||
import { Canvas } from '../../2d/framework';
|
||||
import { Graphics } from '../../2d/components';
|
||||
import type { Graphics } from '../../2d/components/graphics';
|
||||
|
||||
import { B2RigidBody2D } from './rigid-body';
|
||||
import { PhysicsContactListener } from './platform/physics-contact-listener';
|
||||
@@ -126,25 +126,33 @@ export class B2PhysicsWorld implements IPhysicsWorld {
|
||||
canvas.parent = scene;
|
||||
}
|
||||
|
||||
const node = new Node('PHYSICS_2D_DEBUG_DRAW');
|
||||
let node: Node | null = new Node('PHYSICS_2D_DEBUG_DRAW');
|
||||
// node.zIndex = cc.macro.MAX_ZINDEX;
|
||||
node.hideFlags |= CCObjectFlags.DontSave;
|
||||
node.parent = canvas;
|
||||
node.worldPosition = Vec3.ZERO;
|
||||
node.layer = Layers.Enum.UI_2D;
|
||||
|
||||
this._debugGraphics = node.addComponent(Graphics);
|
||||
this._debugGraphics.lineWidth = 3;
|
||||
try {
|
||||
this._debugGraphics = node.addComponent('cc.Graphics') as Graphics;
|
||||
this._debugGraphics.lineWidth = 3;
|
||||
|
||||
PhysicsDebugDraw._drawer = this._debugGraphics;
|
||||
const debugDraw = B2.Draw.implement(PhysicsDebugDraw.callback);//new PhysicsDebugDraw();
|
||||
PhysicsDebugDraw._drawer = this._debugGraphics;
|
||||
const debugDraw = B2.Draw.implement(PhysicsDebugDraw.callback);//new PhysicsDebugDraw();
|
||||
|
||||
this._b2DebugDrawer = debugDraw;
|
||||
this._world.SetDebugDraw(debugDraw as B2.Draw);
|
||||
this._b2DebugDrawer = debugDraw;
|
||||
this._world.SetDebugDraw(debugDraw as B2.Draw);
|
||||
} catch (e: any) {
|
||||
errorID(4501, e.message as string);
|
||||
node.destroy();
|
||||
node = null;
|
||||
}
|
||||
}
|
||||
|
||||
const parent = this._debugGraphics.node.parent!;
|
||||
this._debugGraphics.node.setSiblingIndex(parent.children.length - 1);
|
||||
if (this._debugGraphics) {
|
||||
const parent = this._debugGraphics.node.parent!;
|
||||
this._debugGraphics.node.setSiblingIndex(parent.children.length - 1);
|
||||
}
|
||||
|
||||
if (this._b2DebugDrawer) {
|
||||
this._b2DebugDrawer.SetFlags(this.debugDrawFlags);
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
import { B2, b2Mul } from '../instantiated';
|
||||
import { Color } from '../../../core';
|
||||
import { PHYSICS_2D_PTM_RATIO } from '../../framework';
|
||||
import { Graphics } from '../../../2d';
|
||||
import type { Graphics } from '../../../2d/components/graphics';
|
||||
|
||||
const _tmp_vec2 = { x: 0, y: 0 };
|
||||
const _tmp_vec3 = { x: 0, y: 0 };
|
||||
|
||||
@@ -26,7 +26,7 @@ import b2 from '@cocos/box2d';
|
||||
import { EDITOR_NOT_IN_PREVIEW, TEST } from 'internal:constants';
|
||||
|
||||
import { IPhysicsWorld } from '../spec/i-physics-world';
|
||||
import { IVec2Like, Vec3, Quat, Vec2, toDegree, Rect, CCObjectFlags, js } from '../../core';
|
||||
import { IVec2Like, Vec3, Quat, Vec2, toDegree, Rect, CCObjectFlags, js, errorID } from '../../core';
|
||||
import { PHYSICS_2D_PTM_RATIO, ERaycast2DType, ERigidBody2DType } from '../framework/physics-types';
|
||||
import { b2RigidBody2D } from './rigid-body';
|
||||
import { PhysicsContactListener } from './platform/physics-contact-listener';
|
||||
@@ -38,6 +38,7 @@ import { b2Shape2D } from './shapes/shape-2d';
|
||||
import { PhysicsDebugDraw } from './platform/physics-debug-draw';
|
||||
import { Node, find, Layers } from '../../scene-graph';
|
||||
import { director } from '../../game';
|
||||
import type { Graphics } from '../../2d/components/graphics';
|
||||
|
||||
const tempVec3 = new Vec3();
|
||||
const tempVec2_1 = new Vec2();
|
||||
@@ -86,7 +87,7 @@ export class b2PhysicsWorld implements IPhysicsWorld {
|
||||
this._raycastQueryCallback = new PhysicsRayCastCallback();
|
||||
}
|
||||
|
||||
_debugGraphics: any = null;
|
||||
_debugGraphics: Graphics | null = null;
|
||||
_b2DebugDrawer: b2.Draw | null = null;
|
||||
|
||||
_debugDrawFlags = 0;
|
||||
@@ -120,24 +121,32 @@ export class b2PhysicsWorld implements IPhysicsWorld {
|
||||
canvas.parent = scene;
|
||||
}
|
||||
|
||||
const node = new Node('PHYSICS_2D_DEBUG_DRAW');
|
||||
let node: Node | null = new Node('PHYSICS_2D_DEBUG_DRAW');
|
||||
// node.zIndex = cc.macro.MAX_ZINDEX;
|
||||
node.hideFlags |= CCObjectFlags.DontSave;
|
||||
node.parent = canvas;
|
||||
node.worldPosition = Vec3.ZERO;
|
||||
node.layer = Layers.Enum.UI_2D;
|
||||
|
||||
this._debugGraphics = node.addComponent('cc.Graphics');
|
||||
this._debugGraphics.lineWidth = 3;
|
||||
try {
|
||||
this._debugGraphics = node.addComponent('cc.Graphics') as Graphics;
|
||||
this._debugGraphics.lineWidth = 3;
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
||||
const debugDraw = new PhysicsDebugDraw(this._debugGraphics);
|
||||
this._b2DebugDrawer = debugDraw;
|
||||
this._world.SetDebugDraw(debugDraw);
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
||||
const debugDraw = new PhysicsDebugDraw(this._debugGraphics);
|
||||
this._b2DebugDrawer = debugDraw;
|
||||
this._world.SetDebugDraw(debugDraw);
|
||||
} catch (e: any) {
|
||||
errorID(4501, e.message as string);
|
||||
node.destroy();
|
||||
node = null;
|
||||
}
|
||||
}
|
||||
|
||||
const parent = this._debugGraphics.node.parent!;
|
||||
this._debugGraphics.node.setSiblingIndex(parent.children.length - 1);
|
||||
if (this._debugGraphics) {
|
||||
const parent = this._debugGraphics.node.parent!;
|
||||
this._debugGraphics.node.setSiblingIndex(parent.children.length - 1);
|
||||
}
|
||||
|
||||
if (this._b2DebugDrawer) {
|
||||
this._b2DebugDrawer.SetFlags(this.debugDrawFlags);
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
import b2, { Vec2 } from '@cocos/box2d';
|
||||
import { Color } from '../../../core';
|
||||
import { PHYSICS_2D_PTM_RATIO } from '../../framework';
|
||||
import { Graphics } from '../../../2d';
|
||||
import type { Graphics } from '../../../2d/components/graphics';
|
||||
|
||||
const _tmp_vec2 = new b2.Vec2();
|
||||
const _tmp_color = new Color();
|
||||
|
||||
@@ -24,9 +24,7 @@
|
||||
|
||||
import { EDITOR_NOT_IN_PREVIEW, TEST } from 'internal:constants';
|
||||
import { IPhysicsWorld } from '../spec/i-physics-world';
|
||||
// import { Graphics } from '../../2d';
|
||||
import { CCObjectFlags, Vec3, Color, IVec2Like, Vec2, Rect, js } from '../../core';
|
||||
// import { Canvas } from '../../2d/framework';
|
||||
import { CCObjectFlags, Vec3, Color, IVec2Like, Vec2, Rect, js, errorID } from '../../core';
|
||||
import { BuiltinShape2D } from './shapes/shape-2d';
|
||||
import { BuiltinBoxShape } from './shapes/box-shape-2d';
|
||||
import { BuiltinCircleShape } from './shapes/circle-shape-2d';
|
||||
@@ -36,6 +34,7 @@ import { PhysicsSystem2D, Collider2D } from '../framework';
|
||||
import { BuiltinContact } from './builtin-contact';
|
||||
import { Node, find } from '../../scene-graph';
|
||||
import { director } from '../../game';
|
||||
import type { Graphics } from '../../2d/components/graphics';
|
||||
|
||||
const contactResults: BuiltinContact[] = [];
|
||||
const testIntersectResults: Collider2D[] = [];
|
||||
@@ -44,7 +43,7 @@ const testIntersectResults: Collider2D[] = [];
|
||||
export class BuiltinPhysicsWorld implements IPhysicsWorld {
|
||||
private _contacts: BuiltinContact[] = [];
|
||||
private _shapes: BuiltinShape2D[] = [];
|
||||
private _debugGraphics: any = null;
|
||||
private _debugGraphics: Graphics | null = null;
|
||||
private _debugDrawFlags = 0;
|
||||
|
||||
get debugDrawFlags (): number {
|
||||
@@ -219,18 +218,26 @@ export class BuiltinPhysicsWorld implements IPhysicsWorld {
|
||||
canvas.parent = scene;
|
||||
}
|
||||
|
||||
const node = new Node('PHYSICS_2D_DEBUG_DRAW');
|
||||
let node: Node | null = new Node('PHYSICS_2D_DEBUG_DRAW');
|
||||
// node.zIndex = cc.macro.MAX_ZINDEX;
|
||||
node.hideFlags |= CCObjectFlags.DontSave;
|
||||
node.parent = canvas;
|
||||
node.worldPosition = Vec3.ZERO;
|
||||
|
||||
this._debugGraphics = node.addComponent('cc.Graphics');
|
||||
this._debugGraphics.lineWidth = 2;
|
||||
try {
|
||||
this._debugGraphics = node.addComponent('cc.Graphics') as Graphics;
|
||||
this._debugGraphics.lineWidth = 2;
|
||||
} catch (e: any) {
|
||||
errorID(4501, e.message as string);
|
||||
node.destroy();
|
||||
node = null;
|
||||
}
|
||||
}
|
||||
|
||||
const parent = this._debugGraphics.node.parent!;
|
||||
this._debugGraphics.node.setSiblingIndex(parent.children.length - 1);
|
||||
if (this._debugGraphics) {
|
||||
const parent = this._debugGraphics.node.parent!;
|
||||
this._debugGraphics.node.setSiblingIndex(parent.children.length - 1);
|
||||
}
|
||||
}
|
||||
|
||||
testPoint (p: Vec2): readonly Collider2D[] {
|
||||
|
||||
@@ -26,7 +26,8 @@ import { UIRenderer } from '../2d/framework/ui-renderer';
|
||||
import { warnID } from '../core/platform/debug';
|
||||
import { UIMeshRenderer } from '../2d';
|
||||
import type { Node } from './node';
|
||||
import type { UITransform, UISkew } from '../2d/framework';
|
||||
import type { UITransform } from '../2d/framework';
|
||||
import type { UISkew } from '../2d/framework/ui-skew';
|
||||
|
||||
/**
|
||||
* @en Node's UI properties abstraction
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
*/
|
||||
|
||||
import { ccclass, editable, serializable, type } from 'cc.decorator';
|
||||
import { DEV, DEBUG, EDITOR, EDITOR_NOT_IN_PREVIEW } from 'internal:constants';
|
||||
import { DEV, DEBUG, EDITOR, EDITOR_NOT_IN_PREVIEW, USE_UI_SKEW } from 'internal:constants';
|
||||
import { Layers } from './layers';
|
||||
import { NodeUIProperties } from './node-ui-properties';
|
||||
import { cclegacy } from '../core/global-exports';
|
||||
@@ -45,7 +45,8 @@ import { findSkewAndGetOriginalWorldMatrix, updateLocalMatrixBySkew } from '../2
|
||||
import type { Scene } from './scene';
|
||||
import type { Director } from '../game/director';
|
||||
import type { Game } from '../game/game';
|
||||
import type { UITransform, UISkew } from '../2d/framework';
|
||||
import type { UITransform } from '../2d/framework';
|
||||
import type { UISkew } from '../2d/framework/ui-skew';
|
||||
|
||||
const Destroying = CCObjectFlags.Destroying;
|
||||
const DontDestroy = CCObjectFlags.DontDestroy;
|
||||
@@ -83,9 +84,6 @@ const dirtyNodes: Node[] = [];
|
||||
const reserveContentsForAllSyncablePrefabTag = Symbol('ReserveContentsForAllSyncablePrefab');
|
||||
let globalFlagChangeVersion = 0;
|
||||
|
||||
// TODO: Make this configurable in cc.config.json
|
||||
const HAS_UI_SKEW = true;
|
||||
|
||||
let skewCompCount = 0;
|
||||
|
||||
/**
|
||||
@@ -2025,7 +2023,7 @@ export class Node extends CCObject implements ISchedulable, CustomSerializable {
|
||||
self.updateWorldTransform();
|
||||
} else {
|
||||
let newParentMatWithoutSkew = parent._mat;
|
||||
if (HAS_UI_SKEW) {
|
||||
if (USE_UI_SKEW) {
|
||||
const hasSkew = skewCompCount > 0;
|
||||
if (hasSkew) {
|
||||
if (oldParent) {
|
||||
@@ -2282,7 +2280,7 @@ export class Node extends CCObject implements ISchedulable, CustomSerializable {
|
||||
if (rotationScaleSkewDirty) {
|
||||
let originalWorldMatrix = childMat;
|
||||
Mat4.fromSRT(m4_1, child._lrot, child._lpos, child._lscale); // m4_1 stores local matrix
|
||||
if (HAS_UI_SKEW && skewCompCount > 0) {
|
||||
if (USE_UI_SKEW && skewCompCount > 0) {
|
||||
foundSkewInAncestor = findSkewAndGetOriginalWorldMatrix(cur, m4_2); // m4_2 stores parent's world matrix without skew
|
||||
uiSkewComp = child._uiProps._uiSkewComp;
|
||||
if (uiSkewComp || foundSkewInAncestor) {
|
||||
@@ -2300,7 +2298,7 @@ export class Node extends CCObject implements ISchedulable, CustomSerializable {
|
||||
const rotTmp = dirtyBits & TransformBit.ROTATION ? child._rot : null;
|
||||
Mat4.toSRT(originalWorldMatrix, rotTmp, childPos, child._scale);
|
||||
|
||||
if (HAS_UI_SKEW && foundSkewInAncestor) {
|
||||
if (USE_UI_SKEW && foundSkewInAncestor) {
|
||||
// NOTE: world position from Mat4.toSRT(originalWorldMatrix, ...) will not consider the skew factor.
|
||||
// So we need to update the world position manually here.
|
||||
Vec3.transformMat4(childPos, child._lpos, cur._mat);
|
||||
@@ -2322,7 +2320,7 @@ export class Node extends CCObject implements ISchedulable, CustomSerializable {
|
||||
}
|
||||
Mat4.fromSRT(childMat, child._rot, child._pos, child._scale);
|
||||
|
||||
if (HAS_UI_SKEW && skewCompCount > 0) {
|
||||
if (USE_UI_SKEW && skewCompCount > 0) {
|
||||
uiSkewComp = child._uiProps._uiSkewComp;
|
||||
if (uiSkewComp) {
|
||||
updateLocalMatrixBySkew(uiSkewComp, childMat);
|
||||
|
||||
+23
-11
@@ -24,12 +24,13 @@
|
||||
import { EDITOR_NOT_IN_PREVIEW, JSB } from 'internal:constants';
|
||||
import { ccclass, executeInEditMode, help, menu, serializable, type, override, displayOrder, editable, visible } from 'cc.decorator';
|
||||
import { Material, Texture2D } from '../asset/assets';
|
||||
import { error, logID, warn } from '../core/platform/debug';
|
||||
import { error, errorID, logID, warn } from '../core/platform/debug';
|
||||
import { Enum, EnumType, ccenum } from '../core/value-types/enum';
|
||||
import { Node, NodeEventType } from '../scene-graph';
|
||||
import { CCObjectFlags, Color, RecyclePool, js } from '../core';
|
||||
import { SkeletonData } from './skeleton-data';
|
||||
import { Graphics, UIRenderer } from '../2d';
|
||||
import type { Graphics } from '../2d/components/graphics';
|
||||
import { UIRenderer } from '../2d/framework/ui-renderer';
|
||||
import { Batcher2D } from '../2d/renderer/batcher-2d';
|
||||
import { BlendFactor, BlendOp } from '../gfx';
|
||||
import { MaterialInstance } from '../render-scene';
|
||||
@@ -297,16 +298,19 @@ export class Skeleton extends UIRenderer {
|
||||
|
||||
/**
|
||||
* @engineInternal
|
||||
* @mangle
|
||||
*/
|
||||
public _debugRenderer: Graphics | null = null;
|
||||
/**
|
||||
* @engineInternal
|
||||
* @mangle
|
||||
*/
|
||||
public _startSlotIndex;
|
||||
public _startSlotIndex: number;
|
||||
/**
|
||||
* @engineInternal
|
||||
* @mangle
|
||||
*/
|
||||
public _endSlotIndex;
|
||||
public _endSlotIndex: number;
|
||||
|
||||
private _customMaterialInstance: MaterialInstance | null = null;
|
||||
_vLength = 0;
|
||||
@@ -1612,16 +1616,24 @@ export class Skeleton extends UIRenderer {
|
||||
protected _updateDebugDraw (): void {
|
||||
if (this.debugBones || this.debugSlots || this.debugMesh) {
|
||||
if (!this._debugRenderer) {
|
||||
const debugDrawNode = new Node('DEBUG_DRAW_NODE');
|
||||
let debugDrawNode: Node | null = new Node('DEBUG_DRAW_NODE');
|
||||
debugDrawNode.layer = this.node.layer;
|
||||
debugDrawNode.hideFlags |= CCObjectFlags.DontSave | CCObjectFlags.HideInHierarchy;
|
||||
const debugDraw = debugDrawNode.addComponent(Graphics);
|
||||
debugDraw.lineWidth = 5;
|
||||
debugDraw.strokeColor = new Color(255, 0, 0, 255);
|
||||
let debugDraw: Graphics | undefined;
|
||||
|
||||
this._debugRenderer = debugDraw;
|
||||
debugDrawNode.parent = this.node;
|
||||
this.node.on(NodeEventType.LAYER_CHANGED, this._applyLayer, this);
|
||||
try {
|
||||
debugDraw = debugDrawNode.addComponent('cc.Graphics') as Graphics;
|
||||
debugDraw.lineWidth = 5;
|
||||
debugDraw.strokeColor = new Color(255, 0, 0, 255);
|
||||
|
||||
this._debugRenderer = debugDraw;
|
||||
debugDrawNode.parent = this.node;
|
||||
this.node.on(NodeEventType.LAYER_CHANGED, this._applyLayer, this);
|
||||
} catch (e: any) {
|
||||
errorID(4501, e.message as string);
|
||||
debugDrawNode.destroy();
|
||||
debugDrawNode = null;
|
||||
}
|
||||
}
|
||||
if (this.isAnimationCached()) {
|
||||
warn('Debug bones or slots is invalid in cached mode');
|
||||
|
||||
@@ -71,6 +71,53 @@
|
||||
"description": "i18n:ENGINE.features.xr.description",
|
||||
"enginePlugin": false
|
||||
},
|
||||
"rich-text": {
|
||||
"default": true,
|
||||
"label": "i18n:ENGINE.features.rich_text.label",
|
||||
"description": "i18n:ENGINE.features.rich_text.description",
|
||||
"category": "2d",
|
||||
"dependencies": [
|
||||
"2d"
|
||||
],
|
||||
"enginePlugin": true
|
||||
},
|
||||
"mask": {
|
||||
"default": true,
|
||||
"label": "i18n:ENGINE.features.mask.label",
|
||||
"description": "i18n:ENGINE.features.mask.description",
|
||||
"category": "2d",
|
||||
"dependencies": [
|
||||
"2d",
|
||||
"graphics"
|
||||
],
|
||||
"enginePlugin": true
|
||||
},
|
||||
"graphics": {
|
||||
"default": true,
|
||||
"label": "i18n:ENGINE.features.graphics_2d.label",
|
||||
"description": "i18n:ENGINE.features.graphics_2d.description",
|
||||
"category": "2d",
|
||||
"dependencies": [
|
||||
"2d"
|
||||
],
|
||||
"enginePlugin": true
|
||||
},
|
||||
"ui-skew": {
|
||||
"default": true,
|
||||
"label": "i18n:ENGINE.features.ui_skew.label",
|
||||
"description": "i18n:ENGINE.features.ui_skew.description",
|
||||
"category": "2d",
|
||||
"dependencies": [
|
||||
"2d"
|
||||
],
|
||||
"enginePlugin": true
|
||||
},
|
||||
"affine-transform": {
|
||||
"label": "i18n:ENGINE.features.affine_transform.label",
|
||||
"description": "i18n:ENGINE.features.affine_transform.description",
|
||||
"default": true,
|
||||
"category": "2d"
|
||||
},
|
||||
"ui": {
|
||||
"default": true,
|
||||
"label": "i18n:ENGINE.features.ui.label",
|
||||
|
||||
@@ -975,6 +975,26 @@ module.exports = link(mixin({
|
||||
label: "Basic 2D Features",
|
||||
description: "Components and tools that are widely used in general 2D applications.",
|
||||
},
|
||||
rich_text: {
|
||||
label: "Rich Text",
|
||||
description: "Rich text support.",
|
||||
},
|
||||
mask: {
|
||||
label: "Mask",
|
||||
description: "Mask support.",
|
||||
},
|
||||
graphics_2d: {
|
||||
label: "Graphic Drawing",
|
||||
description: "2D Graphic Drawing support.",
|
||||
},
|
||||
ui_skew: {
|
||||
label: "Skew",
|
||||
description: "Skew support.",
|
||||
},
|
||||
affine_transform: {
|
||||
label: "2D Affine Transform",
|
||||
description: "2D Affine Transform support.",
|
||||
},
|
||||
physics_2d: {
|
||||
label: "2D Physics System",
|
||||
description: "Physics system that applied to 2D application.",
|
||||
|
||||
@@ -953,6 +953,26 @@ module.exports = link(mixin({
|
||||
label: "基础 2D 功能",
|
||||
description: "常用于一般 2D 应用的工具与组件。",
|
||||
},
|
||||
rich_text: {
|
||||
label: "富文本",
|
||||
description: "富文本支持。",
|
||||
},
|
||||
mask: {
|
||||
label: "遮罩",
|
||||
description: "遮罩功能支持。",
|
||||
},
|
||||
graphics_2d: {
|
||||
label: "图形绘制",
|
||||
description: "2D 图形绘制支持。",
|
||||
},
|
||||
ui_skew: {
|
||||
label: "斜切",
|
||||
description: "斜切支持。",
|
||||
},
|
||||
affine_transform: {
|
||||
label: "2D 仿射变换",
|
||||
description: "2D 仿射变换支持。",
|
||||
},
|
||||
physics_2d: {
|
||||
label: "2D 物理系统",
|
||||
description: "应用于 2D 的物理系统支持。",
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
export { AffineTransform } from '../cocos/core/math/affine-transform';
|
||||
@@ -0,0 +1,7 @@
|
||||
import { cclegacy } from './base';
|
||||
import { graphicsAssembler } from '../cocos/2d/assembler/graphics';
|
||||
|
||||
export * from '../cocos/2d/components/graphics';
|
||||
export { graphicsAssembler };
|
||||
|
||||
cclegacy.UI.graphicsAssembler = graphicsAssembler;
|
||||
@@ -0,0 +1 @@
|
||||
export * from '../cocos/2d/components/mask';
|
||||
@@ -0,0 +1 @@
|
||||
export * from '../cocos/2d/components/rich-text';
|
||||
@@ -0,0 +1 @@
|
||||
export * from '../cocos/2d/framework/ui-skew';
|
||||
@@ -1,5 +1,6 @@
|
||||
import { HtmlTextParser } from "../../cocos/2d";
|
||||
import { CacheMode, HorizontalTextAlignment, RichText, Sprite } from "../../cocos/2d/components";
|
||||
import { CacheMode, HorizontalTextAlignment, Sprite } from "../../cocos/2d/components";
|
||||
import { RichText } from "../../cocos/2d/components/rich-text";
|
||||
import { Node } from "../../cocos/scene-graph/node";
|
||||
|
||||
test('parse-richtext', () => {
|
||||
|
||||
Reference in New Issue
Block a user