public static void ShowWindow() { XffectBrowser window = GetWindow <XffectBrowser>(); window.title = "Xffect Browser"; window.Init(); window.Show(); }
public static void ShowWindow() { XffectBrowser window = GetWindow <XffectBrowser>(); window.titleContent = new GUIContent("Xffect Browser"); window.Init(); window.Show(); }
public override void OnInspectorGUI() { //foreach (GameObject meshobj in Script.MeshList) //{ //if (meshobj != null) //EditorUtility.SetSelectedWireframeHidden(meshobj.renderer, true); //} serializedObject.Update(); //check if need to upgrade. //System.Version myVer = new System.Version(Script.MyVersion); //if (myVer <= new System.Version("4.4.0")) //{ // DoPatch440(Script); // EditorUtility.SetDirty(target); //} XEditor.BeginCommonArea("xffect main config", Script.gameObject.name, this, true); EditorGUILayout.Space(); if (EditorUtility.IsPersistent(target)) { if (GUILayout.Button("Put To Scene")) { GameObject obj = PrefabUtility.InstantiatePrefab(Selection.activeObject as GameObject) as GameObject; Selection.activeGameObject = obj; if (obj != null) { XffectComponent xobj = obj.GetComponent <XffectComponent>(); if (xobj != null) { xobj.EditView = true; xobj.EnableEditView(); } } } if (GUILayout.Button("Open Xffect Browser")) { XffectBrowser.ShowWindow(); } } else { XEditor.DrawToggle("update in editor?", "", EditView); //EditView.boolValue = EditorGUILayout.Toggle("update in editor:", EditView.boolValue,GUILayout.Height(40f)); //if (EditView.boolValue == true) { //if (!XffectComponent.IsActive(Script.gameObject)) { //EditView.boolValue = false; //Debug.Log ("you need to activate the xffect object: " + Script.gameObject.name + " before updating it in editor."); //} //} if (EditView.boolValue) { Script.EnableEditView(); } else { Paused.boolValue = false; Script.DisableEditView(); } } if (EditView.boolValue) { PlaybackTime.floatValue = EditorGUILayout.FloatField("Playback time: ", PlaybackTime.floatValue); if (PlaybackTime.floatValue < 0f) { PlaybackTime.floatValue = 0f; } string disp = "Pause"; if (Paused.boolValue) { disp = "Play"; } EditorGUILayout.BeginHorizontal(); if (GUILayout.Button(disp)) { Paused.boolValue = !Paused.boolValue; } if (GUILayout.Button("Reset")) { Paused.boolValue = false; Script.ResetEditScene(); } EditorGUILayout.EndHorizontal(); } XEditor.DrawSeparator(); XEditor.DrawFloat("life(-1 means infinite):", "", LifeTime); XEditor.DrawToggle("ignore time scale?", "", IgnoreTimeScale); XEditor.DrawToggle("auto destroy?", "check on this option if you want this obj to be destroyed when finished, note this option only works in play mode.", AutoDestroy); XEditor.DrawToggle("merge same mesh?", "check on this option to merge the meshes with same material, can reduce drawcalls.", MergeSameMaterialMesh); XEditor.DrawToggle("update when offscreen?", "", UpdateWhenOffScreen); if (XEditor.DrawToggle("use with 2d sprite?", "", UseWith2DSprite)) { XEditor.DrawText("sorting layer name:", "", SortingLayerName); XEditor.DrawInt("sorting order:", "", SortingOrder); } EditorGUILayout.Space(); XEditor.DrawInt("Max Fps:", "", MaxFps); XEditor.DrawFloat("scale:", "change this Xffect's scale", Scale); if (!Mathf.Approximately(1f, Scale.floatValue)) { XEditor.DrawInfo("note it's not recommended to use this function to change xffect's scale. if you encounter strange behavious, please change it back to 1."); } if (GUILayout.Button("Add Layer")) { GameObject layer = new GameObject(LayerName); EffectLayer efl = (EffectLayer)layer.AddComponent <EffectLayer>(); layer.transform.parent = Selection.activeTransform; efl.transform.localPosition = Vector3.zero; //default to effect layer object. efl.ClientTransform = efl.transform; efl.GravityObject = efl.transform; efl.BombObject = efl.transform; efl.TurbulenceObject = efl.transform; efl.AirObject = efl.transform; efl.VortexObj = efl.transform; //efl.DirCenter = efl.transform; efl.Material = AssetDatabase.LoadAssetAtPath(XEditorTool.GetXffectPath() + DefaultMatPath, typeof(Material)) as Material; efl.gameObject.layer = Script.gameObject.layer; efl.LineStartObj = efl.transform; Selection.activeGameObject = layer; } if (GUILayout.Button("Add Event")) { GameObject obj = new GameObject("_Event"); XftEventComponent xevent = (XftEventComponent)obj.AddComponent <XftEventComponent>(); xevent.transform.parent = Selection.activeTransform; xevent.transform.localPosition = Vector3.zero; xevent.RadialBlurShader = Shader.Find("Xffect/PP/radial_blur"); xevent.GlowCompositeShader = Shader.Find("Xffect/PP/glow_compose"); xevent.GlowDownSampleShader = Shader.Find("Xffect/PP/glow_downsample"); xevent.GlowBlurShader = Shader.Find("Xffect/PP/glow_conetap"); xevent.RadialBlurObj = xevent.transform; xevent.ColorInverseShader = Shader.Find("Xffect/PP/color_inverse"); xevent.GlowPerObjBlendShader = Shader.Find("Hidden/PP/Xffect/glow_per_obj/blend"); xevent.GlowPerObjReplacementShader = Shader.Find("Hidden/PP/Xffect/glow_per_obj/replacement"); xevent.gameObject.layer = Script.gameObject.layer; Selection.activeGameObject = obj; } XEditor.EndXArea(); DrawInfos(); serializedObject.ApplyModifiedProperties(); }