mirror of
https://github.com/Relintai/props.git
synced 2024-11-14 10:17:30 +01:00
Implement initial_setup_default for PropMaterialCache and PropMaterialCachePCM.
This commit is contained in:
parent
5477c38e3f
commit
33cc53c881
@ -24,6 +24,7 @@ SOFTWARE.
|
|||||||
|
|
||||||
#include "../../props/props/prop_data.h"
|
#include "../../props/props/prop_data.h"
|
||||||
#include "../../props/props/prop_data_prop.h"
|
#include "../../props/props/prop_data_prop.h"
|
||||||
|
#include "../singleton/prop_cache.h"
|
||||||
|
|
||||||
#if MESH_DATA_RESOURCE_PRESENT
|
#if MESH_DATA_RESOURCE_PRESENT
|
||||||
#define PROPS_PRESENT 1
|
#define PROPS_PRESENT 1
|
||||||
@ -237,7 +238,20 @@ void PropMaterialCache::refresh_rects() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void PropMaterialCache::initial_setup_default() {
|
void PropMaterialCache::initial_setup_default() {
|
||||||
|
PropCache* pc = PropCache::get_singleton();
|
||||||
|
|
||||||
|
pc->ensure_materials_loaded();
|
||||||
|
|
||||||
|
int matc = pc->material_get_num();
|
||||||
|
for (int i = 0; i < matc; ++i) {
|
||||||
|
Ref<Material> m = pc->material_get(i);
|
||||||
|
|
||||||
|
ERR_CONTINUE(!m.is_valid());
|
||||||
|
|
||||||
|
Ref<Material> md = m->duplicate();
|
||||||
|
|
||||||
|
_materials.push_back(md);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void PropMaterialCache::setup_material_albedo(Ref<Texture> texture) {
|
void PropMaterialCache::setup_material_albedo(Ref<Texture> texture) {
|
||||||
|
@ -23,6 +23,7 @@ SOFTWARE.
|
|||||||
#include "prop_material_cache_pcm.h"
|
#include "prop_material_cache_pcm.h"
|
||||||
|
|
||||||
#include "../../texture_packer/texture_packer.h"
|
#include "../../texture_packer/texture_packer.h"
|
||||||
|
#include "../singleton/prop_cache.h"
|
||||||
#include "scene/resources/texture.h"
|
#include "scene/resources/texture.h"
|
||||||
|
|
||||||
int PropMaterialCachePCM::get_texture_flags() const {
|
int PropMaterialCachePCM::get_texture_flags() const {
|
||||||
@ -131,7 +132,13 @@ void PropMaterialCachePCM::refresh_rects() {
|
|||||||
void PropMaterialCachePCM::initial_setup_default() {
|
void PropMaterialCachePCM::initial_setup_default() {
|
||||||
PropMaterialCache::initial_setup_default();
|
PropMaterialCache::initial_setup_default();
|
||||||
|
|
||||||
//copy settings
|
PropCache *pc = PropCache::get_singleton();
|
||||||
|
|
||||||
|
set_texture_flags(pc->get_texture_flags());
|
||||||
|
set_max_atlas_size(pc->get_max_atlas_size());
|
||||||
|
set_keep_original_atlases(pc->get_keep_original_atlases());
|
||||||
|
set_background_color(pc->get_background_color());
|
||||||
|
set_margin(pc->get_margin());
|
||||||
}
|
}
|
||||||
|
|
||||||
void PropMaterialCachePCM::_setup_material_albedo(Ref<Texture> texture) {
|
void PropMaterialCachePCM::_setup_material_albedo(Ref<Texture> texture) {
|
||||||
|
Loading…
Reference in New Issue
Block a user