Esempio n. 1
0
 private void OnSceneGUI()
 {
     if (m_GizmoDisplayed && m_GizmoedParameter != null && m_GizmoableParameters.Count > 0 && ((VisualEffect)target).visualEffectAsset != null)
     {
         ContextAndGizmo context = GetGizmo();
         VFXGizmoUtility.Draw(context.context, (VisualEffect)target, context.gizmo);
     }
 }
Esempio n. 2
0
        new void OnSceneGUI()
        {
            base.OnSceneGUI();

            if (m_GizmoDisplayed && m_GizmoedParameter != null)
            {
                ContextAndGizmo context = GetGizmo();

                VFXGizmoUtility.Draw(context.context, (VisualEffect)target, context.gizmo);
            }
        }
        protected override void OnSceneViewGUI(SceneView sv)
        {
            base.OnSceneViewGUI(sv);

            if (m_GizmoDisplayed && m_GizmoedParameter != null)
            {
                ContextAndGizmo context = GetGizmo();

                VFXGizmoUtility.Draw(context.context, (VisualEffect)target, context.gizmo);
            }
        }
Esempio n. 4
0
        internal override Bounds GetWorldBoundsOfTarget(UnityObject targetObject)
        {
            if (m_GizmoDisplayed && m_GizmoedParameter != null)
            {
                ContextAndGizmo context = GetGizmo();

                Bounds result = VFXGizmoUtility.GetGizmoBounds(context.context, (VisualEffect)target, context.gizmo);

                return(result);
            }

            return(base.GetWorldBoundsOfTarget(targetObject));
        }
Esempio n. 5
0
        protected override void SceneViewGUICallback()
        {
            base.SceneViewGUICallback();

            if (m_GizmoDisplayed && m_GizmoedParameter != null && m_GizmoableParameters.Count > 0 && ((VisualEffect)target).visualEffectAsset != null)
            {
                ContextAndGizmo context = GetGizmo();
                VFXGizmoUtility.Draw(context.context, (VisualEffect)target, context.gizmo);
            }

            if (m_GizmoableParameters.Count > 0)
            {
                int current = m_GizmoDisplayed ? m_GizmoableParameters.IndexOf(m_GizmoedParameter) : -1;
                EditorGUI.BeginChangeCheck();
                GUILayout.BeginHorizontal();
                GUILayout.Label("Gizmos", GUILayout.Width(45));
                int result = EditorGUILayout.Popup(current, m_GizmoableParameters.Select(t => t.exposedName).ToArray(), GUILayout.Width(140));
                if (EditorGUI.EndChangeCheck() && result != current)
                {
                    m_GizmoedParameter = m_GizmoableParameters[result];
                    if (!m_GizmoDisplayed)
                    {
                        m_GizmoDisplayed = true;
                        EditMode.ChangeEditMode(EditMode.SceneViewEditMode.Collider, this);
                    }
                    Repaint();
                }

                bool saveEnabled = GUI.enabled;
                GUI.enabled = saveEnabled && m_GizmoedParameter != null;
                if (GUILayout.Button(VFXSlotContainerEditor.Contents.gizmoFrame, VFXSlotContainerEditor.Styles.frameButtonStyle, GUILayout.Width(19), GUILayout.Height(18)))
                {
                    if (m_GizmoDisplayed && m_GizmoedParameter != null)
                    {
                        ContextAndGizmo context = GetGizmo();

                        context.gizmo.currentSpace        = context.context.space;
                        context.gizmo.spaceLocalByDefault = context.context.spaceLocalByDefault;
                        context.gizmo.component           = (VisualEffect)target;
                        Bounds bounds    = context.gizmo.CallGetGizmoBounds(context.context.value);
                        var    sceneView = SceneView.lastActiveSceneView;
                        if (sceneView)
                        {
                            sceneView.Frame(bounds, false);
                        }
                    }
                }
                GUI.enabled = saveEnabled;
                GUILayout.EndHorizontal();
            }
        }
Esempio n. 6
0
        protected override void SceneViewGUICallback()
        {
            base.SceneViewGUICallback();

            if (m_GizmoableParameters.Count > 0)
            {
                int current = m_GizmoDisplayed ? m_GizmoableParameters.IndexOf(m_GizmoedParameter) : -1;
                EditorGUI.BeginChangeCheck();
                GUILayout.BeginHorizontal();
                GUILayout.Label("Gizmos", GUILayout.Width(45));
                int result = EditorGUILayout.Popup(current, m_GizmoableParameters.Select(t => t.exposedName).ToArray(), GUILayout.Width(140));
                if (EditorGUI.EndChangeCheck() && result != current)
                {
                    m_GizmoedParameter = m_GizmoableParameters[result];
                    if (!m_GizmoDisplayed)
                    {
                        m_GizmoDisplayed = true;
                        EditMode.ChangeEditMode(EditMode.SceneViewEditMode.Collider, this);
                    }
                    Repaint();
                }

                bool saveEnabled = GUI.enabled;
                GUI.enabled = saveEnabled && m_GizmoedParameter != null;
                if (GUILayout.Button(VFXSlotContainerEditor.Contents.gizmoFrame, VFXSlotContainerEditor.Styles.frameButtonStyle, GUILayout.Width(19), GUILayout.Height(18)))
                {
                    if (m_GizmoDisplayed && m_GizmoedParameter != null)
                    {
                        ContextAndGizmo context = GetGizmo();
                        Bounds          bounds  = VFXGizmoUtility.GetGizmoBounds(context.context, (VisualEffect)target, context.gizmo);
                        context.context.Unprepare(); //Restore initial state : if gizmo isn't actually rendered, it could be out of sync
                        var sceneView = SceneView.lastActiveSceneView;
                        if (sceneView)
                        {
                            sceneView.Frame(bounds, false);
                        }
                    }
                }
                GUI.enabled = saveEnabled;
                GUILayout.EndHorizontal();
            }
        }
Esempio n. 7
0
        protected override void SceneViewGUICallback(UnityObject tar, SceneView sceneView)
        {
            base.SceneViewGUICallback(tar, sceneView);
            if (m_GizmoableParameters.Count > 0)
            {
                int current = m_GizmoDisplayed ? m_GizmoableParameters.IndexOf(m_GizmoedParameter) : -1;
                EditorGUI.BeginChangeCheck();
                GUILayout.BeginHorizontal();
                GUILayout.Label("Gizmos", GUILayout.Width(45));
                int result = EditorGUILayout.Popup(current, m_GizmoableParameters.Select(t => t.exposedName).ToArray(), GUILayout.Width(163));
                if (EditorGUI.EndChangeCheck() && result != current)
                {
                    m_GizmoedParameter = m_GizmoableParameters[result];
                    if (!m_GizmoDisplayed)
                    {
                        m_GizmoDisplayed = true;
                        EditMode.ChangeEditMode(EditMode.SceneViewEditMode.Collider, this);
                    }
                    Repaint();
                }

                GUI.enabled = m_GizmoedParameter != null;
                if (GUILayout.Button(VFXSlotContainerEditor.Contents.gizmoFrame, VFXSlotContainerEditor.Styles.frameButtonStyle, GUILayout.Width(19), GUILayout.Height(18)))
                {
                    if (m_GizmoDisplayed && m_GizmoedParameter != null)
                    {
                        ContextAndGizmo context = GetGizmo();

                        context.gizmo.currentSpace = context.context.space;
                        context.gizmo.component    = (VisualEffect)target;
                        Bounds bounds = context.gizmo.CallGetGizmoBounds(context.context.value);
                        sceneView.Frame(bounds, false);
                    }
                }
                GUI.enabled = true;
                GUILayout.EndHorizontal();
            }
        }