Merged changes in the trunk up to revision 27779.

This commit is contained in:
2010-03-26 20:18:39 +00:00
51 changed files with 406 additions and 413 deletions

View File

@@ -507,7 +507,8 @@ class DATA_PT_modifiers(DataButtonsPanel):
col.prop(md, "steps") col.prop(md, "steps")
col.prop(md, "render_steps") col.prop(md, "render_steps")
col = split.column() if wide_ui:
col = split.column()
row = col.row() row = col.row()
row.active = (md.object is None or md.use_object_screw_offset == False) row.active = (md.object is None or md.use_object_screw_offset == False)
row.prop(md, "screw_offset") row.prop(md, "screw_offset")

View File

@@ -268,9 +268,10 @@ class OBJECT_PT_duplication(ObjectButtonsPanel):
else: else:
layout.prop(ob, "dupli_group", text="") layout.prop(ob, "dupli_group", text="")
# XXX: the following options are all quite buggy, ancient hacks that should be dropped
class OBJECT_PT_animation(ObjectButtonsPanel): class OBJECT_PT_animation(ObjectButtonsPanel):
bl_label = "Animation" bl_label = "Animation Hacks"
bl_default_closed = True
def draw(self, context): def draw(self, context):
layout = self.layout layout = self.layout
@@ -293,16 +294,13 @@ class OBJECT_PT_animation(ObjectButtonsPanel):
row.prop(ob, "slow_parent") row.prop(ob, "slow_parent")
row.active = (ob.parent is not None) row.active = (ob.parent is not None)
col.prop(ob, "time_offset", text="Offset") col.prop(ob, "time_offset", text="Offset")
# XXX: these are still used for a few curve-related tracking features
if wide_ui: if wide_ui:
col = split.column() col = split.column()
col.label(text="Track:") col.label(text="Tracking Axes:")
col.prop(ob, "track", text="")
col.prop(ob, "track_axis", text="Axis") col.prop(ob, "track_axis", text="Axis")
col.prop(ob, "up_axis", text="Up Axis") col.prop(ob, "up_axis", text="Up Axis")
row = col.row()
row.prop(ob, "track_override_parent", text="Override Parent")
row.active = (ob.parent is not None)
# import generic panels from other files # import generic panels from other files
@@ -316,7 +314,7 @@ classes = [
OBJECT_PT_groups, OBJECT_PT_groups,
OBJECT_PT_display, OBJECT_PT_display,
OBJECT_PT_duplication, OBJECT_PT_duplication,
OBJECT_PT_animation, OBJECT_PT_animation, # XXX: panel of old hacks pending to be removed...
OBJECT_PT_motion_paths, OBJECT_PT_motion_paths,
#OBJECT_PT_onion_skinning, #OBJECT_PT_onion_skinning,

View File

@@ -179,6 +179,7 @@ class PHYSICS_PT_cloth_collision(PhysicButtonsPanel):
sub.prop(cloth, "self_collision_quality", slider=True, text="Quality") sub.prop(cloth, "self_collision_quality", slider=True, text="Quality")
sub.prop(cloth, "self_min_distance", slider=True, text="Distance") sub.prop(cloth, "self_min_distance", slider=True, text="Distance")
layout.prop(cloth, "group")
class PHYSICS_PT_cloth_stiffness(PhysicButtonsPanel): class PHYSICS_PT_cloth_stiffness(PhysicButtonsPanel):
bl_label = "Cloth Stiffness Scaling" bl_label = "Cloth Stiffness Scaling"

View File

@@ -342,7 +342,7 @@ class IMAGE_PT_image_properties(bpy.types.Panel):
# ima = sima.image # ima = sima.image
iuser = sima.image_user iuser = sima.image_user
layout.template_image(sima, "image", iuser, compact=True) layout.template_image(sima, "image", iuser)
class IMAGE_PT_game_properties(bpy.types.Panel): class IMAGE_PT_game_properties(bpy.types.Panel):

View File

@@ -129,6 +129,13 @@ void free_pose_channel(struct bPoseChannel *pchan);
*/ */
void free_pose_channels(struct bPose *pose); void free_pose_channels(struct bPose *pose);
/**
* Removes the hash for quick lookup of channels, must
* be done when adding/removing channels.
*/
void make_pose_channels_hash(struct bPose *pose);
void free_pose_channels_hash(struct bPose *pose);
/** /**
* Removes and deallocates all data from a pose, and also frees the pose. * Removes and deallocates all data from a pose, and also frees the pose.
*/ */

View File

@@ -45,7 +45,7 @@ struct Scene;
struct Main; struct Main;
#define BLENDER_VERSION 252 #define BLENDER_VERSION 252
#define BLENDER_SUBVERSION 1 #define BLENDER_SUBVERSION 2
#define BLENDER_MINVERSION 250 #define BLENDER_MINVERSION 250
#define BLENDER_MINSUBVERSION 0 #define BLENDER_MINSUBVERSION 0

View File

@@ -49,12 +49,13 @@
#include "BLI_kdopbvh.h" #include "BLI_kdopbvh.h"
struct Cloth;
struct ClothModifierData;
struct DerivedMesh;
struct Group;
struct MFace;
struct Object; struct Object;
struct Scene; struct Scene;
struct Cloth;
struct MFace;
struct DerivedMesh;
struct ClothModifierData;
//////////////////////////////////////// ////////////////////////////////////////
// used for collisions in collision.c // used for collisions in collision.c
@@ -139,7 +140,7 @@ void interpolateOnTriangle ( float to[3], float v1[3], float v2[3], float v3[3],
///////////////////////////////////////////////// /////////////////////////////////////////////////
// used in effect.c // used in effect.c
///////////////////////////////////////////////// /////////////////////////////////////////////////
Object **get_collisionobjects(struct Scene *scene, Object *self, int *numcollobj); struct Object **get_collisionobjects(struct Scene *scene, struct Object *self, struct Group *group, int *numcollobj);
typedef struct ColliderCache { typedef struct ColliderCache {
struct ColliderCache *next, *prev; struct ColliderCache *next, *prev;
@@ -147,7 +148,7 @@ typedef struct ColliderCache {
struct CollisionModifierData *collmd; struct CollisionModifierData *collmd;
} ColliderCache; } ColliderCache;
struct ListBase *get_collider_cache(struct Scene *scene, Object *self); struct ListBase *get_collider_cache(struct Scene *scene, struct Object *self, struct Group *group);
void free_collider_cache(struct ListBase **colliders); void free_collider_cache(struct ListBase **colliders);
///////////////////////////////////////////////// /////////////////////////////////////////////////

View File

@@ -76,7 +76,7 @@ void makeNurbcurve(struct Nurb *nu, float *coord_array, float *tilt_array, float
void forward_diff_bezier(float q0, float q1, float q2, float q3, float *p, int it, int stride); void forward_diff_bezier(float q0, float q1, float q2, float q3, float *p, int it, int stride);
float *make_orco_curve(struct Scene *scene, struct Object *ob); float *make_orco_curve(struct Scene *scene, struct Object *ob);
float *make_orco_surf( struct Object *ob); float *make_orco_surf( struct Object *ob);
void makebevelcurve(struct Scene *scene, struct Object *ob, struct ListBase *disp); void makebevelcurve(struct Scene *scene, struct Object *ob, struct ListBase *disp, int forRender);
void makeBevelList( struct Object *ob); void makeBevelList( struct Object *ob);

View File

@@ -56,8 +56,9 @@
#include "BIK_api.h" #include "BIK_api.h"
#include "BLI_math.h"
#include "BLI_blenlib.h" #include "BLI_blenlib.h"
#include "BLI_ghash.h"
#include "BLI_math.h"
#include "RNA_access.h" #include "RNA_access.h"
@@ -370,6 +371,9 @@ bPoseChannel *get_pose_channel(const bPose *pose, const char *name)
if (ELEM(NULL, pose, name) || (name[0] == 0)) if (ELEM(NULL, pose, name) || (name[0] == 0))
return NULL; return NULL;
if(pose->chanhash)
return BLI_ghash_lookup(pose->chanhash, name);
return BLI_findstring(&((bPose *)pose)->chanbase, name, offsetof(bPoseChannel, name)); return BLI_findstring(&((bPose *)pose)->chanbase, name, offsetof(bPoseChannel, name));
} }
@@ -405,6 +409,7 @@ bPoseChannel *verify_pose_channel(bPose *pose, const char *name)
chan->protectflag = OB_LOCK_ROT4D; /* lock by components by default */ chan->protectflag = OB_LOCK_ROT4D; /* lock by components by default */
BLI_addtail(&pose->chanbase, chan); BLI_addtail(&pose->chanbase, chan);
free_pose_channels_hash(pose);
return chan; return chan;
} }
@@ -519,6 +524,26 @@ void init_pose_ikparam(bPose *pose)
} }
} }
void make_pose_channels_hash(bPose *pose)
{
if(!pose->chanhash) {
bPoseChannel *pchan;
pose->chanhash= BLI_ghash_new(BLI_ghashutil_strhash, BLI_ghashutil_strcmp);
for(pchan=pose->chanbase.first; pchan; pchan=pchan->next)
BLI_ghash_insert(pose->chanhash, pchan->name, pchan);
}
}
void free_pose_channels_hash(bPose *pose)
{
if(pose->chanhash) {
BLI_ghash_free(pose->chanhash, NULL, NULL);
pose->chanhash= NULL;
}
}
void free_pose_channel(bPoseChannel *pchan) void free_pose_channel(bPoseChannel *pchan)
{ {
// XXX this case here will need to be removed when the new motionpaths are ready // XXX this case here will need to be removed when the new motionpaths are ready
@@ -550,6 +575,8 @@ void free_pose_channels(bPose *pose)
BLI_freelistN(&pose->chanbase); BLI_freelistN(&pose->chanbase);
} }
free_pose_channels_hash(pose);
} }
void free_pose(bPose *pose) void free_pose(bPose *pose)
@@ -1063,7 +1090,6 @@ void what_does_obaction (Scene *scene, Object *ob, Object *workob, bPose *pose,
copy_m4_m4(workob->parentinv, ob->parentinv); copy_m4_m4(workob->parentinv, ob->parentinv);
copy_m4_m4(workob->constinv, ob->constinv); copy_m4_m4(workob->constinv, ob->constinv);
workob->parent= ob->parent; workob->parent= ob->parent;
workob->track= ob->track;
workob->rotmode= ob->rotmode; workob->rotmode= ob->rotmode;

View File

@@ -668,7 +668,7 @@ static void frames_duplilist(ListBase *lb, Scene *scene, Object *ob, int level,
if(level>MAX_DUPLI_RECUR) return; if(level>MAX_DUPLI_RECUR) return;
cfrao= scene->r.cfra; cfrao= scene->r.cfra;
if(ob->parent==NULL && ob->track==NULL && ob->ipo==NULL && ob->constraints.first==NULL) return; if(ob->parent==NULL && ob->constraints.first==NULL) return;
if(ob->transflag & OB_DUPLINOSPEED) enable_cu_speed= 0; if(ob->transflag & OB_DUPLINOSPEED) enable_cu_speed= 0;
copyob= *ob; /* store transform info */ copyob= *ob; /* store transform info */

View File

@@ -1675,6 +1675,7 @@ void armature_rebuild_pose(Object *ob, bArmature *arm)
next= pchan->next; next= pchan->next;
if(pchan->bone==NULL) { if(pchan->bone==NULL) {
free_pose_channel(pchan); free_pose_channel(pchan);
free_pose_channels_hash(pose);
BLI_freelinkN(&pose->chanbase, pchan); BLI_freelinkN(&pose->chanbase, pchan);
} }
} }

View File

@@ -1299,188 +1299,122 @@ static int cloth_collision_moving ( ClothModifierData *clmd, CollisionModifierDa
} }
#endif #endif
static void add_collision_object(Object ***objs, int *numobj, int *maxobj, Object *ob, Object *self, int level)
{
CollisionModifierData *cmd= NULL;
if(ob == self)
return;
/* only get objects with collision modifier */
if(ob->pd && ob->pd->deflect)
cmd= (CollisionModifierData *)modifiers_findByType(ob, eModifierType_Collision);
if(cmd) {
/* extend array */
if(*numobj >= *maxobj) {
*maxobj *= 2;
*objs= MEM_reallocN(*objs, sizeof(Object*)*(*maxobj));
}
(*objs)[*numobj] = ob;
(*numobj)++;
}
/* objects in dupli groups, one level only for now */
if(ob->dup_group && level == 0) {
GroupObject *go;
Group *group= ob->dup_group;
/* add objects */
for(go= group->gobject.first; go; go= go->next)
add_collision_object(objs, numobj, maxobj, go->ob, self, level+1);
}
}
// return all collision objects in scene // return all collision objects in scene
// collision object will exclude self // collision object will exclude self
Object **get_collisionobjects(Scene *scene, Object *self, int *numcollobj) Object **get_collisionobjects(Scene *scene, Object *self, Group *group, int *numcollobj)
{ {
Base *base=NULL; Base *base;
Object **objs = NULL; Object **objs;
Object *coll_ob = NULL; GroupObject *go;
CollisionModifierData *collmd = NULL; int numobj= 0, maxobj= 100;
int numobj = 0, maxobj = 100;
objs = MEM_callocN(sizeof(Object *)*maxobj, "CollisionObjectsArray"); objs= MEM_callocN(sizeof(Object *)*maxobj, "CollisionObjectsArray");
// check all collision objects
for ( base = scene->base.first; base; base = base->next )
{
/*Only proceed for mesh object in same layer */
if(!(base->object->type==OB_MESH && (base->lay & self->lay)))
continue;
coll_ob = base->object;
if(coll_ob == self)
continue;
if(coll_ob->pd && coll_ob->pd->deflect)
{
collmd = ( CollisionModifierData * ) modifiers_findByType ( coll_ob, eModifierType_Collision );
}
else
collmd = NULL;
if ( collmd )
{
if(numobj >= maxobj)
{
// realloc
int oldmax = maxobj;
Object **tmp;
maxobj *= 2;
tmp = MEM_callocN(sizeof(Object *)*maxobj, "CollisionObjectsArray");
memcpy(tmp, objs, sizeof(Object *)*oldmax);
MEM_freeN(objs);
objs = tmp;
}
objs[numobj] = coll_ob;
numobj++;
}
else
{
if ( coll_ob->dup_group )
{
GroupObject *go;
Group *group = coll_ob->dup_group;
for ( go= group->gobject.first; go; go= go->next ) /* gather all collision objects */
{ if(group) {
coll_ob = go->ob; /* use specified group */
collmd = NULL; for(go= group->gobject.first; go; go= go->next)
add_collision_object(&objs, &numobj, &maxobj, go->ob, self, 0);
if(coll_ob == self)
continue;
if(coll_ob->pd && coll_ob->pd->deflect)
{
collmd = ( CollisionModifierData * ) modifiers_findByType ( coll_ob, eModifierType_Collision );
}
else
collmd = NULL;
if ( !collmd )
continue;
if( !collmd->bvhtree)
continue;
if(numobj >= maxobj)
{
// realloc
int oldmax = maxobj;
Object **tmp;
maxobj *= 2;
tmp = MEM_callocN(sizeof(Object *)*maxobj, "CollisionObjectsArray");
memcpy(tmp, objs, sizeof(Object *)*oldmax);
MEM_freeN(objs);
objs = tmp;
}
objs[numobj] = coll_ob;
numobj++;
}
}
}
} }
*numcollobj = numobj; else {
/* add objects in same layer in scene */
for(base = scene->base.first; base; base = base->next)
if(base->lay & self->lay)
add_collision_object(&objs, &numobj, &maxobj, base->object, self, 0);
}
*numcollobj= numobj;
return objs; return objs;
} }
ListBase *get_collider_cache(Scene *scene, Object *self) static void add_collider_cache_object(ListBase **objs, Object *ob, Object *self, int level)
{ {
Base *base=NULL; CollisionModifierData *cmd= NULL;
ListBase *objs = NULL;
Object *coll_ob = NULL;
CollisionModifierData *collmd = NULL;
ColliderCache *col; ColliderCache *col;
if(ob == self)
return;
if(ob->pd && ob->pd->deflect)
cmd =(CollisionModifierData *)modifiers_findByType(ob, eModifierType_Collision);
// check all collision objects if(cmd && cmd->bvhtree) {
for ( base = scene->base.first; base; base = base->next ) if(*objs == NULL)
{ *objs = MEM_callocN(sizeof(ListBase), "ColliderCache array");
/*Only proceed for mesh object in same layer */
if(base->object->type!=OB_MESH)
continue;
if(self && (base->lay & self->lay)==0) col = MEM_callocN(sizeof(ColliderCache), "ColliderCache");
continue; col->ob = ob;
col->collmd = cmd;
/* make sure collider is properly set up */
coll_ob = base->object; collision_move_object(cmd, 1.0, 0.0);
BLI_addtail(*objs, col);
if(coll_ob == self)
continue;
if(coll_ob->pd && coll_ob->pd->deflect)
{
collmd = ( CollisionModifierData * ) modifiers_findByType ( coll_ob, eModifierType_Collision );
}
else
collmd = NULL;
if ( collmd )
{
if(objs == NULL)
objs = MEM_callocN(sizeof(ListBase), "ColliderCache array");
col = MEM_callocN(sizeof(ColliderCache), "ColliderCache");
col->ob = coll_ob;
col->collmd = collmd;
/* make sure collider is properly set up */
collision_move_object(collmd, 1.0, 0.0);
BLI_addtail(objs, col);
}
else if ( coll_ob->dup_group )
{
GroupObject *go;
Group *group = coll_ob->dup_group;
for ( go= group->gobject.first; go; go= go->next )
{
coll_ob = go->ob;
collmd = NULL;
if(coll_ob == self)
continue;
if(coll_ob->pd && coll_ob->pd->deflect)
{
collmd = ( CollisionModifierData * ) modifiers_findByType ( coll_ob, eModifierType_Collision );
}
else
collmd = NULL;
if ( !collmd )
continue;
if( !collmd->bvhtree)
continue;
if(objs == NULL)
objs = MEM_callocN(sizeof(ListBase), "ColliderCache array");
col = MEM_callocN(sizeof(ColliderCache), "ColliderCache");
col->ob = coll_ob;
col->collmd = collmd;
/* make sure collider is properly set up */
collision_move_object(collmd, 1.0, 0.0);
BLI_addtail(objs, col);
}
}
} }
/* objects in dupli groups, one level only for now */
if(ob->dup_group && level == 0) {
GroupObject *go;
Group *group= ob->dup_group;
/* add objects */
for(go= group->gobject.first; go; go= go->next)
add_collider_cache_object(objs, go->ob, self, level+1);
}
}
ListBase *get_collider_cache(Scene *scene, Object *self, Group *group)
{
Base *base;
GroupObject *go;
ListBase *objs= NULL;
/* add object in same layer in scene */
if(group) {
for(go= group->gobject.first; go; go= go->next)
add_collider_cache_object(&objs, go->ob, self, 0);
}
else {
for(base = scene->base.first; base; base = base->next)
if(self && (base->lay & self->lay)==0)
add_collider_cache_object(&objs, base->object, self, 0);
}
return objs; return objs;
} }
void free_collider_cache(ListBase **colliders) void free_collider_cache(ListBase **colliders)
{ {
if(*colliders) { if(*colliders) {
@@ -1489,6 +1423,7 @@ void free_collider_cache(ListBase **colliders)
*colliders = NULL; *colliders = NULL;
} }
} }
static void cloth_bvh_objcollisions_nearcheck ( ClothModifierData * clmd, CollisionModifierData *collmd, CollPair **collisions, CollPair **collisions_index, int numresult, BVHTreeOverlap *overlap) static void cloth_bvh_objcollisions_nearcheck ( ClothModifierData * clmd, CollisionModifierData *collmd, CollPair **collisions, CollPair **collisions_index, int numresult, BVHTreeOverlap *overlap)
{ {
int i; int i;
@@ -1574,7 +1509,7 @@ int cloth_bvh_objcollision (Object *ob, ClothModifierData * clmd, float step, fl
bvhtree_update_from_cloth ( clmd, 1 ); // 0 means STATIC, 1 means MOVING (see later in this function) bvhtree_update_from_cloth ( clmd, 1 ); // 0 means STATIC, 1 means MOVING (see later in this function)
bvhselftree_update_from_cloth ( clmd, 0 ); // 0 means STATIC, 1 means MOVING (see later in this function) bvhselftree_update_from_cloth ( clmd, 0 ); // 0 means STATIC, 1 means MOVING (see later in this function)
collobjs = get_collisionobjects(clmd->scene, ob, &numcollobj); collobjs = get_collisionobjects(clmd->scene, ob, clmd->coll_parms->group, &numcollobj);
if(!collobjs) if(!collobjs)
return 0; return 0;

View File

@@ -1867,7 +1867,7 @@ static void samevolume_new_data (void *cdata)
data->volume = 1.0f; data->volume = 1.0f;
} }
static void samevolume_evaluate (bConstraint *con, bConstraintOb *cob) static void samevolume_evaluate (bConstraint *con, bConstraintOb *cob, ListBase *targets)
{ {
bSameVolumeConstraint *data= con->data; bSameVolumeConstraint *data= con->data;
@@ -1896,7 +1896,6 @@ static void samevolume_evaluate (bConstraint *con, bConstraintOb *cob)
} }
break; break;
} }
} }
static bConstraintTypeInfo CTI_SAMEVOL = { static bConstraintTypeInfo CTI_SAMEVOL = {

View File

@@ -1214,7 +1214,7 @@ float *make_orco_curve(Scene *scene, Object *ob)
/* ***************** BEVEL ****************** */ /* ***************** BEVEL ****************** */
void makebevelcurve(Scene *scene, Object *ob, ListBase *disp) void makebevelcurve(Scene *scene, Object *ob, ListBase *disp, int forRender)
{ {
DispList *dl, *dlnew; DispList *dl, *dlnew;
Curve *bevcu, *cu; Curve *bevcu, *cu;
@@ -1231,14 +1231,21 @@ void makebevelcurve(Scene *scene, Object *ob, ListBase *disp)
if(cu->bevobj->type==OB_CURVE) { if(cu->bevobj->type==OB_CURVE) {
bevcu= cu->bevobj->data; bevcu= cu->bevobj->data;
if(bevcu->ext1==0.0 && bevcu->ext2==0.0) { if(bevcu->ext1==0.0 && bevcu->ext2==0.0) {
ListBase bevdisp= {NULL, NULL};
facx= cu->bevobj->size[0]; facx= cu->bevobj->size[0];
facy= cu->bevobj->size[1]; facy= cu->bevobj->size[1];
dl= bevcu->disp.first; if (forRender) {
if(dl==0) { makeDispListCurveTypes_forRender(scene, cu->bevobj, &bevdisp, NULL, 0);
makeDispListCurveTypes(scene, cu->bevobj, 0); dl= bevdisp.first;
} else {
dl= bevcu->disp.first; dl= bevcu->disp.first;
if(dl==0) {
makeDispListCurveTypes(scene, cu->bevobj, 0);
dl= bevcu->disp.first;
}
} }
while(dl) { while(dl) {
if ELEM(dl->type, DL_POLY, DL_SEGM) { if ELEM(dl->type, DL_POLY, DL_SEGM) {
dlnew= MEM_mallocN(sizeof(DispList), "makebevelcurve1"); dlnew= MEM_mallocN(sizeof(DispList), "makebevelcurve1");
@@ -1260,6 +1267,8 @@ void makebevelcurve(Scene *scene, Object *ob, ListBase *disp)
} }
dl= dl->next; dl= dl->next;
} }
freedisplist(&bevdisp);
} }
} }
} }

View File

@@ -468,11 +468,6 @@ static void build_dag_object(DagForest *dag, DagNode *scenenode, Scene *scene, O
addtoroot = 0; addtoroot = 0;
} }
if (ob->track) {
node2 = dag_get_node(dag,ob->track);
dag_add_relation(dag,node2,node,DAG_RL_OB_OB, "Track To");
addtoroot = 0;
}
if (ob->proxy) { if (ob->proxy) {
node2 = dag_get_node(dag, ob->proxy); node2 = dag_get_node(dag, ob->proxy);
dag_add_relation(dag, node, node2, DAG_RL_DATA_DATA|DAG_RL_OB_OB, "Proxy"); dag_add_relation(dag, node, node2, DAG_RL_DATA_DATA|DAG_RL_OB_OB, "Proxy");

View File

@@ -1299,7 +1299,7 @@ static void curve_calc_modifiers_post(Scene *scene, Object *ob, ListBase *dispba
md = preTesselatePoint->next; md = preTesselatePoint->next;
} }
if (*derivedFinal) { if (derivedFinal && *derivedFinal) {
(*derivedFinal)->release (*derivedFinal); (*derivedFinal)->release (*derivedFinal);
} }
@@ -1354,6 +1354,13 @@ static void curve_calc_modifiers_post(Scene *scene, Object *ob, ListBase *dispba
} }
} }
} else { } else {
if (!derivedFinal) {
/* makeDisplistCurveTypes could be used for beveling, where derived mesh */
/* is totally unnecessary, so we could stop modifiers applying */
/* when we found constructive modifier but derived mesh is unwanted result */
break;
}
if (dm) { if (dm) {
if (dmDeformedVerts) { if (dmDeformedVerts) {
DerivedMesh *tdm = CDDM_copy(dm); DerivedMesh *tdm = CDDM_copy(dm);
@@ -1405,7 +1412,9 @@ static void curve_calc_modifiers_post(Scene *scene, Object *ob, ListBase *dispba
MEM_freeN(dmDeformedVerts); MEM_freeN(dmDeformedVerts);
} }
(*derivedFinal) = dm; if (derivedFinal) {
(*derivedFinal) = dm;
}
if (deformedVerts) { if (deformedVerts) {
curve_applyVertexCos(ob->data, nurb, originalVerts); curve_applyVertexCos(ob->data, nurb, originalVerts);
@@ -1659,7 +1668,7 @@ static void do_makeDispListCurveTypes(Scene *scene, Object *ob, ListBase *dispba
makeBevelList(ob); makeBevelList(ob);
/* If curve has no bevel will return nothing */ /* If curve has no bevel will return nothing */
makebevelcurve(scene, ob, &dlbev); makebevelcurve(scene, ob, &dlbev, forRender);
/* no bevel or extrude, and no width correction? */ /* no bevel or extrude, and no width correction? */
if (!dlbev.first && cu->width==1.0f) { if (!dlbev.first && cu->width==1.0f) {

View File

@@ -429,7 +429,7 @@ static float eff_calc_visibility(ListBase *colliders, EffectorCache *eff, Effect
return visibility; return visibility;
if(!colls) if(!colls)
colls = get_collider_cache(eff->scene, NULL); colls = get_collider_cache(eff->scene, NULL, NULL);
if(!colls) if(!colls)
return visibility; return visibility;

View File

@@ -1422,7 +1422,7 @@ static void hair_velocity_smoothing(ClothModifierData *clmd, lfVector *lF, lfVec
/* 10x10x10 grid gives nice initial results */ /* 10x10x10 grid gives nice initial results */
HairGridVert grid[10][10][10]; HairGridVert grid[10][10][10];
HairGridVert colg[10][10][10]; HairGridVert colg[10][10][10];
ListBase *colliders = get_collider_cache(clmd->scene, NULL); ListBase *colliders = get_collider_cache(clmd->scene, NULL, NULL);
ColliderCache *col = NULL; ColliderCache *col = NULL;
float gmin[3], gmax[3], density; float gmin[3], gmax[3], density;
/* 2.0f is an experimental value that seems to give good results */ /* 2.0f is an experimental value that seems to give good results */

View File

@@ -361,11 +361,6 @@ void unlink_object(Scene *scene, Object *ob)
obt->recalc |= OB_RECALC; obt->recalc |= OB_RECALC;
} }
if(obt->track==ob) {
obt->track= NULL;
obt->recalc |= OB_RECALC_OB;
}
modifiers_foreachObjectLink(obt, unlink_object__unlinkModifierLinks, ob); modifiers_foreachObjectLink(obt, unlink_object__unlinkModifierLinks, ob);
if ELEM(obt->type, OB_CURVE, OB_FONT) { if ELEM(obt->type, OB_CURVE, OB_FONT) {
@@ -2037,12 +2032,6 @@ void where_is_object_time(Scene *scene, Object *ob, float ctime)
object_to_mat4(ob, ob->obmat); object_to_mat4(ob, ob->obmat);
} }
/* Handle tracking */
if(ob->track) {
if( ctime != ob->track->ctime) where_is_object_time(scene, ob->track, ctime);
solve_tracking (ob, ob->track->obmat);
}
/* solve constraints */ /* solve constraints */
if (ob->constraints.first && !(ob->flag & OB_NO_CONSTRAINTS)) { if (ob->constraints.first && !(ob->flag & OB_NO_CONSTRAINTS)) {
bConstraintOb *cob; bConstraintOb *cob;
@@ -2137,33 +2126,6 @@ static void solve_parenting (Scene *scene, Object *ob, Object *par, float obmat[
} }
} }
}
void solve_tracking (Object *ob, float targetmat[][4])
{
float quat[4];
float vec[3];
float totmat[3][3];
float tmat[4][4];
sub_v3_v3v3(vec, ob->obmat[3], targetmat[3]);
vec_to_quat( quat,vec, ob->trackflag, ob->upflag);
quat_to_mat3( totmat,quat);
if(ob->parent && (ob->transflag & OB_POWERTRACK)) {
/* 'temporal' : clear parent info */
object_to_mat4(ob, tmat);
tmat[0][3]= ob->obmat[0][3];
tmat[1][3]= ob->obmat[1][3];
tmat[2][3]= ob->obmat[2][3];
tmat[3][0]= ob->obmat[3][0];
tmat[3][1]= ob->obmat[3][1];
tmat[3][2]= ob->obmat[3][2];
tmat[3][3]= ob->obmat[3][3];
}
else copy_m4_m4(tmat, ob->obmat);
mul_m4_m3m4(ob->obmat, totmat, tmat);
} }
void where_is_object(struct Scene *scene, Object *ob) void where_is_object(struct Scene *scene, Object *ob)
@@ -2185,12 +2147,6 @@ for a lamp that is the child of another object */
int a; int a;
/* NO TIMEOFFS */ /* NO TIMEOFFS */
/* no ipo! (because of dloc and realtime-ipos) */
// XXX old animation system
//ipo= ob->ipo;
//ob->ipo= NULL;
if(ob->parent) { if(ob->parent) {
par= ob->parent; par= ob->parent;
@@ -2212,9 +2168,6 @@ for a lamp that is the child of another object */
object_to_mat4(ob, ob->obmat); object_to_mat4(ob, ob->obmat);
} }
if(ob->track)
solve_tracking(ob, ob->track->obmat);
/* solve constraints */ /* solve constraints */
if (ob->constraints.first) { if (ob->constraints.first) {
bConstraintOb *cob; bConstraintOb *cob;
@@ -2223,10 +2176,6 @@ for a lamp that is the child of another object */
solve_constraints(&ob->constraints, cob, (float)scene->r.cfra); solve_constraints(&ob->constraints, cob, (float)scene->r.cfra);
constraints_clear_evalob(cob); constraints_clear_evalob(cob);
} }
/* WATCH IT!!! */
// XXX old animation system
//ob->ipo= ipo;
} }
/* for calculation of the inverse parent transform, only used for editor */ /* for calculation of the inverse parent transform, only used for editor */
@@ -2238,7 +2187,6 @@ void what_does_parent(Scene *scene, Object *ob, Object *workob)
unit_m4(workob->parentinv); unit_m4(workob->parentinv);
unit_m4(workob->constinv); unit_m4(workob->constinv);
workob->parent= ob->parent; workob->parent= ob->parent;
workob->track= ob->track;
workob->trackflag= ob->trackflag; workob->trackflag= ob->trackflag;
workob->upflag= ob->upflag; workob->upflag= ob->upflag;
@@ -2511,7 +2459,10 @@ void object_tfm_restore(Object *ob, void *obtfm_pt)
void object_handle_update(Scene *scene, Object *ob) void object_handle_update(Scene *scene, Object *ob)
{ {
if(ob->recalc & OB_RECALC) { if(ob->recalc & OB_RECALC) {
/* speed optimization for animation lookups */
if(ob->pose)
make_pose_channels_hash(ob->pose);
/* XXX new animsys warning: depsgraph tag OB_RECALC_DATA should not skip drivers, /* XXX new animsys warning: depsgraph tag OB_RECALC_DATA should not skip drivers,
which is only in where_is_object now */ which is only in where_is_object now */
if(ob->recalc & OB_RECALC) { if(ob->recalc & OB_RECALC) {

View File

@@ -3229,7 +3229,7 @@ static void dynamics_step(ParticleSimulationData *sim, float cfra)
psys_update_effectors(sim); psys_update_effectors(sim);
if(part->type != PART_HAIR) if(part->type != PART_HAIR)
sim->colliders = get_collider_cache(sim->scene, NULL); sim->colliders = get_collider_cache(sim->scene, NULL, NULL);
if(part->phystype==PART_PHYS_BOIDS){ if(part->phystype==PART_PHYS_BOIDS){
ParticleTarget *pt = psys->targets.first; ParticleTarget *pt = psys->targets.first;

View File

@@ -1687,7 +1687,7 @@ int BKE_ptcache_write_cache(PTCacheID *pid, int cfra)
return 0; return 0;
if(cache->flag & PTCACHE_DISK_CACHE) { if(cache->flag & PTCACHE_DISK_CACHE) {
int ofra, efra = cache->endframe; int ofra=0, efra = cache->endframe;
if(cfra==0) if(cfra==0)
add = 1; add = 1;
@@ -2871,4 +2871,5 @@ void BKE_ptcache_invalidate(PointCache *cache)
cache->flag &= ~PTCACHE_SIMULATION_VALID; cache->flag &= ~PTCACHE_SIMULATION_VALID;
cache->simframe = 0; cache->simframe = 0;
cache->last_exact = 0; cache->last_exact = 0;
} }

View File

@@ -53,6 +53,7 @@
#include "BKE_animsys.h" #include "BKE_animsys.h"
#include "BKE_depsgraph.h" #include "BKE_depsgraph.h"
#include "BKE_global.h" #include "BKE_global.h"
#include "BKE_group.h"
#include "BKE_idprop.h" #include "BKE_idprop.h"
#include "BKE_library.h" #include "BKE_library.h"
#include "BKE_main.h" #include "BKE_main.h"

View File

@@ -3065,6 +3065,7 @@ static void lib_link_particlesystems(FileData *fd, Object *ob, ID *id, ListBase
* pointcache should /w cloth should be added in 'ParticleSystem' - campbell */ * pointcache should /w cloth should be added in 'ParticleSystem' - campbell */
psys->clmd->point_cache= psys->pointcache; psys->clmd->point_cache= psys->pointcache;
psys->clmd->ptcaches.first= psys->clmd->ptcaches.last= NULL; psys->clmd->ptcaches.first= psys->clmd->ptcaches.last= NULL;
psys->clmd->coll_parms->group= newlibadr(fd, id->lib, psys->clmd->coll_parms->group);
} }
} }
else { else {
@@ -3621,6 +3622,7 @@ static void lib_link_object(FileData *fd, Main *main)
if(clmd) if(clmd)
{ {
clmd->sim_parms->effector_weights->group = newlibadr(fd, ob->id.lib, clmd->sim_parms->effector_weights->group); clmd->sim_parms->effector_weights->group = newlibadr(fd, ob->id.lib, clmd->sim_parms->effector_weights->group);
clmd->coll_parms->group= newlibadr(fd, ob->id.lib, clmd->coll_parms->group);
} }
} }
@@ -3652,6 +3654,8 @@ static void direct_link_pose(FileData *fd, bPose *pose)
link_list(fd, &pose->chanbase); link_list(fd, &pose->chanbase);
link_list(fd, &pose->agroups); link_list(fd, &pose->agroups);
pose->chanhash= NULL;
for (pchan = pose->chanbase.first; pchan; pchan=pchan->next) { for (pchan = pose->chanbase.first; pchan; pchan=pchan->next) {
pchan->bone= NULL; pchan->bone= NULL;
pchan->parent= newdataadr(fd, pchan->parent); pchan->parent= newdataadr(fd, pchan->parent);
@@ -6431,6 +6435,25 @@ static void do_version_constraints_radians_degrees_250(ListBase *lb)
} }
} }
/* NOTE: this version patch is intended for versions < 2.52.2, but was initially introduced in 2.27 already */
static void do_version_old_trackto_to_constraints(Object *ob)
{
/* create new trackto constraint from the relationship */
if (ob->track)
{
bConstraint *con= add_ob_constraint(ob, "AutoTrack", CONSTRAINT_TYPE_TRACKTO);
bTrackToConstraint *data = con->data;
/* copy tracking settings from the object */
data->tar = ob->track;
data->reserved1 = ob->trackflag;
data->reserved2 = ob->upflag;
}
/* clear old track setting */
ob->track = NULL;
}
static void do_versions(FileData *fd, Library *lib, Main *main) static void do_versions(FileData *fd, Library *lib, Main *main)
{ {
/* WATCH IT!!!: pointers from libdata have not been converted */ /* WATCH IT!!!: pointers from libdata have not been converted */
@@ -7253,36 +7276,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
} }
/* Change Ob->Track in real TrackTo constraint */ /* Change Ob->Track in real TrackTo constraint */
do_version_old_trackto_to_constraints(ob);
if (ob->track){
bConstraint *con;
bConstraintTypeInfo *cti;
bTrackToConstraint *data;
void *cdata;
list = &ob->constraints;
if (list)
{
con = MEM_callocN(sizeof(bConstraint), "constraint");
strcpy (con->name, "AutoTrack");
unique_constraint_name(con, list);
con->flag |= CONSTRAINT_EXPAND;
con->enforce=1.0F;
con->type = CONSTRAINT_TYPE_TRACKTO;
cti= get_constraint_typeinfo(CONSTRAINT_TYPE_TRACKTO);
cdata= MEM_callocN(cti->size, cti->structName);
cti->new_data(cdata);
data = (bTrackToConstraint *)cdata;
data->tar = ob->track;
data->reserved1 = ob->trackflag;
data->reserved2 = ob->upflag;
con->data= (void*) data;
BLI_addtail(list, con);
}
ob->track = 0;
}
ob = ob->id.next; ob = ob->id.next;
} }
@@ -9486,7 +9480,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
/* check if top parent has compound shape set and if yes, set this object /* check if top parent has compound shape set and if yes, set this object
to compound shaper as well (was the behaviour before, now it's optional) */ to compound shaper as well (was the behaviour before, now it's optional) */
Object *parent= newlibadr(fd, lib, ob->parent); Object *parent= newlibadr(fd, lib, ob->parent);
while (parent && parent->parent != NULL) { while (parent && parent != ob && parent->parent != NULL) {
parent = newlibadr(fd, lib, parent->parent); parent = newlibadr(fd, lib, parent->parent);
} }
if(parent) { if(parent) {
@@ -9753,7 +9747,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
void *olddata = ob->data; void *olddata = ob->data;
ob->data = me; ob->data = me;
if(me && me->id.lib==NULL && me->mr) /* XXX - library meshes crash on loading most yoFrankie levels, the multires pointer gets invalid - Campbell */ if(me && me->id.lib==NULL && me->mr && me->mr->level_count > 1) /* XXX - library meshes crash on loading most yoFrankie levels, the multires pointer gets invalid - Campbell */
multires_load_old(ob, me); multires_load_old(ob, me);
ob->data = olddata; ob->data = olddata;
@@ -10700,8 +10694,16 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
node= node->next; node= node->next;
} }
} }
} }
/* old-track -> constraints (this time we're really doing it!) */
if (main->versionfile < 252 || (main->versionfile == 252 && main->subversionfile < 2)) {
Object *ob;
for (ob = main->object.first; ob; ob = ob->id.next)
do_version_old_trackto_to_constraints(ob);
}
/* put 2.50 compatibility code here until next subversion bump */ /* put 2.50 compatibility code here until next subversion bump */
{ {

View File

@@ -892,6 +892,8 @@ int join_armature_exec(bContext *C, wmOperator *op)
BLI_remlink(&opose->chanbase, pchan); BLI_remlink(&opose->chanbase, pchan);
BLI_addtail(&pose->chanbase, pchan); BLI_addtail(&pose->chanbase, pchan);
free_pose_channels_hash(opose);
free_pose_channels_hash(pose);
} }
ED_base_object_free_and_unlink(scene, base); ED_base_object_free_and_unlink(scene, base);
@@ -1095,6 +1097,7 @@ static void separate_armature_bones (Scene *scene, Object *ob, short sel)
/* free any of the extra-data this pchan might have */ /* free any of the extra-data this pchan might have */
free_pose_channel(pchan); free_pose_channel(pchan);
free_pose_channels_hash(ob->pose);
/* get rid of unneeded bone */ /* get rid of unneeded bone */
bone_free(arm, curbone); bone_free(arm, curbone);
@@ -1802,6 +1805,7 @@ static int armature_delete_selected_exec(bContext *C, wmOperator *op)
if (curBone && (curBone->flag & BONE_SELECTED) && (arm->layer & curBone->layer)) { if (curBone && (curBone->flag & BONE_SELECTED) && (arm->layer & curBone->layer)) {
free_pose_channel(pchan); free_pose_channel(pchan);
free_pose_channels_hash(obedit->pose);
BLI_freelinkN (&obedit->pose->chanbase, pchan); BLI_freelinkN (&obedit->pose->chanbase, pchan);
} }
else { else {

View File

@@ -161,7 +161,9 @@ static void gp_get_3d_reference (tGPsdata *p, float *vec)
float *fp= give_cursor(p->scene, v3d); float *fp= give_cursor(p->scene, v3d);
/* the reference point used depends on the owner... */ /* the reference point used depends on the owner... */
if (p->ownerPtr.type == &RNA_Object) { #if 0 // XXX: disabled for now, since we can't draw relative ot the owner yet
if (p->ownerPtr.type == &RNA_Object)
{
Object *ob= (Object *)p->ownerPtr.data; Object *ob= (Object *)p->ownerPtr.data;
/* active Object /* active Object
@@ -169,7 +171,9 @@ static void gp_get_3d_reference (tGPsdata *p, float *vec)
*/ */
sub_v3_v3v3(vec, fp, ob->loc); sub_v3_v3v3(vec, fp, ob->loc);
} }
else { else
#endif
{
/* use 3D-cursor */ /* use 3D-cursor */
copy_v3_v3(vec, fp); copy_v3_v3(vec, fp);
} }

View File

@@ -86,7 +86,6 @@ editmesh_tool.c: UI called tools for editmesh, geometry changes here, otherwise
/* XXX */ /* XXX */
static void waitcursor(int val) {} static void waitcursor(int val) {}
static int pupmenu() {return 0;}
#define add_numbut(a, b, c, d, e, f, g) {} #define add_numbut(a, b, c, d, e, f, g) {}
/* XXX */ /* XXX */
@@ -5961,17 +5960,15 @@ static int select_vertex_path_exec(bContext *C, wmOperator *op)
PathNode *currpn; PathNode *currpn;
PathNode *Q; PathNode *Q;
int v, *previous, pathvert, pnindex; /*pnindex redundant?*/ int v, *previous, pathvert, pnindex; /*pnindex redundant?*/
int unbalanced, totnodes; int unbalanced, totnodes;
short physical;
float *cost; float *cost;
int type= RNA_enum_get(op->ptr, "type");
Heap *heap; /*binary heap for sorting pointers to PathNodes based upon a 'cost'*/ Heap *heap; /*binary heap for sorting pointers to PathNodes based upon a 'cost'*/
s = t = NULL; s = t = NULL;
ese = ((EditSelection*)em->selected.last); ese = ((EditSelection*)em->selected.last);
if(ese && ese->type == EDITVERT && ese->prev && ese->prev->type == EDITVERT){ if(ese && ese->type == EDITVERT && ese->prev && ese->prev->type == EDITVERT) {
physical= pupmenu("Distance Method? %t|Edge Length%x1|Topological%x0");
t = (EditVert*)ese->data; t = (EditVert*)ese->data;
s = (EditVert*)ese->prev->data; s = (EditVert*)ese->prev->data;
@@ -6024,7 +6021,7 @@ static int select_vertex_path_exec(bContext *C, wmOperator *op)
newpe = MEM_mallocN(sizeof(PathEdge), "Path Edge"); newpe = MEM_mallocN(sizeof(PathEdge), "Path Edge");
newpe->v = ((PathNode*)eed->v2->tmp.p)->u; newpe->v = ((PathNode*)eed->v2->tmp.p)->u;
if(physical){ if (type == PATH_SELECT_EDGE_LENGTH) {
newpe->w = len_v3v3(eed->v1->co, eed->v2->co); newpe->w = len_v3v3(eed->v1->co, eed->v2->co);
} }
else newpe->w = 1; else newpe->w = 1;
@@ -6036,7 +6033,7 @@ static int select_vertex_path_exec(bContext *C, wmOperator *op)
currpn = ((PathNode*)eed->v2->tmp.p); currpn = ((PathNode*)eed->v2->tmp.p);
newpe = MEM_mallocN(sizeof(PathEdge), "Path Edge"); newpe = MEM_mallocN(sizeof(PathEdge), "Path Edge");
newpe->v = ((PathNode*)eed->v1->tmp.p)->u; newpe->v = ((PathNode*)eed->v1->tmp.p)->u;
if(physical){ if (type == PATH_SELECT_EDGE_LENGTH) {
newpe->w = len_v3v3(eed->v1->co, eed->v2->co); newpe->w = len_v3v3(eed->v1->co, eed->v2->co);
} }
else newpe->w = 1; else newpe->w = 1;
@@ -6124,7 +6121,6 @@ void MESH_OT_select_vertex_path(wmOperatorType *ot)
/* api callbacks */ /* api callbacks */
ot->exec= select_vertex_path_exec; ot->exec= select_vertex_path_exec;
ot->invoke= WM_menu_invoke;
ot->poll= ED_operator_editmesh; ot->poll= ED_operator_editmesh;
/* flags */ /* flags */

View File

@@ -973,10 +973,6 @@ static void copy_object_set_idnew(bContext *C, int dupflag)
{ {
Material *ma, *mao; Material *ma, *mao;
ID *id; ID *id;
#if 0 // XXX old animation system
Ipo *ipo;
bActionStrip *strip;
#endif // XXX old animation system
int a; int a;
/* XXX check object pointers */ /* XXX check object pointers */
@@ -990,17 +986,8 @@ static void copy_object_set_idnew(bContext *C, int dupflag)
} }
modifiers_foreachIDLink(ob, copy_object__forwardModifierLinks, NULL); modifiers_foreachIDLink(ob, copy_object__forwardModifierLinks, NULL);
ID_NEW(ob->parent); ID_NEW(ob->parent);
ID_NEW(ob->track);
ID_NEW(ob->proxy); ID_NEW(ob->proxy);
ID_NEW(ob->proxy_group); ID_NEW(ob->proxy_group);
#if 0 // XXX old animation system
for(strip= ob->nlastrips.first; strip; strip= strip->next) {
bActionModifier *amod;
for(amod= strip->modifiers.first; amod; amod= amod->next)
ID_NEW(amod->ob);
}
#endif // XXX old animation system
} }
CTX_DATA_END; CTX_DATA_END;

View File

@@ -305,7 +305,6 @@ void ED_object_exit_editmode(bContext *C, int flag)
WM_event_add_notifier(C, NC_SCENE|ND_MODE|NS_MODE_OBJECT, scene); WM_event_add_notifier(C, NC_SCENE|ND_MODE|NS_MODE_OBJECT, scene);
obedit->mode &= ~OB_MODE_EDIT; obedit->mode &= ~OB_MODE_EDIT;
ED_object_toggle_modes(C, obedit->restore_mode);
} }
} }
@@ -348,8 +347,7 @@ void ED_object_enter_editmode(bContext *C, int flag)
ob->restore_mode = ob->mode; ob->restore_mode = ob->mode;
ED_object_toggle_modes(C, ob->mode); ED_object_toggle_modes(C, ob->mode);
ob->mode= OB_MODE_EDIT;
ob->mode |= OB_MODE_EDIT;
if(ob->type==OB_MESH) { if(ob->type==OB_MESH) {
Mesh *me= ob->data; Mesh *me= ob->data;

View File

@@ -405,7 +405,7 @@ void OBJECT_OT_proxy_make (wmOperatorType *ot)
static EnumPropertyItem prop_clear_parent_types[] = { static EnumPropertyItem prop_clear_parent_types[] = {
{0, "CLEAR", 0, "Clear Parent", ""}, {0, "CLEAR", 0, "Clear Parent", ""},
{1, "CLEAR_KEEP_TRANSFORM", 0, "Clear and Keep Transformation (Clear Track)", ""}, {1, "CLEAR_KEEP_TRANSFORM", 0, "Clear and Keep Transformation", ""},
{2, "CLEAR_INVERSE", 0, "Clear Parent Inverse", ""}, {2, "CLEAR_INVERSE", 0, "Clear Parent Inverse", ""},
{0, NULL, 0, NULL, NULL} {0, NULL, 0, NULL, NULL}
}; };
@@ -422,7 +422,6 @@ static int parent_clear_exec(bContext *C, wmOperator *op)
} }
else if(type == 1) { else if(type == 1) {
ob->parent= NULL; ob->parent= NULL;
ob->track= NULL;
object_apply_mat4(ob, ob->obmat); object_apply_mat4(ob, ob->obmat);
} }
else if(type == 2) else if(type == 2)
@@ -916,7 +915,6 @@ static EnumPropertyItem prop_make_track_types[] = {
{1, "DAMPTRACK", 0, "Damped Track Constraint", ""}, {1, "DAMPTRACK", 0, "Damped Track Constraint", ""},
{2, "TRACKTO", 0, "Track To Constraint", ""}, {2, "TRACKTO", 0, "Track To Constraint", ""},
{3, "LOCKTRACK", 0, "Lock Track Constraint", ""}, {3, "LOCKTRACK", 0, "Lock Track Constraint", ""},
{4, "OLDTRACK", 0, "Old Track", ""},
{0, NULL, 0, NULL, NULL} {0, NULL, 0, NULL, NULL}
}; };
@@ -988,15 +986,6 @@ static int track_set_exec(bContext *C, wmOperator *op)
} }
CTX_DATA_END; CTX_DATA_END;
} }
else {
CTX_DATA_BEGIN(C, Object*, ob, selected_editable_objects) {
if(ob!=obact) {
ob->track= obact;
ob->recalc |= OB_RECALC;
}
}
CTX_DATA_END;
}
DAG_scene_sort(scene); DAG_scene_sort(scene);
DAG_ids_flush_update(0); DAG_ids_flush_update(0);
@@ -1353,7 +1342,6 @@ void single_object_users(Scene *scene, View3D *v3d, int flag)
modifiers_foreachObjectLink(base->object, single_object_users__forwardModifierLinks, NULL); modifiers_foreachObjectLink(base->object, single_object_users__forwardModifierLinks, NULL);
ID_NEW(ob->parent); ID_NEW(ob->parent);
ID_NEW(ob->track);
} }
} }
@@ -1732,7 +1720,6 @@ static int make_local_exec(bContext *C, wmOperator *op)
CTX_DATA_BEGIN(C, Object*, ob, selected_editable_objects) { CTX_DATA_BEGIN(C, Object*, ob, selected_editable_objects) {
if(ob->id.lib==NULL) { if(ob->id.lib==NULL) {
ID_NEW(ob->parent); ID_NEW(ob->parent);
ID_NEW(ob->track);
} }
} }
CTX_DATA_END; CTX_DATA_END;

View File

@@ -291,6 +291,7 @@ static void buttons_area_listener(ScrArea *sa, wmNotifier *wmn)
ED_area_tag_redraw(sa); ED_area_tag_redraw(sa);
else else
buttons_area_redraw(sa, BCONTEXT_MODIFIER); buttons_area_redraw(sa, BCONTEXT_MODIFIER);
buttons_area_redraw(sa, BCONTEXT_PHYSICS);
break; break;
case ND_CONSTRAINT: case ND_CONSTRAINT:
buttons_area_redraw(sa, BCONTEXT_CONSTRAINT); buttons_area_redraw(sa, BCONTEXT_CONSTRAINT);
@@ -300,6 +301,9 @@ static void buttons_area_listener(ScrArea *sa, wmNotifier *wmn)
buttons_area_redraw(sa, BCONTEXT_PARTICLE); buttons_area_redraw(sa, BCONTEXT_PARTICLE);
break; break;
case ND_DRAW: case ND_DRAW:
buttons_area_redraw(sa, BCONTEXT_OBJECT);
buttons_area_redraw(sa, BCONTEXT_DATA);
buttons_area_redraw(sa, BCONTEXT_PHYSICS);
case ND_SHADING: case ND_SHADING:
case ND_SHADING_DRAW: case ND_SHADING_DRAW:
/* currently works by redraws... if preview is set, it (re)starts job */ /* currently works by redraws... if preview is set, it (re)starts job */

View File

@@ -883,7 +883,7 @@ void uiTemplateImage(uiLayout *layout, bContext *C, PointerRNA *ptr, char *propn
} }
else { else {
row= uiLayoutRow(layout, 0); row= uiLayoutRow(layout, 0);
uiItemR(row, &imaptr, "source", (compact)? 0: UI_ITEM_R_EXPAND, NULL, 0); uiItemR(row, &imaptr, "source", 0, NULL, 0);
if(ima->source != IMA_SRC_GENERATED) { if(ima->source != IMA_SRC_GENERATED) {
row= uiLayoutRow(layout, 1); row= uiLayoutRow(layout, 1);

View File

@@ -159,14 +159,18 @@ static int layers_exec(bContext *C, wmOperator *op)
if(nr < 0) if(nr < 0)
return OPERATOR_CANCELLED; return OPERATOR_CANCELLED;
if(nr == 0) { if(nr == 0) {
/* all layers */ /* all layers */
v3d->lay |= (1<<20)-1;
if(!v3d->layact) if(!v3d->layact)
v3d->layact= 1; v3d->layact= 1;
if (toggle && v3d->lay == ((1<<20)-1)) {
/* return to active layer only */
v3d->lay = v3d->layact;
} else {
v3d->lay |= (1<<20)-1;
}
} }
else { else {
int bit; int bit;

View File

@@ -2600,7 +2600,7 @@ static void createTransNlaData(bContext *C, TransInfo *t)
float xmouse, ymouse; float xmouse, ymouse;
UI_view2d_region_to_view(&ac.ar->v2d, t->imval[0], t->imval[1], &xmouse, &ymouse); UI_view2d_region_to_view(&ac.ar->v2d, t->imval[0], t->imval[1], &xmouse, &ymouse);
t->frame_side= (xmouse > CFRA) ? 'R' : 'L'; // XXX use t->frame_side t->frame_side= (xmouse > CFRA) ? 'R' : 'L';
} }
else { else {
/* normal transform - both sides of current frame are considered */ /* normal transform - both sides of current frame are considered */
@@ -2691,7 +2691,7 @@ static void createTransNlaData(bContext *C, TransInfo *t)
tdn->handle= -1; tdn->handle= -1;
/* now, link the transform data up to this data */ /* now, link the transform data up to this data */
if (t->mode == TFM_TRANSLATION) { if (ELEM(t->mode, TFM_TRANSLATION, TFM_TIME_EXTEND)) {
td->loc= tdn->h1; td->loc= tdn->h1;
VECCOPY(td->iloc, tdn->h1); VECCOPY(td->iloc, tdn->h1);
@@ -2722,7 +2722,7 @@ static void createTransNlaData(bContext *C, TransInfo *t)
tdn->handle= (tdn->handle) ? 2 : 1; tdn->handle= (tdn->handle) ? 2 : 1;
/* now, link the transform data up to this data */ /* now, link the transform data up to this data */
if (t->mode == TFM_TRANSLATION) { if (ELEM(t->mode, TFM_TRANSLATION, TFM_TIME_EXTEND)) {
td->loc= tdn->h2; td->loc= tdn->h2;
VECCOPY(td->iloc, tdn->h2); VECCOPY(td->iloc, tdn->h2);
@@ -4158,7 +4158,6 @@ static void createTransSeqData(bContext *C, TransInfo *t)
static void ObjectToTransData(bContext *C, TransInfo *t, TransData *td, Object *ob) static void ObjectToTransData(bContext *C, TransInfo *t, TransData *td, Object *ob)
{ {
Scene *scene = t->scene; Scene *scene = t->scene;
Object *track;
float obmtx[3][3]; float obmtx[3][3];
short constinv; short constinv;
short skip_invert = 0; short skip_invert = 0;
@@ -4180,10 +4179,7 @@ static void ObjectToTransData(bContext *C, TransInfo *t, TransData *td, Object *
if (t->mode == TFM_DUMMY) if (t->mode == TFM_DUMMY)
skip_invert = 1; skip_invert = 1;
if (skip_invert == 0 && (ob->track || constinv==0)) { if (skip_invert == 0 && constinv == 0) {
track= ob->track;
ob->track= NULL;
if (constinv == 0) if (constinv == 0)
ob->transflag |= OB_NO_CONSTRAINTS; /* where_is_object_time checks this */ ob->transflag |= OB_NO_CONSTRAINTS; /* where_is_object_time checks this */
@@ -4191,8 +4187,6 @@ static void ObjectToTransData(bContext *C, TransInfo *t, TransData *td, Object *
if (constinv == 0) if (constinv == 0)
ob->transflag &= ~OB_NO_CONSTRAINTS; ob->transflag &= ~OB_NO_CONSTRAINTS;
ob->track= track;
} }
else else
where_is_object(t->scene, ob); where_is_object(t->scene, ob);

View File

@@ -869,30 +869,29 @@ void transform_keymap_for_space(wmKeyConfig *keyconf, wmKeyMap *keymap, int spac
case SPACE_ACTION: case SPACE_ACTION:
km= WM_keymap_add_item(keymap, "TRANSFORM_OT_transform", GKEY, KM_PRESS, 0, 0); km= WM_keymap_add_item(keymap, "TRANSFORM_OT_transform", GKEY, KM_PRESS, 0, 0);
RNA_int_set(km->ptr, "mode", TFM_TIME_TRANSLATE); RNA_int_set(km->ptr, "mode", TFM_TIME_TRANSLATE);
km= WM_keymap_add_item(keymap, "TRANSFORM_OT_transform", EVT_TWEAK_S, KM_ANY, 0, 0); km= WM_keymap_add_item(keymap, "TRANSFORM_OT_transform", EVT_TWEAK_S, KM_ANY, 0, 0);
RNA_int_set(km->ptr, "mode", TFM_TIME_TRANSLATE); RNA_int_set(km->ptr, "mode", TFM_TIME_TRANSLATE);
km= WM_keymap_add_item(keymap, "TRANSFORM_OT_transform", EKEY, KM_PRESS, 0, 0); km= WM_keymap_add_item(keymap, "TRANSFORM_OT_transform", EKEY, KM_PRESS, 0, 0);
RNA_int_set(km->ptr, "mode", TFM_TIME_EXTEND); RNA_int_set(km->ptr, "mode", TFM_TIME_EXTEND);
km= WM_keymap_add_item(keymap, "TRANSFORM_OT_transform", SKEY, KM_PRESS, 0, 0); km= WM_keymap_add_item(keymap, "TRANSFORM_OT_transform", SKEY, KM_PRESS, 0, 0);
RNA_int_set(km->ptr, "mode", TFM_TIME_SCALE); RNA_int_set(km->ptr, "mode", TFM_TIME_SCALE);
km= WM_keymap_add_item(keymap, "TRANSFORM_OT_transform", TKEY, KM_PRESS, 0, 0); km= WM_keymap_add_item(keymap, "TRANSFORM_OT_transform", TKEY, KM_PRESS, 0, 0);
RNA_int_set(km->ptr, "mode", TFM_TIME_SLIDE); RNA_int_set(km->ptr, "mode", TFM_TIME_SLIDE);
break; break;
case SPACE_IPO: case SPACE_IPO:
km= WM_keymap_add_item(keymap, OP_TRANSLATION, GKEY, KM_PRESS, 0, 0); km= WM_keymap_add_item(keymap, OP_TRANSLATION, GKEY, KM_PRESS, 0, 0);
km= WM_keymap_add_item(keymap, OP_TRANSLATION, EVT_TWEAK_S, KM_ANY, 0, 0); km= WM_keymap_add_item(keymap, OP_TRANSLATION, EVT_TWEAK_S, KM_ANY, 0, 0);
// XXX the 'mode' identifier here is not quite right
km= WM_keymap_add_item(keymap, "TRANSFORM_OT_transform", EKEY, KM_PRESS, 0, 0); km= WM_keymap_add_item(keymap, "TRANSFORM_OT_transform", EKEY, KM_PRESS, 0, 0);
RNA_int_set(km->ptr, "mode", TFM_TIME_EXTEND); RNA_int_set(km->ptr, "mode", TFM_TIME_EXTEND);
km = WM_keymap_add_item(keymap, OP_ROTATION, RKEY, KM_PRESS, 0, 0); km = WM_keymap_add_item(keymap, OP_ROTATION, RKEY, KM_PRESS, 0, 0);
km = WM_keymap_add_item(keymap, OP_RESIZE, SKEY, KM_PRESS, 0, 0); km = WM_keymap_add_item(keymap, OP_RESIZE, SKEY, KM_PRESS, 0, 0);
break; break;
case SPACE_NLA: case SPACE_NLA:

View File

@@ -40,6 +40,7 @@
struct SpaceLink; struct SpaceLink;
struct Object; struct Object;
struct Group; struct Group;
struct GHash;
/* ************************************************ */ /* ************************************************ */
/* Visualisation */ /* Visualisation */
@@ -326,6 +327,7 @@ typedef enum eRotationModes {
*/ */
typedef struct bPose { typedef struct bPose {
ListBase chanbase; /* list of pose channels, PoseBones in RNA */ ListBase chanbase; /* list of pose channels, PoseBones in RNA */
struct GHash *chanhash; /* ghash for quicker string lookups */
short flag, proxy_layer; /* proxy layer: copy from armature, gets synced */ short flag, proxy_layer; /* proxy layer: copy from armature, gets synced */

View File

@@ -93,6 +93,7 @@ typedef struct ClothCollSettings
int flags; /* collision flags defined in BKE_cloth.h */ int flags; /* collision flags defined in BKE_cloth.h */
short self_loop_count; /* How many iterations for the selfcollision loop */ short self_loop_count; /* How many iterations for the selfcollision loop */
short loop_count; /* How many iterations for the collision loop. */ short loop_count; /* How many iterations for the collision loop. */
struct Group *group; /* Only use colliders from this group of objects */
} ClothCollSettings; } ClothCollSettings;

View File

@@ -906,7 +906,7 @@ typedef struct Scene {
#define R_NO_TEX 0x2000 #define R_NO_TEX 0x2000
#define R_STAMP_INFO 0x4000 /* deprecated */ #define R_STAMP_INFO 0x4000 /* deprecated */
#define R_FULL_SAMPLE 0x8000 #define R_FULL_SAMPLE 0x8000
#define R_COMP_RERENDER 0x10000 #define R_DEPRECATED 0x10000
#define R_RECURS_PROTECTION 0x20000 #define R_RECURS_PROTECTION 0x20000
#define R_TEXNODE_PREVIEW 0x40000 #define R_TEXNODE_PREVIEW 0x40000

View File

@@ -430,6 +430,11 @@ static void rna_def_cloth_collision_settings(BlenderRNA *brna)
RNA_def_property_range(prop, 1, 10); RNA_def_property_range(prop, 1, 10);
RNA_def_property_ui_text(prop, "Self Collision Quality", "How many self collision iterations should be done. (higher is better quality but slower)"); RNA_def_property_ui_text(prop, "Self Collision Quality", "How many self collision iterations should be done. (higher is better quality but slower)");
RNA_def_property_update(prop, 0, "rna_cloth_update"); RNA_def_property_update(prop, 0, "rna_cloth_update");
prop= RNA_def_property(srna, "group", PROP_POINTER, PROP_NONE);
RNA_def_property_flag(prop, PROP_EDITABLE);
RNA_def_property_ui_text(prop, "Collision Group", "Limit colliders to this Group");
RNA_def_property_update(prop, 0, "rna_cloth_update");
} }
void RNA_def_cloth(BlenderRNA *brna) void RNA_def_cloth(BlenderRNA *brna)

View File

@@ -399,7 +399,7 @@ static void modifier_object_set(Object *self, Object **ob_p, int type, PointerRN
Object *ob= value.data; Object *ob= value.data;
if(!self || ob != self) if(!self || ob != self)
if(!ob || ob->type == type) if(!ob || type == OB_EMPTY || ob->type == type)
*ob_p= ob; *ob_p= ob;
} }
@@ -420,7 +420,7 @@ static void rna_CurveModifier_object_set(PointerRNA *ptr, PointerRNA value)
static void rna_CastModifier_object_set(PointerRNA *ptr, PointerRNA value) static void rna_CastModifier_object_set(PointerRNA *ptr, PointerRNA value)
{ {
modifier_object_set(ptr->id.data, &((CastModifierData*)ptr->data)->object, OB_MESH, value); modifier_object_set(ptr->id.data, &((CastModifierData*)ptr->data)->object, OB_EMPTY, value);
} }
static void rna_ArmatureModifier_object_set(PointerRNA *ptr, PointerRNA value) static void rna_ArmatureModifier_object_set(PointerRNA *ptr, PointerRNA value)

View File

@@ -1474,7 +1474,7 @@ static void rna_def_object(BlenderRNA *brna)
RNA_def_property_float_funcs(prop, "rna_Object_boundbox_get", NULL, NULL); RNA_def_property_float_funcs(prop, "rna_Object_boundbox_get", NULL, NULL);
RNA_def_property_ui_text(prop, "Bound Box", "Objects bound box in object-space coords"); RNA_def_property_ui_text(prop, "Bound Box", "Objects bound box in object-space coords");
/* parent and track */ /* parent */
prop= RNA_def_property(srna, "parent", PROP_POINTER, PROP_NONE); prop= RNA_def_property(srna, "parent", PROP_POINTER, PROP_NONE);
RNA_def_property_pointer_funcs(prop, NULL, "rna_Object_parent_set", NULL); RNA_def_property_pointer_funcs(prop, NULL, "rna_Object_parent_set", NULL);
RNA_def_property_flag(prop, PROP_EDITABLE|PROP_ID_SELF_CHECK); RNA_def_property_flag(prop, PROP_EDITABLE|PROP_ID_SELF_CHECK);
@@ -1500,16 +1500,13 @@ static void rna_def_object(BlenderRNA *brna)
RNA_def_property_string_funcs(prop, NULL, NULL, "rna_Object_parent_bone_set"); RNA_def_property_string_funcs(prop, NULL, NULL, "rna_Object_parent_bone_set");
RNA_def_property_ui_text(prop, "Parent Bone", "Name of parent bone in case of a bone parenting relation"); RNA_def_property_ui_text(prop, "Parent Bone", "Name of parent bone in case of a bone parenting relation");
RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Object_dependency_update"); RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Object_dependency_update");
prop= RNA_def_property(srna, "track", PROP_POINTER, PROP_NONE); /* Track and Up flags */
RNA_def_property_flag(prop, PROP_EDITABLE|PROP_ID_SELF_CHECK); // XXX: these have been saved here for a bit longer (after old track was removed), since some other tools still refer to this
RNA_def_property_ui_text(prop, "Track", "Object being tracked to define the rotation (Old Track)");
RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Object_dependency_update");
prop= RNA_def_property(srna, "track_axis", PROP_ENUM, PROP_NONE); prop= RNA_def_property(srna, "track_axis", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "trackflag"); RNA_def_property_enum_sdna(prop, NULL, "trackflag");
RNA_def_property_enum_items(prop, track_items); RNA_def_property_enum_items(prop, track_items);
RNA_def_property_ui_text(prop, "Track Axis", "Tracking axis pointing to the tracked object"); RNA_def_property_ui_text(prop, "Track Axis", "Axis that points in 'forward' direction");
RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Object_update"); RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Object_update");
prop= RNA_def_property(srna, "up_axis", PROP_ENUM, PROP_NONE); prop= RNA_def_property(srna, "up_axis", PROP_ENUM, PROP_NONE);
@@ -1517,7 +1514,7 @@ static void rna_def_object(BlenderRNA *brna)
RNA_def_property_enum_items(prop, up_items); RNA_def_property_enum_items(prop, up_items);
RNA_def_property_ui_text(prop, "Up Axis", "Axis that points in the upward direction"); RNA_def_property_ui_text(prop, "Up Axis", "Axis that points in the upward direction");
RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Object_update"); RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Object_update");
/* proxy */ /* proxy */
prop= RNA_def_property(srna, "proxy", PROP_POINTER, PROP_NONE); prop= RNA_def_property(srna, "proxy", PROP_POINTER, PROP_NONE);
RNA_def_property_ui_text(prop, "Proxy", "Library object this proxy object controls"); RNA_def_property_ui_text(prop, "Proxy", "Library object this proxy object controls");
@@ -1781,11 +1778,7 @@ static void rna_def_object(BlenderRNA *brna)
rna_def_motionpath_common(srna); rna_def_motionpath_common(srna);
/* duplicates */ /* duplicates */
prop= RNA_def_property(srna, "track_override_parent", PROP_BOOLEAN, PROP_NONE); // XXX: evil old crap
RNA_def_property_boolean_sdna(prop, NULL, "transflag", OB_POWERTRACK);
RNA_def_property_ui_text(prop, "Track Override Parent", "Override rotation from parenting");
RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Object_update");
prop= RNA_def_property(srna, "slow_parent", PROP_BOOLEAN, PROP_NONE); prop= RNA_def_property(srna, "slow_parent", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "partype", PARSLOW); RNA_def_property_boolean_sdna(prop, NULL, "partype", PARSLOW);
RNA_def_property_ui_text(prop, "Slow Parent", "Create a delay in the parent relationship"); RNA_def_property_ui_text(prop, "Slow Parent", "Create a delay in the parent relationship");

View File

@@ -37,6 +37,7 @@
#include "DNA_scene_types.h" #include "DNA_scene_types.h"
#include "BLI_math.h" #include "BLI_math.h"
#include "BLI_ghash.h"
#include "WM_types.h" #include "WM_types.h"
@@ -525,7 +526,7 @@ PointerRNA rna_PoseBones_lookup_string(PointerRNA *ptr, const char *key)
{ {
PointerRNA rptr; PointerRNA rptr;
bPose *pose= (bPose*)ptr->data; bPose *pose= (bPose*)ptr->data;
bPoseChannel *pchan= BLI_findstring(&pose->chanbase, key, offsetof(bPoseChannel, name)); bPoseChannel *pchan= get_pose_channel(pose, key);
RNA_pointer_create(ptr->id.data, &RNA_PoseBone, pchan, &rptr); RNA_pointer_create(ptr->id.data, &RNA_PoseBone, pchan, &rptr);
return rptr; return rptr;
} }

View File

@@ -1279,7 +1279,7 @@ void RE_InitState(Render *re, Render *source, RenderData *rd, SceneRenderLayer *
int index = BLI_findindex(&re->r.layers, srl); int index = BLI_findindex(&re->r.layers, srl);
if (index != -1) { if (index != -1) {
re->r.actlay = index; re->r.actlay = index;
re->r.scemode |= (R_SINGLE_LAYER|R_COMP_RERENDER); re->r.scemode |= R_SINGLE_LAYER;
} }
} }
@@ -2226,6 +2226,7 @@ static void render_scene(Render *re, Scene *sce, int cfra)
/* still unsure entity this... */ /* still unsure entity this... */
resc->scene= sce; resc->scene= sce;
resc->lay= sce->lay;
/* ensure scene has depsgraph, base flags etc OK */ /* ensure scene has depsgraph, base flags etc OK */
set_scene_bg(sce); set_scene_bg(sce);
@@ -2458,38 +2459,36 @@ static void do_render_composite_fields_blur_3d(Render *re)
ntreeCompositTagAnimated(ntree); ntreeCompositTagAnimated(ntree);
} }
if(1 || !(re->r.scemode & R_COMP_RERENDER)) { if(ntree && re->r.scemode & R_DOCOMP) {
if(ntree && re->r.scemode & R_DOCOMP) { /* checks if there are render-result nodes that need scene */
/* checks if there are render-result nodes that need scene */ if((re->r.scemode & R_SINGLE_LAYER)==0)
if((re->r.scemode & R_SINGLE_LAYER)==0) ntree_render_scenes(re);
ntree_render_scenes(re);
if(!re->test_break(re->tbh)) {
ntree->stats_draw= render_composit_stats;
ntree->test_break= re->test_break;
ntree->sdh= re->sdh;
ntree->tbh= re->tbh;
/* in case it was never initialized */
R.sdh= re->sdh;
R.stats_draw= re->stats_draw;
if(!re->test_break(re->tbh)) { if (update_newframe)
ntree->stats_draw= render_composit_stats; scene_update_for_newframe(re->scene, re->lay);
ntree->test_break= re->test_break;
ntree->sdh= re->sdh; if(re->r.scemode & R_FULL_SAMPLE)
ntree->tbh= re->tbh; do_merge_fullsample(re, ntree);
/* in case it was never initialized */ else {
R.sdh= re->sdh; ntreeCompositExecTree(ntree, &re->r, G.background==0);
R.stats_draw= re->stats_draw;
if (update_newframe)
scene_update_for_newframe(re->scene, re->lay);
if(re->r.scemode & R_FULL_SAMPLE)
do_merge_fullsample(re, ntree);
else {
ntreeCompositExecTree(ntree, &re->r, G.background==0);
}
ntree->stats_draw= NULL;
ntree->test_break= NULL;
ntree->tbh= ntree->sdh= NULL;
} }
ntree->stats_draw= NULL;
ntree->test_break= NULL;
ntree->tbh= ntree->sdh= NULL;
} }
else if(re->r.scemode & R_FULL_SAMPLE)
do_merge_fullsample(re, NULL);
} }
else if(re->r.scemode & R_FULL_SAMPLE)
do_merge_fullsample(re, NULL);
} }
/* weak... the display callback wants an active renderlayer pointer... */ /* weak... the display callback wants an active renderlayer pointer... */

View File

@@ -2211,12 +2211,23 @@ static void bake_shade(void *handle, Object *ob, ShadeInput *shi, int quad, int
} }
else { else {
char *col= (char *)(bs->rect + bs->rectx*y + x); char *col= (char *)(bs->rect + bs->rectx*y + x);
col[0]= FTOCHAR(shr.combined[0]);
col[1]= FTOCHAR(shr.combined[1]); if (ELEM(bs->type, RE_BAKE_ALL, RE_BAKE_TEXTURE) && (R.r.color_mgt_flag & R_COLOR_MANAGEMENT)) {
col[2]= FTOCHAR(shr.combined[2]); float srgb[3];
srgb[0]= linearrgb_to_srgb(shr.combined[0]);
srgb[1]= linearrgb_to_srgb(shr.combined[1]);
srgb[2]= linearrgb_to_srgb(shr.combined[2]);
col[0]= FTOCHAR(srgb[0]);
col[1]= FTOCHAR(srgb[1]);
col[2]= FTOCHAR(srgb[2]);
} else {
col[0]= FTOCHAR(shr.combined[0]);
col[1]= FTOCHAR(shr.combined[1]);
col[2]= FTOCHAR(shr.combined[2]);
}
if (ELEM(bs->type, RE_BAKE_ALL, RE_BAKE_TEXTURE)) {
if (bs->type==RE_BAKE_ALL || bs->type==RE_BAKE_TEXTURE) {
col[3]= FTOCHAR(shr.alpha); col[3]= FTOCHAR(shr.alpha);
} else { } else {
col[3]= 255; col[3]= 255;
@@ -2643,6 +2654,8 @@ int RE_bake_shade_all_selected(Render *re, int type, Object *actob, short *do_up
ima->id.flag |= LIB_DOIT; ima->id.flag |= LIB_DOIT;
if (ibuf) if (ibuf)
ibuf->userdata = NULL; /* use for masking if needed */ ibuf->userdata = NULL; /* use for masking if needed */
if(ibuf->rect_float)
ibuf->profile = IB_PROFILE_LINEAR_RGB;
} }
BLI_init_threads(&threads, do_bake_thread, re->r.threads); BLI_init_threads(&threads, do_bake_thread, re->r.threads);

View File

@@ -261,6 +261,7 @@ void WM_read_file(bContext *C, char *name, ReportList *reports)
/* we didn't succeed, now try to read Blender file */ /* we didn't succeed, now try to read Blender file */
if (retval== 0) { if (retval== 0) {
int G_f= G.f;
ListBase wmbase; ListBase wmbase;
/* put aside screens to match with persistant windows later */ /* put aside screens to match with persistant windows later */
@@ -270,6 +271,11 @@ void WM_read_file(bContext *C, char *name, ReportList *reports)
retval= BKE_read_file(C, name, NULL, reports); retval= BKE_read_file(C, name, NULL, reports);
G.save_over = 1; G.save_over = 1;
/* this flag is initialized by the operator but overwritten on read.
* need to re-enable it here else drivers + registered scripts wont work. */
if(G_f & G_SCRIPT_AUTOEXEC) G.f |= G_SCRIPT_AUTOEXEC;
else G.f &= ~G_SCRIPT_AUTOEXEC;
/* match the read WM with current WM */ /* match the read WM with current WM */
wm_window_match_do(C, &wmbase); wm_window_match_do(C, &wmbase);
WM_check(C); /* opens window(s), checks keymaps */ WM_check(C); /* opens window(s), checks keymaps */

View File

@@ -1068,7 +1068,7 @@ int main(int argc, char **argv)
} }
else { else {
if((G.fileflags & G_FILE_AUTOPLAY) && (G.fileflags & G_SCRIPT_AUTOEXEC)) if((G.fileflags & G_FILE_AUTOPLAY) && (G.f & G_SCRIPT_AUTOEXEC))
WM_init_game(C); WM_init_game(C);
else if(!G.file_loaded) else if(!G.file_loaded)

View File

@@ -316,10 +316,36 @@ CValue* SCA_PropertySensor::FindIdentifier(const STR_String& identifiername)
int SCA_PropertySensor::validValueForProperty(void *self, const PyAttributeDef*) int SCA_PropertySensor::validValueForProperty(void *self, const PyAttributeDef*)
{ {
/* If someone actually do type checking please make sure the 'max' and 'min'
are checked as well (currently they are calling the PrecalculateRangeExpression
function directly */
/* There is no type checking at this moment, unfortunately... */ /* There is no type checking at this moment, unfortunately... */
return 0; return 0;
} }
int SCA_PropertySensor::validValueForIntervalProperty(void *self, const PyAttributeDef*)
{
SCA_PropertySensor* sensor = reinterpret_cast<SCA_PropertySensor*>(self);
if (sensor->m_checktype==KX_PROPSENSOR_INTERVAL)
{
sensor->PrecalculateRangeExpression();
}
return 0;
}
int SCA_PropertySensor::modeChange(void *self, const PyAttributeDef* attrdef)
{
SCA_PropertySensor* sensor = reinterpret_cast<SCA_PropertySensor*>(self);
if (sensor->m_checktype==KX_PROPSENSOR_INTERVAL)
{
sensor->PrecalculateRangeExpression();
}
return 0;
}
/* Integration hooks ------------------------------------------------------- */ /* Integration hooks ------------------------------------------------------- */
PyTypeObject SCA_PropertySensor::Type = { PyTypeObject SCA_PropertySensor::Type = {
PyVarObject_HEAD_INIT(NULL, 0) PyVarObject_HEAD_INIT(NULL, 0)
@@ -348,9 +374,11 @@ PyMethodDef SCA_PropertySensor::Methods[] = {
}; };
PyAttributeDef SCA_PropertySensor::Attributes[] = { PyAttributeDef SCA_PropertySensor::Attributes[] = {
KX_PYATTRIBUTE_INT_RW("mode",KX_PROPSENSOR_NODEF,KX_PROPSENSOR_MAX-1,false,SCA_PropertySensor,m_checktype), KX_PYATTRIBUTE_INT_RW_CHECK("mode",KX_PROPSENSOR_NODEF,KX_PROPSENSOR_MAX-1,false,SCA_PropertySensor,m_checktype,modeChange),
KX_PYATTRIBUTE_STRING_RW_CHECK("propName",0,100,false,SCA_PropertySensor,m_checkpropname,CheckProperty), KX_PYATTRIBUTE_STRING_RW_CHECK("propName",0,100,false,SCA_PropertySensor,m_checkpropname,CheckProperty),
KX_PYATTRIBUTE_STRING_RW_CHECK("value",0,100,false,SCA_PropertySensor,m_checkpropval,validValueForProperty), KX_PYATTRIBUTE_STRING_RW_CHECK("value",0,100,false,SCA_PropertySensor,m_checkpropval,validValueForProperty),
KX_PYATTRIBUTE_STRING_RW_CHECK("min",0,100,false,SCA_PropertySensor,m_checkpropval,validValueForIntervalProperty),
KX_PYATTRIBUTE_STRING_RW_CHECK("max",0,100,false,SCA_PropertySensor,m_checkpropmaxval,validValueForIntervalProperty),
{ NULL } //Sentinel { NULL } //Sentinel
}; };

View File

@@ -95,6 +95,16 @@ public:
*/ */
static int validValueForProperty(void* self, const PyAttributeDef*); static int validValueForProperty(void* self, const PyAttributeDef*);
/**
* Test whether this is a sensible value for interval (type check) and updates Range Expression
*/
static int validValueForIntervalProperty(void* self, const PyAttributeDef*);
/**
* Test if the new mode is interval. If positive updates Range Expression
*/
static int modeChange(void* self, const PyAttributeDef* attrdef);
#endif #endif
}; };

View File

@@ -234,7 +234,11 @@ KX_GameObject* KX_GameObject::GetParent()
void KX_GameObject::SetParent(KX_Scene *scene, KX_GameObject* obj, bool addToCompound, bool ghost) void KX_GameObject::SetParent(KX_Scene *scene, KX_GameObject* obj, bool addToCompound, bool ghost)
{ {
// check on valid node in case a python controller holds a reference to a deleted object // check on valid node in case a python controller holds a reference to a deleted object
if (obj && GetSGNode() && obj->GetSGNode() && GetSGNode()->GetSGParent() != obj->GetSGNode()) if (obj &&
GetSGNode() && // object is not zombi
obj->GetSGNode() && // object is not zombi
GetSGNode()->GetSGParent() != obj->GetSGNode() && // not already parented to same object
!GetSGNode()->IsAncessor(obj->GetSGNode())) // no parenting loop
{ {
// Make sure the objects have some scale // Make sure the objects have some scale
MT_Vector3 scale1 = NodeGetWorldScaling(); MT_Vector3 scale1 = NodeGetWorldScaling();

View File

@@ -5152,6 +5152,10 @@ class SCA_PropertySensor(SCA_ISensor):
@type propName: string @type propName: string
@ivar value: the value with which the sensor compares to the value of the property. @ivar value: the value with which the sensor compares to the value of the property.
@type value: string @type value: string
@ivar min: the minimum value of the range used to evaluate the property when in interval mode.
@type min: string
@ivar max: the maximum value of the range used to evaluate the property when in interval mode.
@type max: string
""" """
#{ Deprecated #{ Deprecated
def getType(): def getType():

View File

@@ -150,6 +150,12 @@ GetRootSGParent(
return (m_SGparent ? (const SG_Node*) m_SGparent->GetRootSGParent() : (const SG_Node*) this); return (m_SGparent ? (const SG_Node*) m_SGparent->GetRootSGParent() : (const SG_Node*) this);
} }
bool SG_Node::IsAncessor(const SG_Node* child) const
{
return (!child->m_SGparent) ? false :
(child->m_SGparent == this) ? true : IsAncessor(child->m_SGparent);
}
void void
SG_Node:: SG_Node::
DisconnectFromParent( DisconnectFromParent(

View File

@@ -77,6 +77,13 @@ public:
SG_Node* child SG_Node* child
); );
/**
* Return true if the node is the ancessor of child
*/
bool
IsAncessor(
const SG_Node* child
) const;
/** /**
* Get the current list of children. Do not use this interface for * Get the current list of children. Do not use this interface for
* adding or removing children please use the methods of this class for * adding or removing children please use the methods of this class for