add random flag to particle modulators
This commit is contained in:
@@ -555,7 +555,8 @@ class ParticleSystemMaskBase(MaskBase, ABC):
|
||||
'end_frame': end_frame,
|
||||
'effect_duration': effect_duration,
|
||||
'temporal_easing': modulation['temporal_easing'],
|
||||
'palindrome': modulation['palindrome']
|
||||
'palindrome': modulation['palindrome'],
|
||||
'random': modulation.get('random', False) # Add this line
|
||||
}
|
||||
|
||||
if modulation['type'] == 'ParticleSizeModulation':
|
||||
@@ -577,7 +578,10 @@ class ParticleSystemMaskBase(MaskBase, ABC):
|
||||
|
||||
for modulation in self.emitter_modulations[emitter_index]:
|
||||
if modulation['start_frame'] <= current_frame < modulation['end_frame']:
|
||||
progress = self.calculate_modulation_progress(current_frame, modulation, particle.creation_frame)
|
||||
if modulation.get('random', False):
|
||||
progress = random.random() # Generate a random value between 0 and 1
|
||||
else:
|
||||
progress = self.calculate_modulation_progress(current_frame, modulation, particle.creation_frame)
|
||||
|
||||
if modulation['type'] == 'ParticleSizeModulation':
|
||||
self.apply_size_modulation(particle, modulation, progress)
|
||||
|
||||
@@ -309,6 +309,7 @@ class ParticleModulationBase(ParticleSystemModulatorBase):
|
||||
"effect_duration": ("INT", {"default": 0, "min": 0, "max": 1000, "step": 1}),
|
||||
"temporal_easing": (["ease_in_out", "linear", "bounce", "elastic", "none"],),
|
||||
"palindrome": ("BOOLEAN", {"default": False}),
|
||||
"random": ("BOOLEAN", {"default": False}),
|
||||
},
|
||||
"optional": {
|
||||
"previous_modulation": ("PARTICLE_MODULATION",),
|
||||
@@ -316,13 +317,14 @@ class ParticleModulationBase(ParticleSystemModulatorBase):
|
||||
}
|
||||
|
||||
|
||||
def create_modulation(self, start_frame, end_frame, effect_duration, temporal_easing, palindrome, previous_modulation=None):
|
||||
def create_modulation(self, start_frame, end_frame, effect_duration, temporal_easing, palindrome, random, previous_modulation=None):
|
||||
modulation = {
|
||||
"start_frame": start_frame,
|
||||
"end_frame": end_frame,
|
||||
"effect_duration": effect_duration,
|
||||
"temporal_easing": temporal_easing,
|
||||
"palindrome": palindrome,
|
||||
"random": random,
|
||||
}
|
||||
|
||||
modulation_type = self.__class__.__name__
|
||||
|
||||
Reference in New Issue
Block a user