mirror of
https://github.com/Relintai/props_2d.git
synced 2025-02-04 16:15:57 +01:00
Added default_pixels_per_unit property to the Prop2DCache singleton.
This commit is contained in:
parent
5e12fc6525
commit
37b2ab5b5e
@ -72,6 +72,13 @@ Prop2DCache *Prop2DCache::get_singleton() {
|
|||||||
return _instance;
|
return _instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
float Prop2DCache::get_default_pixels_per_unit() const {
|
||||||
|
return _default_pixels_per_unit;
|
||||||
|
}
|
||||||
|
void Prop2DCache::set_default_pixels_per_unit(const float value) {
|
||||||
|
_default_pixels_per_unit = value;
|
||||||
|
}
|
||||||
|
|
||||||
StringName Prop2DCache::get_default_prop_material_cache_class() {
|
StringName Prop2DCache::get_default_prop_material_cache_class() {
|
||||||
return _default_prop_material_cache_class;
|
return _default_prop_material_cache_class;
|
||||||
}
|
}
|
||||||
@ -332,6 +339,8 @@ Ref<Resource> Prop2DCache::load_resource(const String &path, const String &type_
|
|||||||
Prop2DCache::Prop2DCache() {
|
Prop2DCache::Prop2DCache() {
|
||||||
_instance = this;
|
_instance = this;
|
||||||
|
|
||||||
|
_default_pixels_per_unit = GLOBAL_DEF("props_2d/default_pixels_per_unit", 64);
|
||||||
|
|
||||||
#if TEXTURE_PACKER_PRESENT
|
#if TEXTURE_PACKER_PRESENT
|
||||||
_default_prop_material_cache_class = GLOBAL_DEF("props_2d/default_prop_material_cache_class", "Prop2DMaterialCachePCM");
|
_default_prop_material_cache_class = GLOBAL_DEF("props_2d/default_prop_material_cache_class", "Prop2DMaterialCachePCM");
|
||||||
#else
|
#else
|
||||||
@ -359,6 +368,10 @@ Prop2DCache::~Prop2DCache() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Prop2DCache::_bind_methods() {
|
void Prop2DCache::_bind_methods() {
|
||||||
|
ClassDB::bind_method(D_METHOD("get_default_pixels_per_unit"), &Prop2DCache::get_default_pixels_per_unit);
|
||||||
|
ClassDB::bind_method(D_METHOD("set_default_pixels_per_unit", "value"), &Prop2DCache::set_default_pixels_per_unit);
|
||||||
|
ADD_PROPERTY(PropertyInfo(Variant::REAL, "default_pixels_per_unit"), "set_default_pixels_per_unit", "get_default_pixels_per_unit");
|
||||||
|
|
||||||
ClassDB::bind_method(D_METHOD("get_default_prop_material_cache_class"), &Prop2DCache::get_default_prop_material_cache_class);
|
ClassDB::bind_method(D_METHOD("get_default_prop_material_cache_class"), &Prop2DCache::get_default_prop_material_cache_class);
|
||||||
ClassDB::bind_method(D_METHOD("set_default_prop_material_cache_class", "cls_name"), &Prop2DCache::set_default_prop_material_cache_class);
|
ClassDB::bind_method(D_METHOD("set_default_prop_material_cache_class", "cls_name"), &Prop2DCache::set_default_prop_material_cache_class);
|
||||||
ADD_PROPERTY(PropertyInfo(Variant::STRING, "default_prop_material_cache_class"), "set_default_prop_material_cache_class", "get_default_prop_material_cache_class");
|
ADD_PROPERTY(PropertyInfo(Variant::STRING, "default_prop_material_cache_class"), "set_default_prop_material_cache_class", "get_default_prop_material_cache_class");
|
||||||
|
@ -56,6 +56,9 @@ class Prop2DCache : public Object {
|
|||||||
public:
|
public:
|
||||||
static Prop2DCache *get_singleton();
|
static Prop2DCache *get_singleton();
|
||||||
|
|
||||||
|
float get_default_pixels_per_unit() const;
|
||||||
|
void set_default_pixels_per_unit(const float value);
|
||||||
|
|
||||||
StringName get_default_prop_material_cache_class();
|
StringName get_default_prop_material_cache_class();
|
||||||
void set_default_prop_material_cache_class(const StringName &cls_name);
|
void set_default_prop_material_cache_class(const StringName &cls_name);
|
||||||
|
|
||||||
@ -105,6 +108,8 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
static void _bind_methods();
|
static void _bind_methods();
|
||||||
|
|
||||||
|
float _default_pixels_per_unit;
|
||||||
|
|
||||||
StringName _default_prop_material_cache_class;
|
StringName _default_prop_material_cache_class;
|
||||||
|
|
||||||
Map<uint64_t, Ref<Prop2DMaterialCache>> _material_cache;
|
Map<uint64_t, Ref<Prop2DMaterialCache>> _material_cache;
|
||||||
|
Loading…
Reference in New Issue
Block a user