Example #1
0
 public bool CopyParamsFrom(BreastDynamicBoneParameter dbParams)
 {
     for (int i = 0; i < targetBoneNames.Count(); i++)
     {
         string boneName = targetBoneNames[i];
         if (!dictParameterSet[boneName].CopyParameterFrom(dbParams.dictParameterSet[boneName]))
         {
             return(false);
         }
     }
     return(true);
 }
        private static bool LoadExtendedData_ver1(ParamCharaController controller)
        {
#if DEBUG
            BreastPhysicsController.Logger.LogDebug("Call LoadExtendedData_ver1");
#endif
            var chaFile  = MakerAPI.LastLoadedChaFile ?? controller.ChaFileControl;
            var dataVer1 = ExtendedSave.GetExtendedDataById(chaFile, ExtendedDataID_ver1);

            if (dataVer1 != null)
            {
#if DEBUG
                BreastPhysicsController.Logger.LogDebug("Found ver1 ExtendedData.");
#endif
                Compatibility.BreastDynamicBoneParameter paramVer1 = new Compatibility.BreastDynamicBoneParameter();
                var byteDBParams = new object();
                if (dataVer1.data.TryGetValue(ExtendedDataKey_ver1, out byteDBParams) && byteDBParams is byte[])
                {
                    if (paramVer1.SetParamByte((byte[])byteDBParams))
                    {
                        BreastPhysicsController.Logger.LogInfo("Loaded ver1 parameters from ExtendedData.");
                        if (paramVer1.CopyParamsTo(controller.paramCustom))
                        {
                            foreach (ParamBustCustom bust in controller.paramCustom.GetAllBustParameters())
                            {
                                bust.enabled = true;
                            }
                            controller.Enabled = true;

                            return(true);
                        }
                        else
                        {
#if DEBUG
                            BreastPhysicsController.Logger.LogDebug("Failed copy ver1 parameters to controller");
#endif
                        }
                    }
                    else
                    {
                        BreastPhysicsController.Logger.LogError("Loaded ver1 parameters from ExtendedData is invalid.");
                    }
                }
            }
#if DEBUG
            BreastPhysicsController.Logger.LogDebug("Not found ver1 plugin data.");
#endif
            return(false);
        }