/// <summary>
        /// Initializes rendering
        /// </summary>
        private void InitRendering()
        {
            // set model scale
            JointManager.ModelScale = ModelScale;

            // clear hidden dobjs
            JointManager.DOBJManager.HiddenDOBJs.Clear();

            // don't render bones by default
            JointManager._settings.RenderBones = false;

            // reset model visibility
            ResetModelVis();

            // load the model parts
            LoadModelParts();

            // enable preview box
            previewBox.Visible = true;

            // reselect action
            if (actionList.SelectedItem is Action action)
            {
                SelectAction(action);
            }

            // load bone table if plco is found

            //string DummyModelFile = "PLMrNr.dat";
            //int DummyModelExternalId = 0;

            /*var plcoFile = Path.Combine(Path.GetDirectoryName(MainForm.Instance.FilePath), "PlCo.dat");
             * var plmrFile = Path.Combine(Path.GetDirectoryName(MainForm.Instance.FilePath), DummyModelFile);
             * if (File.Exists(plcoFile) && File.Exists(plmrFile))
             * {
             *  ThrowDummyManager.SetJOBJ(new HSDRawFile(plmrFile).Roots[0].Data as HSD_JOBJ);
             *
             *  ThrowDummyManager._settings.RenderBones = false;
             *
             *  ThrowDummyManager.DOBJManager.OverlayColor = new Vector3(1.5f, 1.5f, 1.5f);
             *
             *  // load bone lookup table
             *  var plco = new HSDRawFile(plcoFile).Roots[0].Data as SBM_ftLoadCommonData;
             *  var lookuptable = plco.BoneTables[DummyModelExternalId]._s.GetReference<HSDByteArray>(0x04);
             *  ThrowDummyLookupTable.Clear();
             *  for (int i = 0; i < 54; i++)
             *  {
             *      var bone = lookuptable[i];
             *      if (bone != 255 && !ThrowDummyLookupTable.ContainsKey(bone))
             *          ThrowDummyLookupTable.Add(bone, i);
             *  }
             * }
             * else*/
            {
                ThrowDummyManager.SetJOBJ(DummyThrowModel.GenerateThrowDummy());
            }
        }
예제 #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="offset"></param>
        /// <param name="size"></param>
        private void LoadAnimation(string symbol)
        {
            // clear animation
            JointManager.SetFigaTree(null);

            // check if animation exists
            if (symbol == null || !SymbolToAnimation.ContainsKey(symbol))
            {
                return;
            }

            // load animation
            var anim = new HSDRawFile(SymbolToAnimation[symbol]);

            if (anim.Roots[0].Data is HSD_FigaTree tree)
            {
                var name = new Action()
                {
                    Symbol = anim.Roots[0].Name
                }.ToString();

                JointManager.SetFigaTree(tree);

                _animEditor.SetJoint(JointManager.GetJOBJ(0), JointManager.Animation);

                viewport.MaxFrame = tree.FrameCount;

                ThrowDummyManager.CleanupRendering();
                ThrowDummyManager = new JOBJManager();

                //AnimationName = name;

                // load throw dummy for thrown animations
                if (name.Contains("Throw") && !name.Contains("Taro"))
                {
                    // find thrown anim
                    Action throwAction = null;
                    foreach (Action a in actionList.Items)
                    {
                        if (a.Symbol != null && a.Symbol.Contains("Taro") && a.Symbol.Contains(name) && !a.Symbol.Equals(anim.Roots[0].Name))
                        {
                            throwAction = a;
                            break;
                        }
                    }

                    if (throwAction != null && throwAction.Symbol != null && SymbolToAnimation.ContainsKey(throwAction.Symbol))
                    {
                        // load throw dummy
                        ThrowDummyManager.SetJOBJ(DummyThrowModel.GenerateThrowDummy());

                        // load throw animation
                        var tanim = new HSDRawFile(SymbolToAnimation[throwAction.Symbol]);
                        if (tanim.Roots[0].Data is HSD_FigaTree tree2)
                        {
                            ThrowDummyManager.SetFigaTree(tree2);
                        }
                    }
                }
            }
        }