Beispiel #1
0
        internal void OnLoad(WpfHostingWin32Control.ControlHost controlHost)
        {
            if (null == controlHost)
            {
                return;
            }

            this.controlHost = controlHost;
            this.Cameras     = new System.Collections.ObjectModel.ObservableCollection <ManagedLib.ManagedEntity>();
            for (int i = 0; i < 4; ++i)
            {
                //if (false == this.controlHost.AddCameraEditor())
                //    return;
                if (IntPtr.Zero == this.controlHost.m.addCameraEditor())
                {
                    System.Console.WriteLine("Add entity problem");
                }
                ManagedLib.ManagedEntity entity = new ManagedLib.ManagedEntity();

                this.controlHost.m.setEntityEditor(entity, i);
                this.Cameras.Add(entity);
                this.controlHost.SetCamera(entity, i + 1);
            }
            this.ViewportSelectionCommand0 = new RelayCommand(this.ViewportSelectionExecute0);
            this.ViewportSelectionCommand1 = new RelayCommand(this.ViewportSelectionExecute1);
            this.ViewportSelectionCommand2 = new RelayCommand(this.ViewportSelectionExecute2);
            this.ViewportSelectionCommand3 = new RelayCommand(this.ViewportSelectionExecute3);
            IndexViewport0 = 0;
            IndexViewport1 = 1;
            IndexViewport2 = 2;
            IndexViewport3 = 3;
        }
Beispiel #2
0
 private void resetComboBoxes(int oldViewport, ManagedLib.ManagedEntity entity)
 {
     if (oldViewport == entity.ViewPortID || oldViewport == 0)
     {
         return;
     }
     needChange[oldViewport - 1] = false;
     if (oldViewport != -1)
     {
         _indices[oldViewport - 1] = -1;
     }
     if (oldViewport == 1)
     {
         RaisePropertyChanged("IndexViewport0");
     }
     else if (oldViewport == 2)
     {
         RaisePropertyChanged("IndexViewport1");
     }
     else if (oldViewport == 3)
     {
         RaisePropertyChanged("IndexViewport2");
     }
     else if (oldViewport == 4)
     {
         RaisePropertyChanged("IndexViewport3");
     }
 }
Beispiel #3
0
 public void OnAddModel(int type, string path)
 {
     ManagedLib.ManagedEntity newEntity = null;
     if (path == null && type != 0)
     {
         if (IntPtr.Zero == this.controlHost.addEntity(type, this.selectedEntity, path))
         {
             System.Console.WriteLine("Add entity problem");
         }
         newEntity = new ManagedLib.ManagedEntity();
         newEntity.ValueChanged += this.SelectionDXChanged;
         if (this.selectedEntity != null)
         {
             this.controlHost.setEntity(newEntity, selectedEntity.Childs.Count(), this.SelectedEntity);
             this.selectedEntity.Childs.Add(newEntity);
         }
         else
         {
             this.controlHost.setEntity(newEntity, Entities.Count);
             this.Entities.Add(newEntity);
         }
         newEntity.setMaterialList();
     }
     else if (path != null)
     {
         AsyncAddFbx(type, path);
     }
 }
Beispiel #4
0
        public void SelectedEntityChanged(ManagedLib.ManagedEntity entity)
        {
            this.AnimationViewModel.SelectedEntity = null;
            this.PropertyViewModel.SelectedEntity  = null;
            this.MaterialViewModel.SelectedEntity  = null;
            this.AnimationViewModel.SelectedEntity = entity;
            this.PropertyViewModel.SelectedEntity  = entity;
            this.MaterialViewModel.SelectedEntity  = entity;

            if (this.Autoload)
            {
                if (null == entity)
                {
                    this.AnimationViewModel.IsVisible = false;
                    this.PropertyViewModel.IsVisible  = false;
                    this.MaterialViewModel.IsVisible  = false;
                }
                else
                {
                    if (null != entity && entity.AnimationNames.Count > 0)
                    {
                        this.AnimationViewModel.IsVisible = true;
                    }
                    else
                    {
                        this.AnimationViewModel.IsVisible = false;
                    }
                    this.MaterialViewModel.IsVisible = true;
                    this.PropertyViewModel.IsVisible = true;
                }
            }
        }
Beispiel #5
0
        public IntPtr addEntity(int type, ManagedLib.ManagedEntity parent = null, string path = null)
        {
            if (errorOccured)
            {
                return(IntPtr.Zero);
            }

            return(m.addEntity(type, parent, path));
        }
Beispiel #6
0
        public void SetCamera(ManagedLib.ManagedEntity entity, int viewport)
        {
            if (errorOccured)
            {
                return;
            }

            m.setCamera(entity, viewport);
        }
Beispiel #7
0
        public void setEntity(ManagedLib.ManagedEntity entity, int index, ManagedLib.ManagedEntity parent = null)
        {
            if (errorOccured)
            {
                return;
            }

            m.setEntity(entity, index, parent);
        }
Beispiel #8
0
        public void ViewportSelectionExecute(object obj)
        {
            if (this.SelectedEntity != this.selecE)
            {
                selecE = this.SelectedEntity;
                return;
            }
            int index = Convert.ToInt32(obj);

            this.controlHost.SetCamera(this.SelectedEntity, index);
        }
 public void FillEntity(ManagedLib.ManagedEntity managed)
 {
     managed.TransX = Translation.x;
     managed.TransY = Translation.y;
     managed.TransZ = Translation.z;
     managed.RotX   = Rotation.x;
     managed.RotY   = Rotation.y;
     managed.RotZ   = Rotation.z;
     managed.ScaleX = Scale.x;
     managed.ScaleY = Scale.y;
     managed.ScaleZ = Scale.z;
 }
        public SerializableEntity(ManagedLib.ManagedEntity managed)
        {
            float3 temp;

            temp        = new float3();
            temp.x      = managed.TransX;
            temp.y      = managed.TransY;
            temp.z      = managed.TransZ;
            Translation = temp;
            temp        = new float3();
            temp.x      = managed.RotX;
            temp.y      = managed.RotY;
            temp.z      = managed.RotZ;
            Rotation    = temp;
            temp        = new float3();
            temp.x      = managed.ScaleX;
            temp.y      = managed.ScaleY;
            temp.z      = managed.ScaleZ;
            Scale       = temp;
            Type        = managed.Type;
            Path        = managed.Path;
            Childs      = new ObservableCollection <SerializableEntity>();
        }
Beispiel #11
0
 public void SelectionDXChanged(ManagedLib.ManagedEntity sel)
 {
     this.SelectedEntity = sel;
 }