Particle texture loading

This commit is contained in:
JannisX11 2020-10-06 22:30:25 +02:00
parent edb438bef0
commit 808c28e6ba
2 changed files with 19 additions and 1 deletions

View File

@ -1102,6 +1102,24 @@ Object.assign(Clipbench, {
}
})
if (isApp) {
Wintersky.fetchTexture = function(config) {
console.log(`trying to fetch texture with ${config.file_path} and ${config.particle_texture_path}`)
if (config.file_path && config.particle_texture_path) {
let path_arr = config.file_path.split(PathModule.sep);
let particle_index = path_arr.indexOf('particles')
path_arr.splice(particle_index)
let filePath = PathModule.join(path_arr.join(PathModule.sep), config.particle_texture_path.replace(/\.png$/, '')+'.png')
if (fs.existsSync(filePath)) {
return filePath;
}
}
}
}
const Animator = {
possible_channels: {rotation: true, position: true, scale: true, sound: true, particle: true, timeline: true},
open: false,

View File

@ -588,7 +588,7 @@ const Timeline = {
} else {
Timeline.particle_emitters[path] = [];
}
let emitter = new Wintersky.Emitter(json_content);
let emitter = new Wintersky.Emitter(json_content, {path});
emitter.loop_mode = 'once';
Timeline.particle_emitters[path].push(emitter);
},