Skip to content

Commit f137864

Browse files
committed
2 parents 6069250 + 9096be0 commit f137864

File tree

127 files changed

+1326
-7908
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

127 files changed

+1326
-7908
lines changed

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "UnityProject/Assets/Demos"]
2+
path = UnityProject/Assets/Demos
3+
url = https://github.com/intelligent-systems-lab-org/Demos.git

README.md

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,15 @@
33
<img class="only-light" width="100%" src="https://raw.githubusercontent.com/intelligent-systems-lab-org/simunex.github.io/main/img/logo.png?raw=true#gh-light-mode-only"/>
44

55
<p align="center">
6-
<a href="https://github.com/intelligent-systems-lab-org/SimuNEX/issues">
7-
<img src="https://img.shields.io/github/issues/intelligent-systems-lab-org/SimuNEX" alt="GitHub issues">
8-
</a>
96
<a href="https://unity.com/">
10-
<img src="https://img.shields.io/badge/Unity-2022.3.10f1-blue.svg" alt="Unity Version">
7+
<img src="https://img.shields.io/badge/Unity-2022.3.10f1-blue.svg?logo=unity&style=for-the-badge" alt="Unity version">
8+
</a>
9+
<img src="https://img.shields.io/github/repo-size/intelligent-systems-lab-org/SimuNEX?style=for-the-badge&color=green&logo=github" alt="Repo size">
10+
<a href="https://github.com/intelligent-systems-lab-org/SimuNEX/issues">
11+
<img src="https://img.shields.io/github/issues/intelligent-systems-lab-org/SimuNEX?style=for-the-badge&logo=github" alt="GitHub issues">
1112
</a>
13+
<img src="https://img.shields.io/github/last-commit/intelligent-systems-lab-org/SimuNEX/development?style=for-the-badge&logo=github"
14+
alt="GitHub last development commit">
1215
</p>
1316

1417
-----
@@ -47,7 +50,7 @@ SimuNEX is in its early stages of development and is only usable through the Uni
4750

4851
For upcoming plans and features, please check out the ongoing [projects](https://github.com/intelligent-systems-lab-org/SimuNEX/projects).
4952

50-
## Examples
53+
## Model Examples
5154
<table>
5255
<tr>
5356
<td align="center">
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
using SimuNEX.Mechanical;
2+
using UnityEditor;
3+
using UnityEngine;
4+
5+
namespace SimuNEX
6+
{
7+
[CustomEditor(typeof(CrossDrag))]
8+
public class CrossDragDrawer : Editor
9+
{
10+
private SerializedProperty dragCoefficientsProperty;
11+
private SerializedProperty rigidBodyProperty;
12+
private string[] labels = new string[] { "UV", "UW", "UP", "UQ", "UR", "VW", "VP", "VQ", "VR", "WP", "WQ", "WR", "PQ", "PR", "QR" };
13+
string[] foldoutLabels = { "Force X", "Force Y", "Force Z", "Torque X", "Torque Y", "Torque Z" };
14+
private bool[] foldouts = new bool[6];
15+
16+
protected void OnEnable()
17+
{
18+
rigidBodyProperty = serializedObject.FindProperty("rigidBody");
19+
dragCoefficientsProperty = serializedObject.FindProperty("dragCoefficients._serializedData");
20+
}
21+
22+
public override void OnInspectorGUI()
23+
{
24+
serializedObject.Update();
25+
EditorGUILayout.PropertyField(rigidBodyProperty);
26+
27+
if (dragCoefficientsProperty != null && dragCoefficientsProperty.isArray)
28+
{
29+
// Iterate over each foldout section (Force X, Force Y, Force Z, Torque X, Torque Y, Torque Z)
30+
for (int i = 0; i < 6; i++)
31+
{
32+
foldouts[i] = EditorGUILayout.Foldout(foldouts[i], foldoutLabels[i]);
33+
if (foldouts[i])
34+
{
35+
EditorGUI.indentLevel++;
36+
37+
// Iterate over the rows (3 rows)
38+
for (int row = 0; row < 3; row++)
39+
{
40+
EditorGUILayout.BeginHorizontal();
41+
42+
// Iterate over the columns (5 columns per row)
43+
for (int col = 0; col < 5; col++)
44+
{
45+
int index = i * 15 + row * 5 + col; // Calculate the flat index based on row and column
46+
if (index < dragCoefficientsProperty.arraySize)
47+
{
48+
// Draw the float field with the label above it
49+
EditorGUILayout.BeginVertical();
50+
EditorGUILayout.LabelField(labels[row * 5 + col], GUILayout.Width(50));
51+
SerializedProperty elementProperty = dragCoefficientsProperty.GetArrayElementAtIndex(index);
52+
EditorGUILayout.PropertyField(elementProperty, GUIContent.none, GUILayout.Width(50));
53+
EditorGUILayout.EndVertical();
54+
}
55+
}
56+
EditorGUILayout.EndHorizontal();
57+
}
58+
EditorGUI.indentLevel--;
59+
}
60+
}
61+
}
62+
serializedObject.ApplyModifiedProperties();
63+
}
64+
65+
}
66+
}

UnityProject/Assets/Editor/Core/CrossDragDrawer.cs.meta

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

UnityProject/Assets/Editor/Core/FaultsDrawer.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public static class FaultableExtensions
4242

4343
public static void DrawFaultAddition(this SerializedObject serializedObject)
4444
{
45-
FaultSystem faultSystem = serializedObject.targetObject as FaultSystem;
45+
FaultEntity faultSystem = serializedObject.targetObject as FaultEntity;
4646

4747
const string editorPrefsKey = "FaultsExpanded";
4848
string uniqueKey = serializedObject.GetHashCode() + editorPrefsKey;
@@ -120,7 +120,7 @@ private static void AddFault(string property, Type faultType, SerializedObject s
120120
Debug.Log("Adding fault of type: " + faultType.Name);
121121

122122
Fault newFault = Factory<Fault>.Create(faultType);
123-
FaultSystem faultSystem = serializedObject.targetObject as FaultSystem;
123+
FaultEntity faultSystem = serializedObject.targetObject as FaultEntity;
124124

125125
if (faultSystem != null)
126126
{

UnityProject/Assets/Editor/Core/LoadDrawer.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,12 @@ public override void OnInspectorGUI()
1515
// Parameters foldout
1616
string[] parameterNames = serializedObject.DrawFoldout<ParameterAttribute>("ParametersExpanded", "Parameters");
1717

18+
// SFX foldout
19+
string[] sfxNames = serializedObject.DrawFoldout<SFXAttribute>("SFXExpanded", "SFX");
20+
1821
// Other properties
1922
string[] removedProperties = new string[] { "m_Script" };
20-
DrawPropertiesExcluding(serializedObject, parameterNames.Concat(removedProperties).ToArray());
23+
DrawPropertiesExcluding(serializedObject, parameterNames.Concat(sfxNames).Concat(removedProperties).ToArray());
2124

2225
_ = serializedObject.ApplyModifiedProperties();
2326
}

UnityProject/Assets/Editor/Core/SensorDrawer.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public override void OnInspectorGUI()
1414

1515
// Foldouts
1616
string[] parameterNames = serializedObject.DrawFoldout<ParameterAttribute>("ParametersExpanded", "Parameters");
17-
string[] outputNames = serializedObject.DrawFoldout<OutputAttribute>("InputsExpanded", "Outputs");
17+
string[] outputNames = serializedObject.DrawFoldout<OutputAttribute>("OutputsExpanded", "Outputs");
1818
string[] solverNames = serializedObject.DrawFoldout<SolverAttribute>("SolverExpanded", "Solvers");
1919
string[] omittedNames = serializedObject.targetObject
2020
.GetFieldsWithAttribute<OmittableAttribute>(includePrivate: true, applyOmitLogic: false)

UnityProject/Assets/Editor/Core/SensorSystemEditor.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,14 @@ public override void OnInspectorGUI()
3535
int outputIndex = 0;
3636
foreach (Sensor sensor in sensorSystem.sensors)
3737
{
38-
if (sensor.outputNames != null)
38+
if (sensor.OutputNames != null)
3939
{
40-
for (int i = 0; i < sensor.outputNames.Length; i++)
40+
for (int i = 0; i < sensor.OutputNames.Length; i++)
4141
{
4242
if (outputIndex < sensorSystem.outputs.Length)
4343
{
4444
EditorGUILayout.BeginHorizontal();
45-
EditorGUILayout.LabelField(sensor.outputNames[i], GUILayout.ExpandWidth(true));
45+
EditorGUILayout.LabelField(sensor.OutputNames[i], GUILayout.ExpandWidth(true));
4646
sensorSystem.outputs[outputIndex] = EditorGUILayout.FloatField
4747
(
4848
sensorSystem.outputs[outputIndex],

UnityProject/Assets/Imported/3D Models.meta

Lines changed: 0 additions & 8 deletions
This file was deleted.

UnityProject/Assets/Imported/3D Models/AUVs.meta

Lines changed: 0 additions & 8 deletions
This file was deleted.

0 commit comments

Comments
 (0)