added emission radius

This commit is contained in:
ryanontheinstide
2024-08-28 17:00:40 -04:00
parent 618f63bc2b
commit ff153b25eb
3 changed files with 21 additions and 3 deletions
+2
View File
@@ -287,6 +287,7 @@ add_node_config("ParticleModulationBase", {
- `effect_duration`: Duration of the modulation effect in frames (0 to 1000)
- `temporal_easing`: Easing function for the modulation effect ("ease_in_out", "linear", "bounce", "elastic", "none")
- `palindrome`: Whether to reverse the modulation effect after completion (True/False)
- `random`: Selects a random value between 0 and the chosen target value and applies it per particle
"""
})
@@ -560,6 +561,7 @@ add_node_config("ParticleEmitter", {
- `initial_plume`: Initial burst of particles (0.0 to 1.0)
- `start_frame`: Frame to start the emission (0 to 10000)
- `end_frame`: Frame to end the emission (0 to 10000)
- `emission_radius`: Defaulting to 0 (a point), this value changes the radius of the area from which the particles are emitted. The open 'mouth' of the emitter.
Optional inputs:
- `emitter_movement`: Movement settings for the emitter (EMITTER_MOVEMENT type)
+15 -1
View File
@@ -701,11 +701,25 @@ class ParticleSystemMaskBase(MaskBase, ABC):
return ccw(p1,p3,p4) != ccw(p2,p3,p4) and ccw(p1,p2,p3) != ccw(p1,p2,p4)
def emit_particle(self, emitter, height, width, emitter_index, frame_index):
emitter_pos = (float(emitter['emitter_x']) * width, float(emitter['emitter_y']) * height)
emitter_x = float(emitter['emitter_x']) * width
emitter_y = float(emitter['emitter_y']) * height
particle_direction = math.radians(float(emitter['particle_direction']))
particle_spread = math.radians(float(emitter['particle_spread']))
particle_speed = float(emitter['particle_speed'])
particle_size = float(emitter['particle_size'])
emission_radius = float(emitter.get('emission_radius', 0)) # Default to 0 if not specified
# Generate a random point within the circular emission area
if emission_radius > 0:
r = random.uniform(0, emission_radius)
theta = random.uniform(0, 2 * math.pi)
emitter_pos = (
emitter_x + r * math.cos(theta),
emitter_y + r * math.sin(theta)
)
else:
emitter_pos = (emitter_x, emitter_y)
angle = random.uniform(particle_direction - particle_spread/2,
particle_direction + particle_spread/2)
+4 -2
View File
@@ -156,6 +156,7 @@ class ParticleEmitter(ParticleSystemModulatorBase):
"initial_plume": ("FLOAT", {"default": 0.0, "min": 0.0, "max": 1.0, "step": 0.01}),
"start_frame": ("INT", {"default": 0, "min": 0, "max": 10000, "step": 1}),
"end_frame": ("INT", {"default": 0, "min": 0, "max": 10000, "step": 1}),
"emission_radius": ("FLOAT", {"default": 0.0, "min": 0.0, "max": 100.0, "step": 0.1}),
},
"optional": {
"previous_emitter": ("PARTICLE_EMITTER",),
@@ -170,8 +171,8 @@ class ParticleEmitter(ParticleSystemModulatorBase):
def create_emitter(self, emitter_x, emitter_y, particle_direction, particle_spread,
particle_size, particle_speed, emission_rate, color, initial_plume,
start_frame, end_frame, previous_emitter=None, emitter_movement=None,
spring_joint_setting=None, particle_modulation=None):
start_frame, end_frame, emission_radius, previous_emitter=None,
emitter_movement=None, spring_joint_setting=None, particle_modulation=None):
emitter = {
"emitter_x": emitter_x,
"emitter_y": emitter_y,
@@ -184,6 +185,7 @@ class ParticleEmitter(ParticleSystemModulatorBase):
"initial_plume": initial_plume,
"start_frame": start_frame,
"end_frame": end_frame,
"emission_radius": emission_radius,
}
if emitter_movement: