summaryrefslogtreecommitdiff
path: root/scene/resources
diff options
context:
space:
mode:
Diffstat (limited to 'scene/resources')
-rw-r--r--scene/resources/animation.cpp9
-rw-r--r--scene/resources/mesh.cpp30
-rw-r--r--scene/resources/mesh.h1
-rw-r--r--scene/resources/packed_scene.cpp2
-rw-r--r--scene/resources/visual_shader.cpp2
5 files changed, 11 insertions, 33 deletions
diff --git a/scene/resources/animation.cpp b/scene/resources/animation.cpp
index 2af92a788e..3eb16c544c 100644
--- a/scene/resources/animation.cpp
+++ b/scene/resources/animation.cpp
@@ -1836,9 +1836,14 @@ Variant Animation::value_track_interpolate(int p_track, float p_time) const {
void Animation::_value_track_get_key_indices_in_range(const ValueTrack *vt, float from_time, float to_time, List<int> *p_indices) const {
if (from_time != length && to_time == length)
- to_time = length * 1.01; //include a little more if at the end
+ to_time = length * 1.001; //include a little more if at the end
int to = _find(vt->values, to_time);
+ if (to >= 0 && from_time == to_time && vt->values[to].time == from_time) {
+ //find exact (0 delta), return if found
+ p_indices->push_back(to);
+ return;
+ }
// can't really send the events == time, will be sent in the next frame.
// if event>=len then it will probably never be requested by the anim player.
@@ -1884,7 +1889,7 @@ void Animation::value_track_get_key_indices(int p_track, float p_time, float p_d
if (from_time > to_time) {
// handle loop by splitting
- _value_track_get_key_indices_in_range(vt, length - from_time, length, p_indices);
+ _value_track_get_key_indices_in_range(vt, from_time, length, p_indices);
_value_track_get_key_indices_in_range(vt, 0, to_time, p_indices);
return;
}
diff --git a/scene/resources/mesh.cpp b/scene/resources/mesh.cpp
index 98402dbeaf..85018f38d7 100644
--- a/scene/resources/mesh.cpp
+++ b/scene/resources/mesh.cpp
@@ -1028,34 +1028,6 @@ AABB ArrayMesh::get_custom_aabb() const {
return custom_aabb;
}
-void ArrayMesh::center_geometry() {
-
- /*
- Vector3 ofs = aabb.pos+aabb.size*0.5;
-
- for(int i=0;i<get_surface_count();i++) {
-
- PoolVector<Vector3> geom = surface_get_array(i,ARRAY_VERTEX);
- int gc =geom.size();
- PoolVector<Vector3>::Write w = geom.write();
- surfaces[i].aabb.pos-=ofs;
-
- for(int i=0;i<gc;i++) {
-
- w[i]-=ofs;
- }
-
- w = PoolVector<Vector3>::Write();
-
- surface_set_array(i,ARRAY_VERTEX,geom);
-
- }
-
- aabb.pos-=ofs;
-
-*/
-}
-
void ArrayMesh::regen_normalmaps() {
Vector<Ref<SurfaceTool> > surfs;
@@ -1295,8 +1267,6 @@ void ArrayMesh::_bind_methods() {
ClassDB::bind_method(D_METHOD("create_trimesh_shape"), &ArrayMesh::create_trimesh_shape);
ClassDB::bind_method(D_METHOD("create_convex_shape"), &ArrayMesh::create_convex_shape);
ClassDB::bind_method(D_METHOD("create_outline", "margin"), &ArrayMesh::create_outline);
- ClassDB::bind_method(D_METHOD("center_geometry"), &ArrayMesh::center_geometry);
- ClassDB::set_method_flags(get_class_static(), _scs_create("center_geometry"), METHOD_FLAGS_DEFAULT | METHOD_FLAG_EDITOR);
ClassDB::bind_method(D_METHOD("regen_normalmaps"), &ArrayMesh::regen_normalmaps);
ClassDB::set_method_flags(get_class_static(), _scs_create("regen_normalmaps"), METHOD_FLAGS_DEFAULT | METHOD_FLAG_EDITOR);
ClassDB::bind_method(D_METHOD("lightmap_unwrap", "transform", "texel_size"), &ArrayMesh::lightmap_unwrap);
diff --git a/scene/resources/mesh.h b/scene/resources/mesh.h
index 2d0aef8ab0..dabfc6ea60 100644
--- a/scene/resources/mesh.h
+++ b/scene/resources/mesh.h
@@ -223,7 +223,6 @@ public:
AABB get_aabb() const;
virtual RID get_rid() const;
- void center_geometry();
void regen_normalmaps();
Error lightmap_unwrap(const Transform &p_base_transform = Transform(), float p_texel_size = 0.05);
diff --git a/scene/resources/packed_scene.cpp b/scene/resources/packed_scene.cpp
index 0d12d388ef..99440ff202 100644
--- a/scene/resources/packed_scene.cpp
+++ b/scene/resources/packed_scene.cpp
@@ -92,6 +92,8 @@ Node *SceneState::instance(GenEditState p_edit_state) const {
if (i > 0) {
+ ERR_EXPLAIN(vformat("Invalid scene: node %s does not specify its parent node.", snames[n.name]))
+ ERR_FAIL_COND_V(n.parent == -1, NULL)
NODE_FROM_ID(nparent, n.parent);
#ifdef DEBUG_ENABLED
if (!nparent && (n.parent & FLAG_ID_IS_PATH)) {
diff --git a/scene/resources/visual_shader.cpp b/scene/resources/visual_shader.cpp
index 692c28ed99..4e5909eb2e 100644
--- a/scene/resources/visual_shader.cpp
+++ b/scene/resources/visual_shader.cpp
@@ -1087,6 +1087,8 @@ const VisualShaderNodeInput::Port VisualShaderNodeInput::ports[] = {
{ Shader::MODE_SPATIAL, VisualShader::TYPE_LIGHT, VisualShaderNode::PORT_TYPE_VECTOR, "attenuation", "ATTENUATION" },
{ Shader::MODE_SPATIAL, VisualShader::TYPE_LIGHT, VisualShaderNode::PORT_TYPE_VECTOR, "albedo", "ALBEDO" },
{ Shader::MODE_SPATIAL, VisualShader::TYPE_LIGHT, VisualShaderNode::PORT_TYPE_VECTOR, "transmission", "TRANSMISSION" },
+ { Shader::MODE_SPATIAL, VisualShader::TYPE_LIGHT, VisualShaderNode::PORT_TYPE_VECTOR, "diffuse", "DIFFUSE_LIGHT" },
+ { Shader::MODE_SPATIAL, VisualShader::TYPE_LIGHT, VisualShaderNode::PORT_TYPE_VECTOR, "specular", "SPECULAR_LIGHT" },
{ Shader::MODE_SPATIAL, VisualShader::TYPE_LIGHT, VisualShaderNode::PORT_TYPE_SCALAR, "roughness", "ROUGHNESS" },
{ Shader::MODE_SPATIAL, VisualShader::TYPE_LIGHT, VisualShaderNode::PORT_TYPE_TRANSFORM, "world", "WORLD_MATRIX" },