From: Marko Luukkainen Date: Wed, 14 Aug 2019 09:38:32 +0000 (+0000) Subject: Merge changes Ib176f957,I9a82db4e,Id0fdacee X-Git-Tag: v1.43.0~226 X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=commitdiff_plain;h=38b15c95d858de8661cc2d0b9afb186780b47447;hp=b8221b6f5e0b6ced872c0b760d796a4c205476af;p=simantics%2F3d.git Merge changes Ib176f957,I9a82db4e,Id0fdacee * changes: Add component did not work properly for nozzles. Show components in connected order in outline with debug mode Additional fix to control point synchronization --- diff --git a/org.simantics.plant3d/src/org/simantics/plant3d/actions/AddComponentAction.java b/org.simantics.plant3d/src/org/simantics/plant3d/actions/AddComponentAction.java index 18087b68..60f95215 100644 --- a/org.simantics.plant3d/src/org/simantics/plant3d/actions/AddComponentAction.java +++ b/org.simantics.plant3d/src/org/simantics/plant3d/actions/AddComponentAction.java @@ -17,6 +17,7 @@ import org.simantics.plant3d.Activator; import org.simantics.plant3d.dialog.ComponentSelectionDialog; import org.simantics.plant3d.gizmo.TerminalSelectionGizmo; import org.simantics.plant3d.scenegraph.InlineComponent; +import org.simantics.plant3d.scenegraph.Nozzle; import org.simantics.plant3d.scenegraph.P3DRootNode; import org.simantics.plant3d.scenegraph.PipeRun; import org.simantics.plant3d.scenegraph.PipelineComponent; @@ -58,14 +59,20 @@ public class AddComponentAction extends vtkSwtAction { this.component = component; allowed.clear(); - if (component.getNext() == null) { - allowed.add(PositionType.NEXT); - } - if (component.getPrevious() == null) { - allowed.add(PositionType.PREVIOUS); - } - if (component instanceof InlineComponent && !component.getControlPoint().isFixed()){ - allowed.add(PositionType.SPLIT); + if (component instanceof Nozzle) { + if (component.getNext() == null && component.getPrevious() == null) { + allowed.add(PositionType.NEXT); + } + } else { + if (component.getNext() == null) { + allowed.add(PositionType.NEXT); + } + if (component.getPrevious() == null) { + allowed.add(PositionType.PREVIOUS); + } + if (component instanceof InlineComponent && !component.getControlPoint().isFixed()){ + allowed.add(PositionType.SPLIT); + } } setEnabled(allowed.size() > 0); } diff --git a/org.simantics.plant3d/src/org/simantics/plant3d/editor/P3DContentOutlinePage.java b/org.simantics.plant3d/src/org/simantics/plant3d/editor/P3DContentOutlinePage.java index 160188e6..0c5ab5df 100644 --- a/org.simantics.plant3d/src/org/simantics/plant3d/editor/P3DContentOutlinePage.java +++ b/org.simantics.plant3d/src/org/simantics/plant3d/editor/P3DContentOutlinePage.java @@ -1,5 +1,8 @@ package org.simantics.plant3d.editor; +import java.util.ArrayList; +import java.util.List; + import org.eclipse.jface.action.IMenuListener; import org.eclipse.jface.action.IMenuManager; import org.eclipse.jface.action.MenuManager; @@ -56,11 +59,16 @@ public class P3DContentOutlinePage extends VTKContentOutlinePage list = new ArrayList(); + list.addAll(((PipeRun)parentElement).getControlPoints()); + list.addAll(((PipeRun)parentElement).getSortedChild()); + return list.toArray(); + } + return ((PipeRun)parentElement).getSortedChild().toArray(); + } + if (DEBUG) { if (parentElement instanceof PipelineComponent) { return new Object[]{((PipelineComponent) parentElement).getControlPoint()}; } else if (parentElement instanceof PipeControlPoint) { diff --git a/org.simantics.plant3d/src/org/simantics/plant3d/scenegraph/PipelineComponent.java b/org.simantics.plant3d/src/org/simantics/plant3d/scenegraph/PipelineComponent.java index 36c6dde1..06944b53 100644 --- a/org.simantics.plant3d/src/org/simantics/plant3d/scenegraph/PipelineComponent.java +++ b/org.simantics.plant3d/src/org/simantics/plant3d/scenegraph/PipelineComponent.java @@ -88,8 +88,8 @@ public abstract class PipelineComponent extends GeometryNode { public void setNext(PipelineComponent comp) { if (next == comp) return; - if (comp == null) - this.next._removeRef(this); + if (this.next != null) + this.next._removeRef(this); this.next = comp; this.syncnext = false; syncNext(); @@ -109,7 +109,7 @@ public abstract class PipelineComponent extends GeometryNode { public void setPrevious(PipelineComponent comp) { if (previous == comp) return; - if (comp == null) + if (this.previous != null) this.previous._removeRef(this); this.previous = comp; this.syncprev = false; @@ -130,8 +130,8 @@ public abstract class PipelineComponent extends GeometryNode { public void setBranch0(PipelineComponent comp) { if (branch0 == comp) return; - if (comp == null) - this.branch0._removeRef(this); + if (this.branch0 != null) + this.branch0._removeRef(this); this.branch0 = comp; this.syncbr0 = false; syncBranch0();