Search in sources :

Example 6 with GameObject

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);
}
Also used : SceneEditorWorkspace(com.talosvfx.talos.editor.addons.scene.SceneEditorWorkspace) Vector2(com.badlogic.gdx.math.Vector2) SpineMetadata(com.talosvfx.talos.editor.addons.scene.utils.metadata.SpineMetadata) GameObject(com.talosvfx.talos.editor.addons.scene.logic.GameObject) SkeletonComponent(com.talosvfx.talos.editor.addons.scene.logic.components.SkeletonComponent) SpineRendererComponent(com.talosvfx.talos.editor.addons.scene.logic.components.SpineRendererComponent)

Example 7 with GameObject

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();
}
Also used : ParticleComponent(com.talosvfx.talos.editor.addons.scene.logic.components.ParticleComponent) SceneEditorWorkspace(com.talosvfx.talos.editor.addons.scene.SceneEditorWorkspace) Vector2(com.badlogic.gdx.math.Vector2) TlsMetadata(com.talosvfx.talos.editor.addons.scene.utils.metadata.TlsMetadata) FileHandle(com.badlogic.gdx.files.FileHandle) GameObject(com.talosvfx.talos.editor.addons.scene.logic.GameObject)

Example 8 with GameObject

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;
}
Also used : Array(com.badlogic.gdx.utils.Array) FilePropertyProvider(com.talosvfx.talos.editor.addons.scene.utils.FilePropertyProvider) GameObject(com.talosvfx.talos.editor.addons.scene.logic.GameObject) IPropertyProvider(com.talosvfx.talos.editor.widgets.propertyWidgets.IPropertyProvider) Prefab(com.talosvfx.talos.editor.addons.scene.logic.Prefab)

Example 9 with GameObject

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);
}
Also used : SceneEditorWorkspace(com.talosvfx.talos.editor.addons.scene.SceneEditorWorkspace) MainRenderer(com.talosvfx.talos.editor.addons.scene.MainRenderer) GameObject(com.talosvfx.talos.editor.addons.scene.logic.GameObject)

Example 10 with GameObject

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);
        }
    }
}
Also used : EditableLabel(com.talosvfx.talos.editor.widgets.ui.EditableLabel) GameObject(com.talosvfx.talos.editor.addons.scene.logic.GameObject) FilteredTree(com.talosvfx.talos.editor.widgets.ui.FilteredTree)

Aggregations

GameObject (com.talosvfx.talos.editor.addons.scene.logic.GameObject)14 Vector2 (com.badlogic.gdx.math.Vector2)5 SceneEditorWorkspace (com.talosvfx.talos.editor.addons.scene.SceneEditorWorkspace)5 Array (com.badlogic.gdx.utils.Array)3 InputEvent (com.badlogic.gdx.scenes.scene2d.InputEvent)2 ClickListener (com.badlogic.gdx.scenes.scene2d.utils.ClickListener)2 Prefab (com.talosvfx.talos.editor.addons.scene.logic.Prefab)2 SpriteRendererComponent (com.talosvfx.talos.editor.addons.scene.logic.components.SpriteRendererComponent)2 EventHandler (com.talosvfx.talos.editor.notifications.EventHandler)2 FilteredTree (com.talosvfx.talos.editor.widgets.ui.FilteredTree)2 FileHandle (com.badlogic.gdx.files.FileHandle)1 Texture (com.badlogic.gdx.graphics.Texture)1 Label (com.badlogic.gdx.scenes.scene2d.ui.Label)1 Table (com.badlogic.gdx.scenes.scene2d.ui.Table)1 XmlReader (com.badlogic.gdx.utils.XmlReader)1 MenuItem (com.kotcrab.vis.ui.widget.MenuItem)1 PopupMenu (com.kotcrab.vis.ui.widget.PopupMenu)1 MainRenderer (com.talosvfx.talos.editor.addons.scene.MainRenderer)1 ComponentUpdated (com.talosvfx.talos.editor.addons.scene.events.ComponentUpdated)1 ParticleComponent (com.talosvfx.talos.editor.addons.scene.logic.components.ParticleComponent)1