Added texture packer property to the prop instance job.

This commit is contained in:
Relintai 2021-05-20 18:58:09 +02:00
parent aca6a61c3d
commit a0d9404201
2 changed files with 31 additions and 0 deletions

View File

@ -33,6 +33,19 @@ SOFTWARE.
#include "../mesh_utils/fast_quadratic_mesh_simplifier.h" #include "../mesh_utils/fast_quadratic_mesh_simplifier.h"
#endif #endif
#if TEXTURE_PACKER_PRESENT
#include "../texture_packer/texture_packer.h"
#endif
#if TEXTURE_PACKER_PRESENT
Ref<TexturePacker> PropInstancePropJob::get_texture_packer() {
return _texture_packer;
}
void PropInstancePropJob::set_texture_packer(const Ref<TexturePacker> &packer) {
_texture_packer = packer;
}
#endif
PropInstance *PropInstancePropJob::get_prop_instace() { PropInstance *PropInstancePropJob::get_prop_instace() {
return _prop_instace; return _prop_instace;
} }
@ -389,6 +402,12 @@ PropInstancePropJob::~PropInstancePropJob() {
} }
void PropInstancePropJob::_bind_methods() { void PropInstancePropJob::_bind_methods() {
#if TEXTURE_PACKER_PRESENT
ClassDB::bind_method(D_METHOD("get_texture_packer"), &PropInstancePropJob::get_texture_packer);
ClassDB::bind_method(D_METHOD("set_texture_packer", "packer"), &PropInstancePropJob::set_texture_packer);
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "texture_packer", PROPERTY_HINT_RESOURCE_TYPE, "TexturePacker", 0), "set_texture_packer", "get_texture_packer");
#endif
ClassDB::bind_method(D_METHOD("get_prop_mesher"), &PropInstancePropJob::get_prop_mesher); ClassDB::bind_method(D_METHOD("get_prop_mesher"), &PropInstancePropJob::get_prop_mesher);
ClassDB::bind_method(D_METHOD("set_prop_mesher", "mesher"), &PropInstancePropJob::set_prop_mesher); ClassDB::bind_method(D_METHOD("set_prop_mesher", "mesher"), &PropInstancePropJob::set_prop_mesher);
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "prop_mesher", PROPERTY_HINT_RESOURCE_TYPE, "PropMesher", 0), "set_prop_mesher", "get_prop_mesher"); ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "prop_mesher", PROPERTY_HINT_RESOURCE_TYPE, "PropMesher", 0), "set_prop_mesher", "get_prop_mesher");

View File

@ -25,6 +25,10 @@ SOFTWARE.
#include "prop_instance_job.h" #include "prop_instance_job.h"
#if TEXTURE_PACKER_PRESENT
class TexturePacker;
#endif
class PropMesher; class PropMesher;
class PropInstance; class PropInstance;
@ -32,6 +36,11 @@ class PropInstancePropJob : public PropInstanceJob {
GDCLASS(PropInstancePropJob, PropInstanceJob); GDCLASS(PropInstancePropJob, PropInstanceJob);
public: public:
#if TEXTURE_PACKER_PRESENT
Ref<TexturePacker> get_texture_packer();
void set_texture_packer(const Ref<TexturePacker> &packer);
#endif
PropInstance *get_prop_instace(); PropInstance *get_prop_instace();
void set_prop_instace(PropInstance *prop); void set_prop_instace(PropInstance *prop);
void set_prop_instace_bind(Node *prop); void set_prop_instace_bind(Node *prop);
@ -52,6 +61,9 @@ public:
protected: protected:
static void _bind_methods(); static void _bind_methods();
#if TEXTURE_PACKER_PRESENT
Ref<TexturePacker> _texture_packer;
#endif
Ref<PropMesher> _prop_mesher; Ref<PropMesher> _prop_mesher;
PropInstance *_prop_instace; PropInstance *_prop_instace;