diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2018-09-04 11:30:04 +0200 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2018-09-04 11:32:56 +0200 |
commit | 5fe01d4cfc6a915d24bcb8cdc32ab371c01e94c6 (patch) | |
tree | 4dac370d3a60b5e94e06e8a555e176eb5443334c /scene/2d | |
parent | 1ebfd918d4b56a53ff1223cdf1912aa89863bb8b (diff) |
Move ParticlesMaterial code to its own resource file
It's shared by both 2D and 3D particles (+ CPU ones), so it makes sense
to have as a common resource. It also allowed to disable compilation of
Particles (3D) when using 'disable_3d'.
Also cleaned up includes in SpatialEditorGizmos and some other places,
as well as dropped dead code in material_editor_plugin.cpp.
Diffstat (limited to 'scene/2d')
-rw-r--r-- | scene/2d/cpu_particles_2d.cpp | 4 | ||||
-rw-r--r-- | scene/2d/cpu_particles_2d.h | 4 | ||||
-rw-r--r-- | scene/2d/particles_2d.cpp | 9 | ||||
-rw-r--r-- | scene/2d/particles_2d.h | 8 |
4 files changed, 13 insertions, 12 deletions
diff --git a/scene/2d/cpu_particles_2d.cpp b/scene/2d/cpu_particles_2d.cpp index 136d41e2f9..a8e0f0d07f 100644 --- a/scene/2d/cpu_particles_2d.cpp +++ b/scene/2d/cpu_particles_2d.cpp @@ -30,9 +30,7 @@ #include "cpu_particles_2d.h" -#include "scene/3d/particles.h" -#include "scene/main/viewport.h" -#include "scene/resources/surface_tool.h" +//#include "scene/resources/particles_material.h" #include "servers/visual_server.h" void CPUParticles2D::set_emitting(bool p_emitting) { diff --git a/scene/2d/cpu_particles_2d.h b/scene/2d/cpu_particles_2d.h index fa8e6b54ef..dbe9f59748 100644 --- a/scene/2d/cpu_particles_2d.h +++ b/scene/2d/cpu_particles_2d.h @@ -30,10 +30,10 @@ #ifndef CPU_PARTICLES_2D_H #define CPU_PARTICLES_2D_H + #include "rid.h" #include "scene/2d/node_2d.h" -#include "scene/main/timer.h" -#include "scene/resources/material.h" +#include "scene/resources/texture.h" /** @author Juan Linietsky <reduzio@gmail.com> diff --git a/scene/2d/particles_2d.cpp b/scene/2d/particles_2d.cpp index a4c3057416..7e824cdf75 100644 --- a/scene/2d/particles_2d.cpp +++ b/scene/2d/particles_2d.cpp @@ -30,10 +30,13 @@ #include "particles_2d.h" -#include "engine.h" -#include "scene/3d/particles.h" +#include "scene/resources/particles_material.h" #include "scene/scene_string_names.h" +#ifdef TOOLS_ENABLED +#include "core/engine.h" +#endif + void Particles2D::set_emitting(bool p_emitting) { VS::get_singleton()->particles_set_emitting(particles, p_emitting); @@ -114,7 +117,7 @@ void Particles2D::set_process_material(const Ref<Material> &p_material) { process_material = p_material; Ref<ParticlesMaterial> pm = p_material; if (pm.is_valid() && !pm->get_flag(ParticlesMaterial::FLAG_DISABLE_Z) && pm->get_gravity() == Vector3(0, -9.8, 0)) { - //likely a new material, modify it! + // Likely a new (3D) material, modify it to match 2D space pm->set_flag(ParticlesMaterial::FLAG_DISABLE_Z, true); pm->set_gravity(Vector3(0, 98, 0)); } diff --git a/scene/2d/particles_2d.h b/scene/2d/particles_2d.h index 31a66afb2a..816149ba79 100644 --- a/scene/2d/particles_2d.h +++ b/scene/2d/particles_2d.h @@ -28,11 +28,11 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#ifndef PARTICLES_FRAME_H -#define PARTICLES_FRAME_H +#ifndef PARTICLES_2D_H +#define PARTICLES_2D_H +#include "rid.h" #include "scene/2d/node_2d.h" -#include "scene/resources/color_ramp.h" #include "scene/resources/texture.h" class Particles2D : public Node2D { @@ -132,4 +132,4 @@ public: VARIANT_ENUM_CAST(Particles2D::DrawOrder) -#endif // PARTICLES_FRAME_H +#endif // PARTICLES_2D_H |