From c406ce29742fd44995f29768e593f00a7805df2c Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 17 May 2012 10:07:29 +0000 Subject: [PATCH 1/5] minor improvement - entering "//somepath" in the file selector didnt expand from the current blend files path. also quiet warning. --- source/blender/blenloader/intern/readfile.c | 2 +- source/blender/editors/space_file/file_ops.c | 6 +++++- source/blender/makesrna/intern/rna_sequencer_api.c | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index ae691f07c7d..7078446801b 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -8995,7 +8995,7 @@ static void read_libraries(FileData *basefd, ListBase *mainlist) /* printf and reports for now... its important users know this */ BKE_reportf_wrap(basefd->reports, RPT_INFO, - "read library: '%s', '%s'\n", + "read library: '%s', '%s'", mainptr->curlib->filepath, mainptr->curlib->name); fd= blo_openblenderfile(mainptr->curlib->filepath, basefd->reports); diff --git a/source/blender/editors/space_file/file_ops.c b/source/blender/editors/space_file/file_ops.c index f340c53f528..3ff9c3c0520 100644 --- a/source/blender/editors/space_file/file_ops.c +++ b/source/blender/editors/space_file/file_ops.c @@ -1099,7 +1099,11 @@ static void file_expand_directory(bContext *C) SpaceFile *sfile= CTX_wm_space_file(C); if (sfile->params) { - if ( sfile->params->dir[0] == '~' ) { + /* TODO, what about // when relbase isn't valid? */ + if (G.relbase_valid && strncmp(sfile->params->dir, "//", 2) == 0) { + BLI_path_abs(sfile->params->dir, G.main->name); + } + else if (sfile->params->dir[0] == '~') { char tmpstr[sizeof(sfile->params->dir)-1]; BLI_strncpy(tmpstr, sfile->params->dir+1, sizeof(tmpstr)); BLI_join_dirfile(sfile->params->dir, sizeof(sfile->params->dir), BLI_getDefaultDocumentFolder(), tmpstr); diff --git a/source/blender/makesrna/intern/rna_sequencer_api.c b/source/blender/makesrna/intern/rna_sequencer_api.c index 41c6f046c04..748c66499d8 100644 --- a/source/blender/makesrna/intern/rna_sequencer_api.c +++ b/source/blender/makesrna/intern/rna_sequencer_api.c @@ -202,7 +202,7 @@ static Sequence *rna_Sequences_new_sound(ID *id, Editing *ed, Main *bmain, Repor seq = alloc_generic_sequence(ed, name, start_frame, channel, SEQ_SOUND, sound->name); seq->sound = sound; - seq->len = ceil(sound_get_length(sound) * FPS); + seq->len = ceil((double)sound_get_length(sound) * FPS); seq->scene_sound = sound_add_scene_sound(scene, seq, start_frame, start_frame + seq->len, 0); From c7c937547b0ceb622262ea064db71364f61669c6 Mon Sep 17 00:00:00 2001 From: Joshua Leung Date: Thu, 17 May 2012 10:10:11 +0000 Subject: [PATCH 2/5] KeyingSets UI stuff - Replaced names used in RNA enum instead of redefining manually in UI files --- release/scripts/startup/bl_ui/properties_scene.py | 12 ++---------- source/blender/makesrna/intern/rna_animation.c | 6 +++--- 2 files changed, 5 insertions(+), 13 deletions(-) diff --git a/release/scripts/startup/bl_ui/properties_scene.py b/release/scripts/startup/bl_ui/properties_scene.py index 329dc6d6a01..af8fcc6cbdc 100644 --- a/release/scripts/startup/bl_ui/properties_scene.py +++ b/release/scripts/startup/bl_ui/properties_scene.py @@ -93,14 +93,6 @@ class SCENE_PT_unit(SceneButtonsPanel, Panel): row.prop(unit, "use_separate") -def draw_keyingset_options(data, layout): - # NOTE: keep in sync with rna_def_common_keying_flags() in rna_animation.c - # These are defined out like this because the standard names are too long - layout.prop_enum(data, "bl_options", text="Only Needed", value='INSERTKEY_NEEDED') - layout.prop_enum(data, "bl_options", text="Visual Keying", value='INSERTKEY_VISUAL') - layout.prop_enum(data, "bl_options", text="XYZ=RGB Coloring", value='INSERTKEY_XYZ_TO_RGB') - - class SCENE_PT_keying_sets(SceneButtonsPanel, Panel): bl_label = "Keying Sets" COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} @@ -132,7 +124,7 @@ class SCENE_PT_keying_sets(SceneButtonsPanel, Panel): col = row.column(align=True) col.label(text="Keyframing Settings:") - draw_keyingset_options(ks, col) + col.prop(ks, "bl_options") class SCENE_PT_keying_set_paths(SceneButtonsPanel, Panel): @@ -188,7 +180,7 @@ class SCENE_PT_keying_set_paths(SceneButtonsPanel, Panel): col = row.column(align=True) col.label(text="Keyframing Settings:") - draw_keyingset_options(ks, col) + col.prop(ksp, "bl_options") class SCENE_PT_physics(SceneButtonsPanel, Panel): diff --git a/source/blender/makesrna/intern/rna_animation.c b/source/blender/makesrna/intern/rna_animation.c index 7a8f48705a4..459482063b1 100644 --- a/source/blender/makesrna/intern/rna_animation.c +++ b/source/blender/makesrna/intern/rna_animation.c @@ -468,11 +468,11 @@ static void rna_def_common_keying_flags(StructRNA *srna, short reg) PropertyRNA *prop; static EnumPropertyItem keying_flag_items[] = { - {INSERTKEY_NEEDED, "INSERTKEY_NEEDED", 0, "Insert Keyframes - Only Needed", + {INSERTKEY_NEEDED, "INSERTKEY_NEEDED", 0, "Only Needed", "Only insert keyframes where they're needed in the relevant F-Curves"}, - {INSERTKEY_MATRIX, "INSERTKEY_VISUAL", 0, "Insert Keyframes - Visual", + {INSERTKEY_MATRIX, "INSERTKEY_VISUAL", 0, "Visual Keying", "Insert keyframes based on 'visual transforms'"}, - {INSERTKEY_XYZ2RGB, "INSERTKEY_XYZ_TO_RGB", 0, "F-Curve Colors - XYZ to RGB", + {INSERTKEY_XYZ2RGB, "INSERTKEY_XYZ_TO_RGB", 0, "XYZ=RGB Colors", "Color for newly added transformation F-Curves (Location, Rotation, Scale) " "and also Color is based on the transform axis"}, {0, NULL, 0, NULL, NULL} From f9043865a23f42b2705c66ffcdf7b9f4e6f6072d Mon Sep 17 00:00:00 2001 From: Joshua Leung Date: Thu, 17 May 2012 10:28:30 +0000 Subject: [PATCH 3/5] Disable setting non-object actions as the action used by the Action Constraint (... I could've sworn there used to be some dynamic enums for filtering actions by root type) --- .../editors/object/object_constraint.c | 21 ++++++++++++------- .../blender/makesrna/intern/rna_constraint.c | 1 + 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/source/blender/editors/object/object_constraint.c b/source/blender/editors/object/object_constraint.c index d73b53deecc..7cc11fa0209 100644 --- a/source/blender/editors/object/object_constraint.c +++ b/source/blender/editors/object/object_constraint.c @@ -356,8 +356,15 @@ static void test_constraints(Object *owner, bPoseChannel *pchan) bActionConstraint *data = curcon->data; /* validate action */ - if (data->act == NULL) + if (data->act == NULL) { + /* must have action */ curcon->flag |= CONSTRAINT_DISABLE; + } + else if (data->act->idroot != ID_OB) { + /* only object-rooted actions can be used */ + data->act = NULL; + curcon->flag |= CONSTRAINT_DISABLE; + } } else if (curcon->type == CONSTRAINT_TYPE_FOLLOWPATH) { bFollowPathConstraint *data = curcon->data; @@ -409,12 +416,12 @@ static void test_constraints(Object *owner, bPoseChannel *pchan) if (data->clip != NULL && data->track[0]) { MovieTracking *tracking = &data->clip->tracking; MovieTrackingObject *tracking_object; - + if (data->object[0]) tracking_object = BKE_tracking_named_object(tracking, data->object); else tracking_object = BKE_tracking_get_camera_object(tracking); - + if (!tracking_object) { curcon->flag |= CONSTRAINT_DISABLE; } @@ -428,14 +435,14 @@ static void test_constraints(Object *owner, bPoseChannel *pchan) } else if (curcon->type == CONSTRAINT_TYPE_CAMERASOLVER) { bCameraSolverConstraint *data = curcon->data; - - if ((data->flag & CAMERASOLVER_ACTIVECLIP) == 0 && data->clip == NULL) + + if ((data->flag & CAMERASOLVER_ACTIVECLIP) == 0 && (data->clip == NULL)) curcon->flag |= CONSTRAINT_DISABLE; } else if (curcon->type == CONSTRAINT_TYPE_OBJECTSOLVER) { bObjectSolverConstraint *data = curcon->data; - - if ((data->flag & CAMERASOLVER_ACTIVECLIP) == 0 && data->clip == NULL) + + if ((data->flag & CAMERASOLVER_ACTIVECLIP) == 0 && (data->clip == NULL)) curcon->flag |= CONSTRAINT_DISABLE; } diff --git a/source/blender/makesrna/intern/rna_constraint.c b/source/blender/makesrna/intern/rna_constraint.c index 7c981149aca..e1f1ab97726 100644 --- a/source/blender/makesrna/intern/rna_constraint.c +++ b/source/blender/makesrna/intern/rna_constraint.c @@ -1105,6 +1105,7 @@ static void rna_def_constraint_action(BlenderRNA *brna) prop = RNA_def_property(srna, "action", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "act"); + RNA_def_property_pointer_funcs(prop, NULL, NULL, NULL, "rna_Action_id_poll"); RNA_def_property_ui_text(prop, "Action", "The constraining action"); RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_REFCOUNT); RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update"); From dde529e97757d3cf7bab2e6dce20b7fddbd968cf Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 17 May 2012 10:31:06 +0000 Subject: [PATCH 4/5] remove doubleups of newlines in readfile error prints --- source/blender/blenloader/intern/readfile.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 7078446801b..f57310dab74 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -4874,8 +4874,8 @@ static void lib_link_scene(FileData *fd, Main *main) if (base->object==NULL) { BKE_reportf_wrap(fd->reports, RPT_ERROR, - "LIB ERROR: Object lost from scene:'%s\'\n", - sce->id.name+2); + "LIB ERROR: Object lost from scene:'%s\'", + sce->id.name + 2); BLI_remlink(&sce->base, base); if (base==sce->basact) sce->basact= NULL; MEM_freeN(base); @@ -7209,8 +7209,8 @@ static void do_versions(FileData *fd, Library *lib, Main *main) if (prop) { BKE_reportf_wrap(fd->reports, RPT_WARNING, "Game property name conflict in object: \"%s\".\nText objects reserve the " - "[\"Text\"] game property to change their content through Logic Bricks.\n", - ob->id.name+2); + "[\"Text\"] game property to change their content through Logic Bricks.", + ob->id.name + 2); } } } @@ -9042,7 +9042,7 @@ static void read_libraries(FileData *basefd, ListBase *mainlist) if (fd==NULL) { BKE_reportf_wrap(basefd->reports, RPT_ERROR, - "Can't find lib '%s'\n", + "Can't find lib '%s'", mainptr->curlib->filepath); } } @@ -9061,7 +9061,7 @@ static void read_libraries(FileData *basefd, ListBase *mainlist) append_id_part(fd, mainptr, id, &realid); if (!realid) { BKE_reportf_wrap(fd->reports, RPT_ERROR, - "LIB ERROR: %s:'%s' missing from '%s'\n", + "LIB ERROR: %s:'%s' missing from '%s'", BKE_idcode_to_name(GS(id->name)), id->name+2, mainptr->curlib->filepath); } @@ -9100,8 +9100,8 @@ static void read_libraries(FileData *basefd, ListBase *mainlist) if (id->flag & LIB_READ) { BLI_remlink(lbarray[a], id); BKE_reportf_wrap(basefd->reports, RPT_ERROR, - "LIB ERROR: %s:'%s' unread libblock missing from '%s'\n", - BKE_idcode_to_name(GS(id->name)), id->name+2, mainptr->curlib->filepath); + "LIB ERROR: %s:'%s' unread libblock missing from '%s'", + BKE_idcode_to_name(GS(id->name)), id->name + 2, mainptr->curlib->filepath); change_idid_adr(mainlist, basefd, id, NULL); MEM_freeN(id); From eb57856a19127f8867974470dfbfb7524740cd70 Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Thu, 17 May 2012 10:42:24 +0000 Subject: [PATCH 5/5] Fix select_similar_type_itemf() enum-item-generator func to return the whole prop_similar_types when context is NULL (needed at least by i18n tools!). --- source/blender/editors/mesh/editmesh_select.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/source/blender/editors/mesh/editmesh_select.c b/source/blender/editors/mesh/editmesh_select.c index f1393e4def1..2df89a3df6c 100644 --- a/source/blender/editors/mesh/editmesh_select.c +++ b/source/blender/editors/mesh/editmesh_select.c @@ -834,7 +834,12 @@ static int edbm_select_similar_exec(bContext *C, wmOperator *op) static EnumPropertyItem *select_similar_type_itemf(bContext *C, PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), int *free) { - Object *obedit = CTX_data_edit_object(C); + Object *obedit; + + if (!C) /* needed for docs and i18n tools */ + return prop_similar_types; + + obedit = CTX_data_edit_object(C); if (obedit && obedit->type == OB_MESH) { EnumPropertyItem *item = NULL; @@ -862,7 +867,7 @@ static EnumPropertyItem *select_similar_type_itemf(bContext *C, PointerRNA *UNUS return item; } - + return NULL; }