diff options
author | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2010-07-10 04:37:42 +0400 |
---|---|---|
committer | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2010-07-10 04:37:42 +0400 |
commit | cf2ff0b03e41550222e28d7b3986bbd027a2e301 (patch) | |
tree | 1291e9e2d6a4a02bcbdf1ccae42497a648d44403 /source/blender | |
parent | 5d725fe0e947e6db1e1665e33272ccc7c516cee7 (diff) | |
parent | 3eebaceaa633c62b8ff8c17333541ab9ad92ba81 (diff) |
Merged changes in the trunk up to revision 30167.
Diffstat (limited to 'source/blender')
34 files changed, 781 insertions, 169 deletions
diff --git a/source/blender/blenkernel/BKE_node.h b/source/blender/blenkernel/BKE_node.h index 0e5ad8e3ee9..4c7dcff0cd2 100644 --- a/source/blender/blenkernel/BKE_node.h +++ b/source/blender/blenkernel/BKE_node.h @@ -383,6 +383,7 @@ void ntreeGPUMaterialNodes(struct bNodeTree *ntree, struct GPUMaterial *mat); #define CMP_SCALE_RELATIVE 0 #define CMP_SCALE_ABSOLUTE 1 #define CMP_SCALE_SCENEPERCENT 2 +#define CMP_SCALE_RENDERPERCENT 3 /* the type definitions array */ diff --git a/source/blender/blenkernel/BKE_sca.h b/source/blender/blenkernel/BKE_sca.h index 910f381823c..b1df32d5cd7 100644 --- a/source/blender/blenkernel/BKE_sca.h +++ b/source/blender/blenkernel/BKE_sca.h @@ -67,5 +67,9 @@ void set_sca_new_poins_ob(struct Object *ob); void set_sca_new_poins(void); void sca_remove_ob_poin(struct Object *obt, struct Object *ob); +void sca_move_sensor(struct bSensor *sens_to_move, Object *ob, int move_up); +void sca_move_controller(struct bController *cont_to_move, Object *ob, int move_up); +void sca_move_actuator(struct bActuator *act_to_move, Object *ob, int move_up); + #endif diff --git a/source/blender/blenkernel/BKE_sequencer.h b/source/blender/blenkernel/BKE_sequencer.h index 5c5bf30980c..002a1958a13 100644 --- a/source/blender/blenkernel/BKE_sequencer.h +++ b/source/blender/blenkernel/BKE_sequencer.h @@ -187,6 +187,7 @@ void seq_single_fix(struct Sequence *seq); int seq_test_overlap(struct ListBase * seqbasep, struct Sequence *test); struct ListBase *seq_seqbase(struct ListBase *seqbase, struct Sequence *seq); void seq_offset_animdata(struct Scene *scene, struct Sequence *seq, int ofs); +void seq_dupe_animdata(struct Scene *scene, char *name_from, char *name_to); int shuffle_seq(struct ListBase * seqbasep, struct Sequence *test, struct Scene *evil_scene); int shuffle_seq_time(ListBase * seqbasep, struct Scene *evil_scene); int seqbase_isolated_sel_check(struct ListBase *seqbase); @@ -232,6 +233,8 @@ typedef struct SeqLoadInfo { /* seq_dupli' flags */ #define SEQ_DUPE_UNIQUE_NAME 1<<0 #define SEQ_DUPE_CONTEXT 1<<1 +#define SEQ_DUPE_ANIM 1<<2 +#define SEQ_DUPE_ALL 1<<3 /* otherwise only selected are copied */ /* use as an api function */ typedef struct Sequence *(*SeqLoadFunc)(struct bContext *, ListBase *, struct SeqLoadInfo *); diff --git a/source/blender/blenkernel/intern/depsgraph.c b/source/blender/blenkernel/intern/depsgraph.c index 0dbdd802ff6..1a1ca8a8d3e 100644 --- a/source/blender/blenkernel/intern/depsgraph.c +++ b/source/blender/blenkernel/intern/depsgraph.c @@ -1877,26 +1877,19 @@ static void flush_pointcache_reset(Scene *scene, DagNode *node, int curtime, int } } -/* flushes all recalc flags in objects down the dependency tree */ -void DAG_scene_flush_update(Scene *sce, unsigned int lay, int time) +/* flush layer flags to dependencies */ +static void dag_scene_flush_layers(Scene *sce, int lay) { - DagNode *firstnode, *node; + DagNode *node, *firstnode; DagAdjList *itA; - Object *ob; Base *base; int lasttime; - - if(sce->theDag==NULL) { - printf("DAG zero... not allowed to happen!\n"); - DAG_scene_sort(sce); - } - + firstnode= sce->theDag->DagNode.first; // always scene node for(itA = firstnode->child; itA; itA= itA->next) itA->lay= 0; - - /* first we flush the layer flags */ + sce->theDag->time++; // so we know which nodes were accessed lasttime= sce->theDag->time; @@ -1930,7 +1923,26 @@ void DAG_scene_flush_update(Scene *sce, unsigned int lay, int time) for(itA = firstnode->child; itA; itA= itA->next) if(itA->node->lasttime!=lasttime && itA->node->type==ID_OB) flush_layer_node(sce, itA->node, lasttime); +} + +/* flushes all recalc flags in objects down the dependency tree */ +void DAG_scene_flush_update(Scene *sce, unsigned int lay, int time) +{ + DagNode *firstnode; + DagAdjList *itA; + Object *ob; + int lasttime; + + if(sce->theDag==NULL) { + printf("DAG zero... not allowed to happen!\n"); + DAG_scene_sort(sce); + } + firstnode= sce->theDag->DagNode.first; // always scene node + + /* first we flush the layer flags */ + dag_scene_flush_layers(sce, lay); + /* then we use the relationships + layer info to flush update events */ sce->theDag->time++; // so we know which nodes were accessed lasttime= sce->theDag->time; @@ -2231,7 +2243,8 @@ void DAG_on_load_update(void) Object *ob; Group *group; GroupObject *go; - unsigned int lay; + DagNode *node; + unsigned int lay, oblay; dag_current_scene_layers(bmain, &scene, &lay); @@ -2240,10 +2253,14 @@ void DAG_on_load_update(void) remade, tag them so they get remade in the scene update loop, note armature poses or object matrices are preserved and do not require updates, so we skip those */ + dag_scene_flush_layers(scene, lay); + for(SETLOOPER(scene, base)) { ob= base->object; + node= (sce->theDag)? dag_get_node(sce->theDag, ob): NULL; + oblay= (node)? node->lay: ob->lay; - if(base->lay & lay) { + if(oblay & lay) { if(ELEM5(ob->type, OB_MESH, OB_CURVE, OB_SURF, OB_FONT, OB_MBALL)) ob->recalc |= OB_RECALC_DATA; if(ob->dup_group) diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c index 4daa38001bf..dc78dac04dd 100644 --- a/source/blender/blenkernel/intern/image.c +++ b/source/blender/blenkernel/intern/image.c @@ -1827,10 +1827,13 @@ static ImBuf *image_get_render_result(Image *ima, ImageUser *iuser, void **lock_ layer= (iuser)? iuser->layer: 0; pass= (iuser)? iuser->pass: 0; - if(from_render) + if(from_render) { RE_AcquireResultImage(re, &rres); - else if(ima->renders[ima->render_slot]) + } + else if(ima->renders[ima->render_slot]) { rres= *(ima->renders[ima->render_slot]); + rres.have_combined= rres.rectf != NULL; + } else memset(&rres, 0, sizeof(RenderResult)); @@ -1852,10 +1855,10 @@ static ImBuf *image_get_render_result(Image *ima, ImageUser *iuser, void **lock_ rectz= rres.rectz; dither= iuser->scene->r.dither_intensity; - /* get compo/seq result by default */ - if(rres.compo_seq && layer==0); + /* combined layer gets added as first layer */ + if(rres.have_combined && layer==0); else if(rres.layers.first) { - RenderLayer *rl= BLI_findlink(&rres.layers, layer-(rres.compo_seq?1:0)); + RenderLayer *rl= BLI_findlink(&rres.layers, layer-(rres.have_combined?1:0)); if(rl) { RenderPass *rpass; diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c index 1b8405a91de..6d264b3fed2 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -2479,6 +2479,17 @@ void object_handle_update(Scene *scene, Object *ob) if(ob->pose) make_pose_channels_hash(ob->pose); + if(ob->recalc & OB_RECALC_DATA) { + if(ob->type==OB_ARMATURE) { + /* this happens for reading old files and to match library armatures + with poses we do it ahead of where_is_object to ensure animation + is evaluated on the rebuilt pose, otherwise we get incorrect poses + on file load */ + if(ob->pose==NULL || (ob->pose->flag & POSE_RECALC)) + armature_rebuild_pose(ob, ob->data); + } + } + /* XXX new animsys warning: depsgraph tag OB_RECALC_DATA should not skip drivers, which is only in where_is_object now */ // XXX: should this case be OB_RECALC_OB instead? @@ -2541,11 +2552,6 @@ void object_handle_update(Scene *scene, Object *ob) lattice_calc_modifiers(scene, ob); } else if(ob->type==OB_ARMATURE) { - /* this happens for reading old files and to match library armatures with poses */ - // XXX this won't screw up the pose set already... - if(ob->pose==NULL || (ob->pose->flag & POSE_RECALC)) - armature_rebuild_pose(ob, ob->data); - /* evaluate drivers */ BKE_animsys_evaluate_animdata(data_id, adt, ctime, ADT_RECALC_DRIVERS); @@ -2749,7 +2755,7 @@ void object_camera_matrix( float pixsize; float shiftx=0.0, shifty=0.0, winside, viewfac; - rd->mode &= ~R_ORTHO; + rd->mode &= ~(R_ORTHO|R_PANORAMA); /* question mark */ (*ycor)= rd->yasp / rd->xasp; diff --git a/source/blender/blenkernel/intern/sca.c b/source/blender/blenkernel/intern/sca.c index 3102d4b054b..02b66dd9b32 100644 --- a/source/blender/blenkernel/intern/sca.c +++ b/source/blender/blenkernel/intern/sca.c @@ -683,3 +683,127 @@ void sca_remove_ob_poin(Object *obt, Object *ob) act= act->next; } } + +/* ******************** INTERFACE ******************* */ +void sca_move_sensor(bSensor *sens_to_move, Object *ob, int *move_up) +{ + bSensor *sens, *tmp; + + int val; + val = move_up ? 1:2; + + /* make sure this sensor belongs to this object */ + sens= ob->sensors.first; + while(sens) { + if(sens == sens_to_move) break; + sens= sens->next; + } + if(!sens) return; + + /* move up */ + if( val==1 && sens->prev) { + for (tmp=sens->prev; tmp; tmp=tmp->prev) { + if (tmp->flag & SENS_VISIBLE) + break; + } + if (tmp) { + BLI_remlink(&ob->sensors, sens); + BLI_insertlinkbefore(&ob->sensors, tmp, sens); + } + } + /* move down */ + else if( val==2 && sens->next) { + for (tmp=sens->next; tmp; tmp=tmp->next) { + if (tmp->flag & SENS_VISIBLE) + break; + } + if (tmp) { + BLI_remlink(&ob->sensors, sens); + BLI_insertlink(&ob->sensors, tmp, sens); + } + } +} + +void sca_move_controller(bController *cont_to_move, Object *ob, int move_up) +{ + bController *cont, *tmp; + + int val; + val = move_up ? 1:2; + + /* make sure this controller belongs to this object */ + cont= ob->controllers.first; + while(cont) { + if(cont == cont_to_move) break; + cont= cont->next; + } + if(!cont) return; + + /* move up */ + if( val==1 && cont->prev) { + /* locate the controller that has the same state mask but is earlier in the list */ + tmp = cont->prev; + while(tmp) { + if(tmp->state_mask & cont->state_mask) + break; + tmp = tmp->prev; + } + if (tmp) { + BLI_remlink(&ob->controllers, cont); + BLI_insertlinkbefore(&ob->controllers, tmp, cont); + } + } + + /* move down */ + else if( val==2 && cont->next) { + tmp = cont->next; + while(tmp) { + if(tmp->state_mask & cont->state_mask) + break; + tmp = tmp->next; + } + BLI_remlink(&ob->controllers, cont); + BLI_insertlink(&ob->controllers, tmp, cont); + } +} + +void sca_move_actuator(bActuator *act_to_move, Object *ob, int move_up) +{ + bActuator *act, *tmp; + int val; + + val = move_up ? 1:2; + + /* make sure this actuator belongs to this object */ + act= ob->actuators.first; + while(act) { + if(act == act_to_move) break; + act= act->next; + } + if(!act) return; + + /* move up */ + if( val==1 && act->prev) { + /* locate the first visible actuators before this one */ + for (tmp = act->prev; tmp; tmp=tmp->prev) { + if (tmp->flag & ACT_VISIBLE) + break; + } + if (tmp) { + BLI_remlink(&ob->actuators, act); + BLI_insertlinkbefore(&ob->actuators, tmp, act); + } + } + /* move down */ + else if( val==2 && act->next) { + /* locate the first visible actuators after this one */ + for (tmp=act->next; tmp; tmp=tmp->next) { + if (tmp->flag & ACT_VISIBLE) + break; + } + if (tmp) { + BLI_remlink(&ob->actuators, act); + BLI_insertlink(&ob->actuators, tmp, act); + } + } +} diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c index cd4c2e9f98e..2538f61b81e 100644 --- a/source/blender/blenkernel/intern/scene.c +++ b/source/blender/blenkernel/intern/scene.c @@ -222,7 +222,7 @@ Scene *copy_scene(Main *bmain, Scene *sce, int type) if(sce->ed) { scen->ed= MEM_callocN( sizeof(Editing), "addseq"); scen->ed->seqbasep= &scen->ed->seqbase; - seqbase_dupli_recursive(sce, &scen->ed->seqbase, &sce->ed->seqbase, 0); + seqbase_dupli_recursive(sce, &scen->ed->seqbase, &sce->ed->seqbase, SEQ_DUPE_ALL); } } diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c index 894b8b6ab60..36e768ec98d 100644 --- a/source/blender/blenkernel/intern/sequencer.c +++ b/source/blender/blenkernel/intern/sequencer.c @@ -40,6 +40,7 @@ #include "DNA_anim_types.h" #include "DNA_object_types.h" +#include "BKE_animsys.h" #include "BKE_global.h" #include "BKE_image.h" #include "BKE_main.h" @@ -1536,9 +1537,14 @@ static StripColorBalance calc_cb(StripColorBalance * cb_) } /* note: lift is actually 2-lift */ -MINLINE float color_balance_fl(float v, const float lift, const float gain, const float gamma, const float mul) +MINLINE float color_balance_fl(float in, const float lift, const float gain, const float gamma, const float mul) { - return powf((((v - 1.0f) * lift) + 1.0f) * gain, gamma) * mul; + float x= (((in - 1.0f) * lift) + 1.0f) * gain; + + /* prevent NaN */ + if (x < 0.f) x = 0.f; + + return powf(x, gamma) * mul; } static void make_cb_table_byte(float lift, float gain, float gamma, @@ -2538,6 +2544,10 @@ static TStripElem* do_build_seq_array_recursively( int i; TStripElem* se = 0; + // XXX for prefetch and overlay offset!..., very bad!!! + AnimData *adt= BKE_animdata_from_id(&scene->id); + BKE_animsys_evaluate_animdata(&scene->id, adt, cfra, ADT_RECALC_ANIM); + count = get_shown_sequences(seqbasep, cfra, chanshown, (Sequence **)&seq_arr); @@ -3799,6 +3809,8 @@ ListBase *seq_seqbase(ListBase *seqbase, Sequence *seq) int seq_swap(Sequence *seq_a, Sequence *seq_b) { + char name[sizeof(seq_a->name)]; + if(seq_a->len != seq_b->len) return 0; @@ -3807,12 +3819,33 @@ int seq_swap(Sequence *seq_a, Sequence *seq_b) if(seq_a->type == SEQ_SOUND || seq_b->type == SEQ_SOUND) { return 0; } + + /* disallow effects to swap with non-effects strips */ + if((seq_a->type & SEQ_EFFECT) != (seq_b->type & SEQ_EFFECT)) { + return 0; + } + + if((seq_a->type & SEQ_EFFECT) && (seq_b->type & SEQ_EFFECT)) { + if(get_sequence_effect_num_inputs(seq_a->type) != get_sequence_effect_num_inputs(seq_b->type)) { + return 0; + } + } } SWAP(Sequence, *seq_a, *seq_b); + + /* swap back names so animation fcurves dont get swapped */ + strcpy(name, seq_a->name+2); + strcpy(seq_a->name+2, seq_b->name+2); + strcpy(seq_b->name+2, name); + + /* swap back opacity, and overlay mode */ + SWAP(int, seq_a->blend_mode, seq_b->blend_mode); + SWAP(float, seq_a->blend_opacity, seq_b->blend_opacity); + + SWAP(void *, seq_a->prev, seq_b->prev); SWAP(void *, seq_a->next, seq_b->next); - SWAP(int, seq_a->start, seq_b->start); SWAP(int, seq_a->startofs, seq_b->startofs); SWAP(int, seq_a->endofs, seq_b->endofs); @@ -3849,6 +3882,35 @@ void seq_offset_animdata(Scene *scene, Sequence *seq, int ofs) } } +void seq_dupe_animdata(Scene *scene, char *name_from, char *name_to) +{ + char str_from[32]; + FCurve *fcu; + FCurve *fcu_last; + FCurve *fcu_cpy; + ListBase lb= {NULL, NULL}; + + if(scene->adt==NULL || scene->adt->action==NULL) + return; + + sprintf(str_from, "[\"%s\"]", name_from); + + fcu_last= scene->adt->action->curves.last; + + for (fcu= scene->adt->action->curves.first; fcu && fcu->prev != fcu_last; fcu= fcu->next) { + if(strstr(fcu->rna_path, "sequence_editor.sequences_all[") && strstr(fcu->rna_path, str_from)) { + fcu_cpy= copy_fcurve(fcu); + BLI_addtail(&lb, fcu_cpy); + } + } + + /* notice validate is 0, keep this because the seq may not be added to the scene yet */ + BKE_animdata_fix_paths_rename(&scene->id, scene->adt, "sequence_editor.sequences_all", name_from, name_to, 0, 0, 0); + + /* add the original fcurves back */ + addlisttolist(&scene->adt->action->curves, &lb); +} + /* XXX - hackish function needed to remove all fcurves belonging to a sequencer strip */ static void seq_free_animdata(Scene *scene, Sequence *seq) { @@ -4208,6 +4270,9 @@ static Sequence *seq_dupli(struct Scene *scene, Sequence *seq, int dupe_flag) if(dupe_flag & SEQ_DUPE_UNIQUE_NAME) seqbase_unique_name_recursive(&scene->ed->seqbase, seqn); + if(dupe_flag & SEQ_DUPE_ANIM) + seq_dupe_animdata(scene, seq->name+2, seqn->name+2); + return seqn; } @@ -4234,7 +4299,7 @@ void seqbase_dupli_recursive(Scene *scene, ListBase *nseqbase, ListBase *seqbase for(seq= seqbase->first; seq; seq= seq->next) { seq->tmp= NULL; - if(seq->flag & SELECT) { + if((seq->flag & SELECT) || (dupe_flag & SEQ_DUPE_ALL)) { seqn = seq_dupli(scene, seq, dupe_flag); if (seqn) { /*should never fail */ if(dupe_flag & SEQ_DUPE_CONTEXT) { diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c index 93c93b07232..8f116828ac5 100644 --- a/source/blender/editors/interface/interface_templates.c +++ b/source/blender/editors/interface/interface_templates.c @@ -955,7 +955,7 @@ static uiLayout *draw_constraint(uiLayout *layout, Object *ob, bConstraint *con, bPoseChannel *pchan= get_active_posechannel(ob); bConstraintTypeInfo *cti; uiBlock *block; - uiLayout *result= NULL, *col, *col1, *col2, *box, *row, *subrow, *split; + uiLayout *result= NULL, *col, *box, *row, *subrow; PointerRNA ptr; char typestr[32]; short proxy_protected, xco=0, yco=0; @@ -990,37 +990,30 @@ static uiLayout *draw_constraint(uiLayout *layout, Object *ob, bConstraint *con, uiLayoutSetContextPointer(col, "constraint", &ptr); box= uiLayoutBox(col); - split = uiLayoutSplit(box, 0.35, 0); - - col1= uiLayoutColumn(split, 0); - col2= uiLayoutColumn(split, 0); - row = uiLayoutRow(col1, 0); - subrow = uiLayoutRow(col2, 0); - + row = uiLayoutRow(box, 0); block= uiLayoutGetBlock(box); /* Draw constraint header */ - uiBlockSetEmboss(block, UI_EMBOSSN); /* rounded header */ rb_col= (con->flag & CONSTRAINT_ACTIVE)?50:20; - + /* open/close */ + uiBlockSetEmboss(block, UI_EMBOSSN); uiItemR(row, &ptr, "expanded", UI_ITEM_R_ICON_ONLY, "", 0); - - /* name */ uiBlockSetEmboss(block, UI_EMBOSS); /* XXX if (con->flag & CONSTRAINT_DISABLE) uiBlockSetCol(block, TH_REDALERT);*/ + /* name */ uiDefBut(block, LABEL, B_CONSTRAINT_TEST, typestr, xco+10, yco, 100, 18, NULL, 0.0, 0.0, 0.0, 0.0, ""); if(proxy_protected == 0) { - uiItemR(subrow, &ptr, "name", 0, "", 0); + uiItemR(row, &ptr, "name", 0, "", 0); } else - uiItemL(subrow, con->name, 0); + uiItemL(row, con->name, 0); /* proxy-protected constraints cannot be edited, so hide up/down + close buttons */ if (proxy_protected) { @@ -1054,47 +1047,44 @@ static uiLayout *draw_constraint(uiLayout *layout, Object *ob, bConstraint *con, show_upbut= ((prev_proxylock == 0) && (con->prev)); show_downbut= (con->next) ? 1 : 0; - - uiLayoutSetOperatorContext(subrow, WM_OP_INVOKE_DEFAULT); - - if (compact) { - /* Draw "Delete" Button in first row, before splitting */ - uiBlockSetEmboss(block, UI_EMBOSSN); - uiItemO(subrow, "", ICON_X, "CONSTRAINT_OT_delete"); - uiBlockSetEmboss(block, UI_EMBOSS); - subrow = uiLayoutRow(col2, 0); + /* Code for compact Constraint UI */ + if (compact) { + subrow = uiLayoutRow(box, 0); } + else { + subrow = row; + } + + uiLayoutSetOperatorContext(subrow, WM_OP_INVOKE_DEFAULT); + /* up/down */ if (show_upbut || show_downbut) { uiBlockBeginAlign(block); - uiBlockSetEmboss(block, UI_EMBOSS); + if (show_upbut) + uiItemO(subrow, "", ICON_TRIA_UP, "CONSTRAINT_OT_move_up"); - if (show_upbut) - uiItemO(subrow, "", ICON_TRIA_UP, "CONSTRAINT_OT_move_up"); - - if (show_downbut) - uiItemO(subrow, "", ICON_TRIA_DOWN, "CONSTRAINT_OT_move_down"); + if (show_downbut) + uiItemO(subrow, "", ICON_TRIA_DOWN, "CONSTRAINT_OT_move_down"); uiBlockEndAlign(block); } - + + /* enabled */ + uiItemR(subrow, &ptr, "enabled", 0, "", 0); + + uiLayoutSetOperatorContext(row, WM_OP_INVOKE_DEFAULT); + /* Close 'button' - emboss calls here disable drawing of 'button' behind X */ uiBlockSetEmboss(block, UI_EMBOSSN); - uiItemR(subrow, &ptr, "enabled", 0, "", 0); - - if (!compact) { - uiItemO(subrow, "", ICON_X, "CONSTRAINT_OT_delete"); - } + uiItemO(row, "", ICON_X, "CONSTRAINT_OT_delete"); uiBlockSetEmboss(block, UI_EMBOSS); } - + /* Set but-locks for protected settings (magic numbers are used here!) */ if (proxy_protected) uiBlockSetButLock(block, 1, "Cannot edit Proxy-Protected Constraint"); - /* Draw constraint data */ - if ((con->flag & CONSTRAINT_EXPAND) == 0) { (yco) -= 21; } diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c index 1f112ec1105..681e14dd693 100644 --- a/source/blender/editors/mesh/editmesh_tools.c +++ b/source/blender/editors/mesh/editmesh_tools.c @@ -485,8 +485,12 @@ static int removedoublesflag_exec(bContext *C, wmOperator *op) int count = removedoublesflag(em,1,0,RNA_float_get(op->ptr, "limit")); - if(count) - BKE_reportf(op->reports, RPT_INFO, "Removed %d vertices", count); + if(!count) + return OPERATOR_CANCELLED; + + recalc_editnormals(em); + + BKE_reportf(op->reports, RPT_INFO, "Removed %d vertices", count); DAG_id_flush_update(obedit->data, OB_RECALC_DATA); WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data); @@ -5860,6 +5864,7 @@ static int merge_exec(bContext *C, wmOperator *op) if(!count) return OPERATOR_CANCELLED; + recalc_editnormals(em); BKE_reportf(op->reports, RPT_INFO, "Removed %d vert%s.", count, (count==1)?"ex":"ices"); @@ -7116,7 +7121,7 @@ static int sort_faces_exec(bContext *C, wmOperator *op) { RegionView3D *rv3d= ED_view3d_context_rv3d(C); View3D *v3d= CTX_wm_view3d(C); - Object *ob= CTX_data_active_object(C); + Object *ob= CTX_data_edit_object(C); Scene *scene= CTX_data_scene(C); Mesh *me; CustomDataLayer *layer; @@ -7125,9 +7130,7 @@ static int sort_faces_exec(bContext *C, wmOperator *op) float reverse = 1; // XXX int ctrl= 0; - if(!ob) return OPERATOR_FINISHED; - if(ob->type!=OB_MESH) return OPERATOR_FINISHED; - if (!v3d) return OPERATOR_FINISHED; + if (!v3d) return OPERATOR_CANCELLED; /* This operator work in Object Mode, not in edit mode. * After talk with Cambell we agree that there is no point to port this to EditMesh right now. @@ -7227,6 +7230,8 @@ static int sort_faces_exec(bContext *C, wmOperator *op) /* Return to editmode. */ ED_object_enter_editmode(C, 0); + + return OPERATOR_FINISHED; } void MESH_OT_sort_faces(wmOperatorType *ot) diff --git a/source/blender/editors/mesh/meshtools.c b/source/blender/editors/mesh/meshtools.c index 70098e0812f..87b5c886b4a 100644 --- a/source/blender/editors/mesh/meshtools.c +++ b/source/blender/editors/mesh/meshtools.c @@ -82,10 +82,6 @@ /* own include */ #include "mesh_intern.h" -/* XXX */ -static int pupmenu(const char *dummy) {return 0;} -/* XXX */ - /* * ********************** no editmode!!! *********** */ diff --git a/source/blender/editors/object/object_vgroup.c b/source/blender/editors/object/object_vgroup.c index 2235bdd8f2a..ff48e7e349a 100644 --- a/source/blender/editors/object/object_vgroup.c +++ b/source/blender/editors/object/object_vgroup.c @@ -166,6 +166,8 @@ int ED_vgroup_give_parray(ID *id, MDeformVert ***dvert_arr, int *dvert_tot) return 1; } + else + return 0; } case ID_LT: { diff --git a/source/blender/editors/space_logic/logic_ops.c b/source/blender/editors/space_logic/logic_ops.c index 44cc4066b03..2a179ac281c 100644 --- a/source/blender/editors/space_logic/logic_ops.c +++ b/source/blender/editors/space_logic/logic_ops.c @@ -211,6 +211,16 @@ static bActuator *edit_actuator_property_get(bContext *C, wmOperator *op, Object return act; } +static int logicbricks_move_property_get(wmOperator *op) +{ + int type = RNA_enum_get(op->ptr, "direction"); + + if (type == 1) + return TRUE; + else + return FALSE; +} + /* ************* Add/Remove Sensor Operator ************* */ static int sensor_remove_exec(bContext *C, wmOperator *op) @@ -530,12 +540,158 @@ void LOGIC_OT_actuator_add(wmOperatorType *ot) RNA_def_string(ot->srna, "object", "", 32, "Object", "Name of the Object to add the Actuator to"); } +/* ************* Move Logic Bricks Operator ************* */ +static EnumPropertyItem logicbricks_move_direction[] ={ + {1, "UP", 0, "Move Up", ""}, + {2, "DOWN", 0, "Move Down", ""}, + {0, NULL, 0, NULL, NULL}}; + + +static int sensor_move_exec(bContext *C, wmOperator *op) +{ + Object *ob=NULL; + bSensor *sens= edit_sensor_property_get(C, op, &ob); + int move_up= logicbricks_move_property_get(op); + + if (!sens) + return OPERATOR_CANCELLED; + + sca_move_sensor(sens, ob, move_up); + + WM_event_add_notifier(C, NC_LOGIC, NULL); + + return OPERATOR_FINISHED; +} + +static int sensor_move_invoke(bContext *C, wmOperator *op, wmEvent *event) +{ + if (edit_sensor_invoke_properties(C, op)) { + return sensor_move_exec(C, op); + } + else + return OPERATOR_CANCELLED; +} + +void LOGIC_OT_sensor_move(wmOperatorType *ot) +{ + /* identifiers */ + ot->name= "Move Sensor"; + ot->description = "Move Densor"; + ot->idname= "LOGIC_OT_sensor_move"; + + /* api callbacks */ + ot->invoke= sensor_move_invoke; + ot->exec= sensor_move_exec; + ot->poll= edit_sensor_poll; + + /* flags */ + ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; + + /* properties */ + edit_sensor_properties(ot); + RNA_def_enum(ot->srna, "direction", logicbricks_move_direction, 1, "Direction", "Move Up or Down"); +} + +static int controller_move_exec(bContext *C, wmOperator *op) +{ + Object *ob=NULL; + bController *cont= edit_controller_property_get(C, op, &ob); + int move_up= logicbricks_move_property_get(op); + + if (!cont) + return OPERATOR_CANCELLED; + + sca_move_controller(cont, ob, move_up); + + WM_event_add_notifier(C, NC_LOGIC, NULL); + + return OPERATOR_FINISHED; +} + +static int controller_move_invoke(bContext *C, wmOperator *op, wmEvent *event) +{ + if (edit_controller_invoke_properties(C, op)) { + return controller_move_exec(C, op); + } + else + return OPERATOR_CANCELLED; +} + +void LOGIC_OT_controller_move(wmOperatorType *ot) +{ + /* identifiers */ + ot->name= "Move Controller"; + ot->description = "Move Controller"; + ot->idname= "LOGIC_OT_controller_move"; + + /* api callbacks */ + ot->invoke= controller_move_invoke; + ot->exec= controller_move_exec; + ot->poll= edit_controller_poll; + + /* flags */ + ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; + + /* properties */ + edit_controller_properties(ot); + RNA_def_enum(ot->srna, "direction", logicbricks_move_direction, 1, "Direction", "Move Up or Down"); +} + +static int actuator_move_exec(bContext *C, wmOperator *op) +{ + Object *ob=NULL; + bActuator *act = edit_actuator_property_get(C, op, &ob); + int move_up= logicbricks_move_property_get(op); + + if (!act) + return OPERATOR_CANCELLED; + + sca_move_actuator(act, ob, move_up); + + WM_event_add_notifier(C, NC_LOGIC, NULL); + + return OPERATOR_FINISHED; +} + +static int actuator_move_invoke(bContext *C, wmOperator *op, wmEvent *event) +{ + if (edit_actuator_invoke_properties(C, op)) { + return actuator_move_exec(C, op); + } + else + return OPERATOR_CANCELLED; +} + +void LOGIC_OT_actuator_move(wmOperatorType *ot) +{ + /* identifiers */ + ot->name= "Move Actuator"; + ot->description = "Move Actuator"; + ot->idname= "LOGIC_OT_actuator_move"; + + /* api callbacks */ + ot->invoke= actuator_move_invoke; + ot->exec= actuator_move_exec; + ot->poll= edit_actuator_poll; + + /* flags */ + ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; + + /* properties */ + edit_actuator_properties(ot); + RNA_def_enum(ot->srna, "direction", logicbricks_move_direction, 1, "Direction", "Move Up or Down"); +} + + void ED_operatortypes_logic(void) { WM_operatortype_append(LOGIC_OT_sensor_remove); WM_operatortype_append(LOGIC_OT_sensor_add); + WM_operatortype_append(LOGIC_OT_sensor_move); WM_operatortype_append(LOGIC_OT_controller_remove); WM_operatortype_append(LOGIC_OT_controller_add); + WM_operatortype_append(LOGIC_OT_controller_move); WM_operatortype_append(LOGIC_OT_actuator_remove); WM_operatortype_append(LOGIC_OT_actuator_add); + WM_operatortype_append(LOGIC_OT_actuator_move); } diff --git a/source/blender/editors/space_logic/logic_window.c b/source/blender/editors/space_logic/logic_window.c index 26b4b6fc08c..4ab2511fcd2 100644 --- a/source/blender/editors/space_logic/logic_window.c +++ b/source/blender/editors/space_logic/logic_window.c @@ -194,8 +194,9 @@ static void make_unique_prop_names_cb(bContext *C, void *strv, void *redraw_view } -static void sca_move_sensor(bContext *C, void *datav, void *move_up) +static void old_sca_move_sensor(bContext *C, void *datav, void *move_up) { + /* deprecated, no longer using it (moved to sca.c) */ Scene *scene= CTX_data_scene(C); bSensor *sens_to_delete= datav; int val; @@ -246,8 +247,9 @@ static void sca_move_sensor(bContext *C, void *datav, void *move_up) } } -static void sca_move_controller(bContext *C, void *datav, void *move_up) +static void old_sca_move_controller(bContext *C, void *datav, void *move_up) { + /* deprecated, no longer using it (moved to sca.c) */ Scene *scene= CTX_data_scene(C); bController *controller_to_del= datav; int val; @@ -301,8 +303,9 @@ static void sca_move_controller(bContext *C, void *datav, void *move_up) } } -static void sca_move_actuator(bContext *C, void *datav, void *move_up) +static void old_sca_move_actuator(bContext *C, void *datav, void *move_up) { + /* deprecated, no longer using it (moved to sca.c) */ Scene *scene= CTX_data_scene(C); bActuator *actuator_to_move= datav; int val; @@ -3188,6 +3191,11 @@ static void draw_sensor_header(uiLayout *layout, PointerRNA *ptr, PointerRNA *lo && RNA_boolean_get(ptr, "expanded")) || RNA_boolean_get(ptr, "pinned"))); uiItemR(subrow, ptr, "pinned", UI_ITEM_R_NO_BG, "", 0); + if(RNA_boolean_get(ptr, "expanded")==0) { + uiItemEnumO(row, "LOGIC_OT_sensor_move", "", ICON_TRIA_UP, "direction", 1); // up + uiItemEnumO(row, "LOGIC_OT_sensor_move", "", ICON_TRIA_DOWN, "direction", 2); // down + } + uiItemO(row, "", ICON_X, "LOGIC_OT_sensor_remove"); } @@ -3527,6 +3535,11 @@ static void draw_controller_header(uiLayout *layout, PointerRNA *ptr) uiItemL(row, name, 0); uiItemR(row, ptr, "priority", 0, "", 0); + + if(RNA_boolean_get(ptr, "expanded")==0) { + uiItemEnumO(row, "LOGIC_OT_controller_move", "", ICON_TRIA_UP, "direction", 1); // up + uiItemEnumO(row, "LOGIC_OT_controller_move", "", ICON_TRIA_DOWN, "direction", 2); // down + } uiItemO(row, "", ICON_X, "LOGIC_OT_controller_remove"); } @@ -3606,6 +3619,10 @@ static void draw_actuator_header(uiLayout *layout, PointerRNA *ptr, PointerRNA * && RNA_boolean_get(ptr, "expanded")) || RNA_boolean_get(ptr, "pinned"))); uiItemR(subrow, ptr, "pinned", UI_ITEM_R_NO_BG, "", 0); + if(RNA_boolean_get(ptr, "expanded")==0) { + uiItemEnumO(row, "LOGIC_OT_actuator_move", "", ICON_TRIA_UP, "direction", 1); // up + uiItemEnumO(row, "LOGIC_OT_actuator_move", "", ICON_TRIA_DOWN, "direction", 2); // down + } uiItemO(row, "", ICON_X, "LOGIC_OT_actuator_remove"); } @@ -3966,9 +3983,11 @@ static void draw_actuator_motion(uiLayout *layout, PointerRNA *ptr) Object *ob; PointerRNA settings_ptr; uiLayout *split, *row, *col, *subcol; + int physics_type; ob = (Object *)ptr->id.data; RNA_pointer_create((ID *)ob, &RNA_GameObjectSettings, ob, &settings_ptr); + physics_type = RNA_enum_get(&settings_ptr, "physics_type"); uiItemR(layout, ptr, "mode", 0, NULL, 0); @@ -3984,33 +4003,32 @@ static void draw_actuator_motion(uiLayout *layout, PointerRNA *ptr) uiItemR(row, ptr, "rot", 0, NULL, 0); uiItemR(split, ptr, "local_rotation", UI_ITEM_R_TOGGLE, NULL, 0); - if (RNA_enum_get(&settings_ptr, "physics_type") != OB_BODY_TYPE_DYNAMIC) - break; - - uiItemL(layout, "Dynamic Object Settings:", 0); - split = uiLayoutSplit(layout, 0.9, 0); - row = uiLayoutRow(split, 0); - uiItemR(row, ptr, "force", 0, NULL, 0); - uiItemR(split, ptr, "local_force", UI_ITEM_R_TOGGLE, NULL, 0); - - split = uiLayoutSplit(layout, 0.9, 0); - row = uiLayoutRow(split, 0); - uiItemR(row, ptr, "torque", 0, NULL, 0); - uiItemR(split, ptr, "local_torque", UI_ITEM_R_TOGGLE, NULL, 0); - - split = uiLayoutSplit(layout, 0.9, 0); - row = uiLayoutRow(split, 0); - uiItemR(row, ptr, "linear_velocity", 0, NULL, 0); - row = uiLayoutRow(split, 1); - uiItemR(row, ptr, "local_linear_velocity", UI_ITEM_R_TOGGLE, NULL, 0); - uiItemR(row, ptr, "add_linear_velocity", UI_ITEM_R_TOGGLE, NULL, 0); - - split = uiLayoutSplit(layout, 0.9, 0); - row = uiLayoutRow(split, 0); - uiItemR(row, ptr, "angular_velocity", 0, NULL, 0); - uiItemR(split, ptr, "local_angular_velocity", UI_ITEM_R_TOGGLE, NULL, 0); - - uiItemR(layout, ptr, "damping", 0, NULL, 0); + if (ELEM3(physics_type, OB_BODY_TYPE_DYNAMIC, OB_BODY_TYPE_RIGID, OB_BODY_TYPE_SOFT)) { + uiItemL(layout, "Dynamic Object Settings:", 0); + split = uiLayoutSplit(layout, 0.9, 0); + row = uiLayoutRow(split, 0); + uiItemR(row, ptr, "force", 0, NULL, 0); + uiItemR(split, ptr, "local_force", UI_ITEM_R_TOGGLE, NULL, 0); + + split = uiLayoutSplit(layout, 0.9, 0); + row = uiLayoutRow(split, 0); + uiItemR(row, ptr, "torque", 0, NULL, 0); + uiItemR(split, ptr, "local_torque", UI_ITEM_R_TOGGLE, NULL, 0); + + split = uiLayoutSplit(layout, 0.9, 0); + row = uiLayoutRow(split, 0); + uiItemR(row, ptr, "linear_velocity", 0, NULL, 0); + row = uiLayoutRow(split, 1); + uiItemR(row, ptr, "local_linear_velocity", UI_ITEM_R_TOGGLE, NULL, 0); + uiItemR(row, ptr, "add_linear_velocity", UI_ITEM_R_TOGGLE, NULL, 0); + + split = uiLayoutSplit(layout, 0.9, 0); + row = uiLayoutRow(split, 0); + uiItemR(row, ptr, "angular_velocity", 0, NULL, 0); + uiItemR(split, ptr, "local_angular_velocity", UI_ITEM_R_TOGGLE, NULL, 0); + + uiItemR(layout, ptr, "damping", 0, NULL, 0); + } break; case ACT_OBJECT_SERVO: uiItemR(layout, ptr, "reference_object", 0, NULL, 0); @@ -4563,6 +4581,9 @@ static void logic_buttons_new(bContext *C, ARegion *ar) { // gotta check if the current state is visible or not uiLayout *split, *col; + /* make as visible, for move operator */ + sens->flag |= SENS_VISIBLE; + split = uiLayoutSplit(layout, 0.95, 0); col = uiLayoutColumn(split, 1); uiLayoutSetContextPointer(col, "sensor", &ptr); @@ -4626,6 +4647,9 @@ static void logic_buttons_new(bContext *C, ARegion *ar) { // gotta check if the current state is visible or not uiLayout *split, *col; + /* make as visible, for move operator */ + act->flag |= ACT_VISIBLE; + split = uiLayoutSplit(layout, 0.05, 0); /* put inlink button to the left */ @@ -4818,15 +4842,15 @@ void logic_buttons(bContext *C, ARegion *ar) cpack(0x999999); glRecti(xco+22, yco, xco+width-22,yco+19); but= uiDefBut(block, LABEL, 0, controller_name(cont->type), (short)(xco+22), yco, 70, UI_UNIT_Y, cont, 0, 0, 0, 0, "Controller type"); - //uiButSetFunc(but, sca_move_controller, cont, NULL); + //uiButSetFunc(but, old_sca_move_controller, cont, NULL); but= uiDefBut(block, LABEL, 0, cont->name,(short)(xco+92), yco,(short)(width-158), UI_UNIT_Y, cont, 0, 0, 0, 0, "Controller name"); - //uiButSetFunc(but, sca_move_controller, cont, NULL); + //uiButSetFunc(but, old_sca_move_controller, cont, NULL); uiBlockBeginAlign(block); but= uiDefIconBut(block, BUT, B_REDR, ICON_TRIA_UP, (short)(xco+width-(110+5)), yco, 22, UI_UNIT_Y, NULL, 0, 0, 0, 0, "Move this logic brick up"); - uiButSetFunc(but, sca_move_controller, cont, (void *)TRUE); + uiButSetFunc(but, old_sca_move_controller, cont, (void *)TRUE); but= uiDefIconBut(block, BUT, B_REDR, ICON_TRIA_DOWN, (short)(xco+width-(88+5)), yco, 22, UI_UNIT_Y, NULL, 0, 0, 0, 0, "Move this logic brick down"); - uiButSetFunc(but, sca_move_controller, cont, (void *)FALSE); + uiButSetFunc(but, old_sca_move_controller, cont, (void *)FALSE); uiBlockEndAlign(block); ycoo= yco; @@ -4910,15 +4934,15 @@ void logic_buttons(bContext *C, ARegion *ar) set_col_sensor(sens->type, 1); glRecti(xco+22, yco, xco+width-22,yco+19); but= uiDefBut(block, LABEL, 0, sensor_name(sens->type), (short)(xco+22), yco, 80, UI_UNIT_Y, sens, 0, 0, 0, 0, ""); - //uiButSetFunc(but, sca_move_sensor, sens, NULL); + //uiButSetFunc(but, old_sca_move_sensor, sens, NULL); but= uiDefBut(block, LABEL, 0, sens->name, (short)(xco+102), yco, (short)(width-(pin?146:124)), UI_UNIT_Y, sens, 0, 31, 0, 0, ""); - //uiButSetFunc(but, sca_move_sensor, sens, NULL); + //uiButSetFunc(but, old_sca_move_sensor, sens, NULL); uiBlockBeginAlign(block); but= uiDefIconBut(block, BUT, B_REDR, ICON_TRIA_UP, (short)(xco+width-(66+5)), yco, 22, UI_UNIT_Y, NULL, 0, 0, 0, 0, "Move this logic brick up"); - uiButSetFunc(but, sca_move_sensor, sens, (void *)TRUE); + uiButSetFunc(but, old_sca_move_sensor, sens, (void *)TRUE); but= uiDefIconBut(block, BUT, B_REDR, ICON_TRIA_DOWN, (short)(xco+width-(44+5)), yco, 22, UI_UNIT_Y, NULL, 0, 0, 0, 0, "Move this logic brick down"); - uiButSetFunc(but, sca_move_sensor, sens, (void *)FALSE); + uiButSetFunc(but, old_sca_move_sensor, sens, (void *)FALSE); uiBlockEndAlign(block); } @@ -4988,15 +5012,15 @@ void logic_buttons(bContext *C, ARegion *ar) set_col_actuator(act->type, 1); glRecti((short)(xco+22), yco, (short)(xco+width-22),(short)(yco+19)); but= uiDefBut(block, LABEL, 0, actuator_name(act->type), (short)(xco+22), yco, 90, UI_UNIT_Y, act, 0, 0, 0, 0, "Actuator type"); - // uiButSetFunc(but, sca_move_actuator, act, NULL); + // uiButSetFunc(but, old_sca_move_actuator, act, NULL); but= uiDefBut(block, LABEL, 0, act->name, (short)(xco+112), yco, (short)(width-(pin?156:134)), UI_UNIT_Y, act, 0, 0, 0, 0, "Actuator name"); - // uiButSetFunc(but, sca_move_actuator, act, NULL); + // uiButSetFunc(but, old_sca_move_actuator, act, NULL); uiBlockBeginAlign(block); but= uiDefIconBut(block, BUT, B_REDR, ICON_TRIA_UP, (short)(xco+width-(66+5)), yco, 22, UI_UNIT_Y, NULL, 0, 0, 0, 0, "Move this logic brick up"); - uiButSetFunc(but, sca_move_actuator, act, (void *)TRUE); + uiButSetFunc(but, old_sca_move_actuator, act, (void *)TRUE); but= uiDefIconBut(block, BUT, B_REDR, ICON_TRIA_DOWN, (short)(xco+width-(44+5)), yco, 22, UI_UNIT_Y, NULL, 0, 0, 0, 0, "Move this logic brick down"); - uiButSetFunc(but, sca_move_actuator, act, (void *)FALSE); + uiButSetFunc(but, old_sca_move_actuator, act, (void *)FALSE); uiBlockEndAlign(block); ycoo= yco; diff --git a/source/blender/editors/space_sequencer/sequencer_add.c b/source/blender/editors/space_sequencer/sequencer_add.c index 36ae475e64b..01a99ed2b1f 100644 --- a/source/blender/editors/space_sequencer/sequencer_add.c +++ b/source/blender/editors/space_sequencer/sequencer_add.c @@ -459,7 +459,9 @@ static int sequencer_add_image_strip_exec(bContext *C, wmOperator *op) se= strip->stripdata; RNA_BEGIN(op->ptr, itemptr, "files") { - RNA_string_get(&itemptr, "name", se->name); + char *filename= RNA_string_get_alloc(&itemptr, "name", NULL, 0); + BLI_strncpy(se->name, filename, sizeof(se->name)); + MEM_freeN(filename); se++; } RNA_END; diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c b/source/blender/editors/space_sequencer/sequencer_draw.c index e449490516c..30f0f84c092 100644 --- a/source/blender/editors/space_sequencer/sequencer_draw.c +++ b/source/blender/editors/space_sequencer/sequencer_draw.c @@ -369,17 +369,17 @@ static void draw_seq_extensions(Scene *scene, SpaceSeq *sseq, Sequence *seq) { float x1, x2, y1, y2, pixely, a; char col[3], blendcol[3]; - View2D *v2d; + View2D *v2d= &sseq->v2d; if(seq->type >= SEQ_EFFECT) return; + if(v2d->mask.ymax == v2d->mask.ymin) return; /* avoid divide by zero */ x1= seq->startdisp; x2= seq->enddisp; y1= seq->machine+SEQ_STRIP_OFSBOTTOM; y2= seq->machine+SEQ_STRIP_OFSTOP; - - v2d = &sseq->v2d; + pixely = (v2d->cur.ymax - v2d->cur.ymin)/(v2d->mask.ymax - v2d->mask.ymin); blendcol[0] = blendcol[1] = blendcol[2] = 120; @@ -690,7 +690,7 @@ void set_special_seq_update(int val) else special_seq_update= 0; } -void draw_image_seq(const bContext* C, Scene *scene, ARegion *ar, SpaceSeq *sseq) +void draw_image_seq(const bContext* C, Scene *scene, ARegion *ar, SpaceSeq *sseq, int cfra, int frame_ofs) { extern void gl_round_box(int mode, float minx, float miny, float maxx, float maxy, float rad); struct ImBuf *ibuf; @@ -726,9 +726,11 @@ void draw_image_seq(const bContext* C, Scene *scene, ARegion *ar, SpaceSeq *sseq viewrecty /= proxy_size / 100.0; } - /* XXX TODO: take color from theme */ - glClearColor(0.0, 0.0, 0.0, 0.0); - glClear(GL_COLOR_BUFFER_BIT); + if(frame_ofs == 0) { + /* XXX TODO: take color from theme */ + glClearColor(0.0, 0.0, 0.0, 0.0); + glClear(GL_COLOR_BUFFER_BIT); + } /* without this colors can flicker from previous opengl state */ glColor4ub(255, 255, 255, 255); @@ -746,13 +748,13 @@ void draw_image_seq(const bContext* C, Scene *scene, ARegion *ar, SpaceSeq *sseq else { recursive= 1; if (special_seq_update) { - ibuf= give_ibuf_seq_direct(scene, rectx, recty, (scene->r.cfra), proxy_size, special_seq_update); + ibuf= give_ibuf_seq_direct(scene, rectx, recty, cfra + frame_ofs, proxy_size, special_seq_update); } else if (!U.prefetchframes) { // XXX || (G.f & G_PLAYANIM) == 0) { - ibuf= (ImBuf *)give_ibuf_seq(scene, rectx, recty, (scene->r.cfra), sseq->chanshown, proxy_size); + ibuf= (ImBuf *)give_ibuf_seq(scene, rectx, recty, cfra + frame_ofs, sseq->chanshown, proxy_size); } else { - ibuf= (ImBuf *)give_ibuf_seq_threaded(scene, rectx, recty, (scene->r.cfra), sseq->chanshown, proxy_size); + ibuf= (ImBuf *)give_ibuf_seq_threaded(scene, rectx, recty, cfra + frame_ofs, sseq->chanshown, proxy_size); } recursive= 0; @@ -812,11 +814,26 @@ void draw_image_seq(const bContext* C, Scene *scene, ARegion *ar, SpaceSeq *sseq glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, ibuf->x, ibuf->y, 0, GL_RGBA, GL_UNSIGNED_BYTE, ibuf->rect); - glBegin(GL_QUADS); - glTexCoord2f(0.0f, 0.0f); glVertex2f(v2d->tot.xmin, v2d->tot.ymin); - glTexCoord2f(0.0f, 1.0f);glVertex2f(v2d->tot.xmin, v2d->tot.ymax); + glBegin(GL_QUADS); + + if(frame_ofs) { + rctf tot_clip; + tot_clip.xmin= v2d->tot.xmin + (ABS(v2d->tot.xmax - v2d->tot.xmin) * scene->ed->over_border.xmin); + tot_clip.ymin= v2d->tot.ymin + (ABS(v2d->tot.ymax - v2d->tot.ymin) * scene->ed->over_border.ymin); + tot_clip.xmax= v2d->tot.xmin + (ABS(v2d->tot.xmax - v2d->tot.xmin) * scene->ed->over_border.xmax); + tot_clip.ymax= v2d->tot.ymin + (ABS(v2d->tot.ymax - v2d->tot.ymin) * scene->ed->over_border.ymax); + + glTexCoord2f(scene->ed->over_border.xmin, scene->ed->over_border.ymin);glVertex2f(tot_clip.xmin, tot_clip.ymin); + glTexCoord2f(scene->ed->over_border.xmin, scene->ed->over_border.ymax);glVertex2f(tot_clip.xmin, tot_clip.ymax); + glTexCoord2f(scene->ed->over_border.xmax, scene->ed->over_border.ymax);glVertex2f(tot_clip.xmax, tot_clip.ymax); + glTexCoord2f(scene->ed->over_border.xmax, scene->ed->over_border.ymin);glVertex2f(tot_clip.xmax, tot_clip.ymin); + } + else { + glTexCoord2f(0.0f, 0.0f);glVertex2f(v2d->tot.xmin, v2d->tot.ymin); + glTexCoord2f(0.0f, 1.0f);glVertex2f(v2d->tot.xmin, v2d->tot.ymax); glTexCoord2f(1.0f, 1.0f);glVertex2f(v2d->tot.xmax, v2d->tot.ymax); - glTexCoord2f(1.0f, 0.0f);glVertex2f(v2d->tot.xmax, v2d->tot.ymin); + glTexCoord2f(1.0f, 0.0f);glVertex2f(v2d->tot.xmax, v2d->tot.ymin); + } glEnd( ); glBindTexture(GL_TEXTURE_2D, last_texid); glDisable(GL_TEXTURE_2D); @@ -1056,6 +1073,19 @@ void draw_timeline_seq(const bContext *C, ARegion *ar) /* preview range */ UI_view2d_view_ortho(C, v2d); ANIM_draw_previewrange(C, v2d); + + /* overlap playhead */ + if(scene->ed && scene->ed->over_flag & SEQ_EDIT_OVERLAY_SHOW) { + int cfra_over= (scene->ed->over_flag & SEQ_EDIT_OVERLAY_ABS) ? scene->ed->over_cfra : scene->r.cfra + scene->ed->over_ofs; + glColor3f(0.2, 0.2, 0.2); + // glRectf(cfra_over, v2d->cur.ymin, scene->ed->over_ofs + scene->r.cfra + 1, v2d->cur.ymax); + + glBegin(GL_LINES); + glVertex2f(cfra_over, v2d->cur.ymin); + glVertex2f(cfra_over, v2d->cur.ymax); + glEnd(); + + } /* reset view matrix */ UI_view2d_view_restore(C); diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c index 1592c2093c4..19b8e9d7a79 100644 --- a/source/blender/editors/space_sequencer/sequencer_edit.c +++ b/source/blender/editors/space_sequencer/sequencer_edit.c @@ -792,7 +792,7 @@ static Sequence *cut_seq_hard(Scene *scene, Sequence * seq, int cutframe) if (!skip_dup) { /* Duplicate AFTER the first change */ - seqn = seq_dupli_recursive(scene, seq, SEQ_DUPE_UNIQUE_NAME); + seqn = seq_dupli_recursive(scene, seq, SEQ_DUPE_UNIQUE_NAME | SEQ_DUPE_ANIM); } if (seqn) { @@ -881,7 +881,7 @@ static Sequence *cut_seq_soft(Scene *scene, Sequence * seq, int cutframe) if (!skip_dup) { /* Duplicate AFTER the first change */ - seqn = seq_dupli_recursive(scene, seq, SEQ_DUPE_UNIQUE_NAME); + seqn = seq_dupli_recursive(scene, seq, SEQ_DUPE_UNIQUE_NAME | SEQ_DUPE_ANIM); } if (seqn) { @@ -1117,6 +1117,15 @@ int sequencer_edit_poll(bContext *C) return (seq_give_editing(CTX_data_scene(C), FALSE) != NULL); } +int sequencer_view_poll(bContext *C) +{ + SpaceSeq *sseq= CTX_wm_space_seq(C); + Editing *ed= seq_give_editing(CTX_data_scene(C), FALSE); + if (ed && sseq && (sseq->mainb == SEQ_DRAW_IMG_IMBUF)) + return 1; + + return 0; +} /* snap operator*/ static int sequencer_snap_exec(bContext *C, wmOperator *op) @@ -1588,6 +1597,18 @@ void SEQUENCER_OT_cut(struct wmOperatorType *ot) } /* duplicate operator */ +static int apply_unique_name_cb(Sequence *seq, void *arg_pt) +{ + Scene *scene= (Scene *)arg_pt; + char name[sizeof(seq->name)-2]; + + strcpy(name, seq->name+2); + seqbase_unique_name_recursive(&scene->ed->seqbase, seq); + seq_dupe_animdata(scene, name, seq->name+2); + return 1; + +} + static int sequencer_add_duplicate_exec(bContext *C, wmOperator *op) { Scene *scene= CTX_data_scene(C); @@ -1598,7 +1619,7 @@ static int sequencer_add_duplicate_exec(bContext *C, wmOperator *op) if(ed==NULL) return OPERATOR_CANCELLED; - seqbase_dupli_recursive(scene, &nseqbase, ed->seqbasep, SEQ_DUPE_UNIQUE_NAME|SEQ_DUPE_CONTEXT); + seqbase_dupli_recursive(scene, &nseqbase, ed->seqbasep, SEQ_DUPE_CONTEXT); if(nseqbase.first) { Sequence * seq= nseqbase.first; @@ -1606,7 +1627,7 @@ static int sequencer_add_duplicate_exec(bContext *C, wmOperator *op) addlisttolist(ed->seqbasep, &nseqbase); for( ; seq; seq= seq->next) - seqbase_unique_name_recursive(&ed->seqbase, seq); + seq_recursive_apply(seq, apply_unique_name_cb, scene); WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER, scene); return OPERATOR_FINISHED; @@ -2711,3 +2732,62 @@ void SEQUENCER_OT_swap_data(wmOperatorType *ot) /* properties */ } +/* borderselect operator */ +static int view_ghost_border_exec(bContext *C, wmOperator *op) +{ + Scene *scene= CTX_data_scene(C); + Editing *ed= seq_give_editing(scene, FALSE); + View2D *v2d= UI_view2d_fromcontext(C); + + rctf rect; + + /* convert coordinates of rect to 'tot' rect coordinates */ + UI_view2d_region_to_view(v2d, RNA_int_get(op->ptr, "xmin"), RNA_int_get(op->ptr, "ymin"), &rect.xmin, &rect.ymin); + UI_view2d_region_to_view(v2d, RNA_int_get(op->ptr, "xmax"), RNA_int_get(op->ptr, "ymax"), &rect.xmax, &rect.ymax); + + if(ed==NULL) + return OPERATOR_CANCELLED; + + rect.xmin /= (float)(ABS(v2d->tot.xmax - v2d->tot.xmin)); + rect.ymin /= (float)(ABS(v2d->tot.ymax - v2d->tot.ymin)); + + rect.xmax /= (float)(ABS(v2d->tot.xmax - v2d->tot.xmin)); + rect.ymax /= (float)(ABS(v2d->tot.ymax - v2d->tot.ymin)); + + rect.xmin+=0.5; + rect.xmax+=0.5; + rect.ymin+=0.5; + rect.ymax+=0.5; + + CLAMP(rect.xmin, 0.0f, 1.0f); + CLAMP(rect.ymin, 0.0f, 1.0f); + CLAMP(rect.xmax, 0.0f, 1.0f); + CLAMP(rect.ymax, 0.0f, 1.0f); + + scene->ed->over_border= rect; + + WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER, scene); + + return OPERATOR_FINISHED; +} + +/* ****** Border Select ****** */ +void SEQUENCER_OT_view_ghost_border(wmOperatorType *ot) +{ + /* identifiers */ + ot->name= "Border Offset View"; + ot->idname= "SEQUENCER_OT_view_ghost_border"; + ot->description="Enable border select mode"; + + /* api callbacks */ + ot->invoke= WM_border_select_invoke; + ot->exec= view_ghost_border_exec; + ot->modal= WM_border_select_modal; + ot->poll= sequencer_view_poll; + + /* flags */ + ot->flag= 0; + + /* rna */ + WM_operator_properties_gesture_border(ot, FALSE); +} diff --git a/source/blender/editors/space_sequencer/sequencer_intern.h b/source/blender/editors/space_sequencer/sequencer_intern.h index df426e91075..bf0dfff8e98 100644 --- a/source/blender/editors/space_sequencer/sequencer_intern.h +++ b/source/blender/editors/space_sequencer/sequencer_intern.h @@ -48,7 +48,7 @@ struct ARegion *sequencer_has_buttons_region(struct ScrArea *sa); /* sequencer_draw.c */ void draw_timeline_seq(const struct bContext *C, struct ARegion *ar); -void draw_image_seq(const struct bContext* C, struct Scene *scene,struct ARegion *ar, struct SpaceSeq *sseq); +void draw_image_seq(const struct bContext* C, struct Scene *scene,struct ARegion *ar, struct SpaceSeq *sseq, int cfra, int offset); void seq_reset_imageofs(struct SpaceSeq *sseq); @@ -69,6 +69,7 @@ struct Sequence *alloc_sequence(struct ListBase *lb, int cfra, int machine); /* operator helpers */ int sequencer_edit_poll(struct bContext *C); +int sequencer_view_poll(struct bContext *C); /* externs */ extern EnumPropertyItem sequencer_prop_effect_types[]; @@ -103,6 +104,7 @@ void SEQUENCER_OT_view_toggle(struct wmOperatorType *ot); void SEQUENCER_OT_view_all(struct wmOperatorType *ot); void SEQUENCER_OT_view_selected(struct wmOperatorType *ot); void SEQUENCER_OT_view_zoom_ratio(struct wmOperatorType *ot); +void SEQUENCER_OT_view_ghost_border(struct wmOperatorType *ot); void SEQUENCER_OT_copy(struct wmOperatorType *ot); void SEQUENCER_OT_paste(struct wmOperatorType *ot); diff --git a/source/blender/editors/space_sequencer/sequencer_ops.c b/source/blender/editors/space_sequencer/sequencer_ops.c index 9f5a97d4446..82f70eafc0a 100644 --- a/source/blender/editors/space_sequencer/sequencer_ops.c +++ b/source/blender/editors/space_sequencer/sequencer_ops.c @@ -82,6 +82,7 @@ void sequencer_operatortypes(void) WM_operatortype_append(SEQUENCER_OT_view_all_preview); WM_operatortype_append(SEQUENCER_OT_view_toggle); WM_operatortype_append(SEQUENCER_OT_view_zoom_ratio); + WM_operatortype_append(SEQUENCER_OT_view_ghost_border); /* sequencer_select.c */ WM_operatortype_append(SEQUENCER_OT_select_all_toggle); @@ -113,6 +114,9 @@ void sequencer_keymap(wmKeyConfig *keyconf) wmKeyMap *keymap= WM_keymap_find(keyconf, "SequencerCommon", SPACE_SEQ, 0); wmKeyMapItem *kmi; + kmi= WM_keymap_add_item(keymap, "WM_OT_context_toggle", OKEY, KM_PRESS, KM_SHIFT, 0); + RNA_string_set(kmi->ptr, "data_path", "scene.sequence_editor.show_overlay"); + /* operators common to sequence and preview view */ WM_keymap_add_item(keymap, "SEQUENCER_OT_view_toggle", TABKEY, KM_PRESS, KM_CTRL, 0); @@ -223,6 +227,10 @@ void sequencer_keymap(wmKeyConfig *keyconf) WM_keymap_add_menu(keymap, "SEQUENCER_MT_add", AKEY, KM_PRESS, KM_SHIFT, 0); + kmi= WM_keymap_add_item(keymap, "WM_OT_context_set_int", OKEY, KM_PRESS, 0, 0); + RNA_string_set(kmi->ptr, "data_path", "scene.sequence_editor.overlay_frame"); + RNA_int_set(kmi->ptr, "value", 0); + transform_keymap_for_space(keyconf, keymap, SPACE_SEQ); keymap= WM_keymap_find(keyconf, "SequencerPreview", SPACE_SEQ, 0); @@ -232,6 +240,8 @@ void sequencer_keymap(wmKeyConfig *keyconf) keymap= WM_keymap_find(keyconf, "SequencerPreview", SPACE_SEQ, 0); + WM_keymap_add_item(keymap, "SEQUENCER_OT_view_ghost_border", OKEY, KM_PRESS, 0, 0); + /* would prefer to use numpad keys for job */ RNA_float_set(WM_keymap_add_item(keymap, "SEQUENCER_OT_view_zoom_ratio", PAD8, KM_PRESS, KM_SHIFT, 0)->ptr, "ratio", 8.0f); RNA_float_set(WM_keymap_add_item(keymap, "SEQUENCER_OT_view_zoom_ratio", PAD4, KM_PRESS, KM_SHIFT, 0)->ptr, "ratio", 4.0f); diff --git a/source/blender/editors/space_sequencer/space_sequencer.c b/source/blender/editors/space_sequencer/space_sequencer.c index 8b7670a55bc..586b76268e4 100644 --- a/source/blender/editors/space_sequencer/space_sequencer.c +++ b/source/blender/editors/space_sequencer/space_sequencer.c @@ -396,7 +396,21 @@ static void sequencer_preview_area_draw(const bContext *C, ARegion *ar) /* XXX temp fix for wrong setting in sseq->mainb */ if (sseq->mainb == SEQ_DRAW_SEQUENCE) sseq->mainb = SEQ_DRAW_IMG_IMBUF; - draw_image_seq(C, scene, ar, sseq); + + draw_image_seq(C, scene, ar, sseq, scene->r.cfra, 0); + + if(scene->ed && scene->ed->over_flag & SEQ_EDIT_OVERLAY_SHOW && sseq->mainb == SEQ_DRAW_IMG_IMBUF) { + int over_cfra; + + if(scene->ed->over_flag & SEQ_EDIT_OVERLAY_ABS) + over_cfra= scene->ed->over_cfra; + else + over_cfra= scene->r.cfra + scene->ed->over_ofs; + + if(over_cfra != scene->r.cfra) + draw_image_seq(C, scene, ar, sseq, scene->r.cfra, over_cfra - scene->r.cfra); + } + } static void sequencer_preview_area_listener(ARegion *ar, wmNotifier *wmn) diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index 7cbcc982bf6..be98e24ea9d 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -4475,13 +4475,13 @@ static void tekenvertsN(Nurb *nu, short sel, short hide_handles, void *lastsel) a= nu->pntsu; while(a--) { if(bezt->hide==0) { - if (bezt == lastsel) { + if (sel == 1 && bezt == lastsel) { UI_ThemeColor(TH_LASTSEL_POINT); bglVertex3fv(bezt->vec[1]); if (!hide_handles) { - bglVertex3fv(bezt->vec[0]); - bglVertex3fv(bezt->vec[2]); + if(bezt->f1 & SELECT) bglVertex3fv(bezt->vec[0]); + if(bezt->f3 & SELECT) bglVertex3fv(bezt->vec[2]); } UI_ThemeColor(color); diff --git a/source/blender/makesdna/DNA_sequence_types.h b/source/blender/makesdna/DNA_sequence_types.h index f5ca32c6b32..3ab7cb73d56 100644 --- a/source/blender/makesdna/DNA_sequence_types.h +++ b/source/blender/makesdna/DNA_sequence_types.h @@ -196,6 +196,10 @@ typedef struct Editing { Sequence *act_seq; char act_imagedir[256]; char act_sounddir[256]; + + int over_ofs, over_cfra; + int over_flag, pad; + rctf over_border; } Editing; /* ************* Effect Variable Structs ********* */ @@ -242,6 +246,10 @@ typedef struct SpeedControlVars { int lastValidFrame; } SpeedControlVars; +/* Editor->over_flag */ +#define SEQ_EDIT_OVERLAY_SHOW 1 +#define SEQ_EDIT_OVERLAY_ABS 2 + #define SEQ_STRIP_OFSBOTTOM 0.2f #define SEQ_STRIP_OFSTOP 0.8f diff --git a/source/blender/makesrna/intern/rna_constraint.c b/source/blender/makesrna/intern/rna_constraint.c index a7f2761526e..fb19e8976c3 100644 --- a/source/blender/makesrna/intern/rna_constraint.c +++ b/source/blender/makesrna/intern/rna_constraint.c @@ -1940,7 +1940,6 @@ void RNA_def_constraint(BlenderRNA *brna) prop= RNA_def_property(srna, "enabled", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", CONSTRAINT_OFF); RNA_def_property_ui_text(prop, "Enabled", "Enable/Disable Constraint"); - RNA_def_property_ui_icon(prop, ICON_CHECKBOX_DEHLT, 1); prop= RNA_def_property(srna, "expanded", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", CONSTRAINT_EXPAND); diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c index cc135ff124f..5ebf43fc2b7 100644 --- a/source/blender/makesrna/intern/rna_nodetree.c +++ b/source/blender/makesrna/intern/rna_nodetree.c @@ -865,7 +865,7 @@ static void def_cmp_blur(StructRNA *srna) prop = RNA_def_property(srna, "relative", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "relative", 1); - RNA_def_property_ui_text(prop, "Relative", ""); + RNA_def_property_ui_text(prop, "Relative", "Use relative (percent) values to define blur radius"); RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); prop = RNA_def_property(srna, "factor", PROP_FLOAT, PROP_NONE); @@ -894,12 +894,12 @@ static void def_cmp_blur(StructRNA *srna) prop = RNA_def_property(srna, "bokeh", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "bokeh", 1); - RNA_def_property_ui_text(prop, "Bokeh", ""); + RNA_def_property_ui_text(prop, "Bokeh", "Uses circular filter (slower)"); RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); prop = RNA_def_property(srna, "gamma", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "gamma", 1); - RNA_def_property_ui_text(prop, "Gamma", ""); + RNA_def_property_ui_text(prop, "Gamma", "Applies filter on gamma corrected values"); RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); } @@ -1176,6 +1176,7 @@ static void def_cmp_scale(StructRNA *srna) {0, "RELATIVE", 0, "Relative", ""}, {1, "ABSOLUTE", 0, "Absolute", ""}, {2, "SCENE_SIZE", 0, "Scene Size", ""}, + {3, "RENDER_SIZE", 0, "Render Size", ""}, {0, NULL, 0, NULL, NULL}}; prop = RNA_def_property(srna, "space", PROP_ENUM, PROP_NONE); diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c index 2bb3a74252e..638d867e862 100644 --- a/source/blender/makesrna/intern/rna_object.c +++ b/source/blender/makesrna/intern/rna_object.c @@ -1476,7 +1476,7 @@ static void rna_def_object(BlenderRNA *brna) {OB_BOUND_SPHERE, "SPHERE", 0, "Sphere", ""}, {OB_BOUND_CYLINDER, "CYLINDER", 0, "Cylinder", ""}, {OB_BOUND_CONE, "CONE", 0, "Cone", ""}, - {OB_BOUND_POLYH, "POLYHEDER", 0, "Polyheder", ""}, + {OB_BOUND_POLYH, "POLYHEDRON", 0, "Polyhedron", ""}, {0, NULL, 0, NULL, NULL}}; static EnumPropertyItem dupli_items[] = { diff --git a/source/blender/makesrna/intern/rna_sequencer.c b/source/blender/makesrna/intern/rna_sequencer.c index b7bdffa0e13..9313a85c17f 100644 --- a/source/blender/makesrna/intern/rna_sequencer.c +++ b/source/blender/makesrna/intern/rna_sequencer.c @@ -30,6 +30,7 @@ #include "rna_internal.h" +#include "DNA_anim_types.h" #include "DNA_object_types.h" #include "DNA_scene_types.h" #include "DNA_sequence_types.h" @@ -270,6 +271,7 @@ static void rna_Sequence_name_set(PointerRNA *ptr, const char *value) Scene *scene= (Scene*)ptr->id.data; Sequence *seq= (Sequence*)ptr->data; char oldname[sizeof(seq->name)]; + AnimData *adt; /* make a copy of the old name first */ BLI_strncpy(oldname, seq->name+2, sizeof(seq->name)-2); @@ -281,7 +283,12 @@ static void rna_Sequence_name_set(PointerRNA *ptr, const char *value) seqbase_unique_name_recursive(&scene->ed->seqbase, seq); /* fix all the animation data which may link to this */ - BKE_all_animdata_fix_paths_rename("sequence_editor.sequences_all", oldname, seq->name+2); + + /* dont rename everywhere because these are per scene */ + /* BKE_all_animdata_fix_paths_rename("sequence_editor.sequences_all", oldname, seq->name+2); */ + adt= BKE_animdata_from_id(&scene->id); + if(adt) + BKE_animdata_fix_paths_rename(&scene->id, adt, "sequence_editor.sequences_all", oldname, seq->name+2, 0, 0, 1); } static StructRNA* rna_Sequence_refine(struct PointerRNA *ptr) @@ -514,6 +521,55 @@ static char *rna_SequenceColorBalance_path(PointerRNA *ptr) return BLI_strdup(""); } +static void rna_SequenceEditor_overlay_lock_set(PointerRNA *ptr, int value) +{ + Scene *scene= ptr->id.data; + Editing *ed= seq_give_editing(scene, FALSE); + + if(ed==NULL) + return; + + /* convert from abs to relative and back */ + if((ed->over_flag & SEQ_EDIT_OVERLAY_ABS)==0 && value) { + ed->over_cfra= scene->r.cfra + ed->over_ofs; + ed->over_flag |= SEQ_EDIT_OVERLAY_ABS; + } + else if((ed->over_flag & SEQ_EDIT_OVERLAY_ABS) && !value) { + ed->over_ofs= ed->over_cfra - scene->r.cfra; + ed->over_flag &= ~SEQ_EDIT_OVERLAY_ABS; + } +} + +static int rna_SequenceEditor_overlay_frame_get(PointerRNA *ptr) +{ + Scene *scene= (Scene *)ptr->id.data; + Editing *ed= seq_give_editing(scene, FALSE); + + if(ed==NULL) + return scene->r.cfra; + + if(ed->over_flag & SEQ_EDIT_OVERLAY_ABS) + return ed->over_cfra - scene->r.cfra; + else + return ed->over_ofs; + +} + +static void rna_SequenceEditor_overlay_frame_set(PointerRNA *ptr, int value) +{ + Scene *scene= (Scene *)ptr->id.data; + Editing *ed= seq_give_editing(scene, FALSE); + + if(ed==NULL) + return; + + + if(ed->over_flag & SEQ_EDIT_OVERLAY_ABS) + ed->over_cfra= (scene->r.cfra + value); + else + ed->over_ofs= value; +} + #else static void rna_def_strip_element(BlenderRNA *brna) @@ -527,9 +583,7 @@ static void rna_def_strip_element(BlenderRNA *brna) prop= RNA_def_property(srna, "filename", PROP_STRING, PROP_FILENAME); RNA_def_property_string_sdna(prop, NULL, "name"); - RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_property_ui_text(prop, "Filename", ""); - RNA_def_property_string_funcs(prop, NULL, NULL, "rna_SequenceElement_filename_set"); RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update"); } @@ -880,6 +934,22 @@ static void rna_def_editor(BlenderRNA *brna) RNA_def_property_pointer_sdna(prop, NULL, "act_seq"); RNA_def_property_flag(prop, PROP_EDITABLE); + prop= RNA_def_property(srna, "show_overlay", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "over_flag", SEQ_EDIT_OVERLAY_SHOW); + RNA_def_property_ui_text(prop, "Draw Axes", "Partial overlay ontop of the sequencer"); + RNA_def_property_update(prop, NC_SPACE|ND_SPACE_SEQUENCER, NULL); + + prop= RNA_def_property(srna, "overlay_lock", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "over_flag", SEQ_EDIT_OVERLAY_ABS); + RNA_def_property_ui_text(prop, "Overlay Lock", ""); + RNA_def_property_boolean_funcs(prop, NULL, "rna_SequenceEditor_overlay_lock_set"); + RNA_def_property_update(prop, NC_SPACE|ND_SPACE_SEQUENCER, NULL); + + /* access to fixed and relative frame */ + prop= RNA_def_property(srna, "overlay_frame", PROP_INT, PROP_NONE); + RNA_def_property_ui_text(prop, "Overlay Offset", ""); + RNA_def_property_int_funcs(prop, "rna_SequenceEditor_overlay_frame_get", "rna_SequenceEditor_overlay_frame_set", NULL); + RNA_def_property_update(prop, NC_SPACE|ND_SPACE_SEQUENCER, NULL); RNA_def_property_ui_text(prop, "Active Strip", "Sequencers active strip"); } diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_scale.c b/source/blender/nodes/intern/CMP_nodes/CMP_scale.c index d7a9497f41d..9779875b01a 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_scale.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_scale.c @@ -64,6 +64,10 @@ static void node_composit_exec_scale(void *data, bNode *node, bNodeStack **in, b else if(node->custom1==CMP_SCALE_SCENEPERCENT) { newx = cbuf->x * (rd->size / 100.0f); newy = cbuf->y * (rd->size / 100.0f); + } + else if (node->custom1==CMP_SCALE_RENDERPERCENT) { + newx= (rd->xsch * rd->size)/100; + newy= (rd->ysch * rd->size)/100; } else { /* CMP_SCALE_ABSOLUTE */ newx= MAX2((int)in[1]->vec[0], 1); newy= MAX2((int)in[2]->vec[0], 1); diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_texture.c b/source/blender/nodes/intern/CMP_nodes/CMP_texture.c index b130b3f38a8..f990fa452cb 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_texture.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_texture.c @@ -95,10 +95,11 @@ static void node_composit_exec_texture(void *data, bNode *node, bNodeStack **in, /* first make the preview image */ CompBuf *prevbuf= alloc_compbuf(140, 140, CB_RGBA, 1); /* alloc */ - - sizex = rd->xsch; - sizey = rd->ysch; - + + /* Also take care about the render size! */ + sizex = (rd->size*rd->xsch)/100; + sizey = (rd->size*rd->ysch)/100; + prevbuf->rect_procedural= texture_procedural; prevbuf->node= node; VECCOPY(prevbuf->procedural_offset, in[0]->vec); diff --git a/source/blender/python/intern/bpy_interface.c b/source/blender/python/intern/bpy_interface.c index 6a1495b5f65..bf91b0498ed 100644 --- a/source/blender/python/intern/bpy_interface.c +++ b/source/blender/python/intern/bpy_interface.c @@ -150,7 +150,6 @@ void BPY_update_modules( void ) *****************************************************************************/ static PyObject *CreateGlobalDictionary( bContext *C, const char *filename ) { - PyObject *mod; PyObject *item; PyObject *dict = PyDict_New( ); PyDict_SetItemString( dict, "__builtins__", PyEval_GetBuiltins( ) ); @@ -166,11 +165,6 @@ static PyObject *CreateGlobalDictionary( bContext *C, const char *filename ) Py_DECREF(item); } - /* add bpy to global namespace */ - mod= PyImport_ImportModuleLevel("bpy", NULL, NULL, NULL, 0); - PyDict_SetItemString( dict, "bpy", mod ); - Py_DECREF(mod); - return dict; } diff --git a/source/blender/render/extern/include/RE_pipeline.h b/source/blender/render/extern/include/RE_pipeline.h index a75dd193de2..378a386478d 100644 --- a/source/blender/render/extern/include/RE_pipeline.h +++ b/source/blender/render/extern/include/RE_pipeline.h @@ -130,8 +130,8 @@ typedef struct RenderResult { /* for render results in Image, verify validity for sequences */ int framenr; - /* for acquire image, to indicate if it is compo/seq result */ - int compo_seq; + /* for acquire image, to indicate if it there is a combined layer */ + int have_combined; /* render info text */ char *text; diff --git a/source/blender/render/intern/source/convertblender.c b/source/blender/render/intern/source/convertblender.c index c3034768a4e..4436bdb9261 100644 --- a/source/blender/render/intern/source/convertblender.c +++ b/source/blender/render/intern/source/convertblender.c @@ -4780,7 +4780,7 @@ static void database_init_objects(Render *re, unsigned int renderlay, int nolamp /* in the prev/next pass for making speed vectors, avoid creating * objects that are not on a renderlayer with a vector pass, can * save a lot of time in complex scenes */ - vectorlay= get_vector_renderlayers(sce); + vectorlay= get_vector_renderlayers(re->scene); lay= (timeoffset)? renderlay & vectorlay: renderlay; /* if the object has been restricted from rendering in the outliner, ignore it */ @@ -4807,7 +4807,7 @@ static void database_init_objects(Render *re, unsigned int renderlay, int nolamp /* create list of duplis generated by this object, particle * system need to have render settings set for dupli particles */ dupli_render_particle_set(re, ob, timeoffset, 0, 1); - lb= object_duplilist(sce, ob); + lb= object_duplilist(re->scene, ob); dupli_render_particle_set(re, ob, timeoffset, 0, 0); for(dob= lb->first; dob; dob= dob->next) { diff --git a/source/blender/render/intern/source/pipeline.c b/source/blender/render/intern/source/pipeline.c index 9033729652e..bdf4eaec589 100644 --- a/source/blender/render/intern/source/pipeline.c +++ b/source/blender/render/intern/source/pipeline.c @@ -1090,7 +1090,7 @@ void RE_AcquireResultImage(Render *re, RenderResult *rr) rr->rectz= RE_RenderLayerGetPass(rl, SCE_PASS_Z); } - rr->compo_seq= (rr->rectf != NULL); + rr->have_combined= (re->result->rectf != NULL); rr->layers= re->result->layers; } } diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c index 7c11c7ff3af..0023ded23f0 100644 --- a/source/blender/windowmanager/intern/wm_operators.c +++ b/source/blender/windowmanager/intern/wm_operators.c @@ -830,7 +830,7 @@ void WM_operator_properties_filesel(wmOperatorType *ot, int filter, short type, RNA_def_property_flag(prop, PROP_HIDDEN); if(flag & WM_FILESEL_RELPATH) - RNA_def_boolean(ot->srna, "relative_path", 0, "Relative Path", "Select the file relative to the blend file"); + RNA_def_boolean(ot->srna, "relative_path", (U.flag & USER_RELPATHS) ? 1:0, "Relative Path", "Select the file relative to the blend file"); } void WM_operator_properties_select_all(wmOperatorType *ot) { @@ -1819,7 +1819,7 @@ static void WM_OT_save_as_mainfile(wmOperatorType *ot) WM_operator_properties_filesel(ot, FOLDERFILE|BLENDERFILE, FILE_BLENDER, FILE_SAVE, WM_FILESEL_FILEPATH); RNA_def_boolean(ot->srna, "compress", 0, "Compress", "Write compressed .blend file"); - RNA_def_boolean(ot->srna, "relative_remap", 0, "Remap Relative", "Remap relative paths when saving in a different directory"); + RNA_def_boolean(ot->srna, "relative_remap", 1, "Remap Relative", "Remap relative paths when saving in a different directory"); } /* *************** save file directly ******** */ @@ -3141,6 +3141,7 @@ static void gesture_border_modal_keymap(wmKeyConfig *keyconf) WM_modalkeymap_assign(keymap, "NODE_OT_select_border"); // WM_modalkeymap_assign(keymap, "SCREEN_OT_border_select"); // template WM_modalkeymap_assign(keymap, "SEQUENCER_OT_select_border"); + WM_modalkeymap_assign(keymap, "SEQUENCER_OT_view_ghost_border"); WM_modalkeymap_assign(keymap, "UV_OT_select_border"); WM_modalkeymap_assign(keymap, "VIEW2D_OT_zoom_border"); WM_modalkeymap_assign(keymap, "VIEW3D_OT_clip_border"); |