Skip to content

Commit 572c051

Browse files
committed
Make the transform serializable
1 parent 7b3a4dc commit 572c051

3 files changed

Lines changed: 24 additions & 12 deletions

File tree

src/main/java/eu/mihosoft/vrl/v3d/CSG.java

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -239,9 +239,9 @@ public CSG setColor(Color color) {
239239
}
240240

241241
public void setMeshColor(Color color) {
242-
if (current != null) {
242+
if (getCurrentMeshView() != null) {
243243
PhongMaterial m = new PhongMaterial(color);
244-
current.setMaterial(m);
244+
getCurrentMeshView().setMaterial(m);
245245
}
246246
}
247247

@@ -251,9 +251,9 @@ public void setMeshColor(Color color) {
251251
* @param color the new Temporary color
252252
*/
253253
public CSG setTemporaryColor(Color color) {
254-
if (current != null) {
254+
if (getCurrentMeshView() != null) {
255255
PhongMaterial m = new PhongMaterial(color);
256-
current.setMaterial(m);
256+
getCurrentMeshView().setMaterial(m);
257257
}
258258
return this;
259259
}
@@ -269,9 +269,9 @@ public CSG setManipulator(javafx.scene.transform.Affine manipulator) {
269269
return this;
270270
Affine old = manipulator;
271271
this.manipulator = manipulator;
272-
if (current != null) {
273-
current.getTransforms().clear();
274-
current.getTransforms().add(manipulator);
272+
if (getCurrentMeshView() != null) {
273+
getCurrentMeshView().getTransforms().clear();
274+
getCurrentMeshView().getTransforms().add(manipulator);
275275
}
276276
return this;
277277
}
@@ -282,10 +282,10 @@ public CSG setManipulator(javafx.scene.transform.Affine manipulator) {
282282
* @return the mesh
283283
*/
284284
public MeshView getMesh() {
285-
if (current != null)
286-
return current;
287-
current = newMesh();
288-
return current;
285+
if (getCurrentMeshView() != null)
286+
return getCurrentMeshView();
287+
setCurrentMeshView(newMesh());
288+
return getCurrentMeshView();
289289
}
290290

291291
/**
@@ -3451,4 +3451,12 @@ public static void setMinPolygonsForOffloading(int minPolygonsForOffloading) {
34513451
MinPolygonsForOffloading = minPolygonsForOffloading;
34523452
}
34533453

3454+
public MeshView getCurrentMeshView() {
3455+
return current;
3456+
}
3457+
3458+
public void setCurrentMeshView(MeshView current) {
3459+
this.current = current;
3460+
}
3461+
34543462
}

src/main/java/eu/mihosoft/vrl/v3d/CSGClient.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ private ArrayList<CSG> performOperation(List<CSG> csgList, CSGRemoteOperation op
140140
tmp.setManufacturing(null);
141141
tmp.getMapOfparametrics().clear();
142142
tmp.setRegenerate(null);
143+
143144
toSend.add(tmp);
144145
}
145146
CSGRequest request = new CSGRequest(toSend, operation);

src/main/java/eu/mihosoft/vrl/v3d/Transform.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@
3333
*/
3434
package eu.mihosoft.vrl.v3d;
3535

36+
import java.io.Serializable;
37+
3638
import javax.vecmath.Matrix4d;
3739
import javax.vecmath.Quat4d;
3840

@@ -57,8 +59,9 @@
5759
*
5860
* @author Michael Hoffer &lt;info@michaelhoffer.de&gt;
5961
*/
60-
public class Transform {
62+
public class Transform implements Serializable {
6163

64+
private static final long serialVersionUID = 3248601462585606936L;
6265
/**
6366
* Internal 4x4 matrix.
6467
*/

0 commit comments

Comments
 (0)