Example #1
0
 private bool CanUngroupAs3D(SceneElement element)
 {
     if (!Model3DGroupElement.GetIsGroup((SceneNode)element))
     {
         return(ModelVisual3DElement.GetIsGroup(element));
     }
     return(true);
 }
Example #2
0
 public Model3DGroupTimelineItem(TimelineItemManager timelineItemManager, Model3DGroupElement element)
     : base(timelineItemManager, (Base3DElement)element)
 {
     this.createLightTimelineCommand = new DelegateCommand(new DelegateCommand.SimpleEventHandler(this.CreateLightTimelineCommandBinding_Execute));
 }
Example #3
0
        private SceneNode[] Ungroup(Base3DElement group)
        {
            SceneElement         parentElement         = group.ParentElement;
            Matrix3D             matrix3D              = group.Transform.Value;
            Model3DGroupElement  model3DgroupElement   = group as Model3DGroupElement;
            ModelVisual3DElement modelVisual3Delement1 = group as ModelVisual3DElement;
            int  index1 = 0;
            bool flag   = false;

            if (model3DgroupElement != null)
            {
                index1 = model3DgroupElement.Children.Count;
            }
            else if (modelVisual3Delement1 != null)
            {
                index1 = modelVisual3Delement1.Children.Count;
                flag   = modelVisual3Delement1.Model3DContent != null;
            }
            Base3DElement[] base3DelementArray = new Base3DElement[index1 + (flag ? true : false)];
            Matrix3D[]      matrix3DArray      = new Matrix3D[index1 + (flag ? true : false)];
            if (model3DgroupElement != null)
            {
                for (int index2 = 0; index2 < model3DgroupElement.Children.Count; ++index2)
                {
                    base3DelementArray[index2] = (Base3DElement)model3DgroupElement.Children[index2];
                }
            }
            else if (modelVisual3Delement1 != null)
            {
                for (int index2 = 0; index2 < modelVisual3Delement1.Children.Count; ++index2)
                {
                    base3DelementArray[index2] = (Base3DElement)modelVisual3Delement1.Children[index2];
                }
                if (flag)
                {
                    base3DelementArray[index1] = (Base3DElement)modelVisual3Delement1.Model3DContent;
                    matrix3DArray[index1]      = modelVisual3Delement1.Transform.Value;
                }
            }
            for (int index2 = 0; index2 < index1; ++index2)
            {
                Base3DElement base3Delement = base3DelementArray[index2];
                matrix3DArray[index2] = base3Delement.Transform.Value;
            }
            using (this.SceneViewModel.ForceBaseValue())
            {
                int insertAt = group.GetCollectionContainer().IndexOf((SceneNode)group);
                if (group.ParentElement is Base3DElement)
                {
                    this.SceneViewModel.AnimationEditor.DeleteAllAnimationsInSubtree(group.ParentElement);
                }
                else
                {
                    this.SceneViewModel.AnimationEditor.DeleteAllAnimationsInSubtree((SceneElement)group);
                }
                this.SceneViewModel.RemoveElement((SceneNode)group);
                for (int index2 = index1 - 1; index2 >= 0; --index2)
                {
                    Base3DElement base3Delement = base3DelementArray[index2];
                    base3Delement.Remove();
                    CanonicalTransform3D canonicalTransform3D = new CanonicalTransform3D(matrix3DArray[index2] * matrix3D);
                    base3Delement.Transform = (Transform3D)canonicalTransform3D.ToTransform();
                    if (parentElement is Base3DElement)
                    {
                        GroupCommandHelpers.InsertElement(this.SceneViewModel, (Base3DElement)parentElement, (SceneNode)base3Delement, new int?(insertAt));
                    }
                    else
                    {
                        GroupCommandHelpers.InsertElement(parentElement, (SceneNode)base3Delement, insertAt);
                    }
                }
                if (flag)
                {
                    ModelVisual3DElement modelVisual3Delement2 = parentElement as ModelVisual3DElement;
                    base3DelementArray[index1].Remove();
                    CanonicalTransform3D canonicalTransform3D = new CanonicalTransform3D(matrix3DArray[index1] * matrix3D);
                    base3DelementArray[index1].Transform = (Transform3D)canonicalTransform3D.ToTransform();
                    ModelVisual3DElement modelVisual3Delement3 = (ModelVisual3DElement)this.SceneViewModel.CreateSceneNode(typeof(ModelVisual3D));
                    modelVisual3Delement2.Children.Add((Visual3DElement)modelVisual3Delement3);
                    modelVisual3Delement3.Content = (SceneNode)base3DelementArray[index1];
                }
            }
            return((SceneNode[])base3DelementArray);
        }
        internal static void InsertElement(SceneViewModel sceneViewModel, Base3DElement parent, SceneNode child, int?insertAt)
        {
            Model3DGroupElement  model3DgroupElement  = parent as Model3DGroupElement;
            ModelVisual3DElement modelVisual3Delement = parent as ModelVisual3DElement;
            Model3DElement       model3Delement1      = child as Model3DElement;
            Visual3DElement      visual3Delement      = child as Visual3DElement;

            if (modelVisual3Delement != null)
            {
                if (visual3Delement != null)
                {
                    if (insertAt.HasValue)
                    {
                        modelVisual3Delement.Children.Insert(insertAt.Value, visual3Delement);
                    }
                    else
                    {
                        modelVisual3Delement.Children.Add(visual3Delement);
                    }
                }
                else
                {
                    if (model3Delement1 == null)
                    {
                        return;
                    }
                    modelVisual3Delement.Content = (SceneNode)model3Delement1;
                }
            }
            else
            {
                if (model3DgroupElement == null)
                {
                    return;
                }
                if (visual3Delement != null)
                {
                    Model3DElement model3Delement2 = BaseElement3DCoercionHelper.CoerceToModel3D(sceneViewModel, (SceneElement)visual3Delement);
                    if (insertAt.HasValue)
                    {
                        model3DgroupElement.Children.Insert(insertAt.Value, model3Delement2);
                    }
                    else
                    {
                        model3DgroupElement.Children.Add(model3Delement2);
                    }
                }
                else
                {
                    if (model3Delement1 == null)
                    {
                        return;
                    }
                    if (insertAt.HasValue)
                    {
                        model3DgroupElement.Children.Insert(insertAt.Value, model3Delement1);
                    }
                    else
                    {
                        model3DgroupElement.Children.Add(model3Delement1);
                    }
                }
            }
        }