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.
This commit is contained in:
2008-02-24 06:38:42 +00:00
parent c8569c934a
commit cd934aa1a8
5 changed files with 46 additions and 36 deletions

View File

@@ -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.