use of com.talosvfx.talos.editor.addons.scene.logic.GameObject in project talos by rockbite.
the class SpineImporter method makeInstance.
@Override
public void makeInstance(FileHandle asset, GameObject parent) {
SceneEditorWorkspace workspace = SceneEditorAddon.get().workspace;
Vector2 sceneCords = workspace.getMouseCordsOnScene();
GameObject gameObject = workspace.createObjectByTypeName("spine", sceneCords, parent);
// now do some fancy component configuring from this guy
SpineRendererComponent spineRendererComponent = gameObject.getComponent(SpineRendererComponent.class);
SkeletonComponent skeletonComponent = gameObject.getComponent(SkeletonComponent.class);
SpineMetadata spineMetadata = AssetImporter.readMetadataFor(asset, SpineMetadata.class);
// read this from meta instead later
spineRendererComponent.path = spineMetadata.atlasPath;
skeletonComponent.path = AssetImporter.relative(asset.path());
spineRendererComponent.reloadAtlas();
skeletonComponent.setAtlas(spineRendererComponent.textureAtlas);
skeletonComponent.reloadData(spineMetadata.scale);
}
use of com.talosvfx.talos.editor.addons.scene.logic.GameObject 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();
}
use of com.talosvfx.talos.editor.addons.scene.logic.GameObject in project talos by rockbite.
the class PrefabMetadata method getPropertyProviders.
@Override
public Iterable<IPropertyProvider> getPropertyProviders() {
Array<IPropertyProvider> propertyProviders = new Array<>();
propertyProviders.add(new FilePropertyProvider(currentFile));
Prefab prefab = new Prefab();
prefab.path = currentFile.path();
prefab.loadFromPath();
GameObject root = prefab.root;
Iterable<IPropertyProvider> rootProviders = root.getPropertyProviders();
for (IPropertyProvider provider : rootProviders) {
propertyProviders.add(provider);
}
return propertyProviders;
}
use of com.talosvfx.talos.editor.addons.scene.logic.GameObject in project talos by rockbite.
the class CameraPreview method drawPreview.
private void drawPreview() {
SceneEditorWorkspace workspace = SceneEditorAddon.get().workspace;
GameObject rootGO = workspace.getRootGO();
MainRenderer renderer = SceneEditorAddon.get().workspace.getRenderer();
renderer.render(spriteBatch, rootGO);
}
use of com.talosvfx.talos.editor.addons.scene.logic.GameObject in project talos by rockbite.
the class HierarchyWidget method traverseEntityContainer.
private void traverseEntityContainer(GameObjectContainer entityContainer, FilteredTree.Node node) {
Array<GameObject> gameObjects = entityContainer.getGameObjects();
if (gameObjects == null)
return;
for (int i = 0; i < gameObjects.size; i++) {
final GameObject gameObject = gameObjects.get(i);
EditableLabel editableLabel = new EditableLabel(gameObject.getName(), TalosMain.Instance().getSkin());
FilteredTree.Node newNode = new FilteredTree.Node(gameObject.getName(), editableLabel);
newNode.draggable = true;
node.add(newNode);
editableLabel.setListener(new EditableLabel.EditableLabelChangeListener() {
@Override
public void changed(String newText) {
SceneEditorAddon.get().workspace.changeGOName(gameObject, newText);
}
});
objectMap.put(gameObject.getName(), gameObject);
nodeMap.put(gameObject, newNode);
if (gameObject.getGameObjects() != null) {
traverseEntityContainer(gameObject, newNode);
}
}
}
Aggregations