Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>2010-07-05 22:37:29 +0400
committerTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>2010-07-05 22:37:29 +0400
commitb8de9bc5fbcbdb05a1cf2f07f5b1a2572f70decf (patch)
treeee6ff5c090244d10df36ebd80624b6861a639b70 /source/blender/editors
parent38b7cbbd004ef7268a1c39114d8503906361c1f7 (diff)
parent59b8f8d18c8d8f4a29c1dc70a4faa707118bd632 (diff)
Merged changes in the trunk up to revision 29994.
Diffstat (limited to 'source/blender/editors')
-rw-r--r--source/blender/editors/animation/anim_channels_defines.c1
-rw-r--r--source/blender/editors/animation/anim_deps.c4
-rw-r--r--source/blender/editors/animation/anim_filter.c21
-rw-r--r--source/blender/editors/animation/anim_ops.c1
-rw-r--r--source/blender/editors/animation/keyframes_draw.c4
-rw-r--r--source/blender/editors/animation/keyingsets.c2
-rw-r--r--source/blender/editors/armature/editarmature_sketch.c1
-rw-r--r--source/blender/editors/armature/meshlaplacian.c2
-rw-r--r--source/blender/editors/armature/meshlaplacian.h2
-rw-r--r--source/blender/editors/curve/editcurve.c4
-rw-r--r--source/blender/editors/curve/editfont.c4
-rw-r--r--source/blender/editors/include/ED_anim_api.h5
-rw-r--r--source/blender/editors/include/ED_armature.h2
-rw-r--r--source/blender/editors/include/ED_keyframing.h2
-rw-r--r--source/blender/editors/include/ED_render.h1
-rw-r--r--source/blender/editors/include/UI_interface.h9
-rw-r--r--source/blender/editors/interface/interface_handlers.c48
-rw-r--r--source/blender/editors/interface/interface_icons.c41
-rw-r--r--source/blender/editors/interface/interface_intern.h7
-rw-r--r--source/blender/editors/interface/interface_layout.c33
-rw-r--r--source/blender/editors/interface/interface_ops.c2
-rw-r--r--source/blender/editors/interface/interface_regions.c14
-rw-r--r--source/blender/editors/interface/interface_templates.c128
-rw-r--r--source/blender/editors/interface/interface_widgets.c92
-rw-r--r--source/blender/editors/mesh/editmesh_add.c20
-rw-r--r--source/blender/editors/mesh/editmesh_tools.c2
-rw-r--r--source/blender/editors/metaball/mball_edit.c14
-rw-r--r--source/blender/editors/object/object_add.c62
-rw-r--r--source/blender/editors/object/object_constraint.c4
-rw-r--r--source/blender/editors/object/object_edit.c11
-rw-r--r--source/blender/editors/object/object_modifier.c13
-rw-r--r--source/blender/editors/object/object_relations.c51
-rw-r--r--source/blender/editors/render/render_internal.c17
-rw-r--r--source/blender/editors/render/render_opengl.c7
-rw-r--r--source/blender/editors/render/render_preview.c6
-rw-r--r--source/blender/editors/render/render_shading.c2
-rw-r--r--source/blender/editors/screen/area.c8
-rw-r--r--source/blender/editors/screen/screen_context.c32
-rw-r--r--source/blender/editors/screen/screen_ops.c1
-rw-r--r--source/blender/editors/screen/screendump.c2
-rw-r--r--source/blender/editors/sculpt_paint/paint_image.c7
-rw-r--r--source/blender/editors/sound/sound_ops.c2
-rw-r--r--source/blender/editors/space_action/action_edit.c1
-rw-r--r--source/blender/editors/space_buttons/buttons_ops.c56
-rw-r--r--source/blender/editors/space_file/file_ops.c6
-rw-r--r--source/blender/editors/space_file/filelist.c2
-rw-r--r--source/blender/editors/space_file/filesel.c36
-rw-r--r--source/blender/editors/space_file/fsmenu.c71
-rw-r--r--source/blender/editors/space_file/fsmenu.h5
-rw-r--r--source/blender/editors/space_file/space_file.c13
-rw-r--r--source/blender/editors/space_graph/graph_edit.c3
-rw-r--r--source/blender/editors/space_graph/graph_ops.c1
-rw-r--r--source/blender/editors/space_image/SConscript1
-rw-r--r--source/blender/editors/space_image/image_ops.c28
-rw-r--r--source/blender/editors/space_info/info_ops.c2
-rw-r--r--source/blender/editors/space_info/space_info.c31
-rw-r--r--source/blender/editors/space_logic/logic_window.c10
-rw-r--r--source/blender/editors/space_node/drawnode.c14
-rw-r--r--source/blender/editors/space_node/node_edit.c64
-rw-r--r--source/blender/editors/space_sequencer/sequencer_add.c117
-rw-r--r--source/blender/editors/space_sequencer/sequencer_draw.c99
-rw-r--r--source/blender/editors/space_sequencer/sequencer_edit.c127
-rw-r--r--source/blender/editors/space_sequencer/sequencer_intern.h1
-rw-r--r--source/blender/editors/space_sequencer/sequencer_ops.c2
-rw-r--r--source/blender/editors/space_sequencer/space_sequencer.c1
-rw-r--r--source/blender/editors/space_text/text_ops.c4
-rw-r--r--source/blender/editors/space_time/space_time.c14
-rw-r--r--source/blender/editors/space_view3d/drawobject.c5
-rw-r--r--source/blender/editors/space_view3d/space_view3d.c3
-rw-r--r--source/blender/editors/space_view3d/view3d_draw.c10
-rw-r--r--source/blender/editors/space_view3d/view3d_edit.c86
-rw-r--r--source/blender/editors/space_view3d/view3d_intern.h1
-rw-r--r--source/blender/editors/space_view3d/view3d_ops.c4
-rw-r--r--source/blender/editors/transform/transform.c31
-rw-r--r--source/blender/editors/transform/transform_conversions.c2
-rw-r--r--source/blender/editors/transform/transform_generics.c2
-rw-r--r--source/blender/editors/util/ed_util.c4
77 files changed, 1084 insertions, 464 deletions
diff --git a/source/blender/editors/animation/anim_channels_defines.c b/source/blender/editors/animation/anim_channels_defines.c
index fee66384e65..09fbdf2d70d 100644
--- a/source/blender/editors/animation/anim_channels_defines.c
+++ b/source/blender/editors/animation/anim_channels_defines.c
@@ -3206,6 +3206,7 @@ void ANIM_channel_draw_widgets (bAnimContext *ac, bAnimListElem *ale, uiBlock *b
*/
if ((draw_sliders) && ELEM(ale->type, ANIMTYPE_FCURVE, ANIMTYPE_SHAPEKEY)) {
/* adjust offset */
+ // TODO: make slider width dynamic, so that they can be easier to use when the view is wide enough
offset += SLIDER_WIDTH;
/* need backdrop behind sliders... */
diff --git a/source/blender/editors/animation/anim_deps.c b/source/blender/editors/animation/anim_deps.c
index 82575cf58fa..5312e97c604 100644
--- a/source/blender/editors/animation/anim_deps.c
+++ b/source/blender/editors/animation/anim_deps.c
@@ -90,7 +90,7 @@ void ANIM_list_elem_update(Scene *scene, bAnimListElem *ale)
else {
/* in other case we do standard depsgaph update, ideally
we'd be calling property update functions here too ... */
- DAG_id_flush_update(id, OB_RECALC); // XXX or do we want something more restrictive?
+ DAG_id_flush_update(id, OB_RECALC_ALL); // XXX or do we want something more restrictive?
}
}
@@ -106,7 +106,7 @@ void ANIM_id_update(Scene *scene, ID *id)
adt->recalc |= ADT_RECALC_ANIM;
/* set recalc flags */
- DAG_id_flush_update(id, OB_RECALC); // XXX or do we want something more restrictive?
+ DAG_id_flush_update(id, OB_RECALC_ALL); // XXX or do we want something more restrictive?
}
}
diff --git a/source/blender/editors/animation/anim_filter.c b/source/blender/editors/animation/anim_filter.c
index 67f2cb834e0..a9c9830f07f 100644
--- a/source/blender/editors/animation/anim_filter.c
+++ b/source/blender/editors/animation/anim_filter.c
@@ -797,7 +797,7 @@ bAnimListElem *make_new_animlistelem (void *data, short datatype, void *owner, s
/* ----------------------------------------- */
/* NOTE: when this function returns true, the F-Curve is to be skipped */
-static int skip_fcurve_selected_data(FCurve *fcu, ID *owner_id, int filter_mode)
+static int skip_fcurve_selected_data(bDopeSheet *ads, FCurve *fcu, ID *owner_id, int filter_mode)
{
if (GS(owner_id->name) == ID_OB) {
Object *ob= (Object *)owner_id;
@@ -814,9 +814,8 @@ static int skip_fcurve_selected_data(FCurve *fcu, ID *owner_id, int filter_mode)
/* check whether to continue or skip */
if ((pchan) && (pchan->bone)) {
- /* if only visible channels, skip if bone not visible */
- // TODO: should we just do this always?
- if (filter_mode & ANIMFILTER_VISIBLE) {
+ /* if only visible channels, skip if bone not visible unless user wants channels from hidden data too */
+ if ((filter_mode & ANIMFILTER_VISIBLE) && !(ads->filterflag & ADS_FILTER_INCL_HIDDEN)) {
bArmature *arm= (bArmature *)ob->data;
if ((arm->layer & pchan->bone->layer) == 0)
@@ -887,7 +886,7 @@ static FCurve *animdata_filter_fcurve_next (bDopeSheet *ads, FCurve *first, bAct
* - this will also affect things like Drivers, and also works for Bone Constraints
*/
if ( ((ads) && (ads->filterflag & ADS_FILTER_ONLYSEL)) && (owner_id) ) {
- if (skip_fcurve_selected_data(fcu, owner_id, filter_mode))
+ if (skip_fcurve_selected_data(ads, fcu, owner_id, filter_mode))
continue;
}
@@ -946,6 +945,13 @@ static int animdata_filter_action (bAnimContext *ac, ListBase *anim_data, bDopeS
FCurve *lastchan=NULL;
int items = 0;
+ /* don't include anything from this action if it is linked in from another file,
+ * and we're getting stuff for editing...
+ */
+ // TODO: need a way of tagging other channels that may also be affected...
+ if ((filter_mode & ANIMFILTER_FOREDIT) && (act->id.lib))
+ return 0;
+
/* loop over groups */
// TODO: in future, should we expect to need nested groups?
for (agrp= act->groups.first; agrp; agrp= agrp->next) {
@@ -2105,11 +2111,14 @@ static int animdata_filter_dopesheet (bAnimContext *ac, ListBase *anim_data, bDo
/* firstly, check if object can be included, by the following factors:
* - if only visible, must check for layer and also viewport visibility
+ * --> while tools may demand only visible, user setting takes priority
+ * as user option controls whether sets of channels get included while
+ * tool-flag takes into account collapsed/open channels too
* - if only selected, must check if object is selected
* - there must be animation data to edit
*/
// TODO: if cache is implemented, just check name here, and then
- if (filter_mode & ANIMFILTER_VISIBLE) {
+ if ((filter_mode & ANIMFILTER_VISIBLE) && !(ads->filterflag & ADS_FILTER_INCL_HIDDEN)) {
/* layer visibility - we check both object and base, since these may not be in sync yet */
if ((sce->lay & (ob->lay|base->lay))==0) continue;
diff --git a/source/blender/editors/animation/anim_ops.c b/source/blender/editors/animation/anim_ops.c
index 88d6051b23b..11ba3cfffed 100644
--- a/source/blender/editors/animation/anim_ops.c
+++ b/source/blender/editors/animation/anim_ops.c
@@ -69,6 +69,7 @@ static void change_frame_apply(bContext *C, wmOperator *op)
/* set the new frame number */
CFRA= RNA_int_get(op->ptr, "frame");
FRAMENUMBER_MIN_CLAMP(CFRA);
+ SUBFRA = 0.f;
/* do updates */
sound_seek_scene(C);
diff --git a/source/blender/editors/animation/keyframes_draw.c b/source/blender/editors/animation/keyframes_draw.c
index a8c184937d9..2290909325e 100644
--- a/source/blender/editors/animation/keyframes_draw.c
+++ b/source/blender/editors/animation/keyframes_draw.c
@@ -240,7 +240,7 @@ static BezTriple *abk_get_bezt_with_value (ActBeztColumn *abk, float value)
/* look over each BezTriple in this container */
for (i = 0; i < abk->numBezts; i++) {
/* only do exact match for now... */
- if (i >= sizeof(abk->bezts)/sizeof(BezTriple)) {
+ if (/*i >= MAX_ABK_BUFSIZE*/0) {
// TODO: this case needs special handling
}
else {
@@ -283,7 +283,7 @@ static void add_bezt_to_keyblocks_list(DLRBT_Tree *blocks, DLRBT_Tree *beztTree,
abk= (ActBeztColumn *)BLI_dlrbTree_search_prev(beztTree, compare_abk_bezt, beztn);
/* if applicable, the BezTriple with the same value */
prev= (abk) ? abk_get_bezt_with_value(abk, beztn->vec[1][1]) : NULL;
-
+
/* check if block needed - same value(s)?
* -> firstly, handles must have same central value as each other
* -> secondly, handles which control that section of the curve must be constant
diff --git a/source/blender/editors/animation/keyingsets.c b/source/blender/editors/animation/keyingsets.c
index f496cec7b39..1c06266a148 100644
--- a/source/blender/editors/animation/keyingsets.c
+++ b/source/blender/editors/animation/keyingsets.c
@@ -918,7 +918,7 @@ int ANIM_apply_keyingset (bContext *C, ListBase *dsources, bAction *act, KeyingS
{
Object *ob= (Object *)ksp->id;
- ob->recalc |= OB_RECALC;
+ ob->recalc |= OB_RECALC_ALL; // XXX: only object transforms only?
}
break;
}
diff --git a/source/blender/editors/armature/editarmature_sketch.c b/source/blender/editors/armature/editarmature_sketch.c
index fdc89936029..a1af68458f6 100644
--- a/source/blender/editors/armature/editarmature_sketch.c
+++ b/source/blender/editors/armature/editarmature_sketch.c
@@ -2679,6 +2679,7 @@ static int sketch_draw_modal(bContext *C, wmOperator *op, wmEvent *event, short
RNA_boolean_set(op->ptr, "snap", snap);
break;
case MOUSEMOVE:
+ case INBETWEEN_MOUSEMOVE:
dd->mval[0] = event->mval[0];
dd->mval[1] = event->mval[1];
sk_draw_stroke(C, sketch, stk, dd, snap);
diff --git a/source/blender/editors/armature/meshlaplacian.c b/source/blender/editors/armature/meshlaplacian.c
index 546a15467c4..0325232e5b9 100644
--- a/source/blender/editors/armature/meshlaplacian.c
+++ b/source/blender/editors/armature/meshlaplacian.c
@@ -1922,7 +1922,7 @@ static void heat_weighting_bind(Scene *scene, DerivedMesh *dm, MeshDeformModifie
}
#endif
-void mesh_deform_bind(Scene *scene, DerivedMesh *dm, MeshDeformModifierData *mmd, float *vertexcos, int totvert, float cagemat[][4])
+void mesh_deform_bind(Scene *scene, MeshDeformModifierData *mmd, float *vertexcos, int totvert, float cagemat[][4])
{
MeshDeformBind mdb;
MVert *mvert;
diff --git a/source/blender/editors/armature/meshlaplacian.h b/source/blender/editors/armature/meshlaplacian.h
index 4e5fbec9c82..640eb33c945 100644
--- a/source/blender/editors/armature/meshlaplacian.h
+++ b/source/blender/editors/armature/meshlaplacian.h
@@ -78,7 +78,7 @@ void rigid_deform_end(int cancel);
/* Harmonic Coordinates */
-void mesh_deform_bind(struct Scene *scene, struct DerivedMesh *dm,
+void mesh_deform_bind(struct Scene *scene,
struct MeshDeformModifierData *mmd,
float *vertexcos, int totvert, float cagemat[][4]);
diff --git a/source/blender/editors/curve/editcurve.c b/source/blender/editors/curve/editcurve.c
index dad111432de..186f3f20082 100644
--- a/source/blender/editors/curve/editcurve.c
+++ b/source/blender/editors/curve/editcurve.c
@@ -5219,8 +5219,8 @@ Nurb *add_nurbs_primitive(bContext *C, float mat[4][4], int type, int newname)
float tmp_vec[3] = {0.f, 0.f, 0.f};
if(newname) {
- rename_id((ID *)obedit, "SurfDonut");
- rename_id((ID *)obedit->data, "SurfDonut");
+ rename_id((ID *)obedit, "SurfTorus");
+ rename_id((ID *)obedit->data, "SurfTorus");
}
xzproj= 1;
diff --git a/source/blender/editors/curve/editfont.c b/source/blender/editors/curve/editfont.c
index 3a5f185c550..7d5af54b640 100644
--- a/source/blender/editors/curve/editfont.c
+++ b/source/blender/editors/curve/editfont.c
@@ -417,7 +417,7 @@ void FONT_OT_file_paste(wmOperatorType *ot)
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
/* properties */
- WM_operator_properties_filesel(ot, FOLDERFILE|TEXTFILE, FILE_SPECIAL, FILE_OPENFILE, 0);
+ WM_operator_properties_filesel(ot, FOLDERFILE|TEXTFILE, FILE_SPECIAL, FILE_OPENFILE, WM_FILESEL_FILEPATH);
}
/******************* paste buffer operator ********************/
@@ -1732,7 +1732,7 @@ void FONT_OT_open(wmOperatorType *ot)
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
/* properties */
- WM_operator_properties_filesel(ot, FOLDERFILE|FTFONTFILE, FILE_SPECIAL, FILE_OPENFILE, 0);
+ WM_operator_properties_filesel(ot, FOLDERFILE|FTFONTFILE, FILE_SPECIAL, FILE_OPENFILE, WM_FILESEL_FILEPATH);
}
/******************* delete operator *********************/
diff --git a/source/blender/editors/include/ED_anim_api.h b/source/blender/editors/include/ED_anim_api.h
index 230a3e8a3dd..5fb7fa41752 100644
--- a/source/blender/editors/include/ED_anim_api.h
+++ b/source/blender/editors/include/ED_anim_api.h
@@ -102,8 +102,11 @@ typedef struct bAnimListElem {
int flag; /* copy of elem's flags for quick access */
int index; /* for un-named data, the index of the data in it's collection */
- void *key_data; /* motion data - mostly F-Curves, but can be other types too */
+ short elemFlag; /* flags for the list elem instance (not the data it represents) */
+
short datatype; /* type of motion data to expect */
+ void *key_data; /* motion data - mostly F-Curves, but can be other types too */
+
struct ID *id; /* ID block that channel is attached to */
struct AnimData *adt; /* source of the animation data attached to ID block (for convenience) */
diff --git a/source/blender/editors/include/ED_armature.h b/source/blender/editors/include/ED_armature.h
index 67387dc2e08..d2d1e2a1d69 100644
--- a/source/blender/editors/include/ED_armature.h
+++ b/source/blender/editors/include/ED_armature.h
@@ -165,7 +165,7 @@ void BDR_drawSketch(const struct bContext *vc);
int BDR_drawSketchNames(struct ViewContext *vc);
/* meshlaplacian.c */
-void mesh_deform_bind(struct Scene *scene, struct DerivedMesh *dm,
+void mesh_deform_bind(struct Scene *scene,
struct MeshDeformModifierData *mmd,
float *vertexcos, int totvert, float cagemat[][4]);
diff --git a/source/blender/editors/include/ED_keyframing.h b/source/blender/editors/include/ED_keyframing.h
index 86a1f5c4031..fc5e3a43a62 100644
--- a/source/blender/editors/include/ED_keyframing.h
+++ b/source/blender/editors/include/ED_keyframing.h
@@ -257,7 +257,7 @@ short fcurve_frame_has_keyframe(struct FCurve *fcu, float frame, short filter);
* Checks whether a keyframe exists for the given ID-block one the given frame.
* - It is recommended to call this method over the other keyframe-checkers directly,
* in case some detail of the implementation changes...
- * - frame: the value of this is quite often result of frame_to_float(CFRA)
+ * - frame: the value of this is quite often result of BKE_curframe()
*/
short id_frame_has_keyframe(struct ID *id, float frame, short filter);
diff --git a/source/blender/editors/include/ED_render.h b/source/blender/editors/include/ED_render.h
index 6100ecd436f..f34670da471 100644
--- a/source/blender/editors/include/ED_render.h
+++ b/source/blender/editors/include/ED_render.h
@@ -78,6 +78,7 @@ void ED_preview_free_dbase(void);
void ED_preview_shader_job(const struct bContext *C, void *owner, struct ID *id, struct ID *parent, struct MTex *slot, int sizex, int sizey, int method);
void ED_preview_icon_job(const struct bContext *C, void *owner, struct ID *id, unsigned int *rect, int sizex, int sizey);
+void ED_preview_kill_jobs(const struct bContext *C);
void ED_preview_draw(const struct bContext *C, void *idp, void *parentp, void *slot, rcti *rect);
diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h
index db479b45472..93e91d02599 100644
--- a/source/blender/editors/include/UI_interface.h
+++ b/source/blender/editors/include/UI_interface.h
@@ -142,7 +142,7 @@ typedef struct uiLayout uiLayout;
#define UI_BUT_ALIGN_DOWN (1<<17)
#define UI_BUT_DISABLED (1<<18)
-#define UI_BUT_UNUSED (1<<19)
+#define UI_BUT_COLOR_LOCK (1<<19)
#define UI_BUT_ANIMATED (1<<20)
#define UI_BUT_ANIMATED_KEY (1<<21)
#define UI_BUT_DRIVEN (1<<22)
@@ -152,6 +152,9 @@ typedef struct uiLayout uiLayout;
#define UI_BUT_IMMEDIATE (1<<26)
#define UI_BUT_NO_TOOLTIP (1<<27)
+#define UI_BUT_VEC_SIZE_LOCK (1<<28) /* used to flag if color hsv-circle should keep luminance */
+#define UI_BUT_COLOR_CUBIC (1<<29) /* cubic saturation for the color wheel */
+
#define UI_PANEL_WIDTH 340
#define UI_COMPACT_PANEL_WIDTH 160
@@ -676,14 +679,14 @@ void uiTemplateAnyID(uiLayout *layout, struct bContext *C, struct PointerRNA *pt
void uiTemplatePathBuilder(uiLayout *layout, struct bContext *C, struct PointerRNA *ptr, char *propname,
struct PointerRNA *root_ptr, char *text);
uiLayout *uiTemplateModifier(uiLayout *layout, struct bContext *C, struct PointerRNA *ptr, int compact);
-uiLayout *uiTemplateConstraint(uiLayout *layout, struct PointerRNA *ptr);
+uiLayout *uiTemplateConstraint(uiLayout *layout, struct PointerRNA *ptr, int compact);
void uiTemplatePreview(uiLayout *layout, struct ID *id, struct ID *parent, struct MTex *slot);
void uiTemplateColorRamp(uiLayout *layout, struct PointerRNA *ptr, char *propname, int expand);
void uiTemplateHistogram(uiLayout *layout, struct PointerRNA *ptr, char *propname, int expand);
void uiTemplateWaveform(uiLayout *layout, struct PointerRNA *ptr, char *propname, int expand);
void uiTemplateVectorscope(uiLayout *layout, struct PointerRNA *ptr, char *propname, int expand);
void uiTemplateCurveMapping(uiLayout *layout, struct PointerRNA *ptr, char *propname, int type, int levels, int brush);
-void uiTemplateColorWheel(uiLayout *layout, struct PointerRNA *ptr, char *propname, int value_slider, int lock);
+void uiTemplateColorWheel(uiLayout *layout, struct PointerRNA *ptr, char *propname, int value_slider, int lock, int lock_luminosity, int cubic);
void uiTemplateTriColorSet(uiLayout *layout, struct PointerRNA *ptr, char *propname);
void uiTemplateLayers(uiLayout *layout, struct PointerRNA *ptr, char *propname,
PointerRNA *used_ptr, char *used_propname, int active_layer);
diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c
index 1f9c2bb9ce0..a19113d4b27 100644
--- a/source/blender/editors/interface/interface_handlers.c
+++ b/source/blender/editors/interface/interface_handlers.c
@@ -24,6 +24,7 @@
*/
#include <float.h>
+#include <limits.h>
#include <math.h>
#include <stdlib.h>
#include <string.h>
@@ -235,7 +236,7 @@ static uiBut *ui_but_last(uiBlock *block)
static int ui_is_a_warp_but(uiBut *but)
{
if(U.uiflag & USER_CONTINUOUS_MOUSE)
- if(ELEM(but->type, NUM, NUMABS))
+ if(ELEM3(but->type, NUM, NUMABS, HSVCIRCLE))
return TRUE;
return FALSE;
@@ -2223,7 +2224,6 @@ static int ui_numedit_but_NUM(uiBut *but, uiHandleButtonData *data, float fac, i
softmax= but->softmax;
softrange= softmax - softmin;
-
if(ui_is_a_warp_but(but)) {
/* Mouse location isn't screen clamped to the screen so use a linear mapping
* 2px == 1-int, or 1px == 1-ClickStep */
@@ -2283,15 +2283,18 @@ static int ui_numedit_but_NUM(uiBut *but, uiHandleButtonData *data, float fac, i
/* Use a non-linear mapping of the mouse drag especially for large floats (normal behavior) */
deler= 500;
if(!ui_is_but_float(but)) {
- if((softrange)<100) deler= 200.0;
- if((softrange)<25) deler= 50.0;
+ /* prevent large ranges from getting too out of control */
+ if (softrange > 600) deler = powf(softrange, 0.75);
+
+ if (softrange < 100) deler= 200.0;
+ if (softrange < 25) deler= 50.0;
}
deler /= fac;
- if(ui_is_but_float(but) && softrange > 11) {
+ if(softrange > 11) {
/* non linear change in mouse input- good for high precicsion */
data->dragf+= (((float)(mx-data->draglastx))/deler) * (fabs(data->dragstartx-mx)*0.002);
- } else if (!ui_is_but_float(but) && softrange > 129) { /* only scale large int buttons */
+ } else if (softrange > 129) { /* only scale large int buttons */
/* non linear change in mouse input- good for high precicsionm ints need less fine tuning */
data->dragf+= (((float)(mx-data->draglastx))/deler) * (fabs(data->dragstartx-mx)*0.004);
} else {
@@ -2299,8 +2302,7 @@ static int ui_numedit_but_NUM(uiBut *but, uiHandleButtonData *data, float fac, i
data->dragf+= ((float)(mx-data->draglastx))/deler ;
}
- if(data->dragf>1.0) data->dragf= 1.0;
- if(data->dragf<0.0) data->dragf= 0.0;
+ CLAMP(data->dragf, 0.0, 1.0);
data->draglastx= mx;
tempf= (softmin + data->dragf*softrange);
@@ -2312,7 +2314,7 @@ static int ui_numedit_but_NUM(uiBut *but, uiHandleButtonData *data, float fac, i
CLAMP(temp, softmin, softmax);
lvalue= (int)data->value;
-
+
if(temp != lvalue) {
data->dragchange= 1;
data->value= (double)temp;
@@ -3045,7 +3047,7 @@ static int ui_do_but_HSVCUBE(bContext *C, uiBlock *block, uiBut *but, uiHandleBu
return WM_UI_HANDLER_CONTINUE;
}
-static int ui_numedit_but_HSVCIRCLE(uiBut *but, uiHandleButtonData *data, int mx, int my)
+static int ui_numedit_but_HSVCIRCLE(uiBut *but, uiHandleButtonData *data, int mx, int my, int shift)
{
rcti rect;
int changed= 1;
@@ -3059,13 +3061,29 @@ static int ui_numedit_but_HSVCIRCLE(uiBut *but, uiHandleButtonData *data, int mx
/* exception, when using color wheel in 'locked' value state:
* allow choosing a hue for black values, by giving a tiny increment */
- if (but->a2 == 1) { // lock
+ if (but->flag & UI_BUT_COLOR_LOCK) { // lock
if (hsv[2] == 0.f) hsv[2] = 0.0001f;
}
-
+
+ if(U.uiflag & USER_CONTINUOUS_MOUSE) {
+ float fac= shift ? 0.02 : 0.1;
+ /* slow down the mouse, this is fairly picky */
+ mx = (data->dragstartx*(1.0f-fac) + mx*fac);
+ my = (data->dragstarty*(1.0f-fac) + my*fac);
+ }
+
ui_hsvcircle_vals_from_pos(hsv, hsv+1, &rect, (float)mx, (float)my);
-
+
+ if(but->flag & UI_BUT_COLOR_CUBIC)
+ hsv[1]= 1.0f - sqrt3f(1.0f - hsv[1]);
+
hsv_to_rgb(hsv[0], hsv[1], hsv[2], rgb, rgb+1, rgb+2);
+
+ if((but->flag & UI_BUT_VEC_SIZE_LOCK) && (rgb[0] || rgb[1] || rgb[2])) {
+ normalize_v3(rgb);
+ mul_v3_fl(rgb, but->a2);
+ }
+
ui_set_but_vectorf(but, rgb);
data->draglastx= mx;
@@ -3092,7 +3110,7 @@ static int ui_do_but_HSVCIRCLE(bContext *C, uiBlock *block, uiBut *but, uiHandle
button_activate_state(C, but, BUTTON_STATE_NUM_EDITING);
/* also do drag the first time */
- if(ui_numedit_but_HSVCIRCLE(but, data, mx, my))
+ if(ui_numedit_but_HSVCIRCLE(but, data, mx, my, event->shift))
ui_numedit_apply(C, block, but, data);
return WM_UI_HANDLER_BREAK;
@@ -3143,7 +3161,7 @@ static int ui_do_but_HSVCIRCLE(bContext *C, uiBlock *block, uiBut *but, uiHandle
}
else if(event->type == MOUSEMOVE) {
if(mx!=data->draglastx || my!=data->draglasty) {
- if(ui_numedit_but_HSVCIRCLE(but, data, mx, my))
+ if(ui_numedit_but_HSVCIRCLE(but, data, mx, my, event->shift))
ui_numedit_apply(C, block, but, data);
}
}
diff --git a/source/blender/editors/interface/interface_icons.c b/source/blender/editors/interface/interface_icons.c
index 622b9ddbfdf..499fe3b9767 100644
--- a/source/blender/editors/interface/interface_icons.c
+++ b/source/blender/editors/interface/interface_icons.c
@@ -457,25 +457,20 @@ static void init_internal_icons()
ImBuf *bbuf= NULL;
int x, y, icontype;
char iconfilestr[FILE_MAXDIR+FILE_MAXFILE];
- char filenamestr[FILE_MAXFILE+16]; // 16 == strlen(".blender/icons/")+1
if ((btheme!=NULL) && (strlen(btheme->tui.iconfile) > 0)) {
-
-#ifdef WIN32
- sprintf(filenamestr, "icons/%s", btheme->tui.iconfile);
-#else
- sprintf(filenamestr, ".blender/icons/%s", btheme->tui.iconfile);
-#endif
-
- BLI_make_file_string("/", iconfilestr, BLI_gethome(), filenamestr);
-
- if (BLI_exists(iconfilestr)) {
- bbuf = IMB_loadiffname(iconfilestr, IB_rect);
- if(bbuf->x < ICON_IMAGE_W || bbuf->y < ICON_IMAGE_H) {
- if (G.f & G_DEBUG)
- printf("\n***WARNING***\nIcons file %s too small.\nUsing built-in Icons instead\n", iconfilestr);
- IMB_freeImBuf(bbuf);
- bbuf= NULL;
+ char *datadir= BLI_get_folder(BLENDER_DATAFILES, NULL);
+ if (datadir) {
+ BLI_make_file_string("/", iconfilestr, datadir, btheme->tui.iconfile);
+
+ if (BLI_exists(iconfilestr)) {
+ bbuf = IMB_loadiffname(iconfilestr, IB_rect);
+ if(bbuf->x < ICON_IMAGE_W || bbuf->y < ICON_IMAGE_H) {
+ if (G.f & G_DEBUG)
+ printf("\n***WARNING***\nIcons file %s too small.\nUsing built-in Icons instead\n", iconfilestr);
+ IMB_freeImBuf(bbuf);
+ bbuf= NULL;
+ }
}
}
}
@@ -555,14 +550,14 @@ static void init_iconfile_list(struct ListBase *list)
char icondirstr[FILE_MAX];
char iconfilestr[FILE_MAX+16]; /* allow 256 chars for file+dir */
char olddir[FILE_MAX];
-
+ char *datadir= NULL;
+
list->first = list->last = NULL;
+ datadir = BLI_get_folder(BLENDER_DATAFILES, NULL);
-#ifdef WIN32
- BLI_make_file_string("/", icondirstr, BLI_gethome(), "icons");
-#else
- BLI_make_file_string("/", icondirstr, BLI_gethome(), ".blender/icons");
-#endif
+ if (!datadir) return;
+
+ BLI_make_file_string("/", icondirstr, datadir, "");
if(BLI_exists(icondirstr)==0)
return;
diff --git a/source/blender/editors/interface/interface_intern.h b/source/blender/editors/interface/interface_intern.h
index ecefcf93c28..cb8130573fe 100644
--- a/source/blender/editors/interface/interface_intern.h
+++ b/source/blender/editors/interface/interface_intern.h
@@ -184,8 +184,11 @@ struct uiBut {
struct bContextStore *context;
+ /* not ysed yet, was used in 2.4x for ui_draw_pulldown_round & friends */
+ /*
void (*embossfunc)(int , int , float, float, float, float, float, int);
void (*sliderfunc)(int , float, float, float, float, float, float, int);
+ */
uiButCompleteFunc autocomplete_func;
void *autofunc_arg;
@@ -228,12 +231,12 @@ struct uiBut {
/* Operator data */
struct wmOperatorType *optype;
- int opcontext;
struct IDProperty *opproperties;
struct PointerRNA *opptr;
+ short opcontext;
/* Draggable data, type is WM_DRAG_... */
- int dragtype;
+ short dragtype;
void *dragpoin;
struct ImBuf *imb;
float imb_scale;
diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c
index d91cdd5c20d..b7b9a2156ef 100644
--- a/source/blender/editors/interface/interface_layout.c
+++ b/source/blender/editors/interface/interface_layout.c
@@ -431,18 +431,14 @@ static void ui_item_array(uiLayout *layout, uiBlock *block, char *name, int icon
but->type= TOG;
}
}
- else if(ELEM(subtype, PROP_COLOR, PROP_COLOR_GAMMA) && len == 4) {
- but= uiDefAutoButR(block, ptr, prop, 3, "A:", 0, 0, 0, w, UI_UNIT_Y);
- if(slider && but->type==NUM)
- but->type= NUMSLI;
- }
}
uiBlockSetCurLayout(block, layout);
}
-static void ui_item_enum_row(uiLayout *layout, uiBlock *block, PointerRNA *ptr, PropertyRNA *prop, char *uiname, int x, int y, int w, int h, int icon_only)
+static void ui_item_enum_expand(uiLayout *layout, uiBlock *block, PointerRNA *ptr, PropertyRNA *prop, char *uiname, int x, int y, int w, int h, int icon_only)
{
+ uiBut *but;
EnumPropertyItem *item;
const char *identifier;
char *name;
@@ -462,11 +458,14 @@ static void ui_item_enum_row(uiLayout *layout, uiBlock *block, PointerRNA *ptr,
itemw= ui_text_icon_width(block->curlayout, name, icon, 0);
if(icon && strcmp(name, "") != 0 && !icon_only)
- uiDefIconTextButR(block, ROW, 0, icon, name, 0, 0, itemw, h, ptr, identifier, -1, 0, value, -1, -1, NULL);
+ but= uiDefIconTextButR(block, ROW, 0, icon, name, 0, 0, itemw, h, ptr, identifier, -1, 0, value, -1, -1, NULL);
else if(icon)
- uiDefIconButR(block, ROW, 0, icon, 0, 0, itemw, h, ptr, identifier, -1, 0, value, -1, -1, NULL);
+ but= uiDefIconButR(block, ROW, 0, icon, 0, 0, itemw, h, ptr, identifier, -1, 0, value, -1, -1, NULL);
else
- uiDefButR(block, ROW, 0, name, 0, 0, itemw, h, ptr, identifier, -1, 0, value, -1, -1, NULL);
+ but= uiDefButR(block, ROW, 0, name, 0, 0, itemw, h, ptr, identifier, -1, 0, value, -1, -1, NULL);
+
+ if(ui_layout_local_dir(layout) != UI_LAYOUT_HORIZONTAL)
+ but->flag |= UI_TEXT_LEFT;
}
uiBlockSetCurLayout(block, layout);
@@ -514,7 +513,7 @@ static uiBut *ui_item_with_label(uiLayout *layout, uiBlock *block, char *name, i
uiDefAutoButR(block, ptr, prop, index, "", icon, x, y, w-UI_UNIT_X, h);
/* BUTTONS_OT_file_browse calls uiFileBrowseContextProperty */
- but= uiDefIconButO(block, BUT, "BUTTONS_OT_file_browse", WM_OP_INVOKE_DEFAULT, ICON_FILESEL, x, y, UI_UNIT_X, h, "Browse for file or directory");
+ but= uiDefIconButO(block, BUT, "BUTTONS_OT_file_browse", WM_OP_INVOKE_DEFAULT, ICON_FILESEL, x, y, UI_UNIT_X, h, NULL);
}
else if(subtype == PROP_DIRECTION) {
uiDefButR(block, BUT_NORMAL, 0, name, x, y, 100, 100, ptr, RNA_property_identifier(prop), index, 0, 0, -1, -1, NULL);
@@ -614,6 +613,9 @@ PointerRNA uiItemFullO(uiLayout *layout, char *idname, char *name, int icon, IDP
w= ui_text_icon_width(layout, name, icon, 0);
+ if (flag & UI_ITEM_R_NO_BG)
+ uiBlockSetEmboss(block, UI_EMBOSSN);
+
if(icon && strcmp(name, "") != 0)
but= uiDefIconTextButO(block, BUT, ot->idname, context, icon, (char*)name, 0, 0, w, UI_UNIT_Y, NULL);
else if(icon)
@@ -624,7 +626,10 @@ PointerRNA uiItemFullO(uiLayout *layout, char *idname, char *name, int icon, IDP
/* text alignment for toolbar buttons */
if((layout->root->type == UI_LAYOUT_TOOLBAR) && !icon)
but->flag |= UI_TEXT_LEFT;
-
+
+ if (flag & UI_ITEM_R_NO_BG)
+ uiBlockSetEmboss(block, UI_EMBOSS);
+
/* assign properties */
if(properties || (flag & UI_ITEM_O_RETURN_PROPS)) {
PointerRNA *opptr= uiButGetOperatorPtrRNA(but);
@@ -946,7 +951,7 @@ void uiItemFullR(uiLayout *layout, PointerRNA *ptr, PropertyRNA *prop, int index
}
/* expanded enum */
else if(type == PROP_ENUM && expand)
- ui_item_enum_row(layout, block, ptr, prop, name, 0, 0, w, h, icon_only);
+ ui_item_enum_expand(layout, block, ptr, prop, name, 0, 0, w, h, icon_only);
/* property with separate label */
else if(type == PROP_ENUM || type == PROP_STRING || type == PROP_POINTER) {
but= ui_item_with_label(layout, block, name, icon, ptr, prop, index, 0, 0, w, h, flag);
@@ -1291,8 +1296,10 @@ static void ui_item_menu(uiLayout *layout, char *name, int icon, uiMenuCreateFun
if(layout->root->type == UI_LAYOUT_HEADER)
uiBlockSetEmboss(block, UI_EMBOSS);
- else if(layout->root->type == UI_LAYOUT_PANEL)
+ else if(layout->root->type == UI_LAYOUT_PANEL) {
but->type= MENU;
+ but->flag |= UI_TEXT_LEFT;
+ }
}
void uiItemM(uiLayout *layout, bContext *C, char *menuname, char *name, int icon)
diff --git a/source/blender/editors/interface/interface_ops.c b/source/blender/editors/interface/interface_ops.c
index 419de8eb898..20752099814 100644
--- a/source/blender/editors/interface/interface_ops.c
+++ b/source/blender/editors/interface/interface_ops.c
@@ -322,6 +322,8 @@ static int copy_to_selected_list(bContext *C, PointerRNA *ptr, ListBase *lb)
*lb = CTX_data_collection_get(C, "selected_editable_bones");
else if(RNA_struct_is_a(ptr->type, &RNA_PoseBone))
*lb = CTX_data_collection_get(C, "selected_pose_bones");
+ else if(RNA_struct_is_a(ptr->type, &RNA_Sequence))
+ *lb = CTX_data_collection_get(C, "selected_editable_sequences");
else
return 0;
diff --git a/source/blender/editors/interface/interface_regions.c b/source/blender/editors/interface/interface_regions.c
index d44e4b2b4dc..fb00d4f968e 100644
--- a/source/blender/editors/interface/interface_regions.c
+++ b/source/blender/editors/interface/interface_regions.c
@@ -1795,6 +1795,9 @@ static void uiBlockPicker(uiBlock *block, float *rgb, PointerRNA *ptr, PropertyR
linearrgb_to_srgb_v3_v3(rgb_gamma, rgb);
}
+ /* sneaky way to check for alpha */
+ rgb[3]= FLT_MAX;
+
RNA_property_float_ui_range(ptr, prop, &min, &max, &step, &precision);
RNA_property_float_get_array(ptr, prop, rgb);
rgb_to_hsv(rgb[0], rgb[1], rgb[2], hsv, hsv+1, hsv+2);
@@ -1835,6 +1838,7 @@ static void uiBlockPicker(uiBlock *block, float *rgb, PointerRNA *ptr, PropertyR
uiButSetFunc(bt, do_picker_rna_cb, bt, NULL);
bt= uiDefButR(block, NUMSLI, 0, "B ", 0, -100, butwidth, UI_UNIT_Y, ptr, propname, 2, 0.0, 0.0, 0, 0, "");
uiButSetFunc(bt, do_picker_rna_cb, bt, NULL);
+
// could use uiItemFullR(col, ptr, prop, -1, 0, UI_ITEM_R_EXPAND|UI_ITEM_R_SLIDER, "", 0);
// but need to use uiButSetFunc for updating other fake buttons
@@ -1847,7 +1851,15 @@ static void uiBlockPicker(uiBlock *block, float *rgb, PointerRNA *ptr, PropertyR
bt= uiDefButF(block, NUMSLI, 0, "V ", 0, -100, butwidth, UI_UNIT_Y, hsv+2, 0.0, max, 10, 3, "");
uiButSetFunc(bt, do_hsv_rna_cb, bt, hsv);
uiBlockEndAlign(block);
-
+
+ if(rgb[3] != FLT_MAX) {
+ bt= uiDefButR(block, NUMSLI, 0, "A ", 0, -120, butwidth, UI_UNIT_Y, ptr, propname, 3, 0.0, 0.0, 0, 0, "");
+ uiButSetFunc(bt, do_picker_rna_cb, bt, NULL);
+ }
+ else {
+ rgb[3]= 1.0f;
+ }
+
rgb_to_hsv(rgb[0], rgb[1], rgb[2], hsv, hsv+1, hsv+2);
sprintf(hexcol, "%02X%02X%02X", (unsigned int)(rgb_gamma[0]*255.0), (unsigned int)(rgb_gamma[1]*255.0), (unsigned int)(rgb_gamma[2]*255.0));
diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c
index 93529d31fcf..93c93b07232 100644
--- a/source/blender/editors/interface/interface_templates.c
+++ b/source/blender/editors/interface/interface_templates.c
@@ -80,11 +80,15 @@ void uiTemplateDopeSheetFilter(uiLayout *layout, bContext *C, PointerRNA *ptr)
uiLayout *row= layout;
short nlaActive= ((sa) && (sa->spacetype==SPACE_NLA));
- /* more 'generic' filtering options */
+ /* most 'generic' filtering options */
row= uiLayoutRow(layout, 1);
uiItemR(row, ptr, "only_selected", 0, "", 0);
- uiItemR(row, ptr, "display_transforms", 0, "", 0); // xxx: include in another position instead?
+ uiItemR(row, ptr, "display_hidden", 0, "", 0);
+
+ /* object-level filtering options */
+ row= uiLayoutRow(layout, 1);
+ uiItemR(row, ptr, "display_transforms", 0, "", 0);
if (nlaActive)
uiItemR(row, ptr, "include_missing_nla", 0, "", 0);
@@ -946,15 +950,14 @@ static void constraint_active_func(bContext *C, void *ob_v, void *con_v)
}
/* draw panel showing settings for a constraint */
-static uiLayout *draw_constraint(uiLayout *layout, Object *ob, bConstraint *con)
+static uiLayout *draw_constraint(uiLayout *layout, Object *ob, bConstraint *con, int compact)
{
bPoseChannel *pchan= get_active_posechannel(ob);
bConstraintTypeInfo *cti;
uiBlock *block;
- uiLayout *result= NULL, *col, *box, *row, *subrow;
+ uiLayout *result= NULL, *col, *col1, *col2, *box, *row, *subrow, *split;
PointerRNA ptr;
char typestr[32];
- short width = 265;
short proxy_protected, xco=0, yco=0;
int rb_col;
@@ -987,13 +990,15 @@ static uiLayout *draw_constraint(uiLayout *layout, Object *ob, bConstraint *con)
uiLayoutSetContextPointer(col, "constraint", &ptr);
box= uiLayoutBox(col);
- row= uiLayoutRow(box, 0);
+ split = uiLayoutSplit(box, 0.35, 0);
+
+ col1= uiLayoutColumn(split, 0);
+ col2= uiLayoutColumn(split, 0);
+ row = uiLayoutRow(col1, 0);
+ subrow = uiLayoutRow(col2, 0);
block= uiLayoutGetBlock(box);
- subrow= uiLayoutRow(row, 0);
- //uiLayoutSetAlignment(subrow, UI_LAYOUT_ALIGN_LEFT);
-
/* Draw constraint header */
uiBlockSetEmboss(block, UI_EMBOSSN);
@@ -1001,7 +1006,7 @@ static uiLayout *draw_constraint(uiLayout *layout, Object *ob, bConstraint *con)
rb_col= (con->flag & CONSTRAINT_ACTIVE)?50:20;
/* open/close */
- uiItemR(subrow, &ptr, "expanded", UI_ITEM_R_ICON_ONLY, "", 0);
+ uiItemR(row, &ptr, "expanded", UI_ITEM_R_ICON_ONLY, "", 0);
/* name */
uiBlockSetEmboss(block, UI_EMBOSS);
@@ -1010,15 +1015,12 @@ static uiLayout *draw_constraint(uiLayout *layout, Object *ob, bConstraint *con)
uiBlockSetCol(block, TH_REDALERT);*/
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);
}
else
uiItemL(subrow, con->name, 0);
-
- subrow= uiLayoutRow(row, 0);
- //uiLayoutSetAlignment(subrow, UI_LAYOUT_ALIGN_RIGHT);
/* proxy-protected constraints cannot be edited, so hide up/down + close buttons */
if (proxy_protected) {
@@ -1053,23 +1055,36 @@ 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);
+ }
+
if (show_upbut || show_downbut) {
uiBlockBeginAlign(block);
uiBlockSetEmboss(block, UI_EMBOSS);
if (show_upbut)
- uiDefIconButO(block, BUT, "CONSTRAINT_OT_move_up", WM_OP_INVOKE_DEFAULT, ICON_TRIA_UP, xco+width-50, yco, 16, 18, "Move constraint up in constraint stack");
+ uiItemO(subrow, "", ICON_TRIA_UP, "CONSTRAINT_OT_move_up");
if (show_downbut)
- uiDefIconButO(block, BUT, "CONSTRAINT_OT_move_down", WM_OP_INVOKE_DEFAULT, ICON_TRIA_DOWN, xco+width-50+18, yco, 16, 18, "Move constraint down in constraint stack");
+ uiItemO(subrow, "", ICON_TRIA_DOWN, "CONSTRAINT_OT_move_down");
uiBlockEndAlign(block);
}
/* Close 'button' - emboss calls here disable drawing of 'button' behind X */
uiBlockSetEmboss(block, UI_EMBOSSN);
- uiDefIconButBitS(block, ICONTOGN, CONSTRAINT_OFF, B_CONSTRAINT_TEST, ICON_CHECKBOX_DEHLT, xco+243, yco, 19, 19, &con->flag, 0.0, 0.0, 0.0, 0.0, "enable/disable constraint");
+ uiItemR(subrow, &ptr, "enabled", 0, "", 0);
- uiDefIconButO(block, BUT, "CONSTRAINT_OT_delete", WM_OP_INVOKE_DEFAULT, ICON_X, xco+262, yco, 19, 19, "Delete constraint");
+ if (!compact) {
+ uiItemO(subrow, "", ICON_X, "CONSTRAINT_OT_delete");
+ }
uiBlockSetEmboss(block, UI_EMBOSS);
}
@@ -1095,7 +1110,7 @@ static uiLayout *draw_constraint(uiLayout *layout, Object *ob, bConstraint *con)
return result;
}
-uiLayout *uiTemplateConstraint(uiLayout *layout, PointerRNA *ptr)
+uiLayout *uiTemplateConstraint(uiLayout *layout, PointerRNA *ptr, int compact)
{
Object *ob;
bConstraint *con;
@@ -1123,7 +1138,7 @@ uiLayout *uiTemplateConstraint(uiLayout *layout, PointerRNA *ptr)
return NULL;
}
- return draw_constraint(layout, ob, con);
+ return draw_constraint(layout, ob, con, compact);
}
@@ -1335,6 +1350,29 @@ static void colorband_del_cb(bContext *C, void *cb_v, void *coba_v)
rna_update_cb(C, cb_v, NULL);
}
+static void colorband_flip_cb(bContext *C, void *cb_v, void *coba_v)
+{
+ CBData data_tmp[MAXCOLORBAND];
+
+ ColorBand *coba= coba_v;
+ int a;
+
+ for(a=0; a<coba->tot; a++) {
+ data_tmp[a]= coba->data[coba->tot - (a + 1)];
+ }
+ for(a=0; a<coba->tot; a++) {
+ data_tmp[a].pos = 1.0f - data_tmp[a].pos;
+ coba->data[a]= data_tmp[a];
+ }
+
+ /* may as well flip the cur*/
+ coba->cur= coba->tot - (coba->cur + 1);
+
+ ED_undo_push(C, "Flip colorband");
+
+ rna_update_cb(C, cb_v, NULL);
+}
+
/* offset aligns from bottom, standard width 300, height 115 */
static void colorband_buttons_large(uiLayout *layout, uiBlock *block, ColorBand *coba, int xoffs, int yoffs, RNAUpdateCb *cb)
@@ -1345,12 +1383,17 @@ static void colorband_buttons_large(uiLayout *layout, uiBlock *block, ColorBand
if(coba==NULL) return;
- bt= uiDefBut(block, BUT, 0, "Add", 0+xoffs,100+yoffs,50,20, 0, 0, 0, 0, 0, "Add a new color stop to the colorband");
+ bt= uiDefBut(block, BUT, 0, "Add", 0+xoffs,100+yoffs,40,20, 0, 0, 0, 0, 0, "Add a new color stop to the colorband");
uiButSetNFunc(bt, colorband_add_cb, MEM_dupallocN(cb), coba);
- bt= uiDefBut(block, BUT, 0, "Delete", 60+xoffs,100+yoffs,50,20, 0, 0, 0, 0, 0, "Delete the active position");
+ bt= uiDefBut(block, BUT, 0, "Delete", 45+xoffs,100+yoffs,45,20, 0, 0, 0, 0, 0, "Delete the active position");
uiButSetNFunc(bt, colorband_del_cb, MEM_dupallocN(cb), coba);
+
+ /* XXX, todo for later - convert to operator - campbell */
+ bt= uiDefBut(block, BUT, 0, "F", 95+xoffs,100+yoffs,20,20, 0, 0, 0, 0, 0, "Flip colorband");
+ uiButSetNFunc(bt, colorband_flip_cb, MEM_dupallocN(cb), coba);
+
uiDefButS(block, NUM, 0, "", 120+xoffs,100+yoffs,80, 20, &coba->cur, 0.0, (float)(MAX2(0, coba->tot-1)), 0, 0, "Choose active color stop");
bt= uiDefButS(block, MENU, 0, "Interpolation %t|Ease %x1|Cardinal %x3|Linear %x0|B-Spline %x2|Constant %x4",
@@ -1361,6 +1404,8 @@ static void colorband_buttons_large(uiLayout *layout, uiBlock *block, ColorBand
bt= uiDefBut(block, BUT_COLORBAND, 0, "", xoffs,65+yoffs,300,30, coba, 0, 0, 0, 0, "");
uiButSetNFunc(bt, rna_update_cb, MEM_dupallocN(cb), NULL);
+
+
if(coba->tot) {
CBData *cbd= coba->data + coba->cur;
@@ -1383,8 +1428,10 @@ static void colorband_buttons_small(uiLayout *layout, uiBlock *block, ColorBand
uiBlockBeginAlign(block);
bt= uiDefBut(block, BUT, 0, "Add", xs,butr->ymin+20.0f,2.0f*unit,20, NULL, 0, 0, 0, 0, "Add a new color stop to the colorband");
uiButSetNFunc(bt, colorband_add_cb, MEM_dupallocN(cb), coba);
- bt= uiDefBut(block, BUT, 0, "Delete", xs+2.0f*unit,butr->ymin+20.0f,2.0f*unit,20, NULL, 0, 0, 0, 0, "Delete the active position");
+ bt= uiDefBut(block, BUT, 0, "Delete", xs+2.0f*unit,butr->ymin+20.0f,1.5f*unit,20, NULL, 0, 0, 0, 0, "Delete the active position");
uiButSetNFunc(bt, colorband_del_cb, MEM_dupallocN(cb), coba);
+ bt= uiDefBut(block, BUT, 0, "F", xs+3.5f*unit,butr->ymin+20.0f,0.5f*unit,20, NULL, 0, 0, 0, 0, "Flip the color ramp");
+ uiButSetNFunc(bt, colorband_flip_cb, MEM_dupallocN(cb), coba);
uiBlockEndAlign(block);
if(coba->tot) {
@@ -1908,37 +1955,44 @@ void uiTemplateCurveMapping(uiLayout *layout, PointerRNA *ptr, char *propname, i
#define WHEEL_SIZE 100
-void uiTemplateColorWheel(uiLayout *layout, PointerRNA *ptr, char *propname, int value_slider, int lock)
+void uiTemplateColorWheel(uiLayout *layout, PointerRNA *ptr, char *propname, int value_slider, int lock, int lock_luminosity, int cubic)
{
PropertyRNA *prop= RNA_struct_find_property(ptr, propname);
uiBlock *block= uiLayoutGetBlock(layout);
uiLayout *col, *row;
+ uiBut *but;
float softmin, softmax, step, precision;
if (!prop) {
printf("uiTemplateColorWheel: property not found: %s\n", propname);
return;
}
-
+
RNA_property_float_ui_range(ptr, prop, &softmin, &softmax, &step, &precision);
col = uiLayoutColumn(layout, 0);
row= uiLayoutRow(col, 1);
- uiDefButR(block, HSVCIRCLE, 0, "", 0, 0, WHEEL_SIZE, WHEEL_SIZE, ptr, propname, -1, 0.0, 0.0, 0, lock, "");
-
+ but= uiDefButR(block, HSVCIRCLE, 0, "", 0, 0, WHEEL_SIZE, WHEEL_SIZE, ptr, propname, -1, 0.0, 0.0, 0, 0, "");
+
+ if(lock) {
+ but->flag |= UI_BUT_COLOR_LOCK;
+ }
+
+ if(lock_luminosity) {
+ float color[4]; /* incase of alpha */
+ but->flag |= UI_BUT_VEC_SIZE_LOCK;
+ RNA_property_float_get_array(ptr, prop, color);
+ but->a2= len_v3(color);
+ }
+
+ if(cubic)
+ but->flag |= UI_BUT_COLOR_CUBIC;
+
uiItemS(row);
if (value_slider)
uiDefButR(block, HSVCUBE, 0, "", WHEEL_SIZE+6, 0, 14, WHEEL_SIZE, ptr, propname, -1, softmin, softmax, 9, 0, "");
-
- /* maybe a switch for this?
- row= uiLayoutRow(col, 0);
- if(ELEM(RNA_property_subtype(prop), PROP_COLOR, PROP_COLOR_GAMMA) && RNA_property_array_length(ptr, prop) == 4) {
- but= uiDefAutoButR(block, ptr, prop, 3, "A:", 0, 0, 0, WHEEL_SIZE+20, UI_UNIT_Y);
- }
- */
-
}
@@ -2410,13 +2464,13 @@ static void do_running_jobs(bContext *C, void *arg, int event)
G.afbreek= 1;
break;
case B_STOPCAST:
- WM_jobs_stop(CTX_wm_manager(C), CTX_wm_screen(C));
+ WM_jobs_stop(CTX_wm_manager(C), CTX_wm_screen(C), NULL);
break;
case B_STOPANIM:
WM_operator_name_call(C, "SCREEN_OT_animation_play", WM_OP_INVOKE_SCREEN, NULL);
break;
case B_STOPCOMPO:
- WM_jobs_stop(CTX_wm_manager(C), CTX_wm_area(C));
+ WM_jobs_stop(CTX_wm_manager(C), CTX_wm_area(C), NULL);
break;
}
}
diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c
index 8f0f794585a..d2860adbf50 100644
--- a/source/blender/editors/interface/interface_widgets.c
+++ b/source/blender/editors/interface/interface_widgets.c
@@ -608,14 +608,67 @@ static void widgetbase_draw(uiWidgetBase *wtb, uiWidgetColors *wcol)
/* backdrop non AA */
if(wtb->inner) {
if(wcol->shaded==0) {
-
- /* filled center, solid */
- glColor4ubv((unsigned char*)wcol->inner);
- glBegin(GL_POLYGON);
- for(a=0; a<wtb->totvert; a++)
- glVertex2fv(wtb->inner_v[a]);
- glEnd();
+ if (wcol->alpha_check) {
+ GLubyte checker_stipple_sml[32*32/8] =
+ {
+ 255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0, \
+ 255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0, \
+ 0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255, \
+ 0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255, \
+ 255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0, \
+ 255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0, \
+ 0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255, \
+ 0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255, \
+ };
+
+ float x_mid= 0.0f; /* used for dumb clamping of values */
+
+ /* dark checkers */
+ glColor4ub(100, 100, 100, 255);
+ glBegin(GL_POLYGON);
+ for(a=0; a<wtb->totvert; a++) {
+ glVertex2fv(wtb->inner_v[a]);
+ }
+ glEnd();
+
+ /* light checkers */
+ glEnable(GL_POLYGON_STIPPLE);
+ glColor4ub(160, 160, 160, 255);
+ glPolygonStipple(checker_stipple_sml);
+ glBegin(GL_POLYGON);
+ for(a=0; a<wtb->totvert; a++) {
+ glVertex2fv(wtb->inner_v[a]);
+ }
+ glEnd();
+ glDisable(GL_POLYGON_STIPPLE);
+ /* alpha fill */
+ glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+
+ glColor4ubv((unsigned char*)wcol->inner);
+ glBegin(GL_POLYGON);
+ for(a=0; a<wtb->totvert; a++) {
+ glVertex2fv(wtb->inner_v[a]);
+ x_mid += wtb->inner_v[a][0];
+ }
+ x_mid /= wtb->totvert;
+ glEnd();
+
+ /* 1/2 solid color */
+ glColor4ub(wcol->inner[0], wcol->inner[1], wcol->inner[2], 255);
+ glBegin(GL_POLYGON);
+ for(a=0; a<wtb->totvert; a++)
+ glVertex2f(MIN2(wtb->inner_v[a][0], x_mid), wtb->inner_v[a][1]);
+ glEnd();
+ }
+ else {
+ /* simple fill */
+ glColor4ubv((unsigned char*)wcol->inner);
+ glBegin(GL_POLYGON);
+ for(a=0; a<wtb->totvert; a++)
+ glVertex2fv(wtb->inner_v[a]);
+ glEnd();
+ }
}
else {
char col1[4], col2[4];
@@ -1603,10 +1656,10 @@ void ui_draw_but_HSVCIRCLE(uiBut *but, uiWidgetColors *wcol, rcti *rect)
rgb_to_hsv(rgb[0], rgb[1], rgb[2], hsv, hsv+1, hsv+2);
copy_v3_v3(hsvo, hsv);
- /* exception: if 'lock' is set (stored in but->a2),
+ /* exception: if 'lock' is set
* lock the value of the color wheel to 1.
* Useful for color correction tools where you're only interested in hue. */
- if (but->a2) hsv[2] = 1.f;
+ if (but->flag & UI_BUT_COLOR_LOCK) hsv[2] = 1.f;
hsv_to_rgb(0.f, 0.f, hsv[2], colcent, colcent+1, colcent+2);
@@ -1621,6 +1674,8 @@ void ui_draw_but_HSVCIRCLE(uiBut *but, uiWidgetColors *wcol, rcti *rect)
float co= cos(ang);
ui_hsvcircle_vals_from_pos(hsv, hsv+1, rect, centx + co*radius, centy + si*radius);
+ CLAMP(hsv[2], 0.0f, 1.0f); /* for display only */
+
hsv_to_rgb(hsv[0], hsv[1], hsv[2], col, col+1, col+2);
glColor3fv(col);
glVertex2f( centx + co*radius, centy + si*radius);
@@ -1635,14 +1690,19 @@ void ui_draw_but_HSVCIRCLE(uiBut *but, uiWidgetColors *wcol, rcti *rect)
glEnable(GL_BLEND);
glEnable(GL_LINE_SMOOTH );
glColor3ubv((unsigned char*)wcol->outline);
- glutil_draw_lined_arc(0.0f, M_PI*2.0, radius, tot);
+ glutil_draw_lined_arc(0.0f, M_PI*2.0, radius, tot + 1);
glDisable(GL_BLEND);
glDisable(GL_LINE_SMOOTH );
glPopMatrix();
/* cursor */
ang= 2.0f*M_PI*hsvo[0] + 0.5f*M_PI;
- radius= hsvo[1]*radius;
+
+ if(but->flag & UI_BUT_COLOR_CUBIC)
+ radius= (1.0f - pow(1.0f - hsvo[1], 3.0f)) *radius;
+ else
+ radius= hsvo[1] * radius;
+
ui_hsv_cursor(centx + cos(-ang)*radius, centy + sin(-ang)*radius);
}
@@ -2208,9 +2268,15 @@ static void widget_swatch(uiBut *but, uiWidgetColors *wcol, rcti *rect, int stat
float col[4];
int color_profile = but->block->color_profile;
+ col[3]= 1.0f;
+
if (but->rnaprop) {
if (RNA_property_subtype(but->rnaprop) == PROP_COLOR_GAMMA)
color_profile = BLI_PR_NONE;
+
+ if(RNA_property_array_length(&but->rnapoin, but->rnaprop)==4) {
+ col[3]= RNA_property_float_get_index(&but->rnapoin, but->rnaprop, 3);
+ }
}
widget_init(&wtb);
@@ -2226,8 +2292,10 @@ static void widget_swatch(uiBut *but, uiWidgetColors *wcol, rcti *rect, int stat
wcol->inner[0]= FTOCHAR(col[0]);
wcol->inner[1]= FTOCHAR(col[1]);
wcol->inner[2]= FTOCHAR(col[2]);
+ wcol->inner[3]= FTOCHAR(col[3]);
wcol->shaded = 0;
-
+ wcol->alpha_check = (wcol->inner[3] < 255);
+
widgetbase_draw(&wtb, wcol);
}
diff --git a/source/blender/editors/mesh/editmesh_add.c b/source/blender/editors/mesh/editmesh_add.c
index a7a0a854f1b..6cdd1dff1fc 100644
--- a/source/blender/editors/mesh/editmesh_add.c
+++ b/source/blender/editors/mesh/editmesh_add.c
@@ -1262,6 +1262,23 @@ static void make_prim(Object *obedit, int type, float mat[4][4], int tot, int se
/* ********* add primitive operators ************* */
+static char *get_mesh_defname(int type)
+{
+ switch (type) {
+ case PRIM_PLANE: return "Plane";
+ case PRIM_CUBE: return "Cube";
+ case PRIM_CIRCLE: return "Circle";
+ case PRIM_CYLINDER: return "Tube";
+ case PRIM_CONE: return "Cone";
+ case PRIM_GRID: return "Grid";
+ case PRIM_UVSPHERE: return "Sphere";
+ case PRIM_ICOSPHERE: return "Icosphere";
+ case PRIM_MONKEY: return "Monkey";
+ default:
+ return "Mesh";
+ }
+}
+
static void make_prim_ext(bContext *C, float *loc, float *rot, int enter_editmode, unsigned int layer,
int type, int tot, int seg,
int subdiv, float dia, float depth, int ext, int fill)
@@ -1274,6 +1291,9 @@ static void make_prim_ext(bContext *C, float *loc, float *rot, int enter_editmod
if(obedit==NULL || obedit->type!=OB_MESH) {
obedit= ED_object_add_type(C, OB_MESH, loc, rot, FALSE, layer);
+ rename_id((ID *)obedit, get_mesh_defname(type));
+ rename_id((ID *)obedit->data, get_mesh_defname(type));
+
/* create editmode */
ED_object_enter_editmode(C, EM_DO_UNDO|EM_IGNORE_LAYER); /* rare cases the active layer is messed up */
newob = 1;
diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c
index 13656ca1b7e..a46d154cc22 100644
--- a/source/blender/editors/mesh/editmesh_tools.c
+++ b/source/blender/editors/mesh/editmesh_tools.c
@@ -1030,7 +1030,7 @@ void MESH_OT_spin(wmOperatorType *ot)
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
/* props */
- RNA_def_int(ot->srna, "steps", 9, 0, INT_MAX, "Steps", "Steps", 0, INT_MAX);
+ RNA_def_int(ot->srna, "steps", 9, 0, INT_MAX, "Steps", "Steps", 0, 128);
RNA_def_boolean(ot->srna, "dupli", 0, "Dupli", "Make Duplicates");
RNA_def_float(ot->srna, "degrees", 90.0f, -FLT_MAX, FLT_MAX, "Degrees", "Degrees", -360.0f, 360.0f);
diff --git a/source/blender/editors/metaball/mball_edit.c b/source/blender/editors/metaball/mball_edit.c
index 62261c3c68f..11534f57f75 100644
--- a/source/blender/editors/metaball/mball_edit.c
+++ b/source/blender/editors/metaball/mball_edit.c
@@ -47,6 +47,7 @@
#include "BKE_depsgraph.h"
#include "BKE_object.h"
#include "BKE_context.h"
+#include "BKE_library.h"
#include "ED_screen.h"
#include "ED_view3d.h"
@@ -59,6 +60,10 @@
/* This function is used to free all MetaElems from MetaBall */
void free_editMball(Object *obedit)
{
+ MetaBall *mb = (MetaBall*)obedit->data;
+
+ mb->editelems= NULL;
+ mb->lastelem= NULL;
}
/* This function is called, when MetaBall Object is
@@ -83,10 +88,6 @@ void make_editMball(Object *obedit)
* from object->data->edit_elems to object->data->elems. */
void load_editMball(Object *obedit)
{
- MetaBall *mb = (MetaBall*)obedit->data;
-
- mb->editelems= NULL;
- mb->lastelem= NULL;
}
/* Add metaelem primitive to metaball object (which is in edit mode) */
@@ -122,24 +123,29 @@ MetaElem *add_metaball_primitive(bContext *C, float mat[4][4], int type, int new
case MB_BALL:
ml->type = MB_BALL;
ml->expx= ml->expy= ml->expz= 1.0;
+
break;
case MB_TUBE:
ml->type = MB_TUBE;
ml->expx= ml->expy= ml->expz= 1.0;
+
break;
case MB_PLANE:
ml->type = MB_PLANE;
ml->expx= ml->expy= ml->expz= 1.0;
+
break;
case MB_ELIPSOID:
ml->type = MB_ELIPSOID;
ml->expx= 1.2f;
ml->expy= 0.8f;
ml->expz= 1.0;
+
break;
case MB_CUBE:
ml->type = MB_CUBE;
ml->expx= ml->expy= ml->expz= 1.0;
+
break;
default:
break;
diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c
index ee0fd2b47e9..757c167c496 100644
--- a/source/blender/editors/object/object_add.c
+++ b/source/blender/editors/object/object_add.c
@@ -183,7 +183,7 @@ void ED_object_add_generic_props(wmOperatorType *ot, int do_editmode)
RNA_def_float_vector(ot->srna, "location", 3, NULL, -FLT_MAX, FLT_MAX, "Location", "Location for the newly added object.", -FLT_MAX, FLT_MAX);
RNA_def_float_rotation(ot->srna, "rotation", 3, NULL, -FLT_MAX, FLT_MAX, "Rotation", "Rotation for the newly added object", -FLT_MAX, FLT_MAX);
- prop = RNA_def_boolean_layer_member(ot->srna, "layer", 32, NULL, "Layer", "");
+ prop = RNA_def_boolean_layer_member(ot->srna, "layer", 20, NULL, "Layer", "");
RNA_def_property_flag(prop, PROP_HIDDEN);
}
@@ -193,32 +193,28 @@ static void object_add_generic_invoke_options(bContext *C, wmOperator *op)
if (!RNA_property_is_set(op->ptr, "enter_editmode"))
RNA_boolean_set(op->ptr, "enter_editmode", U.flag & USER_ADD_EDITMODE);
- if (!RNA_property_is_set(op->ptr, "location")) {
+ if(!RNA_property_is_set(op->ptr, "location")) {
float loc[3];
ED_object_location_from_view(C, loc);
RNA_float_set_array(op->ptr, "location", loc);
}
- if (!RNA_property_is_set(op->ptr, "layer")) {
+ if(!RNA_property_is_set(op->ptr, "layer")) {
View3D *v3d = CTX_wm_view3d(C);
Scene *scene = CTX_data_scene(C);
- int a, values[32], layer;
+ int a, values[20], layer;
- if (v3d) {
- if (v3d->localvd) {
- layer = v3d->layact + v3d->lay;
- for(a=0; a<32; a++)
- values[a]= (layer & (1<<a));
- } else {
- layer = (v3d->scenelock)?scene->layact:v3d->layact;
+ if(v3d) {
+ layer = (v3d->scenelock && !v3d->localvd)? scene->layact: v3d->layact;
- for(a=0; a<32; a++)
- values[a]= (layer & (1<<a));
- }
- } else {
+ for(a=0; a<20; a++)
+ values[a]= (layer & (1<<a));
+ }
+ else {
layer = scene->layact;
- for(a=0; a<32; a++)
+
+ for(a=0; a<20; a++)
values[a]= (layer & (1<<a));
}
@@ -234,7 +230,8 @@ int ED_object_add_generic_invoke(bContext *C, wmOperator *op, wmEvent *event)
int ED_object_add_generic_get_opts(bContext *C, wmOperator *op, float *loc, float *rot, int *enter_editmode, unsigned int *layer)
{
- int a, layer_values[32];
+ View3D *v3d = CTX_wm_view3d(C);
+ int a, layer_values[20];
int view_align;
*enter_editmode = FALSE;
@@ -245,7 +242,7 @@ int ED_object_add_generic_get_opts(bContext *C, wmOperator *op, float *loc, floa
if(RNA_property_is_set(op->ptr, "layer")) {
RNA_boolean_get_array(op->ptr, "layer", layer_values);
- for(a=0; a<32; a++) {
+ for(a=0; a<20; a++) {
if(layer_values[a])
*layer |= (1 << a);
else
@@ -258,6 +255,11 @@ int ED_object_add_generic_get_opts(bContext *C, wmOperator *op, float *loc, floa
*layer = scene->layact;
}
+ /* in local view we additionally add local view layers,
+ not part of operator properties */
+ if(v3d && v3d->localvd)
+ *layer |= v3d->lay;
+
if (RNA_property_is_set(op->ptr, "view_align"))
view_align = RNA_boolean_get(op->ptr, "view_align");
else
@@ -671,6 +673,19 @@ void OBJECT_OT_armature_add(wmOperatorType *ot)
ED_object_add_generic_props(ot, TRUE);
}
+static char *get_lamp_defname(int type)
+{
+ switch (type) {
+ case LA_LOCAL: return "Point";
+ case LA_SUN: return "Sun";
+ case LA_SPOT: return "Spot";
+ case LA_HEMI: return "Hemi";
+ case LA_AREA: return "Area";
+ default:
+ return "Lamp";
+ }
+}
+
static int object_lamp_add_exec(bContext *C, wmOperator *op)
{
Object *ob;
@@ -687,6 +702,9 @@ static int object_lamp_add_exec(bContext *C, wmOperator *op)
if(ob && ob->data)
((Lamp*)ob->data)->type= type;
+ rename_id((ID *)ob, get_lamp_defname(type));
+ rename_id((ID *)ob->data, get_lamp_defname(type));
+
return OPERATOR_FINISHED;
}
@@ -1051,7 +1069,7 @@ static Base *duplibase_for_convert(Scene *scene, Base *base, Object *ob)
}
obn= copy_object(ob);
- obn->recalc |= OB_RECALC;
+ obn->recalc |= OB_RECALC_ALL;
basen= MEM_mallocN(sizeof(Base), "duplibase");
*basen= *base;
@@ -1134,7 +1152,7 @@ static int convert_exec(bContext *C, wmOperator *op)
newob->data= copy_mesh(me);
} else {
newob = ob;
- ob->recalc |= OB_RECALC;
+ ob->recalc |= OB_RECALC_ALL;
}
/* make new mesh data from the original copy */
@@ -1195,7 +1213,7 @@ static int convert_exec(bContext *C, wmOperator *op)
for(ob1= G.main->object.first; ob1; ob1=ob1->id.next) {
if(ob1->data==ob->data) {
ob1->type= OB_CURVE;
- ob1->recalc |= OB_RECALC;
+ ob1->recalc |= OB_RECALC_ALL;
}
}
}
@@ -1386,7 +1404,7 @@ static Base *object_add_duplicate_internal(Scene *scene, Base *base, int dupflag
}
else {
obn= copy_object(ob);
- obn->recalc |= OB_RECALC;
+ obn->recalc |= OB_RECALC_ALL;
basen= MEM_mallocN(sizeof(Base), "duplibase");
*basen= *base;
diff --git a/source/blender/editors/object/object_constraint.c b/source/blender/editors/object/object_constraint.c
index 7b61d8de43f..b1dc41531ef 100644
--- a/source/blender/editors/object/object_constraint.c
+++ b/source/blender/editors/object/object_constraint.c
@@ -866,7 +866,7 @@ void CONSTRAINT_OT_move_down (wmOperatorType *ot)
/* identifiers */
ot->name= "Move Constraint Down";
ot->idname= "CONSTRAINT_OT_move_down";
- ot->description= "Move constraint down constraint stack";
+ ot->description= "Move constraint down in constraint stack";
/* callbacks */
ot->exec= constraint_move_down_exec;
@@ -913,7 +913,7 @@ void CONSTRAINT_OT_move_up (wmOperatorType *ot)
/* identifiers */
ot->name= "Move Constraint Up";
ot->idname= "CONSTRAINT_OT_move_up";
- ot->description= "Move constraint up constraint stack";
+ ot->description= "Move constraint up in constraint stack";
/* callbacks */
ot->exec= constraint_move_up_exec;
diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c
index 5f61da4ae37..d3226b1adf4 100644
--- a/source/blender/editors/object/object_edit.c
+++ b/source/blender/editors/object/object_edit.c
@@ -468,7 +468,7 @@ void ED_object_enter_editmode(bContext *C, int flag)
scene->obedit= ob;
ED_armature_to_edit(ob);
/* to ensure all goes in restposition and without striding */
- DAG_id_flush_update(&ob->id, OB_RECALC);
+ DAG_id_flush_update(&ob->id, OB_RECALC_ALL); // XXX: should this be OB_RECALC_DATA?
WM_event_add_notifier(C, NC_SCENE|ND_MODE|NS_EDITMODE_ARMATURE, scene);
}
@@ -1792,6 +1792,11 @@ static int shade_smooth_exec(bContext *C, wmOperator *op)
return (done)? OPERATOR_FINISHED: OPERATOR_CANCELLED;
}
+static int shade_poll(bContext *C)
+{
+ return (ED_operator_object_active_editable(C) && !ED_operator_editmesh(C));
+}
+
void OBJECT_OT_shade_flat(wmOperatorType *ot)
{
/* identifiers */
@@ -1799,7 +1804,7 @@ void OBJECT_OT_shade_flat(wmOperatorType *ot)
ot->idname= "OBJECT_OT_shade_flat";
/* api callbacks */
- ot->poll= ED_operator_object_active_editable;
+ ot->poll= shade_poll;
ot->exec= shade_smooth_exec;
/* flags */
@@ -1813,7 +1818,7 @@ void OBJECT_OT_shade_smooth(wmOperatorType *ot)
ot->idname= "OBJECT_OT_shade_smooth";
/* api callbacks */
- ot->poll= ED_operator_object_active_editable;
+ ot->poll= shade_poll;
ot->exec= shade_smooth_exec;
/* flags */
diff --git a/source/blender/editors/object/object_modifier.c b/source/blender/editors/object/object_modifier.c
index 56742413358..0661b675668 100644
--- a/source/blender/editors/object/object_modifier.c
+++ b/source/blender/editors/object/object_modifier.c
@@ -399,7 +399,7 @@ static int modifier_apply_obdata(ReportList *reports, Scene *scene, Object *ob,
if (ob->type==OB_MESH) {
DerivedMesh *dm;
Mesh *me = ob->data;
- MultiresModifierData *mmd= find_multires_modifier(scene, ob);
+ MultiresModifierData *mmd= find_multires_modifier_before(scene, md);
if( me->key) {
BKE_report(reports, RPT_ERROR, "Modifier cannot be applied to Mesh with Shape Keys");
@@ -412,12 +412,15 @@ static int modifier_apply_obdata(ReportList *reports, Scene *scene, Object *ob,
if(md->type == eModifierType_Multires)
multires_force_update(ob);
- if (mmd && mti->type==eModifierTypeType_OnlyDeform) {
- multiresModifier_reshapeFromDeformMod (scene, mmd, ob, md);
+ if (mmd && mmd->totlvl && mti->type==eModifierTypeType_OnlyDeform) {
+ if(!multiresModifier_reshapeFromDeformMod (scene, mmd, ob, md)) {
+ BKE_report(reports, RPT_ERROR, "Multires modifier returned error, skipping apply");
+ return 0;
+ }
} else {
dm = mesh_create_derived_for_modifier(scene, ob, md);
if (!dm) {
- BKE_report(reports, RPT_ERROR, "Modifier is returned error, skipping apply");
+ BKE_report(reports, RPT_ERROR, "Modifier returned error, skipping apply");
return 0;
}
@@ -1081,7 +1084,7 @@ void OBJECT_OT_multires_external_save(wmOperatorType *ot)
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
- WM_operator_properties_filesel(ot, FOLDERFILE|BTXFILE, FILE_SPECIAL, FILE_SAVE, FILE_RELPATH);
+ WM_operator_properties_filesel(ot, FOLDERFILE|BTXFILE, FILE_SPECIAL, FILE_SAVE, WM_FILESEL_FILEPATH|WM_FILESEL_RELPATH);
edit_modifier_properties(ot);
}
diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c
index 28eb919dbe7..fbc6075796c 100644
--- a/source/blender/editors/object/object_relations.c
+++ b/source/blender/editors/object/object_relations.c
@@ -193,7 +193,7 @@ static int vertex_parent_set_exec(bContext *C, wmOperator *op)
CTX_DATA_BEGIN(C, Object*, ob, selected_editable_objects) {
if(ob != obedit) {
- ob->recalc |= OB_RECALC;
+ ob->recalc |= OB_RECALC_ALL;
par= obedit->parent;
while(par) {
@@ -339,7 +339,7 @@ static int make_proxy_exec (bContext *C, wmOperator *op)
/* depsgraph flushes are needed for the new data */
DAG_scene_sort(scene);
- DAG_id_flush_update(&newob->id, OB_RECALC);
+ DAG_id_flush_update(&newob->id, OB_RECALC_ALL);
WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, newob);
}
else {
@@ -427,7 +427,7 @@ static int parent_clear_exec(bContext *C, wmOperator *op)
else if(type == 2)
unit_m4(ob->parentinv);
- ob->recalc |= OB_RECALC;
+ ob->recalc |= OB_RECALC_ALL;
}
CTX_DATA_END;
@@ -869,7 +869,7 @@ static int object_track_clear_exec(bContext *C, wmOperator *op)
/* remove track-object for old track */
ob->track= NULL;
- ob->recalc |= OB_RECALC;
+ ob->recalc |= OB_RECALC_ALL;
/* also remove all tracking constraints */
for (con= ob->constraints.last; con; con= pcon) {
@@ -935,7 +935,7 @@ static int track_set_exec(bContext *C, wmOperator *op)
data = con->data;
data->tar = obact;
- ob->recalc |= OB_RECALC;
+ ob->recalc |= OB_RECALC_ALL;
/* Lamp and Camera track differently by default */
if (ob->type == OB_LAMP || ob->type == OB_CAMERA)
@@ -954,7 +954,7 @@ static int track_set_exec(bContext *C, wmOperator *op)
data = con->data;
data->tar = obact;
- ob->recalc |= OB_RECALC;
+ ob->recalc |= OB_RECALC_ALL;
/* Lamp and Camera track differently by default */
if (ob->type == OB_LAMP || ob->type == OB_CAMERA) {
@@ -975,7 +975,7 @@ static int track_set_exec(bContext *C, wmOperator *op)
data = con->data;
data->tar = obact;
- ob->recalc |= OB_RECALC;
+ ob->recalc |= OB_RECALC_ALL;
/* Lamp and Camera track differently by default */
if (ob->type == OB_LAMP || ob->type == OB_CAMERA) {
@@ -1191,24 +1191,25 @@ enum {
/* Return 1 if make link data is allow, zero otherwise */
static int allow_make_links_data(int ev, Object *ob, Object *obt)
{
- if (ev == MAKE_LINKS_OBDATA) {
- if (ob->type == OB_MESH && obt->type == OB_MESH)
- return(1);
+ switch(ev) {
+ case MAKE_LINKS_OBDATA:
+ if (ob->type == obt->type && ob->type != OB_EMPTY)
+ return 1;
+ break;
+ case MAKE_LINKS_MATERIALS:
+ if (ELEM5(ob->type, OB_MESH, OB_CURVE, OB_FONT, OB_SURF, OB_MBALL) &&
+ ELEM5(obt->type, OB_MESH, OB_CURVE, OB_FONT, OB_SURF, OB_MBALL))
+ return 1;
+ break;
+ case MAKE_LINKS_ANIMDATA:
+ case MAKE_LINKS_DUPLIGROUP:
+ return 1;
+ case MAKE_LINKS_MODIFIERS:
+ if (ob->type != OB_EMPTY && obt->type != OB_EMPTY)
+ return 1;
+ break;
}
- else if (ev == MAKE_LINKS_MATERIALS) {
- if ((ob->type == OB_MESH || ob->type == OB_CURVE || ob->type == OB_FONT || ob->type == OB_SURF || ob->type == OB_MBALL) &&
- (obt->type == OB_MESH || obt->type == OB_CURVE || obt->type == OB_FONT || obt->type == OB_SURF || obt->type == OB_MBALL))
- return(1);
- }
- else if (ev == MAKE_LINKS_ANIMDATA)
- return(1);
- else if (ev == MAKE_LINKS_DUPLIGROUP)
- return(1);
- else if (ev == MAKE_LINKS_MODIFIERS) {
- if (ob->type != OB_EMPTY && obt->type != OB_EMPTY)
- return(1);
- }
- return(0);
+ return 0;
}
static int make_links_data_exec(bContext *C, wmOperator *op)
@@ -1258,7 +1259,7 @@ static int make_links_data_exec(bContext *C, wmOperator *op)
break;
case MAKE_LINKS_MODIFIERS:
object_link_modifiers(obt, ob);
- obt->recalc |= OB_RECALC;
+ obt->recalc |= OB_RECALC_ALL;
break;
}
}
diff --git a/source/blender/editors/render/render_internal.c b/source/blender/editors/render/render_internal.c
index 48ad3bbcc94..7110c3aa7a7 100644
--- a/source/blender/editors/render/render_internal.c
+++ b/source/blender/editors/render/render_internal.c
@@ -403,7 +403,7 @@ static int screen_render_exec(bContext *C, wmOperator *op)
Render *re= RE_NewRender(scene->id.name);
Image *ima;
View3D *v3d= CTX_wm_view3d(C);
- int lay= (v3d)? v3d->lay|scene->lay: scene->lay;
+ int lay= (v3d)? v3d->lay: scene->lay;
if(re==NULL) {
re= RE_NewRender(scene->id.name);
@@ -508,11 +508,14 @@ static void image_renderinfo_cb(void *rjv, RenderStats *rs)
rr= RE_AcquireResultRead(rj->re);
- /* malloc OK here, stats_draw is not in tile threads */
- if(rr->text==NULL)
- rr->text= MEM_callocN(IMA_MAX_RENDER_TEXT, "rendertext");
+ if(rr) {
+ /* malloc OK here, stats_draw is not in tile threads */
+ if(rr->text==NULL)
+ rr->text= MEM_callocN(IMA_MAX_RENDER_TEXT, "rendertext");
+
+ make_renderinfo_string(rs, rj->scene, rr->text);
+ }
- make_renderinfo_string(rs, rj->scene, rr->text);
RE_ReleaseResult(rj->re);
/* make jobs timer to send notifier */
@@ -634,7 +637,7 @@ static int screen_render_invoke(bContext *C, wmOperator *op, wmEvent *event)
multires_force_render_update(CTX_data_active_object(C));
/* get editmode results */
- ED_object_exit_editmode(C, EM_FREEDATA|EM_DO_UNDO); /* 0 = does not exit editmode */
+ ED_object_exit_editmode(C, 0); /* 0 = does not exit editmode */
// store spare
// get view3d layer, local layer, make this nice api call to render
@@ -666,7 +669,7 @@ static int screen_render_invoke(bContext *C, wmOperator *op, wmEvent *event)
rj->scene= scene;
rj->win= CTX_wm_window(C);
rj->srl = srl;
- rj->lay = (v3d)? v3d->lay|scene->lay: scene->lay;
+ rj->lay = (v3d)? v3d->lay: scene->lay;
rj->anim= RNA_boolean_get(op->ptr, "animation");
rj->iuser.scene= scene;
rj->iuser.ok= 1;
diff --git a/source/blender/editors/render/render_opengl.c b/source/blender/editors/render/render_opengl.c
index 7cc074a74fd..5881d50c309 100644
--- a/source/blender/editors/render/render_opengl.c
+++ b/source/blender/editors/render/render_opengl.c
@@ -233,7 +233,7 @@ static int screen_opengl_render_init(bContext *C, wmOperator *op)
rr= RE_AcquireResultWrite(oglrender->re);
if(rr->rectf==NULL)
- rr->rectf= MEM_mallocN(sizeof(float)*4*sizex*sizey, "32 bits rects");
+ rr->rectf= MEM_callocN(sizeof(float)*4*sizex*sizey, "screen_opengl_render_init rect");
RE_ReleaseResult(oglrender->re);
return 1;
@@ -402,9 +402,10 @@ static int screen_opengl_render_modal(bContext *C, wmOperator *op, wmEvent *even
return OPERATOR_RUNNING_MODAL;
}
- ret= screen_opengl_render_anim_step(C, op);
-
+ /* run first because screen_opengl_render_anim_step can free oglrender */
WM_event_add_notifier(C, NC_SCENE|ND_RENDER_RESULT, oglrender->scene);
+
+ ret= screen_opengl_render_anim_step(C, op);
/* stop at the end or on error */
if(ret == 0) {
diff --git a/source/blender/editors/render/render_preview.c b/source/blender/editors/render/render_preview.c
index 898a8f527c3..ae2462b95f8 100644
--- a/source/blender/editors/render/render_preview.c
+++ b/source/blender/editors/render/render_preview.c
@@ -1153,4 +1153,10 @@ void ED_preview_shader_job(const bContext *C, void *owner, ID *id, ID *parent, M
WM_jobs_start(CTX_wm_manager(C), steve);
}
+void ED_preview_kill_jobs(const struct bContext *C)
+{
+ wmWindowManager *wm= CTX_wm_manager(C);
+ if(wm)
+ WM_jobs_kill(wm, NULL, common_preview_startjob);
+}
diff --git a/source/blender/editors/render/render_shading.c b/source/blender/editors/render/render_shading.c
index 36a62919b5a..81f32c402da 100644
--- a/source/blender/editors/render/render_shading.c
+++ b/source/blender/editors/render/render_shading.c
@@ -1129,7 +1129,7 @@ void TEXTURE_OT_envmap_save(wmOperatorType *ot)
/* properties */
//RNA_def_enum(ot->srna, "file_type", image_file_type_items, R_PNG, "File Type", "File type to save image as.");
- WM_operator_properties_filesel(ot, FOLDERFILE|IMAGEFILE|MOVIEFILE, FILE_SPECIAL, FILE_SAVE, FILE_RELPATH);
+ WM_operator_properties_filesel(ot, FOLDERFILE|IMAGEFILE|MOVIEFILE, FILE_SPECIAL, FILE_SAVE, WM_FILESEL_FILEPATH|WM_FILESEL_RELPATH);
}
static int envmap_clear_exec(bContext *C, wmOperator *op)
diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c
index 65b2923d884..fa7064b817d 100644
--- a/source/blender/editors/screen/area.c
+++ b/source/blender/editors/screen/area.c
@@ -177,14 +177,18 @@ static void area_draw_azone(short x1, short y1, short x2, short y2)
float dx= 0.3f*(xmax-xmin);
float dy= 0.3f*(ymax-ymin);
- glColor4ub(255, 255, 255, 80);
+ glColor4ub(255, 255, 255, 180);
fdrawline(xmin, ymax, xmax, ymin);
+ glColor4ub(255, 255, 255, 130);
fdrawline(xmin, ymax-dy, xmax-dx, ymin);
+ glColor4ub(255, 255, 255, 80);
fdrawline(xmin, ymax-2*dy, xmax-2*dx, ymin);
- glColor4ub(0, 0, 0, 150);
+ glColor4ub(0, 0, 0, 210);
fdrawline(xmin, ymax+1, xmax+1, ymin);
+ glColor4ub(0, 0, 0, 180);
fdrawline(xmin, ymax-dy+1, xmax-dx+1, ymin);
+ glColor4ub(0, 0, 0, 150);
fdrawline(xmin, ymax-2*dy+1, xmax-2*dx+1, ymin);
}
diff --git a/source/blender/editors/screen/screen_context.c b/source/blender/editors/screen/screen_context.c
index 2d5af4aa705..de1312501d4 100644
--- a/source/blender/editors/screen/screen_context.c
+++ b/source/blender/editors/screen/screen_context.c
@@ -29,6 +29,7 @@
#include "DNA_object_types.h"
#include "DNA_armature_types.h"
+#include "DNA_sequence_types.h"
#include "DNA_scene_types.h"
#include "DNA_screen_types.h"
@@ -36,6 +37,7 @@
#include "BKE_utildefines.h"
#include "BKE_global.h"
#include "BKE_action.h"
+#include "BKE_sequencer.h"
#include "RNA_access.h"
@@ -66,7 +68,9 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult
"visible_pose_bones", "selected_pose_bones", "active_bone", "active_pose_bone",
"active_base", "active_object", "object", "edit_object",
"sculpt_object", "vertex_paint_object", "weight_paint_object",
- "texture_paint_object", "particle_edit_object", NULL};
+ "texture_paint_object", "particle_edit_object",
+ "selected_sequences", "selected_editable_sequences", /* sequencer */
+ NULL};
CTX_data_dir_set(result, dir);
return 1;
@@ -317,6 +321,32 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult
return 1;
}
+ else if(CTX_data_equals(member, "selected_strips")) {
+ Editing *ed= seq_give_editing(scene, FALSE);
+ if(ed) {
+ Sequence *seq;
+ for (seq= ed->seqbasep->first; seq; seq= seq->next) {
+ if (seq->flag & SELECT) {
+ CTX_data_list_add(result, &scene->id, &RNA_Sequence, seq);
+ }
+ }
+ CTX_data_type_set(result, CTX_DATA_TYPE_COLLECTION);
+ return 1;
+ }
+ }
+ else if(CTX_data_equals(member, "selected_editable_sequences")) {
+ Editing *ed= seq_give_editing(scene, FALSE);
+ if(ed) {
+ Sequence *seq;
+ for (seq= ed->seqbasep->first; seq; seq= seq->next) {
+ if (seq->flag & SELECT && !(seq->flag & SEQ_LOCK)) {
+ CTX_data_list_add(result, &scene->id, &RNA_Sequence, seq);
+ }
+ }
+ CTX_data_type_set(result, CTX_DATA_TYPE_COLLECTION);
+ return 1;
+ }
+ }
else {
return 0; /* not found */
}
diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c
index 515b06feba1..5aeb50b34c5 100644
--- a/source/blender/editors/screen/screen_ops.c
+++ b/source/blender/editors/screen/screen_ops.c
@@ -1504,6 +1504,7 @@ static int frame_offset_exec(bContext *C, wmOperator *op)
delta = RNA_int_get(op->ptr, "delta");
CTX_data_scene(C)->r.cfra += delta;
+ CTX_data_scene(C)->r.subframe = 0.f;
sound_seek_scene(C);
diff --git a/source/blender/editors/screen/screendump.c b/source/blender/editors/screen/screendump.c
index 5f592aeba52..d5cd8285515 100644
--- a/source/blender/editors/screen/screendump.c
+++ b/source/blender/editors/screen/screendump.c
@@ -171,7 +171,7 @@ void SCREEN_OT_screenshot(wmOperatorType *ot)
ot->flag= 0;
- WM_operator_properties_filesel(ot, FOLDERFILE|IMAGEFILE, FILE_SPECIAL, FILE_SAVE, 0);
+ WM_operator_properties_filesel(ot, FOLDERFILE|IMAGEFILE, FILE_SPECIAL, FILE_SAVE, WM_FILESEL_FILEPATH);
RNA_def_boolean(ot->srna, "full", 1, "Full Screen", "");
}
diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c
index 6269b9c5e09..41908bbe388 100644
--- a/source/blender/editors/sculpt_paint/paint_image.c
+++ b/source/blender/editors/sculpt_paint/paint_image.c
@@ -3552,16 +3552,18 @@ static void blend_color_mix_float(float *cp, const float *cp1, const float *cp2,
cp[3]= mfac*cp1[3] + fac*cp2[3];
}
-static void blend_color_mix_rgb(unsigned char *cp, const unsigned char *cp1, const unsigned char *cp2, const int fac)
+static void blend_color_mix_accum(unsigned char *cp, const unsigned char *cp1, const unsigned char *cp2, const int fac)
{
/* this and other blending modes previously used >>8 instead of /255. both
are not equivalent (>>8 is /256), and the former results in rounding
errors that can turn colors black fast after repeated blending */
const int mfac= 255-fac;
+ const int alpha= cp1[3] + ((fac * cp2[3]) / 255);
cp[0]= (mfac*cp1[0]+fac*cp2[0])/255;
cp[1]= (mfac*cp1[1]+fac*cp2[1])/255;
cp[2]= (mfac*cp1[2]+fac*cp2[2])/255;
+ cp[3]= alpha > 255 ? 255 : alpha;
}
static void do_projectpaint_clone(ProjPaintState *ps, ProjPixel *projPixel, float *rgba, float alpha, float mask)
@@ -3732,7 +3734,8 @@ static void *do_projectpaint_thread(void *ph_v)
bicubic_interpolation_color(ps->reproject_ibuf, projPixel->newColor.ch, NULL, projPixel->projCoSS[0], projPixel->projCoSS[1]);
if(projPixel->newColor.ch[3]) {
mask = ((float)projPixel->mask)/65535.0f;
- blend_color_mix_rgb(projPixel->pixel.ch_pt, projPixel->origColor.ch, projPixel->newColor.ch, (mask*projPixel->newColor.ch[3]));
+ blend_color_mix_accum(projPixel->pixel.ch_pt, projPixel->origColor.ch, projPixel->newColor.ch, (mask*projPixel->newColor.ch[3]));
+
}
}
}
diff --git a/source/blender/editors/sound/sound_ops.c b/source/blender/editors/sound/sound_ops.c
index f362c584585..0d2dfd75863 100644
--- a/source/blender/editors/sound/sound_ops.c
+++ b/source/blender/editors/sound/sound_ops.c
@@ -150,7 +150,7 @@ void SOUND_OT_open(wmOperatorType *ot)
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
/* properties */
- WM_operator_properties_filesel(ot, FOLDERFILE|SOUNDFILE|MOVIEFILE, FILE_SPECIAL, FILE_OPENFILE, FILE_RELPATH);
+ WM_operator_properties_filesel(ot, FOLDERFILE|SOUNDFILE|MOVIEFILE, FILE_SPECIAL, FILE_OPENFILE, WM_FILESEL_RELPATH);
RNA_def_boolean(ot->srna, "cache", FALSE, "Cache", "Cache the sound in memory.");
}
diff --git a/source/blender/editors/space_action/action_edit.c b/source/blender/editors/space_action/action_edit.c
index 01c8ede6a2a..0e2a7f690c5 100644
--- a/source/blender/editors/space_action/action_edit.c
+++ b/source/blender/editors/space_action/action_edit.c
@@ -1138,6 +1138,7 @@ static int actkeys_framejump_exec(bContext *C, wmOperator *op)
if (ked.i1) {
Scene *scene= ac.scene;
CFRA= (int)floor((ked.f1 / ked.i1) + 0.5f);
+ SUBFRA= 0.f;
}
/* set notifier that things have changed */
diff --git a/source/blender/editors/space_buttons/buttons_ops.c b/source/blender/editors/space_buttons/buttons_ops.c
index 96cf79d880f..ebdc0d37b43 100644
--- a/source/blender/editors/space_buttons/buttons_ops.c
+++ b/source/blender/editors/space_buttons/buttons_ops.c
@@ -32,7 +32,10 @@
#include "DNA_userdef_types.h"
+#include "BLI_fileops.h"
+
#include "BKE_context.h"
+#include "BKE_global.h" /* G.sce only */
#include "WM_api.h"
#include "WM_types.h"
@@ -120,30 +123,53 @@ static int file_browse_invoke(bContext *C, wmOperator *op, wmEvent *event)
if(!prop)
return OPERATOR_CANCELLED;
-
- fbo= MEM_callocN(sizeof(FileBrowseOp), "FileBrowseOp");
- fbo->ptr= ptr;
- fbo->prop= prop;
- op->customdata= fbo;
str= RNA_property_string_get_alloc(&ptr, prop, 0, 0);
- RNA_string_set(op->ptr, "filepath", str);
- MEM_freeN(str);
- if(RNA_struct_find_property(op->ptr, "relative_path"))
- if(!RNA_property_is_set(op->ptr, "relative_path"))
- RNA_boolean_set(op->ptr, "relative_path", U.flag & USER_RELPATHS);
+ /* useful yet irritating feature, Shift+Click to open the file
+ * Alt+Click to browse a folder in the OS's browser */
+ if(event->shift || event->alt) {
+ PointerRNA props_ptr;
- WM_event_add_fileselect(C, op);
-
- return OPERATOR_RUNNING_MODAL;
+ if(event->alt) {
+ char *lslash= BLI_last_slash(str);
+ if(lslash)
+ *lslash= '\0';
+ }
+
+
+ WM_operator_properties_create(&props_ptr, "WM_OT_path_open");
+ RNA_string_set(&props_ptr, "filepath", str);
+ WM_operator_name_call(C, "WM_OT_path_open", WM_OP_EXEC_DEFAULT, &props_ptr);
+ WM_operator_properties_free(&props_ptr);
+
+ MEM_freeN(str);
+ return OPERATOR_CANCELLED;
+ }
+ else {
+ fbo= MEM_callocN(sizeof(FileBrowseOp), "FileBrowseOp");
+ fbo->ptr= ptr;
+ fbo->prop= prop;
+ op->customdata= fbo;
+
+ RNA_string_set(op->ptr, "filepath", str);
+ MEM_freeN(str);
+
+ if(RNA_struct_find_property(op->ptr, "relative_path"))
+ if(!RNA_property_is_set(op->ptr, "relative_path"))
+ RNA_boolean_set(op->ptr, "relative_path", U.flag & USER_RELPATHS);
+
+ WM_event_add_fileselect(C, op);
+
+ return OPERATOR_RUNNING_MODAL;
+ }
}
void BUTTONS_OT_file_browse(wmOperatorType *ot)
{
/* identifiers */
ot->name= "Accept";
- ot->description="Open a file browser";
+ ot->description="Open a file browser, Hold Shift to open the file, Alt to browse containing directory";
ot->idname= "BUTTONS_OT_file_browse";
/* api callbacks */
@@ -152,6 +178,6 @@ void BUTTONS_OT_file_browse(wmOperatorType *ot)
ot->cancel= file_browse_cancel;
/* properties */
- WM_operator_properties_filesel(ot, 0, FILE_SPECIAL, FILE_OPENFILE, FILE_RELPATH);
+ WM_operator_properties_filesel(ot, 0, FILE_SPECIAL, FILE_OPENFILE, WM_FILESEL_FILEPATH|WM_FILESEL_RELPATH);
}
diff --git a/source/blender/editors/space_file/file_ops.c b/source/blender/editors/space_file/file_ops.c
index 7c2a2f436cc..55a44b36a52 100644
--- a/source/blender/editors/space_file/file_ops.c
+++ b/source/blender/editors/space_file/file_ops.c
@@ -391,7 +391,7 @@ static int bookmark_add_exec(bContext *C, wmOperator *op)
char name[FILE_MAX];
fsmenu_insert_entry(fsmenu, FS_CATEGORY_BOOKMARKS, params->dir, 0, 1);
- BLI_make_file_string("/", name, BLI_gethome(), ".Bfs");
+ BLI_make_file_string("/", name, BLI_get_folder_create(BLENDER_USER_CONFIG, NULL), BLENDER_BOOKMARK_FILE);
fsmenu_write_file(fsmenu, name);
}
@@ -423,7 +423,7 @@ static int bookmark_delete_exec(bContext *C, wmOperator *op)
char name[FILE_MAX];
fsmenu_remove_entry(fsmenu, FS_CATEGORY_BOOKMARKS, index);
- BLI_make_file_string("/", name, BLI_gethome(), ".Bfs");
+ BLI_make_file_string("/", name, BLI_get_folder_create(BLENDER_USER_CONFIG, NULL), BLENDER_BOOKMARK_FILE);
fsmenu_write_file(fsmenu, name);
ED_area_tag_redraw(sa);
}
@@ -619,7 +619,7 @@ int file_exec(bContext *C, wmOperator *exec_op)
folderlist_free(sfile->folders_next);
fsmenu_insert_entry(fsmenu_get(), FS_CATEGORY_RECENT, sfile->params->dir,0, 1);
- BLI_make_file_string(G.sce, filepath, BLI_gethome(), ".Bfs");
+ BLI_make_file_string(G.sce, filepath, BLI_get_folder_create(BLENDER_USER_CONFIG, NULL), BLENDER_BOOKMARK_FILE);
fsmenu_write_file(fsmenu_get(), filepath);
WM_event_fileselect_event(C, op, EVT_FILESELECT_EXEC);
diff --git a/source/blender/editors/space_file/filelist.c b/source/blender/editors/space_file/filelist.c
index 5e4887827b6..37653d616c4 100644
--- a/source/blender/editors/space_file/filelist.c
+++ b/source/blender/editors/space_file/filelist.c
@@ -1360,7 +1360,7 @@ void thumbnails_start(struct FileList* filelist, const struct bContext* C)
void thumbnails_stop(struct FileList* filelist, const struct bContext* C)
{
- WM_jobs_kill(CTX_wm_manager(C), filelist);
+ WM_jobs_kill(CTX_wm_manager(C), filelist, NULL);
}
int thumbnails_running(struct FileList* filelist, const struct bContext* C)
diff --git a/source/blender/editors/space_file/filesel.c b/source/blender/editors/space_file/filesel.c
index abb3a6a7a35..086d4f9cce2 100644
--- a/source/blender/editors/space_file/filesel.c
+++ b/source/blender/editors/space_file/filesel.c
@@ -102,7 +102,6 @@ FileSelectParams* ED_fileselect_get_params(struct SpaceFile *sfile)
short ED_fileselect_set_params(SpaceFile *sfile)
{
- char name[FILE_MAX], dir[FILE_MAX], file[FILE_MAX];
FileSelectParams *params;
wmOperator *op = sfile->op;
@@ -110,10 +109,7 @@ short ED_fileselect_set_params(SpaceFile *sfile)
if (!sfile->params) {
sfile->params= MEM_callocN(sizeof(FileSelectParams), "fileselparams");
/* set path to most recently opened .blend */
- BLI_strncpy(sfile->params->dir, G.sce, sizeof(sfile->params->dir));
- BLI_split_dirfile(G.sce, dir, file);
- BLI_strncpy(sfile->params->file, file, sizeof(sfile->params->file));
- BLI_make_file_string(G.sce, sfile->params->dir, dir, ""); /* XXX needed ? - also solve G.sce */
+ BLI_split_dirfile(G.sce, sfile->params->dir, sfile->params->file);
}
params = sfile->params;
@@ -127,19 +123,33 @@ short ED_fileselect_set_params(SpaceFile *sfile)
else
params->type = FILE_SPECIAL;
- if (RNA_property_is_set(op->ptr, "filepath")) {
+ if (RNA_struct_find_property(op->ptr, "filepath") && RNA_property_is_set(op->ptr, "filepath")) {
+ char name[FILE_MAX];
RNA_string_get(op->ptr, "filepath", name);
if (params->type == FILE_LOADLIB) {
BLI_strncpy(params->dir, name, sizeof(params->dir));
- BLI_cleanup_dir(G.sce, params->dir);
- } else {
- /* if operator has path set, use it, otherwise keep the last */
- BLI_path_abs(name, G.sce);
- BLI_split_dirfile(name, dir, file);
- BLI_strncpy(params->file, file, sizeof(params->file));
- BLI_make_file_string(G.sce, params->dir, dir, ""); /* XXX needed ? - also solve G.sce */
+ sfile->params->file[0]= '\0';
+ }
+ else {
+ BLI_split_dirfile(name, sfile->params->dir, sfile->params->file);
}
}
+ else {
+ if (RNA_struct_find_property(op->ptr, "directory") && RNA_property_is_set(op->ptr, "directory")) {
+ RNA_string_get(op->ptr, "directory", params->dir);
+ sfile->params->file[0]= '\0';
+ }
+
+ if (RNA_struct_find_property(op->ptr, "filename") && RNA_property_is_set(op->ptr, "filename")) {
+ RNA_string_get(op->ptr, "filename", params->file);
+ }
+ }
+
+ if(params->dir[0]) {
+ BLI_cleanup_dir(G.sce, params->dir);
+ BLI_path_abs(params->dir, G.sce);
+ }
+
params->filter = 0;
if(RNA_struct_find_property(op->ptr, "filter_blender"))
params->filter |= RNA_boolean_get(op->ptr, "filter_blender") ? BLENDERFILE : 0;
diff --git a/source/blender/editors/space_file/fsmenu.c b/source/blender/editors/space_file/fsmenu.c
index 08a6b5a8f34..6699c0b8bc7 100644
--- a/source/blender/editors/space_file/fsmenu.c
+++ b/source/blender/editors/space_file/fsmenu.c
@@ -248,12 +248,41 @@ void fsmenu_write_file(struct FSMenu* fsmenu, const char *filename)
fclose(fp);
}
-void fsmenu_read_file(struct FSMenu* fsmenu, const char *filename)
+void fsmenu_read_bookmarks(struct FSMenu* fsmenu, const char *filename)
{
char line[256];
FSMenuCategory category = FS_CATEGORY_BOOKMARKS;
FILE *fp;
+ fp = fopen(filename, "r");
+ if (!fp) return;
+
+ while ( fgets ( line, 256, fp ) != NULL ) /* read a line */
+ {
+ if (strncmp(line, "[Bookmarks]", 11)==0){
+ category = FS_CATEGORY_BOOKMARKS;
+ } else if (strncmp(line, "[Recent]", 8)==0){
+ category = FS_CATEGORY_RECENT;
+ } else {
+ int len = strlen(line);
+ if (len>0) {
+ if (line[len-1] == '\n') {
+ line[len-1] = '\0';
+ }
+ if (BLI_exist(line)) {
+ fsmenu_insert_entry(fsmenu, category, line, 0, 1);
+ }
+ }
+ }
+ }
+ fclose(fp);
+}
+
+void fsmenu_read_system(struct FSMenu* fsmenu)
+{
+ char line[256];
+ FILE *fp;
+
#ifdef WIN32
/* Add the drive names to the listing */
{
@@ -429,15 +458,14 @@ void fsmenu_read_file(struct FSMenu* fsmenu, const char *filename)
#else
/* unix */
{
- char dir[FILE_MAXDIR];
char *home= BLI_gethome();
if(home) {
- BLI_snprintf(dir, FILE_MAXDIR, "%s/", home);
- fsmenu_insert_entry(fsmenu, FS_CATEGORY_BOOKMARKS, dir, 1, 0);
- BLI_snprintf(dir, FILE_MAXDIR, "%s/Desktop/", home);
- if (BLI_exists(dir)) {
- fsmenu_insert_entry(fsmenu, FS_CATEGORY_BOOKMARKS, dir, 1, 0);
+ BLI_snprintf(line, FILE_MAXDIR, "%s/", home);
+ fsmenu_insert_entry(fsmenu, FS_CATEGORY_BOOKMARKS, line, 1, 0);
+ BLI_snprintf(line, FILE_MAXDIR, "%s/Desktop/", home);
+ if (BLI_exists(line)) {
+ fsmenu_insert_entry(fsmenu, FS_CATEGORY_BOOKMARKS, line, 1, 0);
}
}
@@ -446,7 +474,6 @@ void fsmenu_read_file(struct FSMenu* fsmenu, const char *filename)
#ifdef __linux__
/* loop over mount points */
struct mntent *mnt;
- FILE *fp;
int len;
fp = setmntent (MOUNTED, "r");
@@ -461,8 +488,8 @@ void fsmenu_read_file(struct FSMenu* fsmenu, const char *filename)
len= strlen(mnt->mnt_dir);
if(len && mnt->mnt_dir[len-1] != '/') {
- BLI_snprintf(dir, FILE_MAXDIR, "%s/", mnt->mnt_dir);
- fsmenu_insert_entry(fsmenu, FS_CATEGORY_SYSTEM, dir, 1, 0);
+ BLI_snprintf(line, FILE_MAXDIR, "%s/", mnt->mnt_dir);
+ fsmenu_insert_entry(fsmenu, FS_CATEGORY_SYSTEM, line, 1, 0);
}
else
fsmenu_insert_entry(fsmenu, FS_CATEGORY_SYSTEM, mnt->mnt_dir, 1, 0);
@@ -482,31 +509,9 @@ void fsmenu_read_file(struct FSMenu* fsmenu, const char *filename)
}
#endif
#endif
-
- fp = fopen(filename, "r");
- if (!fp) return;
-
- while ( fgets ( line, 256, fp ) != NULL ) /* read a line */
- {
- if (strncmp(line, "[Bookmarks]", 11)==0){
- category = FS_CATEGORY_BOOKMARKS;
- } else if (strncmp(line, "[Recent]", 8)==0){
- category = FS_CATEGORY_RECENT;
- } else {
- int len = strlen(line);
- if (len>0) {
- if (line[len-1] == '\n') {
- line[len-1] = '\0';
- }
- if (BLI_exist(line)) {
- fsmenu_insert_entry(fsmenu, category, line, 0, 1);
- }
- }
- }
- }
- fclose(fp);
}
+
static void fsmenu_free_category(struct FSMenu* fsmenu, FSMenuCategory category)
{
FSMenuEntry *fsme= fsmenu_get_category(fsmenu, category);
diff --git a/source/blender/editors/space_file/fsmenu.h b/source/blender/editors/space_file/fsmenu.h
index 8304b104a4f..dcf8d3eb632 100644
--- a/source/blender/editors/space_file/fsmenu.h
+++ b/source/blender/editors/space_file/fsmenu.h
@@ -68,7 +68,10 @@ void fsmenu_remove_entry (struct FSMenu* fsmenu, FSMenuCategory category, int i
void fsmenu_write_file (struct FSMenu* fsmenu, const char *filename);
/** reads the 'bookmarks' from the specified file */
-void fsmenu_read_file (struct FSMenu* fsmenu, const char *filename);
+void fsmenu_read_bookmarks (struct FSMenu* fsmenu, const char *filename);
+
+ /** adds system specific directories */
+void fsmenu_read_system (struct FSMenu* fsmenu);
/** Free's all the memory associated with the fsmenu */
void fsmenu_free (struct FSMenu* fsmenu);
diff --git a/source/blender/editors/space_file/space_file.c b/source/blender/editors/space_file/space_file.c
index 300a72851a4..261b7058151 100644
--- a/source/blender/editors/space_file/space_file.c
+++ b/source/blender/editors/space_file/space_file.c
@@ -591,9 +591,16 @@ void ED_spacetype_file(void)
void ED_file_init(void)
{
- char name[FILE_MAX];
- BLI_make_file_string("/", name, BLI_gethome(), ".Bfs");
- fsmenu_read_file(fsmenu_get(), name);
+ char *cfgdir = BLI_get_folder(BLENDER_CONFIG, NULL);
+
+ fsmenu_read_system(fsmenu_get());
+
+ if (cfgdir) {
+ char name[FILE_MAX];
+ BLI_make_file_string("/", name, cfgdir, BLENDER_BOOKMARK_FILE);
+ fsmenu_read_bookmarks(fsmenu_get(), name);
+ }
+
filelist_init_icons();
IMB_thumb_makedirs();
}
diff --git a/source/blender/editors/space_graph/graph_edit.c b/source/blender/editors/space_graph/graph_edit.c
index 6834dfac58a..6249edc1090 100644
--- a/source/blender/editors/space_graph/graph_edit.c
+++ b/source/blender/editors/space_graph/graph_edit.c
@@ -1117,7 +1117,7 @@ void GRAPH_OT_sound_bake (wmOperatorType *ot)
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
/* properties */
- WM_operator_properties_filesel(ot, FOLDERFILE|SOUNDFILE|MOVIEFILE, FILE_SPECIAL, FILE_OPENFILE, 0);
+ WM_operator_properties_filesel(ot, FOLDERFILE|SOUNDFILE|MOVIEFILE, FILE_SPECIAL, FILE_OPENFILE, WM_FILESEL_FILEPATH);
RNA_def_float(ot->srna, "low", 0.0f, 0.0, 100000.0, "Lowest frequency", "", 0.1, 1000.00);
RNA_def_float(ot->srna, "high", 100000.0, 0.0, 100000.0, "Highest frequency", "", 0.1, 1000.00);
RNA_def_float(ot->srna, "attack", 0.005, 0.0, 2.0, "Attack time", "", 0.01, 0.1);
@@ -1582,6 +1582,7 @@ static int graphkeys_framejump_exec(bContext *C, wmOperator *op)
/* take the average values, rounding to the nearest int for the current frame */
CFRA= (int)floor((ked.f1 / ked.i1) + 0.5f);
+ SUBFRA= 0.f;
sipo->cursorVal= ked.f2 / (float)ked.i1;
}
diff --git a/source/blender/editors/space_graph/graph_ops.c b/source/blender/editors/space_graph/graph_ops.c
index c6d601f9305..fa9acb282c7 100644
--- a/source/blender/editors/space_graph/graph_ops.c
+++ b/source/blender/editors/space_graph/graph_ops.c
@@ -71,6 +71,7 @@ static void graphview_cursor_apply(bContext *C, wmOperator *op)
* NOTE: sync this part of the code with ANIM_OT_change_frame
*/
CFRA= RNA_int_get(op->ptr, "frame");
+ SUBFRA=0.f;
sound_seek_scene(C);
/* set the cursor value */
diff --git a/source/blender/editors/space_image/SConscript b/source/blender/editors/space_image/SConscript
index b38e1473a0c..4e1918bc327 100644
--- a/source/blender/editors/space_image/SConscript
+++ b/source/blender/editors/space_image/SConscript
@@ -11,6 +11,7 @@ defs = []
if env['WITH_BF_LCMS']:
defs.append('WITH_LCMS')
+ incs += ' ' + env['BF_LCMS_INC']
if env['WITH_BF_OPENEXR']:
defs.append('WITH_OPENEXR')
if env['WITH_BF_TIFF']:
diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c
index f84fd6fc430..3e269634b27 100644
--- a/source/blender/editors/space_image/image_ops.c
+++ b/source/blender/editors/space_image/image_ops.c
@@ -28,6 +28,7 @@
#include <stddef.h>
#include <string.h>
#include <stdlib.h>
+#include <errno.h>
#include "MEM_guardedalloc.h"
@@ -688,10 +689,14 @@ static int open_exec(bContext *C, wmOperator *op)
RNA_string_get(op->ptr, "filepath", str);
/* default to frame 1 if there's no scene in context */
+
+ errno= 0;
+
ima= BKE_add_image_file(str, scene ? scene->r.cfra : 1);
if(!ima) {
if(op->customdata) MEM_freeN(op->customdata);
+ BKE_reportf(op->reports, RPT_ERROR, "Can't read: \"%s\", %s.", str, errno ? strerror(errno) : "Unsupported image format");
return OPERATOR_CANCELLED;
}
@@ -755,7 +760,7 @@ void IMAGE_OT_open(wmOperatorType *ot)
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
/* properties */
- WM_operator_properties_filesel(ot, FOLDERFILE|IMAGEFILE|MOVIEFILE, FILE_SPECIAL, FILE_OPENFILE, FILE_RELPATH);
+ WM_operator_properties_filesel(ot, FOLDERFILE|IMAGEFILE|MOVIEFILE, FILE_SPECIAL, FILE_OPENFILE, WM_FILESEL_FILEPATH|WM_FILESEL_RELPATH);
}
/******************** replace image operator ********************/
@@ -810,7 +815,7 @@ void IMAGE_OT_replace(wmOperatorType *ot)
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
/* properties */
- WM_operator_properties_filesel(ot, FOLDERFILE|IMAGEFILE|MOVIEFILE, FILE_SPECIAL, FILE_OPENFILE, FILE_RELPATH);
+ WM_operator_properties_filesel(ot, FOLDERFILE|IMAGEFILE|MOVIEFILE, FILE_SPECIAL, FILE_OPENFILE, WM_FILESEL_FILEPATH|WM_FILESEL_RELPATH);
}
/******************** save image as operator ********************/
@@ -998,7 +1003,7 @@ void IMAGE_OT_save_as(wmOperatorType *ot)
/* properties */
RNA_def_enum(ot->srna, "file_type", image_file_type_items, R_PNG, "File Type", "File type to save image as.");
- WM_operator_properties_filesel(ot, FOLDERFILE|IMAGEFILE|MOVIEFILE, FILE_SPECIAL, FILE_SAVE, FILE_RELPATH);
+ WM_operator_properties_filesel(ot, FOLDERFILE|IMAGEFILE|MOVIEFILE, FILE_SPECIAL, FILE_SAVE, WM_FILESEL_FILEPATH|WM_FILESEL_RELPATH);
RNA_def_boolean(ot->srna, "copy", 0, "Copy", "Create a new image file without modifying the current image in blender");
}
@@ -1182,7 +1187,7 @@ static int new_exec(bContext *C, wmOperator *op)
PropertyRNA *prop;
char name[22];
float color[4];
- int width, height, floatbuf, uvtestgrid;
+ int width, height, floatbuf, uvtestgrid, alpha;
/* retrieve state */
sima= CTX_wm_space_image(C);
@@ -1195,12 +1200,15 @@ static int new_exec(bContext *C, wmOperator *op)
floatbuf= RNA_boolean_get(op->ptr, "float");
uvtestgrid= RNA_boolean_get(op->ptr, "uv_test_grid");
RNA_float_get_array(op->ptr, "color", color);
- color[3]= RNA_float_get(op->ptr, "alpha");
+ alpha= RNA_boolean_get(op->ptr, "alpha");
if (!floatbuf && scene->r.color_mgt_flag & R_COLOR_MANAGEMENT)
linearrgb_to_srgb_v3_v3(color, color);
- ima = BKE_add_image_size(width, height, name, floatbuf, uvtestgrid, color);
+ if(!alpha)
+ color[3]= 1.0f;
+
+ ima = BKE_add_image_size(width, height, name, alpha ? 32 : 24, floatbuf, uvtestgrid, color);
if(!ima)
return OPERATOR_CANCELLED;
@@ -1228,6 +1236,9 @@ static int new_exec(bContext *C, wmOperator *op)
void IMAGE_OT_new(wmOperatorType *ot)
{
+ PropertyRNA *prop;
+ float default_color[4]= {0.0f, 0.0f, 0.0f, 1.0f};
+
/* identifiers */
ot->name= "New";
ot->idname= "IMAGE_OT_new";
@@ -1243,8 +1254,9 @@ void IMAGE_OT_new(wmOperatorType *ot)
RNA_def_string(ot->srna, "name", "Untitled", 21, "Name", "Image datablock name.");
RNA_def_int(ot->srna, "width", 1024, 1, INT_MAX, "Width", "Image width.", 1, 16384);
RNA_def_int(ot->srna, "height", 1024, 1, INT_MAX, "Height", "Image height.", 1, 16384);
- RNA_def_float_color(ot->srna, "color", 3, NULL, 0.0f, FLT_MAX, "Color", "Default fill color.", 0.0f, 1.0f);
- RNA_def_float(ot->srna, "alpha", 1.0f, 0.0f, 1.0f, "Alpha", "Default fill alpha.", 0.0f, 1.0f);
+ prop= RNA_def_float_color(ot->srna, "color", 4, NULL, 0.0f, FLT_MAX, "Color", "Default fill color.", 0.0f, 1.0f);
+ RNA_def_property_float_array_default(prop, default_color);
+ RNA_def_boolean(ot->srna, "alpha", 1, "Alpha", "Create an image with an alpha channel.");
RNA_def_boolean(ot->srna, "uv_test_grid", 0, "UV Test Grid", "Fill the image with a grid for UV map testing.");
RNA_def_boolean(ot->srna, "float", 0, "32 bit Float", "Create image with 32 bit floating point bit depth.");
}
diff --git a/source/blender/editors/space_info/info_ops.c b/source/blender/editors/space_info/info_ops.c
index 2a1a20aa0d7..62e82f83e58 100644
--- a/source/blender/editors/space_info/info_ops.c
+++ b/source/blender/editors/space_info/info_ops.c
@@ -299,7 +299,7 @@ void FILE_OT_find_missing_files(wmOperatorType *ot)
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
/* properties */
- WM_operator_properties_filesel(ot, 0, FILE_SPECIAL, FILE_OPENFILE, 0);
+ WM_operator_properties_filesel(ot, 0, FILE_SPECIAL, FILE_OPENFILE, WM_FILESEL_FILEPATH);
}
/********************* report box operator *********************/
diff --git a/source/blender/editors/space_info/space_info.c b/source/blender/editors/space_info/space_info.c
index 0d9f1c90489..0f483f4bcec 100644
--- a/source/blender/editors/space_info/space_info.c
+++ b/source/blender/editors/space_info/space_info.c
@@ -38,6 +38,7 @@
#include "BKE_context.h"
#include "BKE_colortools.h"
+#include "BKE_global.h"
#include "BKE_screen.h"
#include "BKE_utildefines.h"
@@ -49,7 +50,7 @@
#include "WM_types.h"
#include "UI_resources.h"
-
+#include "UI_interface.h"
#include "info_intern.h" // own include
@@ -179,6 +180,31 @@ static void info_header_listener(ARegion *ar, wmNotifier *wmn)
}
+static void recent_files_menu(const bContext *C, Menu *menu)
+{
+ struct RecentFile *recent;
+ uiLayout *layout= menu->layout;
+ uiLayoutSetOperatorContext(layout, WM_OP_EXEC_REGION_WIN);
+ if (G.recent_files.first) {
+ for(recent = G.recent_files.first; (recent); recent = recent->next) {
+ uiItemStringO(layout, BLI_path_basename(recent->filepath), ICON_FILE_BLEND, "WM_OT_open_mainfile", "filepath", recent->filepath);
+ }
+ } else {
+ uiItemL(layout, "No Recent Files", 0);
+ }
+}
+
+void recent_files_menu_register()
+{
+ MenuType *mt;
+
+ mt= MEM_callocN(sizeof(MenuType), "spacetype info menu recent files");
+ strcpy(mt->idname, "INFO_MT_file_open_recent");
+ strcpy(mt->label, "Open Recent...");
+ mt->draw= recent_files_menu;
+ WM_menutype_add(mt);
+}
+
/* only called once, from space/spacetypes.c */
void ED_spacetype_info(void)
{
@@ -217,7 +243,8 @@ void ED_spacetype_info(void)
BLI_addhead(&st->regiontypes, art);
-
+ recent_files_menu_register();
+
BKE_spacetype_register(st);
}
diff --git a/source/blender/editors/space_logic/logic_window.c b/source/blender/editors/space_logic/logic_window.c
index 409277cb66e..26b4b6fc08c 100644
--- a/source/blender/editors/space_logic/logic_window.c
+++ b/source/blender/editors/space_logic/logic_window.c
@@ -3184,8 +3184,8 @@ static void draw_sensor_header(uiLayout *layout, PointerRNA *ptr, PointerRNA *lo
uiItemR(row, ptr, "name", 0, "", 0);
subrow= uiLayoutRow(row, 0);
- uiLayoutSetActive(subrow, (RNA_boolean_get(logic_ptr, "sensors_show_active_states")
- && RNA_boolean_get(ptr, "expanded") || RNA_boolean_get(ptr, "pinned")));
+ uiLayoutSetActive(subrow, ((RNA_boolean_get(logic_ptr, "sensors_show_active_states")
+ && RNA_boolean_get(ptr, "expanded")) || RNA_boolean_get(ptr, "pinned")));
uiItemR(subrow, ptr, "pinned", UI_ITEM_R_NO_BG, "", 0);
uiItemO(row, "", ICON_X, "LOGIC_OT_sensor_remove");
@@ -3602,8 +3602,8 @@ static void draw_actuator_header(uiLayout *layout, PointerRNA *ptr, PointerRNA *
uiItemR(row, ptr, "name", 0, "", 0);
subrow= uiLayoutRow(row, 0);
- uiLayoutSetActive(subrow, (RNA_boolean_get(logic_ptr, "actuators_show_active_states")
- && RNA_boolean_get(ptr, "expanded") || RNA_boolean_get(ptr, "pinned")));
+ uiLayoutSetActive(subrow, ((RNA_boolean_get(logic_ptr, "actuators_show_active_states")
+ && RNA_boolean_get(ptr, "expanded")) || RNA_boolean_get(ptr, "pinned")));
uiItemR(subrow, ptr, "pinned", UI_ITEM_R_NO_BG, "", 0);
uiItemO(row, "", ICON_X, "LOGIC_OT_actuator_remove");
@@ -4436,7 +4436,7 @@ static void logic_buttons_new(bContext *C, ARegion *ar)
bController *cont;
PointerRNA ptr;
uiLayout *split, *subsplit, *col;
- int iact;
+
ob= (Object *)idar[a];
diff --git a/source/blender/editors/space_node/drawnode.c b/source/blender/editors/space_node/drawnode.c
index 629b1008aa0..2d111b731ad 100644
--- a/source/blender/editors/space_node/drawnode.c
+++ b/source/blender/editors/space_node/drawnode.c
@@ -107,7 +107,7 @@ static void node_buts_rgb(uiLayout *layout, bContext *C, PointerRNA *ptr)
RNA_property_collection_lookup_int(ptr, prop, 0, &sockptr);
col = uiLayoutColumn(layout, 0);
- uiTemplateColorWheel(col, &sockptr, "default_value", 1, 0);
+ uiTemplateColorWheel(col, &sockptr, "default_value", 1, 0, 0, 0);
uiItemR(col, &sockptr, "default_value", 0, "", 0);
}
@@ -947,17 +947,17 @@ static void node_composit_buts_colorbalance(uiLayout *layout, bContext *C, Point
split = uiLayoutSplit(layout, 0, 0);
col = uiLayoutColumn(split, 0);
- uiTemplateColorWheel(col, ptr, "lift", 1, 1);
+ uiTemplateColorWheel(col, ptr, "lift", 1, 1, 0, 1);
row = uiLayoutRow(col, 0);
uiItemR(row, ptr, "lift", 0, NULL, 0);
col = uiLayoutColumn(split, 0);
- uiTemplateColorWheel(col, ptr, "gamma", 1, 1);
+ uiTemplateColorWheel(col, ptr, "gamma", 1, 1, 1, 1);
row = uiLayoutRow(col, 0);
uiItemR(row, ptr, "gamma", 0, NULL, 0);
col = uiLayoutColumn(split, 0);
- uiTemplateColorWheel(col, ptr, "gain", 1, 1);
+ uiTemplateColorWheel(col, ptr, "gain", 1, 1, 1, 1);
row = uiLayoutRow(col, 0);
uiItemR(row, ptr, "gain", 0, NULL, 0);
@@ -965,17 +965,17 @@ static void node_composit_buts_colorbalance(uiLayout *layout, bContext *C, Point
split = uiLayoutSplit(layout, 0, 0);
col = uiLayoutColumn(split, 0);
- uiTemplateColorWheel(col, ptr, "offset", 1, 1);
+ uiTemplateColorWheel(col, ptr, "offset", 1, 1, 0, 1);
row = uiLayoutRow(col, 0);
uiItemR(row, ptr, "offset", 0, NULL, 0);
col = uiLayoutColumn(split, 0);
- uiTemplateColorWheel(col, ptr, "power", 1, 1);
+ uiTemplateColorWheel(col, ptr, "power", 1, 1, 0, 1);
row = uiLayoutRow(col, 0);
uiItemR(row, ptr, "power", 0, NULL, 0);
col = uiLayoutColumn(split, 0);
- uiTemplateColorWheel(col, ptr, "slope", 1, 1);
+ uiTemplateColorWheel(col, ptr, "slope", 1, 1, 0, 1);
row = uiLayoutRow(col, 0);
uiItemR(row, ptr, "slope", 0, NULL, 0);
}
diff --git a/source/blender/editors/space_node/node_edit.c b/source/blender/editors/space_node/node_edit.c
index dd838a67afa..cea88c33c5b 100644
--- a/source/blender/editors/space_node/node_edit.c
+++ b/source/blender/editors/space_node/node_edit.c
@@ -31,6 +31,7 @@
#include <stdlib.h>
#include <math.h>
#include <string.h>
+#include <errno.h>
#include "MEM_guardedalloc.h"
@@ -65,6 +66,7 @@
#include "ED_node.h"
#include "ED_screen.h"
+#include "ED_render.h"
#include "RNA_access.h"
#include "RNA_define.h"
@@ -548,6 +550,8 @@ static int node_group_edit_exec(bContext *C, wmOperator *op)
SpaceNode *snode = CTX_wm_space_node(C);
bNode *gnode;
+ ED_preview_kill_jobs(C);
+
gnode= nodeGetActive(snode->edittree);
snode_make_group_editable(snode, gnode);
@@ -593,6 +597,8 @@ static int node_group_ungroup_exec(bContext *C, wmOperator *op)
SpaceNode *snode = CTX_wm_space_node(C);
bNode *gnode;
+ ED_preview_kill_jobs(C);
+
/* are we inside of a group? */
gnode= node_tree_get_editgroup(snode->nodetree);
if(gnode)
@@ -1098,13 +1104,16 @@ static int node_active_link_viewer(bContext *C, wmOperator *op)
SpaceNode *snode= CTX_wm_space_node(C);
bNode *node;
-
node= editnode_get_active(snode->edittree);
- if(node) {
- node_link_viewer(snode, node);
- snode_notify(C, snode);
- }
+ if(!node)
+ return OPERATOR_CANCELLED;
+
+ ED_preview_kill_jobs(C);
+
+ node_link_viewer(snode, node);
+ snode_notify(C, snode);
+
return OPERATOR_FINISHED;
}
@@ -1466,6 +1475,8 @@ static int node_duplicate_exec(bContext *C, wmOperator *op)
{
SpaceNode *snode= CTX_wm_space_node(C);
+ ED_preview_kill_jobs(C);
+
ntreeCopyTree(snode->edittree, 1); /* 1 == internally selected nodes */
ntreeSolveOrder(snode->edittree);
@@ -1624,7 +1635,7 @@ static int node_link_modal(bContext *C, wmOperator *op, wmEvent *event)
static int node_link_init(SpaceNode *snode, NodeLinkDrag *nldrag)
{
bNodeLink *link;
-
+
/* output indicated? */
if(find_indicated_socket(snode, &nldrag->node, &nldrag->sock, SOCK_OUT)) {
if(nodeCountSocketLinks(snode->edittree, nldrag->sock) < nldrag->sock->limit)
@@ -1678,6 +1689,8 @@ static int node_link_invoke(bContext *C, wmOperator *op, wmEvent *event)
UI_view2d_region_to_view(&ar->v2d, event->x - ar->winrct.xmin, event->y - ar->winrct.ymin,
&snode->mx, &snode->my);
+ ED_preview_kill_jobs(C);
+
nldrag->in_out= node_link_init(snode, nldrag);
if(nldrag->in_out) {
@@ -1724,6 +1737,8 @@ static int node_make_link_exec(bContext *C, wmOperator *op)
SpaceNode *snode= CTX_wm_space_node(C);
int replace = RNA_boolean_get(op->ptr, "replace");
+ ED_preview_kill_jobs(C);
+
snode_autoconnect(snode, 0, replace);
node_tree_verify_groups(snode->nodetree);
@@ -1787,6 +1802,8 @@ static int cut_links_exec(bContext *C, wmOperator *op)
if(i>1) {
bNodeLink *link, *next;
+
+ ED_preview_kill_jobs(C);
for(link= snode->edittree->links.first; link; link= next) {
next= link->next;
@@ -1839,6 +1856,8 @@ static int node_read_renderlayers_exec(bContext *C, wmOperator *op)
Scene *curscene= CTX_data_scene(C), *scene;
bNode *node;
+ ED_preview_kill_jobs(C);
+
/* first tag scenes unread */
for(scene= G.main->scene.first; scene; scene= scene->id.next)
scene->id.flag |= LIB_DOIT;
@@ -1955,6 +1974,8 @@ static int node_group_make_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
}
}
+
+ ED_preview_kill_jobs(C);
gnode= nodeMakeGroupFromSelected(snode->nodetree);
if(gnode==NULL) {
@@ -2057,6 +2078,8 @@ static int node_preview_exec(bContext *C, wmOperator *op)
if((snode == NULL) || (snode->edittree == NULL))
return OPERATOR_CANCELLED;
+ ED_preview_kill_jobs(C);
+
node_flag_toggle_exec(snode, NODE_PREVIEW);
snode_notify(C, snode);
@@ -2089,6 +2112,8 @@ static int node_socket_toggle_exec(bContext *C, wmOperator *op)
if((snode == NULL) || (snode->edittree == NULL))
return OPERATOR_CANCELLED;
+ ED_preview_kill_jobs(C);
+
for(node= snode->edittree->nodes.first; node; node= node->next) {
if(node->flag & SELECT) {
if(node_has_hidden_sockets(node)) {
@@ -2137,6 +2162,8 @@ static int node_mute_exec(bContext *C, wmOperator *op)
if(node_tree_get_editgroup(snode->nodetree))
return OPERATOR_CANCELLED;
+ ED_preview_kill_jobs(C);
+
for(node= snode->edittree->nodes.first; node; node= node->next) {
if(node->flag & SELECT) {
if(node->inputs.first && node->outputs.first) {
@@ -2173,6 +2200,8 @@ static int node_delete_exec(bContext *C, wmOperator *op)
SpaceNode *snode= CTX_wm_space_node(C);
bNode *node, *next;
+ ED_preview_kill_jobs(C);
+
for(node= snode->edittree->nodes.first; node; node= next) {
next= node->next;
if(node->flag & SELECT) {
@@ -2248,25 +2277,34 @@ static int node_add_file_exec(bContext *C, wmOperator *op)
{
char path[FILE_MAX];
RNA_string_get(op->ptr, "filepath", path);
+
+ errno= 0;
+
ima= BKE_add_image_file(path, scene ? scene->r.cfra : 1);
+
+ if(!ima) {
+ BKE_reportf(op->reports, RPT_ERROR, "Can't read: \"%s\", %s.", path, errno ? strerror(errno) : "Unsupported image format");
+ return OPERATOR_CANCELLED;
+ }
}
else if(RNA_property_is_set(op->ptr, "name"))
{
char name[32];
RNA_string_get(op->ptr, "name", name);
ima= (Image *)find_id("IM", name);
+
+ if(!ima) {
+ BKE_reportf(op->reports, RPT_ERROR, "Image named \"%s\", not found.", name);
+ return OPERATOR_CANCELLED;
+ }
}
- if(!ima) {
- BKE_report(op->reports, RPT_ERROR, "Not an Image.");
- return OPERATOR_CANCELLED;
- }
-
-
node_deselectall(snode);
if (snode->nodetree->type==NTREE_COMPOSIT)
ntype = CMP_NODE_IMAGE;
+
+ ED_preview_kill_jobs(C);
node = node_add_node(snode, scene, ntype, snode->mx, snode->my);
@@ -2312,7 +2350,7 @@ void NODE_OT_add_file(wmOperatorType *ot)
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
- WM_operator_properties_filesel(ot, FOLDERFILE|IMAGEFILE, FILE_SPECIAL, FILE_OPENFILE, 0); //XXX TODO, relative_path
+ WM_operator_properties_filesel(ot, FOLDERFILE|IMAGEFILE, FILE_SPECIAL, FILE_OPENFILE, WM_FILESEL_FILEPATH); //XXX TODO, relative_path
RNA_def_string(ot->srna, "name", "Image", 24, "Name", "Datablock name to assign.");
}
diff --git a/source/blender/editors/space_sequencer/sequencer_add.c b/source/blender/editors/space_sequencer/sequencer_add.c
index 1a56cb6d683..36ae475e64b 100644
--- a/source/blender/editors/space_sequencer/sequencer_add.c
+++ b/source/blender/editors/space_sequencer/sequencer_add.c
@@ -86,8 +86,6 @@
static void sequencer_generic_props__internal(wmOperatorType *ot, int flag)
{
- RNA_def_string(ot->srna, "name", "", MAX_ID_NAME-2, "Name", "Name of the new sequence strip");
-
if(flag & SEQPROP_STARTFRAME)
RNA_def_int(ot->srna, "frame_start", 0, INT_MIN, INT_MAX, "Start Frame", "Start frame of the sequence strip", INT_MIN, INT_MAX);
@@ -102,6 +100,20 @@ static void sequencer_generic_props__internal(wmOperatorType *ot, int flag)
RNA_def_collection_runtime(ot->srna, "files", &RNA_OperatorFileListElement, "Files", "");
}
+static void sequencer_generic_invoke_path__internal(bContext *C, wmOperator *op, const char *identifier)
+{
+ if(RNA_struct_find_property(op->ptr, identifier)) {
+ Scene *scene= CTX_data_scene(C);
+ Sequence *last_seq= seq_active_get(scene);
+ if(last_seq && last_seq->strip && SEQ_HAS_PATH(last_seq)) {
+ char path[sizeof(last_seq->strip->dir)];
+ BLI_strncpy(path, last_seq->strip->dir, sizeof(path));
+ BLI_path_abs(path, G.sce);
+ RNA_string_set(op->ptr, identifier, path);
+ }
+ }
+}
+
static void sequencer_generic_invoke_xy__internal(bContext *C, wmOperator *op, wmEvent *event, int flag)
{
ARegion *ar= CTX_wm_region(C);
@@ -121,11 +133,14 @@ static void sequencer_generic_invoke_xy__internal(bContext *C, wmOperator *op, w
if ((flag & SEQPROP_ENDFRAME) && RNA_property_is_set(op->ptr, "frame_end")==0)
RNA_int_set(op->ptr, "frame_end", (int)mval_v2d[0] + 25); // XXX arbitary but ok for now.
-
+
+ sequencer_generic_invoke_path__internal(C, op, "filepath");
+ sequencer_generic_invoke_path__internal(C, op, "directory");
}
static void seq_load_operator_info(SeqLoadInfo *seq_load, wmOperator *op)
{
+ int is_file= -1;
memset(seq_load, 0, sizeof(SeqLoadInfo));
seq_load->start_frame= RNA_int_get(op->ptr, "frame_start");
@@ -134,9 +149,13 @@ static void seq_load_operator_info(SeqLoadInfo *seq_load, wmOperator *op)
seq_load->channel= RNA_int_get(op->ptr, "channel");
seq_load->len= 1; // images only, if endframe isnt set!
- RNA_string_get(op->ptr, "name", seq_load->name+2);
-
- RNA_string_get(op->ptr, "filepath", seq_load->path); /* full path, file is set by the caller */
+ if(RNA_struct_find_property(op->ptr, "filepath")) {
+ RNA_string_get(op->ptr, "filepath", seq_load->path); /* full path, file is set by the caller */
+ is_file= 1;
+ } else if (RNA_struct_find_property(op->ptr, "directory")) {
+ RNA_string_get(op->ptr, "directory", seq_load->path); /* full path, file is set by the caller */
+ is_file= 0;
+ }
if (RNA_struct_find_property(op->ptr, "frame_end")) {
seq_load->end_frame = RNA_int_get(op->ptr, "frame_end");
@@ -153,6 +172,20 @@ static void seq_load_operator_info(SeqLoadInfo *seq_load, wmOperator *op)
/* always use this for ops */
seq_load->flag |= SEQ_LOAD_FRAME_ADVANCE;
+
+
+ if(is_file==1) {
+ BLI_strncpy(seq_load->name, BLI_path_basename(seq_load->path), sizeof(seq_load->name));
+ }
+ else if(RNA_struct_find_property(op->ptr, "files")) {
+ /* used for image strip */
+ /* best guess, first images name */
+ RNA_BEGIN(op->ptr, itemptr, "files") {
+ RNA_string_get(&itemptr, "name", seq_load->name);
+ break;
+ }
+ RNA_END;
+ }
}
/* add scene operator */
@@ -180,8 +213,9 @@ static int sequencer_add_scene_strip_exec(bContext *C, wmOperator *op)
}
seq = alloc_sequence(ed->seqbasep, start_frame, channel);
-
seq->type= SEQ_SCENE;
+ seq->blend_mode= SEQ_CROSS; /* so alpha adjustment fade to the strip below */
+
seq->scene= sce_seq;
seq->sfra= sce_seq->r.sfra;
@@ -192,11 +226,9 @@ static int sequencer_add_scene_strip_exec(bContext *C, wmOperator *op)
strip->stripdata= se= MEM_callocN(seq->len*sizeof(StripElem), "stripelem");
- if(RNA_property_is_set(op->ptr, "name"))
- RNA_string_get(op->ptr, "name", seq->name+2);
- else
- strcpy(seq->name+2, sce_seq->id.name+2);
-
+ strcpy(seq->name+2, sce_seq->id.name+2);
+ seqbase_unique_name_recursive(&ed->seqbase, seq);
+
seq->scene_sound = sound_scene_add_scene_sound(scene, seq, start_frame, start_frame + strip->len, 0);
calc_sequence_disp(scene, seq);
@@ -318,7 +350,10 @@ static int sequencer_add_movie_strip_invoke(bContext *C, wmOperator *op, wmEvent
RNA_boolean_set(op->ptr, "relative_path", U.flag & USER_RELPATHS);
sequencer_generic_invoke_xy__internal(C, op, event, 0);
- return WM_operator_filesel(C, op, event);
+
+ WM_event_add_fileselect(C, op);
+ return OPERATOR_RUNNING_MODAL;
+
//return sequencer_add_movie_strip_exec(C, op);
}
@@ -340,7 +375,7 @@ void SEQUENCER_OT_movie_strip_add(struct wmOperatorType *ot)
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
- WM_operator_properties_filesel(ot, FOLDERFILE|MOVIEFILE, FILE_SPECIAL, FILE_OPENFILE, FILE_RELPATH);
+ WM_operator_properties_filesel(ot, FOLDERFILE|MOVIEFILE, FILE_SPECIAL, FILE_OPENFILE, WM_FILESEL_FILEPATH|WM_FILESEL_RELPATH);
sequencer_generic_props__internal(ot, SEQPROP_STARTFRAME|SEQPROP_FILES);
RNA_def_boolean(ot->srna, "sound", TRUE, "Sound", "Load sound with the movie");
}
@@ -363,7 +398,10 @@ static int sequencer_add_sound_strip_invoke(bContext *C, wmOperator *op, wmEvent
RNA_boolean_set(op->ptr, "relative_path", U.flag & USER_RELPATHS);
sequencer_generic_invoke_xy__internal(C, op, event, 0);
- return WM_operator_filesel(C, op, event);
+
+ WM_event_add_fileselect(C, op);
+ return OPERATOR_RUNNING_MODAL;
+
//return sequencer_add_sound_strip_exec(C, op);
}
@@ -385,7 +423,7 @@ void SEQUENCER_OT_sound_strip_add(struct wmOperatorType *ot)
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
- WM_operator_properties_filesel(ot, FOLDERFILE|SOUNDFILE, FILE_SPECIAL, FILE_OPENFILE, FILE_RELPATH);
+ WM_operator_properties_filesel(ot, FOLDERFILE|SOUNDFILE, FILE_SPECIAL, FILE_OPENFILE, WM_FILESEL_FILEPATH|WM_FILESEL_RELPATH);
sequencer_generic_props__internal(ot, SEQPROP_STARTFRAME|SEQPROP_FILES);
RNA_def_boolean(ot->srna, "cache", FALSE, "Cache", "Cache the sound in memory.");
}
@@ -409,26 +447,24 @@ static int sequencer_add_image_strip_exec(bContext *C, wmOperator *op)
seq_load.len= RNA_property_collection_length(op->ptr, RNA_struct_find_property(op->ptr, "files"));
if(seq_load.len==0)
- seq_load.len= 1;
+ return OPERATOR_CANCELLED;
if(seq_load.flag & SEQ_LOAD_REPLACE_SEL)
deselect_all_seq(scene);
-
+
/* main adding function */
seq= sequencer_add_image_strip(C, ed->seqbasep, &seq_load);
strip= seq->strip;
se= strip->stripdata;
- if(seq_load.len > 1) {
- RNA_BEGIN(op->ptr, itemptr, "files") {
- RNA_string_get(&itemptr, "name", se->name);
- se++;
- }
- RNA_END;
+ RNA_BEGIN(op->ptr, itemptr, "files") {
+ RNA_string_get(&itemptr, "name", se->name);
+ se++;
}
- else {
- BLI_strncpy(se->name, BLI_path_basename(seq_load.path), sizeof(se->name));
+ RNA_END;
+
+ if(seq_load.len == 1) {
if(seq_load.start_frame < seq_load.end_frame) {
seq->endstill= seq_load.end_frame - seq_load.start_frame;
}
@@ -457,7 +493,10 @@ static int sequencer_add_image_strip_invoke(bContext *C, wmOperator *op, wmEvent
RNA_boolean_set(op->ptr, "relative_path", U.flag & USER_RELPATHS);
sequencer_generic_invoke_xy__internal(C, op, event, SEQPROP_ENDFRAME);
- return WM_operator_filesel(C, op, event);
+
+ WM_event_add_fileselect(C, op);
+ return OPERATOR_RUNNING_MODAL;
+
//return sequencer_add_image_strip_exec(C, op);
}
@@ -479,7 +518,7 @@ void SEQUENCER_OT_image_strip_add(struct wmOperatorType *ot)
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
- WM_operator_properties_filesel(ot, FOLDERFILE|IMAGEFILE, FILE_SPECIAL, FILE_OPENFILE, FILE_RELPATH);
+ WM_operator_properties_filesel(ot, FOLDERFILE|IMAGEFILE, FILE_SPECIAL, FILE_OPENFILE, WM_FILESEL_DIRECTORY|WM_FILESEL_RELPATH);
sequencer_generic_props__internal(ot, SEQPROP_STARTFRAME|SEQPROP_ENDFRAME|SEQPROP_FILES);
}
@@ -506,7 +545,7 @@ static int sequencer_add_effect_strip_exec(bContext *C, wmOperator *op)
type= RNA_enum_get(op->ptr, "type");
- // XXX We need unique names and move to invoke
+ // XXX move to invoke
if(!seq_effect_find_selected(scene, NULL, type, &seq1, &seq2, &seq3, &error_msg)) {
BKE_report(op->reports, RPT_ERROR, error_msg);
return OPERATOR_CANCELLED;
@@ -522,11 +561,7 @@ static int sequencer_add_effect_strip_exec(bContext *C, wmOperator *op)
seq = alloc_sequence(ed->seqbasep, start_frame, channel);
seq->type= type;
- if(RNA_property_is_set(op->ptr, "name"))
- RNA_string_get(op->ptr, "name", seq->name+2);
- else
- strcpy(seq->name+2, give_seqname(seq));
-
+ BLI_strncpy(seq->name+2, give_seqname(seq), sizeof(seq->name)-2);
seqbase_unique_name_recursive(&ed->seqbase, seq);
sh = get_sequence_effect(seq);
@@ -569,6 +604,18 @@ static int sequencer_add_effect_strip_exec(bContext *C, wmOperator *op)
else if (seq->type==SEQ_COLOR) {
SolidColorVars *colvars= (SolidColorVars *)seq->effectdata;
RNA_float_get_array(op->ptr, "color", colvars->col);
+ seq->blend_mode= SEQ_CROSS; /* so alpha adjustment fade to the strip below */
+
+ }
+
+ // XXX, this conflicts with giving a channel with invoke, perhaps we should have an active channel
+ // but for now this is much more usable
+ if(seq->seq1 || seq->seq2 || seq->seq3) {
+ int chan= MAX3( seq->seq1 ? seq->seq1->machine : 0,
+ seq->seq2 ? seq->seq2->machine : 0,
+ seq->seq3 ? seq->seq3->machine : 0);
+ if(chan < MAXSEQ)
+ seq->machine= chan;
}
if(seq_test_overlap(ed->seqbasep, seq)) shuffle_seq(ed->seqbasep, seq, scene);
@@ -631,7 +678,7 @@ void SEQUENCER_OT_effect_strip_add(struct wmOperatorType *ot)
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
- WM_operator_properties_filesel(ot, 0, FILE_SPECIAL, FILE_OPENFILE, FILE_RELPATH);
+ WM_operator_properties_filesel(ot, 0, FILE_SPECIAL, FILE_OPENFILE, WM_FILESEL_FILEPATH|WM_FILESEL_RELPATH);
sequencer_generic_props__internal(ot, SEQPROP_STARTFRAME|SEQPROP_ENDFRAME);
RNA_def_enum(ot->srna, "type", sequencer_prop_effect_types, SEQ_CROSS, "Type", "Sequencer effect type");
RNA_def_float_vector(ot->srna, "color", 3, NULL, 0.0f, 1.0f, "Color", "Initialize the strip with this color (only used when type='COLOR')", 0.0f, 1.0f);
diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c b/source/blender/editors/space_sequencer/sequencer_draw.c
index bf7f053ad71..e449490516c 100644
--- a/source/blender/editors/space_sequencer/sequencer_draw.c
+++ b/source/blender/editors/space_sequencer/sequencer_draw.c
@@ -200,46 +200,86 @@ static void drawseqwave(Sequence *seq, float x1, float y1, float x2, float y2, f
}
}
+static void drawmeta_stipple(int value)
+{
+ if(value) {
+ glEnable(GL_POLYGON_STIPPLE);
+ glPolygonStipple(stipple_halftone);
+
+ glEnable(GL_LINE_STIPPLE);
+ glLineStipple(1, 0x8888);
+ }
+ else {
+ glDisable(GL_POLYGON_STIPPLE);
+ glDisable(GL_LINE_STIPPLE);
+ }
+}
+
static void drawmeta_contents(Scene *scene, Sequence *seqm, float x1, float y1, float x2, float y2)
{
/* Note, this used to use WHILE_SEQ, but it messes up the seq->depth value, (needed by transform when doing overlap checks)
* so for now, just use the meta's immediate children, could be fixed but its only drawing - Campbell */
Sequence *seq;
- float dx;
- int nr;
- char col[3];
-
- nr= BLI_countlist(&seqm->seqbase);
+ char col[4];
- dx= (x2-x1)/nr;
+ int chan_min= MAXSEQ;
+ int chan_max= 0;
+ int chan_range= 0;
+ float draw_range= y2 - y1;
+ float draw_height;
- if (seqm->flag & SEQ_MUTE) {
- glEnable(GL_POLYGON_STIPPLE);
- glPolygonStipple(stipple_halftone);
-
- glEnable(GL_LINE_STIPPLE);
- glLineStipple(1, 0x8888);
+ glEnable(GL_BLEND);
+ glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+
+ if(seqm->flag & SEQ_MUTE)
+ drawmeta_stipple(1);
+
+ for (seq= seqm->seqbase.first; seq; seq= seq->next) {
+ chan_min= MIN2(chan_min, seq->machine);
+ chan_max= MAX2(chan_max, seq->machine);
}
-
+
+ chan_range= (chan_max - chan_min) + 1;
+ draw_height= draw_range / chan_range;
+
+ col[3]= 196; /* alpha, used for all meta children */
+
for (seq= seqm->seqbase.first; seq; seq= seq->next) {
- get_seq_color3ubv(scene, seq, col);
-
- glColor3ubv((GLubyte *)col);
+ if((seq->startdisp > x2 || seq->enddisp < x1) == 0) {
+ float y_chan= (seq->machine - chan_min) / (float)(chan_range) * draw_range;
+ float x1_chan= seq->startdisp;
+ float x2_chan= seq->enddisp;
+ float y1_chan, y2_chan;
- glRectf(x1, y1, x1+0.9*dx, y2);
-
- UI_GetColorPtrBlendShade3ubv(col, col, col, 0.0, -30);
- glColor3ubv((GLubyte *)col);
+ if((seqm->flag & SEQ_MUTE) == 0 && (seq->flag & SEQ_MUTE))
+ drawmeta_stipple(1);
- fdrawbox(x1, y1, x1+0.9*dx, y2);
-
- x1+= dx;
+ get_seq_color3ubv(scene, seq, col);
+
+ glColor4ubv((GLubyte *)col);
+
+ /* clamp within parent sequence strip bounds */
+ if(x1_chan < x1) x1_chan= x1;
+ if(x2_chan > x2) x2_chan= x2;
+
+ y1_chan= y1 + y_chan + (draw_height * SEQ_STRIP_OFSBOTTOM);
+ y2_chan= y1 + y_chan + (draw_height * SEQ_STRIP_OFSTOP);
+
+ glRectf(x1_chan, y1_chan, x2_chan, y2_chan);
+
+ UI_GetColorPtrBlendShade3ubv(col, col, col, 0.0, -30);
+ glColor4ubv((GLubyte *)col);
+ fdrawbox(x1_chan, y1_chan, x2_chan, y2_chan);
+
+ if((seqm->flag & SEQ_MUTE) == 0 && (seq->flag & SEQ_MUTE))
+ drawmeta_stipple(0);
+ }
}
+
+ if (seqm->flag & SEQ_MUTE)
+ drawmeta_stipple(0);
- if (seqm->flag & SEQ_MUTE) {
- glDisable(GL_POLYGON_STIPPLE);
- glDisable(GL_LINE_STIPPLE);
- }
+ glDisable(GL_BLEND);
}
/* draw a handle, for each end of a sequence strip */
@@ -619,13 +659,12 @@ static void draw_seq_strip(Scene *scene, ARegion *ar, SpaceSeq *sseq, Sequence *
glDisable(GL_LINE_STIPPLE);
}
+ if(seq->type==SEQ_META) drawmeta_contents(scene, seq, x1, y1, x2, y2);
+
/* calculate if seq is long enough to print a name */
x1= seq->startdisp+seq->handsize;
x2= seq->enddisp-seq->handsize;
- /* but first the contents of a meta */
- if(seq->type==SEQ_META) drawmeta_contents(scene, seq, x1, y1+0.15, x2, y2-0.15);
-
/* info text on the strip */
if(x1<v2d->cur.xmin) x1= v2d->cur.xmin;
else if(x1>v2d->cur.xmax) x1= v2d->cur.xmax;
diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c
index 6d225647a52..1592c2093c4 100644
--- a/source/blender/editors/space_sequencer/sequencer_edit.c
+++ b/source/blender/editors/space_sequencer/sequencer_edit.c
@@ -677,36 +677,6 @@ int seq_effect_find_selected(Scene *scene, Sequence *activeseq, int type, Sequen
return 1;
}
-void reassign_inputs_seq_effect(Scene *scene)
-{
- Editing *ed= seq_give_editing(scene, FALSE);
- Sequence *seq1, *seq2, *seq3, *last_seq = seq_active_get(scene);
- char *error_msg;
-
- if(last_seq==0 || !(last_seq->type & SEQ_EFFECT)) return;
- if(ed==NULL) return;
-
- if(!seq_effect_find_selected(scene, last_seq, last_seq->type, &seq1, &seq2, &seq3, &error_msg)) {
- //BKE_report(op->reports, RPT_ERROR, error_msg); // XXX operatorify
- return;
- }
- /* see reassigning would create a cycle */
- if( seq_is_predecessor(seq1, last_seq) ||
- seq_is_predecessor(seq2, last_seq) ||
- seq_is_predecessor(seq3, last_seq)
- ) {
- //BKE_report(op->reports, RPT_ERROR, "Can't reassign inputs: no cycles allowed"); // XXX operatorify
- return;
- }
-
- last_seq->seq1 = seq1;
- last_seq->seq2 = seq2;
- last_seq->seq3 = seq3;
-
- update_changed_seq_and_deps(scene, last_seq, 1, 1);
-
-}
-
static Sequence *del_seq_find_replace_recurs(Scene *scene, Sequence *seq)
{
Sequence *seq1, *seq2, *seq3;
@@ -761,7 +731,8 @@ static void recurs_del_seq_flag(Scene *scene, ListBase *lb, short flag, short de
BLI_remlink(lb, seq);
if(seq==last_seq) seq_active_set(scene, NULL);
if(seq->type==SEQ_META) recurs_del_seq_flag(scene, &seq->seqbase, flag, 1);
- if(seq->ipo) seq->ipo->id.us--;
+ /* if(seq->ipo) seq->ipo->id.us--; */
+ /* XXX, remove fcurve */
seq_free_sequence(scene, seq);
}
seq= seqn;
@@ -1457,6 +1428,67 @@ void SEQUENCER_OT_refresh_all(struct wmOperatorType *ot)
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
}
+static int sequencer_reassign_inputs_exec(bContext *C, wmOperator *op)
+{
+ Scene *scene= CTX_data_scene(C);
+ Sequence *seq1, *seq2, *seq3, *last_seq = seq_active_get(scene);
+ char *error_msg;
+
+ if(!seq_effect_find_selected(scene, last_seq, last_seq->type, &seq1, &seq2, &seq3, &error_msg)) {
+ BKE_report(op->reports, RPT_ERROR, error_msg);
+ return OPERATOR_CANCELLED;
+ }
+ /* see reassigning would create a cycle */
+ if( seq_is_predecessor(seq1, last_seq) ||
+ seq_is_predecessor(seq2, last_seq) ||
+ seq_is_predecessor(seq3, last_seq)
+ ) {
+ BKE_report(op->reports, RPT_ERROR, "Can't reassign inputs: no cycles allowed");
+ return OPERATOR_CANCELLED;
+ }
+
+ last_seq->seq1 = seq1;
+ last_seq->seq2 = seq2;
+ last_seq->seq3 = seq3;
+
+ update_changed_seq_and_deps(scene, last_seq, 1, 1);
+
+ WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER, scene);
+
+ return OPERATOR_FINISHED;
+}
+
+int sequencer_effect_poll(bContext *C)
+{
+ Scene *scene= CTX_data_scene(C);
+ Editing *ed= seq_give_editing(scene, FALSE);
+
+ if(ed) {
+ Sequence *last_seq= seq_active_get(scene);
+ if(last_seq && (last_seq->type & SEQ_EFFECT)) {
+ return 1;
+ }
+ }
+
+ return 0;
+}
+
+void SEQUENCER_OT_reassign_inputs(struct wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name= "Reassign Inputs";
+ ot->idname= "SEQUENCER_OT_reassign_inputs";
+ ot->description="Reassign the inputs for the effects strip";
+
+ /* api callbacks */
+ ot->exec= sequencer_reassign_inputs_exec;
+ ot->poll= sequencer_effect_poll;
+
+ /* flags */
+ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+}
+
+
/* cut operator */
static EnumPropertyItem prop_cut_types[] = {
{SEQ_CUT_SOFT, "SOFT", 0, "Soft", ""},
@@ -1700,10 +1732,7 @@ static int sequencer_separate_images_exec(bContext *C, wmOperator *op)
int start_ofs, cfra, frame_end;
int step= RNA_int_get(op->ptr, "length");
- if(ed==NULL)
- return OPERATOR_CANCELLED;
-
- seq= ed->seqbasep->first;
+ seq= ed->seqbasep->first; /* poll checks this is valid */
while (seq) {
if((seq->flag & SELECT) && (seq->type == SEQ_IMAGE) && (seq->len > 1)) {
@@ -1711,7 +1740,8 @@ static int sequencer_separate_images_exec(bContext *C, wmOperator *op)
see seq_free_sequence below for the real free'ing */
seq_next = seq->next;
BLI_remlink(ed->seqbasep, seq);
- if(seq->ipo) seq->ipo->id.us--;
+ /* if(seq->ipo) seq->ipo->id.us--; */
+ /* XXX, remove fcurve and assign to split image strips */
start_ofs = cfra = seq_tx_get_final_left(seq, 0);
frame_end = seq_tx_get_final_right(seq, 0);
@@ -1735,11 +1765,16 @@ static int sequencer_separate_images_exec(bContext *C, wmOperator *op)
strip_new->stripdata= se_new= MEM_callocN(sizeof(StripElem)*1, "stripelem");
strncpy(se_new->name, se->name, FILE_MAXFILE-1);
calc_sequence(scene, seq_new);
- seq_new->flag &= ~SEQ_OVERLAP;
- if (seq_test_overlap(ed->seqbasep, seq_new)) {
- shuffle_seq(ed->seqbasep, seq_new, scene);
+
+ if(step > 1) {
+ seq_new->flag &= ~SEQ_OVERLAP;
+ if (seq_test_overlap(ed->seqbasep, seq_new)) {
+ shuffle_seq(ed->seqbasep, seq_new, scene);
+ }
}
+ /* XXX, COPY FCURVES */
+ strncpy(seq_new->name+2, seq->name+2, sizeof(seq->name)-2);
seqbase_unique_name_recursive(&scene->ed->seqbase, seq_new);
cfra++;
@@ -1857,8 +1892,7 @@ static int sequencer_meta_make_exec(bContext *C, wmOperator *op)
Scene *scene= CTX_data_scene(C);
Editing *ed= seq_give_editing(scene, FALSE);
- Sequence *seq, *seqm, *next;
-
+ Sequence *seq, *seqm, *next, *last_seq = seq_active_get(scene);
int channel_max= 1;
if(seqbase_isolated_sel_check(ed->seqbasep)==FALSE) {
@@ -1883,7 +1917,7 @@ static int sequencer_meta_make_exec(bContext *C, wmOperator *op)
}
seq= next;
}
- seqm->machine= channel_max;
+ seqm->machine= last_seq ? last_seq->machine : channel_max;
calc_sequence(scene, seqm);
seqm->strip= MEM_callocN(sizeof(Strip), "metastrip");
@@ -2643,9 +2677,18 @@ static int sequencer_swap_data_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
}
+ sound_remove_scene_sound(scene, seq_act->scene_sound);
+ sound_remove_scene_sound(scene, seq_other->scene_sound);
+
+ seq_act->scene_sound= NULL;
+ seq_other->scene_sound= NULL;
+
calc_sequence(scene, seq_act);
calc_sequence(scene, seq_other);
+ if(seq_act->sound) sound_add_scene_sound(scene, seq_act, seq_act->startdisp, seq_act->enddisp, seq_act->startofs + seq_act->anim_startofs);
+ if(seq_other->sound) sound_add_scene_sound(scene, seq_other, seq_other->startdisp, seq_other->enddisp, seq_other->startofs + seq_other->anim_startofs);
+
WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER, scene);
return OPERATOR_FINISHED;
diff --git a/source/blender/editors/space_sequencer/sequencer_intern.h b/source/blender/editors/space_sequencer/sequencer_intern.h
index 71953ff3ddd..df426e91075 100644
--- a/source/blender/editors/space_sequencer/sequencer_intern.h
+++ b/source/blender/editors/space_sequencer/sequencer_intern.h
@@ -85,6 +85,7 @@ void SEQUENCER_OT_lock(struct wmOperatorType *ot);
void SEQUENCER_OT_unlock(struct wmOperatorType *ot);
void SEQUENCER_OT_reload(struct wmOperatorType *ot);
void SEQUENCER_OT_refresh_all(struct wmOperatorType *ot);
+void SEQUENCER_OT_reassign_inputs(struct wmOperatorType *ot);
void SEQUENCER_OT_duplicate(struct wmOperatorType *ot);
void SEQUENCER_OT_delete(struct wmOperatorType *ot);
void SEQUENCER_OT_images_separate(struct wmOperatorType *ot);
diff --git a/source/blender/editors/space_sequencer/sequencer_ops.c b/source/blender/editors/space_sequencer/sequencer_ops.c
index 69457e5c6e8..9f5a97d4446 100644
--- a/source/blender/editors/space_sequencer/sequencer_ops.c
+++ b/source/blender/editors/space_sequencer/sequencer_ops.c
@@ -63,6 +63,7 @@ void sequencer_operatortypes(void)
WM_operatortype_append(SEQUENCER_OT_unlock);
WM_operatortype_append(SEQUENCER_OT_reload);
WM_operatortype_append(SEQUENCER_OT_refresh_all);
+ WM_operatortype_append(SEQUENCER_OT_reassign_inputs);
WM_operatortype_append(SEQUENCER_OT_duplicate);
WM_operatortype_append(SEQUENCER_OT_delete);
WM_operatortype_append(SEQUENCER_OT_images_separate);
@@ -134,6 +135,7 @@ void sequencer_keymap(wmKeyConfig *keyconf)
WM_keymap_add_item(keymap, "SEQUENCER_OT_lock", LKEY, KM_PRESS, KM_SHIFT, 0);
WM_keymap_add_item(keymap, "SEQUENCER_OT_unlock", LKEY, KM_PRESS, KM_SHIFT|KM_ALT, 0);
+ WM_keymap_add_item(keymap, "SEQUENCER_OT_reassign_inputs", RKEY, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "SEQUENCER_OT_reload", RKEY, KM_PRESS, KM_ALT, 0);
WM_keymap_add_item(keymap, "SEQUENCER_OT_duplicate", DKEY, KM_PRESS, KM_SHIFT, 0);
diff --git a/source/blender/editors/space_sequencer/space_sequencer.c b/source/blender/editors/space_sequencer/space_sequencer.c
index 49c2049c66c..8b7670a55bc 100644
--- a/source/blender/editors/space_sequencer/space_sequencer.c
+++ b/source/blender/editors/space_sequencer/space_sequencer.c
@@ -355,6 +355,7 @@ static void sequencer_main_area_listener(ARegion *ar, wmNotifier *wmn)
case NC_SCENE:
switch(wmn->data) {
case ND_FRAME:
+ case ND_FRAME_RANGE:
case ND_MARKERS:
case ND_SEQUENCER:
ED_region_tag_redraw(ar);
diff --git a/source/blender/editors/space_text/text_ops.c b/source/blender/editors/space_text/text_ops.c
index c90d257ee43..a684c4dce0e 100644
--- a/source/blender/editors/space_text/text_ops.c
+++ b/source/blender/editors/space_text/text_ops.c
@@ -295,7 +295,7 @@ void TEXT_OT_open(wmOperatorType *ot)
ot->flag= OPTYPE_UNDO;
/* properties */
- WM_operator_properties_filesel(ot, FOLDERFILE|TEXTFILE|PYSCRIPTFILE, FILE_SPECIAL, FILE_OPENFILE, 0); //XXX TODO, relative_path
+ WM_operator_properties_filesel(ot, FOLDERFILE|TEXTFILE|PYSCRIPTFILE, FILE_SPECIAL, FILE_OPENFILE, WM_FILESEL_FILEPATH); //XXX TODO, relative_path
RNA_def_boolean(ot->srna, "internal", 0, "Make internal", "Make text file internal after loading");
}
@@ -542,7 +542,7 @@ void TEXT_OT_save_as(wmOperatorType *ot)
ot->poll= text_edit_poll;
/* properties */
- WM_operator_properties_filesel(ot, FOLDERFILE|TEXTFILE|PYSCRIPTFILE, FILE_SPECIAL, FILE_SAVE, 0); //XXX TODO, relative_path
+ WM_operator_properties_filesel(ot, FOLDERFILE|TEXTFILE|PYSCRIPTFILE, FILE_SPECIAL, FILE_SAVE, WM_FILESEL_FILEPATH); //XXX TODO, relative_path
}
/******************* run script operator *********************/
diff --git a/source/blender/editors/space_time/space_time.c b/source/blender/editors/space_time/space_time.c
index 7928fc6284a..b2e1bfb9b93 100644
--- a/source/blender/editors/space_time/space_time.c
+++ b/source/blender/editors/space_time/space_time.c
@@ -410,6 +410,20 @@ static void time_listener(ScrArea *sa, wmNotifier *wmn)
case ND_FRAME:
ED_area_tag_refresh(sa);
break;
+ case ND_FRAME_RANGE:
+ {
+ ARegion *ar;
+ Scene *scene = wmn->reference;
+
+ for (ar= sa->regionbase.first; ar; ar= ar->next) {
+ if (ar->regiontype==RGN_TYPE_WINDOW) {
+ ar->v2d.tot.xmin= (float)(SFRA - 4);
+ ar->v2d.tot.xmax= (float)(EFRA + 4);
+ break;
+ }
+ }
+ }
+ break;
}
case NC_SPACE:
switch (wmn->data) {
diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c
index 7cae427112b..c8581abd704 100644
--- a/source/blender/editors/space_view3d/drawobject.c
+++ b/source/blender/editors/space_view3d/drawobject.c
@@ -5557,6 +5557,9 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag)
if (ob!=scene->obedit) {
if (ob->restrictflag & OB_RESTRICT_VIEW)
return;
+ if ((ob->restrictflag & OB_RESTRICT_RENDER) &&
+ (v3d->flag2 & V3D_RENDER_OVERRIDE))
+ return;
}
/* XXX particles are not safe for simultaneous threaded render */
@@ -6158,7 +6161,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag)
}
}
- if(dt<OB_SHADED) {
+ if(dt<OB_SHADED && (v3d->flag2 & V3D_RENDER_OVERRIDE)==0) {
if((ob->gameflag & OB_DYNAMIC) ||
((ob->gameflag & OB_BOUNDS) && (ob->boundtype == OB_BOUND_SPHERE))) {
float imat[4][4], vec[3];
diff --git a/source/blender/editors/space_view3d/space_view3d.c b/source/blender/editors/space_view3d/space_view3d.c
index 92e3b35f614..2b89fbbb656 100644
--- a/source/blender/editors/space_view3d/space_view3d.c
+++ b/source/blender/editors/space_view3d/space_view3d.c
@@ -749,6 +749,7 @@ static void view3d_buttons_area_listener(ARegion *ar, wmNotifier *wmn)
case ND_POSE:
case ND_DRAW:
case ND_KEYS:
+ case ND_MODIFIER:
ED_region_tag_redraw(ar);
break;
}
@@ -760,6 +761,8 @@ static void view3d_buttons_area_listener(ARegion *ar, wmNotifier *wmn)
ED_region_tag_redraw(ar);
break;
}
+ if (wmn->action == NA_EDITED)
+ ED_region_tag_redraw(ar);
break;
case NC_TEXTURE:
/* for brush textures */
diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c
index 96f1e058948..c3d034eebd3 100644
--- a/source/blender/editors/space_view3d/view3d_draw.c
+++ b/source/blender/editors/space_view3d/view3d_draw.c
@@ -820,7 +820,7 @@ static void draw_selected_name(Scene *scene, Object *ob, View3D *v3d)
}
/* colour depends on whether there is a keyframe */
- if (id_frame_has_keyframe((ID *)ob, /*frame_to_float(scene, CFRA)*/(float)(CFRA), v3d->keyflags))
+ if (id_frame_has_keyframe((ID *)ob, /*BKE_curframe(scene)*/(float)(CFRA), v3d->keyflags))
UI_ThemeColor(TH_VERTEX_SELECT);
else
UI_ThemeColor(TH_TEXT_HI);
@@ -1830,15 +1830,15 @@ static void gpu_update_lamps_shadows(Scene *scene, View3D *v3d)
for(shadow=shadows.first; shadow; shadow=shadow->next) {
/* this needs to be done better .. */
float viewmat[4][4], winmat[4][4];
- int drawtype, lay, winsize, flag2;
+ int drawtype, lay, winsize, flag2=v3d->flag2;
drawtype= v3d->drawtype;
lay= v3d->lay;
- flag2= v3d->flag2 & V3D_SOLID_TEX;
v3d->drawtype = OB_SOLID;
v3d->lay &= GPU_lamp_shadow_layer(shadow->lamp);
v3d->flag2 &= ~V3D_SOLID_TEX;
+ v3d->flag2 |= V3D_RENDER_OVERRIDE;
GPU_lamp_shadow_buffer_bind(shadow->lamp, viewmat, &winsize, winmat);
@@ -1859,7 +1859,7 @@ static void gpu_update_lamps_shadows(Scene *scene, View3D *v3d)
v3d->drawtype= drawtype;
v3d->lay= lay;
- v3d->flag2 |= flag2;
+ v3d->flag2 = flag2;
}
BLI_freelistN(&shadows);
@@ -1962,7 +1962,7 @@ void ED_view3d_draw_offscreen(Scene *scene, View3D *v3d, ARegion *ar, int winx,
bwiny= ar->winy;
ar->winx= winx;
ar->winy= winy;
-
+
/* set flags */
G.f |= G_RENDER_OGL;
diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c
index 77ba7939ccd..56714143fe9 100644
--- a/source/blender/editors/space_view3d/view3d_edit.c
+++ b/source/blender/editors/space_view3d/view3d_edit.c
@@ -728,7 +728,19 @@ static int viewrotate_invoke(bContext *C, wmOperator *op, wmEvent *event)
}
}
-static int ED_operator_view3d_rotate(bContext *C)
+static int view3d_camera_active_poll(bContext *C)
+{
+ if(ED_operator_view3d_active(C)) {
+ RegionView3D *rv3d= CTX_wm_region_view3d(C);
+ if(rv3d->persp==RV3D_CAMOB) {
+ return 1;
+ }
+ }
+
+ return 0;
+}
+
+static int view3d_rotate_poll(bContext *C)
{
if (!ED_operator_view3d_active(C)) {
return 0;
@@ -754,7 +766,7 @@ void VIEW3D_OT_rotate(wmOperatorType *ot)
/* api callbacks */
ot->invoke= viewrotate_invoke;
ot->modal= viewrotate_modal;
- ot->poll= ED_operator_view3d_active;
+ ot->poll= view3d_rotate_poll;
/* flags */
ot->flag= OPTYPE_BLOCKING|OPTYPE_GRAB_POINTER;
@@ -1294,6 +1306,18 @@ static int viewhome_exec(bContext *C, wmOperator *op) /* was view3d_home() in 2.
return OPERATOR_FINISHED;
}
+static int viewhome_poll(bContext *C)
+{
+ if(ED_operator_view3d_active(C)) {
+ RegionView3D *rv3d= CTX_wm_region_view3d(C); //XXX, when accessed from a header menu this doesnt work!
+ if(rv3d && rv3d->persp!=RV3D_CAMOB) {
+ return 1;
+ }
+ }
+
+ return 0;
+}
+
void VIEW3D_OT_view_all(wmOperatorType *ot)
{
/* identifiers */
@@ -1303,7 +1327,7 @@ void VIEW3D_OT_view_all(wmOperatorType *ot)
/* api callbacks */
ot->exec= viewhome_exec;
- ot->poll= ED_operator_view3d_active;
+ ot->poll= viewhome_poll;
/* flags */
ot->flag= 0;
@@ -1311,6 +1335,7 @@ void VIEW3D_OT_view_all(wmOperatorType *ot)
RNA_def_boolean(ot->srna, "center", 0, "Center", "");
}
+
static int viewselected_exec(bContext *C, wmOperator *op) /* like a localview without local!, was centerview() in 2.4x */
{
ARegion *ar= CTX_wm_region(C);
@@ -1460,16 +1485,10 @@ static int viewcenter_cursor_exec(bContext *C, wmOperator *op)
Scene *scene= CTX_data_scene(C);
if (rv3d) {
- if (rv3d->persp==RV3D_CAMOB) {
- /* center the camera offset */
- rv3d->camdx= rv3d->camdy= 0.0;
- }
- else {
- /* non camera center */
- float new_ofs[3];
- negate_v3_v3(new_ofs, give_cursor(scene, v3d));
- smooth_view(C, NULL, NULL, new_ofs, NULL, NULL, NULL);
- }
+ /* non camera center */
+ float new_ofs[3];
+ negate_v3_v3(new_ofs, give_cursor(scene, v3d));
+ smooth_view(C, NULL, NULL, new_ofs, NULL, NULL, NULL);
if (rv3d->viewlock & RV3D_BOXVIEW)
view3d_boxview_copy(CTX_wm_area(C), CTX_wm_region(C));
@@ -1493,6 +1512,32 @@ void VIEW3D_OT_view_center_cursor(wmOperatorType *ot)
ot->flag= 0;
}
+static int view3d_center_camera_exec(bContext *C, wmOperator *op) /* was view3d_home() in 2.4x */
+{
+ RegionView3D *rv3d= CTX_wm_region_view3d(C);
+
+ rv3d->camdx= rv3d->camdy= 0.0f;
+
+ WM_event_add_notifier(C, NC_SPACE|ND_SPACE_VIEW3D, CTX_wm_view3d(C));
+
+ return OPERATOR_FINISHED;
+}
+
+void VIEW3D_OT_view_center_camera(wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name= "View Camera Center";
+ ot->description = "Center the camera view";
+ ot->idname= "VIEW3D_OT_view_center_camera";
+
+ /* api callbacks */
+ ot->exec= view3d_center_camera_exec;
+ ot->poll= view3d_camera_active_poll;
+
+ /* flags */
+ ot->flag= 0;
+}
+
/* ********************* Set render border operator ****************** */
static int render_border_exec(bContext *C, wmOperator *op)
@@ -1543,15 +1588,6 @@ static int render_border_exec(bContext *C, wmOperator *op)
}
-static int view3d_render_border_invoke(bContext *C, wmOperator *op, wmEvent *event)
-{
- RegionView3D *rv3d= ED_view3d_context_rv3d(C);
-
- /* if not in camera view do not exec the operator*/
- if (rv3d->persp == RV3D_CAMOB) return WM_border_select_invoke(C, op, event);
- else return OPERATOR_PASS_THROUGH;
-}
-
void VIEW3D_OT_render_border(wmOperatorType *ot)
{
/* identifiers */
@@ -1560,11 +1596,11 @@ void VIEW3D_OT_render_border(wmOperatorType *ot)
ot->idname= "VIEW3D_OT_render_border";
/* api callbacks */
- ot->invoke= view3d_render_border_invoke;
+ ot->invoke= WM_border_select_invoke;
ot->exec= render_border_exec;
ot->modal= WM_border_select_modal;
- ot->poll= ED_operator_view3d_active;
+ ot->poll= view3d_camera_active_poll;
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -2010,7 +2046,7 @@ void VIEW3D_OT_view_orbit(wmOperatorType *ot)
/* api callbacks */
ot->exec= vieworbit_exec;
- ot->poll= ED_operator_view3d_active;
+ ot->poll= view3d_rotate_poll;
/* flags */
ot->flag= 0;
diff --git a/source/blender/editors/space_view3d/view3d_intern.h b/source/blender/editors/space_view3d/view3d_intern.h
index 69e4006770d..3e8bc71c351 100644
--- a/source/blender/editors/space_view3d/view3d_intern.h
+++ b/source/blender/editors/space_view3d/view3d_intern.h
@@ -75,6 +75,7 @@ void VIEW3D_OT_view_all(struct wmOperatorType *ot);
void VIEW3D_OT_viewnumpad(struct wmOperatorType *ot);
void VIEW3D_OT_view_selected(struct wmOperatorType *ot);
void VIEW3D_OT_view_center_cursor(struct wmOperatorType *ot);
+void VIEW3D_OT_view_center_camera(struct wmOperatorType *ot);
void VIEW3D_OT_view_pan(struct wmOperatorType *ot);
void VIEW3D_OT_view_persportho(struct wmOperatorType *ot);
void VIEW3D_OT_add_background_image(struct wmOperatorType *ot);
diff --git a/source/blender/editors/space_view3d/view3d_ops.c b/source/blender/editors/space_view3d/view3d_ops.c
index 08658cd752d..faeab482f72 100644
--- a/source/blender/editors/space_view3d/view3d_ops.c
+++ b/source/blender/editors/space_view3d/view3d_ops.c
@@ -70,6 +70,7 @@ void view3d_operatortypes(void)
WM_operatortype_append(VIEW3D_OT_remove_background_image);
WM_operatortype_append(VIEW3D_OT_view_selected);
WM_operatortype_append(VIEW3D_OT_view_center_cursor);
+ WM_operatortype_append(VIEW3D_OT_view_center_camera);
WM_operatortype_append(VIEW3D_OT_select);
WM_operatortype_append(VIEW3D_OT_select_border);
WM_operatortype_append(VIEW3D_OT_clip_border);
@@ -150,7 +151,8 @@ void view3d_keymap(wmKeyConfig *keyconf)
RNA_int_set(WM_keymap_add_item(keymap, "VIEW3D_OT_zoom", WHEELINMOUSE, KM_PRESS, 0, 0)->ptr, "delta", 1);
RNA_int_set(WM_keymap_add_item(keymap, "VIEW3D_OT_zoom", WHEELOUTMOUSE, KM_PRESS, 0, 0)->ptr, "delta", -1);
- RNA_boolean_set(WM_keymap_add_item(keymap, "VIEW3D_OT_view_all", HOMEKEY, KM_PRESS, 0, 0)->ptr, "center", 0);
+ WM_keymap_add_item(keymap, "VIEW3D_OT_view_center_camera", HOMEKEY, KM_PRESS, 0, 0); /* only with camera view */
+ RNA_boolean_set(WM_keymap_add_item(keymap, "VIEW3D_OT_view_all", HOMEKEY, KM_PRESS, 0, 0)->ptr, "center", 0); /* only without camera view */
RNA_boolean_set(WM_keymap_add_item(keymap, "VIEW3D_OT_view_all", CKEY, KM_PRESS, KM_SHIFT, 0)->ptr, "center", 1);
/* numpad view hotkeys*/
diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c
index 45ebbe63b15..c177f2789d0 100644
--- a/source/blender/editors/transform/transform.c
+++ b/source/blender/editors/transform/transform.c
@@ -479,6 +479,8 @@ static void view_editmove(unsigned short event)
#define TFM_MODAL_REMOVE_SNAP 17
/* 18 and 19 used by numinput, defined in transform.h
* */
+#define TFM_MODAL_PROPSIZE_UP 20
+#define TFM_MODAL_PROPSIZE_DOWN 21
/* called in transform_ops.c, on each regeneration of keymaps */
wmKeyMap* transform_modal_keymap(wmKeyConfig *keyconf)
@@ -503,6 +505,8 @@ wmKeyMap* transform_modal_keymap(wmKeyConfig *keyconf)
{TFM_MODAL_REMOVE_SNAP, "REMOVE_SNAP", 0, "Remove Last Snap Point", ""},
{NUM_MODAL_INCREMENT_UP, "INCREMENT_UP", 0, "Numinput Increment Up", ""},
{NUM_MODAL_INCREMENT_DOWN, "INCREMENT_DOWN", 0, "Numinput Increment Down", ""},
+ {TFM_MODAL_PROPSIZE_UP, "PROPORTIONAL_SIZE_UP", 0, "Increase Proportional Influence", ""},
+ {TFM_MODAL_PROPSIZE_DOWN, "PROPORTIONAL_SIZE_DOWN", 0, "Decrease Poportional Influence", ""},
{0, NULL, 0, NULL, NULL}};
wmKeyMap *keymap= WM_modalkeymap_get(keyconf, "Transform Modal Map");
@@ -532,6 +536,11 @@ wmKeyMap* transform_modal_keymap(wmKeyConfig *keyconf)
WM_modalkeymap_add_item(keymap, UPARROWKEY, KM_PRESS, 0, 0, NUM_MODAL_INCREMENT_UP);
WM_modalkeymap_add_item(keymap, DOWNARROWKEY, KM_PRESS, 0, 0, NUM_MODAL_INCREMENT_DOWN);
+
+ WM_modalkeymap_add_item(keymap, PAGEUPKEY, KM_PRESS, 0, 0, TFM_MODAL_PROPSIZE_UP);
+ WM_modalkeymap_add_item(keymap, PAGEDOWNKEY, KM_PRESS, 0, 0, TFM_MODAL_PROPSIZE_DOWN);
+ WM_modalkeymap_add_item(keymap, WHEELDOWNMOUSE, KM_PRESS, 0, 0, TFM_MODAL_PROPSIZE_UP);
+ WM_modalkeymap_add_item(keymap, WHEELUPMOUSE, KM_PRESS, 0, 0, TFM_MODAL_PROPSIZE_DOWN);
return keymap;
}
@@ -709,6 +718,20 @@ int transformEvent(TransInfo *t, wmEvent *event)
removeSnapPoint(t);
t->redraw |= TREDRAW_HARD;
break;
+ case TFM_MODAL_PROPSIZE_UP:
+ if(t->flag & T_PROP_EDIT) {
+ t->prop_size*= 1.1f;
+ calculatePropRatio(t);
+ }
+ t->redraw |= TREDRAW_HARD;
+ break;
+ case TFM_MODAL_PROPSIZE_DOWN:
+ if (t->flag & T_PROP_EDIT) {
+ t->prop_size*= 0.90909090f;
+ calculatePropRatio(t);
+ }
+ t->redraw |= TREDRAW_HARD;
+ break;
default:
handled = 0;
break;
@@ -933,10 +956,6 @@ int transformEvent(TransInfo *t, wmEvent *event)
if (t->flag & T_AUTOIK) {
transform_autoik_update(t, 1);
}
- else if(t->flag & T_PROP_EDIT) {
- t->prop_size*= 1.1f;
- calculatePropRatio(t);
- }
else view_editmove(event->type);
t->redraw= 1;
break;
@@ -952,10 +971,6 @@ int transformEvent(TransInfo *t, wmEvent *event)
if (t->flag & T_AUTOIK) {
transform_autoik_update(t, -1);
}
- else if (t->flag & T_PROP_EDIT) {
- t->prop_size*= 0.90909090f;
- calculatePropRatio(t);
- }
else view_editmove(event->type);
t->redraw= 1;
break;
diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c
index d8e56331e19..555940c2f35 100644
--- a/source/blender/editors/transform/transform_conversions.c
+++ b/source/blender/editors/transform/transform_conversions.c
@@ -4826,7 +4826,7 @@ void special_aftertrans_update(bContext *C, TransInfo *t)
// fixme... some of this stuff is not good
if (ob) {
if (ob->pose || ob_get_key(ob))
- DAG_id_flush_update(&ob->id, OB_RECALC);
+ DAG_id_flush_update(&ob->id, OB_RECALC_ALL);
else
DAG_id_flush_update(&ob->id, OB_RECALC_OB);
}
diff --git a/source/blender/editors/transform/transform_generics.c b/source/blender/editors/transform/transform_generics.c
index 58fc93de745..98ecb07660f 100644
--- a/source/blender/editors/transform/transform_generics.c
+++ b/source/blender/editors/transform/transform_generics.c
@@ -810,7 +810,7 @@ void recalcData(TransInfo *t)
/* sets recalc flags fully, instead of flushing existing ones
* otherwise proxies don't function correctly
*/
- DAG_id_flush_update(&ob->id, OB_RECALC);
+ DAG_id_flush_update(&ob->id, OB_RECALC_OB);
}
}
diff --git a/source/blender/editors/util/ed_util.c b/source/blender/editors/util/ed_util.c
index 0c9ce9648c7..fbf2051f962 100644
--- a/source/blender/editors/util/ed_util.c
+++ b/source/blender/editors/util/ed_util.c
@@ -56,6 +56,7 @@ void ED_editors_init(bContext *C)
Main *bmain= CTX_data_main(C);
Scene *sce= CTX_data_scene(C);
Object *ob, *obact= (sce && sce->basact)? sce->basact->object: NULL;
+ ID *data;
/* toggle on modes for objects that were saved with these enabled. for
e.g. linked objects we have to ensure that they are actually the
@@ -65,8 +66,9 @@ void ED_editors_init(bContext *C)
if(mode && (mode != OB_MODE_POSE)) {
ob->mode= 0;
+ data= ob->data;
- if(ob == obact)
+ if(ob == obact && !ob->id.lib && !(data && data->lib))
ED_object_toggle_modes(C, mode);
}
}