mirror of
https://github.com/Relintai/pandemonium_engine.git
synced 2025-01-22 00:57:17 +01:00
Added a new PropDataMergeGroup Node for props.
This commit is contained in:
parent
5e4b6182f1
commit
018f59305e
@ -23,6 +23,7 @@ sources = [
|
||||
"props/prop_data_tiled_wall.cpp",
|
||||
"props/prop_data_collision_object.cpp",
|
||||
"props/prop_data_static_body.cpp",
|
||||
"props/prop_data_merge_group.cpp",
|
||||
|
||||
"clutter/ground_clutter.cpp",
|
||||
"clutter/ground_clutter_foliage.cpp",
|
||||
@ -32,6 +33,7 @@ sources = [
|
||||
"prop_ess_entity.cpp",
|
||||
"prop_instance_job.cpp",
|
||||
"prop_instance_prop_job.cpp",
|
||||
"prop_merge_group.cpp",
|
||||
|
||||
"prop_scene_instance.cpp",
|
||||
|
||||
|
@ -19,6 +19,7 @@ def get_doc_classes():
|
||||
"PropData",
|
||||
"PropDataCollisionObject",
|
||||
"PropDataStaticBody",
|
||||
"PropDataMergeGroup",
|
||||
|
||||
"TiledWall",
|
||||
"TiledWallData",
|
||||
@ -33,6 +34,7 @@ def get_doc_classes():
|
||||
"PropMeshUtils",
|
||||
|
||||
"PropSceneInstance",
|
||||
"PropMergeGroup",
|
||||
|
||||
"PropUtils",
|
||||
|
||||
|
40
modules/props/prop_merge_group.cpp
Normal file
40
modules/props/prop_merge_group.cpp
Normal file
@ -0,0 +1,40 @@
|
||||
/*************************************************************************/
|
||||
/* prop_merge_group.cpp */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* PANDEMONIUM ENGINE */
|
||||
/* https://github.com/Relintai/pandemonium_engine */
|
||||
/*************************************************************************/
|
||||
/* Copyright (c) 2022-present Péter Magyar. */
|
||||
/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */
|
||||
/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */
|
||||
/* */
|
||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||
/* a copy of this software and associated documentation files (the */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
|
||||
#include "prop_merge_group.h"
|
||||
|
||||
PropMergeGroup::PropMergeGroup() {
|
||||
}
|
||||
PropMergeGroup::~PropMergeGroup() {
|
||||
}
|
||||
|
||||
void PropMergeGroup::_bind_methods() {
|
||||
}
|
53
modules/props/prop_merge_group.h
Normal file
53
modules/props/prop_merge_group.h
Normal file
@ -0,0 +1,53 @@
|
||||
#ifndef PROP_MERGE_GROUP_H
|
||||
#define PROP_MERGE_GROUP_H
|
||||
|
||||
/*************************************************************************/
|
||||
/* prop_merge_group.h */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* PANDEMONIUM ENGINE */
|
||||
/* https://github.com/Relintai/pandemonium_engine */
|
||||
/*************************************************************************/
|
||||
/* Copyright (c) 2022-present Péter Magyar. */
|
||||
/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */
|
||||
/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */
|
||||
/* */
|
||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||
/* a copy of this software and associated documentation files (the */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
|
||||
#include "scene/main/spatial.h"
|
||||
|
||||
#include "core/math/vector3.h"
|
||||
|
||||
#include "props/prop_data.h"
|
||||
#include "scene/resources/packed_scene.h"
|
||||
|
||||
class PropMergeGroup : public Spatial {
|
||||
GDCLASS(PropMergeGroup, Spatial);
|
||||
|
||||
public:
|
||||
PropMergeGroup();
|
||||
~PropMergeGroup();
|
||||
|
||||
protected:
|
||||
static void _bind_methods();
|
||||
};
|
||||
|
||||
#endif
|
77
modules/props/props/prop_data_merge_group.cpp
Normal file
77
modules/props/props/prop_data_merge_group.cpp
Normal file
@ -0,0 +1,77 @@
|
||||
/*************************************************************************/
|
||||
/* prop_data_merge_group.cpp */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* PANDEMONIUM ENGINE */
|
||||
/* https://github.com/Relintai/pandemonium_engine */
|
||||
/*************************************************************************/
|
||||
/* Copyright (c) 2022-present Péter Magyar. */
|
||||
/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */
|
||||
/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */
|
||||
/* */
|
||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||
/* a copy of this software and associated documentation files (the */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
|
||||
#include "prop_data_merge_group.h"
|
||||
|
||||
#include "../prop_instance.h"
|
||||
#include "../prop_merge_group.h"
|
||||
#include "../singleton/prop_utils.h"
|
||||
#include "prop_data.h"
|
||||
|
||||
#include "modules/modules_enabled.gen.h"
|
||||
|
||||
bool PropDataMergeGroup::_processor_handles(Node *node) {
|
||||
PropMergeGroup *g = Object::cast_to<PropMergeGroup>(node);
|
||||
|
||||
return g;
|
||||
}
|
||||
|
||||
void PropDataMergeGroup::_processor_process(Ref<PropData> prop_data, Node *node, const Transform &transform) {
|
||||
PropMergeGroup *g = Object::cast_to<PropMergeGroup>(node);
|
||||
|
||||
if (g) {
|
||||
Ref<PropData> d;
|
||||
d.instance();
|
||||
|
||||
for (int i = 0; i < g->get_child_count(); ++i) {
|
||||
PropUtils::get_singleton()->_convert_tree(d, g->get_child(i), Transform());
|
||||
}
|
||||
|
||||
Ref<PropDataMergeGroup> l;
|
||||
l.instance();
|
||||
l->set_prop(d);
|
||||
l->set_transform(transform * g->get_transform());
|
||||
prop_data->add_prop(l);
|
||||
}
|
||||
}
|
||||
|
||||
bool PropDataMergeGroup::_processor_evaluate_children() {
|
||||
return false;
|
||||
}
|
||||
|
||||
PropDataMergeGroup::PropDataMergeGroup() {
|
||||
}
|
||||
|
||||
PropDataMergeGroup::~PropDataMergeGroup() {
|
||||
}
|
||||
|
||||
void PropDataMergeGroup::_bind_methods() {
|
||||
}
|
61
modules/props/props/prop_data_merge_group.h
Normal file
61
modules/props/props/prop_data_merge_group.h
Normal file
@ -0,0 +1,61 @@
|
||||
#ifndef PROP_DATA_MERGE_GROUP_H
|
||||
#define PROP_DATA_MERGE_GROUP_H
|
||||
|
||||
/*************************************************************************/
|
||||
/* prop_data_merge_group.h */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* PANDEMONIUM ENGINE */
|
||||
/* https://github.com/Relintai/pandemonium_engine */
|
||||
/*************************************************************************/
|
||||
/* Copyright (c) 2022-present Péter Magyar. */
|
||||
/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */
|
||||
/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */
|
||||
/* */
|
||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||
/* a copy of this software and associated documentation files (the */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
|
||||
#include "core/math/vector3.h"
|
||||
#include "prop_data_entry.h"
|
||||
|
||||
#include "prop_data_prop.h"
|
||||
|
||||
#include "modules/modules_enabled.gen.h"
|
||||
|
||||
#ifdef MODULE_TEXTURE_PACKER_ENABLED
|
||||
#include "../../texture_packer/texture_packer.h"
|
||||
#endif
|
||||
|
||||
class PropDataMergeGroup : public PropDataProp {
|
||||
GDCLASS(PropDataMergeGroup, PropDataProp);
|
||||
|
||||
public:
|
||||
bool _processor_handles(Node *node);
|
||||
void _processor_process(Ref<PropData> prop_data, Node *node, const Transform &transform);
|
||||
bool _processor_evaluate_children();
|
||||
|
||||
PropDataMergeGroup();
|
||||
~PropDataMergeGroup();
|
||||
|
||||
protected:
|
||||
static void _bind_methods();
|
||||
};
|
||||
|
||||
#endif
|
@ -74,13 +74,15 @@ bool PropDataProp::_processor_handles(Node *node) {
|
||||
void PropDataProp::_processor_process(Ref<PropData> prop_data, Node *node, const Transform &transform) {
|
||||
PropInstance *i = Object::cast_to<PropInstance>(node);
|
||||
|
||||
ERR_FAIL_COND(!i);
|
||||
if (i) {
|
||||
Ref<PropDataProp> l;
|
||||
l.instance();
|
||||
l->set_prop(i->get_prop_data());
|
||||
l->set_transform(transform * i->get_transform());
|
||||
prop_data->add_prop(l);
|
||||
|
||||
Ref<PropDataProp> l;
|
||||
l.instance();
|
||||
l->set_prop(i->get_prop_data());
|
||||
l->set_transform(transform * i->get_transform());
|
||||
prop_data->add_prop(l);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
Node *PropDataProp::_processor_get_node_for(const Transform &transform) {
|
||||
@ -96,6 +98,7 @@ PropDataProp::PropDataProp() {
|
||||
_snap_to_mesh = false;
|
||||
_snap_axis = Vector3(0, 1, 0);
|
||||
}
|
||||
|
||||
PropDataProp::~PropDataProp() {
|
||||
if (_prop.is_valid())
|
||||
_prop.unref();
|
||||
|
@ -32,28 +32,6 @@
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
|
||||
/*
|
||||
Copyright (c) 2023-present Péter Magyar
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "prop_data_collision_object.h"
|
||||
|
||||
class PhysicsMaterial;
|
||||
|
@ -40,6 +40,7 @@
|
||||
#include "props/prop_data_collision_object.h"
|
||||
#include "props/prop_data_entry.h"
|
||||
#include "props/prop_data_light.h"
|
||||
#include "props/prop_data_merge_group.h"
|
||||
#include "props/prop_data_prop.h"
|
||||
#include "props/prop_data_scene.h"
|
||||
#include "props/prop_data_static_body.h"
|
||||
@ -53,6 +54,7 @@
|
||||
#include "prop_ess_entity.h"
|
||||
#include "prop_instance.h"
|
||||
#include "prop_instance_merger.h"
|
||||
#include "prop_merge_group.h"
|
||||
|
||||
#include "prop_instance_job.h"
|
||||
#include "prop_instance_prop_job.h"
|
||||
@ -107,6 +109,7 @@ void register_props_types(ModuleRegistrationLevel p_level) {
|
||||
ClassDB::register_class<PropDataTiledWall>();
|
||||
ClassDB::register_class<PropDataCollisionObject>();
|
||||
ClassDB::register_class<PropDataStaticBody>();
|
||||
ClassDB::register_class<PropDataMergeGroup>();
|
||||
|
||||
ClassDB::register_class<PropDataPortal>();
|
||||
|
||||
@ -127,6 +130,7 @@ void register_props_types(ModuleRegistrationLevel p_level) {
|
||||
ClassDB::register_class<PropTextureJob>();
|
||||
|
||||
ClassDB::register_class<PropSceneInstance>();
|
||||
ClassDB::register_class<PropMergeGroup>();
|
||||
|
||||
ClassDB::register_class<PropMaterialCache>();
|
||||
|
||||
@ -151,6 +155,9 @@ void register_props_types(ModuleRegistrationLevel p_level) {
|
||||
|
||||
Ref<PropDataStaticBody> static_body_processor = Ref<PropDataStaticBody>(memnew(PropDataStaticBody));
|
||||
PropUtils::add_processor(static_body_processor);
|
||||
|
||||
Ref<PropDataMergeGroup> merge_group_processor = Ref<PropDataMergeGroup>(memnew(PropDataMergeGroup));
|
||||
PropUtils::add_processor(merge_group_processor);
|
||||
}
|
||||
|
||||
#ifdef TOOLS_ENABLED
|
||||
|
Loading…
Reference in New Issue
Block a user