@@ -1859,7 +1859,7 @@ bool Project::ExportPOVRay(const QString& FileName)
1859
1859
lcPiecesLibrary* Library = lcGetPiecesLibrary ();
1860
1860
std::map<const PieceInfo*, std::pair<char [LC_PIECE_NAME_LEN + 1 ], int >> PieceTable;
1861
1861
size_t NumColors = gColorList .size ();
1862
- std::vector<std::array< char , LC_MAX_COLOR_NAME + 3 > > LgeoColorTable (NumColors);
1862
+ std::vector<std::string > LgeoColorTable (NumColors);
1863
1863
std::vector<std::array<char , LC_MAX_COLOR_NAME + 3 >> ColorTable (NumColors);
1864
1864
1865
1865
const std::vector<std::unique_ptr<lcLight>>& Lights = gMainWindow ->GetActiveModel ()->GetLights ();
@@ -2291,12 +2291,12 @@ bool Project::ExportPOVRay(const QString& FileName)
2291
2291
if (sscanf (Line," %d%s%s" , &Code, Name, Flags) != 3 )
2292
2292
continue ;
2293
2293
2294
- size_t ColorIdx = lcGetColorIndex (Code);
2295
- if (ColorIdx >= NumColors)
2294
+ size_t ColorIndex = lcGetColorIndex (Code);
2295
+
2296
+ if (ColorIndex >= NumColors)
2296
2297
continue ;
2297
2298
2298
- strncpy (LgeoColorTable[ColorIdx].data (), Name, LgeoColorTable[ColorIdx].size ());
2299
- LgeoColorTable[ColorIdx][LgeoColorTable[ColorIdx].size () - 1 ] = 0 ;
2299
+ LgeoColorTable[ColorIndex] = Name;
2300
2300
}
2301
2301
}
2302
2302
@@ -2308,7 +2308,7 @@ bool Project::ExportPOVRay(const QString& FileName)
2308
2308
{
2309
2309
lcColor* Color = &gColorList [ColorIdx];
2310
2310
2311
- if (! LgeoColorTable[ColorIdx][ 0 ] )
2311
+ if (LgeoColorTable[ColorIdx]. empty () )
2312
2312
{
2313
2313
sprintf (ColorTable[ColorIdx].data (), " lc_%s" , Color->SafeName );
2314
2314
@@ -2339,7 +2339,7 @@ bool Project::ExportPOVRay(const QString& FileName)
2339
2339
sprintf (ColorTable[ColorIdx].data (), " LDXColor%i" , Color->Code );
2340
2340
2341
2341
sprintf (Line," #ifndef (LDXColor%i) // %s\n #declare LDXColor%i = material { texture { %s } }\n #end\n\n " ,
2342
- Color->Code , Color->Name , Color->Code , LgeoColorTable[ColorIdx].data ());
2342
+ Color->Code , Color->Name , Color->Code , LgeoColorTable[ColorIdx].c_str ());
2343
2343
}
2344
2344
2345
2345
POVFile.WriteLine (Line);
@@ -2354,12 +2354,12 @@ bool Project::ExportPOVRay(const QString& FileName)
2354
2354
2355
2355
sprintf (ColorTable[ColorIdx].data (), " LDXColor%i" , Color->Code );
2356
2356
2357
- if (! LgeoColorTable[ColorIdx][ 0 ] )
2357
+ if (LgeoColorTable[ColorIdx]. empty () )
2358
2358
sprintf (Line, " #ifndef (lc_%s)\n #declare lc_%s = OpaqueColor(%g, %g, %g)\n #end\n\n " ,
2359
2359
Color->SafeName , Color->SafeName , Color->Value [0 ], Color->Value [1 ], Color->Value [2 ]);
2360
2360
else
2361
2361
sprintf (Line," #ifndef (LDXColor%i) // %s\n #declare LDXColor%i = material { texture { %s } }\n #end\n\n " ,
2362
- Color->Code , Color->Name , Color->Code , LgeoColorTable[ColorIdx].data ());
2362
+ Color->Code , Color->Name , Color->Code , LgeoColorTable[ColorIdx].c_str ());
2363
2363
2364
2364
POVFile.WriteLine (Line);
2365
2365
}
0 commit comments