use of com.talosvfx.talos.editor.addons.scene.SceneEditorWorkspace 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.SceneEditorWorkspace in project talos by rockbite.
the class SpriteImporter method makeInstance.
@Override
public void makeInstance(FileHandle asset, GameObject parent) {
if (!AssetImporter.getMetadataHandleFor(asset).exists()) {
createMetadataFor(asset);
}
SpriteMetadata metadata = AssetImporter.readMetadataFor(asset, SpriteMetadata.class);
SceneEditorWorkspace workspace = SceneEditorAddon.get().workspace;
Vector2 sceneCords = workspace.getMouseCordsOnScene();
GameObject gameObject = workspace.createSpriteObject(asset, sceneCords, parent);
if (metadata.borderData != null) {
SpriteRendererComponent component = gameObject.getComponent(SpriteRendererComponent.class);
component.renderMode = SpriteRendererComponent.RenderMode.sliced;
} else {
if (gameObject.hasComponent(TransformComponent.class)) {
TransformComponent component = gameObject.getComponent(TransformComponent.class);
Texture texture = new Texture(asset);
component.scale.x = texture.getWidth() / metadata.pixelsPerUnit;
component.scale.y = texture.getHeight() / metadata.pixelsPerUnit;
}
}
}
Aggregations