use of com.talosvfx.talos.runtime.ParticleEffectDescriptor in project HyperLap2D by rednblackgames.
the class TalosVFXAsset method exportAsset.
@Override
public boolean exportAsset(MainItemVO item, ExportMapperVO exportMapperVO, File tmpDir) throws IOException {
super.exportAsset(item, exportMapperVO, tmpDir);
TalosVO talosVO = (TalosVO) item;
File fileSrc = new File(currentProjectPath + ProjectManager.TALOS_VFX_DIR_PATH + File.separator + talosVO.particleName);
FileUtils.copyFileToDirectory(fileSrc, tmpDir);
exportMapperVO.mapper.add(new ExportMapperVO.ExportedAsset(AssetsUtils.TYPE_TALOS_VFX, fileSrc.getName()));
ParticleEffectDescriptor particleEffect = resourceManager.getProjectTalosList().get(talosVO.particleName);
for (ParticleEmitterDescriptor emitter : new Array.ArrayIterator<>(particleEffect.emitterModuleGraphs)) {
for (AbstractModule module : new Array.ArrayIterator<>(emitter.getModules())) {
if (module instanceof TextureModule) {
String path = ((TextureModule) module).regionName + ".png";
File f = new File(currentProjectPath + ProjectManager.IMAGE_DIR_PATH + File.separator + path);
FileUtils.copyFileToDirectory(f, tmpDir);
}
if (module instanceof PolylineModule) {
String path = ((PolylineModule) module).regionName + ".png";
File f = new File(currentProjectPath + ProjectManager.IMAGE_DIR_PATH + File.separator + path);
FileUtils.copyFileToDirectory(f, tmpDir);
}
if (module instanceof FlipbookModule) {
String path = ((FlipbookModule) module).regionName + ".png";
File f = new File(currentProjectPath + ProjectManager.IMAGE_DIR_PATH + File.separator + path);
FileUtils.copyFileToDirectory(f, tmpDir);
}
if (module instanceof ShadedSpriteModule) {
String path = ((ShadedSpriteModule) module).shdrFileName;
File f = new File(currentProjectPath + ProjectManager.TALOS_VFX_DIR_PATH + File.separator + path);
FileUtils.copyFileToDirectory(f, tmpDir);
}
}
}
return true;
}
use of com.talosvfx.talos.runtime.ParticleEffectDescriptor in project talos by rockbite.
the class BvBWorkspace method updateParticle.
public void updateParticle(FileHandle handle) {
String name = handle.nameWithoutExtension();
if (vfxLibrary.containsKey(name)) {
ParticleEffectDescriptor descriptor = new ParticleEffectDescriptor();
descriptor.setAssetProvider(TalosMain.Instance().TalosProject().getProjectAssetProvider());
descriptor.load(handle);
vfxLibrary.put(name, descriptor);
skeletonContainer.updateEffect(name, descriptor);
}
}
use of com.talosvfx.talos.runtime.ParticleEffectDescriptor in project talos by rockbite.
the class ParticleComponent method reloadDescriptor.
public void reloadDescriptor() {
FileHandle handle = AssetImporter.get(path);
if (handle.exists() && handle.extension().equals("p")) {
try {
descriptor = new ParticleEffectDescriptor();
descriptor.setAssetProvider(SceneEditorAddon.get().assetProvider);
descriptor.load(handle);
} catch (Exception e) {
}
} else {
// load default
descriptor = new ParticleEffectDescriptor();
descriptor.setAssetProvider(SceneEditorAddon.get().assetProvider);
descriptor.load(Gdx.files.internal("addons/scene/missing/sample.p"));
}
}
use of com.talosvfx.talos.runtime.ParticleEffectDescriptor in project talos by rockbite.
the class TalosProject method cleanData.
private void cleanData() {
TalosMain.Instance().UIStage().PreviewWidget().resetToDefaults();
TalosMain.Instance().NodeStage().moduleBoardWidget.clearAll();
activeWrappers.clear();
particleEffectDescriptor = new ParticleEffectDescriptor();
particleEffectDescriptor.setAssetProvider(projectAssetProvider);
particleEffect = new ParticleEffectInstance(particleEffectDescriptor);
particleEffect.setScope(TalosMain.Instance().globalScope);
particleEffect.loopable = true;
}
use of com.talosvfx.talos.runtime.ParticleEffectDescriptor in project talos by rockbite.
the class BoundEffect method read.
@Override
public void read(Json json, JsonValue jsonData) {
String effectName = jsonData.getString("effectName");
String effectPath = parent.getWorkspace().getPath(effectName + ".p");
FileHandle effectHandle = TalosMain.Instance().ProjectController().findFile(effectPath);
this.name = effectName;
if (effectHandle == null || !effectHandle.exists()) {
throw new GdxRuntimeException("Particle effect not found");
}
parent.getWorkspace().registerTalosAssets(effectHandle);
// TODO: refactor this
ParticleEffectDescriptor descriptor = new ParticleEffectDescriptor();
descriptor.setAssetProvider(TalosMain.Instance().TalosProject().getProjectAssetProvider());
descriptor.load(effectHandle);
parent.getWorkspace().getVfxLibrary().put(name, descriptor);
// track this file
TalosMain.Instance().FileTracker().trackFile(effectHandle, parent.getWorkspace().bvb.particleTracker);
this.particleEffectDescriptor = descriptor;
positionAttachment = json.readValue(AttachmentPoint.class, jsonData.get("positionAttachment"));
JsonValue valueAttachmentsJson = jsonData.get("valueAttachments");
for (JsonValue valueAttachmentJson : valueAttachmentsJson) {
AttachmentPoint point = json.readValue(AttachmentPoint.class, valueAttachmentJson);
valueAttachments.add(point);
}
setStartEvent(jsonData.getString("startEvent", ""));
setCompleteEvent(jsonData.getString("completeEvent", ""));
isStandalone = jsonData.getBoolean("isStandalone", false);
isBehind = jsonData.getBoolean("isBehind");
isNested = jsonData.getBoolean("isNested");
// setForever(startEvent.equals("") && completeEvent.equals(""));
}
Aggregations