use of com.talosvfx.talos.editor.addons.scene.SceneEditorProject in project talos by rockbite.
the class CameraPane method act.
@Override
public void act(float delta) {
if (TalosMain.Instance().Project() instanceof SceneEditorProject) {
setVisible(true);
} else {
setVisible(false);
return;
}
super.act(delta);
if (cameraObject != null) {
setFrom(cameraObject);
}
setSize(previewSize.x + 20, previewSize.y + 49);
title.setWidth(getWidth() - 40);
title.setEllipsis(true);
Vector2 vec = Pools.get(Vector2.class).obtain();
// position specifically
Table workspace = SceneEditorAddon.get().workspaceContainer;
workspace.localToStageCoordinates(vec.set(workspace.getWidth(), 0));
setPosition(vec.x - getWidth() + 5, vec.y - 8);
Pools.get(Vector2.class).free(vec);
cameraPreview.act(delta);
}
use of com.talosvfx.talos.editor.addons.scene.SceneEditorProject in project talos by rockbite.
the class CurveGizmo method draw.
@Override
public void draw(Batch batch, float parentAlpha) {
if (gameObject.hasComponent(CurveComponent.class)) {
CurveComponent curve = gameObject.getComponent(CurveComponent.class);
Array<Vector2> points = curve.points;
if (selected) {
for (int i = 0; i < points.size; i++) {
if (i % 3 == 0) {
drawCircle(toWorld(points.get(i)), batch);
}
}
}
for (int i = 0; i < curve.getNumSegments(); i++) {
Vector2[] pointsInSegment = curve.getPointsInSegment(i);
if (selected) {
Color color = Color.GRAY;
if (curve.automaticControl) {
color = darkerLine;
}
ctrlOne.set(pointsInSegment[1]);
ctrlTwo.set(pointsInSegment[2]);
if (animatingAnchor >= 0) {
if (i * 3 + 2 == animatingAnchor - 1) {
tmp.set(ctrlTwo).sub(curve.points.get(animatingAnchor)).scl(animateActor.getX()).add(curve.points.get(animatingAnchor));
ctrlTwo.set(tmp);
} else if (i * 3 + 1 == animatingAnchor + 1) {
tmp.set(ctrlOne).sub(curve.points.get(animatingAnchor)).scl(animateActor.getX()).add(curve.points.get(animatingAnchor));
ctrlOne.set(tmp);
}
}
drawLine(batch, toWorld(ctrlOne, tmp2), toWorld(pointsInSegment[0], tmp3), color);
drawLine(batch, toWorld(ctrlTwo, tmp2), toWorld(pointsInSegment[3], tmp3), color);
if (!curve.automaticControl) {
drawCircle(toWorld(ctrlOne), batch);
drawCircle(toWorld(ctrlTwo), batch);
}
}
bezier.set(pointsInSegment);
Vector2 prev = bezier.valueAt(tmp, 0);
float step = 1f / 20f;
for (float t = step; t <= 1f; t += step) {
Vector2 curr = bezier.valueAt(tmp2, t);
if (selectedSegmentIndex == i) {
drawLine(batch, toWorld(prev, tmp3), toWorld(curr, tmp4), Color.YELLOW);
} else {
drawLine(batch, toWorld(prev, tmp3), toWorld(curr, tmp4), Color.RED);
}
prev.set(curr);
}
Vector2 curr = bezier.valueAt(tmp2, 1f);
if (selectedSegmentIndex == i) {
drawLine(batch, toWorld(prev, tmp3), toWorld(curr, tmp4), Color.YELLOW);
} else {
drawLine(batch, toWorld(prev, tmp3), toWorld(curr, tmp4), Color.RED);
}
}
}
if (Gdx.input.isKeyJustPressed(Input.Keys.ESCAPE)) {
IProject project = TalosMain.Instance().ProjectController().getProject();
if (project instanceof SceneEditorProject) {
SceneEditorProject sceneEditorProject = (SceneEditorProject) project;
sceneEditorProject.sceneEditorAddon.workspace.requestSelectionClear();
}
}
}
Aggregations