Example #1
0
    void OnGUI()
    {
        EditorGUILayout.BeginVertical();
        scrollPosition = GUILayout.BeginScrollView(scrollPosition, false, false);
        EditorGUILayout.Separator();
        EditorGUILayout.LabelField(playgroundLanguage.playgroundBrushWizard, EditorStyles.largeLabel, GUILayout.Height(20));
        EditorGUILayout.Separator();

        GUILayout.BeginVertical("box");
        EditorGUILayout.HelpBox(playgroundLanguage.brushWizardText, MessageType.Info);
        EditorGUILayout.Separator();

        GUILayout.BeginHorizontal();
        EditorGUILayout.PrefixLabel(playgroundLanguage.brushTexture);
        Texture2D selectedBrushTexture = brushTexture;

        brushTexture = EditorGUILayout.ObjectField(brushTexture, typeof(Texture2D), false) as Texture2D;
        GUILayout.EndHorizontal();
        if (selectedBrushTexture != brushTexture)
        {
            brushName = brushTexture.name;
        }
        brushName           = EditorGUILayout.TextField(playgroundLanguage.nameText, brushName);
        brushScale          = EditorGUILayout.FloatField(playgroundLanguage.scale, brushScale);
        brushDetail         = (BRUSHDETAILC)EditorGUILayout.EnumPopup(playgroundLanguage.detail, brushDetail);
        distance            = EditorGUILayout.FloatField(playgroundLanguage.distance, distance);
        spacing             = EditorGUILayout.FloatField(playgroundLanguage.paintSpacing, spacing);
        exceedMaxStopsPaint = EditorGUILayout.Toggle(playgroundLanguage.exceedMaxStopsPaint, exceedMaxStopsPaint);

        if (GUILayout.Button(playgroundLanguage.create, EditorStyles.toolbarButton, GUILayout.ExpandWidth(false)))
        {
            brushName = brushName.Trim();
            if (brushTexture && brushName != "")
            {
                if (AssetDatabase.LoadAssetAtPath("Assets/" + PlaygroundParticleSystemInspectorC.playgroundSettings.playgroundPath + PlaygroundParticleSystemInspectorC.playgroundSettings.brushPath + brushName + ".prefab", typeof(GameObject)))
                {
                    if (EditorUtility.DisplayDialog(playgroundLanguage.brushSameName,
                                                    brushName + " " + playgroundLanguage.brushSameNameText,
                                                    playgroundLanguage.yes,
                                                    playgroundLanguage.no))
                    {
                        CreateBrush();
                    }
                }
                else
                {
                    CreateBrush();
                }
            }
        }

        GUILayout.EndVertical();
        GUILayout.EndScrollView();
        EditorGUILayout.EndVertical();
    }
Example #2
0
    void OnGUI()
    {
        EditorGUILayout.BeginVertical();
        scrollPosition = GUILayout.BeginScrollView(scrollPosition, false, false);
        EditorGUILayout.Separator();
        EditorGUILayout.LabelField("Playground Brush Wizard", EditorStyles.largeLabel, GUILayout.Height(20));
        EditorGUILayout.Separator();

        GUILayout.BeginVertical("box");
        EditorGUILayout.HelpBox("Create a Particle Playground Brush by selecting a texture and edit its settings. The texture must have Read/Write Enabled and use True Color (non-compressed) in its import settings .", MessageType.Info);
        EditorGUILayout.Separator();

        GUILayout.BeginHorizontal();
        EditorGUILayout.PrefixLabel("Brush Texture");
        Texture2D selectedBrushTexture = brushTexture;

        brushTexture = EditorGUILayout.ObjectField(brushTexture, typeof(Texture2D), false) as Texture2D;
        GUILayout.EndHorizontal();
        if (selectedBrushTexture != brushTexture)
        {
            brushName = brushTexture.name;
        }
        brushName           = EditorGUILayout.TextField("Name", brushName);
        brushScale          = EditorGUILayout.FloatField("Scale", brushScale);
        brushDetail         = (BRUSHDETAILC)EditorGUILayout.EnumPopup("Detail", brushDetail);
        distance            = EditorGUILayout.FloatField("Distance", distance);
        spacing             = EditorGUILayout.FloatField("Spacing", spacing);
        exceedMaxStopsPaint = EditorGUILayout.Toggle("Exceeding Max Stops Paint", exceedMaxStopsPaint);

        if (GUILayout.Button("Create", EditorStyles.toolbarButton, GUILayout.Width(50)))
        {
            brushName = brushName.Trim();
            if (brushTexture && brushName != "")
            {
                if (AssetDatabase.LoadAssetAtPath(PlaygroundParticleWindowC.playgroundPath + PlaygroundParticleWindowC.brushPath + brushName + ".prefab", typeof(GameObject)))
                {
                    if (EditorUtility.DisplayDialog("Brush with same name found!",
                                                    "The brush " + brushName + " already exists. Do you want to overwrite it?",
                                                    "Yes",
                                                    "No"))
                    {
                        CreateBrush();
                    }
                }
                else
                {
                    CreateBrush();
                }
            }
        }

        GUILayout.EndVertical();
        GUILayout.EndScrollView();
        EditorGUILayout.EndVertical();
    }
	void OnGUI () {
		EditorGUILayout.BeginVertical();
		scrollPosition = GUILayout.BeginScrollView(scrollPosition, false, false);
		EditorGUILayout.Separator();
		EditorGUILayout.LabelField(playgroundLanguage.playgroundBrushWizard, EditorStyles.largeLabel, GUILayout.Height(20));
		EditorGUILayout.Separator();
		
		GUILayout.BeginVertical("box");
		EditorGUILayout.HelpBox(playgroundLanguage.brushWizardText, MessageType.Info);
		EditorGUILayout.Separator();
		
		GUILayout.BeginHorizontal();
		EditorGUILayout.PrefixLabel(playgroundLanguage.brushTexture);
		Texture2D selectedBrushTexture = brushTexture;
		brushTexture = EditorGUILayout.ObjectField(brushTexture, typeof(Texture2D), false) as Texture2D;
		GUILayout.EndHorizontal();
		if (selectedBrushTexture!=brushTexture)
			brushName = brushTexture.name;
		brushName = EditorGUILayout.TextField(playgroundLanguage.nameText, brushName);
		brushScale = EditorGUILayout.FloatField(playgroundLanguage.scale, brushScale);
		brushDetail = (BRUSHDETAILC)EditorGUILayout.EnumPopup(playgroundLanguage.detail, brushDetail);
		distance = EditorGUILayout.FloatField(playgroundLanguage.distance, distance);
		spacing = EditorGUILayout.FloatField(playgroundLanguage.paintSpacing, spacing);
		exceedMaxStopsPaint = EditorGUILayout.Toggle(playgroundLanguage.exceedMaxStopsPaint, exceedMaxStopsPaint);
		
		if(GUILayout.Button(playgroundLanguage.create, EditorStyles.toolbarButton, GUILayout.ExpandWidth(false))){
			brushName = brushName.Trim();
			if (brushTexture && brushName!="") {
				if (AssetDatabase.LoadAssetAtPath("Assets/"+PlaygroundParticleSystemInspectorC.playgroundSettings.playgroundPath+PlaygroundParticleSystemInspectorC.playgroundSettings.brushPath+brushName+".prefab", typeof(GameObject))) {
					if (EditorUtility.DisplayDialog(playgroundLanguage.brushSameName, 
						brushName+" "+playgroundLanguage.brushSameNameText, 
                        playgroundLanguage.yes, 
                        playgroundLanguage.no))
							CreateBrush();
				} else CreateBrush();
			}
		}
		
		GUILayout.EndVertical();
		GUILayout.EndScrollView();
		EditorGUILayout.EndVertical();
	}
	void OnGUI () {
		EditorGUILayout.BeginVertical();
		scrollPosition = GUILayout.BeginScrollView(scrollPosition, false, false);
		EditorGUILayout.Separator();
		EditorGUILayout.LabelField("Playground Brush Wizard", EditorStyles.largeLabel, GUILayout.Height(20));
		EditorGUILayout.Separator();
		
		GUILayout.BeginVertical("box");
		EditorGUILayout.HelpBox("Create a Particle Playground Brush by selecting a texture and edit its settings. The texture must have Read/Write Enabled and use True Color (non-compressed) in its import settings .", MessageType.Info);
		EditorGUILayout.Separator();
		
		GUILayout.BeginHorizontal();
		EditorGUILayout.PrefixLabel("Brush Texture");
		Texture2D selectedBrushTexture = brushTexture;
		brushTexture = EditorGUILayout.ObjectField(brushTexture, typeof(Texture2D), false) as Texture2D;
		GUILayout.EndHorizontal();
		if (selectedBrushTexture!=brushTexture)
			brushName = brushTexture.name;
		brushName = EditorGUILayout.TextField("Name", brushName);
		brushScale = EditorGUILayout.FloatField("Scale", brushScale);
		brushDetail = (BRUSHDETAILC)EditorGUILayout.EnumPopup("Detail", brushDetail);
		distance = EditorGUILayout.FloatField("Distance", distance);
		spacing = EditorGUILayout.FloatField("Spacing", spacing);
		exceedMaxStopsPaint = EditorGUILayout.Toggle("Exceeding Max Stops Paint", exceedMaxStopsPaint);
		
		if(GUILayout.Button("Create", EditorStyles.toolbarButton, GUILayout.Width(50))){
			brushName = brushName.Trim();
			if (brushTexture && brushName!="") {
				if (AssetDatabase.LoadAssetAtPath(PlaygroundParticleWindowC.playgroundPath+PlaygroundParticleWindowC.brushPath+brushName+".prefab", typeof(GameObject))) {
					if (EditorUtility.DisplayDialog("Brush with same name found!", 
						"The brush "+brushName+" already exists. Do you want to overwrite it?", 
						"Yes", 
						"No"))
							CreateBrush();
				} else CreateBrush();
			}
		}
		
		GUILayout.EndVertical();
		GUILayout.EndScrollView();
		EditorGUILayout.EndVertical();
	}