During 0.62.01 release I did not apply the commit from nikitakit branch that enables the save and load palette to disk.
After the release, nikitakit has merged the stable branch to its devel branch and I’ve compiled and build it. It builds fine and I’ve tested the save-load palette feature.
Here is the result:
youtube.com/watch?v=Y-3ItiGSV4Y
And here is the palette file saved:
my-palette.spal.txt (1.52 KB)
I would like to fix that bug before apply the devel branch to master
-G
Weird… your palette file loaded perfectly on my machine, exactly as was displayed in the video. I’ll run through the code again to see if there’s anything wrong there.
Could you do me a favor and run a little debugging test? After line 355 in “synfig-core/src/synfig/palette.cpp”, add a quick statement to print out the color: “info(item.color.get_hex());”. On my machine, this correctly prints out all the colors in the palette (see below), but I’d like to know what happens on yours.
synfig(27508) [07:24:32 PM] info: 000000
synfig(27508) [07:24:32 PM] info: 000000
synfig(27508) [07:24:32 PM] info: 191919
synfig(27508) [07:24:32 PM] info: 333333
synfig(27508) [07:24:32 PM] info: 4c4c4c
synfig(27508) [07:24:32 PM] info: 666666
synfig(27508) [07:24:32 PM] info: 7f7f7f
synfig(27508) [07:24:32 PM] info: 999999
..................
This is what i get.
synfig(13596) [16:39:16] información: 000000
synfig(13596) [16:39:16] información: 000000
synfig(13596) [16:39:16] información: 000000
synfig(13596) [16:39:16] información: 000000
synfig(13596) [16:39:16] información: 000000
synfig(13596) [16:39:16] información: 000000
synfig(13596) [16:39:16] información: 000000
synfig(13596) [16:39:16] información: 000000
synfig(13596) [16:39:16] información: 000000
synfig(13596) [16:39:16] información: 000000
synfig(13596) [16:39:16] información: 000000
synfig(13596) [16:39:16] información: ffffff
synfig(13596) [16:39:16] información: 000000
synfig(13596) [16:39:16] información: 000000
synfig(13596) [16:39:16] información: 000000
synfig(13596) [16:39:16] información: 000000
synfig(13596) [16:39:16] información: 000000
synfig(13596) [16:39:16] información: 000000
synfig(13596) [16:39:16] información: 000000
synfig(13596) [16:39:16] información: 000000
synfig(13596) [16:39:16] información: 000000
synfig(13596) [16:39:16] información: 000000
synfig(13596) [16:39:16] información: 000000
synfig(13596) [16:39:16] información: 000000
synfig(13596) [16:39:16] información: ff0000
synfig(13596) [16:39:16] información: ff0000
synfig(13596) [16:39:16] información: ffff00
synfig(13596) [16:39:16] información: 00ff00
synfig(13596) [16:39:16] información: 00ff00
synfig(13596) [16:39:16] información: 00ff00
synfig(13596) [16:39:16] información: 00ffff
synfig(13596) [16:39:16] información: 0000ff
synfig(13596) [16:39:16] información: 0000ff
synfig(13596) [16:39:16] información: 0000ff
synfig(13596) [16:39:16] información: ff00ff
synfig(13596) [16:39:16] información: ff0000
..............
I’ve added other debug lines to display the read line and it seems to be fine. The problem comes from atof() function because the string is not properly converted to double.
synfig(26193) [16:47:28] información: r 0.111111
synfig(26193) [16:47:28] información: g 0
synfig(26193) [16:47:28] información: b 0.0536731
synfig(26193) [16:47:28] información: a 1
synfig(26193) [16:47:28] información: 000000
synfig(26193) [16:47:28] información: r 1
synfig(26193) [16:47:28] información: g 0.423444
synfig(26193) [16:47:28] información: b 1
synfig(26193) [16:47:28] información: a 1
synfig(26193) [16:47:28] información: ff00ff
synfig(26193) [16:47:28] información: r 1
synfig(26193) [16:47:28] información: g 0.0531642
synfig(26193) [16:47:28] información: b 1
synfig(26193) [16:47:28] información: a 1
synfig(26193) [16:47:28] información: ff00ff
synfig(26193) [16:47:28] información: r 0.0321346
synfig(26193) [16:47:28] información: g 0.407131
synfig(26193) [16:47:28] información: b 0.076777
synfig(26193) [16:47:28] información: a 1
synfig(26193) [16:47:28] información: 000000
Maybe it is due I’m using a 64 bit system?
I’ll continue digging what can be the problem.
-G
These changes works fine here but reads two times the last color in the palette:
[code]@@ -331,29 +331,18 @@ Palette::load_from_file(const synfig::String& filename)
getline(file,ret.name_);
while(!file.eof())
{
PaletteItem item;
-
String n;
-
float r,g,b,a; getline(file,item.name);
-
if(file.eof())break;
-
getline(file,line);
-
if(file.eof())break;
-
item.color.set_r(atof(line.c_str()));
-
getline(file,line);
-
if(file.eof())break;
-
item.color.set_g(atof(line.c_str()));
-
getline(file,line);
-
if(file.eof())break;
-
item.color.set_b(atof(line.c_str()));
-
getline(file,line);
-
if(file.eof())break;
-
item.color.set_a(atof(line.c_str()));
-
file>>r>>g>>b>>a;
-
item.name=n;
-
item.color.set_r(r);
-
item.color.set_g(g);
-
item.color.set_b(b);
-
}item.color.set_a(a); ret.push_back(item);
- return ret;
}
[/code]