add default_omit and -omitall
This commit is contained in:
parent
07b77f24cc
commit
af3ef86096
|
|
@ -191,6 +191,16 @@ EggPalettize() : EggMultiFilter(true) {
|
|||
"to be rebuilt if necessary to optimize the packing, but this "
|
||||
"may invalidate other egg files which share this palette.",
|
||||
&EggPalettize::dispatch_none, &_optimal);
|
||||
add_option
|
||||
("omitall", "", 0,
|
||||
"Re-enables the flag to omit all textures. This flag is normally on "
|
||||
"by default, causing nothing actually to be palettized, until the "
|
||||
"first time egg-palettize is run with the -opt flag, which turns off "
|
||||
"the omitall flag and thenceforth allows textures to be combined "
|
||||
"into palettes. Specifying this flag restores the original behavior "
|
||||
"of keeping every texture as a separate image (which is convenient for "
|
||||
"development).",
|
||||
&EggPalettize::dispatch_none, &_omitall);
|
||||
|
||||
// This isn't even implemented yet. Presently, we never lock anyway.
|
||||
// Dangerous, but hard to implement reliable file locking across
|
||||
|
|
@ -600,6 +610,9 @@ run() {
|
|||
<< " does not exist; starting palettization from scratch.\n";
|
||||
pal = new Palettizer;
|
||||
|
||||
// By default, the -omitall flag is true from the beginning.
|
||||
pal->_omit_everything = true;
|
||||
|
||||
} else {
|
||||
// Read the Palettizer object from the Bam file written
|
||||
// previously. This will recover all of the state saved from the
|
||||
|
|
@ -716,6 +729,12 @@ run() {
|
|||
// vice-versa.
|
||||
pal->_omit_solitary = _optimal;
|
||||
|
||||
if (_omitall) {
|
||||
pal->_omit_everything = true;
|
||||
} else if (_optimal) {
|
||||
pal->_omit_everything = false;
|
||||
}
|
||||
|
||||
pal->all_params_set();
|
||||
|
||||
// Remove any files named for removal.
|
||||
|
|
|
|||
|
|
@ -66,6 +66,7 @@ private:
|
|||
bool _report_statistics;
|
||||
bool _all_textures;
|
||||
bool _optimal;
|
||||
bool _omitall;
|
||||
bool _redo_all;
|
||||
bool _redo_eggs;
|
||||
bool _dont_lock_txa;
|
||||
|
|
|
|||
|
|
@ -44,6 +44,9 @@ operator << (ostream &out, OmitReason omit) {
|
|||
|
||||
case OR_unused:
|
||||
return out << "unused";
|
||||
|
||||
case OR_default_omit:
|
||||
return out << "default_omit";
|
||||
}
|
||||
|
||||
return out << "**invalid**(" << (int)omit << ")";
|
||||
|
|
|
|||
|
|
@ -53,6 +53,9 @@ enum OmitReason {
|
|||
OR_unused,
|
||||
// The texture is no longer used by any of the egg files that
|
||||
// formerly referenced it.
|
||||
|
||||
OR_default_omit,
|
||||
// The texture is omitted because _omit_everything is set true.
|
||||
};
|
||||
|
||||
ostream &operator << (ostream &out, OmitReason omit);
|
||||
|
|
|
|||
|
|
@ -41,13 +41,14 @@ Palettizer *pal = (Palettizer *)NULL;
|
|||
// allows us to easily update egg-palettize to write out additional
|
||||
// information to its pi file, without having it increment the bam
|
||||
// version number for all bam and boo files anywhere in the world.
|
||||
int Palettizer::_pi_version = 13;
|
||||
int Palettizer::_pi_version = 14;
|
||||
// Updated to version 8 on 3/20/03 to remove extensions from texture key names.
|
||||
// Updated to version 9 on 4/13/03 to add a few properties in various places.
|
||||
// Updated to version 10 on 4/15/03 to add _alpha_file_channel.
|
||||
// Updated to version 11 on 4/30/03 to add TextureReference::_tref_name.
|
||||
// Updated to version 12 on 9/11/03 to add _generated_image_pattern.
|
||||
// Updated to version 13 on 9/13/03 to add _keep_format and _background.
|
||||
// Updated to version 14 on 7/26/06 to add _omit_everything.
|
||||
|
||||
int Palettizer::_min_pi_version = 8;
|
||||
// Dropped support for versions 7 and below on 7/14/03.
|
||||
|
|
@ -109,6 +110,7 @@ Palettizer() {
|
|||
_shadow_dirname = "shadow";
|
||||
_margin = 2;
|
||||
_omit_solitary = false;
|
||||
_omit_everything = false;
|
||||
_coverage_threshold = 2.5;
|
||||
_aggressively_clean_mapdir = true;
|
||||
_force_power_2 = true;
|
||||
|
|
@ -199,6 +201,7 @@ report_pi() const {
|
|||
<< " force textures to power of 2: " << yesno(_force_power_2) << "\n"
|
||||
<< " aggressively clean the map directory: "
|
||||
<< yesno(_aggressively_clean_mapdir) << "\n"
|
||||
<< " omit everything: " << yesno(_omit_everything) << "\n"
|
||||
<< " round UV area: " << yesno(_round_uvs) << "\n";
|
||||
if (_round_uvs) {
|
||||
cout << " round UV area to nearest " << _round_unit << " with fuzz "
|
||||
|
|
@ -996,6 +999,7 @@ write_datagram(BamWriter *writer, Datagram &datagram) {
|
|||
datagram.add_float64(_background[3]);
|
||||
datagram.add_int32(_margin);
|
||||
datagram.add_bool(_omit_solitary);
|
||||
datagram.add_bool(_omit_everything);
|
||||
datagram.add_float64(_coverage_threshold);
|
||||
datagram.add_bool(_force_power_2);
|
||||
datagram.add_bool(_aggressively_clean_mapdir);
|
||||
|
|
@ -1144,6 +1148,9 @@ fillin(DatagramIterator &scan, BamReader *manager) {
|
|||
}
|
||||
_margin = scan.get_int32();
|
||||
_omit_solitary = scan.get_bool();
|
||||
if (_read_pi_version >= 14) {
|
||||
_omit_everything = scan.get_bool();
|
||||
}
|
||||
_coverage_threshold = scan.get_float64();
|
||||
_force_power_2 = scan.get_bool();
|
||||
_aggressively_clean_mapdir = scan.get_bool();
|
||||
|
|
|
|||
|
|
@ -112,6 +112,7 @@ public:
|
|||
Colord _background;
|
||||
int _margin;
|
||||
bool _omit_solitary;
|
||||
bool _omit_everything;
|
||||
double _coverage_threshold;
|
||||
bool _force_power_2;
|
||||
bool _aggressively_clean_mapdir;
|
||||
|
|
|
|||
|
|
@ -336,7 +336,13 @@ determine_size() {
|
|||
force_replace();
|
||||
_omit_reason = OR_size;
|
||||
|
||||
} else if (pal->_omit_everything) {
|
||||
// If we're omitting everything, omit everything.
|
||||
force_replace();
|
||||
_omit_reason = OR_default_omit;
|
||||
|
||||
} else if (_omit_reason == OR_omitted ||
|
||||
_omit_reason == OR_default_omit ||
|
||||
_omit_reason == OR_size ||
|
||||
_omit_reason == OR_coverage ||
|
||||
_omit_reason == OR_unknown) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue