ui基本完毕,修了一大把的bug
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
[CustomPropertyDrawer(typeof(CallbackOptions))]
|
||||
public class CallbackOptionsPropertyDrawer : PropertyDrawer
|
||||
{
|
||||
private static bool foldout = true;
|
||||
|
||||
// Draw the property inside the given rect
|
||||
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
|
||||
{
|
||||
foldout = EditorGUILayout.BeginFoldoutHeaderGroup(foldout, label);
|
||||
|
||||
if (foldout)
|
||||
{
|
||||
EditorGUILayout.PropertyField(property.FindPropertyRelative("onFracture"));
|
||||
EditorGUILayout.PropertyField(property.FindPropertyRelative("onCompleted"));
|
||||
}
|
||||
|
||||
EditorGUILayout.EndFoldoutHeaderGroup();
|
||||
}
|
||||
|
||||
// Hack to prevent extra space at top of property drawer. This is due to using EditorGUILayout
|
||||
// in OnGUI, but I don't want to have to manually specify control sizes
|
||||
public override float GetPropertyHeight(SerializedProperty property, GUIContent label) { return 0; }
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e56ee0315133e004e8ef0f70106090ef
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
using UnityEditor;
|
||||
|
||||
[CustomEditor(typeof(Fracture))]
|
||||
[CanEditMultipleObjects]
|
||||
public class FractureEditor : Editor
|
||||
{
|
||||
// Empty editor required for custom property drawers to work properly
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 69f5d525b9339e54d97390fa221d2097
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,38 @@
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
// IngredientDrawerUIE
|
||||
[CustomPropertyDrawer(typeof(FractureOptions))]
|
||||
public class FractureOptionsPropertyDrawer : PropertyDrawer
|
||||
{
|
||||
private static bool foldout = true;
|
||||
|
||||
// Draw the property inside the given rect
|
||||
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
|
||||
{
|
||||
EditorGUI.indentLevel = 0;
|
||||
foldout = EditorGUILayout.BeginFoldoutHeaderGroup(foldout, label);
|
||||
|
||||
if (foldout)
|
||||
{
|
||||
EditorGUI.indentLevel = 1;
|
||||
|
||||
EditorGUILayout.PropertyField(property.FindPropertyRelative("fragmentCount"));
|
||||
EditorGUILayout.PropertyField(property.FindPropertyRelative("asynchronous"));
|
||||
EditorGUILayout.PropertyField(property.FindPropertyRelative("detectFloatingFragments"));
|
||||
EditorGUILayout.PropertyField(property.FindPropertyRelative("xAxis"), new GUIContent("Fracture Along X Plane"));
|
||||
EditorGUILayout.PropertyField(property.FindPropertyRelative("yAxis"), new GUIContent("Fracture Along Y Plane"));
|
||||
EditorGUILayout.PropertyField(property.FindPropertyRelative("zAxis"), new GUIContent("Fracture Along Z Plane"));
|
||||
EditorGUILayout.PropertyField(property.FindPropertyRelative("insideMaterial"));
|
||||
EditorGUILayout.PropertyField(property.FindPropertyRelative("textureScale"));
|
||||
EditorGUILayout.PropertyField(property.FindPropertyRelative("textureOffset"));
|
||||
}
|
||||
|
||||
EditorGUILayout.EndFoldoutHeaderGroup();
|
||||
EditorGUI.indentLevel = 0;
|
||||
}
|
||||
|
||||
// Hack to prevent extra space at top of property drawer. This is due to using EditorGUILayout
|
||||
// in OnGUI, but I don't want to have to manually specify control sizes
|
||||
public override float GetPropertyHeight(SerializedProperty property, GUIContent label) { return 0; }
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6dc10c5bce663b74da7236629b70b065
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"name": "OpenFracture.Editor",
|
||||
"rootNamespace": "",
|
||||
"references": [
|
||||
"GUID:7b1a8d9f4355a214f9a95471fa510c86"
|
||||
],
|
||||
"includePlatforms": [
|
||||
"Editor"
|
||||
],
|
||||
"excludePlatforms": [],
|
||||
"allowUnsafeCode": false,
|
||||
"overrideReferences": false,
|
||||
"precompiledReferences": [],
|
||||
"autoReferenced": true,
|
||||
"defineConstraints": [],
|
||||
"versionDefines": [],
|
||||
"noEngineReferences": false
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 948c819856827144ba8a7bba3f8946df
|
||||
AssemblyDefinitionImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
using UnityEditor;
|
||||
|
||||
[CustomEditor(typeof(Prefracture))]
|
||||
[CanEditMultipleObjects]
|
||||
public class PrefractureEditor : Editor
|
||||
{
|
||||
// Empty editor required for custom property drawers to work properly
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b13c64051dd526c4f8906d68712e987b
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,63 @@
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
[CustomPropertyDrawer(typeof(PrefractureOptions))]
|
||||
public class PrefractureOptionsPropertyDrawer : PropertyDrawer
|
||||
{
|
||||
private static bool foldout = true;
|
||||
|
||||
// Draw the property inside the given rect
|
||||
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
|
||||
{
|
||||
var unfreezeAll = property.FindPropertyRelative("unfreezeAll");
|
||||
var saveFragmentsToDisk = property.FindPropertyRelative("saveFragmentsToDisk");
|
||||
var saveLocation = property.FindPropertyRelative("saveLocation");
|
||||
|
||||
EditorGUI.indentLevel = 0;
|
||||
foldout = EditorGUILayout.BeginFoldoutHeaderGroup(foldout, label);
|
||||
|
||||
if (foldout)
|
||||
{
|
||||
EditorGUI.indentLevel = 1;
|
||||
|
||||
EditorGUILayout.PropertyField(unfreezeAll, new GUIContent("Unfreeze All"));
|
||||
EditorGUILayout.PropertyField(saveFragmentsToDisk, new GUIContent("Save Fragments To Disk"));
|
||||
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
EditorGUILayout.PropertyField(saveLocation, new GUIContent("Save Location"));
|
||||
|
||||
if (GUILayout.Button(" . . . ", GUILayout.ExpandWidth(false)))
|
||||
{
|
||||
string path = EditorUtility.OpenFolderPanel("Select Save Location", "", "");
|
||||
if (path.StartsWith(Application.dataPath))
|
||||
{
|
||||
saveLocation.stringValue = "Assets" + path.Substring(Application.dataPath.Length);
|
||||
saveLocation.serializedObject.ApplyModifiedProperties();
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new System.ArgumentException("Full path does not contain the current project's Assets folder", "absolutePath");
|
||||
}
|
||||
}
|
||||
EditorGUILayout.EndHorizontal();
|
||||
|
||||
GUILayout.Space(4);
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
GUILayout.Space(16);
|
||||
if (GUILayout.Button("Prefracture Mesh", new GUILayoutOption[] { GUILayout.ExpandWidth(true), GUILayout.Height(32) }))
|
||||
{
|
||||
((Prefracture)property.serializedObject.targetObject).ComputeFracture();
|
||||
}
|
||||
GUILayout.Space(16);
|
||||
EditorGUILayout.EndHorizontal();
|
||||
GUILayout.Space(4);
|
||||
}
|
||||
|
||||
EditorGUILayout.EndFoldoutHeaderGroup();
|
||||
EditorGUI.indentLevel = 0;
|
||||
}
|
||||
|
||||
// Hack to prevent extra space at top of property drawer. This is due to using EditorGUILayout
|
||||
// in OnGUI, but I don't want to have to manually specify control sizes
|
||||
public override float GetPropertyHeight(SerializedProperty property, GUIContent label) { return 0; }
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d08b34658d6e1ea4d83a8079e48bb270
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,35 @@
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
// IngredientDrawerUIE
|
||||
[CustomPropertyDrawer(typeof(RefractureOptions))]
|
||||
public class RefractureOptionsPropertyDrawer : PropertyDrawer
|
||||
{
|
||||
private static bool foldout = true;
|
||||
|
||||
// Draw the property inside the given rect
|
||||
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
|
||||
{
|
||||
var enableRefracturing = property.FindPropertyRelative("enableRefracturing");
|
||||
var maxRefractureCount = property.FindPropertyRelative("maxRefractureCount");
|
||||
var invokeCallbacks = property.FindPropertyRelative("invokeCallbacks");
|
||||
|
||||
EditorGUI.indentLevel = 0;
|
||||
foldout = EditorGUILayout.BeginFoldoutHeaderGroup(foldout, label);
|
||||
|
||||
if (foldout)
|
||||
{
|
||||
EditorGUI.indentLevel = 1;
|
||||
EditorGUILayout.PropertyField(enableRefracturing, new GUIContent("Enabled"));
|
||||
EditorGUILayout.PropertyField(invokeCallbacks, new GUIContent("Invoke Callbacks"));
|
||||
EditorGUILayout.PropertyField(maxRefractureCount, new GUIContent("Max # of Refractures"));
|
||||
}
|
||||
|
||||
EditorGUILayout.EndFoldoutHeaderGroup();
|
||||
EditorGUI.indentLevel = 0;
|
||||
}
|
||||
|
||||
// Hack to prevent extra space at top of property drawer. This is due to using EditorGUILayout
|
||||
// in OnGUI, but I don't want to have to manually specify control sizes
|
||||
public override float GetPropertyHeight(SerializedProperty property, GUIContent label) { return 0; }
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5d99dbaf6b5735b4c9af0896040ac65b
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
using UnityEditor;
|
||||
|
||||
[CustomEditor(typeof(Slice))]
|
||||
[CanEditMultipleObjects]
|
||||
public class SliceEditor : Editor
|
||||
{
|
||||
// Empty editor required for custom property drawers to work properly
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f692bceb73d91e24681b607ab09f2ee6
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,57 @@
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
// IngredientDrawerUIE
|
||||
[CustomPropertyDrawer(typeof(TriggerOptions))]
|
||||
public class TriggerOptionsPropertyDrawer : PropertyDrawer
|
||||
{
|
||||
private static bool foldout = true;
|
||||
|
||||
// Draw the property inside the given rect
|
||||
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
|
||||
{
|
||||
// Create property container element.
|
||||
var minimumCollisionForce = property.FindPropertyRelative("minimumCollisionForce");
|
||||
var triggerType = property.FindPropertyRelative("triggerType");
|
||||
var triggerKey = property.FindPropertyRelative("triggerKey");
|
||||
var filterCollisionsByTag = property.FindPropertyRelative("filterCollisionsByTag");
|
||||
var triggerAllowedTags = property.FindPropertyRelative("triggerAllowedTags");
|
||||
|
||||
EditorGUI.indentLevel = 0;
|
||||
foldout = EditorGUILayout.BeginFoldoutHeaderGroup(foldout, label);
|
||||
|
||||
if (foldout)
|
||||
{
|
||||
EditorGUI.indentLevel = 1;
|
||||
EditorGUILayout.PropertyField(triggerType);
|
||||
|
||||
switch (triggerType.enumValueIndex)
|
||||
{
|
||||
case ((int)TriggerType.Collision):
|
||||
EditorGUILayout.PropertyField(minimumCollisionForce);
|
||||
EditorGUILayout.PropertyField(filterCollisionsByTag, new GUIContent("Limit collisions to selected tags?"));
|
||||
if (filterCollisionsByTag.boolValue)
|
||||
{
|
||||
EditorGUILayout.EndFoldoutHeaderGroup();
|
||||
EditorGUILayout.PropertyField(triggerAllowedTags, new GUIContent("Included Tags"));
|
||||
}
|
||||
break;
|
||||
case ((int)TriggerType.Trigger):
|
||||
EditorGUILayout.PropertyField(filterCollisionsByTag);
|
||||
EditorGUILayout.EndFoldoutHeaderGroup();
|
||||
EditorGUILayout.PropertyField(triggerAllowedTags);
|
||||
break;
|
||||
case ((int)TriggerType.Keyboard):
|
||||
EditorGUILayout.PropertyField(triggerKey);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
EditorGUILayout.EndFoldoutHeaderGroup();
|
||||
EditorGUI.indentLevel = 0;
|
||||
}
|
||||
|
||||
// Hack to prevent extra space at top of property drawer. This is due to using EditorGUILayout
|
||||
// in OnGUI, but I don't want to have to manually specify control sizes
|
||||
public override float GetPropertyHeight(SerializedProperty property, GUIContent label) { return 0; }
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2e2055e9f36d75c4e9cf52e3380fa95b
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
using UnityEditor;
|
||||
|
||||
[CustomEditor(typeof(UnfreezeFragment))]
|
||||
[CanEditMultipleObjects]
|
||||
public class UnfreezeFragmentEditor : Editor
|
||||
{
|
||||
// Empty editor required for custom property drawers to work properly
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: acbae3f2ee815e34c8322878fe2df558
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user