use of artisynth.core.mechmodels.MeshComponent in project artisynth_core by artisynth.
the class MeshBodyEditor method applyAction.
public void applyAction(String actionCommand, LinkedList<ModelComponent> selection, Rectangle popupBounds) {
if (containsMultipleSelection(selection, MeshComponent.class)) {
if (containsSingleSelection(selection, MeshComponent.class)) {
if (actionCommand == "Save local mesh as ...") {
MeshComponent body = (MeshComponent) selection.get(0);
MeshBase mesh = body.getMesh();
EditorUtils.saveMesh(mesh, null);
} else if (actionCommand == "Save world mesh as ...") {
MeshComponent body = (MeshComponent) selection.get(0);
MeshBase mesh = body.getMesh();
EditorUtils.saveMesh(mesh, mesh != null ? mesh.getMeshToWorld() : null);
} else if (actionCommand == "Add mesh inspector") {
MeshComponent body = (MeshComponent) selection.get(0);
MechModel mech = (MechModel) body.getGrandParent();
EditablePolygonalMeshComp editMesh = new EditablePolygonalMeshComp((PolygonalMesh) body.getMesh());
double size = RenderableUtils.getRadius(editMesh);
RenderProps.setVisible(editMesh, true);
RenderProps.setPointStyle(editMesh, Renderer.PointStyle.SPHERE);
RenderProps.setPointRadius(editMesh, 0.05 * size);
mech.addRenderable(editMesh);
}
}
}
}
use of artisynth.core.mechmodels.MeshComponent in project artisynth_core by artisynth.
the class MeshBodyEditor method addActions.
public void addActions(EditActionMap actions, SelectionManager selManager) {
LinkedList<ModelComponent> selection = selManager.getCurrentSelection();
if (containsMultipleSelection(selection, MeshComponent.class)) {
if (containsSingleSelection(selection, MeshComponent.class)) {
MeshComponent body = (MeshComponent) selection.get(0);
actions.add(this, "Save local mesh as ...");
actions.add(this, "Save world mesh as ...");
if (body.getMesh() instanceof PolygonalMesh && body.getGrandParent() instanceof MechModel) {
actions.add(this, "Add mesh inspector");
}
}
}
}
Aggregations