Search in sources :

Example 1 with SkeletonComponent

use of com.talosvfx.talos.editor.addons.scene.logic.components.SkeletonComponent 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)

Aggregations

Vector2 (com.badlogic.gdx.math.Vector2)1 SceneEditorWorkspace (com.talosvfx.talos.editor.addons.scene.SceneEditorWorkspace)1 GameObject (com.talosvfx.talos.editor.addons.scene.logic.GameObject)1 SkeletonComponent (com.talosvfx.talos.editor.addons.scene.logic.components.SkeletonComponent)1 SpineRendererComponent (com.talosvfx.talos.editor.addons.scene.logic.components.SpineRendererComponent)1 SpineMetadata (com.talosvfx.talos.editor.addons.scene.utils.metadata.SpineMetadata)1