Example #1
0
        public bool Close()
        {
            try
            {
                if (!CloseExternal())
                {
                    return(false);
                }

                BrawlBox.Properties.Settings.Default.ViewerSettings     = CollectSettings();
                BrawlBox.Properties.Settings.Default.ScreenCapBgLocText = ScreenCapBgLocText.Text;
                BrawlBox.Properties.Settings.Default.ViewerSettingsSet  = true;
                BrawlBox.Properties.Settings.Default.Save();

                StopAnim();

                if (_viewerForm != null)
                {
                    _viewerForm.Close();
                }
                if (_interpolationForm != null)
                {
                    _interpolationForm.Close();
                }

                if (TargetModel != null)
                {
                    TargetModel.ApplyCHR(null, 0);
                    TargetModel.ApplySRT(null, 0);
                }
                ResetBoneColors();
            }
            catch { }
            return(true);
        }
Example #2
0
 public bool CloseFiles()
 {
     try
     {
         if (TargetModel != null)
         {
             TargetModel.ApplyCHR(null, 0);
         }
         ResetBoneColors();
         return(CloseExternal() && scriptPanel.scriptPanel.CloseReferences());
     }
     catch { return(true); }
 }
Example #3
0
        private unsafe void button5_Click(object sender, EventArgs e)
        {
            //Set vertices (0), normals (1), and/or colors (2, 3)
            //UVs are not morphed so there's no need to set them

            if (SelectedAnimation == null ||
                SelectedSource == null ||
                TargetModel == null ||
                TargetModel.Objects == null ||
                TargetModel.Objects.Length == 0)
            {
                return;
            }

            SHP0EntryNode entry = SelectedAnimation.FindChild(SelectedSource, false) as SHP0EntryNode;

            if (entry == null)
            {
                return;
            }

            if (MessageBox.Show(this, "Are you sure you want to continue?\nThis will edit the model and make the selected object's vertices, normals and/or colors default to the current morph.", "Are you sure?", MessageBoxButtons.OKCancel) == DialogResult.Cancel)
            {
                return;
            }

            //Set the model to be only the bind pose with the SHP0 applied
            //This is so when the data is unweighted,
            //only the influence of the SHP0 will be set to the model.
            //Otherwise the entire CHR0 pose would be set as well
            float    frame = CurrentFrame;
            SHP0Node shp   = _mainWindow.SelectedSHP0;
            CHR0Node chr   = _mainWindow.SelectedCHR0;

            if (TargetModel != null)
            {
                TargetModel.ApplyCHR(null, 0);
                TargetModel.ApplySHP(shp, frame);
            }

            ResourceNode[] nodes = ((ResourceNode)TargetModel).FindChildrenByName(SelectedSource);
            foreach (ResourceNode n in nodes)
            {
                if (n is MDL0VertexNode)
                {
                    MDL0VertexNode   node = (MDL0VertexNode)n;
                    MDL0ObjectNode[] o    = new MDL0ObjectNode[node._objects.Count];
                    node._objects.CopyTo(o);
                    foreach (MDL0ObjectNode obj in o)
                    {
                        //Set the unweighted positions using the weighted positions
                        //Created using the SHP0
                        obj.Unweight(false);
                        obj.SetEditedAssets(true, true, false, false, false);
                    }
                }
                else if (n is MDL0NormalNode)
                {
                    MDL0NormalNode   node = (MDL0NormalNode)n;
                    MDL0ObjectNode[] o    = new MDL0ObjectNode[node._objects.Count];
                    node._objects.CopyTo(o);
                    foreach (MDL0ObjectNode obj in o)
                    {
                        obj.SetEditedAssets(true, false, true, false, false);
                    }
                }
                else if (n is MDL0ColorNode)
                {
                    MDL0ColorNode    node = (MDL0ColorNode)n;
                    MDL0ObjectNode[] o    = new MDL0ObjectNode[node._objects.Count];
                    node._objects.CopyTo(o);
                    foreach (MDL0ObjectNode obj in o)
                    {
                        obj.SetEditedAssets(true, false, false, true, true);
                    }
                }
            }

            if (TargetModel != null)
            {
                TargetModel.ApplyCHR(chr, frame);
                TargetModel.ApplySHP(shp, frame);
            }
        }