예제 #1
0
    private void RotationPropertyField(SerializedProperty rotationProperty, GUIContent content)
    {
        Transform  transform     = (Transform)this.targets[0];
        Quaternion localRotation = transform.localRotation;

        foreach (UnityEngine.Object t in (UnityEngine.Object[]) this.targets)
        {
            if (!SameRotation(localRotation, ((Transform)t).localRotation))
            {
                EditorGUI.showMixedValue = true;
                break;
            }
        }

        EditorGUI.BeginChangeCheck();

        Vector3 eulerAngles = TransformUtilEditor.Vector3InputField(content.text, localRotation.eulerAngles);

        //Vector3 eulerAngles = EditorGUILayout.Vector3Field(content, localRotation.eulerAngles);

        if (EditorGUI.EndChangeCheck())
        {
            Undo.RecordObjects(this.targets, "Rotation Changed");
            foreach (UnityEngine.Object obj in this.targets)
            {
                Transform t = (Transform)obj;
                t.localEulerAngles = eulerAngles;
            }
            rotationProperty.serializedObject.SetIsDifferentCacheDirty();
        }

        EditorGUI.showMixedValue = false;
    }
예제 #2
0
    /// <summary>
    /// Draws the input for the position
    /// </summary>
    private void DrawPositionElement()
    {
        if (ThinInspectorMode)
        {
            GUILayout.BeginHorizontal();
            EditorGUILayout.LabelField("Position");
            DrawPositionSkill();
            GUILayout.EndHorizontal();
        }

        string label = ThinInspectorMode ? "" : "Position";

        GUILayout.BeginHorizontal();
        EditorGUIUtility.labelWidth        = EditorGUIUtility.currentViewWidth - FIELD_WIDTH - 64; // align field to right of inspector
        this.positionProperty.vector3Value = TransformUtilEditor.Vector3InputField(label, this.positionProperty.vector3Value);
        if (!ThinInspectorMode)
        {
            DrawPositionSkill();
        }
        GUILayout.EndHorizontal();
        EditorGUIUtility.labelWidth = 0;
    }
예제 #3
0
    /// <summary>
    /// Draws the input for the scale
    /// </summary>
    private void DrawScaleElement()
    {
        if (ThinInspectorMode)
        {
            GUILayout.BeginHorizontal();
            EditorGUILayout.LabelField("Scale");
            DrawScaleSkill();
            GUILayout.EndHorizontal();
        }
        string label = ThinInspectorMode ? "" : "Scale";

        //Scale Layout
        GUILayout.BeginHorizontal();
        EditorGUIUtility.labelWidth     = EditorGUIUtility.currentViewWidth - FIELD_WIDTH - 64; // align field to right of inspector
        this.scaleProperty.vector3Value = TransformUtilEditor.Vector3InputField(label, this.scaleProperty.vector3Value, false, UniformScaling, UniformScaling);
        if (!ThinInspectorMode)
        {
            DrawScaleSkill();
        }
        GUILayout.EndHorizontal();
        EditorGUIUtility.labelWidth = 0;
    }