From: Marko Luukkainen Date: Thu, 24 Oct 2019 10:26:52 +0000 (+0300) Subject: Piping rules seemed to be executed while editor was loading data X-Git-Tag: v1.43.0~173 X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=commitdiff_plain;h=195e8e68bac6c952d65f31dd40dcac0a4eb11cd4;p=simantics%2F3d.git Piping rules seemed to be executed while editor was loading data gitlab #35 Change-Id: Iff74082d21753d391017be1742db836c35075d5f --- diff --git a/org.simantics.plant3d/src/org/simantics/plant3d/scenegraph/controlpoint/PipeControlPoint.java b/org.simantics.plant3d/src/org/simantics/plant3d/scenegraph/controlpoint/PipeControlPoint.java index b3bc2e1e..6c932ad8 100644 --- a/org.simantics.plant3d/src/org/simantics/plant3d/scenegraph/controlpoint/PipeControlPoint.java +++ b/org.simantics.plant3d/src/org/simantics/plant3d/scenegraph/controlpoint/PipeControlPoint.java @@ -768,7 +768,7 @@ public class PipeControlPoint extends G3DNode implements IP3DNode { } public void getControlPointEnds(Tuple3d p1, Tuple3d p2) { - PipeControlPoint sub = isAxial() ? this : getSubPoint().get(0); + PipeControlPoint sub = isAxial() || isDirected() || isTurn() ? this : getSubPoint().get(0); Vector3d pos = getWorldPosition(), pos2 = sub == this ? pos : sub.getWorldPosition(); Vector3d dir1 = getPathLegDirection(Direction.PREVIOUS); diff --git a/org.simantics.plant3d/src/org/simantics/plant3d/scenegraph/controlpoint/PipingRules.java b/org.simantics.plant3d/src/org/simantics/plant3d/scenegraph/controlpoint/PipingRules.java index a0ff359e..6c121d80 100644 --- a/org.simantics.plant3d/src/org/simantics/plant3d/scenegraph/controlpoint/PipingRules.java +++ b/org.simantics.plant3d/src/org/simantics/plant3d/scenegraph/controlpoint/PipingRules.java @@ -51,6 +51,8 @@ public class PipingRules { private static Object ruleMutex = new Object(); public static void requestUpdate(PipeControlPoint pcp) { + if (!PipingRules.enabled) + return; if (DEBUG) System.out.println("PipingRules request " + pcp); synchronized (updateMutex) { if (!requestUpdates.contains(pcp)) @@ -59,6 +61,9 @@ public class PipingRules { } public static boolean update() throws Exception { + if (!PipingRules.enabled) + return false; + if (requestUpdates.size() == 0) return false; @@ -304,6 +309,10 @@ public class PipingRules { else if (us.end.equals(updated)) lengthChange = PathLegUpdateType.PREV; } + if (us == null) { + System.out.println("Null update struct " + start); + return; + } updatePathLeg(us, lengthChange); } @@ -316,6 +325,10 @@ public class PipingRules { // else if (us.end.equals(updated)) // lengthChange = PathLegUpdateType.PREV; // } + if (us == null) { + System.out.println("Null update struct " + start); + return; + } updatePathLeg(us, lengthChange); } @@ -1629,8 +1642,9 @@ public class PipingRules { PipeControlPoint pcp = pipeRun.getControlPoints().iterator().next(); while (pcp.getPrevious() != null) { PipeControlPoint prev = pcp.getPrevious(); - if (prev.getPipeRun() != pipeRun) - break; + if (prev.getPipeRun() != pipeRun && prev.getPipeRun() != null) { // bypass possible corruption + break; + } pcp = prev; } if (pcp.isDualSub()) { @@ -1800,11 +1814,19 @@ public class PipingRules { } List runPcps = getControlPoints(pipeRun); if (runPcps.size() != count) { - System.out.println("Run " + pipeRun.getName() + " contains unconnected control points"); + System.out.println("Run " + pipeRun.getName() + " contains unconnected control points, found " + runPcps.size() + " connected, " + pcps.size() + " total."); + for (PipeControlPoint pcp : pcps) { + if (!runPcps.contains(pcp)) { + System.out.println("Unconnected " + pcp + " " + pcp.getPipelineComponent()); + } + } } for (PipeControlPoint pcp : pcps) { + if (pcp.getPipeRun() == null) { + System.out.println("PipeRun ref missing " + pcp + " " + pcp.getPipelineComponent()); + } if (!pcp.isDirected() && pcp.getNext() == null && pcp.getPrevious() == null) - System.out.println("Orphan undirected " + pcp); + System.out.println("Orphan undirected " + pcp + " " + pcp.getPipelineComponent()); } for (PipeControlPoint pcp : pcps) { if (pcp.getParentPoint() == null) {