示例#1
0
        public override void OnEnable()
        {
            base.OnEnable();

            s_PreviewMovementSpeed = SessionState.GetFloat(k_PreviewMovementSpeed, 0.2f);
            s_PreviewTimeScale     = SessionState.GetFloat(k_PreviewTimeScale, 1.0f);
            s_PreviewShape         = (PreviewShape)SessionState.GetInt(k_PreviewShape, 0);
            s_PreviewShapeSize     = SessionState.GetFloat(k_PreviewShapeSize, 5.0f);

            m_CurveEditor.OnEnable(serializedObject);
            s_Inspectors.AddLast(this);
            SceneView.duringSceneGui += OnSceneViewGUI;
            EditorApplication.update += RepaintSceneView;
            ShortcutIntegration.instance.contextManager.RegisterToolContext(m_ShortcutContext);

            s_PlayEvent       = CreateCommandEvent("Play");
            s_StopEvent       = CreateCommandEvent("Stop");
            s_RestartEvent    = CreateCommandEvent("Restart");
            s_ShowBoundsEvent = CreateCommandEvent("ShowBounds");

            m_Time = serializedObject.FindProperty("m_Time");
            m_MinVertexDistance     = serializedObject.FindProperty("m_MinVertexDistance");
            m_Autodestruct          = serializedObject.FindProperty("m_Autodestruct");
            m_Emitting              = serializedObject.FindProperty("m_Emitting");
            m_ApplyActiveColorSpace = serializedObject.FindProperty("m_ApplyActiveColorSpace");
            m_ColorGradient         = serializedObject.FindProperty("m_Parameters.colorGradient");
            m_NumCornerVertices     = serializedObject.FindProperty("m_Parameters.numCornerVertices");
            m_NumCapVertices        = serializedObject.FindProperty("m_Parameters.numCapVertices");
            m_Alignment             = serializedObject.FindProperty("m_Parameters.alignment");
            m_TextureMode           = serializedObject.FindProperty("m_Parameters.textureMode");
            m_TextureScale          = serializedObject.FindProperty("m_Parameters.textureScale");
            m_ShadowBias            = serializedObject.FindProperty("m_Parameters.shadowBias");
            m_GenerateLightingData  = serializedObject.FindProperty("m_Parameters.generateLightingData");
            m_MaskInteraction       = serializedObject.FindProperty("m_MaskInteraction");
        }
示例#2
0
        List<GeoLibPointF> pBBDims(int index)
        {
            PreviewShape pShape1 = new PreviewShape(this, index);
            BoundingBox bb = new BoundingBox(new List<PreviewShape> { pShape1 });

            return bb.getPoints();
        }
示例#3
0
 private void init()
 {
     resistShapes  = new List <PreviewShape>();
     shadowLine    = new PreviewShape();
     minShadowLine = new PreviewShape();
     maxShadowLine = new PreviewShape();
     valid         = false;
 }
示例#4
0
        private void PlayBackInfoGUI()
        {
            EventType oldEventType  = Event.current.type;
            int       oldHotControl = GUIUtility.hotControl;
            string    oldFormat     = EditorGUI.kFloatFieldFormatString;

            EditorGUIUtility.labelWidth = k_SceneViewOverlayLabelWidth;

            EditorGUI.kFloatFieldFormatString = Styles.secondsFloatFieldFormatString;
            if (Time.timeScale == 0.0f)
            {
                using (new EditorGUI.DisabledScope(true))
                {
                    EditorGUILayout.FloatField(Styles.movementSpeedDisabled, 0.0f);
                    EditorGUILayout.FloatField(Styles.timeScaleDisabled, 0.0f);
                }
            }
            else
            {
                EditorGUI.BeginChangeCheck();
                s_PreviewMovementSpeed = Mathf.Clamp(EditorGUILayout.FloatField(Styles.movementSpeed, s_PreviewMovementSpeed), 0.0f, 2.0f);
                s_PreviewTimeScale     = Mathf.Clamp(EditorGUILayout.FloatField(Styles.timeScale, s_PreviewTimeScale), 0.1f, 1.0f);
                if (EditorGUI.EndChangeCheck())
                {
                    m_PreviewIsFirstMove = true;
                }
            }

            EditorGUI.BeginChangeCheck();
            s_PreviewShape = (PreviewShape)EditorGUILayout.EnumPopup(Styles.previewShape, s_PreviewShape);
            if (EditorGUI.EndChangeCheck())
            {
                m_PreviewIsFirstMove = true;
            }

            EditorGUI.BeginChangeCheck();
            s_PreviewShapeSize = EditorGUILayout.FloatField(Styles.previewShapeSize, s_PreviewShapeSize);
            if (EditorGUI.EndChangeCheck())
            {
                s_PreviewShapeSize   = ClampPreviewSize(target as TrailRenderer, s_PreviewShapeSize);
                m_PreviewIsFirstMove = true;
            }

            EditorGUI.kFloatFieldFormatString = oldFormat;

            s_PreviewShowBounds = GUILayout.Toggle(s_PreviewShowBounds, Styles.showBounds, EditorStyles.toggle);

            EditorGUIUtility.labelWidth = 0.0f;
        }
示例#5
0
        private GuiElement MakePreviewButton(PreviewShape shape, string icon)
        {
            var button = new Frame
            {
                Name             = shape.ToString(),
                Size             = new UDim2(0, 26, 0, 26),
                BackgroundColour = new Colour(0, 0, 0, 0.4f),
                BorderThickness  = 0
            };

            button.MouseEnter.Connect((x, y) =>
            {
                button.BackgroundColour = new Colour(0, 0, 0, 0.8f);
            });

            button.MouseLeave.Connect((x, y) =>
            {
                button.BackgroundColour = new Colour(0, 0, 0, 0.4f);
            });

            // ReSharper disable once ObjectCreationAsStatement
            new ImageLabel
            {
                BackgroundColour = Colour.Transparent,
                BorderThickness  = 0,
                Size             = new UDim2(0, 16, 0, 16),
                AlignmentX       = AlignmentX.Center,
                AlignmentY       = AlignmentY.Middle,
                ImageId          = $"editor://Icons/{icon}.png",
                Parent           = button
            };

            button.MouseButton1Up.Event += (x, y) => { Preview = shape; };

            return(button);
        }
示例#6
0
    private void pSetResistShapes(Colors colors, GeoLibPointF[] geom, GeoLibPointF[] bgGeom, GeoLibPointF[] shadow, GeoLibPointF[] min_, GeoLibPointF[] max_)
    {
        resistShapes.Clear();

        resistShapes.Add(new PreviewShape());
        resistShapes[0].addPoints(geom);
        resistShapes[0].setColor(colors.implantResist_Color);

        resistShapes.Add(new PreviewShape());
        resistShapes[1].addPoints(bgGeom);
        resistShapes[1].setColor(colors.implantResist_Color);

        shadowLine = new PreviewShape();
        shadowLine.addPoints(shadow);
        shadowLine.setColor(colors.implantMean_Color);

        minShadowLine = new PreviewShape();
        minShadowLine.addPoints(min_);
        minShadowLine.setColor(colors.implantMin_Color);

        maxShadowLine = new PreviewShape();
        maxShadowLine.addPoints(max_);
        maxShadowLine.setColor(colors.implantMax_Color);
    }