diff options
author | Joshua Leung <aligorith@gmail.com> | 2008-02-24 09:38:42 +0300 |
---|---|---|
committer | Joshua Leung <aligorith@gmail.com> | 2008-02-24 09:38:42 +0300 |
commit | cd934aa1a80e29aebb173d993497685fd29657bf (patch) | |
tree | 0876fdd82437d4b0ea864c5822c82f72792deeb5 /source/blender/python/BPY_interface.c | |
parent | c8569c934ad83d41053ffcf7347cb4d3e4a7948a (diff) |
Patch #8344:
Submitted by: Thomas Knight (epat)
Parts committed:
1) Fixed a few misspellings in some error strings.
2) Fixed a (theoretical) bug with pyconstraints where a text object could be deleted from python but would remain linked
to the constraint it was assigned to - causing slight UI usage discontinuities!
Not committed yet:
3) Particle system bugfix in this patch has not been committed. Could jahka or brecht check this.
Diffstat (limited to 'source/blender/python/BPY_interface.c')
-rw-r--r-- | source/blender/python/BPY_interface.c | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/source/blender/python/BPY_interface.c b/source/blender/python/BPY_interface.c index b1fd48d87e6..04d99944ee4 100644 --- a/source/blender/python/BPY_interface.c +++ b/source/blender/python/BPY_interface.c @@ -1261,6 +1261,45 @@ int BPY_is_pyconstraint(Text *text) return 0; } +/* This function frees links from pyconstraints to a given text-buffer. + * Used when a text-buffer is unlinked! + */ +void BPY_free_pyconstraint_links(Text *text) +{ + Object *ob; + bConstraint *con; + short update; + + /*check all pyconstraints*/ + for (ob=G.main->object.first; ob; ob=ob->id.next) { + update = 0; + if(ob->type==OB_ARMATURE && ob->pose) { + bPoseChannel *pchan; + for(pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) { + for (con = pchan->constraints.first; con; con=con->next) { + if (con->type==CONSTRAINT_TYPE_PYTHON) { + bPythonConstraint *data = con->data; + if (data->text==text) data->text = NULL; + update = 1; + + } + } + } + } + for (con = ob->constraints.first; con; con=con->next) { + if (con->type==CONSTRAINT_TYPE_PYTHON) { + bPythonConstraint *data = con->data; + if (data->text==text) data->text = NULL; + update = 1; + } + } + + if (update) { + DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA); + } + } +} + /* This function is called to update PyConstraint data so that it is compatible with the script. * Some of the allocating/freeing of memory for constraint targets occurs here, espcially * if the number of targets changes. |