Skip to content

Commit 1538686

Browse files
committed
check manipulator before using it
1 parent 4ff49bb commit 1538686

File tree

9 files changed

+353
-261
lines changed

9 files changed

+353
-261
lines changed

src/main/java/com/neuronrobotics/bowlerkernel/Bezier3d/BezierEditor.java

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -192,10 +192,17 @@ public void update() {
192192
ArrayList<Transform> transforms = transforms();
193193
for (int i = 0; i < getNumParts(); i++) {
194194
TransformNR nr = TransformFactory.csgToNR(transforms.get(i));
195-
Affine partsGetGetManipulator = getPartsInternal().get(i).getManipulator();
196-
BowlerKernel.runLater(() -> {
197-
TransformFactory.nrToAffine(nr, partsGetGetManipulator);
198-
});
195+
Affine partsGetGetManipulator;
196+
try {
197+
partsGetGetManipulator = getPartsInternal().get(i).getManipulator();
198+
BowlerKernel.runLater(() -> {
199+
TransformFactory.nrToAffine(nr, partsGetGetManipulator);
200+
});
201+
} catch (MissingManipulatorException e) {
202+
// TODO Auto-generated catch block
203+
e.printStackTrace();
204+
}
205+
199206
}
200207

201208
updateLines(start, cp1Manip, cp1Line, cp1LinePose);

src/main/java/com/neuronrobotics/bowlerstudio/creature/LimbOption.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838

3939
import eu.mihosoft.vrl.v3d.CSG;
4040
import eu.mihosoft.vrl.v3d.FileUtil;
41+
import eu.mihosoft.vrl.v3d.MissingManipulatorException;
4142
import eu.mihosoft.vrl.v3d.parametrics.CSGDatabase;
4243
import eu.mihosoft.vrl.v3d.parametrics.CSGDatabaseInstance;
4344
import javafx.embed.swing.SwingFXUtils;
@@ -185,7 +186,12 @@ public void build(CaDoodleFile f) throws IOException {
185186
}
186187
CSG get(CSG in) {
187188
if(in.hasManipulator())
188-
return in.transformed(TransformFactory.nrToCSG(TransformFactory.affineToNr(in.getManipulator())));
189+
try {
190+
return in.transformed(TransformFactory.nrToCSG(TransformFactory.affineToNr(in.getManipulator())));
191+
} catch (MissingManipulatorException e) {
192+
// TODO Auto-generated catch block
193+
e.printStackTrace();
194+
}
189195
return in;
190196
}
191197
public javafx.scene.image.Image getImage() {

src/main/java/com/neuronrobotics/bowlerstudio/creature/ThumbnailImage.java

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
import eu.mihosoft.vrl.v3d.Bounds;
1111
import eu.mihosoft.vrl.v3d.CSG;
12+
import eu.mihosoft.vrl.v3d.MissingManipulatorException;
1213
import eu.mihosoft.vrl.v3d.Vector3d;
1314
import eu.mihosoft.vrl.v3d.parametrics.CSGDatabase;
1415
import eu.mihosoft.vrl.v3d.parametrics.CSGDatabaseInstance;
@@ -67,8 +68,14 @@ public static WritableImage get(CSGDatabaseInstance instance,List<CSG> c) {
6768
ArrayList<CSG> csgList=new ArrayList<CSG>() ;
6869
for(CSG cs:c) {
6970
if(cs.hasManipulator()) {
70-
TransformNR nr = TransformFactory.affineToNr(cs.getManipulator());
71-
csgList.add(cs.transformed(TransformFactory.nrToCSG(nr)).syncProperties(instance,cs));
71+
TransformNR nr;
72+
try {
73+
nr = TransformFactory.affineToNr(cs.getManipulator());
74+
csgList.add(cs.transformed(TransformFactory.nrToCSG(nr)).syncProperties(instance,cs));
75+
} catch (MissingManipulatorException e) {
76+
// TODO Auto-generated catch block
77+
e.printStackTrace();
78+
}
7279
}else
7380
csgList.add(cs);
7481
}

src/main/java/com/neuronrobotics/bowlerstudio/physics/CSGPhysicsManager.java

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020

2121
import eu.mihosoft.vrl.v3d.CSG;
2222
import eu.mihosoft.vrl.v3d.Cube;
23+
import eu.mihosoft.vrl.v3d.MissingManipulatorException;
2324
import eu.mihosoft.vrl.v3d.Polygon;
2425
import eu.mihosoft.vrl.v3d.Sphere;
2526
import eu.mihosoft.vrl.v3d.Vertex;
@@ -43,8 +44,15 @@ public CSGPhysicsManager(List<CSG> baseCSG, Transform pose, double mass, boolean
4344
ObjectArrayList<Vector3f> arg0 = new ObjectArrayList<>();
4445
for (int i = 0; i < baseCSG.size(); i++) {
4546

46-
CSG back = loadCSGToPoints(baseCSG.get(i), adjustCenter, pose, arg0);
47-
back.setManipulator(baseCSG.get(i).getManipulator());
47+
CSG csg = baseCSG.get(i);
48+
CSG back = loadCSGToPoints(csg, adjustCenter, pose, arg0);
49+
try {
50+
if(csg.hasManipulator())
51+
back.setManipulator(csg.getManipulator());
52+
} catch (MissingManipulatorException e) {
53+
// TODO Auto-generated catch block
54+
e.printStackTrace();
55+
}
4856
baseCSG.set(i, back);
4957
}
5058
CollisionShape fallShape = new com.bulletphysics.collision.shapes.ConvexHullShape(arg0);

src/main/java/com/neuronrobotics/bowlerstudio/physics/MobileBasePhysicsManager.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
import Jama.Matrix;
3232

3333
import eu.mihosoft.vrl.v3d.CSG;
34+
import eu.mihosoft.vrl.v3d.MissingManipulatorException;
3435
import eu.mihosoft.vrl.v3d.parametrics.CSGDatabaseInstance;
3536
//import eu.mihosoft.vrl.v3d.ext.quickhull3d.HullUtil;
3637
//import eu.mihosoft.vvecmath.Vector3d;
@@ -127,7 +128,14 @@ public MobileBasePhysicsManager(CSGDatabaseInstance db,MobileBase base, ArrayLis
127128
BowlerKernel.runLater(new Runnable() {
128129
@Override
129130
public void run() {
130-
TransformFactory.bulletToAffine(baseCad.get(0).getManipulator(), start);
131+
try {
132+
CSG csg = baseCad.get(0);
133+
if(csg.hasManipulator())
134+
TransformFactory.bulletToAffine(csg.getManipulator(), start);
135+
} catch (MissingManipulatorException e) {
136+
// TODO Auto-generated catch block
137+
e.printStackTrace();
138+
}
131139
}
132140
});
133141
CSG collisionBod;

0 commit comments

Comments
 (0)