添加形状显示开关,修改默认参数
This commit is contained in:
1 parent
aadcf5cbcf
commit
3f2699a946
7 files changed
+17
-6
No files matched your search
@@ -47,6 +47,7 @@ export function defaultConfig(): EmitterConfig {
|
||||
delay: 0,
|
||||
duration: 1, // 持续发射时长;默认 1 秒(30f)。爆发模式运行时按 0 处理。
|
||||
shape: 'point',
|
||||
showShape: true,
|
||||
shapeRangeVersion: 1,
|
||||
innerRadius: 0,
|
||||
outerRadius: 30,
|
||||
@@ -476,4 +477,3 @@ export function ensureEmitterConfig(config: EmitterConfig): EmitterConfig {
|
||||
config.trailResourceVersion = 6
|
||||
return config
|
||||
}
|
||||
|
||||
@@ -141,6 +141,8 @@ export interface EmitterConfig {
|
||||
/** 持续发射时长(秒)= 时间轴绿色段;爆发模式不使用该时长 */
|
||||
duration: number
|
||||
shape: EmitShape // 发射形状
|
||||
/** 是否在画布上显示当前发射形状。 */
|
||||
showShape: boolean
|
||||
/** 发射范围结构版本,用于旧配置迁移。 */
|
||||
shapeRangeVersion: number
|
||||
/** 圆形和锥形发射范围的内外半径。 */
|
||||
@@ -396,4 +398,3 @@ export interface TrailState {
|
||||
colorHex: number
|
||||
resourceId?: number
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ export function defaultSpineExportSettings(): SpineExportSettings {
|
||||
return {
|
||||
imagesPath: './images/',
|
||||
spineVersion: '4.2',
|
||||
keyframeCurve: 'linear',
|
||||
keyframeCurve: 'bezier',
|
||||
fps: 30,
|
||||
omitFps: false,
|
||||
integerFrameAlignment: true,
|
||||
|
||||
@@ -120,6 +120,10 @@
|
||||
<NumSlider label="基准角度" :min="-360" :max="360" :step="1" v-model="sys.config.direction" />
|
||||
<NumSlider label="随机范围" :min="0" :max="360" :step="1" v-model="sys.config.spread" />
|
||||
</template>
|
||||
<label v-if="sys.config.shape !== 'point'" class="switch-row">
|
||||
<input type="checkbox" v-model="sys.config.showShape" />
|
||||
<span class="switch-ui"></span><span>显示形状</span>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -298,7 +298,7 @@ const MODULE_RESET_KEYS: Record<Exclude<ResetModule, 'export'>, string[]> = {
|
||||
'burstCount', 'burstLoop', 'delay', 'duration',
|
||||
],
|
||||
shape: [
|
||||
'shape', 'shapeRangeVersion',
|
||||
'shape', 'showShape', 'shapeRangeVersion',
|
||||
'innerRadius', 'outerRadius', 'innerRectW', 'innerRectH', 'outerRectW', 'outerRectH', 'spawnPathId', 'spawnPathDistribution',
|
||||
'radius', 'rectW', 'rectH', 'emissionAngleMode', 'direction', 'spread', 'coneDirection', 'coneAngle',
|
||||
],
|
||||
|
||||
@@ -40,10 +40,10 @@ export function drawShapeRange(store: EditorStore, emitterPreviewTransform: Map<
|
||||
if (!shapeGfx) return
|
||||
const g = shapeGfx
|
||||
g.clear()
|
||||
if (!store.settings.showEmitter) return
|
||||
const sys = store.systems.find((s) => s.id === store.activeId)
|
||||
if (!sys || sys.visible === false) return
|
||||
const c = sys.config
|
||||
if (!c.showShape) return
|
||||
const preview = emitterPreviewTransform.get(sys.id)
|
||||
// root 中心(发射器容器 position = centerX/-centerY),数学坐标
|
||||
const cx = preview?.x ?? c.centerX ?? 0
|
||||
|
||||
@@ -167,8 +167,14 @@ export function drawPaths(store: EditorStore, selectedPathNodes: Set<number>, pa
|
||||
if (!pathGfx) return
|
||||
const g = pathGfx
|
||||
g.clear()
|
||||
const activeSystem = store.activeObjectType === 'particle'
|
||||
? store.systems.find((system) => system.id === store.activeObjectId)
|
||||
: null
|
||||
const hiddenEmitterPathId = activeSystem?.config.shape === 'path' && !activeSystem.config.showShape
|
||||
? activeSystem.config.spawnPathId
|
||||
: 0
|
||||
for (const path of store.paths) {
|
||||
if (path.visible === false || !path.enabled || !path.points.length) continue
|
||||
if (path.id === hiddenEmitterPathId || path.visible === false || !path.enabled || !path.points.length) continue
|
||||
const selected = store.activeObjectType === 'path' && store.activeObjectId === path.id
|
||||
const color = colorNumber(path.color, 0xff933e)
|
||||
const screenPoint = (x: number, y: number) => {
|
||||
|
||||
Reference in new issue
Block a user