修改水
This commit is contained in:
@@ -1,12 +1,11 @@
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Obi
|
||||
{
|
||||
|
||||
[CustomEditor(typeof(ObiColliderBase), true), CanEditMultipleObjects]
|
||||
public class ObiColliderEditor : Editor
|
||||
{
|
||||
namespace Obi{
|
||||
|
||||
[CustomEditor(typeof(ObiColliderBase), true), CanEditMultipleObjects]
|
||||
public class ObiColliderEditor : Editor
|
||||
{
|
||||
|
||||
ObiColliderBase collider;
|
||||
SerializedProperty collisionFilter;
|
||||
@@ -17,42 +16,11 @@ namespace Obi
|
||||
collisionFilter = serializedObject.FindProperty("filter");
|
||||
}
|
||||
|
||||
protected void NonReadableMeshWarning(Mesh mesh)
|
||||
{
|
||||
EditorGUILayout.BeginVertical(EditorStyles.helpBox);
|
||||
Texture2D icon = EditorGUIUtility.Load("icons/console.erroricon.png") as Texture2D;
|
||||
EditorGUILayout.LabelField(new GUIContent("The input mesh is not readable. Read/Write must be enabled in the mesh import settings.", icon), EditorStyles.wordWrappedMiniLabel);
|
||||
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
GUILayout.FlexibleSpace();
|
||||
if (GUILayout.Button("Fix now", GUILayout.MaxWidth(100), GUILayout.MinHeight(32)))
|
||||
{
|
||||
string assetPath = AssetDatabase.GetAssetPath(mesh);
|
||||
ModelImporter modelImporter = AssetImporter.GetAtPath(assetPath) as ModelImporter;
|
||||
if (modelImporter != null)
|
||||
{
|
||||
modelImporter.isReadable = true;
|
||||
}
|
||||
modelImporter.SaveAndReimport();
|
||||
}
|
||||
EditorGUILayout.EndHorizontal();
|
||||
EditorGUILayout.EndVertical();
|
||||
}
|
||||
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
|
||||
serializedObject.UpdateIfRequiredOrScript();
|
||||
|
||||
foreach (ObiColliderBase t in targets)
|
||||
{
|
||||
ObiMeshShapeTracker meshTracker = t.Tracker as ObiMeshShapeTracker;
|
||||
if (meshTracker != null)
|
||||
{
|
||||
if (meshTracker.targetMesh != null && !meshTracker.targetMesh.isReadable)
|
||||
NonReadableMeshWarning(meshTracker.targetMesh);
|
||||
}
|
||||
}
|
||||
|
||||
var rect = EditorGUILayout.GetControlRect();
|
||||
var label = EditorGUI.BeginProperty(rect, new GUIContent("Collision category"), collisionFilter);
|
||||
@@ -88,13 +56,8 @@ namespace Obi
|
||||
}
|
||||
EditorGUI.EndProperty();
|
||||
|
||||
DrawPropertiesExcluding(serializedObject, "m_Script", "CollisionMaterial", "filter", "Thickness", "Inverted");
|
||||
|
||||
foreach (ObiColliderBase t in targets)
|
||||
{
|
||||
if (!t.gameObject.isStatic)
|
||||
t.ForceUpdate();
|
||||
}
|
||||
DrawPropertiesExcluding(serializedObject, "m_Script", "CollisionMaterial", "filter", "Thickness");
|
||||
|
||||
// Apply changes to the serializedProperty
|
||||
if (GUI.changed)
|
||||
|
||||
@@ -68,7 +68,7 @@ namespace Obi{
|
||||
EditorUtility.SetDirty(target);
|
||||
CoroutineJob job = new CoroutineJob();
|
||||
routine = job.Start( distanceField.Generate());
|
||||
EditorCoroutine.ShowCoroutineProgressBar("Generating distance field", routine);
|
||||
EditorCoroutine.ShowCoroutineProgressBar("Generating distance field",ref routine);
|
||||
UpdatePreview();
|
||||
EditorGUIUtility.ExitGUI();
|
||||
}
|
||||
|
||||
@@ -1,30 +0,0 @@
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Obi
|
||||
{
|
||||
|
||||
/**
|
||||
* Custom inspector for ObiForceZone component.
|
||||
*/
|
||||
|
||||
[CustomEditor(typeof(ObiForceZone)), CanEditMultipleObjects]
|
||||
public class ObiForceZoneEditor : Editor
|
||||
{
|
||||
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
|
||||
serializedObject.UpdateIfRequiredOrScript();
|
||||
|
||||
DrawPropertiesExcluding(serializedObject, "m_Script");
|
||||
|
||||
// Apply changes to the serializedProperty
|
||||
if (GUI.changed)
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 724435a7a84154b27bb0c8ea49b611df
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user