mirror of
https://github.com/vrm-c/UniVRM.git
synced 2026-04-24 23:18:04 -05:00
RotationOffset
This commit is contained in:
parent
ab4e4cb900
commit
20431dad6d
28
Assets/VRM10/Editor/VRM10RotationOffsetDrawer.cs
Normal file
28
Assets/VRM10/Editor/VRM10RotationOffsetDrawer.cs
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace UniVRM10
|
||||
{
|
||||
[CustomPropertyDrawer(typeof(VRM10RotationOffset))]
|
||||
public class IngredientDrawer : PropertyDrawer
|
||||
{
|
||||
public override float GetPropertyHeight(SerializedProperty property, GUIContent label)
|
||||
{
|
||||
return 16f + 18f;
|
||||
}
|
||||
|
||||
// Draw the property inside the given rect
|
||||
void DrawEuler(Rect position, SerializedProperty property)
|
||||
{
|
||||
Vector3 euler = property.quaternionValue.eulerAngles;
|
||||
euler = EditorGUI.Vector3Field(position, "Offset", euler);
|
||||
property.quaternionValue = Quaternion.Euler(euler);
|
||||
}
|
||||
|
||||
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
|
||||
{
|
||||
DrawEuler(position, property.FindPropertyRelative(nameof(VRM10RotationOffset.Rotation)));
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Assets/VRM10/Editor/VRM10RotationOffsetDrawer.cs.meta
Normal file
11
Assets/VRM10/Editor/VRM10RotationOffsetDrawer.cs.meta
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 615a7cbd2c3cd5d42ab2719d6e74c1b8
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -1,3 +1,4 @@
|
|||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
namespace UniVRM10
|
||||
|
|
|
|||
|
|
@ -13,6 +13,9 @@ namespace UniVRM10
|
|||
[SerializeField]
|
||||
public Transform Source = default;
|
||||
|
||||
[SerializeField]
|
||||
public VRM10RotationOffset SourceOffset = VRM10RotationOffset.Identity;
|
||||
|
||||
[SerializeField]
|
||||
public ObjectSpace SourceCoordinate = default;
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,17 @@
|
|||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
namespace UniVRM10
|
||||
{
|
||||
[Serializable]
|
||||
public struct VRM10RotationOffset
|
||||
{
|
||||
[SerializeField]
|
||||
public Quaternion Rotation;
|
||||
|
||||
public static VRM10RotationOffset Identity => new VRM10RotationOffset
|
||||
{
|
||||
Rotation = Quaternion.identity,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 5b8a5228a8756d64684e8dca601ccafc
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Loading…
Reference in New Issue
Block a user