diff options
-rw-r--r-- | release/ui/buttons_particle.py | 570 | ||||
-rw-r--r-- | source/blender/blenkernel/BKE_particle.h | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/modifier.c | 3 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/particle.c | 55 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/particle_system.c | 36 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/pointcache.c | 2 | ||||
-rw-r--r-- | source/blender/blenloader/intern/readfile.c | 20 | ||||
-rw-r--r-- | source/blender/editors/physics/editparticle.c | 2 | ||||
-rw-r--r-- | source/blender/editors/sculpt_paint/paint_vertex.c | 2 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/drawobject.c | 7 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/space_view3d.c | 1 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_particle_types.h | 23 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_object_force.c | 7 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_particle.c | 380 | ||||
-rw-r--r-- | source/blender/render/intern/source/convertblender.c | 14 | ||||
-rw-r--r-- | source/blender/windowmanager/WM_types.h | 1 |
16 files changed, 996 insertions, 129 deletions
diff --git a/release/ui/buttons_particle.py b/release/ui/buttons_particle.py index 737aa1a4393..da04fad4adc 100644 --- a/release/ui/buttons_particle.py +++ b/release/ui/buttons_particle.py @@ -1,25 +1,589 @@ import bpy +def particle_panel_enabled(psys): + return psys.point_cache.baked==False and psys.editable==False + +def particle_panel_poll(context): + psys = context.particle_system + type = psys.settings.type + return psys != None and (type=='EMITTER' or type=='REACTOR'or type=='HAIR') + class ParticleButtonsPanel(bpy.types.Panel): __space_type__ = "BUTTONS_WINDOW" __region_type__ = "WINDOW" __context__ = "particle" def poll(self, context): - return (context.particle_system != None) + psys = context.particle_system + type = psys.settings.type + return psys != None and (type=='EMITTER' or type=='REACTOR'or type=='HAIR') class PARTICLE_PT_particles(ParticleButtonsPanel): __idname__= "PARTICLE_PT_particles" - __label__ = "Particles" + __label__ = "ParticleSystem" + + def poll(self, context): + return (context.particle_system != None) + + def draw(self, context): + layout = self.layout + + psys = context.particle_system + part = psys.settings + + #row = layout.row() + #row.itemL(text="Particle system datablock") + #row.itemL(text="Viewport") + #row.itemL(text="Render") + + type = psys.settings.type + + if(type!='EMITTER' and type!='REACTOR' and type!='HAIR'): + layout.itemL(text="No settings for fluid particles") + return + + row = layout.row() + row.enabled = particle_panel_enabled(psys) + row.itemR(part, "type") + row.itemR(psys, "seed") + + row = layout.row() + if part.type=='HAIR': + if psys.editable==True: + row.itemO("PARTICLE_OT_editable_set", text="Free Edit") + else: + row.itemO("PARTICLE_OT_editable_set", text="Make Editable") + subrow = row.row() + subrow.enabled = particle_panel_enabled(psys) + subrow.itemR(part, "hair_step") + elif part.type=='REACTOR': + row.itemR(psys, "reactor_target_object") + row.itemR(psys, "reactor_target_particle_system", text="Particle System") + +class PARTICLE_PT_emission(ParticleButtonsPanel): + __idname__= "PARTICLE_PT_emission" + __label__ = "Emission" + + def draw(self, context): + layout = self.layout + + psys = context.particle_system + part = psys.settings + + layout.enabled = particle_panel_enabled(psys) + + row = layout.row() + #col.itemL(text="TODO: Rate instead of amount") + row.itemR(part, "amount") + row.itemL(text="") + + split = layout.split() + + col = split.column(align=True) + col.itemR(part, "start") + col.itemR(part, "end") + + col = split.column(align=True) + col.itemR(part, "lifetime") + col.itemR(part, "random_lifetime", slider=True) + +class PARTICLE_PT_cache(ParticleButtonsPanel): + __idname__= "PARTICLE_PT_cache" + __label__ = "Cache" + + def poll(self, context): + psys = context.particle_system + type = psys.settings.type + return psys != None and (type=='EMITTER' or type== 'REACTOR') + + def draw(self, context): + layout = self.layout + + psys = context.particle_system + part = psys.settings + cache = psys.point_cache + + #if cache.baked==True: + #layout.itemO("PARTICLE_OT_free_bake", text="BAKE") + #else: + row = layout.row() + #row.itemO("PARTICLE_OT_bake", text="BAKE") + row.itemR(cache, "start_frame") + row.itemR(cache, "end_frame") + + #layout.row().itemL(text="No simulation frames in disk cache.") + + +class PARTICLE_PT_initial(ParticleButtonsPanel): + __idname__= "PARTICLE_PT_initial" + __label__ = "Initial values" + + def draw(self, context): + layout = self.layout + + psys = context.particle_system + part = psys.settings + + layout.enabled = particle_panel_enabled(psys) + + layout.row().itemL(text="Location from:") + + box = layout.box() + row = box.row() + row.itemR(part, "trand") + + col = row.column() + col.row().itemR(part, "emit_from", expand=True) + + if part.emit_from=='FACE' or part.emit_from=='VOLUME': + row = box.row() + + if part.distribution!='GRID': + row.itemR(part, "even_distribution") + else: + row.itemL(text="") + + row.itemR(part, "distribution", expand=True) + + row = box.row() + + if part.distribution=='JIT': + row.itemR(part, "userjit", text="Particles/Face") + row.itemR(part, "jitter_factor", text="Jittering Amount", slider=True) + elif part.distribution=='GRID': + row.itemR(part, "grid_resolution") + + #layout.row().itemL(text="") + + layout.row().itemL(text="Velocity:") + box = layout.box() + row = box.row() + col = row.column() + col.itemR(part, "normal_factor") + if part.emit_from=='PARTICLE': + col.itemR(part, "particle_factor") + else: + col.itemR(part, "object_factor", slider=True) + col.itemR(part, "random_factor") + + col = row.column(align=True) + col.itemL(text="TODO:") + col.itemL(text="Object aligned") + col.itemL(text="direction: X, Y, Z") + + row = box.row() + col = row.column(align=True) + col.itemR(part, "tangent_factor") + col.itemR(part, "tangent_phase", slider=True) + + col = row.column(align=True) + if part.type=='REACTOR': + col.itemR(part, "reactor_factor") + col.itemR(part, "reaction_shape", slider=True) + else: + col.itemL(text="") + + layout.row().itemL(text="Rotation:") + box = layout.box() + box.row().itemR(part, "rotation_dynamic") + + row = box.row() + col = row.column(align=True) + col.itemR(part, "rotation_mode", text="") + col.itemR(part, "random_rotation_factor", slider=True) + col = row.column(align=True) + col.itemR(part, "phase_factor", slider=True) + col.itemR(part, "random_phase_factor", text="Random", slider=True) + + + layout.row().itemL(text="Angular velocity:") + box = layout.box() + row = box.row() + row.itemR(part, "angular_velocity_mode", expand=True) + row.itemR(part, "angular_velocity_factor", text="") + +class PARTICLE_PT_physics(ParticleButtonsPanel): + __idname__= "PARTICLE_PT_physics" + __label__ = "Physics" + + def draw(self, context): + layout = self.layout + + psys = context.particle_system + part = psys.settings + + layout.enabled = layout.enabled = particle_panel_enabled(psys) + + layout.itemR(part, "effector_group") + + layout.itemL(text="General:") + box = layout.box() + row = box.row() + col = row.column(align=True) + col.itemR(part, "particle_size") + col.itemR(part, "random_size", slider=True) + col = row.column(align=True) + col.itemR(part, "mass") + col.itemR(part, "sizemass", text="Multiply mass with size") + + layout.row().itemL(text="") + + row = layout.row() + row.itemL(text="Physics Type:") + row.itemR(part, "physics_type", expand=True) + + if part.physics_type != 'NO': + box = layout.box() + row = box.row() + + if part.physics_type == 'NEWTON': + row.itemR(part, "integrator") + row = box.row() + col = row.column(align=True) + col.itemL(text="Forces:") + col.itemR(part, "brownian_factor") + col.itemR(part, "drag_factor", slider=True) + col.itemR(part, "damp_factor", slider=True) + + row.column().itemR(part, "acceleration") + elif part.physics_type == 'KEYED': + row.itemR(psys, "keyed_first") + if psys.keyed_first==True: + row.itemR(psys, "timed_keys", text="Key timing") + else: + row.itemR(part, "keyed_time") + + row = box.row() + row.itemL(text="Next key from object:") + row.itemR(psys, "keyed_object", text="") + row.itemR(psys, "keyed_particle_system") + + if part.physics_type=='NEWTON' or part.physics_type=='BOIDS': + row = box.row() + row.itemR(part, "size_deflect") + row.itemR(part, "die_on_collision") + row.itemR(part, "sticky") + +class PARTICLE_PT_render(ParticleButtonsPanel): + __idname__= "PARTICLE_PT_render" + __label__ = "Render" + + def poll(self, context): + return (context.particle_system != None) + + def draw(self, context): + layout = self.layout + + psys = context.particle_system + part = psys.settings + + row = layout.row() + row.itemR(part, "material") + col = row.column() + col.itemR(part, "emitter"); + col.itemR(part, "parent"); + col = row.column() + col.itemR(part, "unborn"); + col.itemR(part, "died"); + + row = layout.row() + row.itemR(part, "ren_as", expand=True) + + row = layout.row(align=True) + + if part.ren_as == 'LINE': + row.itemR(part, "line_length_tail") + row.itemR(part, "line_length_head") + row.itemR(part, "velocity_length") + elif part.ren_as == 'PATH': + + if (part.type!='HAIR' and psys.point_cache.baked==False): + box = layout.box() + box.itemL(text="Baked or keyed particles needed for correct rendering.") + return + + row.itemR(part, "hair_bspline") + row.itemR(part, "render_step", text="Steps") + + row = layout.row() + row.itemR(part, "abs_length") + col = row.column(align=True) + col.itemR(part, "absolute_length") + col.itemR(part, "random_length", slider=True) + + #row = layout.row() + #row.itemR(part, "timed_path") + #col = row.column(align=True) + #col.active = part.timed_path == True + #col.itemR(part, "line_length_tail", text="Start") + #col.itemR(part, "line_length_head", text="End") + + row = layout.row() + col = row.column() + col.itemR(part, "render_strand") + + subrow = col.row() + subrow.active = part.render_strand == False + subrow.itemR(part, "render_adaptive") + col = row.column(align=True) + subrow = col.row() + subrow.active = part.render_adaptive or part.render_strand == True + subrow.itemR(part, "adaptive_angle") + subrow = col.row() + subrow.active = part.render_adaptive == True and part.render_strand == False + subrow.itemR(part, "adaptive_pix") + + if part.type=='HAIR' and part.render_strand==True and part.child_type=='FACES': + layout.itemR(part, "enable_simplify") + if part.enable_simplify==True: + box = layout.box() + row = box.row() + row.itemR(part, "simplify_refsize") + row.itemR(part, "simplify_rate") + row.itemR(part, "simplify_transition") + row = box.row() + row.itemR(part, "viewport") + subrow = row.row() + subrow.active = part.viewport==True + subrow.itemR(part, "simplify_viewport") + + + elif part.ren_as == 'OBJECT': + row.itemR(part, "dupli_object") + elif part.ren_as == 'GROUP': + split = layout.split() + col = split.column() + row = col.row() + row.itemR(part, "whole_group") + subcol = row.column() + subcol.active = part.whole_group == False + subcol.itemR(part, "rand_group") + split.column().itemR(part, "dupli_group", text="") + elif part.ren_as == 'BILLBOARD': + row.itemL(text="Align:") + row.itemR(part, "billboard_lock", text="Lock") + row = layout.row() + row.itemR(part, "billboard_align", expand=True) + row = layout.row() + row.itemR(part, "billboard_object") + + row = layout.row() + col = row.column(align=True) + col.itemL(text="Tilt:") + col.itemR(part, "billboard_tilt", text="Angle", slider=True) + col.itemR(part, "billboard_random_tilt", slider=True) + col = row.column() + col.itemR(part, "billboard_offset") + + row = layout.row() + row.itemR(psys, "billboard_normal_uv") + row = layout.row() + row.itemR(psys, "billboard_time_index_uv") + + row = layout.row() + row.itemL(text="Split uv's:") + row.itemR(part, "billboard_uv_split", text="Number of splits") + row = layout.row() + row.itemR(psys, "billboard_split_uv") + row = layout.row() + row.itemL(text="Animate:") + row.itemR(part, "billboard_animation", expand=True) + row.itemL(text="Offset:") + row.itemR(part, "billboard_split_offset", expand=True) + +class PARTICLE_PT_draw(ParticleButtonsPanel): + __idname__= "PARTICLE_PT_draw" + __label__ = "Draw" + + def poll(self, context): + return (context.particle_system != None) + def draw(self, context): layout = self.layout psys = context.particle_system part = psys.settings + + row = layout.row() + row.itemR(part, "draw_as", expand=True) + + if part.draw_as=='NONE' or (part.ren_as=='NONE' and part.draw_as=='RENDER'): + return + + path = (part.ren_as=='PATH' and part.draw_as=='RENDER') or part.draw_as=='PATH' + + if path and part.type!='HAIR' and psys.point_cache.baked==False: + box = layout.box() + box.itemL(text="Baked or keyed particles needed for correct drawing.") + return + + row = layout.row() + row.itemR(part, "display", slider=True) + if part.draw_as!='RENDER' or part.ren_as=='HALO': + row.itemR(part, "draw_size") + else: + row.itemL(text="") + + row = layout.row() + col = row.column() + col.itemR(part, "show_size") + col.itemR(part, "velocity") + col.itemR(part, "num") + if part.physics_type == 'BOIDS': + col.itemR(part, "draw_health") + + col = row.column() + if (path): + box = col.box() + box.itemR(part, "draw_step") + else: + col.itemR(part, "material_color", text="Use material color") + subcol = col.column() + subcol.active = part.material_color==False + #subcol.itemL(text="color") + #subcol.itemL(text="Override material color") + + +class PARTICLE_PT_children(ParticleButtonsPanel): + __idname__= "PARTICLE_PT_children" + __label__ = "Children" + + def draw(self, context): + layout = self.layout + + psys = context.particle_system + part = psys.settings + + layout.row().itemR(part, "child_type", expand=True) + + if part.child_type=='NONE': + return + + row = layout.row() + + col = row.column(align=True) + col.itemR(part, "child_nbr", text="Draw") + col.itemR(part, "rendered_child_nbr", text="Render") + + col = row.column(align=True) + + if part.child_type=='FACES': + col.itemR(part, "virtual_parents", slider=True) + else: + col.itemR(part, "child_radius", text="Radius") + col.itemR(part, "child_roundness", text="Roundness", slider=True) + + col = row.column(align=True) + col.itemR(part, "child_size", text="Size") + col.itemR(part, "child_random_size", text="Random") + + layout.row().itemL(text="Effects:") + + row = layout.row() + + col = row.column(align=True) + col.itemR(part, "clump_factor", slider=True) + col.itemR(part, "clumppow", slider=True) + + col = row.column(align=True) + col.itemR(part, "rough_endpoint") + col.itemR(part, "rough_end_shape") + + row = layout.row() + + col = row.column(align=True) + col.itemR(part, "rough1") + col.itemR(part, "rough1_size") + + col = row.column(align=True) + col.itemR(part, "rough2") + col.itemR(part, "rough2_size") + col.itemR(part, "rough2_thres", slider=True) + + layout.row().itemL(text="Kink:") + layout.row().itemR(part, "kink", expand=True) + + row = layout.row() + row.itemR(part, "kink_amplitude") + row.itemR(part, "kink_frequency") + row.itemR(part, "kink_shape", slider=True) + + + +class PARTICLE_PT_vertexgroups(ParticleButtonsPanel): + __idname__= "PARTICLE_PT_vertexgroups" + __label__ = "Vertexgroups" + + def draw(self, context): + layout = self.layout + + psys = context.particle_system + part = psys.settings + + layout.itemL(text="Nothing here yet.") + + #row = layout.row() + #row.itemL(text="Vertex Group") + #row.itemL(text="Negate") - layout.itemR(part, "amount") + + #row = layout.row() + #row.itemR(psys, "vertex_group_density") + #row.itemR(psys, "vertex_group_density_negate", text="") + + #row = layout.row() + #row.itemR(psys, "vertex_group_velocity") + #row.itemR(psys, "vertex_group_velocity_negate", text="") + + #row = layout.row() + #row.itemR(psys, "vertex_group_length") + #row.itemR(psys, "vertex_group_length_negate", text="") + + #row = layout.row() + #row.itemR(psys, "vertex_group_clump") + #row.itemR(psys, "vertex_group_clump_negate", text="") + + #row = layout.row() + #row.itemR(psys, "vertex_group_kink") + #row.itemR(psys, "vertex_group_kink_negate", text="") + + #row = layout.row() + #row.itemR(psys, "vertex_group_roughness1") + #row.itemR(psys, "vertex_group_roughness1_negate", text="") + + #row = layout.row() + #row.itemR(psys, "vertex_group_roughness2") + #row.itemR(psys, "vertex_group_roughness2_negate", text="") + + #row = layout.row() + #row.itemR(psys, "vertex_group_roughness_end") + #row.itemR(psys, "vertex_group_roughness_end_negate", text="") + #row = layout.row() + #row.itemR(psys, "vertex_group_size") + #row.itemR(psys, "vertex_group_size_negate", text="") + + #row = layout.row() + #row.itemR(psys, "vertex_group_tangent") + #row.itemR(psys, "vertex_group_tangent_negate", text="") + + #row = layout.row() + #row.itemR(psys, "vertex_group_rotation") + #row.itemR(psys, "vertex_group_rotation_negate", text="") + + #row = layout.row() + #row.itemR(psys, "vertex_group_field") + #row.itemR(psys, "vertex_group_field_negate", text="") + bpy.types.register(PARTICLE_PT_particles) +bpy.types.register(PARTICLE_PT_cache) +bpy.types.register(PARTICLE_PT_emission) +bpy.types.register(PARTICLE_PT_initial) +bpy.types.register(PARTICLE_PT_physics) +bpy.types.register(PARTICLE_PT_render) +bpy.types.register(PARTICLE_PT_draw) +bpy.types.register(PARTICLE_PT_children) +bpy.types.register(PARTICLE_PT_vertexgroups) diff --git a/source/blender/blenkernel/BKE_particle.h b/source/blender/blenkernel/BKE_particle.h index db4d948216e..4efd9a7f8ba 100644 --- a/source/blender/blenkernel/BKE_particle.h +++ b/source/blender/blenkernel/BKE_particle.h @@ -251,7 +251,7 @@ struct ParticleSystemModifierData *psys_get_modifier(struct Object *ob, struct P struct ParticleSettings *psys_new_settings(char *name, struct Main *main); struct ParticleSettings *psys_copy_settings(struct ParticleSettings *part); -void psys_flush_settings(struct Scene *scene, struct ParticleSettings *part, int event, int hair_recalc); +void psys_flush_particle_settings(struct Scene *scene, struct ParticleSettings *part, int recalc); void make_local_particlesettings(struct ParticleSettings *part); struct LinkNode *psys_using_settings(struct Scene *scene, struct ParticleSettings *part, int flush_update); diff --git a/source/blender/blenkernel/intern/modifier.c b/source/blender/blenkernel/intern/modifier.c index 5610db355e1..ec8d28aee6c 100644 --- a/source/blender/blenkernel/intern/modifier.c +++ b/source/blender/blenkernel/intern/modifier.c @@ -6347,8 +6347,7 @@ static void particleSystemModifier_deformVerts( psmd->dm->getNumFaces(psmd->dm)!=psmd->totdmface){ /* in file read dm hasn't really changed but just wasn't saved in file */ - psys->recalc |= PSYS_RECALC_HAIR; - psys->recalc |= PSYS_DISTR; + psys->recalc |= PSYS_RECALC_RESET; psmd->flag |= eParticleSystemFlag_DM_changed; psmd->totdmvert= psmd->dm->getNumVerts(psmd->dm); diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c index 7d998a481f6..6cef9959d8b 100644 --- a/source/blender/blenkernel/intern/particle.c +++ b/source/blender/blenkernel/intern/particle.c @@ -348,8 +348,17 @@ void free_hair(ParticleSystem *psys, int softbody) } void free_keyed_keys(ParticleSystem *psys) { - if(psys->particles && psys->particles->keys) + if(psys->particles && psys->particles->keys) { + ParticleData *pa; + int i, totpart=psys->totpart; + MEM_freeN(psys->particles->keys); + + for(i=0, pa=psys->particles; i<totpart; i++,pa++){ + pa->keys = NULL; + pa->totkey = 0; + } + } } void free_child_path_cache(ParticleSystem *psys) { @@ -1739,12 +1748,12 @@ static void do_path_effectors(Scene *scene, Object *ob, ParticleSystem *psys, in Normalize(force); + VECADDFAC(ca->co, (ca-1)->co, force, *length); + if(k < steps) { VecSubf(vec, (ca+1)->co, ca->co); *length = VecLength(vec); } - - VECADDFAC(ca->co, (ca-1)->co, force, *length); } static int check_path_length(int k, ParticleCacheKey *keys, ParticleCacheKey *state, float max_length, float *cur_length, float length, float *dvec) { @@ -3052,42 +3061,22 @@ void make_local_particlesettings(ParticleSettings *part) } } -/* should be integrated to depgraph signals */ -void psys_flush_settings(struct Scene *scene, ParticleSettings *part, int event, int hair_recalc) +void psys_flush_particle_settings(Scene *scene, ParticleSettings *part, int recalc) { - Base *base; - Object *ob, *tob; + Base *base = scene->base.first; ParticleSystem *psys; int flush; - /* update all that have same particle settings */ - for(base = scene->base.first; base; base= base->next) { - if(base->object->particlesystem.first) { - ob=base->object; - flush=0; - for(psys=ob->particlesystem.first; psys; psys=psys->next){ - if(psys->part==part){ - psys->recalc |= event; - if(hair_recalc) - psys->recalc |= PSYS_RECALC_HAIR; - flush++; - } - else if(psys->part->type==PART_REACTOR){ - ParticleSystem *tpsys; - tob=psys->target_ob; - if(tob==0) - tob=ob; - tpsys=BLI_findlink(&tob->particlesystem,psys->target_psys-1); - - if(tpsys && tpsys->part==part){ - psys->recalc |= event; - flush++; - } - } + for(base = scene->base.first; base; base = base->next) { + flush = 0; + for(psys = base->object->particlesystem.first; psys; psys=psys->next) { + if(psys->part == part) { + psys->recalc |= recalc; + flush++; } - if(flush) - DAG_object_flush_update(scene, ob, OB_RECALC_DATA); } + if(flush) + DAG_object_flush_update(scene, base->object, OB_RECALC_DATA); } } diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c index f8b1852b728..f097af279b6 100644 --- a/source/blender/blenkernel/intern/particle_system.c +++ b/source/blender/blenkernel/intern/particle_system.c @@ -4173,10 +4173,10 @@ static void psys_update_path_cache(Scene *scene, Object *ob, ParticleSystemModif ParticleEditSettings *pset=&scene->toolsettings->particle; int distr=0,alloc=0; - if((psys->part->childtype && psys->totchild != get_psys_tot_child(scene, psys)) || psys->recalc&PSYS_ALLOC) + if((psys->part->childtype && psys->totchild != get_psys_tot_child(scene, psys)) || psys->recalc&PSYS_RECALC_RESET) alloc=1; - if(alloc || psys->recalc&PSYS_DISTR || (psys->vgroup[PSYS_VG_DENSITY] && (G.f & G_WEIGHTPAINT))) + if(alloc || psys->recalc&PSYS_RECALC_RESET || (psys->vgroup[PSYS_VG_DENSITY] && (G.f & G_WEIGHTPAINT))) distr=1; if(distr){ @@ -4194,8 +4194,9 @@ static void psys_update_path_cache(Scene *scene, Object *ob, ParticleSystemModif } } - if((part->type==PART_HAIR || psys->flag&PSYS_KEYED) && (psys_in_edit_mode(scene, psys) - || (part->type==PART_HAIR || part->draw_as==PART_DRAW_PATH))){ + if((part->type==PART_HAIR || psys->flag&PSYS_KEYED) && ( psys_in_edit_mode(scene, psys) || (part->type==PART_HAIR + || (part->ren_as == PART_DRAW_PATH && (part->draw_as == PART_DRAW_REND || psys->renderdata))))){ + psys_cache_paths(scene, ob, psys, cfra, 0); /* for render, child particle paths are computed on the fly */ @@ -4247,7 +4248,7 @@ static void hair_step(Scene *scene, Object *ob, ParticleSystemModifierData *psmd pa->flag &= ~PARS_NO_DISP; } - if(psys->recalc & PSYS_DISTR) + if(psys->recalc & PSYS_RECALC_RESET) /* need this for changing subsurf levels */ psys_calc_dmcache(ob, psmd->dm, psys); @@ -4367,16 +4368,14 @@ void psys_changed_type(ParticleSystem *psys) psys->flag &= ~PSYS_KEYED; if(part->type == PART_HAIR) { - part->draw_as = PART_DRAW_PATH; - part->rotfrom = PART_ROT_IINCR; - } - else { - free_hair(psys, 1); + if(ELEM4(part->ren_as, PART_DRAW_NOT, PART_DRAW_PATH, PART_DRAW_OB, PART_DRAW_GR)==0) + part->ren_as = PART_DRAW_PATH; - if(part->draw_as == PART_DRAW_PATH) - if(psys->part->phystype != PART_PHYS_KEYED) - part->draw_as = PART_DRAW_DOT; + if(ELEM3(part->draw_as, PART_DRAW_NOT, PART_DRAW_REND, PART_DRAW_PATH)==0) + part->draw_as = PART_DRAW_REND; } + else + free_hair(psys, 1); psys->softflag= 0; @@ -4574,7 +4573,7 @@ static void system_step(Scene *scene, Object *ob, ParticleSystem *psys, Particle init= 1; } - if(psys->recalc & PSYS_DISTR) { + if(psys->recalc & PSYS_RECALC_RESET) { distr= 1; init= 1; } @@ -4594,6 +4593,8 @@ static void system_step(Scene *scene, Object *ob, ParticleSystem *psys, Particle } if(only_children_changed==0) { + free_keyed_keys(psys); + initialize_all_particles(ob, psys, psmd); if(alloc) @@ -4747,8 +4748,8 @@ static void psys_to_softbody(Scene *scene, Object *ob, ParticleSystem *psys) static int hair_needs_recalc(ParticleSystem *psys) { if((psys->flag & PSYS_EDITED)==0 && - ((psys->flag & PSYS_HAIR_DONE)==0 || psys->recalc & PSYS_RECALC_HAIR)) { - psys->recalc &= ~PSYS_RECALC_HAIR; + ((psys->flag & PSYS_HAIR_DONE)==0 || psys->recalc & PSYS_RECALC_REDO)) { + psys->recalc &= ~PSYS_RECALC_REDO; return 1; } @@ -4778,6 +4779,9 @@ void particle_system_update(Scene *scene, Object *ob, ParticleSystem *psys) if(!psmd->dm) return; + if(psys->recalc & PSYS_RECALC_TYPE) + psys_changed_type(psys); + /* (re-)create hair */ if(psys->part->type==PART_HAIR && hair_needs_recalc(psys)) { float hcfra=0.0f; diff --git a/source/blender/blenkernel/intern/pointcache.c b/source/blender/blenkernel/intern/pointcache.c index 9c74014853d..b00755f7135 100644 --- a/source/blender/blenkernel/intern/pointcache.c +++ b/source/blender/blenkernel/intern/pointcache.c @@ -492,6 +492,8 @@ int BKE_ptcache_object_reset(Object *ob, int mode) else skip = 1; } + else if((psys->recalc & PSYS_RECALC_RESET)==0) + skip = 1; if(skip == 0) { BKE_ptcache_id_from_particles(&pid, ob, psys); diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 78a156559ff..c459d766937 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -8406,7 +8406,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) part->draw_as = PART_DRAW_PATH; part->type = PART_HAIR; - psys->recalc |= PSYS_RECALC_HAIR; + psys->recalc |= PSYS_RECALC_REDO; part->normfac *= fac; part->randfac *= fac; @@ -8872,6 +8872,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) Mesh *me; Scene *sce; Tex *tx; + ParticleSettings *part; for(screen= main->screen.first; screen; screen= screen->id.next) { do_versions_windowmanager_2_50(screen); @@ -8913,6 +8914,23 @@ static void do_versions(FileData *fd, Library *lib, Main *main) for(me= main->mesh.first; me; me= me->id.next) { me->drawflag= ME_DRAWEDGES|ME_DRAWFACES|ME_DRAWCREASES; } + + /* particle settings conversion */ + for(part= main->particle.first; part; part= part->id.next) { + if(part->draw_as) { + if(part->draw_as == PART_DRAW_DOT) { + part->ren_as = PART_DRAW_HALO; + part->draw_as = PART_DRAW_REND; + } + else if(part->draw_as <= PART_DRAW_AXIS) { + part->ren_as = PART_DRAW_HALO; + } + else { + part->ren_as = part->draw_as; + part->draw_as = PART_DRAW_REND; + } + } + } } /* TODO: should be moved into one of the version blocks once this branch moves to trunk and we can diff --git a/source/blender/editors/physics/editparticle.c b/source/blender/editors/physics/editparticle.c index 1c2b3c6b309..f60d5493058 100644 --- a/source/blender/editors/physics/editparticle.c +++ b/source/blender/editors/physics/editparticle.c @@ -3759,7 +3759,7 @@ static int set_editable_exec(bContext *C, wmOperator *op) PE_free_particle_edit(psys); psys->flag &= ~PSYS_EDITED; - psys->recalc |= PSYS_RECALC_HAIR; + psys->recalc |= PSYS_RECALC_RESET; DAG_object_flush_update(scene, ob, OB_RECALC_DATA); } diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c b/source/blender/editors/sculpt_paint/paint_vertex.c index 0c20c0cc1cf..0710079301b 100644 --- a/source/blender/editors/sculpt_paint/paint_vertex.c +++ b/source/blender/editors/sculpt_paint/paint_vertex.c @@ -1274,7 +1274,7 @@ static void wpaint_exit(bContext *C, wmOperator *op) for(psys= ob->particlesystem.first; psys; psys= psys->next) { for(i=0; i<PSYS_TOT_VG; i++) { if(psys->vgroup[i]==ob->actdef) { - psys->recalc |= PSYS_RECALC_HAIR; + psys->recalc |= PSYS_RECALC_RESET; break; } } diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index 054cd4e966e..a67e8c8a1c3 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -3042,7 +3042,11 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv } totpart=psys->totpart; - draw_as=part->draw_as; + + if(part->draw_as==PART_DRAW_REND) + draw_as = part->ren_as; + else + draw_as = part->draw_as; if(part->flag&PART_GLOB_TIME) cfra=bsystem_time(scene, 0, (float)CFRA, 0.0f); @@ -3489,7 +3493,6 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv glColorPointer(3, GL_FLOAT, 0, cdata); } - /* draw created data arrays */ switch(draw_as){ case PART_DRAW_AXIS: diff --git a/source/blender/editors/space_view3d/space_view3d.c b/source/blender/editors/space_view3d/space_view3d.c index 70f90a1a9d9..6e33b1dcaab 100644 --- a/source/blender/editors/space_view3d/space_view3d.c +++ b/source/blender/editors/space_view3d/space_view3d.c @@ -395,6 +395,7 @@ static void view3d_main_area_listener(ARegion *ar, wmNotifier *wmn) case ND_MODIFIER: case ND_CONSTRAINT: case ND_KEYS: + case ND_PARTICLE: ED_region_tag_redraw(ar); break; } diff --git a/source/blender/makesdna/DNA_particle_types.h b/source/blender/makesdna/DNA_particle_types.h index 575fcfd8ac7..6805082d094 100644 --- a/source/blender/makesdna/DNA_particle_types.h +++ b/source/blender/makesdna/DNA_particle_types.h @@ -106,6 +106,7 @@ typedef struct ParticleSettings { /* physics modes */ short phystype, rotmode, avemode, reactevent; short draw, draw_as, draw_size, childtype; + short ren_as, rt2[3]; /* number of path segments, power of 2 except */ short draw_step, ren_step; short hair_step, keys_step; @@ -302,12 +303,12 @@ typedef struct ParticleSystem{ /* note, make sure all (runtime) are NULL's in /* part->draw */ #define PART_DRAW_VEL 1 -#define PART_DRAW_ANG 2 +//#define PART_DRAW_PATH_LEN 2 #define PART_DRAW_SIZE 4 #define PART_DRAW_EMITTER 8 /* render emitter also */ -//#define PART_DRAW_KEYS 16 /* not used anywhere */ -#define PART_DRAW_ADAPT 32 -#define PART_DRAW_COS 64 +//#define PART_DRAW_HEALTH 16 +//#define PART_DRAW_TIMED_PATH 32 +//#define PART_DRAW_CACHED_PATH 64 #define PART_DRAW_BB_LOCK 128 #define PART_DRAW_PARENT 256 #define PART_DRAW_NUM 512 @@ -341,9 +342,11 @@ typedef struct ParticleSystem{ /* note, make sure all (runtime) are NULL's in #define PART_BB_OFF_LINEAR 1 #define PART_BB_OFF_RANDOM 2 -/* part->draw as */ +/* part->draw_as */ +/* part->ren_as*/ #define PART_DRAW_NOT 0 #define PART_DRAW_DOT 1 +#define PART_DRAW_HALO 1 #define PART_DRAW_CIRC 2 #define PART_DRAW_CROSS 3 #define PART_DRAW_AXIS 4 @@ -352,6 +355,7 @@ typedef struct ParticleSystem{ /* note, make sure all (runtime) are NULL's in #define PART_DRAW_OB 7 #define PART_DRAW_GR 8 #define PART_DRAW_BB 9 +#define PART_DRAW_REND 10 /* part->integrator */ #define PART_INT_EULER 0 @@ -382,11 +386,10 @@ typedef struct ParticleSystem{ /* note, make sure all (runtime) are NULL's in #define PART_CHILD_FACES 2 /* psys->recalc */ -#define PSYS_INIT 1 -#define PSYS_DISTR 2 -#define PSYS_ALLOC 4 -#define PSYS_TYPE 8 -#define PSYS_RECALC_HAIR 16 +#define PSYS_RECALC_REDO 1 /* only do pathcache etc */ +#define PSYS_RECALC_RESET 2 /* reset everything including pointcache */ +#define PSYS_RECALC_TYPE 4 /* handle system type change */ +#define PSYS_RECALC_CHILD 16 /* only child settings changed */ /* psys->flag */ #define PSYS_CURRENT 1 diff --git a/source/blender/makesrna/intern/rna_object_force.c b/source/blender/makesrna/intern/rna_object_force.c index d20552cbdb0..c3e1931c439 100644 --- a/source/blender/makesrna/intern/rna_object_force.c +++ b/source/blender/makesrna/intern/rna_object_force.c @@ -53,6 +53,13 @@ static void rna_def_pointcache(BlenderRNA *brna) RNA_def_property_int_sdna(prop, NULL, "endframe"); RNA_def_property_range(prop, 1, 300000); RNA_def_property_ui_text(prop, "End", "Frame on which the simulation stops."); + + /* flags */ + prop= RNA_def_property(srna, "baked", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", PTCACHE_BAKED); + + prop= RNA_def_property(srna, "baking", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", PTCACHE_BAKING); } static void rna_def_collision(BlenderRNA *brna) diff --git a/source/blender/makesrna/intern/rna_particle.c b/source/blender/makesrna/intern/rna_particle.c index ee755fca27e..7c4f4eba27f 100644 --- a/source/blender/makesrna/intern/rna_particle.c +++ b/source/blender/makesrna/intern/rna_particle.c @@ -35,9 +35,59 @@ #include "DNA_particle_types.h" #include "DNA_object_force.h" #include "DNA_object_types.h" +#include "DNA_scene_types.h" + +#include "WM_types.h" #ifdef RNA_RUNTIME +#include "BKE_context.h" +#include "BKE_depsgraph.h" +#include "BKE_particle.h" + +static void rna_Particle_redo(bContext *C, PointerRNA *ptr) +{ + ParticleSettings *part; + if(ptr->type==&RNA_ParticleSystem) + part = ((ParticleSystem*)ptr->data)->part; + else + part = ptr->id.data; + + psys_flush_particle_settings(CTX_data_scene(C), part, PSYS_RECALC_REDO); +} + +static void rna_Particle_reset(bContext *C, PointerRNA *ptr) +{ + ParticleSettings *part; + if(ptr->type==&RNA_ParticleSystem) + part = ((ParticleSystem*)ptr->data)->part; + else + part = ptr->id.data; + + psys_flush_particle_settings(CTX_data_scene(C), part, PSYS_RECALC_RESET|PSYS_RECALC_REDO); +} + +static void rna_Particle_change_type(bContext *C, PointerRNA *ptr) +{ + ParticleSettings *part; + if(ptr->type==&RNA_ParticleSystem) + part = ((ParticleSystem*)ptr->data)->part; + else + part = ptr->id.data; + + psys_flush_particle_settings(CTX_data_scene(C), part, PSYS_RECALC_RESET|PSYS_RECALC_TYPE|PSYS_RECALC_REDO); +} + +static void rna_Particle_redo_child(bContext *C, PointerRNA *ptr) +{ + ParticleSettings *part; + if(ptr->type==&RNA_ParticleSystem) + part = ((ParticleSystem*)ptr->data)->part; + else + part = ptr->id.data; + + psys_flush_particle_settings(CTX_data_scene(C), part, PSYS_RECALC_CHILD); +} static void rna_PartSettings_start_set(struct PointerRNA *ptr, float value) { ParticleSettings *settings = (ParticleSettings*)ptr->data; @@ -111,6 +161,88 @@ static void rna_ParticleSystem_name_get(PointerRNA *ptr, char *str) strcat(str, psys->part->id.name+2); } +static EnumPropertyItem from_items[] = { + {PART_FROM_VERT, "VERT", "Vertexes", ""}, + {PART_FROM_FACE, "FACE", "Faces", ""}, + {PART_FROM_VOLUME, "VOLUME", "Volume", ""}, + {0, NULL, NULL, NULL} +}; + +static EnumPropertyItem reactor_from_items[] = { + {PART_FROM_VERT, "VERT", "Vertexes", ""}, + {PART_FROM_FACE, "FACE", "Faces", ""}, + {PART_FROM_VOLUME, "VOLUME", "Volume", ""}, + {PART_FROM_PARTICLE, "PARTICLE", "Particle", ""}, + {0, NULL, NULL, NULL} +}; + +static EnumPropertyItem *rna_Particle_from_itemf(PointerRNA *ptr) +{ + ParticleSettings *part = ptr->id.data; + + if(part->type==PART_REACTOR) + return reactor_from_items; + else + return from_items; +} + +static EnumPropertyItem draw_as_items[] = { + {PART_DRAW_NOT, "NONE", "None", ""}, + {PART_DRAW_REND, "RENDER", "Rendered", ""}, + {PART_DRAW_DOT, "DOT", "Point", ""}, + {PART_DRAW_CIRC, "CIRC", "Circle", ""}, + {PART_DRAW_CROSS, "CROSS", "Cross", ""}, + {PART_DRAW_AXIS, "AXIS", "Axis", ""}, + {0, NULL, NULL, NULL} +}; + +static EnumPropertyItem hair_draw_as_items[] = { + {PART_DRAW_NOT, "NONE", "None", ""}, + {PART_DRAW_REND, "RENDER", "Rendered", ""}, + {PART_DRAW_PATH, "PATH", "Path", ""}, + {0, NULL, NULL, NULL} +}; + +static EnumPropertyItem ren_as_items[] = { + {PART_DRAW_NOT, "NONE", "None", ""}, + {PART_DRAW_HALO, "HALO", "Halo", ""}, + {PART_DRAW_LINE, "LINE", "Line", ""}, + {PART_DRAW_PATH, "PATH", "Path", ""}, + {PART_DRAW_OB, "OBJECT", "Object", ""}, + {PART_DRAW_GR, "GROUP", "Group", ""}, + {PART_DRAW_BB, "BILLBOARD", "Billboard", ""}, + {0, NULL, NULL, NULL} +}; + +static EnumPropertyItem hair_ren_as_items[] = { + {PART_DRAW_NOT, "NONE", "None", ""}, + {PART_DRAW_PATH, "PATH", "Path", ""}, + {PART_DRAW_OB, "OBJECT", "Object", ""}, + {PART_DRAW_GR, "GROUP", "Group", ""}, + {0, NULL, NULL, NULL} +}; + +static EnumPropertyItem *rna_Particle_draw_as_itemf(PointerRNA *ptr) +{ + ParticleSettings *part = ptr->id.data; + + if(part->type==PART_HAIR) + return hair_draw_as_items; + else + return draw_as_items; +} + +static EnumPropertyItem *rna_Particle_ren_as_itemf(PointerRNA *ptr) +{ + ParticleSettings *part = ptr->id.data; + + if(part->type==PART_HAIR) + return hair_ren_as_items; + else + return ren_as_items; +} + + #else static void rna_def_particle_hair_key(BlenderRNA *brna) @@ -326,16 +458,6 @@ static void rna_def_particle_settings(BlenderRNA *brna) {PART_EMITTER, "EMITTER", "Emitter", ""}, {PART_REACTOR, "REACTOR", "Reactor", ""}, {PART_HAIR, "HAIR", "Hair", ""}, - {PART_FLUID, "FLUID", "Fluid", ""}, - {0, NULL, NULL, NULL} - }; - - static EnumPropertyItem from_items[] = { - {PART_FROM_VERT, "VERT", "Vertexes", ""}, - {PART_FROM_FACE, "FACE", "Faces", ""}, - {PART_FROM_VOLUME, "VOLUME", "Volume", ""}, - {PART_FROM_PARTICLE, "PARTICLE", "Particle", ""}, - {PART_FROM_CHILD, "CHILD", "Child", ""}, {0, NULL, NULL, NULL} }; @@ -347,7 +469,7 @@ static void rna_def_particle_settings(BlenderRNA *brna) }; static EnumPropertyItem phys_type_items[] = { - {PART_PHYS_NO, "NO", "no", ""}, + {PART_PHYS_NO, "NO", "No", ""}, {PART_PHYS_NEWTON, "NEWTON", "Newtonian", ""}, {PART_PHYS_KEYED, "KEYED", "Keyed", ""}, {PART_PHYS_BOIDS, "BOIDS", "Boids", ""}, @@ -381,20 +503,6 @@ static void rna_def_particle_settings(BlenderRNA *brna) {0, NULL, NULL, NULL} }; - static EnumPropertyItem draw_as_items[] = { - {PART_DRAW_NOT, "NONE", "None", ""}, - {PART_DRAW_DOT, "DOT", "Point", ""}, - {PART_DRAW_CIRC, "CIRC", "Circle", ""}, - {PART_DRAW_CROSS, "CROSS", "Cross", ""}, - {PART_DRAW_AXIS, "AXIS", "Axis", ""}, - {PART_DRAW_LINE, "LINE", "Line", ""}, - {PART_DRAW_PATH, "PATH", "Path", ""}, - {PART_DRAW_OB, "OBJECT", "Object", ""}, - {PART_DRAW_GR, "GROUP", "Group", ""}, - {PART_DRAW_BB, "BILLBOARD", "Billboard", ""}, - {0, NULL, NULL, NULL} - }; - static EnumPropertyItem child_type_items[] = { {0, "NONE", "None", ""}, {PART_CHILD_PARTICLES, "PARTICLES", "Particles", ""}, @@ -466,15 +574,19 @@ static void rna_def_particle_settings(BlenderRNA *brna) prop= RNA_def_property(srna, "react_start_end", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_REACT_STA_END); RNA_def_property_ui_text(prop, "Start/End", "Give birth to unreacted particles eventually."); + RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_reset"); prop= RNA_def_property(srna, "react_multiple", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_REACT_MULTIPLE); RNA_def_property_ui_text(prop, "Multi React", "React multiple times."); + RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_reset"); prop= RNA_def_property(srna, "loop", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_LOOP); RNA_def_property_ui_text(prop, "Loop", "Loop particle lives."); + RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_reset"); + /* TODO: used somewhere? */ prop= RNA_def_property(srna, "hair_geometry", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_HAIR_GEOMETRY); RNA_def_property_ui_text(prop, "Hair Geometry", "");//TODO: tooltip @@ -482,83 +594,104 @@ static void rna_def_particle_settings(BlenderRNA *brna) prop= RNA_def_property(srna, "unborn", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_UNBORN); RNA_def_property_ui_text(prop, "Unborn", "Show particles before they are emitted."); + RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo"); prop= RNA_def_property(srna, "died", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_DIED); RNA_def_property_ui_text(prop, "Died", "Show particles after they have died"); + RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo"); prop= RNA_def_property(srna, "trand", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_TRAND); RNA_def_property_ui_text(prop, "Random", "Emit in random order of elements"); + RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_reset"); prop= RNA_def_property(srna, "even_distribution", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_EDISTR); RNA_def_property_ui_text(prop, "Even Distribution", "Use even distribution from faces based on face areas or edge lengths."); + RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_reset"); prop= RNA_def_property(srna, "sticky", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_STICKY); RNA_def_property_ui_text(prop, "Sticky", "Particles stick to collided objects if they die in the collision."); + RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_reset"); prop= RNA_def_property(srna, "die_on_collision", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_DIE_ON_COL); RNA_def_property_ui_text(prop, "Die on hit", "Particles die when they collide with a deflector object."); + RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_reset"); prop= RNA_def_property(srna, "size_deflect", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_SIZE_DEFL); RNA_def_property_ui_text(prop, "Size Deflect", "Use particle's size in deflection."); + RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_reset"); prop= RNA_def_property(srna, "rotation_dynamic", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_ROT_DYN); RNA_def_property_ui_text(prop, "Dynamic", "Sets rotation to dynamic/constant"); + RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_reset"); prop= RNA_def_property(srna, "sizemass", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_SIZEMASS); RNA_def_property_ui_text(prop, "Mass from Size", "Multiply mass with particle size."); + RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_reset"); prop= RNA_def_property(srna, "abs_length", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_ABS_LENGTH); RNA_def_property_ui_text(prop, "Abs Length", "Use maximum length for children"); + RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo"); prop= RNA_def_property(srna, "absolute_time", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_ABS_TIME); RNA_def_property_ui_text(prop, "Absolute Time", "Set all ipos that work on particles to be calculated in absolute/relative time."); + RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_reset"); prop= RNA_def_property(srna, "global_time", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_GLOB_TIME); RNA_def_property_ui_text(prop, "Global Time", "Set all ipos that work on particles to be calculated in global/object time."); + RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_reset"); prop= RNA_def_property(srna, "boids_2d", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_BOIDS_2D); RNA_def_property_ui_text(prop, "Boids 2D", "Constrain boids to a surface"); + RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_reset"); prop= RNA_def_property(srna, "branching", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_BRANCHING); RNA_def_property_ui_text(prop, "Branching", "Branch child paths from each other."); + RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo_child"); prop= RNA_def_property(srna, "animate_branching", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_ANIM_BRANCHING); RNA_def_property_ui_text(prop, "Animated", "Animate branching"); + RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo_child"); prop= RNA_def_property(srna, "symmetric_branching", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_SYMM_BRANCHING); RNA_def_property_ui_text(prop, "Symmetric", "Start and end points are the same."); + RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo_child"); prop= RNA_def_property(srna, "hair_bspline", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_HAIR_BSPLINE); RNA_def_property_ui_text(prop, "B-Spline", "Interpolate hair using B-Splines."); + RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo"); prop= RNA_def_property(srna, "grid_invert", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_GRID_INVERT); RNA_def_property_ui_text(prop, "Invert", "Invert what is considered object and what is not."); + RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_reset"); prop= RNA_def_property(srna, "child_effector", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_CHILD_EFFECT); RNA_def_property_ui_text(prop, "Children", "Apply effectors to children."); + RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo"); prop= RNA_def_property(srna, "child_seams", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_CHILD_SEAMS); RNA_def_property_ui_text(prop, "Use seams", "Use seams to determine parents"); + RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo_child"); + /* TODO: used somewhere? */ prop= RNA_def_property(srna, "child_render", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_CHILD_RENDER); RNA_def_property_ui_text(prop, "child_render", ""); @@ -566,129 +699,164 @@ static void rna_def_particle_settings(BlenderRNA *brna) prop= RNA_def_property(srna, "child_guide", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_CHILD_GUIDE); RNA_def_property_ui_text(prop, "child_guide", ""); + RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo"); prop= RNA_def_property(srna, "self_effect", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_SELF_EFFECT); RNA_def_property_ui_text(prop, "Self Effect", "Particle effectors effect themselves."); + RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_reset"); prop= RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE); RNA_def_property_enum_items(prop, type_items); RNA_def_property_ui_text(prop, "Type", ""); + RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_change_type"); prop= RNA_def_property(srna, "emit_from", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "from"); - RNA_def_property_enum_items(prop, from_items); + RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_Particle_from_itemf"); RNA_def_property_ui_text(prop, "Emit From", "Where to emit particles from"); + RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_reset"); prop= RNA_def_property(srna, "distribution", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "distr"); RNA_def_property_enum_items(prop, dist_items); RNA_def_property_ui_text(prop, "Distribution", "How to distribute particles on selected element"); + RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_reset"); /* physics modes */ prop= RNA_def_property(srna, "physics_type", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "phystype"); RNA_def_property_enum_items(prop, phys_type_items); RNA_def_property_ui_text(prop, "Physics Type", "Particle physics type"); + RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_reset"); prop= RNA_def_property(srna, "rotation_mode", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "rotmode"); RNA_def_property_enum_items(prop, rot_mode_items); RNA_def_property_ui_text(prop, "Rotation", "Particles initial rotation"); + RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_reset"); prop= RNA_def_property(srna, "angular_velocity_mode", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "avemode"); RNA_def_property_enum_items(prop, ave_mode_items); RNA_def_property_ui_text(prop, "Angular Velocity Mode", "Particle angular velocity mode."); + RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_reset"); prop= RNA_def_property(srna, "react_event", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "reactevent"); RNA_def_property_enum_items(prop, react_event_items); RNA_def_property_ui_text(prop, "React On", "The event of target particles to react on."); + RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_reset"); /*draw flag*/ prop= RNA_def_property(srna, "velocity", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_VEL); RNA_def_property_ui_text(prop, "Velocity", "Show particle velocity"); + RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo"); - /* used? - prop= RNA_def_property(srna, "angle", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_ANG); - RNA_def_property_ui_text(prop, "Angle", ""); - */ + //prop= RNA_def_property(srna, "draw_path_length", PROP_BOOLEAN, PROP_NONE); + //RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_PATH_LEN); + //RNA_def_property_ui_text(prop, "Path length", "Draw path length"); + //RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo"); prop= RNA_def_property(srna, "show_size", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_SIZE); RNA_def_property_ui_text(prop, "Size", "Show particle size"); + RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo"); prop= RNA_def_property(srna, "emitter", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_EMITTER); RNA_def_property_ui_text(prop, "Emitter", "Render emitter Object also."); + RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo"); - /* used? - prop= RNA_def_property(srna, "adapt", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_ADAPT); - RNA_def_property_ui_text(prop, "adapt", ""); + //prop= RNA_def_property(srna, "draw_health", PROP_BOOLEAN, PROP_NONE); + //RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_HEALTH); + //RNA_def_property_ui_text(prop, "Health", "Draw boid health"); + //RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo"); - prop= RNA_def_property(srna, "cos", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_COS); - RNA_def_property_ui_text(prop, "cos", ""); - */ + //prop= RNA_def_property(srna, "timed_path", PROP_BOOLEAN, PROP_NONE); + //RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_TIMED_PATH); + //RNA_def_property_ui_text(prop, "Clip with time", "Clip path based on time"); + //RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo"); + + //prop= RNA_def_property(srna, "draw_cached_path", PROP_BOOLEAN, PROP_NONE); + //RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_CACHED_PATH); + //RNA_def_property_ui_text(prop, "Path", "Draw particle path if the path is baked"); + //RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo"); prop= RNA_def_property(srna, "billboard_lock", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_BB_LOCK); RNA_def_property_ui_text(prop, "Lock Billboard", "Lock the billboards align axis"); + RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo"); prop= RNA_def_property(srna, "parent", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_PARENT); RNA_def_property_ui_text(prop, "Parents", "Render parent particles."); + RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo"); prop= RNA_def_property(srna, "num", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_NUM); RNA_def_property_ui_text(prop, "Number", "Show particle number"); + RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo"); prop= RNA_def_property(srna, "rand_group", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_RAND_GR); RNA_def_property_ui_text(prop, "Pick Random", "Pick objects from group randomly"); + RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo"); prop= RNA_def_property(srna, "render_adaptive", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_REN_ADAPT); RNA_def_property_ui_text(prop, "Adaptive render", "Draw steps of the particle path"); + RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo"); prop= RNA_def_property(srna, "velocity_length", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_VEL_LENGTH); RNA_def_property_ui_text(prop, "Speed", "Multiply line length by particle speed"); + RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo"); prop= RNA_def_property(srna, "material_color", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_MAT_COL); RNA_def_property_ui_text(prop, "Material Color", "Draw particles using material's diffuse color."); + RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo"); prop= RNA_def_property(srna, "whole_group", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_WHOLE_GR); - RNA_def_property_ui_text(prop, "Dupli Group", "Use whole group at once."); + RNA_def_property_ui_text(prop, "Whole Group", "Use whole group at once."); + RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo"); prop= RNA_def_property(srna, "render_strand", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_REN_STRAND); RNA_def_property_ui_text(prop, "Strand render", "Use the strand primitive for rendering"); - + RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo"); prop= RNA_def_property(srna, "draw_as", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_items(prop, draw_as_items); - RNA_def_property_ui_text(prop, "Particle Visualization", "How particles are visualized"); + RNA_def_property_enum_sdna(prop, NULL, "draw_as"); + RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_Particle_draw_as_itemf"); + RNA_def_property_ui_text(prop, "Particle Drawing", "How particles are drawn in viewport"); + RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo"); + + prop= RNA_def_property(srna, "ren_as", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "ren_as"); + RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_Particle_ren_as_itemf"); + RNA_def_property_ui_text(prop, "Particle Rendering", "How particles are rendered"); + RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo"); prop= RNA_def_property(srna, "draw_size", PROP_INT, PROP_NONE); RNA_def_property_range(prop, 0, 10); RNA_def_property_ui_text(prop, "Draw Size", "Size of particles on viewport in pixels (0=default)"); + RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo"); prop= RNA_def_property(srna, "child_type", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "childtype"); RNA_def_property_enum_items(prop, child_type_items); RNA_def_property_ui_text(prop, "Children From", "Create child particles"); + RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo"); prop= RNA_def_property(srna, "draw_step", PROP_INT, PROP_NONE); RNA_def_property_range(prop, 0, 7); RNA_def_property_ui_text(prop, "Steps", "How many steps paths are drawn with (power of 2)"); + RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo"); prop= RNA_def_property(srna, "render_step", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "ren_step"); @@ -697,7 +865,9 @@ static void rna_def_particle_settings(BlenderRNA *brna) prop= RNA_def_property(srna, "hair_step", PROP_INT, PROP_NONE); RNA_def_property_range(prop, 2, 50); - RNA_def_property_ui_text(prop, "Segments", "Amount of hair segments"); + RNA_def_property_ui_text(prop, "Segments", "Number of hair segments"); + RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo"); + //TODO: not found in UI, readonly? prop= RNA_def_property(srna, "keys_step", PROP_INT, PROP_NONE); @@ -719,11 +889,13 @@ static void rna_def_particle_settings(BlenderRNA *brna) RNA_def_property_int_sdna(prop, NULL, "disp"); RNA_def_property_range(prop, 0, 100); RNA_def_property_ui_text(prop, "Display", "Percentage of particles to display in 3d view"); + RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo"); prop= RNA_def_property(srna, "material", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "omat"); RNA_def_property_range(prop, 1, 16); RNA_def_property_ui_text(prop, "Material", "Specify material used for the particles"); + RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo"); //interpolation @@ -738,14 +910,17 @@ static void rna_def_particle_settings(BlenderRNA *brna) prop= RNA_def_property(srna, "integrator", PROP_ENUM, PROP_NONE); RNA_def_property_enum_items(prop, integrator_type_items); RNA_def_property_ui_text(prop, "Integration", "Select physics integrator type"); + RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_reset"); prop= RNA_def_property(srna, "kink", PROP_ENUM, PROP_NONE); RNA_def_property_enum_items(prop, kink_type_items); RNA_def_property_ui_text(prop, "Kink", "Type of periodic offset on the path"); + RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo_child"); prop= RNA_def_property(srna, "kink_axis", PROP_ENUM, PROP_NONE); RNA_def_property_enum_items(prop, kink_axis_items); RNA_def_property_ui_text(prop, "Axis", "Which axis to use for offset"); + RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo_child"); /* used? prop= RNA_def_property(srna, "inbetween", PROP_INT, PROP_NONE); @@ -758,12 +933,14 @@ static void rna_def_particle_settings(BlenderRNA *brna) RNA_def_property_int_sdna(prop, NULL, "boidneighbours"); RNA_def_property_range(prop, 1, 10); RNA_def_property_ui_text(prop, "Neighbours", "How many neighbours to consider for each boid"); + RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_reset"); /* billboards */ prop= RNA_def_property(srna, "billboard_align", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "bb_align"); RNA_def_property_enum_items(prop, bb_align_items); RNA_def_property_ui_text(prop, "Align to", "In respect to what the billboards are aligned"); + RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo"); prop= RNA_def_property(srna, "billboard_uv_split", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "bb_uv_split"); @@ -784,17 +961,20 @@ static void rna_def_particle_settings(BlenderRNA *brna) RNA_def_property_float_sdna(prop, NULL, "bb_tilt"); RNA_def_property_range(prop, -1.0f, 1.0f); RNA_def_property_ui_text(prop, "Tilt", "Tilt of the billboards"); + RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo"); prop= RNA_def_property(srna, "billboard_random_tilt", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "bb_rand_tilt"); RNA_def_property_range(prop, 0.0f, 1.0f); RNA_def_property_ui_text(prop, "Random Tilt", "Random tilt of the billboards"); + RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo"); prop= RNA_def_property(srna, "billboard_offset", PROP_FLOAT, PROP_VECTOR); RNA_def_property_float_sdna(prop, NULL, "bb_offset"); RNA_def_property_array(prop, 2); RNA_def_property_range(prop, -1.0f, 1.0f); RNA_def_property_ui_text(prop, "Billboard Offset", ""); + RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo"); /* simplification */ prop= RNA_def_property(srna, "enable_simplify", PROP_BOOLEAN, PROP_NONE); @@ -828,39 +1008,47 @@ static void rna_def_particle_settings(BlenderRNA *brna) RNA_def_property_range(prop, -30000.0f, 30000.0f); //TODO: replace 30000 with MAXFRAMEF when available in 2.5 RNA_def_property_float_funcs(prop, NULL, "rna_PartSettings_start_set", NULL); RNA_def_property_ui_text(prop, "Start", "Frame # to start emitting particles."); + RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_reset"); prop= RNA_def_property(srna, "end", PROP_FLOAT, PROP_NONE); RNA_def_property_range(prop, -30000.0f, 30000.0f); //TODO: replace 30000 with MAXFRAMEF when available in 2.5 RNA_def_property_float_funcs(prop, NULL, "rna_PartSettings_end_set", NULL); RNA_def_property_ui_text(prop, "End", "Frame # to stop emitting particles."); + RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_reset"); prop= RNA_def_property(srna, "lifetime", PROP_FLOAT, PROP_NONE); RNA_def_property_range(prop, 1.0f, 30000.0f); RNA_def_property_ui_text(prop, "Lifetime", "Specify the life span of the particles"); + RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_reset"); prop= RNA_def_property(srna, "random_lifetime", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "randlife"); - RNA_def_property_range(prop, 0.0f, 2.0f); + RNA_def_property_range(prop, 0.0f, 1.0f); RNA_def_property_ui_text(prop, "Random", "Give the particle life a random variation."); + RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_reset"); prop= RNA_def_property(srna, "time_tweak", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "timetweak"); RNA_def_property_range(prop, 0.0f, 10.0f); RNA_def_property_ui_text(prop, "Tweak", "A multiplier for physics timestep (1.0 means one frame = 1/25 seconds)"); + RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_reset"); prop= RNA_def_property(srna, "jitter_factor", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "jitfac"); RNA_def_property_range(prop, 0.0f, 2.0f); RNA_def_property_ui_text(prop, "Amount", "Amount of jitter applied to the sampling."); + RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_reset"); prop= RNA_def_property(srna, "keyed_time", PROP_FLOAT, PROP_NONE); RNA_def_property_range(prop, 0.0f, 1.0f); RNA_def_property_ui_text(prop, "Time", "Keyed key time relative to remaining particle life."); + RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_reset"); prop= RNA_def_property(srna, "effect_hair", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "eff_hair"); RNA_def_property_range(prop, 0.0f, 1.0f); RNA_def_property_ui_text(prop, "Stiffnes", "Hair stiffness for effectors"); + RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo"); //float rt; TODO:find where rt is used - can't find it in UI @@ -868,92 +1056,110 @@ static void rna_def_particle_settings(BlenderRNA *brna) RNA_def_property_int_sdna(prop, NULL, "totpart"); RNA_def_property_range(prop, 0, 100000); RNA_def_property_ui_text(prop, "Amount", "Total number of particles."); + RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_reset"); prop= RNA_def_property(srna, "userjit", PROP_INT, PROP_UNSIGNED);//TODO: can we get a better name for userjit? RNA_def_property_int_sdna(prop, NULL, "userjit"); RNA_def_property_range(prop, 0, 1000); RNA_def_property_ui_text(prop, "P/F", "Emission locations / face (0 = automatic)."); + RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_reset"); prop= RNA_def_property(srna, "grid_resolution", PROP_INT, PROP_UNSIGNED); RNA_def_property_int_sdna(prop, NULL, "grid_res"); RNA_def_property_range(prop, 1, 100); RNA_def_property_ui_text(prop, "Resolution", "The resolution of the particle grid."); + RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_reset"); /* initial velocity factors */ prop= RNA_def_property(srna, "normal_factor", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "normfac");//optional if prop names are the same RNA_def_property_range(prop, -200.0f, 200.0f); RNA_def_property_ui_text(prop, "Normal", "Let the surface normal give the particle a starting speed."); + RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_reset"); prop= RNA_def_property(srna, "object_factor", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "obfac"); RNA_def_property_range(prop, -1.0f, 1.0f); RNA_def_property_ui_text(prop, "Object", "Let the object give the particle a starting speed"); + RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_reset"); prop= RNA_def_property(srna, "random_factor", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "randfac");//optional if prop names are the same RNA_def_property_range(prop, 0.0f, 200.0f); RNA_def_property_ui_text(prop, "Random", "Give the starting speed a random variation."); + RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_reset"); prop= RNA_def_property(srna, "particle_factor", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "partfac"); RNA_def_property_range(prop, -10.0f, 10.0f); RNA_def_property_ui_text(prop, "Particle", "Let the target particle give the particle a starting speed."); + RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_reset"); prop= RNA_def_property(srna, "tangent_factor", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "tanfac"); RNA_def_property_range(prop, -200.0f, 200.0f); RNA_def_property_ui_text(prop, "Tangent", "Let the surface tangent give the particle a starting speed."); + RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_reset"); prop= RNA_def_property(srna, "tangent_phase", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "tanphase"); RNA_def_property_range(prop, -1.0f, 1.0f); RNA_def_property_ui_text(prop, "Rot", "Rotate the surface tangent."); + RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_reset"); prop= RNA_def_property(srna, "reactor_factor", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "reactfac"); RNA_def_property_range(prop, -10.0f, 10.0f); RNA_def_property_ui_text(prop, "Reactor", "Let the vector away from the target particles location give the particle a starting speed."); + RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_reset"); prop= RNA_def_property(srna, "angular_velocity_factor", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "avefac"); RNA_def_property_range(prop, -200.0f, 200.0f); RNA_def_property_ui_text(prop, "Angular Velocity", "Angular velocity amount"); + RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_reset"); prop= RNA_def_property(srna, "phase_factor", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "phasefac"); RNA_def_property_range(prop, -1.0f, 1.0f); RNA_def_property_ui_text(prop, "Phase", "Initial rotation phase"); + RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_reset"); prop= RNA_def_property(srna, "random_rotation_factor", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "randrotfac"); RNA_def_property_range(prop, 0.0f, 1.0f); RNA_def_property_ui_text(prop, "Random Rotation", "Randomize rotation"); + RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_reset"); prop= RNA_def_property(srna, "random_phase_factor", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "randphasefac"); RNA_def_property_range(prop, 0.0f, 1.0f); RNA_def_property_ui_text(prop, "Random Phase", "Randomize rotation phase"); + RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_reset"); /* physical properties */ prop= RNA_def_property(srna, "mass", PROP_FLOAT, PROP_NONE); RNA_def_property_range(prop, 0.01f, 100.0f); RNA_def_property_ui_text(prop, "Mass", "Specify the mass of the particles"); + RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_reset"); prop= RNA_def_property(srna, "particle_size", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "size"); RNA_def_property_range(prop, 0.01f, 100.0f); RNA_def_property_ui_text(prop, "Size", "The size of the particles"); + RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_reset"); prop= RNA_def_property(srna, "random_size", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "randsize"); RNA_def_property_range(prop, 0.0f, 1.0f); RNA_def_property_ui_text(prop, "Random Size", "Give the particle size a random variation"); + RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_reset"); prop= RNA_def_property(srna, "reaction_shape", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "reactshape"); RNA_def_property_range(prop, 0.0f, 10.0f); RNA_def_property_ui_text(prop, "Shape", "Power of reaction strength dependence on distance to target."); + RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_reset"); /* global physical properties */ @@ -962,21 +1168,25 @@ static void rna_def_particle_settings(BlenderRNA *brna) RNA_def_property_array(prop, 3); RNA_def_property_range(prop, -200.0f, 200.0f); RNA_def_property_ui_text(prop, "Accelaration", "Constant acceleration"); + RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_reset"); prop= RNA_def_property(srna, "drag_factor", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "dragfac"); RNA_def_property_range(prop, 0.0f, 1.0f); RNA_def_property_ui_text(prop, "Drag", "Specify the amount of air-drag."); + RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_reset"); prop= RNA_def_property(srna, "brownian_factor", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "brownfac"); RNA_def_property_range(prop, 0.0f, 200.0f); RNA_def_property_ui_text(prop, "Brownian", "Specify the amount of brownian motion"); + RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_reset"); prop= RNA_def_property(srna, "damp_factor", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "dampfac"); RNA_def_property_range(prop, 0.0f, 1.0f); RNA_def_property_ui_text(prop, "Damp", "Specify the amount of damping"); + RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_reset"); /* length */ //TODO: is this readonly? @@ -989,64 +1199,75 @@ static void rna_def_particle_settings(BlenderRNA *brna) RNA_def_property_float_sdna(prop, NULL, "abslength"); RNA_def_property_range(prop, 0.0f, 10000.0f); RNA_def_property_ui_text(prop, "Max Length", "Absolute maximum path length for children, in blender units."); + RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo"); prop= RNA_def_property(srna, "random_length", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "randlength"); RNA_def_property_range(prop, 0.0f, 1.0f); RNA_def_property_ui_text(prop, "Random Length", "Give path length a random variation."); + RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo"); /* children */ - prop= RNA_def_property(srna, "child_nbr", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, NULL, "child_nbr");//optional if prop names are the same - RNA_def_property_range(prop, 0.0f, MAX_PART_CHILDREN); + prop= RNA_def_property(srna, "child_nbr", PROP_INT, PROP_NONE); + RNA_def_property_int_sdna(prop, NULL, "child_nbr");//optional if prop names are the same + RNA_def_property_range(prop, 0, MAX_PART_CHILDREN); RNA_def_property_ui_text(prop, "Children Per Parent", "Amount of children/parent"); + RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo_child"); - prop= RNA_def_property(srna, "rendered_child_nbr", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, NULL, "ren_child_nbr"); - RNA_def_property_range(prop, 0.0f, MAX_PART_CHILDREN); + prop= RNA_def_property(srna, "rendered_child_nbr", PROP_INT, PROP_NONE); + RNA_def_property_int_sdna(prop, NULL, "ren_child_nbr"); + RNA_def_property_range(prop, 0, MAX_PART_CHILDREN); RNA_def_property_ui_text(prop, "Rendered Children", "Amount of children/parent for rendering."); prop= RNA_def_property(srna, "virtual_parents", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "parents"); RNA_def_property_range(prop, 0.0f, 1.0f); RNA_def_property_ui_text(prop, "Virtual Parents", "Relative amount of virtual parents."); + RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo_child"); prop= RNA_def_property(srna, "child_size", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "childsize"); RNA_def_property_range(prop, 0.01f, 100.0f); RNA_def_property_ui_text(prop, "Child Size", "A multiplier for the child particle size."); + RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo_child"); prop= RNA_def_property(srna, "child_random_size", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "childrandsize"); RNA_def_property_range(prop, 0.0f, 1.0f); RNA_def_property_ui_text(prop, "Random Child Size", "Random variation to the size of the child particles."); + RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo_child"); prop= RNA_def_property(srna, "child_radius", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "childrad"); RNA_def_property_range(prop, 0.0f, 10.0f); RNA_def_property_ui_text(prop, "Child Radius", "Radius of children around parent."); + RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo_child"); prop= RNA_def_property(srna, "child_roundness", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "childflat"); RNA_def_property_range(prop, 0.0f, 1.0f); RNA_def_property_ui_text(prop, "Child Roundness", "Roundness of children around parent."); + RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo_child"); //TODO: is this readonly? prop= RNA_def_property(srna, "child_spread", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "childspread"); // RNA_def_property_range(prop, 0.0f, upperLimitf); TODO: limits RNA_def_property_ui_text(prop, "Child Spread", ""); + RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo_child"); /* clumping */ prop= RNA_def_property(srna, "clump_factor", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "clumpfac"); RNA_def_property_range(prop, -1.0f, 1.0f); RNA_def_property_ui_text(prop, "Clump", "Amount of clumping"); + RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo_child"); prop= RNA_def_property(srna, "clumppow", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "clumppow"); RNA_def_property_range(prop, -0.999f, 0.999f); RNA_def_property_ui_text(prop, "Shape", "Shape of clumping"); + RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo_child"); /* kink */ @@ -1054,101 +1275,121 @@ static void rna_def_particle_settings(BlenderRNA *brna) RNA_def_property_float_sdna(prop, NULL, "kink_amp"); RNA_def_property_range(prop, 0.0f, 10.0f); RNA_def_property_ui_text(prop, "Amplitude", "The amplitude of the offset."); + RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo_child"); prop= RNA_def_property(srna, "kink_frequency", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "kink_freq"); RNA_def_property_range(prop, 0.0f, 10.0f); RNA_def_property_ui_text(prop, "Frequency", "The frequency of the offset (1/total length)"); + RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo_child"); prop= RNA_def_property(srna, "kink_shape", PROP_FLOAT, PROP_NONE); RNA_def_property_range(prop, -0.999f, 0.999f); RNA_def_property_ui_text(prop, "Shape", "Adjust the offset to the beginning/end"); + RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo_child"); /* rough */ prop= RNA_def_property(srna, "rough1", PROP_FLOAT, PROP_NONE); RNA_def_property_range(prop, 0.0f, 10.0f); RNA_def_property_ui_text(prop, "Rough1", "Amount of location dependent rough."); + RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo_child"); prop= RNA_def_property(srna, "rough1_size", PROP_FLOAT, PROP_NONE); RNA_def_property_range(prop, 0.01f, 10.0f); RNA_def_property_ui_text(prop, "Size1", "Size of location dependent rough."); + RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo_child"); prop= RNA_def_property(srna, "rough2", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "rough2"); RNA_def_property_range(prop, 0.0f, 10.0f); RNA_def_property_ui_text(prop, "Rough2", "Amount of random rough."); + RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo_child"); prop= RNA_def_property(srna, "rough2_size", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "rough2_size"); RNA_def_property_range(prop, 0.01f, 10.0f); RNA_def_property_ui_text(prop, "Size2", "Size of random rough."); + RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo_child"); prop= RNA_def_property(srna, "rough2_thres", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "rough2_thres"); RNA_def_property_range(prop, 0.0f, 1.0f); RNA_def_property_ui_text(prop, "Threshold", "Amount of particles left untouched by random rough."); + RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo_child"); prop= RNA_def_property(srna, "rough_endpoint", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "rough_end"); RNA_def_property_range(prop, 0.0f, 10.0f); RNA_def_property_ui_text(prop, "Rough Endpoint", "Amount of end point rough."); + RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo_child"); prop= RNA_def_property(srna, "rough_end_shape", PROP_FLOAT, PROP_NONE); RNA_def_property_range(prop, 0.0f, 10.0f); RNA_def_property_ui_text(prop, "Shape", "Shape of end point rough"); + RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo_child"); /* branching */ prop= RNA_def_property(srna, "branch_threshold", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "branch_thres"); RNA_def_property_range(prop, 0.0f, 1.0f); RNA_def_property_ui_text(prop, "Threshold", "Threshold of branching."); + RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo_child"); /* drawing stuff */ prop= RNA_def_property(srna, "line_length_tail", PROP_FLOAT, PROP_NONE); RNA_def_property_float_funcs(prop, "rna_PartSetting_linelentail_get", "rna_PartSetting_linelentail_set", NULL); RNA_def_property_range(prop, 0.0f, 10.0f); RNA_def_property_ui_text(prop, "Back", "Length of the line's tail"); + RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo"); prop= RNA_def_property(srna, "line_length_head", PROP_FLOAT, PROP_NONE); RNA_def_property_float_funcs(prop, "rna_PartSetting_linelenhead_get", "rna_PartSetting_linelenhead_set", NULL); RNA_def_property_range(prop, 0.0f, 10.0f); RNA_def_property_ui_text(prop, "Head", "Length of the line's head"); + RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo"); /* boids */ prop= RNA_def_property(srna, "max_velocity", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "max_vel"); RNA_def_property_range(prop, 0.0f, 200.0f); RNA_def_property_ui_text(prop, "Maximum Velocity", ""); + RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_reset"); prop= RNA_def_property(srna, "lateral_acceleration_max", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "max_lat_acc"); RNA_def_property_range(prop, 0.0f, 1.0f); RNA_def_property_ui_text(prop, "Lateral Acceleration", "Lateral acceleration % of max velocity"); + RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_reset"); prop= RNA_def_property(srna, "tangential_acceleration_max", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "max_tan_acc"); RNA_def_property_range(prop, 0.0f, 1.0f); RNA_def_property_ui_text(prop, "Tangential acceleration", "Tangential acceleration % of max velocity"); + RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_reset"); prop= RNA_def_property(srna, "average_velocity", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "average_vel"); RNA_def_property_range(prop, 0.0f, 1.0f); RNA_def_property_ui_text(prop, "Average Velocity", "The usual speed % of max velocity"); + RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_reset"); prop= RNA_def_property(srna, "banking", PROP_FLOAT, PROP_NONE); RNA_def_property_range(prop, -10.0f, 10.0f); RNA_def_property_ui_text(prop, "Banking", "Banking of boids on turns (1.0==natural banking)"); + RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_reset"); prop= RNA_def_property(srna, "banking_max", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "max_bank"); RNA_def_property_range(prop, 0.0f, 1.0f); RNA_def_property_ui_text(prop, "Maximum Banking", "How much a boid can bank at a single step"); + RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_reset"); prop= RNA_def_property(srna, "ground_z", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "groundz"); RNA_def_property_range(prop, -100.0f, 100.0f); RNA_def_property_ui_text(prop, "Ground Z", "Default Z value"); + RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_reset"); /*TODO: not sure how to deal with this prop= RNA_def_property(srna, "boid_factor", PROP_FLOAT, PROP_VECTOR); @@ -1163,24 +1404,28 @@ static void rna_def_particle_settings(BlenderRNA *brna) RNA_def_property_struct_type(prop, "Group"); RNA_def_property_flag(prop, PROP_EDITABLE); RNA_def_property_ui_text(prop, "Dupli Group", "Show Objects in this Group in place of particles"); + RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo"); prop= RNA_def_property(srna, "effector_group", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "eff_group"); RNA_def_property_struct_type(prop, "Group"); RNA_def_property_flag(prop, PROP_EDITABLE); RNA_def_property_ui_text(prop, "Effector Group", "Limit effectors to this Group."); + RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_reset"); prop= RNA_def_property(srna, "dupli_object", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "dup_ob"); RNA_def_property_struct_type(prop, "Object"); RNA_def_property_flag(prop, PROP_EDITABLE); RNA_def_property_ui_text(prop, "Dupli Object", "Show this Object in place of particles."); + RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo"); prop= RNA_def_property(srna, "billboard_object", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "bb_ob"); RNA_def_property_struct_type(prop, "Object"); RNA_def_property_flag(prop, PROP_EDITABLE); RNA_def_property_ui_text(prop, "Billboard Object", "Billboards face this object (default is active camera)"); + RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo"); #if 0 prop= RNA_def_property(srna, "ipo", PROP_POINTER, PROP_NONE); @@ -1225,6 +1470,7 @@ static void rna_def_particle_system(BlenderRNA *brna) prop= RNA_def_property(srna, "seed", PROP_INT, PROP_UNSIGNED); RNA_def_property_ui_text(prop, "Seed", "Offset in the random number table, to get a different randomized result."); + RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_reset"); /* hair */ prop= RNA_def_property(srna, "softbody", PROP_POINTER, PROP_NONE); @@ -1245,37 +1491,43 @@ static void rna_def_particle_system(BlenderRNA *brna) RNA_def_property_pointer_sdna(prop, NULL, "target_ob"); RNA_def_property_flag(prop, PROP_EDITABLE); RNA_def_property_ui_text(prop, "Reactor Target Object", "For reactor systems, the object that has the target particle system (empty if same object)."); + RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_reset"); prop= RNA_def_property(srna, "reactor_target_particle_system", PROP_INT, PROP_UNSIGNED); RNA_def_property_int_sdna(prop, NULL, "target_psys"); RNA_def_property_range(prop, 1, INT_MAX); RNA_def_property_ui_text(prop, "Reactor Target Particle System", "For reactor systems, index of particle system on the target object."); + RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_reset"); /* boids */ prop= RNA_def_property(srna, "boids_surface_object", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "keyed_ob"); RNA_def_property_flag(prop, PROP_EDITABLE); RNA_def_property_ui_text(prop, "Boids Surface Object", "For boids physics systems, constrain boids to this object's surface."); + RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_reset"); /* keyed */ prop= RNA_def_property(srna, "keyed_object", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "keyed_ob"); RNA_def_property_flag(prop, PROP_EDITABLE); RNA_def_property_ui_text(prop, "Keyed Object", "For keyed physics systems, the object that has the target particle system."); + RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_reset"); prop= RNA_def_property(srna, "keyed_particle_system", PROP_INT, PROP_UNSIGNED); RNA_def_property_int_sdna(prop, NULL, "keyed_psys"); RNA_def_property_range(prop, 1, INT_MAX); RNA_def_property_ui_text(prop, "Keyed Particle System", "For keyed physics systems, index of particle system on the keyed object."); + RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_reset"); prop= RNA_def_property(srna, "keyed_first", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", PSYS_FIRST_KEYED); RNA_def_property_ui_text(prop, "Keyed First", "Set the system to be the starting point of keyed particles"); + RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_reset"); prop= RNA_def_property(srna, "keyed_timed", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", PSYS_KEYED_TIME); RNA_def_property_ui_text(prop, "Keyed Timed", "Use intermediate key times for keyed particles (setting for starting point only)."); - + RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_reset"); /* billboard */ prop= RNA_def_property(srna, "billboard_normal_uv", PROP_STRING, PROP_NONE); @@ -1297,98 +1549,122 @@ static void rna_def_particle_system(BlenderRNA *brna) prop= RNA_def_property(srna, "vertex_group_density", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "vgroup[0]"); RNA_def_property_ui_text(prop, "Vertex Group Density", "Vertex group to control density."); + RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_reset"); prop= RNA_def_property(srna, "vertex_group_density_negate", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "vg_neg", (1 << PSYS_VG_DENSITY)); RNA_def_property_ui_text(prop, "Vertex Group Density Negate", "Negate the effect of the density vertex group."); + RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_reset"); prop= RNA_def_property(srna, "vertex_group_velocity", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "vgroup[1]"); RNA_def_property_ui_text(prop, "Vertex Group Velocity", "Vertex group to control velocity."); + RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_reset"); prop= RNA_def_property(srna, "vertex_group_velocity_negate", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "vg_neg", (1 << PSYS_VG_VEL)); RNA_def_property_ui_text(prop, "Vertex Group Velocity Negate", "Negate the effect of the velocity vertex group."); + RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_reset"); prop= RNA_def_property(srna, "vertex_group_length", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "vgroup[2]"); RNA_def_property_ui_text(prop, "Vertex Group Length", "Vertex group to control length."); + RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo"); prop= RNA_def_property(srna, "vertex_group_length_negate", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "vg_neg", (1 << PSYS_VG_LENGTH)); RNA_def_property_ui_text(prop, "Vertex Group Length Negate", "Negate the effect of the length vertex group."); + RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo"); prop= RNA_def_property(srna, "vertex_group_clump", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "vgroup[3]"); RNA_def_property_ui_text(prop, "Vertex Group Clump", "Vertex group to control clump."); + RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo_child"); prop= RNA_def_property(srna, "vertex_group_clump_negate", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "vg_neg", (1 << PSYS_VG_CLUMP)); RNA_def_property_ui_text(prop, "Vertex Group Clump Negate", "Negate the effect of the clump vertex group."); + RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo_child"); prop= RNA_def_property(srna, "vertex_group_kink", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "vgroup[4]"); RNA_def_property_ui_text(prop, "Vertex Group Kink", "Vertex group to control kink."); + RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo_child"); prop= RNA_def_property(srna, "vertex_group_kink_negate", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "vg_neg", (1 << PSYS_VG_KINK)); RNA_def_property_ui_text(prop, "Vertex Group Kink Negate", "Negate the effect of the kink vertex group."); + RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo_child"); prop= RNA_def_property(srna, "vertex_group_roughness1", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "vgroup[5]"); RNA_def_property_ui_text(prop, "Vertex Group Roughness 1", "Vertex group to control roughness 1."); + RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo_child"); prop= RNA_def_property(srna, "vertex_group_roughness1_negate", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "vg_neg", (1 << PSYS_VG_ROUGH1)); RNA_def_property_ui_text(prop, "Vertex Group Roughness 1 Negate", "Negate the effect of the roughness 1 vertex group."); + RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo_child"); prop= RNA_def_property(srna, "vertex_group_roughness2", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "vgroup[6]"); RNA_def_property_ui_text(prop, "Vertex Group Roughness 2", "Vertex group to control roughness 2."); + RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo_child"); prop= RNA_def_property(srna, "vertex_group_roughness2_negate", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "vg_neg", (1 << PSYS_VG_ROUGH2)); RNA_def_property_ui_text(prop, "Vertex Group Roughness 2 Negate", "Negate the effect of the roughness 2 vertex group."); + RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo_child"); prop= RNA_def_property(srna, "vertex_group_roughness_end", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "vgroup[7]"); RNA_def_property_ui_text(prop, "Vertex Group Roughness End", "Vertex group to control roughness end."); + RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo_child"); prop= RNA_def_property(srna, "vertex_group_roughness_end_negate", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "vg_neg", (1 << PSYS_VG_ROUGHE)); RNA_def_property_ui_text(prop, "Vertex Group Roughness End Negate", "Negate the effect of the roughness end vertex group."); + RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo_child"); prop= RNA_def_property(srna, "vertex_group_size", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "vgroup[8]"); RNA_def_property_ui_text(prop, "Vertex Group Size", "Vertex group to control size."); + RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_reset"); prop= RNA_def_property(srna, "vertex_group_size_negate", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "vg_neg", (1 << PSYS_VG_SIZE)); RNA_def_property_ui_text(prop, "Vertex Group Size Negate", "Negate the effect of the size vertex group."); + RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_reset"); prop= RNA_def_property(srna, "vertex_group_tangent", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "vgroup[9]"); RNA_def_property_ui_text(prop, "Vertex Group Tangent", "Vertex group to control tangent."); + RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_reset"); prop= RNA_def_property(srna, "vertex_group_tangent_negate", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "vg_neg", (1 << PSYS_VG_TAN)); RNA_def_property_ui_text(prop, "Vertex Group Tangent Negate", "Negate the effect of the tangent vertex group."); + RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_reset"); prop= RNA_def_property(srna, "vertex_group_rotation", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "vgroup[10]"); RNA_def_property_ui_text(prop, "Vertex Group Rotation", "Vertex group to control rotation."); + RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_reset"); prop= RNA_def_property(srna, "vertex_group_rotation_negate", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "vg_neg", (1 << PSYS_VG_ROT)); RNA_def_property_ui_text(prop, "Vertex Group Rotation Negate", "Negate the effect of the rotation vertex group."); + RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_reset"); prop= RNA_def_property(srna, "vertex_group_field", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "vgroup[11]"); RNA_def_property_ui_text(prop, "Vertex Group Field", "Vertex group to control field."); + RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_reset"); prop= RNA_def_property(srna, "vertex_group_field_negate", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "vg_neg", (1 << PSYS_VG_EFFECTOR)); RNA_def_property_ui_text(prop, "Vertex Group Field Negate", "Negate the effect of the field vertex group."); + RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_reset"); /* pointcache */ prop= RNA_def_property(srna, "point_cache", PROP_POINTER, PROP_NEVER_NULL); diff --git a/source/blender/render/intern/source/convertblender.c b/source/blender/render/intern/source/convertblender.c index 6bc88f7499b..996bf2c3b19 100644 --- a/source/blender/render/intern/source/convertblender.c +++ b/source/blender/render/intern/source/convertblender.c @@ -1459,7 +1459,7 @@ static int render_new_particle_system(Render *re, ObjectRen *obr, ParticleSystem if(part==NULL || pars==NULL || !psys_check_enabled(ob, psys)) return 0; - if(part->draw_as==PART_DRAW_OB || part->draw_as==PART_DRAW_GR || part->draw_as==PART_DRAW_NOT) + if(part->ren_as==PART_DRAW_OB || part->ren_as==PART_DRAW_GR || part->ren_as==PART_DRAW_NOT) return 1; /* 2. start initialising things */ @@ -1522,7 +1522,7 @@ static int render_new_particle_system(Render *re, ObjectRen *obr, ParticleSystem sd.mcol = MEM_callocN(sd.totcol * sizeof(MCol), "particle_mcols"); /* 2.2 setup billboards */ - if(part->draw_as == PART_DRAW_BB) { + if(part->ren_as == PART_DRAW_BB) { int first_uv = CustomData_get_layer_index(&psmd->dm->faceData, CD_MTFACE); bb.uv[0] = CustomData_get_named_layer_index(&psmd->dm->faceData, CD_MTFACE, psys->bb_uvname[0]); @@ -1577,7 +1577,7 @@ static int render_new_particle_system(Render *re, ObjectRen *obr, ParticleSystem Mat3Transp(nmat); /* 2.6 setup strand rendering */ - if(part->draw_as == PART_DRAW_PATH && psys->pathcache){ + if(part->ren_as == PART_DRAW_PATH && psys->pathcache){ path_nbr=(int)pow(2.0,(double) part->ren_step); if(path_nbr) { @@ -1884,10 +1884,10 @@ static int render_new_particle_system(Render *re, ObjectRen *obr, ParticleSystem continue; VECCOPY(loc,state.co); - if(part->draw_as!=PART_DRAW_BB) + if(part->ren_as!=PART_DRAW_BB) MTC_Mat4MulVecfl(re->viewmat,loc); - switch(part->draw_as) { + switch(part->ren_as) { case PART_DRAW_LINE: sd.line = 1; sd.time = 0.0f; @@ -4379,7 +4379,7 @@ static int allow_render_dupli_instance(Render *re, DupliObject *dob, Object *obd } for(psys=obd->particlesystem.first; psys; psys=psys->next) - if(!ELEM5(psys->part->draw_as, PART_DRAW_BB, PART_DRAW_LINE, PART_DRAW_PATH, PART_DRAW_OB, PART_DRAW_GR)) + if(!ELEM5(psys->part->ren_as, PART_DRAW_BB, PART_DRAW_LINE, PART_DRAW_PATH, PART_DRAW_OB, PART_DRAW_GR)) return 0; /* don't allow lamp, animated duplis, or radio render */ @@ -4402,7 +4402,7 @@ static void dupli_render_particle_set(Render *re, Object *ob, int timeoffset, in if(ob->transflag & OB_DUPLIPARTS) { for(psys=ob->particlesystem.first; psys; psys=psys->next) { - if(ELEM(psys->part->draw_as, PART_DRAW_OB, PART_DRAW_GR)) { + if(ELEM(psys->part->ren_as, PART_DRAW_OB, PART_DRAW_GR)) { if(enable) psys_render_set(ob, psys, re->viewmat, re->winmat, re->winx, re->winy, timeoffset); else diff --git a/source/blender/windowmanager/WM_types.h b/source/blender/windowmanager/WM_types.h index 09b81d69ac0..8b04d55c696 100644 --- a/source/blender/windowmanager/WM_types.h +++ b/source/blender/windowmanager/WM_types.h @@ -197,6 +197,7 @@ typedef struct wmNotifier { #define ND_KEYS (24<<16) #define ND_GEOM_DATA (25<<16) #define ND_CONSTRAINT (26<<16) +#define ND_PARTICLE (27<<16) /* NC_MATERIAL Material */ #define ND_SHADING (30<<16) |