use of com.talosvfx.talos.editor.addons.scene.logic.components.ParticleComponent in project talos by rockbite.
the class TlsImporter method makeInstance.
@Override
public void makeInstance(FileHandle asset, GameObject parent) {
if (!AssetImporter.getMetadataHandleFor(asset).exists()) {
createMetadataFor(asset);
}
TlsMetadata metadata = AssetImporter.readMetadataFor(asset, TlsMetadata.class);
if (asset.extension().equals("tls")) {
// if p doesnot exist, create it
FileHandle pHandle = AssetImporter.makeSimilar(asset, "p");
if (!pHandle.exists()) {
// create
exportTlsFile(asset);
}
asset = pHandle;
}
SceneEditorWorkspace workspace = SceneEditorAddon.get().workspace;
Vector2 sceneCords = workspace.getMouseCordsOnScene();
GameObject gameObject = workspace.createObjectByTypeName("particle", sceneCords, parent);
ParticleComponent component = gameObject.getComponent(ParticleComponent.class);
component.path = AssetImporter.relative(AssetImporter.makeSimilar(asset, "p").path());
component.linkedTo = AssetImporter.relative(AssetImporter.makeSimilar(asset, "tls").path());
component.reloadDescriptor();
}
Aggregations