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;
}
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;
}
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;
}
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;
}
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;
}
Aggregations