Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More viewer clean #36

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 15 additions & 35 deletions src/artofillusion/polymesh/PolyMeshViewer.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,17 @@
import java.awt.Color;
import java.awt.Point;
import java.awt.Polygon;
import java.awt.event.MouseEvent;

import java.util.ArrayList;
import java.util.Iterator;

import artofillusion.MeshEditorWindow;


import artofillusion.MeshViewer;
import artofillusion.RenderingMesh;
import artofillusion.TextureParameter;
import artofillusion.TriMeshEditorWindow;

import artofillusion.UndoRecord;
import artofillusion.ViewerCanvas;

import artofillusion.animation.SkeletonTool;
import artofillusion.math.RGBColor;
import artofillusion.math.Vec2;
Expand All @@ -37,7 +37,7 @@
import artofillusion.polymesh.PolyMesh.Wface;
import artofillusion.polymesh.PolyMesh.Wvertex;
import artofillusion.polymesh.QuadMesh.QuadEdge;
import artofillusion.polymesh.QuadMesh.QuadVertex;

import artofillusion.texture.FaceParameterValue;
import artofillusion.ui.EditingTool;
import artofillusion.ui.MeshEditController;
Expand All @@ -54,7 +54,6 @@
import buoy.event.KeyPressedEvent;
import buoy.event.MouseClickedEvent;
import buoy.event.MouseMovedEvent;
import buoy.event.WidgetEvent;
import buoy.event.WidgetMouseEvent;
import buoy.widget.RowContainer;

Expand Down Expand Up @@ -305,11 +304,7 @@ else if (renderMode == RENDER_SMOOTH)

/**
* Draw the vertices of the control mesh.
*
* @param unselectedColor
* Color for unselected vertices
* @param selectedColor
* Color for selected vertices
*
*/

private void drawVertices()
Expand All @@ -318,39 +313,25 @@ private void drawVertices()
return;

PolyMesh mesh = (PolyMesh) getController().getObject().getObject();
PolyMesh viewMesh = mesh;
Color vertColor = mesh.getVertColor();
Color selectedVertColor = vertColor;
int handleSize = mesh.getHandleSize();

if (currentTool.hilightSelection())
selectedVertColor = mesh.getSelectedVertColor();
if (currentTool instanceof SkeletonTool)
{
selectedVertColor = disableColor(selectedVertColor);
vertColor = disableColor(vertColor);
}
// First, draw any unselected portions of the object.

boolean selected[] = controller.getSelection();

boolean mirror = false;
int[] invVertTable = mesh.getInvMirroredVerts();

if (mesh.getMirrorState() != PolyMesh.NO_MIRROR)
{
mirror = true;
viewMesh = mesh.getMirroredMesh();
}
QuadMesh subMesh = null;
MeshVertex sv[];
boolean project = (controller instanceof PolyMeshEditorWindow && ((PolyMeshEditorWindow) controller).getProjectOntoSurface());
if (project && viewMesh.getSubdividedMesh() != null)
{
subMesh = viewMesh.getSubdividedMesh();
sv = (MeshVertex[]) subMesh.getVertices();
}
else
sv = (MeshVertex[]) viewMesh.getVertices();
if (mesh.getMirrorState() != PolyMesh.NO_MIRROR) mirror = true;

int handleSize = mesh.getHandleSize();
for (int i = 0; i < screenVert.length; i++)
{
if(!visible[i]) continue;
Expand All @@ -375,10 +356,6 @@ private void drawVertices()
*
* @param p
* Description of the Parameter
* @param unselectedColor
* Color for unselected vertices
* @param selectedColor
* Color for selected vertices
*/

private void drawEdges(Vec2[] p)
Expand Down Expand Up @@ -737,6 +714,7 @@ protected void mouseMoved(WidgetMouseEvent e)
* Description of the Parameter
*/

@Override
protected void mousePressed(WidgetMouseEvent e)
{
PolyMesh mesh = (PolyMesh) getController().getObject().getObject();
Expand Down Expand Up @@ -1138,7 +1116,8 @@ && isEdgeVisible(ref))

/** Set the currently selected tool. */

public void setTool(EditingTool tool)
@Override
public void setTool(EditingTool tool)
{
manipulators.clear();
manipulatorArray = new Manipulator[0];
Expand Down Expand Up @@ -1455,6 +1434,7 @@ protected void keyPressed(KeyPressedEvent e)
return;
}

@Override
public void setPerspective(boolean perspective)
{
for (int i = 0; i < manipulatorArray.length; i++)
Expand Down