public override void OnEnable()
        {
            base.OnEnable();

            m_PointEditor = new LineRendererEditor(target as LineRenderer, this);
            m_PointEditor.Deselect();
            SceneView.onSceneGUIDelegate     += OnSceneGUIDelegate;
            Undo.undoRedoPerformed           += UndoRedoPerformed;
            EditMode.onEditModeStartDelegate += EditModeStarted;
            EditMode.onEditModeEndDelegate   += EditModeEnded;

            List <string> excludedProperties = new List <string>();

            excludedProperties.Add("m_Loop");
            excludedProperties.Add("m_Parameters");
            excludedProperties.Add("m_Positions");
            excludedProperties.AddRange(Probes.GetFieldsStringArray());
            if (!SupportedRenderingFeatures.active.rendererSupportsMotionVectors)
            {
                excludedProperties.Add("m_MotionVectors");
            }
            if (!SupportedRenderingFeatures.active.rendererSupportsReceiveShadows)
            {
                excludedProperties.Add("m_ReceiveShadows");
            }
            excludedProperties.Add("m_RenderingLayerMask");
            m_ExcludedProperties = excludedProperties.ToArray();

            m_CurveEditor.OnEnable(serializedObject);
            m_Loop                 = serializedObject.FindProperty("m_Loop");
            m_Positions            = serializedObject.FindProperty("m_Positions");
            m_PositionsSize        = serializedObject.FindProperty("m_Positions.Array.size");
            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_GenerateLightingData = serializedObject.FindProperty("m_Parameters.generateLightingData");
            m_ShadowBias           = serializedObject.FindProperty("m_Parameters.shadowBias");

            m_PositionsView = new LineRendererPositionsView(m_Positions);
            m_PositionsView.selectionChangedCallback += PositionsViewSelectionChanged;

            m_ShowPositionsAnimation = new AnimBool(false, Repaint)
            {
                value = m_Positions.isExpanded
            };
            EditorApplication.contextualPropertyMenu += OnPropertyContextMenu;

            // We cannot access isEditingMultipleObjects when drawing the SceneView so we need to cache it here for later use.
            m_IsMultiEditing = serializedObject.isEditingMultipleObjects;

            InitializeProbeFields();
        }
예제 #2
0
        public void EndEditPositions()
        {
            if (!m_EditingPositions)
            {
                return;
            }

            if (m_PointEditor != null)
            {
                m_PointEditor.Deselect();
            }

            ResetSimplifyPreview();
            Tools.s_Hidden = false;
            SceneView.RepaintAll();
        }
예제 #3
0
        public override void OnEnable()
        {
            base.OnEnable();

            var lineRenderer = target as LineRenderer;

            m_PointEditor = new LineRendererEditor(lineRenderer, this);

            m_PointEditor.Deselect();
            SceneView.duringSceneGui         += OnSceneGUIDelegate;
            Undo.undoRedoPerformed           += UndoRedoPerformed;
            EditMode.onEditModeStartDelegate += EditModeStarted;
            EditMode.onEditModeEndDelegate   += EditModeEnded;
            m_CurveEditor.OnEnable(serializedObject);

            m_Loop = serializedObject.FindProperty("m_Loop");
            m_ApplyActiveColorSpace = serializedObject.FindProperty("m_ApplyActiveColorSpace");
            m_Positions             = serializedObject.FindProperty("m_Positions");
            m_PositionsSize         = serializedObject.FindProperty("m_Positions.Array.size");
            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_GenerateLightingData  = serializedObject.FindProperty("m_Parameters.generateLightingData");
            m_ShadowBias            = serializedObject.FindProperty("m_Parameters.shadowBias");
            m_UseWorldSpace         = serializedObject.FindProperty("m_UseWorldSpace");
            m_MaskInteraction       = serializedObject.FindProperty("m_MaskInteraction");

            m_PositionsView = new LineRendererPositionsView(m_Positions);
            m_PositionsView.selectionChangedCallback += PositionsViewSelectionChanged;
            if (targets.Length == 1)
            {
                m_PositionsView.lineRenderer = lineRenderer;
            }

            m_ShowPositionsAnimation = new AnimBool(false, Repaint)
            {
                value = m_Positions.isExpanded
            };
            EditorApplication.contextualPropertyMenu += OnPropertyContextMenu;

            // We cannot access isEditingMultipleObjects when drawing the SceneView so we need to cache it here for later use.
            m_IsMultiEditing       = serializedObject.isEditingMultipleObjects;
            m_IsGameObjectEditable = (lineRenderer.gameObject.hideFlags & HideFlags.NotEditable) == 0;
        }
 public override void OnActivated()
 {
     pointEditor.Deselect();
 }