diff options
author | Daniel Genrich <daniel.genrich@gmx.net> | 2008-09-21 17:03:39 +0400 |
---|---|---|
committer | Daniel Genrich <daniel.genrich@gmx.net> | 2008-09-21 17:03:39 +0400 |
commit | 518b8fe01834b6379614f65f7c611645e5ad4bd5 (patch) | |
tree | 4ae32e35c1faa81b9df422280e533358d9ab8780 /source/blender | |
parent | fc312fae98f54b56d00812fee64aa9e9e1ee74ff (diff) | |
parent | 92829e821f345596edec123e06187186e2471027 (diff) |
svn merge -r 16593:16648 https://svn.blender.org/svnroot/bf-blender/trunk/blender
Diffstat (limited to 'source/blender')
92 files changed, 1317 insertions, 772 deletions
diff --git a/source/blender/blenkernel/BKE_bad_level_calls.h b/source/blender/blenkernel/BKE_bad_level_calls.h index 8dee9a27f49..0b623526562 100644 --- a/source/blender/blenkernel/BKE_bad_level_calls.h +++ b/source/blender/blenkernel/BKE_bad_level_calls.h @@ -141,7 +141,7 @@ short pupmenu(char *instr); // will be general callback /* scene.c */ #include "DNA_sequence_types.h" void free_editing(struct Editing *ed); // scenes and sequences problem... -void BPY_do_all_scripts (short int event); +void BPY_do_all_scripts (short int event, short int anim); int BPY_call_importloader(char *name); diff --git a/source/blender/blenkernel/BKE_blender.h b/source/blender/blenkernel/BKE_blender.h index 0591937ea4c..8dbb90372f0 100644 --- a/source/blender/blenkernel/BKE_blender.h +++ b/source/blender/blenkernel/BKE_blender.h @@ -41,7 +41,7 @@ struct ListBase; struct MemFile; #define BLENDER_VERSION 247 -#define BLENDER_SUBVERSION 2 +#define BLENDER_SUBVERSION 4 #define BLENDER_MINVERSION 245 #define BLENDER_MINSUBVERSION 15 diff --git a/source/blender/blenkernel/BKE_property.h b/source/blender/blenkernel/BKE_property.h index f1587790c4a..6af1deda727 100644 --- a/source/blender/blenkernel/BKE_property.h +++ b/source/blender/blenkernel/BKE_property.h @@ -41,7 +41,8 @@ struct bProperty *copy_property(struct bProperty *prop); void copy_properties(struct ListBase *lbn, struct ListBase *lbo); void init_property(struct bProperty *prop); struct bProperty *new_property(int type); -struct bProperty *get_property(struct Object *ob, char *name); +struct bProperty *get_ob_property(struct Object *ob, char *name); +void set_ob_property(struct Object *ob, struct bProperty *propc); int compare_property(struct bProperty *prop, char *str); void set_property(struct bProperty *prop, char *str); void add_property(struct bProperty *prop, char *str); diff --git a/source/blender/blenkernel/BKE_utildefines.h b/source/blender/blenkernel/BKE_utildefines.h index d647a74c6e2..9662d6fbff8 100644 --- a/source/blender/blenkernel/BKE_utildefines.h +++ b/source/blender/blenkernel/BKE_utildefines.h @@ -102,6 +102,8 @@ #define AVG2(x, y) ( 0.5 * ((x) + (y)) ) +#define FTOCHAR(val) (val<=0.0f)? 0 : ((val>(1.0f-0.5f/255.0f))? 255 : (char)((255.0f*val)+0.5f)) + #define VECCOPY(v1,v2) {*(v1)= *(v2); *(v1+1)= *(v2+1); *(v1+2)= *(v2+2);} #define VECCOPY2D(v1,v2) {*(v1)= *(v2); *(v1+1)= *(v2+1);} #define QUATCOPY(v1,v2) {*(v1)= *(v2); *(v1+1)= *(v2+1); *(v1+2)= *(v2+2); *(v1+3)= *(v2+3);} diff --git a/source/blender/blenkernel/SConscript b/source/blender/blenkernel/SConscript index db67251f44e..f891b307b2c 100644 --- a/source/blender/blenkernel/SConscript +++ b/source/blender/blenkernel/SConscript @@ -43,7 +43,8 @@ if env['WITH_BF_QUICKTIME'] == 1: defs += ' WITH_QUICKTIME' incs += ' ' + env['BF_QUICKTIME_INC'] -defs += ' WITH_CCGSUBSURF' +if env['BF_NO_ELBEEM'] == 1: + defs += ' DISABLE_ELBEEM' if env['WITH_BF_PLAYER']: SConscript(['bad_level_call_stubs/SConscript']) diff --git a/source/blender/blenkernel/bad_level_call_stubs/stubs.c b/source/blender/blenkernel/bad_level_call_stubs/stubs.c index f4beca262d7..ae336d0fc26 100644 --- a/source/blender/blenkernel/bad_level_call_stubs/stubs.c +++ b/source/blender/blenkernel/bad_level_call_stubs/stubs.c @@ -201,7 +201,7 @@ short pupmenu(char *instr){ return 0;} // will be general callback /* scene.c */ #include "DNA_sequence_types.h" void free_editing(struct Editing *ed){} // scenes and sequences problem... -void BPY_do_all_scripts (short int event){} +void BPY_do_all_scripts (short int event, short int anim){} /*editmesh_lib.c*/ void EM_select_face(struct EditFace *efa, int sel) {} diff --git a/source/blender/blenkernel/intern/action.c b/source/blender/blenkernel/intern/action.c index d65a99f23f0..e0afdec5e23 100644 --- a/source/blender/blenkernel/intern/action.c +++ b/source/blender/blenkernel/intern/action.c @@ -1048,7 +1048,7 @@ static float nla_time(float cfra, float unit) static float stridechannel_frame(Object *ob, float sizecorr, bActionStrip *strip, Path *path, float pathdist, float *stride_offset) { bAction *act= strip->act; - char *name= strip->stridechannel; + const char *name= strip->stridechannel; bActionChannel *achan= get_action_channel(act, name); int stride_axis= strip->stride_axis; diff --git a/source/blender/blenkernel/intern/brush.c b/source/blender/blenkernel/intern/brush.c index 6ea470a2263..1c53af97dbb 100644 --- a/source/blender/blenkernel/intern/brush.c +++ b/source/blender/blenkernel/intern/brush.c @@ -359,7 +359,6 @@ void brush_sample_tex(Brush *brush, float *xy, float *rgba) rgba[0]= rgba[1]= rgba[2]= rgba[3]= 1.0f; } -#define FTOCHAR(val) val<=0.0f?0: (val>=1.0f?255: (char)(255.0f*val)) void brush_imbuf_new(Brush *brush, short flt, short texfall, int size, ImBuf **outbuf) { diff --git a/source/blender/blenkernel/intern/colortools.c b/source/blender/blenkernel/intern/colortools.c index 45b8bb7935c..1bc34aea9a1 100644 --- a/source/blender/blenkernel/intern/colortools.c +++ b/source/blender/blenkernel/intern/colortools.c @@ -650,7 +650,6 @@ void curvemapping_evaluate_premulRGBF(CurveMapping *cumap, float *vecout, const vecout[2]= curvemap_evaluateF(cumap->cm+2, fac); } -#define FTOCHAR(val) val<=0.0f?0: (val>=1.0f?255: (char)(255.0f*val)) void curvemapping_do_ibuf(CurveMapping *cumap, ImBuf *ibuf) { diff --git a/source/blender/blenkernel/intern/constraint.c b/source/blender/blenkernel/intern/constraint.c index efb03b71438..99cf58e8e5a 100644 --- a/source/blender/blenkernel/intern/constraint.c +++ b/source/blender/blenkernel/intern/constraint.c @@ -1872,7 +1872,7 @@ static void pycon_get_tarmat (bConstraint *con, bConstraintOb *cob, bConstraintT { bPythonConstraint *data= con->data; - if ((G.f & G_DOSCRIPTLINKS) && VALID_CONS_TARGET(ct)) { + if (VALID_CONS_TARGET(ct)) { /* special exception for curves - depsgraph issues */ if (ct->tar->type == OB_CURVE) { Curve *cu= ct->tar->data; @@ -1886,7 +1886,10 @@ static void pycon_get_tarmat (bConstraint *con, bConstraintOb *cob, bConstraintT * this matrix if it needs to do so */ constraint_target_to_mat4(ct->tar, ct->subtarget, ct->matrix, CONSTRAINT_SPACE_WORLD, ct->space, con->headtail); - BPY_pyconstraint_target(data, ct); + + /* only execute target calculation if allowed */ + if (G.f & G_DOSCRIPTLINKS) + BPY_pyconstraint_target(data, ct); } else if (ct) Mat4One(ct->matrix); @@ -1896,6 +1899,7 @@ static void pycon_evaluate (bConstraint *con, bConstraintOb *cob, ListBase *targ { bPythonConstraint *data= con->data; + /* only evaluate in python if we're allowed to do so */ if ((G.f & G_DOSCRIPTLINKS)==0) return; /* currently removed, until I this can be re-implemented for multiple targets */ diff --git a/source/blender/blenkernel/intern/curve.c b/source/blender/blenkernel/intern/curve.c index 396bdda9c10..c5ad9e58a4c 100644 --- a/source/blender/blenkernel/intern/curve.c +++ b/source/blender/blenkernel/intern/curve.c @@ -1519,7 +1519,7 @@ void makeBevelList(Object *ob) bevp->y= bp->vec[1]; bevp->z= bp->vec[2]; bevp->alfa= bp->alfa; - bevp->f1= 1; + bevp->f1= SELECT; bevp++; bp++; } @@ -1579,11 +1579,11 @@ void makeBevelList(Object *ob) /* indicate with handlecodes double points */ if(prevbezt->h1==prevbezt->h2) { - if(prevbezt->h1==0 || prevbezt->h1==HD_VECT) bevp->f1= 1; + if(prevbezt->h1==0 || prevbezt->h1==HD_VECT) bevp->f1= SELECT; } else { - if(prevbezt->h1==0 || prevbezt->h1==HD_VECT) bevp->f1= 1; - else if(prevbezt->h2==0 || prevbezt->h2==HD_VECT) bevp->f1= 1; + if(prevbezt->h1==0 || prevbezt->h1==HD_VECT) bevp->f1= SELECT; + else if(prevbezt->h2==0 || prevbezt->h2==HD_VECT) bevp->f1= SELECT; } v1= data; @@ -2385,9 +2385,9 @@ void sethandlesNurb(short code) bezt= nu->bezt; a= nu->pntsu; while(a--) { - if(bezt->f1 || bezt->f3) { - if(bezt->f1) bezt->h1= code; - if(bezt->f3) bezt->h2= code; + if((bezt->f1 & SELECT) || (bezt->f3 & SELECT)) { + if(bezt->f1 & SELECT) bezt->h1= code; + if(bezt->f3 & SELECT) bezt->h2= code; if(bezt->h1!=bezt->h2) { if ELEM(bezt->h1, HD_ALIGN, HD_AUTO) bezt->h1= HD_FREE; if ELEM(bezt->h2, HD_ALIGN, HD_AUTO) bezt->h2= HD_FREE; @@ -2415,8 +2415,8 @@ void sethandlesNurb(short code) bezt= nu->bezt; a= nu->pntsu; while(a--) { - if(bezt->f1 && bezt->h1) ok= 1; - if(bezt->f3 && bezt->h2) ok= 1; + if((bezt->f1 & SELECT) && bezt->h1) ok= 1; + if((bezt->f3 & SELECT) && bezt->h2) ok= 1; if(ok) break; bezt++; } @@ -2432,8 +2432,8 @@ void sethandlesNurb(short code) bezt= nu->bezt; a= nu->pntsu; while(a--) { - if(bezt->f1) bezt->h1= ok; - if(bezt->f3 ) bezt->h2= ok; + if(bezt->f1 & SELECT) bezt->h1= ok; + if(bezt->f3 & SELECT) bezt->h2= ok; bezt++; } diff --git a/source/blender/blenkernel/intern/depsgraph.c b/source/blender/blenkernel/intern/depsgraph.c index 96ea4fced9d..7f4910a9765 100644 --- a/source/blender/blenkernel/intern/depsgraph.c +++ b/source/blender/blenkernel/intern/depsgraph.c @@ -865,12 +865,12 @@ DagNode * dag_get_sub_node (DagForest *forest,void * fob) return node; } -void dag_add_relation(DagForest *forest, DagNode *fob1, DagNode *fob2, short rel, char *name) +static void dag_add_parent_relation(DagForest *forest, DagNode *fob1, DagNode *fob2, short rel, char *name) { - DagAdjList *itA = fob1->child; + DagAdjList *itA = fob2->parent; while (itA) { /* search if relation exist already */ - if (itA->node == fob2) { + if (itA->node == fob1) { itA->type |= rel; itA->count += 1; return; @@ -879,20 +879,23 @@ void dag_add_relation(DagForest *forest, DagNode *fob1, DagNode *fob2, short rel } /* create new relation and insert at head. MALLOC alert! */ itA = MEM_mallocN(sizeof(DagAdjList),"DAG adj list"); - itA->node = fob2; + itA->node = fob1; itA->type = rel; itA->count = 1; - itA->next = fob1->child; + itA->next = fob2->parent; itA->name = name; - fob1->child = itA; + fob2->parent = itA; } -static void dag_add_parent_relation(DagForest *forest, DagNode *fob1, DagNode *fob2, short rel, char *name) +void dag_add_relation(DagForest *forest, DagNode *fob1, DagNode *fob2, short rel, char *name) { - DagAdjList *itA = fob2->parent; + DagAdjList *itA = fob1->child; + /* parent relation is for cycle checking */ + dag_add_parent_relation(forest, fob1, fob2, rel, name); + while (itA) { /* search if relation exist already */ - if (itA->node == fob1) { + if (itA->node == fob2) { itA->type |= rel; itA->count += 1; return; @@ -901,12 +904,12 @@ static void dag_add_parent_relation(DagForest *forest, DagNode *fob1, DagNode *f } /* create new relation and insert at head. MALLOC alert! */ itA = MEM_mallocN(sizeof(DagAdjList),"DAG adj list"); - itA->node = fob1; + itA->node = fob2; itA->type = rel; itA->count = 1; - itA->next = fob2->parent; + itA->next = fob1->child; itA->name = name; - fob2->parent = itA; + fob1->child = itA; } static char *dag_node_name(DagNode *node) @@ -966,6 +969,63 @@ static void dag_node_print_dependency_cycle(DagForest *dag, DagNode *startnode, printf("\n"); } +static int dag_node_recurs_level(DagNode *node, int level) +{ + DagAdjList *itA; + int newlevel; + + node->color= DAG_BLACK; /* done */ + newlevel= ++level; + + for(itA= node->parent; itA; itA= itA->next) { + if(itA->node->color==DAG_WHITE) { + itA->node->ancestor_count= dag_node_recurs_level(itA->node, level); + newlevel= MAX2(newlevel, level+itA->node->ancestor_count); + } + else + newlevel= MAX2(newlevel, level+itA->node->ancestor_count); + } + + return newlevel; +} + +static void dag_check_cycle(DagForest *dag) +{ + DagNode *node; + DagAdjList *itA; + + /* tag nodes unchecked */ + for(node = dag->DagNode.first; node; node= node->next) + node->color= DAG_WHITE; + + for(node = dag->DagNode.first; node; node= node->next) { + if(node->color==DAG_WHITE) { + node->ancestor_count= dag_node_recurs_level(node, 0); + } + } + + /* check relations, and print errors */ + for(node = dag->DagNode.first; node; node= node->next) { + for(itA= node->parent; itA; itA= itA->next) { + if(itA->node->ancestor_count > node->ancestor_count) { + if(node->ob && itA->node->ob) { + printf("Dependency cycle detected:\n"); + dag_node_print_dependency_cycle(dag, itA->node, node, itA->name); + } + } + } + } + + /* parent relations are only needed for cycle checking, so free now */ + for(node = dag->DagNode.first; node; node= node->next) { + while (node->parent) { + itA = node->parent->next; + MEM_freeN(node->parent); + node->parent = itA; + } + } +} + /* * MainDAG is the DAG of all objects in current scene * used only for drawing there is one also in each scene @@ -1603,6 +1663,8 @@ void DAG_scene_sort(struct Scene *sce) build_dag(sce, DAG_RL_ALL_BUT_DATA); + dag_check_cycle(sce->theDag); + nqueue = queue_create(DAGQUEUEALLOC); for(node = sce->theDag->DagNode.first; node; node= node->next) { @@ -2206,57 +2268,6 @@ void DAG_object_update_flags(Scene *sce, Object *ob, unsigned int lay) /* ******************* DAG FOR ARMATURE POSE ***************** */ -static int node_recurs_level(DagNode *node, int level) -{ - DagAdjList *itA; - int newlevel; - - node->color= DAG_BLACK; /* done */ - newlevel= ++level; - - for(itA= node->parent; itA; itA= itA->next) { - if(itA->node->color==DAG_WHITE) { - itA->node->ancestor_count= node_recurs_level(itA->node, level); - newlevel= MAX2(newlevel, level+itA->node->ancestor_count); - } - else - newlevel= MAX2(newlevel, level+itA->node->ancestor_count); - } - - return newlevel; -} - -static void pose_check_cycle(DagForest *dag) -{ - DagNode *node; - DagAdjList *itA; - - /* tag nodes unchecked */ - for(node = dag->DagNode.first; node; node= node->next) - node->color= DAG_WHITE; - - for(node = dag->DagNode.first; node; node= node->next) { - if(node->color==DAG_WHITE) { - node->ancestor_count= node_recurs_level(node, 0); - } - } - - /* check relations, and print errors */ - for(node = dag->DagNode.first; node; node= node->next) { - for(itA= node->parent; itA; itA= itA->next) { - if(itA->node->ancestor_count > node->ancestor_count) { - bPoseChannel *pchan= (bPoseChannel *)node->ob; - bPoseChannel *parchan= (bPoseChannel *)itA->node->ob; - - if(pchan && parchan) { - printf("Cycle detected:\n"); - dag_node_print_dependency_cycle(dag, itA->node, node, itA->name); - } - } - } - } -} - /* we assume its an armature with pose */ void DAG_pose_sort(Object *ob) { @@ -2286,7 +2297,6 @@ void DAG_pose_sort(Object *ob) if(pchan->parent) { node2 = dag_get_node(dag, pchan->parent); dag_add_relation(dag, node2, node, 0, "Parent Relation"); - dag_add_parent_relation(dag, node2, node, 0, "Parent Relation"); addtoroot = 0; } for (con = pchan->constraints.first; con; con=con->next) { @@ -2305,7 +2315,6 @@ void DAG_pose_sort(Object *ob) if(target) { node2 = dag_get_node(dag, target); dag_add_relation(dag, node2, node, 0, "Ipo Driver"); - dag_add_parent_relation(dag, node2, node, 0, "Ipo Driver"); /* uncommented this line, results in dependencies * not being added properly for this constraint, @@ -2325,7 +2334,6 @@ void DAG_pose_sort(Object *ob) if (target) { node2= dag_get_node(dag, target); dag_add_relation(dag, node2, node, 0, "IK Constraint"); - dag_add_parent_relation(dag, node2, node, 0, "IK Constraint"); if (con->type==CONSTRAINT_TYPE_KINEMATIC) { bKinematicConstraint *data = (bKinematicConstraint *)con->data; @@ -2342,7 +2350,6 @@ void DAG_pose_sort(Object *ob) while (parchan) { node3= dag_get_node(dag, parchan); dag_add_relation(dag, node2, node3, 0, "IK Constraint"); - dag_add_parent_relation(dag, node2, node3, 0, "IK Constraint"); segcount++; if (segcount==data->rootbone || segcount>255) break; // 255 is weak @@ -2359,11 +2366,10 @@ void DAG_pose_sort(Object *ob) } if (addtoroot == 1 ) { dag_add_relation(dag, rootnode, node, 0, "Root Bone Relation"); - dag_add_parent_relation(dag, rootnode, node, 0, "Root Bone Relation"); } } - pose_check_cycle(dag); + dag_check_cycle(dag); /* now we try to sort... */ tempbase.first= tempbase.last= NULL; diff --git a/source/blender/blenkernel/intern/displist.c b/source/blender/blenkernel/intern/displist.c index 3b79f6689c0..69c8f3406a2 100644 --- a/source/blender/blenkernel/intern/displist.c +++ b/source/blender/blenkernel/intern/displist.c @@ -757,7 +757,10 @@ void reshadeall_displist(void) for(base= G.scene->base.first; base; base= base->next) { ob= base->object; - freedisplist(&ob->disp); + + if(ELEM5(ob->type, OB_MESH, OB_CURVE, OB_SURF, OB_FONT, OB_MBALL)) + freedisplist(&ob->disp); + if(base->lay & G.scene->lay) { /* Metaballs have standard displist at the Object */ if(ob->type==OB_MBALL) shadeDispList(base); diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c index ee887bee2b1..7aff0f0eb49 100644 --- a/source/blender/blenkernel/intern/particle_system.c +++ b/source/blender/blenkernel/intern/particle_system.c @@ -156,7 +156,7 @@ void psys_reset(ParticleSystem *psys, int mode) int p=0; for(; p<psys->totpart; p++, pa++) - pa->flag = PARS_NO_DISP; + pa->flag |= PARS_NO_DISP; } /* reset children */ @@ -2110,22 +2110,18 @@ static void react_to_events(ParticleSystem *psys, int pa_num) for(re=psys->reactevents.first; re; re=re->next){ birth=0; if(part->from==PART_FROM_PARTICLE){ - if(pa->num==re->pa_num){ + if(pa->num==re->pa_num && pa->alive==PARS_UNBORN){ if(re->event==PART_EVENT_NEAR){ ParticleData *tpa = re->psys->particles+re->pa_num; float pa_time=tpa->time + pa->foffset*tpa->lifetime; - if(re->time > pa_time){ - pa->alive=PARS_ALIVE; + if(re->time >= pa_time){ pa->time=pa_time; pa->dietime=pa->time+pa->lifetime; } } else{ - if(pa->alive==PARS_UNBORN){ - pa->alive=PARS_ALIVE; - pa->time=re->time; - pa->dietime=pa->time+pa->lifetime; - } + pa->time=re->time; + pa->dietime=pa->time+pa->lifetime; } } } @@ -2133,7 +2129,6 @@ static void react_to_events(ParticleSystem *psys, int pa_num) dist=VecLenf(pa->state.co, re->state.co); if(dist <= re->size){ if(pa->alive==PARS_UNBORN){ - pa->alive=PARS_ALIVE; pa->time=re->time; pa->dietime=pa->time+pa->lifetime; birth=1; @@ -3127,6 +3122,10 @@ static void deflect_particle(Object *pob, ParticleSystemModifierData *psmd, Part if(through == 0 && (part->flag & PART_DIE_ON_COL || pd->flag & PDEFLE_KILL_PART)) { pa->alive = PARS_DYING; pa->dietime = pa->state.time + (cfra - pa->state.time) * dt; + + /* we have to add this for dying particles too so that reactors work correctly */ + VECADDFAC(co, co, col.nor, (through ? -0.0001f : 0.0001f)); + VECCOPY(state->co, co); VecLerpf(state->vel, pa->state.vel, state->vel, dt); QuatInterpol(state->rot, pa->state.rot, state->rot, dt); @@ -4061,9 +4060,11 @@ static void dynamics_step(Object *ob, ParticleSystem *psys, ParticleSystemModifi pa_dfra = dfra; pa_dtime = dtime; + /* we need to calculate this once again because reactions might have changed pa->time */ + birthtime = pa->time + pa->loop * pa->lifetime; dietime = birthtime + pa->lifetime; - if(birthtime < cfra && birthtime >= psys->cfra){ + if(birthtime <= cfra && birthtime >= psys->cfra){ /* particle is born some time between this and last step*/ pa->alive = PARS_ALIVE; pa_dfra = cfra - birthtime; @@ -4103,8 +4104,6 @@ static void dynamics_step(Object *ob, ParticleSystem *psys, ParticleSystemModifi } } - push_reaction(ob,psys,p,PART_EVENT_NEAR,key); - if(pa->alive == PARS_DYING){ push_reaction(ob,psys,p,PART_EVENT_DEATH,key); @@ -4124,6 +4123,8 @@ static void dynamics_step(Object *ob, ParticleSystem *psys, ParticleSystemModifi } else key->time=cfra; + + push_reaction(ob,psys,p,PART_EVENT_NEAR,key); } } } diff --git a/source/blender/blenkernel/intern/property.c b/source/blender/blenkernel/intern/property.c index f55bdd15279..d2eb058a9a0 100644 --- a/source/blender/blenkernel/intern/property.c +++ b/source/blender/blenkernel/intern/property.c @@ -83,8 +83,7 @@ bProperty *copy_property(bProperty *prop) void copy_properties(ListBase *lbn, ListBase *lbo) { bProperty *prop, *propn; - - lbn->first= lbn->last= 0; + free_properties( lbn ); /* incase we are copying to an object with props */ prop= lbo->first; while(prop) { propn= copy_property(prop); @@ -139,7 +138,7 @@ bProperty *new_property(int type) return prop; } -bProperty *get_property(Object *ob, char *name) +bProperty *get_ob_property(Object *ob, char *name) { bProperty *prop; @@ -151,6 +150,17 @@ bProperty *get_property(Object *ob, char *name) return NULL; } +void set_ob_property(Object *ob, bProperty *propc) +{ + bProperty *prop; + prop= get_ob_property(ob, propc->name); + if(prop) { + free_property(prop); + BLI_remlink(&ob->prop, prop); + } + BLI_addtail(&ob->prop, copy_property(propc)); +} + /* negative: prop is smaller * positive: prop is larger */ diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c index 553107dd264..701e8ecb311 100644 --- a/source/blender/blenkernel/intern/scene.c +++ b/source/blender/blenkernel/intern/scene.c @@ -350,7 +350,7 @@ void set_scene_bg(Scene *sce) /* no full animation update, this to enable render code to work (render code calls own animation updates) */ /* do we need FRAMECHANGED in set_scene? */ -// if (G.f & G_DOSCRIPTLINKS) BPY_do_all_scripts(SCRIPT_FRAMECHANGED); +// if (G.f & G_DOSCRIPTLINKS) BPY_do_all_scripts(SCRIPT_FRAMECHANGED, 0); } /* called from creator.c */ @@ -570,8 +570,8 @@ void scene_update_for_newframe(Scene *sce, unsigned int lay) /* object ipos are calculated in where_is_object */ do_all_data_ipos(); - if (G.f & G_DOSCRIPTLINKS) BPY_do_all_scripts(SCRIPT_FRAMECHANGED); - + if (G.f & G_DOSCRIPTLINKS) BPY_do_all_scripts(SCRIPT_FRAMECHANGED, 0); + /* sets first, we allow per definition current scene to have dependencies on sets */ for(sce= sce->set; sce; sce= sce->set) scene_update(sce, lay); diff --git a/source/blender/blenlib/BLI_arithb.h b/source/blender/blenlib/BLI_arithb.h index 6e54fae58d0..4b858dcb503 100644 --- a/source/blender/blenlib/BLI_arithb.h +++ b/source/blender/blenlib/BLI_arithb.h @@ -91,6 +91,7 @@ float saasin(float fac); float sasqrt(float fac); int FloatCompare(float *v1, float *v2, float limit); +int FloatCompare4(float *v1, float *v2, float limit); float FloatLerpf(float target, float origin, float fac); float CalcNormFloat(float *v1, float *v2, float *v3, float *n); diff --git a/source/blender/blenlib/BLI_blenlib.h b/source/blender/blenlib/BLI_blenlib.h index a1db7adf33d..6a50e2de0e5 100644 --- a/source/blender/blenlib/BLI_blenlib.h +++ b/source/blender/blenlib/BLI_blenlib.h @@ -224,7 +224,7 @@ int BLI_strcaseeq(char *a, char *b); /* in util.c */ #ifdef WITH_ICONV -void BLI_string_to_utf8(char *original, char *utf_8, char *code); +void BLI_string_to_utf8(char *original, char *utf_8, const char *code); #endif /** diff --git a/source/blender/blenlib/intern/arithb.c b/source/blender/blenlib/intern/arithb.c index f89f90f7045..c6634eb7707 100644 --- a/source/blender/blenlib/intern/arithb.c +++ b/source/blender/blenlib/intern/arithb.c @@ -1026,6 +1026,19 @@ int FloatCompare( float *v1, float *v2, float limit) return 0; } +int FloatCompare4( float *v1, float *v2, float limit) +{ + + if( fabs(v1[0]-v2[0])<limit ) { + if( fabs(v1[1]-v2[1])<limit ) { + if( fabs(v1[2]-v2[2])<limit ) { + if( fabs(v1[3]-v2[3])<limit ) return 1; + } + } + } + return 0; +} + float FloatLerpf( float target, float origin, float fac) { return (fac*target) + (1.0f-fac)*origin; diff --git a/source/blender/blenlib/intern/dynlib.c b/source/blender/blenlib/intern/dynlib.c index c4692995f20..e7fa3332f43 100644 --- a/source/blender/blenlib/intern/dynlib.c +++ b/source/blender/blenlib/intern/dynlib.c @@ -77,12 +77,12 @@ char *PIL_dynlib_get_error_as_string(PILdynlib* lib) { int err; /* if lib is NULL reset the last error code */ + err= GetLastError(); if (!lib) { SetLastError(ERROR_SUCCESS); - return NULL; + err = ERROR_SUCCESS; } - err= GetLastError(); if (err) { static char buf[1024]; @@ -96,7 +96,7 @@ char *PIL_dynlib_get_error_as_string(PILdynlib* lib) { return buf; } - return NULL; + return "unrecognized error"; } void PIL_dynlib_close(PILdynlib *lib) { diff --git a/source/blender/blenlib/intern/edgehash.c b/source/blender/blenlib/intern/edgehash.c index 3e1c8afb7a8..603c85655d7 100644 --- a/source/blender/blenlib/intern/edgehash.c +++ b/source/blender/blenlib/intern/edgehash.c @@ -77,8 +77,12 @@ void BLI_edgehash_insert(EdgeHash *eh, int v0, int v1, void *val) { unsigned int hash; Entry *e= malloc(sizeof(*e)); - if (v1<v0) v0 ^= v1 ^= v0 ^= v1; - hash = EDGEHASH(v0,v1)%eh->nbuckets; + if (v1<v0) { + v0 ^= v1; + v1 ^= v0; + v0 ^= v1; + } + hash = EDGEHASH(v0,v1)%eh->nbuckets; e->v0 = v0; e->v1 = v1; @@ -114,7 +118,11 @@ void** BLI_edgehash_lookup_p(EdgeHash *eh, int v0, int v1) { unsigned int hash; Entry *e; - if (v1<v0) v0 ^= v1 ^= v0 ^= v1; + if (v1<v0) { + v0 ^= v1; + v1 ^= v0; + v0 ^= v1; + } hash = EDGEHASH(v0,v1)%eh->nbuckets; for (e= eh->buckets[hash]; e; e= e->next) if (v0==e->v0 && v1==e->v1) diff --git a/source/blender/blenlib/intern/freetypefont.c b/source/blender/blenlib/intern/freetypefont.c index 74f152ac635..48a40db6a72 100644 --- a/source/blender/blenlib/intern/freetypefont.c +++ b/source/blender/blenlib/intern/freetypefont.c @@ -404,8 +404,6 @@ static VFontData *objfnt_to_ftvfontdata(PackedFile * pf) break; lcode = charcode; } - - err = FT_Select_Charmap( face, FT_ENCODING_UNICODE ); return vfd; } diff --git a/source/blender/blenlib/intern/util.c b/source/blender/blenlib/intern/util.c index c27efcb7934..9dfe9557c1b 100644 --- a/source/blender/blenlib/intern/util.c +++ b/source/blender/blenlib/intern/util.c @@ -1955,7 +1955,7 @@ int BLI_strncasecmp(const char *s1, const char *s2, int n) { #include "iconv.h" #include "localcharset.h" -void BLI_string_to_utf8(char *original, char *utf_8, char *code) +void BLI_string_to_utf8(char *original, char *utf_8, const char *code) { size_t inbytesleft=strlen(original); size_t outbytesleft=512; diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 928def77059..797c986b7d0 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -139,7 +139,7 @@ #include "BKE_object.h" #include "BKE_particle.h" #include "BKE_pointcache.h" -#include "BKE_property.h" // for get_property +#include "BKE_property.h" // for get_ob_property #include "BKE_sca.h" // for init_actuator #include "BKE_scene.h" #include "BKE_softbody.h" // sbNew() @@ -5329,7 +5329,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) while (act) { if(act->type==ACT_IPO) { ia= act->data; - prop= get_property(ob, ia->name); + prop= get_ob_property(ob, ia->name); if(prop) { ia->type= ACT_IPO_FROM_PROP; } @@ -7830,6 +7830,25 @@ static void do_versions(FileData *fd, Library *lib, Main *main) } } + if (main->versionfile < 247 || (main->versionfile == 247 && main->subversionfile < 3)){ + Object *ob; + for(ob = main->object.first; ob; ob= ob->id.next) { + // Starting from subversion 3, ACTOR is a separate feature. + // Before it was conditioning all the other dynamic flags + if (!(ob->gameflag & OB_ACTOR)) + ob->gameflag &= ~(OB_GHOST|OB_DYNAMIC|OB_RIGID_BODY|OB_SOFT_BODY|OB_COLLISION_RESPONSE); + } + } + + if (main->versionfile < 247 || (main->versionfile == 247 && main->subversionfile < 4)){ + Scene *sce= main->scene.first; + while(sce) { + if(sce->frame_step==0) + sce->frame_step= 1; + sce= sce->id.next; + } + } + /* WATCH IT!!!: pointers from libdata have not been converted yet here! */ /* WATCH IT 2!: Userdef struct init has to be in src/usiblender.c! */ diff --git a/source/blender/gpu/GPU_extensions.h b/source/blender/gpu/GPU_extensions.h index d3faa81ebb1..3813fe3da8e 100644 --- a/source/blender/gpu/GPU_extensions.h +++ b/source/blender/gpu/GPU_extensions.h @@ -108,8 +108,8 @@ void GPU_framebuffer_restore(); - only for fragment shaders now - must call texture bind before setting a texture as uniform! */ -GPUShader *GPU_shader_create(const char *vertexcode, const char *fragcode, GPUShader *lib); -GPUShader *GPU_shader_create_lib(const char *code); +GPUShader *GPU_shader_create(const char *vertexcode, const char *fragcode, const char *libcode); /*GPUShader *lib);*/ +/*GPUShader *GPU_shader_create_lib(const char *code);*/ void GPU_shader_free(GPUShader *shader); void GPU_shader_bind(GPUShader *shader); diff --git a/source/blender/gpu/intern/gpu_codegen.c b/source/blender/gpu/intern/gpu_codegen.c index 78a99cab447..1c29bdc8741 100644 --- a/source/blender/gpu/intern/gpu_codegen.c +++ b/source/blender/gpu/intern/gpu_codegen.c @@ -188,8 +188,8 @@ static void BLI_dynstr_printf(DynStr *dynstr, const char *format, ...) * These are stored in a hash for lookup when creating a material. */ static GHash *FUNCTION_HASH= NULL; -static char *FUNCTION_PROTOTYPES= NULL; -static GPUShader *FUNCTION_LIB= NULL; +/*static char *FUNCTION_PROTOTYPES= NULL; +static GPUShader *FUNCTION_LIB= NULL;*/ static int gpu_str_prefix(char *str, char *prefix) { @@ -299,6 +299,7 @@ static void gpu_parse_functions_string(GHash *hash, char *code) } } +#if 0 static char *gpu_generate_function_prototyps(GHash *hash) { DynStr *ds = BLI_dynstr_new(); @@ -346,14 +347,15 @@ static char *gpu_generate_function_prototyps(GHash *hash) return prototypes; } +#endif GPUFunction *GPU_lookup_function(char *name) { if(!FUNCTION_HASH) { FUNCTION_HASH = BLI_ghash_new(BLI_ghashutil_strhash, BLI_ghashutil_strcmp); gpu_parse_functions_string(FUNCTION_HASH, datatoc_gpu_shader_material_glsl); - FUNCTION_PROTOTYPES = gpu_generate_function_prototyps(FUNCTION_HASH); - FUNCTION_LIB = GPU_shader_create_lib(datatoc_gpu_shader_material_glsl); + /*FUNCTION_PROTOTYPES = gpu_generate_function_prototyps(FUNCTION_HASH); + FUNCTION_LIB = GPU_shader_create_lib(datatoc_gpu_shader_material_glsl);*/ } return (GPUFunction*)BLI_ghash_lookup(FUNCTION_HASH, name); @@ -370,14 +372,14 @@ void GPU_extensions_exit(void) BLI_ghash_free(FUNCTION_HASH, NULL, (GHashValFreeFP)MEM_freeN); FUNCTION_HASH = NULL; } - if(FUNCTION_PROTOTYPES) { + /*if(FUNCTION_PROTOTYPES) { MEM_freeN(FUNCTION_PROTOTYPES); FUNCTION_PROTOTYPES = NULL; - } - if(FUNCTION_LIB) { + }*/ + /*if(FUNCTION_LIB) { GPU_shader_free(FUNCTION_LIB); FUNCTION_LIB = NULL; - } + }*/ } /* GLSL code generation */ @@ -688,7 +690,7 @@ static char *code_generate_fragment(ListBase *nodes, GPUOutput *output, const ch DynStr *ds = BLI_dynstr_new(); char *code; - BLI_dynstr_append(ds, FUNCTION_PROTOTYPES); + /*BLI_dynstr_append(ds, FUNCTION_PROTOTYPES);*/ codegen_set_unique_ids(nodes); codegen_print_uniforms_functions(ds, nodes); @@ -1393,10 +1395,10 @@ GPUPass *GPU_generate_pass(ListBase *nodes, GPUNodeLink *outlink, GPUVertexAttri GPUPass *pass; char *vertexcode, *fragmentcode; - if(!FUNCTION_LIB) { + /*if(!FUNCTION_LIB) { GPU_nodes_free(nodes); return NULL; - } + }*/ /* prune unused nodes */ gpu_nodes_prune(nodes, outlink); @@ -1407,7 +1409,7 @@ GPUPass *GPU_generate_pass(ListBase *nodes, GPUNodeLink *outlink, GPUVertexAttri /* generate code and compile with opengl */ fragmentcode = code_generate_fragment(nodes, outlink->output, name); vertexcode = code_generate_vertex(nodes); - shader = GPU_shader_create(vertexcode, fragmentcode, FUNCTION_LIB); + shader = GPU_shader_create(vertexcode, fragmentcode, datatoc_gpu_shader_material_glsl); /*FUNCTION_LIB);*/ MEM_freeN(fragmentcode); MEM_freeN(vertexcode); diff --git a/source/blender/gpu/intern/gpu_extensions.c b/source/blender/gpu/intern/gpu_extensions.c index 4c3090dd2c1..a8dc369460c 100644 --- a/source/blender/gpu/intern/gpu_extensions.c +++ b/source/blender/gpu/intern/gpu_extensions.c @@ -40,6 +40,7 @@ #include "BKE_image.h" #include "BKE_global.h" +#include "BKE_utildefines.h" #include "IMB_imbuf.h" #include "IMB_imbuf_types.h" @@ -154,7 +155,6 @@ struct GPUTexture { int depth; /* is a depth texture? */ }; -#define FTOCHAR(val) val<=0.0f?0: (val>=1.0f?255: (char)(255.0f*val)) static unsigned char *GPU_texture_convert_pixels(int length, float *fpixels) { unsigned char *pixels, *p; @@ -669,11 +669,13 @@ static void shader_print_errors(char *task, char *log, const char *code) fprintf(stderr, "%s\n", log); } -GPUShader *GPU_shader_create(const char *vertexcode, const char *fragcode, GPUShader *lib) +GPUShader *GPU_shader_create(const char *vertexcode, const char *fragcode, /*GPUShader *lib,*/ const char *libcode) { GLint status; GLcharARB log[5000]; + const char *fragsource[2]; GLsizei length = 0; + GLint count; GPUShader *shader; if (!GLEW_ARB_vertex_shader || !GLEW_ARB_fragment_shader) @@ -712,8 +714,12 @@ GPUShader *GPU_shader_create(const char *vertexcode, const char *fragcode, GPUSh } if(fragcode) { + count = 0; + if(libcode) fragsource[count++] = libcode; + if(fragcode) fragsource[count++] = fragcode; + glAttachObjectARB(shader->object, shader->fragment); - glShaderSourceARB(shader->fragment, 1, (const char**)&fragcode, NULL); + glShaderSourceARB(shader->fragment, count, fragsource, NULL); glCompileShaderARB(shader->fragment); glGetObjectParameterivARB(shader->fragment, GL_OBJECT_COMPILE_STATUS_ARB, &status); @@ -727,8 +733,8 @@ GPUShader *GPU_shader_create(const char *vertexcode, const char *fragcode, GPUSh } } - if(lib && lib->lib) - glAttachObjectARB(shader->object, lib->lib); + /*if(lib && lib->lib) + glAttachObjectARB(shader->object, lib->lib);*/ glLinkProgramARB(shader->object); glGetObjectParameterivARB(shader->object, GL_OBJECT_LINK_STATUS_ARB, &status); @@ -743,6 +749,7 @@ GPUShader *GPU_shader_create(const char *vertexcode, const char *fragcode, GPUSh return shader; } +#if 0 GPUShader *GPU_shader_create_lib(const char *code) { GLint status; @@ -778,6 +785,7 @@ GPUShader *GPU_shader_create_lib(const char *code) return shader; } +#endif void GPU_shader_bind(GPUShader *shader) { diff --git a/source/blender/imbuf/intern/divers.c b/source/blender/imbuf/intern/divers.c index 84588b52573..8043e594454 100644 --- a/source/blender/imbuf/intern/divers.c +++ b/source/blender/imbuf/intern/divers.c @@ -38,6 +38,7 @@ #include "IMB_imbuf.h" #include "IMB_allocimbuf.h" #include "IMB_divers.h" +#include "BKE_utildefines.h" void imb_checkncols(struct ImBuf *ibuf) { @@ -171,7 +172,6 @@ void IMB_gamwarp(struct ImBuf *ibuf, double gamma) } } -#define FTOCHAR(val) val<=0.0f?0: (val>=1.0f?255: (char)(255.99f*val)) void IMB_rect_from_float(struct ImBuf *ibuf) { diff --git a/source/blender/imbuf/intern/rectop.c b/source/blender/imbuf/intern/rectop.c index a8ddb271309..56714c3b481 100644 --- a/source/blender/imbuf/intern/rectop.c +++ b/source/blender/imbuf/intern/rectop.c @@ -37,6 +37,7 @@ #include "IMB_imbuf.h" #include "IMB_allocimbuf.h" +#include "BKE_utildefines.h" /* blend modes */ @@ -514,10 +515,6 @@ void IMB_rectfill(struct ImBuf *drect, float col[4]) } } -/* maybe we should use BKE_utildefines.h */ -#define FTOCHAR(val) (val<=0.0f ? 0: (val>=1.0f ? 255: (char)(255.99f*val))) -#define CLAMP(a, b, c) if((a)<(b)) (a)=(b); else if((a)>(c)) (a)=(c) -#define SWAP(type, a, b) { type sw_ap; sw_ap=(a); (a)=(b); (b)=sw_ap; } void buf_rectfill_area(unsigned char *rect, float *rectf, int width, int height, float *col, int x1, int y1, int x2, int y2) { diff --git a/source/blender/include/BIF_editseq.h b/source/blender/include/BIF_editseq.h index b353e7bb45c..be30a3eaaf3 100644 --- a/source/blender/include/BIF_editseq.h +++ b/source/blender/include/BIF_editseq.h @@ -52,6 +52,7 @@ struct Sequence* find_next_prev_sequence(struct Sequence *test, int lr, int sel) struct Sequence* find_nearest_seq(int *hand); int insert_gap(int gap, int cfra); void make_meta(void); +void select_single_seq(struct Sequence *seq, int deselect_all); void select_channel_direction(struct Sequence *test,int lr); void select_more_seq(void); void select_less_seq(void); diff --git a/source/blender/include/BIF_outliner.h b/source/blender/include/BIF_outliner.h index abf8b58b1c9..fcd206bb828 100644 --- a/source/blender/include/BIF_outliner.h +++ b/source/blender/include/BIF_outliner.h @@ -41,7 +41,7 @@ typedef struct TreeElement { short idcode; // from TreeStore id short xend; // width of item display, for select char *name; - void *directdata; // Armature Bones, Base, ... + void *directdata; // Armature Bones, Base, Sequence, Strip... } TreeElement; /* TreeElement->flag */ @@ -77,6 +77,9 @@ typedef struct TreeElement { #define TSE_LINKED_LAMP 23 #define TSE_POSEGRP_BASE 24 #define TSE_POSEGRP 25 +#define TSE_SEQUENCE 26 +#define TSE_SEQ_STRIP 27 +#define TSE_SEQUENCE_DUP 28 /* outliner search flags */ #define OL_FIND 0 diff --git a/source/blender/include/blendef.h b/source/blender/include/blendef.h index a7f7bc2e4b8..5a883dc9e21 100644 --- a/source/blender/include/blendef.h +++ b/source/blender/include/blendef.h @@ -113,6 +113,7 @@ #define F_CFRA ((float)(G.scene->r.cfra)) #define SFRA (G.scene->r.sfra) #define EFRA (G.scene->r.efra) +#define STFRA (G.scene->frame_step) #define PSFRA ((G.scene->r.psfra != 0)? (G.scene->r.psfra): (G.scene->r.sfra)) #define PEFRA ((G.scene->r.psfra != 0)? (G.scene->r.pefra): (G.scene->r.efra)) #define FRA2TIME(a) ((((double) G.scene->r.frs_sec_base) * (a)) / G.scene->r.frs_sec) @@ -127,6 +128,10 @@ /* for curve objects in editmode that can have hidden handles - may use for IPO's later */ #define BEZSELECTED_HIDDENHANDLES(bezt) ((G.f & G_HIDDENHANDLES) ? (bezt)->f2 & SELECT : BEZSELECTED(bezt)) +#define BEZ_SEL(bezt) { (bezt)->f1 |= SELECT; (bezt)->f2 |= SELECT; (bezt)->f3 |= SELECT; } +#define BEZ_DESEL(bezt) { (bezt)->f1 &= ~SELECT; (bezt)->f2 &= ~SELECT; (bezt)->f3 &= ~SELECT; } +#define BEZ_INVSEL(bezt) { (bezt)->f1 ^= SELECT; (bezt)->f2 ^= SELECT; (bezt)->f3 ^= SELECT; } + /* psfont */ #define FNT_PDRAW 1 #define FNT_HAEBERLI 2 diff --git a/source/blender/makesdna/DNA_curve_types.h b/source/blender/makesdna/DNA_curve_types.h index a4fb8dc1150..3722c365f39 100644 --- a/source/blender/makesdna/DNA_curve_types.h +++ b/source/blender/makesdna/DNA_curve_types.h @@ -187,37 +187,6 @@ typedef struct Curve { struct CharInfo curinfo; } Curve; -typedef struct IpoDriver { - struct Object *ob; - short blocktype, adrcode, type, flag; - char name[128]; /* bone or constraint(?), or python expression here */ -} IpoDriver; - -/* temp? we store more bone names in 1 driver... */ -#define DRIVER_NAME_OFFS 32 - -typedef struct IpoCurve { - struct IpoCurve *next, *prev; - - struct BPoint *bp; /* are these even used anywhere? */ - struct BezTriple *bezt; /* array of BezTriples (sizeof(BezTriple)*totvert. i.e. keyframes */ - - rctf maxrct, totrct; /* bounding boxes */ - - short blocktype, adrcode, vartype; /* blocktype= ipo-blocktype; adrcode= type of ipo-curve; vartype= 'format' of data */ - short totvert; /* total number of BezTriples (i.e. keyframes) on curve */ - short ipo, extrap; /* interpolation and extrapolation modes */ - short flag, rt; /* flag= settings; rt= ??? */ - float ymin, ymax; /* minimum/maximum y-extents for curve */ - unsigned int bitmask; /* ??? */ - - float slide_min, slide_max; /* minimum/maximum values for sliders (in action editor) */ - float curval; /* value of ipo-curve for current frame */ - - IpoDriver *driver; /* pointer to ipo-driver for this curve */ - -} IpoCurve; - /* **************** CURVE ********************* */ /* texflag */ @@ -273,15 +242,5 @@ typedef struct IpoCurve { #define CU_UNDERLINE 4 #define CU_WRAP 8 /* wordwrap occured here */ -/* *************** driver ****************** */ - -/* driver->type */ -#define IPO_DRIVER_TYPE_NORMAL 0 -#define IPO_DRIVER_TYPE_PYTHON 1 - -/* driver->flag */ -/* invalid flag: currently only used for buggy pydriver expressions: */ -#define IPO_DRIVER_FLAG_INVALID 1 - #endif diff --git a/source/blender/makesdna/DNA_ipo_types.h b/source/blender/makesdna/DNA_ipo_types.h index f517bf14733..5be6dd727c0 100644 --- a/source/blender/makesdna/DNA_ipo_types.h +++ b/source/blender/makesdna/DNA_ipo_types.h @@ -24,7 +24,7 @@ * * The Original Code is: all of this file. * - * Contributor(s): none yet. + * Contributor(s): Joshua Leung * * ***** END GPL LICENSE BLOCK ***** */ @@ -32,10 +32,54 @@ #define DNA_IPO_TYPES_H #include "DNA_listBase.h" +#include "DNA_curve_types.h" #include "DNA_vec_types.h" #include "DNA_ID.h" +/* -------------------------- Type Defines --------------------------- */ + +/* sometimes used - mainly for GE/Ketsji */ +typedef short IPO_Channel; + + +/* --- IPO Curve Driver --- */ + +/* IPO Curve Driver */ +typedef struct IpoDriver { + struct Object *ob; /* target/driver ob */ + short blocktype, adrcode; /* sub-channel to use */ + + short type, flag; /* driver settings */ + char name[128]; /* bone, or python expression here */ +} IpoDriver; + +/* --- IPO Curve --- */ + +/* IPO Curve */ +typedef struct IpoCurve { + struct IpoCurve *next, *prev; + + struct BPoint *bp; /* array of BPoints (sizeof(BPoint)*totvert) - i.e. baked/imported data */ + struct BezTriple *bezt; /* array of BezTriples (sizeof(BezTriple)*totvert) - i.e. user-editable keyframes */ + + rctf maxrct, totrct; /* bounding boxes */ + + short blocktype, adrcode, vartype; /* blocktype= ipo-blocktype; adrcode= type of ipo-curve; vartype= 'format' of data */ + short totvert; /* total number of BezTriples (i.e. keyframes) on curve */ + short ipo, extrap; /* interpolation and extrapolation modes */ + short flag, rt; /* flag= settings; rt= ??? */ + float ymin, ymax; /* minimum/maximum y-extents for curve */ + unsigned int bitmask; /* ??? */ + + float slide_min, slide_max; /* minimum/maximum values for sliders (in action editor) */ + float curval; /* value of ipo-curve for current frame */ + + IpoDriver *driver; /* pointer to ipo-driver for this curve */ +} IpoCurve; + +/* --- ID-Datablock --- */ + /* IPO Data-Block */ typedef struct Ipo { ID id; @@ -47,13 +91,9 @@ typedef struct Ipo { short muteipo, pad; /* muteipo: either 0 or 1 (whether ipo block is muted) */ } Ipo; -/* NOTE: IpoCurve struct is defined in DNA_curve_types.h, not in here... */ - -/* sometimes used */ -typedef short IPO_Channel; +/* ----------- adrcodes (for matching ipo-curves to data) ------------- */ /* defines: are these duped or new? */ - #define IPOBUTY 17 #define TOB_IPO 1 @@ -64,7 +104,7 @@ typedef short IPO_Channel; #define IPO_DISPBITS 2 #define IPO_DISPTIME 3 -/* ******************** */ +/* ********** Object (ID_OB) ********** */ #define OB_TOTIPO 30 #define OB_TOTNAM 30 @@ -110,7 +150,7 @@ typedef short IPO_Channel; #define OB_ROT_DIFF 100 -/* ******************** */ +/* ********** Material (ID_MA) ********** */ #define MA_TOTIPO 40 #define MA_TOTNAM 26 @@ -179,7 +219,7 @@ typedef short IPO_Channel; #define MAP_VARF 13 #define MAP_DISP 14 -/* ******************** */ +/* ********** Texture (ID_TE) ********** */ #define TE_TOTIPO 26 #define TE_TOTNAM 26 @@ -216,21 +256,21 @@ typedef short IPO_Channel; #define TE_BRIGHT 25 #define TE_CONTRA 26 -/* ******************** */ +/* ******** Sequence (ID_SEQ) ********** */ #define SEQ_TOTIPO 1 #define SEQ_TOTNAM 1 #define SEQ_FAC1 1 -/* ******************** */ +/* ********* Curve (ID_CU) *********** */ #define CU_TOTIPO 1 #define CU_TOTNAM 1 #define CU_SPEED 1 -/* ******************** */ +/* ********* ShapeKey (ID_KE) *********** */ #define KEY_TOTIPO 64 #define KEY_TOTNAM 64 @@ -238,7 +278,7 @@ typedef short IPO_Channel; #define KEY_SPEED 0 #define KEY_NR 1 -/* ******************** */ +/* ********* World (ID_WO) *********** */ #define WO_TOTIPO 29 #define WO_TOTNAM 16 @@ -263,7 +303,7 @@ typedef short IPO_Channel; #define WO_STARDIST 15 #define WO_STARSIZE 16 -/* ******************** */ +/* ********** Lamp (ID_LA) ********** */ #define LA_TOTIPO 21 #define LA_TOTNAM 10 @@ -279,9 +319,8 @@ typedef short IPO_Channel; #define LA_QUAD2 9 #define LA_HALOINT 10 -/* ******************** */ +/* ********* Camera (ID_CA) ************ */ -/* yafray: totipo & totnam +2 because of added curves */ #define CAM_TOTIPO 7 #define CAM_TOTNAM 7 @@ -296,7 +335,7 @@ typedef short IPO_Channel; #define CAM_SHIFT_X 6 #define CAM_SHIFT_Y 7 -/* ******************** */ +/* ********* Sound (ID_SO) *********** */ #define SND_TOTIPO 4 #define SND_TOTNAM 4 @@ -306,9 +345,9 @@ typedef short IPO_Channel; #define SND_PANNING 3 #define SND_ATTEN 4 -/* ******************** */ +/* ******* PoseChannel (ID_PO) ********* */ -#define AC_TOTIPO 10 /* __NLA */ +#define AC_TOTIPO 10 #define AC_TOTNAM 10 #define AC_LOC_X 1 @@ -324,25 +363,15 @@ typedef short IPO_Channel; #define AC_QUAT_Y 27 #define AC_QUAT_Z 28 -/* ******************** */ -#define CO_TOTIPO 2 /* Constraint Ipos */ +/* ******** Constraint (ID_CO) ********** */ + +#define CO_TOTIPO 2 #define CO_TOTNAM 2 #define CO_ENFORCE 1 #define CO_HEADTAIL 2 -/* -#define CO_TIME 2 -#define CO_OFFSET_X 3 -#define CO_OFFSET_Y 4 -#define CO_OFFSET_Z 5 -#define CO_ORIENT_X 6 -#define CO_ORIENT_Y 7 -#define CO_ORIENT_Z 8 -#define CO_ROLL 9 -*/ -/* ******************** */ -/* fluidsim ipos NT */ +/* ****** FluidSim (ID_FLUIDSIM) ****** */ #define FLUIDSIM_TOTIPO 13 #define FLUIDSIM_TOTNAM 13 @@ -367,6 +396,8 @@ typedef short IPO_Channel; /* ******************** */ /* particle ipos */ + +/* ******* Particle (ID_PA) ******** */ #define PART_TOTIPO 25 #define PART_TOTNAM 25 @@ -403,8 +434,9 @@ typedef short IPO_Channel; #define PART_PD2_FMAXD 25 -/* these are IpoCurve specific */ -/* **************** IPO ********************* */ +/* -------------------- Defines: Flags and Types ------------------ */ + +/* ----- IPO Curve Defines ------- */ /* icu->vartype */ #define IPO_CHAR 0 @@ -414,6 +446,7 @@ typedef short IPO_Channel; #define IPO_FLOAT 4 #define IPO_DOUBLE 5 #define IPO_FLOAT_DEGR 6 + /* very special case, in keys */ #define IPO_BEZTRIPLE 100 #define IPO_BPOINT 101 @@ -428,7 +461,8 @@ typedef short IPO_Channel; #define IPO_CONST 0 #define IPO_LIN 1 #define IPO_BEZ 2 -#define IPO_MIXED 3 /* not used yet */ + /* not used yet */ +#define IPO_MIXED 3 /* icu->extrap */ #define IPO_HORIZ 0 @@ -446,6 +480,19 @@ typedef short IPO_Channel; #define IPO_PROTECT 64 #define IPO_MUTE 128 +/* ---------- IPO Drivers ----------- */ + +/* offset in driver->name for finding second posechannel for rot-diff */ +#define DRIVER_NAME_OFFS 32 + +/* driver->type */ +#define IPO_DRIVER_TYPE_NORMAL 0 +#define IPO_DRIVER_TYPE_PYTHON 1 + +/* driver->flag */ + /* invalid flag: currently only used for buggy pydriver expressions */ +#define IPO_DRIVER_FLAG_INVALID (1<<0) + #endif diff --git a/source/blender/makesdna/DNA_lamp_types.h b/source/blender/makesdna/DNA_lamp_types.h index 2a39580bb5c..bc746e99864 100644 --- a/source/blender/makesdna/DNA_lamp_types.h +++ b/source/blender/makesdna/DNA_lamp_types.h @@ -50,6 +50,7 @@ typedef struct Lamp { short colormodel, totex; float r, g, b, k; + float shdwr, shdwg, shdwb, shdwpad; float energy, dist, spotsize, spotblend; float haint; @@ -138,6 +139,7 @@ typedef struct Lamp { /* Since it is used with LOCAL lamp, can't use LA_SHAD */ #define LA_YF_SOFT 16384 #define LA_LAYER_SHADOW 32768 +#define LA_SHAD_TEX (1<<16) /* layer_shadow */ #define LA_LAYER_SHADOW_BOTH 0 @@ -190,6 +192,7 @@ typedef struct Lamp { /* mapto */ #define LAMAP_COL 1 +#define LAMAP_SHAD 2 #endif /* DNA_LAMP_TYPES_H */ diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h index 32522d1e866..3888cb48520 100644 --- a/source/blender/makesdna/DNA_scene_types.h +++ b/source/blender/makesdna/DNA_scene_types.h @@ -553,6 +553,10 @@ typedef struct Scene { /* Sculptmode data */ struct SculptData sculptdata; + + /* frame step. */ + int frame_step; + int pad; } Scene; diff --git a/source/blender/makesdna/DNA_space_types.h b/source/blender/makesdna/DNA_space_types.h index c59cafc1ef0..226a3ecd834 100644 --- a/source/blender/makesdna/DNA_space_types.h +++ b/source/blender/makesdna/DNA_space_types.h @@ -589,6 +589,7 @@ typedef struct SpaceImaSel { #define SO_LIBRARIES 7 #define SO_VERSE_SESSION 8 #define SO_VERSE_MS 9 +#define SO_SEQUENCE 10 /* SpaceOops->storeflag */ #define SO_TREESTORE_CLEANUP 1 diff --git a/source/blender/python/BPY_extern.h b/source/blender/python/BPY_extern.h index 4b96ef3fdf0..aac3c51b97e 100644 --- a/source/blender/python/BPY_extern.h +++ b/source/blender/python/BPY_extern.h @@ -100,7 +100,7 @@ extern "C" { void BPY_clear_bad_scriptlinks( struct Text *byebye ); int BPY_has_onload_script( void ); - void BPY_do_all_scripts( short event ); + void BPY_do_all_scripts( short event, short anim ); int BPY_check_all_scriptlinks( struct Text *text ); void BPY_do_pyscript( struct ID *id, short event ); void BPY_free_scriptlink( struct ScriptLink *slink ); @@ -112,7 +112,7 @@ extern "C" { int BPY_has_spacehandler(struct Text *text, struct ScrArea *sa); void BPY_screen_free_spacehandlers(struct bScreen *sc); int BPY_do_spacehandlers(struct ScrArea *sa, unsigned short event, - unsigned short space_event); + short eventValue, unsigned short space_event); void BPY_pydriver_update(void); float BPY_pydriver_eval(struct IpoDriver *driver); diff --git a/source/blender/python/BPY_interface.c b/source/blender/python/BPY_interface.c index 041ba069928..31609970f6f 100644 --- a/source/blender/python/BPY_interface.c +++ b/source/blender/python/BPY_interface.c @@ -2163,8 +2163,14 @@ void BPY_clear_bad_scriptlinks( struct Text *byebye ) * For the scene, only the current active scene the scripts are * executed (if any). *****************************************************************************/ -void BPY_do_all_scripts( short event ) +void BPY_do_all_scripts( short event, short anim ) { + /* during stills rendering we disable FRAMECHANGED events */ + static char disable_frame_changed = 0; + + if ((event == SCRIPT_FRAMECHANGED) && disable_frame_changed) + return; + DoAllScriptsFromList( &( G.main->object ), event ); DoAllScriptsFromList( &( G.main->lamp ), event ); DoAllScriptsFromList( &( G.main->camera ), event ); @@ -2180,9 +2186,12 @@ void BPY_do_all_scripts( short event ) * "import sys; sys.setcheckinterval(sys.maxint)" */ if (event == SCRIPT_RENDER) { _Py_CheckInterval = PyInt_GetMax(); + if (!anim) + disable_frame_changed = 1; } else if (event == SCRIPT_POSTRENDER) { _Py_CheckInterval = 100; /* Python default */ + disable_frame_changed = 0; } return; @@ -2466,7 +2475,7 @@ int BPY_add_spacehandler(Text *text, ScrArea *sa, char spacetype) } int BPY_do_spacehandlers( ScrArea *sa, unsigned short event, - unsigned short space_event ) + short eventValue, unsigned short space_event ) { ScriptLink *scriptlink; int retval = 0; @@ -2506,8 +2515,9 @@ int BPY_do_spacehandlers( ScrArea *sa, unsigned short event, PyDict_SetItemString(g_blenderdict, "bylink", Py_True); /* unlike normal scriptlinks, here Blender.link is int (space event type) */ EXPP_dict_set_item_str(g_blenderdict, "link", PyInt_FromLong(space_event)); - /* note: DRAW space_events set event to 0 */ + /* note: DRAW space_events set event and val to 0 */ EXPP_dict_set_item_str(g_blenderdict, "event", PyInt_FromLong(event)); + EXPP_dict_set_item_str(g_blenderdict, "eventValue", PyInt_FromLong(eventValue)); /* now run all assigned space handlers for this space and space_event */ for( index = 0; index < scriptlink->totscript; index++ ) { diff --git a/source/blender/python/api2_2x/Camera.c b/source/blender/python/api2_2x/Camera.c index 87c605ef612..af93a1130cb 100644 --- a/source/blender/python/api2_2x/Camera.c +++ b/source/blender/python/api2_2x/Camera.c @@ -36,6 +36,7 @@ #include "BKE_utildefines.h" #include "BLI_blenlib.h" #include "BLI_arithb.h" /* for M_PI */ +#include "DNA_userdef_types.h" #include "BSE_editipo.h" #include "BIF_keyframing.h" #include "BIF_space.h" @@ -1032,18 +1033,21 @@ static PyObject *Camera_repr( BPy_Camera * self ) static PyObject *Camera_insertIpoKey( BPy_Camera * self, PyObject * args ) { - int key = 0; + int key = 0, flag = 0; if( !PyArg_ParseTuple( args, "i", &( key ) ) ) return ( EXPP_ReturnPyObjError( PyExc_AttributeError, "expected int argument" ) ); - + + /* flag should be initialised with the 'autokeying' flags like for normal keying */ + if (IS_AUTOKEY_FLAG(INSERTNEEDED)) flag |= INSERTKEY_NEEDED; + if (key == IPOKEY_LENS){ - insertkey((ID *)self->camera, ID_CA, NULL, NULL, CAM_LENS, 0); + insertkey((ID *)self->camera, ID_CA, NULL, NULL, CAM_LENS, flag); } else if (key == IPOKEY_CLIPPING){ - insertkey((ID *)self->camera, ID_CA, NULL, NULL, CAM_STA, 0); - insertkey((ID *)self->camera, ID_CA, NULL, NULL, CAM_END, 0); + insertkey((ID *)self->camera, ID_CA, NULL, NULL, CAM_STA, flag); + insertkey((ID *)self->camera, ID_CA, NULL, NULL, CAM_END, flag); } allspace(REMAKEIPO, 0); diff --git a/source/blender/python/api2_2x/Ipocurve.h b/source/blender/python/api2_2x/Ipocurve.h index 8263bf2022f..6f474d4d167 100644 --- a/source/blender/python/api2_2x/Ipocurve.h +++ b/source/blender/python/api2_2x/Ipocurve.h @@ -31,7 +31,7 @@ #define EXPP_IPOCURVE_H #include <Python.h> -#include "DNA_curve_types.h" /* declaration of IpoCurve */ +#include "DNA_ipo_types.h" /* declaration of IpoCurve */ /*****************************************************************************/ /* Python C_IpoCurve structure definition: */ diff --git a/source/blender/python/api2_2x/Lamp.c b/source/blender/python/api2_2x/Lamp.c index 38968b64cf5..799833d4ee0 100644 --- a/source/blender/python/api2_2x/Lamp.c +++ b/source/blender/python/api2_2x/Lamp.c @@ -46,6 +46,7 @@ #include "gen_utils.h" #include "gen_library.h" #include "BKE_utildefines.h" +#include "DNA_userdef_types.h" #include "MEM_guardedalloc.h" /*****************************************************************************/ @@ -1336,7 +1337,7 @@ static int Lamp_setIpo( BPy_Lamp * self, PyObject * value ) static PyObject *Lamp_insertIpoKey( BPy_Lamp * self, PyObject * args ) { - int key = 0, map; + int key = 0, flag = 0, map; if( !PyArg_ParseTuple( args, "i", &( key ) ) ) return ( EXPP_ReturnPyObjError( PyExc_AttributeError, @@ -1344,26 +1345,29 @@ static PyObject *Lamp_insertIpoKey( BPy_Lamp * self, PyObject * args ) map = texchannel_to_adrcode(self->lamp->texact); + /* flag should be initialised with the 'autokeying' flags like for normal keying */ + if (IS_AUTOKEY_FLAG(INSERTNEEDED)) flag |= INSERTKEY_NEEDED; + if (key == IPOKEY_RGB ) { - insertkey((ID *)self->lamp, ID_LA, NULL, NULL, LA_COL_R, 0); - insertkey((ID *)self->lamp, ID_LA, NULL, NULL,LA_COL_G, 0); - insertkey((ID *)self->lamp, ID_LA, NULL, NULL,LA_COL_B, 0); + insertkey((ID *)self->lamp, ID_LA, NULL, NULL, LA_COL_R, flag); + insertkey((ID *)self->lamp, ID_LA, NULL, NULL,LA_COL_G, flag); + insertkey((ID *)self->lamp, ID_LA, NULL, NULL,LA_COL_B, flag); } if (key == IPOKEY_ENERGY ) { - insertkey((ID *)self->lamp, ID_LA, NULL, NULL,LA_ENERGY, 0); + insertkey((ID *)self->lamp, ID_LA, NULL, NULL,LA_ENERGY, flag); } if (key == IPOKEY_SPOTSIZE ) { - insertkey((ID *)self->lamp, ID_LA, NULL, NULL,LA_SPOTSI, 0); + insertkey((ID *)self->lamp, ID_LA, NULL, NULL,LA_SPOTSI, flag); } if (key == IPOKEY_OFFSET ) { - insertkey((ID *)self->lamp, ID_LA, NULL, NULL, map+MAP_OFS_X, 0); - insertkey((ID *)self->lamp, ID_LA, NULL, NULL, map+MAP_OFS_Y, 0); - insertkey((ID *)self->lamp, ID_LA, NULL, NULL, map+MAP_OFS_Z, 0); + insertkey((ID *)self->lamp, ID_LA, NULL, NULL, map+MAP_OFS_X, flag); + insertkey((ID *)self->lamp, ID_LA, NULL, NULL, map+MAP_OFS_Y, flag); + insertkey((ID *)self->lamp, ID_LA, NULL, NULL, map+MAP_OFS_Z, flag); } if (key == IPOKEY_SIZE ) { - insertkey((ID *)self->lamp, ID_LA, NULL, NULL, map+MAP_SIZE_X, 0); - insertkey((ID *)self->lamp, ID_LA, NULL, NULL, map+MAP_SIZE_Y, 0); - insertkey((ID *)self->lamp, ID_LA, NULL, NULL, map+MAP_SIZE_Z, 0); + insertkey((ID *)self->lamp, ID_LA, NULL, NULL, map+MAP_SIZE_X, flag); + insertkey((ID *)self->lamp, ID_LA, NULL, NULL, map+MAP_SIZE_Y, flag); + insertkey((ID *)self->lamp, ID_LA, NULL, NULL, map+MAP_SIZE_Z, flag); } allspace(REMAKEIPO, 0); diff --git a/source/blender/python/api2_2x/Material.c b/source/blender/python/api2_2x/Material.c index b118bdb30e7..d3bb6c8d158 100644 --- a/source/blender/python/api2_2x/Material.c +++ b/source/blender/python/api2_2x/Material.c @@ -32,6 +32,7 @@ #include "DNA_space_types.h" #include "DNA_material_types.h" +#include "DNA_userdef_types.h" #include "BKE_main.h" #include "BKE_global.h" #include "BKE_library.h" @@ -1873,7 +1874,7 @@ static int Material_setIpo( BPy_Material * self, PyObject * value ) static PyObject *Material_insertIpoKey( BPy_Material * self, PyObject * args ) { - int key = 0, map; + int key = 0, flag = 0, map; if( !PyArg_ParseTuple( args, "i", &( key ) ) ) return ( EXPP_ReturnPyObjError( PyExc_AttributeError, @@ -1881,59 +1882,62 @@ static PyObject *Material_insertIpoKey( BPy_Material * self, PyObject * args ) map = texchannel_to_adrcode(self->material->texact); + /* flag should be initialised with the 'autokeying' flags like for normal keying */ + if (IS_AUTOKEY_FLAG(INSERTNEEDED)) flag |= INSERTKEY_NEEDED; + if(key==IPOKEY_RGB || key==IPOKEY_ALLCOLOR) { - insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_COL_R, 0); - insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_COL_G, 0); - insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_COL_B, 0); + insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_COL_R, flag); + insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_COL_G, flag); + insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_COL_B, flag); } if(key==IPOKEY_ALPHA || key==IPOKEY_ALLCOLOR) { - insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_ALPHA, 0); + insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_ALPHA, flag); } if(key==IPOKEY_HALOSIZE || key==IPOKEY_ALLCOLOR) { - insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_HASIZE, 0); + insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_HASIZE, flag); } if(key==IPOKEY_MODE || key==IPOKEY_ALLCOLOR) { - insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_MODE, 0); + insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_MODE, flag); } if(key==IPOKEY_ALLCOLOR) { - insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_SPEC_R, 0); - insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_SPEC_G, 0); - insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_SPEC_B, 0); - insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_REF, 0); - insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_EMIT, 0); - insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_AMB, 0); - insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_SPEC, 0); - insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_HARD, 0); - insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_MODE, 0); - insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_TRANSLU, 0); - insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_ADD, 0); + insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_SPEC_R, flag); + insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_SPEC_G, flag); + insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_SPEC_B, flag); + insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_REF, flag); + insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_EMIT, flag); + insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_AMB, flag); + insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_SPEC, flag); + insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_HARD, flag); + insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_MODE, flag); + insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_TRANSLU, flag); + insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_ADD, flag); } if(key==IPOKEY_ALLMIRROR) { - insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_RAYM, 0); - insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_FRESMIR, 0); - insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_FRESMIRI, 0); - insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_FRESTRA, 0); - insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_FRESTRAI, 0); + insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_RAYM, flag); + insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_FRESMIR, flag); + insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_FRESMIRI, flag); + insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_FRESTRA, flag); + insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_FRESTRAI, flag); } if(key==IPOKEY_OFS || key==IPOKEY_ALLMAPPING) { - insertkey((ID *)self->material, ID_MA, NULL, NULL, map+MAP_OFS_X, 0); - insertkey((ID *)self->material, ID_MA, NULL, NULL, map+MAP_OFS_Y, 0); - insertkey((ID *)self->material, ID_MA, NULL, NULL, map+MAP_OFS_Z, 0); + insertkey((ID *)self->material, ID_MA, NULL, NULL, map+MAP_OFS_X, flag); + insertkey((ID *)self->material, ID_MA, NULL, NULL, map+MAP_OFS_Y, flag); + insertkey((ID *)self->material, ID_MA, NULL, NULL, map+MAP_OFS_Z, flag); } if(key==IPOKEY_SIZE || key==IPOKEY_ALLMAPPING) { - insertkey((ID *)self->material, ID_MA, NULL, NULL, map+MAP_SIZE_X, 0); - insertkey((ID *)self->material, ID_MA, NULL, NULL, map+MAP_SIZE_Y, 0); - insertkey((ID *)self->material, ID_MA, NULL, NULL, map+MAP_SIZE_Z, 0); + insertkey((ID *)self->material, ID_MA, NULL, NULL, map+MAP_SIZE_X, flag); + insertkey((ID *)self->material, ID_MA, NULL, NULL, map+MAP_SIZE_Y, flag); + insertkey((ID *)self->material, ID_MA, NULL, NULL, map+MAP_SIZE_Z, flag); } if(key==IPOKEY_ALLMAPPING) { - insertkey((ID *)self->material, ID_MA, NULL, NULL, map+MAP_R, 0); - insertkey((ID *)self->material, ID_MA, NULL, NULL, map+MAP_G, 0); - insertkey((ID *)self->material, ID_MA, NULL, NULL, map+MAP_B, 0); - insertkey((ID *)self->material, ID_MA, NULL, NULL, map+MAP_DVAR, 0); - insertkey((ID *)self->material, ID_MA, NULL, NULL, map+MAP_COLF, 0); - insertkey((ID *)self->material, ID_MA, NULL, NULL, map+MAP_NORF, 0); - insertkey((ID *)self->material, ID_MA, NULL, NULL, map+MAP_VARF, 0); - insertkey((ID *)self->material, ID_MA, NULL, NULL, map+MAP_DISP, 0); + insertkey((ID *)self->material, ID_MA, NULL, NULL, map+MAP_R, flag); + insertkey((ID *)self->material, ID_MA, NULL, NULL, map+MAP_G, flag); + insertkey((ID *)self->material, ID_MA, NULL, NULL, map+MAP_B, flag); + insertkey((ID *)self->material, ID_MA, NULL, NULL, map+MAP_DVAR, flag); + insertkey((ID *)self->material, ID_MA, NULL, NULL, map+MAP_COLF, flag); + insertkey((ID *)self->material, ID_MA, NULL, NULL, map+MAP_NORF, flag); + insertkey((ID *)self->material, ID_MA, NULL, NULL, map+MAP_VARF, flag); + insertkey((ID *)self->material, ID_MA, NULL, NULL, map+MAP_DISP, flag); } allspace(REMAKEIPO, 0); diff --git a/source/blender/python/api2_2x/Object.c b/source/blender/python/api2_2x/Object.c index 0d5af06377c..1e5445cbd80 100644 --- a/source/blender/python/api2_2x/Object.c +++ b/source/blender/python/api2_2x/Object.c @@ -2568,7 +2568,7 @@ static int Object_setMatrix( BPy_Object * self, MatrixObject * mat ) static PyObject *Object_insertIpoKey( BPy_Object * self, PyObject * args ) { Object *ob= self->object; - int key = 0; + int key = 0, flag = 0; char *actname= NULL; if( !PyArg_ParseTuple( args, "i", &key ) ) @@ -2578,35 +2578,39 @@ static PyObject *Object_insertIpoKey( BPy_Object * self, PyObject * args ) if(ob->ipoflag & OB_ACTION_OB) actname= "Object"; + /* flag should be initialised with the 'autokeying' flags like for normal keying */ + if (IS_AUTOKEY_FLAG(AUTOMATKEY)) flag |= INSERTKEY_MATRIX; + if (IS_AUTOKEY_FLAG(INSERTNEEDED)) flag |= INSERTKEY_NEEDED; + if (key == IPOKEY_LOC || key == IPOKEY_LOCROT || key == IPOKEY_LOCROTSIZE){ - insertkey((ID *)ob, ID_OB, actname, NULL,OB_LOC_X, 0); - insertkey((ID *)ob, ID_OB, actname, NULL,OB_LOC_Y, 0); - insertkey((ID *)ob, ID_OB, actname, NULL,OB_LOC_Z, 0); + insertkey((ID *)ob, ID_OB, actname, NULL,OB_LOC_X, flag); + insertkey((ID *)ob, ID_OB, actname, NULL,OB_LOC_Y, flag); + insertkey((ID *)ob, ID_OB, actname, NULL,OB_LOC_Z, flag); } if (key == IPOKEY_ROT || key == IPOKEY_LOCROT || key == IPOKEY_LOCROTSIZE){ - insertkey((ID *)ob, ID_OB, actname, NULL,OB_ROT_X, 0); - insertkey((ID *)ob, ID_OB, actname, NULL,OB_ROT_Y, 0); - insertkey((ID *)ob, ID_OB, actname, NULL,OB_ROT_Z, 0); + insertkey((ID *)ob, ID_OB, actname, NULL,OB_ROT_X, flag); + insertkey((ID *)ob, ID_OB, actname, NULL,OB_ROT_Y, flag); + insertkey((ID *)ob, ID_OB, actname, NULL,OB_ROT_Z, flag); } if (key == IPOKEY_SIZE || key == IPOKEY_LOCROTSIZE ){ - insertkey((ID *)ob, ID_OB, actname, NULL,OB_SIZE_X, 0); - insertkey((ID *)ob, ID_OB, actname, NULL,OB_SIZE_Y, 0); - insertkey((ID *)ob, ID_OB, actname, NULL,OB_SIZE_Z, 0); + insertkey((ID *)ob, ID_OB, actname, NULL,OB_SIZE_X, flag); + insertkey((ID *)ob, ID_OB, actname, NULL,OB_SIZE_Y, flag); + insertkey((ID *)ob, ID_OB, actname, NULL,OB_SIZE_Z, flag); } if (key == IPOKEY_LAYER ){ - insertkey((ID *)ob, ID_OB, actname, NULL,OB_LAY, 0); + insertkey((ID *)ob, ID_OB, actname, NULL,OB_LAY, flag); } if (key == IPOKEY_PI_STRENGTH ){ - insertkey((ID *)ob, ID_OB, actname, NULL, OB_PD_FSTR, 0); + insertkey((ID *)ob, ID_OB, actname, NULL, OB_PD_FSTR, flag); } else if (key == IPOKEY_PI_FALLOFF ){ - insertkey((ID *)ob, ID_OB, actname, NULL, OB_PD_FFALL, 0); + insertkey((ID *)ob, ID_OB, actname, NULL, OB_PD_FFALL, flag); } else if (key == IPOKEY_PI_SURFACEDAMP ){ - insertkey((ID *)ob, ID_OB, actname, NULL, OB_PD_SDAMP, 0); + insertkey((ID *)ob, ID_OB, actname, NULL, OB_PD_SDAMP, flag); } else if (key == IPOKEY_PI_RANDOMDAMP ){ - insertkey((ID *)ob, ID_OB, actname, NULL, OB_PD_RDAMP, 0); + insertkey((ID *)ob, ID_OB, actname, NULL, OB_PD_RDAMP, flag); } else if (key == IPOKEY_PI_PERM ){ - insertkey((ID *)ob, ID_OB, actname, NULL, OB_PD_PERM, 0); + insertkey((ID *)ob, ID_OB, actname, NULL, OB_PD_PERM, flag); } allspace(REMAKEIPO, 0); @@ -2630,6 +2634,7 @@ static PyObject *Object_insertPoseKey( BPy_Object * self, PyObject * args ) BPy_Action *sourceact; char *chanName; int actframe; + int flag=0; /* for doing the time trick, similar to editaction bake_action_with_client() */ @@ -2648,17 +2653,21 @@ static PyObject *Object_insertPoseKey( BPy_Object * self, PyObject * args ) /* XXX: must check chanName actually exists, otherwise segfaults! */ //achan = get_action_channel(sourceact->action, chanName); - - insertkey(&ob->id, ID_PO, chanName, NULL, AC_LOC_X, 0); - insertkey(&ob->id, ID_PO, chanName, NULL, AC_LOC_Y, 0); - insertkey(&ob->id, ID_PO, chanName, NULL, AC_LOC_Z, 0); - insertkey(&ob->id, ID_PO, chanName, NULL, AC_QUAT_X, 0); - insertkey(&ob->id, ID_PO, chanName, NULL, AC_QUAT_Y, 0); - insertkey(&ob->id, ID_PO, chanName, NULL, AC_QUAT_Z, 0); - insertkey(&ob->id, ID_PO, chanName, NULL, AC_QUAT_W, 0); - insertkey(&ob->id, ID_PO, chanName, NULL, AC_SIZE_X, 0); - insertkey(&ob->id, ID_PO, chanName, NULL, AC_SIZE_Y, 0); - insertkey(&ob->id, ID_PO, chanName, NULL, AC_SIZE_Z, 0); + + /* flag should be initialised with the 'autokeying' flags like for normal keying */ + if (IS_AUTOKEY_FLAG(AUTOMATKEY)) flag |= INSERTKEY_MATRIX; + if (IS_AUTOKEY_FLAG(INSERTNEEDED)) flag |= INSERTKEY_NEEDED; + + insertkey(&ob->id, ID_PO, chanName, NULL, AC_LOC_X, flag); + insertkey(&ob->id, ID_PO, chanName, NULL, AC_LOC_Y, flag); + insertkey(&ob->id, ID_PO, chanName, NULL, AC_LOC_Z, flag); + insertkey(&ob->id, ID_PO, chanName, NULL, AC_QUAT_X, flag); + insertkey(&ob->id, ID_PO, chanName, NULL, AC_QUAT_Y, flag); + insertkey(&ob->id, ID_PO, chanName, NULL, AC_QUAT_Z, flag); + insertkey(&ob->id, ID_PO, chanName, NULL, AC_QUAT_W, flag); + insertkey(&ob->id, ID_PO, chanName, NULL, AC_SIZE_X, flag); + insertkey(&ob->id, ID_PO, chanName, NULL, AC_SIZE_Y, flag); + insertkey(&ob->id, ID_PO, chanName, NULL, AC_SIZE_Z, flag); G.scene->r.cfra = oldframe; @@ -2680,6 +2689,7 @@ static PyObject *Object_insertPoseKey( BPy_Object * self, PyObject * args ) static PyObject *Object_insertCurrentPoseKey( BPy_Object * self, PyObject * args ) { Object *ob= self->object; + int flag = 0; char *chanName; /* for doing the time trick, similar to editaction bake_action_with_client() */ @@ -2695,16 +2705,20 @@ static PyObject *Object_insertCurrentPoseKey( BPy_Object * self, PyObject * args /* XXX: must check chanName actually exists, otherwise segfaults! */ - insertkey(&ob->id, ID_PO, chanName, NULL, AC_LOC_X, 0); - insertkey(&ob->id, ID_PO, chanName, NULL, AC_LOC_Y, 0); - insertkey(&ob->id, ID_PO, chanName, NULL, AC_LOC_Z, 0); - insertkey(&ob->id, ID_PO, chanName, NULL, AC_QUAT_X, 0); - insertkey(&ob->id, ID_PO, chanName, NULL, AC_QUAT_Y, 0); - insertkey(&ob->id, ID_PO, chanName, NULL, AC_QUAT_Z, 0); - insertkey(&ob->id, ID_PO, chanName, NULL, AC_QUAT_W, 0); - insertkey(&ob->id, ID_PO, chanName, NULL, AC_SIZE_X, 0); - insertkey(&ob->id, ID_PO, chanName, NULL, AC_SIZE_Y, 0); - insertkey(&ob->id, ID_PO, chanName, NULL, AC_SIZE_Z, 0); + /* flag should be initialised with the 'autokeying' flags like for normal keying */ + if (IS_AUTOKEY_FLAG(AUTOMATKEY)) flag |= INSERTKEY_MATRIX; + if (IS_AUTOKEY_FLAG(INSERTNEEDED)) flag |= INSERTKEY_NEEDED; + + insertkey(&ob->id, ID_PO, chanName, NULL, AC_LOC_X, flag); + insertkey(&ob->id, ID_PO, chanName, NULL, AC_LOC_Y, flag); + insertkey(&ob->id, ID_PO, chanName, NULL, AC_LOC_Z, flag); + insertkey(&ob->id, ID_PO, chanName, NULL, AC_QUAT_X, flag); + insertkey(&ob->id, ID_PO, chanName, NULL, AC_QUAT_Y, flag); + insertkey(&ob->id, ID_PO, chanName, NULL, AC_QUAT_Z, flag); + insertkey(&ob->id, ID_PO, chanName, NULL, AC_QUAT_W, flag); + insertkey(&ob->id, ID_PO, chanName, NULL, AC_SIZE_X, flag); + insertkey(&ob->id, ID_PO, chanName, NULL, AC_SIZE_Y, flag); + insertkey(&ob->id, ID_PO, chanName, NULL, AC_SIZE_Z, flag); G.scene->r.cfra = oldframe; @@ -2988,7 +3002,7 @@ static PyObject *Object_getProperty( BPy_Object * self, PyObject * args ) return EXPP_ReturnPyObjError( PyExc_TypeError, "expected a string" ); - prop = get_property( self->object, prop_name ); + prop = get_ob_property( self->object, prop_name ); if( prop ) return Property_CreatePyObject( prop ); @@ -3004,7 +3018,7 @@ static PyObject *Object_addProperty( BPy_Object * self, PyObject * args ) char *prop_type = NULL; short type = -1; BPy_Property *py_prop = NULL; - int argslen = PyObject_Length( args ); + int argslen = PyTuple_Size( args ); if( argslen == 3 || argslen == 2 ) { if( !PyArg_ParseTuple( args, "sO|s", &prop_name, &prop_data, @@ -3115,7 +3129,7 @@ static PyObject *Object_removeProperty( BPy_Object * self, PyObject * args ) py_prop->property = NULL; } } else { - prop = get_property( self->object, prop_name ); + prop = get_ob_property( self->object, prop_name ); if( prop ) { BLI_remlink( &self->object->prop, prop ); free_property( prop ); @@ -3134,18 +3148,23 @@ static PyObject *Object_copyAllPropertiesTo( BPy_Object * self, PyObject * args ) { PyObject *dest; + Object *dest_ob; bProperty *prop = NULL; bProperty *propn = NULL; if( !PyArg_ParseTuple( args, "O!", &Object_Type, &dest ) ) return EXPP_ReturnPyObjError( PyExc_TypeError, "expected an Object" ); - + + if (dest == (PyObject *)self) { + Py_RETURN_NONE; + } + dest_ob = ( ( BPy_Object * ) dest )->object; + /*make a copy of all its properties*/ prop = self->object->prop.first; while( prop ) { - propn = copy_property( prop ); - BLI_addtail( &( ( BPy_Object * ) dest )->object->prop, propn ); + set_ob_property( dest_ob, prop ); prop = prop->next; } @@ -3305,6 +3324,33 @@ static PyObject *Object_insertShapeKey(BPy_Object * self) Py_RETURN_NONE; } +static PyObject *Object_getColor( BPy_Object *self, void *type ) +{ + return Py_BuildValue( "(ffff)", self->object->col[0], self->object->col[1], self->object->col[2], self->object->col[3] ); +} + +static int Object_setColor( BPy_Object *self, PyObject *value ) +{ + int i; + float color[4]; + struct Object *object = self->object; + + value = PySequence_Tuple( value ); + + if( !value || !PyArg_ParseTuple( value, "ffff", &color[0], &color[1], &color[2], &color[3] ) ) { + Py_XDECREF( value ); + return EXPP_ReturnIntError( PyExc_TypeError, + "expected a list or tuple of 3 floats" ); + } + + Py_DECREF( value ); + + for( i = 0; i < 4; ++i ) { + object->col[i] = MAX2(MIN2(color[i], 1.0), 0); + } + return 0; +} + /* __copy__() */ static PyObject *Object_copy(BPy_Object * self) { @@ -5189,7 +5235,10 @@ static PyGetSetDef BPy_Object_getseters[] = { (getter)Object_getDrawModeBits, (setter)Object_setDrawModeBits, "Transparent materials for the active object (mesh only) enabled", (void *)OB_DRAWTRANSP}, - + {"color", + (getter)Object_getColor, (setter)Object_setColor, + "Object color used by the game engine and optionally for materials", + NULL}, {"enableNLAOverride", (getter)Object_getNLAflagBits, (setter)Object_setNLAflagBits, "Toggles Action-NLA based animation", diff --git a/source/blender/python/api2_2x/Pose.c b/source/blender/python/api2_2x/Pose.c index 52ede1cb3ee..06d736f2cb6 100644 --- a/source/blender/python/api2_2x/Pose.c +++ b/source/blender/python/api2_2x/Pose.c @@ -414,16 +414,17 @@ static PyObject *PoseBone_insertKey(BPy_PoseBone *self, PyObject *args) { PyObject *parent_object = NULL; PyObject *constants = NULL, *item = NULL; - int frame = 1, oldframe, length, x, numeric_value = 0, oldflag, no_ipo_update = 0; + int frame = 1, oldframe, length, x, numeric_value = 0, oldflag, no_ipo_update = 0, flag = 0; bPoseChannel *pchan = NULL; if (!PyArg_ParseTuple(args, "O!i|Oi", &Object_Type, &parent_object, &frame, &constants, &no_ipo_update )) goto AttributeError; - /* incase we ever have a value other then 1 for fast */ - if (no_ipo_update) - no_ipo_update = 1; + /* flag should be initialised with the 'autokeying' flags like for normal keying */ + if (no_ipo_update) flag |= INSERTKEY_FAST; + if (IS_AUTOKEY_FLAG(AUTOMATKEY)) flag |= INSERTKEY_MATRIX; + if (IS_AUTOKEY_FLAG(INSERTNEEDED)) flag |= INSERTKEY_NEEDED; //verify that this pchannel is part of the object->pose for (pchan = ((BPy_Object*)parent_object)->object->pose->chanbase.first; @@ -493,29 +494,29 @@ static PyObject *PoseBone_insertKey(BPy_PoseBone *self, PyObject *args) //insert the pose keys if (self->posechannel->flag & POSE_ROT){ insertkey(&((BPy_Object*)parent_object)->object->id, - ID_PO, self->posechannel->name, NULL, AC_QUAT_X, no_ipo_update); + ID_PO, self->posechannel->name, NULL, AC_QUAT_X, flag); insertkey(&((BPy_Object*)parent_object)->object->id, - ID_PO, self->posechannel->name, NULL, AC_QUAT_Y, no_ipo_update); + ID_PO, self->posechannel->name, NULL, AC_QUAT_Y, flag); insertkey(&((BPy_Object*)parent_object)->object->id, - ID_PO, self->posechannel->name, NULL, AC_QUAT_Z, no_ipo_update); + ID_PO, self->posechannel->name, NULL, AC_QUAT_Z, flag); insertkey(&((BPy_Object*)parent_object)->object->id, - ID_PO, self->posechannel->name, NULL, AC_QUAT_W, no_ipo_update); + ID_PO, self->posechannel->name, NULL, AC_QUAT_W, flag); } if (self->posechannel->flag & POSE_LOC){ insertkey(&((BPy_Object*)parent_object)->object->id, - ID_PO, self->posechannel->name, NULL, AC_LOC_X, no_ipo_update); + ID_PO, self->posechannel->name, NULL, AC_LOC_X, flag); insertkey(&((BPy_Object*)parent_object)->object->id, - ID_PO, self->posechannel->name, NULL, AC_LOC_Y, no_ipo_update); + ID_PO, self->posechannel->name, NULL, AC_LOC_Y, flag); insertkey(&((BPy_Object*)parent_object)->object->id, - ID_PO, self->posechannel->name, NULL, AC_LOC_Z, no_ipo_update); + ID_PO, self->posechannel->name, NULL, AC_LOC_Z, flag); } if (self->posechannel->flag & POSE_SIZE){ insertkey(&((BPy_Object*)parent_object)->object->id, - ID_PO, self->posechannel->name, NULL, AC_SIZE_X, no_ipo_update); + ID_PO, self->posechannel->name, NULL, AC_SIZE_X, flag); insertkey(&((BPy_Object*)parent_object)->object->id, - ID_PO, self->posechannel->name, NULL, AC_SIZE_Y, no_ipo_update); + ID_PO, self->posechannel->name, NULL, AC_SIZE_Y, flag); insertkey(&((BPy_Object*)parent_object)->object->id, - ID_PO, self->posechannel->name, NULL, AC_SIZE_Z, no_ipo_update); + ID_PO, self->posechannel->name, NULL, AC_SIZE_Z, flag); } //flip the frame back diff --git a/source/blender/python/api2_2x/Scene.c b/source/blender/python/api2_2x/Scene.c index eba951b8813..662656663c1 100644 --- a/source/blender/python/api2_2x/Scene.c +++ b/source/blender/python/api2_2x/Scene.c @@ -641,20 +641,18 @@ static PyObject *M_Scene_Get( PyObject * self, PyObject * args ) if( !PyArg_ParseTuple( args, "|s", &name ) ) return ( EXPP_ReturnPyObjError( PyExc_TypeError, "expected string argument (or nothing)" ) ); - + scene_iter = G.main->scene.first; if( name ) { /* (name) - Search scene by name */ PyObject *wanted_scene = NULL; - while( ( scene_iter ) && ( wanted_scene == NULL ) ) { - - if( strcmp( name, scene_iter->id.name + 2 ) == 0 ) - wanted_scene = - Scene_CreatePyObject( scene_iter ); - - scene_iter = scene_iter->id.next; + for(;scene_iter; scene_iter = scene_iter->id.next) { + if( strcmp( name, scene_iter->id.name + 2 ) == 0 ) { + wanted_scene = Scene_CreatePyObject( scene_iter ); + break; + } } if( wanted_scene == NULL ) { /* Requested scene doesn't exist */ @@ -678,19 +676,14 @@ static PyObject *M_Scene_Get( PyObject * self, PyObject * args ) return ( EXPP_ReturnPyObjError( PyExc_MemoryError, "couldn't create PyList" ) ); - while( scene_iter ) { + for(; scene_iter; scene_iter = scene_iter->id.next, index++) { pyobj = Scene_CreatePyObject( scene_iter ); if( !pyobj ) { Py_DECREF(sce_pylist); - return ( EXPP_ReturnPyObjError - ( PyExc_MemoryError, - "couldn't create PyString" ) ); + return NULL; /* Scene_CreatePyObject sets an error */ } PyList_SET_ITEM( sce_pylist, index, pyobj ); - - scene_iter = scene_iter->id.next; - index++; } return sce_pylist; diff --git a/source/blender/python/api2_2x/Text.c b/source/blender/python/api2_2x/Text.c index 9719daaa3d4..c8b96fbd97e 100644 --- a/source/blender/python/api2_2x/Text.c +++ b/source/blender/python/api2_2x/Text.c @@ -47,6 +47,10 @@ #define EXPP_TEXT_MODE_FOLLOW TXT_FOLLOW +/* checks for the group being removed */ +#define TEXT_DEL_CHECK_PY(bpy_text) if (!(bpy_text->text)) return ( EXPP_ReturnPyObjError( PyExc_RuntimeError, "Text has been removed" ) ) +#define TEXT_DEL_CHECK_INT(bpy_text) if (!(bpy_text->text)) return ( EXPP_ReturnIntError( PyExc_RuntimeError, "Text has been removed" ) ) + /*****************************************************************************/ /* Python API function prototypes for the Text module. */ /*****************************************************************************/ @@ -109,6 +113,8 @@ static PyObject *Text_markSelection( BPy_Text * self, PyObject * args ); static PyObject *Text_suggest( BPy_Text * self, PyObject * args ); static PyObject *Text_showDocs( BPy_Text * self, PyObject * args ); +static void text_reset_internal( BPy_Text * self ); /* internal func */ + /*****************************************************************************/ /* Python BPy_Text methods table: */ /*****************************************************************************/ @@ -377,8 +383,7 @@ PyObject *Text_CreatePyObject( Text * txt ) "couldn't create BPy_Text PyObject" ); pytxt->text = txt; - pytxt->iol = NULL; - pytxt->ioc = -1; + text_reset_internal(pytxt); return ( PyObject * ) pytxt; } @@ -388,6 +393,7 @@ PyObject *Text_CreatePyObject( Text * txt ) /*****************************************************************************/ static PyObject *Text_getFilename( BPy_Text * self ) { + TEXT_DEL_CHECK_PY(self); if( self->text->name ) return PyString_FromString( self->text->name ); @@ -398,7 +404,9 @@ static PyObject *Text_getNLines( BPy_Text * self ) { /* text->nlines isn't updated in Blender (?) */ int nlines = 0; TextLine *line; - + + TEXT_DEL_CHECK_PY(self); + line = self->text->lines.first; while( line ) { /* so we have to count them ourselves */ @@ -415,9 +423,7 @@ static PyObject *Text_clear( BPy_Text * self) { int oldstate; - if( !self->text ) - return EXPP_ReturnPyObjError( PyExc_RuntimeError, - "This object isn't linked to a Blender Text Object" ); + TEXT_DEL_CHECK_PY(self); oldstate = txt_get_undostate( ); txt_set_undostate( 1 ); @@ -428,11 +434,15 @@ static PyObject *Text_clear( BPy_Text * self) Py_RETURN_NONE; } -static PyObject *Text_reset( BPy_Text * self ) +static void text_reset_internal( BPy_Text * self ) { self->iol = NULL; self->ioc = -1; +} +static PyObject *Text_reset( BPy_Text * self ) +{ + text_reset_internal(self); Py_RETURN_NONE; } @@ -440,9 +450,7 @@ static PyObject *Text_readline( BPy_Text * self ) { PyObject *tmpstr; - if( !self->text ) - return EXPP_ReturnPyObjError( PyExc_RuntimeError, - "This object isn't linked to a Blender Text Object" ); + TEXT_DEL_CHECK_PY(self); /* Reset */ if (!self->iol && self->ioc == -1) { @@ -476,20 +484,18 @@ static PyObject *Text_write( BPy_Text * self, PyObject * value ) char *str = PyString_AsString(value); int oldstate; - if( !self->text ) - return EXPP_ReturnPyObjError( PyExc_RuntimeError, - "This object isn't linked to a Blender Text Object" ); - if( !str ) return EXPP_ReturnPyObjError( PyExc_TypeError, "expected string argument" ); + TEXT_DEL_CHECK_PY(self); + oldstate = txt_get_undostate( ); txt_insert_buf( self->text, str ); txt_move_eof( self->text, 0 ); txt_set_undostate( oldstate ); - Text_reset( self ); + text_reset_internal( self ); Py_RETURN_NONE; } @@ -499,19 +505,17 @@ static PyObject *Text_insert( BPy_Text * self, PyObject * value ) char *str = PyString_AsString(value); int oldstate; - if( !self->text ) - return EXPP_ReturnPyObjError( PyExc_RuntimeError, - "This object isn't linked to a Blender Text Object" ); - if( !str ) return EXPP_ReturnPyObjError( PyExc_TypeError, "expected string argument" ); + + TEXT_DEL_CHECK_PY(self); oldstate = txt_get_undostate( ); txt_insert_buf( self->text, str ); txt_set_undostate( oldstate ); - Text_reset( self ); + text_reset_internal( self ); Py_RETURN_NONE; } @@ -521,11 +525,10 @@ static PyObject *Text_delete( BPy_Text * self, PyObject * value ) int num = PyInt_AsLong(value); int oldstate; - if( !self->text ) - return EXPP_ReturnPyObjError( PyExc_RuntimeError, - "This object isn't linked to a Blender Text Object" ); - - if( !num ) + TEXT_DEL_CHECK_PY(self); + + /* zero num is invalid and -1 is an error value */ + if( !num || (num==-1 && PyErr_Occurred())) return EXPP_ReturnPyObjError( PyExc_TypeError, "expected non-zero int argument" ); @@ -540,7 +543,7 @@ static PyObject *Text_delete( BPy_Text * self, PyObject * value ) } txt_set_undostate( oldstate ); - Text_reset( self ); + text_reset_internal( self ); Py_RETURN_NONE; } @@ -550,6 +553,8 @@ static PyObject *Text_set( BPy_Text * self, PyObject * args ) int ival; char *attr; + TEXT_DEL_CHECK_PY(self); + if( !PyArg_ParseTuple( args, "si", &attr, &ival ) ) return EXPP_ReturnPyObjError( PyExc_TypeError, "expected a string and an int as arguments" ); @@ -570,9 +575,7 @@ static PyObject *Text_asLines( BPy_Text * self, PyObject * args ) PyObject *list, *tmpstr; int start=0, end=-1, i; - if( !self->text ) - return EXPP_ReturnPyObjError( PyExc_RuntimeError, - "This object isn't linked to a Blender Text Object" ); + TEXT_DEL_CHECK_PY(self); if( !PyArg_ParseTuple( args, "|ii", &start, &end ) ) return EXPP_ReturnPyObjError( PyExc_TypeError, @@ -608,10 +611,9 @@ static PyObject *Text_getCursorPos( BPy_Text * self ) TextLine *linep; int row, col; + TEXT_DEL_CHECK_PY(self); + text = self->text; - if( !text ) - return EXPP_ReturnPyObjError( PyExc_RuntimeError, - "This object isn't linked to a Blender Text Object" ); for (row=0,linep=text->lines.first; linep!=text->curl; linep=linep->next) row++; @@ -625,9 +627,7 @@ static PyObject *Text_setCursorPos( BPy_Text * self, PyObject * args ) int row, col; SpaceText *st; - if (!self->text) - return EXPP_ReturnPyObjError(PyExc_RuntimeError, - "This object isn't linked to a Blender Text Object"); + TEXT_DEL_CHECK_PY(self); if (!PyArg_ParseTuple(args, "ii", &row, &col)) return EXPP_ReturnPyObjError(PyExc_TypeError, @@ -649,10 +649,9 @@ static PyObject *Text_getSelectPos( BPy_Text * self ) TextLine *linep; int row, col; + TEXT_DEL_CHECK_PY(self); + text = self->text; - if( !text ) - return EXPP_ReturnPyObjError( PyExc_RuntimeError, - "This object isn't linked to a Blender Text Object" ); for (row=0,linep=text->lines.first; linep!=text->sell; linep=linep->next) row++; @@ -666,9 +665,7 @@ static PyObject *Text_setSelectPos( BPy_Text * self, PyObject * args ) int row, col; SpaceText *st; - if (!self->text) - return EXPP_ReturnPyObjError(PyExc_RuntimeError, - "This object isn't linked to a Blender Text Object"); + TEXT_DEL_CHECK_PY(self); if (!PyArg_ParseTuple(args, "ii", &row, &col)) return EXPP_ReturnPyObjError(PyExc_TypeError, @@ -690,10 +687,9 @@ static PyObject *Text_markSelection( BPy_Text * self, PyObject * args ) Text *text; char color[4]; + TEXT_DEL_CHECK_PY(self); + text = self->text; - if (!text) - return EXPP_ReturnPyObjError(PyExc_RuntimeError, - "This object isn't linked to a Blender Text Object"); if (!PyArg_ParseTuple(args, "i(iii)i", &group, &r, &g, &b, &flags)) return EXPP_ReturnPyObjError(PyExc_TypeError, @@ -723,9 +719,7 @@ static PyObject *Text_suggest( BPy_Text * self, PyObject * args ) char *prefix = NULL, *name, type; SpaceText *st; - if (!self->text) - return EXPP_ReturnPyObjError(PyExc_RuntimeError, - "This object isn't linked to a Blender Text Object"); + TEXT_DEL_CHECK_PY(self); /* Parse args for a list of strings/tuples */ if (!PyArg_ParseTuple(args, "O!|s", &PyList_Type, &list, &prefix)) @@ -782,10 +776,8 @@ static PyObject *Text_showDocs( BPy_Text * self, PyObject * args ) { char *docs; SpaceText *st; - - if (!self->text) - return EXPP_ReturnPyObjError(PyExc_RuntimeError, - "This object isn't linked to a Blender Text Object"); + + TEXT_DEL_CHECK_PY(self); if (!PyArg_ParseTuple(args, "s", &docs)) return EXPP_ReturnPyObjError( PyExc_TypeError, @@ -839,6 +831,7 @@ static PyObject *Text_repr( BPy_Text * self ) /*****************************************************************************/ static PyObject *Text_getMode(BPy_Text * self) { + TEXT_DEL_CHECK_PY(self); return PyInt_FromLong( self->text->flags ); } diff --git a/source/blender/python/api2_2x/World.c b/source/blender/python/api2_2x/World.c index 0c57488a266..354d8cda0b7 100644 --- a/source/blender/python/api2_2x/World.c +++ b/source/blender/python/api2_2x/World.c @@ -43,6 +43,7 @@ #include "World.h" /*This must come first*/ #include "DNA_scene_types.h" /* for G.scene */ +#include "DNA_userdef_types.h" #include "BKE_global.h" #include "BKE_world.h" #include "BKE_main.h" @@ -988,7 +989,7 @@ World *World_FromPyObject( PyObject * py_obj ) static PyObject *World_insertIpoKey( BPy_World * self, PyObject * args ) { - int key = 0, map; + int key = 0, flag = 0, map; if( !PyArg_ParseTuple( args, "i", &( key ) ) ) return ( EXPP_ReturnPyObjError( PyExc_AttributeError, @@ -996,38 +997,41 @@ static PyObject *World_insertIpoKey( BPy_World * self, PyObject * args ) map = texchannel_to_adrcode(self->world->texact); + /* flag should be initialised with the 'autokeying' flags like for normal keying */ + if (IS_AUTOKEY_FLAG(INSERTNEEDED)) flag |= INSERTKEY_NEEDED; + if(key == IPOKEY_ZENITH) { - insertkey((ID *)self->world, ID_WO, NULL, NULL, WO_ZEN_R, 0); - insertkey((ID *)self->world, ID_WO, NULL, NULL, WO_ZEN_G, 0); - insertkey((ID *)self->world, ID_WO, NULL, NULL, WO_ZEN_B, 0); + insertkey((ID *)self->world, ID_WO, NULL, NULL, WO_ZEN_R, flag); + insertkey((ID *)self->world, ID_WO, NULL, NULL, WO_ZEN_G, flag); + insertkey((ID *)self->world, ID_WO, NULL, NULL, WO_ZEN_B, flag); } if(key == IPOKEY_HORIZON) { - insertkey((ID *)self->world, ID_WO, NULL, NULL, WO_HOR_R, 0); - insertkey((ID *)self->world, ID_WO, NULL, NULL, WO_HOR_G, 0); - insertkey((ID *)self->world, ID_WO, NULL, NULL, WO_HOR_B, 0); + insertkey((ID *)self->world, ID_WO, NULL, NULL, WO_HOR_R, flag); + insertkey((ID *)self->world, ID_WO, NULL, NULL, WO_HOR_G, flag); + insertkey((ID *)self->world, ID_WO, NULL, NULL, WO_HOR_B, flag); } if(key == IPOKEY_MIST) { - insertkey((ID *)self->world, ID_WO, NULL, NULL, WO_MISI, 0); - insertkey((ID *)self->world, ID_WO, NULL, NULL, WO_MISTDI, 0); - insertkey((ID *)self->world, ID_WO, NULL, NULL, WO_MISTSTA, 0); - insertkey((ID *)self->world, ID_WO, NULL, NULL, WO_MISTHI, 0); + insertkey((ID *)self->world, ID_WO, NULL, NULL, WO_MISI, flag); + insertkey((ID *)self->world, ID_WO, NULL, NULL, WO_MISTDI, flag); + insertkey((ID *)self->world, ID_WO, NULL, NULL, WO_MISTSTA, flag); + insertkey((ID *)self->world, ID_WO, NULL, NULL, WO_MISTHI, flag); } if(key == IPOKEY_STARS) { - insertkey((ID *)self->world, ID_WO, NULL, NULL, WO_STAR_R, 0); - insertkey((ID *)self->world, ID_WO, NULL, NULL, WO_STAR_G, 0); - insertkey((ID *)self->world, ID_WO, NULL, NULL, WO_STAR_B, 0); - insertkey((ID *)self->world, ID_WO, NULL, NULL, WO_STARDIST, 0); - insertkey((ID *)self->world, ID_WO, NULL, NULL, WO_STARSIZE, 0); + insertkey((ID *)self->world, ID_WO, NULL, NULL, WO_STAR_R, flag); + insertkey((ID *)self->world, ID_WO, NULL, NULL, WO_STAR_G, flag); + insertkey((ID *)self->world, ID_WO, NULL, NULL, WO_STAR_B, flag); + insertkey((ID *)self->world, ID_WO, NULL, NULL, WO_STARDIST, flag); + insertkey((ID *)self->world, ID_WO, NULL, NULL, WO_STARSIZE, flag); } if(key == IPOKEY_OFFSET) { - insertkey((ID *)self->world, ID_WO, NULL, NULL, map+MAP_OFS_X, 0); - insertkey((ID *)self->world, ID_WO, NULL, NULL, map+MAP_OFS_Y, 0); - insertkey((ID *)self->world, ID_WO, NULL, NULL, map+MAP_OFS_Z, 0); + insertkey((ID *)self->world, ID_WO, NULL, NULL, map+MAP_OFS_X, flag); + insertkey((ID *)self->world, ID_WO, NULL, NULL, map+MAP_OFS_Y, flag); + insertkey((ID *)self->world, ID_WO, NULL, NULL, map+MAP_OFS_Z, flag); } if(key == IPOKEY_SIZE) { - insertkey((ID *)self->world, ID_WO, NULL, NULL, map+MAP_SIZE_X, 0); - insertkey((ID *)self->world, ID_WO, NULL, NULL, map+MAP_SIZE_Y, 0); - insertkey((ID *)self->world, ID_WO, NULL, NULL, map+MAP_SIZE_Z, 0); + insertkey((ID *)self->world, ID_WO, NULL, NULL, map+MAP_SIZE_X, flag); + insertkey((ID *)self->world, ID_WO, NULL, NULL, map+MAP_SIZE_Y, flag); + insertkey((ID *)self->world, ID_WO, NULL, NULL, map+MAP_SIZE_Z, flag); } allspace(REMAKEIPO, 0); diff --git a/source/blender/python/api2_2x/doc/API_intro.py b/source/blender/python/api2_2x/doc/API_intro.py index 2960d8ed1d2..192c9710ea2 100644 --- a/source/blender/python/api2_2x/doc/API_intro.py +++ b/source/blender/python/api2_2x/doc/API_intro.py @@ -61,6 +61,14 @@ The Blender Python API Reference - L{World} - L{sys<Sys>} + Additional information: + ----------------------- + - L{API_related}: + - Calling scripts from command line + - Script links and space handlers + - How to register scripts in menus + - Recommended ways to document and support configuration options + Introduction: ============= diff --git a/source/blender/python/api2_2x/doc/API_related.py b/source/blender/python/api2_2x/doc/API_related.py index 4e29f95e76d..dcd2bdd1e60 100644 --- a/source/blender/python/api2_2x/doc/API_related.py +++ b/source/blender/python/api2_2x/doc/API_related.py @@ -226,6 +226,7 @@ Introduction: import Blender from Blender import Draw evt = Blender.event + val = Blender.eventValue return_it = False if evt == Draw.LEFTMOUSE: @@ -233,7 +234,7 @@ Introduction: elif evt == Draw.AKEY: print "Swallowing an 'a' character" else: - print "Let the 3D View itself process this event:", evt + print "Let the 3D View itself process this event: %d with value %d" % (evt, val) return_it = True # if Blender should not process itself the passed event: @@ -249,8 +250,14 @@ Introduction: tells what space this handler belongs to and the handler's type (EVENT, DRAW); - B{event}: - - EVENT handlers: an input event (check keys and mouse events in L{Draw}) - to be processed or ignored. + - EVENT handlers: an input event (check keys and mouse events in + L{Draw}) to be processed or ignored; + - DRAW handlers: 0 always; + - B{eventValue}: + - EVENT handlers: the event value, it indicates mouse button or key + presses (since we don't pass releases) as 1 and mouse movements + (Draw.MOUSE.X and Draw.MOUSE.Y) as the current x or y coordinate, + for example; - DRAW handlers: 0 always. B{Guidelines (important)}: diff --git a/source/blender/python/api2_2x/doc/Blender.py b/source/blender/python/api2_2x/doc/Blender.py index 964b8f70e8b..9d89cae7137 100644 --- a/source/blender/python/api2_2x/doc/Blender.py +++ b/source/blender/python/api2_2x/doc/Blender.py @@ -10,8 +10,8 @@ """ The main Blender module. -B{New}: L{Run}, L{UpdateMenus}, new options to L{Get}, L{ShowHelp}, -L{SpaceHandlers} dictionary. +B{New}: new var L{eventValue} for space handlers, L{Run}, L{UpdateMenus}, +new options to L{Get}, L{ShowHelp}, L{SpaceHandlers} dictionary. L{UnpackModes} dictionary. Blender @@ -34,7 +34,11 @@ Blender - for normal L{GUI<Draw.Register>} scripts I{during the events callback}, it holds the ascii value of the current event, if it is a valid one. Users interested in this should also check the builtin 'ord' and 'chr' - Python functions. + Python functions. +@type eventValue: int +@var eventValue: used only for EVENT space handlers, it holds the event value: + - for mouse button and key presses it's 1, for mouse movement + (Draw.MOUSEX and Draw.MOUSEY) it has the new x or y coordinate, resp. @type mode: string @var mode: Blender's current mode: - 'interactive': normal mode, with an open window answering to user input; diff --git a/source/blender/python/api2_2x/doc/Object.py b/source/blender/python/api2_2x/doc/Object.py index 07942d58093..49cb14d1e66 100644 --- a/source/blender/python/api2_2x/doc/Object.py +++ b/source/blender/python/api2_2x/doc/Object.py @@ -552,6 +552,8 @@ class Object: @ivar transp: Enable transparent materials for the active object (mesh only). Also see B{TRANSP} bit in L{drawMode} attribute. @type transp: boolean + @ivar color: Object color used by the game engine and optionally for materials, 4 floats for RGBA object color. + @type color: tuple of 4 floats between 0 and 1 @ivar drawMode: The object's drawing mode bitfield. See L{DrawModes} constant dict for values. @type drawMode: int diff --git a/source/blender/python/api2_2x/sceneRender.c b/source/blender/python/api2_2x/sceneRender.c index 22e165cbe9f..7f88acd3a87 100644 --- a/source/blender/python/api2_2x/sceneRender.c +++ b/source/blender/python/api2_2x/sceneRender.c @@ -481,7 +481,6 @@ PyObject *RenderData_Render( BPy_RenderData * self ) set_scene( oldsce ); } else { /* background mode (blender -b file.blend -P script) */ - int slink_flag = 0; Render *re= RE_NewRender(G.scene->id.name); int end_frame = G.scene->r.efra; @@ -492,20 +491,14 @@ PyObject *RenderData_Render( BPy_RenderData * self ) G.scene->r.efra = G.scene->r.sfra; - if (G.f & G_DOSCRIPTLINKS) { - BPY_do_all_scripts(SCRIPT_RENDER); - G.f &= ~G_DOSCRIPTLINKS; /* avoid FRAMECHANGED events*/ - slink_flag = 1; - } + if (G.f & G_DOSCRIPTLINKS) + BPY_do_all_scripts(SCRIPT_RENDER, 0); tstate = PyEval_SaveThread(); - RE_BlenderAnim(re, G.scene, G.scene->r.sfra, G.scene->r.efra); + RE_BlenderAnim(re, G.scene, G.scene->r.sfra, G.scene->r.efra, G.scene->frame_step); - if (slink_flag) { - G.f |= G_DOSCRIPTLINKS; - BPY_do_all_scripts(SCRIPT_POSTRENDER); - } + BPY_do_all_scripts(SCRIPT_POSTRENDER, 0); G.scene->r.efra = end_frame; } @@ -603,13 +596,13 @@ PyObject *RenderData_RenderAnim( BPy_RenderData * self ) "start frame must be less or equal to end frame"); if (G.f & G_DOSCRIPTLINKS) - BPY_do_all_scripts(SCRIPT_RENDER); + BPY_do_all_scripts(SCRIPT_RENDER, 1); tstate = PyEval_SaveThread(); - RE_BlenderAnim(re, G.scene, G.scene->r.sfra, G.scene->r.efra); + RE_BlenderAnim(re, G.scene, G.scene->r.sfra, G.scene->r.efra, G.scene->frame_step); if (G.f & G_DOSCRIPTLINKS) - BPY_do_all_scripts(SCRIPT_POSTRENDER); + BPY_do_all_scripts(SCRIPT_POSTRENDER, 1); } PyEval_RestoreThread(tstate); diff --git a/source/blender/render/extern/include/RE_pipeline.h b/source/blender/render/extern/include/RE_pipeline.h index 64cf7fcb37b..60557403143 100644 --- a/source/blender/render/extern/include/RE_pipeline.h +++ b/source/blender/render/extern/include/RE_pipeline.h @@ -185,7 +185,7 @@ void RE_TileProcessor(struct Render *re, int firsttile, int threaded); /* only RE_NewRender() needed, main Blender render calls */ void RE_BlenderFrame(struct Render *re, struct Scene *scene, int frame); -void RE_BlenderAnim(struct Render *re, struct Scene *scene, int sfra, int efra); +void RE_BlenderAnim(struct Render *re, struct Scene *scene, int sfra, int efra, int tfra); void RE_ReadRenderResult(struct Scene *scene, struct Scene *scenode); void RE_WriteRenderResult(RenderResult *rr, char *filename, int compress); diff --git a/source/blender/render/intern/include/render_types.h b/source/blender/render/intern/include/render_types.h index 7e2194549cc..1768b052b54 100644 --- a/source/blender/render/intern/include/render_types.h +++ b/source/blender/render/intern/include/render_types.h @@ -421,6 +421,7 @@ typedef struct LampRen { short type; int mode; float r, g, b, k; + float shdwr, shdwg, shdwb; float energy, haint; int lay; float spotsi,spotbl; diff --git a/source/blender/render/intern/include/texture.h b/source/blender/render/intern/include/texture.h index 8e56c4a852f..be5471e07c4 100644 --- a/source/blender/render/intern/include/texture.h +++ b/source/blender/render/intern/include/texture.h @@ -55,7 +55,7 @@ struct ImBuf; void do_halo_tex(struct HaloRen *har, float xn, float yn, float *colf); void do_sky_tex(float *rco, float *lo, float *dxyview, float *hor, float *zen, float *blend, int skyflag); void do_material_tex(struct ShadeInput *shi); -void do_lamp_tex(LampRen *la, float *lavec, struct ShadeInput *shi, float *colf); +void do_lamp_tex(LampRen *la, float *lavec, struct ShadeInput *shi, float *colf, int effect); void init_render_textures(Render *re); diff --git a/source/blender/render/intern/source/convertblender.c b/source/blender/render/intern/source/convertblender.c index 33f32a4744e..d5ac2fa1748 100644 --- a/source/blender/render/intern/source/convertblender.c +++ b/source/blender/render/intern/source/convertblender.c @@ -3456,6 +3456,9 @@ static GroupObject *add_render_lamp(Render *re, Object *ob) lar->r= lar->energy*la->r; lar->g= lar->energy*la->g; lar->b= lar->energy*la->b; + lar->shdwr= la->shdwr; + lar->shdwg= la->shdwg; + lar->shdwb= la->shdwb; lar->k= la->k; // area @@ -3608,7 +3611,10 @@ static GroupObject *add_render_lamp(Render *re, Object *ob) for(c=0; c<MAX_MTEX; c++) { if(la->mtex[c] && la->mtex[c]->tex) { - lar->mode |= LA_TEXTURE; + if (la->mtex[c]->mapto & LAMAP_COL) + lar->mode |= LA_TEXTURE; + if (la->mtex[c]->mapto & LAMAP_SHAD) + lar->mode |= LA_SHAD_TEX; if(G.rendering) { if(re->osa) { diff --git a/source/blender/render/intern/source/pipeline.c b/source/blender/render/intern/source/pipeline.c index bf2a72b4f9b..6bdd57612c7 100644 --- a/source/blender/render/intern/source/pipeline.c +++ b/source/blender/render/intern/source/pipeline.c @@ -38,6 +38,7 @@ #include "DNA_scene_types.h" #include "DNA_userdef_types.h" +#include "BKE_utildefines.h" #include "BKE_global.h" #include "BKE_image.h" #include "BKE_main.h" @@ -961,7 +962,6 @@ void RE_GetResultImage(Render *re, RenderResult *rr) } } -#define FTOCHAR(val) val<=0.0f?0: (val>=1.0f?255: (char)(255.0f*val)) /* caller is responsible for allocating rect in correct size! */ void RE_ResultGet32(Render *re, unsigned int *rect) { @@ -2559,10 +2559,12 @@ static void do_write_image_or_movie(Render *re, Scene *scene, bMovieHandle *mh) } /* saves images to disk */ -void RE_BlenderAnim(Render *re, Scene *scene, int sfra, int efra) +void RE_BlenderAnim(Render *re, Scene *scene, int sfra, int efra, int tfra) { bMovieHandle *mh= BKE_get_movie_handle(scene->r.imtype); + unsigned int lay; int cfrao= scene->r.cfra; + int nfra; /* do not fully call for each frame, it initializes & pops output window */ if(!render_initialize_from_scene(re, scene, 0)) @@ -2591,12 +2593,27 @@ void RE_BlenderAnim(Render *re, Scene *scene, int sfra, int efra) } } } else { - for(scene->r.cfra= sfra; scene->r.cfra<=efra; scene->r.cfra++) { + for(nfra= sfra, scene->r.cfra= sfra; scene->r.cfra<=efra; scene->r.cfra++) { char name[FILE_MAX]; /* only border now, todo: camera lens. (ton) */ render_initialize_from_scene(re, scene, 1); - + + if(nfra!=scene->r.cfra) { + /* + * Skip this frame, but update for physics and particles system. + * From convertblender.c: + * in localview, lamps are using normal layers, objects only local bits. + */ + if(scene->lay & 0xFF000000) + lay= scene->lay & 0xFF000000; + else + lay= scene->lay; + + scene_update_for_newframe(scene, lay); + continue; + } + if (scene->r.mode & (R_NO_OVERWRITE | R_TOUCH) ) { BKE_makepicstring(name, scene->r.pic, scene->r.cfra, scene->r.imtype); } @@ -2626,6 +2643,7 @@ void RE_BlenderAnim(Render *re, Scene *scene, int sfra, int efra) break; } + nfra+= tfra; } } diff --git a/source/blender/render/intern/source/pixelshading.c b/source/blender/render/intern/source/pixelshading.c index 2e3509f0471..ef723eea6b5 100644 --- a/source/blender/render/intern/source/pixelshading.c +++ b/source/blender/render/intern/source/pixelshading.c @@ -141,7 +141,7 @@ static void render_lighting_halo(HaloRen *har, float *colf) VECCOPY(shi.co, rco); shi.osatex= 0; - do_lamp_tex(lar, lv, &shi, lacol); + do_lamp_tex(lar, lv, &shi, lacol, LA_TEXTURE); } if(lar->type==LA_SPOT) { diff --git a/source/blender/render/intern/source/rendercore.c b/source/blender/render/intern/source/rendercore.c index bda02bea8d7..05ff0d3c020 100644 --- a/source/blender/render/intern/source/rendercore.c +++ b/source/blender/render/intern/source/rendercore.c @@ -672,22 +672,10 @@ static void atm_tile(RenderPart *pa, RenderLayer *rl) GroupObject *go; LampRen *lar; RenderLayer *rlpp[RE_MAX_OSA]; - - int totsample, fullsample, sample; - int x, y,od; - short first_lamp; - float *zrect; - float *rgbrect; - float rgb[3]={0}; - float tmp_rgb[3]; - float fac; - float facm; + int totsample; + int x, y, od= 0; - fac = 0.5; - facm = 1.0 - fac; - totsample= get_sample_layers(pa, rl, rlpp); - fullsample= (totsample > 1); /* check that z pass is enabled */ if(pa->rectz==NULL) return; @@ -698,65 +686,66 @@ static void atm_tile(RenderPart *pa, RenderLayer *rl) if(zpass==NULL) return; /* check for at least one sun lamp that its atmosphere flag is is enabled */ - first_lamp = 1; for(go=R.lights.first; go; go= go->next) { lar= go->lampren; - if(lar->type==LA_SUN && lar->sunsky && - (lar->sunsky->effect_type & LA_SUN_EFFECT_AP)){ - first_lamp = 0; + if(lar->type==LA_SUN && lar->sunsky && (lar->sunsky->effect_type & LA_SUN_EFFECT_AP)) break; - } } /* do nothign and return if there is no sun lamp */ - if(first_lamp) + if(go==NULL) return; - zrect = zpass->rect; - rgbrect = rl->rectf; - od=0; - /* for each x,y and sun lamp*/ + /* for each x,y and each sample, and each sun lamp*/ for(y=pa->disprect.ymin; y<pa->disprect.ymax; y++) { - for(x=pa->disprect.xmin; x<pa->disprect.xmax; x++, zrect++, od++) { + for(x=pa->disprect.xmin; x<pa->disprect.xmax; x++, od++) { + int sample; - first_lamp = 1; - for(go=R.lights.first; go; go= go->next) { - lar= go->lampren; - if(lar->type==LA_SUN && lar->sunsky) + for(sample=0; sample<totsample; sample++) { + float *zrect= RE_RenderLayerGetPass(rlpp[sample], SCE_PASS_Z) + od; + float *rgbrect = rlpp[sample]->rectf + 4*od; + float rgb[3]; + int done= 0; + + for(go=R.lights.first; go; go= go->next) { + - { - /* if it's sky continue and don't apply atmosphere effect on it */ - if(*zrect >= 9.9e10){ - continue; - } - - if(lar->sunsky->effect_type & LA_SUN_EFFECT_AP){ - VECCOPY(tmp_rgb, (float*)(rgbrect+4*od)); - - shadeAtmPixel(lar->sunsky, tmp_rgb, x, y, *zrect); + lar= go->lampren; + if(lar->type==LA_SUN && lar->sunsky) { - if(first_lamp){ - VECCOPY(rgb, tmp_rgb); - first_lamp = 0; + /* if it's sky continue and don't apply atmosphere effect on it */ + if(*zrect >= 9.9e10 || rgbrect[3]==0.0f) { + continue; } - else{ - rgb[0] = facm*rgb[0] + fac*tmp_rgb[0]; - rgb[1] = facm*rgb[1] + fac*tmp_rgb[1]; - rgb[2] = facm*rgb[2] + fac*tmp_rgb[2]; + + if((lar->sunsky->effect_type & LA_SUN_EFFECT_AP)) { + float tmp_rgb[3]; + + VECCOPY(tmp_rgb, rgbrect); + if(rgbrect[3]!=1.0f) { /* de-premul */ + float div= 1.0f/rgbrect[3]; + VECMUL(tmp_rgb, div); + } + shadeAtmPixel(lar->sunsky, tmp_rgb, x, y, *zrect); + if(rgbrect[3]!=1.0f) { /* premul */ + VECMUL(tmp_rgb, rgbrect[3]); + } + + if(done==0) { + VECCOPY(rgb, tmp_rgb); + done = 1; + } + else{ + rgb[0] = 0.5f*rgb[0] + 0.5f*tmp_rgb[0]; + rgb[1] = 0.5f*rgb[1] + 0.5f*tmp_rgb[1]; + rgb[2] = 0.5f*rgb[2] + 0.5f*tmp_rgb[2]; + } } } } - } - /* if at least for one sun lamp aerial perspective was applied*/ - if(first_lamp==0) - { - if(fullsample) { - for(sample=0; sample<totsample; sample++) { - VECCOPY((float*)(rlpp[sample]->rectf + od*4), rgb); - } - } - else { - VECCOPY((float*)(rgbrect+4*od), rgb); + /* if at least for one sun lamp aerial perspective was applied*/ + if(done) { + VECCOPY(rgbrect, rgb); } } } @@ -1217,6 +1206,10 @@ void zbufshadeDA_tile(RenderPart *pa) } } + /* sun/sky */ + if(rl->layflag & SCE_LAY_SKY) + atm_tile(pa, rl); + /* sky before edge */ if(rl->layflag & SCE_LAY_SKY) sky_tile(pa, rl); @@ -1226,10 +1219,6 @@ void zbufshadeDA_tile(RenderPart *pa) if(R.r.mode & R_EDGE) edge_enhance_add(pa, rl->rectf, edgerect); - /* sun/sky */ - if(rl->layflag & SCE_LAY_SKY) - atm_tile(pa, rl); - if(rl->passflag & SCE_PASS_VECTOR) reset_sky_speed(pa, rl); @@ -1380,6 +1369,10 @@ void zbufshade_tile(RenderPart *pa) } } + /* sun/sky */ + if(rl->layflag & SCE_LAY_SKY) + atm_tile(pa, rl); + /* sky before edge */ if(rl->layflag & SCE_LAY_SKY) sky_tile(pa, rl); @@ -1390,10 +1383,6 @@ void zbufshade_tile(RenderPart *pa) edge_enhance_add(pa, rl->rectf, edgerect); } - /* sun/sky */ - if(rl->layflag & SCE_LAY_SKY) - atm_tile(pa, rl); - if(rl->passflag & SCE_PASS_VECTOR) reset_sky_speed(pa, rl); @@ -1971,7 +1960,6 @@ void RE_shade_external(Render *re, ShadeInput *shi, ShadeResult *shr) /* ************************* bake ************************ */ -#define FTOCHAR(val) val<=0.0f?0: (val>=1.0f?255: (char)(255.0f*val)) typedef struct BakeShade { ShadeSample ssamp; diff --git a/source/blender/render/intern/source/shadeoutput.c b/source/blender/render/intern/source/shadeoutput.c index 5a80173d1f1..91621c24365 100644 --- a/source/blender/render/intern/source/shadeoutput.c +++ b/source/blender/render/intern/source/shadeoutput.c @@ -1179,7 +1179,7 @@ static void shade_one_light(LampRen *lar, ShadeInput *shi, ShadeResult *shr, int { Material *ma= shi->mat; VlakRen *vlr= shi->vlr; - float lv[3], lampdist, lacol[3], shadfac[4]; + float lv[3], lampdist, lacol[3], shadfac[4], lashdw[3]; float i, is, i_noshad, inp, *vn, *view, vnor[3], phongcorr=1.0f; float visifac; @@ -1219,7 +1219,12 @@ static void shade_one_light(LampRen *lar, ShadeInput *shi, ShadeResult *shr, int lacol[1]= lar->g; lacol[2]= lar->b; - if(lar->mode & LA_TEXTURE) do_lamp_tex(lar, lv, shi, lacol); + lashdw[0]= lar->shdwr; + lashdw[1]= lar->shdwg; + lashdw[2]= lar->shdwb; + + if(lar->mode & LA_TEXTURE) do_lamp_tex(lar, lv, shi, lacol, LA_TEXTURE); + if(lar->mode & LA_SHAD_TEX) do_lamp_tex(lar, lv, shi, lashdw, LA_SHAD_TEX); /* tangent case; calculate fake face normal, aligned with lampvector */ /* note, vnor==vn is used as tangent trigger for buffer shadow */ @@ -1342,13 +1347,13 @@ static void shade_one_light(LampRen *lar, ShadeInput *shi, ShadeResult *shr, int if((lar->mode & LA_ONLYSHADOW) && i>0.0) { shadfac[3]= i*lar->energy*(1.0f-shadfac[3]); - shr->shad[0] -= shadfac[3]*shi->r; - shr->shad[1] -= shadfac[3]*shi->g; - shr->shad[2] -= shadfac[3]*shi->b; + shr->shad[0] -= shadfac[3]*shi->r*(1.0f-lashdw[0]); + shr->shad[1] -= shadfac[3]*shi->g*(1.0f-lashdw[1]); + shr->shad[2] -= shadfac[3]*shi->b*(1.0f-lashdw[2]); - shr->spec[0] -= shadfac[3]*shi->specr; - shr->spec[1] -= shadfac[3]*shi->specg; - shr->spec[2] -= shadfac[3]*shi->specb; + shr->spec[0] -= shadfac[3]*shi->specr*(1.0f-lashdw[0]); + shr->spec[1] -= shadfac[3]*shi->specg*(1.0f-lashdw[1]); + shr->spec[2] -= shadfac[3]*shi->specb*(1.0f-lashdw[2]); return; } @@ -1366,6 +1371,10 @@ static void shade_one_light(LampRen *lar, ShadeInput *shi, ShadeResult *shr, int else add_to_diffuse(shr->shad, shi, is, i*lacol[0], i*lacol[1], i*lacol[2]); } + /* add light for colored shadow */ + if (i_noshad>i && !(lashdw[0]==0 && lashdw[1]==0 && lashdw[2]==0)) { + add_to_diffuse(shr->shad, shi, is, lashdw[0]*(i_noshad-i)*lacol[0], lashdw[1]*(i_noshad-i)*lacol[1], lashdw[2]*(i_noshad-i)*lacol[2]); + } if(i_noshad>0.0f) { if(passflag & (SCE_PASS_DIFFUSE|SCE_PASS_SHADOW)) { if(ma->mode & MA_SHADOW_TRA) diff --git a/source/blender/render/intern/source/texture.c b/source/blender/render/intern/source/texture.c index 27628d91465..c14425e274f 100644 --- a/source/blender/render/intern/source/texture.c +++ b/source/blender/render/intern/source/texture.c @@ -2301,7 +2301,7 @@ void do_sky_tex(float *rco, float *lo, float *dxyview, float *hor, float *zen, f /* ------------------------------------------------------------------------- */ /* colf supposed to be initialized with la->r,g,b */ -void do_lamp_tex(LampRen *la, float *lavec, ShadeInput *shi, float *colf) +void do_lamp_tex(LampRen *la, float *lavec, ShadeInput *shi, float *colf, int effect) { Object *ob; MTex *mtex; @@ -2440,7 +2440,7 @@ void do_lamp_tex(LampRen *la, float *lavec, ShadeInput *shi, float *colf) } /* mapping */ - if(mtex->mapto & LAMAP_COL) { + if(((mtex->mapto & LAMAP_COL) && (effect & LA_TEXTURE))||((mtex->mapto & LAMAP_SHAD) && (effect & LA_SHAD_TEX))) { float col[3]; if(rgb==0) { diff --git a/source/blender/src/SConscript b/source/blender/src/SConscript index c8c517e15ff..c421d1e8388 100644 --- a/source/blender/src/SConscript +++ b/source/blender/src/SConscript @@ -75,7 +75,13 @@ if env['WITH_BF_VERSE']: # TODO buildinfo if env['BF_BUILDINFO'] == 1: defs.append('NAN_BUILDINFO') - + +if env['BF_NO_ELBEEM'] == 1: + defs.append('DISABLE_ELBEEM') + +if env['WITH_BF_SDL'] == 0: + defs.append('DISABLE_SDL') + if (env['BF_SPLIT_SRC'] == 1) and (env['OURPLATFORM'] == 'win32-mingw'): for i in range(numlibs): env.BlenderLib ( libname = 'src%d' % (i), sources = subsources[i], includes = Split(incs), defines = defs, libtype=['core', 'intern'], priority = [5, 25] ) diff --git a/source/blender/src/buttons_logic.c b/source/blender/src/buttons_logic.c index e16443460a1..45974e5704c 100644 --- a/source/blender/src/buttons_logic.c +++ b/source/blender/src/buttons_logic.c @@ -2969,6 +2969,45 @@ static void check_body_type(void *arg1_but, void *arg2_object) } } +static uiBlock *advanced_bullet_menu(void *arg_ob) +{ + uiBlock *block; + Object *ob = arg_ob; + short yco = 65, xco = 0; + + block= uiNewBlock(&curarea->uiblocks, "advanced_bullet_options", UI_EMBOSS, UI_HELV, curarea->win); + /* use this for a fake extra empy space around the buttons */ + uiDefBut(block, LABEL, 0, "", -5, -10, 255, 100, NULL, 0, 0, 0, 0, ""); + + uiDefButBitI(block, TOG, OB_ACTOR, 0, "Sensor actor", + xco, yco, 118, 19, &ob->gameflag, 0, 0, 0, 0, + "Objects that are detected by the Near and Radar sensor"); + + if (ob->gameflag & OB_DYNAMIC) { + uiDefButBitI(block, TOG, OB_COLLISION_RESPONSE, 0, "No sleeping", + xco+=120, yco, 118, 19, &ob->gameflag, 0, 0, 0, 0, + "Disable auto (de)activation"); + } + + yco -= 25; + xco = 0; + if (ob->gameflag & OB_DYNAMIC) { + if (ob->margin < 0.001f) + ob->margin = 0.06f; + uiDefButF(block, NUM, 0, "Margin", + xco, yco, 118, 19, &ob->margin, 0.001, 1.0, 1, 0, + "Collision margin"); + } else { + uiDefButF(block, NUM, 0, "Margin", + xco, yco, 118, 19, &ob->margin, 0.0, 1.0, 1, 0, + "Collision margin"); + } + + uiBlockSetDirection(block, UI_TOP); + + return block; +} + void buttons_bullet(uiBlock *block, Object *ob) { uiBut *but; @@ -2976,7 +3015,7 @@ void buttons_bullet(uiBlock *block, Object *ob) /* determine the body_type setting based on flags */ if (!(ob->gameflag & OB_COLLISION)) ob->body_type = OB_BODY_TYPE_NO_COLLISION; - else if (!(ob->gameflag & OB_DYNAMIC) || !(ob->gameflag & OB_DYNAMIC)) + else if (!(ob->gameflag & OB_DYNAMIC)) ob->body_type = OB_BODY_TYPE_STATIC; else if (!(ob->gameflag & (OB_RIGID_BODY|OB_SOFT_BODY))) ob->body_type = OB_BODY_TYPE_DYNAMIC; @@ -2985,61 +3024,51 @@ void buttons_bullet(uiBlock *block, Object *ob) else ob->body_type = OB_BODY_TYPE_SOFT; - uiBlockBeginAlign(block); but = uiDefButS(block, MENU, REDRAWVIEW3D, "Object type%t|No collision%x0|Static%x1|Dynamic%x2|Rigid body%x3|Soft body%x4", - 10, 205, 150, 19, &ob->body_type, 0, 0, 0, 0, "Selects the type of physical representation of the object"); + 10, 205, 120, 19, &ob->body_type, 0, 0, 0, 0, "Selects the type of physical representation"); uiButSetFunc(but, check_body_type, but, ob); if (ob->gameflag & OB_COLLISION) { - but = uiDefButBitI(block, TOG, OB_ACTOR, B_REDR, "Actor", - 160,205,55,19, &ob->gameflag, 0, 0, 0, 0, - "Objects that are detected by the Near and Radar sensor"); - uiButSetFunc(but, check_actor, but, &ob->gameflag); - - uiDefButBitI(block, TOG, OB_GHOST, B_REDR, "Ghost", 215,205,55,19, + + uiBlockSetCol(block, TH_BUT_SETTING1); + uiDefBlockBut(block, advanced_bullet_menu, ob, + "Advanced Settings", + 200, 205, 150, 20, "Display collision advanced settings"); + uiBlockSetCol(block, TH_BUT_SETTING2); + + uiBlockBeginAlign(block); + uiDefButBitI(block, TOG, OB_GHOST, 0, "Ghost", 10, 182, 60, 19, &ob->gameflag, 0, 0, 0, 0, "Objects that don't restitute collisions (like a ghost)"); + if ((ob->gameflag & OB_DYNAMIC) || ((ob->gameflag & OB_BOUNDS) && (ob->boundtype == OB_BOUND_SPHERE))) { + uiDefButF(block, NUM, REDRAWVIEW3D, "Radius:", 70, 182, 140, 19, + &ob->inertia, 0.01, 10.0, 10, 2, + "Bounding sphere radius, not used for other bounding shapes"); + } if(ob->gameflag & OB_DYNAMIC) { - uiDefButBitI(block, TOG, OB_COLLISION_RESPONSE, B_REDR, "No sleeping", 270,205,80,19, - &ob->gameflag, 0, 0, 0, 0, - "Disable auto (de)activation"); - uiDefButF(block, NUM, B_DIFF, "Mass:", 10, 185, 170, 19, + uiDefButF(block, NUM, B_DIFF, "Mass:", 210, 182, 140, 19, &ob->mass, 0.01, 10000.0, 10, 2, "The mass of the Object"); - uiDefButF(block, NUM, REDRAWVIEW3D, "Radius:", 180, 185, 170, 19, - &ob->inertia, 0.01, 10.0, 10, 2, - "Bounding sphere radius, not used for other bounding shapes"); - uiDefButF(block, NUMSLI, B_DIFF, "Damp ", 10, 165, 150, 19, + uiDefButF(block, NUMSLI, B_DIFF, "Damp ", 10, 162, 150, 19, &ob->damping, 0.0, 1.0, 10, 0, "General movement damping"); - uiDefButF(block, NUMSLI, B_DIFF, "RotDamp ", 160, 165, 190, 19, + uiDefButF(block, NUMSLI, B_DIFF, "RotDamp ", 160, 162, 190, 19, &ob->rdamping, 0.0, 1.0, 10, 0, "General rotation damping"); } uiBlockEndAlign(block); uiBlockBeginAlign(block); - if ((ob->gameflag & (OB_ACTOR|OB_DYNAMIC)) == (OB_ACTOR|OB_DYNAMIC)) { - if (ob->margin < 0.001f) - ob->margin = 0.06f; - uiDefButF(block, NUM, B_DIFF, "Margin", 10, 105, 105, 19, - &ob->margin, 0.001, 1.0, 1, 0, - "Collision margin"); - } else { - uiDefButF(block, NUM, B_DIFF, "Margin", 10, 105, 105, 19, - &ob->margin, 0.0, 1.0, 1, 0, - "Collision margin"); - } - uiDefButBitI(block, TOG, OB_BOUNDS, B_REDR, "Bounds", 115, 105, 55, 19, - &ob->gameflag, 0, 0,0, 0, + uiDefButBitI(block, TOG, OB_BOUNDS, B_REDR, "Bounds", 10, 105, 80, 19, + &ob->gameflag, 0, 0, 0, 0, "Specify a bounds object for physics"); if (ob->gameflag & OB_BOUNDS) { uiDefButS(block, MENU, REDRAWVIEW3D, "Boundary Display%t|Box%x0|Sphere%x1|Cylinder%x2|Cone%x3|Convex Hull%x5|Static Mesh%x4", //almost ready to enable this one: uiDefButS(block, MENU, REDRAWVIEW3D, "Boundary Display%t|Box%x0|Sphere%x1|Cylinder%x2|Cone%x3|Convex Hull Polytope%x5|Static TriangleMesh %x4|Dynamic Mesh %x5|", - 170, 105, 105, 19, &ob->boundtype, 0, 0, 0, 0, "Selects the collision type"); - uiDefButBitI(block, TOG, OB_CHILD, B_REDR, "Compound", 275,105,75,19, + 90, 105, 150, 19, &ob->boundtype, 0, 0, 0, 0, "Selects the collision type"); + uiDefButBitI(block, TOG, OB_CHILD, B_REDR, "Compound", 240,105,110,19, &ob->gameflag, 0, 0, 0, 0, "Add Children"); } diff --git a/source/blender/src/buttons_scene.c b/source/blender/src/buttons_scene.c index f2e20356f21..8ea71ce38dc 100644 --- a/source/blender/src/buttons_scene.c +++ b/source/blender/src/buttons_scene.c @@ -2315,12 +2315,13 @@ static void render_panel_anim(void) uiBlockEndAlign(block); uiBlockSetCol(block, TH_AUTO); - uiDefBut(block, BUT,B_PLAYANIM, "PLAY",692,40,94,33, 0, 0, 0, 0, 0, "Play rendered images/avi animation (Ctrl+F11), (Play Hotkeys: A-Noskip, P-PingPong)"); - uiDefButS(block, NUM, B_RTCHANGED, "rt:",789,40,95,33, &G.rt, -1000.0, 1000.0, 0, 0, "General testing/debug button"); + uiDefBut(block, BUT,B_PLAYANIM, "PLAY",692,50,94,33, 0, 0, 0, 0, 0, "Play rendered images/avi animation (Ctrl+F11), (Play Hotkeys: A-Noskip, P-PingPong)"); + uiDefButS(block, NUM, B_RTCHANGED, "rt:",789,50,95,33, &G.rt, -1000.0, 1000.0, 0, 0, "General testing/debug button"); uiBlockBeginAlign(block); - uiDefButI(block, NUM,REDRAWSEQ,"Sta:",692,10,94,24, &G.scene->r.sfra,1.0,MAXFRAMEF, 0, 0, "The start frame of the animation (inclusive)"); - uiDefButI(block, NUM,REDRAWSEQ,"End:",789,10,95,24, &G.scene->r.efra,SFRA,MAXFRAMEF, 0, 0, "The end frame of the animation (inclusive)"); + uiDefButI(block, NUM,REDRAWSEQ,"Sta:",692,20,94,24, &G.scene->r.sfra,1.0,MAXFRAMEF, 0, 0, "The start frame of the animation (inclusive)"); + uiDefButI(block, NUM,REDRAWSEQ,"End:",789,20,95,24, &G.scene->r.efra,SFRA,MAXFRAMEF, 0, 0, "The end frame of the animation (inclusive)"); + uiDefButI(block, NUM,REDRAWSEQ,"Step:",692,0,192,18, &G.scene->frame_step, 1.0, MAXFRAMEF, 0, 0, "Frame Step"); uiBlockEndAlign(block); } diff --git a/source/blender/src/buttons_shading.c b/source/blender/src/buttons_shading.c index 6d5e1a62ad4..c41047ed788 100644 --- a/source/blender/src/buttons_shading.c +++ b/source/blender/src/buttons_shading.c @@ -2535,7 +2535,10 @@ static void lamp_panel_mapto(Object *ob, Lamp *la) uiDefButF(block, NUMSLI, B_LAMPPRV, "DVar ", 10,10,135,19, &(mtex->def_var), 0.0, 1.0, 0, 0, "Value to use for Ref, Spec, Amb, Emit, Alpha, RayMir, TransLu and Hard"); /* MAP TO */ - uiDefButBitS(block, TOG, MAP_COL, B_LAMPPRV, "Col", 10,180,135,19, &(mtex->mapto), 0, 0, 0, 0, "Lets the texture affect the basic color of the lamp"); + uiBlockBeginAlign(block); + uiDefButBitS(block, TOG, LAMAP_COL, B_LAMPPRV, "Col", 10,180,135,19, &(mtex->mapto), 0, 0, 0, 0, "Lets the texture affect the basic color of the lamp"); + uiDefButBitS(block, TOG, LAMAP_SHAD, B_LAMPPRV, "Shadow", 146,180,135,19, &(mtex->mapto), 0, 0, 0, 0, "Lets the texture affect the shadow color of the lamp"); + uiBlockEndAlign(block); uiBlockBeginAlign(block); uiDefButS(block, MENU, B_LAMPPRV, mapto_blendtype_pup(),155,125,155,19, &(mtex->blendtype), 0, 0, 0, 0, "Texture blending mode"); @@ -2669,6 +2672,12 @@ static void lamp_panel_spot(Object *ob, Lamp *la) uiDefButBitI(block, TOG, LA_LAYER_SHADOW, B_LAMPPRV,"Layer", 10,90,80,19,&la->mode, 0, 0, 0, 0, "Causes only objects on the same layer to cast shadows"); uiBlockEndAlign(block); + if(ELEM4(la->type, LA_AREA, LA_SPOT, LA_SUN, LA_LOCAL) && ((la->mode & LA_SHAD_RAY)||(la->mode & LA_SHAD_BUF))) { + uiBlockBeginAlign(block); + uiDefButF(block, COL, 0, "Shadow ", 10,90,80,19,&la->shdwr, 0, 0, 0, B_COLLAMP, "Sets the shadow color; default is black (RGB 0,0,0)"); + uiBlockEndAlign(block); + } + if(la->type==LA_SPOT) { uiBlockBeginAlign(block); uiDefButBitI(block, TOG, LA_SQUARE, B_LAMPREDRAW,"Square", 10,60,80,19,&la->mode, 0, 0, 0, 0, "Sets square spotbundles"); diff --git a/source/blender/src/drawipo.c b/source/blender/src/drawipo.c index ec6a0f0d75b..1454c0d4f09 100644 --- a/source/blender/src/drawipo.c +++ b/source/blender/src/drawipo.c @@ -1315,7 +1315,7 @@ static void draw_ipohandles(int sel) glVertex2fv(fp+3); glVertex2fv(fp+6); glEnd(); } - else if( (bezt->f1 & 1)==sel) { + else if( (bezt->f1 & SELECT)==sel) { fp= bezt->vec[0]; cpack(col[bezt->h1]); diff --git a/source/blender/src/drawmesh.c b/source/blender/src/drawmesh.c index 8f22c704fd0..ba266fa8c29 100644 --- a/source/blender/src/drawmesh.c +++ b/source/blender/src/drawmesh.c @@ -467,7 +467,7 @@ void draw_mesh_text(Object *ob, int glsl) MFace *mf, *mface= me->mface; MTFace *tface= me->mtface; MCol *mcol= me->mcol; /* why does mcol exist? */ - bProperty *prop = get_property(ob, "Text"); + bProperty *prop = get_ob_property(ob, "Text"); GPUVertexAttribs gattribs; int a, totface= me->totface; @@ -568,7 +568,7 @@ void draw_mesh_textured(Object *ob, DerivedMesh *dm, int faceselect) dm->drawFacesTex(dm, draw_tface__set_draw); /* draw game engine text hack */ - if(get_property(ob, "Text")) + if(get_ob_property(ob, "Text")) draw_mesh_text(ob, 0); draw_textured_end(); diff --git a/source/blender/src/drawobject.c b/source/blender/src/drawobject.c index 8a3176e16b2..527b36d0df4 100644 --- a/source/blender/src/drawobject.c +++ b/source/blender/src/drawobject.c @@ -2281,7 +2281,7 @@ static void draw_mesh_fancy(Base *base, int dt, int flag) glFrontFace((ob->transflag&OB_NEG_SCALE)?GL_CW:GL_CCW); dm->drawFacesGLSL(dm, GPU_enable_material); - if(get_property(ob, "Text")) + if(get_ob_property(ob, "Text")) draw_mesh_text(ob, 1); GPU_disable_material(); @@ -5187,7 +5187,7 @@ void draw_object(Base *base, int flag) } if(dt<OB_SHADED) { - if((ob->gameflag & OB_ACTOR) && (ob->gameflag & OB_DYNAMIC)) { + if(/*(ob->gameflag & OB_ACTOR) &&*/ (ob->gameflag & OB_DYNAMIC)) { float tmat[4][4], imat[4][4], vec[3]; vec[0]= vec[1]= vec[2]= 0.0; diff --git a/source/blender/src/drawview.c b/source/blender/src/drawview.c index 42576c901d7..60d7ab599ab 100644 --- a/source/blender/src/drawview.c +++ b/source/blender/src/drawview.c @@ -3422,7 +3422,7 @@ void drawview3dspace(ScrArea *sa, void *spacedata) /* run any view3d draw handler script links */ if (sa->scriptlink.totscript) - BPY_do_spacehandlers(sa, 0, SPACEHANDLER_VIEW3D_DRAW); + BPY_do_spacehandlers(sa, 0, 0, SPACEHANDLER_VIEW3D_DRAW); /* run scene redraw script links */ if((G.f & G_DOSCRIPTLINKS) && G.scene->scriptlink.totscript && diff --git a/source/blender/src/editaction.c b/source/blender/src/editaction.c index fe83976ee57..220265fcbaf 100644 --- a/source/blender/src/editaction.c +++ b/source/blender/src/editaction.c @@ -2102,7 +2102,7 @@ void paste_actdata () /* from selected channels */ for (ale= act_data.first; ale; ale= ale->next) { - Ipo *ipo_src=NULL, *ipo_dst=ale->key_data; + Ipo *ipo_src=NULL; bActionChannel *achan; IpoCurve *ico, *icu; BezTriple *bezt; @@ -2149,12 +2149,12 @@ void paste_actdata () } /* this shouldn't happen, but it might */ - if (ELEM(NULL, ipo_src, ipo_dst)) + if (ipo_src == NULL) continue; /* loop over curves, pasting keyframes */ for (ico= ipo_src->curve.first; ico; ico= ico->next) { - icu= verify_ipocurve((ID*)ob, ico->blocktype, actname, conname, "", ico->adrcode, 1); + icu= verify_ipocurve((ID*)ob, ico->blocktype, actname, conname, NULL, ico->adrcode, 1); if (icu) { /* just start pasting, with the the first keyframe on the current frame, and so on */ diff --git a/source/blender/src/editcurve.c b/source/blender/src/editcurve.c index 261bb26b0c4..f15ffcdcb58 100644 --- a/source/blender/src/editcurve.c +++ b/source/blender/src/editcurve.c @@ -262,7 +262,7 @@ static void printweightsNurb__doPrint(void *userData, Nurb *nurb, BPoint *bp, Be { char str[30]; - if (bp && (bp->f1&1)) { + if (bp && (bp->f1 & SELECT)) { sprintf(str,"%2.2f", bp->vec[3]); cpack(0x737373); @@ -2916,12 +2916,12 @@ void addvert_Nurb(int mode) if((nu->type & 7)==CU_BEZIER) { /* which bezpoint? */ if(bezt== nu->bezt) { /* first */ - bezt->f1= bezt->f2= bezt->f3= 0; + BEZ_DESEL(bezt); newbezt = (BezTriple*)MEM_callocN((nu->pntsu+1) * sizeof(BezTriple), "addvert_Nurb"); memcpy(newbezt+1, bezt, nu->pntsu*sizeof(BezTriple)); *newbezt= *bezt; - newbezt->f1= newbezt->f2= newbezt->f3= SELECT; + BEZ_SEL(newbezt); if(newbezt->h1 >= 0) newbezt->h2= newbezt->h1; else newbezt->h2= newbezt->h1= HD_ALIGN; /* does this ever happen? */ VECCOPY(temp, bezt->vec[1]); @@ -2930,7 +2930,7 @@ void addvert_Nurb(int mode) bezt= newbezt+1; } else if(bezt== (nu->bezt+nu->pntsu-1)) { /* last */ - bezt->f1= bezt->f2= bezt->f3= 0; + BEZ_DESEL(bezt); newbezt = (BezTriple*)MEM_callocN((nu->pntsu+1) * sizeof(BezTriple), "addvert_Nurb"); memcpy(newbezt, nu->bezt, nu->pntsu*sizeof(BezTriple)); @@ -2939,7 +2939,7 @@ void addvert_Nurb(int mode) MEM_freeN(nu->bezt); nu->bezt= newbezt; newbezt+= nu->pntsu; - newbezt->f1= newbezt->f2= newbezt->f3= SELECT; + BEZ_SEL(newbezt); if(newbezt->h1 >= 0) newbezt->h2= newbezt->h1; else newbezt->h2= newbezt->h1= HD_ALIGN; /* does this ever happen? */ bezt= nu->bezt+nu->pntsu-1; diff --git a/source/blender/src/editipo.c b/source/blender/src/editipo.c index fc0ac71908b..9a7f8e652a7 100644 --- a/source/blender/src/editipo.c +++ b/source/blender/src/editipo.c @@ -1346,14 +1346,10 @@ void update_editipo_flags(void) for(a=0; a<G.sipo->totipo; a++) { if(ik->data[a]) { if(ik->flag & 1) { - ik->data[a]->f1 |= SELECT; - ik->data[a]->f2 |= SELECT; - ik->data[a]->f3 |= SELECT; + BEZ_SEL(ik->data[a]); } else { - ik->data[a]->f1 &= ~SELECT; - ik->data[a]->f2 &= ~SELECT; - ik->data[a]->f3 &= ~SELECT; + BEZ_DESEL(ik->data[a]); } } } @@ -1451,7 +1447,7 @@ static short findnearest_ipovert(IpoCurve **icu, BezTriple **bezt) if(ei->disptype!=IPO_DISPBITS && ei->icu->ipo==IPO_BEZ) { /* middle points get an advantage */ temp= -3+abs(mval[0]- sco[0][0])+ abs(mval[1]- sco[0][1]); - if( bezt1->f1 & 1) temp+=5; + if( bezt1->f1 & SELECT) temp+=5; if(temp<dist) { hpoint= 0; *bezt= bezt1; @@ -1542,18 +1538,18 @@ void mouse_select_ipo(void) if(bezt) { if(hand==1) { if(BEZSELECTED(bezt)) { - bezt->f1= bezt->f2= bezt->f3= 0; + BEZ_DESEL(bezt); } else { - bezt->f1= bezt->f2= bezt->f3= SELECT; + BEZ_SEL(bezt); } } else if(hand==0) { - if(bezt->f1 & SELECT) bezt->f1= 0; + if(bezt->f1 & SELECT) bezt->f1 &= ~SELECT; else bezt->f1= SELECT; } else { - if(bezt->f3 & SELECT) bezt->f3= 0; + if(bezt->f3 & SELECT) bezt->f3 &= ~SELECT; else bezt->f3= SELECT; } } @@ -1563,7 +1559,7 @@ void mouse_select_ipo(void) if(bezt) { if(hand==1) { - bezt->f1|= SELECT; bezt->f2|= SELECT; bezt->f3|= SELECT; + BEZ_SEL(bezt); } else if(hand==0) bezt->f1 |= SELECT; else bezt->f3 |= SELECT; @@ -2290,7 +2286,7 @@ void add_duplicate_editipo(void) while(b--) { *beztn= *bezt; if(bezt->f2 & SELECT) { - beztn->f1= beztn->f2= beztn->f3= 0; + BEZ_DESEL(beztn); beztn++; *beztn= *bezt; } @@ -3503,14 +3499,10 @@ void make_ipokey(void) if(ik->data[a]) { bezt= ik->data[a]; if(sel) { - bezt->f1 |= SELECT; - bezt->f2 |= SELECT; - bezt->f3 |= SELECT; + BEZ_SEL(bezt); } else { - bezt->f1 &= ~SELECT; - bezt->f2 &= ~SELECT; - bezt->f3 &= ~SELECT; + BEZ_DESEL(bezt); } } } @@ -3618,15 +3610,11 @@ void make_ipokey_transform(Object *ob, ListBase *lb, int sel) icu= icu->next; } - - ik= lb->first; - while(ik) { - /* map ipo-keys for drawing/editing if scaled ipo */ - if (NLA_IPO_SCALED) { + if (NLA_IPO_SCALED) { + for (ik= lb->first; ik; ik= ik->next) { + /* map ipo-keys for drawing/editing if scaled ipo */ ik->val= get_action_frame_inv(OBACT, ik->val); } - - ik= ik->next; } } @@ -4678,7 +4666,7 @@ void duplicate_ipo_keys(Ipo *ipo) for (icu=ipo->curve.first; icu; icu=icu->next){ for (i=0; i<icu->totvert; i++){ /* If a key is selected */ - if (icu->bezt[i].f2 & 1){ + if (icu->bezt[i].f2 & SELECT){ /* Expand the list */ newbezt = MEM_callocN(sizeof(BezTriple) * (icu->totvert+1), "beztriple"); memcpy (newbezt, icu->bezt, sizeof(BezTriple) * (i+1)); @@ -4688,15 +4676,10 @@ void duplicate_ipo_keys(Ipo *ipo) MEM_freeN (icu->bezt); icu->bezt=newbezt; /* Unselect the current key*/ - icu->bezt[i].f1 &= ~ 1; - icu->bezt[i].f2 &= ~ 1; - icu->bezt[i].f3 &= ~ 1; + BEZ_DESEL(&icu->bezt[i]); i++; /* Select the copied key */ - icu->bezt[i].f1 |= 1; - icu->bezt[i].f2 |= 1; - icu->bezt[i].f3 |= 1; - + BEZ_SEL(&icu->bezt[i]); } } } diff --git a/source/blender/src/editipo_mods.c b/source/blender/src/editipo_mods.c index 24bb111c8d1..94a373d5841 100644 --- a/source/blender/src/editipo_mods.c +++ b/source/blender/src/editipo_mods.c @@ -136,10 +136,10 @@ void swap_selectall_editipo(void) b= ei->icu->totvert; while(b--) { if(totipo_vertsel) { - bezt->f1= bezt->f2= bezt->f3= 0; + BEZ_DESEL(bezt); } else { - bezt->f1= bezt->f2= bezt->f3= SELECT; + BEZ_SEL(bezt); } bezt++; } @@ -228,7 +228,7 @@ void deselectall_editipo(void) bezt= ei->icu->bezt; b= ei->icu->totvert; while(b--) { - bezt->f1= bezt->f2= bezt->f3= 0; + BEZ_SEL(bezt); bezt++; } } @@ -374,18 +374,14 @@ static int selected_bezier_loop(int (*looptest)(EditIpo *), int select_bezier_add(BezTriple *bezt) { /* Select the bezier triple */ - bezt->f1 |= SELECT; - bezt->f2 |= SELECT; - bezt->f3 |= SELECT; + BEZ_SEL(bezt); return 0; } int select_bezier_subtract(BezTriple *bezt) { /* Deselect the bezier triple */ - bezt->f1 &= ~SELECT; - bezt->f2 &= ~SELECT; - bezt->f3 &= ~SELECT; + BEZ_DESEL(bezt); return 0; } @@ -412,9 +408,9 @@ static int set_bezier_auto(BezTriple *bezt) /* is a handle selected? If so * set it to type auto */ - if(bezt->f1 || bezt->f3) { - if(bezt->f1) bezt->h1= 1; /* the secret code for auto */ - if(bezt->f3) bezt->h2= 1; + if((bezt->f1 & SELECT) || (bezt->f3 & SELECT)) { + if(bezt->f1 & SELECT) bezt->h1= 1; /* the secret code for auto */ + if(bezt->f3 & SELECT) bezt->h2= 1; /* if the handles are not of the same type, set them * to type free @@ -435,9 +431,9 @@ static int set_bezier_vector(BezTriple *bezt) /* is a handle selected? If so * set it to type vector */ - if(bezt->f1 || bezt->f3) { - if(bezt->f1) bezt->h1= 2; /* the code for vector */ - if(bezt->f3) bezt->h2= 2; + if((bezt->f1 & SELECT) || (bezt->f3 & SELECT)) { + if(bezt->f1 & SELECT) bezt->h1= 2; /* the code for vector */ + if(bezt->f3 & SELECT) bezt->h2= 2; /* if the handles are not of the same type, set them * to type free @@ -455,8 +451,8 @@ static int bezier_isfree(BezTriple *bezt) /* queries whether the handle should be set * to type 'free' (I think) */ - if(bezt->f1 && bezt->h1) return 1; - if(bezt->f3 && bezt->h2) return 1; + if((bezt->f1 & SELECT) && bezt->h1) return 1; + if((bezt->f3 & SELECT) && bezt->h2) return 1; return 0; } @@ -464,8 +460,8 @@ static int set_bezier_free(BezTriple *bezt) { /* Sets selected bezier handles to type 'free' */ - if(bezt->f1) bezt->h1= HD_FREE; - if(bezt->f3) bezt->h2= HD_FREE; + if(bezt->f1 & SELECT) bezt->h1= HD_FREE; + if(bezt->f3 & SELECT) bezt->h2= HD_FREE; return 0; } @@ -473,8 +469,8 @@ static int set_bezier_align(BezTriple *bezt) { /* Sets selected bezier handles to type 'align' */ - if(bezt->f1) bezt->h1= HD_ALIGN; - if(bezt->f3) bezt->h2= HD_ALIGN; + if(bezt->f1 & SELECT) bezt->h1= HD_ALIGN; + if(bezt->f3 & SELECT) bezt->h2= HD_ALIGN; return 0; } @@ -1032,6 +1028,7 @@ void borderselect_ipo(void) select_proj_ipo(&rectf, val); } else { + int selflag= (val==LEFTMOUSE) ? SELECT : 0; ei= G.sipo->editipo; for(a=0; a<G.sipo->totipo; a++, ei++) { @@ -1040,14 +1037,12 @@ void borderselect_ipo(void) b= ei->icu->totvert; bezt= ei->icu->bezt; while(b--) { - int bit= (val==LEFTMOUSE); - if(BLI_in_rctf(&rectf, bezt->vec[0][0], bezt->vec[0][1])) - bezt->f1 = (bezt->f1&~SELECT) | bit; + bezt->f1 = selflag ? (bezt->f1 | SELECT) : (bezt->f1 & ~SELECT); if(BLI_in_rctf(&rectf, bezt->vec[1][0], bezt->vec[1][1])) - bezt->f2 = (bezt->f2&~SELECT) | bit; + bezt->f2 = selflag ? (bezt->f2 | SELECT) : (bezt->f2 & ~SELECT); if(BLI_in_rctf(&rectf, bezt->vec[2][0], bezt->vec[2][1])) - bezt->f3 = (bezt->f3&~SELECT) | bit; + bezt->f3 = selflag ? (bezt->f3 | SELECT) : (bezt->f3 & ~SELECT); bezt++; } @@ -1211,19 +1206,13 @@ void set_ipo_key_selection(Ipo *ipo, int sel) for (icu=ipo->curve.first; icu; icu=icu->next){ for (i=0; i<icu->totvert; i++){ if (sel == 2) { - icu->bezt[i].f1^=1; - icu->bezt[i].f2^=1; - icu->bezt[i].f3^=1; + BEZ_INVSEL(&icu->bezt[i]); } else if (sel == 1){ - icu->bezt[i].f1|=1; - icu->bezt[i].f2|=1; - icu->bezt[i].f3|=1; + BEZ_SEL(&icu->bezt[i]); } else{ - icu->bezt[i].f1&=~1; - icu->bezt[i].f2&=~1; - icu->bezt[i].f3&=~1; + BEZ_DESEL(&icu->bezt[i]); } } } @@ -1240,10 +1229,10 @@ int fullselect_ipo_keys(Ipo *ipo) for (icu=ipo->curve.first; icu; icu=icu->next) { for (i=0; i<icu->totvert; i++){ - if (icu->bezt[i].f2 & 1){ + if (icu->bezt[i].f2 & SELECT){ tvtot+=3; - icu->bezt[i].f1 |= 1; - icu->bezt[i].f3 |= 1; + icu->bezt[i].f1 |= SELECT; + icu->bezt[i].f3 |= SELECT; } } } diff --git a/source/blender/src/editmesh_loop.c b/source/blender/src/editmesh_loop.c index 2c5386b86b6..138dd93e490 100644 --- a/source/blender/src/editmesh_loop.c +++ b/source/blender/src/editmesh_loop.c @@ -519,6 +519,7 @@ static CutCurve *get_mouse_trail(int *len, char mode, char cutmode, struct GHash glDrawBuffer(GL_FRONT); headerprint("(LMB) draw, (MMB) constrain to x/y screen axis, (Enter) cut (with Ctrl to select cut line), (Esc) cancel"); } + bglFlush(); persp(PERSP_WIN); @@ -620,14 +621,14 @@ static CutCurve *get_mouse_trail(int *len, char mode, char cutmode, struct GHash if ((i>1)&&(i!=lasti)) { /*Draw recorded part of curve */ sdrawline((int)curve[i-2].x, (int)curve[i-2].y, (int)curve[i-1].x, (int)curve[i-1].y); - glFlush(); + bglFlush(); } if ((i==lasti)&&(i>0)) { /*Draw rubberband */ glLineWidth(2.0); sdrawXORline((int)curve[i-1].x, (int)curve[i-1].y,(int)mval[0], (int)mval[1]); glLineWidth(1.0); - glFlush(); + bglFlush(); rubberband=1; } lasti=i; diff --git a/source/blender/src/editobject.c b/source/blender/src/editobject.c index 2459f7ed23c..29d7b52487f 100644 --- a/source/blender/src/editobject.c +++ b/source/blender/src/editobject.c @@ -3192,7 +3192,7 @@ void flip_subdivison(int level) static void copymenu_properties(Object *ob) { - bProperty *prop, *propn, *propc; + bProperty *prop; Base *base; int nr, tot=0; char *str; @@ -3208,45 +3208,43 @@ static void copymenu_properties(Object *ob) return; } - str= MEM_callocN(24+32*tot, "copymenu prop"); + str= MEM_callocN(50 + 33*tot, "copymenu prop"); - strcpy(str, "Copy Property %t"); + strcpy(str, "Copy Property %t|Replace All|Merge All|%l"); tot= 0; prop= ob->prop.first; while(prop) { tot++; - strcat(str, " |"); + strcat(str, "|"); strcat(str, prop->name); prop= prop->next; } nr= pupmenu(str); - if(nr>0) { - tot= 0; - prop= ob->prop.first; - while(prop) { - tot++; - if(tot==nr) break; - prop= prop->next; + + if ( nr==1 || nr==2 ) { + base= FIRSTBASE; + while(base) { + if((base != BASACT) && TESTBASELIB(base)) { + if (nr==1) { /* replace */ + copy_properties( &base->object->prop, &ob->prop ); + } else { + for(prop = ob->prop.first; prop; prop= prop->next ) { + set_ob_property(base->object, prop); + } + } + } + base= base->next; } + } else if(nr>0) { + prop = BLI_findlink(&ob->prop, nr-4); /* account for first 3 menu items & menu index starting at 1*/ + if(prop) { - propc= prop; - - base= FIRSTBASE; - while(base) { - if(base != BASACT) { - if(TESTBASELIB(base)) { - prop= get_property(base->object, propc->name); - if(prop) { - free_property(prop); - BLI_remlink(&base->object->prop, prop); - } - propn= copy_property(propc); - BLI_addtail(&base->object->prop, propn); - } + for(base= FIRSTBASE; base; base= base->next) { + if((base != BASACT) && TESTBASELIB(base)) { + set_ob_property(base->object, prop); } - base= base->next; } } } @@ -3672,6 +3670,9 @@ void copy_attr(short event) else if(event==30) { /* index object */ base->object->index= ob->index; } + else if(event==31) { /* object color */ + QUATCOPY(base->object->col, ob->col); + } } } base= base->next; @@ -3710,7 +3711,7 @@ void copy_attr_menu() * view3d_edit_object_copyattrmenu() and in toolbox.c */ - strcpy(str, "Copy Attributes %t|Location%x1|Rotation%x2|Size%x3|Draw Options%x4|Time Offset%x5|Dupli%x6|%l|Mass%x7|Damping%x8|All Physical Attributes%x11|Properties%x9|Logic Bricks%x10|Protected Transform%x29|%l"); + strcpy(str, "Copy Attributes %t|Location%x1|Rotation%x2|Size%x3|Draw Options%x4|Time Offset%x5|Dupli%x6|Object Color%x31|%l|Mass%x7|Damping%x8|All Physical Attributes%x11|Properties%x9|Logic Bricks%x10|Protected Transform%x29|%l"); strcat (str, "|Object Constraints%x22"); strcat (str, "|NLA Strips%x26"); diff --git a/source/blender/src/editseq.c b/source/blender/src/editseq.c index e9d0b57a166..d16e3f28671 100644 --- a/source/blender/src/editseq.c +++ b/source/blender/src/editseq.c @@ -687,6 +687,24 @@ static void recurs_sel_seq(Sequence *seqm) } } +void select_single_seq(Sequence *seq, int deselect_all) +{ + if(deselect_all) + deselect_all_seq(); + set_last_seq(seq); + + if((seq->type==SEQ_IMAGE) || (seq->type==SEQ_MOVIE)) { + if(seq->strip) + strncpy(last_imagename, seq->strip->dir, FILE_MAXDIR-1); + } + else if((seq->type==SEQ_HD_SOUND) || (seq->type==SEQ_RAM_SOUND)) { + if(seq->strip) + strncpy(last_sounddir, seq->strip->dir, FILE_MAXDIR-1); + } + seq->flag|= SELECT; + recurs_sel_seq(seq); +} + void swap_select_seq(void) { Sequence *seq; @@ -932,7 +950,11 @@ void mouse_select_seq(void) } force_draw_plus(SPACE_BUTS, 0); - if(get_last_seq()) allqueue(REDRAWIPO, 0); + if(get_last_seq()) { + allqueue(REDRAWIPO, 0); + allqueue(REDRAWOOPS, 0); + } + BIF_undo_push("Select Strips, Sequencer"); std_rmouse_transform(transform_seq_nomarker); @@ -2211,6 +2233,7 @@ void del_seq(void) BIF_undo_push("Delete Strip(s), Sequencer"); allqueue(REDRAWSEQ, 0); + allqueue(REDRAWOOPS, 0); } static Sequence *dupli_seq(Sequence *seq) @@ -2897,7 +2920,7 @@ void un_meta(void) BIF_undo_push("Un-Make Meta Strip, Sequencer"); allqueue(REDRAWSEQ, 0); - + allqueue(REDRAWOOPS, 0); } void exit_meta(void) @@ -2930,6 +2953,7 @@ void exit_meta(void) MEM_freeN(ms); allqueue(REDRAWSEQ, 0); + allqueue(REDRAWOOPS, 0); BIF_undo_push("Exit Meta Strip, Sequence"); } @@ -2958,6 +2982,7 @@ void enter_meta(void) set_last_seq(NULL); allqueue(REDRAWSEQ, 0); + allqueue(REDRAWOOPS, 0); BIF_undo_push("Enter Meta Strip, Sequence"); } diff --git a/source/blender/src/glutil.c b/source/blender/src/glutil.c index 69e3d4c7aac..69a44aff1e4 100644 --- a/source/blender/src/glutil.c +++ b/source/blender/src/glutil.c @@ -290,7 +290,6 @@ static int get_cached_work_texture(int *w_r, int *h_r) return texid; } -#define FTOCHAR(val) val<=0.0f?0: (val>=1.0f?255: (char)(255.0f*val)) void glaDrawPixelsTex(float x, float y, int img_w, int img_h, int format, void *rect) { float *f_rect; diff --git a/source/blender/src/header_oops.c b/source/blender/src/header_oops.c index ad65705b79d..68326c330ad 100644 --- a/source/blender/src/header_oops.c +++ b/source/blender/src/header_oops.c @@ -559,15 +559,15 @@ void oops_buttons(void) else { if(G.main->library.first) #ifdef WITH_VERSE - uiDefButS(block, MENU, B_REDR, "Outliner Display%t|Verse Servers %x9|Verse Sessions %x8|Libraries %x7|All Scenes %x0|Current Scene %x1|Visible Layers %x2|Groups %x6|Same Types %x5|Selected %x3|Active %x4", xco, 0, 100, 20, &soops->outlinevis, 0, 0, 0, 0, ""); + uiDefButS(block, MENU, B_REDR, "Outliner Display%t|Verse Servers %x9|Verse Sessions %x8|Libraries %x7|All Scenes %x0|Current Scene %x1|Visible Layers %x2|Groups %x6|Same Types %x5|Selected %x3|Active %x4|Sequence %x10", xco, 0, 100, 20, &soops->outlinevis, 0, 0, 0, 0, ""); #else - uiDefButS(block, MENU, B_REDR, "Outliner Display%t|Libraries %x7|All Scenes %x0|Current Scene %x1|Visible Layers %x2|Groups %x6|Same Types %x5|Selected %x3|Active %x4", xco, 0, 100, 20, &soops->outlinevis, 0, 0, 0, 0, ""); + uiDefButS(block, MENU, B_REDR, "Outliner Display%t|Libraries %x7|All Scenes %x0|Current Scene %x1|Visible Layers %x2|Groups %x6|Same Types %x5|Selected %x3|Active %x4|Sequence %x10", xco, 0, 100, 20, &soops->outlinevis, 0, 0, 0, 0, ""); #endif /* WITH_VERSE */ else #ifdef WITH_VERSE - uiDefButS(block, MENU, B_REDR, "Outliner Display%t|Verse Servers %x9|Verse Sessions %x8|All Scenes %x0|Current Scene %x1|Visible Layers %x2|Groups %x6|Same Types %x5|Selected %x3|Active %x4", xco, 0, 100, 20, &soops->outlinevis, 0, 0, 0, 0, ""); + uiDefButS(block, MENU, B_REDR, "Outliner Display%t|Verse Servers %x9|Verse Sessions %x8|All Scenes %x0|Current Scene %x1|Visible Layers %x2|Groups %x6|Same Types %x5|Selected %x3|Active %x4|Sequence %x10", xco, 0, 100, 20, &soops->outlinevis, 0, 0, 0, 0, ""); #else - uiDefButS(block, MENU, B_REDR, "Outliner Display%t|All Scenes %x0|Current Scene %x1|Visible Layers %x2|Groups %x6|Same Types %x5|Selected %x3|Active %x4", xco, 0, 100, 20, &soops->outlinevis, 0, 0, 0, 0, ""); + uiDefButS(block, MENU, B_REDR, "Outliner Display%t|All Scenes %x0|Current Scene %x1|Visible Layers %x2|Groups %x6|Same Types %x5|Selected %x3|Active %x4|Sequence %x10", xco, 0, 100, 20, &soops->outlinevis, 0, 0, 0, 0, ""); #endif /* WITH_VERSE */ } diff --git a/source/blender/src/header_view3d.c b/source/blender/src/header_view3d.c index 36ba819b3f1..827103cbb32 100644 --- a/source/blender/src/header_view3d.c +++ b/source/blender/src/header_view3d.c @@ -885,6 +885,8 @@ void do_view3d_select_object_groupedmenu(void *arg, int event) case 7: /* Objects in Same Group */ case 8: /* Object Hooks*/ case 9: /* Object PassIndex*/ + case 10: /* Object Color*/ + case 11: /* Game Properties*/ select_object_grouped((short)event); break; } @@ -907,7 +909,9 @@ static uiBlock *view3d_select_object_groupedmenu(void *arg_unused) uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Objects on Shared Layers|Shift G, 6", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 6, ""); uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Objects in Same Group|Shift G, 7", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 7, ""); uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Object Hooks|Shift G, 8", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 8, ""); - uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Object PassIndex|Shift G, 9", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 9, ""); + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Object PassIndex|Shift G, 9", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 9, ""); + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Object Color|Shift G, 0", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 10, ""); + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Game Properties|Shift G, Alt+1", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 11, ""); uiBlockSetDirection(block, UI_RIGHT); uiTextBoundsBlock(block, 60); diff --git a/source/blender/src/outliner.c b/source/blender/src/outliner.c index 52c5592be38..8d33496f068 100644 --- a/source/blender/src/outliner.c +++ b/source/blender/src/outliner.c @@ -56,9 +56,12 @@ #include "DNA_texture_types.h" #include "DNA_text_types.h" #include "DNA_world_types.h" +#include "DNA_sequence_types.h" #include "BLI_blenlib.h" +#include "IMB_imbuf_types.h" + #include "BKE_constraint.h" #include "BKE_deform.h" #include "BKE_depsgraph.h" @@ -100,6 +103,7 @@ #include "BIF_screen.h" #include "BIF_space.h" #include "BIF_toolbox.h" +#include "BIF_editseq.h" #ifdef WITH_VERSE #include "BIF_verse.h" @@ -301,7 +305,7 @@ static ID *outliner_search_back(SpaceOops *soops, TreeElement *te, short idcode) while(te) { tselem= TREESTORE(te); - if(te->idcode==idcode && tselem->type==0) return tselem->id; + if(tselem->type==0 && te->idcode==idcode) return tselem->id; te= te->parent; } return NULL; @@ -558,8 +562,10 @@ static TreeElement *outliner_add_element(SpaceOops *soops, ListBase *lb, void *i te->parent= parent; te->index= index; // for data arays - te->name= id->name+2; // default, can be overridden by Library or non-ID data - te->idcode= GS(id->name); + if((type!=TSE_SEQUENCE) && (type != TSE_SEQ_STRIP) && (type != TSE_SEQUENCE_DUP)) { + te->name= id->name+2; // default, can be overridden by Library or non-ID data + te->idcode= GS(id->name); + } if(type==0) { @@ -898,6 +904,65 @@ static TreeElement *outliner_add_element(SpaceOops *soops, ListBase *lb, void *i break; } } + else if(type==TSE_SEQUENCE) { + Sequence *seq= (Sequence*) idv; + Sequence *p; + + /* + * The idcode is a little hack, but the outliner + * only check te->idcode if te->type is equal to zero, + * so this is "safe". + */ + te->idcode= seq->type; + te->directdata= seq; + + if(seq->type<7) { + /* + * This work like the sequence. + * If the sequence have a name (not default name) + * show it, in other case put the filename. + */ + if(strcmp(seq->name, "SQ")) + te->name= seq->name; + else { + if((seq->strip) && (seq->strip->stripdata)) + te->name= seq->strip->stripdata->name; + else if((seq->strip) && (seq->strip->tstripdata) && (seq->strip->tstripdata->ibuf)) + te->name= seq->strip->tstripdata->ibuf->name; + else + te->name= "SQ None"; + } + + if(seq->type==SEQ_META) { + te->name= "Meta Strip"; + p= seq->seqbase.first; + while(p) { + outliner_add_element(soops, &te->subtree, (void*)p, te, TSE_SEQUENCE, index); + p= p->next; + } + } + else + outliner_add_element(soops, &te->subtree, (void*)seq->strip, te, TSE_SEQ_STRIP, index); + } + else + te->name= "Effect"; + } + else if(type==TSE_SEQ_STRIP) { + Strip *strip= (Strip *)idv; + + if(strip->dir) + te->name= strip->dir; + else + te->name= "Strip None"; + te->directdata= strip; + } + else if(type==TSE_SEQUENCE_DUP) { + Sequence *seq= (Sequence*)idv; + + te->idcode= seq->type; + te->directdata= seq; + te->name= seq->strip->stripdata->name; + } #ifdef WITH_VERSE else if(type==ID_VS) { struct VerseSession *session = (VerseSession*)idv; @@ -964,6 +1029,62 @@ static void outliner_make_hierarchy(SpaceOops *soops, ListBase *lb) } } +/* Helped function to put duplicate sequence in the same tree. */ +int need_add_seq_dup(Sequence *seq) +{ + Sequence *p; + + if((!seq->strip) || (!seq->strip->stripdata) || (!seq->strip->stripdata->name)) + return(1); + + /* + * First check backward, if we found a duplicate + * sequence before this, don't need it, just return. + */ + p= seq->prev; + while(p) { + if((!p->strip) || (!p->strip->stripdata) || (!p->strip->stripdata->name)) { + p= p->prev; + continue; + } + + if(!strcmp(p->strip->stripdata->name, seq->strip->stripdata->name)) + return(2); + p= p->prev; + } + + p= seq->next; + while(p) { + if((!p->strip) || (!p->strip->stripdata) || (!p->strip->stripdata->name)) { + p= p->next; + continue; + } + + if(!strcmp(p->strip->stripdata->name, seq->strip->stripdata->name)) + return(0); + p= p->next; + } + return(1); +} + +void add_seq_dup(SpaceOops *soops, Sequence *seq, TreeElement *te, short index) +{ + TreeElement *ch; + Sequence *p; + + p= seq; + while(p) { + if((!p->strip) || (!p->strip->stripdata) || (!p->strip->stripdata->name)) { + p= p->next; + continue; + } + + if(!strcmp(p->strip->stripdata->name, seq->strip->stripdata->name)) + ch= outliner_add_element(soops, &te->subtree, (void*)p, te, TSE_SEQUENCE, index); + p= p->next; + } +} + static void outliner_build_tree(SpaceOops *soops) { Base *base; @@ -1120,6 +1241,30 @@ static void outliner_build_tree(SpaceOops *soops) } } #endif + else if(soops->outlinevis==SO_SEQUENCE) { + Sequence *seq; + Editing *ed; + int op; + + ed= G.scene->ed; + if(!ed) + return; + + seq= ed->seqbasep->first; + if(!seq) + return; + + while(seq) { + op= need_add_seq_dup(seq); + if(op==1) + ten= outliner_add_element(soops, &soops->tree, (void*)seq, NULL, TSE_SEQUENCE, 0); + else if(op==0) { + ten= outliner_add_element(soops, &soops->tree, (void*)seq, NULL, TSE_SEQUENCE_DUP, 0); + add_seq_dup(soops, seq, ten, 0); + } + seq= seq->next; + } + } else { ten= outliner_add_element(soops, &soops->tree, OBACT, NULL, 0, 0); if(ten) ten->directdata= BASACT; @@ -1884,6 +2029,50 @@ static int tree_element_active_pose(TreeElement *te, TreeStoreElem *tselem, int return 0; } +static int tree_element_active_sequence(TreeElement *te, TreeStoreElem *tselem, int set) +{ + Sequence *seq= (Sequence*) te->directdata; + + if(set) { + select_single_seq(seq, 1); + allqueue(REDRAWSEQ, 0); + } + else { + if(seq->flag & SELECT) + return(1); + } + return(0); +} + +static int tree_element_active_sequence_dup(TreeElement *te, TreeStoreElem *tselem, int set) +{ + Sequence *seq, *p; + Editing *ed; + + seq= (Sequence*)te->directdata; + if(set==0) { + if(seq->flag & SELECT) + return(1); + return(0); + } + + select_single_seq(seq, 1); + ed= G.scene->ed; + p= ed->seqbasep->first; + while(p) { + if((!p->strip) || (!p->strip->stripdata) || (!p->strip->stripdata->name)) { + p= p->next; + continue; + } + + if(!strcmp(p->strip->stripdata->name, seq->strip->stripdata->name)) + select_single_seq(p, 0); + p= p->next; + } + allqueue(REDRAWSEQ, 0); + return(0); +} + /* generic call for non-id data to make/check active in UI */ static int tree_element_type_active(SpaceOops *soops, TreeElement *te, TreeStoreElem *tselem, int set) { @@ -1914,6 +2103,12 @@ static int tree_element_type_active(SpaceOops *soops, TreeElement *te, TreeStore return tree_element_active_renderlayer(te, tselem, set); case TSE_POSEGRP: return tree_element_active_posegroup(te, tselem, set); + case TSE_SEQUENCE: + return tree_element_active_sequence(te, tselem, set); + break; + case TSE_SEQUENCE_DUP: + return tree_element_active_sequence_dup(te, tselem, set); + break; } return 0; } @@ -2035,6 +2230,8 @@ static int do_outliner_mouse_event(SpaceOops *soops, TreeElement *te, short even if (G.qual == LR_CTRLKEY) { if(ELEM9(tselem->type, TSE_NLA, TSE_DEFGROUP_BASE, TSE_CONSTRAINT_BASE, TSE_MODIFIER_BASE, TSE_SCRIPT_BASE, TSE_POSE_BASE, TSE_POSEGRP_BASE, TSE_R_LAYER_BASE, TSE_R_PASS)) error("Cannot edit builtin name"); + else if(ELEM3(tselem->type, TSE_SEQUENCE, TSE_SEQ_STRIP, TSE_SEQUENCE_DUP)) + error("Cannot edit sequence name"); else if(tselem->id->lib) { error_libdata(); } else if(te->idcode == ID_LI && te->parent) { @@ -2044,7 +2241,8 @@ static int do_outliner_mouse_event(SpaceOops *soops, TreeElement *te, short even } } else { /* always makes active object */ - tree_element_active_object(soops, te); + if(tselem->type!=TSE_SEQUENCE && tselem->type!=TSE_SEQ_STRIP && tselem->type!=TSE_SEQUENCE_DUP) + tree_element_active_object(soops, te); if(tselem->type==0) { // the lib blocks /* editmode? */ @@ -2070,7 +2268,7 @@ static int do_outliner_mouse_event(SpaceOops *soops, TreeElement *te, short even } else if(event==RIGHTMOUSE) { #ifdef WITH_VERSE - if(ELEM4(te->idcode, ID_VS, ID_VN, ID_MS, ID_SS)) + if((tselem->type!=TSE_SEQUENCE && tselem->type!=TSE_SEQ_STRIP && tselem->type!=TSE_SEQUENCE_DUP) && ELEM4(te->idcode, ID_VS, ID_VN, ID_MS, ID_SS)) verse_operation_menu(te); else #endif @@ -2274,8 +2472,8 @@ static TreeElement *outliner_find_tse(SpaceOops *soops, TreeStoreElem *tse) /* check if 'tse' is in treestore */ tselem= ts->data; for(a=0; a<ts->usedelem; a++, tselem++) { - if(tselem->id==tse->id) { - if((tse->type==0 && tselem->type==0) || (tselem->type==tse->type && tselem->nr==tse->nr)) { + if((tse->type==0 && tselem->type==0) || (tselem->type==tse->type && tselem->nr==tse->nr)) { + if(tselem->id==tse->id) { break; } } @@ -2488,12 +2686,18 @@ static void set_operation_types(SpaceOops *soops, ListBase *lb, tselem= TREESTORE(te); if(tselem->flag & TSE_SELECTED) { if(tselem->type) { + if(tselem->type==TSE_SEQUENCE) + *datalevel= TSE_SEQUENCE; + else if(tselem->type==TSE_SEQ_STRIP) + *datalevel= TSE_SEQ_STRIP; + else if(tselem->type==TSE_SEQUENCE_DUP) + *datalevel= TSE_SEQUENCE_DUP; #ifdef WITH_VERSE - if(te->idcode==ID_VS) *datalevel= TSE_VERSE_SESSION; + else if(te->idcode==ID_VS) *datalevel= TSE_VERSE_SESSION; else if(te->idcode==ID_VN) *datalevel= TSE_VERSE_OBJ_NODE; else if(*datalevel==0) *datalevel= tselem->type; #else - if(*datalevel==0) *datalevel= tselem->type; + else if(*datalevel==0) *datalevel= tselem->type; #endif else if(*datalevel!=tselem->type) *datalevel= -1; } @@ -2783,6 +2987,15 @@ static void vsession_cb(int event, TreeElement *te, TreeStoreElem *tselem) } #endif +static void sequence_cb(int event, TreeElement *te, TreeStoreElem *tselem) +{ + Sequence *seq= (Sequence*) te->directdata; + if(event==1) { + select_single_seq(seq, 1); + allqueue(REDRAWSEQ, 0); + } +} + static void outliner_do_data_operation(SpaceOops *soops, int type, int event, ListBase *lb, void (*operation_cb)(int, TreeElement *, TreeStoreElem *)) { @@ -2805,10 +3018,14 @@ static void outliner_do_data_operation(SpaceOops *soops, int type, int event, Li void outliner_del(ScrArea *sa) { SpaceOops *soops= sa->spacedata.first; - outliner_do_object_operation(soops, &soops->tree, object_delete_cb); - DAG_scene_sort(G.scene); - countall(); - BIF_undo_push("Delete Objects"); + if(soops->outlinevis==SO_SEQUENCE) + del_seq(); + else { + outliner_do_object_operation(soops, &soops->tree, object_delete_cb); + DAG_scene_sort(G.scene); + countall(); + BIF_undo_push("Delete Objects"); + } allqueue(REDRAWALL, 0); } @@ -2941,7 +3158,13 @@ void outliner_operation_menu(ScrArea *sa) } } #endif - + else if(datalevel==TSE_SEQUENCE) { + short event= pupmenu("Sequence Operations %t|Select %x1"); + if(event>0) { + outliner_do_data_operation(soops, datalevel, event, &soops->tree, sequence_cb); + } + } + allqueue(REDRAWOOPS, 0); allqueue(REDRAWBUTSALL, 0); allqueue(REDRAWVIEW3D, 0); @@ -3021,7 +3244,26 @@ static void tselem_draw_icon(float x, float y, TreeStoreElem *tselem, TreeElemen BIF_icon_draw(x, y, ICON_MATERIAL_DEHLT); break; case TSE_POSEGRP_BASE: BIF_icon_draw(x, y, ICON_VERTEXSEL); break; - + case TSE_SEQUENCE: + if((te->idcode==SEQ_MOVIE) || (te->idcode==SEQ_MOVIE_AND_HD_SOUND)) + BIF_icon_draw(x, y, ICON_SEQUENCE); + else if(te->idcode==SEQ_META) + BIF_icon_draw(x, y, ICON_DOT); + else if(te->idcode==SEQ_SCENE) + BIF_icon_draw(x, y, ICON_SCENE); + else if((te->idcode==SEQ_RAM_SOUND) || (te->idcode==SEQ_HD_SOUND)) + BIF_icon_draw(x, y, ICON_SOUND); + else if(te->idcode==SEQ_IMAGE) + BIF_icon_draw(x, y, ICON_IMAGE_COL); + else + BIF_icon_draw(x, y, ICON_PARTICLES); + break; + case TSE_SEQ_STRIP: + BIF_icon_draw(x, y, ICON_LIBRARY_DEHLT); + break; + case TSE_SEQUENCE_DUP: + BIF_icon_draw(x, y, ICON_OBJECT); + break; #ifdef WITH_VERSE case ID_VS: case ID_MS: @@ -3234,7 +3476,7 @@ static void outliner_draw_tree_element(SpaceOops *soops, TreeElement *te, int st } /* open/close icon, only when sublevels, except for scene */ - if(te->subtree.first || (te->idcode==ID_SCE && tselem->type==0)) { + if(te->subtree.first || (tselem->type==0 && te->idcode==ID_SCE)) { int icon_x; if((tselem->type==0 && ELEM(te->idcode, ID_OB, ID_SCE)) || ELEM4(te->idcode,ID_VN,ID_VS, ID_MS, ID_SS)) icon_x = startx; @@ -3255,7 +3497,7 @@ static void outliner_draw_tree_element(SpaceOops *soops, TreeElement *te, int st tselem_draw_icon(startx+offsx, *starty+2, tselem, te); offsx+= OL_X; - if(tselem->id->lib && tselem->type==0) { + if(tselem->type==0 && tselem->id->lib) { glPixelTransferf(GL_ALPHA_SCALE, 0.5); if(tselem->id->flag & LIB_INDIRECT) BIF_icon_draw(startx+offsx, *starty+2, ICON_DATALIB); @@ -3761,6 +4003,9 @@ static void outliner_buttons(uiBlock *block, SpaceOops *soops, ListBase *lb) if(te->ys >= soops->v2d.cur.ymin && te->ys <= soops->v2d.cur.ymax) { if(tselem->flag & TSE_TEXTBUT) { + /* If we add support to rename Sequence. + * need change this. + */ if(tselem->type == TSE_POSE_BASE) continue; // prevent crash when trying to rename 'pose' entry of armature if(tselem->type==TSE_EBONE) len = sizeof(((EditBone*) 0)->name); diff --git a/source/blender/src/renderwin.c b/source/blender/src/renderwin.c index 33484500328..b4d78b7fa37 100644 --- a/source/blender/src/renderwin.c +++ b/source/blender/src/renderwin.c @@ -426,7 +426,6 @@ static void renderwin_zoom(RenderWin *rw, int ZoomIn) { renderwin_queue_redraw(rw); } -#define FTOCHAR(val) val<=0.0f? 0 : (val>=(1.0f-0.5f/255.0f)? 255 :(char)((255.0f*val)+0.5f)) static void renderwin_mouse_moved(RenderWin *rw) { @@ -1132,7 +1131,7 @@ static void do_render(int anim) } if(anim) - RE_BlenderAnim(re, G.scene, G.scene->r.sfra, G.scene->r.efra); + RE_BlenderAnim(re, G.scene, G.scene->r.sfra, G.scene->r.efra, G.scene->frame_step); else RE_BlenderFrame(re, G.scene, G.scene->r.cfra); @@ -1274,16 +1273,9 @@ void BIF_store_spare(void) /* set up display, render an image or scene */ void BIF_do_render(int anim) { - int slink_flag = 0; + if (G.f & G_DOSCRIPTLINKS) + BPY_do_all_scripts(SCRIPT_RENDER, anim); - if (G.f & G_DOSCRIPTLINKS) { - BPY_do_all_scripts(SCRIPT_RENDER); - if (!anim) { /* avoid FRAMECHANGED slink in render callback */ - G.f &= ~G_DOSCRIPTLINKS; - slink_flag = 1; - } - } - BIF_store_spare(); do_render(anim); @@ -1294,8 +1286,8 @@ void BIF_do_render(int anim) } if(G.scene->r.dither_intensity != 0.0f) BIF_redraw_render_rect(); - if (slink_flag) G.f |= G_DOSCRIPTLINKS; - if (G.f & G_DOSCRIPTLINKS) BPY_do_all_scripts(SCRIPT_POSTRENDER); + + if (G.f & G_DOSCRIPTLINKS) BPY_do_all_scripts(SCRIPT_POSTRENDER, anim); } void do_ogl_view3d_render(Render *re, View3D *v3d, int winx, int winy) @@ -1345,16 +1337,28 @@ void BIF_do_ogl_render(View3D *v3d, int anim) if(anim) { bMovieHandle *mh= BKE_get_movie_handle(G.scene->r.imtype); + unsigned int lay; int cfrao= CFRA; + int nfra; if(BKE_imtype_is_movie(G.scene->r.imtype)) mh->start_movie(&G.scene->r, winx, winy); - for(CFRA= SFRA; CFRA<=EFRA; CFRA++) { + for(nfra= SFRA, CFRA= SFRA; CFRA<=EFRA; CFRA++) { /* user event can close window */ if(render_win==NULL) break; + if(nfra!=CFRA) { + if(G.scene->lay & 0xFF000000) + lay= G.scene->lay & 0xFF000000; + else + lay= G.scene->lay; + + scene_update_for_newframe(G.scene, lay); + continue; + } + do_ogl_view3d_render(re, v3d, winx, winy); glReadPixels(0, 0, winx, winy, GL_RGBA, GL_UNSIGNED_BYTE, rr->rect32); if((G.scene->r.scemode & R_STAMP_INFO) && (G.scene->r.stamp & R_STAMP_DRAW)) { @@ -1389,6 +1393,7 @@ void BIF_do_ogl_render(View3D *v3d, int anim) printf("\n"); if(test_break()) break; + nfra+= STFRA; } if(BKE_imtype_is_movie(G.scene->r.imtype)) diff --git a/source/blender/src/retopo.c b/source/blender/src/retopo.c index 60be622e3ad..47eee872a8a 100644 --- a/source/blender/src/retopo.c +++ b/source/blender/src/retopo.c @@ -826,11 +826,11 @@ void retopo_do_all() } else if(nu->type & CU_BEZIER) { for(i=0; i<nu->pntsu; ++i) { - if(nu->bezt[i].f1 & 1) + if(nu->bezt[i].f1 & SELECT) retopo_do_vert(G.vd, nu->bezt[i].vec[0]); - if(nu->bezt[i].f2 & 1) + if(nu->bezt[i].f2 & SELECT) retopo_do_vert(G.vd, nu->bezt[i].vec[1]); - if(nu->bezt[i].f3 & 1) + if(nu->bezt[i].f3 & SELECT) retopo_do_vert(G.vd, nu->bezt[i].vec[2]); } } diff --git a/source/blender/src/seqaudio.c b/source/blender/src/seqaudio.c index 7c27f32c242..2c86ac92c7f 100644 --- a/source/blender/src/seqaudio.c +++ b/source/blender/src/seqaudio.c @@ -27,6 +27,7 @@ * ***** END GPL LICENSE BLOCK ***** */ + #include <math.h> #include <stdlib.h> #include <string.h> @@ -118,6 +119,7 @@ void makewavstring (char *string) void audio_mixdown() { +#ifndef DISABLE_SDL int file, c, totlen, totframe, i, oldcfra; char *buf; @@ -203,6 +205,7 @@ void audio_mixdown() MEM_freeN(buf); return; +#endif } void audiostream_fill(Uint8 *mixdown, int len) @@ -211,7 +214,7 @@ void audiostream_fill(Uint8 *mixdown, int len) int i; memset(mixdown, 0, len); - +#ifndef DISABLE_SDL for (i = 0; i < len; i += 64) { CFRA = (int) ( ((float)(audio_pos-64) /( G.scene->audio.mixrate*4 )) @@ -222,6 +225,7 @@ void audiostream_fill(Uint8 *mixdown, int len) } CFRA = oldcfra; +#endif } @@ -288,6 +292,7 @@ void audio_makestream(bSound *sound) } } +#ifndef DISABLE_SDL static void audio_fill_ram_sound(Sequence *seq, void * mixdown, Uint8 * sstream, int len) { @@ -318,7 +323,9 @@ static void audio_fill_ram_sound(Sequence *seq, void * mixdown, } seq->curpos += len; } +#endif +#ifndef DISABLE_SDL static void audio_fill_hd_sound(Sequence *seq, void * mixdown, Uint8 * sstream, int len) @@ -354,7 +361,9 @@ static void audio_fill_hd_sound(Sequence *seq, } seq->curpos += len; } +#endif +#ifndef DISABLE_SDL static void audio_fill_seq(Sequence * seq, void * mixdown, Uint8 *sstream, int len, int advance_only) { @@ -407,7 +416,9 @@ static void audio_fill_seq(Sequence * seq, void * mixdown, seq = seq->next; } } +#endif +#ifndef DISABLE_SDL void audio_fill(void *mixdown, Uint8 *sstream, int len) { Editing *ed; @@ -427,7 +438,9 @@ void audio_fill(void *mixdown, Uint8 *sstream, int len) } } } +#endif +#ifndef DISABLE_SDL static int audio_init(SDL_AudioSpec *desired) { SDL_AudioSpec *obtained, *hardware_spec; @@ -452,6 +465,7 @@ static int audio_init(SDL_AudioSpec *desired) SDL_PauseAudio(0); return 1; } +#endif static int audiostream_play_seq(Sequence * seq, Uint32 startframe) { @@ -498,6 +512,7 @@ static int audiostream_play_seq(Sequence * seq, Uint32 startframe) void audiostream_play(Uint32 startframe, Uint32 duration, int mixdown) { +#ifndef DISABLE_SDL static SDL_AudioSpec desired; Editing *ed; int have_sound = 0; @@ -539,6 +554,7 @@ void audiostream_play(Uint32 startframe, Uint32 duration, int mixdown) SDL_PauseAudio(0); audio_playing++; } +#endif } void audiostream_start(Uint32 frame) @@ -553,8 +569,10 @@ void audiostream_scrub(Uint32 frame) void audiostream_stop(void) { +#ifndef DISABLE_SDL SDL_PauseAudio(1); audio_playing=0; +#endif } int audiostream_pos(void) diff --git a/source/blender/src/seqscopes.c b/source/blender/src/seqscopes.c index 34cd27dfdd3..553752c0676 100644 --- a/source/blender/src/seqscopes.c +++ b/source/blender/src/seqscopes.c @@ -384,7 +384,6 @@ static void draw_zebra_byte(struct ImBuf * src,struct ImBuf * ibuf, float perc) } } -#define FTOCHAR(val) val<=0.0f?0: (val>=1.0f?255: (char)(255.99f*val)) static void draw_zebra_float(struct ImBuf * src,struct ImBuf * ibuf,float perc) { diff --git a/source/blender/src/space.c b/source/blender/src/space.c index fb86620201b..d4460e55a3e 100644 --- a/source/blender/src/space.c +++ b/source/blender/src/space.c @@ -64,6 +64,7 @@ #include "DNA_modifier_types.h" /* used for select grouped hooks */ #include "DNA_object_types.h" #include "DNA_particle_types.h" +#include "DNA_property_types.h" #include "DNA_scene_types.h" #include "DNA_screen_types.h" #include "DNA_sequence_types.h" @@ -93,7 +94,6 @@ #include "BKE_utildefines.h" #include "BKE_image.h" /* for IMA_TYPE_COMPOSITE and IMA_TYPE_R_RESULT */ #include "BKE_particle.h" - #include "BIF_spacetypes.h" /* first, nasty dependency with typedef */ #include "BIF_butspace.h" @@ -710,7 +710,7 @@ static short select_parent(void) /* Makes parent active and de-selected OBACT */ short changed = 0; Base *base, *startbase, *basact=NULL, *oldbasact; - if (!(OBACT) || !(OBACT->parent)) return 0; + if (!(OBACT->parent)) return 0; /* we know OBACT is valid */ BASACT->flag &= (~SELECT); BASACT->object->flag &= (~SELECT); startbase= FIRSTBASE; @@ -746,9 +746,6 @@ static short select_same_group(Object *ob) /* Select objects in the same group a char str[10 + (24*GROUP_MENU_MAX)]; char *p = str; int group_count=0, menu, i; - - if (!ob) - return 0; for ( group=G.main->group.first; group && group_count < GROUP_MENU_MAX; @@ -804,9 +801,6 @@ static short select_object_hooks(Object *ob) ModifierData *md; HookModifierData *hmd; - if (!ob) - return 0; - for (md = ob->modifiers.first; md; md=md->next) { if (md->type==eModifierType_Hook) { hmd= (HookModifierData*) md; @@ -829,8 +823,6 @@ static short select_same_parent(Object *ob) { short changed = 0; Base *base; - if (!ob) - return 0; for (base= FIRSTBASE; base; base= base->next) { if (BASE_SELECTABLE(base) && (base->object->parent==ob->parent) && !(base->flag & SELECT)) { @@ -846,8 +838,6 @@ static short select_same_type(Object *ob) { short changed = 0; Base *base; - if (!ob) - return 0; for (base= FIRSTBASE; base; base= base->next) { if (BASE_SELECTABLE(base) && (base->object->type == ob->type) && !(base->flag & SELECT)) { @@ -864,9 +854,6 @@ static short select_same_layer(Object *ob) char changed = 0; Base *base = FIRSTBASE; - if (!ob) - return 0; - while(base) { if (BASE_SELECTABLE(base) && (base->lay & ob->lay) && !(base->flag & SELECT)) { base->flag |= SELECT; @@ -883,9 +870,6 @@ static short select_same_index_object(Object *ob) char changed = 0; Base *base = FIRSTBASE; - if (!ob) - return 0; - while(base) { if (BASE_SELECTABLE(base) && (base->object->index == ob->index) && !(base->flag & SELECT)) { base->flag |= SELECT; @@ -897,18 +881,68 @@ static short select_same_index_object(Object *ob) return changed; } +static short select_same_color(Object *ob) +{ + char changed = 0; + Base *base = FIRSTBASE; + + while(base) { + if (BASE_SELECTABLE(base) && !(base->flag & SELECT) && (FloatCompare(base->object->col, ob->col, 0.005))) { + base->flag |= SELECT; + base->object->flag |= SELECT; + changed = 1; + } + base= base->next; + } + return changed; +} + +static short objects_share_gameprop(Object *a, Object *b) +{ + bProperty *prop; + /*make a copy of all its properties*/ + + for( prop= a->prop.first; prop; prop = prop->next ) { + if ( get_ob_property(b, prop->name) ) + return 1; + } + return 0; +} + +static short select_same_gameprops(Object *ob) +{ + char changed = 0; + Base *base = FIRSTBASE; + + while(base) { + if (BASE_SELECTABLE(base) && !(base->flag & SELECT) && (objects_share_gameprop(base->object, ob))) { + base->flag |= SELECT; + base->object->flag |= SELECT; + changed = 1; + } + base= base->next; + } + return changed; +} + void select_object_grouped(short nr) { + Object *ob = OBACT; short changed = 0; - if(nr==1) changed = select_children(OBACT, 1); - else if(nr==2) changed = select_children(OBACT, 0); + + if (ob==NULL) return; + + if(nr==1) changed = select_children(ob, 1); + else if(nr==2) changed = select_children(ob, 0); else if(nr==3) changed = select_parent(); - else if(nr==4) changed = select_same_parent(OBACT); - else if(nr==5) changed = select_same_type(OBACT); - else if(nr==6) changed = select_same_layer(OBACT); - else if(nr==7) changed = select_same_group(OBACT); - else if(nr==8) changed = select_object_hooks(OBACT); - else if(nr==9) changed = select_same_index_object(OBACT); + else if(nr==4) changed = select_same_parent(ob); + else if(nr==5) changed = select_same_type(ob); + else if(nr==6) changed = select_same_layer(ob); + else if(nr==7) changed = select_same_group(ob); + else if(nr==8) changed = select_object_hooks(ob); + else if(nr==9) changed = select_same_index_object(ob); + else if(nr==10) changed = select_same_color(ob); + else if(nr==11) changed = select_same_gameprops(ob); if (changed) { countall(); @@ -934,7 +968,10 @@ static void select_object_grouped_menu(void) "Objects of Same Type%x5|" "Objects on Shared Layers%x6|" "Objects in Same Group%x7|" - "Object Hooks%x8|Object PassIndex%x9"); + "Object Hooks%x8|" + "Object PassIndex%x9|" + "Object Color%x10|" + "Game Properties%x11"); /* here we go */ @@ -1206,8 +1243,8 @@ static void winqreadview3dspace(ScrArea *sa, void *spacedata, BWinEvent *evt) */ if(event==LEFTMOUSE) { /* run any view3d event handler script links */ - if (event && sa->scriptlink.totscript) { - if (BPY_do_spacehandlers(sa, event, SPACEHANDLER_VIEW3D_EVENT)) + if (sa->scriptlink.totscript) { + if (BPY_do_spacehandlers(sa, event, val, SPACEHANDLER_VIEW3D_EVENT)) return; /* return if event was processed (swallowed) by handler(s) */ } @@ -1268,7 +1305,7 @@ static void winqreadview3dspace(ScrArea *sa, void *spacedata, BWinEvent *evt) /* run any view3d event handler script links */ if (event && sa->scriptlink.totscript) - if (BPY_do_spacehandlers(sa, event, SPACEHANDLER_VIEW3D_EVENT)) + if (BPY_do_spacehandlers(sa, event, val, SPACEHANDLER_VIEW3D_EVENT)) return; /* return if event was processed (swallowed) by handler(s) */ /* TEXTEDITING?? */ diff --git a/source/blender/src/toolbox.c b/source/blender/src/toolbox.c index f38affde418..55feb4c0305 100644 --- a/source/blender/src/toolbox.c +++ b/source/blender/src/toolbox.c @@ -897,6 +897,8 @@ static TBitem tb_object_select_grouped[]= { { 0, "Objects in Same Group|Shift G, 7", 7, NULL}, { 0, "Object Hooks|Shift G, 8", 8, NULL}, { 0, "Object PassIndex|Shift G, 9", 9, NULL}, +{ 0, "Object Color|Shift G, 0", 9, NULL}, +{ 0, "Game Properties|Shift G, Alt+1", 9, NULL}, { -1, "", 0, do_view3d_select_object_groupedmenu}}; static TBitem tb_object_select[]= { diff --git a/source/blender/src/transform.c b/source/blender/src/transform.c index 705a5f868e7..e21d543d34e 100644 --- a/source/blender/src/transform.c +++ b/source/blender/src/transform.c @@ -2548,9 +2548,9 @@ static void ElementRotation(TransInfo *t, TransData *td, float mat[3][3], short float rot[3]; /* current IPO value for compatible euler */ - current_rot[0] = tdi->rotx[0]; - current_rot[1] = tdi->roty[0]; - current_rot[2] = tdi->rotz[0]; + current_rot[0] = (tdi->rotx) ? tdi->rotx[0] : 0.0f; + current_rot[1] = (tdi->roty) ? tdi->roty[0] : 0.0f; + current_rot[2] = (tdi->rotz) ? tdi->rotz[0] : 0.0f; VecMulf(current_rot, (float)(M_PI_2 / 9.0)); /* calculate the total rotatation in eulers */ diff --git a/source/blender/src/transform_conversions.c b/source/blender/src/transform_conversions.c index 210a81927c8..7a2ca3f088b 100644 --- a/source/blender/src/transform_conversions.c +++ b/source/blender/src/transform_conversions.c @@ -4033,7 +4033,7 @@ static void createTransObject(TransInfo *t) ob= base->object; /* store ipo keys? */ - if (ob->id.lib == 0 && ob->ipo && ob->ipo->showkey && (ob->ipoflag & OB_DRAWKEY)) { + if ((ob->id.lib == 0) && (ob->ipo) && (ob->ipo->showkey) && (ob->ipoflag & OB_DRAWKEY)) { elems.first= elems.last= NULL; make_ipokey_transform(ob, &elems, 1); /* '1' only selected keys */ @@ -4041,7 +4041,7 @@ static void createTransObject(TransInfo *t) for(ik= elems.first; ik; ik= ik->next) t->total++; - + if(elems.first==NULL) t->total++; } @@ -4074,7 +4074,7 @@ static void createTransObject(TransInfo *t) } /* store ipo keys? */ - if(ob->id.lib == 0 && ob->ipo && ob->ipo->showkey && (ob->ipoflag & OB_DRAWKEY)) { + if((ob->id.lib == 0) && (ob->ipo) && (ob->ipo->showkey) && (ob->ipoflag & OB_DRAWKEY)) { popfirst(&elems); // bring back pushed listbase diff --git a/source/blender/src/writeimage.c b/source/blender/src/writeimage.c index 1ef32fc33e8..b21c14bed35 100644 --- a/source/blender/src/writeimage.c +++ b/source/blender/src/writeimage.c @@ -80,7 +80,6 @@ void BIF_save_envmap(EnvMap *env, char *str) } -#define FTOCHAR(val) val<=0.0f?255: 255-(val>=255.0f?255: (char)(val)) /* callback for fileselect to save rendered image, renderresult was checked to exist */ static void save_rendered_image_cb_real(char *name, int confirm) diff --git a/source/blender/yafray/intern/export_File.cpp b/source/blender/yafray/intern/export_File.cpp index f42e00daf6d..ea700965826 100644 --- a/source/blender/yafray/intern/export_File.cpp +++ b/source/blender/yafray/intern/export_File.cpp @@ -96,7 +96,7 @@ static void addDrive(string &path) static string unixYafrayPath() { - static char *alternative[]= + static const char *alternative[]= { "/usr/local/bin/", "/usr/bin/", diff --git a/source/blender/yafray/intern/export_Plugin.cpp b/source/blender/yafray/intern/export_Plugin.cpp index a7d5653892f..92ec7ba8d82 100644 --- a/source/blender/yafray/intern/export_Plugin.cpp +++ b/source/blender/yafray/intern/export_Plugin.cpp @@ -98,7 +98,7 @@ static string YafrayPath() string path=find_path(); return path; #else - static char *alternative[]= + static const char *alternative[]= { "/usr/local/lib/", #ifdef __x86_64__ @@ -124,7 +124,7 @@ static string YafrayPluginPath() #ifdef WIN32 return find_path()+"\\plugins"; #else - static char *alternative[]= + static const char *alternative[]= { "/usr/local/lib/yafray", #ifdef __x86_64__ |