diff --git a/cocos/3d/framework/particle/animator/color-overtime.ts b/cocos/3d/framework/particle/animator/color-overtime.ts index 082de437cb..261113eef4 100644 --- a/cocos/3d/framework/particle/animator/color-overtime.ts +++ b/cocos/3d/framework/particle/animator/color-overtime.ts @@ -11,11 +11,14 @@ const COLOR_OVERTIME_RAND_OFFSET = 91041; @ccclass('cc.ColorOvertimeModule') export default class ColorOvertimeModule { - @property + @property({ + displayOrder: 0, + }) public enable = false; @property({ type: GradientRange, + displayOrder: 1, }) public color = new GradientRange(); diff --git a/cocos/3d/framework/particle/animator/force-overtime.ts b/cocos/3d/framework/particle/animator/force-overtime.ts index 3c3c35068f..000d68272d 100644 --- a/cocos/3d/framework/particle/animator/force-overtime.ts +++ b/cocos/3d/framework/particle/animator/force-overtime.ts @@ -10,26 +10,32 @@ const FORCE_OVERTIME_RAND_OFFSET = 212165; @ccclass('cc.ForceOvertimeModule') export default class ForceOvertimeModule { - @property + @property({ + displayOrder: 0, + }) public enable = false; @property({ type: CurveRange, + displayOrder: 2, }) public x = new CurveRange(); @property({ type: CurveRange, + displayOrder: 3, }) public y = new CurveRange(); @property({ type: CurveRange, + displayOrder: 4, }) public z = new CurveRange(); @property({ type: Space, + displayOrder: 1, }) public space = Space.Local; diff --git a/cocos/3d/framework/particle/animator/limit-velocity-overtime.ts b/cocos/3d/framework/particle/animator/limit-velocity-overtime.ts index 5c7ad59f4a..633aeb218e 100644 --- a/cocos/3d/framework/particle/animator/limit-velocity-overtime.ts +++ b/cocos/3d/framework/particle/animator/limit-velocity-overtime.ts @@ -11,37 +11,48 @@ const LIMIT_VELOCITY_RAND_OFFSET = 23541; @ccclass('cc.LimitVelocityOvertimeModule') export default class LimitVelocityOvertimeModule { - @property + @property({ + displayOrder: 0, + }) public enable = false; @property({ type: CurveRange, + displayOrder: 4, }) public limitX = new CurveRange(); @property({ type: CurveRange, + displayOrder: 5, }) public limitY = new CurveRange(); @property({ type: CurveRange, + displayOrder: 6, }) public limitZ = new CurveRange(); @property({ type: CurveRange, + displayOrder: 3, }) public limit = new CurveRange(); - @property - public dampen = 0; + @property({ + displayOrder: 7, + }) + public dampen = 3; - @property + @property({ + displayOrder: 2, + }) public separateAxes = false; @property({ type: Space, + displayOrder: 1, }) public space = Space.Local; diff --git a/cocos/3d/framework/particle/animator/rotation-overtime.ts b/cocos/3d/framework/particle/animator/rotation-overtime.ts index 29d1de795a..4ef6bb13f5 100644 --- a/cocos/3d/framework/particle/animator/rotation-overtime.ts +++ b/cocos/3d/framework/particle/animator/rotation-overtime.ts @@ -10,13 +10,17 @@ const ROTATION_OVERTIME_RAND_OFFSET = 125292; @ccclass('cc.RotationOvertimeModule') export default class RotationOvertimeModule { - @property + @property({ + displayOrder: 0, + }) public enable = false; @property private _separateAxes = false; - @property + @property({ + displayOrder: 1, + }) get separateAxes () { return this._separateAxes; } @@ -32,16 +36,19 @@ export default class RotationOvertimeModule { @property({ type: CurveRange, + displayOrder: 2, }) public x = new CurveRange(); @property({ type: CurveRange, + displayOrder: 3, }) public y = new CurveRange(); @property({ type: CurveRange, + displayOrder: 4, }) public z = new CurveRange(); diff --git a/cocos/3d/framework/particle/animator/size-overtime.ts b/cocos/3d/framework/particle/animator/size-overtime.ts index d885bb5521..d7a5730a28 100644 --- a/cocos/3d/framework/particle/animator/size-overtime.ts +++ b/cocos/3d/framework/particle/animator/size-overtime.ts @@ -10,29 +10,37 @@ const SIZE_OVERTIME_RAND_OFFSET = 39825; @ccclass('cc.SizeOvertimeModule') export default class SizeOvertimeModule { - @property + @property({ + displayOrder: 0, + }) public enable = false; - @property + @property({ + displayOrder: 1, + }) public separateAxes = false; @property({ type: CurveRange, + displayOrder: 2, }) public size = new CurveRange(); @property({ type: CurveRange, + displayOrder: 3, }) public x = new CurveRange(); @property({ type: CurveRange, + displayOrder: 4, }) public y = new CurveRange(); @property({ type: CurveRange, + displayOrder: 5, }) public z = new CurveRange(); diff --git a/cocos/3d/framework/particle/animator/texture-animation.ts b/cocos/3d/framework/particle/animator/texture-animation.ts index 9f53738296..5a68e5ff83 100644 --- a/cocos/3d/framework/particle/animator/texture-animation.ts +++ b/cocos/3d/framework/particle/animator/texture-animation.ts @@ -25,7 +25,9 @@ export default class TextureAnimationModule { @property private _enable = false; - @property + @property({ + displayOrder: 0, + }) get enable () { return this._enable; } @@ -42,6 +44,7 @@ export default class TextureAnimationModule { @property({ type: Mode, + displayOrder: 1, }) get mode () { return this._mode; @@ -54,28 +57,37 @@ export default class TextureAnimationModule { } } - @property + @property({ + displayOrder: 2, + }) public numTilesX = 0; - @property + @property({ + displayOrder: 3, + }) public numTilesY = 0; @property({ type: Animation, + displayOrder: 4, }) public animation = Animation.WholeSheet; @property({ type: CurveRange, + displayOrder: 7, }) public frameOverTime = new CurveRange(); @property({ type: CurveRange, + displayOrder: 8, }) public startFrame = new CurveRange(); - @property + @property({ + displayOrder: 9, + }) public cycleCount = 0; @property @@ -111,10 +123,14 @@ export default class TextureAnimationModule { console.error("particle texture animation's uvChannelMask is not supported!"); } - @property + @property({ + displayOrder: 5, + }) public randomRow = false; - @property + @property({ + displayOrder: 6, + }) public rowIndex = 0; private ps: ParticleSystemComponent | null = null; diff --git a/cocos/3d/framework/particle/animator/velocity-overtime.ts b/cocos/3d/framework/particle/animator/velocity-overtime.ts index 90acc40c17..b3f0747af1 100644 --- a/cocos/3d/framework/particle/animator/velocity-overtime.ts +++ b/cocos/3d/framework/particle/animator/velocity-overtime.ts @@ -11,31 +11,38 @@ const VELOCITY_OVERTIME_RAND_OFFSET = 197866; @ccclass('cc.VelocityOvertimeModule') export default class VelocityOvertimeModule { - @property + @property({ + displayOrder: 0, + }) public enable = false; @property({ type: CurveRange, + displayOrder: 2, }) public x = new CurveRange(); @property({ type: CurveRange, + displayOrder: 3, }) public y = new CurveRange(); @property({ type: CurveRange, + displayOrder: 4, }) public z = new CurveRange(); @property({ type: CurveRange, + displayOrder: 5, }) public speedModifier = new CurveRange(); @property({ type: Space, + displayOrder: 1, }) public space = Space.Local; diff --git a/cocos/3d/framework/particle/emitter/shape-module.ts b/cocos/3d/framework/particle/emitter/shape-module.ts index 7da1634f90..82025c3e72 100644 --- a/cocos/3d/framework/particle/emitter/shape-module.ts +++ b/cocos/3d/framework/particle/emitter/shape-module.ts @@ -35,23 +35,29 @@ const ArcMode = Enum({ @ccclass('cc.ShapeModule') export default class ShapeModule { - @property + @property({ + displayOrder: 0, + }) public enable = false; @property({ type: ShapeType, + displayOrder: 1, }) public shapeType = ShapeType.Box; @property({ type: EmitLocation, + displayOrder: 2, }) public emitFrom = EmitLocation.Volume; @property private _position = new Vec3(0, 0, 0); - @property + @property({ + displayOrder: 12, + }) get position () { return this._position; } @@ -63,7 +69,9 @@ export default class ShapeModule { @property private _rotation = new Vec3(0, 0, 0); - @property + @property({ + displayOrder: 13, + }) get rotation () { return this._rotation; } @@ -75,7 +83,9 @@ export default class ShapeModule { @property private _scale = new Vec3(1, 1, 1); - @property + @property({ + displayOrder: 14, + }) get scale () { return this._scale; } @@ -84,28 +94,42 @@ export default class ShapeModule { this.constructMat(); } - @property + @property({ + displayOrder: 15, + }) public alignToDirection = false; - @property + @property({ + displayOrder: 16, + }) public randomDirectionAmount = 0; - @property + @property({ + displayOrder: 17, + }) public sphericalDirectionAmount = 0; - @property + @property({ + displayOrder: 18, + }) public randomPositionAmount = 0; - @property + @property({ + displayOrder: 3, + }) public radius = 1; - @property + @property({ + displayOrder: 4, + }) public radiusThickness = 1; @property private _arc = toRadian(360); - @property + @property({ + displayOrder: 6, + }) get arc () { return toDegree(this._arc); } @@ -116,21 +140,27 @@ export default class ShapeModule { @property({ type: ArcMode, + displayOrder: 7, }) public arcMode = ArcMode.Random; - @property - public arcSpread = 0; + @property({ + displayOrder: 0, + }) + public arcSpread = 8; @property({ type: CurveRange, + displayOrder: 9, }) public arcSpeed = new CurveRange(); @property private _angle = toRadian(25); - @property + @property({ + displayOrder: 5, + }) get angle () { return toDegree(this._angle); } @@ -139,10 +169,14 @@ export default class ShapeModule { this._angle = toRadian(val); } - @property + @property({ + displayOrder: 10, + }) public length = 0; - @property + @property({ + displayOrder: 11, + }) public boxThickness = new Vec3(0, 0, 0); private mat: mat4; diff --git a/cocos/3d/framework/particle/particle-system-component.ts b/cocos/3d/framework/particle/particle-system-component.ts index f945afbc0c..16109f3d64 100644 --- a/cocos/3d/framework/particle/particle-system-component.ts +++ b/cocos/3d/framework/particle/particle-system-component.ts @@ -29,49 +29,63 @@ const _world_mat = mat4.create(); @executeInEditMode export class ParticleSystemComponent extends Component { - @property + @property({ + displayOrder: 1, + }) public capacity = 2000; @property({ type: GradientRange, + displayOrder: 8, }) public startColor = new GradientRange(); @property({ type: CurveRange, + displayOrder: 9, }) public startSize = new CurveRange(); @property({ type: CurveRange, + displayOrder: 10, }) public startSpeed = new CurveRange(); @property({ type: CurveRange, + displayOrder: 11, }) public startRotation = new CurveRange(); @property({ type: CurveRange, + displayOrder: 6, }) public startDelay = new CurveRange(); @property({ type: CurveRange, + displayOrder: 7, }) public startLifetime = new CurveRange(); - @property + @property({ + displayOrder: 0, + }) public duration = 5.0; - @property + @property({ + displayOrder: 2, + }) public loop = true; @property private _prewarm = false; - @property + @property({ + displayOrder: 3, + }) get prewarm () { return this._prewarm; } @@ -88,6 +102,7 @@ export class ParticleSystemComponent extends Component { @property({ type: Space, + displayOrder: 4, }) get simulationSpace () { return this._simulationSpace; @@ -100,30 +115,38 @@ export class ParticleSystemComponent extends Component { } } - @property + @property({ + displayOrder: 5, + }) public simulationSpeed = 1.0; - @property + @property({ + displayOrder: 2, + }) public playOnAwake = true; @property({ type: CurveRange, + displayOrder: 12, }) public gravityModifier = new CurveRange(); // emission module @property({ type: CurveRange, + displayOrder: 13, }) public rateOverTime = new CurveRange(); @property({ type: CurveRange, + displayOrder: 14, }) public rateOverDistance = new CurveRange(); @property({ type: [Burst], + displayOrder: 15, }) public bursts = new Array(); diff --git a/cocos/3d/framework/particle/renderer/particle-system-renderer.ts b/cocos/3d/framework/particle/renderer/particle-system-renderer.ts index 5b202e8263..e3e208f7ee 100644 --- a/cocos/3d/framework/particle/renderer/particle-system-renderer.ts +++ b/cocos/3d/framework/particle/renderer/particle-system-renderer.ts @@ -46,6 +46,7 @@ export default class ParticleSystemRenderer extends RenderableComponent { @property({ type: RenderMode, + displayOrder: 0, }) public get renderMode () { return this._renderMode; @@ -60,7 +61,9 @@ export default class ParticleSystemRenderer extends RenderableComponent { this._updateModel(); } - @property + @property({ + displayOrder: 1, + }) public get velocityScale () { return this._velocityScale; } @@ -71,7 +74,9 @@ export default class ParticleSystemRenderer extends RenderableComponent { // this._updateModel(); } - @property + @property({ + displayOrder: 2, + }) public get lengthScale () { return this._lengthScale; } diff --git a/cocos/3d/ui/components/sprite-component.ts b/cocos/3d/ui/components/sprite-component.ts index 5af61f7098..4cdfe10c52 100644 --- a/cocos/3d/ui/components/sprite-component.ts +++ b/cocos/3d/ui/components/sprite-component.ts @@ -150,6 +150,27 @@ ccenum(SizeMode); @menu('UI/Sprite') export class SpriteComponent extends UIRenderComponent { + /** + * !#en The atlas of the sprite. + * !#zh 精灵的图集 + * @return {SpriteAtlas} + */ + @property({ + type: SpriteAtlas, + }) + get spriteAtlas () { + return this._atlas; + } + + set spriteAtlas (value) { + if (this._atlas === value) { + return; + } + + this._atlas = value; + this.spriteFrame = null; + } + /** * !#en The sprite frame of the sprite. * !#zh 精灵的精灵帧 @@ -162,7 +183,7 @@ export class SpriteComponent extends UIRenderComponent { return this._spriteFrame; } - set spriteFrame (value: SpriteFrame | null) { + set spriteFrame (value) { if (this._spriteFrame === value) { return; } @@ -347,17 +368,6 @@ export class SpriteComponent extends UIRenderComponent { } } - get spriteAtlas() { - return this._atlas; - } - - @property({ - type: cc.SpriteAtlas, - }) - set spriteAtlas(value) { - this._atlas = value; - } - public static FillType = FillType; public static Type = SpriteType; public static SizeMode = SizeMode; @@ -378,7 +388,6 @@ export class SpriteComponent extends UIRenderComponent { @property private _isTrimmedMode = true; // _state = 0; - // TODO: @property private _atlas: SpriteAtlas | null = null; // static State = State; @@ -563,13 +572,17 @@ export class SpriteComponent extends UIRenderComponent { return; } // Set atlas - if (spriteFrame && spriteFrame.atlasUuid) { - const self = this; - cc.AssetLibrary.loadAsset(spriteFrame.atlasUuid, (err, asset) => { - self._atlas = asset; - }); - } else { - this._atlas = null; + if (spriteFrame) { + if (spriteFrame.atlasUuid.length > 0) { + if (!this._atlas || this._atlas._uuid !== spriteFrame.atlasUuid) { + const self = this; + cc.AssetLibrary.loadAsset(spriteFrame.atlasUuid, (err, asset) => { + self._atlas = asset; + }); + } + }else{ + this._atlas = null; + } } } diff --git a/cocos/assets/sprite-atlas.ts b/cocos/assets/sprite-atlas.ts index 2d77ed3ff0..f3c6c82a48 100644 --- a/cocos/assets/sprite-atlas.ts +++ b/cocos/assets/sprite-atlas.ts @@ -28,20 +28,22 @@ import { ccclass, property } from '../core/data/class-decorator'; import { Asset } from './asset'; import { SpriteFrame } from './CCSpriteFrame'; -interface ISpriteAtlas { - [key: string]: SpriteFrame | null; -} - /** * !#en Class for sprite atlas handling. * !#zh 精灵图集资源类。 * @class SpriteAtlas * @extends Asset */ + +interface ISpriteAtlasSerializeData{ + name: string; + spriteFrames: string[]; +} + @ccclass('cc.SpriteAtlas') export class SpriteAtlas extends Asset { @property - public spriteFrames: ISpriteAtlas = {}; + public spriteFrames: Map = new Map(); /** * Returns the texture of the sprite atlas @@ -49,11 +51,10 @@ export class SpriteAtlas extends Asset { * @returns {Texture2D} */ public getTexture () { - const keys = Object.keys(this.spriteFrames); - if (keys.length > 0) { - const spriteFrame = this.spriteFrames[keys[0]]; - // return spriteFrame ? spriteFrame.getTexture() : null; - return spriteFrame; + const values = this.spriteFrames.values; + if (values.length > 0) { + const spriteFrame = values[0]; + return spriteFrame && spriteFrame.image ? spriteFrame.image : null; } else { return null; @@ -84,20 +85,37 @@ export class SpriteAtlas extends Asset { */ public getSpriteFrames () { const frames: Array = []; - const spriteFrames = this.spriteFrames; - - for (const key of Object.keys(spriteFrames)) { - frames.push(this.getSpriteFrame(key)); + for (const spriteFrame of this.spriteFrames) { + frames.push(spriteFrame[1]); } return frames; } public _serialize () { + const frames: string[] = []; + for (const spriteFrame of this.spriteFrames) { + const id = spriteFrame[1] ? spriteFrame[1]._uuid : ''; + frames.push(spriteFrame[0]); + frames.push(id); + } + return { - spriteFrames: this.spriteFrames, + name: this._name, + spriteFrames: frames, }; } + + public _deserialize (serializeData: any, handle: any){ + const data = serializeData as ISpriteAtlasSerializeData; + this._name = data.name; + const frames = data.spriteFrames; + this.spriteFrames.clear(); + for (let i = 0; i < frames.length; i += 2) { + this.spriteFrames.set(frames[i], new SpriteFrame()); + handle.result.push(this.spriteFrames, `${i}`, frames[i + 1]); + } + } } cc.SpriteAtlas = SpriteAtlas; diff --git a/cocos/pipeline/ui/ui-pipeline.ts b/cocos/pipeline/ui/ui-pipeline.ts index c744d4dfcc..c56ce6ef8e 100644 --- a/cocos/pipeline/ui/ui-pipeline.ts +++ b/cocos/pipeline/ui/ui-pipeline.ts @@ -1,9 +1,9 @@ import { Root } from '../../core/root'; +import { mat4 } from '../../core/vmath'; import { UBOGlobal } from '../define'; -import { RenderPipeline, IRenderPipelineInfo } from '../render-pipeline'; +import { IRenderPipelineInfo, RenderPipeline } from '../render-pipeline'; import { RenderView } from '../render-view'; import { UIFlow } from './ui-flow'; -import { mat4 } from '../../core/vmath'; const _vec4Array = new Float32Array(4); const _mat4Array = new Float32Array(16); @@ -46,6 +46,10 @@ export class UIPipeline extends RenderPipeline { _vec4Array[2] = 0.0; _vec4Array[3] = 1.0 / _vec4Array[1]; this._defaultUboGlobal!.view.set(_vec4Array, UBOGlobal.EXPOSURE_OFFSET); +<<<<<<< HEAD +======= + +>>>>>>> 932cada8e62f7fc7f541242899647024c4acf180 // update ubos this._globalBindings.get(UBOGlobal.BLOCK.name)!.buffer!.update(this._defaultUboGlobal!.view.buffer); }