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:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2013-05-10 21:14:07 +0400
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2013-05-10 21:14:07 +0400
commit6dc23a2712d5c45d281c20e77b0d21902f3860b6 (patch)
tree8a9da22f7c75ea836fc5bf6374dac0ba280fac46 /source/blender/makesrna/intern/rna_particle.c
parent8160027ff89258c4af1837838dc6c7ebeddc03ad (diff)
Fix #35296: particles crash with long object name.
Diffstat (limited to 'source/blender/makesrna/intern/rna_particle.c')
-rw-r--r--source/blender/makesrna/intern/rna_particle.c53
1 files changed, 18 insertions, 35 deletions
diff --git a/source/blender/makesrna/intern/rna_particle.c b/source/blender/makesrna/intern/rna_particle.c
index 140b9d74d06..07aaa30f7ef 100644
--- a/source/blender/makesrna/intern/rna_particle.c
+++ b/source/blender/makesrna/intern/rna_particle.c
@@ -922,32 +922,6 @@ static void rna_ParticleSystem_active_particle_target_index_set(struct PointerRN
pt->flag &= ~PTARGET_CURRENT;
}
}
-static int rna_ParticleTarget_name_length(PointerRNA *ptr)
-{
- ParticleTarget *pt = ptr->data;
-
- if (pt->flag & PTARGET_VALID) {
- ParticleSystem *psys = NULL;
-
- if (pt->ob)
- psys = BLI_findlink(&pt->ob->particlesystem, pt->psys - 1);
- else {
- Object *ob = (Object *) ptr->id.data;
- psys = BLI_findlink(&ob->particlesystem, pt->psys - 1);
- }
-
- if (psys) {
- if (pt->ob)
- return strlen(pt->ob->id.name + 2) + 2 + strlen(psys->name);
- else
- return strlen(psys->name);
- }
- else
- return 15;
- }
- else
- return 15;
-}
static void rna_ParticleTarget_name_get(PointerRNA *ptr, char *str)
{
@@ -976,6 +950,15 @@ static void rna_ParticleTarget_name_get(PointerRNA *ptr, char *str)
strcpy(str, "Invalid target!");
}
+static int rna_ParticleTarget_name_length(PointerRNA *ptr)
+{
+ char tstr[MAX_ID_NAME + MAX_ID_NAME + 64];
+
+ rna_ParticleTarget_name_get(ptr, tstr);
+
+ return strlen(tstr);
+}
+
static int particle_id_check(PointerRNA *ptr)
{
ID *id = ptr->id.data;
@@ -1062,15 +1045,6 @@ static void rna_ParticleDupliWeight_active_index_set(struct PointerRNA *ptr, int
}
}
-static void rna_ParticleDupliWeight_name_get(PointerRNA *ptr, char *str);
-
-static int rna_ParticleDupliWeight_name_length(PointerRNA *ptr)
-{
- char tstr[32];
- rna_ParticleDupliWeight_name_get(ptr, tstr);
- return strlen(tstr);
-}
-
static void rna_ParticleDupliWeight_name_get(PointerRNA *ptr, char *str)
{
ParticleDupliWeight *dw = ptr->data;
@@ -1081,6 +1055,15 @@ static void rna_ParticleDupliWeight_name_get(PointerRNA *ptr, char *str)
strcpy(str, "No object");
}
+static int rna_ParticleDupliWeight_name_length(PointerRNA *ptr)
+{
+ char tstr[MAX_ID_NAME + 64];
+
+ rna_ParticleDupliWeight_name_get(ptr, tstr);
+
+ return strlen(tstr);
+}
+
static EnumPropertyItem *rna_Particle_from_itemf(bContext *UNUSED(C), PointerRNA *UNUSED(ptr),
PropertyRNA *UNUSED(prop), int *UNUSED(free))
{