mirror of
https://github.com/Relintai/props.git
synced 2025-02-04 16:05:54 +01:00
Added a material_paths property to the PropCache, can be used to store resource paths to the materials.
This commit is contained in:
parent
d59047eb7c
commit
f9d5a4c29a
@ -95,6 +95,13 @@ void PropCache::set_margin(const int margin) {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
PoolStringArray PropCache::material_paths_get() const {
|
||||||
|
return _material_paths;
|
||||||
|
}
|
||||||
|
void PropCache::material_paths_set(const PoolStringArray &value) {
|
||||||
|
_material_paths = value;
|
||||||
|
}
|
||||||
|
|
||||||
Ref<PropMaterialCache> PropCache::material_cache_get(const Ref<PropData> &prop) {
|
Ref<PropMaterialCache> PropCache::material_cache_get(const Ref<PropData> &prop) {
|
||||||
ERR_FAIL_COND_V(!prop.is_valid(), Ref<PropMaterialCache>());
|
ERR_FAIL_COND_V(!prop.is_valid(), Ref<PropMaterialCache>());
|
||||||
|
|
||||||
@ -187,6 +194,8 @@ PropCache::PropCache() {
|
|||||||
_background_color = GLOBAL_DEF("props/background_color", Color());
|
_background_color = GLOBAL_DEF("props/background_color", Color());
|
||||||
_margin = GLOBAL_DEF("props/margin", 0);
|
_margin = GLOBAL_DEF("props/margin", 0);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
_material_paths = GLOBAL_DEF("props/material_paths", PoolStringArray());
|
||||||
}
|
}
|
||||||
|
|
||||||
PropCache::~PropCache() {
|
PropCache::~PropCache() {
|
||||||
@ -219,4 +228,8 @@ void PropCache::_bind_methods() {
|
|||||||
ClassDB::bind_method(D_METHOD("set_margin", "size"), &PropCache::set_margin);
|
ClassDB::bind_method(D_METHOD("set_margin", "size"), &PropCache::set_margin);
|
||||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "margin"), "set_margin", "get_margin");
|
ADD_PROPERTY(PropertyInfo(Variant::INT, "margin"), "set_margin", "get_margin");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
ClassDB::bind_method(D_METHOD("material_paths_get"), &PropCache::material_paths_get);
|
||||||
|
ClassDB::bind_method(D_METHOD("material_paths_set", "value"), &PropCache::material_paths_set);
|
||||||
|
ADD_PROPERTY(PropertyInfo(Variant::POOL_STRING_ARRAY, "material_paths"), "material_paths_set", "material_paths_get");
|
||||||
}
|
}
|
||||||
|
@ -71,6 +71,9 @@ public:
|
|||||||
void set_margin(const int margin);
|
void set_margin(const int margin);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
PoolStringArray material_paths_get() const;
|
||||||
|
void material_paths_set(const PoolStringArray &array);
|
||||||
|
|
||||||
Ref<PropMaterialCache> material_cache_get(const Ref<PropData> &prop);
|
Ref<PropMaterialCache> material_cache_get(const Ref<PropData> &prop);
|
||||||
void material_cache_unref(const Ref<PropData> &prop);
|
void material_cache_unref(const Ref<PropData> &prop);
|
||||||
|
|
||||||
@ -102,6 +105,8 @@ protected:
|
|||||||
Color _background_color;
|
Color _background_color;
|
||||||
int _margin;
|
int _margin;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
PoolStringArray _material_paths;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user