Skip to content

Commit

Permalink
Add VerbosityLevel as a built-in enum
Browse files Browse the repository at this point in the history
  • Loading branch information
2shady4u committed Mar 13, 2024
1 parent a90582d commit cf41272
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 9 deletions.
9 changes: 1 addition & 8 deletions demo/addons/godot-krita-importer/krita_import_plugin.gd
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,6 @@
@tool
extends EditorImportPlugin

enum VerbosityLevel {
QUIET,
NORMAL,
VERBOSE,
VERY_VERBOSE
}

var presets : Array[Dictionary] = [
{
"name": "ignore_invisible_layers",
Expand Down Expand Up @@ -61,7 +54,7 @@ func _get_visible_name() -> String:

func _import(source_file: String, save_path: String, options: Dictionary, platform_variants: Array, gen_files: Array) -> int:
var importer = KraImporter.new()
importer.verbosity_level = VerbosityLevel.QUIET
importer.verbosity_level = KraImporter.VerbosityLevel.QUIET

var scene := PackedScene.new()
var node := Node2D.new()
Expand Down
6 changes: 6 additions & 0 deletions src/godot_kra_importer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ void KraImporter::_bind_methods()
ClassDB::bind_method(D_METHOD("set_verbosity_level"), &KraImporter::set_verbosity_level);
ClassDB::bind_method(D_METHOD("get_verbosity_level"), &KraImporter::get_verbosity_level);
ADD_PROPERTY(PropertyInfo(Variant::INT, "verbosity_level"), "set_verbosity_level", "get_verbosity_level");

// Constants.
BIND_ENUM_CONSTANT(QUIET);
BIND_ENUM_CONSTANT(NORMAL);
BIND_ENUM_CONSTANT(VERBOSE);
BIND_ENUM_CONSTANT(VERY_VERBOSE);
}

KraImporter::KraImporter()
Expand Down
14 changes: 13 additions & 1 deletion src/godot_kra_importer.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,21 +27,33 @@ namespace godot
static void _bind_methods();

public:
// Constants.
enum VerbosityLevel {
QUIET = 0,
NORMAL = 1,
VERBOSE = 2,
VERY_VERBOSE = 3
};

KraImporter();
~KraImporter();

// Functions.
void load(String p_path);

Dictionary get_layer_data_at(int p_layer_index);
Dictionary get_layer_data_with_uuid(String p_uuid);

// Properties.
void set_layer_count(int p_layer_count);
int get_layer_count();

void set_verbosity_level(int p_verbosity_level);
int get_verbosity_level();
};

}
} //namespace godot

VARIANT_ENUM_CAST(KraImporter::VerbosityLevel);

#endif // KRA_IMPORTER_H

0 comments on commit cf41272

Please sign in to comment.