public void OnEnable()
 {
     Undo.undoRedoPerformed += OnUndoRedo;
     instance = (GPathPainter)target;
     instance.Internal_UpdateFalloffTexture();
     previewPropertyBlock = new MaterialPropertyBlock();
     GCommon.RegisterBeginRender(OnCameraRender);
     GCommon.RegisterBeginRenderSRP(OnCameraRenderSRP);
     GCommon.UpdateMaterials(instance.SplineCreator.GroupId);
 }
示例#2
0
        public override void OnInspectorGUI()
        {
            instance.SplineCreator = EditorGUILayout.ObjectField("Spline Creator", instance.SplineCreator, typeof(GSplineCreator), true) as GSplineCreator;
            if (instance.SplineCreator == null)
            {
                return;
            }
            instance.Channel = (GPathPainter.PaintChannel)EditorGUILayout.EnumPopup("Channel", instance.Channel);
            bool wideMode = EditorGUIUtility.wideMode;

            EditorGUIUtility.wideMode = true;
            EditorGUI.BeginChangeCheck();
            instance.Falloff = EditorGUILayout.CurveField("Falloff", instance.Falloff, Color.red, new Rect(0, 0, 1, 1));
            if (EditorGUI.EndChangeCheck())
            {
                instance.Internal_UpdateFalloffTexture();
            }

            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.PrefixLabel("Falloff Noise");
            instance.FalloffNoise = EditorGUILayout.ObjectField(instance.FalloffNoise, typeof(Texture2D), false) as Texture2D;
            EditorGUILayout.EndHorizontal();
            if (instance.FalloffNoise != null)
            {
                instance.FalloffNoiseSize = EditorGUILayout.Vector2Field("Falloff Noise Size", instance.FalloffNoiseSize);
            }
            EditorGUIUtility.wideMode = wideMode;

            if (instance.Channel == GPathPainter.PaintChannel.AlbedoAndMetallic)
            {
                DrawAlbedoAndMetallicGUI();
            }
            else if (instance.Channel == GPathPainter.PaintChannel.Splat)
            {
                DrawSplatGUI();
            }
            instance.Editor_ShowLivePreview = EditorGUILayout.Toggle("Live Preview", instance.Editor_ShowLivePreview);
            if (GUILayout.Button("Apply"))
            {
                GAnalytics.Record(GAnalytics.SPLINE_PATH_PAINTER);
                CreateInitialBackup();
                ApplyPath();
                CreateBackupAfterApplyPath();
            }
        }