コード例 #1
0
	static public void ShowEditor()
	{
#if UNITY_IPHONE && !(UNITY_3_0 || UNITY_3_1 || UNITY_3_2 || UNITY_3_3 || UNITY_3_4 || UNITY_3_5 || UNITY_3_6 || UNITY_3_7 || UNITY_3_8 || UNITY_3_9)
		if (instance != null)
		{
			instance.Show(true);
			return;
		}

		instance = new SpriteTimelineEditor();

		if(timelineInstance == null)
			timelineInstance = new SpriteTimeline();

		// Get the selected object and see if it has a sprite:
		timelineInstance.Editor = instance;
		timelineInstance.SetupSelection();
		instance.position = new Rect(200, 200, 700, 400);
		timelineInstance.position = instance.position;
		timelineInstance.SetupRects();

		instance.autoRepaintOnSceneChange = true;
		instance.Show(true);
#else
		if (instance != null)
		{
			instance.ShowUtility();
			return;
		}

		instance = (SpriteTimelineEditor)EditorWindow.GetWindow(typeof(SpriteTimelineEditor), false, "Sprite Timeline");

		if (timelineInstance == null)
			timelineInstance = new SpriteTimeline();

		timelineInstance.Editor = instance;
		/*
				timelineInstance.SetupSelection();
				timelineInstance.SetupRects();
		*/
		timelineInstance.position = instance.position;

		instance.ShowUtility();
#endif
		instance.wndRect = instance.position;
	}
コード例 #2
0
    public override void Initialize(Object[] targets)
    {
        singleTarget = targets.Length == 1;

        base.Initialize(targets);
        animationClipSettings = AnimationUtility.GetAnimationClipSettings((AnimationClip)target);

        timeline = new SpriteTimeline(animationClipSettings.startTime, animationClipSettings.stopTime);

        var clipObject         = new SerializedObject(target);
        var serializedProperty = clipObject.FindProperty("m_ClipBindingConstant").FindPropertyRelative("pptrCurveMapping");

        for (var i = 0; i < serializedProperty.arraySize; i++)
        {
            var sprite = (Sprite)serializedProperty.GetArrayElementAtIndex(i).objectReferenceValue;
            ArrayUtility.Add(ref sprites, sprite);

            // プレビュー画像生成のために呼び出しとく
            AssetPreview.GetAssetPreview(sprite);
        }
    }