Exemplo n.º 1
0
void AppSettings::ReadSettings(string iniFile)
{
   NameValueCollection settings = ReadIniSection(Name.c_str(), iniFile.c_str());

   // expand indirect values first
   for (NameValueCollection::iterator itr = settings.begin(), end = settings.end(); itr != end; ++itr)
      itr->second = GetIndirectValue(itr->second.c_str());

   // next expand qualifiers
   for (NameValueCollection::iterator itr = settings.begin(), end = settings.end(); itr != end; ++itr)
      itr->second = ExpandQualifiers(itr->second.c_str(), settings);

   // finally expand environment variables, last because it clobbers my custom qualifier expansion
   for (NameValueCollection::iterator itr = settings.begin(), end = settings.end(); itr != end; ++itr)
      itr->second = ExpandEnvironment(itr->second);

   std::swap(Environment, settings);

   rootPath = GetSetting<string>("RootPath");
   rootPaths = TokenizeString(GetSetting<string>("RootPaths").c_str(), ";");
   searchPaths = TokenizeString(GetSetting<string>("TextureSearchPaths").c_str(), ";");
   extensions = TokenizeString(GetSetting<string>("TextureExtensions").c_str(), ";");
   textureRootPaths = TokenizeString(GetSetting<string>("TextureRootPaths").c_str(), ";");

   Skeleton = GetSetting<string>("Skeleton");
   useSkeleton = GetSetting<bool>("UseSkeleton", useSkeleton);
   goToSkeletonBindPosition = GetSetting<bool>("GoToSkeletonBindPosition", goToSkeletonBindPosition);
   disableCreateNubsForBones = GetSetting<bool>("DisableCreateNubsForBones", disableCreateNubsForBones);
   applyOverallTransformToSkinAndBones = GetSetting<int>("ApplyOverallTransformToSkinAndBones", -1);

   dummyNodeMatches = TokenizeString(GetSetting<string>("DummyNodeMatches").c_str(), ";");
}
void AppSettings::ReadSettings(tstring iniFile)
{
	NameValueCollection settings = ReadIniSection(Name.c_str(), iniFile.c_str());

	// expand indirect values first
	for (NameValueCollection::iterator itr = settings.begin(), end = settings.end(); itr != end; ++itr)
		itr->second = GetIndirectValue(itr->second.c_str());

	// next expand qualifiers
	for (NameValueCollection::iterator itr = settings.begin(), end = settings.end(); itr != end; ++itr)
		itr->second = ExpandQualifiers(itr->second.c_str(), settings);

	// finally expand environment variables, last because it clobbers my custom qualifier expansion
	for (NameValueCollection::iterator itr = settings.begin(), end = settings.end(); itr != end; ++itr)
		itr->second = ExpandEnvironment(itr->second);

	std::swap(Environment, settings);

	NiVersion = GetSetting<tstring>(TEXT("NiVersion"), TEXT("20.0.0.5"));
	NiUserVersion = GetSetting<int>(TEXT("NiUserVersion"), 0);
	NiUserVersion2 = GetSetting<int>(TEXT("NiUserVersion2"), 0);

	rootPath = GetSetting<tstring>(TEXT("RootPath"));
	rootPaths = TokenizeString(GetSetting<tstring>(TEXT("RootPaths")).c_str(), TEXT(";"));
	searchPaths = TokenizeString(GetSetting<tstring>(TEXT("TextureSearchPaths")).c_str(), TEXT(";"));
	extensions = TokenizeString(GetSetting<tstring>(TEXT("TextureExtensions")).c_str(), TEXT(";"));
	textureRootPaths = TokenizeString(GetSetting<tstring>(TEXT("TextureRootPaths")).c_str(), TEXT(";"));
	materialRootPaths = TokenizeString(GetSetting<tstring>(TEXT("MaterialPaths")).c_str(), TEXT(";"));

	Skeleton = GetSetting<tstring>(TEXT("Skeleton"));
	useSkeleton = GetSetting<bool>(TEXT("UseSkeleton"), useSkeleton);
	skeletonSearchPaths = TokenizeString(GetSetting<tstring>(TEXT("SkeletonSearchPaths"), TEXT(".")).c_str(), TEXT(";"));

	goToSkeletonBindPosition = GetSetting<bool>(TEXT("GoToSkeletonBindPosition"), goToSkeletonBindPosition);
	disableCreateNubsForBones = GetSetting<bool>(TEXT("DisableCreateNubsForBones"), disableCreateNubsForBones);
	applyOverallTransformToSkinAndBones = GetSetting<int>(TEXT("ApplyOverallTransformToSkinAndBones"), -1);
	textureUseFullPath = GetSetting<int>(TEXT("TextureUseFullPath"), textureUseFullPath);

	dummyNodeMatches = TokenizeString(GetSetting<tstring>(TEXT("DummyNodeMatches")).c_str(), TEXT(";"));
	rotate90Degrees = TokenizeString(GetSetting<tstring>(TEXT("Rotate90Degrees")).c_str(), TEXT(";"));
	supportPrnStrings = GetSetting<bool>(TEXT("SupportPrnStrings"), supportPrnStrings);
	doNotReuseExistingBones = GetSetting<bool>(TEXT("DoNotReuseExistingBones"), doNotReuseExistingBones);

	skeletonCheck = GetSetting<tstring>(TEXT("SkeletonCheck"));
}
Exemplo n.º 3
0
void Exporter::readConfig(Interface *i)
{
   if (mUseRegistry)
   {
      HKEY hKey;
      if (RegCreateKey(HKEY_CURRENT_USER, REGPATH, &hKey) != ERROR_SUCCESS)
         return;

      DWORD ver;
      regGet(hKey, _T("npx_ver"), ver);
      regGet(hKey, _T("npx_tristrips"), mTriStrips);
      regGet(hKey, _T("npx_hidden"), mExportHidden);
      regGet(hKey, _T("npx_furn"), mExportFurn);
      regGet(hKey, _T("npx_lights"), mExportLights);
      regGet(hKey, _T("npx_vcolors"), mVertexColors);
      //	regGet(hKey, "npx_wthresh", mWeldThresh);
      regGet(hKey, _T("npx_tprefix"), mTexPrefix);
      regGet(hKey, _T("npx_coll"), mExportCollision);
      regGet(hKey, _T("npx_remap"), mRemapIndices);
   }
   else
   {
      TCHAR iniName[MAX_PATH];
      GetIniFileName(iniName);

      // mVersion = GetIniValue<int>(NifExportSection, "Version", 013, iniName);
      mTriStrips = GetIniValue<bool>(NifExportSection, _T("GenerateStrips"), true, iniName);
      mExportHidden = GetIniValue<bool>(NifExportSection, _T("IncludeHidden"), false, iniName);
      mExportFurn = GetIniValue<bool>(NifExportSection, _T("FurnatureMarkers"), true, iniName);
      mExportLights = GetIniValue<bool>(NifExportSection, _T("Lights"), false, iniName);
      mVertexColors = GetIniValue<bool>(NifExportSection, _T("VertexColors"), true, iniName);
      mWeldThresh = GetIniValue<float>(NifExportSection, _T("WeldVertexThresh"), 0.01f, iniName);
      mNormThresh = GetIniValue<float>(NifExportSection, _T("WeldNormThresh"), 0.01f, iniName);
      mUVWThresh = GetIniValue<float>(NifExportSection, _T("WeldUVWThresh"), 0.01f, iniName);

      mTexPrefix = GetIniValue<std::wstring>(NifExportSection, _T("TexturePrefix"), _T("textures"), iniName);
      mExportCollision = GetIniValue<bool>(NifExportSection, _T("ExportCollision"), true, iniName);
      mRemapIndices = GetIniValue(NifExportSection, _T("RemapIndices"), true, iniName);

      mExportExtraNodes = GetIniValue(NifExportSection, _T("ExportExtraNodes"), false, iniName);
      mExportSkin = GetIniValue(NifExportSection, _T("ExportSkin"), false, iniName);
      mUserPropBuffer = GetIniValue(NifExportSection, _T("UserPropBuffer"), false, iniName);
      mFlattenHierarchy = GetIniValue(NifExportSection, _T("FlattenHierarchy"), false, iniName);
      mRemoveUnreferencedBones = GetIniValue(NifExportSection, _T("RemoveUnreferencedBones"), false, iniName);
      mSortNodesToEnd = GetIniValue(NifExportSection, _T("SortNodesToEnd"), false, iniName);
      mSkeletonOnly = GetIniValue(NifExportSection, _T("SkeletonOnly"), false, iniName);
      mExportCameras = GetIniValue(NifExportSection, _T("Cameras"), false, iniName);
      mGenerateBoneCollision = GetIniValue(NifExportSection, _T("GenerateBoneCollision"), false, iniName);

      mExportTransforms = GetIniValue(KfExportSection, _T("Transforms"), true, iniName);
      mDefaultPriority = GetIniValue<float>(KfExportSection, _T("Priority"), 0.0f, iniName);
      mExportType = ExportType(GetIniValue<int>(NifExportSection, _T("ExportType"), NIF_WO_ANIM, iniName));

      mMultiplePartitions = GetIniValue(NifExportSection, _T("MultiplePartitions"), false, iniName);
      mBonesPerVertex = GetIniValue<int>(NifExportSection, _T("BonesPerVertex"), 4, iniName);     
      mBonesPerPartition = GetIniValue<int>(NifExportSection, _T("BonesPerPartition"), 20, iniName);

      // mUseTimeTags = GetIniValue(NifExportSection, "UseTimeTags", false, iniName);
      mAllowAccum = GetIniValue(NifExportSection, _T("AllowAccum"), true, iniName);
      mCollapseTransforms = GetIniValue(NifExportSection, _T("CollapseTransforms"), false, iniName);
      mZeroTransforms = GetIniValue(NifExportSection, _T("ZeroTransforms"), false, iniName);
      mFixNormals = GetIniValue(NifExportSection, _T("FixNormals"), false, iniName);
      mTangentAndBinormalExtraData = GetIniValue(NifExportSection, _T("TangentAndBinormalExtraData"), false, iniName);
      mTangentAndBinormalMethod = GetIniValue<int>(NifExportSection, _T("TangentAndBinormalMethod"), 0, iniName);

      mUseAlternateStripper = GetIniValue(NifExportSection, _T("UseAlternateStripper"), false, iniName);
      mCreatorName = GetIniValue<std::wstring>(NifExportSection, _T("Creator"), _T(""), iniName);

      bhkScaleFactor = GetIniValue<float>(CollisionSection, _T("bhkScaleFactor"), 7.0f, iniName);

      mStartNifskopeAfterStart = GetIniValue(NifExportSection, _T("StartNifskopeAfterStart"), false, iniName);
      mNifskopeDir = ExpandEnvironment(GetIndirectValue(GetIniValue<std::wstring>(_T("System"), _T("NifskopeDir"), _T(""), iniName).c_str()));
      mTriPartStrips = GetIniValue<bool>(NifExportSection, _T("GeneratePartitionStrips"), true, iniName);

	  mRootType = GetIniValue<std::wstring>(NifExportSection, _T("RootType"), _T("NiNode"), iniName);
	  mRootTypes = TokenizeString(GetIniValue<std::wstring>(NifExportSection, _T("RootTypes"), _T("NiNode;BSFadeNode"), iniName).c_str(), _T(";"));
  }
}