mirror of
https://github.com/JannisX11/blockbench.git
synced 2025-03-13 16:58:33 +08:00
Auto-load particle and sound files when loading from bbmodel
Closes #1309
This commit is contained in:
parent
8abf744639
commit
d1d73231f6
@ -1383,6 +1383,9 @@
|
||||
stroke-width: 0;
|
||||
pointer-events: initial;
|
||||
}
|
||||
.keyframe .keyframe_waveform > polygon:hover {
|
||||
fill: var(--color-accent);
|
||||
}
|
||||
|
||||
#timeline_graph_editor {
|
||||
position: absolute;
|
||||
|
@ -9,9 +9,23 @@ class KeyframeDataPoint {
|
||||
if (data.values) {
|
||||
Object.assign(data, data.values)
|
||||
}
|
||||
let file_value_before = this.file;
|
||||
for (var key in KeyframeDataPoint.properties) {
|
||||
KeyframeDataPoint.properties[key].merge(this, data)
|
||||
}
|
||||
if (isApp && data.file && !file_value_before) {
|
||||
if (this.keyframe.channel == 'sound' && !Timeline.waveforms[this.file]) {
|
||||
Timeline.visualizeAudioFile(this.file);
|
||||
} else if (this.keyframe.channel == 'particle') {
|
||||
try {
|
||||
Blockbench.read([this.file], {}, (files) => {
|
||||
Animator.loadParticleEmitter(this.file, files[0].content);
|
||||
})
|
||||
} catch (err) {
|
||||
console.log('Could not load particle effect for', this.file)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
getUndoCopy() {
|
||||
var copy = {}
|
||||
|
@ -71,7 +71,7 @@ class Property {
|
||||
if (typeof this.default == 'function') {
|
||||
return this.default(instance);
|
||||
} else if (this.isArray) {
|
||||
return this.default.slice();
|
||||
return this.default ? this.default.slice() : [];
|
||||
} else if (this.isObject) {
|
||||
return Object.keys(this.default).length ? JSON.parse(JSON.stringify(this.default)) : {};
|
||||
} else {
|
||||
|
Loading…
x
Reference in New Issue
Block a user