public static void editAnimation(Texture2D[] s, string n, float f, int w, bool p) 
	{
		AnimationEditor.animationWindow = (AnimationEditor)EditorWindow.GetWindow(typeof(AnimationEditor), true);
		
		animationWindow.setHighlight();
		
		AnimationEditor.animationWindow.ShowUtility();
	
		animationWindow.populateAnimation(s, n, f, w, p);
	}
        void OpenAnimationEditor(string name)
        {
            AnimationEditor window = (AnimationEditor)EditorWindow.GetWindow(typeof(AnimationEditor));

            window.Show();
            window.CreateNewAsset("Asset/Animations");
            window.emp = asset.employeeList[viewIndex - 1];
            window.SetAnimationName(name);
            window.animationString = name;
        }
Exemple #3
0
        public void InitializeRendering(AnimationEditor editor, DeviceManager deviceManager, WadMoveable skin)
        {
            if (LicenseManager.UsageMode != LicenseUsageMode.Runtime)
            {
                return;
            }

            base.InitializeRendering(deviceManager.Device, Configuration.RenderingItem_Antialias);
            ResetCamera();

            _editor      = editor;
            _wadRenderer = new WadRenderer(deviceManager.___LegacyDevice);
            _model       = _wadRenderer.GetMoveable(editor.Moveable);

            Configuration = _editor.Tool.Configuration;

            if (skin != null)
            {
                _skinModel = _wadRenderer.GetMoveable(skin);
            }

            // Actual "InitializeRendering"
            _fontTexture = Device.CreateTextureAllocator(new RenderingTextureAllocator.Description {
                Size = new VectorInt3(512, 512, 2)
            });
            _fontDefault = Device.CreateFont(new RenderingFont.Description {
                FontName = "Segoe UI", FontSize = 24, FontIsBold = true, TextureAllocator = _fontTexture
            });

            // Legacy rendering
            {
                _device        = deviceManager.___LegacyDevice;
                _deviceManager = deviceManager;
                new BasicEffect(_device); // This effect is used for editor special meshes like sinks, cameras, light meshes, etc
                SharpDX.Direct3D11.RasterizerStateDescription renderStateDesc =
                    new SharpDX.Direct3D11.RasterizerStateDescription
                {
                    CullMode                 = SharpDX.Direct3D11.CullMode.None,
                    DepthBias                = 0,
                    DepthBiasClamp           = 0,
                    FillMode                 = SharpDX.Direct3D11.FillMode.Wireframe,
                    IsAntialiasedLineEnabled = true,
                    IsDepthClipEnabled       = true,
                    IsFrontCounterClockwise  = false,
                    IsMultisampleEnabled     = true,
                    IsScissorEnabled         = false,
                    SlopeScaledDepthBias     = 0
                };

                _rasterizerWireframe = RasterizerState.New(deviceManager.___LegacyDevice, renderStateDesc);

                _gizmo = new GizmoAnimationEditor(editor, _device, _deviceManager.___LegacyEffects["Solid"], this);
                _plane = GeometricPrimitive.GridPlane.New(_device, 8, 4);
            }
        }
        private ThemeContentProvider.SystemThemeContentProvider GetCachedThemeContent(Dictionary <ThemeContentProvider.PlatformSpecificDocumentReference, ThemeContentProvider.SystemThemeContentProvider> themeCache, ThemeManager manager, IProjectContext projectContext, DocumentReference reference, IAssembly themeAssembly, string themeAssemblyPath, ITextBufferService textBufferService)
        {
            ThemeContentProvider.PlatformSpecificDocumentReference key = new ThemeContentProvider.PlatformSpecificDocumentReference(reference, projectContext != null ? projectContext.TargetFramework : (FrameworkName)null);
            ThemeContentProvider.SystemThemeContentProvider        themeContentProvider;
            if (!themeCache.TryGetValue(key, out themeContentProvider))
            {
                Encoding    encoding;
                ITextBuffer textBuffer = themeAssembly != null?ThemeManager.LoadResource(themeAssembly, themeAssemblyPath, textBufferService, out encoding) : ThemeContentProvider.LoadReference(reference, textBufferService, out encoding);

                IDocumentLocator documentLocator = DocumentReferenceLocator.GetDocumentLocator(reference);
                IDocumentContext userContext     = projectContext == null ? (IDocumentContext)null : (IDocumentContext) new DocumentContext(projectContext, documentLocator);
                XamlDocument     theme           = manager.GetTheme(documentLocator, themeAssembly != null, userContext, textBuffer, encoding);
                if (theme != null)
                {
                    bool flag1 = false;
                    try
                    {
                        if (projectContext != null)
                        {
                            if (!projectContext.IsCapabilitySet(PlatformCapability.IsWpf))
                            {
                                if (themeAssembly != null)
                                {
                                    bool flag2 = false;
                                    foreach (IAssembly assembly in (projectContext.Platform.Metadata as PlatformTypes).DefaultAssemblyReferences)
                                    {
                                        if (assembly == themeAssembly)
                                        {
                                            flag2 = true;
                                            break;
                                        }
                                    }
                                    if (flag2)
                                    {
                                        flag1 = true;
                                        AnimationEditor.ConvertFromToAnimations(theme.RootNode);
                                    }
                                }
                            }
                        }
                    }
                    catch
                    {
                        if (flag1)
                        {
                            theme = manager.GetTheme(documentLocator, themeAssembly != null, userContext, textBuffer, encoding);
                        }
                    }
                    themeContentProvider = new ThemeContentProvider.SystemThemeContentProvider(this.designerContext, theme);
                    themeCache[key]      = themeContentProvider;
                }
            }
            return(themeContentProvider);
        }
        private static AnimatorInterface WizardAnimationPopupMecanim(string _title, ICECreatureControl _control, AnimatorInterface _animator_data)
        {
            Animator m_animator = _control.GetComponent <Animator>();

            if (m_animator != null && m_animator.enabled == true && m_animator.runtimeAnimatorController != null && m_animator.avatar != null)
            {
                if (!EditorApplication.isPlaying)
                {
                    _animator_data.Type = AnimatorControlType.DIRECT;

                    ICEEditorLayout.BeginHorizontal();
                    _animator_data.Index = AnimationEditor.AnimatorIntPopupBase(m_animator, _animator_data.Index, _title);
                    ICEEditorLayout.EndHorizontal();

                    if (AnimationTools.GetAnimationClipCount(m_animator) == 0)
                    {
                        Info.Warning(Info.BEHAVIOUR_ANIMATION_ANIMATOR_ERROR_NO_CLIPS);
                    }
                    else
                    {
                        AnimationClip _animation_clip = AnimationTools.GetAnimationClipByIndex(m_animator, _animator_data.Index);
                        if (_animation_clip != null)
                        {
                            if (_animator_data.Name != _animation_clip.name)
                            {
                                _animator_data.Init();
                            }


                            _animation_clip.wrapMode = WrapMode.Loop;
                            _animation_clip.legacy   = false;

                            _animator_data.StateName          = AnimationEditor.GetAnimatorStateName(m_animator, _animation_clip.name);
                            _animator_data.Name               = _animation_clip.name;
                            _animator_data.Length             = _animation_clip.length;
                            _animator_data.Speed              = 1;
                            _animator_data.TransitionDuration = 0.05f;
                        }
                    }
                }
                else
                {
                    ICEEditorLayout.Label("Name", "Animation name.", _animator_data.Name);
                }
            }
            else
            {
            }
            return(_animator_data);
        }
        public override void Execute()
        {
            AnimationEditor      animationEditor  = this.SceneViewModel.AnimationEditor;
            SceneElement         pathTarget       = this.GetPathTarget(this.SceneViewModel.ElementSelectionSet);
            BaseFrameworkElement frameworkElement = (BaseFrameworkElement)this.GetAnimationTarget(this.SceneViewModel.ElementSelectionSet);

            if (frameworkElement == null)
            {
                SceneElement root = this.SceneViewModel.ActiveEditingContainer as SceneElement;
                if (root != null)
                {
                    frameworkElement = PathTargetDialog.ChooseMotionPathTarget(root, pathTarget);
                }
            }
            if (frameworkElement == null)
            {
                return;
            }
            PathGeometry geometry = PathConversionHelper.ConvertToPathGeometry(pathTarget);

            if (PathGeometryUtilities.TotalSegmentCount(geometry) == 0)
            {
                this.DesignerContext.MessageDisplayService.ShowError(StringTable.ConvertToMotionPathNoSegmentsMessage);
            }
            else
            {
                using (SceneEditTransaction editTransaction = this.SceneViewModel.CreateEditTransaction(StringTable.ConvertToMotionPathUndo, false))
                {
                    StoryboardTimelineSceneNode targetTimeline = this.GetTargetTimeline();
                    if (targetTimeline == null)
                    {
                        this.SceneViewModel.AnimationEditor.CreateNewTimeline(TriggerCreateBehavior.Default);
                    }
                    else if (targetTimeline != this.SceneViewModel.ActiveStoryboardTimeline)
                    {
                        this.SceneViewModel.SetActiveStoryboardTimeline(targetTimeline.StoryboardContainer, targetTimeline, (TriggerBaseNode)null);
                    }
                    this.SceneViewModel.ElementSelectionSet.Clear();
                    Point        elementCoordinates = frameworkElement.RenderTransformOriginInElementCoordinates;
                    Matrix       matrix             = new TranslateTransform(-elementCoordinates.X, -elementCoordinates.Y).Value;
                    Transform    transform          = (Transform) new MatrixTransform(pathTarget.GetComputedTransformToElement((SceneElement)frameworkElement) * frameworkElement.GetEffectiveRenderTransform(false) * matrix);
                    PathGeometry path          = PathGeometryUtilities.TransformGeometry((System.Windows.Media.Geometry)geometry, transform);
                    double       animationTime = animationEditor.AnimationTime;
                    animationEditor.SetMotionPath((SceneElement)frameworkElement, path, new double?(animationTime), new double?(animationTime + 2.0));
                    this.SceneViewModel.ElementSelectionSet.SetSelection((SceneElement)frameworkElement);
                    editTransaction.Commit();
                }
            }
        }
        private static AnimationInterface WizardAnimationPopupLegacy(string _title, ICECreatureControl _control, AnimationInterface _animation_data)
        {
            Animation m_animation = _control.GetComponentInChildren <Animation>();

            if (m_animation != null && m_animation.enabled == true)
            {
                if (EditorApplication.isPlaying)
                {
                    EditorGUILayout.LabelField("Name", _animation_data.Name);
                }
                else
                {
                    _animation_data.Name = AnimationEditor.AnimationPopupBase(m_animation, _animation_data.Name, _title);
                    AnimationState _state = AnimationTools.GetAnimationStateByName(_control.gameObject, _animation_data.Name);
                    if (_state != null)
                    {
                        if (_state.clip != null)
                        {
                            _state.clip.legacy = true;
                        }

                        if (_animation_data.Name != _state.name)
                        {
                            _animation_data.Name               = _state.name;
                            _animation_data.Length             = _state.length;
                            _animation_data.Speed              = _state.speed;
                            _animation_data.TransitionDuration = 0.25f;
                            _animation_data.wrapMode           = _state.wrapMode;

                            _animation_data.Length          = _state.length;
                            _animation_data.DefaultSpeed    = _state.speed;
                            _animation_data.DefaultWrapMode = _state.wrapMode;
                        }
                    }
                }
            }
            else
            {
                EditorGUILayout.HelpBox("Check your Animation Component", MessageType.Warning);
            }

            return(_animation_data);
        }
Exemple #8
0
        public AnchorPlacingWindow(AnimationEditor parent, AnimatedTexture anim) : base("Anchor Placer")
        {
            _parent = parent;
            _anim   = anim;

            // Ensure anchor array length is correct.
            // It's possible for more frames to be added after initial initialization.
            Vector2[] anchorArray = _anim.Anchors;
            if (anchorArray.Length <= _anim.TotalFrames)
            {
                Array.Resize(ref anchorArray, _anim.TotalFrames + 1);
                _anim.Anchors = anchorArray;
            }

            if (_parent.AnimController != null)
            {
                anchorArray = _parent.AnimController.MirrorXAnchors;
                if (anchorArray != null && anchorArray.Length <= _anim.TotalFrames)
                {
                    Array.Resize(ref anchorArray, _anim.TotalFrames + 1);
                    _parent.AnimController.MirrorXAnchors = anchorArray;
                }
            }
        }
 public FrameOrderWindow(AnimationEditor parent, AnimatedTexture anim) : base("Frame Order")
 {
     _parent = parent;
     _anim   = anim;
     _font   = Engine.AssetLoader.Get <FontAsset>("debugFont.otf");
 }
Exemple #10
0
 public AnchorPlacer(AnimationEditor parent, AnimatedTexture anim) : base("Anchor Placer")
 {
     _parent = parent;
     _anim   = anim;
 }
	void saveAnimation()
	{
		
		EditorUtility.UnloadUnusedAssetsIgnoreManagedReferences(); 		
		
		AtlasBuilder.addAnimationToAtlas(animName, sprites, fps, wrapmode, playOnWake);
		
		if(animationWindow)
			animationWindow.Close();		
			else
			{
				animationWindow = (AnimationEditor)EditorWindow.GetWindow( typeof(AnimationEditor), true);
				animationWindow.Close();
			}
	}
Exemple #12
0
 public AnimationCreateFrom(AnimationEditor parent, Action <Vector2, Vector2> callback, Action <int, int> callbackRc) : base("Animation, Create From:")
 {
     _parent     = parent;
     _callback   = callback;
     _callbackRc = callbackRc;
 }
 private void addClick(AnimationEditor obj)
 {
     animationEditor1.Selection = frameSelector1.GetSelection();
 }
 public GridSettingsWindow(AnimationEditor parent, Action <Vector2, Vector2> callback, Action <int, int> callbackRc) : base("Grid Frames")
 {
     _parent     = parent;
     _callback   = callback;
     _callbackRC = callbackRc;
 }