void LoadStyle() { if (EffectLayerCustom.IsSkinLoaded) { return; } EffectLayerCustom.LoadStyle(); }
override public void OnInspectorGUI() { if (mSplinecomp != null) { if (mSplinecomp.CachedElements.Count == 0) { mSplinecomp.RefreshElements(); } bool addremove = false, selected = false; EditorGUILayout.BeginVertical(); if (EffectLayerCustom.XInfoArea == null) { EffectLayerCustom.LoadStyle(); } //GUILayout.Label("note: if you are trying to edit the spline, please make sure it has NO PREFAB INSTANCE, or the inspector would be very very slow, this is most probably a unity bug:(", EffectLayerCustom.XInfoArea); //EditorGUILayout.LabelField("Point Count", mSpline.mPoints.Count.ToString()); //EditorGUILayout.LabelField("Length", mSpline.Length.ToString()); mSplinecomp.ShowDebug = EditorGUILayout.Toggle("Show Debug?", mSplinecomp.ShowDebug); mSpline.InterpolateType = (XSpline.SplineType)EditorGUILayout.EnumPopup("Interpolate Type:", mSpline.InterpolateType); if (mSpline.InterpolateType != XSpline.SplineType.Linear) { mSplinecomp.Granularity = EditorGUILayout.IntField("Granularity:", mSplinecomp.Granularity); } mSpline.WrapType = (XSpline.WrapMode)EditorGUILayout.EnumPopup("Wrap mode", mSpline.WrapType); mSpline.Reparam = (XSpline.ReparamType)EditorGUILayout.EnumPopup("Reparameterization", mSpline.Reparam); if (mSpline.Reparam != XSpline.ReparamType.None) { mSpline.StepCount = EditorGUILayout.IntSlider("Step Count", mSpline.StepCount, 1, 64); } EditorGUILayout.EndVertical(); EditorGUILayout.BeginVertical(); if (mSpline.mPoints.Count > 0) { if (GUILayout.Button("Select Last Point")) { mEdithelper.SelectFirst(); } } if (GUILayout.Button("Append Point")) { mEdithelper.AppendPoint(); addremove = true; } if (GUILayout.Button("Remove Last")) { mEdithelper.RemoveLast(); addremove = true; } if (GUILayout.Button("Reverse Points")) { mSpline.ReversePoints(); addremove = true; } if (GUILayout.Button("Set Pivot To Center")) { ResetPivotToCenter(); } if (GUILayout.Button("Set Pivot To First Point")) { ResetPivotToFirstPoint(); } if (GUILayout.Button("Set Pivot To Last Point")) { ResetPivotToLastPoint(); } EditorGUILayout.EndVertical(); if (mEdithelper.SomethingSelected) { EditorGUILayout.Space(); EditorGUILayout.Space(); EditorGUILayout.LabelField("Selected Point:", mEdithelper.SelectedIndex.ToString()); if (mSpline.InterpolateType == XSpline.SplineType.Bezier) { mEdithelper.SelectedPoint.mBezierType = (XSpline.BezierPointType)EditorGUILayout.EnumPopup("Point Type", mEdithelper.SelectedPoint.mBezierType); mEdithelper.SelectedPoint.mPoint = EditorGUILayout.Vector3Field("Position", mEdithelper.SelectedPoint.mPoint); if (mEdithelper.SelectedPoint.mBezierType != XSpline.BezierPointType.Smooth) { mEdithelper.SelectedPoint.mPrevctrl = EditorGUILayout.Vector3Field("Handle In", mEdithelper.SelectedPoint.mPrevctrl); mEdithelper.SelectedPoint.mNextctrl = EditorGUILayout.Vector3Field("Handle Out", mEdithelper.SelectedPoint.mNextctrl); } } else { mEdithelper.SelectedPoint.mPoint = EditorGUILayout.Vector3Field("Position", mEdithelper.SelectedPoint.mPoint); } EditorGUILayout.BeginHorizontal(); if (GUILayout.Button("Insert Before")) { mEdithelper.InsertBefore(); addremove = true; } if (GUILayout.Button("Insert After")) { mEdithelper.InsertAfter(); addremove = true; } EditorGUILayout.EndHorizontal(); if (GUILayout.Button("Remove")) { mEdithelper.Remove(); addremove = true; } } if (GUI.changed || addremove) { mSpline.Build(); mSplinecomp.RefreshElements(); EditorUtility.SetDirty(mSplinecomp); Repaint(); } if (selected) { Repaint(); SceneView.RepaintAll(); GUIUtility.keyboardControl = 0; } } }