summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md1
-rw-r--r--editor/editor_properties.cpp70
-rw-r--r--modules/bullet/space_bullet.cpp15
3 files changed, 63 insertions, 23 deletions
diff --git a/README.md b/README.md
index f9855beaf6..5cfa10c5dd 100644
--- a/README.md
+++ b/README.md
@@ -67,6 +67,7 @@ such as text and video tutorials, demos, etc. Consult the [community channels](h
for more info.
[![Travis Build Status](https://travis-ci.org/godotengine/godot.svg?branch=master)](https://travis-ci.org/godotengine/godot)
+[![Actions Build Status](https://github.com/godotengine/godot/workflows/Godot/badge.svg?branch=master)](https://github.com/godotengine/godot/actions)
[![AppVeyor Build Status](https://ci.appveyor.com/api/projects/status/bfiihqq6byxsjxxh/branch/master?svg=true)](https://ci.appveyor.com/project/akien-mga/godot)
[![Code Triagers Badge](https://www.codetriage.com/godotengine/godot/badges/users.svg)](https://www.codetriage.com/godotengine/godot)
[![Translate on Weblate](https://hosted.weblate.org/widgets/godot-engine/-/godot/svg-badge.svg)](https://hosted.weblate.org/engage/godot-engine/?utm_source=widget)
diff --git a/editor/editor_properties.cpp b/editor/editor_properties.cpp
index c3f0d1b712..2d50d25ff5 100644
--- a/editor/editor_properties.cpp
+++ b/editor/editor_properties.cpp
@@ -2980,7 +2980,16 @@ Variant EditorPropertyResource::get_drag_data_fw(const Point2 &p_point, Control
}
bool EditorPropertyResource::_is_drop_valid(const Dictionary &p_drag_data) const {
- String allowed_type = base_type;
+ Vector<String> allowed_types = base_type.split(",");
+ int size = allowed_types.size();
+ for (int i = 0; i < size; i++) {
+ String at = allowed_types[i].strip_edges();
+ if (at == "StandardMaterial3D") {
+ allowed_types.append("Texture2D");
+ } else if (at == "ShaderMaterial") {
+ allowed_types.append("Shader");
+ }
+ }
Dictionary drag_data = p_drag_data;
@@ -2993,9 +3002,9 @@ bool EditorPropertyResource::_is_drop_valid(const Dictionary &p_drag_data) const
}
if (res.is_valid()) {
- for (int i = 0; i < allowed_type.get_slice_count(","); i++) {
- String at = allowed_type.get_slice(",", i).strip_edges();
- if (res.is_valid() && ClassDB::is_parent_class(res->get_class(), at)) {
+ for (int i = 0; i < allowed_types.size(); i++) {
+ String at = allowed_types[i].strip_edges();
+ if (ClassDB::is_parent_class(res->get_class(), at)) {
return true;
}
}
@@ -3009,8 +3018,8 @@ bool EditorPropertyResource::_is_drop_valid(const Dictionary &p_drag_data) const
String ftype = EditorFileSystem::get_singleton()->get_file_type(file);
if (ftype != "") {
- for (int i = 0; i < allowed_type.get_slice_count(","); i++) {
- String at = allowed_type.get_slice(",", i).strip_edges();
+ for (int i = 0; i < allowed_types.size(); i++) {
+ String at = allowed_types[i].strip_edges();
if (ClassDB::is_parent_class(ftype, at)) {
return true;
}
@@ -3039,24 +3048,49 @@ void EditorPropertyResource::drop_data_fw(const Point2 &p_point, const Variant &
res = drag_data["resource"];
}
- if (res.is_valid()) {
- emit_changed(get_edited_property(), res);
- update_property();
- return;
- }
-
- if (drag_data.has("type") && String(drag_data["type"]) == "files") {
+ if (!res.is_valid() && drag_data.has("type") && String(drag_data["type"]) == "files") {
Vector<String> files = drag_data["files"];
if (files.size() == 1) {
String file = files[0];
- RES file_res = ResourceLoader::load(file);
- if (file_res.is_valid()) {
- emit_changed(get_edited_property(), file_res);
- update_property();
- return;
+ res = ResourceLoader::load(file);
+ }
+ }
+
+ if (res.is_valid()) {
+ bool need_convert = true;
+
+ Vector<String> allowed_types = base_type.split(",");
+ for (int i = 0; i < allowed_types.size(); i++) {
+ String at = allowed_types[i].strip_edges();
+ if (ClassDB::is_parent_class(res->get_class(), at)) {
+ need_convert = false;
+ break;
+ }
+ }
+
+ if (need_convert) {
+ for (int i = 0; i < allowed_types.size(); i++) {
+ String at = allowed_types[i].strip_edges();
+ if (at == "StandardMaterial3D" && ClassDB::is_parent_class(res->get_class(), "Texture2D")) {
+ Ref<StandardMaterial3D> mat = memnew(StandardMaterial3D);
+ mat->set_texture(StandardMaterial3D::TextureParam::TEXTURE_ALBEDO, res);
+ res = mat;
+ break;
+ }
+
+ if (at == "ShaderMaterial" && ClassDB::is_parent_class(res->get_class(), "Shader")) {
+ Ref<ShaderMaterial> mat = memnew(ShaderMaterial);
+ mat->set_shader(res);
+ res = mat;
+ break;
+ }
}
}
+
+ emit_changed(get_edited_property(), res);
+ update_property();
+ return;
}
}
diff --git a/modules/bullet/space_bullet.cpp b/modules/bullet/space_bullet.cpp
index 70e137b16d..9dc307c629 100644
--- a/modules/bullet/space_bullet.cpp
+++ b/modules/bullet/space_bullet.cpp
@@ -158,10 +158,6 @@ bool BulletPhysicsDirectSpaceState::cast_motion(const RID &p_shape, const Transf
btVector3 bt_motion;
G_TO_B(p_motion, bt_motion);
- if (bt_motion.fuzzyZero()) {
- return false;
- }
-
ShapeBullet *shape = space->get_physics_server()->get_shape_owner()->getornull(p_shape);
ERR_FAIL_COND_V(!shape, false);
@@ -180,6 +176,10 @@ bool BulletPhysicsDirectSpaceState::cast_motion(const RID &p_shape, const Transf
btTransform bt_xform_to(bt_xform_from);
bt_xform_to.getOrigin() += bt_motion;
+ if ((bt_xform_to.getOrigin() - bt_xform_from.getOrigin()).fuzzyZero()) {
+ return false;
+ }
+
GodotClosestConvexResultCallback btResult(bt_xform_from.getOrigin(), bt_xform_to.getOrigin(), &p_exclude, p_collide_with_bodies, p_collide_with_areas);
btResult.m_collisionFilterGroup = 0;
btResult.m_collisionFilterMask = p_collision_mask;
@@ -982,7 +982,7 @@ bool SpaceBullet::test_body_motion(RigidBodyBullet *p_body, const Transform &p_f
motionVec->end();
#endif
- for (int shIndex = 0; shIndex < shape_count && !motion.fuzzyZero(); ++shIndex) {
+ for (int shIndex = 0; shIndex < shape_count; ++shIndex) {
if (p_body->is_shape_disabled(shIndex)) {
continue;
}
@@ -1004,6 +1004,11 @@ bool SpaceBullet::test_body_motion(RigidBodyBullet *p_body, const Transform &p_f
btTransform shape_world_to(shape_world_from);
shape_world_to.getOrigin() += motion;
+ if ((shape_world_to.getOrigin() - shape_world_from.getOrigin()).fuzzyZero()) {
+ motion = btVector3(0, 0, 0);
+ break;
+ }
+
GodotKinClosestConvexResultCallback btResult(shape_world_from.getOrigin(), shape_world_to.getOrigin(), p_body, p_infinite_inertia);
btResult.m_collisionFilterGroup = p_body->get_collision_layer();
btResult.m_collisionFilterMask = p_body->get_collision_mask();