-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathSofaMeshEditor.cs
More file actions
57 lines (48 loc) · 1.91 KB
/
SofaMeshEditor.cs
File metadata and controls
57 lines (48 loc) · 1.91 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
using UnityEngine;
using UnityEditor;
using SofaUnity;
using System.Collections.Generic;
namespace SofaUnity
{
/// <summary>
/// Editor class corresponding to @sa SofaMesh
/// This class inherite from @sa SofaBaseComponentEditor and will add specific data after the Data display
/// Provides some information regarding the sofa topology handle by this Mesh
/// </summary>
[CustomEditor(typeof(SofaMesh), true)]
public class SofaMeshEditor : SofaBaseComponentEditor
{
/// Method to create parameters GUI
public override void OnInspectorGUI()
{
base.OnInspectorGUI();
SofaMesh compo = (SofaMesh)this.target;
EditorGUILayout.IntField("Nb Points", compo.NbVertices());
if (!compo.HasTopology())
return;
EditorGUILayout.Separator();
EditorGUI.BeginDisabledGroup(true);
TopologyObjectType type = compo.TopologyType();
EditorGUILayout.EnumPopup("MeshTopology Type", type);
if (type == TopologyObjectType.HEXAHEDRON)
{
EditorGUILayout.IntField("Nb Hexahedra", compo.NbHexahedra());
}
else if (type == TopologyObjectType.TETRAHEDRON)
{
EditorGUILayout.IntField("Nb Tetrahedra", compo.NbTetrahedra());
}
else if (type == TopologyObjectType.QUAD || type == TopologyObjectType.TRIANGLE)
{
EditorGUILayout.IntField("Nb Triangles", compo.NbTriangles());
EditorGUILayout.IntField("Nb Quads", compo.NbQuads());
}
else if (type == TopologyObjectType.EDGE)
{
EditorGUILayout.IntField("Nb Edges", compo.NbEdges());
}
compo.DrawForces = EditorGUILayout.Toggle("DrawGizmoForces", compo.DrawForces);
EditorGUI.EndDisabledGroup();
}
}
}