Merged changes in the trunk up to revision 40299.

This commit is contained in:
2011-09-17 18:54:16 +00:00
176 changed files with 1791 additions and 1139 deletions

View File

@@ -237,6 +237,17 @@ void object_free_display(Object *ob)
freedisplist(&ob->disp);
}
void free_sculptsession_deformMats(SculptSession *ss)
{
if(ss->orig_cos) MEM_freeN(ss->orig_cos);
if(ss->deform_cos) MEM_freeN(ss->deform_cos);
if(ss->deform_imats) MEM_freeN(ss->deform_imats);
ss->orig_cos = NULL;
ss->deform_cos = NULL;
ss->deform_imats = NULL;
}
void free_sculptsession(Object *ob)
{
if(ob && ob->sculpt) {
@@ -267,6 +278,7 @@ void free_sculptsession(Object *ob)
}
}
/* do not free object itself */
void free_object(Object *ob)
{
@@ -408,7 +420,7 @@ void unlink_object(Object *ob)
for (ct= targets.first; ct; ct= ct->next) {
if (ct->tar == ob) {
ct->tar = NULL;
strcpy(ct->subtarget, "");
ct->subtarget[0]= '\0';
obt->recalc |= OB_RECALC_DATA;
}
}
@@ -438,7 +450,7 @@ void unlink_object(Object *ob)
for (ct= targets.first; ct; ct= ct->next) {
if (ct->tar == ob) {
ct->tar = NULL;
strcpy(ct->subtarget, "");
ct->subtarget[0]= '\0';
obt->recalc |= OB_RECALC_DATA;
}
}
@@ -1308,6 +1320,37 @@ static void copy_object_pose(Object *obn, Object *ob)
}
}
static int object_pose_context(Object *ob)
{
if( (ob) &&
(ob->type == OB_ARMATURE) &&
(ob->pose) &&
(ob->mode & OB_MODE_POSE)
) {
return 1;
}
else {
return 0;
}
}
//Object *object_pose_armature_get(Object *ob)
Object *object_pose_armature_get(struct Object *ob)
{
if(ob==NULL)
return NULL;
if(object_pose_context(ob))
return ob;
ob= modifiers_isDeformedByArmature(ob);
if(object_pose_context(ob))
return ob;
return NULL;
}
static void copy_object_transform(Object *ob_tar, Object *ob_src)
{
copy_v3_v3(ob_tar->loc, ob_src->loc);
@@ -2769,6 +2812,33 @@ void object_handle_update(Scene *scene, Object *ob)
}
}
void object_sculpt_modifiers_changed(Object *ob)
{
SculptSession *ss= ob->sculpt;
if(!ss->cache) {
/* we free pbvh on changes, except during sculpt since it can't deal with
changing PVBH node organization, we hope topology does not change in
the meantime .. weak */
if(ss->pbvh) {
BLI_pbvh_free(ss->pbvh);
ss->pbvh= NULL;
}
free_sculptsession_deformMats(ob->sculpt);
} else {
PBVHNode **nodes;
int n, totnode;
BLI_pbvh_search_gather(ss->pbvh, NULL, NULL, &nodes, &totnode);
for(n = 0; n < totnode; n++)
BLI_pbvh_node_mark_update(nodes[n]);
MEM_freeN(nodes);
}
}
float give_timeoffset(Object *ob) {
if ((ob->ipoflag & OB_OFFS_PARENTADD) && ob->parent) {
return ob->sf + give_timeoffset(ob->parent);