浏览代码

remove defines that are now always true

/develop/lex-walker-model
Chris Elion 4 年前
当前提交
19c747f0
共有 23 个文件被更改,包括 55 次插入81 次删除
  1. 4
      com.unity.ml-agents.extensions/Editor/Input/InputActuatorComponentEditor.cs
  2. 4
      com.unity.ml-agents.extensions/Runtime/Input/Adaptors/ButtonInputActionAdaptor.cs
  3. 4
      com.unity.ml-agents.extensions/Runtime/Input/Adaptors/DoubleInputActionAdaptor.cs
  4. 4
      com.unity.ml-agents.extensions/Runtime/Input/Adaptors/FloatInputActionAdaptor.cs
  5. 4
      com.unity.ml-agents.extensions/Runtime/Input/Adaptors/IntegerInputActionAdaptor.cs
  6. 4
      com.unity.ml-agents.extensions/Runtime/Input/Adaptors/Vector2InputActionAdaptor.cs
  7. 4
      com.unity.ml-agents.extensions/Runtime/Input/IInputActionAssetProvider.cs
  8. 4
      com.unity.ml-agents.extensions/Runtime/Input/IRLActionInputAdaptor.cs
  9. 4
      com.unity.ml-agents.extensions/Runtime/Input/InputActionActuator.cs
  10. 4
      com.unity.ml-agents.extensions/Runtime/Input/InputActuatorComponent.cs
  11. 4
      com.unity.ml-agents.extensions/Runtime/Input/InputActuatorEventContext.cs
  12. 4
      com.unity.ml-agents.extensions/Tests/Runtime/Input/Adaptors/ButtonInputActionAdaptorTests.cs
  13. 4
      com.unity.ml-agents.extensions/Tests/Runtime/Input/Adaptors/DoubleInputActionAdaptorTests.cs
  14. 4
      com.unity.ml-agents.extensions/Tests/Runtime/Input/Adaptors/FloatInputActionAdapatorTests.cs
  15. 4
      com.unity.ml-agents.extensions/Tests/Runtime/Input/Adaptors/IntegerInputActionAdaptorTests.cs
  16. 4
      com.unity.ml-agents.extensions/Tests/Runtime/Input/Adaptors/Vector2InputActionAdaptorTests.cs
  17. 4
      com.unity.ml-agents.extensions/Tests/Runtime/Input/InputActionActuatorTests.cs
  18. 4
      com.unity.ml-agents.extensions/Tests/Runtime/Input/TestPushBlockActions.cs
  19. 6
      com.unity.ml-agents/Editor/MLAgentsSettingsBuildProvider.cs
  20. 4
      com.unity.ml-agents/Editor/MLAgentsSettingsProvider.cs
  21. 22
      com.unity.ml-agents/Runtime/Analytics/InferenceAnalytics.cs
  22. 26
      com.unity.ml-agents/Runtime/Analytics/TrainingAnalytics.cs
  23. 6
      com.unity.ml-agents/Tests/Editor/AcademyTests.cs

4
com.unity.ml-agents.extensions/Editor/Input/InputActuatorComponentEditor.cs


#if MLA_INPUT_SYSTEM && UNITY_2019_4_OR_NEWER
#if MLA_INPUT_SYSTEM
using Unity.MLAgents.Extensions.Input;
using UnityEditor;

}
}
}
#endif // MLA_INPUT_SYSTEM && UNITY_2019_OR_NEWER
#endif // MLA_INPUT_SYSTEM

4
com.unity.ml-agents.extensions/Runtime/Input/Adaptors/ButtonInputActionAdaptor.cs


#if MLA_INPUT_SYSTEM && UNITY_2019_4_OR_NEWER
#if MLA_INPUT_SYSTEM
using Unity.MLAgents.Actuators;
using UnityEngine;
using UnityEngine.InputSystem;

}
}
}
#endif // MLA_INPUT_SYSTEM && UNITY_2019_4_OR_NEWER
#endif // MLA_INPUT_SYSTEM

4
com.unity.ml-agents.extensions/Runtime/Input/Adaptors/DoubleInputActionAdaptor.cs


#if MLA_INPUT_SYSTEM && UNITY_2019_4_OR_NEWER
#if MLA_INPUT_SYSTEM
using Unity.MLAgents.Actuators;
using UnityEngine.InputSystem;
using UnityEngine.InputSystem.Controls;

}
}
}
#endif // MLA_INPUT_SYSTEM && UNITY_2019_4_OR_NEWER
#endif // MLA_INPUT_SYSTEM

4
com.unity.ml-agents.extensions/Runtime/Input/Adaptors/FloatInputActionAdaptor.cs


#if MLA_INPUT_SYSTEM && UNITY_2019_4_OR_NEWER
#if MLA_INPUT_SYSTEM
using Unity.MLAgents.Actuators;
using UnityEngine.InputSystem;
using UnityEngine.InputSystem.LowLevel;

}
}
}
#endif // MLA_INPUT_SYSTEM && UNITY_2019_4_OR_NEWER
#endif // MLA_INPUT_SYSTEM

4
com.unity.ml-agents.extensions/Runtime/Input/Adaptors/IntegerInputActionAdaptor.cs


#if MLA_INPUT_SYSTEM && UNITY_2019_4_OR_NEWER
#if MLA_INPUT_SYSTEM
using Unity.MLAgents.Actuators;
using UnityEngine.InputSystem;
using UnityEngine.InputSystem.LowLevel;

}
}
}
#endif // MLA_INPUT_SYSTEM && UNITY_2019_4_OR_NEWER
#endif // MLA_INPUT_SYSTEM

4
com.unity.ml-agents.extensions/Runtime/Input/Adaptors/Vector2InputActionAdaptor.cs


#if MLA_INPUT_SYSTEM && UNITY_2019_4_OR_NEWER
#if MLA_INPUT_SYSTEM
using System;
using Unity.MLAgents.Actuators;
using UnityEngine;

}
}
#endif // MLA_INPUT_SYSTEM && UNITY_2019_4_OR_NEWER
#endif // MLA_INPUT_SYSTEM

4
com.unity.ml-agents.extensions/Runtime/Input/IInputActionAssetProvider.cs


#if MLA_INPUT_SYSTEM && UNITY_2019_4_OR_NEWER
#if MLA_INPUT_SYSTEM
using UnityEngine.InputSystem;
namespace Unity.MLAgents.Extensions.Input

(InputActionAsset, IInputActionCollection2) GetInputActionAsset();
}
}
#endif // MLA_INPUT_SYSTEM && UNITY_2019_4_OR_NEWER
#endif // MLA_INPUT_SYSTEM

4
com.unity.ml-agents.extensions/Runtime/Input/IRLActionInputAdaptor.cs


#if MLA_INPUT_SYSTEM && UNITY_2019_4_OR_NEWER
#if MLA_INPUT_SYSTEM
using System;
using Unity.MLAgents.Actuators;
using UnityEngine.InputSystem;

void WriteToHeuristic(InputAction action, in ActionBuffers actionBuffers);
}
}
#endif // MLA_INPUT_SYSTEM && UNITY_2019_4_OR_NEWER
#endif // MLA_INPUT_SYSTEM

4
com.unity.ml-agents.extensions/Runtime/Input/InputActionActuator.cs


#if MLA_INPUT_SYSTEM && UNITY_2019_4_OR_NEWER
#if MLA_INPUT_SYSTEM
using Unity.MLAgents.Actuators;
using Unity.MLAgents.Policies;

}
}
#endif // MLA_INPUT_SYSTEM && UNITY_2019_4_OR_NEWER
#endif // MLA_INPUT_SYSTEM

4
com.unity.ml-agents.extensions/Runtime/Input/InputActuatorComponent.cs


#if MLA_INPUT_SYSTEM && UNITY_2019_4_OR_NEWER
#if MLA_INPUT_SYSTEM
using System;
using System.Collections.Generic;
using Unity.Collections;

}
}
}
#endif // MLA_INPUT_SYSTEM && UNITY_2019_4_OR_NEWER
#endif // MLA_INPUT_SYSTEM

4
com.unity.ml-agents.extensions/Runtime/Input/InputActuatorEventContext.cs


#if MLA_INPUT_SYSTEM && UNITY_2019_4_OR_NEWER
#if MLA_INPUT_SYSTEM
using System;
using Unity.Collections;
using UnityEngine.InputSystem;

}
}
}
#endif // MLA_INPUT_SYSTEM && UNITY_2019_4_OR_NEWER
#endif // MLA_INPUT_SYSTEM

4
com.unity.ml-agents.extensions/Tests/Runtime/Input/Adaptors/ButtonInputActionAdaptorTests.cs


#if MLA_INPUT_TESTS && UNITY_2019_4_OR_NEWER
#if MLA_INPUT_TESTS
using NUnit.Framework;
using Unity.MLAgents.Actuators;
using Unity.MLAgents.Extensions.Input;

}
}
}
#endif // MLA_INPUT_TESTS && UNITY_2019_4_OR_NEWER
#endif // MLA_INPUT_TESTS

4
com.unity.ml-agents.extensions/Tests/Runtime/Input/Adaptors/DoubleInputActionAdaptorTests.cs


#if MLA_INPUT_TESTS && UNITY_2019_4_OR_NEWER
#if MLA_INPUT_TESTS
using NUnit.Framework;
using Unity.MLAgents.Actuators;
using Unity.MLAgents.Extensions.Input;

}
}
}
#endif // MLA_INPUT_TESTS && UNITY_2019_4_OR_NEWER
#endif // MLA_INPUT_TESTS

4
com.unity.ml-agents.extensions/Tests/Runtime/Input/Adaptors/FloatInputActionAdapatorTests.cs


#if MLA_INPUT_TESTS && UNITY_2019_4_OR_NEWER
#if MLA_INPUT_TESTS
using NUnit.Framework;
using Unity.MLAgents.Actuators;
using Unity.MLAgents.Extensions.Input;

}
}
}
#endif // MLA_INPUT_TESTS && UNITY_2019_4_OR_NEWER
#endif // MLA_INPUT_TESTS

4
com.unity.ml-agents.extensions/Tests/Runtime/Input/Adaptors/IntegerInputActionAdaptorTests.cs


#if MLA_INPUT_TESTS && UNITY_2019_4_OR_NEWER
#if MLA_INPUT_TESTS
using System;
using NUnit.Framework;
using Unity.MLAgents.Actuators;

}
}
}
#endif // MLA_INPUT_TESTS && UNITY_2019_4_OR_NEWER
#endif // MLA_INPUT_TESTS

4
com.unity.ml-agents.extensions/Tests/Runtime/Input/Adaptors/Vector2InputActionAdaptorTests.cs


#if MLA_INPUT_TESTS && UNITY_2019_4_OR_NEWER
#if MLA_INPUT_TESTS
using NUnit.Framework;
using Unity.MLAgents.Actuators;
using Unity.MLAgents.Extensions.Input;

}
}
}
#endif // MLA_INPUT_TESTS && UNITY_2019_4_OR_NEWER
#endif // MLA_INPUT_TESTS

4
com.unity.ml-agents.extensions/Tests/Runtime/Input/InputActionActuatorTests.cs


#if MLA_INPUT_TESTS && UNITY_2019_4_OR_NEWER
#if MLA_INPUT_TESTS
using NUnit.Framework;
using Unity.Barracuda;
using Unity.MLAgents.Actuators;

}
}
}
#endif // MLA_INPUT_TESTS && UNITY_2019_4_OR_NEWER
#endif // MLA_INPUT_TESTS

4
com.unity.ml-agents.extensions/Tests/Runtime/Input/TestPushBlockActions.cs


#if MLA_INPUT_TESTS && UNITY_2019_4_OR_NEWER
#if MLA_INPUT_TESTS
//------------------------------------------------------------------------------
// <auto-generated>
// This code was auto-generated by com.unity.inputsystem:InputActionCodeGenerator

void OnJump(InputAction.CallbackContext context);
}
}
#endif // MLA_INPUT_TESTS && UNITY_2019_4_OR_NEWER
#endif // MLA_INPUT_TESTS

6
com.unity.ml-agents/Editor/MLAgentsSettingsBuildProvider.cs


private static bool IsPlayerSettingsDirty()
{
#if UNITY_2019_OR_NEWER
#else
return false;
#endif
#if UNITY_2019_OR_NEWER
#endif
}
}
}

4
com.unity.ml-agents/Editor/MLAgentsSettingsProvider.cs


using System.Runtime.CompilerServices;
using UnityEngine;
using UnityEditor;
#if UNITY_2019_4_OR_NEWER
#else
using UnityEngine.Experimental.UIElements;
#endif
[assembly: InternalsVisibleTo("Unity.ML-Agents.DevTests.Editor")]
namespace Unity.MLAgents.Editor

22
com.unity.ml-agents/Runtime/Analytics/InferenceAnalytics.cs


#if MLA_UNITY_ANALYTICS_MODULE || !UNITY_2019_4_OR_NEWER
#define MLA_UNITY_ANALYTICS_MODULE_ENABLED
#endif
using System;
using System.Collections.Generic;
using System.Diagnostics;
using Unity.Barracuda;

using Unity.MLAgents.Sensors;
using UnityEngine;
#if MLA_UNITY_ANALYTICS_MODULE_ENABLED
#if MLA_UNITY_ANALYTICS_MODULE
using UnityEngine.Analytics;
#endif

#if MLA_UNITY_ANALYTICS_MODULE_ENABLED
#if MLA_UNITY_ANALYTICS_MODULE
#endif // MLA_UNITY_ANALYTICS_MODULE_ENABLED
#endif // MLA_UNITY_ANALYTICS_MODULE
#endif // UNITY_EDITOR

return true;
}
#if UNITY_EDITOR && MLA_UNITY_ANALYTICS_MODULE_ENABLED
#if UNITY_EDITOR && MLA_UNITY_ANALYTICS_MODULE
#elif MLA_UNITY_ANALYTICS_MODULE_ENABLED
#elif MLA_UNITY_ANALYTICS_MODULE
AnalyticsResult result = AnalyticsResult.UnsupportedPlatform;
if (result == AnalyticsResult.Ok)
{

/// <param name="actionSpec">ActionSpec for the Agent. Used to generate information about the action space.</param>
/// <param name="actuators">List of IActuators for the Agent. Used to generate information about the action space.</param>
/// <returns></returns>
[Conditional("MLA_UNITY_ANALYTICS_MODULE_ENABLED")]
[Conditional("MLA_UNITY_ANALYTICS_MODULE")]
public static void InferenceModelSet(
NNModel nnModel,
string behaviorName,

var data = GetEventForModel(nnModel, behaviorName, inferenceDevice, sensors, actionSpec, actuators);
// Note - to debug, use JsonUtility.ToJson on the event.
// Debug.Log(JsonUtility.ToJson(data, true));
#if UNITY_EDITOR && MLA_UNITY_ANALYTICS_MODULE_ENABLED
#if UNITY_EDITOR && MLA_UNITY_ANALYTICS_MODULE
if (AnalyticsUtils.s_SendEditorAnalytics)
{
EditorAnalytics.SendEventWithLimit(k_EventName, data, k_EventVersion);

inferenceEvent.BarracudaModelProducer = "tensorflow_to_barracuda.py";
}
#if UNITY_2019_3_OR_NEWER && UNITY_EDITOR
#if UNITY_EDITOR
var barracudaPackageInfo = UnityEditor.PackageManager.PackageInfo.FindForAssembly(typeof(Tensor).Assembly);
inferenceEvent.BarracudaPackageVersion = barracudaPackageInfo.version;
#else

26
com.unity.ml-agents/Runtime/Analytics/TrainingAnalytics.cs


#if MLA_UNITY_ANALYTICS_MODULE || !UNITY_2019_4_OR_NEWER
#define MLA_UNITY_ANALYTICS_MODULE_ENABLED
#endif
using System;
using System.Collections.Generic;
using System.Diagnostics;

#if MLA_UNITY_ANALYTICS_MODULE_ENABLED
#if MLA_UNITY_ANALYTICS_MODULE
using UnityEngine.Analytics;
#if UNITY_EDITOR
using UnityEditor.Analytics;

static bool EnableAnalytics()
{
#if MLA_UNITY_ANALYTICS_MODULE_ENABLED
#if MLA_UNITY_ANALYTICS_MODULE
if (s_EventsRegistered)
{
return true;

return s_EventsRegistered;
#else
return false;
#endif // MLA_UNITY_ANALYTICS_MODULE_ENABLED
#endif // MLA_UNITY_ANALYTICS_MODULE
}
/// <summary>

/// <param name="packageVersion"></param>
[Conditional("MLA_UNITY_ANALYTICS_MODULE_ENABLED")]
[Conditional("MLA_UNITY_ANALYTICS_MODULE")]
public static void SetTrainerInformation(string packageVersion, string communicationVersion)
{
s_TrainerPackageVersion = packageVersion;

public static bool IsAnalyticsEnabled()
{
#if UNITY_EDITOR && MLA_UNITY_ANALYTICS_MODULE_ENABLED
#if UNITY_EDITOR && MLA_UNITY_ANALYTICS_MODULE
return EditorAnalytics.enabled;
#else
return false;

[Conditional("MLA_UNITY_ANALYTICS_MODULE_ENABLED")]
[Conditional("MLA_UNITY_ANALYTICS_MODULE")]
public static void TrainingEnvironmentInitialized(TrainingEnvironmentInitializedEvent tbiEvent)
{
if (!IsAnalyticsEnabled())

// Debug.Log(
// $"Would send event {k_TrainingEnvironmentInitializedEventName} with body {JsonUtility.ToJson(tbiEvent, true)}"
// );
#if UNITY_EDITOR && MLA_UNITY_ANALYTICS_MODULE_ENABLED
#if UNITY_EDITOR && MLA_UNITY_ANALYTICS_MODULE
if (AnalyticsUtils.s_SendEditorAnalytics)
{
EditorAnalytics.SendEventWithLimit(k_TrainingEnvironmentInitializedEventName, tbiEvent);

[Conditional("MLA_UNITY_ANALYTICS_MODULE_ENABLED")]
[Conditional("MLA_UNITY_ANALYTICS_MODULE")]
public static void RemotePolicyInitialized(
string fullyQualifiedBehaviorName,
IList<ISensor> sensors,

// Debug.Log(
// $"Would send event {k_RemotePolicyInitializedEventName} with body {JsonUtility.ToJson(data, true)}"
// );
#if UNITY_EDITOR && MLA_UNITY_ANALYTICS_MODULE_ENABLED
#if UNITY_EDITOR && MLA_UNITY_ANALYTICS_MODULE
if (AnalyticsUtils.s_SendEditorAnalytics)
{
EditorAnalytics.SendEventWithLimit(k_RemotePolicyInitializedEventName, data);

return fullyQualifiedBehaviorName.Substring(0, lastQuestionIndex);
}
[Conditional("MLA_UNITY_ANALYTICS_MODULE_ENABLED")]
[Conditional("MLA_UNITY_ANALYTICS_MODULE")]
public static void TrainingBehaviorInitialized(TrainingBehaviorInitializedEvent tbiEvent)
{
if (!IsAnalyticsEnabled())

// Debug.Log(
// $"Would send event {k_TrainingBehaviorInitializedEventName} with body {JsonUtility.ToJson(tbiEvent, true)}"
// );
#if UNITY_EDITOR && MLA_UNITY_ANALYTICS_MODULE_ENABLED
#if UNITY_EDITOR && MLA_UNITY_ANALYTICS_MODULE
if (AnalyticsUtils.s_SendEditorAnalytics)
{
EditorAnalytics.SendEventWithLimit(k_TrainingBehaviorInitializedEventName, tbiEvent);

6
com.unity.ml-agents/Tests/Editor/AcademyTests.cs


using NUnit.Framework;
using Unity.MLAgents.Sensors;
using UnityEngine;
#if UNITY_2019_3_OR_NEWER
#endif
namespace Unity.MLAgents.Tests
{

[Test]
public void TestPackageVersion()
{
// Make sure that the version strings in the package and Academy don't get out of sync.
// Unfortunately, the PackageInfo methods don't exist in earlier versions of the editor.
#if UNITY_2019_3_OR_NEWER
#endif
}
class RecursiveAgent : Agent

正在加载...
取消
保存