Changed: Replaced atof by NLMISC::fromString

This commit is contained in:
kervala 2014-07-19 11:14:38 +02:00
parent ca4c302c6a
commit 8d2db7bc85
6 changed files with 18 additions and 13 deletions

View file

@ -62,7 +62,7 @@ int main(int argc, char *argv[])
float bakeFrameRate= 20;
if(argc>=5)
{
bakeFrameRate= (float)atof(argv[4]);
NLMISC::fromString(argv[4], bakeFrameRate);
if(bakeFrameRate<=1)
{
nlwarning("bad bakeFrameRate value, use a default of 20");

View file

@ -67,7 +67,9 @@ uint CEditEx::getUInt() const
float CEditEx::getFloat() const
{
nlassert(_Type == FloatType);
return (float) ::atof(getString().c_str());
float val;
NLMISC::fromString(getString(), val);
return val;
}
std::string CEditEx::getString() const

View file

@ -1392,9 +1392,9 @@ void CMainFrame::OnViewSetSceneRotation()
if (sceneRotDlg.DoModal() == IDOK)
{
// read value.
_LastSceneRotX= (float)atof(sceneRotDlg.RotX);
_LastSceneRotY= (float)atof(sceneRotDlg.RotY);
_LastSceneRotZ= (float)atof(sceneRotDlg.RotZ);
NLMISC::fromString(sceneRotDlg.RotX, _LastSceneRotX);
NLMISC::fromString(sceneRotDlg.RotY, _LastSceneRotY);
NLMISC::fromString(sceneRotDlg.RotZ, _LastSceneRotZ);
float rotx= degToRad(_LastSceneRotX);
float roty= degToRad(_LastSceneRotY);
float rotz= degToRad(_LastSceneRotZ);

View file

@ -225,7 +225,8 @@ void CVegetableDensityPage::updateAngleMinFromEditText()
// get angles edited.
char stmp[256];
AngleMinEdit.GetWindowText(stmp, 256);
float angleMin= (float)atof(stmp);
float angleMin;
NLMISC::fromString(stmp, angleMin);
NLMISC::clamp(angleMin, -90, 90);
// make a sinus, because 90 => 1, and -90 =>-1
float cosAngleMin= (float)sin(angleMin*NLMISC::Pi/180.f);
@ -248,7 +249,8 @@ void CVegetableDensityPage::updateAngleMaxFromEditText()
// get angles edited.
char stmp[256];
AngleMaxEdit.GetWindowText(stmp, 256);
float angleMax= (float)atof(stmp);
float angleMax;
NLMISC::fromString(stmp, angleMax);
NLMISC::clamp(angleMax, -90, 90);
// make a sinus, because 90 => 1, and -90 =>-1
float cosAngleMax= (float)sin(angleMax*NLMISC::Pi/180.f);

View file

@ -173,7 +173,7 @@ INT_PTR CALLBACK OptionsDialogCallback (
if( SendMessage( GetDlgItem(hwndDlg,IDC_RADIORADIOSITYEXPORTLIGHTING), BM_GETCHECK, 0, 0 ) == BST_CHECKED )
theExportSceneStruct.nExportLighting = 1;
SendMessage( GetDlgItem(hwndDlg,IDC_EDITLUMELSIZE), WM_GETTEXT, 1024, (long)tmp );
theExportSceneStruct.rLumelSize = (float)atof( tmp );
NLMISC::fromString(tmp, theExportSceneStruct.rLumelSize);
if( SendMessage( GetDlgItem(hwndDlg,IDC_RADIOSS1), BM_GETCHECK, 0, 0 ) == BST_CHECKED )
theExportSceneStruct.nOverSampling = 1;
@ -192,9 +192,9 @@ INT_PTR CALLBACK OptionsDialogCallback (
// SurfaceLighting
theExportSceneStruct.bTestSurfaceLighting= (SendMessage( GetDlgItem(hwndDlg,IDC_TEST_SURFACE_LIGHT), BM_GETCHECK, 0, 0 ) == BST_CHECKED);
SendMessage( GetDlgItem(hwndDlg,IDC_EDITCELLSIZE), WM_GETTEXT, 1024, (long)tmp );
theExportSceneStruct.SurfaceLightingCellSize= (float)atof( tmp );
NLMISC::fromString(tmp, theExportSceneStruct.SurfaceLightingCellSize);
SendMessage( GetDlgItem(hwndDlg,IDC_EDITCELLDELTAZ), WM_GETTEXT, 1024, (long)tmp );
theExportSceneStruct.SurfaceLightingDeltaZ= (float)atof( tmp );
NLMISC::fromString(tmp, theExportSceneStruct.SurfaceLightingDeltaZ);
// End the dialog
EndDialog(hwndDlg, TRUE);

View file

@ -300,9 +300,9 @@ void SLightBuild::convertFromMaxLight (INode *node,TimeValue tvTime)
// Get Soft Shadow information
string sTmp = CExportNel::getScriptAppData (node, NEL3D_APPDATA_SOFTSHADOW_RADIUS, toString(NEL3D_APPDATA_SOFTSHADOW_RADIUS_DEFAULT));
this->rSoftShadowRadius = (float)atof(sTmp.c_str());
NLMISC::fromString(sTmp, this->rSoftShadowRadius);
sTmp = CExportNel::getScriptAppData (node, NEL3D_APPDATA_SOFTSHADOW_CONELENGTH, toString(NEL3D_APPDATA_SOFTSHADOW_CONELENGTH_DEFAULT));
this->rSoftShadowConeLength = (float)atof(sTmp.c_str());
NLMISC::fromString(sTmp, this->rSoftShadowConeLength);
if( deleteIt )
maxLight->DeleteThis();
@ -2147,7 +2147,8 @@ bool CExportNel::calculateLM( CMesh::CMeshBuild *pZeMeshBuild, CMeshBase::CMeshB
// **** Retrieve Shape Node properties
string sLumelSizeMul = CExportNel::getScriptAppData (&ZeNode, NEL3D_APPDATA_LUMELSIZEMUL, "1.0");
float rLumelSizeMul = (float)atof(sLumelSizeMul.c_str());
float rLumelSizeMul;
NLMISC::fromString(sLumelSizeMul, rLumelSizeMul);
// 8Bits LightMap Compression
bool lmcEnabled= CExportNel::getScriptAppData (&ZeNode, NEL3D_APPDATA_EXPORT_LMC_ENABLED, BST_UNCHECKED)==BST_CHECKED;
enum {NumLightGroup= 3};