Anupam Bhatnagar
4 年前
当前提交
abc1220f
共有 20 个文件被更改,包括 672 次插入 和 90 次删除
-
2.yamato/com.unity.ml-agents-performance.yml
-
4com.unity.ml-agents.extensions/Editor/Unity.ML-Agents.Extensions.Editor.asmdef
-
1com.unity.ml-agents.extensions/Runtime/AssemblyInfo.cs
-
29com.unity.ml-agents.extensions/Runtime/Sensors/ArticulationBodyPoseExtractor.cs
-
8com.unity.ml-agents.extensions/Runtime/Sensors/ArticulationBodySensorComponent.cs
-
54com.unity.ml-agents.extensions/Runtime/Sensors/PhysicsBodySensor.cs
-
117com.unity.ml-agents.extensions/Runtime/Sensors/PoseExtractor.cs
-
80com.unity.ml-agents.extensions/Runtime/Sensors/RigidBodyPoseExtractor.cs
-
68com.unity.ml-agents.extensions/Runtime/Sensors/RigidBodySensorComponent.cs
-
88com.unity.ml-agents.extensions/Tests/Editor/Sensors/PoseExtractorTests.cs
-
67com.unity.ml-agents.extensions/Tests/Editor/Sensors/RigidBodyPoseExtractorTests.cs
-
5com.unity.ml-agents/CHANGELOG.md
-
16ml-agents/mlagents/trainers/policy/tf_policy.py
-
2ml-agents/mlagents/trainers/stats.py
-
3ml-agents/mlagents/trainers/tests/mock_brain.py
-
113ml-agents/mlagents/trainers/tests/test_nn_policy.py
-
26ml-agents/mlagents/trainers/tf/models.py
-
2ml-agents/mlagents/trainers/trainer_controller.py
-
66com.unity.ml-agents.extensions/Editor/RigidBodySensorComponentEditor.cs
-
11com.unity.ml-agents.extensions/Editor/RigidBodySensorComponentEditor.cs.meta
|
|||
using System.Runtime.CompilerServices; |
|||
|
|||
[assembly: InternalsVisibleTo("Unity.ML-Agents.Extensions.EditorTests")] |
|||
[assembly: InternalsVisibleTo("Unity.ML-Agents.Extensions.Editor")] |
|
|||
using UnityEngine; |
|||
using UnityEditor; |
|||
using Unity.MLAgents.Editor; |
|||
using Unity.MLAgents.Extensions.Sensors; |
|||
|
|||
namespace Unity.MLAgents.Extensions.Editor |
|||
{ |
|||
[CustomEditor(typeof(RigidBodySensorComponent))] |
|||
[CanEditMultipleObjects] |
|||
internal class RigidBodySensorComponentEditor : UnityEditor.Editor |
|||
{ |
|||
bool ShowHierarchy = true; |
|||
|
|||
public override void OnInspectorGUI() |
|||
{ |
|||
var so = serializedObject; |
|||
so.Update(); |
|||
|
|||
var rbSensorComp = so.targetObject as RigidBodySensorComponent; |
|||
bool requireExtractorUpdate; |
|||
|
|||
EditorGUI.BeginDisabledGroup(!EditorUtilities.CanUpdateModelProperties()); |
|||
{ |
|||
// All the fields affect the sensor order or observation size,
|
|||
// So can't be changed at runtime.
|
|||
EditorGUI.BeginChangeCheck(); |
|||
EditorGUILayout.PropertyField(so.FindProperty("RootBody"), true); |
|||
EditorGUILayout.PropertyField(so.FindProperty("VirtualRoot"), true); |
|||
|
|||
// Changing the root body or virtual root changes the hierarchy, so we need to reset later.
|
|||
requireExtractorUpdate = EditorGUI.EndChangeCheck(); |
|||
|
|||
EditorGUILayout.PropertyField(so.FindProperty("Settings"), true); |
|||
|
|||
// Collapsible tree for the body hierarchy
|
|||
ShowHierarchy = EditorGUILayout.Foldout(ShowHierarchy, "Hierarchy", true); |
|||
if (ShowHierarchy) |
|||
{ |
|||
var treeNodes = rbSensorComp.GetDisplayNodes(); |
|||
var originalIndent = EditorGUI.indentLevel; |
|||
foreach (var node in treeNodes) |
|||
{ |
|||
var obj = node.NodeObject; |
|||
var objContents = EditorGUIUtility.ObjectContent(obj, obj.GetType()); |
|||
EditorGUI.indentLevel = originalIndent + node.Depth; |
|||
var enabled = EditorGUILayout.Toggle(objContents, node.Enabled); |
|||
rbSensorComp.SetPoseEnabled(node.OriginalIndex, enabled); |
|||
} |
|||
|
|||
EditorGUI.indentLevel = originalIndent; |
|||
} |
|||
|
|||
EditorGUILayout.PropertyField(so.FindProperty("sensorName"), true); |
|||
} |
|||
EditorGUI.EndDisabledGroup(); |
|||
|
|||
so.ApplyModifiedProperties(); |
|||
if (requireExtractorUpdate) |
|||
{ |
|||
rbSensorComp.ResetPoseExtractor(); |
|||
} |
|||
} |
|||
|
|||
|
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 8c3481f5312564501b381742673d3100 |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
撰写
预览
正在加载...
取消
保存
Reference in new issue