@@ -223,6 +223,13 @@ static json settings_schema = R"(
223
223
"default": false,
224
224
"type": "boolean"
225
225
},
226
+ "unique_color_change": {
227
+ "description": "The chance of the color of the character to be changed",
228
+ "type": "integer",
229
+ "default": 20,
230
+ "minimum": 0,
231
+ "maximum": 100
232
+ },
226
233
"ready": {
227
234
"description": "Set to 'true' when ready",
228
235
"default": false,
@@ -256,7 +263,7 @@ typedef std::pair<
256
263
257
264
tl::expected<bool , std::string> try_read_settings_json ();
258
265
ThreadOutput generate_images (ThreadInfo thread_info, int start_image_id, int end_image_id);
259
- std::pair<std::list<json>, json> generate_battle (int image_id, int total_character_count, int character_count, Random& random, std::filesystem::path& asset_directory, std::filesystem::path& output_image_directory);
266
+ std::pair<std::list<json>, json> generate_battle (int image_id, int total_character_count, int character_count, int unique_color_change, Random& random, std::filesystem::path& asset_directory, std::filesystem::path& output_image_directory);
260
267
json get_categories ();
261
268
void create_annotations_json (std::filesystem::path& output_directory, json& coco_annotations);
262
269
void create_data_yaml (std::filesystem::path& output_directory);
@@ -448,11 +455,12 @@ ThreadOutput generate_images(ThreadInfo thread_info, int start_image_id, int end
448
455
449
456
int character_min_count (settings_json[" character_min_count" ].get <int >());
450
457
int character_max_count (settings_json[" character_max_count" ].get <int >());
458
+ int unique_color_change (settings_json[" unique_color_change" ].get <int >());
451
459
452
460
int total_character_count = 0 ;
453
461
for (int image_id = start_image_id; image_id < end_image_id; image_id++) {
454
462
int character_count = random .random_int_from_interval (character_min_count, character_max_count);
455
- auto result = generate_battle (image_id, total_character_count, character_count, random , asset_directory, output_image_directory);
463
+ auto result = generate_battle (image_id, total_character_count, character_count, unique_color_change, random , asset_directory, output_image_directory);
456
464
std::list<json> character_coco_objects = result.first ;
457
465
json image_coco_object = result.second ;
458
466
@@ -466,7 +474,7 @@ ThreadOutput generate_images(ThreadInfo thread_info, int start_image_id, int end
466
474
};
467
475
}
468
476
469
- std::pair<std::list<json>, json> generate_battle (int image_id, int total_character_count, int character_count, Random& random, std::filesystem::path& asset_directory, std::filesystem::path& output_image_directory) {
477
+ std::pair<std::list<json>, json> generate_battle (int image_id, int total_character_count, int character_count, int unique_color_change, Random& random, std::filesystem::path& asset_directory, std::filesystem::path& output_image_directory) {
470
478
auto & entity_data_manager = EntityDataManager::getInstance ();
471
479
472
480
spdlog::info (" Generating image {} with {} characters!\n " , image_id, character_count);
@@ -510,7 +518,7 @@ std::pair<std::list<json>, json> generate_battle(int image_id, int total_charact
510
518
static_cast <float >(Random::get_instance ().random_int_from_interval (128 , 954 ))
511
519
};
512
520
character->setPosition (position);
513
- if (random .random_int_from_interval (0 , 1 ) ) {
521
+ if (random .random_int_from_interval (0 , 100 ) <= unique_color_change ) {
514
522
std::vector<EntityEffect> non_stackable_entity_effects_vector (non_stackable_entity_effects);
515
523
do {
516
524
int index = random .random_int_from_interval (0 , non_stackable_entity_effects_vector.size () - 1 );
0 commit comments