浏览代码

Remove Legacy Unity changed visibility dependence for new gizmo

/main
RSlysz 6 年前
当前提交
62bbd31e
共有 1 个文件被更改,包括 55 次插入56 次删除
  1. 111
      com.unity.render-pipelines.core/CoreRP/Tool/Gizmo6FacesBox.cs

111
com.unity.render-pipelines.core/CoreRP/Tool/Gizmo6FacesBox.cs


Gizmos.color = colorGizmo;
}
static Type k_SnapSettings = Type.GetType("UnityEditor.SnapSettings, UnityEditor");
//static Type k_Slider1D = Type.GetType("UnityEditorInternal.Slider1D");
//static MethodInfo k_Slider1D_Do = k_Slider1D
// .GetMethod(
// "Do",
// BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.Public,
// null,
// CallingConventions.Any,
// new[] { typeof(int), typeof(Vector3), typeof(Vector3), typeof(float), typeof(Handles.CapFunction), typeof(float) },
// null);
static PropertyInfo k_scale = Type.GetType("UnityEditor.SnapSettings, UnityEditor").GetProperty("scale");
static Type k_Slider1D = Type.GetType("UnityEditorInternal.Slider1D, UnityEditor");
static MethodInfo k_Slider1D_Do = k_Slider1D
.GetMethod(
"Do",
BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.Public,
null,
CallingConventions.Any,
new[] { typeof(int), typeof(Vector3), typeof(Vector3), typeof(float), typeof(Handles.CapFunction), typeof(float) },
null);
//Type k_Slider1D = Type.GetType("UnityEditorInternal.Slider1D, UnityEditor");
//MethodInfo k_Slider1D_Do = k_Slider1D
// .GetMethod(
// "Do",
// BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.Public,
// null,
// CallingConventions.Any,
// new[] { typeof(int), typeof(Vector3), typeof(Vector3), typeof(float), typeof(Handles.CapFunction), typeof(float) },
// null);
Type k_Slider1D = Type.GetType("UnityEditorInternal.Slider1D, UnityEditor");
MethodInfo k_Slider1D_Do = k_Slider1D
.GetMethod(
"Do",
BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.Public,
null,
CallingConventions.Any,
new[] { typeof(int), typeof(Vector3), typeof(Vector3), typeof(float), typeof(Handles.CapFunction), typeof(float) },
null);
float handleSize = HandleUtility.GetHandleSize(center) * 0.05f;
float handleSizeCoef = 0.05f;
for (int i = 0, count = m_ControlIDs.Length; i < count; ++i)
m_ControlIDs[i] = GUIUtility.GetControlID(GetHashCode(), FocusType.Passive);

Vector3 frontPosition = center + size.z * .5f * Vector3.forward;
Vector3 backPosition = center + size.z * .5f * Vector3.back;
//Note: Handles.Slider not allow to use a specific ControlID.
//Thus Slider1D is used (with reflection)
float snapScale = (float)k_SnapSettings.GetProperty("scale").GetValue(null, null);
float snapScale = (float)k_scale.GetValue(null, null);
//k_Slider1D_Do.Invoke(null, new[]
//{
// m_ControlIDs[(int)NamedFace.Left],
// leftPosition,
// Vector3.left,
// 1f,
// (Delegate)Handles.DotHandleCap,
// k_SnapSettings.GetProperty("scale").GetValue(null, null)
//});
leftPosition = UnityEditorInternal.Slider1D.Do(
leftPosition = (Vector3)k_Slider1D_Do.Invoke(null, new object[]
{
handleSize,
Handles.DotHandleCap,
HandleUtility.GetHandleSize(leftPosition) * handleSizeCoef,
new Handles.CapFunction(Handles.DotHandleCap),
);
});
rightPosition = UnityEditorInternal.Slider1D.Do(
rightPosition = (Vector3)k_Slider1D_Do.Invoke(null, new object[]
{
Vector3.right,
handleSize,
Handles.DotHandleCap,
Vector3.left,
HandleUtility.GetHandleSize(rightPosition) * handleSizeCoef,
new Handles.CapFunction(Handles.DotHandleCap),
);
});
topPosition = UnityEditorInternal.Slider1D.Do(
topPosition = (Vector3)k_Slider1D_Do.Invoke(null, new object[]
{
handleSize,
Handles.DotHandleCap,
HandleUtility.GetHandleSize(topPosition) * handleSizeCoef,
new Handles.CapFunction(Handles.DotHandleCap),
);
});
bottomPosition = UnityEditorInternal.Slider1D.Do(
bottomPosition = (Vector3)k_Slider1D_Do.Invoke(null, new object[]
{
handleSize,
Handles.DotHandleCap,
HandleUtility.GetHandleSize(bottomPosition) * handleSizeCoef,
new Handles.CapFunction(Handles.DotHandleCap),
);
});
frontPosition = UnityEditorInternal.Slider1D.Do(
frontPosition = (Vector3)k_Slider1D_Do.Invoke(null, new object[]
{
handleSize,
Handles.DotHandleCap,
HandleUtility.GetHandleSize(frontPosition) * handleSizeCoef,
new Handles.CapFunction(Handles.DotHandleCap),
);
});
backPosition = UnityEditorInternal.Slider1D.Do(
backPosition = (Vector3)k_Slider1D_Do.Invoke(null, new object[]
{
handleSize,
Handles.DotHandleCap,
HandleUtility.GetHandleSize(backPosition) * handleSizeCoef,
new Handles.CapFunction(Handles.DotHandleCap),
);
});
if (EditorGUI.EndChangeCheck())
{

正在加载...
取消
保存