diff options
Diffstat (limited to 'scene/3d')
-rw-r--r-- | scene/3d/camera.cpp | 5 | ||||
-rw-r--r-- | scene/3d/particles.cpp | 7 | ||||
-rw-r--r-- | scene/3d/particles.h | 1 | ||||
-rw-r--r-- | scene/3d/spatial.cpp | 8 | ||||
-rw-r--r-- | scene/3d/voxel_light_baker.cpp | 4 |
5 files changed, 12 insertions, 13 deletions
diff --git a/scene/3d/camera.cpp b/scene/3d/camera.cpp index c74abb7e2d..7143310036 100644 --- a/scene/3d/camera.cpp +++ b/scene/3d/camera.cpp @@ -70,6 +70,9 @@ void Camera::_validate_property(PropertyInfo &p_property) const { void Camera::_update_camera() { + if (!is_inside_tree()) + return; + Transform tr = get_camera_transform(); tr.origin += tr.basis.get_axis(1) * v_offset; tr.origin += tr.basis.get_axis(0) * h_offset; @@ -81,7 +84,7 @@ void Camera::_update_camera() { get_viewport()->_camera_transform_changed_notify(); */ - if (!is_inside_tree() || get_tree()->is_node_being_edited(this) || !is_current()) + if (get_tree()->is_node_being_edited(this) || !is_current()) return; get_viewport()->_camera_transform_changed_notify(); diff --git a/scene/3d/particles.cpp b/scene/3d/particles.cpp index b445ccc5a9..9108973cbf 100644 --- a/scene/3d/particles.cpp +++ b/scene/3d/particles.cpp @@ -42,8 +42,7 @@ PoolVector<Face3> Particles::get_faces(uint32_t p_usage_flags) const { void Particles::set_emitting(bool p_emitting) { - emitting = p_emitting; - VS::get_singleton()->particles_set_emitting(particles, emitting); + VS::get_singleton()->particles_set_emitting(particles, p_emitting); } void Particles::set_amount(int p_amount) { @@ -63,7 +62,7 @@ void Particles::set_one_shot(bool p_one_shot) { one_shot = p_one_shot; VS::get_singleton()->particles_set_one_shot(particles, one_shot); - if (!one_shot && emitting) + if (!one_shot && is_emitting()) VisualServer::get_singleton()->particles_restart(particles); } @@ -113,7 +112,7 @@ void Particles::set_speed_scale(float p_scale) { bool Particles::is_emitting() const { - return emitting; + return VS::get_singleton()->particles_get_emitting(particles); } int Particles::get_amount() const { diff --git a/scene/3d/particles.h b/scene/3d/particles.h index 5b8121e937..24154b5607 100644 --- a/scene/3d/particles.h +++ b/scene/3d/particles.h @@ -57,7 +57,6 @@ public: private: RID particles; - bool emitting; bool one_shot; int amount; float lifetime; diff --git a/scene/3d/spatial.cpp b/scene/3d/spatial.cpp index d9f88ac693..e890533ab7 100644 --- a/scene/3d/spatial.cpp +++ b/scene/3d/spatial.cpp @@ -558,27 +558,27 @@ bool Spatial::is_visible() const { void Spatial::rotate(const Vector3 &p_normal, float p_radians) { Transform t = get_transform(); - t.basis.rotate(p_normal, p_radians); + t.basis.rotate_local(p_normal, p_radians); //use local rotation here, as it makes more sense here in tree hierarchy set_transform(t); } void Spatial::rotate_x(float p_radians) { Transform t = get_transform(); - t.basis.rotate(Vector3(1, 0, 0), p_radians); + t.basis.rotate_local(Vector3(1, 0, 0), p_radians); set_transform(t); } void Spatial::rotate_y(float p_radians) { Transform t = get_transform(); - t.basis.rotate(Vector3(0, 1, 0), p_radians); + t.basis.rotate_local(Vector3(0, 1, 0), p_radians); set_transform(t); } void Spatial::rotate_z(float p_radians) { Transform t = get_transform(); - t.basis.rotate(Vector3(0, 0, 1), p_radians); + t.basis.rotate_local(Vector3(0, 0, 1), p_radians); set_transform(t); } diff --git a/scene/3d/voxel_light_baker.cpp b/scene/3d/voxel_light_baker.cpp index 17aa649dff..bd7e52d947 100644 --- a/scene/3d/voxel_light_baker.cpp +++ b/scene/3d/voxel_light_baker.cpp @@ -1799,7 +1799,6 @@ Vector3 VoxelLightBaker::_compute_ray_trace_at_pos(const Vector3 &p_pos, const V void VoxelLightBaker::_lightmap_bake_point(uint32_t p_x, LightMap *p_line) { - LightMap *pixel = &p_line[p_x]; if (pixel->pos == Vector3()) return; @@ -1814,7 +1813,6 @@ void VoxelLightBaker::_lightmap_bake_point(uint32_t p_x, LightMap *p_line) { // pixel->light = Vector3(1, 1, 1); //} } - } Error VoxelLightBaker::make_lightmap(const Transform &p_xform, Ref<Mesh> &p_mesh, LightMapData &r_lightmap, bool (*p_bake_time_func)(void *, float, float), void *p_bake_time_ud) { @@ -1882,7 +1880,7 @@ Error VoxelLightBaker::make_lightmap(const Transform &p_xform, Ref<Mesh> &p_mesh for (int i = 0; i < height; i++) { - thread_process_array(width,this,&VoxelLightBaker::_lightmap_bake_point,&lightmap_ptr[i*width]); + thread_process_array(width, this, &VoxelLightBaker::_lightmap_bake_point, &lightmap_ptr[i * width]); lines = MAX(lines, i); //for multithread if (p_bake_time_func) { |