修改水

This commit is contained in:
2026-01-01 22:00:33 +08:00
parent 040a222bd6
commit 9ceffccd39
1800 changed files with 103929 additions and 139495 deletions

View File

@@ -1,6 +1,11 @@
using UnityEditor;
using UnityEditor.EditorTools;
using UnityEditorInternal;
using UnityEngine;
using System;
using System.Collections.Generic;
using System.Linq;
namespace Obi
{
@@ -13,8 +18,6 @@ namespace Obi
static void CreateObiRope(MenuCommand menuCommand)
{
GameObject go = new GameObject("Obi Rope", typeof(ObiRope), typeof(ObiRopeExtrudedRenderer));
var renderer = go.GetComponent<ObiRopeExtrudedRenderer>();
renderer.material = ObiEditorUtils.GetDefaultMaterial();
ObiEditorUtils.PlaceActorRoot(go, menuCommand);
}
@@ -25,7 +28,6 @@ namespace Obi
SerializedProperty collisionMaterial;
SerializedProperty selfCollisions;
SerializedProperty surfaceCollisions;
SerializedProperty massScale;
SerializedProperty distanceConstraintsEnabled;
SerializedProperty stretchingScale;
@@ -38,10 +40,6 @@ namespace Obi
SerializedProperty plasticYield;
SerializedProperty plasticCreep;
SerializedProperty aerodynamicsEnabled;
SerializedProperty drag;
SerializedProperty lift;
SerializedProperty tearingEnabled;
SerializedProperty tearResistanceMultiplier;
SerializedProperty tearRate;
@@ -57,7 +55,6 @@ namespace Obi
collisionMaterial = serializedObject.FindProperty("m_CollisionMaterial");
selfCollisions = serializedObject.FindProperty("m_SelfCollisions");
surfaceCollisions = serializedObject.FindProperty("m_SurfaceCollisions");
massScale = serializedObject.FindProperty("m_MassScale");
distanceConstraintsEnabled = serializedObject.FindProperty("_distanceConstraintsEnabled");
stretchingScale = serializedObject.FindProperty("_stretchingScale");
@@ -70,10 +67,6 @@ namespace Obi
plasticYield = serializedObject.FindProperty("_plasticYield");
plasticCreep = serializedObject.FindProperty("_plasticCreep");
aerodynamicsEnabled = serializedObject.FindProperty("_aerodynamicsEnabled");
drag = serializedObject.FindProperty("_drag");
lift = serializedObject.FindProperty("_lift");
tearingEnabled = serializedObject.FindProperty("tearingEnabled");
tearResistanceMultiplier = serializedObject.FindProperty("tearResistanceMultiplier");
tearRate = serializedObject.FindProperty("tearRate");
@@ -119,29 +112,8 @@ namespace Obi
using (new EditorGUI.DisabledScope(ToolManager.activeToolType == typeof(ObiPathEditor)))
{
GUILayout.BeginHorizontal();
EditorGUI.BeginChangeCheck();
EditorGUILayout.PropertyField(ropeBlueprint, new GUIContent("Blueprint"));
if (actor.ropeBlueprint == null)
{
if (GUILayout.Button("Create", EditorStyles.miniButton, GUILayout.MaxWidth(80)))
{
string path = EditorUtility.SaveFilePanel("Save blueprint", "Assets/", "RopeBlueprint", "asset");
if (!string.IsNullOrEmpty(path))
{
path = FileUtil.GetProjectRelativePath(path);
ObiRopeBlueprint asset = ScriptableObject.CreateInstance<ObiRopeBlueprint>();
AssetDatabase.CreateAsset(asset, path);
AssetDatabase.SaveAssets();
actor.ropeBlueprint = asset;
}
}
}
if (EditorGUI.EndChangeCheck())
{
foreach (var t in targets)
@@ -153,14 +125,8 @@ namespace Obi
foreach (var t in targets)
(t as ObiRope).AddToSolver();
}
GUILayout.EndHorizontal();
}
GUI.enabled = !Application.isPlaying;
EditorGUILayout.PropertyField(massScale, new GUIContent("Mass scale"));
GUI.enabled = true;
DoEditButton();
EditorGUILayout.Space();
@@ -193,11 +159,6 @@ namespace Obi
EditorGUILayout.PropertyField(plasticCreep, new GUIContent("Plastic creep"));
});
ObiEditorUtils.DoToggleablePropertyGroup(aerodynamicsEnabled, new GUIContent("Aerodynamics", Resources.Load<Texture2D>("Icons/ObiAerodynamicConstraints Icon")),
() => {
EditorGUILayout.PropertyField(drag, new GUIContent("Drag"));
EditorGUILayout.PropertyField(lift, new GUIContent("Lift"));
});
if (GUI.changed)
serializedObject.ApplyModifiedProperties();