Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJanne Karhu <jhkarh@gmail.com>2011-04-04 17:47:28 +0400
committerJanne Karhu <jhkarh@gmail.com>2011-04-04 17:47:28 +0400
commit36858f63427b02dea2df77708aea591c455fa2ed (patch)
treefe88808e72466d8b3a51c67d57725c6955ae6e85 /source/blender/makesrna/intern/rna_particle.c
parent5b996e04d2dfdfcd30194e4988312e5d42e6797b (diff)
Fix for [#26747] Crash accessing dynamic hair RNA
* Removed hairkey.co_dynamic. The hairkey access is now simplified so that hairkey.co are the dynamic coordinates whenever the hair is dynamic.
Diffstat (limited to 'source/blender/makesrna/intern/rna_particle.c')
-rw-r--r--source/blender/makesrna/intern/rna_particle.c71
1 files changed, 15 insertions, 56 deletions
diff --git a/source/blender/makesrna/intern/rna_particle.c b/source/blender/makesrna/intern/rna_particle.c
index 990fece584d..fe0ab6787de 100644
--- a/source/blender/makesrna/intern/rna_particle.c
+++ b/source/blender/makesrna/intern/rna_particle.c
@@ -183,58 +183,17 @@ static void rna_ParticleHairKey_location_object_get(PointerRNA *ptr, float *valu
rna_ParticleHairKey_location_object_info(ptr, &psmd, &pa);
if(pa) {
- float hairmat[4][4];
- psys_mat_hair_to_object(ob, psmd->dm, psmd->psys->part->from, pa, hairmat);
- copy_v3_v3(values, hkey->co);
- mul_m4_v3(hairmat, values);
- }
- else {
- zero_v3(values);
- }
-}
-
-static void rna_ParticleHairKey_location_object_set(PointerRNA *ptr, const float *values)
-{
- HairKey *hkey= (HairKey *)ptr->data;
- Object *ob = (Object *)ptr->id.data;
- ParticleSystemModifierData *psmd;
- ParticleData *pa;
-
- rna_ParticleHairKey_location_object_info(ptr, &psmd, &pa);
-
- if(pa) {
- float hairmat[4][4];
- float imat[4][4];
-
- psys_mat_hair_to_object(ob, psmd->dm, psmd->psys->part->from, pa, hairmat);
- invert_m4_m4(imat, hairmat);
- copy_v3_v3(hkey->co, values);
- mul_m4_v3(imat, hkey->co);
- }
- else {
- zero_v3(hkey->co);
- }
-}
-
-static void rna_ParticleHairKey_dynamic_location_object_get(PointerRNA *ptr, float *values)
-{
- HairKey *hkey= (HairKey *)ptr->data;
- // Object *ob = (Object *)ptr->id.data;
- ParticleSystemModifierData *psmd;
- ParticleData *pa;
-
- rna_ParticleHairKey_location_object_info(ptr, &psmd, &pa);
-
- if(pa) {
- ParticleSystem *psys = psmd->psys;
- DerivedMesh *hairdm = (psys->flag & PSYS_HAIR_DYNAMICS) ? psys->hair_out_dm : NULL;
+ DerivedMesh *hairdm = (psmd->psys->flag & PSYS_HAIR_DYNAMICS) ? psmd->psys->hair_out_dm : NULL;
if(hairdm) {
MVert *mvert = CDDM_get_vert(hairdm, pa->hair_index + (hkey - pa->hair));
copy_v3_v3(values, mvert->co);
}
else {
- rna_ParticleHairKey_dynamic_location_object_get(ptr, values);
+ float hairmat[4][4];
+ psys_mat_hair_to_object(ob, psmd->dm, psmd->psys->part->from, pa, hairmat);
+ copy_v3_v3(values, hkey->co);
+ mul_m4_v3(hairmat, values);
}
}
else {
@@ -242,25 +201,30 @@ static void rna_ParticleHairKey_dynamic_location_object_get(PointerRNA *ptr, flo
}
}
-static void rna_ParticleHairKey_dynamic_location_object_set(PointerRNA *ptr, const float *values)
+static void rna_ParticleHairKey_location_object_set(PointerRNA *ptr, const float *values)
{
HairKey *hkey= (HairKey *)ptr->data;
- // Object *ob = (Object *)ptr->id.data;
+ Object *ob = (Object *)ptr->id.data;
ParticleSystemModifierData *psmd;
ParticleData *pa;
rna_ParticleHairKey_location_object_info(ptr, &psmd, &pa);
if(pa) {
- ParticleSystem *psys = psmd->psys;
- DerivedMesh *hairdm = (psys->flag & PSYS_HAIR_DYNAMICS) ? psys->hair_out_dm : NULL;
+ DerivedMesh *hairdm = (psmd->psys->flag & PSYS_HAIR_DYNAMICS) ? psmd->psys->hair_out_dm : NULL;
if(hairdm) {
MVert *mvert = CDDM_get_vert(hairdm, pa->hair_index + (hkey - pa->hair));
copy_v3_v3(mvert->co, values);
}
else {
- rna_ParticleHairKey_dynamic_location_object_set(ptr, values);
+ float hairmat[4][4];
+ float imat[4][4];
+
+ psys_mat_hair_to_object(ob, psmd->dm, psmd->psys->part->from, pa, hairmat);
+ invert_m4_m4(imat, hairmat);
+ copy_v3_v3(hkey->co, values);
+ mul_m4_v3(imat, hkey->co);
}
}
else {
@@ -941,11 +905,6 @@ static void rna_def_particle_hair_key(BlenderRNA *brna)
prop= RNA_def_property(srna, "co_hair_space", PROP_FLOAT, PROP_TRANSLATION);
RNA_def_property_float_sdna(prop, NULL, "co");
RNA_def_property_ui_text(prop, "Location", "Location of the hair key in its internal coordinate system, relative to the emitting face");
-
- prop= RNA_def_property(srna, "co_dynamic", PROP_FLOAT, PROP_TRANSLATION);
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Location (Dynamic)", "Location of the hair key for the current frame with hair dynamics applied");
- RNA_def_property_float_funcs(prop, "rna_ParticleHairKey_dynamic_location_object_get", "rna_ParticleHairKey_dynamic_location_object_set", NULL);
}
static void rna_def_particle_key(BlenderRNA *brna)