diff options
author | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2010-03-26 23:18:39 +0300 |
---|---|---|
committer | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2010-03-26 23:18:39 +0300 |
commit | 009d7819c144047355c35fb1ac90333351779e3c (patch) | |
tree | 466be90a1b8e79b37a7578087bad5db81a2bf074 | |
parent | 048f357f416d8044a3acfb16f7cd27db194cd3e8 (diff) | |
parent | a5197f4943a2c117a53b50ca12eba193d42663ea (diff) |
Merged changes in the trunk up to revision 27779.
51 files changed, 403 insertions, 410 deletions
diff --git a/release/scripts/ui/properties_data_modifier.py b/release/scripts/ui/properties_data_modifier.py index b91c7d4372c..8bf1617c124 100644 --- a/release/scripts/ui/properties_data_modifier.py +++ b/release/scripts/ui/properties_data_modifier.py @@ -507,7 +507,8 @@ class DATA_PT_modifiers(DataButtonsPanel): col.prop(md, "steps") col.prop(md, "render_steps") - col = split.column() + if wide_ui: + col = split.column() row = col.row() row.active = (md.object is None or md.use_object_screw_offset == False) row.prop(md, "screw_offset") diff --git a/release/scripts/ui/properties_object.py b/release/scripts/ui/properties_object.py index 73f0a6fe5c2..d83253bf771 100644 --- a/release/scripts/ui/properties_object.py +++ b/release/scripts/ui/properties_object.py @@ -268,9 +268,10 @@ class OBJECT_PT_duplication(ObjectButtonsPanel): else: 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): - bl_label = "Animation" + bl_label = "Animation Hacks" + bl_default_closed = True def draw(self, context): layout = self.layout @@ -293,16 +294,13 @@ class OBJECT_PT_animation(ObjectButtonsPanel): row.prop(ob, "slow_parent") row.active = (ob.parent is not None) col.prop(ob, "time_offset", text="Offset") - + + # XXX: these are still used for a few curve-related tracking features if wide_ui: col = split.column() - col.label(text="Track:") - col.prop(ob, "track", text="") + col.label(text="Tracking Axes:") col.prop(ob, "track_axis", text="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 @@ -316,7 +314,7 @@ classes = [ OBJECT_PT_groups, OBJECT_PT_display, OBJECT_PT_duplication, - OBJECT_PT_animation, + OBJECT_PT_animation, # XXX: panel of old hacks pending to be removed... OBJECT_PT_motion_paths, #OBJECT_PT_onion_skinning, diff --git a/release/scripts/ui/properties_physics_cloth.py b/release/scripts/ui/properties_physics_cloth.py index 7a65420e172..22a83e02ba7 100644 --- a/release/scripts/ui/properties_physics_cloth.py +++ b/release/scripts/ui/properties_physics_cloth.py @@ -179,6 +179,7 @@ class PHYSICS_PT_cloth_collision(PhysicButtonsPanel): sub.prop(cloth, "self_collision_quality", slider=True, text="Quality") sub.prop(cloth, "self_min_distance", slider=True, text="Distance") + layout.prop(cloth, "group") class PHYSICS_PT_cloth_stiffness(PhysicButtonsPanel): bl_label = "Cloth Stiffness Scaling" diff --git a/release/scripts/ui/space_image.py b/release/scripts/ui/space_image.py index 4b4ff15014d..b8c5c010407 100644 --- a/release/scripts/ui/space_image.py +++ b/release/scripts/ui/space_image.py @@ -342,7 +342,7 @@ class IMAGE_PT_image_properties(bpy.types.Panel): # ima = sima.image 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): diff --git a/source/blender/blenkernel/BKE_action.h b/source/blender/blenkernel/BKE_action.h index 1b38e276ca4..214b5a32cd6 100644 --- a/source/blender/blenkernel/BKE_action.h +++ b/source/blender/blenkernel/BKE_action.h @@ -129,6 +129,13 @@ void free_pose_channel(struct bPoseChannel *pchan); */ 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. */ diff --git a/source/blender/blenkernel/BKE_blender.h b/source/blender/blenkernel/BKE_blender.h index 6b656f1d12e..8865757b85a 100644 --- a/source/blender/blenkernel/BKE_blender.h +++ b/source/blender/blenkernel/BKE_blender.h @@ -45,7 +45,7 @@ struct Scene; struct Main; #define BLENDER_VERSION 252 -#define BLENDER_SUBVERSION 1 +#define BLENDER_SUBVERSION 2 #define BLENDER_MINVERSION 250 #define BLENDER_MINSUBVERSION 0 diff --git a/source/blender/blenkernel/BKE_collision.h b/source/blender/blenkernel/BKE_collision.h index 689fa96ffa6..91c5eb4afee 100644 --- a/source/blender/blenkernel/BKE_collision.h +++ b/source/blender/blenkernel/BKE_collision.h @@ -49,12 +49,13 @@ #include "BLI_kdopbvh.h" -struct Object; -struct Scene; struct Cloth; -struct MFace; -struct DerivedMesh; struct ClothModifierData; +struct DerivedMesh; +struct Group; +struct MFace; +struct Object; +struct Scene; //////////////////////////////////////// // 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 ///////////////////////////////////////////////// -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 { struct ColliderCache *next, *prev; @@ -147,7 +148,7 @@ typedef struct ColliderCache { struct CollisionModifierData *collmd; } 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); ///////////////////////////////////////////////// diff --git a/source/blender/blenkernel/BKE_curve.h b/source/blender/blenkernel/BKE_curve.h index 7119a725630..a3232ac91d6 100644 --- a/source/blender/blenkernel/BKE_curve.h +++ b/source/blender/blenkernel/BKE_curve.h @@ -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); float *make_orco_curve(struct Scene *scene, 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); diff --git a/source/blender/blenkernel/intern/action.c b/source/blender/blenkernel/intern/action.c index afd0b3a0f57..2d52d6061b9 100644 --- a/source/blender/blenkernel/intern/action.c +++ b/source/blender/blenkernel/intern/action.c @@ -56,8 +56,9 @@ #include "BIK_api.h" -#include "BLI_math.h" #include "BLI_blenlib.h" +#include "BLI_ghash.h" +#include "BLI_math.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)) return NULL; + if(pose->chanhash) + return BLI_ghash_lookup(pose->chanhash, 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 */ BLI_addtail(&pose->chanbase, chan); + free_pose_channels_hash(pose); 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) { // 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); } + + free_pose_channels_hash(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->constinv, ob->constinv); workob->parent= ob->parent; - workob->track= ob->track; workob->rotmode= ob->rotmode; diff --git a/source/blender/blenkernel/intern/anim.c b/source/blender/blenkernel/intern/anim.c index b2ac32da138..1465f4550f5 100644 --- a/source/blender/blenkernel/intern/anim.c +++ b/source/blender/blenkernel/intern/anim.c @@ -668,7 +668,7 @@ static void frames_duplilist(ListBase *lb, Scene *scene, Object *ob, int level, if(level>MAX_DUPLI_RECUR) return; 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; copyob= *ob; /* store transform info */ diff --git a/source/blender/blenkernel/intern/armature.c b/source/blender/blenkernel/intern/armature.c index 668ce9aadac..c1998d705ad 100644 --- a/source/blender/blenkernel/intern/armature.c +++ b/source/blender/blenkernel/intern/armature.c @@ -1675,6 +1675,7 @@ void armature_rebuild_pose(Object *ob, bArmature *arm) next= pchan->next; if(pchan->bone==NULL) { free_pose_channel(pchan); + free_pose_channels_hash(pose); BLI_freelinkN(&pose->chanbase, pchan); } } diff --git a/source/blender/blenkernel/intern/collision.c b/source/blender/blenkernel/intern/collision.c index b024ba5f4e1..c85bd2f90b3 100644 --- a/source/blender/blenkernel/intern/collision.c +++ b/source/blender/blenkernel/intern/collision.c @@ -1299,188 +1299,122 @@ static int cloth_collision_moving ( ClothModifierData *clmd, CollisionModifierDa } #endif - -// return all collision objects in scene -// collision object will exclude self -Object **get_collisionobjects(Scene *scene, Object *self, int *numcollobj) +static void add_collision_object(Object ***objs, int *numobj, int *maxobj, Object *ob, Object *self, int level) { - Base *base=NULL; - Object **objs = NULL; - Object *coll_ob = NULL; - CollisionModifierData *collmd = NULL; - int numobj = 0, maxobj = 100; + 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); - 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 ); + if(cmd) { + /* extend array */ + if(*numobj >= *maxobj) { + *maxobj *= 2; + *objs= MEM_reallocN(*objs, sizeof(Object*)*(*maxobj)); } - 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; + (*objs)[*numobj] = ob; + (*numobj)++; + } - 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; + /* objects in dupli groups, one level only for now */ + if(ob->dup_group && level == 0) { + GroupObject *go; + Group *group= ob->dup_group; - if ( !collmd ) - continue; - - if( !collmd->bvhtree) - continue; + /* add objects */ + for(go= group->gobject.first; go; go= go->next) + add_collision_object(objs, numobj, maxobj, go->ob, self, level+1); + } +} - 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++; - } - } - } +// return all collision objects in scene +// collision object will exclude self +Object **get_collisionobjects(Scene *scene, Object *self, Group *group, int *numcollobj) +{ + Base *base; + Object **objs; + GroupObject *go; + int numobj= 0, maxobj= 100; + + objs= MEM_callocN(sizeof(Object *)*maxobj, "CollisionObjectsArray"); + + /* gather all collision objects */ + if(group) { + /* use specified group */ + for(go= group->gobject.first; go; go= go->next) + add_collision_object(&objs, &numobj, &maxobj, go->ob, self, 0); + } + 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; + + *numcollobj= numobj; + 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; - ListBase *objs = NULL; - Object *coll_ob = NULL; - CollisionModifierData *collmd = NULL; + CollisionModifierData *cmd= NULL; ColliderCache *col; - - // 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) - continue; - if(self && (base->lay & self->lay)==0) - continue; + if(ob == self) + return; - - 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(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; + if(ob->pd && ob->pd->deflect) + cmd =(CollisionModifierData *)modifiers_findByType(ob, eModifierType_Collision); + + if(cmd && cmd->bvhtree) { + if(*objs == NULL) + *objs = MEM_callocN(sizeof(ListBase), "ColliderCache array"); + + col = MEM_callocN(sizeof(ColliderCache), "ColliderCache"); + col->ob = ob; + col->collmd = cmd; + /* make sure collider is properly set up */ + collision_move_object(cmd, 1.0, 0.0); + BLI_addtail(*objs, col); + } - 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; + /* objects in dupli groups, one level only for now */ + if(ob->dup_group && level == 0) { + GroupObject *go; + Group *group= ob->dup_group; - 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); - } - } + /* 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; } + void free_collider_cache(ListBase **colliders) { if(*colliders) { @@ -1489,6 +1423,7 @@ void free_collider_cache(ListBase **colliders) *colliders = NULL; } } + static void cloth_bvh_objcollisions_nearcheck ( ClothModifierData * clmd, CollisionModifierData *collmd, CollPair **collisions, CollPair **collisions_index, int numresult, BVHTreeOverlap *overlap) { 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) 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) return 0; diff --git a/source/blender/blenkernel/intern/constraint.c b/source/blender/blenkernel/intern/constraint.c index 3ab5e9442b4..7994849a469 100644 --- a/source/blender/blenkernel/intern/constraint.c +++ b/source/blender/blenkernel/intern/constraint.c @@ -1867,7 +1867,7 @@ static void samevolume_new_data (void *cdata) 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; @@ -1896,7 +1896,6 @@ static void samevolume_evaluate (bConstraint *con, bConstraintOb *cob) } break; } - } static bConstraintTypeInfo CTI_SAMEVOL = { diff --git a/source/blender/blenkernel/intern/curve.c b/source/blender/blenkernel/intern/curve.c index 4fed662b6b4..9087a7ec4f2 100644 --- a/source/blender/blenkernel/intern/curve.c +++ b/source/blender/blenkernel/intern/curve.c @@ -1214,7 +1214,7 @@ float *make_orco_curve(Scene *scene, Object *ob) /* ***************** BEVEL ****************** */ -void makebevelcurve(Scene *scene, Object *ob, ListBase *disp) +void makebevelcurve(Scene *scene, Object *ob, ListBase *disp, int forRender) { DispList *dl, *dlnew; Curve *bevcu, *cu; @@ -1231,14 +1231,21 @@ void makebevelcurve(Scene *scene, Object *ob, ListBase *disp) if(cu->bevobj->type==OB_CURVE) { bevcu= cu->bevobj->data; if(bevcu->ext1==0.0 && bevcu->ext2==0.0) { + ListBase bevdisp= {NULL, NULL}; facx= cu->bevobj->size[0]; facy= cu->bevobj->size[1]; - dl= bevcu->disp.first; - if(dl==0) { - makeDispListCurveTypes(scene, cu->bevobj, 0); + if (forRender) { + makeDispListCurveTypes_forRender(scene, cu->bevobj, &bevdisp, NULL, 0); + dl= bevdisp.first; + } else { dl= bevcu->disp.first; + if(dl==0) { + makeDispListCurveTypes(scene, cu->bevobj, 0); + dl= bevcu->disp.first; + } } + while(dl) { if ELEM(dl->type, DL_POLY, DL_SEGM) { dlnew= MEM_mallocN(sizeof(DispList), "makebevelcurve1"); @@ -1260,6 +1267,8 @@ void makebevelcurve(Scene *scene, Object *ob, ListBase *disp) } dl= dl->next; } + + freedisplist(&bevdisp); } } } diff --git a/source/blender/blenkernel/intern/depsgraph.c b/source/blender/blenkernel/intern/depsgraph.c index 4e0270315ad..86cafa733ff 100644 --- a/source/blender/blenkernel/intern/depsgraph.c +++ b/source/blender/blenkernel/intern/depsgraph.c @@ -468,11 +468,6 @@ static void build_dag_object(DagForest *dag, DagNode *scenenode, Scene *scene, O 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) { node2 = dag_get_node(dag, ob->proxy); dag_add_relation(dag, node, node2, DAG_RL_DATA_DATA|DAG_RL_OB_OB, "Proxy"); diff --git a/source/blender/blenkernel/intern/displist.c b/source/blender/blenkernel/intern/displist.c index 3480564e00e..3e28dcc7acd 100644 --- a/source/blender/blenkernel/intern/displist.c +++ b/source/blender/blenkernel/intern/displist.c @@ -1299,7 +1299,7 @@ static void curve_calc_modifiers_post(Scene *scene, Object *ob, ListBase *dispba md = preTesselatePoint->next; } - if (*derivedFinal) { + if (derivedFinal && *derivedFinal) { (*derivedFinal)->release (*derivedFinal); } @@ -1354,6 +1354,13 @@ static void curve_calc_modifiers_post(Scene *scene, Object *ob, ListBase *dispba } } } 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 (dmDeformedVerts) { DerivedMesh *tdm = CDDM_copy(dm); @@ -1405,7 +1412,9 @@ static void curve_calc_modifiers_post(Scene *scene, Object *ob, ListBase *dispba MEM_freeN(dmDeformedVerts); } - (*derivedFinal) = dm; + if (derivedFinal) { + (*derivedFinal) = dm; + } if (deformedVerts) { curve_applyVertexCos(ob->data, nurb, originalVerts); @@ -1659,7 +1668,7 @@ static void do_makeDispListCurveTypes(Scene *scene, Object *ob, ListBase *dispba makeBevelList(ob); /* 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? */ if (!dlbev.first && cu->width==1.0f) { diff --git a/source/blender/blenkernel/intern/effect.c b/source/blender/blenkernel/intern/effect.c index 66e7f805f50..118f4885af4 100644 --- a/source/blender/blenkernel/intern/effect.c +++ b/source/blender/blenkernel/intern/effect.c @@ -429,7 +429,7 @@ static float eff_calc_visibility(ListBase *colliders, EffectorCache *eff, Effect return visibility; if(!colls) - colls = get_collider_cache(eff->scene, NULL); + colls = get_collider_cache(eff->scene, NULL, NULL); if(!colls) return visibility; diff --git a/source/blender/blenkernel/intern/implicit.c b/source/blender/blenkernel/intern/implicit.c index b4fb34d8464..c625fb28840 100644 --- a/source/blender/blenkernel/intern/implicit.c +++ b/source/blender/blenkernel/intern/implicit.c @@ -1422,7 +1422,7 @@ static void hair_velocity_smoothing(ClothModifierData *clmd, lfVector *lF, lfVec /* 10x10x10 grid gives nice initial results */ HairGridVert grid[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; float gmin[3], gmax[3], density; /* 2.0f is an experimental value that seems to give good results */ diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c index e4350cfde7f..bb7c77408ac 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -361,11 +361,6 @@ void unlink_object(Scene *scene, Object *ob) obt->recalc |= OB_RECALC; } - if(obt->track==ob) { - obt->track= NULL; - obt->recalc |= OB_RECALC_OB; - } - modifiers_foreachObjectLink(obt, unlink_object__unlinkModifierLinks, ob); 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); } - /* 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 */ if (ob->constraints.first && !(ob->flag & OB_NO_CONSTRAINTS)) { bConstraintOb *cob; @@ -2138,33 +2127,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) { @@ -2185,12 +2147,6 @@ for a lamp that is the child of another object */ int a; /* NO TIMEOFFS */ - - /* no ipo! (because of dloc and realtime-ipos) */ - // XXX old animation system - //ipo= ob->ipo; - //ob->ipo= NULL; - if(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); } - if(ob->track) - solve_tracking(ob, ob->track->obmat); - /* solve constraints */ if (ob->constraints.first) { 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); constraints_clear_evalob(cob); } - - /* WATCH IT!!! */ - // XXX old animation system - //ob->ipo= ipo; } /* 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->constinv); workob->parent= ob->parent; - workob->track= ob->track; workob->trackflag= ob->trackflag; 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) { 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, which is only in where_is_object now */ if(ob->recalc & OB_RECALC) { diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c index a99a8affbd3..a8446c0009f 100644 --- a/source/blender/blenkernel/intern/particle_system.c +++ b/source/blender/blenkernel/intern/particle_system.c @@ -3229,7 +3229,7 @@ static void dynamics_step(ParticleSimulationData *sim, float cfra) psys_update_effectors(sim); 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){ ParticleTarget *pt = psys->targets.first; diff --git a/source/blender/blenkernel/intern/pointcache.c b/source/blender/blenkernel/intern/pointcache.c index 9f0c7289350..cbe294f1347 100644 --- a/source/blender/blenkernel/intern/pointcache.c +++ b/source/blender/blenkernel/intern/pointcache.c @@ -1687,7 +1687,7 @@ int BKE_ptcache_write_cache(PTCacheID *pid, int cfra) return 0; if(cache->flag & PTCACHE_DISK_CACHE) { - int ofra, efra = cache->endframe; + int ofra=0, efra = cache->endframe; if(cfra==0) add = 1; @@ -2871,4 +2871,5 @@ void BKE_ptcache_invalidate(PointCache *cache) cache->flag &= ~PTCACHE_SIMULATION_VALID; cache->simframe = 0; cache->last_exact = 0; -}
\ No newline at end of file +} + diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c index 8f8241baa8e..b8d8cd0dc8f 100644 --- a/source/blender/blenkernel/intern/scene.c +++ b/source/blender/blenkernel/intern/scene.c @@ -53,6 +53,7 @@ #include "BKE_animsys.h" #include "BKE_depsgraph.h" #include "BKE_global.h" +#include "BKE_group.h" #include "BKE_idprop.h" #include "BKE_library.h" #include "BKE_main.h" diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 121fd26f5d6..350f779e490 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -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 */ psys->clmd->point_cache= psys->pointcache; psys->clmd->ptcaches.first= psys->clmd->ptcaches.last= NULL; + psys->clmd->coll_parms->group= newlibadr(fd, id->lib, psys->clmd->coll_parms->group); } } else { @@ -3621,6 +3622,7 @@ static void lib_link_object(FileData *fd, Main *main) if(clmd) { 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->agroups); + pose->chanhash= NULL; + for (pchan = pose->chanbase.first; pchan; pchan=pchan->next) { pchan->bone= NULL; 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) { /* 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 */ - - 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; - } + do_version_old_trackto_to_constraints(ob); 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 to compound shaper as well (was the behaviour before, now it's optional) */ 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); } if(parent) { @@ -9753,7 +9747,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) void *olddata = ob->data; 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); ob->data = olddata; @@ -10700,8 +10694,16 @@ static void do_versions(FileData *fd, Library *lib, Main *main) 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 */ { diff --git a/source/blender/editors/armature/editarmature.c b/source/blender/editors/armature/editarmature.c index f3b5e49a3ef..478a711aedd 100644 --- a/source/blender/editors/armature/editarmature.c +++ b/source/blender/editors/armature/editarmature.c @@ -892,6 +892,8 @@ int join_armature_exec(bContext *C, wmOperator *op) BLI_remlink(&opose->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); @@ -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_pose_channel(pchan); + free_pose_channels_hash(ob->pose); /* get rid of unneeded bone */ 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)) { free_pose_channel(pchan); + free_pose_channels_hash(obedit->pose); BLI_freelinkN (&obedit->pose->chanbase, pchan); } else { diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c index e8c42afe00a..59c9150fc14 100644 --- a/source/blender/editors/gpencil/gpencil_paint.c +++ b/source/blender/editors/gpencil/gpencil_paint.c @@ -161,7 +161,9 @@ static void gp_get_3d_reference (tGPsdata *p, float *vec) float *fp= give_cursor(p->scene, v3d); /* 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; /* active Object @@ -169,7 +171,9 @@ static void gp_get_3d_reference (tGPsdata *p, float *vec) */ sub_v3_v3v3(vec, fp, ob->loc); } - else { + else +#endif + { /* use 3D-cursor */ copy_v3_v3(vec, fp); } diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c index a4a25a6ad52..2a20c86744d 100644 --- a/source/blender/editors/mesh/editmesh_tools.c +++ b/source/blender/editors/mesh/editmesh_tools.c @@ -86,7 +86,6 @@ editmesh_tool.c: UI called tools for editmesh, geometry changes here, otherwise /* XXX */ static void waitcursor(int val) {} -static int pupmenu() {return 0;} #define add_numbut(a, b, c, d, e, f, g) {} /* XXX */ @@ -5961,17 +5960,15 @@ static int select_vertex_path_exec(bContext *C, wmOperator *op) PathNode *currpn; PathNode *Q; int v, *previous, pathvert, pnindex; /*pnindex redundant?*/ - int unbalanced, totnodes; - short physical; + int unbalanced, totnodes; float *cost; + int type= RNA_enum_get(op->ptr, "type"); Heap *heap; /*binary heap for sorting pointers to PathNodes based upon a 'cost'*/ s = t = NULL; ese = ((EditSelection*)em->selected.last); - if(ese && ese->type == EDITVERT && ese->prev && ese->prev->type == EDITVERT){ - physical= pupmenu("Distance Method? %t|Edge Length%x1|Topological%x0"); - + if(ese && ese->type == EDITVERT && ese->prev && ese->prev->type == EDITVERT) { t = (EditVert*)ese->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->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); } else newpe->w = 1; @@ -6036,7 +6033,7 @@ static int select_vertex_path_exec(bContext *C, wmOperator *op) currpn = ((PathNode*)eed->v2->tmp.p); newpe = MEM_mallocN(sizeof(PathEdge), "Path Edge"); 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); } else newpe->w = 1; @@ -6124,7 +6121,6 @@ void MESH_OT_select_vertex_path(wmOperatorType *ot) /* api callbacks */ ot->exec= select_vertex_path_exec; - ot->invoke= WM_menu_invoke; ot->poll= ED_operator_editmesh; /* flags */ diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c index 921a56142d4..a2070771844 100644 --- a/source/blender/editors/object/object_add.c +++ b/source/blender/editors/object/object_add.c @@ -973,10 +973,6 @@ static void copy_object_set_idnew(bContext *C, int dupflag) { Material *ma, *mao; ID *id; -#if 0 // XXX old animation system - Ipo *ipo; - bActionStrip *strip; -#endif // XXX old animation system int a; /* 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); ID_NEW(ob->parent); - ID_NEW(ob->track); ID_NEW(ob->proxy); 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; diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c index 976990deda8..dcf4c072f92 100644 --- a/source/blender/editors/object/object_edit.c +++ b/source/blender/editors/object/object_edit.c @@ -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); 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; ED_object_toggle_modes(C, ob->mode); - - ob->mode |= OB_MODE_EDIT; + ob->mode= OB_MODE_EDIT; if(ob->type==OB_MESH) { Mesh *me= ob->data; diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c index e89bde00ce7..52d6a7a7b8b 100644 --- a/source/blender/editors/object/object_relations.c +++ b/source/blender/editors/object/object_relations.c @@ -405,7 +405,7 @@ void OBJECT_OT_proxy_make (wmOperatorType *ot) static EnumPropertyItem prop_clear_parent_types[] = { {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", ""}, {0, NULL, 0, NULL, NULL} }; @@ -422,7 +422,6 @@ static int parent_clear_exec(bContext *C, wmOperator *op) } else if(type == 1) { ob->parent= NULL; - ob->track= NULL; object_apply_mat4(ob, ob->obmat); } else if(type == 2) @@ -916,7 +915,6 @@ static EnumPropertyItem prop_make_track_types[] = { {1, "DAMPTRACK", 0, "Damped Track Constraint", ""}, {2, "TRACKTO", 0, "Track To Constraint", ""}, {3, "LOCKTRACK", 0, "Lock Track Constraint", ""}, - {4, "OLDTRACK", 0, "Old Track", ""}, {0, NULL, 0, NULL, NULL} }; @@ -988,15 +986,6 @@ static int track_set_exec(bContext *C, wmOperator *op) } 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_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); 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) { if(ob->id.lib==NULL) { ID_NEW(ob->parent); - ID_NEW(ob->track); } } CTX_DATA_END; diff --git a/source/blender/editors/space_buttons/space_buttons.c b/source/blender/editors/space_buttons/space_buttons.c index fa9308111b0..66068a4f23c 100644 --- a/source/blender/editors/space_buttons/space_buttons.c +++ b/source/blender/editors/space_buttons/space_buttons.c @@ -291,6 +291,7 @@ static void buttons_area_listener(ScrArea *sa, wmNotifier *wmn) ED_area_tag_redraw(sa); else buttons_area_redraw(sa, BCONTEXT_MODIFIER); + buttons_area_redraw(sa, BCONTEXT_PHYSICS); break; case ND_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); break; 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_DRAW: /* currently works by redraws... if preview is set, it (re)starts job */ diff --git a/source/blender/editors/space_image/image_buttons.c b/source/blender/editors/space_image/image_buttons.c index 5f96c4a2324..283d8490028 100644 --- a/source/blender/editors/space_image/image_buttons.c +++ b/source/blender/editors/space_image/image_buttons.c @@ -883,7 +883,7 @@ void uiTemplateImage(uiLayout *layout, bContext *C, PointerRNA *ptr, char *propn } else { 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) { row= uiLayoutRow(layout, 1); diff --git a/source/blender/editors/space_view3d/view3d_header.c b/source/blender/editors/space_view3d/view3d_header.c index 558e817157f..e76546c6080 100644 --- a/source/blender/editors/space_view3d/view3d_header.c +++ b/source/blender/editors/space_view3d/view3d_header.c @@ -159,14 +159,18 @@ static int layers_exec(bContext *C, wmOperator *op) if(nr < 0) return OPERATOR_CANCELLED; - - + if(nr == 0) { /* all layers */ - v3d->lay |= (1<<20)-1; - if(!v3d->layact) 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 { int bit; diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c index 02e4ee5da91..96616f57575 100644 --- a/source/blender/editors/transform/transform_conversions.c +++ b/source/blender/editors/transform/transform_conversions.c @@ -2600,7 +2600,7 @@ static void createTransNlaData(bContext *C, TransInfo *t) float 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 { /* normal transform - both sides of current frame are considered */ @@ -2691,7 +2691,7 @@ static void createTransNlaData(bContext *C, TransInfo *t) tdn->handle= -1; /* 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; VECCOPY(td->iloc, tdn->h1); @@ -2722,7 +2722,7 @@ static void createTransNlaData(bContext *C, TransInfo *t) tdn->handle= (tdn->handle) ? 2 : 1; /* 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; 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) { Scene *scene = t->scene; - Object *track; float obmtx[3][3]; short constinv; short skip_invert = 0; @@ -4180,10 +4179,7 @@ static void ObjectToTransData(bContext *C, TransInfo *t, TransData *td, Object * if (t->mode == TFM_DUMMY) skip_invert = 1; - if (skip_invert == 0 && (ob->track || constinv==0)) { - track= ob->track; - ob->track= NULL; - + if (skip_invert == 0 && constinv == 0) { if (constinv == 0) 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) ob->transflag &= ~OB_NO_CONSTRAINTS; - - ob->track= track; } else where_is_object(t->scene, ob); diff --git a/source/blender/editors/transform/transform_ops.c b/source/blender/editors/transform/transform_ops.c index b12de7fd6f8..fb1282495a4 100644 --- a/source/blender/editors/transform/transform_ops.c +++ b/source/blender/editors/transform/transform_ops.c @@ -869,30 +869,29 @@ void transform_keymap_for_space(wmKeyConfig *keyconf, wmKeyMap *keymap, int spac case SPACE_ACTION: km= WM_keymap_add_item(keymap, "TRANSFORM_OT_transform", GKEY, KM_PRESS, 0, 0); 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); RNA_int_set(km->ptr, "mode", TFM_TIME_TRANSLATE); - + km= WM_keymap_add_item(keymap, "TRANSFORM_OT_transform", EKEY, KM_PRESS, 0, 0); RNA_int_set(km->ptr, "mode", TFM_TIME_EXTEND); - + km= WM_keymap_add_item(keymap, "TRANSFORM_OT_transform", SKEY, KM_PRESS, 0, 0); RNA_int_set(km->ptr, "mode", TFM_TIME_SCALE); - + km= WM_keymap_add_item(keymap, "TRANSFORM_OT_transform", TKEY, KM_PRESS, 0, 0); RNA_int_set(km->ptr, "mode", TFM_TIME_SLIDE); break; case SPACE_IPO: 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); - - // XXX the 'mode' identifier here is not quite right + km= WM_keymap_add_item(keymap, "TRANSFORM_OT_transform", EKEY, KM_PRESS, 0, 0); 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_RESIZE, SKEY, KM_PRESS, 0, 0); break; case SPACE_NLA: diff --git a/source/blender/makesdna/DNA_action_types.h b/source/blender/makesdna/DNA_action_types.h index 937dd3ee324..18b3c1095cc 100644 --- a/source/blender/makesdna/DNA_action_types.h +++ b/source/blender/makesdna/DNA_action_types.h @@ -40,6 +40,7 @@ struct SpaceLink; struct Object; struct Group; +struct GHash; /* ************************************************ */ /* Visualisation */ @@ -326,6 +327,7 @@ typedef enum eRotationModes { */ typedef struct bPose { 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 */ diff --git a/source/blender/makesdna/DNA_cloth_types.h b/source/blender/makesdna/DNA_cloth_types.h index 8fa63e6acc4..bd323c5821b 100644 --- a/source/blender/makesdna/DNA_cloth_types.h +++ b/source/blender/makesdna/DNA_cloth_types.h @@ -93,6 +93,7 @@ typedef struct ClothCollSettings int flags; /* collision flags defined in BKE_cloth.h */ short self_loop_count; /* How many iterations for the selfcollision loop */ short loop_count; /* How many iterations for the collision loop. */ + struct Group *group; /* Only use colliders from this group of objects */ } ClothCollSettings; diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h index 4e1b24a1b1d..c5b2f399d73 100644 --- a/source/blender/makesdna/DNA_scene_types.h +++ b/source/blender/makesdna/DNA_scene_types.h @@ -906,7 +906,7 @@ typedef struct Scene { #define R_NO_TEX 0x2000 #define R_STAMP_INFO 0x4000 /* deprecated */ #define R_FULL_SAMPLE 0x8000 -#define R_COMP_RERENDER 0x10000 +#define R_DEPRECATED 0x10000 #define R_RECURS_PROTECTION 0x20000 #define R_TEXNODE_PREVIEW 0x40000 diff --git a/source/blender/makesrna/intern/rna_cloth.c b/source/blender/makesrna/intern/rna_cloth.c index 7dcdd92a90a..19718a33265 100644 --- a/source/blender/makesrna/intern/rna_cloth.c +++ b/source/blender/makesrna/intern/rna_cloth.c @@ -430,6 +430,11 @@ static void rna_def_cloth_collision_settings(BlenderRNA *brna) 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_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) diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c index 8d253ac47b8..4adb462c8d1 100644 --- a/source/blender/makesrna/intern/rna_modifier.c +++ b/source/blender/makesrna/intern/rna_modifier.c @@ -399,7 +399,7 @@ static void modifier_object_set(Object *self, Object **ob_p, int type, PointerRN Object *ob= value.data; if(!self || ob != self) - if(!ob || ob->type == type) + if(!ob || type == OB_EMPTY || ob->type == type) *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) { - 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) diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c index 3823af25619..a3a20376026 100644 --- a/source/blender/makesrna/intern/rna_object.c +++ b/source/blender/makesrna/intern/rna_object.c @@ -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_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); RNA_def_property_pointer_funcs(prop, NULL, "rna_Object_parent_set", NULL); 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_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"); - - prop= RNA_def_property(srna, "track", PROP_POINTER, PROP_NONE); - RNA_def_property_flag(prop, PROP_EDITABLE|PROP_ID_SELF_CHECK); - 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"); - + + /* Track and Up flags */ + // XXX: these have been saved here for a bit longer (after old track was removed), since some other tools still refer to this prop= RNA_def_property(srna, "track_axis", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "trackflag"); 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"); 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_ui_text(prop, "Up Axis", "Axis that points in the upward direction"); RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Object_update"); - + /* proxy */ prop= RNA_def_property(srna, "proxy", PROP_POINTER, PROP_NONE); 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); /* duplicates */ - prop= RNA_def_property(srna, "track_override_parent", PROP_BOOLEAN, PROP_NONE); - 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"); - + // XXX: evil old crap prop= RNA_def_property(srna, "slow_parent", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "partype", PARSLOW); RNA_def_property_ui_text(prop, "Slow Parent", "Create a delay in the parent relationship"); diff --git a/source/blender/makesrna/intern/rna_pose.c b/source/blender/makesrna/intern/rna_pose.c index 03687a5f366..ff67597a78b 100644 --- a/source/blender/makesrna/intern/rna_pose.c +++ b/source/blender/makesrna/intern/rna_pose.c @@ -37,6 +37,7 @@ #include "DNA_scene_types.h" #include "BLI_math.h" +#include "BLI_ghash.h" #include "WM_types.h" @@ -525,7 +526,7 @@ PointerRNA rna_PoseBones_lookup_string(PointerRNA *ptr, const char *key) { PointerRNA rptr; 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); return rptr; } diff --git a/source/blender/render/intern/source/pipeline.c b/source/blender/render/intern/source/pipeline.c index e11c37db09a..8da0a1bf177 100644 --- a/source/blender/render/intern/source/pipeline.c +++ b/source/blender/render/intern/source/pipeline.c @@ -1279,7 +1279,7 @@ void RE_InitState(Render *re, Render *source, RenderData *rd, SceneRenderLayer * int index = BLI_findindex(&re->r.layers, srl); if (index != -1) { 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... */ resc->scene= sce; + resc->lay= sce->lay; /* ensure scene has depsgraph, base flags etc OK */ set_scene_bg(sce); @@ -2458,38 +2459,36 @@ static void do_render_composite_fields_blur_3d(Render *re) ntreeCompositTagAnimated(ntree); } - if(1 || !(re->r.scemode & R_COMP_RERENDER)) { - if(ntree && re->r.scemode & R_DOCOMP) { - /* checks if there are render-result nodes that need scene */ - if((re->r.scemode & R_SINGLE_LAYER)==0) - ntree_render_scenes(re); + if(ntree && re->r.scemode & R_DOCOMP) { + /* checks if there are render-result nodes that need scene */ + if((re->r.scemode & R_SINGLE_LAYER)==0) + 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)) { - 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 (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; + 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; } - 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... */ diff --git a/source/blender/render/intern/source/rendercore.c b/source/blender/render/intern/source/rendercore.c index cf1f339591d..7375ea0f863 100644 --- a/source/blender/render/intern/source/rendercore.c +++ b/source/blender/render/intern/source/rendercore.c @@ -2211,12 +2211,23 @@ static void bake_shade(void *handle, Object *ob, ShadeInput *shi, int quad, int } else { char *col= (char *)(bs->rect + bs->rectx*y + x); - 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) && (R.r.color_mgt_flag & R_COLOR_MANAGEMENT)) { + 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 (bs->type==RE_BAKE_ALL || bs->type==RE_BAKE_TEXTURE) { + if (ELEM(bs->type, RE_BAKE_ALL, RE_BAKE_TEXTURE)) { col[3]= FTOCHAR(shr.alpha); } else { 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; if (ibuf) 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); diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c index 2959bb4c179..f79b083857e 100644 --- a/source/blender/windowmanager/intern/wm_files.c +++ b/source/blender/windowmanager/intern/wm_files.c @@ -261,6 +261,7 @@ void WM_read_file(bContext *C, char *name, ReportList *reports) /* we didn't succeed, now try to read Blender file */ if (retval== 0) { + int G_f= G.f; ListBase wmbase; /* 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); 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 */ wm_window_match_do(C, &wmbase); WM_check(C); /* opens window(s), checks keymaps */ diff --git a/source/creator/creator.c b/source/creator/creator.c index 78aff4024f0..536d380fdbc 100644 --- a/source/creator/creator.c +++ b/source/creator/creator.c @@ -1068,7 +1068,7 @@ int main(int argc, char **argv) } 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); else if(!G.file_loaded) diff --git a/source/gameengine/GameLogic/SCA_PropertySensor.cpp b/source/gameengine/GameLogic/SCA_PropertySensor.cpp index 134d34fc00d..24dbdb94f95 100644 --- a/source/gameengine/GameLogic/SCA_PropertySensor.cpp +++ b/source/gameengine/GameLogic/SCA_PropertySensor.cpp @@ -316,10 +316,36 @@ CValue* SCA_PropertySensor::FindIdentifier(const STR_String& identifiername) 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... */ 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 ------------------------------------------------------- */ PyTypeObject SCA_PropertySensor::Type = { PyVarObject_HEAD_INIT(NULL, 0) @@ -348,9 +374,11 @@ PyMethodDef SCA_PropertySensor::Methods[] = { }; 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("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 }; diff --git a/source/gameengine/GameLogic/SCA_PropertySensor.h b/source/gameengine/GameLogic/SCA_PropertySensor.h index 0bc1e9b3579..9a5c4762558 100644 --- a/source/gameengine/GameLogic/SCA_PropertySensor.h +++ b/source/gameengine/GameLogic/SCA_PropertySensor.h @@ -95,6 +95,16 @@ public: */ 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 }; diff --git a/source/gameengine/Ketsji/KX_GameObject.cpp b/source/gameengine/Ketsji/KX_GameObject.cpp index 744dc85b9cc..9cb7e802235 100644 --- a/source/gameengine/Ketsji/KX_GameObject.cpp +++ b/source/gameengine/Ketsji/KX_GameObject.cpp @@ -234,7 +234,11 @@ KX_GameObject* KX_GameObject::GetParent() 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 - 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 MT_Vector3 scale1 = NodeGetWorldScaling(); diff --git a/source/gameengine/PyDoc/GameTypes.py b/source/gameengine/PyDoc/GameTypes.py index cae1b875a1b..7ecae944324 100644 --- a/source/gameengine/PyDoc/GameTypes.py +++ b/source/gameengine/PyDoc/GameTypes.py @@ -5152,6 +5152,10 @@ class SCA_PropertySensor(SCA_ISensor): @type propName: string @ivar value: the value with which the sensor compares to the value of the property. @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 def getType(): diff --git a/source/gameengine/SceneGraph/SG_Node.cpp b/source/gameengine/SceneGraph/SG_Node.cpp index 2436f6ecb55..706568fc3fe 100644 --- a/source/gameengine/SceneGraph/SG_Node.cpp +++ b/source/gameengine/SceneGraph/SG_Node.cpp @@ -150,6 +150,12 @@ GetRootSGParent( 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 SG_Node:: DisconnectFromParent( diff --git a/source/gameengine/SceneGraph/SG_Node.h b/source/gameengine/SceneGraph/SG_Node.h index 78fa61c019e..5d2bac2b955 100644 --- a/source/gameengine/SceneGraph/SG_Node.h +++ b/source/gameengine/SceneGraph/SG_Node.h @@ -77,6 +77,13 @@ public: 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 * adding or removing children please use the methods of this class for |