Created
December 1, 2013 16:29
-
-
Save yumehachi/7736313 to your computer and use it in GitHub Desktop.
Transformのコピーアンドペースト
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using UnityEditor; | |
using System.Collections; | |
/// <summary> | |
/// Transformのコピーアンドペースト | |
/// </summary> | |
/// <author> | |
/// Create by yumehachi on 2013/12/02 | |
/// </author> | |
public class TransformCopyAndPaste : ScriptableObject | |
{ | |
private static Vector3 position; | |
private static Quaternion rotation; | |
private static Vector3 scale; | |
/// <summary> | |
/// Transformをコピーします | |
/// </summary> | |
[MenuItem ("Edit/Transform Copy &%c")] | |
static void Copy () | |
{ | |
position = Selection.activeTransform.localPosition; | |
rotation = Selection.activeTransform.localRotation; | |
scale = Selection.activeTransform.localScale; | |
} | |
/// <summary> | |
/// Transformを貼付けします | |
/// </summary> | |
[MenuItem ("Edit/Transform Paste &%v")] | |
static void AllPaste () | |
{ | |
Selection.activeTransform.localPosition = position; | |
Selection.activeTransform.localRotation = rotation; | |
Selection.activeTransform.localScale = scale; | |
} | |
/// <summary> | |
/// Positionのみ貼付けます | |
/// </summary> | |
[MenuItem ("Edit/Transform Position Paste &%p")] | |
static void PositionPaste () | |
{ | |
Selection.activeTransform.localPosition = position; | |
} | |
/// <summary> | |
/// Rotationのみ貼付けます | |
/// </summary> | |
[MenuItem ("Edit/Transform Rotation Paste &%r")] | |
static void RotationPaste () | |
{ | |
Selection.activeTransform.localRotation = rotation; | |
} | |
/// <summary> | |
/// Scaleのみ貼付けます | |
/// </summary> | |
[MenuItem ("Edit/Transform Scale Paste &%s")] | |
static void ScalePaste () | |
{ | |
Selection.activeTransform.localScale = scale; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment