use of com.talosvfx.talos.runtime.values.NumericalValue in project talos by rockbite.
the class MetaData method read.
@Override
public void read(Json json, JsonValue jsonData) {
JsonValue arr = jsonData.get("scopeDefaults");
int iter = 0;
for (JsonValue item : arr) {
NumericalValue val = new NumericalValue();
val.set(item.get(0).asFloat(), item.get(1).asFloat(), item.get(2).asFloat(), item.get(3).asFloat());
TalosMain.Instance().globalScope.setDynamicValue(iter++, val);
}
// preview widget stuff
if (jsonData.has("previewCamPos")) {
JsonValue camPos = jsonData.get("previewCamPos");
TalosMain.Instance().UIStage().PreviewWidget().setCameraPos(camPos.getFloat("x", 0), camPos.getFloat("y", 0));
} else {
TalosMain.Instance().UIStage().PreviewWidget().setCameraPos(0, 0);
}
TalosMain.Instance().UIStage().PreviewWidget().setBackgroundImage(jsonData.getString("bgImagePath", null));
TalosMain.Instance().UIStage().PreviewWidget().setGridVisible(jsonData.getBoolean("isGridVisible", true));
TalosMain.Instance().UIStage().PreviewWidget().setImageIsBackground(jsonData.getBoolean("bgImageIsInBack", true));
TalosMain.Instance().UIStage().PreviewWidget().setBgImageSize(jsonData.getFloat("bgImageSize", 10));
TalosMain.Instance().UIStage().PreviewWidget().setGridSize(jsonData.getFloat("gridSize", 1));
TalosMain.Instance().UIStage().PreviewWidget().setCameraZoom(jsonData.getFloat("previewCamZoom", 1.4285715f));
// particle position
ParticleEffectInstance particleEffect = TalosMain.Instance().TalosProject().getParticleEffect();
if (particleEffect != null) {
float pPosX = jsonData.getFloat("particlePositionX", 0);
float pPosY = jsonData.getFloat("particlePositionY", 0);
particleEffect.setPosition(pPosX, pPosY);
}
JsonValue resourcePaths = jsonData.get("resourcePaths");
if (resourcePaths != null) {
iter = 0;
for (JsonValue item : resourcePaths) {
final String filePath = item.asString();
resourcePathStrings.add(filePath);
}
}
}
use of com.talosvfx.talos.runtime.values.NumericalValue in project talos by rockbite.
the class GlobalScopeModuleWrapper method setModule.
@Override
public void setModule(GlobalScopeModule module) {
super.setModule(module);
NumericalValue value = TalosMain.Instance().globalScope.getDynamicValue(module.getKey());
dragPoint.set(value.get(0), value.get(1));
}
use of com.talosvfx.talos.runtime.values.NumericalValue in project talos by rockbite.
the class GlobalScopeModuleWrapper method updateFromSelectBox.
private void updateFromSelectBox() {
String selected = selectBox.getSelected();
int key = Integer.parseInt(selected);
module.setKey(key);
NumericalValue value = TalosMain.Instance().globalScope.getDynamicValue(key);
dragPoint.set(value.get(0), value.get(1));
}
use of com.talosvfx.talos.runtime.values.NumericalValue in project talos by rockbite.
the class VectorFieldModule method processValues.
@Override
public void processValues() {
if (vectorField == null)
return;
float scaleVal = 1f;
if (!scale.isEmpty()) {
scaleVal = scale.getFloat();
}
float forceVal = 1f;
if (!force.isEmpty()) {
forceVal = force.getFloat();
}
NumericalValue posNumVal = getScope().get(ScopePayload.PARTICLE_POSITION);
pos.set(posNumVal.get(0), posNumVal.get(1));
vectorField.setScale(scaleVal);
vectorField.setPosition(position.get(0), position.get(1));
tmp = vectorField.getValue(pos, tmp);
tmp.scl(forceVal);
angle.set(tmp.angle());
velocity.set(tmp.len());
}
use of com.talosvfx.talos.runtime.values.NumericalValue in project talos by rockbite.
the class OffsetModule method defineSlots.
@Override
protected void defineSlots() {
alpha = createInputSlot(ALPHA);
output = createOutputSlot(OUTPUT);
lowPos = new NumericalValue();
lowSize = new NumericalValue();
highPos = new NumericalValue();
highSize = new NumericalValue();
}
Aggregations