mkhuman's .obj and jme
i'm afraid this is already have been solved.
but i had coudn'd ,that why i'm writing.
so when i read .obj which made by makehuman.
i need head's TriMesh,but 'node.getChild("head")' didnt work.
so i changed ObjToJme.class keep line usemtl's name.
I'm not sure this patch work or not,but it easy to explain what i changed.
### Eclipse Workspace Patch 1.0
#P jMonkeyEngine
Index: src/com/jmex/model/converters/ObjToJme.java
===================================================================
RCS file: /cvs/jme/src/com/jmex/model/converters/ObjToJme.java,v
retrieving revision 1.2
diff -u -r1.2 ObjToJme.java
--- src/com/jmex/model/converters/ObjToJme.java 21 Sep 2007 15:45:30 -0000 1.2
+++ src/com/jmex/model/converters/ObjToJme.java 1 Feb 2008 06:57:08 -0000
@@ -283,8 +283,13 @@
addMaterial(parts);
return;
} else if ("usemtl".equals(parts[0])) {
- if (materialNames.get(parts[1]) != null)
+
+ if (materialNames.get(parts[1]) != null){
+ //TODO
curGroup = materialNames.get(parts[1]);
+ //something special for makehuman
+ curGroup.name=parts[1];
+ }
else
setDefaultGroup();
return;
@@ -395,6 +400,14 @@
ArraySet thisMat = materialSets.get(curGroup);
if (thisMat.objName == null && curObjectName != null)
thisMat.objName = curObjectName;
+ //TODO
+ //something special for makehuman .obj file
+ if(thisMat.objName.equals("mesh.obj") && curGroup.name!=null){
+ thisMat.objName=curGroup.name;
+ }
+
+
+
IndexSet first = new IndexSet(parts[1]);
int firstIndex = thisMat.findSet(first);
IndexSet second = new IndexSet(parts[2]);
@@ -482,6 +495,8 @@
MaterialState m;
TextureState ts;
AlphaState as;
+ //TODO
+ String name;
}
/**
Labels: jme, makehuman
How to use Scrollbar in SWT
I was shocked because I have forgot How to scroll Text.
It's so simple.
Text text = new Text(panel,SWT.MULTI|SWT.V_SCROLL|SWT.H_SCROLL);
What is Insets?[GEF/Draw2D]

How many pixels inset a figure by a border on top,bottom,left and right.
Some layouts take care that value.
And I guess it help to know if a border was clicked.
Anyway,generally a border overdraw a figure in insets.
Maybe you could know if events happen inside a border like below.
public class MouseClicked extends MouseListener.Stub{ public void mousePressed(MouseEvent me) { Figure figure=(Figure)me.getSource(); //I guess there are other better way. if(figure.getBounds().contains(me.x,me.y) && !figure.getBounds().getCropped(figure.getInsets()).contains(me.x,me.y)){ shell.setText("click border"); }else{ shell.setText("click inside"); } }
}
like WaveFormGraph and zoom in and zoom out and stretch[GEF/Draw2D]

Of course my way is tricky.
But I don't know how to set different scale both width and height.
please see code anyway,it's difficult to explain how to do that.
In my program,I use ScaledPane and ToolbarLayout.
So It's easy zoom in and zoom out.
but When I wish fix height,I would do something.
In my code,I change my graph figure return 1x1 dimension everytime.
because on scaled changed,height length would be changed.
public Dimension getPreferredSize(int hintW,int hintH){ System.out.println(getParentScale()); if(horizontal){ //return new Dimension(values.length*space,maxValue-minValue); //return new Dimension(values.length*space,(int)((maxValue-minValue)/getParentScale())); return new Dimension(values.length*space,1); }else{ return new Dimension(hintW,hintH); }}Once you do that,it's ToolbarLayout and height would be stretched automatic.
CodesScaledToolbarLayoutTest.javaScaledWavFormGraphTest.java
my Ecliipse RCP Application for Windows -akJ OptipngWrapper

There are Optimizing PNG File Application -
OptipngAnd This is Optipng Wrapper Application.
In this application I didn't use draw2d yet.
It's simple Eclipse RCP Application.
It may work under Windows Platform. If there were not .exe file.No one use this application. I don't know how to support other platform. And more it include command-line exe.you can download this application from
sourceforge.jpAnd this is Opensource Application,
and you can see code
cvs.sourceforge.jpbut be carefull,I didn't refactoring yet.
Scroll ScrollPane by MouseWheel [Draw2D]
Create class implement SelectionListener and write that.
public class WheelMove implements SelectionListener{ public void widgetSelected(SelectionEvent arg0) { ScrollBar bar=scrollpane.getHorizontalScrollBar(); int direction=1;//16777218 if(arg0.detail==16777217){ direction=-1; } bar.setValue(bar.getValue()+direction*bar.getStepIncrement()); } public void widgetDefaultSelected(SelectionEvent arg0) { } }and get Real ScrollBar of FigureCanvas and add a addSelectionListener.
FigureCanvas canvas = new FigureCanvas(shell); canvas.getVerticalBar().addSelectionListener(new WheelMove()); FullCodehttp://cvs.sourceforge.jp/cgi-bin/viewcvs.cgi/akjrcp/draw2dexample/src/example/draw2d/NonOpaqueViewPort.java?rev=HEAD&content-type=text/vnd.viewcvs-markup
Change isOpaque() of ScrollPane [Draw2D]

Finaly,I upload sample codes to cvs.
see here
http://cvs.sourceforge.jp/cgi-bin/viewcvs.cgi/akjrcp/draw2dexample/src/example/draw2d/I'm sorry,I don't have any way to know other platform results.
So I guess sometime on non-windows platrom it's didn't work correctly.
isOpaque methods of Scrollpane return always true.
but if you don't like it,overwrite it.
public class NoOpaqueScrollPane extends ScrollPane{ public boolean isOpaque(){ return false; } }
FullCode
http://cvs.sourceforge.jp/cgi-bin/viewcvs.cgi/akjrcp/draw2dexample/src/example/draw2d/NonOpaqueViewPort.java?rev=HEAD&content-type=text/vnd.viewcvs-markup
Customize BorderLayout of Draw2D

If you customized BorderLayout.java ,you could do such things.
Certainly,If you overwrited getPreferedSize(),and you could do.
But If you did customize BorderLayout,You could control center figure of BorderLayout.
It's simple and usefull.
I copy from
BorderLayout.java to CustomBorderLayout.java
and new field.
and create both of get and set methods.
private boolean stretchCenterWidth=true;
private boolean stretchCenterHeight=false;and ,on layout() methods,
I replace code to when stretchCenter* is true,layoutmanager stretch figure width or height.
if(!stretchCenterHeight){ if (childSize.height <>
area.y += (area.height - childSize.height) / 2;
area.height = childSize.height;
}
}
if(!stretchCenterWidth){
if (childSize.width <>
area.x += (area.width - childSize.width) / 2;
area.width = childSize.width;
}
}
finally use call in your program like this.
CustomBorderLayout layout=new CustomBorderLayout(); layout.setStretchCenterWidth(true);
layout.setStretchCenterHeight(true);
FullCode
http://cvs.sourceforge.jp/cgi-bin/viewcvs.cgi/akjrcp/draw2dexample/src/example/draw2d/CustomBorderLayoutTest.java?rev=1.1&content-type=text/vnd.viewcvs-markup