Пример #1
0
        private static void SaveObjectPlacementLookAndFeel(XmlTextWriter xmlWriter, Octave3DConfigSaveLoadSettings saveSettings)
        {
            if (saveSettings.ObjectPlacementLookAndFeel)
            {
                ObjectPivotPointsRenderSettings           pivotPointsRenderSettings         = ObjectPlacement.Get().GuidePivotPointsRenderSettings;
                ProjectedBoxFacePivotPointsRenderSettings projectedPivotPointRenderSettings = pivotPointsRenderSettings.ProjectedBoxFacePivotPointsRenderSettings;
                ObjectVertexSnapSessionRenderSettings     vertexSnapRenderSettings          = ObjectPlacement.Get().ObjectVertexSnapSessionRenderSettings;

                xmlWriter.WriteNewLine(1);
                xmlWriter.WriteStartElement(Octave3DConfigXMLInfo.ObjectPlacementLookAndFeelNode);

                // Pivot points
                xmlWriter.WriteNewLine(2);
                xmlWriter.WriteStartElement(Octave3DConfigXMLInfo.GuidePivotPointsLookAndFeelNode);

                xmlWriter.WriteNewLine(3);
                xmlWriter.WriteStartElement(Octave3DConfigXMLInfo.GuidePivotPointsShapeTypeNode);
                xmlWriter.WriteString(pivotPointsRenderSettings.ShapeType.ToString());
                xmlWriter.WriteEndElement();

                xmlWriter.WriteNewLine(3);
                xmlWriter.WriteStartElement(Octave3DConfigXMLInfo.GuidePivotPointsShapeSizeInPixelsNode);
                xmlWriter.WriteString(pivotPointsRenderSettings.PivotPointSizeInPixels.ToString());
                xmlWriter.WriteEndElement();

                xmlWriter.WriteNewLine(3);
                xmlWriter.WriteStartElement(Octave3DConfigXMLInfo.DrawPivotPointProjectionLinesNode);
                xmlWriter.WriteString(projectedPivotPointRenderSettings.RenderProjectionLines.ToString());
                xmlWriter.WriteEndElement();

                xmlWriter.WriteNewLine(3);
                xmlWriter.WriteStartElement(Octave3DConfigXMLInfo.PivotPointProjectionLineColorNode);
                xmlWriter.WriteColorString(projectedPivotPointRenderSettings.ProjectionLineColor);
                xmlWriter.WriteEndElement();

                xmlWriter.WriteNewLine(3);
                xmlWriter.WriteStartElement(Octave3DConfigXMLInfo.DrawPivotPointConnectionLinesNode);
                xmlWriter.WriteString(projectedPivotPointRenderSettings.RenderPivotPointConnectionLines.ToString());
                xmlWriter.WriteEndElement();

                xmlWriter.WriteNewLine(3);
                xmlWriter.WriteStartElement(Octave3DConfigXMLInfo.PivotPointConnectionLineColorNode);
                xmlWriter.WriteColorString(projectedPivotPointRenderSettings.PivotPointConnectionLineColor);
                xmlWriter.WriteEndElement();

                xmlWriter.WriteNewLine(3);
                xmlWriter.WriteStartElement(Octave3DConfigXMLInfo.ActivePivotPointLookAndFeelNode);

                xmlWriter.WriteNewLine(4);
                xmlWriter.WriteStartElement(Octave3DConfigXMLInfo.PivotPointIsVisibleNode);
                xmlWriter.WriteString(projectedPivotPointRenderSettings.ActivePivotPointRenderSettings.IsVisible.ToString());
                xmlWriter.WriteEndElement();

                xmlWriter.WriteNewLine(4);
                xmlWriter.WriteStartElement(Octave3DConfigXMLInfo.PivotPointFillColorNode);
                xmlWriter.WriteColorString(projectedPivotPointRenderSettings.ActivePivotPointRenderSettings.FillColor);
                xmlWriter.WriteEndElement();

                xmlWriter.WriteNewLine(4);
                xmlWriter.WriteStartElement(Octave3DConfigXMLInfo.PivotPointBorderColorNode);
                xmlWriter.WriteColorString(projectedPivotPointRenderSettings.ActivePivotPointRenderSettings.BorderLineColor);
                xmlWriter.WriteEndElement();

                xmlWriter.WriteNewLine(4);
                xmlWriter.WriteStartElement(Octave3DConfigXMLInfo.PivotPointScaleNode);
                xmlWriter.WriteString(projectedPivotPointRenderSettings.ActivePivotPointRenderSettings.Scale.ToString());
                xmlWriter.WriteEndElement();

                xmlWriter.WriteNewLine(3);
                xmlWriter.WriteEndElement();

                xmlWriter.WriteNewLine(3);
                xmlWriter.WriteStartElement(Octave3DConfigXMLInfo.InactivePivotPointLookAndFeelNode);

                xmlWriter.WriteNewLine(4);
                xmlWriter.WriteStartElement(Octave3DConfigXMLInfo.PivotPointIsVisibleNode);
                xmlWriter.WriteString(projectedPivotPointRenderSettings.InactivePivotPointRenderSettings.IsVisible.ToString());
                xmlWriter.WriteEndElement();

                xmlWriter.WriteNewLine(4);
                xmlWriter.WriteStartElement(Octave3DConfigXMLInfo.PivotPointFillColorNode);
                xmlWriter.WriteColorString(projectedPivotPointRenderSettings.InactivePivotPointRenderSettings.FillColor);
                xmlWriter.WriteEndElement();

                xmlWriter.WriteNewLine(4);
                xmlWriter.WriteStartElement(Octave3DConfigXMLInfo.PivotPointBorderColorNode);
                xmlWriter.WriteColorString(projectedPivotPointRenderSettings.InactivePivotPointRenderSettings.BorderLineColor);
                xmlWriter.WriteEndElement();

                xmlWriter.WriteNewLine(4);
                xmlWriter.WriteStartElement(Octave3DConfigXMLInfo.PivotPointScaleNode);
                xmlWriter.WriteString(projectedPivotPointRenderSettings.InactivePivotPointRenderSettings.Scale.ToString());
                xmlWriter.WriteEndElement();

                xmlWriter.WriteNewLine(3);
                xmlWriter.WriteEndElement();

                xmlWriter.WriteNewLine(2);
                xmlWriter.WriteEndElement();

                // Vertex snapping
                xmlWriter.WriteNewLine(2);
                xmlWriter.WriteStartElement(Octave3DConfigXMLInfo.ObjectVertexSnappingLookAndFeelNode);

                xmlWriter.WriteNewLine(3);
                xmlWriter.WriteStartElement(Octave3DConfigXMLInfo.ObjectVertexSnappingDrawSrcVertexNode);
                xmlWriter.WriteString(vertexSnapRenderSettings.RenderSourceVertex.ToString());
                xmlWriter.WriteEndElement();

                xmlWriter.WriteNewLine(3);
                xmlWriter.WriteStartElement(Octave3DConfigXMLInfo.ObjectVertexSnappingSrcVertexFillColorNode);
                xmlWriter.WriteColorString(vertexSnapRenderSettings.SourceVertexFillColor);
                xmlWriter.WriteEndElement();

                xmlWriter.WriteNewLine(3);
                xmlWriter.WriteStartElement(Octave3DConfigXMLInfo.ObjectVertexSnappingSrcVertexBorderColorNode);
                xmlWriter.WriteColorString(vertexSnapRenderSettings.SourceVertexBorderColor);
                xmlWriter.WriteEndElement();

                xmlWriter.WriteNewLine(3);
                xmlWriter.WriteStartElement(Octave3DConfigXMLInfo.ObjectVertexSnappingSrcVertexPixelRadiusNode);
                xmlWriter.WriteString(vertexSnapRenderSettings.SourceVertexRadiusInPixels.ToString());
                xmlWriter.WriteEndElement();

                xmlWriter.WriteNewLine(2);
                xmlWriter.WriteEndElement();

                // Decor paint
                xmlWriter.WriteNewLine(2);
                xmlWriter.WriteStartElement(Octave3DConfigXMLInfo.DecorPaintLookAndFeelNode);

                xmlWriter.WriteNewLine(3);
                xmlWriter.WriteStartElement(Octave3DConfigXMLInfo.DecorPaintBrushCircleLookAndFeelNode);

                xmlWriter.WriteNewLine(4);
                xmlWriter.WriteStartElement(Octave3DConfigXMLInfo.DecorPaintBrushCircleBorderLineColorNode);
                xmlWriter.WriteColorString(ObjectPlacement.Get().DecorPaintObjectPlacement.BrushCircleRenderSettings.BorderLineColor);
                xmlWriter.WriteEndElement();

                xmlWriter.WriteNewLine(3);
                xmlWriter.WriteEndElement();

                xmlWriter.WriteNewLine(2);
                xmlWriter.WriteEndElement();

                // Path
                ObjectPlacementPathRenderSettings pathRenderSettings = ObjectPlacement.Get().PathObjectPlacement.PathRenderSettings;
                xmlWriter.WriteNewLine(2);
                xmlWriter.WriteStartElement(Octave3DConfigXMLInfo.PathLookAndFeelNode);

                xmlWriter.WriteNewLine(3);
                xmlWriter.WriteStartElement(Octave3DConfigXMLInfo.PathBorderLineColorNode);
                xmlWriter.WriteColorString(pathRenderSettings.ManualConstructionRenderSettings.BoxBorderLineColor);
                xmlWriter.WriteEndElement();

                SaveExtensionPlaneLookAndFeel(ObjectPlacement.Get().PathObjectPlacement.PathExtensionPlaneRenderSettings, xmlWriter, 3);

                xmlWriter.WriteNewLine(2);
                xmlWriter.WriteEndElement();

                // Block
                ObjectPlacementBlockRenderSettings blockRenderSettings = ObjectPlacement.Get().BlockObjectPlacement.BlockRenderSettings;
                xmlWriter.WriteNewLine(2);
                xmlWriter.WriteStartElement(Octave3DConfigXMLInfo.BlockLookAndFeelNode);

                xmlWriter.WriteNewLine(3);
                xmlWriter.WriteStartElement(Octave3DConfigXMLInfo.BlockBorderLineColorNode);
                xmlWriter.WriteColorString(blockRenderSettings.ManualConstructionRenderSettings.BoxBorderLineColor);
                xmlWriter.WriteEndElement();

                xmlWriter.WriteNewLine(3);
                xmlWriter.WriteStartElement(Octave3DConfigXMLInfo.BlockTextColorNode);
                xmlWriter.WriteColorString(blockRenderSettings.ManualConstructionRenderSettings.DimensionsLabelRenderSettings.TextColor);
                xmlWriter.WriteEndElement();

                xmlWriter.WriteNewLine(3);
                xmlWriter.WriteStartElement(Octave3DConfigXMLInfo.BlockFontSizeNode);
                xmlWriter.WriteString(blockRenderSettings.ManualConstructionRenderSettings.DimensionsLabelRenderSettings.FontSize.ToString());
                xmlWriter.WriteEndElement();

                xmlWriter.WriteNewLine(3);
                xmlWriter.WriteStartElement(Octave3DConfigXMLInfo.BlockBoldTextNode);
                xmlWriter.WriteString(blockRenderSettings.ManualConstructionRenderSettings.DimensionsLabelRenderSettings.Bold.ToString());
                xmlWriter.WriteEndElement();

                SaveExtensionPlaneLookAndFeel(ObjectPlacement.Get().BlockObjectPlacement.BlockExtensionPlaneRenderSettings, xmlWriter, 3);

                xmlWriter.WriteNewLine(2);
                xmlWriter.WriteEndElement();

                xmlWriter.WriteNewLine(1);
                xmlWriter.WriteEndElement();
            }
        }
Пример #2
0
        private void RenderPivotPointProjectionLines(ProjectedBoxFacePivotPoints projectedBoxFacePivotPoints, ObjectPivotPointsRenderSettings pivotPointsRenderSettings)
        {
            ProjectedBoxFacePivotPointsRenderSettings renderSettings = pivotPointsRenderSettings.ProjectedBoxFacePivotPointsRenderSettings;

            if (renderSettings.RenderProjectionLines)
            {
                List <Vector3> allPivotPoints = projectedBoxFacePivotPoints.AllPoints;
                if (allPivotPoints.Count != 0)
                {
                    Color projectionLineColor = renderSettings.ProjectionLineColor;

                    List <Vector3> unprojectedPoints = projectedBoxFacePivotPoints.GetUnprojectedPivotPoints();
                    for (int pointIndex = 0; pointIndex < unprojectedPoints.Count; ++pointIndex)
                    {
                        GizmosEx.RenderLine(allPivotPoints[pointIndex], unprojectedPoints[pointIndex], projectionLineColor);
                    }
                }
            }
        }
Пример #3
0
        private void RenderPivotPointConnectionLines(ProjectedBoxFacePivotPoints projectedBoxFacePivotPoints, ObjectPivotPointsRenderSettings pivotPointsRenderSettings)
        {
            ProjectedBoxFacePivotPointsRenderSettings renderSettings = pivotPointsRenderSettings.ProjectedBoxFacePivotPointsRenderSettings;

            if (renderSettings.RenderPivotPointConnectionLines)
            {
                List <Vector3> pivotPointsNoCenter = projectedBoxFacePivotPoints.GetAllPointsExcludingCenter();
                if (pivotPointsNoCenter.Count != 0)
                {
                    GizmosEx.RenderLinesBetweenPoints(pivotPointsNoCenter, renderSettings.PivotPointConnectionLineColor);
                }
            }
        }
Пример #4
0
        private void RenderAllPivotPoints(ProjectedBoxFacePivotPoints projectedBoxFacePivotPoints, ObjectPivotPointsRenderSettings pivotPointsRenderSettings)
        {
            List <Vector3> allPivotPoints = projectedBoxFacePivotPoints.AllPoints;

            if (allPivotPoints.Count != 0)
            {
                ProjectedBoxFacePivotPointsRenderSettings renderSettings = pivotPointsRenderSettings.ProjectedBoxFacePivotPointsRenderSettings;
                IPivotPointRenderer objectPivotPointRenderer             = PivotPointRendererFactory.Create(pivotPointsRenderSettings.ShapeType);

                Color activePivotPointFillColor         = renderSettings.ActivePivotPointRenderSettings.FillColor;
                Color inactivePivotPointFillColor       = renderSettings.InactivePivotPointRenderSettings.FillColor;
                Color activePivotPointBorderLineColor   = renderSettings.ActivePivotPointRenderSettings.BorderLineColor;
                Color inactivePivotPointBorderLineColor = renderSettings.InactivePivotPointRenderSettings.BorderLineColor;

                float pivotPointSizeInPixels  = pivotPointsRenderSettings.PivotPointSizeInPixels;
                float activePivotPointScale   = renderSettings.ActivePivotPointRenderSettings.Scale;
                float inactivePivotPointScale = renderSettings.InactivePivotPointRenderSettings.Scale;

                if (renderSettings.InactivePivotPointRenderSettings.IsVisible)
                {
                    for (int pivotPointIndex = 0; pivotPointIndex < allPivotPoints.Count; ++pivotPointIndex)
                    {
                        if (pivotPointIndex != projectedBoxFacePivotPoints.IndexOfActivePoint)
                        {
                            objectPivotPointRenderer.Render(allPivotPoints[pivotPointIndex], inactivePivotPointFillColor, inactivePivotPointBorderLineColor, pivotPointSizeInPixels * inactivePivotPointScale);
                        }
                    }
                }

                if (renderSettings.ActivePivotPointRenderSettings.IsVisible)
                {
                    objectPivotPointRenderer.Render(allPivotPoints[projectedBoxFacePivotPoints.IndexOfActivePoint], activePivotPointFillColor, activePivotPointBorderLineColor, pivotPointSizeInPixels * activePivotPointScale);
                }
            }
        }
Пример #5
0
 public void RenderGizmos(ProjectedBoxFacePivotPoints projectedBoxFacePivotPoints, ObjectPivotPointsRenderSettings pivotPointsRenderSettings)
 {
     if (ObjectPlacementGuide.ExistsInSceneAndIsActive &&
         SceneViewCamera.Instance.IsGameObjectHierarchyVisible(ObjectPlacementGuide.SceneObject))
     {
         RenderPivotPointConnectionLines(projectedBoxFacePivotPoints, pivotPointsRenderSettings);
         RenderPivotPointProjectionLines(projectedBoxFacePivotPoints, pivotPointsRenderSettings);
         RenderAllPivotPoints(projectedBoxFacePivotPoints, pivotPointsRenderSettings);
     }
 }
Пример #6
0
 public ObjectPivotPointsRenderSettingsView(ObjectPivotPointsRenderSettings settings)
 {
     _settings = settings;
 }