diff options
author | YimingWu <xp8110@outlook.com> | 2020-05-16 18:08:40 +0300 |
---|---|---|
committer | YimingWu <xp8110@outlook.com> | 2020-05-16 18:08:40 +0300 |
commit | cd54abd2c1316136753f7bbe227bd762a5f9e7d9 (patch) | |
tree | 69f2a4a1a5013acc78213bb4f3fe888912380ea4 /source/blender/makesrna/intern/rna_particle.c | |
parent | f7770cb97bb9d19d0806f67da9377129fd4d09b0 (diff) | |
parent | eaf7d36d66e551c3262d69f472b4028aeccb7e97 (diff) |
Merge remote-tracking branch 'origin/master' into temp-lanpr-review
Diffstat (limited to 'source/blender/makesrna/intern/rna_particle.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_particle.c | 38 |
1 files changed, 20 insertions, 18 deletions
diff --git a/source/blender/makesrna/intern/rna_particle.c b/source/blender/makesrna/intern/rna_particle.c index 4155c453440..73b3515030e 100644 --- a/source/blender/makesrna/intern/rna_particle.c +++ b/source/blender/makesrna/intern/rna_particle.c @@ -20,20 +20,20 @@ * \ingroup RNA */ +#include <limits.h> #include <stdio.h> #include <stdlib.h> -#include <limits.h> +#include "DNA_boid_types.h" +#include "DNA_cloth_types.h" #include "DNA_material_types.h" #include "DNA_mesh_types.h" #include "DNA_meshdata_types.h" #include "DNA_modifier_types.h" -#include "DNA_cloth_types.h" -#include "DNA_particle_types.h" #include "DNA_object_force_types.h" #include "DNA_object_types.h" +#include "DNA_particle_types.h" #include "DNA_scene_types.h" -#include "DNA_boid_types.h" #include "DNA_texture_types.h" #include "RNA_define.h" @@ -41,12 +41,14 @@ #include "BKE_mesh.h" +#include "BLI_listbase.h" + #include "BLT_translation.h" #include "rna_internal.h" -#include "WM_types.h" #include "WM_api.h" +#include "WM_types.h" #ifdef RNA_RUNTIME static const EnumPropertyItem part_from_items[] = { @@ -149,9 +151,9 @@ static const EnumPropertyItem part_fluid_type_items[] = { # include "BLI_string_utils.h" # include "BKE_boids.h" -# include "BKE_context.h" # include "BKE_cloth.h" # include "BKE_colortools.h" +# include "BKE_context.h" # include "BKE_deform.h" # include "BKE_effect.h" # include "BKE_material.h" @@ -188,9 +190,9 @@ static void rna_ParticleHairKey_location_object_info(PointerRNA *ptr, * not a very efficient way of getting hair key location data, * but it's the best we've got at the present * - * IDEAS: include additional information in pointerRNA beforehand, - * for example a pointer to the ParticleStstemModifierData to which the - * hairkey belongs. + * IDEAS: include additional information in PointerRNA beforehand, + * for example a pointer to the ParticleSystemModifierData to which the + * hair-key belongs. */ for (md = ob->modifiers.first; md; md = md->next) { @@ -199,9 +201,9 @@ static void rna_ParticleHairKey_location_object_info(PointerRNA *ptr, if (psmd && psmd->mesh_final && psmd->psys) { psys = psmd->psys; for (i = 0, pa = psys->particles; i < psys->totpart; i++, pa++) { - /* hairkeys are stored sequentially in memory, so we can + /* Hair-keys are stored sequentially in memory, so we can * find if it's the same particle by comparing pointers, - * without having to iterate over them all */ + * without having to iterate over them all. */ if ((hkey >= pa->hair) && (hkey < pa->hair + pa->totkey)) { *psmd_pt = psmd; *pa_pt = pa; @@ -385,11 +387,11 @@ static void rna_ParticleSystem_co_hair( totchild = 0; } - if (particle_no < totpart) { + if (particle_no < totpart && particlesystem->pathcache) { cache = particlesystem->pathcache[particle_no]; max_k = (int)cache->segments; } - else if (particle_no < totpart + totchild) { + else if (particle_no < totpart + totchild && particlesystem->childcache) { cache = particlesystem->childcache[particle_no - totpart]; if (cache->segments < 0) { @@ -425,7 +427,7 @@ static const EnumPropertyItem *rna_Particle_Material_itemf(bContext *C, if (ob && ob->totcol > 0) { for (i = 1; i <= ob->totcol; i++) { - ma = give_current_material(ob, i); + ma = BKE_object_material_get(ob, i); tmp.value = i; tmp.icon = ICON_MATERIAL_DATA; if (ma) { @@ -695,7 +697,7 @@ static void rna_Particle_change_type(Main *bmain, Scene *UNUSED(scene), PointerR /* Iterating over all object is slow, but no better solution exists at the moment. */ for (Object *ob = bmain->objects.first; ob; ob = ob->id.next) { - for (ParticleSystem *psys = ob->particlesystem.first; psys; psys = psys->next) { + LISTBASE_FOREACH (ParticleSystem *, psys, &ob->particlesystem) { if (psys->part == part) { psys_changed_type(ob, psys); psys->recalc |= ID_RECALC_PSYS_RESET; @@ -825,7 +827,7 @@ static void rna_Particle_hair_dynamics_update(Main *bmain, Scene *scene, Pointer ParticleSystem *psys = (ParticleSystem *)ptr->data; if (psys && !psys->clmd) { - psys->clmd = (ClothModifierData *)modifier_new(eModifierType_Cloth); + psys->clmd = (ClothModifierData *)BKE_modifier_new(eModifierType_Cloth); psys->clmd->sim_parms->goalspring = 0.0f; psys->clmd->sim_parms->flags |= CLOTH_SIMSETTINGS_FLAG_RESIST_SPRING_COMPRESS; psys->clmd->coll_parms->flags &= ~CLOTH_COLLSETTINGS_FLAG_SELF; @@ -1396,7 +1398,7 @@ static void psys_vg_name_set__internal(PointerRNA *ptr, const char *value, int i psys->vgroup[index] = 0; } else { - int defgrp_index = defgroup_name_index(ob, value); + int defgrp_index = BKE_object_defgroup_name_index(ob, value); if (defgrp_index == -1) { return; @@ -3481,7 +3483,7 @@ static void rna_def_particle_settings(BlenderRNA *brna) RNA_def_property_float_sdna(prop, NULL, "rad_scale"); RNA_def_property_range(prop, 0.0f, FLT_MAX); RNA_def_property_ui_range(prop, 0.0f, 10.0f, 0.1, 2); - RNA_def_property_ui_text(prop, "Radius Scale", "Multiplier of radius properties"); + RNA_def_property_ui_text(prop, "Diameter Scale", "Multiplier of diameter properties"); RNA_def_property_update( prop, 0, "rna_Particle_redo"); /* TODO: Only need to tell the render engine to update. */ } |