Search in sources :

Example 1 with AssetSelectWidget

use of com.talosvfx.talos.editor.addons.scene.widgets.property.AssetSelectWidget in project talos by rockbite.

the class ScriptComponent method getListOfProperties.

@Override
public Array<PropertyWidget> getListOfProperties() {
    Array<PropertyWidget> properties = new Array<>();
    AssetSelectWidget widget = new AssetSelectWidget("Script", "ts", new Supplier<String>() {

        @Override
        public String get() {
            return path;
        }
    }, new PropertyWidget.ValueChanged<String>() {

        @Override
        public void report(String value) {
            path = value;
        }
    });
    properties.add(widget);
    return properties;
}
Also used : Array(com.badlogic.gdx.utils.Array) AssetSelectWidget(com.talosvfx.talos.editor.addons.scene.widgets.property.AssetSelectWidget) PropertyWidget(com.talosvfx.talos.editor.widgets.propertyWidgets.PropertyWidget)

Example 2 with AssetSelectWidget

use of com.talosvfx.talos.editor.addons.scene.widgets.property.AssetSelectWidget in project talos by rockbite.

the class SkeletonComponent method getListOfProperties.

@Override
public Array<PropertyWidget> getListOfProperties() {
    SpineMetadata spineMetadata = AssetImporter.readMetadataFor(Gdx.files.absolute(path), SpineMetadata.class);
    reloadData(spineMetadata.scale);
    Array<PropertyWidget> properties = new Array<>();
    AssetSelectWidget skelWidget = new AssetSelectWidget("Skeleton Data", "skel", new Supplier<String>() {

        @Override
        public String get() {
            return path;
        }
    }, new PropertyWidget.ValueChanged<String>() {

        @Override
        public void report(String value) {
            path = value;
            SpineMetadata spineMetadata = AssetImporter.readMetadataFor(AssetImporter.get(path), SpineMetadata.class);
            reloadData(spineMetadata.scale);
        }
    });
    SelectBoxWidget skinWidget = new SelectBoxWidget("Animation", new Supplier<String>() {

        @Override
        public String get() {
            return skin;
        }
    }, new PropertyWidget.ValueChanged<String>() {

        @Override
        public void report(String value) {
            skin = value;
        }
    }, new Supplier<Array<String>>() {

        @Override
        public Array<String> get() {
            Array<Skin> skins = skeletonData.getSkins();
            Array<String> list = new Array<>();
            for (Skin skin : skins) {
                list.add(skin.getName());
            }
            return list;
        }
    });
    SelectBoxWidget animationWidget = new SelectBoxWidget("Animation", new Supplier<String>() {

        @Override
        public String get() {
            return animation;
        }
    }, new PropertyWidget.ValueChanged<String>() {

        @Override
        public void report(String value) {
            animation = value;
        }
    }, new Supplier<Array<String>>() {

        @Override
        public Array<String> get() {
            Array<Animation> animations = skeletonData.getAnimations();
            Array<String> list = new Array<>();
            for (Animation animation : animations) {
                list.add(animation.getName());
            }
            return list;
        }
    });
    PropertyWidget loopWidget = WidgetFactory.generate(this, "loop", "Loop");
    PropertyWidget timeScaleWidget = WidgetFactory.generate(this, "timeScale", "Time Scl");
    properties.add(skelWidget);
    if (skeletonData != null) {
        properties.add(skinWidget);
        properties.add(animationWidget);
    }
    properties.add(loopWidget);
    properties.add(timeScaleWidget);
    return properties;
}
Also used : SpineMetadata(com.talosvfx.talos.editor.addons.scene.utils.metadata.SpineMetadata) AssetSelectWidget(com.talosvfx.talos.editor.addons.scene.widgets.property.AssetSelectWidget) Array(com.badlogic.gdx.utils.Array)

Example 3 with AssetSelectWidget

use of com.talosvfx.talos.editor.addons.scene.widgets.property.AssetSelectWidget in project talos by rockbite.

the class ParticleComponent method getListOfProperties.

@Override
public Array<PropertyWidget> getListOfProperties() {
    Array<PropertyWidget> properties = new Array<>();
    AssetSelectWidget descriptorWidget = new AssetSelectWidget("Effect", "p", new Supplier<String>() {

        @Override
        public String get() {
            FileHandle fileHandle = Gdx.files.absolute(path);
            return fileHandle.path();
        }
    }, new PropertyWidget.ValueChanged<String>() {

        @Override
        public void report(String value) {
            path = value;
            reloadDescriptor();
        }
    });
    ButtonPropertyWidget<String> linkedToWidget = new ButtonPropertyWidget<String>("Effect Project", "Edit", new ButtonPropertyWidget.ButtonListener<String>() {

        @Override
        public void clicked(ButtonPropertyWidget<String> widget) {
            String link = widget.getValue();
            if (link.isEmpty()) {
                FileHandle sample = Gdx.files.internal("addons/scene/missing/sample.tls");
                FileHandle thisEffect = AssetImporter.get(path);
                FileHandle destination;
                if (!path.isEmpty() && thisEffect.exists()) {
                // idk which scenario is this
                } else {
                    String projectPath = SceneEditorAddon.get().workspace.getProjectPath();
                    destination = AssetImporter.attemptToImport(sample);
                    FileHandle pHandle = AssetImporter.makeSimilar(destination, "p");
                    FileHandle texture = Gdx.files.internal("addons/scene/missing/white.png");
                    FileHandle textureDst = Gdx.files.absolute(projectPath + File.separator + "assets/white.png");
                    texture.copyTo(textureDst);
                    path = pHandle.path();
                    linkedTo = destination.path();
                    Notifications.fireEvent(Notifications.obtainEvent(ComponentUpdated.class).set(ParticleComponent.this, false));
                    TalosMain.Instance().ProjectController().setProject(ProjectController.TLS);
                    TalosMain.Instance().ProjectController().loadProject(destination);
                }
            } else {
                FileHandle fileHandle = AssetImporter.get(link);
                TalosMain.Instance().ProjectController().setProject(ProjectController.TLS);
                TalosMain.Instance().ProjectController().loadProject(fileHandle);
            }
        }
    }, new Supplier<String>() {

        @Override
        public String get() {
            return linkedTo;
        }
    }, new PropertyWidget.ValueChanged<String>() {

        @Override
        public void report(String value) {
            linkedTo = value;
        }
    });
    properties.add(descriptorWidget);
    properties.add(linkedToWidget);
    properties.addAll(super.getListOfProperties());
    return properties;
}
Also used : ButtonPropertyWidget(com.talosvfx.talos.editor.widgets.propertyWidgets.ButtonPropertyWidget) FileHandle(com.badlogic.gdx.files.FileHandle) AssetSelectWidget(com.talosvfx.talos.editor.addons.scene.widgets.property.AssetSelectWidget) PropertyWidget(com.talosvfx.talos.editor.widgets.propertyWidgets.PropertyWidget) ButtonPropertyWidget(com.talosvfx.talos.editor.widgets.propertyWidgets.ButtonPropertyWidget) Array(com.badlogic.gdx.utils.Array) ComponentUpdated(com.talosvfx.talos.editor.addons.scene.events.ComponentUpdated)

Example 4 with AssetSelectWidget

use of com.talosvfx.talos.editor.addons.scene.widgets.property.AssetSelectWidget in project talos by rockbite.

the class SpineRendererComponent method getListOfProperties.

@Override
public Array<PropertyWidget> getListOfProperties() {
    Array<PropertyWidget> properties = new Array<>();
    AssetSelectWidget atlasWidget = new AssetSelectWidget("Atlas", "atlas", new Supplier<String>() {

        @Override
        public String get() {
            return path;
        }
    }, new PropertyWidget.ValueChanged<String>() {

        @Override
        public void report(String value) {
            path = value;
            reloadAtlas();
        }
    });
    properties.add(atlasWidget);
    Array<PropertyWidget> superList = super.getListOfProperties();
    properties.addAll(superList);
    return properties;
}
Also used : Array(com.badlogic.gdx.utils.Array) AssetSelectWidget(com.talosvfx.talos.editor.addons.scene.widgets.property.AssetSelectWidget) PropertyWidget(com.talosvfx.talos.editor.widgets.propertyWidgets.PropertyWidget)

Example 5 with AssetSelectWidget

use of com.talosvfx.talos.editor.addons.scene.widgets.property.AssetSelectWidget in project talos by rockbite.

the class SpriteRendererComponent method getListOfProperties.

@Override
public Array<PropertyWidget> getListOfProperties() {
    Array<PropertyWidget> properties = new Array<>();
    AssetSelectWidget textureWidget = new AssetSelectWidget("Texture", "png", new Supplier<String>() {

        @Override
        public String get() {
            return path;
        }
    }, new PropertyWidget.ValueChanged<String>() {

        @Override
        public void report(String value) {
            path = value;
            reloadTexture();
        }
    });
    PropertyWidget colorWidget = WidgetFactory.generate(this, "color", "Color");
    PropertyWidget flipXWidget = WidgetFactory.generate(this, "flipX", "Flip X");
    PropertyWidget flipYWidget = WidgetFactory.generate(this, "flipY", "Flip Y");
    PropertyWidget renderModesWidget = WidgetFactory.generate(this, "renderMode", "Render Mode");
    properties.add(textureWidget);
    properties.add(colorWidget);
    properties.add(flipXWidget);
    properties.add(flipYWidget);
    properties.add(renderModesWidget);
    Array<PropertyWidget> superList = super.getListOfProperties();
    properties.addAll(superList);
    return properties;
}
Also used : Array(com.badlogic.gdx.utils.Array) AssetSelectWidget(com.talosvfx.talos.editor.addons.scene.widgets.property.AssetSelectWidget)

Aggregations

Array (com.badlogic.gdx.utils.Array)6 AssetSelectWidget (com.talosvfx.talos.editor.addons.scene.widgets.property.AssetSelectWidget)6 PropertyWidget (com.talosvfx.talos.editor.widgets.propertyWidgets.PropertyWidget)4 FileHandle (com.badlogic.gdx.files.FileHandle)1 ComponentUpdated (com.talosvfx.talos.editor.addons.scene.events.ComponentUpdated)1 SpineMetadata (com.talosvfx.talos.editor.addons.scene.utils.metadata.SpineMetadata)1 ButtonPropertyWidget (com.talosvfx.talos.editor.widgets.propertyWidgets.ButtonPropertyWidget)1