From 1997cba227138efb1bf9aeb514a2eef15385eef1 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Tue, 11 Oct 2011 14:53:27 +0000 Subject: Fix crash drawing waveform with zero length sound, found looking into sound reading bug. --- source/blender/editors/space_sequencer/sequencer_draw.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c b/source/blender/editors/space_sequencer/sequencer_draw.c index 0f5398f24a7..9e402de3b9d 100644 --- a/source/blender/editors/space_sequencer/sequencer_draw.c +++ b/source/blender/editors/space_sequencer/sequencer_draw.c @@ -187,6 +187,9 @@ static void drawseqwave(Scene *scene, Sequence *seq, float x1, float y1, float x if(!seq->sound->waveform) sound_read_waveform(seq->sound); + if(!seq->sound->waveform) + return; /* zero length sound */ + waveform = seq->sound->waveform; startsample = floor((seq->startofs + seq->anim_startofs)/FPS * SOUND_WAVE_SAMPLES_PER_SECOND); -- cgit v1.2.3 From 6b2dd62c64638b97ae9b3164a69dc143a31447cd Mon Sep 17 00:00:00 2001 From: Nathan Letwory Date: Tue, 11 Oct 2011 17:30:08 +0000 Subject: Commit testing notifier hack --- doc/build_systems/scons-dev.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/build_systems/scons-dev.txt b/doc/build_systems/scons-dev.txt index ca1b3924804..4cc4e6c6ec2 100644 --- a/doc/build_systems/scons-dev.txt +++ b/doc/build_systems/scons-dev.txt @@ -189,6 +189,6 @@ $Id$ need changes elsewhere in the system, as it is handled automatically with the central library repository. - Enjoy the new system! + Enjoy the new system!! /Nathan Letwory (jesterKing) -- cgit v1.2.3 From 4750f24663cc4077861de80a38dcd21af781f30d Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 11 Oct 2011 23:08:17 +0000 Subject: fix for crash caused by invalid active material index while editing text. also added some better error checking in object_remove_material_slot() so it will print an error rather then crashing if this case ever happens again. --- source/blender/blenkernel/intern/font.c | 2 +- source/blender/blenkernel/intern/material.c | 19 +++++++++++++------ source/blender/editors/curve/editfont.c | 9 ++++++++- 3 files changed, 22 insertions(+), 8 deletions(-) diff --git a/source/blender/blenkernel/intern/font.c b/source/blender/blenkernel/intern/font.c index 4c8d0cf998d..9c01b35b91a 100644 --- a/source/blender/blenkernel/intern/font.c +++ b/source/blender/blenkernel/intern/font.c @@ -546,7 +546,7 @@ static void buildchar(Main *bmain, Curve *cu, unsigned long character, CharInfo nu2->knotsu = nu2->knotsv = NULL; nu2->flag= CU_SMOOTH; nu2->charidx = charidx; - if (info->mat_nr) { + if (info->mat_nr > 0) { nu2->mat_nr= info->mat_nr-1; } else { diff --git a/source/blender/blenkernel/intern/material.c b/source/blender/blenkernel/intern/material.c index ed9be989dbd..ebd05ab9bf8 100644 --- a/source/blender/blenkernel/intern/material.c +++ b/source/blender/blenkernel/intern/material.c @@ -1105,8 +1105,17 @@ int object_remove_material_slot(Object *ob) short *totcolp; short a, actcol; - if(ob==NULL || ob->totcol==0) return FALSE; - + if (ob==NULL || ob->totcol==0) { + return FALSE; + } + + /* this should never happen and used to crash */ + if (ob->actcol <= 0) { + printf("%s: invalid material index %d, report a bug!\n", __func__, ob->actcol); + BLI_assert(0); + return FALSE; + } + /* take a mesh/curve/mball as starting point, remove 1 index, * AND with all objects that share the ob->data * @@ -1119,10 +1128,8 @@ int object_remove_material_slot(Object *ob) if(*matarar==NULL) return FALSE; /* we delete the actcol */ - if(ob->totcol) { - mao= (*matarar)[ob->actcol-1]; - if(mao) mao->id.us--; - } + mao= (*matarar)[ob->actcol-1]; + if(mao) mao->id.us--; for(a=ob->actcol; atotcol; a++) (*matarar)[a-1]= (*matarar)[a]; diff --git a/source/blender/editors/curve/editfont.c b/source/blender/editors/curve/editfont.c index d8257c524c1..19892d2c1ee 100644 --- a/source/blender/editors/curve/editfont.c +++ b/source/blender/editors/curve/editfont.c @@ -264,9 +264,16 @@ static void text_update_edited(bContext *C, Scene *scene, Object *obedit, int re EditFont *ef= cu->editfont; cu->curinfo = ef->textbufinfo[cu->pos?cu->pos-1:0]; - if(obedit->totcol>0) + if(obedit->totcol > 0) { obedit->actcol= ef->textbufinfo[cu->pos?cu->pos-1:0].mat_nr; + /* since this array is calloc'd, it can be 0 even though we try ensure + * (mat_nr > 0) almost everywhere */ + if (obedit->actcol < 1) { + obedit->actcol= 1; + } + } + if(mode == FO_EDIT) update_string(cu); -- cgit v1.2.3 From e3be5aacf8db45689ff03a9a1cf1b4e9f3e05fea Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 11 Oct 2011 23:27:01 +0000 Subject: fix [#28873] Blenders Python API Sphinx Build Script give exceptions --- doc/python_api/sphinx_doc_gen.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/doc/python_api/sphinx_doc_gen.py b/doc/python_api/sphinx_doc_gen.py index c1bed089b5a..8743a89057e 100644 --- a/doc/python_api/sphinx_doc_gen.py +++ b/doc/python_api/sphinx_doc_gen.py @@ -1042,7 +1042,9 @@ def rna2sphinx(BASEPATH): fw("html_theme = 'blender-org'\n") fw("html_theme_path = ['../']\n") - fw("html_favicon = 'favicon.ico'\n") + # copied with the theme, exclude else we get an error [#28873] + fw("html_favicon = 'favicon.ico'\n") + # not helpful since the source us generated, adds to upload size. fw("html_copy_source = False\n") fw("\n") -- cgit v1.2.3 From 4bfee0a1cf33f7b74f937ab991967f2047b80b9c Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 11 Oct 2011 23:52:45 +0000 Subject: fix [#28879] can't change names of some of the VSE strips Multi-Cam, Sound, Movie and Image strips were not showing strip names. also replace sprintf() with safer BLI_snprintf() --- .../editors/space_sequencer/sequencer_draw.c | 25 +++++++++++----------- 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c b/source/blender/editors/space_sequencer/sequencer_draw.c index 9e402de3b9d..8f1ea6fe254 100644 --- a/source/blender/editors/space_sequencer/sequencer_draw.c +++ b/source/blender/editors/space_sequencer/sequencer_draw.c @@ -511,47 +511,48 @@ static void draw_seq_text(View2D *v2d, Sequence *seq, float x1, float x2, float char str[32 + FILE_MAXDIR+FILE_MAXFILE]; const char *name= seq->name+2; char col[4]; - + + /* note, all strings should include 'name' */ if(name[0]=='\0') name= give_seqname(seq); if(seq->type == SEQ_META || seq->type == SEQ_ADJUSTMENT) { - sprintf(str, "%d | %s", seq->len, name); + BLI_snprintf(str, sizeof(str), "%d | %s", seq->len, name); } else if(seq->type == SEQ_SCENE) { if(seq->scene) { if(seq->scene_camera) { - sprintf(str, "%d | %s: %s (%s)", seq->len, name, seq->scene->id.name+2, ((ID *)seq->scene_camera)->name+2); + BLI_snprintf(str, sizeof(str), "%d | %s: %s (%s)", seq->len, name, seq->scene->id.name+2, ((ID *)seq->scene_camera)->name+2); } else { - sprintf(str, "%d | %s: %s", seq->len, name, seq->scene->id.name+2); + BLI_snprintf(str, sizeof(str), "%d | %s: %s", seq->len, name, seq->scene->id.name+2); } } else { - sprintf(str, "%d | %s", seq->len, name); + BLI_snprintf(str, sizeof(str), "%d | %s", seq->len, name); } } else if(seq->type == SEQ_MULTICAM) { - sprintf(str, "Cam: %d", seq->multicam_source); + BLI_snprintf(str, sizeof(str), "Cam | %s: %d", name, seq->multicam_source); } else if(seq->type == SEQ_IMAGE) { - sprintf(str, "%d | %s%s", seq->len, seq->strip->dir, seq->strip->stripdata->name); + BLI_snprintf(str, sizeof(str), "%d | %s: %s%s", seq->len, name, seq->strip->dir, seq->strip->stripdata->name); } else if(seq->type & SEQ_EFFECT) { int can_float = (seq->type != SEQ_PLUGIN) || (seq->plugin && seq->plugin->version >= 4); if(seq->seq3!=seq->seq2 && seq->seq1!=seq->seq3) - sprintf(str, "%d | %s: %d>%d (use %d)%s", seq->len, name, seq->seq1->machine, seq->seq2->machine, seq->seq3->machine, can_float ? "" : " No float, upgrade plugin!"); + BLI_snprintf(str, sizeof(str), "%d | %s: %d>%d (use %d)%s", seq->len, name, seq->seq1->machine, seq->seq2->machine, seq->seq3->machine, can_float ? "" : " No float, upgrade plugin!"); else if (seq->seq1 && seq->seq2) - sprintf(str, "%d | %s: %d>%d%s", seq->len, name, seq->seq1->machine, seq->seq2->machine, can_float ? "" : " No float, upgrade plugin!"); + BLI_snprintf(str, sizeof(str), "%d | %s: %d>%d%s", seq->len, name, seq->seq1->machine, seq->seq2->machine, can_float ? "" : " No float, upgrade plugin!"); else - sprintf(str, "%d | %s", seq->len, name); + BLI_snprintf(str, sizeof(str), "%d | %s", seq->len, name); } else if (seq->type == SEQ_SOUND) { - sprintf(str, "%d | %s", seq->len, seq->sound->name); + BLI_snprintf(str, sizeof(str), "%d | %s: %s", seq->len, name, seq->sound->name); } else if (seq->type == SEQ_MOVIE) { - sprintf(str, "%d | %s%s", seq->len, seq->strip->dir, seq->strip->stripdata->name); + BLI_snprintf(str, sizeof(str), "%d | %s: %s%s", seq->len, name, seq->strip->dir, seq->strip->stripdata->name); } if(seq->flag & SELECT){ -- cgit v1.2.3 From 15bf56c696b976a4f74b4b0cae4371ea8008e231 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 12 Oct 2011 00:15:19 +0000 Subject: changes to relative path option - initialize the relative_path option in ED_fileselect_get_params(), saves initializing within every operators own init functions, some even trying to initialize a non existing property. - don't set the operator default from the user preferece, operator property defaults should be static else python scripts for eg can get different defaults depending on user settings, this also wont get updated when user-defaults are edited so generally confusing & not good practice. --- source/blender/editors/curve/editfont.c | 5 +---- source/blender/editors/object/object_modifier.c | 3 --- source/blender/editors/render/render_shading.c | 3 --- source/blender/editors/sound/sound_ops.c | 6 ------ source/blender/editors/space_buttons/buttons_ops.c | 2 ++ source/blender/editors/space_file/filesel.c | 6 ++++++ source/blender/editors/space_image/image_ops.c | 7 ------- source/blender/editors/space_sequencer/sequencer_add.c | 15 +-------------- source/blender/windowmanager/intern/wm_operators.c | 5 +---- 9 files changed, 11 insertions(+), 41 deletions(-) diff --git a/source/blender/editors/curve/editfont.c b/source/blender/editors/curve/editfont.c index 19892d2c1ee..1f2ef79e091 100644 --- a/source/blender/editors/curve/editfont.c +++ b/source/blender/editors/curve/editfont.c @@ -1707,10 +1707,7 @@ static int open_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) } path = (font && strcmp(font->name, FO_BUILTIN_NAME) != 0)? font->name: U.fontdir; - - if(!RNA_property_is_set(op->ptr, "relative_path")) - RNA_boolean_set(op->ptr, "relative_path", U.flag & USER_RELPATHS); - + if(RNA_property_is_set(op->ptr, "filepath")) return open_exec(C, op); diff --git a/source/blender/editors/object/object_modifier.c b/source/blender/editors/object/object_modifier.c index ebbc4137628..20ca50581bf 100644 --- a/source/blender/editors/object/object_modifier.c +++ b/source/blender/editors/object/object_modifier.c @@ -1163,9 +1163,6 @@ static int multires_external_save_invoke(bContext *C, wmOperator *op, wmEvent *U if(CustomData_external_test(&me->fdata, CD_MDISPS)) return OPERATOR_CANCELLED; - if(!RNA_property_is_set(op->ptr, "relative_path")) - RNA_boolean_set(op->ptr, "relative_path", U.flag & USER_RELPATHS); - if(RNA_property_is_set(op->ptr, "filepath")) return multires_external_save_exec(C, op); diff --git a/source/blender/editors/render/render_shading.c b/source/blender/editors/render/render_shading.c index 72cc4ec2afa..faf0baa1aca 100644 --- a/source/blender/editors/render/render_shading.c +++ b/source/blender/editors/render/render_shading.c @@ -712,9 +712,6 @@ static int envmap_save_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event { //Scene *scene= CTX_data_scene(C); - if(!RNA_property_is_set(op->ptr, "relative_path")) - RNA_boolean_set(op->ptr, "relative_path", U.flag & USER_RELPATHS); - if(RNA_property_is_set(op->ptr, "filepath")) return envmap_save_exec(C, op); diff --git a/source/blender/editors/sound/sound_ops.c b/source/blender/editors/sound/sound_ops.c index d03c2b19300..50dda49bead 100644 --- a/source/blender/editors/sound/sound_ops.c +++ b/source/blender/editors/sound/sound_ops.c @@ -164,9 +164,6 @@ static int open_exec(bContext *UNUSED(C), wmOperator *op) static int open_invoke(bContext *C, wmOperator *op, wmEvent *event) { - if(!RNA_property_is_set(op->ptr, "relative_path")) - RNA_boolean_set(op->ptr, "relative_path", U.flag & USER_RELPATHS); - if(RNA_property_is_set(op->ptr, "filepath")) return open_exec(C, op); @@ -264,9 +261,6 @@ static int mixdown_exec(bContext *C, wmOperator *op) static int mixdown_invoke(bContext *C, wmOperator *op, wmEvent *event) { - if(!RNA_property_is_set(op->ptr, "relative_path")) - RNA_boolean_set(op->ptr, "relative_path", U.flag & USER_RELPATHS); - if(RNA_property_is_set(op->ptr, "filepath")) return mixdown_exec(C, op); diff --git a/source/blender/editors/space_buttons/buttons_ops.c b/source/blender/editors/space_buttons/buttons_ops.c index 99e5c6d693e..75b3eb950a5 100644 --- a/source/blender/editors/space_buttons/buttons_ops.c +++ b/source/blender/editors/space_buttons/buttons_ops.c @@ -201,6 +201,8 @@ static int file_browse_invoke(bContext *C, wmOperator *op, wmEvent *event) RNA_string_set(op->ptr, path_prop, str); MEM_freeN(str); + /* normally ED_fileselect_get_params would handle this but we need to because of stupid + * user-prefs exception - campbell */ if(RNA_struct_find_property(op->ptr, "relative_path")) { if(!RNA_property_is_set(op->ptr, "relative_path")) { /* annoying exception!, if were dealign with the user prefs, default relative to be off */ diff --git a/source/blender/editors/space_file/filesel.c b/source/blender/editors/space_file/filesel.c index e3571886cf4..6cc42b2a751 100644 --- a/source/blender/editors/space_file/filesel.c +++ b/source/blender/editors/space_file/filesel.c @@ -125,6 +125,7 @@ short ED_fileselect_set_params(SpaceFile *sfile) const short is_filepath= (RNA_struct_find_property(op->ptr, "filepath") != NULL); const short is_filename= (RNA_struct_find_property(op->ptr, "filename") != NULL); const short is_directory= (RNA_struct_find_property(op->ptr, "directory") != NULL); + const short is_relative_path= (RNA_struct_find_property(op->ptr, "relative_path") != NULL); BLI_strncpy(params->title, op->type->name, sizeof(params->title)); @@ -228,6 +229,11 @@ short ED_fileselect_set_params(SpaceFile *sfile) params->display= FILE_SHORTDISPLAY; } + if (is_relative_path) { + if (!RNA_property_is_set(op->ptr, "relative_path")) { + RNA_boolean_set(op->ptr, "relative_path", U.flag & USER_RELPATHS); + } + } } else { /* default values, if no operator */ diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c index 33c3ae45a58..725b5f5c02d 100644 --- a/source/blender/editors/space_image/image_ops.c +++ b/source/blender/editors/space_image/image_ops.c @@ -843,10 +843,6 @@ static int open_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) if(ima) path= ima->name; - - - if(!RNA_property_is_set(op->ptr, "relative_path")) - RNA_boolean_set(op->ptr, "relative_path", U.flag & USER_RELPATHS); if(RNA_property_is_set(op->ptr, "filepath")) return open_exec(C, op); @@ -1167,9 +1163,6 @@ static int save_as_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) Scene *scene= CTX_data_scene(C); SaveImageOptions simopts; - if(!RNA_property_is_set(op->ptr, "relative_path")) - RNA_boolean_set(op->ptr, "relative_path", U.flag & USER_RELPATHS); - if(RNA_property_is_set(op->ptr, "filepath")) return save_as_exec(C, op); diff --git a/source/blender/editors/space_sequencer/sequencer_add.c b/source/blender/editors/space_sequencer/sequencer_add.c index b390b7dbdb5..1c4b0130897 100644 --- a/source/blender/editors/space_sequencer/sequencer_add.c +++ b/source/blender/editors/space_sequencer/sequencer_add.c @@ -380,9 +380,6 @@ static int sequencer_add_movie_strip_invoke(bContext *C, wmOperator *op, wmEvent sequencer_generic_invoke_xy__internal(C, op, event, 0); - 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; @@ -434,10 +431,7 @@ static int sequencer_add_sound_strip_invoke(bContext *C, wmOperator *op, wmEvent } sequencer_generic_invoke_xy__internal(C, op, event, 0); - - 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; @@ -543,9 +537,6 @@ static int sequencer_add_image_strip_invoke(bContext *C, wmOperator *op, wmEvent } sequencer_generic_invoke_xy__internal(C, op, event, SEQPROP_ENDFRAME); - - 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; @@ -721,10 +712,6 @@ static int sequencer_add_effect_strip_invoke(bContext *C, wmOperator *op, wmEven sequencer_generic_invoke_xy__internal(C, op, event, prop_flag); if (is_type_set && type==SEQ_PLUGIN) { - - if(!RNA_property_is_set(op->ptr, "relative_path")) - RNA_boolean_set(op->ptr, "relative_path", U.flag & USER_RELPATHS); - /* only plugins need the file selector */ return WM_operator_filesel(C, op, event); } diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c index eda85f112df..07bab06e52f 100644 --- a/source/blender/windowmanager/intern/wm_operators.c +++ b/source/blender/windowmanager/intern/wm_operators.c @@ -860,7 +860,7 @@ void WM_operator_properties_filesel(wmOperatorType *ot, int filter, short type, RNA_def_property_flag(prop, PROP_HIDDEN); if(flag & WM_FILESEL_RELPATH) - RNA_def_boolean(ot->srna, "relative_path", (U.flag & USER_RELPATHS) ? 1:0, "Relative Path", "Select the file relative to the blend file"); + RNA_def_boolean(ot->srna, "relative_path", TRUE, "Relative Path", "Select the file relative to the blend file"); } void WM_operator_properties_select_all(wmOperatorType *ot) @@ -1618,9 +1618,6 @@ static void WM_OT_open_mainfile(wmOperatorType *ot) static int wm_link_append_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { - if(!RNA_property_is_set(op->ptr, "relative_path")) - RNA_boolean_set(op->ptr, "relative_path", U.flag & USER_RELPATHS); - if(RNA_property_is_set(op->ptr, "filepath")) { return WM_operator_call(C, op); } -- cgit v1.2.3 From 18b9a2d0bcced11e6207ba98e1b92127c3705416 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 12 Oct 2011 00:21:08 +0000 Subject: fix [#28880] relative paths don't work with Change Path/Files --- source/blender/editors/space_sequencer/sequencer_edit.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c index bd93a1270f6..da785430d43 100644 --- a/source/blender/editors/space_sequencer/sequencer_edit.c +++ b/source/blender/editors/space_sequencer/sequencer_edit.c @@ -2961,9 +2961,11 @@ void SEQUENCER_OT_change_effect_type(struct wmOperatorType *ot) static int sequencer_change_path_exec(bContext *C, wmOperator *op) { + Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); Editing *ed= seq_give_editing(scene, FALSE); Sequence *seq= seq_active_get(scene); + const int is_relative_path= RNA_boolean_get(op->ptr, "relative_path"); if(seq->type == SEQ_IMAGE) { char directory[FILE_MAX]; @@ -2974,6 +2976,12 @@ static int sequencer_change_path_exec(bContext *C, wmOperator *op) return OPERATOR_CANCELLED; RNA_string_get(op->ptr, "directory", directory); + if (is_relative_path) { + /* TODO, shouldnt this already be relative from the filesel? + * (as the 'filepath' is) for now just make relative here, + * but look into changing after 2.60 - campbell */ + BLI_path_rel(directory, bmain->name); + } BLI_strncpy(seq->strip->dir, directory, sizeof(seq->strip->dir)); if(seq->strip->stripdata) { -- cgit v1.2.3 From 50a851b946bc7eebdf3d489786f1a18c9ec3d8f1 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 12 Oct 2011 00:47:50 +0000 Subject: python UI was doing a lot of attribute lookups on tool & sculpt tool (not especially efficient & annoying when adding breakpoints into why its not working right). --- .../scripts/startup/bl_ui/space_view3d_toolbar.py | 35 ++++++++++++---------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/release/scripts/startup/bl_ui/space_view3d_toolbar.py b/release/scripts/startup/bl_ui/space_view3d_toolbar.py index e322a6dcd13..8f1833f952b 100644 --- a/release/scripts/startup/bl_ui/space_view3d_toolbar.py +++ b/release/scripts/startup/bl_ui/space_view3d_toolbar.py @@ -484,16 +484,18 @@ class VIEW3D_PT_tools_brush(PaintPanel, Panel): # XXX This needs a check if psys is editable. if context.particle_edit_object: + tool = settings.tool + # XXX Select Particle System layout.column().prop(settings, "tool", expand=True) - if settings.tool != 'NONE': + if tool != 'NONE': col = layout.column() col.prop(brush, "size", slider=True) - if settings.tool != 'ADD': + if tool != 'ADD': col.prop(brush, "strength", slider=True) - if settings.tool == 'ADD': + if tool == 'ADD': col.prop(brush, "count") col = layout.column() col.prop(settings, "use_default_interpolate") @@ -501,15 +503,16 @@ class VIEW3D_PT_tools_brush(PaintPanel, Panel): sub.active = settings.use_default_interpolate sub.prop(brush, "steps", slider=True) sub.prop(settings, "default_key_count", slider=True) - elif settings.tool == 'LENGTH': + elif tool == 'LENGTH': layout.prop(brush, "length_mode", expand=True) - elif settings.tool == 'PUFF': + elif tool == 'PUFF': layout.prop(brush, "puff_mode", expand=True) layout.prop(brush, "use_puff_volume") # Sculpt Mode # elif context.sculpt_object and brush: + tool = brush.sculpt_tool col = layout.column() @@ -526,12 +529,12 @@ class VIEW3D_PT_tools_brush(PaintPanel, Panel): row.prop(brush, "use_pressure_size", toggle=True, text="") - if brush.sculpt_tool not in {'SNAKE_HOOK', 'GRAB', 'ROTATE'}: + if tool not in {'SNAKE_HOOK', 'GRAB', 'ROTATE'}: col.separator() row = col.row(align=True) - if brush.use_space and brush.sculpt_tool not in {'SMOOTH'}: + if brush.use_space and tool != 'SMOOTH': if brush.use_space_atten: row.prop(brush, "use_space_atten", toggle=True, text="", icon='LOCKED') else: @@ -540,26 +543,26 @@ class VIEW3D_PT_tools_brush(PaintPanel, Panel): row.prop(brush, "strength", text="Strength", slider=True) row.prop(brush, "use_pressure_strength", text="") - if brush.sculpt_tool not in {'SMOOTH'}: + if tool != 'SMOOTH': col.separator() row = col.row(align=True) row.prop(brush, "auto_smooth_factor", slider=True) row.prop(brush, "use_inverse_smooth_pressure", toggle=True, text="") - if brush.sculpt_tool in {'GRAB', 'SNAKE_HOOK'}: + if tool in {'GRAB', 'SNAKE_HOOK'}: col.separator() row = col.row(align=True) row.prop(brush, "normal_weight", slider=True) - if brush.sculpt_tool in {'CREASE', 'BLOB'}: + if tool in {'CREASE', 'BLOB'}: col.separator() row = col.row(align=True) row.prop(brush, "crease_pinch_factor", slider=True, text="Pinch") - if brush.sculpt_tool not in {'PINCH', 'INFLATE', 'SMOOTH'}: + if tool not in {'PINCH', 'INFLATE', 'SMOOTH'}: row = col.row(align=True) col.separator() @@ -571,8 +574,8 @@ class VIEW3D_PT_tools_brush(PaintPanel, Panel): row.prop(brush, "sculpt_plane", text="") - #if brush.sculpt_tool in {'CLAY', 'CLAY_TUBES', 'FLATTEN', 'FILL', 'SCRAPE'}: - if brush.sculpt_tool in {'CLAY', 'FLATTEN', 'FILL', 'SCRAPE'}: + #if tool in {'CLAY', 'CLAY_TUBES', 'FLATTEN', 'FILL', 'SCRAPE'}: + if tool in {'CLAY', 'FLATTEN', 'FILL', 'SCRAPE'}: row = col.row(align=True) row.prop(brush, "plane_offset", slider=True) row.prop(brush, "use_offset_pressure", text="") @@ -585,7 +588,7 @@ class VIEW3D_PT_tools_brush(PaintPanel, Panel): row.active = brush.use_plane_trim row.prop(brush, "plane_trim", slider=True, text="Distance") - if brush.sculpt_tool == 'LAYER': + if tool == 'LAYER': row = col.row() row.prop(brush, "height", slider=True, text="Height") @@ -597,12 +600,12 @@ class VIEW3D_PT_tools_brush(PaintPanel, Panel): col.separator() col.row().prop(brush, "direction", expand=True) - if brush.sculpt_tool in {'DRAW', 'CREASE', 'BLOB', 'INFLATE', 'LAYER', 'CLAY'}: + if tool in {'DRAW', 'CREASE', 'BLOB', 'INFLATE', 'LAYER', 'CLAY'}: col.separator() col.prop(brush, "use_accumulate") - if brush.sculpt_tool == 'LAYER': + if tool == 'LAYER': col.separator() ob = context.sculpt_object -- cgit v1.2.3 From 51cbfb396128bf800c0b53fd922a87dc4fe0ff79 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 12 Oct 2011 01:36:06 +0000 Subject: fix [#28883] redraw problems for particle mode's brush menu The enum items for getting the brush tool (which the UI draws), would change after the 3D view first draws on exiting editmode. Since the panel draws before the 3D view does, the UI had a glitch. Fix by using psys_get_current() for the enum, rather then PE_get_current() which depends on an updated particle system. --- source/blender/makesrna/intern/rna_sculpt_paint.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/source/blender/makesrna/intern/rna_sculpt_paint.c b/source/blender/makesrna/intern/rna_sculpt_paint.c index b350956047c..28b96f3b08b 100644 --- a/source/blender/makesrna/intern/rna_sculpt_paint.c +++ b/source/blender/makesrna/intern/rna_sculpt_paint.c @@ -131,13 +131,23 @@ static EnumPropertyItem *rna_ParticleEdit_tool_itemf(bContext *C, PointerRNA *UN { Scene *scene= CTX_data_scene(C); Object *ob= (scene->basact)? scene->basact->object: NULL; +#if 0 PTCacheEdit *edit = PE_get_current(scene, ob); - - if(edit && edit->psys) { - if(edit->psys->flag & PSYS_GLOBAL_HAIR) + ParticleSystem *psys= edit ? edit->psys : NULL; +#else + /* use this rather than PE_get_current() - because the editing cache is + * dependant on the cache being updated which can happen after this UI + * draws causing a glitch [#28883] */ + ParticleSystem *psys= psys_get_current(ob); +#endif + + if(psys) { + if(psys->flag & PSYS_GLOBAL_HAIR) { return particle_edit_disconnected_hair_brush_items; - else + } + else { return particle_edit_hair_brush_items; + } } return particle_edit_cache_brush_items; -- cgit v1.2.3 From e2e8cf36da1041949a2501c087d10ea1303fc0be Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 12 Oct 2011 03:46:38 +0000 Subject: fix [#28882] grease pencil draw apperence seems to change wieght/thickness after a while --- source/blender/editors/gpencil/drawgpencil.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/source/blender/editors/gpencil/drawgpencil.c b/source/blender/editors/gpencil/drawgpencil.c index cfa9585868e..b87166c51ca 100644 --- a/source/blender/editors/gpencil/drawgpencil.c +++ b/source/blender/editors/gpencil/drawgpencil.c @@ -114,12 +114,14 @@ static void gp_draw_stroke_buffer (tGPspoint *points, int totpoints, short thick /* don't draw stroke at all! */ } else { - float oldpressure = 0.0f; + float oldpressure = points[0].pressure; /* draw stroke curve */ if (G.f & G_DEBUG) setlinestyle(2); - + + glLineWidth(oldpressure * thickness); glBegin(GL_LINE_STRIP); + for (i=0, pt=points; i < totpoints && pt; i++, pt++) { /* if there was a significant pressure change, stop the curve, change the thickness of the stroke, * and continue drawing again (since line-width cannot change in middle of GL_LINE_STRIP) @@ -144,6 +146,9 @@ static void gp_draw_stroke_buffer (tGPspoint *points, int totpoints, short thick glVertex2f(pt->x, pt->y); } glEnd(); + + /* reset for pradictable OpenGL context */ + glLineWidth(1.0f); if (G.f & G_DEBUG) setlinestyle(0); } -- cgit v1.2.3 From be24b4dfccfda38c776545d571897ab17ecc96a6 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 12 Oct 2011 11:18:46 +0000 Subject: fix for possible buffer overflow bug in BLI_join_dirfile(), recent fix didn't account for the case when destination string and dir string matched. --- source/blender/blenlib/intern/path_util.c | 39 +++++++++++++++++++++++-------- 1 file changed, 29 insertions(+), 10 deletions(-) diff --git a/source/blender/blenlib/intern/path_util.c b/source/blender/blenlib/intern/path_util.c index b206e275d9a..ab7d082c432 100644 --- a/source/blender/blenlib/intern/path_util.c +++ b/source/blender/blenlib/intern/path_util.c @@ -1430,21 +1430,40 @@ void BLI_split_dirfile(const char *string, char *dir, char *file) } /* simple appending of filename to dir, does not check for valid path! */ -void BLI_join_dirfile(char *string, const size_t maxlen, const char *dir, const char *file) +void BLI_join_dirfile(char *dst, const size_t maxlen, const char *dir, const char *file) { - int sl_dir; + size_t dirlen= BLI_strnlen(dir, maxlen); - if(string != dir) /* compare pointers */ - BLI_strncpy(string, dir, maxlen -(file ? 1 : 0)); + if (dst != dir) { + if(dirlen == maxlen) { + memcpy(dst, dir, dirlen); + dst[dirlen - 1]= '\0'; + return; /* dir fills the path */ + } + else { + memcpy(dst, dir, dirlen + 1); + } + } - if (!file) - return; + if (dirlen + 1 >= maxlen) { + return; /* fills the path */ + } - sl_dir= BLI_add_slash(string); - - if (sl_dir < maxlen) { - BLI_strncpy(string + sl_dir, file, maxlen - sl_dir); + /* inline BLI_add_slash */ + if (dst[dirlen - 1] != SEP) { + dst[dirlen++]= SEP; + dst[dirlen ]= '\0'; } + + if (dirlen >= maxlen) { + return; /* fills the path */ + } + + if (file == NULL) { + return; + } + + BLI_strncpy(dst + dirlen, file, maxlen - dirlen); } /* like pythons os.path.basename( ) */ -- cgit v1.2.3 From 5a3540f4d8f8e674eaea96d6ce63f87b685c29ef Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Wed, 12 Oct 2011 12:49:45 +0000 Subject: Fixes for #26837: MPEG Preseek does not work for some h264 files. - Display running job template in all sequencer modes It was displayed only for sequencer mode without preview. - Fixed proxy rebuild progress indicator It was alsways zero because of incorrect rounding. - Fixed timecode saving on windows (and probably some other platforms) It was caused by incorrect opening file for writting -- it should be opened in binary format "wb". This error caused incorrect movie duration detection on windows. - Fixed movie resolution detection for some movies. In file attached to report, Blender detected resolution 1920x1088 instead of 1920x1080. Not sure if this fix is correct or it's issue in FFmpeg, but it's something what mplayer using: store width/height before running avcodec_open(). - Fixed frame number calculation when building timecodes. It was rounding error caused some frames be positioned incorrect in several cases (that each 6th frame rendered as next frame from report). --- release/scripts/startup/bl_ui/space_sequencer.py | 3 ++- source/blender/imbuf/intern/anim_movie.c | 8 ++++++-- source/blender/imbuf/intern/indexer.c | 8 ++++---- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/release/scripts/startup/bl_ui/space_sequencer.py b/release/scripts/startup/bl_ui/space_sequencer.py index b03e7b8c59c..2e957effccd 100644 --- a/release/scripts/startup/bl_ui/space_sequencer.py +++ b/release/scripts/startup/bl_ui/space_sequencer.py @@ -60,7 +60,6 @@ class SEQUENCER_HT_header(Header): layout.separator() layout.operator("sequencer.refresh_all") - layout.template_running_jobs() elif st.view_type == 'SEQUENCER_PREVIEW': layout.separator() layout.operator("sequencer.refresh_all") @@ -76,6 +75,8 @@ class SEQUENCER_HT_header(Header): row.prop(ed, "overlay_frame", text="") row.prop(ed, "overlay_lock", text="", icon='LOCKED') + layout.template_running_jobs() + class SEQUENCER_MT_view_toggle(Menu): bl_label = "View Type" diff --git a/source/blender/imbuf/intern/anim_movie.c b/source/blender/imbuf/intern/anim_movie.c index b9500c2f798..c07326c1237 100644 --- a/source/blender/imbuf/intern/anim_movie.c +++ b/source/blender/imbuf/intern/anim_movie.c @@ -418,6 +418,7 @@ static int startffmpeg(struct anim * anim) { int frs_num; double frs_den; int streamcount; + int width, height; #ifdef FFMPEG_SWSCALE_COLOR_SPACE_SUPPORT /* The following for color space determination */ @@ -474,6 +475,9 @@ static int startffmpeg(struct anim * anim) { pCodecCtx->workaround_bugs = 1; + width = pCodecCtx->width; + height = pCodecCtx->height; + if(avcodec_open(pCodecCtx, pCodec) < 0) { av_close_input_file(pFormatCtx); return -1; @@ -498,8 +502,8 @@ static int startffmpeg(struct anim * anim) { anim->params = 0; - anim->x = pCodecCtx->width; - anim->y = pCodecCtx->height; + anim->x = width; + anim->y = height; anim->interlacing = 0; anim->orientation = 0; anim->framesize = anim->x * anim->y * 4; diff --git a/source/blender/imbuf/intern/indexer.c b/source/blender/imbuf/intern/indexer.c index d79e881e5a2..3f764e4d452 100644 --- a/source/blender/imbuf/intern/indexer.c +++ b/source/blender/imbuf/intern/indexer.c @@ -87,7 +87,7 @@ anim_index_builder * IMB_index_builder_create(const char * name) BLI_make_existing_file(rv->temp_name); - rv->fp = fopen(rv->temp_name, "w"); + rv->fp = fopen(rv->temp_name, "wb"); if (!rv->fp) { fprintf(stderr, "Couldn't open index target: %s! " @@ -797,7 +797,7 @@ static int index_rebuild_ffmpeg(struct anim * anim, while(av_read_frame(iFormatCtx, &next_packet) >= 0) { int frame_finished = 0; - float next_progress = ((int)floor(((double) next_packet.pos) * 100 / + float next_progress = (float)((int)floor(((double) next_packet.pos) * 100 / ((double) stream_size)+0.5)) / 100; if (*progress != next_progress) { @@ -840,8 +840,8 @@ static int index_rebuild_ffmpeg(struct anim * anim, start_pts_set = TRUE; } - frameno = (pts - start_pts) - * pts_time_base * frame_rate; + frameno = round((pts - start_pts) + * pts_time_base * frame_rate); /* decoding starts *always* on I-Frames, so: P-Frames won't work, even if all the -- cgit v1.2.3 From a85f595721e44cb214262b688f8c418018f1c5c2 Mon Sep 17 00:00:00 2001 From: Lukas Toenne Date: Wed, 12 Oct 2011 12:55:32 +0000 Subject: Fix for #28886, compositor cache regression bug. The problem was that all outputs got tagged indiscriminately (esp. hidden render layer sockets), leading to full recalculation every time. This was caused by erroneous tagging of bNodeStacks with hasinput/hasoutput flags. This patch restores the old behaviour of tagging all non-static stacks as input values and all outputs that are connected to some input. Only difference is in node groups, where the hasoutput flag is no longer abused for tagging internal buffers, here the is_copy flag is used instead. --- source/blender/nodes/intern/node_exec.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/source/blender/nodes/intern/node_exec.c b/source/blender/nodes/intern/node_exec.c index 608347bc258..53bbb27f9b0 100644 --- a/source/blender/nodes/intern/node_exec.c +++ b/source/blender/nodes/intern/node_exec.c @@ -174,11 +174,13 @@ bNodeTreeExec *ntree_exec_begin(bNodeTree *ntree) exec->stacksize = index; exec->stack = MEM_callocN(exec->stacksize * sizeof(bNodeStack), "bNodeStack"); + /* all non-const results are considered inputs */ + for (n=0; n < exec->stacksize; ++n) + exec->stack[n].hasinput = 1; + /* prepare group tree inputs */ for (sock=ntree->inputs.first; sock; sock=sock->next) { ns = setup_stack(exec->stack, sock); - if (ns->hasoutput) - ns->hasinput = 1; } /* prepare all internal nodes for execution */ for(n=0, nodeexec= exec->nodeexec; n < totnodes; ++n, ++nodeexec) { @@ -191,14 +193,12 @@ bNodeTreeExec *ntree_exec_begin(bNodeTree *ntree) node->need_exec= 0; ns = setup_stack(exec->stack, sock); - if (ns->hasoutput) - ns->hasinput = 1; + ns->hasoutput = 1; } /* tag all outputs */ for (sock=node->outputs.first; sock; sock=sock->next) { ns = setup_stack(exec->stack, sock); - ns->hasoutput = 1; } if(node->typeinfo->initexecfunc) -- cgit v1.2.3 From 89dd5e933f01853abdba9249dd2823ac53562c6d Mon Sep 17 00:00:00 2001 From: Lukas Toenne Date: Wed, 12 Oct 2011 13:07:30 +0000 Subject: Fix for #28876, alpha over with empty image node gives black result. The image node output is the default value when no image is selected. In pre-2.60 this was always initialized to 0 alpha, the defaults written in the node socket templates were completely ignored for outputs (except for value and RGB input nodes, which use these as button values). Now the stack values are initialized with the template defaults, which are all 0 by default. This patch changes alpha to 0 for image and render layer outputs too. --- source/blender/blenloader/intern/readfile.c | 24 ++++++++++++++++++++++ .../nodes/composite/nodes/node_composite_image.c | 2 +- 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 38b4a773650..331eeb9a959 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -7068,6 +7068,19 @@ void convert_tface_mt(FileData *fd, Main *main) } } +static void do_versions_nodetree_image_default_alpha_output(bNodeTree *ntree) +{ + bNode *node; + bNodeSocket *sock; + for (node=ntree->nodes.first; node; node=node->next) { + if (ELEM(node->type, CMP_NODE_IMAGE, CMP_NODE_R_LAYERS)) { + /* default Image output value should have 0 alpha */ + sock = node->outputs.first; + ((bNodeSocketValueRGBA*)sock->default_value)->value[3] = 0.0f; + } + } +} + static void do_versions(FileData *fd, Library *lib, Main *main) { /* WATCH IT!!!: pointers from libdata have not been converted */ @@ -12145,6 +12158,17 @@ static void do_versions(FileData *fd, Library *lib, Main *main) /* put compatibility code here until next subversion bump */ { + { + /* set default alpha value of Image outputs in image and render layer nodes to 0 */ + Scene *sce; + bNodeTree *ntree; + + for (sce=main->scene.first; sce; sce=sce->id.next) + if (sce->nodetree) + do_versions_nodetree_image_default_alpha_output(sce->nodetree); + for (ntree=main->nodetree.first; ntree; ntree=ntree->id.next) + do_versions_nodetree_image_default_alpha_output(ntree); + } } /* WATCH IT!!!: pointers from libdata have not been converted yet here! */ diff --git a/source/blender/nodes/composite/nodes/node_composite_image.c b/source/blender/nodes/composite/nodes/node_composite_image.c index c18a35fdd98..5e32800fe45 100644 --- a/source/blender/nodes/composite/nodes/node_composite_image.c +++ b/source/blender/nodes/composite/nodes/node_composite_image.c @@ -38,7 +38,7 @@ /* **************** IMAGE (and RenderResult, multilayer image) ******************** */ static bNodeSocketTemplate cmp_node_rlayers_out[]= { - { SOCK_RGBA, 0, "Image", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f}, + { SOCK_RGBA, 0, "Image", 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, { SOCK_FLOAT, 0, "Alpha", 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, { SOCK_FLOAT, 0, "Z", 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, { SOCK_VECTOR, 0, "Normal", 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, -- cgit v1.2.3 From 4689d78b5c739ed67d915d46972de9c5d8404c48 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Wed, 12 Oct 2011 13:43:56 +0000 Subject: Workaround for #28864: crash rendering out file with audio, due to scene audio channels being set to invalid value 0. The cause of this is unclear, this adds a version patch just to be safe, in case it turns out to be a common issue. --- source/blender/blenloader/intern/readfile.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 331eeb9a959..7d84eeba9c8 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -12163,9 +12163,16 @@ static void do_versions(FileData *fd, Library *lib, Main *main) Scene *sce; bNodeTree *ntree; - for (sce=main->scene.first; sce; sce=sce->id.next) + for (sce=main->scene.first; sce; sce=sce->id.next) { + /* there are files with invalid audio_channels value, the real cause + is unknown, but we fix it here anyway to avoid crashes */ + if(sce->r.ffcodecdata.audio_channels == 0) + sce->r.ffcodecdata.audio_channels = 2; + if (sce->nodetree) do_versions_nodetree_image_default_alpha_output(sce->nodetree); + } + for (ntree=main->nodetree.first; ntree; ntree=ntree->id.next) do_versions_nodetree_image_default_alpha_output(ntree); } -- cgit v1.2.3 From da0354e0541f58a8b48f403e31ba09a5ece5e962 Mon Sep 17 00:00:00 2001 From: Lukas Toenne Date: Wed, 12 Oct 2011 13:53:03 +0000 Subject: Free cache data when creating a new group from selected nodes. This would leave unfreed memory behind otherwise, since node groups don't have internal caches. --- source/blender/nodes/intern/node_common.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/source/blender/nodes/intern/node_common.c b/source/blender/nodes/intern/node_common.c index fa5a3c727c2..56f80840112 100644 --- a/source/blender/nodes/intern/node_common.c +++ b/source/blender/nodes/intern/node_common.c @@ -199,6 +199,9 @@ bNode *node_group_make_from_selected(bNodeTree *ntree) } } + /* node groups don't use internal cached data */ + ntreeFreeCache(ngroup); + /* make group node */ ntemp.type = NODE_GROUP; ntemp.ngroup = ngroup; -- cgit v1.2.3 From dd8eac0d85c3520bcbab286e138be00982734a42 Mon Sep 17 00:00:00 2001 From: "Guillermo S. Romero" Date: Wed, 12 Oct 2011 17:06:15 +0000 Subject: Fix typo. --- source/blender/editors/gpencil/drawgpencil.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/blender/editors/gpencil/drawgpencil.c b/source/blender/editors/gpencil/drawgpencil.c index b87166c51ca..8e83b01fc2f 100644 --- a/source/blender/editors/gpencil/drawgpencil.c +++ b/source/blender/editors/gpencil/drawgpencil.c @@ -147,7 +147,7 @@ static void gp_draw_stroke_buffer (tGPspoint *points, int totpoints, short thick } glEnd(); - /* reset for pradictable OpenGL context */ + /* reset for predictable OpenGL context */ glLineWidth(1.0f); if (G.f & G_DEBUG) setlinestyle(0); -- cgit v1.2.3 From c6f253f8a62a5d6abaa48b4df1d54e5a540d32b5 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Wed, 12 Oct 2011 18:56:55 +0000 Subject: Compile fix for some platforms (like linux release build environment) --- source/blender/imbuf/intern/indexer.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/blender/imbuf/intern/indexer.c b/source/blender/imbuf/intern/indexer.c index 3f764e4d452..635813d856e 100644 --- a/source/blender/imbuf/intern/indexer.c +++ b/source/blender/imbuf/intern/indexer.c @@ -840,8 +840,8 @@ static int index_rebuild_ffmpeg(struct anim * anim, start_pts_set = TRUE; } - frameno = round((pts - start_pts) - * pts_time_base * frame_rate); + frameno = floor((pts - start_pts) + * pts_time_base * frame_rate + 0.5f); /* decoding starts *always* on I-Frames, so: P-Frames won't work, even if all the -- cgit v1.2.3 From cfebab77152c082e93a771d1da2a6dc5b4c6c5e7 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 12 Oct 2011 22:00:53 +0000 Subject: quiet compiler warnings for string formatting in ffmpeg logging --- source/blender/imbuf/intern/anim_movie.c | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/source/blender/imbuf/intern/anim_movie.c b/source/blender/imbuf/intern/anim_movie.c index c07326c1237..01b3e71ad8a 100644 --- a/source/blender/imbuf/intern/anim_movie.c +++ b/source/blender/imbuf/intern/anim_movie.c @@ -749,9 +749,9 @@ static int ffmpeg_decode_video_frame(struct anim * anim) " FRAME DONE: " "next_pts=%lld pkt_pts=%lld\n", (anim->pFrame->pts == AV_NOPTS_VALUE) ? - -1 : anim->pFrame->pts, + -1 : (long long int)anim->pFrame->pts, (anim->pFrame->pkt_pts == AV_NOPTS_VALUE) ? - -1 : anim->pFrame->pkt_pts); + -1 : (long long int)anim->pFrame->pkt_pts); anim->next_pts = av_get_pts_from_frame(anim->pFormatCtx, anim->pFrame); @@ -771,9 +771,9 @@ static int ffmpeg_decode_video_frame(struct anim * anim) anim->next_packet.stream_index, anim->videoStream, (anim->next_packet.dts == AV_NOPTS_VALUE) ? -1: - anim->next_packet.dts, + (long long int)anim->next_packet.dts, (anim->next_packet.pts == AV_NOPTS_VALUE) ? -1: - anim->next_packet.pts, + (long long int)anim->next_packet.pts, (anim->next_packet.flags & AV_PKT_FLAG_KEY) ? " KEY" : ""); if (anim->next_packet.stream_index == anim->videoStream) { @@ -800,11 +800,11 @@ static int ffmpeg_decode_video_frame(struct anim * anim) " FRAME DONE: next_pts=%lld " "pkt_pts=%lld, guessed_pts=%lld\n", (anim->pFrame->pts == AV_NOPTS_VALUE) ? - -1 : anim->pFrame->pts, + -1 : (long long int)anim->pFrame->pts, (anim->pFrame->pkt_pts == AV_NOPTS_VALUE) ? - -1 : anim->pFrame->pkt_pts, - anim->next_pts); + -1 : (long long int)anim->pFrame->pkt_pts, + (long long int)anim->next_pts); } } av_free_packet(&anim->next_packet); @@ -828,13 +828,13 @@ static void ffmpeg_decode_video_frame_scan( av_log(anim->pFormatCtx, AV_LOG_DEBUG, "SCAN start: considering pts=%lld in search of %lld\n", - anim->next_pts, pts_to_search); + (long long int)anim->next_pts, (long long int)pts_to_search); while (count > 0 && anim->next_pts < pts_to_search) { av_log(anim->pFormatCtx, AV_LOG_DEBUG, " WHILE: pts=%lld in search of %lld\n", - anim->next_pts, pts_to_search); + (long long int)anim->next_pts, (long long int)pts_to_search); if (!ffmpeg_decode_video_frame(anim)) { break; } @@ -845,7 +845,7 @@ static void ffmpeg_decode_video_frame_scan( AV_LOG_ERROR, "SCAN failed: completely lost in stream, " "bailing out at PTS=%lld, searching for PTS=%lld\n", - anim->next_pts, pts_to_search); + (long long int)anim->next_pts, (long long int)pts_to_search); } if (anim->next_pts == pts_to_search) { av_log(anim->pFormatCtx, @@ -942,13 +942,13 @@ static ImBuf * ffmpeg_fetchibuf(struct anim * anim, int position, av_log(anim->pFormatCtx, AV_LOG_DEBUG, "FETCH: looking for PTS=%lld " "(pts_timebase=%g, frame_rate=%g, st_time=%lld)\n", - pts_to_search, pts_time_base, frame_rate, st_time); + (long long int)pts_to_search, pts_time_base, frame_rate, st_time); if (anim->last_frame && anim->last_pts <= pts_to_search && anim->next_pts > pts_to_search){ av_log(anim->pFormatCtx, AV_LOG_DEBUG, "FETCH: frame repeat: last: %lld next: %lld\n", - anim->last_pts, anim->next_pts); + (long long int)anim->last_pts, (long long int)anim->next_pts); IMB_refImBuf(anim->last_frame); anim->curposition = position; return anim->last_frame; @@ -961,7 +961,8 @@ static ImBuf * ffmpeg_fetchibuf(struct anim * anim, int position, av_log(anim->pFormatCtx, AV_LOG_DEBUG, "FETCH: no seek necessary: " "next: %lld next undecoded: %lld\n", - anim->next_pts, anim->next_undecoded_pts); + (long long int)anim->next_pts, + (long long int)anim->next_undecoded_pts); /* we are already done :) */ @@ -1035,7 +1036,7 @@ static ImBuf * ffmpeg_fetchibuf(struct anim * anim, int position, "FETCH: " "error while seeking to DTS = %lld " "(frameno = %d, PTS = %lld): errcode = %d\n", - pos, position, pts_to_search, ret); + pos, position, (long long int)pts_to_search, ret); } avcodec_flush_buffers(anim->pCodecCtx); -- cgit v1.2.3 From 6955c47faca1c772c9278136d53337c2083aea18 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 13 Oct 2011 00:52:09 +0000 Subject: bpy/rna new property attribute 'data', this means its possible to get back the rna-struct which a property uses. Without this you cant get the bone from an fcurve data path for example, needed to fix bug [#28889]. --- source/blender/python/intern/bpy_rna.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c index ba7e2d41e69..0acd844cc84 100644 --- a/source/blender/python/intern/bpy_rna.c +++ b/source/blender/python/intern/bpy_rna.c @@ -2972,7 +2972,7 @@ PyDoc_STRVAR(pyrna_struct_path_from_id_doc, " :arg property: Optional property name which can be used if the path is\n" " to a property of this object.\n" " :type property: string\n" -" :return: The path from :class:`bpy_struct.id_data`\n" +" :return: The path from :class:`bpy.types.bpy_struct.id_data`\n" " to this struct and property (when given).\n" " :rtype: str\n" ); @@ -3028,7 +3028,7 @@ PyDoc_STRVAR(pyrna_prop_path_from_id_doc, "\n" " Returns the data path from the ID to this property (string).\n" "\n" -" :return: The path from :class:`bpy_struct.id_data` to this property.\n" +" :return: The path from :class:`bpy.types.bpy_struct.id_data` to this property.\n" " :rtype: str\n" ); static PyObject *pyrna_prop_path_from_id(BPy_PropertyRNA *self) @@ -3059,7 +3059,7 @@ PyDoc_STRVAR(pyrna_struct_type_recast_doc, " such as textures can be changed at runtime.\n" "\n" " :return: a new instance of this object with the type initialized again.\n" -" :rtype: subclass of :class:`bpy_struct`\n" +" :rtype: subclass of :class:`bpy.types.bpy_struct`\n" ); static PyObject *pyrna_struct_type_recast(BPy_StructRNA *self) { @@ -3664,6 +3664,11 @@ static PyObject *pyrna_struct_get_id_data(BPy_DummyPointerRNA *self) Py_RETURN_NONE; } +static PyObject *pyrna_struct_get_pointer_data(BPy_DummyPointerRNA *self) +{ + return pyrna_struct_CreatePyObject(&self->ptr); +} + static PyObject *pyrna_struct_get_rna_type(BPy_PropertyRNA *self) { PointerRNA tptr; @@ -3679,6 +3684,7 @@ static PyObject *pyrna_struct_get_rna_type(BPy_PropertyRNA *self) static PyGetSetDef pyrna_prop_getseters[]= { {(char *)"id_data", (getter)pyrna_struct_get_id_data, (setter)NULL, (char *)"The :class:`bpy.types.ID` object this datablock is from or None, (not available for all data types)", NULL}, + {(char *)"data", (getter)pyrna_struct_get_pointer_data, (setter)NULL, (char *)"The data this property is using, *type* :class:`bpy.types.bpy_struct`", NULL}, {(char *)"rna_type", (getter)pyrna_struct_get_rna_type, (setter)NULL, (char *)"The property type for introspection", NULL}, {NULL, NULL, NULL, NULL, NULL} /* Sentinel */ }; -- cgit v1.2.3 From 276e5f709518e0a64c7bf520062de9ed9337572f Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 13 Oct 2011 01:29:08 +0000 Subject: formatting edits & remove debug print. --- source/blender/python/generic/IDProp.c | 26 +- source/blender/python/generic/bgl.c | 16 +- .../blender/python/generic/bpy_internal_import.c | 40 +- source/blender/python/generic/noise_py_api.c | 58 +- source/blender/python/generic/py_capi_utils.c | 72 +- source/blender/python/intern/bpy.c | 20 +- source/blender/python/intern/bpy_app.c | 8 +- source/blender/python/intern/bpy_app_handlers.c | 16 +- source/blender/python/intern/bpy_driver.c | 22 +- source/blender/python/intern/bpy_interface.c | 76 +- .../blender/python/intern/bpy_interface_atexit.c | 2 +- source/blender/python/intern/bpy_library.c | 36 +- source/blender/python/intern/bpy_operator.c | 42 +- source/blender/python/intern/bpy_operator_wrap.c | 5 +- source/blender/python/intern/bpy_props.c | 222 ++--- source/blender/python/intern/bpy_rna.c | 910 +++++++++++---------- source/blender/python/intern/bpy_rna_anim.c | 42 +- source/blender/python/intern/bpy_rna_array.c | 56 +- source/blender/python/intern/bpy_traceback.c | 12 +- source/blender/python/intern/bpy_util.c | 12 +- source/blender/python/intern/gpu.c | 4 +- source/blender/python/mathutils/mathutils.c | 60 +- source/blender/python/mathutils/mathutils_Color.c | 84 +- source/blender/python/mathutils/mathutils_Euler.c | 78 +- source/blender/python/mathutils/mathutils_Matrix.c | 342 ++++---- .../python/mathutils/mathutils_Quaternion.c | 158 ++-- source/blender/python/mathutils/mathutils_Vector.c | 86 +- .../blender/python/mathutils/mathutils_geometry.c | 146 ++-- 28 files changed, 1331 insertions(+), 1320 deletions(-) diff --git a/source/blender/python/generic/IDProp.c b/source/blender/python/generic/IDProp.c index e6883eb30af..1524812086b 100644 --- a/source/blender/python/generic/IDProp.c +++ b/source/blender/python/generic/IDProp.c @@ -254,7 +254,7 @@ static PyObject *BPy_IDGroup_Map_GetItem(BPy_IDProperty *self, PyObject *item) idprop= IDP_GetPropertyFromGroup(self->prop, name); - if(idprop==NULL) { + if (idprop==NULL) { PyErr_SetString(PyExc_KeyError, "key not in subgroup dict"); return NULL; } @@ -273,20 +273,20 @@ static int idp_sequence_type(PyObject *seq) for (i=0; i < len; i++) { item = PySequence_GetItem(seq, i); if (PyFloat_Check(item)) { - if(type == IDP_IDPARRAY) { /* mixed dict/int */ + if (type == IDP_IDPARRAY) { /* mixed dict/int */ Py_DECREF(item); return -1; } type= IDP_DOUBLE; } else if (PyLong_Check(item)) { - if(type == IDP_IDPARRAY) { /* mixed dict/int */ + if (type == IDP_IDPARRAY) { /* mixed dict/int */ Py_DECREF(item); return -1; } } else if (PyMapping_Check(item)) { - if(i != 0 && (type != IDP_IDPARRAY)) { /* mixed dict/int */ + if (i != 0 && (type != IDP_IDPARRAY)) { /* mixed dict/int */ Py_DECREF(item); return -1; } @@ -309,7 +309,7 @@ const char *BPy_IDProperty_Map_ValidateAndCreate(const char *name, IDProperty *g IDProperty *prop = NULL; IDPropertyTemplate val = {0}; - if(strlen(name) >= sizeof(group->name)) + if (strlen(name) >= sizeof(group->name)) return "the length of IDProperty names is limited to 31 characters"; if (PyFloat_Check(ob)) { @@ -335,7 +335,7 @@ const char *BPy_IDProperty_Map_ValidateAndCreate(const char *name, IDProperty *g PyObject *item; int i; - if((val.array.type= idp_sequence_type(ob)) == -1) + if ((val.array.type= idp_sequence_type(ob)) == -1) return "only floats, ints and dicts are allowed in ID property arrays"; /*validate sequence and derive type. @@ -369,7 +369,7 @@ const char *BPy_IDProperty_Map_ValidateAndCreate(const char *name, IDProperty *g error= BPy_IDProperty_Map_ValidateAndCreate("", prop, item); Py_DECREF(item); - if(error) + if (error) return error; } break; @@ -415,7 +415,7 @@ const char *BPy_IDProperty_Map_ValidateAndCreate(const char *name, IDProperty *g } else return "invalid property value"; - if(group->type==IDP_IDPARRAY) { + if (group->type==IDP_IDPARRAY) { IDP_AppendArray(group, prop); // IDP_FreeProperty(item); // IDP_AppendArray does a shallow copy (memcpy), only free memory MEM_freeN(prop); @@ -598,7 +598,7 @@ static PyObject *BPy_IDGroup_Pop(BPy_IDProperty *self, PyObject *value) idprop= IDP_GetPropertyFromGroup(self->prop, name); - if(idprop) { + if (idprop) { pyform = BPy_IDGroup_MapDataToPy(idprop); if (!pyform) { @@ -1050,7 +1050,7 @@ static PyObject *BPy_IDArray_slice(BPy_IDArray *self, int begin, int end) case IDP_FLOAT: { float *array= (float*)IDP_Array(prop); - for(count = begin; count < end; count++) { + for (count = begin; count < end; count++) { PyTuple_SET_ITEM(tuple, count - begin, PyFloat_FromDouble(array[count])); } break; @@ -1058,7 +1058,7 @@ static PyObject *BPy_IDArray_slice(BPy_IDArray *self, int begin, int end) case IDP_DOUBLE: { double *array= (double*)IDP_Array(prop); - for(count = begin; count < end; count++) { + for (count = begin; count < end; count++) { PyTuple_SET_ITEM(tuple, count - begin, PyFloat_FromDouble(array[count])); } break; @@ -1066,7 +1066,7 @@ static PyObject *BPy_IDArray_slice(BPy_IDArray *self, int begin, int end) case IDP_INT: { int *array= (int*)IDP_Array(prop); - for(count = begin; count < end; count++) { + for (count = begin; count < end; count++) { PyTuple_SET_ITEM(tuple, count - begin, PyLong_FromLong(array[count])); } break; @@ -1094,7 +1094,7 @@ static int BPy_IDArray_ass_slice(BPy_IDArray *self, int begin, int end, PyObject alloc_len= size * elem_size; vec= MEM_mallocN(alloc_len, "array assignment"); /* NOTE: we count on int/float being the same size here */ - if(PyC_AsArray(vec, seq, size, py_type, is_double, "slice assignment: ") == -1) { + if (PyC_AsArray(vec, seq, size, py_type, is_double, "slice assignment: ") == -1) { MEM_freeN(vec); return -1; } diff --git a/source/blender/python/generic/bgl.c b/source/blender/python/generic/bgl.c index 35c211d5424..e8dd0274568 100644 --- a/source/blender/python/generic/bgl.c +++ b/source/blender/python/generic/bgl.c @@ -95,7 +95,7 @@ static PyObject *Buffer_to_list_recursive(Buffer *self) { PyObject *list; - if(self->ndimensions > 1) { + if (self->ndimensions > 1) { int i, len= self->dimensions[0]; list= PyList_New(len); @@ -213,7 +213,7 @@ PyTypeObject BGL_bufferType = { static PyObject *Method_##funcname (PyObject *UNUSED(self), PyObject *args) {\ arg_def##nargs arg_list; \ ret_def_##ret; \ - if(!PyArg_ParseTuple(args, arg_str##nargs arg_list, arg_ref##nargs arg_list)) return NULL;\ + if (!PyArg_ParseTuple(args, arg_str##nargs arg_list, arg_ref##nargs arg_list)) return NULL;\ ret_set_##ret gl##funcname (arg_var##nargs arg_list);\ ret_ret_##ret; \ } @@ -222,7 +222,7 @@ static PyObject *Method_##funcname (PyObject *UNUSED(self), PyObject *args) {\ static PyObject *Method_##funcname (PyObject *UNUSED(self), PyObject *args) {\ arg_def##nargs arg_list; \ ret_def_##ret; \ - if(!PyArg_ParseTuple(args, arg_str##nargs arg_list, arg_ref##nargs arg_list)) return NULL;\ + if (!PyArg_ParseTuple(args, arg_str##nargs arg_list, arg_ref##nargs arg_list)) return NULL;\ ret_set_##ret glu##funcname (arg_var##nargs arg_list);\ ret_ret_##ret; \ } @@ -289,7 +289,7 @@ static PyObject *Buffer_new(PyTypeObject *UNUSED(type), PyObject *args, PyObject int type; Py_ssize_t i, ndimensions = 0; - if(kwds && PyDict_Size(kwds)) { + if (kwds && PyDict_Size(kwds)) { PyErr_SetString(PyExc_TypeError, "bgl.Buffer(): takes no keyword args"); return NULL; @@ -307,7 +307,7 @@ static PyObject *Buffer_new(PyTypeObject *UNUSED(type), PyObject *args, PyObject if (PyLong_Check(length_ob)) { ndimensions= 1; - if(((dimensions[0]= PyLong_AsLong(length_ob)) < 1)) { + if (((dimensions[0]= PyLong_AsLong(length_ob)) < 1)) { PyErr_SetString(PyExc_AttributeError, "dimensions must be between 1 and "STRINGIFY(MAX_DIMENSIONS)); return NULL; @@ -332,7 +332,7 @@ static PyObject *Buffer_new(PyTypeObject *UNUSED(type), PyObject *args, PyObject else dimensions[i]= PyLong_AsLong(ob); Py_DECREF(ob); - if(dimensions[i] < 1) { + if (dimensions[i] < 1) { PyErr_SetString(PyExc_AttributeError, "dimensions must be between 1 and "STRINGIFY(MAX_DIMENSIONS)); return NULL; @@ -490,7 +490,7 @@ static int Buffer_ass_slice(Buffer *self, int begin, int end, PyObject *seq) for (count= begin; count < end; count++) { item= PySequence_GetItem(seq, count - begin); - if(item) { + if (item) { err= Buffer_ass_item(self, count, item); Py_DECREF(item); } @@ -1293,7 +1293,7 @@ PyObject *BPyInit_bgl(void) submodule= PyModule_Create(&BGL_module_def); dict= PyModule_GetDict(submodule); - if(PyType_Ready(&BGL_bufferType) < 0) + if (PyType_Ready(&BGL_bufferType) < 0) return NULL; /* should never happen */ diff --git a/source/blender/python/generic/bpy_internal_import.c b/source/blender/python/generic/bpy_internal_import.c index d29bc798399..0346c421f68 100644 --- a/source/blender/python/generic/bpy_internal_import.c +++ b/source/blender/python/generic/bpy_internal_import.c @@ -62,7 +62,7 @@ void bpy_import_init(PyObject *builtins) /* move reload here * XXX, use import hooks */ mod= PyImport_ImportModuleLevel((char *)"imp", NULL, NULL, NULL, 0); - if(mod) { + if (mod) { PyDict_SetItemString(PyModule_GetDict(mod), "reload", item=PyCFunction_New(&bpy_reload_meth, NULL)); Py_DECREF(item); Py_DECREF(mod); } @@ -74,7 +74,7 @@ void bpy_import_init(PyObject *builtins) static void free_compiled_text(Text *text) { - if(text->compiled) { + if (text->compiled) { Py_DECREF((PyObject *)text->compiled); } text->compiled= NULL; @@ -102,7 +102,7 @@ PyObject *bpy_text_import(Text *text) char modulename[24]; int len; - if(!text->compiled) { + if (!text->compiled) { char fn_dummy[256]; bpy_text_filename_get(fn_dummy, sizeof(fn_dummy), text); @@ -110,7 +110,7 @@ PyObject *bpy_text_import(Text *text) text->compiled= Py_CompileString(buf, fn_dummy, Py_file_input); MEM_freeN(buf); - if(PyErr_Occurred()) { + if (PyErr_Occurred()) { PyErr_Print(); PyErr_Clear(); PySys_SetObject("last_traceback", NULL); @@ -135,7 +135,7 @@ PyObject *bpy_text_import_name(char *name, int *found) *found= 0; - if(!maggie) { + if (!maggie) { printf("ERROR: bpy_import_main_set() was not called before running python. this is a bug.\n"); return NULL; } @@ -147,7 +147,7 @@ PyObject *bpy_text_import_name(char *name, int *found) text= BLI_findstring(&maggie->text, txtname, offsetof(ID, name) + 2); - if(!text) + if (!text) return NULL; else *found= 1; @@ -169,7 +169,7 @@ PyObject *bpy_text_reimport(PyObject *module, int *found) //XXX Main *maggie= bpy_import_main ? bpy_import_main:G.main; Main *maggie= bpy_import_main; - if(!maggie) { + if (!maggie) { printf("ERROR: bpy_import_main_set() was not called before running python. this is a bug.\n"); return NULL; } @@ -177,24 +177,24 @@ PyObject *bpy_text_reimport(PyObject *module, int *found) *found= 0; /* get name, filename from the module itself */ - if((name= PyModule_GetName(module)) == NULL) + if ((name= PyModule_GetName(module)) == NULL) return NULL; - if((filepath= (char *)PyModule_GetFilename(module)) == NULL) + if ((filepath= (char *)PyModule_GetFilename(module)) == NULL) return NULL; /* look up the text object */ text= BLI_findstring(&maggie->text, BLI_path_basename(filepath), offsetof(ID, name) + 2); /* uh-oh.... didn't find it */ - if(!text) + if (!text) return NULL; else *found= 1; /* if previously compiled, free the object */ /* (can't see how could be NULL, but check just in case) */ - if(text->compiled){ + if (text->compiled) { Py_DECREF((PyObject *)text->compiled); } @@ -204,7 +204,7 @@ PyObject *bpy_text_reimport(PyObject *module, int *found) MEM_freeN(buf); /* if compile failed.... return this error */ - if(PyErr_Occurred()) { + if (PyErr_Occurred()) { PyErr_Print(); PyErr_Clear(); PySys_SetObject("last_traceback", NULL); @@ -229,14 +229,14 @@ static PyObject *blender_import(PyObject *UNUSED(self), PyObject *args, PyObject //PyObject_Print(args, stderr, 0); static const char *kwlist[]= {"name", "globals", "locals", "fromlist", "level", NULL}; - if(!PyArg_ParseTupleAndKeywords(args, kw, "s|OOOi:bpy_import_meth", (char **)kwlist, + if (!PyArg_ParseTupleAndKeywords(args, kw, "s|OOOi:bpy_import_meth", (char **)kwlist, &name, &globals, &locals, &fromlist, &level)) return NULL; /* import existing builtin modules or modules that have been imported already */ newmodule= PyImport_ImportModuleLevel(name, globals, locals, fromlist, level); - if(newmodule) + if (newmodule) return newmodule; PyErr_Fetch(&exception, &err, &tb); /* get the python error incase we cant import as blender text either */ @@ -244,7 +244,7 @@ static PyObject *blender_import(PyObject *UNUSED(self), PyObject *args, PyObject /* importing from existing modules failed, see if we have this module as blender text */ newmodule= bpy_text_import_name(name, &found); - if(newmodule) {/* found module as blender text, ignore above exception */ + if (newmodule) {/* found module as blender text, ignore above exception */ PyErr_Clear(); Py_XDECREF(exception); Py_XDECREF(err); @@ -278,14 +278,14 @@ static PyObject *blender_reload(PyObject *UNUSED(self), PyObject *module) /* try reimporting from file */ newmodule= PyImport_ReloadModule(module); - if(newmodule) + if (newmodule) return newmodule; /* no file, try importing from memory */ PyErr_Fetch(&exception, &err, &tb); /*restore for probable later use */ newmodule= bpy_text_reimport(module, &found); - if(newmodule) {/* found module as blender text, ignore above exception */ + if (newmodule) {/* found module as blender text, ignore above exception */ PyErr_Clear(); Py_XDECREF(exception); Py_XDECREF(err); @@ -359,10 +359,10 @@ void bpy_text_clear_modules(int clear_all) */ while (PyDict_Next(modules, &pos, &key, &value)) { fname= PyModule_GetFilename(value); - if(fname) { + if (fname) { if (clear_all || ((strstr(fname, SEPSTR))==0)) { /* no path ? */ file_extension= strstr(fname, ".py"); - if(file_extension && (*(file_extension + 3) == '\0' || *(file_extension + 4) == '\0')) { /* .py or pyc extension? */ + if (file_extension && (*(file_extension + 3) == '\0' || *(file_extension + 4) == '\0')) { /* .py or pyc extension? */ /* now we can be fairly sure its a python import from the blendfile */ PyList_Append(list, key); /* free'd with the list */ } @@ -374,7 +374,7 @@ void bpy_text_clear_modules(int clear_all) } /* remove all our modules */ - for(pos=0; pos < PyList_GET_SIZE(list); pos++) { + for (pos=0; pos < PyList_GET_SIZE(list); pos++) { /* PyObject_Print(key, stderr, 0); */ key= PyList_GET_ITEM(list, pos); PyDict_DelItem(modules, key); diff --git a/source/blender/python/generic/noise_py_api.c b/source/blender/python/generic/noise_py_api.c index 7be0998c0a1..2171f1f7f39 100644 --- a/source/blender/python/generic/noise_py_api.c +++ b/source/blender/python/generic/noise_py_api.c @@ -136,7 +136,7 @@ static void init_genrand(unsigned long s) { int j; state[0] = s & 0xffffffffUL; - for(j = 1; j < N; j++) { + for (j = 1; j < N; j++) { state[j] = (1812433253UL * (state[j - 1] ^ (state[j - 1] >> 30)) + j); @@ -157,16 +157,16 @@ static void next_state(void) /* if init_genrand() has not been called, */ /* a default initial seed is used */ - if(initf == 0) + if (initf == 0) init_genrand(5489UL); left = N; next = state; - for(j = N - M + 1; --j; p++) + for (j = N - M + 1; --j; p++) *p = p[M] ^ TWIST(p[0], p[1]); - for(j = M; --j; p++) + for (j = M; --j; p++) *p = p[M - N] ^ TWIST(p[0], p[1]); *p = p[M - N] ^ TWIST(p[0], state[0]); @@ -176,7 +176,7 @@ static void next_state(void) static void setRndSeed(int seed) { - if(seed == 0) + if (seed == 0) init_genrand(time(NULL)); else init_genrand(seed); @@ -187,7 +187,7 @@ static float frand(void) { unsigned long y; - if(--left == 0) + if (--left == 0) next_state(); y = *next++; @@ -207,7 +207,7 @@ static void randuvec(float v[3]) { float r; v[2] = 2.f * frand() - 1.f; - if((r = 1.f - v[2] * v[2]) > 0.f) { + if ((r = 1.f - v[2] * v[2]) > 0.f) { float a = (float)(6.283185307f * frand()); r = (float)sqrt(r); v[0] = (float)(r * cosf(a)); @@ -237,7 +237,7 @@ static PyObject *Noise_random_unit_vector(PyObject *UNUSED(self)) static PyObject *Noise_seed_set(PyObject *UNUSED(self), PyObject *args) { int s; - if(!PyArg_ParseTuple(args, "i:seed_set", &s)) + if (!PyArg_ParseTuple(args, "i:seed_set", &s)) return NULL; setRndSeed(s); Py_RETURN_NONE; @@ -251,7 +251,7 @@ static PyObject *Noise_noise(PyObject *UNUSED(self), PyObject *args) { float x, y, z; int nb = 1; - if(!PyArg_ParseTuple(args, "(fff)|i:noise", &x, &y, &z, &nb)) + if (!PyArg_ParseTuple(args, "(fff)|i:noise", &x, &y, &z, &nb)) return NULL; return PyFloat_FromDouble((2.0f * BLI_gNoise(1.0f, x, y, z, 0, nb) - 1.0f)); @@ -275,7 +275,7 @@ static PyObject *Noise_vector(PyObject *UNUSED(self), PyObject *args) { float x, y, z, v[3]; int nb = 1; - if(!PyArg_ParseTuple(args, "(fff)|i:vector", &x, &y, &z, &nb)) + if (!PyArg_ParseTuple(args, "(fff)|i:vector", &x, &y, &z, &nb)) return NULL; noise_vector(x, y, z, nb, v); return Py_BuildValue("[fff]", v[0], v[1], v[2]); @@ -292,15 +292,15 @@ static float turb(float x, float y, float z, int oct, int hard, int nb, int i; amp = 1.f; out = (float)(2.0f * BLI_gNoise(1.f, x, y, z, 0, nb) - 1.0f); - if(hard) + if (hard) out = (float)fabs(out); - for(i = 1; i < oct; i++) { + for (i = 1; i < oct; i++) { amp *= ampscale; x *= freqscale; y *= freqscale; z *= freqscale; t = (float)(amp * (2.0f * BLI_gNoise(1.f, x, y, z, 0, nb) - 1.0f)); - if(hard) + if (hard) t = (float)fabs(t); out += t; } @@ -312,7 +312,7 @@ static PyObject *Noise_turbulence(PyObject *UNUSED(self), PyObject *args) float x, y, z; int oct, hd, nb = 1; float as = 0.5, fs = 2.0; - if(!PyArg_ParseTuple(args, "(fff)ii|iff:turbulence", &x, &y, &z, &oct, &hd, &nb, &as, &fs)) + if (!PyArg_ParseTuple(args, "(fff)ii|iff:turbulence", &x, &y, &z, &oct, &hd, &nb, &as, &fs)) return NULL; return PyFloat_FromDouble(turb(x, y, z, oct, hd, nb, as, fs)); @@ -329,18 +329,18 @@ static void vTurb(float x, float y, float z, int oct, int hard, int nb, int i; amp = 1.f; noise_vector(x, y, z, nb, v); - if(hard) { + if (hard) { v[0] = (float)fabs(v[0]); v[1] = (float)fabs(v[1]); v[2] = (float)fabs(v[2]); } - for(i = 1; i < oct; i++) { + for (i = 1; i < oct; i++) { amp *= ampscale; x *= freqscale; y *= freqscale; z *= freqscale; noise_vector(x, y, z, nb, t); - if(hard) { + if (hard) { t[0] = (float)fabs(t[0]); t[1] = (float)fabs(t[1]); t[2] = (float)fabs(t[2]); @@ -356,7 +356,7 @@ static PyObject *Noise_turbulence_vector(PyObject *UNUSED(self), PyObject *args) float x, y, z, v[3]; int oct, hd, nb = 1; float as = 0.5, fs = 2.0; - if(!PyArg_ParseTuple(args, "(fff)ii|iff:turbulence_vector", &x, &y, &z, &oct, &hd, &nb, &as, &fs)) + if (!PyArg_ParseTuple(args, "(fff)ii|iff:turbulence_vector", &x, &y, &z, &oct, &hd, &nb, &as, &fs)) return NULL; vTurb(x, y, z, oct, hd, nb, as, fs, v); return Py_BuildValue("[fff]", v[0], v[1], v[2]); @@ -370,7 +370,7 @@ static PyObject *Noise_fractal(PyObject *UNUSED(self), PyObject *args) { float x, y, z, H, lac, oct; int nb = 1; - if(!PyArg_ParseTuple(args, "(fff)fff|i:fractal", &x, &y, &z, &H, &lac, &oct, &nb)) + if (!PyArg_ParseTuple(args, "(fff)fff|i:fractal", &x, &y, &z, &H, &lac, &oct, &nb)) return NULL; return PyFloat_FromDouble(mg_fBm(x, y, z, H, lac, oct, nb)); } @@ -381,7 +381,7 @@ static PyObject *Noise_multi_fractal(PyObject *UNUSED(self), PyObject *args) { float x, y, z, H, lac, oct; int nb = 1; - if(!PyArg_ParseTuple(args, "(fff)fff|i:multi_fractal", &x, &y, &z, &H, &lac, &oct, &nb)) + if (!PyArg_ParseTuple(args, "(fff)fff|i:multi_fractal", &x, &y, &z, &H, &lac, &oct, &nb)) return NULL; return PyFloat_FromDouble(mg_MultiFractal(x, y, z, H, lac, oct, nb)); @@ -393,7 +393,7 @@ static PyObject *Noise_vl_vector(PyObject *UNUSED(self), PyObject *args) { float x, y, z, d; int nt1 = 1, nt2 = 1; - if(!PyArg_ParseTuple(args, "(fff)f|ii:vl_vector", &x, &y, &z, &d, &nt1, &nt2)) + if (!PyArg_ParseTuple(args, "(fff)f|ii:vl_vector", &x, &y, &z, &d, &nt1, &nt2)) return NULL; return PyFloat_FromDouble(mg_VLNoise(x, y, z, d, nt1, nt2)); } @@ -404,7 +404,7 @@ static PyObject *Noise_hetero_terrain(PyObject *UNUSED(self), PyObject *args) { float x, y, z, H, lac, oct, ofs; int nb = 1; - if(!PyArg_ParseTuple(args, "(fff)ffff|i:hetero_terrain", &x, &y, &z, &H, &lac, &oct, &ofs, &nb)) + if (!PyArg_ParseTuple(args, "(fff)ffff|i:hetero_terrain", &x, &y, &z, &H, &lac, &oct, &ofs, &nb)) return NULL; return PyFloat_FromDouble(mg_HeteroTerrain(x, y, z, H, lac, oct, ofs, nb)); @@ -416,7 +416,7 @@ static PyObject *Noise_hybrid_multi_fractal(PyObject *UNUSED(self), PyObject *ar { float x, y, z, H, lac, oct, ofs, gn; int nb = 1; - if(!PyArg_ParseTuple(args, "(fff)fffff|i:hybrid_multi_fractal", &x, &y, &z, &H, &lac, &oct, &ofs, &gn, &nb)) + if (!PyArg_ParseTuple(args, "(fff)fffff|i:hybrid_multi_fractal", &x, &y, &z, &H, &lac, &oct, &ofs, &gn, &nb)) return NULL; return PyFloat_FromDouble(mg_HybridMultiFractal(x, y, z, H, lac, oct, ofs, gn, nb)); @@ -428,7 +428,7 @@ static PyObject *Noise_ridged_multi_fractal(PyObject *UNUSED(self), PyObject *ar { float x, y, z, H, lac, oct, ofs, gn; int nb = 1; - if(!PyArg_ParseTuple(args, "(fff)fffff|i:ridged_multi_fractal", &x, &y, &z, &H, &lac, &oct, &ofs, &gn, &nb)) + if (!PyArg_ParseTuple(args, "(fff)fffff|i:ridged_multi_fractal", &x, &y, &z, &H, &lac, &oct, &ofs, &gn, &nb)) return NULL; return PyFloat_FromDouble(mg_RidgedMultiFractal(x, y, z, H, lac, oct, ofs, gn, nb)); } @@ -440,7 +440,7 @@ static PyObject *Noise_voronoi(PyObject *UNUSED(self), PyObject *args) float x, y, z, da[4], pa[12]; int dtype = 0; float me = 2.5; /* default minkovsky exponent */ - if(!PyArg_ParseTuple(args, "(fff)|if:voronoi", &x, &y, &z, &dtype, &me)) + if (!PyArg_ParseTuple(args, "(fff)|if:voronoi", &x, &y, &z, &dtype, &me)) return NULL; voronoi(x, y, z, da, pa, me, dtype); return Py_BuildValue("[[ffff][[fff][fff][fff][fff]]]", @@ -455,7 +455,7 @@ static PyObject *Noise_voronoi(PyObject *UNUSED(self), PyObject *args) static PyObject *Noise_cell(PyObject *UNUSED(self), PyObject *args) { float x, y, z; - if(!PyArg_ParseTuple(args, "(fff):cell", &x, &y, &z)) + if (!PyArg_ParseTuple(args, "(fff):cell", &x, &y, &z)) return NULL; return PyFloat_FromDouble(cellNoise(x, y, z)); @@ -466,7 +466,7 @@ static PyObject *Noise_cell(PyObject *UNUSED(self), PyObject *args) static PyObject *Noise_cell_vector(PyObject *UNUSED(self), PyObject *args) { float x, y, z, ca[3]; - if(!PyArg_ParseTuple(args, "(fff):cell_vector", &x, &y, &z)) + if (!PyArg_ParseTuple(args, "(fff):cell_vector", &x, &y, &z)) return NULL; cellNoiseV(x, y, z, ca); return Py_BuildValue("[fff]", ca[0], ca[1], ca[2]); @@ -698,7 +698,7 @@ PyObject *BPyInit_noise(void) setRndSeed(0); /* Constant noisetype dictionary */ - if(submodule) { + if (submodule) { static PyStructSequence_Field noise_types_fields[] = { {(char *)"BLENDER", NULL}, {(char *)"STDPERLIN", NULL}, @@ -747,7 +747,7 @@ PyObject *BPyInit_noise(void) PyModule_AddObject(submodule, "types", noise_types); } - if(submodule) { + if (submodule) { static PyStructSequence_Field distance_metrics_fields[] = { {(char *)"DISTANCE", NULL}, {(char *)"DISTANCE_SQUARED", NULL}, diff --git a/source/blender/python/generic/py_capi_utils.c b/source/blender/python/generic/py_capi_utils.c index bf14102bb0d..1bccc8a24c4 100644 --- a/source/blender/python/generic/py_capi_utils.c +++ b/source/blender/python/generic/py_capi_utils.c @@ -43,13 +43,13 @@ int PyC_AsArray(void *array, PyObject *value, const int length, const PyTypeObje int value_len; int i; - if(!(value_fast=PySequence_Fast(value, error_prefix))) { + if (!(value_fast=PySequence_Fast(value, error_prefix))) { return -1; } value_len= PySequence_Fast_GET_SIZE(value_fast); - if(value_len != length) { + if (value_len != length) { Py_DECREF(value); PyErr_Format(PyExc_TypeError, "%.200s: invalid sequence length. expected %d, got %d", @@ -58,30 +58,30 @@ int PyC_AsArray(void *array, PyObject *value, const int length, const PyTypeObje } /* for each type */ - if(type == &PyFloat_Type) { - if(is_double) { + if (type == &PyFloat_Type) { + if (is_double) { double *array_double= array; - for(i=0; itp_name); @@ -119,7 +119,7 @@ void PyC_ObSpit(const char *name, PyObject *var) fprintf(stderr, " ptr:%p", (void *)var); fprintf(stderr, " type:"); - if(Py_TYPE(var)) + if (Py_TYPE(var)) fprintf(stderr, "%s", Py_TYPE(var)->tp_name); else fprintf(stderr, ""); @@ -134,7 +134,7 @@ void PyC_LineSpit(void) int lineno; /* Note, allow calling from outside python (RNA) */ - if(!PYC_INTERPRETER_ACTIVE) { + if (!PYC_INTERPRETER_ACTIVE) { fprintf(stderr, "python line lookup failed, interpreter inactive\n"); return; } @@ -162,18 +162,18 @@ void PyC_FileAndNum(const char **filename, int *lineno) } /* when executing a module */ - if(filename && *filename == NULL) { + if (filename && *filename == NULL) { /* try an alternative method to get the filename - module based * references below are all borrowed (double checked) */ PyObject *mod_name= PyDict_GetItemString(PyEval_GetGlobals(), "__name__"); - if(mod_name) { + if (mod_name) { PyObject *mod= PyDict_GetItem(PyImport_GetModuleDict(), mod_name); - if(mod) { + if (mod) { *filename= PyModule_GetFilename(mod); } /* unlikely, fallback */ - if(*filename == NULL) { + if (*filename == NULL) { *filename= _PyUnicode_AsString(mod_name); } } @@ -225,7 +225,7 @@ PyObject *PyC_Err_Format_Prefix(PyObject *exception_type_prefix, const char *for error_value_prefix= PyUnicode_FromFormatV(format, args); /* can fail and be NULL */ va_end(args); - if(PyErr_Occurred()) { + if (PyErr_Occurred()) { PyObject *error_type, *error_value, *error_traceback; PyErr_Fetch(&error_type, &error_value, &error_traceback); PyErr_Format(exception_type_prefix, @@ -259,7 +259,7 @@ PyObject *PyC_ExceptionBuffer(void) PyObject *format_tb_func= NULL; PyObject *ret= NULL; - if(! (traceback_mod= PyImport_ImportModule("traceback")) ) { + if (! (traceback_mod= PyImport_ImportModule("traceback")) ) { goto error_cleanup; } else if (! (format_tb_func= PyObject_GetAttrString(traceback_mod, "format_exc"))) { @@ -268,7 +268,7 @@ PyObject *PyC_ExceptionBuffer(void) ret= PyObject_CallObject(format_tb_func, NULL); - if(ret == Py_None) { + if (ret == Py_None) { Py_DECREF(ret); ret= NULL; } @@ -303,7 +303,7 @@ PyObject *PyC_ExceptionBuffer(void) * string_io = io.StringIO() */ - if(! (string_io_mod= PyImport_ImportModule("io")) ) { + if (! (string_io_mod= PyImport_ImportModule("io")) ) { goto error_cleanup; } else if (! (string_io = PyObject_CallMethod(string_io_mod, (char *)"StringIO", NULL))) { @@ -360,7 +360,7 @@ const char *PyC_UnicodeAsByte(PyObject *py_str, PyObject **coerce) result= _PyUnicode_AsString(py_str); - if(result) { + if (result) { /* 99% of the time this is enough but we better support non unicode * chars since blender doesnt limit this */ return result; @@ -368,7 +368,7 @@ const char *PyC_UnicodeAsByte(PyObject *py_str, PyObject **coerce) else { PyErr_Clear(); - if(PyBytes_Check(py_str)) { + if (PyBytes_Check(py_str)) { return PyBytes_AS_STRING(py_str); } else { @@ -380,7 +380,7 @@ const char *PyC_UnicodeAsByte(PyObject *py_str, PyObject **coerce) PyObject *PyC_UnicodeFromByte(const char *str) { PyObject *result= PyUnicode_FromString(str); - if(result) { + if (result) { /* 99% of the time this is enough but we better support non unicode * chars since blender doesnt limit this */ return result; @@ -412,7 +412,7 @@ PyObject *PyC_DefaultNameSpace(const char *filename) PyDict_SetItemString(interp->modules, "__main__", mod_main); Py_DECREF(mod_main); /* sys.modules owns now */ PyModule_AddStringConstant(mod_main, "__name__", "__main__"); - if(filename) + if (filename) PyModule_AddStringConstant(mod_main, "__file__", filename); /* __file__ only for nice UI'ness */ PyModule_AddObject(mod_main, "__builtins__", interp->builtins); Py_INCREF(interp->builtins); /* AddObject steals a reference */ @@ -437,7 +437,7 @@ void PyC_MainModule_Restore(PyObject *main_mod) /* must be called before Py_Initialize, expects output of BLI_get_folder(BLENDER_PYTHON, NULL) */ void PyC_SetHomePath(const char *py_path_bundle) { - if(py_path_bundle==NULL) { + if (py_path_bundle==NULL) { /* Common enough to have bundled *nix python but complain on OSX/Win */ #if defined(__APPLE__) || defined(_WIN32) fprintf(stderr, "Warning! bundled python not found and is expected on this platform. (if you built with CMake: 'install' target may have not been built)\n"); @@ -450,7 +450,7 @@ void PyC_SetHomePath(const char *py_path_bundle) #ifdef __APPLE__ /* OSX allow file/directory names to contain : character (represented as / in the Finder) but current Python lib (release 3.1.1) doesn't handle these correctly */ - if(strchr(py_path_bundle, ':')) + if (strchr(py_path_bundle, ':')) printf("Warning : Blender application is located in a path containing : or / chars\ \nThis may make python import function fail\n"); #endif @@ -481,7 +481,7 @@ void PyC_RunQuicky(const char *filepath, int n, ...) { FILE *fp= fopen(filepath, "r"); - if(fp) { + if (fp) { PyGILState_STATE gilstate= PyGILState_Ensure(); va_list vargs; @@ -508,13 +508,13 @@ void PyC_RunQuicky(const char *filepath, int n, ...) ret= PyObject_CallFunction(calcsize, (char *)"s", format); - if(ret) { + if (ret) { sizes[i]= PyLong_AsSsize_t(ret); Py_DECREF(ret); ret = PyObject_CallFunction(unpack, (char *)"sy#", format, (char *)ptr, sizes[i]); } - if(ret == NULL) { + if (ret == NULL) { printf("PyC_InlineRun error, line:%d\n", __LINE__); PyErr_Print(); PyErr_Clear(); @@ -525,7 +525,7 @@ void PyC_RunQuicky(const char *filepath, int n, ...) sizes[i]= 0; } else { - if(PyTuple_GET_SIZE(ret) == 1) { + if (PyTuple_GET_SIZE(ret) == 1) { /* convenience, convert single tuples into single values */ PyObject *tmp= PyTuple_GET_ITEM(ret, 0); Py_INCREF(tmp); @@ -545,13 +545,13 @@ void PyC_RunQuicky(const char *filepath, int n, ...) fclose(fp); - if(py_result) { + if (py_result) { /* we could skip this but then only slice assignment would work * better not be so strict */ values= PyDict_GetItemString(py_dict, "values"); - if(values && PyList_Check(values)) { + if (values && PyList_Check(values)) { /* dont use the result */ Py_DECREF(py_result); @@ -567,10 +567,10 @@ void PyC_RunQuicky(const char *filepath, int n, ...) PyObject *item_new; /* prepend the string formatting and remake the tuple */ item= PyList_GET_ITEM(values, i); - if(PyTuple_CheckExact(item)) { + if (PyTuple_CheckExact(item)) { int ofs= PyTuple_GET_SIZE(item); item_new= PyTuple_New(ofs + 1); - while(ofs--) { + while (ofs--) { PyObject *member= PyTuple_GET_ITEM(item, ofs); PyTuple_SET_ITEM(item_new, ofs + 1, member); Py_INCREF(member); @@ -584,7 +584,7 @@ void PyC_RunQuicky(const char *filepath, int n, ...) ret = PyObject_Call(pack, item_new, NULL); - if(ret) { + if (ret) { /* copy the bytes back into memory */ memcpy(ptr, PyBytes_AS_STRING(ret), sizes[i]); Py_DECREF(ret); diff --git a/source/blender/python/intern/bpy.c b/source/blender/python/intern/bpy.c index 3f637feadf7..f251e41a92d 100644 --- a/source/blender/python/intern/bpy.c +++ b/source/blender/python/intern/bpy.c @@ -109,7 +109,7 @@ static PyObject *bpy_blend_paths(PyObject *UNUSED(self), PyObject *args, PyObjec list= PyList_New(0); - for(BLI_bpathIterator_init(&bpi, G.main, G.main->name, 0); !BLI_bpathIterator_isDone(bpi); BLI_bpathIterator_step(bpi)) { + for (BLI_bpathIterator_init(&bpi, G.main, G.main->name, 0); !BLI_bpathIterator_isDone(bpi); BLI_bpathIterator_step(bpi)) { /* build the list */ if (absolute) { BLI_bpathIterator_getPathExpanded(bpi, filepath_expanded); @@ -149,10 +149,10 @@ static PyObject *bpy_user_resource(PyObject *UNUSED(self), PyObject *args, PyObj return NULL; /* stupid string compare */ - if (!strcmp(type, "DATAFILES")) folder_id= BLENDER_USER_DATAFILES; - else if(!strcmp(type, "CONFIG")) folder_id= BLENDER_USER_CONFIG; - else if(!strcmp(type, "SCRIPTS")) folder_id= BLENDER_USER_SCRIPTS; - else if(!strcmp(type, "AUTOSAVE")) folder_id= BLENDER_USER_AUTOSAVE; + if (!strcmp(type, "DATAFILES")) folder_id= BLENDER_USER_DATAFILES; + else if (!strcmp(type, "CONFIG")) folder_id= BLENDER_USER_CONFIG; + else if (!strcmp(type, "SCRIPTS")) folder_id= BLENDER_USER_SCRIPTS; + else if (!strcmp(type, "AUTOSAVE")) folder_id= BLENDER_USER_AUTOSAVE; else { PyErr_SetString(PyExc_ValueError, "invalid resource argument"); return NULL; @@ -193,9 +193,9 @@ static PyObject *bpy_resource_path(PyObject *UNUSED(self), PyObject *args, PyObj return NULL; /* stupid string compare */ - if (!strcmp(type, "USER")) folder_id= BLENDER_RESOURCE_PATH_USER; - else if(!strcmp(type, "LOCAL")) folder_id= BLENDER_RESOURCE_PATH_LOCAL; - else if(!strcmp(type, "SYSTEM")) folder_id= BLENDER_RESOURCE_PATH_SYSTEM; + if (!strcmp(type, "USER")) folder_id= BLENDER_RESOURCE_PATH_USER; + else if (!strcmp(type, "LOCAL")) folder_id= BLENDER_RESOURCE_PATH_LOCAL; + else if (!strcmp(type, "SYSTEM")) folder_id= BLENDER_RESOURCE_PATH_SYSTEM; else { PyErr_SetString(PyExc_ValueError, "invalid resource argument"); return NULL; @@ -215,7 +215,7 @@ static PyMethodDef meth_bpy_resource_path= {"resource_path", (PyCFunction)bpy_re static PyObject *bpy_import_test(const char *modname) { PyObject *mod= PyImport_ImportModuleLevel((char *)modname, NULL, NULL, NULL, 0); - if(mod) { + if (mod) { Py_DECREF(mod); } else { @@ -238,7 +238,7 @@ void BPy_init_modules(void) /* Needs to be first since this dir is needed for future modules */ char *modpath= BLI_get_folder(BLENDER_SYSTEM_SCRIPTS, "modules"); - if(modpath) { + if (modpath) { // printf("bpy: found module path '%s'.\n", modpath); PyObject *sys_path= PySys_GetObject("path"); /* borrow */ PyObject *py_modpath= PyUnicode_FromString(modpath); diff --git a/source/blender/python/intern/bpy_app.c b/source/blender/python/intern/bpy_app.c index 079d5223f58..bd7be8dd9c5 100644 --- a/source/blender/python/intern/bpy_app.c +++ b/source/blender/python/intern/bpy_app.c @@ -168,13 +168,13 @@ static int bpy_app_debug_set(PyObject *UNUSED(self), PyObject *value, void *UNUS { int param= PyObject_IsTrue(value); - if(param < 0) { + if (param < 0) { PyErr_SetString(PyExc_TypeError, "bpy.app.debug can only be True/False"); return -1; } - if(param) G.f |= G_DEBUG; - else G.f &= ~G_DEBUG; + if (param) G.f |= G_DEBUG; + else G.f &= ~G_DEBUG; return 0; } @@ -230,7 +230,7 @@ static void py_struct_seq_getset_init(void) /* tricky dynamic members, not to py-spec! */ PyGetSetDef *getset; - for(getset= bpy_app_getsets; getset->name; getset++) { + for (getset= bpy_app_getsets; getset->name; getset++) { PyDict_SetItemString(BlenderAppType.tp_dict, getset->name, PyDescr_NewGetSet(&BlenderAppType, getset)); } } diff --git a/source/blender/python/intern/bpy_app_handlers.c b/source/blender/python/intern/bpy_app_handlers.c index cd3d78410f2..1a50ae79dc7 100644 --- a/source/blender/python/intern/bpy_app_handlers.c +++ b/source/blender/python/intern/bpy_app_handlers.c @@ -77,13 +77,13 @@ static PyObject *make_app_cb_info(void) return NULL; } - for(pos= 0; pos < BLI_CB_EVT_TOT; pos++) { - if(app_cb_info_fields[pos].name == NULL) { + for (pos= 0; pos < BLI_CB_EVT_TOT; pos++) { + if (app_cb_info_fields[pos].name == NULL) { Py_FatalError("invalid callback slots 1"); } PyStructSequence_SET_ITEM(app_cb_info, pos, (py_cb_array[pos]= PyList_New(0))); } - if(app_cb_info_fields[pos].name != NULL) { + if (app_cb_info_fields[pos].name != NULL) { Py_FatalError("invalid callback slots 2"); } @@ -103,12 +103,12 @@ PyObject *BPY_app_handlers_struct(void) BlenderAppCbType.tp_new= NULL; /* assign the C callbacks */ - if(ret) { + if (ret) { static bCallbackFuncStore funcstore_array[BLI_CB_EVT_TOT]= {{NULL}}; bCallbackFuncStore *funcstore; int pos= 0; - for(pos= 0; pos < BLI_CB_EVT_TOT; pos++) { + for (pos= 0; pos < BLI_CB_EVT_TOT; pos++) { funcstore= &funcstore_array[pos]; funcstore->func= bpy_app_generic_callback; funcstore->alloc= 0; @@ -124,7 +124,7 @@ void BPY_app_handlers_reset(void) { int pos= 0; - for(pos= 0; pos < BLI_CB_EVT_TOT; pos++) { + for (pos= 0; pos < BLI_CB_EVT_TOT; pos++) { PyList_SetSlice(py_cb_array[pos], 0, PY_SSIZE_T_MAX, NULL); } } @@ -134,7 +134,7 @@ void bpy_app_generic_callback(struct Main *UNUSED(main), struct ID *id, void *ar { PyObject *cb_list= py_cb_array[GET_INT_FROM_POINTER(arg)]; Py_ssize_t cb_list_len; - if((cb_list_len= PyList_GET_SIZE(cb_list)) > 0) { + if ((cb_list_len= PyList_GET_SIZE(cb_list)) > 0) { PyGILState_STATE gilstate= PyGILState_Ensure(); PyObject* args= PyTuple_New(1); // save python creating each call @@ -143,7 +143,7 @@ void bpy_app_generic_callback(struct Main *UNUSED(main), struct ID *id, void *ar Py_ssize_t pos; /* setup arguments */ - if(id) { + if (id) { PointerRNA id_ptr; RNA_id_pointer_create(id, &id_ptr); PyTuple_SET_ITEM(args, 0, pyrna_struct_CreatePyObject(&id_ptr)); diff --git a/source/blender/python/intern/bpy_driver.c b/source/blender/python/intern/bpy_driver.c index 319790340ca..c5d15145ab2 100644 --- a/source/blender/python/intern/bpy_driver.c +++ b/source/blender/python/intern/bpy_driver.c @@ -99,7 +99,7 @@ void BPY_driver_reset(void) PyGILState_STATE gilstate; int use_gil= 1; /* !PYC_INTERPRETER_ACTIVE; */ - if(use_gil) + if (use_gil) gilstate= PyGILState_Ensure(); if (bpy_pydriver_Dict) { /* free the global dict used by pydrivers */ @@ -108,7 +108,7 @@ void BPY_driver_reset(void) bpy_pydriver_Dict= NULL; } - if(use_gil) + if (use_gil) PyGILState_Release(gilstate); return; @@ -157,14 +157,14 @@ float BPY_driver_exec(ChannelDriver *driver) if ((expr == NULL) || (expr[0]=='\0')) return 0.0f; - if(!(G.f & G_SCRIPT_AUTOEXEC)) { + if (!(G.f & G_SCRIPT_AUTOEXEC)) { printf("skipping driver '%s', automatic scripts are disabled\n", driver->expression); return 0.0f; } use_gil= 1; /* !PYC_INTERPRETER_ACTIVE; */ - if(use_gil) + if (use_gil) gilstate= PyGILState_Ensure(); /* needed since drivers are updated directly after undo where 'main' is @@ -175,17 +175,17 @@ float BPY_driver_exec(ChannelDriver *driver) if (!bpy_pydriver_Dict) { if (bpy_pydriver_create_dict() != 0) { fprintf(stderr, "Pydriver error: couldn't create Python dictionary"); - if(use_gil) + if (use_gil) PyGILState_Release(gilstate); return 0.0f; } } - if(driver->expr_comp==NULL) + if (driver->expr_comp==NULL) driver->flag |= DRIVER_FLAG_RECOMPILE; /* compile the expression first if it hasn't been compiled or needs to be rebuilt */ - if(driver->flag & DRIVER_FLAG_RECOMPILE) { + if (driver->flag & DRIVER_FLAG_RECOMPILE) { Py_XDECREF(driver->expr_comp); driver->expr_comp= PyTuple_New(2); @@ -199,7 +199,7 @@ float BPY_driver_exec(ChannelDriver *driver) expr_code= PyTuple_GET_ITEM(((PyObject *)driver->expr_comp), 0); } - if(driver->flag & DRIVER_FLAG_RENAMEVAR) { + if (driver->flag & DRIVER_FLAG_RENAMEVAR) { /* may not be set */ expr_vars= PyTuple_GET_ITEM(((PyObject *)driver->expr_comp), 1); Py_XDECREF(expr_vars); @@ -260,7 +260,7 @@ float BPY_driver_exec(ChannelDriver *driver) if (retval == NULL) { pydriver_error(driver); } - else if((result= PyFloat_AsDouble(retval)) == -1.0 && PyErr_Occurred()) { + else if ((result= PyFloat_AsDouble(retval)) == -1.0 && PyErr_Occurred()) { pydriver_error(driver); Py_DECREF(retval); result= 0.0; @@ -271,10 +271,10 @@ float BPY_driver_exec(ChannelDriver *driver) Py_DECREF(retval); } - if(use_gil) + if (use_gil) PyGILState_Release(gilstate); - if(finite(result)) { + if (finite(result)) { return (float)result; } else { diff --git a/source/blender/python/intern/bpy_interface.c b/source/blender/python/intern/bpy_interface.c index 429a74fddc0..aaa813137c6 100644 --- a/source/blender/python/intern/bpy_interface.c +++ b/source/blender/python/intern/bpy_interface.c @@ -100,14 +100,14 @@ void bpy_context_set(bContext *C, PyGILState_STATE *gilstate) { py_call_level++; - if(gilstate) + if (gilstate) *gilstate= PyGILState_Ensure(); - if(py_call_level==1) { + if (py_call_level==1) { bpy_context_update(C); #ifdef TIME_PY_RUN - if(bpy_timer_count==0) { + if (bpy_timer_count==0) { /* record time from the beginning */ bpy_timer= PIL_check_seconds_timer(); bpy_timer_run= bpy_timer_run_tot= 0.0; @@ -125,13 +125,13 @@ void bpy_context_clear(bContext *UNUSED(C), PyGILState_STATE *gilstate) { py_call_level--; - if(gilstate) + if (gilstate) PyGILState_Release(*gilstate); - if(py_call_level < 0) { + if (py_call_level < 0) { fprintf(stderr, "ERROR: Python context internal state bug. this should not happen!\n"); } - else if(py_call_level==0) { + else if (py_call_level==0) { // XXX - Calling classes currently wont store the context :\, cant set NULL because of this. but this is very flakey still. //BPy_SetContext(NULL); //bpy_import_main_set(NULL); @@ -146,7 +146,7 @@ void bpy_context_clear(bContext *UNUSED(C), PyGILState_STATE *gilstate) void BPY_text_free_code(Text *text) { - if(text->compiled) { + if (text->compiled) { Py_DECREF((PyObject *)text->compiled); text->compiled= NULL; } @@ -273,10 +273,10 @@ void BPY_python_end(void) printf("*bpy stats* - "); printf("tot exec: %d, ", bpy_timer_count); printf("tot run: %.4fsec, ", bpy_timer_run_tot); - if(bpy_timer_count>0) + if (bpy_timer_count>0) printf("average run: %.6fsec, ", (bpy_timer_run_tot/bpy_timer_count)); - if(bpy_timer>0.0) + if (bpy_timer>0.0) printf("tot usage %.4f%%", (bpy_timer_run_tot/bpy_timer)*100.0); printf("\n"); @@ -292,7 +292,7 @@ static void python_script_error_jump_text(struct Text *text) int lineno; int offset; python_script_error_jump(text->id.name+2, &lineno, &offset); - if(lineno != -1) { + if (lineno != -1) { /* select the line with the error */ txt_move_to(text, lineno - 1, INT_MAX, FALSE); txt_move_to(text, lineno - 1, offset, TRUE); @@ -332,22 +332,22 @@ static int python_script_exec(bContext *C, const char *fn, struct Text *text, st char fn_dummy[FILE_MAXDIR]; bpy_text_filename_get(fn_dummy, sizeof(fn_dummy), text); - if(text->compiled == NULL) { /* if it wasn't already compiled, do it now */ + if (text->compiled == NULL) { /* if it wasn't already compiled, do it now */ char *buf= txt_to_buf(text); text->compiled= Py_CompileString(buf, fn_dummy, Py_file_input); MEM_freeN(buf); - if(PyErr_Occurred()) { - if(do_jump) { + if (PyErr_Occurred()) { + if (do_jump) { python_script_error_jump_text(text); } BPY_text_free_code(text); } } - if(text->compiled) { + if (text->compiled) { py_dict= PyC_DefaultNameSpace(fn_dummy); py_result= PyEval_EvalCode(text->compiled, py_dict, py_dict); } @@ -356,7 +356,7 @@ static int python_script_exec(bContext *C, const char *fn, struct Text *text, st else { FILE *fp= fopen(fn, "r"); - if(fp) { + if (fp) { py_dict= PyC_DefaultNameSpace(fn); #ifdef _WIN32 @@ -390,8 +390,8 @@ static int python_script_exec(bContext *C, const char *fn, struct Text *text, st } if (!py_result) { - if(text) { - if(do_jump) { + if (text) { + if (do_jump) { python_script_error_jump_text(text); } } @@ -401,7 +401,7 @@ static int python_script_exec(bContext *C, const char *fn, struct Text *text, st Py_DECREF(py_result); } - if(py_dict) { + if (py_dict) { #ifdef PYMODULE_CLEAR_WORKAROUND PyModuleObject *mmod= (PyModuleObject *)PyDict_GetItemString(PyThreadState_GET()->interp->modules, "__main__"); PyObject *dict_back= mmod->md_dict; @@ -450,7 +450,7 @@ int BPY_button_exec(bContext *C, const char *expr, double *value, const short ve if (!value || !expr) return -1; - if(expr[0]=='\0') { + if (expr[0]=='\0') { *value= 0.0; return error_ret; } @@ -479,13 +479,13 @@ int BPY_button_exec(bContext *C, const char *expr, double *value, const short ve else { double val; - if(PyTuple_Check(retval)) { + if (PyTuple_Check(retval)) { /* Users my have typed in 10km, 2m * add up all values */ int i; val= 0.0; - for(i=0; itext.first; text; text= text->id.next) { - if(text->flags & TXT_ISSCRIPT && BLI_testextensie(text->id.name+2, ".py")) { - if(!(G.f & G_SCRIPT_AUTOEXEC)) { + for (text=CTX_data_main(C)->text.first; text; text= text->id.next) { + if (text->flags & TXT_ISSCRIPT && BLI_testextensie(text->id.name+2, ".py")) { + if (!(G.f & G_SCRIPT_AUTOEXEC)) { printf("scripts disabled for \"%s\", skipping '%s'\n", bmain->name, text->id.name+2); } else { @@ -611,13 +611,13 @@ int BPY_context_member_get(bContext *C, const char *member, bContextDataResult * PointerRNA *ptr= NULL; int done= 0; - if(item==NULL) { + if (item==NULL) { /* pass */ } - else if(item==Py_None) { + else if (item==Py_None) { /* pass */ } - else if(BPy_StructRNA_Check(item)) { + else if (BPy_StructRNA_Check(item)) { ptr= &(((BPy_StructRNA *)item)->ptr); //result->ptr= ((BPy_StructRNA *)item)->ptr; @@ -633,10 +633,10 @@ int BPY_context_member_get(bContext *C, const char *member, bContextDataResult * else { int len= PySequence_Fast_GET_SIZE(seq_fast); int i; - for(i= 0; i < len; i++) { + for (i= 0; i < len; i++) { PyObject *list_item= PySequence_Fast_GET_ITEM(seq_fast, i); - if(BPy_StructRNA_Check(list_item)) { + if (BPy_StructRNA_Check(list_item)) { /* CollectionPointerLink *link= MEM_callocN(sizeof(CollectionPointerLink), "bpy_context_get"); link->ptr= ((BPy_StructRNA *)item)->ptr; @@ -656,12 +656,12 @@ int BPY_context_member_get(bContext *C, const char *member, bContextDataResult * } } - if(done==0) { + if (done==0) { if (item) printf("PyContext '%s' not a valid type\n", member); else printf("PyContext '%s' not found\n", member); } else { - if(G.f & G_DEBUG) { + if (G.f & G_DEBUG) { printf("PyContext '%s' found\n", member); } } @@ -759,7 +759,7 @@ PyInit_bpy(void) dealloc_obj_Type.tp_dealloc= dealloc_obj_dealloc; dealloc_obj_Type.tp_flags= Py_TPFLAGS_DEFAULT; - if(PyType_Ready(&dealloc_obj_Type) < 0) + if (PyType_Ready(&dealloc_obj_Type) < 0) return NULL; dob= (dealloc_obj *) dealloc_obj_Type.tp_alloc(&dealloc_obj_Type, 0); diff --git a/source/blender/python/intern/bpy_interface_atexit.c b/source/blender/python/intern/bpy_interface_atexit.c index ac8c90198a0..9424bdab93f 100644 --- a/source/blender/python/intern/bpy_interface_atexit.c +++ b/source/blender/python/intern/bpy_interface_atexit.c @@ -68,7 +68,7 @@ static void atexit_func_call(const char *func_name, PyObject *atexit_func_arg) Py_DECREF(atexit_func); Py_DECREF(args); - if(ret) { + if (ret) { Py_DECREF(ret); } else { /* should never happen */ diff --git a/source/blender/python/intern/bpy_library.c b/source/blender/python/intern/bpy_library.c index 4ce3e0356e2..603bb0ed0ac 100644 --- a/source/blender/python/intern/bpy_library.c +++ b/source/blender/python/intern/bpy_library.c @@ -184,7 +184,7 @@ static PyObject *bpy_lib_load(PyObject *UNUSED(self), PyObject *args, PyObject * const char* filename= NULL; int is_rel= 0, is_link= 0; - if(!PyArg_ParseTupleAndKeywords(args, kwds, "s|ii:load", (char **)kwlist, &filename, &is_link, &is_rel)) + if (!PyArg_ParseTupleAndKeywords(args, kwds, "s|ii:load", (char **)kwlist, &filename, &is_link, &is_rel)) return NULL; ret= PyObject_New(BPy_Library, &bpy_lib_Type); @@ -210,10 +210,10 @@ static PyObject *_bpy_names(BPy_Library *self, int blocktype) names= BLO_blendhandle_get_datablock_names(self->blo_handle, blocktype, &totnames); - if(names) { + if (names) { int counter= 0; list= PyList_New(totnames); - for(l= names; l; l= l->next) { + for (l= names; l; l= l->next) { PyList_SET_ITEM(list, counter, PyUnicode_FromString((char *)l->link)); counter++; } @@ -237,8 +237,8 @@ static PyObject *bpy_lib_enter(BPy_Library *self, PyObject *UNUSED(args)) self->blo_handle= BLO_blendhandle_from_file(self->abspath, &reports); - if(self->blo_handle == NULL) { - if(BPy_reports_to_error(&reports, PyExc_IOError, TRUE) != -1) { + if (self->blo_handle == NULL) { + if (BPy_reports_to_error(&reports, PyExc_IOError, TRUE) != -1) { PyErr_Format(PyExc_IOError, "load: %s failed to open blend file", self->abspath); @@ -247,8 +247,8 @@ static PyObject *bpy_lib_enter(BPy_Library *self, PyObject *UNUSED(args)) } else { int i= 0, code; - while((code= BKE_idcode_iter_step(&i))) { - if(BKE_idcode_is_linkable(code)) { + while ((code= BKE_idcode_iter_step(&i))) { + if (BKE_idcode_is_linkable(code)) { const char *name_plural= BKE_idcode_to_name_plural(code); PyObject *str= PyUnicode_FromString(name_plural); PyDict_SetItem(self->dict, str, PyList_New(0)); @@ -322,27 +322,27 @@ static PyObject *bpy_lib_exit(BPy_Library *self, PyObject *UNUSED(args)) { int i= 0, code; - while((code= BKE_idcode_iter_step(&i))) { - if(BKE_idcode_is_linkable(code)) { + while ((code= BKE_idcode_iter_step(&i))) { + if (BKE_idcode_is_linkable(code)) { const char *name_plural= BKE_idcode_to_name_plural(code); PyObject *ls= PyDict_GetItemString(self->dict, name_plural); // printf("lib: %s\n", name_plural); - if(ls && PyList_Check(ls)) { + if (ls && PyList_Check(ls)) { /* loop */ Py_ssize_t size= PyList_GET_SIZE(ls); Py_ssize_t i; PyObject *item; const char *item_str; - for(i= 0; i < size; i++) { + for (i= 0; i < size; i++) { item= PyList_GET_ITEM(ls, i); item_str= _PyUnicode_AsString(item); // printf(" %s\n", item_str); - if(item_str) { + if (item_str) { ID *id= BLO_library_append_named_part(mainl, &(self->blo_handle), item_str, code); - if(id) { + if (id) { #ifdef USE_RNA_DATABLOCKS PointerRNA id_ptr; RNA_id_pointer_create(id, &id_ptr); @@ -382,7 +382,7 @@ static PyObject *bpy_lib_exit(BPy_Library *self, PyObject *UNUSED(args)) } } - if(err == -1) { + if (err == -1) { /* exception raised above, XXX, this leaks some memory */ BLO_blendhandle_close(self->blo_handle); self->blo_handle= NULL; @@ -399,10 +399,10 @@ static PyObject *bpy_lib_exit(BPy_Library *self, PyObject *UNUSED(args)) recalc_all_library_objects(G.main); /* append, rather than linking */ - if((self->flag & FILE_LINK)==0) { + if ((self->flag & FILE_LINK)==0) { Library *lib= BLI_findstring(&G.main->library, self->abspath, offsetof(Library, name)); - if(lib) all_local(lib, 1); - else BLI_assert(!"cant find name of just added library!"); + if (lib) all_local(lib, 1); + else BLI_assert(!"cant find name of just added library!"); } } @@ -426,7 +426,7 @@ int bpy_lib_init(PyObject *mod_par) /* some compilers dont like accessing this directly, delay assignment */ bpy_lib_Type.tp_getattro= PyObject_GenericGetAttr; - if(PyType_Ready(&bpy_lib_Type) < 0) + if (PyType_Ready(&bpy_lib_Type) < 0) return -1; return 0; diff --git a/source/blender/python/intern/bpy_operator.c b/source/blender/python/intern/bpy_operator.c index dedc5df1f1c..b5fd7851458 100644 --- a/source/blender/python/intern/bpy_operator.c +++ b/source/blender/python/intern/bpy_operator.c @@ -76,7 +76,7 @@ static PyObject *pyop_poll(PyObject *UNUSED(self), PyObject *args) // XXX Todo, work out a better solution for passing on context, could make a tuple from self and pack the name and Context into it... bContext *C= (bContext *)BPy_GetContext(); - if(C==NULL) { + if (C==NULL) { PyErr_SetString(PyExc_RuntimeError, "Context is None, cant poll any operators"); return NULL; } @@ -93,8 +93,8 @@ static PyObject *pyop_poll(PyObject *UNUSED(self), PyObject *args) return NULL; } - if(context_str) { - if(RNA_enum_value_from_id(operator_context_items, context_str, &context)==0) { + if (context_str) { + if (RNA_enum_value_from_id(operator_context_items, context_str, &context)==0) { char *enum_str= BPy_enum_as_string(operator_context_items); PyErr_Format(PyExc_TypeError, "Calling operator \"bpy.ops.%s.poll\" error, " @@ -105,7 +105,7 @@ static PyObject *pyop_poll(PyObject *UNUSED(self), PyObject *args) } } - if(context_dict==NULL || context_dict==Py_None) { + if (context_dict==NULL || context_dict==Py_None) { context_dict= NULL; } else if (!PyDict_Check(context_dict)) { @@ -150,7 +150,7 @@ static PyObject *pyop_call(PyObject *UNUSED(self), PyObject *args) // XXX Todo, work out a better solution for passing on context, could make a tuple from self and pack the name and Context into it... bContext *C= (bContext *)BPy_GetContext(); - if(C==NULL) { + if (C==NULL) { PyErr_SetString(PyExc_RuntimeError, "Context is None, cant poll any operators"); return NULL; } @@ -167,7 +167,7 @@ static PyObject *pyop_call(PyObject *UNUSED(self), PyObject *args) return NULL; } - if(!pyrna_write_check()) { + if (!pyrna_write_check()) { PyErr_Format(PyExc_RuntimeError, "Calling operator \"bpy.ops.%s\" error, " "can't modify blend data in this state (drawing/rendering)", @@ -175,8 +175,8 @@ static PyObject *pyop_call(PyObject *UNUSED(self), PyObject *args) return NULL; } - if(context_str) { - if(RNA_enum_value_from_id(operator_context_items, context_str, &context)==0) { + if (context_str) { + if (RNA_enum_value_from_id(operator_context_items, context_str, &context)==0) { char *enum_str= BPy_enum_as_string(operator_context_items); PyErr_Format(PyExc_TypeError, "Calling operator \"bpy.ops.%s\" error, " @@ -187,7 +187,7 @@ static PyObject *pyop_call(PyObject *UNUSED(self), PyObject *args) } } - if(context_dict==NULL || context_dict==Py_None) { + if (context_dict==NULL || context_dict==Py_None) { context_dict= NULL; } else if (!PyDict_Check(context_dict)) { @@ -203,7 +203,7 @@ static PyObject *pyop_call(PyObject *UNUSED(self), PyObject *args) CTX_py_dict_set(C, (void *)context_dict); Py_XINCREF(context_dict); /* so we done loose it */ - if(WM_operator_poll_context((bContext*)C, ot, context) == FALSE) { + if (WM_operator_poll_context((bContext*)C, ot, context) == FALSE) { const char *msg= CTX_wm_operator_poll_msg_get(C); PyErr_Format(PyExc_RuntimeError, "Operator bpy.ops.%.200s.poll() %.200s", @@ -215,7 +215,7 @@ static PyObject *pyop_call(PyObject *UNUSED(self), PyObject *args) WM_operator_properties_create_ptr(&ptr, ot); WM_operator_properties_sanitize(&ptr, 0); - if(kw && PyDict_Size(kw)) + if (kw && PyDict_Size(kw)) error_val= pyrna_pydict_to_props(&ptr, kw, 0, "Converting py args to operator properties: "); @@ -245,10 +245,10 @@ static PyObject *pyop_call(PyObject *UNUSED(self), PyObject *args) error_val= BPy_reports_to_error(reports, PyExc_RuntimeError, FALSE); /* operator output is nice to have in the terminal/console too */ - if(reports->list.first) { + if (reports->list.first) { char *report_str= BKE_reports_string(reports, 0); /* all reports */ - if(report_str) { + if (report_str) { PySys_WriteStdout("%s\n", report_str); MEM_freeN(report_str); } @@ -315,7 +315,7 @@ static PyObject *pyop_as_string(PyObject *UNUSED(self), PyObject *args) bContext *C= (bContext *)BPy_GetContext(); - if(C==NULL) { + if (C==NULL) { PyErr_SetString(PyExc_RuntimeError, "Context is None, cant get the string representation of this object."); return NULL; } @@ -336,7 +336,7 @@ static PyObject *pyop_as_string(PyObject *UNUSED(self), PyObject *args) /* Save another lookup */ RNA_pointer_create(NULL, ot->srna, NULL, &ptr); - if(kw && PyDict_Size(kw)) + if (kw && PyDict_Size(kw)) error_val= pyrna_pydict_to_props(&ptr, kw, 0, "Converting py args to operator properties: "); if (error_val==0) @@ -348,7 +348,7 @@ static PyObject *pyop_as_string(PyObject *UNUSED(self), PyObject *args) return NULL; } - if(buf) { + if (buf) { pybuf= PyUnicode_FromString(buf); MEM_freeN(buf); } @@ -364,7 +364,7 @@ static PyObject *pyop_dir(PyObject *UNUSED(self)) GHashIterator *iter= WM_operatortype_iter(); PyObject *list= PyList_New(0), *name; - for( ; !BLI_ghashIterator_isDone(iter); BLI_ghashIterator_step(iter)) { + for ( ; !BLI_ghashIterator_isDone(iter); BLI_ghashIterator_step(iter)) { wmOperatorType *ot= BLI_ghashIterator_getValue(iter); name= PyUnicode_FromString(ot->idname); @@ -383,12 +383,12 @@ static PyObject *pyop_getrna(PyObject *UNUSED(self), PyObject *value) char *opname= _PyUnicode_AsString(value); BPy_StructRNA *pyrna= NULL; - if(opname==NULL) { + if (opname==NULL) { PyErr_SetString(PyExc_TypeError, "_bpy.ops.get_rna() expects a string argument"); return NULL; } ot= WM_operatortype_find(opname, TRUE); - if(ot==NULL) { + if (ot==NULL) { PyErr_Format(PyExc_KeyError, "_bpy.ops.get_rna(\"%s\") not found", opname); return NULL; } @@ -416,12 +416,12 @@ static PyObject *pyop_getinstance(PyObject *UNUSED(self), PyObject *value) char *opname= _PyUnicode_AsString(value); BPy_StructRNA *pyrna= NULL; - if(opname==NULL) { + if (opname==NULL) { PyErr_SetString(PyExc_TypeError, "_bpy.ops.get_instance() expects a string argument"); return NULL; } ot= WM_operatortype_find(opname, TRUE); - if(ot==NULL) { + if (ot==NULL) { PyErr_Format(PyExc_KeyError, "_bpy.ops.get_instance(\"%s\") not found", opname); return NULL; } diff --git a/source/blender/python/intern/bpy_operator_wrap.c b/source/blender/python/intern/bpy_operator_wrap.c index b5ded8b3a65..1b158f9bade 100644 --- a/source/blender/python/intern/bpy_operator_wrap.c +++ b/source/blender/python/intern/bpy_operator_wrap.c @@ -50,7 +50,7 @@ static void operator_properties_init(wmOperatorType *ot) * later */ RNA_def_struct_identifier(ot->srna, ot->idname); - if(pyrna_deferred_register_class(ot->srna, py_class) != 0) { + if (pyrna_deferred_register_class(ot->srna, py_class) != 0) { PyErr_Print(); /* failed to register operator props */ PyErr_Clear(); } @@ -72,8 +72,9 @@ void operator_wrapper(wmOperatorType *ot, void *userdata) RNA_pointer_create(NULL, ot->srna, NULL, &ptr); prop= RNA_struct_find_property(&ptr, "type"); - if(prop) + if (prop) { ot->prop= prop; + } } } diff --git a/source/blender/python/intern/bpy_props.c b/source/blender/python/intern/bpy_props.c index 5c668590dff..d3963458298 100644 --- a/source/blender/python/intern/bpy_props.c +++ b/source/blender/python/intern/bpy_props.c @@ -123,11 +123,11 @@ static PyObject *pyrna_struct_as_instance(PointerRNA *ptr) PyObject *self= NULL; /* first get self */ /* operators can store their own instance for later use */ - if(ptr->data) { + if (ptr->data) { void **instance= RNA_struct_instance(ptr); - if(instance) { - if(*instance) { + if (instance) { + if (*instance) { self= *instance; Py_INCREF(self); } @@ -135,7 +135,7 @@ static PyObject *pyrna_struct_as_instance(PointerRNA *ptr) } /* in most cases this will run */ - if(self == NULL) { + if (self == NULL) { self= pyrna_struct_CreatePyObject(ptr); } @@ -167,7 +167,7 @@ static PyObject *bpy_prop_deferred_return(PyObject *func, PyObject *kw) PyTuple_SET_ITEM(ret, 0, func); Py_INCREF(func); - if(kw==NULL) + if (kw==NULL) kw= PyDict_New(); else Py_INCREF(kw); @@ -190,7 +190,7 @@ static void bpy_prop_update_cb(struct bContext *C, struct PointerRNA *ptr, struc BLI_assert(py_data != NULL); - if(!is_write_ok) { + if (!is_write_ok) { pyrna_write_set(TRUE); } @@ -209,11 +209,11 @@ static void bpy_prop_update_cb(struct bContext *C, struct PointerRNA *ptr, struc Py_DECREF(args); - if(ret == NULL) { + if (ret == NULL) { printf_func_error(py_func); } else { - if(ret != Py_None) { + if (ret != Py_None) { PyErr_SetString(PyExc_ValueError, "the return value must be None"); printf_func_error(py_func); } @@ -223,15 +223,15 @@ static void bpy_prop_update_cb(struct bContext *C, struct PointerRNA *ptr, struc bpy_context_clear(C, &gilstate); - if(!is_write_ok) { + if (!is_write_ok) { pyrna_write_set(FALSE); } } static int bpy_prop_callback_check(PyObject *py_func, int argcount) { - if(py_func) { - if(!PyFunction_Check(py_func)) { + if (py_func) { + if (!PyFunction_Check(py_func)) { PyErr_Format(PyExc_TypeError, "update keyword: expected a function type, not a %.200s", Py_TYPE(py_func)->tp_name); @@ -255,7 +255,7 @@ static int bpy_prop_callback_check(PyObject *py_func, int argcount) static int bpy_prop_callback_assign(struct PropertyRNA *prop, PyObject *update_cb) { /* assume this is already checked for type and arg length */ - if(update_cb) { + if (update_cb) { PyObject **py_data= MEM_callocN(sizeof(PyObject *) * BPY_DATA_CB_SLOT_SIZE, "bpy_prop_callback_assign"); RNA_def_property_update_runtime(prop, (void *)bpy_prop_update_cb); py_data[BPY_DATA_CB_SLOT_UPDATE]= update_cb; @@ -270,7 +270,7 @@ static int bpy_prop_callback_assign(struct PropertyRNA *prop, PyObject *update_c /* utility function we need for parsing int's in an if statement */ static int py_long_as_int(PyObject *py_long, int *r_int) { - if(PyLong_CheckExact(py_long)) { + if (PyLong_CheckExact(py_long)) { *r_int= (int)PyLong_AS_LONG(py_long); return 0; } @@ -295,8 +295,8 @@ static int py_long_as_int(PyObject *py_long, int *r_int) return NULL; \ } \ srna= srna_from_self(self, #_func"(...):"); \ - if(srna==NULL) { \ - if(PyErr_Occurred()) \ + if (srna==NULL) { \ + if (PyErr_Occurred()) \ return NULL; \ return bpy_prop_deferred_return((void *)pymeth_##_func, kw); \ } \ @@ -304,24 +304,24 @@ static int py_long_as_int(PyObject *py_long, int *r_int) /* terse macros for error checks shared between all funcs cant use function * calls because of static strins passed to pyrna_set_to_enum_bitfield */ #define BPY_PROPDEF_CHECK(_func, _property_flag_items) \ - if(id_len >= MAX_IDPROP_NAME) { \ + if (id_len >= MAX_IDPROP_NAME) { \ PyErr_Format(PyExc_TypeError, \ #_func"(): '%.200s' too long, max length is %d", \ id, MAX_IDPROP_NAME-1); \ return NULL; \ } \ - if(RNA_def_property_free_identifier(srna, id) == -1) { \ + if (RNA_def_property_free_identifier(srna, id) == -1) { \ PyErr_Format(PyExc_TypeError, \ #_func"(): '%s' is defined as a non-dynamic type", \ id); \ return NULL; \ } \ - if(pyopts && pyrna_set_to_enum_bitfield(_property_flag_items, pyopts, &opts, #_func"(options={...}):")) \ + if (pyopts && pyrna_set_to_enum_bitfield(_property_flag_items, pyopts, &opts, #_func"(options={...}):")) \ return NULL; \ #define BPY_PROPDEF_SUBTYPE_CHECK(_func, _property_flag_items, _subtype) \ BPY_PROPDEF_CHECK(_func, _property_flag_items) \ - if(pysubtype && RNA_enum_value_from_id(_subtype, pysubtype, &subtype)==0) { \ + if (pysubtype && RNA_enum_value_from_id(_subtype, pysubtype, &subtype)==0) { \ PyErr_Format(PyExc_TypeError, \ #_func"(subtype='%s'): invalid subtype", \ pysubtype); \ @@ -380,7 +380,7 @@ static PyObject *BPy_BoolProperty(PyObject *self, PyObject *args, PyObject *kw) BPY_PROPDEF_HEAD(BoolProperty) - if(srna) { + if (srna) { static const char *kwlist[]= {"attr", "name", "description", "default", "options", "subtype", "update", NULL}; const char *id=NULL, *name="", *description=""; int id_len; @@ -412,9 +412,9 @@ static PyObject *BPy_BoolProperty(PyObject *self, PyObject *args, PyObject *kw) RNA_def_property_boolean_default(prop, def); RNA_def_property_ui_text(prop, name, description); - if(pyopts) { - if(opts & PROP_HIDDEN) RNA_def_property_flag(prop, PROP_HIDDEN); - if((opts & PROP_ANIMATABLE)==0) RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); + if (pyopts) { + if (opts & PROP_HIDDEN) RNA_def_property_flag(prop, PROP_HIDDEN); + if ((opts & PROP_ANIMATABLE)==0) RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); } bpy_prop_callback_assign(prop, update_cb); RNA_def_property_duplicate_pointers(srna, prop); @@ -446,7 +446,7 @@ static PyObject *BPy_BoolVectorProperty(PyObject *self, PyObject *args, PyObject BPY_PROPDEF_HEAD(BoolVectorProperty) - if(srna) { + if (srna) { static const char *kwlist[]= {"attr", "name", "description", "default", "options", "subtype", "size", "update", NULL}; const char *id=NULL, *name="", *description=""; int id_len; @@ -472,12 +472,12 @@ static PyObject *BPy_BoolVectorProperty(PyObject *self, PyObject *args, PyObject BPY_PROPDEF_SUBTYPE_CHECK(BoolVectorProperty, property_flag_items, property_subtype_array_items) - if(size < 1 || size > PYRNA_STACK_ARRAY) { + if (size < 1 || size > PYRNA_STACK_ARRAY) { PyErr_Format(PyExc_TypeError, "BoolVectorProperty(size=%d): size must be between 0 and " STRINGIFY(PYRNA_STACK_ARRAY), size); return NULL; } - if(pydef && PyC_AsArray(def, pydef, size, &PyBool_Type, FALSE, "BoolVectorProperty(default=sequence)") < 0) + if (pydef && PyC_AsArray(def, pydef, size, &PyBool_Type, FALSE, "BoolVectorProperty(default=sequence)") < 0) return NULL; if (bpy_prop_callback_check(update_cb, 2) == -1) { @@ -487,12 +487,12 @@ static PyObject *BPy_BoolVectorProperty(PyObject *self, PyObject *args, PyObject // prop= RNA_def_boolean_array(srna, id, size, pydef ? def:NULL, name, description); prop= RNA_def_property(srna, id, PROP_BOOLEAN, subtype); RNA_def_property_array(prop, size); - if(pydef) RNA_def_property_boolean_array_default(prop, def); + if (pydef) RNA_def_property_boolean_array_default(prop, def); RNA_def_property_ui_text(prop, name, description); - if(pyopts) { - if(opts & PROP_HIDDEN) RNA_def_property_flag(prop, PROP_HIDDEN); - if((opts & PROP_ANIMATABLE)==0) RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); + if (pyopts) { + if (opts & PROP_HIDDEN) RNA_def_property_flag(prop, PROP_HIDDEN); + if ((opts & PROP_ANIMATABLE)==0) RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); } bpy_prop_callback_assign(prop, update_cb); RNA_def_property_duplicate_pointers(srna, prop); @@ -520,7 +520,7 @@ static PyObject *BPy_IntProperty(PyObject *self, PyObject *args, PyObject *kw) BPY_PROPDEF_HEAD(IntProperty) - if(srna) { + if (srna) { static const char *kwlist[]= {"attr", "name", "description", "default", "min", "max", "soft_min", "soft_max", "step", "options", "subtype", "update", NULL}; const char *id=NULL, *name="", *description=""; int id_len; @@ -555,9 +555,9 @@ static PyObject *BPy_IntProperty(PyObject *self, PyObject *args, PyObject *kw) RNA_def_property_ui_text(prop, name, description); RNA_def_property_ui_range(prop, MAX2(soft_min, min), MIN2(soft_max, max), step, 3); - if(pyopts) { - if(opts & PROP_HIDDEN) RNA_def_property_flag(prop, PROP_HIDDEN); - if((opts & PROP_ANIMATABLE)==0) RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); + if (pyopts) { + if (opts & PROP_HIDDEN) RNA_def_property_flag(prop, PROP_HIDDEN); + if ((opts & PROP_ANIMATABLE)==0) RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); } bpy_prop_callback_assign(prop, update_cb); RNA_def_property_duplicate_pointers(srna, prop); @@ -588,7 +588,7 @@ static PyObject *BPy_IntVectorProperty(PyObject *self, PyObject *args, PyObject BPY_PROPDEF_HEAD(IntVectorProperty) - if(srna) { + if (srna) { static const char *kwlist[]= {"attr", "name", "description", "default", "min", "max", "soft_min", "soft_max", "step", "options", "subtype", "size", "update", NULL}; const char *id=NULL, *name="", *description=""; int id_len; @@ -616,12 +616,12 @@ static PyObject *BPy_IntVectorProperty(PyObject *self, PyObject *args, PyObject BPY_PROPDEF_SUBTYPE_CHECK(IntVectorProperty, property_flag_items, property_subtype_array_items) - if(size < 1 || size > PYRNA_STACK_ARRAY) { + if (size < 1 || size > PYRNA_STACK_ARRAY) { PyErr_Format(PyExc_TypeError, "IntVectorProperty(size=%d): size must be between 0 and " STRINGIFY(PYRNA_STACK_ARRAY), size); return NULL; } - if(pydef && PyC_AsArray(def, pydef, size, &PyLong_Type, FALSE, "IntVectorProperty(default=sequence)") < 0) + if (pydef && PyC_AsArray(def, pydef, size, &PyLong_Type, FALSE, "IntVectorProperty(default=sequence)") < 0) return NULL; if (bpy_prop_callback_check(update_cb, 2) == -1) { @@ -630,14 +630,14 @@ static PyObject *BPy_IntVectorProperty(PyObject *self, PyObject *args, PyObject prop= RNA_def_property(srna, id, PROP_INT, subtype); RNA_def_property_array(prop, size); - if(pydef) RNA_def_property_int_array_default(prop, def); + if (pydef) RNA_def_property_int_array_default(prop, def); RNA_def_property_range(prop, min, max); RNA_def_property_ui_text(prop, name, description); RNA_def_property_ui_range(prop, MAX2(soft_min, min), MIN2(soft_max, max), step, 3); - if(pyopts) { - if(opts & PROP_HIDDEN) RNA_def_property_flag(prop, PROP_HIDDEN); - if((opts & PROP_ANIMATABLE)==0) RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); + if (pyopts) { + if (opts & PROP_HIDDEN) RNA_def_property_flag(prop, PROP_HIDDEN); + if ((opts & PROP_ANIMATABLE)==0) RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); } bpy_prop_callback_assign(prop, update_cb); RNA_def_property_duplicate_pointers(srna, prop); @@ -666,7 +666,7 @@ static PyObject *BPy_FloatProperty(PyObject *self, PyObject *args, PyObject *kw) BPY_PROPDEF_HEAD(FloatProperty) - if(srna) { + if (srna) { static const char *kwlist[]= {"attr", "name", "description", "default", "min", "max", "soft_min", "soft_max", "step", "precision", "options", "subtype", "unit", "update", NULL}; const char *id=NULL, *name="", *description=""; int id_len; @@ -695,7 +695,7 @@ static PyObject *BPy_FloatProperty(PyObject *self, PyObject *args, PyObject *kw) BPY_PROPDEF_SUBTYPE_CHECK(FloatProperty, property_flag_items, property_subtype_number_items) - if(pyunit && RNA_enum_value_from_id(property_unit_items, pyunit, &unit)==0) { + if (pyunit && RNA_enum_value_from_id(property_unit_items, pyunit, &unit)==0) { PyErr_Format(PyExc_TypeError, "FloatProperty(unit='%s'): invalid unit", pyunit); return NULL; } @@ -710,9 +710,9 @@ static PyObject *BPy_FloatProperty(PyObject *self, PyObject *args, PyObject *kw) RNA_def_property_ui_text(prop, name, description); RNA_def_property_ui_range(prop, MAX2(soft_min, min), MIN2(soft_max, max), step, precision); - if(pyopts) { - if(opts & PROP_HIDDEN) RNA_def_property_flag(prop, PROP_HIDDEN); - if((opts & PROP_ANIMATABLE)==0) RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); + if (pyopts) { + if (opts & PROP_HIDDEN) RNA_def_property_flag(prop, PROP_HIDDEN); + if ((opts & PROP_ANIMATABLE)==0) RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); } bpy_prop_callback_assign(prop, update_cb); RNA_def_property_duplicate_pointers(srna, prop); @@ -744,7 +744,7 @@ static PyObject *BPy_FloatVectorProperty(PyObject *self, PyObject *args, PyObjec BPY_PROPDEF_HEAD(FloatVectorProperty) - if(srna) { + if (srna) { static const char *kwlist[]= {"attr", "name", "description", "default", "min", "max", "soft_min", "soft_max", "step", "precision", "options", "subtype", "unit", "size", "update", NULL}; const char *id=NULL, *name="", *description=""; int id_len; @@ -774,17 +774,17 @@ static PyObject *BPy_FloatVectorProperty(PyObject *self, PyObject *args, PyObjec BPY_PROPDEF_SUBTYPE_CHECK(FloatVectorProperty, property_flag_items, property_subtype_array_items) - if(pyunit && RNA_enum_value_from_id(property_unit_items, pyunit, &unit)==0) { + if (pyunit && RNA_enum_value_from_id(property_unit_items, pyunit, &unit)==0) { PyErr_Format(PyExc_TypeError, "FloatVectorProperty(unit='%s'): invalid unit", pyunit); return NULL; } - if(size < 1 || size > PYRNA_STACK_ARRAY) { + if (size < 1 || size > PYRNA_STACK_ARRAY) { PyErr_Format(PyExc_TypeError, "FloatVectorProperty(size=%d): size must be between 0 and " STRINGIFY(PYRNA_STACK_ARRAY), size); return NULL; } - if(pydef && PyC_AsArray(def, pydef, size, &PyFloat_Type, FALSE, "FloatVectorProperty(default=sequence)") < 0) + if (pydef && PyC_AsArray(def, pydef, size, &PyFloat_Type, FALSE, "FloatVectorProperty(default=sequence)") < 0) return NULL; if (bpy_prop_callback_check(update_cb, 2) == -1) { @@ -793,14 +793,14 @@ static PyObject *BPy_FloatVectorProperty(PyObject *self, PyObject *args, PyObjec prop= RNA_def_property(srna, id, PROP_FLOAT, subtype | unit); RNA_def_property_array(prop, size); - if(pydef) RNA_def_property_float_array_default(prop, def); + if (pydef) RNA_def_property_float_array_default(prop, def); RNA_def_property_range(prop, min, max); RNA_def_property_ui_text(prop, name, description); RNA_def_property_ui_range(prop, MAX2(soft_min, min), MIN2(soft_max, max), step, precision); - if(pyopts) { - if(opts & PROP_HIDDEN) RNA_def_property_flag(prop, PROP_HIDDEN); - if((opts & PROP_ANIMATABLE)==0) RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); + if (pyopts) { + if (opts & PROP_HIDDEN) RNA_def_property_flag(prop, PROP_HIDDEN); + if ((opts & PROP_ANIMATABLE)==0) RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); } bpy_prop_callback_assign(prop, update_cb); RNA_def_property_duplicate_pointers(srna, prop); @@ -827,7 +827,7 @@ static PyObject *BPy_StringProperty(PyObject *self, PyObject *args, PyObject *kw BPY_PROPDEF_HEAD(StringProperty) - if(srna) { + if (srna) { static const char *kwlist[]= {"attr", "name", "description", "default", "maxlen", "options", "subtype", "update", NULL}; const char *id=NULL, *name="", *description="", *def=""; int id_len; @@ -856,13 +856,13 @@ static PyObject *BPy_StringProperty(PyObject *self, PyObject *args, PyObject *kw } prop= RNA_def_property(srna, id, PROP_STRING, subtype); - if(maxlen != 0) RNA_def_property_string_maxlength(prop, maxlen + 1); /* +1 since it includes null terminator */ - if(def) RNA_def_property_string_default(prop, def); + if (maxlen != 0) RNA_def_property_string_maxlength(prop, maxlen + 1); /* +1 since it includes null terminator */ + if (def) RNA_def_property_string_default(prop, def); RNA_def_property_ui_text(prop, name, description); - if(pyopts) { - if(opts & PROP_HIDDEN) RNA_def_property_flag(prop, PROP_HIDDEN); - if((opts & PROP_ANIMATABLE)==0) RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); + if (pyopts) { + if (opts & PROP_HIDDEN) RNA_def_property_flag(prop, PROP_HIDDEN); + if ((opts & PROP_ANIMATABLE)==0) RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); } bpy_prop_callback_assign(prop, update_cb); RNA_def_property_duplicate_pointers(srna, prop); @@ -878,7 +878,7 @@ static size_t strswapbufcpy(char *buf, const char **orig) char *dst= buf; size_t i= 0; *orig= buf; - while((*dst= *src)) { dst++; src++; i++; } + while ((*dst= *src)) { dst++; src++; i++; } return i + 1; /* include '\0' */ } #endif @@ -893,12 +893,12 @@ static EnumPropertyItem *enum_items_from_py(PyObject *seq_fast, PyObject *def, i short def_used= 0; const char *def_cmp= NULL; - if(is_enum_flag) { - if(seq_len > RNA_ENUM_BITFLAG_SIZE) { + if (is_enum_flag) { + if (seq_len > RNA_ENUM_BITFLAG_SIZE) { PyErr_SetString(PyExc_TypeError, "EnumProperty(...): maximum " STRINGIFY(RNA_ENUM_BITFLAG_SIZE) " members for a ENUM_FLAG type property"); return NULL; } - if(def && !PySet_Check(def)) { + if (def && !PySet_Check(def)) { PyErr_Format(PyExc_TypeError, "EnumProperty(...): default option must be a 'set' " "type when ENUM_FLAG is enabled, not a '%.200s'", @@ -907,9 +907,9 @@ static EnumPropertyItem *enum_items_from_py(PyObject *seq_fast, PyObject *def, i } } else { - if(def) { + if (def) { def_cmp= _PyUnicode_AsString(def); - if(def_cmp==NULL) { + if (def_cmp==NULL) { PyErr_Format(PyExc_TypeError, "EnumProperty(...): default option must be a 'str' " "type when ENUM_FLAG is disabled, not a '%.200s'", @@ -924,7 +924,7 @@ static EnumPropertyItem *enum_items_from_py(PyObject *seq_fast, PyObject *def, i items= MEM_callocN(sizeof(EnumPropertyItem) * (seq_len + 1), "enum_items_from_py1"); - for(i=0; iidentifier); buf += strswapbufcpy(buf, &items_ptr->name); buf += strswapbufcpy(buf, &items_ptr->description); @@ -1052,14 +1052,14 @@ static EnumPropertyItem *bpy_props_enum_itemf(struct bContext *C, PointerRNA *pt Py_DECREF(args); - if(items==NULL) { + if (items==NULL) { err= -1; } else { PyObject *items_fast; int defvalue_dummy=0; - if(!(items_fast= PySequence_Fast(items, "EnumProperty(...): return value from the callback was not a sequence"))) { + if (!(items_fast= PySequence_Fast(items, "EnumProperty(...): return value from the callback was not a sequence"))) { err= -1; } else { @@ -1067,7 +1067,7 @@ static EnumPropertyItem *bpy_props_enum_itemf(struct bContext *C, PointerRNA *pt Py_DECREF(items_fast); - if(!eitems) { + if (!eitems) { err= -1; } } @@ -1075,7 +1075,7 @@ static EnumPropertyItem *bpy_props_enum_itemf(struct bContext *C, PointerRNA *pt Py_DECREF(items); } - if(err != -1) { /* worked */ + if (err != -1) { /* worked */ *free= 1; } else { @@ -1118,7 +1118,7 @@ static PyObject *BPy_EnumProperty(PyObject *self, PyObject *args, PyObject *kw) BPY_PROPDEF_HEAD(EnumProperty) - if(srna) { + if (srna) { static const char *kwlist[]= {"attr", "items", "name", "description", "default", "options", "update", NULL}; const char *id=NULL, *name="", *description=""; PyObject *def= NULL; @@ -1149,16 +1149,16 @@ static PyObject *BPy_EnumProperty(PyObject *self, PyObject *args, PyObject *kw) } /* items can be a list or a callable */ - if(PyFunction_Check(items)) { /* dont use PyCallable_Check because we need the function code for errors */ + if (PyFunction_Check(items)) { /* dont use PyCallable_Check because we need the function code for errors */ PyCodeObject *f_code= (PyCodeObject *)PyFunction_GET_CODE(items); - if(f_code->co_argcount != 2) { + if (f_code->co_argcount != 2) { PyErr_Format(PyExc_ValueError, "EnumProperty(...): expected 'items' function to take 2 arguments, not %d", f_code->co_argcount); return NULL; } - if(def) { + if (def) { /* note, using type error here is odd but python does this for invalid arguments */ PyErr_SetString(PyExc_TypeError, "EnumProperty(...): 'default' can't be set when 'items' is a function"); @@ -1169,7 +1169,7 @@ static PyObject *BPy_EnumProperty(PyObject *self, PyObject *args, PyObject *kw) eitems= DummyRNA_NULL_items; } else { - if(!(items_fast= PySequence_Fast(items, "EnumProperty(...): expected a sequence of tuples for the enum items or a function"))) { + if (!(items_fast= PySequence_Fast(items, "EnumProperty(...): expected a sequence of tuples for the enum items or a function"))) { return NULL; } @@ -1177,28 +1177,28 @@ static PyObject *BPy_EnumProperty(PyObject *self, PyObject *args, PyObject *kw) Py_DECREF(items_fast); - if(!eitems) { + if (!eitems) { return NULL; } } - if(opts & PROP_ENUM_FLAG) prop= RNA_def_enum_flag(srna, id, eitems, defvalue, name, description); - else prop= RNA_def_enum(srna, id, eitems, defvalue, name, description); + if (opts & PROP_ENUM_FLAG) prop= RNA_def_enum_flag(srna, id, eitems, defvalue, name, description); + else prop= RNA_def_enum(srna, id, eitems, defvalue, name, description); - if(is_itemf) { + if (is_itemf) { RNA_def_enum_funcs(prop, bpy_props_enum_itemf); RNA_def_enum_py_data(prop, (void *)items); /* Py_INCREF(items); */ /* watch out!, if user is tricky they can probably crash blender if they manage to free the callback, take care! */ } - if(pyopts) { - if(opts & PROP_HIDDEN) RNA_def_property_flag(prop, PROP_HIDDEN); - if((opts & PROP_ANIMATABLE)==0) RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); + if (pyopts) { + if (opts & PROP_HIDDEN) RNA_def_property_flag(prop, PROP_HIDDEN); + if ((opts & PROP_ANIMATABLE)==0) RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); } bpy_prop_callback_assign(prop, update_cb); RNA_def_property_duplicate_pointers(srna, prop); - if(is_itemf == FALSE) { + if (is_itemf == FALSE) { MEM_freeN(eitems); } } @@ -1210,8 +1210,8 @@ static StructRNA *pointer_type_from_py(PyObject *value, const char *error_prefix StructRNA *srna; srna= srna_from_self(value, ""); - if(!srna) { - if(PyErr_Occurred()) { + if (!srna) { + if (PyErr_Occurred()) { PyObject *msg= PyC_ExceptionBuffer(); char *msg_char= _PyUnicode_AsString(msg); PyErr_Format(PyExc_TypeError, @@ -1227,7 +1227,7 @@ static StructRNA *pointer_type_from_py(PyObject *value, const char *error_prefix return NULL; } - if(!RNA_struct_is_a(srna, &RNA_PropertyGroup)) { + if (!RNA_struct_is_a(srna, &RNA_PropertyGroup)) { PyErr_Format(PyExc_TypeError, "%.200s expected an RNA type derived from PropertyGroup", error_prefix); @@ -1256,7 +1256,7 @@ static PyObject *BPy_PointerProperty(PyObject *self, PyObject *args, PyObject *k BPY_PROPDEF_HEAD(PointerProperty) - if(srna) { + if (srna) { static const char *kwlist[]= {"attr", "type", "name", "description", "options", "update", NULL}; const char *id=NULL, *name="", *description=""; int id_len; @@ -1280,7 +1280,7 @@ static PyObject *BPy_PointerProperty(PyObject *self, PyObject *args, PyObject *k BPY_PROPDEF_CHECK(PointerProperty, property_flag_items) ptype= pointer_type_from_py(type, "PointerProperty(...):"); - if(!ptype) + if (!ptype) return NULL; if (bpy_prop_callback_check(update_cb, 2) == -1) { @@ -1288,9 +1288,9 @@ static PyObject *BPy_PointerProperty(PyObject *self, PyObject *args, PyObject *k } prop= RNA_def_pointer_runtime(srna, id, ptype, name, description); - if(pyopts) { - if(opts & PROP_HIDDEN) RNA_def_property_flag(prop, PROP_HIDDEN); - if((opts & PROP_ANIMATABLE)==0) RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); + if (pyopts) { + if (opts & PROP_HIDDEN) RNA_def_property_flag(prop, PROP_HIDDEN); + if ((opts & PROP_ANIMATABLE)==0) RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); } bpy_prop_callback_assign(prop, update_cb); RNA_def_property_duplicate_pointers(srna, prop); @@ -1316,7 +1316,7 @@ static PyObject *BPy_CollectionProperty(PyObject *self, PyObject *args, PyObject BPY_PROPDEF_HEAD(CollectionProperty) - if(srna) { + if (srna) { static const char *kwlist[]= {"attr", "type", "name", "description", "options", NULL}; const char *id=NULL, *name="", *description=""; int id_len; @@ -1338,13 +1338,13 @@ static PyObject *BPy_CollectionProperty(PyObject *self, PyObject *args, PyObject BPY_PROPDEF_CHECK(CollectionProperty, property_flag_items) ptype= pointer_type_from_py(type, "CollectionProperty(...):"); - if(!ptype) + if (!ptype) return NULL; prop= RNA_def_collection_runtime(srna, id, ptype, name, description); - if(pyopts) { - if(opts & PROP_HIDDEN) RNA_def_property_flag(prop, PROP_HIDDEN); - if((opts & PROP_ANIMATABLE)==0) RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); + if (pyopts) { + if (opts & PROP_HIDDEN) RNA_def_property_flag(prop, PROP_HIDDEN); + if ((opts & PROP_ANIMATABLE)==0) RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); } RNA_def_property_duplicate_pointers(srna, prop); } @@ -1363,7 +1363,7 @@ static PyObject *BPy_RemoveProperty(PyObject *self, PyObject *args, PyObject *kw { StructRNA *srna; - if(PyTuple_GET_SIZE(args) == 1) { + if (PyTuple_GET_SIZE(args) == 1) { PyObject *ret; self= PyTuple_GET_ITEM(args, 0); args= PyTuple_New(0); @@ -1377,10 +1377,10 @@ static PyObject *BPy_RemoveProperty(PyObject *self, PyObject *args, PyObject *kw } srna= srna_from_self(self, "RemoveProperty(...):"); - if(srna==NULL && PyErr_Occurred()) { + if (srna==NULL && PyErr_Occurred()) { return NULL; /* self's type was compatible but error getting the srna */ } - else if(srna==NULL) { + else if (srna==NULL) { PyErr_SetString(PyExc_TypeError, "RemoveProperty(): struct rna not available for this type"); return NULL; } @@ -1396,7 +1396,7 @@ static PyObject *BPy_RemoveProperty(PyObject *self, PyObject *args, PyObject *kw return NULL; } - if(RNA_def_property_free_identifier(srna, id) != 1) { + if (RNA_def_property_free_identifier(srna, id) != 1) { PyErr_Format(PyExc_TypeError, "RemoveProperty(): '%s' not a defined dynamic property", id); return NULL; } diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c index 0acd844cc84..c08f981c2f2 100644 --- a/source/blender/python/intern/bpy_rna.c +++ b/source/blender/python/intern/bpy_rna.c @@ -91,8 +91,9 @@ static PyObject *pyrna_prop_collection_values(BPy_PropertyRNA *self); int pyrna_struct_validity_check(BPy_StructRNA *pysrna) { - if(pysrna->ptr.type) + if (pysrna->ptr.type) { return 0; + } PyErr_Format(PyExc_ReferenceError, "StructRNA of type %.200s has been removed", Py_TYPE(pysrna)->tp_name); @@ -101,8 +102,9 @@ int pyrna_struct_validity_check(BPy_StructRNA *pysrna) int pyrna_prop_validity_check(BPy_PropertyRNA *self) { - if(self->ptr.type) + if (self->ptr.type) { return 0; + } PyErr_Format(PyExc_ReferenceError, "PropertyRNA of type %.200s.%.200s has been removed", Py_TYPE(self)->tp_name, RNA_property_identifier(self->prop)); @@ -131,15 +133,15 @@ static void id_release_gc(struct ID *id) { unsigned int j; // unsigned int i= 0; - for(j=0; j<3; j++) { + for (j=0; j<3; j++) { /* hack below to get the 2 other lists from _PyGC_generation0 that are normally not exposed */ PyGC_Head *gen= (PyGC_Head *)(((char *)_PyGC_generation0) + (sizeof(gc_generation) * j)); PyGC_Head *g= gen->gc.gc_next; while ((g= g->gc.gc_next) != gen) { PyObject *ob= FROM_GC(g); - if(PyType_IsSubtype(Py_TYPE(ob), &pyrna_struct_Type) || PyType_IsSubtype(Py_TYPE(ob), &pyrna_prop_Type)) { + if (PyType_IsSubtype(Py_TYPE(ob), &pyrna_struct_Type) || PyType_IsSubtype(Py_TYPE(ob), &pyrna_prop_Type)) { BPy_DummyPointerRNA *ob_ptr= (BPy_DummyPointerRNA *)ob; - if(ob_ptr->ptr.id.data == id) { + if (ob_ptr->ptr.id.data == id) { pyrna_invalidate(ob_ptr); // printf("freeing: %p %s, %.200s\n", (void *)ob, id->name, Py_TYPE(ob)->tp_name); // i++; @@ -163,7 +165,7 @@ static GHash *id_weakref_pool_get(ID *id) { GHash *weakinfo_hash= NULL; - if(id_weakref_pool) { + if (id_weakref_pool) { weakinfo_hash= BLI_ghash_lookup(id_weakref_pool, (void *)id); } else { @@ -172,7 +174,7 @@ static GHash *id_weakref_pool_get(ID *id) weakinfo_hash= NULL; } - if(weakinfo_hash==NULL) { + if (weakinfo_hash==NULL) { /* we're using a ghash as a set, could use libHX's HXMAP_SINGULAR but would be an extra dep. */ weakinfo_hash= BLI_ghash_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp, "rna_id"); BLI_ghash_insert(id_weakref_pool, (void *)id, weakinfo_hash); @@ -220,7 +222,7 @@ static PyObject *id_free_weakref_cb(PyObject *weakinfo_capsule, PyObject *weakre GHash *weakinfo_hash= PyCapsule_GetPointer(weakinfo_capsule, NULL); - if(BLI_ghash_size(weakinfo_hash) > 1) { + if (BLI_ghash_size(weakinfo_hash) > 1) { BLI_ghash_remove(weakinfo_hash, weakref, NULL, NULL); } else { /* get the last id and free it */ @@ -246,7 +248,7 @@ static void id_release_weakref_list(struct ID *id, GHash *weakinfo_hash) while (!BLI_ghashIterator_isDone(&weakinfo_hash_iter)) { PyObject *weakref= (PyObject *)BLI_ghashIterator_getKey(&weakinfo_hash_iter); PyObject *item= PyWeakref_GET_OBJECT(weakref); - if(item != Py_None) { + if (item != Py_None) { #ifdef DEBUG_RNA_WEAKREF PyC_ObSpit("id_release_weakref item ", item); @@ -263,7 +265,7 @@ static void id_release_weakref_list(struct ID *id, GHash *weakinfo_hash) BLI_ghash_remove(id_weakref_pool, (void *)id, NULL, NULL); BLI_ghash_free(weakinfo_hash, NULL, NULL); - if(BLI_ghash_size(id_weakref_pool) == 0) { + if (BLI_ghash_size(id_weakref_pool) == 0) { BLI_ghash_free(id_weakref_pool, NULL, NULL); id_weakref_pool= NULL; #ifdef DEBUG_RNA_WEAKREF @@ -275,7 +277,7 @@ static void id_release_weakref_list(struct ID *id, GHash *weakinfo_hash) static void id_release_weakref(struct ID *id) { GHash *weakinfo_hash= BLI_ghash_lookup(id_weakref_pool, (void *)id); - if(weakinfo_hash) { + if (weakinfo_hash) { id_release_weakref_list(id, weakinfo_hash); } } @@ -289,7 +291,7 @@ void BPY_id_release(struct ID *id) #endif #ifdef USE_PYRNA_INVALIDATE_WEAKREF - if(id_weakref_pool) { + if (id_weakref_pool) { PyGILState_STATE gilstate= PyGILState_Ensure(); id_release_weakref(id); @@ -307,13 +309,13 @@ static short rna_disallow_writes= FALSE; static int rna_id_write_error(PointerRNA *ptr, PyObject *key) { ID *id= ptr->id.data; - if(id) { + if (id) { const short idcode= GS(id->name); - if(!ELEM(idcode, ID_WM, ID_SCR)) { /* may need more added here */ + if (!ELEM(idcode, ID_WM, ID_SCR)) { /* may need more added here */ const char *idtype= BKE_idcode_to_name(idcode); const char *pyname; - if(key && PyUnicode_Check(key)) pyname= _PyUnicode_AsString(key); - else pyname= ""; + if (key && PyUnicode_Check(key)) pyname= _PyUnicode_AsString(key); + else pyname= ""; /* make a nice string error */ BLI_assert(idtype != NULL); @@ -386,13 +388,13 @@ static int mathutils_rna_vector_get(BaseMathObject *bmo, int subtype) PYRNA_PROP_CHECK_INT(self); - if(self->prop==NULL) + if (self->prop==NULL) return -1; RNA_property_float_get_array(&self->ptr, self->prop, bmo->data); /* Euler order exception */ - if(subtype==MATHUTILS_CB_SUBTYPE_EUL) { + if (subtype==MATHUTILS_CB_SUBTYPE_EUL) { EulerObject *eul= (EulerObject *)bmo; PropertyRNA *prop_eul_order= NULL; eul->order= pyrna_rotation_euler_order_get(&self->ptr, &prop_eul_order, eul->order); @@ -408,11 +410,11 @@ static int mathutils_rna_vector_set(BaseMathObject *bmo, int subtype) PYRNA_PROP_CHECK_INT(self); - if(self->prop==NULL) + if (self->prop==NULL) return -1; #ifdef USE_PEDANTIC_WRITE - if(rna_disallow_writes && rna_id_write_error(&self->ptr, NULL)) { + if (rna_disallow_writes && rna_id_write_error(&self->ptr, NULL)) { return -1; } #endif // USE_PEDANTIC_WRITE @@ -426,26 +428,26 @@ static int mathutils_rna_vector_set(BaseMathObject *bmo, int subtype) RNA_property_float_range(&self->ptr, self->prop, &min, &max); - if(min != FLT_MIN || max != FLT_MAX) { + if (min != FLT_MIN || max != FLT_MAX) { int i, len= RNA_property_array_length(&self->ptr, self->prop); - for(i=0; idata[i], min, max); } } RNA_property_float_set_array(&self->ptr, self->prop, bmo->data); - if(RNA_property_update_check(self->prop)) { + if (RNA_property_update_check(self->prop)) { RNA_property_update(BPy_GetContext(), &self->ptr, self->prop); } /* Euler order exception */ - if(subtype==MATHUTILS_CB_SUBTYPE_EUL) { + if (subtype==MATHUTILS_CB_SUBTYPE_EUL) { EulerObject *eul= (EulerObject *)bmo; PropertyRNA *prop_eul_order= NULL; short order= pyrna_rotation_euler_order_get(&self->ptr, &prop_eul_order, eul->order); - if(order != eul->order) { + if (order != eul->order) { RNA_property_enum_set(&self->ptr, prop_eul_order, eul->order); - if(RNA_property_update_check(prop_eul_order)) { + if (RNA_property_update_check(prop_eul_order)) { RNA_property_update(BPy_GetContext(), &self->ptr, prop_eul_order); } } @@ -459,7 +461,7 @@ static int mathutils_rna_vector_get_index(BaseMathObject *bmo, int UNUSED(subtyp PYRNA_PROP_CHECK_INT(self); - if(self->prop==NULL) + if (self->prop==NULL) return -1; bmo->data[index]= RNA_property_float_get_index(&self->ptr, self->prop, index); @@ -472,11 +474,11 @@ static int mathutils_rna_vector_set_index(BaseMathObject *bmo, int UNUSED(subtyp PYRNA_PROP_CHECK_INT(self); - if(self->prop==NULL) + if (self->prop==NULL) return -1; #ifdef USE_PEDANTIC_WRITE - if(rna_disallow_writes && rna_id_write_error(&self->ptr, NULL)) { + if (rna_disallow_writes && rna_id_write_error(&self->ptr, NULL)) { return -1; } #endif // USE_PEDANTIC_WRITE @@ -491,7 +493,7 @@ static int mathutils_rna_vector_set_index(BaseMathObject *bmo, int UNUSED(subtyp RNA_property_float_clamp(&self->ptr, self->prop, &bmo->data[index]); RNA_property_float_set_index(&self->ptr, self->prop, index, bmo->data[index]); - if(RNA_property_update_check(self->prop)) { + if (RNA_property_update_check(self->prop)) { RNA_property_update(BPy_GetContext(), &self->ptr, self->prop); } @@ -516,7 +518,7 @@ static int mathutils_rna_matrix_get(BaseMathObject *bmo, int UNUSED(subtype)) PYRNA_PROP_CHECK_INT(self); - if(self->prop==NULL) + if (self->prop==NULL) return -1; RNA_property_float_get_array(&self->ptr, self->prop, bmo->data); @@ -529,11 +531,11 @@ static int mathutils_rna_matrix_set(BaseMathObject *bmo, int UNUSED(subtype)) PYRNA_PROP_CHECK_INT(self); - if(self->prop==NULL) + if (self->prop==NULL) return -1; #ifdef USE_PEDANTIC_WRITE - if(rna_disallow_writes && rna_id_write_error(&self->ptr, NULL)) { + if (rna_disallow_writes && rna_id_write_error(&self->ptr, NULL)) { return -1; } #endif // USE_PEDANTIC_WRITE @@ -548,7 +550,7 @@ static int mathutils_rna_matrix_set(BaseMathObject *bmo, int UNUSED(subtype)) /* can ignore clamping here */ RNA_property_float_set_array(&self->ptr, self->prop, bmo->data); - if(RNA_property_update_check(self->prop)) { + if (RNA_property_update_check(self->prop)) { RNA_property_update(BPy_GetContext(), &self->ptr, self->prop); } return 0; @@ -565,10 +567,10 @@ static Mathutils_Callback mathutils_rna_matrix_cb= { static short pyrna_rotation_euler_order_get(PointerRNA *ptr, PropertyRNA **prop_eul_order, short order_fallback) { /* attempt to get order */ - if(*prop_eul_order==NULL) + if (*prop_eul_order==NULL) *prop_eul_order= RNA_struct_find_property(ptr, "rotation_mode"); - if(*prop_eul_order) { + if (*prop_eul_order) { short order= RNA_property_enum_get(ptr, *prop_eul_order); if (order >= EULER_ORDER_XYZ && order <= EULER_ORDER_ZYX) /* could be quat or axisangle */ return order; @@ -604,13 +606,13 @@ PyObject *pyrna_math_object_from_array(PointerRNA *ptr, PropertyRNA *prop) is_thick= (flag & PROP_THICK_WRAP); if (totdim == 1 || (totdim == 2 && subtype == PROP_MATRIX)) { - if(!is_thick) + if (!is_thick) ret= pyrna_prop_CreatePyObject(ptr, prop); /* owned by the mathutils PyObject */ switch(RNA_property_subtype(prop)) { case PROP_ALL_VECTOR_SUBTYPES: - if(len>=2 && len <= 4) { - if(is_thick) { + if (len>=2 && len <= 4) { + if (is_thick) { ret= newVectorObject(NULL, len, Py_NEW, NULL); RNA_property_float_get_array(ptr, prop, ((VectorObject *)ret)->vec); } @@ -622,8 +624,8 @@ PyObject *pyrna_math_object_from_array(PointerRNA *ptr, PropertyRNA *prop) } break; case PROP_MATRIX: - if(len==16) { - if(is_thick) { + if (len==16) { + if (is_thick) { ret= newMatrixObject(NULL, 4, 4, Py_NEW, NULL); RNA_property_float_get_array(ptr, prop, ((MatrixObject *)ret)->contigPtr); } @@ -634,7 +636,7 @@ PyObject *pyrna_math_object_from_array(PointerRNA *ptr, PropertyRNA *prop) } } else if (len==9) { - if(is_thick) { + if (is_thick) { ret= newMatrixObject(NULL, 3, 3, Py_NEW, NULL); RNA_property_float_get_array(ptr, prop, ((MatrixObject *)ret)->contigPtr); } @@ -647,8 +649,8 @@ PyObject *pyrna_math_object_from_array(PointerRNA *ptr, PropertyRNA *prop) break; case PROP_EULER: case PROP_QUATERNION: - if(len==3) { /* euler */ - if(is_thick) { + if (len==3) { /* euler */ + if (is_thick) { /* attempt to get order, only needed for thick types since wrapped with update via callbacks */ PropertyRNA *prop_eul_order= NULL; short order= pyrna_rotation_euler_order_get(ptr, &prop_eul_order, EULER_ORDER_XYZ); @@ -664,7 +666,7 @@ PyObject *pyrna_math_object_from_array(PointerRNA *ptr, PropertyRNA *prop) } } else if (len==4) { - if(is_thick) { + if (is_thick) { ret= newQuaternionObject(NULL, Py_NEW, NULL); RNA_property_float_get_array(ptr, prop, ((QuaternionObject *)ret)->quat); } @@ -677,8 +679,8 @@ PyObject *pyrna_math_object_from_array(PointerRNA *ptr, PropertyRNA *prop) break; case PROP_COLOR: case PROP_COLOR_GAMMA: - if(len==3) { /* color */ - if(is_thick) { + if (len==3) { /* color */ + if (is_thick) { ret= newColorObject(NULL, Py_NEW, NULL); // TODO, get order from RNA RNA_property_float_get_array(ptr, prop, ((ColorObject *)ret)->col); } @@ -693,8 +695,8 @@ PyObject *pyrna_math_object_from_array(PointerRNA *ptr, PropertyRNA *prop) } } - if(ret==NULL) { - if(is_thick) { + if (ret==NULL) { + if (is_thick) { /* this is an array we cant reference (since its not thin wrappable) * and cannot be coerced into a mathutils type, so return as a list */ ret= pyrna_prop_array_subscript_slice(NULL, ptr, prop, 0, len, len); @@ -714,7 +716,7 @@ PyObject *pyrna_math_object_from_array(PointerRNA *ptr, PropertyRNA *prop) /* same as RNA_enum_value_from_id but raises an exception */ int pyrna_enum_value_from_id(EnumPropertyItem *item, const char *identifier, int *value, const char *error_prefix) { - if(RNA_enum_value_from_id(item, identifier, value) == 0) { + if (RNA_enum_value_from_id(item, identifier, value) == 0) { const char *enum_str= BPy_enum_as_string(item); PyErr_Format(PyExc_TypeError, "%s: '%.200s' not found in (%s)", @@ -800,14 +802,14 @@ static PyObject *pyrna_struct_str(BPy_StructRNA *self) PyObject *ret; const char *name; - if(!PYRNA_STRUCT_IS_VALID(self)) { + if (!PYRNA_STRUCT_IS_VALID(self)) { return PyUnicode_FromFormat("", Py_TYPE(self)->tp_name); } /* print name if available */ name= RNA_struct_name_get_alloc(&self->ptr, NULL, FALSE); - if(name) { + if (name) { ret= PyUnicode_FromFormat("", RNA_struct_identifier(self->ptr.type), name); @@ -826,12 +828,12 @@ static PyObject *pyrna_struct_repr(BPy_StructRNA *self) PyObject *tmp_str; PyObject *ret; - if(id == NULL || !PYRNA_STRUCT_IS_VALID(self)) + if (id == NULL || !PYRNA_STRUCT_IS_VALID(self)) return pyrna_struct_str(self); /* fallback */ tmp_str= PyUnicode_FromString(id->name+2); - if(RNA_struct_is_ID(self->ptr.type)) { + if (RNA_struct_is_ID(self->ptr.type)) { ret= PyUnicode_FromFormat("bpy.data.%s[%R]", BKE_idcode_to_name_plural(GS(id->name)), tmp_str); @@ -839,7 +841,7 @@ static PyObject *pyrna_struct_repr(BPy_StructRNA *self) else { const char *path; path= RNA_path_from_ID_to_struct(&self->ptr); - if(path) { + if (path) { ret= PyUnicode_FromFormat("bpy.data.%s[%R].%s", BKE_idcode_to_name_plural(GS(id->name)), tmp_str, @@ -872,7 +874,7 @@ static PyObject *pyrna_prop_str(BPy_PropertyRNA *self) type= RNA_property_type(self->prop); - if(RNA_enum_id_from_value(property_type_items, type, &type_id)==0) { + if (RNA_enum_id_from_value(property_type_items, type, &type_id)==0) { PyErr_SetString(PyExc_RuntimeError, "could not use property type, internal error"); /* should never happen */ return NULL; } @@ -883,23 +885,23 @@ static PyObject *pyrna_prop_str(BPy_PropertyRNA *self) while ((*c++= tolower(*type_id++))) {} ; - if(type==PROP_COLLECTION) { + if (type==PROP_COLLECTION) { len= pyrna_prop_collection_length(self); } else if (RNA_property_array_check(self->prop)) { len= pyrna_prop_array_length((BPy_PropertyArrayRNA *)self); } - if(len != -1) + if (len != -1) sprintf(--c, "[%d]", len); } /* if a pointer, try to print name of pointer target too */ - if(RNA_property_type(self->prop) == PROP_POINTER) { + if (RNA_property_type(self->prop) == PROP_POINTER) { ptr= RNA_property_pointer_get(&self->ptr, self->prop); name= RNA_struct_name_get_alloc(&ptr, NULL, FALSE); - if(name) { + if (name) { ret= PyUnicode_FromFormat("", type_fmt, RNA_struct_identifier(self->ptr.type), @@ -909,9 +911,9 @@ static PyObject *pyrna_prop_str(BPy_PropertyRNA *self) return ret; } } - if(RNA_property_type(self->prop) == PROP_COLLECTION) { + if (RNA_property_type(self->prop) == PROP_COLLECTION) { PointerRNA r_ptr; - if(RNA_property_collection_type_get(&self->ptr, self->prop, &r_ptr)) { + if (RNA_property_collection_type_get(&self->ptr, self->prop, &r_ptr)) { return PyUnicode_FromFormat("", type_fmt, RNA_struct_identifier(r_ptr.type)); @@ -933,13 +935,13 @@ static PyObject *pyrna_prop_repr(BPy_PropertyRNA *self) PYRNA_PROP_CHECK_OBJ(self); - if(id == NULL) + if (id == NULL) return pyrna_prop_str(self); /* fallback */ tmp_str= PyUnicode_FromString(id->name+2); path= RNA_path_from_ID_to_property(&self->ptr, self->prop); - if(path) { + if (path) { ret= PyUnicode_FromFormat("bpy.data.%s[%R].%s", BKE_idcode_to_name_plural(GS(id->name)), tmp_str, @@ -1025,7 +1027,7 @@ static void pyrna_struct_dealloc(BPy_StructRNA *self) #endif #ifdef USE_PYRNA_STRUCT_REFERENCE - if(self->reference) { + if (self->reference) { PyObject_GC_UnTrack(self); pyrna_struct_clear(self); } @@ -1038,13 +1040,13 @@ static void pyrna_struct_dealloc(BPy_StructRNA *self) #ifdef USE_PYRNA_STRUCT_REFERENCE static void pyrna_struct_reference_set(BPy_StructRNA *self, PyObject *reference) { - if(self->reference) { + if (self->reference) { // PyObject_GC_UnTrack(self); /* INITIALIZED TRACKED? */ pyrna_struct_clear(self); } /* reference is now NULL */ - if(reference) { + if (reference) { self->reference= reference; Py_INCREF(reference); // PyObject_GC_Track(self); /* INITIALIZED TRACKED? */ @@ -1082,14 +1084,14 @@ static const char *pyrna_enum_as_string(PointerRNA *ptr, PropertyRNA *prop) int free= FALSE; RNA_property_enum_items(BPy_GetContext(), ptr, prop, &item, NULL, &free); - if(item) { + if (item) { result= BPy_enum_as_string(item); } else { result= ""; } - if(free) + if (free) MEM_freeN(item); return result; @@ -1142,14 +1144,14 @@ int pyrna_set_to_enum_bitfield(EnumPropertyItem *items, PyObject *value, int *r_ while (_PySet_NextEntry(value, &pos, &key, &hash)) { const char *param= _PyUnicode_AsString(key); - if(param==NULL) { + if (param==NULL) { PyErr_Format(PyExc_TypeError, "%.200s expected a string, not %.200s", error_prefix, Py_TYPE(key)->tp_name); return -1; } - if(pyrna_enum_value_from_id(items, param, &ret, error_prefix) < 0) { + if (pyrna_enum_value_from_id(items, param, &ret, error_prefix) < 0) { return -1; } @@ -1178,11 +1180,11 @@ static int pyrna_prop_to_enum_bitfield(PointerRNA *ptr, PropertyRNA *prop, PyObj RNA_property_enum_items(BPy_GetContext(), ptr, prop, &item, NULL, &free); - if(item) { + if (item) { ret= pyrna_set_to_enum_bitfield(item, value, r_value, error_prefix); } else { - if(PySet_GET_SIZE(value)) { + if (PySet_GET_SIZE(value)) { PyErr_Format(PyExc_TypeError, "%.200s: empty enum \"%.200s\" could not have any values assigned", error_prefix, RNA_property_identifier(prop)); @@ -1193,7 +1195,7 @@ static int pyrna_prop_to_enum_bitfield(PointerRNA *ptr, PropertyRNA *prop, PyObj } } - if(free) + if (free) MEM_freeN(item); return ret; @@ -1204,10 +1206,10 @@ PyObject *pyrna_enum_bitfield_to_py(EnumPropertyItem *items, int value) PyObject *ret= PySet_New(NULL); const char *identifier[RNA_ENUM_BITFLAG_SIZE + 1]; - if(RNA_enum_bitflag_identifiers(items, value, identifier)) { + if (RNA_enum_bitflag_identifiers(items, value, identifier)) { PyObject *item; int index; - for(index=0; identifier[index]; index++) { + for (index=0; identifier[index]; index++) { item= PyUnicode_FromString(identifier[index]); PySet_Add(ret, item); Py_DECREF(item); @@ -1221,7 +1223,7 @@ static PyObject *pyrna_enum_to_py(PointerRNA *ptr, PropertyRNA *prop, int val) { PyObject *item, *ret= NULL; - if(RNA_property_flag(prop) & PROP_ENUM_FLAG) { + if (RNA_property_flag(prop) & PROP_ENUM_FLAG) { const char *identifier[RNA_ENUM_BITFLAG_SIZE + 1]; ret= PySet_New(NULL); @@ -1229,7 +1231,7 @@ static PyObject *pyrna_enum_to_py(PointerRNA *ptr, PropertyRNA *prop, int val) if (RNA_property_enum_bitflag_identifiers(BPy_GetContext(), ptr, prop, val, identifier)) { int index; - for(index=0; identifier[index]; index++) { + for (index=0; identifier[index]; index++) { item= PyUnicode_FromString(identifier[index]); PySet_Add(ret, item); Py_DECREF(item); @@ -1249,7 +1251,7 @@ static PyObject *pyrna_enum_to_py(PointerRNA *ptr, PropertyRNA *prop, int val) /* don't throw error here, can't trust blender 100% to give the * right values, python code should not generate error for that */ RNA_property_enum_items(BPy_GetContext(), ptr, prop, &enum_item, NULL, &free); - if(enum_item && enum_item->identifier) { + if (enum_item && enum_item->identifier) { ret= PyUnicode_FromString(enum_item->identifier); } else { @@ -1264,13 +1266,13 @@ static PyObject *pyrna_enum_to_py(PointerRNA *ptr, PropertyRNA *prop, int val) PyErr_Warn(PyExc_RuntimeWarning, error_str); #endif - if(ptr_name) + if (ptr_name) MEM_freeN((void *)ptr_name); ret= PyUnicode_FromString(""); } - if(free) + if (free) MEM_freeN(enum_item); /* PyErr_Format(PyExc_AttributeError, @@ -1312,7 +1314,7 @@ PyObject *pyrna_prop_to_py(PointerRNA *ptr, PropertyRNA *prop) buf= RNA_property_string_get_alloc(ptr, prop, buf_fixed, sizeof(buf_fixed)); #ifdef USE_STRING_COERCE /* only file paths get special treatment, they may contain non utf-8 chars */ - if(ELEM3(subtype, PROP_FILEPATH, PROP_DIRPATH, PROP_FILENAME)) { + if (ELEM3(subtype, PROP_FILEPATH, PROP_DIRPATH, PROP_FILENAME)) { ret= PyC_UnicodeFromByte(buf); } else { @@ -1321,7 +1323,7 @@ PyObject *pyrna_prop_to_py(PointerRNA *ptr, PropertyRNA *prop) #else // USE_STRING_COERCE ret= PyUnicode_FromString(buf); #endif // USE_STRING_COERCE - if(buf_fixed != buf) { + if (buf_fixed != buf) { MEM_freeN((void *)buf); } break; @@ -1384,7 +1386,7 @@ int pyrna_pydict_to_props(PointerRNA *ptr, PyObject *kw, int all_args, const cha item= PyDict_GetItemString(kw, arg_name); /* wont set an error */ if (item == NULL) { - if(all_args) { + if (all_args) { PyErr_Format(PyExc_TypeError, "%.200s: keyword \"%.200s\" missing", error_prefix, arg_name ? arg_name : ""); @@ -1439,7 +1441,7 @@ static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyOb if (RNA_property_array_check(prop)) { /* done getting the length */ - if(pyrna_py_to_array(ptr, prop, data, value, error_prefix) == -1) { + if (pyrna_py_to_array(ptr, prop, data, value, error_prefix) == -1) { return -1; } } @@ -1454,12 +1456,12 @@ static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyOb /* prefer not to have an exception here * however so many poll functions return None or a valid Object. * its a hassle to convert these into a bool before returning, */ - if(RNA_property_flag(prop) & PROP_OUTPUT) + if (RNA_property_flag(prop) & PROP_OUTPUT) param= PyObject_IsTrue(value); else param= PyLong_AsLong(value); - if(param < 0) { + if (param < 0) { PyErr_Format(PyExc_TypeError, "%.200s %.200s.%.200s expected True/False or 0/1, not %.200s", error_prefix, RNA_struct_identifier(ptr->type), @@ -1467,8 +1469,8 @@ static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyOb return -1; } else { - if(data) *((int*)data)= param; - else RNA_property_boolean_set(ptr, prop, param); + if (data) *((int*)data)= param; + else RNA_property_boolean_set(ptr, prop, param); } break; } @@ -1476,7 +1478,7 @@ static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyOb { int overflow; long param= PyLong_AsLongAndOverflow(value, &overflow); - if(overflow || (param > INT_MAX) || (param < INT_MIN)) { + if (overflow || (param > INT_MAX) || (param < INT_MIN)) { PyErr_Format(PyExc_ValueError, "%.200s %.200s.%.200s value not in 'int' range " "(" STRINGIFY(INT_MIN) ", " STRINGIFY(INT_MAX) ")", @@ -1494,8 +1496,8 @@ static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyOb else { int param_i= (int)param; RNA_property_int_clamp(ptr, prop, ¶m_i); - if(data) *((int*)data)= param_i; - else RNA_property_int_set(ptr, prop, param_i); + if (data) *((int*)data)= param_i; + else RNA_property_int_set(ptr, prop, param_i); } break; } @@ -1511,8 +1513,8 @@ static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyOb } else { RNA_property_float_clamp(ptr, prop, (float *)¶m); - if(data) *((float*)data)= param; - else RNA_property_float_set(ptr, prop, param); + if (data) *((float*)data)= param; + else RNA_property_float_set(ptr, prop, param); } break; } @@ -1522,14 +1524,14 @@ static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyOb #ifdef USE_STRING_COERCE PyObject *value_coerce= NULL; int subtype= RNA_property_subtype(prop); - if(ELEM3(subtype, PROP_FILEPATH, PROP_DIRPATH, PROP_FILENAME)) { + if (ELEM3(subtype, PROP_FILEPATH, PROP_DIRPATH, PROP_FILENAME)) { /* TODO, get size */ param= PyC_UnicodeAsByte(value, &value_coerce); } else { param= _PyUnicode_AsString(value); #ifdef WITH_INTERNATIONAL - if(subtype == PROP_TRANSLATE) { + if (subtype == PROP_TRANSLATE) { param= UI_translate_do_iface(param); } #endif // WITH_INTERNATIONAL @@ -1540,7 +1542,7 @@ static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyOb #endif // USE_STRING_COERCE if (param==NULL) { - if(PyUnicode_Check(value)) { + if (PyUnicode_Check(value)) { /* there was an error assigning a string type, * rather than setting a new error, prefix the existing one */ @@ -1559,8 +1561,8 @@ static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyOb return -1; } else { - if(data) *((char**)data)= (char *)param; /*XXX, this is suspect but needed for function calls, need to see if theres a better way */ - else RNA_property_string_set(ptr, prop, param); + if (data) *((char**)data)= (char *)param; /*XXX, this is suspect but needed for function calls, need to see if theres a better way */ + else RNA_property_string_set(ptr, prop, param); } #ifdef USE_STRING_COERCE Py_XDECREF(value_coerce); @@ -1572,9 +1574,9 @@ static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyOb int val= 0; /* type checkins is done by each function */ - if(RNA_property_flag(prop) & PROP_ENUM_FLAG) { + if (RNA_property_flag(prop) & PROP_ENUM_FLAG) { /* set of enum items, concatenate all values with OR */ - if(pyrna_prop_to_enum_bitfield(ptr, prop, value, &val, error_prefix) < 0) { + if (pyrna_prop_to_enum_bitfield(ptr, prop, value, &val, error_prefix) < 0) { return -1; } } @@ -1585,8 +1587,8 @@ static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyOb } } - if(data) *((int*)data)= val; - else RNA_property_enum_set(ptr, prop, val); + if (data) *((int*)data)= val; + else RNA_property_enum_set(ptr, prop, val); break; } @@ -1608,7 +1610,7 @@ static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyOb * this is so bad that its almost a good reason to do away with fake 'self.properties -> self' class mixing * if this causes problems in the future it should be removed. */ - if( (ptr_type == &RNA_AnyType) && + if ((ptr_type == &RNA_AnyType) && (BPy_StructRNA_Check(value)) && (RNA_struct_is_a(((BPy_StructRNA *)value)->ptr.type, &RNA_Operator)) ) { @@ -1624,10 +1626,10 @@ static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyOb } /* another exception, allow to pass a collection as an RNA property */ - if(Py_TYPE(value)==&pyrna_prop_collection_Type) { /* ok to ignore idprop collections */ + if (Py_TYPE(value)==&pyrna_prop_collection_Type) { /* ok to ignore idprop collections */ PointerRNA c_ptr; BPy_PropertyRNA *value_prop= (BPy_PropertyRNA *)value; - if(RNA_property_collection_type_get(&value_prop->ptr, value_prop->prop, &c_ptr)) { + if (RNA_property_collection_type_get(&value_prop->ptr, value_prop->prop, &c_ptr)) { value= pyrna_struct_CreatePyObject(&c_ptr); value_new= value; } @@ -1641,7 +1643,7 @@ static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyOb } } - if(!BPy_StructRNA_Check(value) && value != Py_None) { + if (!BPy_StructRNA_Check(value) && value != Py_None) { PyErr_Format(PyExc_TypeError, "%.200s %.200s.%.200s expected a %.200s type, not %.200s", error_prefix, RNA_struct_identifier(ptr->type), @@ -1649,14 +1651,14 @@ static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyOb Py_TYPE(value)->tp_name); Py_XDECREF(value_new); return -1; } - else if((flag & PROP_NEVER_NULL) && value == Py_None) { + else if ((flag & PROP_NEVER_NULL) && value == Py_None) { PyErr_Format(PyExc_TypeError, "%.200s %.200s.%.200s does not support a 'None' assignment %.200s type", error_prefix, RNA_struct_identifier(ptr->type), RNA_property_identifier(prop), RNA_struct_identifier(ptr_type)); Py_XDECREF(value_new); return -1; } - else if(value != Py_None && ((flag & PROP_ID_SELF_CHECK) && ptr->id.data == ((BPy_StructRNA*)value)->ptr.id.data)) { + else if (value != Py_None && ((flag & PROP_ID_SELF_CHECK) && ptr->id.data == ((BPy_StructRNA*)value)->ptr.id.data)) { PyErr_Format(PyExc_TypeError, "%.200s %.200s.%.200s ID type does not support assignment to its self", error_prefix, RNA_struct_identifier(ptr->type), @@ -1666,18 +1668,18 @@ static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyOb else { BPy_StructRNA *param= (BPy_StructRNA*)value; int raise_error= FALSE; - if(data) { + if (data) { - if(flag & PROP_RNAPTR) { - if(value == Py_None) + if (flag & PROP_RNAPTR) { + if (value == Py_None) memset(data, 0, sizeof(PointerRNA)); else *((PointerRNA*)data)= param->ptr; } - else if(value == Py_None) { + else if (value == Py_None) { *((void**)data)= NULL; } - else if(RNA_struct_is_a(param->ptr.type, ptr_type)) { + else if (RNA_struct_is_a(param->ptr.type, ptr_type)) { *((void**)data)= param->ptr.data; } else { @@ -1686,11 +1688,11 @@ static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyOb } else { /* data==NULL, assign to RNA */ - if(value == Py_None) { + if (value == Py_None) { PointerRNA valueptr= {{NULL}}; RNA_property_pointer_set(ptr, prop, valueptr); } - else if(RNA_struct_is_a(param->ptr.type, ptr_type)) { + else if (RNA_struct_is_a(param->ptr.type, ptr_type)) { RNA_property_pointer_set(ptr, prop, param->ptr); } else { @@ -1705,7 +1707,7 @@ static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyOb } } - if(raise_error) { + if (raise_error) { PointerRNA tmp; RNA_pointer_create(NULL, ptr_type, NULL, &tmp); PyErr_Format(PyExc_TypeError, @@ -1732,7 +1734,7 @@ static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyOb lb= (data)? (ListBase*)data: NULL; /* convert a sequence of dict's into a collection */ - if(!PySequence_Check(value)) { + if (!PySequence_Check(value)) { PyErr_Format(PyExc_TypeError, "%.200s %.200s.%.200s expected a sequence for an RNA collection, not %.200s", error_prefix, RNA_struct_identifier(ptr->type), @@ -1741,10 +1743,10 @@ static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyOb } seq_len= PySequence_Size(value); - for(i=0; i < seq_len; i++) { + for (i=0; i < seq_len; i++) { item= PySequence_GetItem(value, i); - if(item==NULL) { + if (item==NULL) { PyErr_Format(PyExc_TypeError, "%.200s %.200s.%.200s failed to get sequence index '%d' for an RNA collection", error_prefix, RNA_struct_identifier(ptr->type), @@ -1753,7 +1755,7 @@ static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyOb return -1; } - if(PyDict_Check(item)==0) { + if (PyDict_Check(item)==0) { PyErr_Format(PyExc_TypeError, "%.200s %.200s.%.200s expected a each sequence " "member to be a dict for an RNA collection, not %.200s", @@ -1763,7 +1765,7 @@ static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyOb return -1; } - if(lb) { + if (lb) { link= MEM_callocN(sizeof(CollectionPointerLink), "PyCollectionPointerLink"); link->ptr= itemptr; BLI_addtail(lb, link); @@ -1771,7 +1773,7 @@ static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyOb else RNA_property_collection_add(ptr, prop, &itemptr); - if(pyrna_pydict_to_props(&itemptr, item, 1, "Converting a python list to an RNA collection")==-1) { + if (pyrna_pydict_to_props(&itemptr, item, 1, "Converting a python list to an RNA collection")==-1) { PyObject *msg= PyC_ExceptionBuffer(); const char *msg_char= _PyUnicode_AsString(msg); @@ -1801,7 +1803,7 @@ static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyOb } /* Run rna property functions */ - if(RNA_property_update_check(prop)) { + if (RNA_property_update_check(prop)) { RNA_property_update(BPy_GetContext(), ptr, prop); } @@ -1836,7 +1838,7 @@ static int pyrna_py_to_prop_array_index(BPy_PropertyArrayRNA *self, int index, P { int param= PyLong_AsLong(value); - if(param < 0 || param > 1) { + if (param < 0 || param > 1) { PyErr_SetString(PyExc_TypeError, "expected True/False or 0/1"); ret= -1; } @@ -1879,7 +1881,7 @@ static int pyrna_py_to_prop_array_index(BPy_PropertyArrayRNA *self, int index, P } /* Run rna property functions */ - if(RNA_property_update_check(prop)) { + if (RNA_property_update_check(prop)) { RNA_property_update(BPy_GetContext(), ptr, prop); } @@ -1932,9 +1934,9 @@ static int pyrna_prop_collection_bool(BPy_PropertyRNA *self) * index is used or to detect internal error with a valid index. * This is done for faster lookups. */ #define PYRNA_PROP_COLLECTION_ABS_INDEX(ret_err) \ - if(keynum < 0) { \ + if (keynum < 0) { \ keynum_abs += RNA_property_collection_length(&self->ptr, self->prop); \ - if(keynum_abs < 0) { \ + if (keynum_abs < 0) { \ PyErr_Format(PyExc_IndexError, \ "bpy_prop_collection[%d]: out of range.", keynum); \ return ret_err; \ @@ -1952,12 +1954,12 @@ static PyObject *pyrna_prop_collection_subscript_int(BPy_PropertyRNA *self, Py_s PYRNA_PROP_COLLECTION_ABS_INDEX(NULL); - if(RNA_property_collection_lookup_int(&self->ptr, self->prop, keynum_abs, &newptr)) { + if (RNA_property_collection_lookup_int(&self->ptr, self->prop, keynum_abs, &newptr)) { return pyrna_struct_CreatePyObject(&newptr); } else { const int len= RNA_property_collection_length(&self->ptr, self->prop); - if(keynum_abs >= len) { + if (keynum_abs >= len) { PyErr_Format(PyExc_IndexError, "bpy_prop_collection[index]: " "index %d out of range, size %d", keynum, len); @@ -1983,9 +1985,9 @@ static int pyrna_prop_collection_ass_subscript_int(BPy_PropertyRNA *self, Py_ssi PYRNA_PROP_COLLECTION_ABS_INDEX(-1); - if(RNA_property_collection_assign_int(&self->ptr, self->prop, keynum_abs, ptr) == 0) { + if (RNA_property_collection_assign_int(&self->ptr, self->prop, keynum_abs, ptr) == 0) { const int len= RNA_property_collection_length(&self->ptr, self->prop); - if(keynum_abs >= len) { + if (keynum_abs >= len) { PyErr_Format(PyExc_IndexError, "bpy_prop_collection[index] = value: " "index %d out of range, size %d", keynum, len); @@ -2010,9 +2012,9 @@ static PyObject *pyrna_prop_array_subscript_int(BPy_PropertyArrayRNA *self, int len= pyrna_prop_array_length(self); - if(keynum < 0) keynum += len; + if (keynum < 0) keynum += len; - if(keynum >= 0 && keynum < len) + if (keynum >= 0 && keynum < len) return pyrna_prop_array_to_py_index(self, keynum); PyErr_Format(PyExc_IndexError, "bpy_prop_array[index]: index %d out of range", keynum); @@ -2025,7 +2027,7 @@ static PyObject *pyrna_prop_collection_subscript_str(BPy_PropertyRNA *self, cons PYRNA_PROP_CHECK_OBJ(self); - if(RNA_property_collection_lookup_string(&self->ptr, self->prop, keyname, &newptr)) + if (RNA_property_collection_lookup_string(&self->ptr, self->prop, keyname, &newptr)) return pyrna_struct_CreatePyObject(&newptr); PyErr_Format(PyExc_KeyError, "bpy_prop_collection[key]: key \"%.200s\" not found", keyname); @@ -2046,22 +2048,22 @@ static PyObject *pyrna_prop_collection_subscript_slice(BPy_PropertyRNA *self, Py list= PyList_New(0); /* first loop up-until the start */ - for(RNA_property_collection_begin(&self->ptr, self->prop, &rna_macro_iter); rna_macro_iter.valid; RNA_property_collection_next(&rna_macro_iter)) { + for (RNA_property_collection_begin(&self->ptr, self->prop, &rna_macro_iter); rna_macro_iter.valid; RNA_property_collection_next(&rna_macro_iter)) { /* PointerRNA itemptr= rna_macro_iter.ptr; */ - if(count == start) { + if (count == start) { break; } count++; } /* add items until stop */ - for(; rna_macro_iter.valid; RNA_property_collection_next(&rna_macro_iter)) { + for (; rna_macro_iter.valid; RNA_property_collection_next(&rna_macro_iter)) { item= pyrna_struct_CreatePyObject(&rna_macro_iter.ptr); PyList_Append(list, item); Py_DECREF(item); count++; - if(count == stop) { + if (count == stop) { break; } } @@ -2098,14 +2100,14 @@ static PyObject *pyrna_prop_array_subscript_slice(BPy_PropertyArrayRNA *self, Po { float values_stack[PYRNA_STACK_ARRAY]; float *values; - if(length > PYRNA_STACK_ARRAY) { values= PyMem_MALLOC(sizeof(float) * length); } - else { values= values_stack; } + if (length > PYRNA_STACK_ARRAY) { values= PyMem_MALLOC(sizeof(float) * length); } + else { values= values_stack; } RNA_property_float_get_array(ptr, prop, values); - for(count=start; count PYRNA_STACK_ARRAY) { values= PyMem_MALLOC(sizeof(int) * length); } - else { values= values_stack; } + if (length > PYRNA_STACK_ARRAY) { values= PyMem_MALLOC(sizeof(int) * length); } + else { values= values_stack; } RNA_property_boolean_get_array(ptr, prop, values); - for(count=start; count PYRNA_STACK_ARRAY) { values= PyMem_MALLOC(sizeof(int) * length); } - else { values= values_stack; } + if (length > PYRNA_STACK_ARRAY) { values= PyMem_MALLOC(sizeof(int) * length); } + else { values= values_stack; } RNA_property_int_get_array(ptr, prop, values); - for(count=start; countstep != Py_None && !_PyEval_SliceIndex(key, &step)) { + if (key_slice->step != Py_None && !_PyEval_SliceIndex(key, &step)) { return NULL; } else if (step != 1) { PyErr_SetString(PyExc_TypeError, "bpy_prop_collection[slice]: slice steps not supported"); return NULL; } - else if(key_slice->start == Py_None && key_slice->stop == Py_None) { + else if (key_slice->start == Py_None && key_slice->stop == Py_None) { return pyrna_prop_collection_subscript_slice(self, 0, PY_SSIZE_T_MAX); } else { Py_ssize_t start= 0, stop= PY_SSIZE_T_MAX; /* avoid PySlice_GetIndicesEx because it needs to know the length ahead of time. */ - if(key_slice->start != Py_None && !_PyEval_SliceIndex(key_slice->start, &start)) return NULL; - if(key_slice->stop != Py_None && !_PyEval_SliceIndex(key_slice->stop, &stop)) return NULL; + if (key_slice->start != Py_None && !_PyEval_SliceIndex(key_slice->start, &start)) return NULL; + if (key_slice->stop != Py_None && !_PyEval_SliceIndex(key_slice->stop, &stop)) return NULL; - if(start < 0 || stop < 0) { + if (start < 0 || stop < 0) { /* only get the length for negative values */ Py_ssize_t len= (Py_ssize_t)RNA_property_collection_length(&self->ptr, self->prop); - if(start < 0) start += len; - if(stop < 0) start += len; + if (start < 0) start += len; + if (stop < 0) start += len; } if (stop - start <= 0) { @@ -2218,11 +2220,11 @@ static int pyrna_prop_collection_type_check(BPy_PropertyRNA *self, PyObject *val { StructRNA *prop_srna; - if(value == Py_None) { + if (value == Py_None) { if (RNA_property_flag(self->prop) & PROP_NEVER_NULL) { PyErr_Format(PyExc_TypeError, - "bpy_prop_collection[key] = value: invalid, " - "this collection doesnt support None assignment"); + "bpy_prop_collection[key] = value: invalid, " + "this collection doesnt support None assignment"); return -1; } else { @@ -2236,7 +2238,7 @@ static int pyrna_prop_collection_type_check(BPy_PropertyRNA *self, PyObject *val Py_TYPE(value)->tp_name); return -1; } - else if((prop_srna= RNA_property_pointer_type(&self->ptr, self->prop))) { + else if ((prop_srna= RNA_property_pointer_type(&self->ptr, self->prop))) { StructRNA *value_srna= ((BPy_StructRNA *)value)->ptr.type; if (RNA_struct_is_a(value_srna, prop_srna) == 0) { PyErr_Format(PyExc_TypeError, @@ -2265,7 +2267,7 @@ static int pyrna_prop_collection_ass_subscript(BPy_PropertyRNA *self, PyObject * PYRNA_PROP_CHECK_INT(self); /* validate the assigned value */ - if(value == NULL) { + if (value == NULL) { PyErr_SetString(PyExc_TypeError, "del bpy_prop_collection[key]: not supported"); return -1; @@ -2292,28 +2294,28 @@ static int pyrna_prop_collection_ass_subscript(BPy_PropertyRNA *self, PyObject * PySliceObject *key_slice= (PySliceObject *)key; Py_ssize_t step= 1; - if(key_slice->step != Py_None && !_PyEval_SliceIndex(key, &step)) { + if (key_slice->step != Py_None && !_PyEval_SliceIndex(key, &step)) { return NULL; } else if (step != 1) { PyErr_SetString(PyExc_TypeError, "bpy_prop_collection[slice]: slice steps not supported"); return NULL; } - else if(key_slice->start == Py_None && key_slice->stop == Py_None) { + else if (key_slice->start == Py_None && key_slice->stop == Py_None) { return pyrna_prop_collection_subscript_slice(self, 0, PY_SSIZE_T_MAX); } else { Py_ssize_t start= 0, stop= PY_SSIZE_T_MAX; /* avoid PySlice_GetIndicesEx because it needs to know the length ahead of time. */ - if(key_slice->start != Py_None && !_PyEval_SliceIndex(key_slice->start, &start)) return NULL; - if(key_slice->stop != Py_None && !_PyEval_SliceIndex(key_slice->stop, &stop)) return NULL; + if (key_slice->start != Py_None && !_PyEval_SliceIndex(key_slice->start, &start)) return NULL; + if (key_slice->stop != Py_None && !_PyEval_SliceIndex(key_slice->stop, &stop)) return NULL; - if(start < 0 || stop < 0) { + if (start < 0 || stop < 0) { /* only get the length for negative values */ Py_ssize_t len= (Py_ssize_t)RNA_property_collection_length(&self->ptr, self->prop); - if(start < 0) start += len; - if(stop < 0) start += len; + if (start < 0) start += len; + if (stop < 0) start += len; } if (stop - start <= 0) { @@ -2352,14 +2354,14 @@ static PyObject *pyrna_prop_array_subscript(BPy_PropertyArrayRNA *self, PyObject Py_ssize_t step= 1; PySliceObject *key_slice= (PySliceObject *)key; - if(key_slice->step != Py_None && !_PyEval_SliceIndex(key, &step)) { + if (key_slice->step != Py_None && !_PyEval_SliceIndex(key, &step)) { return NULL; } else if (step != 1) { PyErr_SetString(PyExc_TypeError, "bpy_prop_array[slice]: slice steps not supported"); return NULL; } - else if(key_slice->start == Py_None && key_slice->stop == Py_None) { + else if (key_slice->start == Py_None && key_slice->stop == Py_None) { /* note, no significant advantage with optimizing [:] slice as with collections but include here for consistency with collection slice func */ Py_ssize_t len= (Py_ssize_t)pyrna_prop_array_length(self); return pyrna_prop_array_subscript_slice(self, &self->ptr, self->prop, 0, len, len); @@ -2393,16 +2395,16 @@ static int prop_subscript_ass_array_slice(PointerRNA *ptr, PropertyRNA *prop, in void *values_alloc= NULL; int ret= 0; - if(value_orig == NULL) { + if (value_orig == NULL) { PyErr_SetString(PyExc_TypeError, "bpy_prop_array[slice]= value: deleting with list types is not supported by bpy_struct"); return -1; } - if(!(value=PySequence_Fast(value_orig, "bpy_prop_array[slice]= value: assignment is not a sequence type"))) { + if (!(value=PySequence_Fast(value_orig, "bpy_prop_array[slice]= value: assignment is not a sequence type"))) { return -1; } - if(PySequence_Fast_GET_SIZE(value) != stop-start) { + if (PySequence_Fast_GET_SIZE(value) != stop-start) { Py_DECREF(value); PyErr_SetString(PyExc_TypeError, "bpy_prop_array[slice]= value: resizing bpy_struct arrays isn't supported"); return -1; @@ -2417,36 +2419,36 @@ static int prop_subscript_ass_array_slice(PointerRNA *ptr, PropertyRNA *prop, in float min, max; RNA_property_float_range(ptr, prop, &min, &max); - if(length > PYRNA_STACK_ARRAY) { values= values_alloc= PyMem_MALLOC(sizeof(float) * length); } - else { values= values_stack; } - if(start != 0 || stop != length) /* partial assignment? - need to get the array */ + if (length > PYRNA_STACK_ARRAY) { values= values_alloc= PyMem_MALLOC(sizeof(float) * length); } + else { values= values_stack; } + if (start != 0 || stop != length) /* partial assignment? - need to get the array */ RNA_property_float_get_array(ptr, prop, values); - for(count=start; count PYRNA_STACK_ARRAY) { values= values_alloc= PyMem_MALLOC(sizeof(int) * length); } - else { values= values_stack; } + if (length > PYRNA_STACK_ARRAY) { values= values_alloc= PyMem_MALLOC(sizeof(int) * length); } + else { values= values_stack; } - if(start != 0 || stop != length) /* partial assignment? - need to get the array */ + if (start != 0 || stop != length) /* partial assignment? - need to get the array */ RNA_property_boolean_get_array(ptr, prop, values); - for(count=start; count PYRNA_STACK_ARRAY) { values= values_alloc= PyMem_MALLOC(sizeof(int) * length); } - else { values= values_stack; } + if (length > PYRNA_STACK_ARRAY) { values= values_alloc= PyMem_MALLOC(sizeof(int) * length); } + else { values= values_stack; } - if(start != 0 || stop != length) /* partial assignment? - need to get the array */ + if (start != 0 || stop != length) /* partial assignment? - need to get the array */ RNA_property_int_get_array(ptr, prop, values); - for(count=start; count= 0 && keynum < len) + if (keynum >= 0 && keynum < len) return pyrna_py_to_prop_array_index(self, keynum, value); PyErr_SetString(PyExc_IndexError, "bpy_prop_array[index] = value: index out of range"); @@ -2551,8 +2553,8 @@ static int pyrna_prop_array_ass_subscript(BPy_PropertyArrayRNA *self, PyObject * ret= -1; } - if(ret != -1) { - if(RNA_property_update_check(self->prop)) { + if (ret != -1) { + if (RNA_property_update_check(self->prop)) { RNA_property_update(BPy_GetContext(), &self->ptr, self->prop); } } @@ -2611,7 +2613,7 @@ static int pyrna_prop_collection_contains(BPy_PropertyRNA *self, PyObject *value /* key in dict style check */ const char *keyname= _PyUnicode_AsString(value); - if(keyname==NULL) { + if (keyname==NULL) { PyErr_SetString(PyExc_TypeError, "bpy_prop_collection.__contains__: expected a string"); return -1; } @@ -2634,14 +2636,14 @@ static int pyrna_struct_contains(BPy_StructRNA *self, PyObject *value) return -1; } - if(RNA_struct_idprops_check(self->ptr.type)==0) { + if (RNA_struct_idprops_check(self->ptr.type)==0) { PyErr_SetString(PyExc_TypeError, "bpy_struct: this type doesn't support IDProperties"); return -1; } group= RNA_struct_idprops(&self->ptr, 0); - if(!group) + if (!group) return 0; return IDP_GetPropertyFromGroup(group, name) ? 1:0; @@ -2694,26 +2696,26 @@ static PyObject *pyrna_struct_subscript(BPy_StructRNA *self, PyObject *key) PYRNA_STRUCT_CHECK_OBJ(self); - if(RNA_struct_idprops_check(self->ptr.type)==0) { + if (RNA_struct_idprops_check(self->ptr.type)==0) { PyErr_SetString(PyExc_TypeError, "this type doesn't support IDProperties"); return NULL; } - if(name==NULL) { + if (name==NULL) { PyErr_SetString(PyExc_TypeError, "bpy_struct[key]: only strings are allowed as keys of ID properties"); return NULL; } group= RNA_struct_idprops(&self->ptr, 0); - if(group==NULL) { + if (group==NULL) { PyErr_Format(PyExc_KeyError, "bpy_struct[key]: key \"%s\" not found", name); return NULL; } idprop= IDP_GetPropertyFromGroup(group, name); - if(idprop==NULL) { + if (idprop==NULL) { PyErr_Format(PyExc_KeyError, "bpy_struct[key]: key \"%s\" not found", name); return NULL; } @@ -2730,12 +2732,12 @@ static int pyrna_struct_ass_subscript(BPy_StructRNA *self, PyObject *key, PyObje group= RNA_struct_idprops(&self->ptr, 1); #ifdef USE_PEDANTIC_WRITE - if(rna_disallow_writes && rna_id_write_error(&self->ptr, key)) { + if (rna_disallow_writes && rna_id_write_error(&self->ptr, key)) { return -1; } #endif // USE_STRING_COERCE - if(group==NULL) { + if (group==NULL) { PyErr_SetString(PyExc_TypeError, "bpy_struct[key]= val: id properties not supported for this type"); return -1; } @@ -2764,14 +2766,14 @@ static PyObject *pyrna_struct_keys(BPy_PropertyRNA *self) { IDProperty *group; - if(RNA_struct_idprops_check(self->ptr.type)==0) { + if (RNA_struct_idprops_check(self->ptr.type)==0) { PyErr_SetString(PyExc_TypeError, "bpy_struct.keys(): this type doesn't support IDProperties"); return NULL; } group= RNA_struct_idprops(&self->ptr, 0); - if(group==NULL) + if (group==NULL) return PyList_New(0); return BPy_Wrap_GetKeys(group); @@ -2792,14 +2794,14 @@ static PyObject *pyrna_struct_items(BPy_PropertyRNA *self) { IDProperty *group; - if(RNA_struct_idprops_check(self->ptr.type)==0) { + if (RNA_struct_idprops_check(self->ptr.type)==0) { PyErr_SetString(PyExc_TypeError, "bpy_struct.items(): this type doesn't support IDProperties"); return NULL; } group= RNA_struct_idprops(&self->ptr, 0); - if(group==NULL) + if (group==NULL) return PyList_New(0); return BPy_Wrap_GetItems(self->ptr.id.data, group); @@ -2820,14 +2822,14 @@ static PyObject *pyrna_struct_values(BPy_PropertyRNA *self) { IDProperty *group; - if(RNA_struct_idprops_check(self->ptr.type)==0) { + if (RNA_struct_idprops_check(self->ptr.type)==0) { PyErr_SetString(PyExc_TypeError, "bpy_struct.values(): this type doesn't support IDProperties"); return NULL; } group= RNA_struct_idprops(&self->ptr, 0); - if(group==NULL) + if (group==NULL) return PyList_New(0); return BPy_Wrap_GetValues(self->ptr.id.data, group); @@ -2853,7 +2855,7 @@ static PyObject *pyrna_struct_is_property_set(BPy_StructRNA *self, PyObject *arg if (!PyArg_ParseTuple(args, "s:is_property_set", &name)) return NULL; - if((prop= RNA_struct_find_property(&self->ptr, name)) == NULL) { + if ((prop= RNA_struct_find_property(&self->ptr, name)) == NULL) { PyErr_Format(PyExc_TypeError, "%.200s.is_property_set(\"%.200s\") not found", RNA_struct_identifier(self->ptr.type), name); @@ -2862,9 +2864,9 @@ static PyObject *pyrna_struct_is_property_set(BPy_StructRNA *self, PyObject *arg /* double property lookup, could speed up */ /* return PyBool_FromLong(RNA_property_is_set(&self->ptr, name)); */ - if(RNA_property_flag(prop) & PROP_IDPROPERTY) { + if (RNA_property_flag(prop) & PROP_IDPROPERTY) { IDProperty *group= RNA_struct_idprops(&self->ptr, 0); - if(group) { + if (group) { ret= IDP_GetPropertyFromGroup(group, name) ? 1:0; } else { @@ -2896,7 +2898,7 @@ static PyObject *pyrna_struct_is_property_hidden(BPy_StructRNA *self, PyObject * if (!PyArg_ParseTuple(args, "s:is_property_hidden", &name)) return NULL; - if((prop= RNA_struct_find_property(&self->ptr, name)) == NULL) { + if ((prop= RNA_struct_find_property(&self->ptr, name)) == NULL) { PyErr_Format(PyExc_TypeError, "%.200s.is_property_hidden(\"%.200s\") not found", RNA_struct_identifier(self->ptr.type), name); @@ -2931,9 +2933,9 @@ static PyObject *pyrna_struct_path_resolve(BPy_StructRNA *self, PyObject *args) return NULL; if (RNA_path_resolve_full(&self->ptr, path, &r_ptr, &r_prop, &index)) { - if(r_prop) { - if(index != -1) { - if(index >= RNA_property_array_length(&r_ptr, r_prop) || index < 0) { + if (r_prop) { + if (index != -1) { + if (index >= RNA_property_array_length(&r_ptr, r_prop) || index < 0) { PyErr_Format(PyExc_TypeError, "%.200s.path_resolve(\"%.200s\") index out of range", RNA_struct_identifier(self->ptr.type), path); @@ -2944,7 +2946,7 @@ static PyObject *pyrna_struct_path_resolve(BPy_StructRNA *self, PyObject *args) } } else { - if(coerce == Py_False) { + if (coerce == Py_False) { return pyrna_prop_CreatePyObject(&r_ptr, r_prop); } else { @@ -2988,9 +2990,9 @@ static PyObject *pyrna_struct_path_from_id(BPy_StructRNA *self, PyObject *args) if (!PyArg_ParseTuple(args, "|s:path_from_id", &name)) return NULL; - if(name) { + if (name) { prop= RNA_struct_find_property(&self->ptr, name); - if(prop==NULL) { + if (prop==NULL) { PyErr_Format(PyExc_TypeError, "%.200s.path_from_id(\"%.200s\") not found", RNA_struct_identifier(self->ptr.type), name); @@ -3003,8 +3005,8 @@ static PyObject *pyrna_struct_path_from_id(BPy_StructRNA *self, PyObject *args) path= RNA_path_from_ID_to_struct(&self->ptr); } - if(path==NULL) { - if(name) { + if (path==NULL) { + if (name) { PyErr_Format(PyExc_TypeError, "%.200s.path_from_id(\"%s\") found but does not support path creation", RNA_struct_identifier(self->ptr.type), name); @@ -3039,7 +3041,7 @@ static PyObject *pyrna_prop_path_from_id(BPy_PropertyRNA *self) path= RNA_path_from_ID_to_property(&self->ptr, self->prop); - if(path==NULL) { + if (path==NULL) { PyErr_Format(PyExc_TypeError, "%.200s.%.200s.path_from_id() does not support path creation for this type", RNA_struct_identifier(self->ptr.type), RNA_property_identifier(prop)); @@ -3079,14 +3081,14 @@ static void pyrna_dir_members_py(PyObject *list, PyObject *self) dict_ptr= _PyObject_GetDictPtr((PyObject *)self); - if(dict_ptr && (dict=*dict_ptr)) { + if (dict_ptr && (dict=*dict_ptr)) { list_tmp= PyDict_Keys(dict); PyList_SetSlice(list, INT_MAX, INT_MAX, list_tmp); Py_DECREF(list_tmp); } dict= ((PyTypeObject *)Py_TYPE(self))->tp_dict; - if(dict) { + if (dict) { list_tmp= PyDict_Keys(dict); PyList_SetSlice(list, INT_MAX, INT_MAX, list_tmp); Py_DECREF(list_tmp); @@ -3127,13 +3129,14 @@ static void pyrna_dir_members_rna(PyObject *list, PointerRNA *ptr) RNA_PROP_BEGIN(ptr, itemptr, iterprop) { nameptr= RNA_struct_name_get_alloc(&itemptr, name, sizeof(name)); - if(nameptr) { + if (nameptr) { pystring= PyUnicode_FromString(nameptr); PyList_Append(list, pystring); Py_DECREF(pystring); - if(name != nameptr) + if (name != nameptr) { MEM_freeN(nameptr); + } } } RNA_PROP_END; @@ -3158,11 +3161,11 @@ static PyObject *pyrna_struct_dir(BPy_StructRNA *self) pyrna_dir_members_rna(ret, &self->ptr); - if(self->ptr.type == &RNA_Context) { + if (self->ptr.type == &RNA_Context) { ListBase lb= CTX_data_dir_get(self->ptr.data); LinkData *link; - for(link=lb.first; link; link=link->next) { + for (link=lb.first; link; link=link->next) { pystring= PyUnicode_FromString(link->data); PyList_Append(ret, pystring); Py_DECREF(pystring); @@ -3195,13 +3198,13 @@ static PyObject *pyrna_struct_getattro(BPy_StructRNA *self, PyObject *pyname) PYRNA_STRUCT_CHECK_OBJ(self); - if(name == NULL) { + if (name == NULL) { PyErr_SetString(PyExc_AttributeError, "bpy_struct: __getattr__ must be a string"); ret= NULL; } - else if(name[0]=='_') { // rna can't start with a "_", so for __dict__ and similar we can skip using rna lookups + else if (name[0]=='_') { // rna can't start with a "_", so for __dict__ and similar we can skip using rna lookups /* annoying exception, maybe we need to have different types for this... */ - if((strcmp(name, "__getitem__")==0 || strcmp(name, "__setitem__")==0) && !RNA_struct_idprops_check(self->ptr.type)) { + if ((strcmp(name, "__getitem__")==0 || strcmp(name, "__setitem__")==0) && !RNA_struct_idprops_check(self->ptr.type)) { PyErr_SetString(PyExc_AttributeError, "bpy_struct: no __getitem__ support for this type"); ret= NULL; } @@ -3218,7 +3221,7 @@ static PyObject *pyrna_struct_getattro(BPy_StructRNA *self, PyObject *pyname) } else if (self->ptr.type == &RNA_Context) { bContext *C= self->ptr.data; - if(C==NULL) { + if (C==NULL) { PyErr_Format(PyExc_AttributeError, "bpy_struct: Context is 'NULL', can't get \"%.200s\" from context", name); @@ -3231,10 +3234,10 @@ static PyObject *pyrna_struct_getattro(BPy_StructRNA *self, PyObject *pyname) int done= CTX_data_get(C, name, &newptr, &newlb, &newtype); - if(done==1) { /* found */ + if (done==1) { /* found */ switch(newtype) { case CTX_DATA_TYPE_POINTER: - if(newptr.data == NULL) { + if (newptr.data == NULL) { ret= Py_None; Py_INCREF(ret); } @@ -3249,7 +3252,7 @@ static PyObject *pyrna_struct_getattro(BPy_StructRNA *self, PyObject *pyname) ret= PyList_New(0); - for(link=newlb.first; link; link=link->next) { + for (link=newlb.first; link; link=link->next) { linkptr= pyrna_struct_CreatePyObject(&link->ptr); PyList_Append(ret, linkptr); Py_DECREF(linkptr); @@ -3328,11 +3331,11 @@ static PyObject *pyrna_struct_meta_idprop_getattro(PyObject *cls, PyObject *attr * * Disable for now, this is faking internal behavior in a way thats too tricky to maintain well. */ #if 0 - if(ret == NULL) { // || pyrna_is_deferred_prop(ret) + if (ret == NULL) { // || pyrna_is_deferred_prop(ret) StructRNA *srna= srna_from_self(cls, "StructRNA.__getattr__"); - if(srna) { + if (srna) { PropertyRNA *prop= RNA_struct_type_find_property(srna, _PyUnicode_AsString(attr)); - if(prop) { + if (prop) { PointerRNA tptr; PyErr_Clear(); /* clear error from tp_getattro */ RNA_pointer_create(NULL, &RNA_Property, prop, &tptr); @@ -3351,7 +3354,7 @@ static int pyrna_struct_meta_idprop_setattro(PyObject *cls, PyObject *attr, PyOb StructRNA *srna= srna_from_self(cls, "StructRNA.__setattr__"); const int is_deferred_prop= (value && pyrna_is_deferred_prop(value)); - if(srna && !pyrna_write_check() && (is_deferred_prop || RNA_struct_type_find_property(srna, _PyUnicode_AsString(attr)))) { + if (srna && !pyrna_write_check() && (is_deferred_prop || RNA_struct_type_find_property(srna, _PyUnicode_AsString(attr)))) { PyErr_Format(PyExc_AttributeError, "pyrna_struct_meta_idprop_setattro() " "can't set in readonly state '%.200s.%S'", @@ -3359,10 +3362,10 @@ static int pyrna_struct_meta_idprop_setattro(PyObject *cls, PyObject *attr, PyOb return -1; } - if(srna == NULL) { + if (srna == NULL) { /* allow setting on unregistered classes which can be registered later on */ /* - if(value && is_deferred_prop) { + if (value && is_deferred_prop) { PyErr_Format(PyExc_AttributeError, "pyrna_struct_meta_idprop_setattro() unable to get srna from class '%.200s'", ((PyTypeObject *)cls)->tp_name); @@ -3374,11 +3377,11 @@ static int pyrna_struct_meta_idprop_setattro(PyObject *cls, PyObject *attr, PyOb return PyType_Type.tp_setattro(cls, attr, value); } - if(value) { + if (value) { /* check if the value is a property */ - if(is_deferred_prop) { + if (is_deferred_prop) { int ret= deferred_register_prop(srna, attr, value); - if(ret == -1) { + if (ret == -1) { /* error set */ return ret; } @@ -3417,12 +3420,12 @@ static int pyrna_struct_setattro(BPy_StructRNA *self, PyObject *pyname, PyObject PYRNA_STRUCT_CHECK_INT(self); #ifdef USE_PEDANTIC_WRITE - if(rna_disallow_writes && rna_id_write_error(&self->ptr, pyname)) { + if (rna_disallow_writes && rna_id_write_error(&self->ptr, pyname)) { return -1; } #endif // USE_STRING_COERCE - if(name == NULL) { + if (name == NULL) { PyErr_SetString(PyExc_AttributeError, "bpy_struct: __setattr__ must be a string"); return -1; } @@ -3437,7 +3440,7 @@ static int pyrna_struct_setattro(BPy_StructRNA *self, PyObject *pyname, PyObject else if (self->ptr.type == &RNA_Context) { /* code just raises correct error, context prop's cant be set, unless its apart of the py class */ bContext *C= self->ptr.data; - if(C==NULL) { + if (C==NULL) { PyErr_Format(PyExc_AttributeError, "bpy_struct: Context is 'NULL', can't set \"%.200s\" from context", name); @@ -3450,7 +3453,7 @@ static int pyrna_struct_setattro(BPy_StructRNA *self, PyObject *pyname, PyObject int done= CTX_data_get(C, name, &newptr, &newlb, &newtype); - if(done==1) { + if (done==1) { PyErr_Format(PyExc_AttributeError, "bpy_struct: Context property \"%.200s\" is read-only", name); @@ -3463,8 +3466,8 @@ static int pyrna_struct_setattro(BPy_StructRNA *self, PyObject *pyname, PyObject } /* pyrna_py_to_prop sets its own exceptions */ - if(prop) { - if(value == NULL) { + if (prop) { + if (value == NULL) { PyErr_SetString(PyExc_AttributeError, "bpy_struct: del not supported"); return -1; } @@ -3489,8 +3492,8 @@ static PyObject *pyrna_prop_dir(BPy_PropertyRNA *self) pyrna_dir_members_py(ret, (PyObject *)self); } - if(RNA_property_type(self->prop) == PROP_COLLECTION) { - if(RNA_property_collection_type_get(&self->ptr, self->prop, &r_ptr)) { + if (RNA_property_type(self->prop) == PROP_COLLECTION) { + if (RNA_property_collection_type_get(&self->ptr, self->prop, &r_ptr)) { pyrna_dir_members_rna(ret, &r_ptr); } } @@ -3508,17 +3511,17 @@ static PyObject *pyrna_prop_collection_getattro(BPy_PropertyRNA *self, PyObject { const char *name= _PyUnicode_AsString(pyname); - if(name == NULL) { + if (name == NULL) { PyErr_SetString(PyExc_AttributeError, "bpy_prop_collection: __getattr__ must be a string"); return NULL; } - else if(name[0] != '_') { + else if (name[0] != '_') { PyObject *ret; PropertyRNA *prop; FunctionRNA *func; PointerRNA r_ptr; - if(RNA_property_collection_type_get(&self->ptr, self->prop, &r_ptr)) { + if (RNA_property_collection_type_get(&self->ptr, self->prop, &r_ptr)) { if ((prop= RNA_struct_find_property(&r_ptr, name))) { ret= pyrna_prop_to_py(&r_ptr, prop); @@ -3545,10 +3548,10 @@ static PyObject *pyrna_prop_collection_getattro(BPy_PropertyRNA *self, PyObject PyObject *ret= PyObject_GenericGetAttr((PyObject *)self, pyname); - if(ret == NULL && name[0] != '_') { /* avoid inheriting __call__ and similar */ + if (ret == NULL && name[0] != '_') { /* avoid inheriting __call__ and similar */ /* since this is least common case, handle it last */ PointerRNA r_ptr; - if(RNA_property_collection_type_get(&self->ptr, self->prop, &r_ptr)) { + if (RNA_property_collection_type_get(&self->ptr, self->prop, &r_ptr)) { PyObject *cls; PyObject *error_type, *error_value, *error_traceback; @@ -3558,7 +3561,7 @@ static PyObject *pyrna_prop_collection_getattro(BPy_PropertyRNA *self, PyObject cls= pyrna_struct_Subtype(&r_ptr); /* borrows */ ret= PyObject_GenericGetAttr(cls, pyname); /* restore the original error */ - if(ret == NULL) { + if (ret == NULL) { PyErr_Restore(error_type, error_value, error_traceback); } } @@ -3577,20 +3580,20 @@ static int pyrna_prop_collection_setattro(BPy_PropertyRNA *self, PyObject *pynam PointerRNA r_ptr; #ifdef USE_PEDANTIC_WRITE - if(rna_disallow_writes && rna_id_write_error(&self->ptr, pyname)) { + if (rna_disallow_writes && rna_id_write_error(&self->ptr, pyname)) { return -1; } #endif // USE_STRING_COERCE - if(name == NULL) { + if (name == NULL) { PyErr_SetString(PyExc_AttributeError, "bpy_prop: __setattr__ must be a string"); return -1; } - else if(value == NULL) { + else if (value == NULL) { PyErr_SetString(PyExc_AttributeError, "bpy_prop: del not supported"); return -1; } - else if(RNA_property_collection_type_get(&self->ptr, self->prop, &r_ptr)) { + else if (RNA_property_collection_type_get(&self->ptr, self->prop, &r_ptr)) { if ((prop= RNA_struct_find_property(&r_ptr, name))) { /* pyrna_py_to_prop sets its own exceptions */ return pyrna_py_to_prop(&r_ptr, prop, NULL, value, "BPy_PropertyRNA - Attribute (setattr):"); @@ -3609,7 +3612,7 @@ static PyObject *pyrna_prop_collection_idprop_add(BPy_PropertyRNA *self) PointerRNA r_ptr; RNA_property_collection_add(&self->ptr, self->prop, &r_ptr); - if(!r_ptr.data) { + if (!r_ptr.data) { PyErr_SetString(PyExc_TypeError, "bpy_prop_collection.add(): not supported for this collection"); return NULL; } @@ -3627,7 +3630,7 @@ static PyObject *pyrna_prop_collection_idprop_remove(BPy_PropertyRNA *self, PyOb return NULL; } - if(!RNA_property_collection_remove(&self->ptr, self->prop, key)) { + if (!RNA_property_collection_remove(&self->ptr, self->prop, key)) { PyErr_SetString(PyExc_TypeError, "bpy_prop_collection.remove() not supported for this collection"); return NULL; } @@ -3644,7 +3647,7 @@ static PyObject *pyrna_prop_collection_idprop_move(BPy_PropertyRNA *self, PyObje return NULL; } - if(!RNA_property_collection_move(&self->ptr, self->prop, key, pos)) { + if (!RNA_property_collection_move(&self->ptr, self->prop, key, pos)) { PyErr_SetString(PyExc_TypeError, "bpy_prop_collection.move() not supported for this collection"); return NULL; } @@ -3655,7 +3658,7 @@ static PyObject *pyrna_prop_collection_idprop_move(BPy_PropertyRNA *self, PyObje static PyObject *pyrna_struct_get_id_data(BPy_DummyPointerRNA *self) { /* used for struct and pointer since both have a ptr */ - if(self->ptr.id.data) { + if (self->ptr.id.data) { PointerRNA id_ptr; RNA_id_pointer_create((ID *)self->ptr.id.data, &id_ptr); return pyrna_struct_CreatePyObject(&id_ptr); @@ -3664,7 +3667,7 @@ static PyObject *pyrna_struct_get_id_data(BPy_DummyPointerRNA *self) Py_RETURN_NONE; } -static PyObject *pyrna_struct_get_pointer_data(BPy_DummyPointerRNA *self) +static PyObject *pyrna_struct_get_data(BPy_DummyPointerRNA *self) { return pyrna_struct_CreatePyObject(&self->ptr); } @@ -3684,7 +3687,7 @@ static PyObject *pyrna_struct_get_rna_type(BPy_PropertyRNA *self) static PyGetSetDef pyrna_prop_getseters[]= { {(char *)"id_data", (getter)pyrna_struct_get_id_data, (setter)NULL, (char *)"The :class:`bpy.types.ID` object this datablock is from or None, (not available for all data types)", NULL}, - {(char *)"data", (getter)pyrna_struct_get_pointer_data, (setter)NULL, (char *)"The data this property is using, *type* :class:`bpy.types.bpy_struct`", NULL}, + {(char *)"data", (getter)pyrna_struct_get_data, (setter)NULL, (char *)"The data this property is using, *type* :class:`bpy.types.bpy_struct`", NULL}, {(char *)"rna_type", (getter)pyrna_struct_get_rna_type, (setter)NULL, (char *)"The property type for introspection", NULL}, {NULL, NULL, NULL, NULL, NULL} /* Sentinel */ }; @@ -3713,15 +3716,16 @@ static PyObject *pyrna_prop_collection_keys(BPy_PropertyRNA *self) RNA_PROP_BEGIN(&self->ptr, itemptr, self->prop) { nameptr= RNA_struct_name_get_alloc(&itemptr, name, sizeof(name)); - if(nameptr) { + if (nameptr) { /* add to python list */ item= PyUnicode_FromString(nameptr); PyList_Append(ret, item); Py_DECREF(item); /* done */ - if(name != nameptr) + if (name != nameptr) { MEM_freeN(nameptr); + } } } RNA_PROP_END; @@ -3746,13 +3750,13 @@ static PyObject *pyrna_prop_collection_items(BPy_PropertyRNA *self) int i= 0; RNA_PROP_BEGIN(&self->ptr, itemptr, self->prop) { - if(itemptr.data) { + if (itemptr.data) { /* add to python list */ item= PyTuple_New(2); nameptr= RNA_struct_name_get_alloc(&itemptr, name, sizeof(name)); - if(nameptr) { + if (nameptr) { PyTuple_SET_ITEM(item, 0, PyUnicode_FromString(nameptr)); - if(name != nameptr) + if (name != nameptr) MEM_freeN(nameptr); } else { @@ -3813,17 +3817,18 @@ static PyObject *pyrna_struct_get(BPy_StructRNA *self, PyObject *args) return NULL; /* mostly copied from BPy_IDGroup_Map_GetItem */ - if(RNA_struct_idprops_check(self->ptr.type)==0) { + if (RNA_struct_idprops_check(self->ptr.type)==0) { PyErr_SetString(PyExc_TypeError, "this type doesn't support IDProperties"); return NULL; } group= RNA_struct_idprops(&self->ptr, 0); - if(group) { + if (group) { idprop= IDP_GetPropertyFromGroup(group, key); - if(idprop) + if (idprop) { return BPy_IDGroup_WrapData(self->ptr.id.data, idprop); + } } return Py_INCREF(def), def; @@ -3869,7 +3874,7 @@ static PyObject *pyrna_prop_collection_get(BPy_PropertyRNA *self, PyObject *args if (!PyArg_ParseTuple(args, "s|O:get", &key, &def)) return NULL; - if(RNA_property_collection_lookup_string(&self->ptr, self->prop, key, &newptr)) + if (RNA_property_collection_lookup_string(&self->ptr, self->prop, key, &newptr)) return pyrna_struct_CreatePyObject(&newptr); return Py_INCREF(def), def; @@ -3910,19 +3915,19 @@ static int foreach_parse_args( *size= *attr_tot= *attr_signed= FALSE; *raw_type= PROP_RAW_UNSET; - if(!PyArg_ParseTuple(args, "sO", attr, seq) || (!PySequence_Check(*seq) && PyObject_CheckBuffer(*seq))) { + if (!PyArg_ParseTuple(args, "sO", attr, seq) || (!PySequence_Check(*seq) && PyObject_CheckBuffer(*seq))) { PyErr_SetString(PyExc_TypeError, "foreach_get(attr, sequence) expects a string and a sequence"); return -1; } *tot= PySequence_Size(*seq); // TODO - buffer may not be a sequence! array.array() is tho. - if(*tot>0) { + if (*tot>0) { foreach_attr_type(self, *attr, raw_type, attr_tot, attr_signed); *size= RNA_raw_type_sizeof(*raw_type); #if 0 // works fine but not strictly needed, we could allow RNA_property_collection_raw_* to do the checks - if((*attr_tot) < 1) + if ((*attr_tot) < 1) *attr_tot= 1; if (RNA_property_type(self->prop) == PROP_COLLECTION) @@ -3934,7 +3939,7 @@ static int foreach_parse_args( target_tot= array_tot * (*attr_tot); /* rna_access.c - rna_raw_access(...) uses this same method */ - if(target_tot != (*tot)) { + if (target_tot != (*tot)) { PyErr_Format(PyExc_TypeError, "foreach_get(attr, sequence) sequence length mismatch given %d, needed %d", *tot, target_tot); @@ -3958,14 +3963,14 @@ static int foreach_compat_buffer(RawPropertyType raw_type, int attr_signed, cons switch(raw_type) { case PROP_RAW_CHAR: - if (attr_signed) return (f=='b') ? 1:0; - else return (f=='B') ? 1:0; + if (attr_signed) return (f=='b') ? 1:0; + else return (f=='B') ? 1:0; case PROP_RAW_SHORT: - if (attr_signed) return (f=='h') ? 1:0; - else return (f=='H') ? 1:0; + if (attr_signed) return (f=='h') ? 1:0; + else return (f=='H') ? 1:0; case PROP_RAW_INT: - if (attr_signed) return (f=='i') ? 1:0; - else return (f=='I') ? 1:0; + if (attr_signed) return (f=='i') ? 1:0; + else return (f=='I') ? 1:0; case PROP_RAW_FLOAT: return (f=='f') ? 1:0; case PROP_RAW_DOUBLE: @@ -3989,17 +3994,17 @@ static PyObject *foreach_getset(BPy_PropertyRNA *self, PyObject *args, int set) int tot, size, attr_tot, attr_signed; RawPropertyType raw_type; - if(foreach_parse_args(self, args, &attr, &seq, &tot, &size, &raw_type, &attr_tot, &attr_signed) < 0) + if (foreach_parse_args(self, args, &attr, &seq, &tot, &size, &raw_type, &attr_tot, &attr_signed) < 0) return NULL; - if(tot==0) + if (tot==0) Py_RETURN_NONE; - if(set) { /* get the array from python */ + if (set) { /* get the array from python */ buffer_is_compat= FALSE; - if(PyObject_CheckBuffer(seq)) { + if (PyObject_CheckBuffer(seq)) { Py_buffer buf; PyObject_GetBuffer(seq, &buf, PyBUF_SIMPLE | PyBUF_FORMAT); @@ -4007,7 +4012,7 @@ static PyObject *foreach_getset(BPy_PropertyRNA *self, PyObject *args, int set) buffer_is_compat= foreach_compat_buffer(raw_type, attr_signed, buf.format); - if(buffer_is_compat) { + if (buffer_is_compat) { ok= RNA_property_collection_raw_set(NULL, &self->ptr, self->prop, attr, buf.buf, raw_type, tot); } @@ -4015,10 +4020,10 @@ static PyObject *foreach_getset(BPy_PropertyRNA *self, PyObject *args, int set) } /* could not use the buffer, fallback to sequence */ - if(!buffer_is_compat) { + if (!buffer_is_compat) { array= PyMem_Malloc(size * tot); - for( ; iptr, self->prop, attr, buf.buf, raw_type, tot); } @@ -4066,14 +4071,14 @@ static PyObject *foreach_getset(BPy_PropertyRNA *self, PyObject *args, int set) } /* could not use the buffer, fallback to sequence */ - if(!buffer_is_compat) { + if (!buffer_is_compat) { array= PyMem_Malloc(size * tot); ok= RNA_property_collection_raw_get(NULL, &self->ptr, self->prop, attr, array, raw_type, tot); - if(!ok) i= tot; /* skip the loop */ + if (!ok) i= tot; /* skip the loop */ - for( ; itp_alloc(type, 0))) { + if ((ret= (BPy_StructRNA *)type->tp_alloc(type, 0))) { ret->ptr= base->ptr; } /* pass on exception & NULL if tp_alloc fails */ @@ -4344,7 +4349,7 @@ static PyObject *pyrna_param_to_py(PointerRNA *ptr, PropertyRNA *prop, void *dat int type= RNA_property_type(prop); int flag= RNA_property_flag(prop); - if(RNA_property_array_check(prop)) { + if (RNA_property_array_check(prop)) { int a, len; if (flag & PROP_DYNAMIC) { @@ -4362,12 +4367,12 @@ static PyObject *pyrna_param_to_py(PointerRNA *ptr, PropertyRNA *prop, void *dat switch (type) { case PROP_BOOLEAN: ret= PyTuple_New(len); - for(a=0; afirst; link; link=link->next) { + for (link=lb->first; link; link=link->next) { linkptr= pyrna_struct_CreatePyObject(&link->ptr); PyList_Append(ret, linkptr); Py_DECREF(linkptr); @@ -4516,8 +4521,8 @@ static PyObject *small_dict_get_item_string(PyObject *dict, const char *key_look PyObject *value = NULL; while (PyDict_Next(dict, &pos, &key, &value)) { - if(PyUnicode_Check(key)) { - if(strcmp(key_lookup, _PyUnicode_AsString(key))==0) { + if (PyUnicode_Check(key)) { + if (strcmp(key_lookup, _PyUnicode_AsString(key))==0) { return value; } } @@ -4553,12 +4558,12 @@ static PyObject *pyrna_func_call(BPy_FunctionRNA *self, PyObject *args, PyObject /* Should never happen but it does in rare cases */ BLI_assert(self_ptr != NULL); - if(self_ptr==NULL) { + if (self_ptr==NULL) { PyErr_SetString(PyExc_RuntimeError, "rna functions internal rna pointer is NULL, this is a bug. aborting"); return NULL; } - if(self_func==NULL) { + if (self_func==NULL) { PyErr_Format(PyExc_RuntimeError, "%.200s.(): rna function internal function is NULL, this is a bug. aborting", RNA_struct_identifier(self_ptr->type)); @@ -4588,7 +4593,7 @@ static PyObject *pyrna_func_call(BPy_FunctionRNA *self, PyObject *args, PyObject parms_len= RNA_parameter_list_arg_count(&parms); ret_len= 0; - if(pyargs_len + pykw_len > parms_len) { + if (pyargs_len + pykw_len > parms_len) { RNA_parameter_list_end(&iter); PyErr_Format(PyExc_TypeError, "%.200s.%.200s(): takes at most %d arguments, got %d", @@ -4625,7 +4630,7 @@ static PyObject *pyrna_func_call(BPy_FunctionRNA *self, PyObject *args, PyObject #else item= small_dict_get_item_string(kw, RNA_property_identifier(parm)); /* borrow ref */ #endif - if(item) + if (item) kw_tot++; /* make sure invalid keywords are not given */ kw_arg= TRUE; @@ -4634,7 +4639,7 @@ static PyObject *pyrna_func_call(BPy_FunctionRNA *self, PyObject *args, PyObject i++; /* current argument */ if (item==NULL) { - if(flag & PROP_REQUIRED) { + if (flag & PROP_REQUIRED) { PyErr_Format(PyExc_TypeError, "%.200s.%.200s(): required parameter \"%.200s\" not specified", RNA_struct_identifier(self_ptr->type), @@ -4649,8 +4654,8 @@ static PyObject *pyrna_func_call(BPy_FunctionRNA *self, PyObject *args, PyObject } #ifdef DEBUG_STRING_FREE - if(item) { - if(PyUnicode_Check(item)) { + if (item) { + if (PyUnicode_Check(item)) { item= PyUnicode_FromString(_PyUnicode_AsString(item)); PyList_Append(string_free_ls, item); Py_DECREF(item); @@ -4659,13 +4664,13 @@ static PyObject *pyrna_func_call(BPy_FunctionRNA *self, PyObject *args, PyObject #endif err= pyrna_py_to_prop(&funcptr, parm, iter.data, item, ""); - if(err!=0) { + if (err!=0) { /* the error generated isn't that useful, so generate it again with a useful prefix * could also write a function to prepend to error messages */ char error_prefix[512]; PyErr_Clear(); /* re-raise */ - if(kw_arg==TRUE) + if (kw_arg==TRUE) BLI_snprintf(error_prefix, sizeof(error_prefix), "%.200s.%.200s(): error with keyword argument \"%.200s\" - ", RNA_struct_identifier(self_ptr->type), @@ -4692,7 +4697,7 @@ static PyObject *pyrna_func_call(BPy_FunctionRNA *self, PyObject *args, PyObject * the if below is quick, checking if it passed less keyword args then we gave. * (Dont overwrite the error if we have one, otherwise can skip important messages and confuse with args) */ - if(err == 0 && kw && (pykw_len > kw_tot)) { + if (err == 0 && kw && (pykw_len > kw_tot)) { PyObject *key, *value; Py_ssize_t pos= 0; @@ -4707,13 +4712,13 @@ static PyObject *pyrna_func_call(BPy_FunctionRNA *self, PyObject *args, PyObject arg_name= _PyUnicode_AsString(key); found= FALSE; - if(arg_name==NULL) { /* unlikely the argname is not a string but ignore if it is*/ + if (arg_name==NULL) { /* unlikely the argname is not a string but ignore if it is*/ PyErr_Clear(); } else { /* Search for arg_name */ RNA_parameter_list_begin(&parms, &iter); - for(; iter.valid; RNA_parameter_list_next(&iter)) { + for (; iter.valid; RNA_parameter_list_next(&iter)) { parm= iter.parm; if (strcmp(arg_name, RNA_property_identifier(parm))==0) { found= TRUE; @@ -4723,7 +4728,7 @@ static PyObject *pyrna_func_call(BPy_FunctionRNA *self, PyObject *args, PyObject RNA_parameter_list_end(&iter); - if(found==FALSE) { + if (found==FALSE) { BLI_dynstr_appendf(bad_args, first ? "%s" : ", %s", arg_name); first= FALSE; } @@ -4734,9 +4739,9 @@ static PyObject *pyrna_func_call(BPy_FunctionRNA *self, PyObject *args, PyObject first= TRUE; RNA_parameter_list_begin(&parms, &iter); - for(; iter.valid; RNA_parameter_list_next(&iter)) { + for (; iter.valid; RNA_parameter_list_next(&iter)) { parm= iter.parm; - if(RNA_property_flag(parm) & PROP_OUTPUT) + if (RNA_property_flag(parm) & PROP_OUTPUT) continue; BLI_dynstr_appendf(good_args, first ? "%s" : ", %s", RNA_property_identifier(parm)); @@ -4773,7 +4778,7 @@ static PyObject *pyrna_func_call(BPy_FunctionRNA *self, PyObject *args, PyObject err= (BPy_reports_to_error(&reports, PyExc_RuntimeError, TRUE)); /* return value */ - if(err != -1) { + if (err != -1) { if (ret_len > 0) { if (ret_len > 1) { ret= PyTuple_New(ret_len); @@ -4781,7 +4786,7 @@ static PyObject *pyrna_func_call(BPy_FunctionRNA *self, PyObject *args, PyObject RNA_parameter_list_begin(&parms, &iter); - for(; iter.valid; RNA_parameter_list_next(&iter)) { + for (; iter.valid; RNA_parameter_list_next(&iter)) { parm= iter.parm; flag= RNA_property_flag(parm); @@ -4795,7 +4800,7 @@ static PyObject *pyrna_func_call(BPy_FunctionRNA *self, PyObject *args, PyObject ret= pyrna_param_to_py(&funcptr, pret_single, retdata_single); /* possible there is an error in conversion */ - if(ret==NULL) + if (ret==NULL) err= -1; } } @@ -4803,7 +4808,7 @@ static PyObject *pyrna_func_call(BPy_FunctionRNA *self, PyObject *args, PyObject #ifdef DEBUG_STRING_FREE - // if(PyList_GET_SIZE(string_free_ls)) printf("%.200s.%.200s(): has %d strings\n", RNA_struct_identifier(self_ptr->type), RNA_function_identifier(self_func), (int)PyList_GET_SIZE(string_free_ls)); + // if (PyList_GET_SIZE(string_free_ls)) printf("%.200s.%.200s(): has %d strings\n", RNA_struct_identifier(self_ptr->type), RNA_function_identifier(self_func), (int)PyList_GET_SIZE(string_free_ls)); Py_DECREF(string_free_ls); #undef DEBUG_STRING_FREE #endif @@ -5539,7 +5544,7 @@ static PyObject *pyrna_prop_collection_iter(BPy_PropertyRNA *self) static PyObject *pyrna_prop_collection_iter_next(BPy_PropertyCollectionIterRNA *self) { - if(self->iter.valid == FALSE) { + if (self->iter.valid == FALSE) { PyErr_SetString(PyExc_StopIteration, "pyrna_prop_collection_iter stop"); return NULL; } @@ -5547,8 +5552,8 @@ static PyObject *pyrna_prop_collection_iter_next(BPy_PropertyCollectionIterRNA * BPy_StructRNA *pyrna= (BPy_StructRNA *)pyrna_struct_CreatePyObject(&self->iter.ptr); #ifdef USE_PYRNA_STRUCT_REFERENCE - if(pyrna) { /* unlikely but may fail */ - if((PyObject *)pyrna != Py_None) { + if (pyrna) { /* unlikely but may fail */ + if ((PyObject *)pyrna != Py_None) { /* hold a reference to the iterator since it may have * allocated memory 'pyrna' needs. eg: introspecting dynamic enum's */ /* TODO, we could have an api call to know if this is needed since most collections don't */ @@ -5622,13 +5627,13 @@ static PyObject* pyrna_srna_PyBase(StructRNA *srna) //, PyObject *bpy_types_dict /* get the base type */ base= RNA_struct_base(srna); - if(base && base != srna) { + if (base && base != srna) { /*/printf("debug subtype %s %p\n", RNA_struct_identifier(srna), srna); */ py_base= pyrna_srna_Subtype(base); //, bpy_types_dict); Py_DECREF(py_base); /* srna owns, this is only to pass as an arg */ } - if(py_base==NULL) { + if (py_base==NULL) { py_base= (PyObject *)&pyrna_struct_Type; } @@ -5644,10 +5649,10 @@ static PyObject* pyrna_srna_ExternalType(StructRNA *srna) const char *idname= RNA_struct_identifier(srna); PyObject *newclass; - if(bpy_types_dict==NULL) { + if (bpy_types_dict==NULL) { PyObject *bpy_types= PyImport_ImportModuleLevel((char *)"bpy_types", NULL, NULL, NULL, 0); - if(bpy_types==NULL) { + if (bpy_types==NULL) { PyErr_Print(); PyErr_Clear(); fprintf(stderr, "%s: failed to find 'bpy_types' module\n", __func__); @@ -5660,27 +5665,27 @@ static PyObject* pyrna_srna_ExternalType(StructRNA *srna) newclass= PyDict_GetItemString(bpy_types_dict, idname); /* sanity check, could skip this unless in debug mode */ - if(newclass) { + if (newclass) { PyObject *base_compare= pyrna_srna_PyBase(srna); //PyObject *slots= PyObject_GetAttrString(newclass, "__slots__"); // cant do this because it gets superclasses values! //PyObject *bases= PyObject_GetAttrString(newclass, "__bases__"); // can do this but faster not to. PyObject *tp_bases= ((PyTypeObject *)newclass)->tp_bases; PyObject *tp_slots= PyDict_GetItem(((PyTypeObject *)newclass)->tp_dict, bpy_intern_str___slots__); - if(tp_slots==NULL) { + if (tp_slots==NULL) { fprintf(stderr, "%s: expected class '%s' to have __slots__ defined\n\nSee bpy_types.py\n", __func__, idname); newclass= NULL; } - else if(PyTuple_GET_SIZE(tp_bases)) { + else if (PyTuple_GET_SIZE(tp_bases)) { PyObject *base= PyTuple_GET_ITEM(tp_bases, 0); - if(base_compare != base) { + if (base_compare != base) { fprintf(stderr, "%s: incorrect subclassing of SRNA '%s'\nSee bpy_types.py\n", __func__, idname); PyC_ObSpit("Expected! ", base_compare); newclass= NULL; } else { - if(G.f & G_DEBUG) + if (G.f & G_DEBUG) fprintf(stderr, "SRNA Subclassed: '%s'\n", idname); } } @@ -5719,10 +5724,10 @@ static PyObject* pyrna_srna_Subtype(StructRNA *srna) /* remove __doc__ for now */ // const char *descr= RNA_struct_ui_description(srna); - // if(!descr) descr= "(no docs)"; + // if (!descr) descr= "(no docs)"; // "__doc__", descr - if(RNA_struct_idprops_check(srna) && !PyObject_IsSubclass(py_base, (PyObject *)&pyrna_struct_meta_idprop_Type)) { + if (RNA_struct_idprops_check(srna) && !PyObject_IsSubclass(py_base, (PyObject *)&pyrna_struct_meta_idprop_Type)) { metaclass= (PyObject *)&pyrna_struct_meta_idprop_Type; } else { @@ -5757,7 +5762,7 @@ static PyObject* pyrna_srna_Subtype(StructRNA *srna) /* use for subtyping so we know which srna is used for a PointerRNA */ static StructRNA *srna_from_ptr(PointerRNA *ptr) { - if(ptr->type == &RNA_Struct) { + if (ptr->type == &RNA_Struct) { return ptr->data; } else { @@ -5796,7 +5801,7 @@ PyObject *pyrna_struct_CreatePyObject(PointerRNA *ptr) } } - if(pyrna == NULL) { + if (pyrna == NULL) { PyErr_SetString(PyExc_MemoryError, "couldn't create bpy_struct object"); return NULL; } @@ -5813,7 +5818,7 @@ PyObject *pyrna_struct_CreatePyObject(PointerRNA *ptr) // PyC_ObSpit("NewStructRNA: ", (PyObject *)pyrna); #ifdef USE_PYRNA_INVALIDATE_WEAKREF - if(ptr->id.data) { + if (ptr->id.data) { id_weakref_pool_add(ptr->id.data, (BPy_DummyPointerRNA *)pyrna); } #endif @@ -5831,7 +5836,7 @@ PyObject *pyrna_prop_CreatePyObject(PointerRNA *ptr, PropertyRNA *prop) type= &pyrna_prop_Type; } else { - if((RNA_property_flag(prop) & PROP_IDPROPERTY) == 0) { + if ((RNA_property_flag(prop) & PROP_IDPROPERTY) == 0) { type= &pyrna_prop_collection_Type; } else { @@ -5853,7 +5858,7 @@ PyObject *pyrna_prop_CreatePyObject(PointerRNA *ptr, PropertyRNA *prop) #endif } - if(pyrna == NULL) { + if (pyrna == NULL) { PyErr_SetString(PyExc_MemoryError, "couldn't create BPy_rna object"); return NULL; } @@ -5862,7 +5867,7 @@ PyObject *pyrna_prop_CreatePyObject(PointerRNA *ptr, PropertyRNA *prop) pyrna->prop= prop; #ifdef USE_PYRNA_INVALIDATE_WEAKREF - if(ptr->id.data) { + if (ptr->id.data) { id_weakref_pool_add(ptr->id.data, (BPy_DummyPointerRNA *)pyrna); } #endif @@ -5886,29 +5891,29 @@ void BPY_rna_init(void) #endif /* metaclass */ - if(PyType_Ready(&pyrna_struct_meta_idprop_Type) < 0) + if (PyType_Ready(&pyrna_struct_meta_idprop_Type) < 0) return; - if(PyType_Ready(&pyrna_struct_Type) < 0) + if (PyType_Ready(&pyrna_struct_Type) < 0) return; - if(PyType_Ready(&pyrna_prop_Type) < 0) + if (PyType_Ready(&pyrna_prop_Type) < 0) return; - if(PyType_Ready(&pyrna_prop_array_Type) < 0) + if (PyType_Ready(&pyrna_prop_array_Type) < 0) return; - if(PyType_Ready(&pyrna_prop_collection_Type) < 0) + if (PyType_Ready(&pyrna_prop_collection_Type) < 0) return; - if(PyType_Ready(&pyrna_prop_collection_idprop_Type) < 0) + if (PyType_Ready(&pyrna_prop_collection_idprop_Type) < 0) return; - if(PyType_Ready(&pyrna_func_Type) < 0) + if (PyType_Ready(&pyrna_func_Type) < 0) return; #ifdef USE_PYRNA_ITER - if(PyType_Ready(&pyrna_prop_collection_iter_Type) < 0) + if (PyType_Ready(&pyrna_prop_collection_iter_Type) < 0) return; #endif } @@ -5961,7 +5966,7 @@ static PyObject *pyrna_basetype_getattro(BPy_BaseTypeRNA *self, PyObject *pyname PyObject *ret; const char *name= _PyUnicode_AsString(pyname); - if(name == NULL) { + if (name == NULL) { PyErr_SetString(PyExc_AttributeError, "bpy.types: __getattr__ must be a string"); ret= NULL; } @@ -6007,7 +6012,7 @@ static PyObject *pyrna_basetype_dir(BPy_BaseTypeRNA *self) list= pyrna_prop_collection_keys(self); /* like calling structs.keys(), avoids looping here */ #if 0 /* for now only contains __dir__ */ - for(meth=pyrna_basetype_methods; meth->ml_name; meth++) { + for (meth=pyrna_basetype_methods; meth->ml_name; meth++) { name= PyUnicode_FromString(meth->ml_name); PyList_Append(list, name); Py_DECREF(name); @@ -6029,7 +6034,7 @@ PyObject *BPY_rna_types(void) pyrna_basetype_Type.tp_flags= Py_TPFLAGS_DEFAULT; pyrna_basetype_Type.tp_methods= pyrna_basetype_methods; - if(PyType_Ready(&pyrna_basetype_Type) < 0) + if (PyType_Ready(&pyrna_basetype_Type) < 0) return NULL; } @@ -6050,26 +6055,26 @@ StructRNA *pyrna_struct_as_srna(PyObject *self, int parent, const char *error_pr StructRNA *srna; /* ack, PyObject_GetAttrString wont look up this types tp_dict first :/ */ - if(PyType_Check(self)) { + if (PyType_Check(self)) { py_srna= (BPy_StructRNA *)PyDict_GetItem(((PyTypeObject *)self)->tp_dict, bpy_intern_str_bl_rna); Py_XINCREF(py_srna); } - if(parent) { + if (parent) { /* be very careful with this since it will return a parent classes srna. * modifying this will do confusing stuff! */ - if(py_srna==NULL) + if (py_srna==NULL) py_srna= (BPy_StructRNA*)PyObject_GetAttr(self, bpy_intern_str_bl_rna); } - if(py_srna==NULL) { + if (py_srna==NULL) { PyErr_Format(PyExc_RuntimeError, "%.200s, missing bl_rna attribute from '%.200s' instance (may not be registered)", error_prefix, Py_TYPE(self)->tp_name); return NULL; } - if(!BPy_StructRNA_Check(py_srna)) { + if (!BPy_StructRNA_Check(py_srna)) { PyErr_Format(PyExc_TypeError, "%.200s, bl_rna attribute wrong type '%.200s' on '%.200s'' instance", error_prefix, Py_TYPE(py_srna)->tp_name, @@ -6078,7 +6083,7 @@ StructRNA *pyrna_struct_as_srna(PyObject *self, int parent, const char *error_pr return NULL; } - if(py_srna->ptr.type != &RNA_Struct) { + if (py_srna->ptr.type != &RNA_Struct) { PyErr_Format(PyExc_TypeError, "%.200s, bl_rna attribute not a RNA_Struct, on '%.200s'' instance", error_prefix, Py_TYPE(self)->tp_name); @@ -6099,7 +6104,7 @@ StructRNA *pyrna_struct_as_srna(PyObject *self, int parent, const char *error_pr StructRNA *srna_from_self(PyObject *self, const char *error_prefix) { - if(self==NULL) { + if (self==NULL) { return NULL; } else if (PyCapsule_CheckExact(self)) { @@ -6120,7 +6125,7 @@ StructRNA *srna_from_self(PyObject *self, const char *error_prefix) srna= pyrna_struct_as_srna(self, 0, error_prefix); - if(!PyErr_Occurred()) { + if (!PyErr_Occurred()) { PyErr_Restore(error_type, error_value, error_traceback); } @@ -6132,14 +6137,14 @@ static int deferred_register_prop(StructRNA *srna, PyObject *key, PyObject *item { /* We only care about results from C which * are for sure types, save some time with error */ - if(pyrna_is_deferred_prop(item)) { + if (pyrna_is_deferred_prop(item)) { PyObject *py_func, *py_kw, *py_srna_cobject, *py_ret; - if(PyArg_ParseTuple(item, "OO!", &py_func, &PyDict_Type, &py_kw)) { + if (PyArg_ParseTuple(item, "OO!", &py_func, &PyDict_Type, &py_kw)) { PyObject *args_fake; - if(*_PyUnicode_AsString(key)=='_') { + if (*_PyUnicode_AsString(key)=='_') { PyErr_Format(PyExc_ValueError, "bpy_struct \"%.200s\" registration error: " "%.200s could not register because the property starts with an '_'\n", @@ -6158,7 +6163,7 @@ static int deferred_register_prop(StructRNA *srna, PyObject *key, PyObject *item Py_DECREF(args_fake); /* free's py_srna_cobject too */ - if(py_ret) { + if (py_ret) { Py_DECREF(py_ret); } else { @@ -6196,12 +6201,12 @@ static int pyrna_deferred_register_props(StructRNA *srna, PyObject *class_dict) /* in both cases PyDict_CheckExact(class_dict) will be true even * though Operators have a metaclass dict namespace */ - if((order= PyDict_GetItem(class_dict, bpy_intern_str_order)) && PyList_CheckExact(order)) { - for(pos= 0; postp_bases, i); /* the rules for using these base classes are not clear, @@ -6235,12 +6240,12 @@ static int pyrna_deferred_register_class_recursive(StructRNA *srna, PyTypeObject * So only scan base classes which are not subclasses if blender types. * This best fits having 'mix-in' classes for operators and render engines. * */ - if( py_superclass != &PyBaseObject_Type && + if (py_superclass != &PyBaseObject_Type && !PyObject_IsSubclass((PyObject *)py_superclass, (PyObject *)&pyrna_struct_Type) ) { ret= pyrna_deferred_register_class_recursive(srna, py_superclass); - if(ret != 0) { + if (ret != 0) { return ret; } } @@ -6254,7 +6259,7 @@ int pyrna_deferred_register_class(StructRNA *srna, PyObject *py_class) { /* Panels and Menus dont need this * save some time and skip the checks here */ - if(!RNA_struct_idprops_register_check(srna)) + if (!RNA_struct_idprops_register_check(srna)) return 0; return pyrna_deferred_register_class_recursive(srna, (PyTypeObject *)py_class); @@ -6269,9 +6274,9 @@ static int rna_function_arg_count(FunctionRNA *func) Link *link; int count= (RNA_function_flag(func) & FUNC_NO_SELF) ? 0 : 1; - for(link=lb->first; link; link=link->next) { + for (link=lb->first; link; link=link->next) { parm= (PropertyRNA*)link; - if(!(RNA_property_flag(parm) & PROP_OUTPUT)) + if (!(RNA_property_flag(parm) & PROP_OUTPUT)) count++; } @@ -6305,11 +6310,11 @@ static int bpy_class_validate(PointerRNA *dummyptr, void *py_data, int *have_fun /* verify callback functions */ lb= RNA_struct_type_functions(srna); i= 0; - for(link=lb->first; link; link=link->next) { + for (link=lb->first; link; link=link->next) { func= (FunctionRNA*)link; flag= RNA_function_flag(func); - if(!(flag & FUNC_REGISTER)) + if (!(flag & FUNC_REGISTER)) continue; item= PyObject_GetAttrString(py_class, RNA_function_identifier(func)); @@ -6330,7 +6335,7 @@ static int bpy_class_validate(PointerRNA *dummyptr, void *py_data, int *have_fun } else { Py_DECREF(item); /* no need to keep a ref, the class owns it (technically we should keep a ref but...) */ - if(flag & FUNC_NO_SELF) { + if (flag & FUNC_NO_SELF) { if (PyMethod_Check(item)==0) { PyErr_Format(PyExc_TypeError, "expected %.200s, %.200s class \"%.200s\" attribute to be a method, not a %.200s", @@ -6355,7 +6360,7 @@ static int bpy_class_validate(PointerRNA *dummyptr, void *py_data, int *have_fun /* note, the number of args we check for and the number of args we give to * @classmethods are different (quirk of python), this is why rna_function_arg_count() doesn't return the value -1*/ - if(flag & FUNC_NO_SELF) + if (flag & FUNC_NO_SELF) func_arg_count++; if (arg_count != func_arg_count) { @@ -6371,12 +6376,12 @@ static int bpy_class_validate(PointerRNA *dummyptr, void *py_data, int *have_fun /* verify properties */ lb= RNA_struct_type_properties(srna); - for(link=lb->first; link; link=link->next) { + for (link=lb->first; link; link=link->next) { const char *identifier; prop= (PropertyRNA*)link; flag= RNA_property_flag(prop); - if(!(flag & PROP_REGISTER)) + if (!(flag & PROP_REGISTER)) continue; identifier= RNA_property_identifier(prop); @@ -6386,10 +6391,10 @@ static int bpy_class_validate(PointerRNA *dummyptr, void *py_data, int *have_fun /* Sneaky workaround to use the class name as the bl_idname */ #define BPY_REPLACEMENT_STRING(rna_attr, py_attr) \ - if(strcmp(identifier, rna_attr) == 0) { \ + if (strcmp(identifier, rna_attr) == 0) { \ item= PyObject_GetAttrString(py_class, py_attr); \ - if(item && item != Py_None) { \ - if(pyrna_py_to_prop(dummyptr, prop, NULL, item, "validating class:") != 0) { \ + if (item && item != Py_None) { \ + if (pyrna_py_to_prop(dummyptr, prop, NULL, item, "validating class:") != 0) { \ Py_DECREF(item); \ return -1; \ } \ @@ -6415,7 +6420,7 @@ static int bpy_class_validate(PointerRNA *dummyptr, void *py_data, int *have_fun else { Py_DECREF(item); /* no need to keep a ref, the class owns it */ - if(pyrna_py_to_prop(dummyptr, prop, NULL, item, "validating class:") != 0) + if (pyrna_py_to_prop(dummyptr, prop, NULL, item, "validating class:") != 0) return -1; } } @@ -6454,7 +6459,7 @@ static int bpy_class_call(bContext *C, PointerRNA *ptr, FunctionRNA *func, Param py_class= RNA_struct_py_type_get(ptr->type); /* rare case. can happen when registering subclasses */ - if(py_class==NULL) { + if (py_class==NULL) { fprintf(stderr, "%s: unable to get python class for rna struct '%.200s'\n", __func__, RNA_struct_identifier(ptr->type)); return -1; @@ -6462,7 +6467,7 @@ static int bpy_class_call(bContext *C, PointerRNA *ptr, FunctionRNA *func, Param /* XXX, this is needed because render engine calls without a context * this should be supported at some point but at the moment its not! */ - if(C==NULL) + if (C==NULL) C= BPy_GetContext(); is_valid_wm= (CTX_wm_manager(C) != NULL); @@ -6471,11 +6476,11 @@ static int bpy_class_call(bContext *C, PointerRNA *ptr, FunctionRNA *func, Param if (!is_static) { /* some datatypes (operator, render engine) can store PyObjects for re-use */ - if(ptr->data) { + if (ptr->data) { void **instance = RNA_struct_instance(ptr); - if(instance) { - if(*instance) { + if (instance) { + if (*instance) { py_class_instance= *instance; Py_INCREF(py_class_instance); } @@ -6487,16 +6492,16 @@ static int bpy_class_call(bContext *C, PointerRNA *ptr, FunctionRNA *func, Param } /* end exception */ - if(py_class_instance==NULL) + if (py_class_instance==NULL) py_srna= pyrna_struct_CreatePyObject(ptr); - if(py_class_instance) { + if (py_class_instance) { /* special case, instance is cached */ } - else if(py_srna == NULL) { + else if (py_srna == NULL) { py_class_instance= NULL; } - else if(py_srna == Py_None) { /* probably wont ever happen but possible */ + else if (py_srna == Py_None) { /* probably wont ever happen but possible */ Py_DECREF(py_srna); py_class_instance= NULL; } @@ -6506,7 +6511,7 @@ static int bpy_class_call(bContext *C, PointerRNA *ptr, FunctionRNA *func, Param * otherwise __init__() always needs to take a second self argument, see pyrna_struct_new(). * Although this is annoying to have to impliment a part of pythons typeobject.c:type_call(). */ - if(py_class->tp_init) { + if (py_class->tp_init) { #ifdef USE_PEDANTIC_WRITE const int prev_write= rna_disallow_writes; rna_disallow_writes= is_operator ? FALSE : TRUE; /* only operators can write on __init__ */ @@ -6547,10 +6552,10 @@ static int bpy_class_call(bContext *C, PointerRNA *ptr, FunctionRNA *func, Param #endif - if(py_class_instance == NULL) { + if (py_class_instance == NULL) { err= -1; /* so the error is not overridden below */ } - else if(py_class_instance_store) { + else if (py_class_instance_store) { *py_class_instance_store= py_class_instance; Py_INCREF(py_class_instance); } @@ -6561,12 +6566,12 @@ static int bpy_class_call(bContext *C, PointerRNA *ptr, FunctionRNA *func, Param PyObject *item= PyObject_GetAttrString((PyObject *)py_class, RNA_function_identifier(func)); // flag= RNA_function_flag(func); - if(item) { + if (item) { RNA_pointer_create(NULL, &RNA_Function, func, &funcptr); args= PyTuple_New(rna_function_arg_count(func)); /* first arg is included in 'item' */ - if(is_static) { + if (is_static) { i= 0; } else { @@ -6625,7 +6630,7 @@ static int bpy_class_call(bContext *C, PointerRNA *ptr, FunctionRNA *func, Param } else { /* the error may be already set if the class instance couldn't be created */ - if(err != -1) { + if (err != -1) { PyErr_Format(PyExc_RuntimeError, "could not create instance of %.200s to call callback function %.200s", RNA_struct_identifier(ptr->type), RNA_function_identifier(func)); @@ -6637,30 +6642,30 @@ static int bpy_class_call(bContext *C, PointerRNA *ptr, FunctionRNA *func, Param err= -1; } else { - if(ret_len==0 && ret != Py_None) { + if (ret_len==0 && ret != Py_None) { PyErr_Format(PyExc_RuntimeError, "expected class %.200s, function %.200s to return None, not %.200s", RNA_struct_identifier(ptr->type), RNA_function_identifier(func), Py_TYPE(ret)->tp_name); err= -1; } - else if(ret_len==1) { + else if (ret_len==1) { err= pyrna_py_to_prop(&funcptr, pret_single, retdata_single, ret, ""); /* when calling operator funcs only gives Function.result with * no line number since the func has finished calling on error, * re-raise the exception with more info since it would be slow to * create prefix on every call (when there are no errors) */ - if(err == -1) { + if (err == -1) { PyC_Err_Format_Prefix(PyExc_RuntimeError, "class %.200s, function %.200s: incompatible return value ", - RNA_struct_identifier(ptr->type), RNA_function_identifier(func) + RNA_struct_identifier(ptr->type), RNA_function_identifier(func) ); } } else if (ret_len > 1) { - if(PyTuple_Check(ret)==0) { + if (PyTuple_Check(ret)==0) { PyErr_Format(PyExc_RuntimeError, "expected class %.200s, function %.200s to return a tuple of size %d, not %.200s", RNA_struct_identifier(ptr->type), RNA_function_identifier(func), @@ -6686,8 +6691,9 @@ static int bpy_class_call(bContext *C, PointerRNA *ptr, FunctionRNA *func, Param /* only useful for single argument returns, we'll need another list loop for multiple */ if (flag & PROP_OUTPUT) { err= pyrna_py_to_prop(&funcptr, parm, iter.data, PyTuple_GET_ITEM(ret, i++), "calling class function:"); - if(err) + if (err) { break; + } } } @@ -6697,7 +6703,7 @@ static int bpy_class_call(bContext *C, PointerRNA *ptr, FunctionRNA *func, Param Py_DECREF(ret); } - if(err != 0) { + if (err != 0) { ReportList *reports; /* alert the user, else they wont know unless they see the console. */ if ( (!is_static) && @@ -6737,12 +6743,12 @@ static void bpy_class_free(void *pyob_ptr) // // remove the rna attribute instead. PyDict_DelItem(((PyTypeObject *)self)->tp_dict, bpy_intern_str_bl_rna); - if(PyErr_Occurred()) + if (PyErr_Occurred()) PyErr_Clear(); #if 0 /* needs further investigation, too annoying so quiet for now */ - if(G.f&G_DEBUG) { - if(self->ob_refcnt > 1) { + if (G.f&G_DEBUG) { + if (self->ob_refcnt > 1) { PyC_ObSpit("zombie class - ref should be 1", self); } } @@ -6767,8 +6773,8 @@ void pyrna_alloc_types(void) RNA_PROP_BEGIN(&ptr, itemptr, prop) { PyObject *item= pyrna_struct_Subtype(&itemptr); - if(item == NULL) { - if(PyErr_Occurred()) { + if (item == NULL) { + if (PyErr_Occurred()) { PyErr_Print(); PyErr_Clear(); } @@ -6797,7 +6803,7 @@ void pyrna_free_types(void) StructRNA *srna= srna_from_ptr(&itemptr); void *py_ptr= RNA_struct_py_type_get(srna); - if(py_ptr) { + if (py_ptr) { #if 0 // XXX - should be able to do this but makes python crash on exit bpy_class_free(py_ptr); #endif @@ -6844,19 +6850,19 @@ static PyObject *pyrna_register_class(PyObject *UNUSED(self), PyObject *py_class const char *identifier; PyObject *py_cls_meth; - if(PyDict_GetItem(((PyTypeObject*)py_class)->tp_dict, bpy_intern_str_bl_rna)) { + if (PyDict_GetItem(((PyTypeObject*)py_class)->tp_dict, bpy_intern_str_bl_rna)) { PyErr_SetString(PyExc_AttributeError, "register_class(...): already registered as a subclass"); return NULL; } /* warning: gets parent classes srna, only for the register function */ srna= pyrna_struct_as_srna(py_class, 1, "register_class(...):"); - if(srna==NULL) + if (srna==NULL) return NULL; /* fails in cases, cant use this check but would like to :| */ /* - if(RNA_struct_py_type_get(srna)) { + if (RNA_struct_py_type_get(srna)) { PyErr_Format(PyExc_ValueError, "register_class(...): %.200s's parent class %.200s is already registered, this is not allowed", ((PyTypeObject*)py_class)->tp_name, RNA_struct_identifier(srna)); @@ -6867,7 +6873,7 @@ static PyObject *pyrna_register_class(PyObject *UNUSED(self), PyObject *py_class /* check that we have a register callback for this type */ reg= RNA_struct_register(srna); - if(!reg) { + if (!reg) { PyErr_Format(PyExc_ValueError, "register_class(...): expected a subclass of a registerable " "rna type (%.200s does not support registration)", @@ -6885,18 +6891,18 @@ static PyObject *pyrna_register_class(PyObject *UNUSED(self), PyObject *py_class srna_new= reg(CTX_data_main(C), &reports, py_class, identifier, bpy_class_validate, bpy_class_call, bpy_class_free); - if(BPy_reports_to_error(&reports, PyExc_RuntimeError, TRUE) == -1) + if (BPy_reports_to_error(&reports, PyExc_RuntimeError, TRUE) == -1) return NULL; /* python errors validating are not converted into reports so the check above will fail. * the cause for returning NULL will be printed as an error */ - if(srna_new == NULL) + if (srna_new == NULL) return NULL; pyrna_subtype_set_rna(py_class, srna_new); /* takes a ref to py_class */ /* old srna still references us, keep the check incase registering somehow can free it */ - if(RNA_struct_py_type_get(srna)) { + if (RNA_struct_py_type_get(srna)) { RNA_struct_py_type_set(srna, NULL); // Py_DECREF(py_class); // should be able to do this XXX since the old rna adds a new ref. } @@ -6905,17 +6911,17 @@ static PyObject *pyrna_register_class(PyObject *UNUSED(self), PyObject *py_class * * item= PyObject_GetAttrString(py_class, "__dict__"); */ - if(pyrna_deferred_register_class(srna_new, py_class)!=0) + if (pyrna_deferred_register_class(srna_new, py_class)!=0) return NULL; /* call classed register method () */ py_cls_meth= PyObject_GetAttr(py_class, bpy_intern_str_register); - if(py_cls_meth == NULL) { + if (py_cls_meth == NULL) { PyErr_Clear(); } else { PyObject *ret= PyObject_CallObject(py_cls_meth, NULL); - if(ret) { + if (ret) { Py_DECREF(ret); } else { @@ -6935,13 +6941,13 @@ static int pyrna_srna_contains_pointer_prop_srna(StructRNA *srna_props, StructRN /* verify properties */ const ListBase *lb= RNA_struct_type_properties(srna); - for(link=lb->first; link; link=link->next) { + for (link=lb->first; link; link=link->next) { prop= (PropertyRNA*)link; - if(RNA_property_type(prop) == PROP_POINTER && !(RNA_property_flag(prop) & PROP_BUILTIN)) { + if (RNA_property_type(prop) == PROP_POINTER && !(RNA_property_flag(prop) & PROP_BUILTIN)) { PointerRNA tptr; RNA_pointer_create(NULL, &RNA_Struct, srna_props, &tptr); - if(RNA_property_pointer_type(&tptr, prop) == srna) { + if (RNA_property_pointer_type(&tptr, prop) == srna) { *prop_identifier= RNA_property_identifier(prop); return 1; } @@ -6967,32 +6973,32 @@ static PyObject *pyrna_unregister_class(PyObject *UNUSED(self), PyObject *py_cla StructRNA *srna; PyObject *py_cls_meth; - /*if(PyDict_GetItem(((PyTypeObject*)py_class)->tp_dict, bpy_intern_str_bl_rna)==NULL) { + /*if (PyDict_GetItem(((PyTypeObject*)py_class)->tp_dict, bpy_intern_str_bl_rna)==NULL) { PWM_cursor_wait(0); PyErr_SetString(PyExc_ValueError, "unregister_class(): not a registered as a subclass"); return NULL; }*/ srna= pyrna_struct_as_srna(py_class, 0, "unregister_class(...):"); - if(srna==NULL) + if (srna==NULL) return NULL; /* check that we have a unregister callback for this type */ unreg= RNA_struct_unregister(srna); - if(!unreg) { + if (!unreg) { PyErr_SetString(PyExc_ValueError, "unregister_class(...): expected a Type subclassed from a registerable rna type (no unregister supported)"); return NULL; } /* call classed unregister method */ py_cls_meth= PyObject_GetAttr(py_class, bpy_intern_str_unregister); - if(py_cls_meth == NULL) { + if (py_cls_meth == NULL) { PyErr_Clear(); } else { PyObject *ret= PyObject_CallObject(py_cls_meth, NULL); - if(ret) { + if (ret) { Py_DECREF(ret); } else { @@ -7001,7 +7007,7 @@ static PyObject *pyrna_unregister_class(PyObject *UNUSED(self), PyObject *py_cla } /* should happen all the time but very slow */ - if(G.f & G_DEBUG) { + if (G.f & G_DEBUG) { /* remove all properties using this class */ StructRNA *srna_iter; PointerRNA ptr_rna; @@ -7016,13 +7022,13 @@ static PyObject *pyrna_unregister_class(PyObject *UNUSED(self), PyObject *py_cla /* loop over all structs */ RNA_PROP_BEGIN(&ptr_rna, itemptr, prop_rna) { srna_iter= itemptr.data; - if(pyrna_srna_contains_pointer_prop_srna(srna_iter, srna, &prop_identifier)) { + if (pyrna_srna_contains_pointer_prop_srna(srna_iter, srna, &prop_identifier)) { break; } } RNA_PROP_END; - if(prop_identifier) { + if (prop_identifier) { PyErr_Format(PyExc_RuntimeError, "unregister_class(...): can't unregister %s because %s.%s pointer property is using this", RNA_struct_identifier(srna), RNA_struct_identifier(srna_iter), prop_identifier); @@ -7037,7 +7043,7 @@ static PyObject *pyrna_unregister_class(PyObject *UNUSED(self), PyObject *py_cla unreg(CTX_data_main(C), srna); /* calls bpy_class_free, this decref's py_class */ PyDict_DelItem(((PyTypeObject *)py_class)->tp_dict, bpy_intern_str_bl_rna); - if(PyErr_Occurred()) + if (PyErr_Occurred()) PyErr_Clear(); //return NULL; Py_RETURN_NONE; diff --git a/source/blender/python/intern/bpy_rna_anim.c b/source/blender/python/intern/bpy_rna_anim.c index c87a141f5bd..00b20f0599c 100644 --- a/source/blender/python/intern/bpy_rna_anim.c +++ b/source/blender/python/intern/bpy_rna_anim.c @@ -70,18 +70,18 @@ static int pyrna_struct_anim_args_parse(PointerRNA *ptr, const char *error_prefi } /* full paths can only be given from ID base */ - if(is_idbase) { + if (is_idbase) { int r_index= -1; - if(RNA_path_resolve_full(ptr, path, &r_ptr, &prop, &r_index)==0) { + if (RNA_path_resolve_full(ptr, path, &r_ptr, &prop, &r_index)==0) { prop= NULL; } - else if(r_index != -1) { + else if (r_index != -1) { PyErr_Format(PyExc_ValueError, "%.200s path includes index, must be a separate argument", error_prefix, path); return -1; } - else if(ptr->id.data != r_ptr.id.data) { + else if (ptr->id.data != r_ptr.id.data) { PyErr_Format(PyExc_ValueError, "%.200s path spans ID blocks", error_prefix, path); @@ -107,8 +107,8 @@ static int pyrna_struct_anim_args_parse(PointerRNA *ptr, const char *error_prefi return -1; } - if(RNA_property_array_check(prop) == 0) { - if((*index) == -1) { + if (RNA_property_array_check(prop) == 0) { + if ((*index) == -1) { *index= 0; } else { @@ -120,7 +120,7 @@ static int pyrna_struct_anim_args_parse(PointerRNA *ptr, const char *error_prefi } else { int array_len= RNA_property_array_length(&r_ptr, prop); - if((*index) < -1 || (*index) >= array_len) { + if ((*index) < -1 || (*index) >= array_len) { PyErr_Format(PyExc_TypeError, "%.200s index out of range \"%s\", given %d, array length is %d", error_prefix, path, *index, array_len); @@ -128,7 +128,7 @@ static int pyrna_struct_anim_args_parse(PointerRNA *ptr, const char *error_prefi } } - if(is_idbase) { + if (is_idbase) { *path_full= BLI_strdup(path); } else { @@ -156,10 +156,10 @@ static int pyrna_struct_keyframe_parse(PointerRNA *ptr, PyObject *args, PyObject if (!PyArg_ParseTupleAndKeywords(args, kw, parse_str, (char **)kwlist, &path, index, cfra, group_name)) return -1; - if(pyrna_struct_anim_args_parse(ptr, error_prefix, path, path_full, index) < 0) + if (pyrna_struct_anim_args_parse(ptr, error_prefix, path, path_full, index) < 0) return -1; - if(*cfra==FLT_MAX) + if (*cfra==FLT_MAX) *cfra= CTX_data_scene(BPy_GetContext())->r.cfra; return 0; /* success */ @@ -191,7 +191,7 @@ PyObject *pyrna_struct_keyframe_insert(BPy_StructRNA *self, PyObject *args, PyOb PYRNA_STRUCT_CHECK_OBJ(self); - if(pyrna_struct_keyframe_parse(&self->ptr, args, kw, + if (pyrna_struct_keyframe_parse(&self->ptr, args, kw, "s|ifs:bpy_struct.keyframe_insert()", "bpy_struct.keyframe_insert()", &path_full, &index, &cfra, &group_name) == -1) { @@ -206,7 +206,7 @@ PyObject *pyrna_struct_keyframe_insert(BPy_StructRNA *self, PyObject *args, PyOb result= insert_keyframe(&reports, (ID *)self->ptr.id.data, NULL, group_name, path_full, index, cfra, 0); MEM_freeN((void *)path_full); - if(BPy_reports_to_error(&reports, PyExc_RuntimeError, TRUE) == -1) + if (BPy_reports_to_error(&reports, PyExc_RuntimeError, TRUE) == -1) return NULL; return PyBool_FromLong(result); @@ -239,7 +239,7 @@ PyObject *pyrna_struct_keyframe_delete(BPy_StructRNA *self, PyObject *args, PyOb PYRNA_STRUCT_CHECK_OBJ(self); - if(pyrna_struct_keyframe_parse(&self->ptr, args, kw, + if (pyrna_struct_keyframe_parse(&self->ptr, args, kw, "s|ifs:bpy_struct.keyframe_delete()", "bpy_struct.keyframe_insert()", &path_full, &index, &cfra, &group_name) == -1) @@ -255,7 +255,7 @@ PyObject *pyrna_struct_keyframe_delete(BPy_StructRNA *self, PyObject *args, PyOb result= delete_keyframe(&reports, (ID *)self->ptr.id.data, NULL, group_name, path_full, index, cfra, 0); MEM_freeN((void *)path_full); - if(BPy_reports_to_error(&reports, PyExc_RuntimeError, TRUE) == -1) + if (BPy_reports_to_error(&reports, PyExc_RuntimeError, TRUE) == -1) return NULL; return PyBool_FromLong(result); @@ -285,7 +285,7 @@ PyObject *pyrna_struct_driver_add(BPy_StructRNA *self, PyObject *args) if (!PyArg_ParseTuple(args, "s|i:driver_add", &path, &index)) return NULL; - if(pyrna_struct_anim_args_parse(&self->ptr, "bpy_struct.driver_add():", path, &path_full, &index) < 0) { + if (pyrna_struct_anim_args_parse(&self->ptr, "bpy_struct.driver_add():", path, &path_full, &index) < 0) { return NULL; } else { @@ -297,10 +297,10 @@ PyObject *pyrna_struct_driver_add(BPy_StructRNA *self, PyObject *args) result= ANIM_add_driver(&reports, (ID *)self->ptr.id.data, path_full, index, 0, DRIVER_TYPE_PYTHON); - if(BPy_reports_to_error(&reports, PyExc_RuntimeError, TRUE) == -1) + if (BPy_reports_to_error(&reports, PyExc_RuntimeError, TRUE) == -1) return NULL; - if(result) { + if (result) { ID *id= self->ptr.id.data; AnimData *adt= BKE_animdata_from_id(id); FCurve *fcu; @@ -308,10 +308,10 @@ PyObject *pyrna_struct_driver_add(BPy_StructRNA *self, PyObject *args) PointerRNA tptr; PyObject *item; - if(index == -1) { /* all, use a list */ + if (index == -1) { /* all, use a list */ int i= 0; ret= PyList_New(0); - while((fcu= list_find_fcurve(&adt->drivers, path_full, i++))) { + while ((fcu= list_find_fcurve(&adt->drivers, path_full, i++))) { RNA_pointer_create(id, &RNA_FCurve, fcu, &tptr); item= pyrna_struct_CreatePyObject(&tptr); PyList_Append(ret, item); @@ -361,7 +361,7 @@ PyObject *pyrna_struct_driver_remove(BPy_StructRNA *self, PyObject *args) if (!PyArg_ParseTuple(args, "s|i:driver_remove", &path, &index)) return NULL; - if(pyrna_struct_anim_args_parse(&self->ptr, "bpy_struct.driver_remove():", path, &path_full, &index) < 0) { + if (pyrna_struct_anim_args_parse(&self->ptr, "bpy_struct.driver_remove():", path, &path_full, &index) < 0) { return NULL; } else { @@ -374,7 +374,7 @@ PyObject *pyrna_struct_driver_remove(BPy_StructRNA *self, PyObject *args) MEM_freeN((void *)path_full); - if(BPy_reports_to_error(&reports, PyExc_RuntimeError, TRUE) == -1) + if (BPy_reports_to_error(&reports, PyExc_RuntimeError, TRUE) == -1) return NULL; WM_event_add_notifier(BPy_GetContext(), NC_ANIMATION|ND_FCURVES_ORDER, NULL); diff --git a/source/blender/python/intern/bpy_rna_array.c b/source/blender/python/intern/bpy_rna_array.c index cab57724d6d..24ecad85d14 100644 --- a/source/blender/python/intern/bpy_rna_array.c +++ b/source/blender/python/intern/bpy_rna_array.c @@ -67,7 +67,7 @@ static int validate_array_type(PyObject *seq, int dim, int totdim, int dimsize[] if (dim + 1 < totdim) { /* check that a sequence contains dimsize[dim] items */ const Py_ssize_t seq_size= PySequence_Size(seq); - if(seq_size == -1) { + if (seq_size == -1) { PyErr_Format(PyExc_ValueError, "%s sequence expected at dimension %d, not '%s'", error_prefix, (int)dim + 1, Py_TYPE(seq)->tp_name); return -1; @@ -77,7 +77,7 @@ static int validate_array_type(PyObject *seq, int dim, int totdim, int dimsize[] int ok= 1; item= PySequence_GetItem(seq, i); - if(item == NULL) { + if (item == NULL) { PyErr_Format(PyExc_TypeError, "%s sequence type '%s' failed to retrieve index %d", error_prefix, Py_TYPE(seq)->tp_name, i); ok= 0; @@ -112,7 +112,7 @@ static int validate_array_type(PyObject *seq, int dim, int totdim, int dimsize[] else { /* check that items are of correct type */ const int seq_size= PySequence_Size(seq); - if(seq_size == -1) { + if (seq_size == -1) { PyErr_Format(PyExc_ValueError, "%s sequence expected at dimension %d, not '%s'", error_prefix, (int)dim + 1, Py_TYPE(seq)->tp_name); return -1; @@ -120,7 +120,7 @@ static int validate_array_type(PyObject *seq, int dim, int totdim, int dimsize[] for (i= 0; i < seq_size; i++) { PyObject *item= PySequence_GetItem(seq, i); - if(item == NULL) { + if (item == NULL) { PyErr_Format(PyExc_TypeError, "%s sequence type '%s' failed to retrieve index %d", error_prefix, Py_TYPE(seq)->tp_name, i); return -1; @@ -146,15 +146,15 @@ static int count_items(PyObject *seq, int dim) { int totitem= 0; - if(dim > 1) { + if (dim > 1) { const Py_ssize_t seq_size= PySequence_Size(seq); Py_ssize_t i; for (i= 0; i < seq_size; i++) { PyObject *item= PySequence_GetItem(seq, i); - if(item) { + if (item) { const int tot= count_items(item, dim - 1); Py_DECREF(item); - if(tot != -1) { + if (tot != -1) { totitem += tot; } else { @@ -184,7 +184,7 @@ static int validate_array_length(PyObject *rvalue, PointerRNA *ptr, PropertyRNA totdim= RNA_property_array_dimension(ptr, prop, dimsize); tot= count_items(rvalue, totdim - lvalue_dim); - if(tot == -1) { + if (tot == -1) { PyErr_Format(PyExc_ValueError, "%s %.200s.%.200s, error validating the sequence length", error_prefix, RNA_struct_identifier(ptr->type), RNA_property_identifier(prop)); return -1; @@ -294,13 +294,13 @@ static char *copy_values(PyObject *seq, PointerRNA *ptr, PropertyRNA *prop, int /* Note that 'data can be NULL' */ - if(seq_size == -1) { + if (seq_size == -1) { return NULL; } for (i= 0; i < seq_size; i++) { PyObject *item= PySequence_GetItem(seq, i); - if(item) { + if (item) { if (dim + 1 < totdim) { data= copy_values(item, ptr, prop, dim + 1, data, item_size, index, convert_item, rna_set_index); } @@ -334,7 +334,7 @@ static int py_to_array(PyObject *seq, PointerRNA *ptr, PropertyRNA *prop, char * if (totitem) { /* note: this code is confusing */ - if(param_data && RNA_property_flag(prop) & PROP_DYNAMIC) { + if (param_data && RNA_property_flag(prop) & PROP_DYNAMIC) { /* not freeing allocated mem, RNA_parameter_list_free() will do this */ ParameterDynAlloc *param_alloc= (ParameterDynAlloc *)param_data; param_alloc->array_tot= (int)totitem; @@ -351,7 +351,7 @@ static int py_to_array(PyObject *seq, PointerRNA *ptr, PropertyRNA *prop, char * /* will only fail in very rare cases since we already validated the * python data, the check here is mainly for completeness. */ - if(copy_values(seq, ptr, prop, 0, data, item_size, NULL, convert_item, NULL) != NULL) { + if (copy_values(seq, ptr, prop, 0, data, item_size, NULL, convert_item, NULL) != NULL) { if (param_data==NULL) { /* NULL can only pass through in case RNA property arraylength is 0 (impossible?) */ rna_set_array(ptr, prop, data); @@ -396,8 +396,8 @@ static int py_to_array_index(PyObject *py, PointerRNA *ptr, PropertyRNA *prop, i index += arrayoffset; - if(lvalue_dim == totdim) { /* single item, assign directly */ - if(!check_item_type(py)) { + if (lvalue_dim == totdim) { /* single item, assign directly */ + if (!check_item_type(py)) { PyErr_Format(PyExc_TypeError, "%s %.200s.%.200s, expected a %s type, not %s", error_prefix, RNA_struct_identifier(ptr->type), RNA_property_identifier(prop), item_type_str, @@ -628,7 +628,7 @@ int pyrna_array_contains_py(PointerRNA *ptr, PropertyRNA *prop, PyObject *value) int type; int i; - if(len==0) /* possible with dynamic arrays */ + if (len==0) /* possible with dynamic arrays */ return 0; if (RNA_property_array_dimension(ptr, prop, NULL) > 1) { @@ -642,7 +642,7 @@ int pyrna_array_contains_py(PointerRNA *ptr, PropertyRNA *prop, PyObject *value) case PROP_FLOAT: { float value_f= PyFloat_AsDouble(value); - if(value_f==-1 && PyErr_Occurred()) { + if (value_f==-1 && PyErr_Occurred()) { PyErr_Clear(); return 0; } @@ -650,7 +650,7 @@ int pyrna_array_contains_py(PointerRNA *ptr, PropertyRNA *prop, PyObject *value) float tmp[32]; float *tmp_arr; - if(len * sizeof(float) > sizeof(tmp)) { + if (len * sizeof(float) > sizeof(tmp)) { tmp_arr= PyMem_MALLOC(len * sizeof(float)); } else { @@ -659,11 +659,13 @@ int pyrna_array_contains_py(PointerRNA *ptr, PropertyRNA *prop, PyObject *value) RNA_property_float_get_array(ptr, prop, tmp_arr); - for(i=0; i sizeof(tmp)) { + if (len * sizeof(int) > sizeof(tmp)) { tmp_arr= PyMem_MALLOC(len * sizeof(int)); } else { tmp_arr= tmp; } - if(type==PROP_BOOLEAN) + if (type==PROP_BOOLEAN) RNA_property_boolean_get_array(ptr, prop, tmp_arr); else RNA_property_int_get_array(ptr, prop, tmp_arr); - for(i=0; itb_next) { + for (tb= (PyTracebackObject *)PySys_GetObject("last_traceback"); tb && (PyObject *)tb != Py_None; tb= tb->tb_next) { PyObject *coerce; const char *tb_filepath= traceback_filepath(tb, &coerce); const int match= strcmp(tb_filepath, filepath) != 0; Py_DECREF(coerce); - if(match) { + if (match) { *lineno= tb->tb_lineno; break; } diff --git a/source/blender/python/intern/bpy_util.c b/source/blender/python/intern/bpy_util.c index 1450621d59e..516a9e49a39 100644 --- a/source/blender/python/intern/bpy_util.c +++ b/source/blender/python/intern/bpy_util.c @@ -48,7 +48,7 @@ char *BPy_enum_as_string(EnumPropertyItem *item) char *cstring; for (e= item; item->identifier; item++) { - if(item->identifier[0]) + if (item->identifier[0]) BLI_dynstr_appendf(dynstr, (e==item)?"'%s'":", '%s'", item->identifier); } @@ -63,11 +63,11 @@ short BPy_reports_to_error(ReportList *reports, PyObject *exception, const short report_str= BKE_reports_string(reports, RPT_ERROR); - if(clear) { + if (clear) { BKE_reports_clear(reports); } - if(report_str) { + if (report_str) { PyErr_SetString(exception, report_str); MEM_freeN(report_str); } @@ -89,7 +89,7 @@ short BPy_errors_to_report(ReportList *reports) return 1; /* less hassle if we allow NULL */ - if(reports==NULL) { + if (reports==NULL) { PyErr_Print(); PyErr_Clear(); return 1; @@ -97,13 +97,13 @@ short BPy_errors_to_report(ReportList *reports) pystring= PyC_ExceptionBuffer(); - if(pystring==NULL) { + if (pystring==NULL) { BKE_report(reports, RPT_ERROR, "unknown py-exception, couldn't convert"); return 0; } PyC_FileAndNum(&filename, &lineno); - if(filename==NULL) + if (filename==NULL) filename= ""; cstring= _PyUnicode_AsString(pystring); diff --git a/source/blender/python/intern/gpu.c b/source/blender/python/intern/gpu.c index 8fa6a7b0629..b4363716d86 100644 --- a/source/blender/python/intern/gpu.c +++ b/source/blender/python/intern/gpu.c @@ -77,7 +77,7 @@ PyInit_gpu(void) PyObject* m; m = PyModule_Create(&gpumodule); - if(m == NULL) + if (m == NULL) return NULL; // device constants @@ -164,7 +164,7 @@ static PyObject* GPU_export_shader(PyObject* UNUSED(self), PyObject *args, PyObj static const char *kwlist[] = {"scene", "material", NULL}; - if(!PyArg_ParseTupleAndKeywords(args, kwds, "OO:export_shader", (char**)(kwlist), &pyscene, &pymat)) + if (!PyArg_ParseTupleAndKeywords(args, kwds, "OO:export_shader", (char**)(kwlist), &pyscene, &pymat)) return NULL; if (!strcmp(Py_TYPE(pyscene)->tp_name, "Scene") && diff --git a/source/blender/python/mathutils/mathutils.c b/source/blender/python/mathutils/mathutils.c index 9adeae9dc29..34575a8d886 100644 --- a/source/blender/python/mathutils/mathutils.c +++ b/source/blender/python/mathutils/mathutils.c @@ -49,14 +49,14 @@ static int mathutils_array_parse_fast(float *array, int array_min, int array_max int i, size; /* non list/tuple cases */ - if(!(value_fast=PySequence_Fast(value, error_prefix))) { + if (!(value_fast=PySequence_Fast(value, error_prefix))) { /* PySequence_Fast sets the error */ return -1; } size= PySequence_Fast_GET_SIZE(value_fast); - if(size > array_max || size < array_min) { + if (size > array_max || size < array_min) { if (array_max == array_min) { PyErr_Format(PyExc_ValueError, "%.200s: sequence size is %d, expected %d", @@ -74,7 +74,7 @@ static int mathutils_array_parse_fast(float *array, int array_min, int array_max i= size; do { i--; - if(((array[i]= PyFloat_AsDouble((item= PySequence_Fast_GET_ITEM(value_fast, i)))) == -1.0f) && PyErr_Occurred()) { + if (((array[i]= PyFloat_AsDouble((item= PySequence_Fast_GET_ITEM(value_fast, i)))) == -1.0f) && PyErr_Occurred()) { PyErr_Format(PyExc_TypeError, "%.200s: sequence index %d expected a number, " "found '%.200s' type, ", @@ -82,7 +82,7 @@ static int mathutils_array_parse_fast(float *array, int array_min, int array_max Py_DECREF(value_fast); return -1; } - } while(i); + } while (i); Py_XDECREF(value_fast); return size; @@ -94,16 +94,16 @@ int mathutils_array_parse(float *array, int array_min, int array_max, PyObject * #if 1 /* approx 6x speedup for mathutils types */ int size; - if( (size= VectorObject_Check(value) ? ((VectorObject *)value)->size : 0) || + if ( (size= VectorObject_Check(value) ? ((VectorObject *)value)->size : 0) || (size= EulerObject_Check(value) ? 3 : 0) || (size= QuaternionObject_Check(value) ? 4 : 0) || (size= ColorObject_Check(value) ? 3 : 0)) { - if(BaseMath_ReadCallback((BaseMathObject *)value) == -1) { + if (BaseMath_ReadCallback((BaseMathObject *)value) == -1) { return -1; } - if(size > array_max || size < array_min) { + if (size > array_max || size < array_min) { if (array_max == array_min) { PyErr_Format(PyExc_ValueError, "%.200s: sequence size is %d, expected %d", @@ -129,8 +129,8 @@ int mathutils_array_parse(float *array, int array_min, int array_max, PyObject * int mathutils_any_to_rotmat(float rmat[3][3], PyObject *value, const char *error_prefix) { - if(EulerObject_Check(value)) { - if(BaseMath_ReadCallback((BaseMathObject *)value) == -1) { + if (EulerObject_Check(value)) { + if (BaseMath_ReadCallback((BaseMathObject *)value) == -1) { return -1; } else { @@ -139,7 +139,7 @@ int mathutils_any_to_rotmat(float rmat[3][3], PyObject *value, const char *error } } else if (QuaternionObject_Check(value)) { - if(BaseMath_ReadCallback((BaseMathObject *)value) == -1) { + if (BaseMath_ReadCallback((BaseMathObject *)value) == -1) { return -1; } else { @@ -150,10 +150,10 @@ int mathutils_any_to_rotmat(float rmat[3][3], PyObject *value, const char *error } } else if (MatrixObject_Check(value)) { - if(BaseMath_ReadCallback((BaseMathObject *)value) == -1) { + if (BaseMath_ReadCallback((BaseMathObject *)value) == -1) { return -1; } - else if(((MatrixObject *)value)->col_size < 3 || ((MatrixObject *)value)->row_size < 3) { + else if (((MatrixObject *)value)->col_size < 3 || ((MatrixObject *)value)->row_size < 3) { PyErr_Format(PyExc_ValueError, "%.200s: matrix must have minimum 3x3 dimensions", error_prefix); @@ -202,7 +202,7 @@ int EXPP_FloatsAreEqual(float af, float bf, int maxDiff) int EXPP_VectorsAreEqual(float *vecA, float *vecB, int size, int floatSteps) { int x; - for (x=0; x< size; x++){ + for (x=0; x< size; x++) { if (EXPP_FloatsAreEqual(vecA[x], vecB[x], floatSteps) == 0) return 0; } @@ -220,8 +220,8 @@ int Mathutils_RegisterCallback(Mathutils_Callback *cb) int i; /* find the first free slot */ - for(i= 0; mathutils_callbacks[i]; i++) { - if(mathutils_callbacks[i]==cb) /* already registered? */ + for (i= 0; mathutils_callbacks[i]; i++) { + if (mathutils_callbacks[i]==cb) /* already registered? */ return i; } @@ -233,10 +233,10 @@ int Mathutils_RegisterCallback(Mathutils_Callback *cb) int _BaseMathObject_ReadCallback(BaseMathObject *self) { Mathutils_Callback *cb= mathutils_callbacks[self->cb_type]; - if(cb->get(self, self->cb_subtype) != -1) + if (cb->get(self, self->cb_subtype) != -1) return 0; - if(!PyErr_Occurred()) { + if (!PyErr_Occurred()) { PyErr_Format(PyExc_RuntimeError, "%s read, user has become invalid", Py_TYPE(self)->tp_name); @@ -247,10 +247,10 @@ int _BaseMathObject_ReadCallback(BaseMathObject *self) int _BaseMathObject_WriteCallback(BaseMathObject *self) { Mathutils_Callback *cb= mathutils_callbacks[self->cb_type]; - if(cb->set(self, self->cb_subtype) != -1) + if (cb->set(self, self->cb_subtype) != -1) return 0; - if(!PyErr_Occurred()) { + if (!PyErr_Occurred()) { PyErr_Format(PyExc_RuntimeError, "%s write, user has become invalid", Py_TYPE(self)->tp_name); @@ -261,10 +261,10 @@ int _BaseMathObject_WriteCallback(BaseMathObject *self) int _BaseMathObject_ReadIndexCallback(BaseMathObject *self, int index) { Mathutils_Callback *cb= mathutils_callbacks[self->cb_type]; - if(cb->get_index(self, self->cb_subtype, index) != -1) + if (cb->get_index(self, self->cb_subtype, index) != -1) return 0; - if(!PyErr_Occurred()) { + if (!PyErr_Occurred()) { PyErr_Format(PyExc_RuntimeError, "%s read index, user has become invalid", Py_TYPE(self)->tp_name); @@ -275,10 +275,10 @@ int _BaseMathObject_ReadIndexCallback(BaseMathObject *self, int index) int _BaseMathObject_WriteIndexCallback(BaseMathObject *self, int index) { Mathutils_Callback *cb= mathutils_callbacks[self->cb_type]; - if(cb->set_index(self, self->cb_subtype, index) != -1) + if (cb->set_index(self, self->cb_subtype, index) != -1) return 0; - if(!PyErr_Occurred()) { + if (!PyErr_Occurred()) { PyErr_Format(PyExc_RuntimeError, "%s write index, user has become invalid", Py_TYPE(self)->tp_name); @@ -316,11 +316,11 @@ int BaseMathObject_clear(BaseMathObject *self) void BaseMathObject_dealloc(BaseMathObject *self) { /* only free non wrapped */ - if(self->wrapped != Py_WRAP) { + if (self->wrapped != Py_WRAP) { PyMem_Free(self->data); } - if(self->cb_user) { + if (self->cb_user) { PyObject_GC_UnTrack(self); BaseMathObject_clear(self); } @@ -350,15 +350,15 @@ PyMODINIT_FUNC PyInit_mathutils(void) PyObject *submodule; PyObject *item; - if(PyType_Ready(&vector_Type) < 0) + if (PyType_Ready(&vector_Type) < 0) return NULL; - if(PyType_Ready(&matrix_Type) < 0) + if (PyType_Ready(&matrix_Type) < 0) return NULL; - if(PyType_Ready(&euler_Type) < 0) + if (PyType_Ready(&euler_Type) < 0) return NULL; - if(PyType_Ready(&quaternion_Type) < 0) + if (PyType_Ready(&quaternion_Type) < 0) return NULL; - if(PyType_Ready(&color_Type) < 0) + if (PyType_Ready(&color_Type) < 0) return NULL; submodule = PyModule_Create(&M_Mathutils_module_def); diff --git a/source/blender/python/mathutils/mathutils_Color.c b/source/blender/python/mathutils/mathutils_Color.c index d0c7ec72cea..f7cc1d4271a 100644 --- a/source/blender/python/mathutils/mathutils_Color.c +++ b/source/blender/python/mathutils/mathutils_Color.c @@ -42,7 +42,7 @@ static PyObject *Color_new(PyTypeObject *type, PyObject *args, PyObject *kwds) { float col[3]= {0.0f, 0.0f, 0.0f}; - if(kwds && PyDict_Size(kwds)) { + if (kwds && PyDict_Size(kwds)) { PyErr_SetString(PyExc_TypeError, "mathutils.Color(): " "takes no keyword args"); @@ -53,7 +53,7 @@ static PyObject *Color_new(PyTypeObject *type, PyObject *args, PyObject *kwds) case 0: break; case 1: - if((mathutils_array_parse(col, COLOR_SIZE, COLOR_SIZE, PyTuple_GET_ITEM(args, 0), "mathutils.Color()")) == -1) + if ((mathutils_array_parse(col, COLOR_SIZE, COLOR_SIZE, PyTuple_GET_ITEM(args, 0), "mathutils.Color()")) == -1) return NULL; break; default: @@ -75,13 +75,13 @@ static PyObject *Color_ToTupleExt(ColorObject *self, int ndigits) ret= PyTuple_New(COLOR_SIZE); - if(ndigits >= 0) { - for(i= 0; i < COLOR_SIZE; i++) { + if (ndigits >= 0) { + for (i= 0; i < COLOR_SIZE; i++) { PyTuple_SET_ITEM(ret, i, PyFloat_FromDouble(double_round((double)self->col[i], ndigits))); } } else { - for(i= 0; i < COLOR_SIZE; i++) { + for (i= 0; i < COLOR_SIZE; i++) { PyTuple_SET_ITEM(ret, i, PyFloat_FromDouble(self->col[i])); } } @@ -102,7 +102,7 @@ PyDoc_STRVAR(Color_copy_doc, ); static PyObject *Color_copy(ColorObject *self) { - if(BaseMath_ReadCallback(self) == -1) + if (BaseMath_ReadCallback(self) == -1) return NULL; return newColorObject(self->col, Py_NEW, Py_TYPE(self)); @@ -115,7 +115,7 @@ static PyObject *Color_repr(ColorObject * self) { PyObject *ret, *tuple; - if(BaseMath_ReadCallback(self) == -1) + if (BaseMath_ReadCallback(self) == -1) return NULL; tuple= Color_ToTupleExt(self, -1); @@ -137,7 +137,7 @@ static PyObject* Color_richcmpr(PyObject *a, PyObject *b, int op) ColorObject *colA= (ColorObject*)a; ColorObject *colB= (ColorObject*)b; - if(BaseMath_ReadCallback(colA) == -1 || BaseMath_ReadCallback(colB) == -1) + if (BaseMath_ReadCallback(colA) == -1 || BaseMath_ReadCallback(colB) == -1) return NULL; ok= EXPP_VectorsAreEqual(colA->col, colB->col, COLOR_SIZE, 1) ? 0 : -1; @@ -175,16 +175,16 @@ static int Color_len(ColorObject *UNUSED(self)) //sequence accessor (get) static PyObject *Color_item(ColorObject * self, int i) { - if(i<0) i= COLOR_SIZE-i; + if (i<0) i= COLOR_SIZE-i; - if(i < 0 || i >= COLOR_SIZE) { + if (i < 0 || i >= COLOR_SIZE) { PyErr_SetString(PyExc_IndexError, "color[attribute]: " "array index out of range"); return NULL; } - if(BaseMath_ReadIndexCallback(self, i) == -1) + if (BaseMath_ReadIndexCallback(self, i) == -1) return NULL; return PyFloat_FromDouble(self->col[i]); @@ -196,16 +196,16 @@ static int Color_ass_item(ColorObject * self, int i, PyObject *value) { float f = PyFloat_AsDouble(value); - if(f == -1 && PyErr_Occurred()) { // parsed item not a number + if (f == -1 && PyErr_Occurred()) { // parsed item not a number PyErr_SetString(PyExc_TypeError, "color[attribute] = x: " "argument not a number"); return -1; } - if(i<0) i= COLOR_SIZE-i; + if (i<0) i= COLOR_SIZE-i; - if(i < 0 || i >= COLOR_SIZE){ + if (i < 0 || i >= COLOR_SIZE) { PyErr_SetString(PyExc_IndexError, "color[attribute] = x: " "array assignment index out of range"); return -1; @@ -213,7 +213,7 @@ static int Color_ass_item(ColorObject * self, int i, PyObject *value) self->col[i] = f; - if(BaseMath_WriteIndexCallback(self, i) == -1) + if (BaseMath_WriteIndexCallback(self, i) == -1) return -1; return 0; @@ -225,7 +225,7 @@ static PyObject *Color_slice(ColorObject * self, int begin, int end) PyObject *tuple; int count; - if(BaseMath_ReadCallback(self) == -1) + if (BaseMath_ReadCallback(self) == -1) return NULL; CLAMP(begin, 0, COLOR_SIZE); @@ -234,7 +234,7 @@ static PyObject *Color_slice(ColorObject * self, int begin, int end) begin= MIN2(begin, end); tuple= PyTuple_New(end - begin); - for(count= begin; count < end; count++) { + for (count= begin; count < end; count++) { PyTuple_SET_ITEM(tuple, count - begin, PyFloat_FromDouble(self->col[count])); } @@ -247,7 +247,7 @@ static int Color_ass_slice(ColorObject *self, int begin, int end, PyObject *seq) int i, size; float col[COLOR_SIZE]; - if(BaseMath_ReadCallback(self) == -1) + if (BaseMath_ReadCallback(self) == -1) return -1; CLAMP(begin, 0, COLOR_SIZE); @@ -255,17 +255,17 @@ static int Color_ass_slice(ColorObject *self, int begin, int end, PyObject *seq) CLAMP(end, 0, COLOR_SIZE); begin = MIN2(begin, end); - if((size=mathutils_array_parse(col, 0, COLOR_SIZE, seq, "mathutils.Color[begin:end] = []")) == -1) + if ((size=mathutils_array_parse(col, 0, COLOR_SIZE, seq, "mathutils.Color[begin:end] = []")) == -1) return -1; - if(size != (end - begin)){ + if (size != (end - begin)) { PyErr_SetString(PyExc_ValueError, "color[begin:end] = []: " "size mismatch in slice assignment"); return -1; } - for(i= 0; i < COLOR_SIZE; i++) + for (i= 0; i < COLOR_SIZE; i++) self->col[begin + i] = col[i]; (void)BaseMath_WriteCallback(self); @@ -379,7 +379,7 @@ static PyObject *Color_add(PyObject *v1, PyObject *v2) color1 = (ColorObject*)v1; color2 = (ColorObject*)v2; - if(BaseMath_ReadCallback(color1) == -1 || BaseMath_ReadCallback(color2) == -1) + if (BaseMath_ReadCallback(color1) == -1 || BaseMath_ReadCallback(color2) == -1) return NULL; add_vn_vnvn(col, color1->col, color2->col, COLOR_SIZE); @@ -401,7 +401,7 @@ static PyObject *Color_iadd(PyObject *v1, PyObject *v2) color1 = (ColorObject*)v1; color2 = (ColorObject*)v2; - if(BaseMath_ReadCallback(color1) == -1 || BaseMath_ReadCallback(color2) == -1) + if (BaseMath_ReadCallback(color1) == -1 || BaseMath_ReadCallback(color2) == -1) return NULL; add_vn_vn(color1->col, color2->col, COLOR_SIZE); @@ -426,7 +426,7 @@ static PyObject *Color_sub(PyObject *v1, PyObject *v2) color1 = (ColorObject*)v1; color2 = (ColorObject*)v2; - if(BaseMath_ReadCallback(color1) == -1 || BaseMath_ReadCallback(color2) == -1) + if (BaseMath_ReadCallback(color1) == -1 || BaseMath_ReadCallback(color2) == -1) return NULL; sub_vn_vnvn(col, color1->col, color2->col, COLOR_SIZE); @@ -448,7 +448,7 @@ static PyObject *Color_isub(PyObject *v1, PyObject *v2) color1 = (ColorObject*)v1; color2 = (ColorObject*)v2; - if(BaseMath_ReadCallback(color1) == -1 || BaseMath_ReadCallback(color2) == -1) + if (BaseMath_ReadCallback(color1) == -1 || BaseMath_ReadCallback(color2) == -1) return NULL; sub_vn_vn(color1->col, color2->col, COLOR_SIZE); @@ -473,12 +473,12 @@ static PyObject *Color_mul(PyObject *v1, PyObject *v2) if ColorObject_Check(v1) { color1= (ColorObject *)v1; - if(BaseMath_ReadCallback(color1) == -1) + if (BaseMath_ReadCallback(color1) == -1) return NULL; } if ColorObject_Check(v2) { color2= (ColorObject *)v2; - if(BaseMath_ReadCallback(color2) == -1) + if (BaseMath_ReadCallback(color2) == -1) return NULL; } @@ -515,7 +515,7 @@ static PyObject *Color_div(PyObject *v1, PyObject *v2) if ColorObject_Check(v1) { color1= (ColorObject *)v1; - if(BaseMath_ReadCallback(color1) == -1) + if (BaseMath_ReadCallback(color1) == -1) return NULL; } else { @@ -526,7 +526,7 @@ static PyObject *Color_div(PyObject *v1, PyObject *v2) /* make sure v1 is always the vector */ if (((scalar= PyFloat_AsDouble(v2)) == -1.0f && PyErr_Occurred())==0) { /* COLOR * FLOAT */ - if(scalar==0.0f) { + if (scalar==0.0f) { PyErr_SetString(PyExc_ZeroDivisionError, "Color division: divide by zero error"); return NULL; @@ -547,7 +547,7 @@ static PyObject *Color_imul(PyObject *v1, PyObject *v2) ColorObject *color = (ColorObject *)v1; float scalar; - if(BaseMath_ReadCallback(color) == -1) + if (BaseMath_ReadCallback(color) == -1) return NULL; /* only support color *= float */ @@ -572,12 +572,12 @@ static PyObject *Color_idiv(PyObject *v1, PyObject *v2) ColorObject *color = (ColorObject *)v1; float scalar; - if(BaseMath_ReadCallback(color) == -1) + if (BaseMath_ReadCallback(color) == -1) return NULL; /* only support color /= float */ if (((scalar= PyFloat_AsDouble(v2)) == -1.0f && PyErr_Occurred())==0) { /* COLOR /= FLOAT */ - if(scalar==0.0f) { + if (scalar==0.0f) { PyErr_SetString(PyExc_ZeroDivisionError, "Color division: divide by zero error"); return NULL; @@ -603,7 +603,7 @@ static PyObject *Color_neg(ColorObject *self) { float tcol[COLOR_SIZE]; - if(BaseMath_ReadCallback(self) == -1) + if (BaseMath_ReadCallback(self) == -1) return NULL; negate_vn_vn(tcol, self->col, COLOR_SIZE); @@ -665,7 +665,7 @@ static PyObject *Color_getChannelHSV(ColorObject * self, void *type) float hsv[3]; int i= GET_INT_FROM_POINTER(type); - if(BaseMath_ReadCallback(self) == -1) + if (BaseMath_ReadCallback(self) == -1) return NULL; rgb_to_hsv(self->col[0], self->col[1], self->col[2], &(hsv[0]), &(hsv[1]), &(hsv[2])); @@ -679,14 +679,14 @@ static int Color_setChannelHSV(ColorObject * self, PyObject *value, void * type) int i= GET_INT_FROM_POINTER(type); float f = PyFloat_AsDouble(value); - if(f == -1 && PyErr_Occurred()) { + if (f == -1 && PyErr_Occurred()) { PyErr_SetString(PyExc_TypeError, "color.h/s/v = value: " "argument not a number"); return -1; } - if(BaseMath_ReadCallback(self) == -1) + if (BaseMath_ReadCallback(self) == -1) return -1; rgb_to_hsv(self->col[0], self->col[1], self->col[2], &(hsv[0]), &(hsv[1]), &(hsv[2])); @@ -694,7 +694,7 @@ static int Color_setChannelHSV(ColorObject * self, PyObject *value, void * type) hsv[i] = f; hsv_to_rgb(hsv[0], hsv[1], hsv[2], &(self->col[0]), &(self->col[1]), &(self->col[2])); - if(BaseMath_WriteCallback(self) == -1) + if (BaseMath_WriteCallback(self) == -1) return -1; return 0; @@ -706,7 +706,7 @@ static PyObject *Color_getHSV(ColorObject * self, void *UNUSED(closure)) float hsv[3]; PyObject *ret; - if(BaseMath_ReadCallback(self) == -1) + if (BaseMath_ReadCallback(self) == -1) return NULL; rgb_to_hsv(self->col[0], self->col[1], self->col[2], &(hsv[0]), &(hsv[1]), &(hsv[2])); @@ -722,7 +722,7 @@ static int Color_setHSV(ColorObject * self, PyObject *value, void *UNUSED(closur { float hsv[3]; - if(mathutils_array_parse(hsv, 3, 3, value, "mathutils.Color.hsv = value") == -1) + if (mathutils_array_parse(hsv, 3, 3, value, "mathutils.Color.hsv = value") == -1) return -1; CLAMP(hsv[0], 0.0f, 1.0f); @@ -731,7 +731,7 @@ static int Color_setHSV(ColorObject * self, PyObject *value, void *UNUSED(closur hsv_to_rgb(hsv[0], hsv[1], hsv[2], &(self->col[0]), &(self->col[1]), &(self->col[2])); - if(BaseMath_WriteCallback(self) == -1) + if (BaseMath_WriteCallback(self) == -1) return -1; return 0; @@ -834,11 +834,11 @@ PyObject *newColorObject(float *col, int type, PyTypeObject *base_type) self->cb_user= NULL; self->cb_type= self->cb_subtype= 0; - if(type == Py_WRAP){ + if(type == Py_WRAP) { self->col = col; self->wrapped = Py_WRAP; } - else if (type == Py_NEW){ + else if (type == Py_NEW) { self->col = PyMem_Malloc(COLOR_SIZE * sizeof(float)); if(col) copy_v3_v3(self->col, col); diff --git a/source/blender/python/mathutils/mathutils_Euler.c b/source/blender/python/mathutils/mathutils_Euler.c index c96eafcd6ad..d9f741d841a 100644 --- a/source/blender/python/mathutils/mathutils_Euler.c +++ b/source/blender/python/mathutils/mathutils_Euler.c @@ -50,21 +50,21 @@ static PyObject *Euler_new(PyTypeObject *type, PyObject *args, PyObject *kwds) float eul[EULER_SIZE]= {0.0f, 0.0f, 0.0f}; short order= EULER_ORDER_XYZ; - if(kwds && PyDict_Size(kwds)) { + if (kwds && PyDict_Size(kwds)) { PyErr_SetString(PyExc_TypeError, "mathutils.Euler(): " "takes no keyword args"); return NULL; } - if(!PyArg_ParseTuple(args, "|Os:mathutils.Euler", &seq, &order_str)) + if (!PyArg_ParseTuple(args, "|Os:mathutils.Euler", &seq, &order_str)) return NULL; switch(PyTuple_GET_SIZE(args)) { case 0: break; case 2: - if((order=euler_order_from_string(order_str, "mathutils.Euler()")) == -1) + if ((order=euler_order_from_string(order_str, "mathutils.Euler()")) == -1) return NULL; /* intentionally pass through */ case 1: @@ -84,7 +84,7 @@ static const char *euler_order_str(EulerObject *self) short euler_order_from_string(const char *str, const char *error_prefix) { - if((str[0] && str[1] && str[2] && str[3]=='\0')) { + if ((str[0] && str[1] && str[2] && str[3]=='\0')) { switch(*((PY_INT32_T *)str)) { case 'X'|'Y'<<8|'Z'<<16: return EULER_ORDER_XYZ; case 'X'|'Z'<<8|'Y'<<16: return EULER_ORDER_XZY; @@ -109,13 +109,13 @@ static PyObject *Euler_ToTupleExt(EulerObject *self, int ndigits) ret= PyTuple_New(EULER_SIZE); - if(ndigits >= 0) { - for(i= 0; i < EULER_SIZE; i++) { + if (ndigits >= 0) { + for (i= 0; i < EULER_SIZE; i++) { PyTuple_SET_ITEM(ret, i, PyFloat_FromDouble(double_round((double)self->eul[i], ndigits))); } } else { - for(i= 0; i < EULER_SIZE; i++) { + for (i= 0; i < EULER_SIZE; i++) { PyTuple_SET_ITEM(ret, i, PyFloat_FromDouble(self->eul[i])); } } @@ -138,7 +138,7 @@ static PyObject *Euler_to_quaternion(EulerObject * self) { float quat[4]; - if(BaseMath_ReadCallback(self) == -1) + if (BaseMath_ReadCallback(self) == -1) return NULL; eulO_to_quat(quat, self->eul, self->order); @@ -159,7 +159,7 @@ static PyObject *Euler_to_matrix(EulerObject * self) { float mat[9]; - if(BaseMath_ReadCallback(self) == -1) + if (BaseMath_ReadCallback(self) == -1) return NULL; eulO_to_mat3((float (*)[3])mat, self->eul, self->order); @@ -176,7 +176,7 @@ static PyObject *Euler_zero(EulerObject * self) { zero_v3(self->eul); - if(BaseMath_WriteCallback(self) == -1) + if (BaseMath_WriteCallback(self) == -1) return NULL; Py_RETURN_NONE; @@ -198,21 +198,21 @@ static PyObject *Euler_rotate_axis(EulerObject * self, PyObject *args) float angle = 0.0f; int axis; /* actually a character */ - if(!PyArg_ParseTuple(args, "Cf:rotate", &axis, &angle)){ + if (!PyArg_ParseTuple(args, "Cf:rotate", &axis, &angle)) { PyErr_SetString(PyExc_TypeError, "Euler.rotate_axis(): " "expected an axis 'X', 'Y', 'Z' and an angle (float)"); return NULL; } - if(!(ELEM3(axis, 'X', 'Y', 'Z'))){ + if (!(ELEM3(axis, 'X', 'Y', 'Z'))) { PyErr_SetString(PyExc_ValueError, "Euler.rotate_axis(): " "expected axis to be 'X', 'Y' or 'Z'"); return NULL; } - if(BaseMath_ReadCallback(self) == -1) + if (BaseMath_ReadCallback(self) == -1) return NULL; @@ -235,10 +235,10 @@ static PyObject *Euler_rotate(EulerObject * self, PyObject *value) { float self_rmat[3][3], other_rmat[3][3], rmat[3][3]; - if(BaseMath_ReadCallback(self) == -1) + if (BaseMath_ReadCallback(self) == -1) return NULL; - if(mathutils_any_to_rotmat(other_rmat, value, "euler.rotate(value)") == -1) + if (mathutils_any_to_rotmat(other_rmat, value, "euler.rotate(value)") == -1) return NULL; eulO_to_mat3(self_rmat, self->eul, self->order); @@ -262,10 +262,10 @@ static PyObject *Euler_make_compatible(EulerObject * self, PyObject *value) { float teul[EULER_SIZE]; - if(BaseMath_ReadCallback(self) == -1) + if (BaseMath_ReadCallback(self) == -1) return NULL; - if(mathutils_array_parse(teul, EULER_SIZE, EULER_SIZE, value, "euler.make_compatible(other), invalid 'other' arg") == -1) + if (mathutils_array_parse(teul, EULER_SIZE, EULER_SIZE, value, "euler.make_compatible(other), invalid 'other' arg") == -1) return NULL; compatible_eul(self->eul, teul); @@ -291,7 +291,7 @@ PyDoc_STRVAR(Euler_copy_doc, ); static PyObject *Euler_copy(EulerObject *self) { - if(BaseMath_ReadCallback(self) == -1) + if (BaseMath_ReadCallback(self) == -1) return NULL; return newEulerObject(self->eul, self->order, Py_NEW, Py_TYPE(self)); @@ -304,7 +304,7 @@ static PyObject *Euler_repr(EulerObject * self) { PyObject *ret, *tuple; - if(BaseMath_ReadCallback(self) == -1) + if (BaseMath_ReadCallback(self) == -1) return NULL; tuple= Euler_ToTupleExt(self, -1); @@ -324,7 +324,7 @@ static PyObject* Euler_richcmpr(PyObject *a, PyObject *b, int op) EulerObject *eulA= (EulerObject*)a; EulerObject *eulB= (EulerObject*)b; - if(BaseMath_ReadCallback(eulA) == -1 || BaseMath_ReadCallback(eulB) == -1) + if (BaseMath_ReadCallback(eulA) == -1 || BaseMath_ReadCallback(eulB) == -1) return NULL; ok= ((eulA->order == eulB->order) && EXPP_VectorsAreEqual(eulA->eul, eulB->eul, EULER_SIZE, 1)) ? 0 : -1; @@ -362,16 +362,16 @@ static int Euler_len(EulerObject *UNUSED(self)) //sequence accessor (get) static PyObject *Euler_item(EulerObject * self, int i) { - if(i<0) i= EULER_SIZE-i; + if (i<0) i= EULER_SIZE-i; - if(i < 0 || i >= EULER_SIZE) { + if (i < 0 || i >= EULER_SIZE) { PyErr_SetString(PyExc_IndexError, "euler[attribute]: " "array index out of range"); return NULL; } - if(BaseMath_ReadIndexCallback(self, i) == -1) + if (BaseMath_ReadIndexCallback(self, i) == -1) return NULL; return PyFloat_FromDouble(self->eul[i]); @@ -383,16 +383,16 @@ static int Euler_ass_item(EulerObject * self, int i, PyObject *value) { float f = PyFloat_AsDouble(value); - if(f == -1 && PyErr_Occurred()) { // parsed item not a number + if (f == -1 && PyErr_Occurred()) { // parsed item not a number PyErr_SetString(PyExc_TypeError, "euler[attribute] = x: " "argument not a number"); return -1; } - if(i<0) i= EULER_SIZE-i; + if (i<0) i= EULER_SIZE-i; - if(i < 0 || i >= EULER_SIZE){ + if (i < 0 || i >= EULER_SIZE) { PyErr_SetString(PyExc_IndexError, "euler[attribute] = x: " "array assignment index out of range"); @@ -401,7 +401,7 @@ static int Euler_ass_item(EulerObject * self, int i, PyObject *value) self->eul[i] = f; - if(BaseMath_WriteIndexCallback(self, i) == -1) + if (BaseMath_WriteIndexCallback(self, i) == -1) return -1; return 0; @@ -413,7 +413,7 @@ static PyObject *Euler_slice(EulerObject * self, int begin, int end) PyObject *tuple; int count; - if(BaseMath_ReadCallback(self) == -1) + if (BaseMath_ReadCallback(self) == -1) return NULL; CLAMP(begin, 0, EULER_SIZE); @@ -422,7 +422,7 @@ static PyObject *Euler_slice(EulerObject * self, int begin, int end) begin= MIN2(begin, end); tuple= PyTuple_New(end - begin); - for(count = begin; count < end; count++) { + for (count = begin; count < end; count++) { PyTuple_SET_ITEM(tuple, count - begin, PyFloat_FromDouble(self->eul[count])); } @@ -435,7 +435,7 @@ static int Euler_ass_slice(EulerObject *self, int begin, int end, PyObject *seq) int i, size; float eul[EULER_SIZE]; - if(BaseMath_ReadCallback(self) == -1) + if (BaseMath_ReadCallback(self) == -1) return -1; CLAMP(begin, 0, EULER_SIZE); @@ -443,17 +443,17 @@ static int Euler_ass_slice(EulerObject *self, int begin, int end, PyObject *seq) CLAMP(end, 0, EULER_SIZE); begin = MIN2(begin, end); - if((size=mathutils_array_parse(eul, 0, EULER_SIZE, seq, "mathutils.Euler[begin:end] = []")) == -1) + if ((size=mathutils_array_parse(eul, 0, EULER_SIZE, seq, "mathutils.Euler[begin:end] = []")) == -1) return -1; - if(size != (end - begin)){ + if (size != (end - begin)) { PyErr_SetString(PyExc_ValueError, "euler[begin:end] = []: " "size mismatch in slice assignment"); return -1; } - for(i= 0; i < EULER_SIZE; i++) + for (i= 0; i < EULER_SIZE; i++) self->eul[begin + i] = eul[i]; (void)BaseMath_WriteCallback(self); @@ -566,7 +566,7 @@ static int Euler_setAxis(EulerObject *self, PyObject *value, void *type) /* rotation order */ static PyObject *Euler_getOrder(EulerObject *self, void *UNUSED(closure)) { - if(BaseMath_ReadCallback(self) == -1) /* can read order too */ + if (BaseMath_ReadCallback(self) == -1) /* can read order too */ return NULL; return PyUnicode_FromString(euler_order_str(self)); @@ -577,7 +577,7 @@ static int Euler_setOrder(EulerObject *self, PyObject *value, void *UNUSED(closu const char *order_str= _PyUnicode_AsString(value); short order= euler_order_from_string(order_str, "euler.order"); - if(order == -1) + if (order == -1) return -1; self->order= order; @@ -678,18 +678,18 @@ PyObject *newEulerObject(float *eul, short order, int type, PyTypeObject *base_t self= base_type ? (EulerObject *)base_type->tp_alloc(base_type, 0) : (EulerObject *)PyObject_GC_New(EulerObject, &euler_Type); - if(self) { + if (self) { /* init callbacks as NULL */ self->cb_user= NULL; self->cb_type= self->cb_subtype= 0; - if(type == Py_WRAP) { + if (type == Py_WRAP) { self->eul = eul; self->wrapped = Py_WRAP; } else if (type == Py_NEW) { self->eul = PyMem_Malloc(EULER_SIZE * sizeof(float)); - if(eul) { + if (eul) { copy_v3_v3(self->eul, eul); } else { @@ -711,7 +711,7 @@ PyObject *newEulerObject(float *eul, short order, int type, PyTypeObject *base_t PyObject *newEulerObject_cb(PyObject *cb_user, short order, int cb_type, int cb_subtype) { EulerObject *self= (EulerObject *)newEulerObject(NULL, order, Py_NEW, NULL); - if(self) { + if (self) { Py_INCREF(cb_user); self->cb_user= cb_user; self->cb_type= (unsigned char)cb_type; diff --git a/source/blender/python/mathutils/mathutils_Matrix.c b/source/blender/python/mathutils/mathutils_Matrix.c index a2a15600965..b1700aa53c6 100644 --- a/source/blender/python/mathutils/mathutils_Matrix.c +++ b/source/blender/python/mathutils/mathutils_Matrix.c @@ -55,10 +55,10 @@ static int mathutils_matrix_vector_get(BaseMathObject *bmo, int subtype) MatrixObject *self= (MatrixObject *)bmo->cb_user; int i; - if(BaseMath_ReadCallback(self) == -1) + if (BaseMath_ReadCallback(self) == -1) return -1; - for(i=0; i < self->col_size; i++) + for (i=0; i < self->col_size; i++) bmo->data[i]= self->matrix[subtype][i]; return 0; @@ -69,10 +69,10 @@ static int mathutils_matrix_vector_set(BaseMathObject *bmo, int subtype) MatrixObject *self= (MatrixObject *)bmo->cb_user; int i; - if(BaseMath_ReadCallback(self) == -1) + if (BaseMath_ReadCallback(self) == -1) return -1; - for(i=0; i < self->col_size; i++) + for (i=0; i < self->col_size; i++) self->matrix[subtype][i]= bmo->data[i]; (void)BaseMath_WriteCallback(self); @@ -83,7 +83,7 @@ static int mathutils_matrix_vector_get_index(BaseMathObject *bmo, int subtype, i { MatrixObject *self= (MatrixObject *)bmo->cb_user; - if(BaseMath_ReadCallback(self) == -1) + if (BaseMath_ReadCallback(self) == -1) return -1; bmo->data[index]= self->matrix[subtype][index]; @@ -94,7 +94,7 @@ static int mathutils_matrix_vector_set_index(BaseMathObject *bmo, int subtype, i { MatrixObject *self= (MatrixObject *)bmo->cb_user; - if(BaseMath_ReadCallback(self) == -1) + if (BaseMath_ReadCallback(self) == -1) return -1; self->matrix[subtype][index]= bmo->data[index]; @@ -117,7 +117,7 @@ Mathutils_Callback mathutils_matrix_vector_cb = { //create a new matrix type static PyObject *Matrix_new(PyTypeObject *type, PyObject *args, PyObject *kwds) { - if(kwds && PyDict_Size(kwds)) { + if (kwds && PyDict_Size(kwds)) { PyErr_SetString(PyExc_TypeError, "Matrix(): " "takes no keyword args"); @@ -134,15 +134,15 @@ static PyObject *Matrix_new(PyTypeObject *type, PyObject *args, PyObject *kwds) /* -1 is an error, size checks will accunt for this */ const unsigned short row_size= PySequence_Size(arg); - if(row_size >= 2 && row_size <= 4) { + if (row_size >= 2 && row_size <= 4) { PyObject *item= PySequence_GetItem(arg, 0); const unsigned short col_size= PySequence_Size(item); Py_XDECREF(item); - if(col_size >= 2 && col_size <= 4) { + if (col_size >= 2 && col_size <= 4) { /* sane row & col size, new matrix and assign as slice */ PyObject *matrix= newMatrixObject(NULL, row_size, col_size, Py_NEW, type); - if(Matrix_ass_slice((MatrixObject *)matrix, 0, INT_MAX, arg) == 0) { + if (Matrix_ass_slice((MatrixObject *)matrix, 0, INT_MAX, arg) == 0) { return matrix; } else { /* matrix ok, slice assignment not */ @@ -164,7 +164,7 @@ static PyObject *matrix__apply_to_copy(PyNoArgsFunction matrix_func, MatrixObjec { PyObject *ret= Matrix_copy(self); PyObject *ret_dummy= matrix_func(ret); - if(ret_dummy) { + if (ret_dummy) { Py_DECREF(ret_dummy); return (PyObject *)ret; } @@ -214,16 +214,16 @@ static PyObject *C_Matrix_Rotation(PyObject *cls, PyObject *args) float mat[16] = {0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}; - if(!PyArg_ParseTuple(args, "di|O", &angle, &matSize, &vec)) { + if (!PyArg_ParseTuple(args, "di|O", &angle, &matSize, &vec)) { PyErr_SetString(PyExc_TypeError, "Matrix.Rotation(angle, size, axis): " "expected float int and a string or vector"); return NULL; } - if(vec && PyUnicode_Check(vec)) { + if (vec && PyUnicode_Check(vec)) { axis= _PyUnicode_AsString((PyObject *)vec); - if(axis==NULL || axis[0]=='\0' || axis[1]!='\0' || axis[0] < 'X' || axis[0] > 'Z') { + if (axis==NULL || axis[0]=='\0' || axis[1]!='\0' || axis[0] < 'X' || axis[0] > 'Z') { PyErr_SetString(PyExc_ValueError, "Matrix.Rotation(): " "3rd argument axis value must be a 3D vector " @@ -238,19 +238,19 @@ static PyObject *C_Matrix_Rotation(PyObject *cls, PyObject *args) angle= angle_wrap_rad(angle); - if(matSize != 2 && matSize != 3 && matSize != 4) { + if (matSize != 2 && matSize != 3 && matSize != 4) { PyErr_SetString(PyExc_ValueError, "Matrix.Rotation(): " "can only return a 2x2 3x3 or 4x4 matrix"); return NULL; } - if(matSize == 2 && (vec != NULL)) { + if (matSize == 2 && (vec != NULL)) { PyErr_SetString(PyExc_ValueError, "Matrix.Rotation(): " "cannot create a 2x2 rotation matrix around arbitrary axis"); return NULL; } - if((matSize == 3 || matSize == 4) && (axis == NULL) && (vec == NULL)) { + if ((matSize == 3 || matSize == 4) && (axis == NULL) && (vec == NULL)) { PyErr_SetString(PyExc_ValueError, "Matrix.Rotation(): " "axis of rotation for 3d and 4d matrices is required"); @@ -258,7 +258,7 @@ static PyObject *C_Matrix_Rotation(PyObject *cls, PyObject *args) } /* check for valid vector/axis above */ - if(vec) { + if (vec) { float tvec[3]; if (mathutils_array_parse(tvec, 3, 3, vec, "Matrix.Rotation(angle, size, axis), invalid 'axis' arg") == -1) @@ -281,7 +281,7 @@ static PyObject *C_Matrix_Rotation(PyObject *cls, PyObject *args) single_axis_angle_to_mat3((float (*)[3])mat, axis[0], angle); } - if(matSize == 4) { + if (matSize == 4) { matrix_3x3_as_4x4(mat); } //pass to matrix creation @@ -337,23 +337,23 @@ static PyObject *C_Matrix_Scale(PyObject *cls, PyObject *args) float mat[16] = {0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}; - if(!PyArg_ParseTuple(args, "fi|O:Matrix.Scale", &factor, &matSize, &vec)) { + if (!PyArg_ParseTuple(args, "fi|O:Matrix.Scale", &factor, &matSize, &vec)) { return NULL; } - if(matSize != 2 && matSize != 3 && matSize != 4) { + if (matSize != 2 && matSize != 3 && matSize != 4) { PyErr_SetString(PyExc_ValueError, "Matrix.Scale(): " "can only return a 2x2 3x3 or 4x4 matrix"); return NULL; } - if(vec) { + if (vec) { vec_size= (matSize == 2 ? 2 : 3); - if(mathutils_array_parse(tvec, vec_size, vec_size, vec, "Matrix.Scale(factor, size, axis), invalid 'axis' arg") == -1) { + if (mathutils_array_parse(tvec, vec_size, vec_size, vec, "Matrix.Scale(factor, size, axis), invalid 'axis' arg") == -1) { return NULL; } } - if(vec == NULL) { //scaling along axis - if(matSize == 2) { + if (vec == NULL) { //scaling along axis + if (matSize == 2) { mat[0] = factor; mat[3] = factor; } @@ -367,14 +367,14 @@ static PyObject *C_Matrix_Scale(PyObject *cls, PyObject *args) //normalize arbitrary axis float norm = 0.0f; int x; - for(x = 0; x < vec_size; x++) { + for (x = 0; x < vec_size; x++) { norm += tvec[x] * tvec[x]; } norm = (float) sqrt(norm); - for(x = 0; x < vec_size; x++) { + for (x = 0; x < vec_size; x++) { tvec[x] /= norm; } - if(matSize == 2) { + if (matSize == 2) { mat[0] = 1 + ((factor - 1) *(tvec[0] * tvec[0])); mat[1] = ((factor - 1) *(tvec[0] * tvec[1])); mat[2] = ((factor - 1) *(tvec[0] * tvec[1])); @@ -392,7 +392,7 @@ static PyObject *C_Matrix_Scale(PyObject *cls, PyObject *args) mat[8] = 1 + ((factor - 1) *(tvec[2] * tvec[2])); } } - if(matSize == 4) { + if (matSize == 4) { matrix_3x3_as_4x4(mat); } //pass to matrix creation @@ -423,21 +423,21 @@ static PyObject *C_Matrix_OrthoProjection(PyObject *cls, PyObject *args) float mat[16] = {0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}; - if(!PyArg_ParseTuple(args, "Oi:Matrix.OrthoProjection", &axis, &matSize)) { + if (!PyArg_ParseTuple(args, "Oi:Matrix.OrthoProjection", &axis, &matSize)) { return NULL; } - if(matSize != 2 && matSize != 3 && matSize != 4) { + if (matSize != 2 && matSize != 3 && matSize != 4) { PyErr_SetString(PyExc_ValueError, "Matrix.OrthoProjection(): " "can only return a 2x2 3x3 or 4x4 matrix"); return NULL; } - if(PyUnicode_Check(axis)) { //ortho projection onto cardinal plane + if (PyUnicode_Check(axis)) { //ortho projection onto cardinal plane Py_ssize_t plane_len; const char *plane= _PyUnicode_AsStringAndSize(axis, &plane_len); - if(matSize == 2) { - if(plane_len == 1 && plane[0]=='X') { + if (matSize == 2) { + if (plane_len == 1 && plane[0]=='X') { mat[0]= 1.0f; } else if (plane_len == 1 && plane[0]=='Y') { @@ -452,7 +452,7 @@ static PyObject *C_Matrix_OrthoProjection(PyObject *cls, PyObject *args) } } else { - if(plane_len == 2 && plane[0]=='X' && plane[1]=='Y') { + if (plane_len == 2 && plane[0]=='X' && plane[1]=='Y') { mat[0]= 1.0f; mat[4]= 1.0f; } @@ -479,25 +479,25 @@ static PyObject *C_Matrix_OrthoProjection(PyObject *cls, PyObject *args) int vec_size= (matSize == 2 ? 2 : 3); float tvec[4]; - if(mathutils_array_parse(tvec, vec_size, vec_size, axis, "Matrix.OrthoProjection(axis, size), invalid 'axis' arg") == -1) { + if (mathutils_array_parse(tvec, vec_size, vec_size, axis, "Matrix.OrthoProjection(axis, size), invalid 'axis' arg") == -1) { return NULL; } //normalize arbitrary axis - for(x = 0; x < vec_size; x++) { + for (x = 0; x < vec_size; x++) { norm += tvec[x] * tvec[x]; } norm = (float) sqrt(norm); - for(x = 0; x < vec_size; x++) { + for (x = 0; x < vec_size; x++) { tvec[x] /= norm; } - if(matSize == 2) { + if (matSize == 2) { mat[0] = 1 - (tvec[0] * tvec[0]); mat[1] = -(tvec[0] * tvec[1]); mat[2] = -(tvec[0] * tvec[1]); mat[3] = 1 - (tvec[1] * tvec[1]); } - else if(matSize > 2) { + else if (matSize > 2) { mat[0] = 1 - (tvec[0] * tvec[0]); mat[1] = -(tvec[0] * tvec[1]); mat[2] = -(tvec[0] * tvec[2]); @@ -509,7 +509,7 @@ static PyObject *C_Matrix_OrthoProjection(PyObject *cls, PyObject *args) mat[8] = 1 - (tvec[2] * tvec[2]); } } - if(matSize == 4) { + if (matSize == 4) { matrix_3x3_as_4x4(mat); } //pass to matrix creation @@ -540,20 +540,20 @@ static PyObject *C_Matrix_Shear(PyObject *cls, PyObject *args) float mat[16] = {0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}; - if(!PyArg_ParseTuple(args, "siO:Matrix.Shear", &plane, &matSize, &fac)) { + if (!PyArg_ParseTuple(args, "siO:Matrix.Shear", &plane, &matSize, &fac)) { return NULL; } - if(matSize != 2 && matSize != 3 && matSize != 4) { + if (matSize != 2 && matSize != 3 && matSize != 4) { PyErr_SetString(PyExc_ValueError, "Matrix.Shear(): " "can only return a 2x2 3x3 or 4x4 matrix"); return NULL; } - if(matSize == 2) { + if (matSize == 2) { float const factor= PyFloat_AsDouble(fac); - if(factor==-1.0f && PyErr_Occurred()) { + if (factor==-1.0f && PyErr_Occurred()) { PyErr_SetString(PyExc_TypeError, "Matrix.Shear(): " "the factor to be a float"); @@ -564,10 +564,10 @@ static PyObject *C_Matrix_Shear(PyObject *cls, PyObject *args) mat[0] = 1.0f; mat[3] = 1.0f; - if(strcmp(plane, "X") == 0) { + if (strcmp(plane, "X") == 0) { mat[2] = factor; } - else if(strcmp(plane, "Y") == 0) { + else if (strcmp(plane, "Y") == 0) { mat[1] = factor; } else { @@ -581,7 +581,7 @@ static PyObject *C_Matrix_Shear(PyObject *cls, PyObject *args) /* 3 or 4, apply as 3x3, resize later if needed */ float factor[2]; - if(mathutils_array_parse(factor, 2, 2, fac, "Matrix.Shear()") < 0) { + if (mathutils_array_parse(factor, 2, 2, fac, "Matrix.Shear()") < 0) { return NULL; } @@ -590,15 +590,15 @@ static PyObject *C_Matrix_Shear(PyObject *cls, PyObject *args) mat[4] = 1.0f; mat[8] = 1.0f; - if(strcmp(plane, "XY") == 0) { + if (strcmp(plane, "XY") == 0) { mat[6] = factor[0]; mat[7] = factor[1]; } - else if(strcmp(plane, "XZ") == 0) { + else if (strcmp(plane, "XZ") == 0) { mat[3] = factor[0]; mat[5] = factor[1]; } - else if(strcmp(plane, "YZ") == 0) { + else if (strcmp(plane, "YZ") == 0) { mat[1] = factor[0]; mat[2] = factor[1]; } @@ -610,7 +610,7 @@ static PyObject *C_Matrix_Shear(PyObject *cls, PyObject *args) } } - if(matSize == 4) { + if (matSize == 4) { matrix_3x3_as_4x4(mat); } //pass to matrix creation @@ -627,11 +627,11 @@ void matrix_as_3x3(float mat[3][3], MatrixObject *self) /* assumes rowsize == colsize is checked and the read callback has run */ static float matrix_determinant_internal(MatrixObject *self) { - if(self->row_size == 2) { + if (self->row_size == 2) { return determinant_m2(self->matrix[0][0], self->matrix[0][1], self->matrix[1][0], self->matrix[1][1]); } - else if(self->row_size == 3) { + else if (self->row_size == 3) { return determinant_m3(self->matrix[0][0], self->matrix[0][1], self->matrix[0][2], self->matrix[1][0], self->matrix[1][1], self->matrix[1][2], @@ -657,17 +657,17 @@ static PyObject *Matrix_to_quaternion(MatrixObject *self) { float quat[4]; - if(BaseMath_ReadCallback(self) == -1) + if (BaseMath_ReadCallback(self) == -1) return NULL; /*must be 3-4 cols, 3-4 rows, square matrix*/ - if((self->col_size < 3) || (self->row_size < 3) || (self->col_size != self->row_size)) { + if ((self->col_size < 3) || (self->row_size < 3) || (self->col_size != self->row_size)) { PyErr_SetString(PyExc_ValueError, "Matrix.to_quat(): " "inappropriate matrix size - expects 3x3 or 4x4 matrix"); return NULL; } - if(self->col_size == 3){ + if (self->col_size == 3) { mat3_to_quat(quat, (float (*)[3])self->contigPtr); } else { @@ -704,21 +704,21 @@ static PyObject *Matrix_to_euler(MatrixObject *self, PyObject *args) float tmat[3][3]; float (*mat)[3]; - if(BaseMath_ReadCallback(self) == -1) + if (BaseMath_ReadCallback(self) == -1) return NULL; - if(!PyArg_ParseTuple(args, "|sO!:to_euler", &order_str, &euler_Type, &eul_compat)) + if (!PyArg_ParseTuple(args, "|sO!:to_euler", &order_str, &euler_Type, &eul_compat)) return NULL; - if(eul_compat) { - if(BaseMath_ReadCallback(eul_compat) == -1) + if (eul_compat) { + if (BaseMath_ReadCallback(eul_compat) == -1) return NULL; copy_v3_v3(eul_compatf, eul_compat->eul); } /*must be 3-4 cols, 3-4 rows, square matrix*/ - if(self->col_size ==3 && self->row_size ==3) { + if (self->col_size ==3 && self->row_size ==3) { mat= (float (*)[3])self->contigPtr; } else if (self->col_size ==4 && self->row_size ==4) { @@ -732,19 +732,19 @@ static PyObject *Matrix_to_euler(MatrixObject *self, PyObject *args) return NULL; } - if(order_str) { + if (order_str) { order= euler_order_from_string(order_str, "Matrix.to_euler()"); - if(order == -1) + if (order == -1) return NULL; } - if(eul_compat) { - if(order == 1) mat3_to_compatible_eul(eul, eul_compatf, mat); + if (eul_compat) { + if (order == 1) mat3_to_compatible_eul(eul, eul_compatf, mat); else mat3_to_compatible_eulO(eul, eul_compatf, order, mat); } else { - if(order == 1) mat3_to_eul(eul, mat); + if (order == 1) mat3_to_eul(eul, mat); else mat3_to_eulO(eul, order, mat); } @@ -760,13 +760,13 @@ static PyObject *Matrix_resize_4x4(MatrixObject *self) { int x, first_row_elem, curr_pos, new_pos, blank_columns, blank_rows, index; - if(self->wrapped==Py_WRAP){ + if (self->wrapped==Py_WRAP) { PyErr_SetString(PyExc_TypeError, "Matrix.resize_4x4(): " "cannot resize wrapped data - make a copy and resize that"); return NULL; } - if(self->cb_user){ + if (self->cb_user) { PyErr_SetString(PyExc_TypeError, "Matrix.resize_4x4(): " "cannot resize owned data - make a copy and resize that"); @@ -774,21 +774,21 @@ static PyObject *Matrix_resize_4x4(MatrixObject *self) } self->contigPtr = PyMem_Realloc(self->contigPtr, (sizeof(float) * 16)); - if(self->contigPtr == NULL) { + if (self->contigPtr == NULL) { PyErr_SetString(PyExc_MemoryError, "Matrix.resize_4x4(): " "problem allocating pointer space"); return NULL; } /*set row pointers*/ - for(x = 0; x < 4; x++) { + for (x = 0; x < 4; x++) { self->matrix[x] = self->contigPtr + (x * 4); } /*move data to new spot in array + clean*/ - for(blank_rows = (4 - self->row_size); blank_rows > 0; blank_rows--){ - for(x = 0; x < 4; x++){ + for (blank_rows = (4 - self->row_size); blank_rows > 0; blank_rows--) { + for (x = 0; x < 4; x++) { index = (4 * (self->row_size + (blank_rows - 1))) + x; - if (index == 10 || index == 15){ + if (index == 10 || index == 15) { self->contigPtr[index] = 1.0f; } else { @@ -796,14 +796,14 @@ static PyObject *Matrix_resize_4x4(MatrixObject *self) } } } - for(x = 1; x <= self->row_size; x++){ + for (x = 1; x <= self->row_size; x++) { first_row_elem = (self->col_size * (self->row_size - x)); curr_pos = (first_row_elem + (self->col_size -1)); new_pos = (4 * (self->row_size - x)) + (curr_pos - first_row_elem); - for(blank_columns = (4 - self->col_size); blank_columns > 0; blank_columns--){ + for (blank_columns = (4 - self->col_size); blank_columns > 0; blank_columns--) { self->contigPtr[new_pos + blank_columns] = 0.0f; } - for( ; curr_pos >= first_row_elem; curr_pos--){ + for ( ; curr_pos >= first_row_elem; curr_pos--) { self->contigPtr[new_pos] = self->contigPtr[curr_pos]; new_pos--; } @@ -824,13 +824,13 @@ PyDoc_STRVAR(Matrix_to_4x4_doc, ); static PyObject *Matrix_to_4x4(MatrixObject *self) { - if(BaseMath_ReadCallback(self) == -1) + if (BaseMath_ReadCallback(self) == -1) return NULL; - if(self->col_size==4 && self->row_size==4) { + if (self->col_size==4 && self->row_size==4) { return (PyObject *)newMatrixObject(self->contigPtr, 4, 4, Py_NEW, Py_TYPE(self)); } - else if(self->col_size==3 && self->row_size==3) { + else if (self->col_size==3 && self->row_size==3) { float mat[4][4]; copy_m4_m3(mat, (float (*)[3])self->contigPtr); return (PyObject *)newMatrixObject((float *)mat, 4, 4, Py_NEW, Py_TYPE(self)); @@ -855,10 +855,10 @@ static PyObject *Matrix_to_3x3(MatrixObject *self) { float mat[3][3]; - if(BaseMath_ReadCallback(self) == -1) + if (BaseMath_ReadCallback(self) == -1) return NULL; - if((self->col_size < 3) || (self->row_size < 3)) { + if ((self->col_size < 3) || (self->row_size < 3)) { PyErr_SetString(PyExc_TypeError, "Matrix.to_3x3(): inappropriate matrix size"); return NULL; @@ -879,10 +879,10 @@ PyDoc_STRVAR(Matrix_to_translation_doc, ); static PyObject *Matrix_to_translation(MatrixObject *self) { - if(BaseMath_ReadCallback(self) == -1) + if (BaseMath_ReadCallback(self) == -1) return NULL; - if((self->col_size < 3) || self->row_size < 4){ + if ((self->col_size < 3) || self->row_size < 4) { PyErr_SetString(PyExc_TypeError, "Matrix.to_translation(): " "inappropriate matrix size"); @@ -908,11 +908,11 @@ static PyObject *Matrix_to_scale(MatrixObject *self) float mat[3][3]; float size[3]; - if(BaseMath_ReadCallback(self) == -1) + if (BaseMath_ReadCallback(self) == -1) return NULL; /*must be 3-4 cols, 3-4 rows, square matrix*/ - if((self->col_size < 3) || (self->row_size < 3)) { + if ((self->col_size < 3) || (self->row_size < 3)) { PyErr_SetString(PyExc_TypeError, "Matrix.to_scale(): " "inappropriate matrix size, 3x3 minimum size"); @@ -945,10 +945,10 @@ static PyObject *Matrix_invert(MatrixObject *self) float mat[16] = {0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}; - if(BaseMath_ReadCallback(self) == -1) + if (BaseMath_ReadCallback(self) == -1) return NULL; - if(self->row_size != self->col_size){ + if (self->row_size != self->col_size) { PyErr_SetString(PyExc_TypeError, "Matrix.invert(ed): " "only square matrices are supported"); @@ -958,25 +958,25 @@ static PyObject *Matrix_invert(MatrixObject *self) /*calculate the determinant*/ det = matrix_determinant_internal(self); - if(det != 0) { + if (det != 0) { /*calculate the classical adjoint*/ - if(self->row_size == 2) { + if (self->row_size == 2) { mat[0] = self->matrix[1][1]; mat[1] = -self->matrix[0][1]; mat[2] = -self->matrix[1][0]; mat[3] = self->matrix[0][0]; - } else if(self->row_size == 3) { + } else if (self->row_size == 3) { adjoint_m3_m3((float (*)[3]) mat,(float (*)[3])self->contigPtr); - } else if(self->row_size == 4) { + } else if (self->row_size == 4) { adjoint_m4_m4((float (*)[4]) mat, (float (*)[4])self->contigPtr); } /*divide by determinate*/ - for(x = 0; x < (self->row_size * self->col_size); x++) { + for (x = 0; x < (self->row_size * self->col_size); x++) { mat[x] /= det; } /*set values*/ - for(x = 0; x < self->row_size; x++) { - for(y = 0; y < self->col_size; y++) { + for (x = 0; x < self->row_size; x++) { + for (y = 0; y < self->col_size; y++) { self->matrix[x][y] = mat[z]; z++; } @@ -1024,13 +1024,13 @@ static PyObject *Matrix_rotate(MatrixObject *self, PyObject *value) { float self_rmat[3][3], other_rmat[3][3], rmat[3][3]; - if(BaseMath_ReadCallback(self) == -1) + if (BaseMath_ReadCallback(self) == -1) return NULL; - if(mathutils_any_to_rotmat(other_rmat, value, "matrix.rotate(value)") == -1) + if (mathutils_any_to_rotmat(other_rmat, value, "matrix.rotate(value)") == -1) return NULL; - if(self->col_size != 3 || self->row_size != 3) { + if (self->col_size != 3 || self->row_size != 3) { PyErr_SetString(PyExc_TypeError, "Matrix.rotate(): " "must have 3x3 dimensions"); @@ -1063,14 +1063,14 @@ static PyObject *Matrix_decompose(MatrixObject *self) float quat[4]; float size[3]; - if(self->col_size != 4 || self->row_size != 4) { + if (self->col_size != 4 || self->row_size != 4) { PyErr_SetString(PyExc_TypeError, "Matrix.decompose(): " "inappropriate matrix size - expects 4x4 matrix"); return NULL; } - if(BaseMath_ReadCallback(self) == -1) + if (BaseMath_ReadCallback(self) == -1) return NULL; mat4_to_loc_rot_size(loc, rot, size, (float (*)[4])self->contigPtr); @@ -1103,21 +1103,21 @@ static PyObject *Matrix_lerp(MatrixObject *self, PyObject *args) MatrixObject *mat2 = NULL; float fac, mat[MATRIX_MAX_DIM*MATRIX_MAX_DIM]; - if(!PyArg_ParseTuple(args, "O!f:lerp", &matrix_Type, &mat2, &fac)) + if (!PyArg_ParseTuple(args, "O!f:lerp", &matrix_Type, &mat2, &fac)) return NULL; - if(self->row_size != mat2->row_size || self->col_size != mat2->col_size) { + if (self->row_size != mat2->row_size || self->col_size != mat2->col_size) { PyErr_SetString(PyExc_ValueError, "Matrix.lerp(): " "expects both matrix objects of the same dimensions"); return NULL; } - if(BaseMath_ReadCallback(self) == -1 || BaseMath_ReadCallback(mat2) == -1) + if (BaseMath_ReadCallback(self) == -1 || BaseMath_ReadCallback(mat2) == -1) return NULL; /* TODO, different sized matrix */ - if(self->row_size==4 && self->col_size==4) { + if (self->row_size==4 && self->col_size==4) { blend_m4_m4m4((float (*)[4])mat, (float (*)[4])self->contigPtr, (float (*)[4])mat2->contigPtr, fac); } else if (self->row_size==3 && self->col_size==3) { @@ -1146,10 +1146,10 @@ PyDoc_STRVAR(Matrix_determinant_doc, ); static PyObject *Matrix_determinant(MatrixObject *self) { - if(BaseMath_ReadCallback(self) == -1) + if (BaseMath_ReadCallback(self) == -1) return NULL; - if(self->row_size != self->col_size){ + if (self->row_size != self->col_size) { PyErr_SetString(PyExc_TypeError, "Matrix.determinant(): " "only square matrices are supported"); @@ -1170,21 +1170,21 @@ static PyObject *Matrix_transpose(MatrixObject *self) { float t = 0.0f; - if(BaseMath_ReadCallback(self) == -1) + if (BaseMath_ReadCallback(self) == -1) return NULL; - if(self->row_size != self->col_size){ + if (self->row_size != self->col_size) { PyErr_SetString(PyExc_TypeError, "Matrix.transpose(d): " "only square matrices are supported"); return NULL; } - if(self->row_size == 2) { + if (self->row_size == 2) { t = self->matrix[1][0]; self->matrix[1][0] = self->matrix[0][1]; self->matrix[0][1] = t; - } else if(self->row_size == 3) { + } else if (self->row_size == 3) { transpose_m3((float (*)[3])self->contigPtr); } else { @@ -1221,7 +1221,7 @@ static PyObject *Matrix_zero(MatrixObject *self) { fill_vn(self->contigPtr, self->row_size * self->col_size, 0.0f); - if(BaseMath_WriteCallback(self) == -1) + if (BaseMath_WriteCallback(self) == -1) return NULL; Py_RETURN_NONE; @@ -1239,29 +1239,29 @@ PyDoc_STRVAR(Matrix_identity_doc, ); static PyObject *Matrix_identity(MatrixObject *self) { - if(BaseMath_ReadCallback(self) == -1) + if (BaseMath_ReadCallback(self) == -1) return NULL; - if(self->row_size != self->col_size){ + if (self->row_size != self->col_size) { PyErr_SetString(PyExc_TypeError, "Matrix.identity(): " "only square matrices are supported"); return NULL; } - if(self->row_size == 2) { + if (self->row_size == 2) { self->matrix[0][0] = 1.0f; self->matrix[0][1] = 0.0f; self->matrix[1][0] = 0.0f; self->matrix[1][1] = 1.0f; - } else if(self->row_size == 3) { + } else if (self->row_size == 3) { unit_m3((float (*)[3])self->contigPtr); } else { unit_m4((float (*)[4])self->contigPtr); } - if(BaseMath_WriteCallback(self) == -1) + if (BaseMath_WriteCallback(self) == -1) return NULL; Py_RETURN_NONE; @@ -1278,7 +1278,7 @@ PyDoc_STRVAR(Matrix_copy_doc, ); static PyObject *Matrix_copy(MatrixObject *self) { - if(BaseMath_ReadCallback(self) == -1) + if (BaseMath_ReadCallback(self) == -1) return NULL; return (PyObject*)newMatrixObject((float (*))self->contigPtr, self->row_size, self->col_size, Py_NEW, Py_TYPE(self)); @@ -1291,12 +1291,12 @@ static PyObject *Matrix_repr(MatrixObject *self) int x, y; PyObject *rows[MATRIX_MAX_DIM]= {NULL}; - if(BaseMath_ReadCallback(self) == -1) + if (BaseMath_ReadCallback(self) == -1) return NULL; - for(x = 0; x < self->row_size; x++){ + for (x = 0; x < self->row_size; x++) { rows[x]= PyTuple_New(self->col_size); - for(y = 0; y < self->col_size; y++) { + for (y = 0; y < self->col_size; y++) { PyTuple_SET_ITEM(rows[x], y, PyFloat_FromDouble(self->matrix[x][y])); } } @@ -1327,7 +1327,7 @@ static PyObject* Matrix_richcmpr(PyObject *a, PyObject *b, int op) MatrixObject *matA= (MatrixObject*)a; MatrixObject *matB= (MatrixObject*)b; - if(BaseMath_ReadCallback(matA) == -1 || BaseMath_ReadCallback(matB) == -1) + if (BaseMath_ReadCallback(matA) == -1 || BaseMath_ReadCallback(matB) == -1) return NULL; ok= ( (matA->col_size == matB->col_size) && @@ -1369,10 +1369,10 @@ static int Matrix_len(MatrixObject *self) the wrapped vector gives direct access to the matrix data*/ static PyObject *Matrix_item(MatrixObject *self, int i) { - if(BaseMath_ReadCallback(self) == -1) + if (BaseMath_ReadCallback(self) == -1) return NULL; - if(i < 0 || i >= self->row_size) { + if (i < 0 || i >= self->row_size) { PyErr_SetString(PyExc_IndexError, "matrix[attribute]: " "array index out of range"); @@ -1386,16 +1386,16 @@ static PyObject *Matrix_item(MatrixObject *self, int i) static int Matrix_ass_item(MatrixObject *self, int i, PyObject *value) { float vec[4]; - if(BaseMath_ReadCallback(self) == -1) + if (BaseMath_ReadCallback(self) == -1) return -1; - if(i >= self->row_size || i < 0){ + if (i >= self->row_size || i < 0) { PyErr_SetString(PyExc_IndexError, "matrix[attribute] = x: bad column"); return -1; } - if(mathutils_array_parse(vec, self->col_size, self->col_size, value, "matrix[i] = value assignment") < 0) { + if (mathutils_array_parse(vec, self->col_size, self->col_size, value, "matrix[i] = value assignment") < 0) { return -1; } @@ -1413,7 +1413,7 @@ static PyObject *Matrix_slice(MatrixObject *self, int begin, int end) PyObject *tuple; int count; - if(BaseMath_ReadCallback(self) == -1) + if (BaseMath_ReadCallback(self) == -1) return NULL; CLAMP(begin, 0, self->row_size); @@ -1421,7 +1421,7 @@ static PyObject *Matrix_slice(MatrixObject *self, int begin, int end) begin= MIN2(begin, end); tuple= PyTuple_New(end - begin); - for(count= begin; count < end; count++) { + for (count= begin; count < end; count++) { PyTuple_SET_ITEM(tuple, count - begin, newVectorObject_cb((PyObject *)self, self->col_size, mathutils_matrix_vector_cb_index, count)); @@ -1435,7 +1435,7 @@ static int Matrix_ass_slice(MatrixObject *self, int begin, int end, PyObject *va { PyObject *value_fast= NULL; - if(BaseMath_ReadCallback(self) == -1) + if (BaseMath_ReadCallback(self) == -1) return -1; CLAMP(begin, 0, self->row_size); @@ -1443,7 +1443,7 @@ static int Matrix_ass_slice(MatrixObject *self, int begin, int end, PyObject *va begin = MIN2(begin, end); /* non list/tuple cases */ - if(!(value_fast=PySequence_Fast(value, "matrix[begin:end] = value"))) { + if (!(value_fast=PySequence_Fast(value, "matrix[begin:end] = value"))) { /* PySequence_Fast sets the error */ return -1; } @@ -1452,7 +1452,7 @@ static int Matrix_ass_slice(MatrixObject *self, int begin, int end, PyObject *va int i; float mat[16]; - if(PySequence_Fast_GET_SIZE(value_fast) != size) { + if (PySequence_Fast_GET_SIZE(value_fast) != size) { Py_DECREF(value_fast); PyErr_SetString(PyExc_ValueError, "matrix[begin:end] = []: " @@ -1465,7 +1465,7 @@ static int Matrix_ass_slice(MatrixObject *self, int begin, int end, PyObject *va /*parse each sub sequence*/ PyObject *item= PySequence_Fast_GET_ITEM(value_fast, i); - if(mathutils_array_parse(&mat[i * self->col_size], self->col_size, self->col_size, item, "matrix[begin:end] = value assignment") < 0) { + if (mathutils_array_parse(&mat[i * self->col_size], self->col_size, self->col_size, item, "matrix[begin:end] = value assignment") < 0) { return -1; } } @@ -1489,17 +1489,17 @@ static PyObject *Matrix_add(PyObject *m1, PyObject *m2) mat1 = (MatrixObject*)m1; mat2 = (MatrixObject*)m2; - if(!MatrixObject_Check(m1) || !MatrixObject_Check(m2)) { + if (!MatrixObject_Check(m1) || !MatrixObject_Check(m2)) { PyErr_SetString(PyExc_TypeError, "Matrix addition: " "arguments not valid for this operation"); return NULL; } - if(BaseMath_ReadCallback(mat1) == -1 || BaseMath_ReadCallback(mat2) == -1) + if (BaseMath_ReadCallback(mat1) == -1 || BaseMath_ReadCallback(mat2) == -1) return NULL; - if(mat1->row_size != mat2->row_size || mat1->col_size != mat2->col_size){ + if (mat1->row_size != mat2->row_size || mat1->col_size != mat2->col_size) { PyErr_SetString(PyExc_TypeError, "Matrix addition: " "matrices must have the same dimensions for this operation"); @@ -1520,17 +1520,17 @@ static PyObject *Matrix_sub(PyObject *m1, PyObject *m2) mat1 = (MatrixObject*)m1; mat2 = (MatrixObject*)m2; - if(!MatrixObject_Check(m1) || !MatrixObject_Check(m2)) { + if (!MatrixObject_Check(m1) || !MatrixObject_Check(m2)) { PyErr_SetString(PyExc_TypeError, "Matrix addition: " "arguments not valid for this operation"); return NULL; } - if(BaseMath_ReadCallback(mat1) == -1 || BaseMath_ReadCallback(mat2) == -1) + if (BaseMath_ReadCallback(mat1) == -1 || BaseMath_ReadCallback(mat2) == -1) return NULL; - if(mat1->row_size != mat2->row_size || mat1->col_size != mat2->col_size){ + if (mat1->row_size != mat2->row_size || mat1->col_size != mat2->col_size) { PyErr_SetString(PyExc_TypeError, "Matrix addition: " "matrices must have the same dimensions for this operation"); @@ -1556,18 +1556,18 @@ static PyObject *Matrix_mul(PyObject *m1, PyObject *m2) MatrixObject *mat1 = NULL, *mat2 = NULL; - if(MatrixObject_Check(m1)) { + if (MatrixObject_Check(m1)) { mat1 = (MatrixObject*)m1; - if(BaseMath_ReadCallback(mat1) == -1) + if (BaseMath_ReadCallback(mat1) == -1) return NULL; } - if(MatrixObject_Check(m2)) { + if (MatrixObject_Check(m2)) { mat2 = (MatrixObject*)m2; - if(BaseMath_ReadCallback(mat2) == -1) + if (BaseMath_ReadCallback(mat2) == -1) return NULL; } - if(mat1 && mat2) { + if (mat1 && mat2) { /*MATRIX * MATRIX*/ float mat[16]= {0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, @@ -1576,9 +1576,9 @@ static PyObject *Matrix_mul(PyObject *m1, PyObject *m2) double dot = 0.0f; int x, y, z; - for(x = 0; x < mat2->row_size; x++) { - for(y = 0; y < mat1->col_size; y++) { - for(z = 0; z < mat1->row_size; z++) { + for (x = 0; x < mat2->row_size; x++) { + for (y = 0; y < mat1->col_size; y++) { + for (z = 0; z < mat1->row_size; z++) { dot += (mat1->matrix[z][y] * mat2->matrix[x][z]); } mat[((x * mat1->col_size) + y)] = (float)dot; @@ -1588,20 +1588,20 @@ static PyObject *Matrix_mul(PyObject *m1, PyObject *m2) return newMatrixObject(mat, mat2->row_size, mat1->col_size, Py_NEW, Py_TYPE(mat1)); } - else if(mat2) { + else if (mat2) { /*FLOAT/INT * MATRIX */ if (((scalar= PyFloat_AsDouble(m1)) == -1.0f && PyErr_Occurred())==0) { return matrix_mul_float(mat2, scalar); } } - else if(mat1) { + else if (mat1) { /*VEC * MATRIX */ - if(VectorObject_Check(m2)) { + if (VectorObject_Check(m2)) { VectorObject *vec2= (VectorObject *)m2; float tvec[4]; - if(BaseMath_ReadCallback(vec2) == -1) + if (BaseMath_ReadCallback(vec2) == -1) return NULL; - if(column_vector_multiplication(tvec, vec2, mat1) == -1) { + if (column_vector_multiplication(tvec, vec2, mat1) == -1) { return NULL; } @@ -1624,7 +1624,7 @@ static PyObject *Matrix_mul(PyObject *m1, PyObject *m2) } static PyObject* Matrix_inv(MatrixObject *self) { - if(BaseMath_ReadCallback(self) == -1) + if (BaseMath_ReadCallback(self) == -1) return NULL; return Matrix_invert(self); @@ -1771,11 +1771,11 @@ static PyObject *Matrix_median_scale_get(MatrixObject *self, void *UNUSED(closur { float mat[3][3]; - if(BaseMath_ReadCallback(self) == -1) + if (BaseMath_ReadCallback(self) == -1) return NULL; /*must be 3-4 cols, 3-4 rows, square matrix*/ - if((self->col_size < 3) || (self->row_size < 3)) { + if ((self->col_size < 3) || (self->row_size < 3)) { PyErr_SetString(PyExc_AttributeError, "Matrix.median_scale: " "inappropriate matrix size, 3x3 minimum"); @@ -1789,13 +1789,13 @@ static PyObject *Matrix_median_scale_get(MatrixObject *self, void *UNUSED(closur static PyObject *Matrix_is_negative_get(MatrixObject *self, void *UNUSED(closure)) { - if(BaseMath_ReadCallback(self) == -1) + if (BaseMath_ReadCallback(self) == -1) return NULL; /*must be 3-4 cols, 3-4 rows, square matrix*/ - if(self->col_size == 4 && self->row_size == 4) + if (self->col_size == 4 && self->row_size == 4) return PyBool_FromLong(is_negative_m4((float (*)[4])self->contigPtr)); - else if(self->col_size == 3 && self->row_size == 3) + else if (self->col_size == 3 && self->row_size == 3) return PyBool_FromLong(is_negative_m3((float (*)[3])self->contigPtr)); else { PyErr_SetString(PyExc_AttributeError, @@ -1807,13 +1807,13 @@ static PyObject *Matrix_is_negative_get(MatrixObject *self, void *UNUSED(closure static PyObject *Matrix_is_orthogonal_get(MatrixObject *self, void *UNUSED(closure)) { - if(BaseMath_ReadCallback(self) == -1) + if (BaseMath_ReadCallback(self) == -1) return NULL; /*must be 3-4 cols, 3-4 rows, square matrix*/ - if(self->col_size == 4 && self->row_size == 4) + if (self->col_size == 4 && self->row_size == 4) return PyBool_FromLong(is_orthogonal_m4((float (*)[4])self->contigPtr)); - else if(self->col_size == 3 && self->row_size == 3) + else if (self->col_size == 3 && self->row_size == 3) return PyBool_FromLong(is_orthogonal_m3((float (*)[3])self->contigPtr)); else { PyErr_SetString(PyExc_AttributeError, @@ -1953,7 +1953,7 @@ PyObject *newMatrixObject(float *mat, const unsigned short rowSize, const unsign int x, row, col; /*matrix objects can be any 2-4row x 2-4col matrix*/ - if(rowSize < 2 || rowSize > 4 || colSize < 2 || colSize > 4) { + if (rowSize < 2 || rowSize > 4 || colSize < 2 || colSize > 4) { PyErr_SetString(PyExc_RuntimeError, "Matrix(): " "row and column sizes must be between 2 and 4"); @@ -1963,7 +1963,7 @@ PyObject *newMatrixObject(float *mat, const unsigned short rowSize, const unsign self= base_type ? (MatrixObject *)base_type->tp_alloc(base_type, 0) : (MatrixObject *)PyObject_GC_New(MatrixObject, &matrix_Type); - if(self) { + if (self) { self->row_size = rowSize; self->col_size = colSize; @@ -1971,30 +1971,30 @@ PyObject *newMatrixObject(float *mat, const unsigned short rowSize, const unsign self->cb_user= NULL; self->cb_type= self->cb_subtype= 0; - if(type == Py_WRAP){ + if (type == Py_WRAP) { self->contigPtr = mat; /*pointer array points to contigous memory*/ - for(x = 0; x < rowSize; x++) { + for (x = 0; x < rowSize; x++) { self->matrix[x] = self->contigPtr + (x * colSize); } self->wrapped = Py_WRAP; } - else if (type == Py_NEW){ + else if (type == Py_NEW) { self->contigPtr = PyMem_Malloc(rowSize * colSize * sizeof(float)); - if(self->contigPtr == NULL) { /*allocation failure*/ + if (self->contigPtr == NULL) { /*allocation failure*/ PyErr_SetString(PyExc_MemoryError, "Matrix(): " "problem allocating pointer space"); return NULL; } /*pointer array points to contigous memory*/ - for(x = 0; x < rowSize; x++) { + for (x = 0; x < rowSize; x++) { self->matrix[x] = self->contigPtr + (x * colSize); } /*parse*/ - if(mat) { /*if a float array passed*/ - for(row = 0; row < rowSize; row++) { - for(col = 0; col < colSize; col++) { + if (mat) { /*if a float array passed*/ + for (row = 0; row < rowSize; row++) { + for (col = 0; col < colSize; col++) { self->matrix[row][col] = mat[(row * colSize) + col]; } } @@ -2016,7 +2016,7 @@ PyObject *newMatrixObject(float *mat, const unsigned short rowSize, const unsign PyObject *newMatrixObject_cb(PyObject *cb_user, int rowSize, int colSize, int cb_type, int cb_subtype) { MatrixObject *self= (MatrixObject *)newMatrixObject(NULL, rowSize, colSize, Py_NEW, NULL); - if(self) { + if (self) { Py_INCREF(cb_user); self->cb_user= cb_user; self->cb_type= (unsigned char)cb_type; diff --git a/source/blender/python/mathutils/mathutils_Quaternion.c b/source/blender/python/mathutils/mathutils_Quaternion.c index 9d1cfb1948a..eda6aa5c84e 100644 --- a/source/blender/python/mathutils/mathutils_Quaternion.c +++ b/source/blender/python/mathutils/mathutils_Quaternion.c @@ -53,13 +53,13 @@ static PyObject *Quaternion_to_tuple_ext(QuaternionObject *self, int ndigits) ret= PyTuple_New(QUAT_SIZE); - if(ndigits >= 0) { - for(i= 0; i < QUAT_SIZE; i++) { + if (ndigits >= 0) { + for (i= 0; i < QUAT_SIZE; i++) { PyTuple_SET_ITEM(ret, i, PyFloat_FromDouble(double_round((double)self->quat[i], ndigits))); } } else { - for(i= 0; i < QUAT_SIZE; i++) { + for (i= 0; i < QUAT_SIZE; i++) { PyTuple_SET_ITEM(ret, i, PyFloat_FromDouble(self->quat[i])); } } @@ -90,34 +90,34 @@ static PyObject *Quaternion_to_euler(QuaternionObject *self, PyObject *args) short order= EULER_ORDER_XYZ; EulerObject *eul_compat = NULL; - if(!PyArg_ParseTuple(args, "|sO!:to_euler", &order_str, &euler_Type, &eul_compat)) + if (!PyArg_ParseTuple(args, "|sO!:to_euler", &order_str, &euler_Type, &eul_compat)) return NULL; - if(BaseMath_ReadCallback(self) == -1) + if (BaseMath_ReadCallback(self) == -1) return NULL; - if(order_str) { + if (order_str) { order= euler_order_from_string(order_str, "Matrix.to_euler()"); - if(order == -1) + if (order == -1) return NULL; } normalize_qt_qt(tquat, self->quat); - if(eul_compat) { + if (eul_compat) { float mat[3][3]; - if(BaseMath_ReadCallback(eul_compat) == -1) + if (BaseMath_ReadCallback(eul_compat) == -1) return NULL; quat_to_mat3(mat, tquat); - if(order == EULER_ORDER_XYZ) mat3_to_compatible_eul(eul, eul_compat->eul, mat); + if (order == EULER_ORDER_XYZ) mat3_to_compatible_eul(eul, eul_compat->eul, mat); else mat3_to_compatible_eulO(eul, eul_compat->eul, order, mat); } else { - if(order == EULER_ORDER_XYZ) quat_to_eul(eul, tquat); + if (order == EULER_ORDER_XYZ) quat_to_eul(eul, tquat); else quat_to_eulO(eul, order, tquat); } @@ -136,7 +136,7 @@ static PyObject *Quaternion_to_matrix(QuaternionObject *self) { float mat[9]; /* all values are set */ - if(BaseMath_ReadCallback(self) == -1) + if (BaseMath_ReadCallback(self) == -1) return NULL; quat_to_mat3((float (*)[3])mat, self->quat); @@ -158,10 +158,10 @@ static PyObject *Quaternion_cross(QuaternionObject *self, PyObject *value) { float quat[QUAT_SIZE], tquat[QUAT_SIZE]; - if(BaseMath_ReadCallback(self) == -1) + if (BaseMath_ReadCallback(self) == -1) return NULL; - if(mathutils_array_parse(tquat, QUAT_SIZE, QUAT_SIZE, value, "Quaternion.cross(other), invalid 'other' arg") == -1) + if (mathutils_array_parse(tquat, QUAT_SIZE, QUAT_SIZE, value, "Quaternion.cross(other), invalid 'other' arg") == -1) return NULL; mul_qt_qtqt(quat, self->quat, tquat); @@ -183,10 +183,10 @@ static PyObject *Quaternion_dot(QuaternionObject *self, PyObject *value) { float tquat[QUAT_SIZE]; - if(BaseMath_ReadCallback(self) == -1) + if (BaseMath_ReadCallback(self) == -1) return NULL; - if(mathutils_array_parse(tquat, QUAT_SIZE, QUAT_SIZE, value, "Quaternion.dot(other), invalid 'other' arg") == -1) + if (mathutils_array_parse(tquat, QUAT_SIZE, QUAT_SIZE, value, "Quaternion.dot(other), invalid 'other' arg") == -1) return NULL; return PyFloat_FromDouble(dot_qtqt(self->quat, tquat)); @@ -206,10 +206,10 @@ static PyObject *Quaternion_rotation_difference(QuaternionObject *self, PyObject { float tquat[QUAT_SIZE], quat[QUAT_SIZE]; - if(BaseMath_ReadCallback(self) == -1) + if (BaseMath_ReadCallback(self) == -1) return NULL; - if(mathutils_array_parse(tquat, QUAT_SIZE, QUAT_SIZE, value, "Quaternion.difference(other), invalid 'other' arg") == -1) + if (mathutils_array_parse(tquat, QUAT_SIZE, QUAT_SIZE, value, "Quaternion.difference(other), invalid 'other' arg") == -1) return NULL; rotation_between_quats_to_quat(quat, self->quat, tquat); @@ -234,20 +234,20 @@ static PyObject *Quaternion_slerp(QuaternionObject *self, PyObject *args) PyObject *value; float tquat[QUAT_SIZE], quat[QUAT_SIZE], fac; - if(!PyArg_ParseTuple(args, "Of:slerp", &value, &fac)) { + if (!PyArg_ParseTuple(args, "Of:slerp", &value, &fac)) { PyErr_SetString(PyExc_TypeError, "quat.slerp(): " "expected Quaternion types and float"); return NULL; } - if(BaseMath_ReadCallback(self) == -1) + if (BaseMath_ReadCallback(self) == -1) return NULL; - if(mathutils_array_parse(tquat, QUAT_SIZE, QUAT_SIZE, value, "Quaternion.slerp(other), invalid 'other' arg") == -1) + if (mathutils_array_parse(tquat, QUAT_SIZE, QUAT_SIZE, value, "Quaternion.slerp(other), invalid 'other' arg") == -1) return NULL; - if(fac > 1.0f || fac < 0.0f) { + if (fac > 1.0f || fac < 0.0f) { PyErr_SetString(PyExc_ValueError, "quat.slerp(): " "interpolation factor must be between 0.0 and 1.0"); @@ -272,10 +272,10 @@ static PyObject *Quaternion_rotate(QuaternionObject *self, PyObject *value) float self_rmat[3][3], other_rmat[3][3], rmat[3][3]; float tquat[4], length; - if(BaseMath_ReadCallback(self) == -1) + if (BaseMath_ReadCallback(self) == -1) return NULL; - if(mathutils_any_to_rotmat(other_rmat, value, "Quaternion.rotate(value)") == -1) + if (mathutils_any_to_rotmat(other_rmat, value, "Quaternion.rotate(value)") == -1) return NULL; length= normalize_qt_qt(tquat, self->quat); @@ -298,7 +298,7 @@ PyDoc_STRVAR(Quaternion_normalize_doc, ); static PyObject *Quaternion_normalize(QuaternionObject *self) { - if(BaseMath_ReadCallback(self) == -1) + if (BaseMath_ReadCallback(self) == -1) return NULL; normalize_qt(self->quat); @@ -327,7 +327,7 @@ PyDoc_STRVAR(Quaternion_invert_doc, ); static PyObject *Quaternion_invert(QuaternionObject *self) { - if(BaseMath_ReadCallback(self) == -1) + if (BaseMath_ReadCallback(self) == -1) return NULL; invert_qt(self->quat); @@ -359,7 +359,7 @@ PyDoc_STRVAR(Quaternion_identity_doc, ); static PyObject *Quaternion_identity(QuaternionObject *self) { - if(BaseMath_ReadCallback(self) == -1) + if (BaseMath_ReadCallback(self) == -1) return NULL; unit_qt(self->quat); @@ -378,7 +378,7 @@ PyDoc_STRVAR(Quaternion_negate_doc, ); static PyObject *Quaternion_negate(QuaternionObject *self) { - if(BaseMath_ReadCallback(self) == -1) + if (BaseMath_ReadCallback(self) == -1) return NULL; mul_qt_fl(self->quat, -1.0f); @@ -394,7 +394,7 @@ PyDoc_STRVAR(Quaternion_conjugate_doc, ); static PyObject *Quaternion_conjugate(QuaternionObject *self) { - if(BaseMath_ReadCallback(self) == -1) + if (BaseMath_ReadCallback(self) == -1) return NULL; conjugate_qt(self->quat); @@ -429,7 +429,7 @@ PyDoc_STRVAR(Quaternion_copy_doc, ); static PyObject *Quaternion_copy(QuaternionObject *self) { - if(BaseMath_ReadCallback(self) == -1) + if (BaseMath_ReadCallback(self) == -1) return NULL; return newQuaternionObject(self->quat, Py_NEW, Py_TYPE(self)); @@ -441,7 +441,7 @@ static PyObject *Quaternion_repr(QuaternionObject *self) { PyObject *ret, *tuple; - if(BaseMath_ReadCallback(self) == -1) + if (BaseMath_ReadCallback(self) == -1) return NULL; tuple= Quaternion_to_tuple_ext(self, -1); @@ -461,7 +461,7 @@ static PyObject* Quaternion_richcmpr(PyObject *a, PyObject *b, int op) QuaternionObject *quatA= (QuaternionObject *)a; QuaternionObject *quatB= (QuaternionObject *)b; - if(BaseMath_ReadCallback(quatA) == -1 || BaseMath_ReadCallback(quatB) == -1) + if (BaseMath_ReadCallback(quatA) == -1 || BaseMath_ReadCallback(quatB) == -1) return NULL; ok= (EXPP_VectorsAreEqual(quatA->quat, quatB->quat, QUAT_SIZE, 1)) ? 0 : -1; @@ -499,16 +499,16 @@ static int Quaternion_len(QuaternionObject *UNUSED(self)) //sequence accessor (get) static PyObject *Quaternion_item(QuaternionObject *self, int i) { - if(i<0) i= QUAT_SIZE-i; + if (i<0) i= QUAT_SIZE-i; - if(i < 0 || i >= QUAT_SIZE) { + if (i < 0 || i >= QUAT_SIZE) { PyErr_SetString(PyExc_IndexError, "quaternion[attribute]: " "array index out of range"); return NULL; } - if(BaseMath_ReadIndexCallback(self, i) == -1) + if (BaseMath_ReadIndexCallback(self, i) == -1) return NULL; return PyFloat_FromDouble(self->quat[i]); @@ -519,16 +519,16 @@ static PyObject *Quaternion_item(QuaternionObject *self, int i) static int Quaternion_ass_item(QuaternionObject *self, int i, PyObject *ob) { float scalar= (float)PyFloat_AsDouble(ob); - if(scalar==-1.0f && PyErr_Occurred()) { /* parsed item not a number */ + if (scalar==-1.0f && PyErr_Occurred()) { /* parsed item not a number */ PyErr_SetString(PyExc_TypeError, "quaternion[index] = x: " "index argument not a number"); return -1; } - if(i<0) i= QUAT_SIZE-i; + if (i<0) i= QUAT_SIZE-i; - if(i < 0 || i >= QUAT_SIZE){ + if (i < 0 || i >= QUAT_SIZE) { PyErr_SetString(PyExc_IndexError, "quaternion[attribute] = x: " "array assignment index out of range"); @@ -536,7 +536,7 @@ static int Quaternion_ass_item(QuaternionObject *self, int i, PyObject *ob) } self->quat[i] = scalar; - if(BaseMath_WriteIndexCallback(self, i) == -1) + if (BaseMath_WriteIndexCallback(self, i) == -1) return -1; return 0; @@ -548,7 +548,7 @@ static PyObject *Quaternion_slice(QuaternionObject *self, int begin, int end) PyObject *tuple; int count; - if(BaseMath_ReadCallback(self) == -1) + if (BaseMath_ReadCallback(self) == -1) return NULL; CLAMP(begin, 0, QUAT_SIZE); @@ -557,7 +557,7 @@ static PyObject *Quaternion_slice(QuaternionObject *self, int begin, int end) begin= MIN2(begin, end); tuple= PyTuple_New(end - begin); - for(count= begin; count < end; count++) { + for (count= begin; count < end; count++) { PyTuple_SET_ITEM(tuple, count - begin, PyFloat_FromDouble(self->quat[count])); } @@ -570,7 +570,7 @@ static int Quaternion_ass_slice(QuaternionObject *self, int begin, int end, PyOb int i, size; float quat[QUAT_SIZE]; - if(BaseMath_ReadCallback(self) == -1) + if (BaseMath_ReadCallback(self) == -1) return -1; CLAMP(begin, 0, QUAT_SIZE); @@ -578,10 +578,10 @@ static int Quaternion_ass_slice(QuaternionObject *self, int begin, int end, PyOb CLAMP(end, 0, QUAT_SIZE); begin = MIN2(begin, end); - if((size=mathutils_array_parse(quat, 0, QUAT_SIZE, seq, "mathutils.Quaternion[begin:end] = []")) == -1) + if ((size=mathutils_array_parse(quat, 0, QUAT_SIZE, seq, "mathutils.Quaternion[begin:end] = []")) == -1) return -1; - if(size != (end - begin)){ + if (size != (end - begin)) { PyErr_SetString(PyExc_ValueError, "quaternion[begin:end] = []: " "size mismatch in slice assignment"); @@ -589,7 +589,7 @@ static int Quaternion_ass_slice(QuaternionObject *self, int begin, int end, PyOb } /* parsed well - now set in vector */ - for(i= 0; i < size; i++) + for (i= 0; i < size; i++) self->quat[begin + i] = quat[i]; (void)BaseMath_WriteCallback(self); @@ -674,7 +674,7 @@ static PyObject *Quaternion_add(PyObject *q1, PyObject *q2) float quat[QUAT_SIZE]; QuaternionObject *quat1 = NULL, *quat2 = NULL; - if(!QuaternionObject_Check(q1) || !QuaternionObject_Check(q2)) { + if (!QuaternionObject_Check(q1) || !QuaternionObject_Check(q2)) { PyErr_SetString(PyExc_TypeError, "Quaternion addition: " "arguments not valid for this operation"); @@ -683,7 +683,7 @@ static PyObject *Quaternion_add(PyObject *q1, PyObject *q2) quat1 = (QuaternionObject*)q1; quat2 = (QuaternionObject*)q2; - if(BaseMath_ReadCallback(quat1) == -1 || BaseMath_ReadCallback(quat2) == -1) + if (BaseMath_ReadCallback(quat1) == -1 || BaseMath_ReadCallback(quat2) == -1) return NULL; add_qt_qtqt(quat, quat1->quat, quat2->quat, 1.0f); @@ -697,7 +697,7 @@ static PyObject *Quaternion_sub(PyObject *q1, PyObject *q2) float quat[QUAT_SIZE]; QuaternionObject *quat1 = NULL, *quat2 = NULL; - if(!QuaternionObject_Check(q1) || !QuaternionObject_Check(q2)) { + if (!QuaternionObject_Check(q1) || !QuaternionObject_Check(q2)) { PyErr_SetString(PyExc_TypeError, "Quaternion addition: " "arguments not valid for this operation"); @@ -707,10 +707,10 @@ static PyObject *Quaternion_sub(PyObject *q1, PyObject *q2) quat1 = (QuaternionObject*)q1; quat2 = (QuaternionObject*)q2; - if(BaseMath_ReadCallback(quat1) == -1 || BaseMath_ReadCallback(quat2) == -1) + if (BaseMath_ReadCallback(quat1) == -1 || BaseMath_ReadCallback(quat2) == -1) return NULL; - for(x = 0; x < QUAT_SIZE; x++) { + for (x = 0; x < QUAT_SIZE; x++) { quat[x] = quat1->quat[x] - quat2->quat[x]; } @@ -732,24 +732,24 @@ static PyObject *Quaternion_mul(PyObject *q1, PyObject *q2) float quat[QUAT_SIZE], scalar; QuaternionObject *quat1 = NULL, *quat2 = NULL; - if(QuaternionObject_Check(q1)) { + if (QuaternionObject_Check(q1)) { quat1 = (QuaternionObject*)q1; - if(BaseMath_ReadCallback(quat1) == -1) + if (BaseMath_ReadCallback(quat1) == -1) return NULL; } - if(QuaternionObject_Check(q2)) { + if (QuaternionObject_Check(q2)) { quat2 = (QuaternionObject*)q2; - if(BaseMath_ReadCallback(quat2) == -1) + if (BaseMath_ReadCallback(quat2) == -1) return NULL; } - if(quat1 && quat2) { /* QUAT*QUAT (cross product) */ + if (quat1 && quat2) { /* QUAT*QUAT (cross product) */ mul_qt_qtqt(quat, quat1->quat, quat2->quat); return newQuaternionObject(quat, Py_NEW, Py_TYPE(q1)); } /* the only case this can happen (for a supported type is "FLOAT*QUAT") */ - else if(quat2) { /* FLOAT*QUAT */ - if(((scalar= PyFloat_AsDouble(q1)) == -1.0f && PyErr_Occurred())==0) { + else if (quat2) { /* FLOAT*QUAT */ + if (((scalar= PyFloat_AsDouble(q1)) == -1.0f && PyErr_Occurred())==0) { return quat_mul_float(quat2, scalar); } } @@ -759,14 +759,14 @@ static PyObject *Quaternion_mul(PyObject *q1, PyObject *q2) VectorObject *vec2 = (VectorObject *)q2; float tvec[3]; - if(vec2->size != 3) { + if (vec2->size != 3) { PyErr_SetString(PyExc_ValueError, "Vector multiplication: " "only 3D vector rotations (with quats) " "currently supported"); return NULL; } - if(BaseMath_ReadCallback(vec2) == -1) { + if (BaseMath_ReadCallback(vec2) == -1) { return NULL; } @@ -776,7 +776,7 @@ static PyObject *Quaternion_mul(PyObject *q1, PyObject *q2) return newVectorObject(tvec, 3, Py_NEW, Py_TYPE(vec2)); } /* QUAT * FLOAT */ - else if((((scalar= PyFloat_AsDouble(q2)) == -1.0f && PyErr_Occurred())==0)) { + else if ((((scalar= PyFloat_AsDouble(q2)) == -1.0f && PyErr_Occurred())==0)) { return quat_mul_float(quat1, scalar); } } @@ -797,7 +797,7 @@ static PyObject *Quaternion_neg(QuaternionObject *self) { float tquat[QUAT_SIZE]; - if(BaseMath_ReadCallback(self) == -1) + if (BaseMath_ReadCallback(self) == -1) return NULL; negate_v4_v4(tquat, self->quat); @@ -874,7 +874,7 @@ static int Quaternion_setAxis(QuaternionObject *self, PyObject *value, void *typ static PyObject *Quaternion_getMagnitude(QuaternionObject *self, void *UNUSED(closure)) { - if(BaseMath_ReadCallback(self) == -1) + if (BaseMath_ReadCallback(self) == -1) return NULL; return PyFloat_FromDouble(sqrt(dot_qtqt(self->quat, self->quat))); @@ -884,7 +884,7 @@ static PyObject *Quaternion_getAngle(QuaternionObject *self, void *UNUSED(closur { float tquat[4]; - if(BaseMath_ReadCallback(self) == -1) + if (BaseMath_ReadCallback(self) == -1) return NULL; normalize_qt_qt(tquat, self->quat); @@ -899,7 +899,7 @@ static int Quaternion_setAngle(QuaternionObject *self, PyObject *value, void *UN float axis[3], angle_dummy; double angle; - if(BaseMath_ReadCallback(self) == -1) + if (BaseMath_ReadCallback(self) == -1) return -1; len= normalize_qt_qt(tquat, self->quat); @@ -907,7 +907,7 @@ static int Quaternion_setAngle(QuaternionObject *self, PyObject *value, void *UN angle= PyFloat_AsDouble(value); - if(angle==-1.0 && PyErr_Occurred()) { /* parsed item not a number */ + if (angle==-1.0 && PyErr_Occurred()) { /* parsed item not a number */ PyErr_SetString(PyExc_TypeError, "Quaternion.angle = value: float expected"); return -1; @@ -916,7 +916,7 @@ static int Quaternion_setAngle(QuaternionObject *self, PyObject *value, void *UN angle= angle_wrap_rad(angle); /* If the axis of rotation is 0,0,0 set it to 1,0,0 - for zero-degree rotations */ - if( EXPP_FloatsAreEqual(axis[0], 0.0f, 10) && + if ( EXPP_FloatsAreEqual(axis[0], 0.0f, 10) && EXPP_FloatsAreEqual(axis[1], 0.0f, 10) && EXPP_FloatsAreEqual(axis[2], 0.0f, 10) ) { @@ -926,7 +926,7 @@ static int Quaternion_setAngle(QuaternionObject *self, PyObject *value, void *UN axis_angle_to_quat(self->quat, axis, angle); mul_qt_fl(self->quat, len); - if(BaseMath_WriteCallback(self) == -1) + if (BaseMath_WriteCallback(self) == -1) return -1; return 0; @@ -939,14 +939,14 @@ static PyObject *Quaternion_getAxisVec(QuaternionObject *self, void *UNUSED(clos float axis[3]; float angle; - if(BaseMath_ReadCallback(self) == -1) + if (BaseMath_ReadCallback(self) == -1) return NULL; normalize_qt_qt(tquat, self->quat); quat_to_axis_angle(axis, &angle, tquat); /* If the axis of rotation is 0,0,0 set it to 1,0,0 - for zero-degree rotations */ - if( EXPP_FloatsAreEqual(axis[0], 0.0f, 10) && + if ( EXPP_FloatsAreEqual(axis[0], 0.0f, 10) && EXPP_FloatsAreEqual(axis[1], 0.0f, 10) && EXPP_FloatsAreEqual(axis[2], 0.0f, 10) ) { @@ -964,7 +964,7 @@ static int Quaternion_setAxisVec(QuaternionObject *self, PyObject *value, void * float axis[3]; float angle; - if(BaseMath_ReadCallback(self) == -1) + if (BaseMath_ReadCallback(self) == -1) return -1; len= normalize_qt_qt(tquat, self->quat); @@ -976,7 +976,7 @@ static int Quaternion_setAxisVec(QuaternionObject *self, PyObject *value, void * axis_angle_to_quat(self->quat, axis, angle); mul_qt_fl(self->quat, len); - if(BaseMath_WriteCallback(self) == -1) + if (BaseMath_WriteCallback(self) == -1) return -1; return 0; @@ -989,14 +989,14 @@ static PyObject *Quaternion_new(PyTypeObject *type, PyObject *args, PyObject *kw double angle = 0.0f; float quat[QUAT_SIZE]= {0.0f, 0.0f, 0.0f, 0.0f}; - if(kwds && PyDict_Size(kwds)) { + if (kwds && PyDict_Size(kwds)) { PyErr_SetString(PyExc_TypeError, "mathutils.Quaternion(): " "takes no keyword args"); return NULL; } - if(!PyArg_ParseTuple(args, "|Od:mathutils.Quaternion", &seq, &angle)) + if (!PyArg_ParseTuple(args, "|Od:mathutils.Quaternion", &seq, &angle)) return NULL; switch(PyTuple_GET_SIZE(args)) { @@ -1021,7 +1021,7 @@ static PyObject *quat__apply_to_copy(PyNoArgsFunction quat_func, QuaternionObjec { PyObject *ret= Quaternion_copy(self); PyObject *ret_dummy= quat_func(ret); - if(ret_dummy) { + if (ret_dummy) { Py_DECREF(ret_dummy); return (PyObject *)ret; } @@ -1144,18 +1144,18 @@ PyObject *newQuaternionObject(float *quat, int type, PyTypeObject *base_type) self= base_type ? (QuaternionObject *)base_type->tp_alloc(base_type, 0) : (QuaternionObject *)PyObject_GC_New(QuaternionObject, &quaternion_Type); - if(self) { + if (self) { /* init callbacks as NULL */ self->cb_user= NULL; self->cb_type= self->cb_subtype= 0; - if(type == Py_WRAP){ + if (type == Py_WRAP) { self->quat = quat; self->wrapped = Py_WRAP; } - else if (type == Py_NEW){ + else if (type == Py_NEW) { self->quat = PyMem_Malloc(QUAT_SIZE * sizeof(float)); - if(!quat) { //new empty + if (!quat) { //new empty unit_qt(self->quat); } else { @@ -1173,7 +1173,7 @@ PyObject *newQuaternionObject(float *quat, int type, PyTypeObject *base_type) PyObject *newQuaternionObject_cb(PyObject *cb_user, int cb_type, int cb_subtype) { QuaternionObject *self= (QuaternionObject *)newQuaternionObject(NULL, Py_NEW, NULL); - if(self) { + if (self) { Py_INCREF(cb_user); self->cb_user= cb_user; self->cb_type= (unsigned char)cb_type; diff --git a/source/blender/python/mathutils/mathutils_Vector.c b/source/blender/python/mathutils/mathutils_Vector.c index 413df78f09e..df8598cc3f1 100644 --- a/source/blender/python/mathutils/mathutils_Vector.c +++ b/source/blender/python/mathutils/mathutils_Vector.c @@ -123,11 +123,11 @@ static PyObject *Vector_normalize(VectorObject *self) if(BaseMath_ReadCallback(self) == -1) return NULL; - for(i = 0; i < self->size; i++) { + for (i = 0; i < self->size; i++) { norm += self->vec[i] * self->vec[i]; } norm = (float) sqrt(norm); - for(i = 0; i < self->size; i++) { + for (i = 0; i < self->size; i++) { self->vec[i] /= norm; } @@ -251,11 +251,11 @@ static PyObject *Vector_resize_4d(VectorObject *self) return NULL; } - if(self->size == 2){ + if(self->size == 2) { self->vec[2] = 0.0f; self->vec[3] = 1.0f; } - else if(self->size == 3){ + else if(self->size == 3) { self->vec[3] = 1.0f; } self->size = 4; @@ -332,12 +332,12 @@ static PyObject *Vector_to_tuple_ext(VectorObject *self, int ndigits) ret= PyTuple_New(self->size); if(ndigits >= 0) { - for(i = 0; i < self->size; i++) { + for (i = 0; i < self->size; i++) { PyTuple_SET_ITEM(ret, i, PyFloat_FromDouble(double_round((double)self->vec[i], ndigits))); } } else { - for(i = 0; i < self->size; i++) { + for (i = 0; i < self->size; i++) { PyTuple_SET_ITEM(ret, i, PyFloat_FromDouble(self->vec[i])); } } @@ -581,7 +581,7 @@ static PyObject *Vector_dot(VectorObject *self, PyObject *value) if(mathutils_array_parse(tvec, self->size, self->size, value, "Vector.dot(other), invalid 'other' arg") == -1) return NULL; - for(x = 0; x < self->size; x++) { + for (x = 0; x < self->size; x++) { dot += (double)(self->vec[x] * tvec[x]); } @@ -621,11 +621,11 @@ static PyObject *Vector_angle(VectorObject *self, PyObject *args) if(mathutils_array_parse(tvec, size, size, value, "Vector.angle(other), invalid 'other' arg") == -1) return NULL; - for(x = 0; x < size; x++) { + for (x = 0; x < size; x++) { test_v1 += (double)(self->vec[x] * self->vec[x]); test_v2 += (double)(tvec[x] * tvec[x]); } - if (!test_v1 || !test_v2){ + if (!test_v1 || !test_v2) { /* avoid exception */ if(fallback) { Py_INCREF(fallback); @@ -640,7 +640,7 @@ static PyObject *Vector_angle(VectorObject *self, PyObject *args) } //dot product - for(x = 0; x < self->size; x++) { + for (x = 0; x < self->size; x++) { dot += (double)(self->vec[x] * tvec[x]); } dot /= (sqrt(test_v1) * sqrt(test_v2)); @@ -714,13 +714,13 @@ static PyObject *Vector_project(VectorObject *self, PyObject *value) return NULL; //get dot products - for(x = 0; x < size; x++) { + for (x = 0; x < size; x++) { dot += (double)(self->vec[x] * tvec[x]); dot2 += (double)(tvec[x] * tvec[x]); } //projection dot /= dot2; - for(x = 0; x < size; x++) { + for (x = 0; x < size; x++) { vec[x] = (float)dot * tvec[x]; } return newVectorObject(vec, size, Py_NEW, Py_TYPE(self)); @@ -757,7 +757,7 @@ static PyObject *Vector_lerp(VectorObject *self, PyObject *args) ifac= 1.0f - fac; - for(x = 0; x < size; x++) { + for (x = 0; x < size; x++) { vec[x] = (ifac * self->vec[x]) + (fac * tvec[x]); } return newVectorObject(vec, size, Py_NEW, Py_TYPE(self)); @@ -872,7 +872,7 @@ static int vector_ass_item_internal(VectorObject *self, int i, PyObject *value, if(i<0) i= self->size-i; - if(i < 0 || i >= self->size){ + if(i < 0 || i >= self->size) { if(is_attr) { PyErr_Format(PyExc_AttributeError, "Vector.%c = x: unavailable on %dd vector", @@ -912,7 +912,7 @@ static PyObject *Vector_slice(VectorObject *self, int begin, int end) begin= MIN2(begin, end); tuple= PyTuple_New(end - begin); - for(count = begin; count < end; count++) { + for (count = begin; count < end; count++) { PyTuple_SET_ITEM(tuple, count - begin, PyFloat_FromDouble(self->vec[count])); } @@ -936,7 +936,7 @@ static int Vector_ass_slice(VectorObject *self, int begin, int end, PyObject *se return -1; /*parsed well - now set in vector*/ - for(y = 0; y < size; y++){ + for (y = 0; y < size; y++) { self->vec[begin + y] = vec[y]; } @@ -1088,7 +1088,7 @@ int column_vector_multiplication(float rvec[MAX_DIMENSIONS], VectorObject* vec, double dot = 0.0f; int x, y, z = 0; - if(mat->row_size != vec->size){ + if(mat->row_size != vec->size) { if(mat->row_size == 4 && vec->size == 3) { vec_cpy[3] = 1.0f; } @@ -1105,8 +1105,8 @@ int column_vector_multiplication(float rvec[MAX_DIMENSIONS], VectorObject* vec, rvec[3] = 1.0f; - for(x = 0; x < mat->col_size; x++) { - for(y = 0; y < mat->row_size; y++) { + for (x = 0; x < mat->col_size; x++) { + for (y = 0; y < mat->row_size; y++) { dot += (double)(mat->matrix[y][x] * vec_cpy[y]); } rvec[z++] = (float)dot; @@ -1153,7 +1153,7 @@ static PyObject *Vector_mul(PyObject *v1, PyObject *v2) } /*dot product*/ - for(i = 0; i < vec1->size; i++) { + for (i = 0; i < vec1->size; i++) { dot += (double)(vec1->vec[i] * vec2->vec[i]); } return PyFloat_FromDouble(dot); @@ -1325,7 +1325,7 @@ static PyObject *Vector_div(PyObject *v1, PyObject *v2) return NULL; } - for(i = 0; i < vec1->size; i++) { + for (i = 0; i < vec1->size; i++) { vec[i] = vec1->vec[i] / scalar; } return newVectorObject(vec, vec1->size, Py_NEW, Py_TYPE(v1)); @@ -1354,7 +1354,7 @@ static PyObject *Vector_idiv(PyObject *v1, PyObject *v2) "divide by zero error"); return NULL; } - for(i = 0; i < vec1->size; i++) { + for (i = 0; i < vec1->size; i++) { vec1->vec[i] /= scalar; } @@ -1383,7 +1383,7 @@ static double vec_magnitude_nosqrt(float *data, int size) double dot = 0.0f; int i; - for(i=0; isize != vecB->size){ - if (comparison_type == Py_NE){ + if (vecA->size != vecB->size) { + if (comparison_type == Py_NE) { Py_RETURN_TRUE; } else { @@ -1426,18 +1426,18 @@ static PyObject* Vector_richcmpr(PyObject *objectA, PyObject *objectB, int compa } } - switch (comparison_type){ + switch (comparison_type) { case Py_LT: lenA = vec_magnitude_nosqrt(vecA->vec, vecA->size); lenB = vec_magnitude_nosqrt(vecB->vec, vecB->size); - if(lenA < lenB){ + if(lenA < lenB) { result = 1; } break; case Py_LE: lenA = vec_magnitude_nosqrt(vecA->vec, vecA->size); lenB = vec_magnitude_nosqrt(vecB->vec, vecB->size); - if(lenA < lenB){ + if(lenA < lenB) { result = 1; } else { @@ -1453,14 +1453,14 @@ static PyObject* Vector_richcmpr(PyObject *objectA, PyObject *objectB, int compa case Py_GT: lenA = vec_magnitude_nosqrt(vecA->vec, vecA->size); lenB = vec_magnitude_nosqrt(vecB->vec, vecB->size); - if(lenA > lenB){ + if(lenA > lenB) { result = 1; } break; case Py_GE: lenA = vec_magnitude_nosqrt(vecA->vec, vecA->size); lenB = vec_magnitude_nosqrt(vecB->vec, vecB->size); - if(lenA > lenB){ + if(lenA > lenB) { result = 1; } else { @@ -1471,7 +1471,7 @@ static PyObject* Vector_richcmpr(PyObject *objectA, PyObject *objectB, int compa printf("The result of the comparison could not be evaluated"); break; } - if (result == 1){ + if (result == 1) { Py_RETURN_TRUE; } else { @@ -1631,7 +1631,7 @@ static PyObject *Vector_getLength(VectorObject *self, void *UNUSED(closure)) if(BaseMath_ReadCallback(self) == -1) return NULL; - for(i = 0; i < self->size; i++){ + for (i = 0; i < self->size; i++) { dot += (double)(self->vec[i] * self->vec[i]); } return PyFloat_FromDouble(sqrt(dot)); @@ -1661,7 +1661,7 @@ static int Vector_setLength(VectorObject *self, PyObject *value) return 0; } - for(i = 0; i < self->size; i++){ + for (i = 0; i < self->size; i++) { dot += (double)(self->vec[i] * self->vec[i]); } @@ -1675,7 +1675,7 @@ static int Vector_setLength(VectorObject *self, PyObject *value) dot= dot/param; - for(i = 0; i < self->size; i++){ + for (i = 0; i < self->size; i++) { self->vec[i]= self->vec[i] / (float)dot; } @@ -1693,7 +1693,7 @@ static PyObject *Vector_getLengthSquared(VectorObject *self, void *UNUSED(closur if(BaseMath_ReadCallback(self) == -1) return NULL; - for(i = 0; i < self->size; i++){ + for (i = 0; i < self->size; i++) { dot += (double)(self->vec[i] * self->vec[i]); } return PyFloat_FromDouble(dot); @@ -1778,7 +1778,7 @@ static int Vector_setSwizzle(VectorObject *self, PyObject *value, void *closure) if (((scalarVal=PyFloat_AsDouble(value)) == -1 && PyErr_Occurred())==0) { int i; - for(i=0; i < MAX_DIMENSIONS; i++) + for (i=0; i < MAX_DIMENSIONS; i++) vec_assign[i]= scalarVal; size_from= axis_from; @@ -2219,8 +2219,8 @@ static int row_vector_multiplication(float rvec[MAX_DIMENSIONS], VectorObject *v double dot = 0.0f; int x, y, z= 0, vec_size= vec->size; - if(mat->col_size != vec_size){ - if(mat->col_size == 4 && vec_size != 3){ + if(mat->col_size != vec_size) { + if(mat->col_size == 4 && vec_size != 3) { PyErr_SetString(PyExc_ValueError, "vector * matrix: matrix column size " "and the vector size must be the same"); @@ -2235,11 +2235,11 @@ static int row_vector_multiplication(float rvec[MAX_DIMENSIONS], VectorObject *v return -1; memcpy(vec_cpy, vec->vec, vec_size * sizeof(float)); -printf("asasas\n"); + rvec[3] = 1.0f; //muliplication - for(x = 0; x < mat->row_size; x++) { - for(y = 0; y < mat->col_size; y++) { + for (x = 0; x < mat->row_size; x++) { + for (y = 0; y < mat->col_size; y++) { dot += mat->matrix[x][y] * vec_cpy[y]; } rvec[z++] = (float)dot; diff --git a/source/blender/python/mathutils/mathutils_geometry.c b/source/blender/python/mathutils/mathutils_geometry.c index 0394d732ae3..dafd89757a9 100644 --- a/source/blender/python/mathutils/mathutils_geometry.c +++ b/source/blender/python/mathutils/mathutils_geometry.c @@ -86,16 +86,16 @@ static PyObject *M_Geometry_intersect_ray_tri(PyObject *UNUSED(self), PyObject* float det, inv_det, u, v, t; int clip= 1; - if(!PyArg_ParseTuple(args, "O!O!O!O!O!|i:intersect_ray_tri", &vector_Type, &vec1, &vector_Type, &vec2, &vector_Type, &vec3, &vector_Type, &ray, &vector_Type, &ray_off , &clip)) { + if (!PyArg_ParseTuple(args, "O!O!O!O!O!|i:intersect_ray_tri", &vector_Type, &vec1, &vector_Type, &vec2, &vector_Type, &vec3, &vector_Type, &ray, &vector_Type, &ray_off , &clip)) { return NULL; } - if(vec1->size != 3 || vec2->size != 3 || vec3->size != 3 || ray->size != 3 || ray_off->size != 3) { + if (vec1->size != 3 || vec2->size != 3 || vec3->size != 3 || ray->size != 3 || ray_off->size != 3) { PyErr_SetString(PyExc_ValueError, "only 3D vectors for all parameters"); return NULL; } - if(BaseMath_ReadCallback(vec1) == -1 || BaseMath_ReadCallback(vec2) == -1 || BaseMath_ReadCallback(vec3) == -1 || BaseMath_ReadCallback(ray) == -1 || BaseMath_ReadCallback(ray_off) == -1) + if (BaseMath_ReadCallback(vec1) == -1 || BaseMath_ReadCallback(vec2) == -1 || BaseMath_ReadCallback(vec3) == -1 || BaseMath_ReadCallback(ray) == -1 || BaseMath_ReadCallback(ray_off) == -1) return NULL; VECCOPY(v1, vec1->vec); @@ -174,19 +174,19 @@ static PyObject *M_Geometry_intersect_line_line(PyObject *UNUSED(self), PyObject VectorObject *vec1, *vec2, *vec3, *vec4; float v1[3], v2[3], v3[3], v4[3], i1[3], i2[3]; - if(!PyArg_ParseTuple(args, "O!O!O!O!:intersect_line_line", &vector_Type, &vec1, &vector_Type, &vec2, &vector_Type, &vec3, &vector_Type, &vec4)) { + if (!PyArg_ParseTuple(args, "O!O!O!O!:intersect_line_line", &vector_Type, &vec1, &vector_Type, &vec2, &vector_Type, &vec3, &vector_Type, &vec4)) { return NULL; } - if(vec1->size != vec2->size || vec1->size != vec3->size || vec3->size != vec2->size) { + if (vec1->size != vec2->size || vec1->size != vec3->size || vec3->size != vec2->size) { PyErr_SetString(PyExc_ValueError, "vectors must be of the same size"); return NULL; } - if(BaseMath_ReadCallback(vec1) == -1 || BaseMath_ReadCallback(vec2) == -1 || BaseMath_ReadCallback(vec3) == -1 || BaseMath_ReadCallback(vec4) == -1) + if (BaseMath_ReadCallback(vec1) == -1 || BaseMath_ReadCallback(vec2) == -1 || BaseMath_ReadCallback(vec3) == -1 || BaseMath_ReadCallback(vec4) == -1) return NULL; - if(vec1->size == 3 || vec1->size == 2) { + if (vec1->size == 3 || vec1->size == 2) { int result; if (vec1->size == 3) { @@ -257,42 +257,42 @@ static PyObject *M_Geometry_normal(PyObject *UNUSED(self), PyObject* args) VectorObject *vec1, *vec2, *vec3, *vec4; float n[3]; - if(PyTuple_GET_SIZE(args) == 3) { - if(!PyArg_ParseTuple(args, "O!O!O!:normal", &vector_Type, &vec1, &vector_Type, &vec2, &vector_Type, &vec3)) { + if (PyTuple_GET_SIZE(args) == 3) { + if (!PyArg_ParseTuple(args, "O!O!O!:normal", &vector_Type, &vec1, &vector_Type, &vec2, &vector_Type, &vec3)) { return NULL; } - if(vec1->size != vec2->size || vec1->size != vec3->size) { + if (vec1->size != vec2->size || vec1->size != vec3->size) { PyErr_SetString(PyExc_ValueError, "vectors must be of the same size"); return NULL; } - if(vec1->size < 3) { + if (vec1->size < 3) { PyErr_SetString(PyExc_ValueError, "2D vectors unsupported"); return NULL; } - if(BaseMath_ReadCallback(vec1) == -1 || BaseMath_ReadCallback(vec2) == -1 || BaseMath_ReadCallback(vec3) == -1) + if (BaseMath_ReadCallback(vec1) == -1 || BaseMath_ReadCallback(vec2) == -1 || BaseMath_ReadCallback(vec3) == -1) return NULL; normal_tri_v3(n, vec1->vec, vec2->vec, vec3->vec); } else { - if(!PyArg_ParseTuple(args, "O!O!O!O!:normal", &vector_Type, &vec1, &vector_Type, &vec2, &vector_Type, &vec3, &vector_Type, &vec4)) { + if (!PyArg_ParseTuple(args, "O!O!O!O!:normal", &vector_Type, &vec1, &vector_Type, &vec2, &vector_Type, &vec3, &vector_Type, &vec4)) { return NULL; } - if(vec1->size != vec2->size || vec1->size != vec3->size || vec1->size != vec4->size) { + if (vec1->size != vec2->size || vec1->size != vec3->size || vec1->size != vec4->size) { PyErr_SetString(PyExc_ValueError, "vectors must be of the same size"); return NULL; } - if(vec1->size < 3) { + if (vec1->size < 3) { PyErr_SetString(PyExc_ValueError, "2D vectors unsupported"); return NULL; } - if(BaseMath_ReadCallback(vec1) == -1 || BaseMath_ReadCallback(vec2) == -1 || BaseMath_ReadCallback(vec3) == -1 || BaseMath_ReadCallback(vec4) == -1) + if (BaseMath_ReadCallback(vec1) == -1 || BaseMath_ReadCallback(vec2) == -1 || BaseMath_ReadCallback(vec3) == -1 || BaseMath_ReadCallback(vec4) == -1) return NULL; normal_quad_v3(n, vec1->vec, vec2->vec, vec3->vec, vec4->vec); @@ -320,17 +320,17 @@ static PyObject *M_Geometry_area_tri(PyObject *UNUSED(self), PyObject* args) { VectorObject *vec1, *vec2, *vec3; - if(!PyArg_ParseTuple(args, "O!O!O!:area_tri", &vector_Type, &vec1, &vector_Type, &vec2, &vector_Type, &vec3)) { + if (!PyArg_ParseTuple(args, "O!O!O!:area_tri", &vector_Type, &vec1, &vector_Type, &vec2, &vector_Type, &vec3)) { return NULL; } - if(vec1->size != vec2->size || vec1->size != vec3->size) { + if (vec1->size != vec2->size || vec1->size != vec3->size) { PyErr_SetString(PyExc_ValueError, "vectors must be of the same size"); return NULL; } - if(BaseMath_ReadCallback(vec1) == -1 || BaseMath_ReadCallback(vec2) == -1 || BaseMath_ReadCallback(vec3) == -1) + if (BaseMath_ReadCallback(vec1) == -1 || BaseMath_ReadCallback(vec2) == -1 || BaseMath_ReadCallback(vec3) == -1) return NULL; if (vec1->size == 3) { @@ -367,7 +367,7 @@ static PyObject *M_Geometry_intersect_line_line_2d(PyObject *UNUSED(self), PyObj { VectorObject *line_a1, *line_a2, *line_b1, *line_b2; float vi[2]; - if(!PyArg_ParseTuple(args, "O!O!O!O!:intersect_line_line_2d", + if (!PyArg_ParseTuple(args, "O!O!O!O!:intersect_line_line_2d", &vector_Type, &line_a1, &vector_Type, &line_a2, &vector_Type, &line_b1, @@ -376,10 +376,10 @@ static PyObject *M_Geometry_intersect_line_line_2d(PyObject *UNUSED(self), PyObj return NULL; } - if(BaseMath_ReadCallback(line_a1) == -1 || BaseMath_ReadCallback(line_a2) == -1 || BaseMath_ReadCallback(line_b1) == -1 || BaseMath_ReadCallback(line_b2) == -1) + if (BaseMath_ReadCallback(line_a1) == -1 || BaseMath_ReadCallback(line_a2) == -1 || BaseMath_ReadCallback(line_b1) == -1 || BaseMath_ReadCallback(line_b2) == -1) return NULL; - if(isect_seg_seg_v2_point(line_a1->vec, line_a2->vec, line_b1->vec, line_b2->vec, vi) == 1) { + if (isect_seg_seg_v2_point(line_a1->vec, line_a2->vec, line_b1->vec, line_b2->vec, vi) == 1) { return newVectorObject(vi, 2, Py_NEW, NULL); } else { @@ -411,7 +411,7 @@ static PyObject *M_Geometry_intersect_line_plane(PyObject *UNUSED(self), PyObjec VectorObject *line_a, *line_b, *plane_co, *plane_no; int no_flip= 0; float isect[3]; - if(!PyArg_ParseTuple(args, "O!O!O!O!|i:intersect_line_plane", + if (!PyArg_ParseTuple(args, "O!O!O!O!|i:intersect_line_plane", &vector_Type, &line_a, &vector_Type, &line_b, &vector_Type, &plane_co, @@ -421,7 +421,7 @@ static PyObject *M_Geometry_intersect_line_plane(PyObject *UNUSED(self), PyObjec return NULL; } - if( BaseMath_ReadCallback(line_a) == -1 || + if ( BaseMath_ReadCallback(line_a) == -1 || BaseMath_ReadCallback(line_b) == -1 || BaseMath_ReadCallback(plane_co) == -1 || BaseMath_ReadCallback(plane_no) == -1 @@ -429,14 +429,14 @@ static PyObject *M_Geometry_intersect_line_plane(PyObject *UNUSED(self), PyObjec return NULL; } - if(ELEM4(2, line_a->size, line_b->size, plane_co->size, plane_no->size)) { + if (ELEM4(2, line_a->size, line_b->size, plane_co->size, plane_no->size)) { PyErr_SetString(PyExc_ValueError, "geometry.intersect_line_plane(...): " " can't use 2D Vectors"); return NULL; } - if(isect_line_plane_v3(isect, line_a->vec, line_b->vec, plane_co->vec, plane_no->vec, no_flip) == 1) { + if (isect_line_plane_v3(isect, line_a->vec, line_b->vec, plane_co->vec, plane_no->vec, no_flip) == 1) { return newVectorObject(isect, 3, Py_NEW, NULL); } else { @@ -471,7 +471,7 @@ static PyObject *M_Geometry_intersect_line_sphere(PyObject *UNUSED(self), PyObje float isect_a[3]; float isect_b[3]; - if(!PyArg_ParseTuple(args, "O!O!O!f|i:intersect_line_sphere", + if (!PyArg_ParseTuple(args, "O!O!O!f|i:intersect_line_sphere", &vector_Type, &line_a, &vector_Type, &line_b, &vector_Type, &sphere_co, @@ -480,14 +480,14 @@ static PyObject *M_Geometry_intersect_line_sphere(PyObject *UNUSED(self), PyObje return NULL; } - if( BaseMath_ReadCallback(line_a) == -1 || + if ( BaseMath_ReadCallback(line_a) == -1 || BaseMath_ReadCallback(line_b) == -1 || BaseMath_ReadCallback(sphere_co) == -1 ) { return NULL; } - if(ELEM3(2, line_a->size, line_b->size, sphere_co->size)) { + if (ELEM3(2, line_a->size, line_b->size, sphere_co->size)) { PyErr_SetString(PyExc_ValueError, "geometry.intersect_line_sphere(...): " " can't use 2D Vectors"); @@ -502,22 +502,22 @@ static PyObject *M_Geometry_intersect_line_sphere(PyObject *UNUSED(self), PyObje switch(isect_line_sphere_v3(line_a->vec, line_b->vec, sphere_co->vec, sphere_radius, isect_a, isect_b)) { case 1: - if(!(!clip || (((lambda= line_point_factor_v3(isect_a, line_a->vec, line_b->vec)) >= 0.0f) && (lambda <= 1.0f)))) use_a= FALSE; + if (!(!clip || (((lambda= line_point_factor_v3(isect_a, line_a->vec, line_b->vec)) >= 0.0f) && (lambda <= 1.0f)))) use_a= FALSE; use_b= FALSE; break; case 2: - if(!(!clip || (((lambda= line_point_factor_v3(isect_a, line_a->vec, line_b->vec)) >= 0.0f) && (lambda <= 1.0f)))) use_a= FALSE; - if(!(!clip || (((lambda= line_point_factor_v3(isect_b, line_a->vec, line_b->vec)) >= 0.0f) && (lambda <= 1.0f)))) use_b= FALSE; + if (!(!clip || (((lambda= line_point_factor_v3(isect_a, line_a->vec, line_b->vec)) >= 0.0f) && (lambda <= 1.0f)))) use_a= FALSE; + if (!(!clip || (((lambda= line_point_factor_v3(isect_b, line_a->vec, line_b->vec)) >= 0.0f) && (lambda <= 1.0f)))) use_b= FALSE; break; default: use_a= FALSE; use_b= FALSE; } - if(use_a) { PyTuple_SET_ITEM(ret, 0, newVectorObject(isect_a, 3, Py_NEW, NULL)); } + if (use_a) { PyTuple_SET_ITEM(ret, 0, newVectorObject(isect_a, 3, Py_NEW, NULL)); } else { PyTuple_SET_ITEM(ret, 0, Py_None); Py_INCREF(Py_None); } - if(use_b) { PyTuple_SET_ITEM(ret, 1, newVectorObject(isect_b, 3, Py_NEW, NULL)); } + if (use_b) { PyTuple_SET_ITEM(ret, 1, newVectorObject(isect_b, 3, Py_NEW, NULL)); } else { PyTuple_SET_ITEM(ret, 1, Py_None); Py_INCREF(Py_None); } return ret; @@ -551,7 +551,7 @@ static PyObject *M_Geometry_intersect_line_sphere_2d(PyObject *UNUSED(self), PyO float isect_a[3]; float isect_b[3]; - if(!PyArg_ParseTuple(args, "O!O!O!f|i:intersect_line_sphere_2d", + if (!PyArg_ParseTuple(args, "O!O!O!f|i:intersect_line_sphere_2d", &vector_Type, &line_a, &vector_Type, &line_b, &vector_Type, &sphere_co, @@ -560,7 +560,7 @@ static PyObject *M_Geometry_intersect_line_sphere_2d(PyObject *UNUSED(self), PyO return NULL; } - if( BaseMath_ReadCallback(line_a) == -1 || + if ( BaseMath_ReadCallback(line_a) == -1 || BaseMath_ReadCallback(line_b) == -1 || BaseMath_ReadCallback(sphere_co) == -1 ) { @@ -575,22 +575,22 @@ static PyObject *M_Geometry_intersect_line_sphere_2d(PyObject *UNUSED(self), PyO switch(isect_line_sphere_v2(line_a->vec, line_b->vec, sphere_co->vec, sphere_radius, isect_a, isect_b)) { case 1: - if(!(!clip || (((lambda= line_point_factor_v2(isect_a, line_a->vec, line_b->vec)) >= 0.0f) && (lambda <= 1.0f)))) use_a= FALSE; + if (!(!clip || (((lambda= line_point_factor_v2(isect_a, line_a->vec, line_b->vec)) >= 0.0f) && (lambda <= 1.0f)))) use_a= FALSE; use_b= FALSE; break; case 2: - if(!(!clip || (((lambda= line_point_factor_v2(isect_a, line_a->vec, line_b->vec)) >= 0.0f) && (lambda <= 1.0f)))) use_a= FALSE; - if(!(!clip || (((lambda= line_point_factor_v2(isect_b, line_a->vec, line_b->vec)) >= 0.0f) && (lambda <= 1.0f)))) use_b= FALSE; + if (!(!clip || (((lambda= line_point_factor_v2(isect_a, line_a->vec, line_b->vec)) >= 0.0f) && (lambda <= 1.0f)))) use_a= FALSE; + if (!(!clip || (((lambda= line_point_factor_v2(isect_b, line_a->vec, line_b->vec)) >= 0.0f) && (lambda <= 1.0f)))) use_b= FALSE; break; default: use_a= FALSE; use_b= FALSE; } - if(use_a) { PyTuple_SET_ITEM(ret, 0, newVectorObject(isect_a, 2, Py_NEW, NULL)); } + if (use_a) { PyTuple_SET_ITEM(ret, 0, newVectorObject(isect_a, 2, Py_NEW, NULL)); } else { PyTuple_SET_ITEM(ret, 0, Py_None); Py_INCREF(Py_None); } - if(use_b) { PyTuple_SET_ITEM(ret, 1, newVectorObject(isect_b, 2, Py_NEW, NULL)); } + if (use_b) { PyTuple_SET_ITEM(ret, 1, newVectorObject(isect_b, 2, Py_NEW, NULL)); } else { PyTuple_SET_ITEM(ret, 1, Py_None); Py_INCREF(Py_None); } return ret; @@ -617,7 +617,7 @@ static PyObject *M_Geometry_intersect_point_line(PyObject *UNUSED(self), PyObjec float lambda; PyObject *ret; - if(!PyArg_ParseTuple(args, "O!O!O!:intersect_point_line", + if (!PyArg_ParseTuple(args, "O!O!O!:intersect_point_line", &vector_Type, &pt, &vector_Type, &line_1, &vector_Type, &line_2) @@ -625,7 +625,7 @@ static PyObject *M_Geometry_intersect_point_line(PyObject *UNUSED(self), PyObjec return NULL; } - if(BaseMath_ReadCallback(pt) == -1 || BaseMath_ReadCallback(line_1) == -1 || BaseMath_ReadCallback(line_2) == -1) + if (BaseMath_ReadCallback(pt) == -1 || BaseMath_ReadCallback(line_1) == -1 || BaseMath_ReadCallback(line_2) == -1) return NULL; /* accept 2d verts */ @@ -666,7 +666,7 @@ static PyObject *M_Geometry_intersect_point_tri_2d(PyObject *UNUSED(self), PyObj { VectorObject *pt_vec, *tri_p1, *tri_p2, *tri_p3; - if(!PyArg_ParseTuple(args, "O!O!O!O!:intersect_point_tri_2d", + if (!PyArg_ParseTuple(args, "O!O!O!O!:intersect_point_tri_2d", &vector_Type, &pt_vec, &vector_Type, &tri_p1, &vector_Type, &tri_p2, @@ -675,7 +675,7 @@ static PyObject *M_Geometry_intersect_point_tri_2d(PyObject *UNUSED(self), PyObj return NULL; } - if(BaseMath_ReadCallback(pt_vec) == -1 || BaseMath_ReadCallback(tri_p1) == -1 || BaseMath_ReadCallback(tri_p2) == -1 || BaseMath_ReadCallback(tri_p3) == -1) + if (BaseMath_ReadCallback(pt_vec) == -1 || BaseMath_ReadCallback(tri_p1) == -1 || BaseMath_ReadCallback(tri_p2) == -1 || BaseMath_ReadCallback(tri_p3) == -1) return NULL; return PyLong_FromLong(isect_point_tri_v2(pt_vec->vec, tri_p1->vec, tri_p2->vec, tri_p3->vec)); @@ -702,7 +702,7 @@ static PyObject *M_Geometry_intersect_point_quad_2d(PyObject *UNUSED(self), PyOb { VectorObject *pt_vec, *quad_p1, *quad_p2, *quad_p3, *quad_p4; - if(!PyArg_ParseTuple(args, "O!O!O!O!O!:intersect_point_quad_2d", + if (!PyArg_ParseTuple(args, "O!O!O!O!O!:intersect_point_quad_2d", &vector_Type, &pt_vec, &vector_Type, &quad_p1, &vector_Type, &quad_p2, @@ -712,7 +712,7 @@ static PyObject *M_Geometry_intersect_point_quad_2d(PyObject *UNUSED(self), PyOb return NULL; } - if(BaseMath_ReadCallback(pt_vec) == -1 || BaseMath_ReadCallback(quad_p1) == -1 || BaseMath_ReadCallback(quad_p2) == -1 || BaseMath_ReadCallback(quad_p3) == -1 || BaseMath_ReadCallback(quad_p4) == -1) + if (BaseMath_ReadCallback(pt_vec) == -1 || BaseMath_ReadCallback(quad_p1) == -1 || BaseMath_ReadCallback(quad_p2) == -1 || BaseMath_ReadCallback(quad_p3) == -1 || BaseMath_ReadCallback(quad_p4) == -1) return NULL; return PyLong_FromLong(isect_point_quad_v2(pt_vec->vec, quad_p1->vec, quad_p2->vec, quad_p3->vec, quad_p4->vec)); @@ -747,7 +747,7 @@ static PyObject *M_Geometry_barycentric_transform(PyObject *UNUSED(self), PyObje VectorObject *vec_t1_src, *vec_t2_src, *vec_t3_src; float vec[3]; - if(!PyArg_ParseTuple(args, "O!O!O!O!O!O!O!:barycentric_transform", + if (!PyArg_ParseTuple(args, "O!O!O!O!O!O!O!:barycentric_transform", &vector_Type, &vec_pt, &vector_Type, &vec_t1_src, &vector_Type, &vec_t2_src, @@ -759,7 +759,7 @@ static PyObject *M_Geometry_barycentric_transform(PyObject *UNUSED(self), PyObje return NULL; } - if( vec_pt->size != 3 || + if ( vec_pt->size != 3 || vec_t1_src->size != 3 || vec_t2_src->size != 3 || vec_t3_src->size != 3 || @@ -814,7 +814,7 @@ static PyObject *M_Geometry_interpolate_bezier(PyObject *UNUSED(self), PyObject* float h2[4]= {0.0, 0.0, 0.0, 0.0}; - if(!PyArg_ParseTuple(args, "O!O!O!O!i:interpolate_bezier", + if (!PyArg_ParseTuple(args, "O!O!O!O!i:interpolate_bezier", &vector_Type, &vec_k1, &vector_Type, &vec_h1, &vector_Type, &vec_h2, @@ -823,30 +823,30 @@ static PyObject *M_Geometry_interpolate_bezier(PyObject *UNUSED(self), PyObject* return NULL; } - if(resolu <= 1) { + if (resolu <= 1) { PyErr_SetString(PyExc_ValueError, "resolution must be 2 or over"); return NULL; } - if(BaseMath_ReadCallback(vec_k1) == -1 || BaseMath_ReadCallback(vec_h1) == -1 || BaseMath_ReadCallback(vec_k2) == -1 || BaseMath_ReadCallback(vec_h2) == -1) + if (BaseMath_ReadCallback(vec_k1) == -1 || BaseMath_ReadCallback(vec_h1) == -1 || BaseMath_ReadCallback(vec_k2) == -1 || BaseMath_ReadCallback(vec_h2) == -1) return NULL; dims= MAX4(vec_k1->size, vec_h1->size, vec_h2->size, vec_k2->size); - for(i=0; i < vec_k1->size; i++) k1[i]= vec_k1->vec[i]; - for(i=0; i < vec_h1->size; i++) h1[i]= vec_h1->vec[i]; - for(i=0; i < vec_k2->size; i++) k2[i]= vec_k2->vec[i]; - for(i=0; i < vec_h2->size; i++) h2[i]= vec_h2->vec[i]; + for (i=0; i < vec_k1->size; i++) k1[i]= vec_k1->vec[i]; + for (i=0; i < vec_h1->size; i++) h1[i]= vec_h1->vec[i]; + for (i=0; i < vec_k2->size; i++) k2[i]= vec_k2->vec[i]; + for (i=0; i < vec_h2->size; i++) h2[i]= vec_h2->vec[i]; coord_array= MEM_callocN(dims * (resolu) * sizeof(float), "interpolate_bezier"); - for(i=0; iverts to set the points from the vectors */ int index, *dl_face, totpoints=0; - if(!PySequence_Check(polyLineSeq)) { + if (!PySequence_Check(polyLineSeq)) { PyErr_SetString(PyExc_TypeError, "expected a sequence of poly lines"); return NULL; @@ -883,7 +883,7 @@ static PyObject *M_Geometry_tesselate_polygon(PyObject *UNUSED(self), PyObject * len_polylines= PySequence_Size(polyLineSeq); - for(i= 0; i < len_polylines; ++i) { + for (i= 0; i < len_polylines; ++i) { polyLine= PySequence_GetItem(polyLineSeq, i); if (!PySequence_Check(polyLine)) { freedisplist(&dispbase); @@ -914,16 +914,16 @@ static PyObject *M_Geometry_tesselate_polygon(PyObject *UNUSED(self), PyObject * dl->verts= fp= MEM_callocN(sizeof(float)*3*len_polypoints, "dl verts"); dl->index= MEM_callocN(sizeof(int)*3*len_polypoints, "dl index"); - for(index= 0; indexvec[0]; fp[1]= ((VectorObject *)polyVec)->vec[1]; - if(((VectorObject *)polyVec)->size > 2) + if (((VectorObject *)polyVec)->size > 2) fp[2]= ((VectorObject *)polyVec)->vec[2]; else fp[2]= 0.0f; /* if its a 2d vector then set the z to be zero */ @@ -939,7 +939,7 @@ static PyObject *M_Geometry_tesselate_polygon(PyObject *UNUSED(self), PyObject * Py_DECREF(polyLine); } - if(ls_error) { + if (ls_error) { freedisplist(&dispbase); /* possible some dl was allocated */ PyErr_SetString(PyExc_TypeError, "A point in one of the polylines " @@ -955,7 +955,7 @@ static PyObject *M_Geometry_tesselate_polygon(PyObject *UNUSED(self), PyObject * dl= dispbase.first; tri_list= PyList_New(dl->parts); - if(!tri_list) { + if (!tri_list) { freedisplist(&dispbase); PyErr_SetString(PyExc_RuntimeError, "failed to make a new list"); @@ -964,7 +964,7 @@ static PyObject *M_Geometry_tesselate_polygon(PyObject *UNUSED(self), PyObject * index= 0; dl_face= dl->index; - while(index < dl->parts) { + while (index < dl->parts) { PyList_SET_ITEM(tri_list, index, Py_BuildValue("iii", dl_face[0], dl_face[1], dl_face[2])); dl_face+= 3; index++; @@ -989,7 +989,7 @@ static int boxPack_FromPyObject(PyObject *value, boxPack **boxarray) /* Error checking must already be done */ - if(!PyList_Check(value)) { + if (!PyList_Check(value)) { PyErr_SetString(PyExc_TypeError, "can only back a list of [x, y, w, h]"); return -1; @@ -1000,9 +1000,9 @@ static int boxPack_FromPyObject(PyObject *value, boxPack **boxarray) (*boxarray)= MEM_mallocN(len*sizeof(boxPack), "boxPack box"); - for(i= 0; i < len; i++) { + for (i= 0; i < len; i++) { list_item= PyList_GET_ITEM(value, i); - if(!PyList_Check(list_item) || PyList_GET_SIZE(list_item) < 4) { + if (!PyList_Check(list_item) || PyList_GET_SIZE(list_item) < 4) { MEM_freeN(*boxarray); PyErr_SetString(PyExc_TypeError, "can only pack a list of [x, y, w, h]"); @@ -1040,7 +1040,7 @@ static void boxPack_ToPyObject(PyObject *value, boxPack **boxarray) len= PyList_GET_SIZE(value); - for(i= 0; i < len; i++) { + for (i= 0; i < len; i++) { box= (*boxarray)+i; list_item= PyList_GET_ITEM(value, box->index); PyList_SET_ITEM(list_item, 0, PyFloat_FromDouble(box->x)); @@ -1066,7 +1066,7 @@ static PyObject *M_Geometry_box_pack_2d(PyObject *UNUSED(self), PyObject *boxlis PyObject *ret; - if(!PyList_Check(boxlist)) { + if (!PyList_Check(boxlist)) { PyErr_SetString(PyExc_TypeError, "expected a list of boxes [[x, y, w, h], ... ]"); return NULL; @@ -1075,7 +1075,7 @@ static PyObject *M_Geometry_box_pack_2d(PyObject *UNUSED(self), PyObject *boxlis len= PyList_GET_SIZE(boxlist); if (len) { boxPack *boxarray= NULL; - if(boxPack_FromPyObject(boxlist, &boxarray) == -1) { + if (boxPack_FromPyObject(boxlist, &boxarray) == -1) { return NULL; /* exception set */ } -- cgit v1.2.3 From fa033e313ea7380746a7bbe42a9a7665c85b43d8 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 13 Oct 2011 01:51:45 +0000 Subject: correct some invalid exception types. --- source/blender/python/intern/bpy_rna.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c index c08f981c2f2..c4ef866722d 100644 --- a/source/blender/python/intern/bpy_rna.c +++ b/source/blender/python/intern/bpy_rna.c @@ -2017,7 +2017,8 @@ static PyObject *pyrna_prop_array_subscript_int(BPy_PropertyArrayRNA *self, int if (keynum >= 0 && keynum < len) return pyrna_prop_array_to_py_index(self, keynum); - PyErr_Format(PyExc_IndexError, "bpy_prop_array[index]: index %d out of range", keynum); + PyErr_Format(PyExc_IndexError, + "bpy_prop_array[index]: index %d out of range", keynum); return NULL; } @@ -2503,7 +2504,8 @@ static int prop_subscript_ass_array_int(BPy_PropertyArrayRNA *self, Py_ssize_t k if (keynum >= 0 && keynum < len) return pyrna_py_to_prop_array_index(self, keynum, value); - PyErr_SetString(PyExc_IndexError, "bpy_prop_array[index] = value: index out of range"); + PyErr_SetString(PyExc_IndexError, + "bpy_prop_array[index] = value: index out of range"); return -1; } @@ -2936,7 +2938,7 @@ static PyObject *pyrna_struct_path_resolve(BPy_StructRNA *self, PyObject *args) if (r_prop) { if (index != -1) { if (index >= RNA_property_array_length(&r_ptr, r_prop) || index < 0) { - PyErr_Format(PyExc_TypeError, + PyErr_Format(PyExc_IndexError, "%.200s.path_resolve(\"%.200s\") index out of range", RNA_struct_identifier(self->ptr.type), path); return NULL; @@ -2959,7 +2961,7 @@ static PyObject *pyrna_struct_path_resolve(BPy_StructRNA *self, PyObject *args) } } else { - PyErr_Format(PyExc_TypeError, + PyErr_Format(PyExc_ValueError, "%.200s.path_resolve(\"%.200s\") could not be resolved", RNA_struct_identifier(self->ptr.type), path); return NULL; @@ -2993,7 +2995,7 @@ static PyObject *pyrna_struct_path_from_id(BPy_StructRNA *self, PyObject *args) if (name) { prop= RNA_struct_find_property(&self->ptr, name); if (prop==NULL) { - PyErr_Format(PyExc_TypeError, + PyErr_Format(PyExc_AttributeError, "%.200s.path_from_id(\"%.200s\") not found", RNA_struct_identifier(self->ptr.type), name); return NULL; @@ -3007,12 +3009,12 @@ static PyObject *pyrna_struct_path_from_id(BPy_StructRNA *self, PyObject *args) if (path==NULL) { if (name) { - PyErr_Format(PyExc_TypeError, + PyErr_Format(PyExc_ValueError, "%.200s.path_from_id(\"%s\") found but does not support path creation", RNA_struct_identifier(self->ptr.type), name); } else { - PyErr_Format(PyExc_TypeError, + PyErr_Format(PyExc_ValueError, "%.200s.path_from_id() does not support path creation for this type", RNA_struct_identifier(self->ptr.type)); } @@ -3042,7 +3044,7 @@ static PyObject *pyrna_prop_path_from_id(BPy_PropertyRNA *self) path= RNA_path_from_ID_to_property(&self->ptr, self->prop); if (path==NULL) { - PyErr_Format(PyExc_TypeError, + PyErr_Format(PyExc_ValueError, "%.200s.%.200s.path_from_id() does not support path creation for this type", RNA_struct_identifier(self->ptr.type), RNA_property_identifier(prop)); return NULL; -- cgit v1.2.3 From 49b1a319c44f0ac3db45652f4cb022d2e1a93d40 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 13 Oct 2011 03:35:08 +0000 Subject: fix [#28898] Segmentation fault when Home key during GreasePencil dopesheet pressed --- source/blender/editors/space_action/action_edit.c | 38 +++++++++++++++-------- 1 file changed, 25 insertions(+), 13 deletions(-) diff --git a/source/blender/editors/space_action/action_edit.c b/source/blender/editors/space_action/action_edit.c index a05053a2d9d..7bf0f98b471 100644 --- a/source/blender/editors/space_action/action_edit.c +++ b/source/blender/editors/space_action/action_edit.c @@ -246,20 +246,32 @@ static void get_keyframe_extents (bAnimContext *ac, float *min, float *max, cons /* go through channels, finding max extents */ for (ale= anim_data.first; ale; ale= ale->next) { AnimData *adt= ANIM_nla_mapping_get(ac, ale); - FCurve *fcu= (FCurve *)ale->key_data; - float tmin, tmax; - - /* get range and apply necessary scaling before processing */ - calc_fcurve_range(fcu, &tmin, &tmax, onlySel); - - if (adt) { - tmin= BKE_nla_tweakedit_remap(adt, tmin, NLATIME_CONVERT_MAP); - tmax= BKE_nla_tweakedit_remap(adt, tmax, NLATIME_CONVERT_MAP); + if (ale->datatype == ALE_GPFRAME) { + bGPDlayer *gpl= ale->data; + bGPDframe *gpf; + + /* find gp-frame which is less than or equal to cframe */ + for (gpf= gpl->frames.first; gpf; gpf= gpf->next) { + *min= MIN2(*min, gpf->framenum); + *max= MAX2(*max, gpf->framenum); + } + } + else { + FCurve *fcu= (FCurve *)ale->key_data; + float tmin, tmax; + + /* get range and apply necessary scaling before processing */ + calc_fcurve_range(fcu, &tmin, &tmax, onlySel); + + if (adt) { + tmin= BKE_nla_tweakedit_remap(adt, tmin, NLATIME_CONVERT_MAP); + tmax= BKE_nla_tweakedit_remap(adt, tmax, NLATIME_CONVERT_MAP); + } + + /* try to set cur using these values, if they're more extreme than previously set values */ + *min= MIN2(*min, tmin); + *max= MAX2(*max, tmax); } - - /* try to set cur using these values, if they're more extreme than previously set values */ - *min= MIN2(*min, tmin); - *max= MAX2(*max, tmax); } /* free memory */ -- cgit v1.2.3 From 03c72a5ba0fd29542eced2276f63241d3b8cd572 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 13 Oct 2011 04:06:32 +0000 Subject: ensure grease pencil layer names are unique when set through rna. --- source/blender/blenkernel/intern/gpencil.c | 2 +- source/blender/makesdna/DNA_gpencil_types.h | 3 ++- source/blender/makesrna/intern/rna_gpencil.c | 14 ++++++++++++++ 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/source/blender/blenkernel/intern/gpencil.c b/source/blender/blenkernel/intern/gpencil.c index 06ca7b7b509..fa493315d4b 100644 --- a/source/blender/blenkernel/intern/gpencil.c +++ b/source/blender/blenkernel/intern/gpencil.c @@ -185,7 +185,7 @@ bGPDlayer *gpencil_layer_addnew (bGPdata *gpd) /* auto-name */ strcpy(gpl->info, "GP_Layer"); - BLI_uniquename(&gpd->layers, gpl, "GP_Layer", '.', offsetof(bGPDlayer, info[0]), sizeof(gpl->info)); + BLI_uniquename(&gpd->layers, gpl, "GP_Layer", '.', offsetof(bGPDlayer, info), sizeof(gpl->info)); /* make this one the active one */ gpencil_layer_setactive(gpd, gpl); diff --git a/source/blender/makesdna/DNA_gpencil_types.h b/source/blender/makesdna/DNA_gpencil_types.h index b259d592864..a4d0b3685e3 100644 --- a/source/blender/makesdna/DNA_gpencil_types.h +++ b/source/blender/makesdna/DNA_gpencil_types.h @@ -99,7 +99,8 @@ typedef struct bGPDlayer { float color[4]; /* color that should be used to draw all the strokes in this layer */ - char info[128]; /* optional reference info about this layer (i.e. "director's comments, 12/3") */ + char info[128]; /* optional reference info about this layer (i.e. "director's comments, 12/3") + * this is used for the name of the layer too and kept unique. */ } bGPDlayer; /* bGPDlayer->flag */ diff --git a/source/blender/makesrna/intern/rna_gpencil.c b/source/blender/makesrna/intern/rna_gpencil.c index 810db9f3634..371c387e871 100644 --- a/source/blender/makesrna/intern/rna_gpencil.c +++ b/source/blender/makesrna/intern/rna_gpencil.c @@ -40,6 +40,8 @@ #ifdef RNA_RUNTIME +#include "BLI_path_util.h" + static int rna_GPencilLayer_active_frame_editable(PointerRNA *ptr) { bGPDlayer *gpl= (bGPDlayer *)ptr->data; @@ -90,6 +92,17 @@ static void rna_GPencil_active_layer_set(PointerRNA *ptr, PointerRNA value) } } +void rna_GPencilLayer_info_set(PointerRNA *ptr, const char *value) +{ + bGPdata *gpd= ptr->id.data; + bGPDlayer *gpl= ptr->data; + + /* copy the new name into the name slot */ + BLI_strncpy_utf8(gpl->info, value, sizeof(gpl->info)); + + BLI_uniquename(&gpd->layers, gpl, "GP_Layer", '.', offsetof(bGPDlayer, info), sizeof(gpl->info)); +} + #else static void rna_def_gpencil_stroke_point(BlenderRNA *brna) @@ -176,6 +189,7 @@ static void rna_def_gpencil_layer(BlenderRNA *brna) /* Name */ prop= RNA_def_property(srna, "info", PROP_STRING, PROP_NONE); RNA_def_property_ui_text(prop, "Info", "Layer name"); + RNA_def_property_string_funcs(prop, NULL, NULL, "rna_GPencilLayer_info_set"); RNA_def_struct_name_property(srna, prop); /* Frames */ -- cgit v1.2.3 From 19b9329885b440666df6f60156679127f6026231 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 13 Oct 2011 04:44:39 +0000 Subject: fix for leak when switching between transform rotation modes. --- source/blender/editors/transform/transform_input.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/source/blender/editors/transform/transform_input.c b/source/blender/editors/transform/transform_input.c index a1e1c0e0b1d..125ba8b511d 100644 --- a/source/blender/editors/transform/transform_input.c +++ b/source/blender/editors/transform/transform_input.c @@ -312,6 +312,11 @@ static void calcSpringFactor(MouseInput *mi) void initMouseInputMode(TransInfo *t, MouseInput *mi, MouseInputMode mode) { + /* may have been allocated previously */ + if(mi->data) { + MEM_freeN(mi->data); + mi->data= NULL; + } switch(mode) { -- cgit v1.2.3 From 7360f64a5138ce633fda93fbe06d850daa649d57 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 13 Oct 2011 06:07:11 +0000 Subject: radius interpolation was incorrectly greyed out for 2D curves. --- release/scripts/startup/bl_ui/properties_data_curve.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/release/scripts/startup/bl_ui/properties_data_curve.py b/release/scripts/startup/bl_ui/properties_data_curve.py index 2e0b36a7a75..02e13966c48 100644 --- a/release/scripts/startup/bl_ui/properties_data_curve.py +++ b/release/scripts/startup/bl_ui/properties_data_curve.py @@ -259,10 +259,11 @@ class DATA_PT_active_spline(CurveButtonsPanelActive, Panel): if not is_surf: split = layout.split() col = split.column() - col.active = (curve.dimensions == '3D') col.label(text="Interpolation:") - col.prop(act_spline, "tilt_interpolation", text="Tilt") + colsub = col.column() + colsub.active = (curve.dimensions == '3D') + colsub.prop(act_spline, "tilt_interpolation", text="Tilt") col.prop(act_spline, "radius_interpolation", text="Radius") layout.prop(act_spline, "use_smooth") -- cgit v1.2.3 From c40b976ea87bcbab01a8f939d20996ba1a465772 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 13 Oct 2011 06:59:09 +0000 Subject: py docs - gpu module wasn't included in docs. also added convenience target to build sphinx api docs: make doc_py --- GNUmakefile | 14 ++++++++++++++ doc/python_api/rst/gpu.rst | 6 ++++-- doc/python_api/sphinx_doc_gen.py | 10 ++++++++++ 3 files changed, 28 insertions(+), 2 deletions(-) diff --git a/GNUmakefile b/GNUmakefile index aad3c58938c..f92b0093eae 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -145,6 +145,9 @@ help: @echo " * check_splint - run blenders source through splint (C only)" @echo " * check_sparse - run blenders source through sparse (C only)" @echo "" + @echo "Documentation Targets" + @echo " * doc_py - generate sphinx python api docs" + @echo "" # ----------------------------------------------------------------------------- # Packages @@ -222,6 +225,17 @@ check_sparse: cd $(BUILD_DIR) ; python3 $(BLENDER_DIR)/build_files/cmake/cmake_static_check_sparse.py +# ----------------------------------------------------------------------------- +# Documentation +# + +# Simple version of ./doc/python_api/sphinx_doc_gen.sh with no PDF generation. +doc_py: + $(BUILD_DIR)/bin/blender --background --factory-startup --python doc/python_api/sphinx_doc_gen.py + cd doc/python_api ; sphinx-build -n -b html sphinx-in sphinx-out + @echo "docs written into: 'doc/python_api/sphinx-out/index.html'" + + clean: $(MAKE) -C $(BUILD_DIR) clean diff --git a/doc/python_api/rst/gpu.rst b/doc/python_api/rst/gpu.rst index 72a5dc2f5d3..2ca7fdda9d5 100644 --- a/doc/python_api/rst/gpu.rst +++ b/doc/python_api/rst/gpu.rst @@ -1,7 +1,10 @@ - GPU functions (gpu) =================== +.. module:: gpu + +This module provides access to materials GLSL shaders. + ***** Intro ***** @@ -16,7 +19,6 @@ and in the game engine. are are closely related to Blender's internal GLSL code and may change if the GLSL code is modified (e.g. new uniform type). -.. module:: gpu ********* Constants diff --git a/doc/python_api/sphinx_doc_gen.py b/doc/python_api/sphinx_doc_gen.py index 8743a89057e..2ccf67e2db4 100644 --- a/doc/python_api/sphinx_doc_gen.py +++ b/doc/python_api/sphinx_doc_gen.py @@ -83,6 +83,7 @@ else: "aud", "bgl", "blf", + "gpu", "mathutils", "mathutils.geometry", ) @@ -1122,6 +1123,8 @@ def rna2sphinx(BASEPATH): fw(" bgl.rst\n\n") if "blf" not in EXCLUDE_MODULES: fw(" blf.rst\n\n") + if "gpu" not in EXCLUDE_MODULES: + fw(" gpu.rst\n\n") if "aud" not in EXCLUDE_MODULES: fw(" aud.rst\n\n") if "bpy_extras" not in EXCLUDE_MODULES: @@ -1262,6 +1265,13 @@ def rna2sphinx(BASEPATH): import shutil shutil.copy2(os.path.join(BASEPATH, "..", "rst", "bgl.rst"), BASEPATH) + if "gpu" not in EXCLUDE_MODULES: + #import gpu as module + #pymodule2sphinx(BASEPATH, "gpu", module, "GPU Shader Module") + #del module + import shutil + shutil.copy2(os.path.join(BASEPATH, "..", "rst", "gpu.rst"), BASEPATH) + if "aud" not in EXCLUDE_MODULES: import aud as module pymodule2sphinx(BASEPATH, "aud", module, "Audio System") -- cgit v1.2.3 From 05b47c28fa8f12bc16db3e21ddcb9a57f3f1e7fa Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Thu, 13 Oct 2011 08:56:21 +0000 Subject: Revert part of recent fix for movie resolution. It helped to make things works better for some movies but it didn't help proxies to work properly. Correct fix seems a bit larger and better not be made atm, so to keep behavior of proxies and original movie consistent keep resolution behaves like it was before recent changes, --- source/blender/imbuf/intern/anim_movie.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/source/blender/imbuf/intern/anim_movie.c b/source/blender/imbuf/intern/anim_movie.c index 01b3e71ad8a..c1ef8c4792b 100644 --- a/source/blender/imbuf/intern/anim_movie.c +++ b/source/blender/imbuf/intern/anim_movie.c @@ -418,7 +418,6 @@ static int startffmpeg(struct anim * anim) { int frs_num; double frs_den; int streamcount; - int width, height; #ifdef FFMPEG_SWSCALE_COLOR_SPACE_SUPPORT /* The following for color space determination */ @@ -475,9 +474,6 @@ static int startffmpeg(struct anim * anim) { pCodecCtx->workaround_bugs = 1; - width = pCodecCtx->width; - height = pCodecCtx->height; - if(avcodec_open(pCodecCtx, pCodec) < 0) { av_close_input_file(pFormatCtx); return -1; @@ -502,8 +498,8 @@ static int startffmpeg(struct anim * anim) { anim->params = 0; - anim->x = width; - anim->y = height; + anim->x = pCodecCtx->width; + anim->y = pCodecCtx->height; anim->interlacing = 0; anim->orientation = 0; anim->framesize = anim->x * anim->y * 4; -- cgit v1.2.3 From fa3b4e1830b0f51b058b54346fcccf9849d84e13 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 13 Oct 2011 14:10:38 +0000 Subject: correct collada lib linking order (wasnt building for me), and sphinx doc syntax warning. --- build_files/cmake/Modules/FindOpenCOLLADA.cmake | 5 +++-- source/blender/python/intern/bpy_rna.c | 4 +++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/build_files/cmake/Modules/FindOpenCOLLADA.cmake b/build_files/cmake/Modules/FindOpenCOLLADA.cmake index 0c8d8c8d841..77c8b09c4ac 100644 --- a/build_files/cmake/Modules/FindOpenCOLLADA.cmake +++ b/build_files/cmake/Modules/FindOpenCOLLADA.cmake @@ -53,10 +53,11 @@ SET(_opencollada_FIND_COMPONENTS ) # Fedora openCOLLADA package links these statically +# note that order is important here ot it wont link SET(_opencollada_FIND_STATIC_COMPONENTS - UTF - ftoa buffer + ftoa + UTF ) SET(_opencollada_SEARCH_DIRS diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c index c4ef866722d..76dcf9729ca 100644 --- a/source/blender/python/intern/bpy_rna.c +++ b/source/blender/python/intern/bpy_rna.c @@ -85,7 +85,9 @@ static PyObject* pyrna_struct_Subtype(PointerRNA *ptr); static PyObject *pyrna_prop_collection_values(BPy_PropertyRNA *self); #define BPY_DOC_ID_PROP_TYPE_NOTE \ -" .. note:: Only :class:`bpy.types.ID`, :class:`bpy.types.Bone` and \n" \ +" .. note::\n" \ +"\n" \ +" Only :class:`bpy.types.ID`, :class:`bpy.types.Bone` and \n" \ " :class:`bpy.types.PoseBone` classes support custom properties.\n" -- cgit v1.2.3 From 818c098004ff64adcc0ff24fe29d40850f5591ce Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 13 Oct 2011 14:32:45 +0000 Subject: comment own recent memory leak fix since it broke edge slide. --- source/blender/editors/transform/transform_input.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/source/blender/editors/transform/transform_input.c b/source/blender/editors/transform/transform_input.c index 125ba8b511d..1c3241237f5 100644 --- a/source/blender/editors/transform/transform_input.c +++ b/source/blender/editors/transform/transform_input.c @@ -313,10 +313,14 @@ static void calcSpringFactor(MouseInput *mi) void initMouseInputMode(TransInfo *t, MouseInput *mi, MouseInputMode mode) { /* may have been allocated previously */ + /* TODO, holding R-key can cause mem leak, but this causes [#28903] + * disable for now. */ +#if 0 if(mi->data) { MEM_freeN(mi->data); mi->data= NULL; } +#endif switch(mode) { -- cgit v1.2.3 From d893ac690cfe34e922d34a65a1ca526f8297c129 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 13 Oct 2011 22:14:41 +0000 Subject: rename confusing constants (no functional change) - OB_BOUND_POLYT --> OB_BOUND_CONVEX_HULL - OB_BOUND_POLYH --> OB_BOUND_TRIANGLE_MESH --- source/blender/makesdna/DNA_object_types.h | 14 +++++++------- source/blender/makesrna/intern/rna_object.c | 14 +++++++------- source/gameengine/Converter/BL_BlenderDataConversion.cpp | 4 ++-- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/source/blender/makesdna/DNA_object_types.h b/source/blender/makesdna/DNA_object_types.h index f0c7cf8cc45..6faf86b74a5 100644 --- a/source/blender/makesdna/DNA_object_types.h +++ b/source/blender/makesdna/DNA_object_types.h @@ -412,14 +412,14 @@ typedef struct DupliObject { #define OB_EMPTY_IMAGE 8 /* boundtype */ -#define OB_BOUND_BOX 0 -#define OB_BOUND_SPHERE 1 -#define OB_BOUND_CYLINDER 2 -#define OB_BOUND_CONE 3 -#define OB_BOUND_POLYH 4 -#define OB_BOUND_POLYT 5 +#define OB_BOUND_BOX 0 +#define OB_BOUND_SPHERE 1 +#define OB_BOUND_CYLINDER 2 +#define OB_BOUND_CONE 3 +#define OB_BOUND_TRIANGLE_MESH 4 +#define OB_BOUND_CONVEX_HULL 5 /* #define OB_BOUND_DYN_MESH 6 */ /*UNUSED*/ -#define OB_BOUND_CAPSULE 7 +#define OB_BOUND_CAPSULE 7 /* **************** BASE ********************* */ diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c index 428599af977..bbbec3bcf9a 100644 --- a/source/blender/makesrna/intern/rna_object.c +++ b/source/blender/makesrna/intern/rna_object.c @@ -83,8 +83,8 @@ static EnumPropertyItem collision_bounds_items[] = { {OB_BOUND_SPHERE, "SPHERE", 0, "Sphere", ""}, {OB_BOUND_CYLINDER, "CYLINDER", 0, "Cylinder", ""}, {OB_BOUND_CONE, "CONE", 0, "Cone", ""}, - {OB_BOUND_POLYT, "CONVEX_HULL", 0, "Convex Hull", ""}, - {OB_BOUND_POLYH, "TRIANGLE_MESH", 0, "Triangle Mesh", ""}, + {OB_BOUND_CONVEX_HULL, "CONVEX_HULL", 0, "Convex Hull", ""}, + {OB_BOUND_TRIANGLE_MESH, "TRIANGLE_MESH", 0, "Triangle Mesh", ""}, {OB_BOUND_CAPSULE, "CAPSULE", 0, "Capsule", ""}, //{OB_DYN_MESH, "DYNAMIC_MESH", 0, "Dynamic Mesh", ""}, {0, NULL, 0, NULL, NULL}}; @@ -430,8 +430,8 @@ static EnumPropertyItem *rna_Object_collision_bounds_itemf(bContext *UNUSED(C), EnumPropertyItem *item= NULL; int totitem= 0; - RNA_enum_items_add_value(&item, &totitem, collision_bounds_items, OB_BOUND_POLYH); - RNA_enum_items_add_value(&item, &totitem, collision_bounds_items, OB_BOUND_POLYT); + RNA_enum_items_add_value(&item, &totitem, collision_bounds_items, OB_BOUND_TRIANGLE_MESH); + RNA_enum_items_add_value(&item, &totitem, collision_bounds_items, OB_BOUND_CONVEX_HULL); if(ob->body_type!=OB_BODY_TYPE_SOFT) { RNA_enum_items_add_value(&item, &totitem, collision_bounds_items, OB_BOUND_CONE); @@ -934,9 +934,9 @@ static void rna_GameObjectSettings_physics_type_set(PointerRNA *ptr, int value) ob->gameflag &= ~(OB_RIGID_BODY|OB_OCCLUDER|OB_SENSOR|OB_NAVMESH); /* assume triangle mesh, if no bounds chosen for soft body */ - if ((ob->gameflag & OB_BOUNDS) && (ob->boundtypegameflag & OB_BOUNDS) && (ob->boundtypeboundtype=OB_BOUND_POLYH; + ob->boundtype= OB_BOUND_TRIANGLE_MESH; } /* create a BulletSoftBody structure if not already existing */ if (!ob->bsoft) @@ -1804,7 +1804,7 @@ static void rna_def_object(BlenderRNA *brna) {OB_BOUND_SPHERE, "SPHERE", 0, "Sphere", "Draw bounds as sphere"}, {OB_BOUND_CYLINDER, "CYLINDER", 0, "Cylinder", "Draw bounds as cylinder"}, {OB_BOUND_CONE, "CONE", 0, "Cone", "Draw bounds as cone"}, - {OB_BOUND_POLYH, "POLYHEDRON", 0, "Polyhedron", "Draw bounds as polyhedron"}, + {OB_BOUND_TRIANGLE_MESH, "POLYHEDRON", 0, "Polyhedron", "Draw bounds as polyhedron"}, {OB_BOUND_CAPSULE, "CAPSULE", 0, "Capsule", "Draw bounds as capsule"}, {0, NULL, 0, NULL, NULL}}; diff --git a/source/gameengine/Converter/BL_BlenderDataConversion.cpp b/source/gameengine/Converter/BL_BlenderDataConversion.cpp index 8633a14de03..e6783d7c106 100644 --- a/source/gameengine/Converter/BL_BlenderDataConversion.cpp +++ b/source/gameengine/Converter/BL_BlenderDataConversion.cpp @@ -1590,7 +1590,7 @@ void BL_CreatePhysicsObjectNew(KX_GameObject* gameobj, objprop.m_boundobject.box.m_extends[1]=2.f*bb.m_extends[1]; objprop.m_boundobject.box.m_extends[2]=2.f*bb.m_extends[2]; break; - case OB_BOUND_POLYT: + case OB_BOUND_CONVEX_HULL: if (blenderobject->type == OB_MESH) { objprop.m_boundclass = KX_BOUNDPOLYTOPE; @@ -1598,7 +1598,7 @@ void BL_CreatePhysicsObjectNew(KX_GameObject* gameobj, } // Object is not a mesh... fall through OB_BOUND_POLYH to // OB_BOUND_SPHERE - case OB_BOUND_POLYH: + case OB_BOUND_TRIANGLE_MESH: if (blenderobject->type == OB_MESH) { objprop.m_boundclass = KX_BOUNDMESH; -- cgit v1.2.3 From 9e17ecf0100af4e95f32a7b03673e880a9fc8d1e Mon Sep 17 00:00:00 2001 From: Joerg Mueller Date: Thu, 13 Oct 2011 22:19:29 +0000 Subject: Fixing [#28907] Frozen playback. Also fixing two more crashes when audio files don't exist/cannot be read and apply a changed file path of a sound, reported by Jens Verwiebe in IRC. --- intern/audaspace/intern/AUD_NULLDevice.cpp | 8 ++++---- source/blender/blenkernel/intern/sound.c | 11 ++++++++--- source/blender/editors/space_sequencer/sequencer_draw.c | 3 +++ source/blender/makesrna/intern/rna_sequencer.c | 2 ++ source/blender/windowmanager/intern/wm_event_system.c | 13 ++++++++----- 5 files changed, 25 insertions(+), 12 deletions(-) diff --git a/intern/audaspace/intern/AUD_NULLDevice.cpp b/intern/audaspace/intern/AUD_NULLDevice.cpp index b7d658aafe6..cb76f9eab88 100644 --- a/intern/audaspace/intern/AUD_NULLDevice.cpp +++ b/intern/audaspace/intern/AUD_NULLDevice.cpp @@ -69,7 +69,7 @@ bool AUD_NULLDevice::AUD_NULLHandle::seek(float position) float AUD_NULLDevice::AUD_NULLHandle::getPosition() { - return 0.0f; + return std::numeric_limits::quiet_NaN(); } AUD_Status AUD_NULLDevice::AUD_NULLHandle::getStatus() @@ -79,7 +79,7 @@ AUD_Status AUD_NULLDevice::AUD_NULLHandle::getStatus() float AUD_NULLDevice::AUD_NULLHandle::getVolume() { - return 0.0f; + return std::numeric_limits::quiet_NaN(); } bool AUD_NULLDevice::AUD_NULLHandle::setVolume(float volume) @@ -89,7 +89,7 @@ bool AUD_NULLDevice::AUD_NULLHandle::setVolume(float volume) float AUD_NULLDevice::AUD_NULLHandle::getPitch() { - return 0.0f; + return std::numeric_limits::quiet_NaN(); } bool AUD_NULLDevice::AUD_NULLHandle::setPitch(float pitch) @@ -153,7 +153,7 @@ void AUD_NULLDevice::unlock() float AUD_NULLDevice::getVolume() const { - return 0; + return std::numeric_limits::quiet_NaN(); } void AUD_NULLDevice::setVolume(float volume) diff --git a/source/blender/blenkernel/intern/sound.c b/source/blender/blenkernel/intern/sound.c index f2d92154c66..649b4f0b724 100644 --- a/source/blender/blenkernel/intern/sound.c +++ b/source/blender/blenkernel/intern/sound.c @@ -295,7 +295,10 @@ void sound_cache(struct bSound* sound) AUD_unload(sound->cache); sound->cache = AUD_bufferSound(sound->handle); - sound->playback_handle = sound->cache; + if(sound->cache) + sound->playback_handle = sound->cache; + else + sound->playback_handle = sound->handle; } void sound_cache_notifying(struct Main* main, struct bSound* sound) @@ -332,6 +335,8 @@ void sound_load(struct Main *bmain, struct bSound* sound) sound->playback_handle = NULL; } + sound_free_waveform(sound); + // XXX unused currently #if 0 switch(sound->type) @@ -625,7 +630,7 @@ float sound_sync_scene(struct Scene *scene) else return AUD_getPosition(scene->sound_scene_handle); } - return 0.0f; + return .0f/.0f; } int sound_scene_playing(struct Scene *scene) @@ -782,7 +787,7 @@ static void sound_start_play_scene(struct Scene *UNUSED(scene)) {} void sound_play_scene(struct Scene *UNUSED(scene)) {} void sound_stop_scene(struct Scene *UNUSED(scene)) {} void sound_seek_scene(struct Main *UNUSED(bmain), struct Scene *UNUSED(scene)) {} -float sound_sync_scene(struct Scene *UNUSED(scene)) { return 0.0f; } +float sound_sync_scene(struct Scene *UNUSED(scene)) { return .0f/.0f; } int sound_scene_playing(struct Scene *UNUSED(scene)) { return -1; } int sound_read_sound_buffer(struct bSound* UNUSED(sound), float* UNUSED(buffer), int UNUSED(length), float UNUSED(start), float UNUSED(end)) { return 0; } void sound_read_waveform(struct bSound* sound) { (void)sound; } diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c b/source/blender/editors/space_sequencer/sequencer_draw.c index 8f1ea6fe254..13e54c9a4c0 100644 --- a/source/blender/editors/space_sequencer/sequencer_draw.c +++ b/source/blender/editors/space_sequencer/sequencer_draw.c @@ -192,6 +192,9 @@ static void drawseqwave(Scene *scene, Sequence *seq, float x1, float y1, float x waveform = seq->sound->waveform; + if(!waveform) + return; + startsample = floor((seq->startofs + seq->anim_startofs)/FPS * SOUND_WAVE_SAMPLES_PER_SECOND); endsample = ceil((seq->startofs + seq->anim_startofs + seq->enddisp - seq->startdisp)/FPS * SOUND_WAVE_SAMPLES_PER_SECOND); samplestep = (endsample-startsample) * stepsize / (x2-x1); diff --git a/source/blender/makesrna/intern/rna_sequencer.c b/source/blender/makesrna/intern/rna_sequencer.c index a75166c3e99..92739148b99 100644 --- a/source/blender/makesrna/intern/rna_sequencer.c +++ b/source/blender/makesrna/intern/rna_sequencer.c @@ -453,6 +453,8 @@ static void rna_Sequence_filepath_set(PointerRNA *ptr, const char *value) PointerRNA id_ptr; RNA_id_pointer_create((ID *)seq->sound, &id_ptr); RNA_string_set(&id_ptr, "filepath", value); + sound_load(G.main, seq->sound); + sound_update_scene_sound(seq->scene_sound, seq->sound); } BLI_split_dirfile(value, dir, name); diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c index cafee6b49ca..074151c9abe 100644 --- a/source/blender/windowmanager/intern/wm_event_system.c +++ b/source/blender/windowmanager/intern/wm_event_system.c @@ -1790,11 +1790,14 @@ void wm_event_do_handlers(bContext *C) } if(playing == 0) { - int ncfra = sound_sync_scene(scene) * (float)FPS + 0.5f; - if(ncfra != scene->r.cfra) { - scene->r.cfra = ncfra; - ED_update_for_newframe(CTX_data_main(C), scene, win->screen, 1); - WM_event_add_notifier(C, NC_WINDOW, NULL); + float time = sound_sync_scene(scene); + if(finite(time)) { + int ncfra = sound_sync_scene(scene) * (float)FPS + 0.5f; + if(ncfra != scene->r.cfra) { + scene->r.cfra = ncfra; + ED_update_for_newframe(CTX_data_main(C), scene, win->screen, 1); + WM_event_add_notifier(C, NC_WINDOW, NULL); + } } } -- cgit v1.2.3 From 0c0259d93100bdbcd19c4c9deda6799de2a1f075 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 14 Oct 2011 02:31:04 +0000 Subject: fix [#28909] OpenCollada export / import sintel lite v2.1 crashes on import. --- source/blender/collada/AnimationImporter.cpp | 70 ++++++++++++---------- source/blender/makesrna/rna_cleanup/rna_cleaner.py | 2 +- .../makesrna/rna_cleanup/rna_cleaner_merge.py | 2 +- .../Converter/BL_BlenderDataConversion.cpp | 2 +- 4 files changed, 40 insertions(+), 36 deletions(-) diff --git a/source/blender/collada/AnimationImporter.cpp b/source/blender/collada/AnimationImporter.cpp index 61f1b1dfa08..f3a6e2371bb 100644 --- a/source/blender/collada/AnimationImporter.cpp +++ b/source/blender/collada/AnimationImporter.cpp @@ -962,30 +962,32 @@ void AnimationImporter::translate_Animations ( COLLADAFW::Node * node , for (unsigned int j = 0; j < matBinds.getCount(); j++) { const COLLADAFW::UniqueId & matuid = matBinds[j].getReferencedMaterial(); const COLLADAFW::Effect *ef = (COLLADAFW::Effect *) (FW_object_map[matuid]); - const COLLADAFW::CommonEffectPointerArray& commonEffects = ef->getCommonEffects(); - COLLADAFW::EffectCommon *efc = commonEffects[0]; - if((animType->material & MATERIAL_SHININESS) != 0){ - const COLLADAFW::FloatOrParam *shin = &(efc->getShininess()); - const COLLADAFW::UniqueId& listid = shin->getAnimationList(); - Assign_float_animations( listid, AnimCurves , "specular_hardness" ); - } + if (ef != NULL) { /* can be NULL [#28909] */ + const COLLADAFW::CommonEffectPointerArray& commonEffects = ef->getCommonEffects(); + COLLADAFW::EffectCommon *efc = commonEffects[0]; + if((animType->material & MATERIAL_SHININESS) != 0){ + const COLLADAFW::FloatOrParam *shin = &(efc->getShininess()); + const COLLADAFW::UniqueId& listid = shin->getAnimationList(); + Assign_float_animations( listid, AnimCurves , "specular_hardness" ); + } - if((animType->material & MATERIAL_IOR) != 0){ - const COLLADAFW::FloatOrParam *ior = &(efc->getIndexOfRefraction()); - const COLLADAFW::UniqueId& listid = ior->getAnimationList(); - Assign_float_animations( listid, AnimCurves , "raytrace_transparency.ior" ); - } + if((animType->material & MATERIAL_IOR) != 0){ + const COLLADAFW::FloatOrParam *ior = &(efc->getIndexOfRefraction()); + const COLLADAFW::UniqueId& listid = ior->getAnimationList(); + Assign_float_animations( listid, AnimCurves , "raytrace_transparency.ior" ); + } - if((animType->material & MATERIAL_SPEC_COLOR) != 0){ - const COLLADAFW::ColorOrTexture *cot = &(efc->getSpecular()); - const COLLADAFW::UniqueId& listid = cot->getColor().getAnimationList(); - Assign_color_animations( listid, AnimCurves , "specular_color" ); - } + if((animType->material & MATERIAL_SPEC_COLOR) != 0){ + const COLLADAFW::ColorOrTexture *cot = &(efc->getSpecular()); + const COLLADAFW::UniqueId& listid = cot->getColor().getAnimationList(); + Assign_color_animations( listid, AnimCurves , "specular_color" ); + } - if((animType->material & MATERIAL_DIFF_COLOR) != 0){ - const COLLADAFW::ColorOrTexture *cot = &(efc->getDiffuse()); - const COLLADAFW::UniqueId& listid = cot->getColor().getAnimationList(); - Assign_color_animations( listid, AnimCurves , "diffuse_color" ); + if((animType->material & MATERIAL_DIFF_COLOR) != 0){ + const COLLADAFW::ColorOrTexture *cot = &(efc->getDiffuse()); + const COLLADAFW::UniqueId& listid = cot->getColor().getAnimationList(); + Assign_color_animations( listid, AnimCurves , "diffuse_color" ); + } } } } @@ -1051,14 +1053,16 @@ AnimationImporter::AnimMix* AnimationImporter::get_animation_type ( const COLLAD for (unsigned int j = 0; j < matBinds.getCount(); j++) { const COLLADAFW::UniqueId & matuid = matBinds[j].getReferencedMaterial(); const COLLADAFW::Effect *ef = (COLLADAFW::Effect *) (FW_object_map[matuid]); - const COLLADAFW::CommonEffectPointerArray& commonEffects = ef->getCommonEffects(); - if(!commonEffects.empty()) { - COLLADAFW::EffectCommon *efc = commonEffects[0]; - types->material = setAnimType(&(efc->getShininess()),(types->material), MATERIAL_SHININESS); - types->material = setAnimType(&(efc->getSpecular().getColor()),(types->material), MATERIAL_SPEC_COLOR); - types->material = setAnimType(&(efc->getDiffuse().getColor()),(types->material), MATERIAL_DIFF_COLOR); - // types->material = setAnimType(&(efc->get()),(types->material), MATERIAL_TRANSPARENCY); - types->material = setAnimType(&(efc->getIndexOfRefraction()),(types->material), MATERIAL_IOR); + if (ef != NULL) { /* can be NULL [#28909] */ + const COLLADAFW::CommonEffectPointerArray& commonEffects = ef->getCommonEffects(); + if(!commonEffects.empty()) { + COLLADAFW::EffectCommon *efc = commonEffects[0]; + types->material = setAnimType(&(efc->getShininess()),(types->material), MATERIAL_SHININESS); + types->material = setAnimType(&(efc->getSpecular().getColor()),(types->material), MATERIAL_SPEC_COLOR); + types->material = setAnimType(&(efc->getDiffuse().getColor()),(types->material), MATERIAL_DIFF_COLOR); + // types->material = setAnimType(&(efc->get()),(types->material), MATERIAL_TRANSPARENCY); + types->material = setAnimType(&(efc->getIndexOfRefraction()),(types->material), MATERIAL_IOR); + } } } } @@ -1067,10 +1071,10 @@ AnimationImporter::AnimMix* AnimationImporter::get_animation_type ( const COLLAD int AnimationImporter::setAnimType ( const COLLADAFW::Animatable * prop , int types, int addition) { - const COLLADAFW::UniqueId& listid = prop->getAnimationList(); - if (animlist_map.find(listid) != animlist_map.end()) - return types|addition; - else return types; + const COLLADAFW::UniqueId& listid = prop->getAnimationList(); + if (animlist_map.find(listid) != animlist_map.end()) + return types|addition; + else return types; } // Is not used anymore. diff --git a/source/blender/makesrna/rna_cleanup/rna_cleaner.py b/source/blender/makesrna/rna_cleanup/rna_cleaner.py index ae17ade36d7..5df6e9a86ff 100755 --- a/source/blender/makesrna/rna_cleanup/rna_cleaner.py +++ b/source/blender/makesrna/rna_cleanup/rna_cleaner.py @@ -1,4 +1,4 @@ -#! /usr/bin/env python3.1 +#! /usr/bin/env python3 """ This script is used to help cleaning RNA api. diff --git a/source/blender/makesrna/rna_cleanup/rna_cleaner_merge.py b/source/blender/makesrna/rna_cleanup/rna_cleaner_merge.py index 8d2fe07b774..89d95b5a627 100755 --- a/source/blender/makesrna/rna_cleanup/rna_cleaner_merge.py +++ b/source/blender/makesrna/rna_cleanup/rna_cleaner_merge.py @@ -1,4 +1,4 @@ -#! /usr/bin/env python3.1 +#! /usr/bin/env python3 import sys diff --git a/source/gameengine/Converter/BL_BlenderDataConversion.cpp b/source/gameengine/Converter/BL_BlenderDataConversion.cpp index e6783d7c106..0f5176af60c 100644 --- a/source/gameengine/Converter/BL_BlenderDataConversion.cpp +++ b/source/gameengine/Converter/BL_BlenderDataConversion.cpp @@ -1596,7 +1596,7 @@ void BL_CreatePhysicsObjectNew(KX_GameObject* gameobj, objprop.m_boundclass = KX_BOUNDPOLYTOPE; break; } - // Object is not a mesh... fall through OB_BOUND_POLYH to + // Object is not a mesh... fall through OB_BOUND_TRIANGLE_MESH to // OB_BOUND_SPHERE case OB_BOUND_TRIANGLE_MESH: if (blenderobject->type == OB_MESH) -- cgit v1.2.3 From 13490b1ac3ee1a98a4e968555df53a4699f23f27 Mon Sep 17 00:00:00 2001 From: Andrew Wiggin Date: Fri, 14 Oct 2011 05:07:53 +0000 Subject: Fix MSVC build ( .0f/.0f fires a compiler error ) --- source/blender/blenkernel/BKE_sound.h | 1 + source/blender/blenkernel/intern/sound.c | 4 ++-- source/blender/editors/screen/screen_ops.c | 2 +- source/blender/windowmanager/intern/wm_event_system.c | 4 ++-- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/source/blender/blenkernel/BKE_sound.h b/source/blender/blenkernel/BKE_sound.h index 3728dd41089..081fb8dc132 100644 --- a/source/blender/blenkernel/BKE_sound.h +++ b/source/blender/blenkernel/BKE_sound.h @@ -35,6 +35,7 @@ * \author nzc */ +#define SOUND_ERR_FLT FLT_MIN #define SOUND_WAVE_SAMPLES_PER_SECOND 250 struct PackedFile; diff --git a/source/blender/blenkernel/intern/sound.c b/source/blender/blenkernel/intern/sound.c index 649b4f0b724..b9a02df423e 100644 --- a/source/blender/blenkernel/intern/sound.c +++ b/source/blender/blenkernel/intern/sound.c @@ -630,7 +630,7 @@ float sound_sync_scene(struct Scene *scene) else return AUD_getPosition(scene->sound_scene_handle); } - return .0f/.0f; + return SOUND_ERR_FLT; } int sound_scene_playing(struct Scene *scene) @@ -787,7 +787,7 @@ static void sound_start_play_scene(struct Scene *UNUSED(scene)) {} void sound_play_scene(struct Scene *UNUSED(scene)) {} void sound_stop_scene(struct Scene *UNUSED(scene)) {} void sound_seek_scene(struct Main *UNUSED(bmain), struct Scene *UNUSED(scene)) {} -float sound_sync_scene(struct Scene *UNUSED(scene)) { return .0f/.0f; } +float sound_sync_scene(struct Scene *UNUSED(scene)) { return SOUND_ERR_FLT; } int sound_scene_playing(struct Scene *UNUSED(scene)) { return -1; } int sound_read_sound_buffer(struct bSound* UNUSED(sound), float* UNUSED(buffer), int UNUSED(length), float UNUSED(start), float UNUSED(end)) { return 0; } void sound_read_waveform(struct bSound* sound) { (void)sound; } diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c index a2be1e8fa6f..8d9190ac80c 100644 --- a/source/blender/editors/screen/screen_ops.c +++ b/source/blender/editors/screen/screen_ops.c @@ -2814,7 +2814,7 @@ static int screen_animation_step(bContext *C, wmOperator *UNUSED(op), wmEvent *e else if (sad->flag & ANIMPLAY_FLAG_NO_SYNC) sync= 0; else sync= (scene->flag & SCE_FRAME_DROP); - if((scene->audio.flag & AUDIO_SYNC) && !(sad->flag & ANIMPLAY_FLAG_REVERSE) && finite(time = sound_sync_scene(scene))) + if((scene->audio.flag & AUDIO_SYNC) && !(sad->flag & ANIMPLAY_FLAG_REVERSE) && ((time = sound_sync_scene(scene)) != SOUND_ERR_FLT)) scene->r.cfra = (double)time * FPS + 0.5; else { diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c index 074151c9abe..4055b6c7d9e 100644 --- a/source/blender/windowmanager/intern/wm_event_system.c +++ b/source/blender/windowmanager/intern/wm_event_system.c @@ -33,7 +33,6 @@ #include #include -#include #include "DNA_listBase.h" #include "DNA_screen_types.h" @@ -47,6 +46,7 @@ #include "BLI_blenlib.h" #include "BLI_utildefines.h" +#include "BLI_math.h" #include "BKE_blender.h" #include "BKE_context.h" @@ -1791,7 +1791,7 @@ void wm_event_do_handlers(bContext *C) if(playing == 0) { float time = sound_sync_scene(scene); - if(finite(time)) { + if(time != SOUND_ERR_FLT) { int ncfra = sound_sync_scene(scene) * (float)FPS + 0.5f; if(ncfra != scene->r.cfra) { scene->r.cfra = ncfra; -- cgit v1.2.3 From eaff9a1c1b420dde7f291c8fb8715f18dd512f64 Mon Sep 17 00:00:00 2001 From: Andrew Wiggin Date: Fri, 14 Oct 2011 07:41:45 +0000 Subject: Reverting my windows build fix because it breaks the bug fix committed in r40995 --- source/blender/blenkernel/BKE_sound.h | 1 - source/blender/blenkernel/intern/sound.c | 4 ++-- source/blender/editors/screen/screen_ops.c | 2 +- source/blender/windowmanager/intern/wm_event_system.c | 4 ++-- 4 files changed, 5 insertions(+), 6 deletions(-) diff --git a/source/blender/blenkernel/BKE_sound.h b/source/blender/blenkernel/BKE_sound.h index 081fb8dc132..3728dd41089 100644 --- a/source/blender/blenkernel/BKE_sound.h +++ b/source/blender/blenkernel/BKE_sound.h @@ -35,7 +35,6 @@ * \author nzc */ -#define SOUND_ERR_FLT FLT_MIN #define SOUND_WAVE_SAMPLES_PER_SECOND 250 struct PackedFile; diff --git a/source/blender/blenkernel/intern/sound.c b/source/blender/blenkernel/intern/sound.c index b9a02df423e..649b4f0b724 100644 --- a/source/blender/blenkernel/intern/sound.c +++ b/source/blender/blenkernel/intern/sound.c @@ -630,7 +630,7 @@ float sound_sync_scene(struct Scene *scene) else return AUD_getPosition(scene->sound_scene_handle); } - return SOUND_ERR_FLT; + return .0f/.0f; } int sound_scene_playing(struct Scene *scene) @@ -787,7 +787,7 @@ static void sound_start_play_scene(struct Scene *UNUSED(scene)) {} void sound_play_scene(struct Scene *UNUSED(scene)) {} void sound_stop_scene(struct Scene *UNUSED(scene)) {} void sound_seek_scene(struct Main *UNUSED(bmain), struct Scene *UNUSED(scene)) {} -float sound_sync_scene(struct Scene *UNUSED(scene)) { return SOUND_ERR_FLT; } +float sound_sync_scene(struct Scene *UNUSED(scene)) { return .0f/.0f; } int sound_scene_playing(struct Scene *UNUSED(scene)) { return -1; } int sound_read_sound_buffer(struct bSound* UNUSED(sound), float* UNUSED(buffer), int UNUSED(length), float UNUSED(start), float UNUSED(end)) { return 0; } void sound_read_waveform(struct bSound* sound) { (void)sound; } diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c index 8d9190ac80c..a2be1e8fa6f 100644 --- a/source/blender/editors/screen/screen_ops.c +++ b/source/blender/editors/screen/screen_ops.c @@ -2814,7 +2814,7 @@ static int screen_animation_step(bContext *C, wmOperator *UNUSED(op), wmEvent *e else if (sad->flag & ANIMPLAY_FLAG_NO_SYNC) sync= 0; else sync= (scene->flag & SCE_FRAME_DROP); - if((scene->audio.flag & AUDIO_SYNC) && !(sad->flag & ANIMPLAY_FLAG_REVERSE) && ((time = sound_sync_scene(scene)) != SOUND_ERR_FLT)) + if((scene->audio.flag & AUDIO_SYNC) && !(sad->flag & ANIMPLAY_FLAG_REVERSE) && finite(time = sound_sync_scene(scene))) scene->r.cfra = (double)time * FPS + 0.5; else { diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c index 4055b6c7d9e..074151c9abe 100644 --- a/source/blender/windowmanager/intern/wm_event_system.c +++ b/source/blender/windowmanager/intern/wm_event_system.c @@ -33,6 +33,7 @@ #include #include +#include #include "DNA_listBase.h" #include "DNA_screen_types.h" @@ -46,7 +47,6 @@ #include "BLI_blenlib.h" #include "BLI_utildefines.h" -#include "BLI_math.h" #include "BKE_blender.h" #include "BKE_context.h" @@ -1791,7 +1791,7 @@ void wm_event_do_handlers(bContext *C) if(playing == 0) { float time = sound_sync_scene(scene); - if(time != SOUND_ERR_FLT) { + if(finite(time)) { int ncfra = sound_sync_scene(scene) * (float)FPS + 0.5f; if(ncfra != scene->r.cfra) { scene->r.cfra = ncfra; -- cgit v1.2.3 From 8868f9455c4a1469b58a454c0ccc9b81a2cb42a2 Mon Sep 17 00:00:00 2001 From: Joerg Mueller Date: Fri, 14 Oct 2011 07:56:33 +0000 Subject: Hopefully fixing windows build problems with this hack now. :-) --- source/blender/blenkernel/intern/sound.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/source/blender/blenkernel/intern/sound.c b/source/blender/blenkernel/intern/sound.c index 649b4f0b724..07df12d5468 100644 --- a/source/blender/blenkernel/intern/sound.c +++ b/source/blender/blenkernel/intern/sound.c @@ -63,6 +63,10 @@ #include "BKE_sequencer.h" #include "BKE_scene.h" +// evil quiet NaN definition +static const int NAN_INT = 0x7FC00000; +#define NAN_FLT *((float*)(&NAN_INT)) + #ifdef WITH_AUDASPACE // evil global ;-) static int sound_cfra; @@ -630,7 +634,7 @@ float sound_sync_scene(struct Scene *scene) else return AUD_getPosition(scene->sound_scene_handle); } - return .0f/.0f; + return NAN_FLT; } int sound_scene_playing(struct Scene *scene) @@ -787,7 +791,7 @@ static void sound_start_play_scene(struct Scene *UNUSED(scene)) {} void sound_play_scene(struct Scene *UNUSED(scene)) {} void sound_stop_scene(struct Scene *UNUSED(scene)) {} void sound_seek_scene(struct Main *UNUSED(bmain), struct Scene *UNUSED(scene)) {} -float sound_sync_scene(struct Scene *UNUSED(scene)) { return .0f/.0f; } +float sound_sync_scene(struct Scene *UNUSED(scene)) { return NAN_FLT; } int sound_scene_playing(struct Scene *UNUSED(scene)) { return -1; } int sound_read_sound_buffer(struct bSound* UNUSED(sound), float* UNUSED(buffer), int UNUSED(length), float UNUSED(start), float UNUSED(end)) { return 0; } void sound_read_waveform(struct bSound* sound) { (void)sound; } -- cgit v1.2.3 From 309721c2e47291841faf1b38acf3fb5024be9f2d Mon Sep 17 00:00:00 2001 From: Andrew Wiggin Date: Fri, 14 Oct 2011 08:06:59 +0000 Subject: Other part of the MSVC build fix (need definition for "finite" macro from BLI_math.h) --- source/blender/windowmanager/intern/wm_event_system.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c index 074151c9abe..33e98007fed 100644 --- a/source/blender/windowmanager/intern/wm_event_system.c +++ b/source/blender/windowmanager/intern/wm_event_system.c @@ -33,7 +33,6 @@ #include #include -#include #include "DNA_listBase.h" #include "DNA_screen_types.h" @@ -47,6 +46,7 @@ #include "BLI_blenlib.h" #include "BLI_utildefines.h" +#include "BLI_math.h" #include "BKE_blender.h" #include "BKE_context.h" -- cgit v1.2.3 From e5e201ccd839f149d113798f944bb6862b80804d Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Fri, 14 Oct 2011 11:24:20 +0000 Subject: Fix for first part of #28911: driver not working properly since 2.594 Missed id type set for driver target when setting target id. Patch by me and Campbell. --- source/blender/blenkernel/intern/ipo.c | 4 ++++ source/blender/editors/interface/interface_anim.c | 1 + 2 files changed, 5 insertions(+) diff --git a/source/blender/blenkernel/intern/ipo.c b/source/blender/blenkernel/intern/ipo.c index 91f3c7a22ba..609f6cd38f1 100644 --- a/source/blender/blenkernel/intern/ipo.c +++ b/source/blender/blenkernel/intern/ipo.c @@ -1034,12 +1034,14 @@ static ChannelDriver *idriver_to_cdriver (IpoDriver *idriver) /* first bone target */ dtar= &dvar->targets[0]; dtar->id= (ID *)idriver->ob; + dtar->idtype= ID_OB; if (idriver->name[0]) BLI_strncpy(dtar->pchan_name, idriver->name, sizeof(dtar->pchan_name)); /* second bone target (name was stored in same var as the first one) */ dtar= &dvar->targets[1]; dtar->id= (ID *)idriver->ob; + dtar->idtype= ID_OB; if (idriver->name[0]) // xxx... for safety BLI_strncpy(dtar->pchan_name, idriver->name+DRIVER_NAME_OFFS, sizeof(dtar->pchan_name)); } @@ -1051,6 +1053,7 @@ static ChannelDriver *idriver_to_cdriver (IpoDriver *idriver) /* only requires a single target */ dtar= &dvar->targets[0]; dtar->id= (ID *)idriver->ob; + dtar->idtype= ID_OB; if (idriver->name[0]) BLI_strncpy(dtar->pchan_name, idriver->name, sizeof(dtar->pchan_name)); dtar->transChan= adrcode_to_dtar_transchan(idriver->adrcode); @@ -1065,6 +1068,7 @@ static ChannelDriver *idriver_to_cdriver (IpoDriver *idriver) /* only requires single target */ dtar= &dvar->targets[0]; dtar->id= (ID *)idriver->ob; + dtar->idtype= ID_OB; dtar->transChan= adrcode_to_dtar_transchan(idriver->adrcode); } } diff --git a/source/blender/editors/interface/interface_anim.c b/source/blender/editors/interface/interface_anim.c index c35996701ee..6c661ba014e 100644 --- a/source/blender/editors/interface/interface_anim.c +++ b/source/blender/editors/interface/interface_anim.c @@ -179,6 +179,7 @@ int ui_but_anim_expression_create(uiBut *but, const char *str) dtar = &dvar->targets[0]; dtar->id = (ID *)CTX_data_scene(C); // XXX: should we check that C is valid first? + dtar->idtype= ID_SCE; dtar->rna_path = BLI_sprintfN("frame_current"); } -- cgit v1.2.3 From 43de42824f4b7d20188d80aedf175054d8e1c552 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 14 Oct 2011 12:17:35 +0000 Subject: cmake's find glew wasnt working right - if glew wasnt found installing the package would not help since the not-found result was cached. --- build_files/cmake/Modules/FindGLEW.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build_files/cmake/Modules/FindGLEW.cmake b/build_files/cmake/Modules/FindGLEW.cmake index c791327c8da..7e1b00d0923 100644 --- a/build_files/cmake/Modules/FindGLEW.cmake +++ b/build_files/cmake/Modules/FindGLEW.cmake @@ -51,9 +51,9 @@ ELSE (WIN32) ENDIF (WIN32) IF (GLEW_INCLUDE_PATH) - SET( GLEW_FOUND 1 CACHE STRING "Set to 1 if GLEW is found, 0 otherwise") + SET(GLEW_FOUND TRUE) ELSE (GLEW_INCLUDE_PATH) - SET( GLEW_FOUND 0 CACHE STRING "Set to 1 if GLEW is found, 0 otherwise") + SET(GLEW_FOUND FALSE) ENDIF (GLEW_INCLUDE_PATH) MARK_AS_ADVANCED( GLEW_FOUND ) -- cgit v1.2.3 From 22e4f9e3bbdce90f8c3fca6b16ee09a7e9917ddd Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Fri, 14 Oct 2011 12:20:58 +0000 Subject: Fix #28914: crash loading file saved with cycles builds in trunk. The cause is an unknown node socket type in node groups. Ideally the node system should handle this better and remove the unknown sockets from groups, but this is a bit of a risky fix to do now, so instead the shader socket type has been added, since this is a simple change and the code has been tested well. --- source/blender/nodes/intern/node_socket.c | 33 +++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/source/blender/nodes/intern/node_socket.c b/source/blender/nodes/intern/node_socket.c index aabaf5b86de..51e48b84383 100644 --- a/source/blender/nodes/intern/node_socket.c +++ b/source/blender/nodes/intern/node_socket.c @@ -128,6 +128,21 @@ static bNodeSocketType node_socket_type_boolean = { /* buttonfunc */ NULL, }; +/****************** SHADER ******************/ + +static bNodeSocketType node_socket_type_shader = { + /* type */ SOCK_SHADER, + /* ui_name */ "Shader", + /* ui_description */ "Shader", + /* ui_icon */ 0, + /* ui_color */ {100,200,100,255}, + + /* value_structname */ NULL, + /* value_structsize */ 0, + + /* buttonfunc */ NULL, +}; + /****************** MESH ******************/ static bNodeSocketType node_socket_type_mesh = { @@ -153,6 +168,7 @@ void node_socket_type_init(bNodeSocketType *types[]) INIT_TYPE(rgba); INIT_TYPE(int); INIT_TYPE(boolean); + INIT_TYPE(shader); INIT_TYPE(mesh); #undef INIT_TYPE @@ -241,6 +257,17 @@ struct bNodeSocket *nodeAddOutputRGBA(struct bNodeTree *ntree, struct bNode *nod return sock; } +struct bNodeSocket *nodeAddInputShader(struct bNodeTree *ntree, struct bNode *node, const char *name) +{ + bNodeSocket *sock= nodeAddSocket(ntree, node, SOCK_IN, name, SOCK_SHADER); + return sock; +} +struct bNodeSocket *nodeAddOutputShader(struct bNodeTree *ntree, struct bNode *node, const char *name) +{ + bNodeSocket *sock= nodeAddSocket(ntree, node, SOCK_OUT, name, SOCK_SHADER); + return sock; +} + struct bNodeSocket *nodeAddInputMesh(struct bNodeTree *ntree, struct bNode *node, const char *name) { bNodeSocket *sock= nodeAddSocket(ntree, node, SOCK_IN, name, SOCK_MESH); @@ -271,6 +298,9 @@ struct bNodeSocket *node_add_input_from_template(struct bNodeTree *ntree, struct case SOCK_RGBA: sock = nodeAddInputRGBA(ntree, node, stemp->name, stemp->val1, stemp->val2, stemp->val3, stemp->val4); break; + case SOCK_SHADER: + sock = nodeAddInputShader(ntree, node, stemp->name); + break; case SOCK_MESH: sock = nodeAddInputMesh(ntree, node, stemp->name); break; @@ -299,6 +329,9 @@ struct bNodeSocket *node_add_output_from_template(struct bNodeTree *ntree, struc case SOCK_RGBA: sock = nodeAddOutputRGBA(ntree, node, stemp->name); break; + case SOCK_SHADER: + sock = nodeAddOutputShader(ntree, node, stemp->name); + break; case SOCK_MESH: sock = nodeAddOutputMesh(ntree, node, stemp->name); break; -- cgit v1.2.3 From fdc0edefce7c75371479cd720aba3f9d3ba24924 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Fri, 14 Oct 2011 13:10:11 +0000 Subject: Split language menu into two columns: - Nearly done for languages with >80% strings translated - In progress for languages which aren't translated enough still. --- source/blender/makesrna/intern/rna_userdef.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c index 11157e67741..7fb6f2de15b 100644 --- a/source/blender/makesrna/intern/rna_userdef.c +++ b/source/blender/makesrna/intern/rna_userdef.c @@ -2511,20 +2511,22 @@ static void rna_def_userdef_system(BlenderRNA *brna) /* locale according to http://www.roseindia.net/tutorials/I18N/locales-list.shtml */ /* if you edit here, please also edit the source/blender/blenfont/intern/blf_lang.c 's locales */ static EnumPropertyItem language_items[] = { + {0, "", 0, "Nearly done", ""}, {0, "DEFAULT", 0, N_("Default (Default)"), ""}, {1, "ENGLISH", 0, N_("English (English)"), "en_US"}, + {8, "FRENCH", 0, N_("French (Française)"), "fr_FR"}, + {9, "SPANISH", 0, N_("Spanish (Español)"), "es_ES"}, + {13, "SIMPLIFIED_CHINESE", 0, N_("Simplified Chinese (简体中文)"), "zh_CN"}, + {0, "", 0, "In progress", ""}, {2, "JAPANESE", 0, N_("Japanese (日本語)"), "ja_JP"}, {3, "DUTCH", 0, N_("Dutch (Nederlandse taal)"), "nl_NL"}, {4, "ITALIAN", 0, N_("Italian (Italiano)"), "it_IT"}, {5, "GERMAN", 0, N_("German (Deutsch)"), "de_DE"}, {6, "FINNISH", 0, N_("Finnish (Suomi)"), "fi_FI"}, {7, "SWEDISH", 0, N_("Swedish (Svenska)"), "sv_SE"}, - {8, "FRENCH", 0, N_("French (Française)"), "fr_FR"}, - {9, "SPANISH", 0, N_("Spanish (Español)"), "es_ES"}, {10, "CATALAN", 0, N_("Catalan (Català)"), "ca_AD"}, {11, "CZECH", 0, N_("Czech (Český)"), "cs_CZ"}, {12, "BRAZILIAN_PORTUGUESE", 0, N_("Brazilian Portuguese (Português do Brasil)"), "pt_BR"}, - {13, "SIMPLIFIED_CHINESE", 0, N_("Simplified Chinese (简体中文)"), "zh_CN"}, {14, "TRADITIONAL_CHINESE", 0, N_("Traditional Chinese (繁體中文)"), "zh_TW"}, {15, "RUSSIAN", 0, N_("Russian (Русский)"), "ru_RU"}, {16, "CROATIAN", 0, N_("Croatian (Hrvatski)"), "hr_HR"}, -- cgit v1.2.3 From f66cbcb1ad04b60fe1f8dc6bac19ef0c9fd81996 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Fri, 14 Oct 2011 13:13:13 +0000 Subject: Remove final e from Francaise --- source/blender/makesrna/intern/rna_userdef.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c index 7fb6f2de15b..28525042eda 100644 --- a/source/blender/makesrna/intern/rna_userdef.c +++ b/source/blender/makesrna/intern/rna_userdef.c @@ -2514,7 +2514,7 @@ static void rna_def_userdef_system(BlenderRNA *brna) {0, "", 0, "Nearly done", ""}, {0, "DEFAULT", 0, N_("Default (Default)"), ""}, {1, "ENGLISH", 0, N_("English (English)"), "en_US"}, - {8, "FRENCH", 0, N_("French (Française)"), "fr_FR"}, + {8, "FRENCH", 0, N_("French (Français)"), "fr_FR"}, {9, "SPANISH", 0, N_("Spanish (Español)"), "es_ES"}, {13, "SIMPLIFIED_CHINESE", 0, N_("Simplified Chinese (简体中文)"), "zh_CN"}, {0, "", 0, "In progress", ""}, -- cgit v1.2.3 From 9252d425d248273f2afd821870e68f52c9d3aa70 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 14 Oct 2011 14:01:39 +0000 Subject: cmake: use cached results for RPM build & dont print annoying rpmbuild missing on every re-run of cmake. --- build_files/cmake/RpmBuild.cmake | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/build_files/cmake/RpmBuild.cmake b/build_files/cmake/RpmBuild.cmake index 2c821a9dd7a..2fdd0a72932 100644 --- a/build_files/cmake/RpmBuild.cmake +++ b/build_files/cmake/RpmBuild.cmake @@ -3,17 +3,24 @@ # Authors: Rohit Yadav # -find_program(RPMBUILD - NAMES rpmbuild - PATHS "/usr/bin") +if(NOT DEFINED RPMBUILD) -mark_as_advanced(RPMBUILD) + find_program(RPMBUILD + NAMES rpmbuild + PATHS "/usr/bin") + + mark_as_advanced(RPMBUILD) + + if(RPMBUILD) + message(STATUS "RPM Build Found: ${RPMBUILD}") + else(RPMBUILD) + message(STATUS "RPM Build Not Found (rpmbuild). RPM generation will not be available") + endif() + +endif() if(RPMBUILD) - get_filename_component(RPMBUILD_PATH ${RPMBUILD} ABSOLUTE) - message(STATUS "Found rpmbuild : ${RPMBUILD_PATH}") - set(RPMBUILD_FOUND "YES") + set(RPMBUILD_FOUND TRUE) else(RPMBUILD) - message(STATUS "rpmbuild NOT found. RPM generation will not be available") - set(RPMBUILD_FOUND "NO") -endif() + set(RPMBUILD_FOUND FALSE) +endif() \ No newline at end of file -- cgit v1.2.3 From 9f6d67484cc6fbb9db575ecff2a1ee8c1768d1b5 Mon Sep 17 00:00:00 2001 From: Joerg Mueller Date: Fri, 14 Oct 2011 16:58:21 +0000 Subject: Fix for [#28916] 2.6 RC2 - Bake Sound to FCurve Crash --- intern/audaspace/FX/AUD_DynamicIIRFilterReader.cpp | 3 +- intern/audaspace/FX/AUD_IIRFilterReader.cpp | 15 +++--- intern/audaspace/intern/AUD_C-API.cpp | 63 ++++++++++++---------- 3 files changed, 47 insertions(+), 34 deletions(-) diff --git a/intern/audaspace/FX/AUD_DynamicIIRFilterReader.cpp b/intern/audaspace/FX/AUD_DynamicIIRFilterReader.cpp index ed9b2d3871d..f1edccb22fb 100644 --- a/intern/audaspace/FX/AUD_DynamicIIRFilterReader.cpp +++ b/intern/audaspace/FX/AUD_DynamicIIRFilterReader.cpp @@ -32,7 +32,8 @@ AUD_DynamicIIRFilterReader::AUD_DynamicIIRFilterReader(AUD_Reference reader, AUD_Reference factory) : - AUD_IIRFilterReader(reader, std::vector(), std::vector()) + AUD_IIRFilterReader(reader, std::vector(), std::vector()), + m_factory(factory) { sampleRateChanged(reader->getSpecs().rate); } diff --git a/intern/audaspace/FX/AUD_IIRFilterReader.cpp b/intern/audaspace/FX/AUD_IIRFilterReader.cpp index 1bfb9b97b62..90f7e1e3cb0 100644 --- a/intern/audaspace/FX/AUD_IIRFilterReader.cpp +++ b/intern/audaspace/FX/AUD_IIRFilterReader.cpp @@ -36,11 +36,14 @@ AUD_IIRFilterReader::AUD_IIRFilterReader(AUD_Reference reader, const std::vector& a) : AUD_BaseIIRFilterReader(reader, b.size(), a.size()), m_a(a), m_b(b) { - for(int i = 1; i < m_a.size(); i++) - m_a[i] /= m_a[0]; - for(int i = 0; i < m_b.size(); i++) - m_b[i] /= m_a[0]; - m_a[0] = 1; + if(m_a.size()) + { + for(int i = 1; i < m_a.size(); i++) + m_a[i] /= m_a[0]; + for(int i = 0; i < m_b.size(); i++) + m_b[i] /= m_a[0]; + m_a[0] = 1; + } } sample_t AUD_IIRFilterReader::filter() @@ -58,7 +61,7 @@ sample_t AUD_IIRFilterReader::filter() void AUD_IIRFilterReader::setCoefficients(const std::vector& b, const std::vector& a) { - setLengths(m_b.size(), m_a.size()); + setLengths(b.size(), a.size()); m_a = a; m_b = b; } diff --git a/intern/audaspace/intern/AUD_C-API.cpp b/intern/audaspace/intern/AUD_C-API.cpp index af053df9c50..66e3a0ed7e9 100644 --- a/intern/audaspace/intern/AUD_C-API.cpp +++ b/intern/audaspace/intern/AUD_C-API.cpp @@ -826,42 +826,51 @@ float* AUD_readSoundBuffer(const char* filename, float low, float high, AUD_Reference file = new AUD_FileFactory(filename); - AUD_Reference reader = file->createReader(); - AUD_SampleRate rate = reader->getSpecs().rate; + int position = 0; - sound = new AUD_ChannelMapperFactory(file, specs); + try + { + AUD_Reference reader = file->createReader(); - if(high < rate) - sound = new AUD_LowpassFactory(sound, high); - if(low > 0) - sound = new AUD_HighpassFactory(sound, low); + AUD_SampleRate rate = reader->getSpecs().rate; - sound = new AUD_EnvelopeFactory(sound, attack, release, threshold, 0.1f); - sound = new AUD_LinearResampleFactory(sound, specs); + sound = new AUD_ChannelMapperFactory(file, specs); - if(square) - sound = new AUD_SquareFactory(sound, sthreshold); + if(high < rate) + sound = new AUD_LowpassFactory(sound, high); + if(low > 0) + sound = new AUD_HighpassFactory(sound, low); - if(accumulate) - sound = new AUD_AccumulatorFactory(sound, additive); - else if(additive) - sound = new AUD_SumFactory(sound); + sound = new AUD_EnvelopeFactory(sound, attack, release, threshold, 0.1f); + sound = new AUD_LinearResampleFactory(sound, specs); - reader = sound->createReader(); + if(square) + sound = new AUD_SquareFactory(sound, sthreshold); - if(reader.isNull()) - return NULL; + if(accumulate) + sound = new AUD_AccumulatorFactory(sound, additive); + else if(additive) + sound = new AUD_SumFactory(sound); - int len; - int position = 0; - bool eos; - do + reader = sound->createReader(); + + if(reader.isNull()) + return NULL; + + int len; + bool eos; + do + { + len = samplerate; + buffer.resize((position + len) * sizeof(float), true); + reader->read(len, eos, buffer.getBuffer() + position); + position += len; + } while(!eos); + } + catch(AUD_Exception&) { - len = samplerate; - buffer.resize((position + len) * sizeof(float), true); - reader->read(len, eos, buffer.getBuffer() + position); - position += len; - } while(!eos); + return NULL; + } float* result = (float*)malloc(position * sizeof(float)); memcpy(result, buffer.getBuffer(), position * sizeof(float)); -- cgit v1.2.3 From afcf581fb06920c415ca9d1c23cdfb235274d323 Mon Sep 17 00:00:00 2001 From: Jens Verwiebe Date: Fri, 14 Oct 2011 17:27:55 +0000 Subject: OSX: commit the needed steps for compiling with gcc 4.6.1 and OMP_NUM_THREADS env variable setting --- build_files/scons/tools/Blender.py | 10 ++++++++++ source/darwin/blender.app/Contents/Info.plist | 17 ++++++++--------- 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/build_files/scons/tools/Blender.py b/build_files/scons/tools/Blender.py index b9632bfffa7..2be464fc6fe 100644 --- a/build_files/scons/tools/Blender.py +++ b/build_files/scons/tools/Blender.py @@ -582,6 +582,16 @@ def AppIt(target=None, source=None, env=None): commands.getoutput(cmd) cmd = 'find %s/%s.app -name __MACOSX -exec rm -rf {} \;'%(installdir, binary) commands.getoutput(cmd) + if env['CC'].endswith('4.6.1'): # for correct errorhandling with gcc 4.6.1 we need the gcc.dylib to link, thus distribute in app-bundle + cmd = 'mkdir %s/%s.app/Contents/MacOS/lib'%(installdir, binary) + commands.getoutput(cmd) + instname = env['BF_CXX'] + cmd = 'cp %s/lib/libgcc_s.1.dylib %s/%s.app/Contents/MacOS/lib/'%(instname, installdir, binary) + commands.getoutput(cmd) + cmd = 'install_name_tool -id @executable_path/lib/libgcc_s.1.dylib %s/%s.app/Contents/MacOS/lib/libgcc_s.1.dylib'%(installdir, binary) + commands.getoutput(cmd) + cmd = 'install_name_tool -change %s/lib/libgcc_s.1.dylib @executable_path/lib/libgcc_s.1.dylib %s/%s.app/Contents/MacOS/%s'%(instname, installdir, binary, binary) + commands.getoutput(cmd) # extract copy system python, be sure to update other build systems # when making changes to the files that are copied. diff --git a/source/darwin/blender.app/Contents/Info.plist b/source/darwin/blender.app/Contents/Info.plist index 23941d91075..a25c629ce68 100644 --- a/source/darwin/blender.app/Contents/Info.plist +++ b/source/darwin/blender.app/Contents/Info.plist @@ -1,33 +1,27 @@ - - + + CFBundleInfoDictionaryVersion 6.0 - CFBundleExecutable blender - CFBundlePackageType APPL CFBundleSignature ???? - CFBundleIconFile blender icon.icns - CFBundleName Blender CFBundleIdentifier org.blenderfoundation.blender - CFBundleVersion ${MACOSX_BUNDLE_LONG_VERSION_STRING}, Blender Foundation CFBundleShortVersionString ${MACOSX_BUNDLE_SHORT_VERSION_STRING} CFBundleGetInfoString ${MACOSX_BUNDLE_LONG_VERSION_STRING}, Blender Foundation - CFBundleDocumentTypes @@ -46,8 +40,13 @@ CFBundleTypeRole Editor LSIsAppleDefaultForType - + + LSEnvironment + + OMP_NUM_THREADS + 2 + -- cgit v1.2.3 From e7095450e7e47a5b05238a70bd75ca836f4332ba Mon Sep 17 00:00:00 2001 From: Jens Verwiebe Date: Fri, 14 Oct 2011 17:54:37 +0000 Subject: OSX: commit the omp_set_simulation_threads applescript and copy-routines --- build_files/scons/tools/Blender.py | 2 + .../set_simulation_threads.app/Contents/Info.plist | 44 +++++++++++++++++++++ .../Contents/MacOS/applet | Bin 0 -> 34480 bytes .../set_simulation_threads.app/Contents/PkgInfo | 1 + .../Contents/Resources/Scripts/main.scpt | Bin 0 -> 2936 bytes .../Contents/Resources/applet.icns | Bin 0 -> 40291 bytes .../Contents/Resources/applet.rsrc | Bin 0 -> 362 bytes .../Contents/Resources/description.rtfd/TXT.rtf | 4 ++ 8 files changed, 51 insertions(+) create mode 100644 source/darwin/set_simulation_threads.app/Contents/Info.plist create mode 100755 source/darwin/set_simulation_threads.app/Contents/MacOS/applet create mode 100644 source/darwin/set_simulation_threads.app/Contents/PkgInfo create mode 100644 source/darwin/set_simulation_threads.app/Contents/Resources/Scripts/main.scpt create mode 100644 source/darwin/set_simulation_threads.app/Contents/Resources/applet.icns create mode 100644 source/darwin/set_simulation_threads.app/Contents/Resources/applet.rsrc create mode 100644 source/darwin/set_simulation_threads.app/Contents/Resources/description.rtfd/TXT.rtf diff --git a/build_files/scons/tools/Blender.py b/build_files/scons/tools/Blender.py index 2be464fc6fe..f54ab102415 100644 --- a/build_files/scons/tools/Blender.py +++ b/build_files/scons/tools/Blender.py @@ -592,6 +592,8 @@ def AppIt(target=None, source=None, env=None): commands.getoutput(cmd) cmd = 'install_name_tool -change %s/lib/libgcc_s.1.dylib @executable_path/lib/libgcc_s.1.dylib %s/%s.app/Contents/MacOS/%s'%(instname, installdir, binary, binary) commands.getoutput(cmd) + cmd = 'cp -R %s/source/darwin/set_simulation_threads.app %s/'%(bldroot, installdir) # the omp_num_threads applescript + commands.getoutput(cmd) # extract copy system python, be sure to update other build systems # when making changes to the files that are copied. diff --git a/source/darwin/set_simulation_threads.app/Contents/Info.plist b/source/darwin/set_simulation_threads.app/Contents/Info.plist new file mode 100644 index 00000000000..e7a5b09b079 --- /dev/null +++ b/source/darwin/set_simulation_threads.app/Contents/Info.plist @@ -0,0 +1,44 @@ + + + + + CFBundleAllowMixedLocalizations + + CFBundleDevelopmentRegion + English + CFBundleExecutable + applet + CFBundleIconFile + applet + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + set_simulation_threads + CFBundlePackageType + APPL + CFBundleSignature + aplt + LSMinimumSystemVersionByArchitecture + + x86_64 + 10.6 + + LSRequiresCarbon + + WindowState + + dividerCollapsed + + eventLogLevel + -1 + name + ScriptWindowState + positionOfDivider + 467 + savedFrame + 943 372 886 806 0 0 1920 1178 + selectedTabView + result + + + diff --git a/source/darwin/set_simulation_threads.app/Contents/MacOS/applet b/source/darwin/set_simulation_threads.app/Contents/MacOS/applet new file mode 100755 index 00000000000..0079f4b19d4 Binary files /dev/null and b/source/darwin/set_simulation_threads.app/Contents/MacOS/applet differ diff --git a/source/darwin/set_simulation_threads.app/Contents/PkgInfo b/source/darwin/set_simulation_threads.app/Contents/PkgInfo new file mode 100644 index 00000000000..3253614c402 --- /dev/null +++ b/source/darwin/set_simulation_threads.app/Contents/PkgInfo @@ -0,0 +1 @@ +APPLaplt \ No newline at end of file diff --git a/source/darwin/set_simulation_threads.app/Contents/Resources/Scripts/main.scpt b/source/darwin/set_simulation_threads.app/Contents/Resources/Scripts/main.scpt new file mode 100644 index 00000000000..4e4ba192bb5 Binary files /dev/null and b/source/darwin/set_simulation_threads.app/Contents/Resources/Scripts/main.scpt differ diff --git a/source/darwin/set_simulation_threads.app/Contents/Resources/applet.icns b/source/darwin/set_simulation_threads.app/Contents/Resources/applet.icns new file mode 100644 index 00000000000..fcc1f09273d Binary files /dev/null and b/source/darwin/set_simulation_threads.app/Contents/Resources/applet.icns differ diff --git a/source/darwin/set_simulation_threads.app/Contents/Resources/applet.rsrc b/source/darwin/set_simulation_threads.app/Contents/Resources/applet.rsrc new file mode 100644 index 00000000000..283acbcdf65 Binary files /dev/null and b/source/darwin/set_simulation_threads.app/Contents/Resources/applet.rsrc differ diff --git a/source/darwin/set_simulation_threads.app/Contents/Resources/description.rtfd/TXT.rtf b/source/darwin/set_simulation_threads.app/Contents/Resources/description.rtfd/TXT.rtf new file mode 100644 index 00000000000..0d0a60c08b5 --- /dev/null +++ b/source/darwin/set_simulation_threads.app/Contents/Resources/description.rtfd/TXT.rtf @@ -0,0 +1,4 @@ +{\rtf1\ansi\ansicpg1252\cocoartf1138\cocoasubrtf230 +{\fonttbl} +{\colortbl;\red255\green255\blue255;} +} \ No newline at end of file -- cgit v1.2.3 From c963edeb9ecbb59b9f62562c42581a38fba60f5d Mon Sep 17 00:00:00 2001 From: Jens Verwiebe Date: Fri, 14 Oct 2011 20:11:19 +0000 Subject: Delete applescript for recommit --- .../set_simulation_threads.app/Contents/Info.plist | 44 --------------------- .../Contents/MacOS/applet | Bin 34480 -> 0 bytes .../set_simulation_threads.app/Contents/PkgInfo | 1 - .../Contents/Resources/Scripts/main.scpt | Bin 2936 -> 0 bytes .../Contents/Resources/applet.icns | Bin 40291 -> 0 bytes .../Contents/Resources/applet.rsrc | Bin 362 -> 0 bytes .../Contents/Resources/description.rtfd/TXT.rtf | 4 -- 7 files changed, 49 deletions(-) delete mode 100644 source/darwin/set_simulation_threads.app/Contents/Info.plist delete mode 100755 source/darwin/set_simulation_threads.app/Contents/MacOS/applet delete mode 100644 source/darwin/set_simulation_threads.app/Contents/PkgInfo delete mode 100644 source/darwin/set_simulation_threads.app/Contents/Resources/Scripts/main.scpt delete mode 100644 source/darwin/set_simulation_threads.app/Contents/Resources/applet.icns delete mode 100644 source/darwin/set_simulation_threads.app/Contents/Resources/applet.rsrc delete mode 100644 source/darwin/set_simulation_threads.app/Contents/Resources/description.rtfd/TXT.rtf diff --git a/source/darwin/set_simulation_threads.app/Contents/Info.plist b/source/darwin/set_simulation_threads.app/Contents/Info.plist deleted file mode 100644 index e7a5b09b079..00000000000 --- a/source/darwin/set_simulation_threads.app/Contents/Info.plist +++ /dev/null @@ -1,44 +0,0 @@ - - - - - CFBundleAllowMixedLocalizations - - CFBundleDevelopmentRegion - English - CFBundleExecutable - applet - CFBundleIconFile - applet - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - set_simulation_threads - CFBundlePackageType - APPL - CFBundleSignature - aplt - LSMinimumSystemVersionByArchitecture - - x86_64 - 10.6 - - LSRequiresCarbon - - WindowState - - dividerCollapsed - - eventLogLevel - -1 - name - ScriptWindowState - positionOfDivider - 467 - savedFrame - 943 372 886 806 0 0 1920 1178 - selectedTabView - result - - - diff --git a/source/darwin/set_simulation_threads.app/Contents/MacOS/applet b/source/darwin/set_simulation_threads.app/Contents/MacOS/applet deleted file mode 100755 index 0079f4b19d4..00000000000 Binary files a/source/darwin/set_simulation_threads.app/Contents/MacOS/applet and /dev/null differ diff --git a/source/darwin/set_simulation_threads.app/Contents/PkgInfo b/source/darwin/set_simulation_threads.app/Contents/PkgInfo deleted file mode 100644 index 3253614c402..00000000000 --- a/source/darwin/set_simulation_threads.app/Contents/PkgInfo +++ /dev/null @@ -1 +0,0 @@ -APPLaplt \ No newline at end of file diff --git a/source/darwin/set_simulation_threads.app/Contents/Resources/Scripts/main.scpt b/source/darwin/set_simulation_threads.app/Contents/Resources/Scripts/main.scpt deleted file mode 100644 index 4e4ba192bb5..00000000000 Binary files a/source/darwin/set_simulation_threads.app/Contents/Resources/Scripts/main.scpt and /dev/null differ diff --git a/source/darwin/set_simulation_threads.app/Contents/Resources/applet.icns b/source/darwin/set_simulation_threads.app/Contents/Resources/applet.icns deleted file mode 100644 index fcc1f09273d..00000000000 Binary files a/source/darwin/set_simulation_threads.app/Contents/Resources/applet.icns and /dev/null differ diff --git a/source/darwin/set_simulation_threads.app/Contents/Resources/applet.rsrc b/source/darwin/set_simulation_threads.app/Contents/Resources/applet.rsrc deleted file mode 100644 index 283acbcdf65..00000000000 Binary files a/source/darwin/set_simulation_threads.app/Contents/Resources/applet.rsrc and /dev/null differ diff --git a/source/darwin/set_simulation_threads.app/Contents/Resources/description.rtfd/TXT.rtf b/source/darwin/set_simulation_threads.app/Contents/Resources/description.rtfd/TXT.rtf deleted file mode 100644 index 0d0a60c08b5..00000000000 --- a/source/darwin/set_simulation_threads.app/Contents/Resources/description.rtfd/TXT.rtf +++ /dev/null @@ -1,4 +0,0 @@ -{\rtf1\ansi\ansicpg1252\cocoartf1138\cocoasubrtf230 -{\fonttbl} -{\colortbl;\red255\green255\blue255;} -} \ No newline at end of file -- cgit v1.2.3 From e7b0ccbb0b12887be18cd37c3ef8f73b5be6899b Mon Sep 17 00:00:00 2001 From: Jens Verwiebe Date: Fri, 14 Oct 2011 20:12:34 +0000 Subject: OSX:recommit applescript, fixed an issue --- .../set_simulation_threads.app/Contents/Info.plist | 44 +++++++++++++++++++++ .../Contents/MacOS/applet | Bin 0 -> 34480 bytes .../set_simulation_threads.app/Contents/PkgInfo | 1 + .../Contents/Resources/Scripts/main.scpt | Bin 0 -> 4432 bytes .../Contents/Resources/applet.icns | Bin 0 -> 40291 bytes .../Contents/Resources/applet.rsrc | Bin 0 -> 362 bytes .../Contents/Resources/description.rtfd/TXT.rtf | 4 ++ 7 files changed, 49 insertions(+) create mode 100644 source/darwin/set_simulation_threads.app/Contents/Info.plist create mode 100755 source/darwin/set_simulation_threads.app/Contents/MacOS/applet create mode 100644 source/darwin/set_simulation_threads.app/Contents/PkgInfo create mode 100644 source/darwin/set_simulation_threads.app/Contents/Resources/Scripts/main.scpt create mode 100644 source/darwin/set_simulation_threads.app/Contents/Resources/applet.icns create mode 100644 source/darwin/set_simulation_threads.app/Contents/Resources/applet.rsrc create mode 100644 source/darwin/set_simulation_threads.app/Contents/Resources/description.rtfd/TXT.rtf diff --git a/source/darwin/set_simulation_threads.app/Contents/Info.plist b/source/darwin/set_simulation_threads.app/Contents/Info.plist new file mode 100644 index 00000000000..f71939a7795 --- /dev/null +++ b/source/darwin/set_simulation_threads.app/Contents/Info.plist @@ -0,0 +1,44 @@ + + + + + CFBundleAllowMixedLocalizations + + CFBundleDevelopmentRegion + English + CFBundleExecutable + applet + CFBundleIconFile + applet + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + set_simulation_threads + CFBundlePackageType + APPL + CFBundleSignature + aplt + LSMinimumSystemVersionByArchitecture + + x86_64 + 10.6 + + LSRequiresCarbon + + WindowState + + dividerCollapsed + + eventLogLevel + -1 + name + ScriptWindowState + positionOfDivider + 284 + savedFrame + 284 477 1474 522 0 0 1920 1178 + selectedTabView + result + + + diff --git a/source/darwin/set_simulation_threads.app/Contents/MacOS/applet b/source/darwin/set_simulation_threads.app/Contents/MacOS/applet new file mode 100755 index 00000000000..0079f4b19d4 Binary files /dev/null and b/source/darwin/set_simulation_threads.app/Contents/MacOS/applet differ diff --git a/source/darwin/set_simulation_threads.app/Contents/PkgInfo b/source/darwin/set_simulation_threads.app/Contents/PkgInfo new file mode 100644 index 00000000000..3253614c402 --- /dev/null +++ b/source/darwin/set_simulation_threads.app/Contents/PkgInfo @@ -0,0 +1 @@ +APPLaplt \ No newline at end of file diff --git a/source/darwin/set_simulation_threads.app/Contents/Resources/Scripts/main.scpt b/source/darwin/set_simulation_threads.app/Contents/Resources/Scripts/main.scpt new file mode 100644 index 00000000000..611fb64417b Binary files /dev/null and b/source/darwin/set_simulation_threads.app/Contents/Resources/Scripts/main.scpt differ diff --git a/source/darwin/set_simulation_threads.app/Contents/Resources/applet.icns b/source/darwin/set_simulation_threads.app/Contents/Resources/applet.icns new file mode 100644 index 00000000000..fcc1f09273d Binary files /dev/null and b/source/darwin/set_simulation_threads.app/Contents/Resources/applet.icns differ diff --git a/source/darwin/set_simulation_threads.app/Contents/Resources/applet.rsrc b/source/darwin/set_simulation_threads.app/Contents/Resources/applet.rsrc new file mode 100644 index 00000000000..43934978719 Binary files /dev/null and b/source/darwin/set_simulation_threads.app/Contents/Resources/applet.rsrc differ diff --git a/source/darwin/set_simulation_threads.app/Contents/Resources/description.rtfd/TXT.rtf b/source/darwin/set_simulation_threads.app/Contents/Resources/description.rtfd/TXT.rtf new file mode 100644 index 00000000000..0d0a60c08b5 --- /dev/null +++ b/source/darwin/set_simulation_threads.app/Contents/Resources/description.rtfd/TXT.rtf @@ -0,0 +1,4 @@ +{\rtf1\ansi\ansicpg1252\cocoartf1138\cocoasubrtf230 +{\fonttbl} +{\colortbl;\red255\green255\blue255;} +} \ No newline at end of file -- cgit v1.2.3 From cae655f81fe219223d9ff9afaf0ddf8e126c7c80 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 15 Oct 2011 01:32:49 +0000 Subject: fix for weight paint vertex select, it broke vertex paint when left on. --- source/blender/editors/space_view3d/drawobject.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index df1c743b5cd..eb2e821e398 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -6723,7 +6723,10 @@ void draw_object_backbufsel(Scene *scene, View3D *v3d, RegionView3D *rv3d, Objec } else { Mesh *me= ob->data; - if(me->editflag & ME_EDIT_VERT_SEL) { + if( (me->editflag & ME_EDIT_VERT_SEL) && + /* currently vertex select only supports weight paint */ + (ob->mode & OB_MODE_WEIGHT_PAINT)) + { DerivedMesh *dm = mesh_get_derived_final(scene, ob, scene->customdata_mask); glColor3ub(0, 0, 0); -- cgit v1.2.3 From f9c41eaaf80fdddb24d5b95cadb51ac859c2d301 Mon Sep 17 00:00:00 2001 From: Janne Karhu Date: Sat, 15 Oct 2011 01:42:26 +0000 Subject: Fix for [#28823] Boids use uninitialized memory. * Boids need the random velocity vector always. --- source/blender/blenkernel/intern/particle_system.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c index 6b601ed4b1a..7b2d621aff2 100644 --- a/source/blender/blenkernel/intern/particle_system.c +++ b/source/blender/blenkernel/intern/particle_system.c @@ -1607,8 +1607,8 @@ void psys_get_birth_coordinates(ParticleSimulationData *sim, ParticleData *pa, P } - /* -velocity */ - if(part->randfac != 0.0f){ + /* -velocity (boids need this even if there's no random velocity) */ + if(part->randfac != 0.0f || (part->phystype==PART_PHYS_BOIDS && pa->boid)){ r_vel[0] = 2.0f * (PSYS_FRAND(p + 10) - 0.5f); r_vel[1] = 2.0f * (PSYS_FRAND(p + 11) - 0.5f); r_vel[2] = 2.0f * (PSYS_FRAND(p + 12) - 0.5f); -- cgit v1.2.3 From 317b649bb241726d8be1a700cd0028f28914595d Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 15 Oct 2011 03:56:05 +0000 Subject: fix for buffer overrun with BLI_split_dirfile(...), was simple to do since many places don't check for filename lengyj of 79 chars which is the limit for the file selector. Add max dir and file length args. --- source/blender/blenkernel/intern/pointcache.c | 2 +- source/blender/blenkernel/intern/sequencer.c | 4 ++-- source/blender/blenlib/BLI_path_util.h | 2 +- source/blender/blenlib/intern/bpath.c | 4 ++-- source/blender/blenlib/intern/path_util.c | 19 ++++++++++--------- source/blender/blenlib/intern/winstuff.c | 3 +-- source/blender/blenloader/intern/writefile.c | 4 ++-- source/blender/collada/DocumentImporter.cpp | 2 +- source/blender/collada/ImageExporter.cpp | 2 +- source/blender/editors/space_file/file_ops.c | 4 ++-- source/blender/editors/space_file/filesel.c | 6 +++--- .../editors/space_sequencer/sequencer_add.c | 2 +- .../editors/space_sequencer/space_sequencer.c | 2 +- source/blender/makesrna/intern/rna_sequencer.c | 22 ++++------------------ source/gameengine/Ketsji/KX_PythonInit.cpp | 4 ++-- 15 files changed, 34 insertions(+), 48 deletions(-) diff --git a/source/blender/blenkernel/intern/pointcache.c b/source/blender/blenkernel/intern/pointcache.c index fb69db17b97..bc5bc87b1fa 100644 --- a/source/blender/blenkernel/intern/pointcache.c +++ b/source/blender/blenkernel/intern/pointcache.c @@ -910,7 +910,7 @@ static int ptcache_path(PTCacheID *pid, char *filename) else if (G.relbase_valid || lib) { char file[MAX_PTCACHE_PATH]; /* we dont want the dir, only the file */ - BLI_split_dirfile(blendfilename, NULL, file); + BLI_split_dirfile(blendfilename, NULL, file, 0, sizeof(file)); i = strlen(file); /* remove .blend */ diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c index 5a2c53f5b9b..00534400cf1 100644 --- a/source/blender/blenkernel/intern/sequencer.c +++ b/source/blender/blenkernel/intern/sequencer.c @@ -3647,7 +3647,7 @@ Sequence *sequencer_add_sound_strip(bContext *C, ListBase *seqbasep, SeqLoadInfo /* we only need 1 element to store the filename */ strip->stripdata= se= MEM_callocN(sizeof(StripElem), "stripelem"); - BLI_split_dirfile(seq_load->path, strip->dir, se->name); + BLI_split_dirfile(seq_load->path, strip->dir, se->name, sizeof(strip->dir), sizeof(se->name)); seq->scene_sound = sound_add_scene_sound(scene, seq, seq_load->start_frame, seq_load->start_frame + strip->len, 0); @@ -3706,7 +3706,7 @@ Sequence *sequencer_add_movie_strip(bContext *C, ListBase *seqbasep, SeqLoadInfo /* we only need 1 element for MOVIE strips */ strip->stripdata= se= MEM_callocN(sizeof(StripElem), "stripelem"); - BLI_split_dirfile(seq_load->path, strip->dir, se->name); + BLI_split_dirfile(seq_load->path, strip->dir, se->name, sizeof(strip->dir), sizeof(se->name)); calc_sequence_disp(scene, seq); diff --git a/source/blender/blenlib/BLI_path_util.h b/source/blender/blenlib/BLI_path_util.h index 81fc8a50db6..4f7f7b482b5 100644 --- a/source/blender/blenlib/BLI_path_util.h +++ b/source/blender/blenlib/BLI_path_util.h @@ -103,7 +103,7 @@ void BLI_setenv_if_new(const char *env, const char* val); void BLI_make_file_string(const char *relabase, char *string, const char *dir, const char *file); void BLI_make_exist(char *dir); void BLI_make_existing_file(const char *name); -void BLI_split_dirfile(const char *string, char *dir, char *file); +void BLI_split_dirfile(const char *string, char *dir, char *file, const size_t dirlen, const size_t filelen); void BLI_join_dirfile(char *string, const size_t maxlen, const char *dir, const char *file); char *BLI_path_basename(char *path); int BKE_rebase_path(char *abs, size_t abs_len, char *rel, size_t rel_len, const char *base_dir, const char *src_dir, const char *dest_dir); diff --git a/source/blender/blenlib/intern/bpath.c b/source/blender/blenlib/intern/bpath.c index 485b8137a02..4e4f8b3cade 100644 --- a/source/blender/blenlib/intern/bpath.c +++ b/source/blender/blenlib/intern/bpath.c @@ -400,7 +400,7 @@ static void seq_setpath(struct BPathIterator *bpi, const char *path) if (SEQ_HAS_PATH(seq)) { if (ELEM3(seq->type, SEQ_IMAGE, SEQ_MOVIE, SEQ_SOUND)) { - BLI_split_dirfile(path, seq->strip->dir, seq->strip->stripdata->name); + BLI_split_dirfile(path, seq->strip->dir, seq->strip->stripdata->name, sizeof(seq->strip->dir), sizeof(seq->strip->stripdata->name)); } else { /* simple case */ @@ -903,7 +903,7 @@ void findMissingFiles(Main *bmain, const char *str) //XXX waitcursor( 1 ); - BLI_split_dirfile(str, dirname, NULL); + BLI_split_dirfile(str, dirname, NULL, sizeof(dirname), 0); BLI_bpathIterator_init(&bpi, bmain, bmain->name, 0); diff --git a/source/blender/blenlib/intern/path_util.c b/source/blender/blenlib/intern/path_util.c index ab7d082c432..fe1d869f898 100644 --- a/source/blender/blenlib/intern/path_util.c +++ b/source/blender/blenlib/intern/path_util.c @@ -894,7 +894,7 @@ static int get_path_local(char *targetpath, const char *folder_name, const char } /* use argv[0] (bprogname) to get the path to the executable */ - BLI_split_dirfile(bprogname, bprogdir, NULL); + BLI_split_dirfile(bprogname, bprogdir, NULL, sizeof(bprogdir), 0); /* try EXECUTABLE_DIR/2.5x/folder_name - new default directory for local blender installed files */ if(test_path(targetpath, bprogdir, blender_version_decimal(ver), relfolder)) @@ -966,7 +966,7 @@ static int get_path_system(char *targetpath, const char *folder_name, const char char bprogdir[FILE_MAX]; /* use argv[0] (bprogname) to get the path to the executable */ - BLI_split_dirfile(bprogname, bprogdir, NULL); + BLI_split_dirfile(bprogname, bprogdir, NULL, sizeof(bprogdir), 0); if(folder_name) { if (subfolder_name) { @@ -1411,21 +1411,22 @@ int BLI_replace_extension(char *path, size_t maxlen, const char *ext) * - dosnt use CWD, or deal with relative paths. * - Only fill's in *dir and *file when they are non NULL * */ -void BLI_split_dirfile(const char *string, char *dir, char *file) +void BLI_split_dirfile(const char *string, char *dir, char *file, const size_t dirlen, const size_t filelen) { char *lslash_str = BLI_last_slash(string); - int lslash= lslash_str ? (int)(lslash_str - string) + 1 : 0; + size_t lslash= lslash_str ? (size_t)(lslash_str - string) + 1 : 0; if (dir) { if (lslash) { - BLI_strncpy( dir, string, lslash + 1); /* +1 to include the slash and the last char */ - } else { + BLI_strncpy( dir, string, MIN2(dirlen, lslash + 1)); /* +1 to include the slash and the last char */ + } + else { dir[0] = '\0'; } } if (file) { - strcpy( file, string+lslash); + BLI_strncpy(file, string+lslash, filelen); } } @@ -1515,7 +1516,7 @@ int BKE_rebase_path(char *abs, size_t abs_len, char *rel, size_t rel_len, const if (rel) rel[0]= 0; - BLI_split_dirfile(base_dir, blend_dir, NULL); + BLI_split_dirfile(base_dir, blend_dir, NULL, sizeof(blend_dir), 0); if (src_dir[0]=='\0') return 0; @@ -1526,7 +1527,7 @@ int BKE_rebase_path(char *abs, size_t abs_len, char *rel, size_t rel_len, const BLI_path_abs(path, base_dir); /* get the directory part */ - BLI_split_dirfile(path, dir, base); + BLI_split_dirfile(path, dir, base, sizeof(dir), sizeof(base)); len= strlen(blend_dir); diff --git a/source/blender/blenlib/intern/winstuff.c b/source/blender/blenlib/intern/winstuff.c index 3b14abb0bee..9594197ef90 100644 --- a/source/blender/blenlib/intern/winstuff.c +++ b/source/blender/blenlib/intern/winstuff.c @@ -53,11 +53,10 @@ int BLI_getInstallationDir( char * str ) { char dir[FILE_MAXDIR]; - char file[FILE_MAXFILE]; int a; GetModuleFileName(NULL,str,FILE_MAXDIR+FILE_MAXFILE); - BLI_split_dirfile(str,dir,file); /* shouldn't be relative */ + BLI_split_dirfile(str, dir, NULL, sizeof(dir), 0); /* shouldn't be relative */ a = strlen(dir); if(dir[a-1] == '\\') dir[a-1]=0; diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c index cbc312a75e9..6e9e3da3b42 100644 --- a/source/blender/blenloader/intern/writefile.c +++ b/source/blender/blenloader/intern/writefile.c @@ -2678,8 +2678,8 @@ int BLO_write_file(Main *mainvar, const char *filepath, int write_flags, ReportL if(write_flags & G_FILE_RELATIVE_REMAP) { char dir1[FILE_MAXDIR+FILE_MAXFILE]; char dir2[FILE_MAXDIR+FILE_MAXFILE]; - BLI_split_dirfile(filepath, dir1, NULL); - BLI_split_dirfile(mainvar->name, dir2, NULL); + BLI_split_dirfile(filepath, dir1, NULL, sizeof(dir1), 0); + BLI_split_dirfile(mainvar->name, dir2, NULL, sizeof(dir2), 0); /* just incase there is some subtle difference */ BLI_cleanup_dir(mainvar->name, dir1); diff --git a/source/blender/collada/DocumentImporter.cpp b/source/blender/collada/DocumentImporter.cpp index e98f551a097..056d74aabfb 100644 --- a/source/blender/collada/DocumentImporter.cpp +++ b/source/blender/collada/DocumentImporter.cpp @@ -884,7 +884,7 @@ bool DocumentImporter::writeImage( const COLLADAFW::Image* image ) char dir[FILE_MAX]; char full_path[FILE_MAX]; - BLI_split_dirfile(filename, dir, NULL); + BLI_split_dirfile(filename, dir, NULL, sizeof(dir), 0); BLI_join_dirfile(full_path, sizeof(full_path), dir, filepath.c_str()); Image *ima = BKE_add_image_file(full_path); if (!ima) { diff --git a/source/blender/collada/ImageExporter.cpp b/source/blender/collada/ImageExporter.cpp index 747f3c783d7..53c43677c18 100644 --- a/source/blender/collada/ImageExporter.cpp +++ b/source/blender/collada/ImageExporter.cpp @@ -97,7 +97,7 @@ void ImagesExporter::operator()(Material *ma, Object *ob) char src[FILE_MAX]; char dir[FILE_MAX]; - BLI_split_dirfile(this->export_settings->filepath, dir, NULL); + BLI_split_dirfile(this->export_settings->filepath, dir, NULL, sizeof(dir), 0); BKE_rebase_path(abs, sizeof(abs), rel, sizeof(rel), G.main->name, image->name, dir); diff --git a/source/blender/editors/space_file/file_ops.c b/source/blender/editors/space_file/file_ops.c index 0955d264ca8..559873bd601 100644 --- a/source/blender/editors/space_file/file_ops.c +++ b/source/blender/editors/space_file/file_ops.c @@ -666,7 +666,7 @@ void file_operator_to_sfile(SpaceFile *sfile, wmOperator *op) if((prop= RNA_struct_find_property(op->ptr, "filepath"))) { char filepath[FILE_MAX]; RNA_property_string_get(op->ptr, prop, filepath); - BLI_split_dirfile(filepath, sfile->params->dir, sfile->params->file); + BLI_split_dirfile(filepath, sfile->params->dir, sfile->params->file, sizeof(sfile->params->dir), sizeof(sfile->params->file)); } else { if((prop= RNA_struct_find_property(op->ptr, "filename"))) { @@ -1143,7 +1143,7 @@ int file_directory_exec(bContext *C, wmOperator *UNUSED(unused)) if(BLI_exists(sfile->params->dir) && BLI_is_dir(sfile->params->dir) == 0) { char path[sizeof(sfile->params->dir)]; BLI_strncpy(path, sfile->params->dir, sizeof(path)); - BLI_split_dirfile(path, sfile->params->dir, sfile->params->file); + BLI_split_dirfile(path, sfile->params->dir, sfile->params->file, sizeof(sfile->params->dir), sizeof(sfile->params->file)); } BLI_cleanup_dir(G.main->name, sfile->params->dir); diff --git a/source/blender/editors/space_file/filesel.c b/source/blender/editors/space_file/filesel.c index 6cc42b2a751..f36145aaba0 100644 --- a/source/blender/editors/space_file/filesel.c +++ b/source/blender/editors/space_file/filesel.c @@ -113,7 +113,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_split_dirfile(G.main->name, sfile->params->dir, sfile->params->file); + BLI_split_dirfile(G.main->name, sfile->params->dir, sfile->params->file, sizeof(sfile->params->dir), sizeof(sfile->params->file)); sfile->params->filter_glob[0] = '\0'; } @@ -142,7 +142,7 @@ short ED_fileselect_set_params(SpaceFile *sfile) sfile->params->file[0]= '\0'; } else { - BLI_split_dirfile(name, sfile->params->dir, sfile->params->file); + BLI_split_dirfile(name, sfile->params->dir, sfile->params->file, sizeof(sfile->params->dir), sizeof(sfile->params->file)); } } else { @@ -613,7 +613,7 @@ void autocomplete_directory(struct bContext *C, char *str, void *UNUSED(arg_v)) DIR *dir; struct dirent *de; - BLI_split_dirfile(str, dirname, NULL); + BLI_split_dirfile(str, dirname, NULL, sizeof(dirname), 0); dir = opendir(dirname); diff --git a/source/blender/editors/space_sequencer/sequencer_add.c b/source/blender/editors/space_sequencer/sequencer_add.c index 1c4b0130897..7fa4e62359a 100644 --- a/source/blender/editors/space_sequencer/sequencer_add.c +++ b/source/blender/editors/space_sequencer/sequencer_add.c @@ -321,7 +321,7 @@ static int sequencer_add_generic_strip_exec(bContext *C, wmOperator *op, SeqLoad char dir_only[FILE_MAX]; char file_only[FILE_MAX]; - BLI_split_dirfile(seq_load.path, dir_only, NULL); + BLI_split_dirfile(seq_load.path, dir_only, NULL, sizeof(dir_only), 0); RNA_BEGIN(op->ptr, itemptr, "files") { RNA_string_get(&itemptr, "name", file_only); diff --git a/source/blender/editors/space_sequencer/space_sequencer.c b/source/blender/editors/space_sequencer/space_sequencer.c index 5c2013ee863..45908801147 100644 --- a/source/blender/editors/space_sequencer/space_sequencer.c +++ b/source/blender/editors/space_sequencer/space_sequencer.c @@ -362,7 +362,7 @@ static void sequencer_drop_copy(wmDrag *drag, wmDropBox *drop) PointerRNA itemptr; char dir[FILE_MAX], file[FILE_MAX]; - BLI_split_dirfile(drag->path, dir, file); + BLI_split_dirfile(drag->path, dir, file, sizeof(dir), sizeof(file)); RNA_string_set(drop->ptr, "directory", dir); diff --git a/source/blender/makesrna/intern/rna_sequencer.c b/source/blender/makesrna/intern/rna_sequencer.c index 92739148b99..b90f10693ac 100644 --- a/source/blender/makesrna/intern/rna_sequencer.c +++ b/source/blender/makesrna/intern/rna_sequencer.c @@ -443,7 +443,6 @@ static PointerRNA rna_SequenceEditor_meta_stack_get(CollectionPropertyIterator * static void rna_Sequence_filepath_set(PointerRNA *ptr, const char *value) { Sequence *seq= (Sequence*)(ptr->data); - char dir[FILE_MAX], name[FILE_MAX]; if(seq->type == SEQ_SOUND && seq->sound) { /* for sound strips we need to update the sound as well. @@ -457,9 +456,7 @@ static void rna_Sequence_filepath_set(PointerRNA *ptr, const char *value) sound_update_scene_sound(seq->scene_sound, seq->sound); } - BLI_split_dirfile(value, dir, name); - BLI_strncpy(seq->strip->dir, dir, sizeof(seq->strip->dir)); - BLI_strncpy(seq->strip->stripdata->name, name, sizeof(seq->strip->stripdata->name)); + BLI_split_dirfile(value, seq->strip->dir, seq->strip->stripdata->name, sizeof(seq->strip->dir), sizeof(seq->strip->stripdata->name)); } static void rna_Sequence_filepath_get(PointerRNA *ptr, char *value) @@ -481,11 +478,7 @@ static int rna_Sequence_filepath_length(PointerRNA *ptr) static void rna_Sequence_proxy_filepath_set(PointerRNA *ptr, const char *value) { StripProxy *proxy= (StripProxy*)(ptr->data); - char dir[FILE_MAX], name[FILE_MAX]; - - BLI_split_dirfile(value, dir, name); - BLI_strncpy(proxy->dir, dir, sizeof(proxy->dir)); - BLI_strncpy(proxy->file, name, sizeof(proxy->file)); + BLI_split_dirfile(value, proxy->dir, proxy->file, sizeof(proxy->dir), sizeof(proxy->file)); } static void rna_Sequence_proxy_filepath_get(PointerRNA *ptr, char *value) @@ -541,20 +534,13 @@ static int rna_Sequence_input_count_get(PointerRNA *ptr) /*static void rna_SoundSequence_filename_set(PointerRNA *ptr, const char *value) { Sequence *seq= (Sequence*)(ptr->data); - char dir[FILE_MAX], name[FILE_MAX]; - - BLI_split_dirfile(value, dir, name); - BLI_strncpy(seq->strip->dir, dir, sizeof(seq->strip->dir)); - BLI_strncpy(seq->strip->stripdata->name, name, sizeof(seq->strip->stripdata->name)); + BLI_split_dirfile(value, seq->strip->dir, seq->strip->stripdata->name, sizeof(seq->strip->dir), sizeof(seq->strip->stripdata->name)); } static void rna_SequenceElement_filename_set(PointerRNA *ptr, const char *value) { StripElem *elem= (StripElem*)(ptr->data); - char name[FILE_MAX]; - - BLI_split_dirfile(value, NULL, name); - BLI_strncpy(elem->name, name, sizeof(elem->name)); + BLI_split_dirfile(value, NULL, elem->name, 0, sizeof(elem->name)); }*/ static void rna_Sequence_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *ptr) diff --git a/source/gameengine/Ketsji/KX_PythonInit.cpp b/source/gameengine/Ketsji/KX_PythonInit.cpp index 62ca2910c60..40917a67c2f 100644 --- a/source/gameengine/Ketsji/KX_PythonInit.cpp +++ b/source/gameengine/Ketsji/KX_PythonInit.cpp @@ -502,7 +502,7 @@ static PyObject* gPyGetBlendFileList(PyObject*, PyObject* args) BLI_path_abs(cpath, gp_GamePythonPath); } else { /* Get the dir only */ - BLI_split_dirfile(gp_GamePythonPath, cpath, NULL); + BLI_split_dirfile(gp_GamePythonPath, cpath, NULL, sizeof(cpath), 0); } if((dp = opendir(cpath)) == NULL) { @@ -1732,7 +1732,7 @@ static void initPySysObjects__append(PyObject *sys_path, char *filename) PyObject *item; char expanded[FILE_MAXDIR + FILE_MAXFILE]; - BLI_split_dirfile(filename, expanded, NULL); /* get the dir part of filename only */ + BLI_split_dirfile(filename, expanded, NULL, sizeof(expanded), 0); /* get the dir part of filename only */ BLI_path_abs(expanded, gp_GamePythonPath); /* filename from lib->filename is (always?) absolute, so this may not be needed but it wont hurt */ BLI_cleanup_file(gp_GamePythonPath, expanded); /* Dont use BLI_cleanup_dir because it adds a slash - BREAKS WIN32 ONLY */ item= PyUnicode_DecodeFSDefault(expanded); -- cgit v1.2.3 From 5da894b1fe1214866d7b343fabab848e8f32a581 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 15 Oct 2011 05:01:47 +0000 Subject: misc edits - cmake/windows was installing locale & font when internationalization was disabled, twice when enabled. - file selector was using the string size-1, where this isn't needed since string buttons expected this value to be the sizeof(), accounting for '\0'. - use const char for extension checking funcs. - minor pep8 edits --- po/update_msg.py | 8 +++++--- release/scripts/startup/bl_ui/space_view3d.py | 1 + source/blender/blenloader/BLO_readfile.h | 2 +- source/blender/blenloader/intern/readfile.c | 2 +- source/blender/editors/include/ED_fileselect.h | 2 +- source/blender/editors/space_file/file_draw.c | 4 ++-- source/blender/editors/space_file/filelist.c | 4 ++-- source/creator/CMakeLists.txt | 10 +--------- 8 files changed, 14 insertions(+), 19 deletions(-) diff --git a/po/update_msg.py b/po/update_msg.py index 5986d96f14b..7cc7ee50b63 100644 --- a/po/update_msg.py +++ b/po/update_msg.py @@ -135,10 +135,12 @@ def dump_messages_rna(messages): item.identifier, ) # Here identifier and name can be the same! - if item.name: # and item.name != item.identifier: - messages.setdefault(item.name, []).append(msgsrc) + if item.name: # and item.name != item.identifier: + messages.setdefault(item.name, + []).append(msgsrc) if item.description: - messages.setdefault(item.description, []).append(msgsrc) + messages.setdefault(item.description, + []).append(msgsrc) def walkRNA(bl_rna): diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py index 9b93fd18bac..068e5a2659a 100644 --- a/release/scripts/startup/bl_ui/space_view3d.py +++ b/release/scripts/startup/bl_ui/space_view3d.py @@ -985,6 +985,7 @@ class VIEW3D_MT_make_links(Menu): layout.operator("object.join_uvs") # stupid place to add this! + class VIEW3D_MT_object_game(Menu): bl_label = "Game" diff --git a/source/blender/blenloader/BLO_readfile.h b/source/blender/blenloader/BLO_readfile.h index 47931477728..e7be98d955d 100644 --- a/source/blender/blenloader/BLO_readfile.h +++ b/source/blender/blenloader/BLO_readfile.h @@ -204,7 +204,7 @@ BLO_blendhandle_close( #define GROUP_MAX 32 -int BLO_has_bfile_extension(char *str); +int BLO_has_bfile_extension(const char *str); /* return ok when a blenderfile, in dir is the filename, * in group the type of libdata diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 7d84eeba9c8..76070e42f29 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -1048,7 +1048,7 @@ void blo_freefiledata(FileData *fd) /* ************ DIV ****************** */ -int BLO_has_bfile_extension(char *str) +int BLO_has_bfile_extension(const char *str) { return (BLI_testextensie(str, ".ble") || BLI_testextensie(str, ".blend") || BLI_testextensie(str, ".blend.gz")); } diff --git a/source/blender/editors/include/ED_fileselect.h b/source/blender/editors/include/ED_fileselect.h index 1eedd7ec782..df4113ca07a 100644 --- a/source/blender/editors/include/ED_fileselect.h +++ b/source/blender/editors/include/ED_fileselect.h @@ -106,7 +106,7 @@ void ED_fileselect_clear(struct bContext *C, struct SpaceFile *sfile); void ED_fileselect_exit(struct bContext *C, struct SpaceFile *sfile); -int ED_file_extension_icon(char *relname); +int ED_file_extension_icon(const char *relname); #endif /* ED_FILES_H */ diff --git a/source/blender/editors/space_file/file_draw.c b/source/blender/editors/space_file/file_draw.c index 611bf79603e..85edcce35ca 100644 --- a/source/blender/editors/space_file/file_draw.c +++ b/source/blender/editors/space_file/file_draw.c @@ -181,7 +181,7 @@ void file_draw_buttons(const bContext *C, ARegion *ar) but = uiDefButTextO(block, TEX, "FILE_OT_directory", 0, "", min_x, line1_y, line1_w-chan_offs, btn_h, - params->dir, 0.0, (float)FILE_MAX-1, 0, 0, + params->dir, 0.0, (float)FILE_MAX, 0, 0, UI_translate_do_tooltip(N_("File path"))); uiButSetCompleteFunc(but, autocomplete_directory, NULL); uiButSetFlag(but, UI_BUT_NO_UTF8); @@ -189,7 +189,7 @@ void file_draw_buttons(const bContext *C, ARegion *ar) if((params->flag & FILE_DIRSEL_ONLY) == 0) { but = uiDefBut(block, TEX, B_FS_FILENAME, "", min_x, line2_y, line2_w-chan_offs, btn_h, - params->file, 0.0, (float)FILE_MAXFILE-1, 0, 0, + params->file, 0.0, (float)FILE_MAXFILE, 0, 0, UI_translate_do_tooltip(overwrite_alert ?N_("File name, overwrite existing") : N_("File name"))); uiButSetCompleteFunc(but, autocomplete_file, NULL); uiButSetFlag(but, UI_BUT_NO_UTF8); diff --git a/source/blender/editors/space_file/filelist.c b/source/blender/editors/space_file/filelist.c index c2e45c5ad8a..b478976d027 100644 --- a/source/blender/editors/space_file/filelist.c +++ b/source/blender/editors/space_file/filelist.c @@ -736,7 +736,7 @@ static int file_is_blend_backup(const char *str) } -static int file_extension_type(char *relname) +static int file_extension_type(const char *relname) { if(BLO_has_bfile_extension(relname)) { return BLENDERFILE; @@ -769,7 +769,7 @@ static int file_extension_type(char *relname) return 0; } -int ED_file_extension_icon(char *relname) +int ED_file_extension_icon(const char *relname) { int type= file_extension_type(relname); diff --git a/source/creator/CMakeLists.txt b/source/creator/CMakeLists.txt index 0650a5678b2..e7a1ff14f03 100644 --- a/source/creator/CMakeLists.txt +++ b/source/creator/CMakeLists.txt @@ -443,14 +443,6 @@ elseif(WIN32) endif() endif() - install( # same as linux!, deduplicate - DIRECTORY - ${CMAKE_SOURCE_DIR}/release/bin/.blender/locale - ${CMAKE_SOURCE_DIR}/release/bin/.blender/fonts - DESTINATION ${TARGETDIR_VER}/datafiles - PATTERN ".svn" EXCLUDE - ) - # plugins in blender 2.5 don't work at the moment. # # install( @@ -656,8 +648,8 @@ elseif(APPLE) if(WITH_INTERNATIONAL) install( DIRECTORY - ${CMAKE_SOURCE_DIR}/release/bin/.blender/fonts ${CMAKE_SOURCE_DIR}/release/bin/.blender/locale + ${CMAKE_SOURCE_DIR}/release/bin/.blender/fonts DESTINATION ${TARGETDIR_VER}/datafiles PATTERN ".svn" EXCLUDE ) -- cgit v1.2.3 From febcb91b82c03a2ec0fc36f989b5dddeca5f4373 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 15 Oct 2011 07:19:34 +0000 Subject: - add template for defining custom driver functions. - comment unused assignments. --- GNUmakefile | 2 +- release/scripts/templates/driver_functions.py | 34 +++++++++++++++++++++++++++ source/blender/nodes/intern/node_exec.c | 4 ++-- 3 files changed, 37 insertions(+), 3 deletions(-) create mode 100644 release/scripts/templates/driver_functions.py diff --git a/GNUmakefile b/GNUmakefile index f92b0093eae..52f36b218d8 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -233,7 +233,7 @@ check_sparse: doc_py: $(BUILD_DIR)/bin/blender --background --factory-startup --python doc/python_api/sphinx_doc_gen.py cd doc/python_api ; sphinx-build -n -b html sphinx-in sphinx-out - @echo "docs written into: 'doc/python_api/sphinx-out/index.html'" + @echo "docs written into: '$(BLENDER_DIR)/doc/python_api/sphinx-out/contents.html'" clean: diff --git a/release/scripts/templates/driver_functions.py b/release/scripts/templates/driver_functions.py new file mode 100644 index 00000000000..db9d4fb4678 --- /dev/null +++ b/release/scripts/templates/driver_functions.py @@ -0,0 +1,34 @@ +# This script defines functions to be used directly in drivers expressions to +# extend the builtin set of python functions. +# +# This can be executed on manually or set to 'Register' to +# initialize thefunctions on file load. + + +# two sample functions +def invert(f): + """ Simple function call: + + invert(val) + """ + return 1.0 - f + + +uuid_store = {} + +def slow_value(value, fac, uuid): + """ Delay the value by a factor, use a unique string to allow + use in multiple drivers without conflict: + + slow_value(val, 0.5, "my_value") + """ + value_prev = uuid_store.get(uuid, value) + uuid_store[uuid] = value_new = (value_prev * fac) + (value * (1.0 - fac)) + return value_new + + +import bpy + +# Add variable defined in this script into the drivers namespace. +bpy.app.driver_namespace["invert"] = invert +bpy.app.driver_namespace["slow_value"] = slow_value diff --git a/source/blender/nodes/intern/node_exec.c b/source/blender/nodes/intern/node_exec.c index 53bbb27f9b0..154f7613223 100644 --- a/source/blender/nodes/intern/node_exec.c +++ b/source/blender/nodes/intern/node_exec.c @@ -180,7 +180,7 @@ bNodeTreeExec *ntree_exec_begin(bNodeTree *ntree) /* prepare group tree inputs */ for (sock=ntree->inputs.first; sock; sock=sock->next) { - ns = setup_stack(exec->stack, sock); + /* ns = */ setup_stack(exec->stack, sock); } /* prepare all internal nodes for execution */ for(n=0, nodeexec= exec->nodeexec; n < totnodes; ++n, ++nodeexec) { @@ -198,7 +198,7 @@ bNodeTreeExec *ntree_exec_begin(bNodeTree *ntree) /* tag all outputs */ for (sock=node->outputs.first; sock; sock=sock->next) { - ns = setup_stack(exec->stack, sock); + /* ns = */ setup_stack(exec->stack, sock); } if(node->typeinfo->initexecfunc) -- cgit v1.2.3 From f8317ed450e8e1649b4b23215417ad3e5b8d607c Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 15 Oct 2011 09:43:42 +0000 Subject: fix UI jump in normal buttons for buttons which didnt start out normalized. --- source/blender/editors/interface/interface.c | 12 ++++++++---- source/blender/editors/interface/interface_handlers.c | 9 ++++++--- source/blender/editors/interface/interface_intern.h | 4 ++-- 3 files changed, 16 insertions(+), 9 deletions(-) diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c index a816c1612a1..a62658349c1 100644 --- a/source/blender/editors/interface/interface.c +++ b/source/blender/editors/interface/interface.c @@ -1211,7 +1211,7 @@ void ui_delete_linkline(uiLinkLine *line, uiBut *but) * an edit override pointer while dragging for example */ /* for buttons pointing to color for example */ -void ui_get_but_vectorf(uiBut *but, float *vec) +void ui_get_but_vectorf(uiBut *but, float vec[3]) { PropertyRNA *prop; int a, tot; @@ -1249,16 +1249,20 @@ void ui_get_but_vectorf(uiBut *but, float *vec) vec[0]= vec[1]= vec[2]= 0.0f; } } + + if (but->type == BUT_NORMAL) { + normalize_v3(vec); + } } /* for buttons pointing to color for example */ -void ui_set_but_vectorf(uiBut *but, float *vec) +void ui_set_but_vectorf(uiBut *but, const float vec[3]) { PropertyRNA *prop; int a, tot; if(but->editvec) { - VECCOPY(but->editvec, vec); + copy_v3_v3(but->editvec, vec); } if(but->rnaprop) { @@ -1280,7 +1284,7 @@ void ui_set_but_vectorf(uiBut *but, float *vec) } else if(but->pointype == FLO) { float *fp= (float *)but->poin; - VECCOPY(fp, vec); + copy_v3_v3(fp, vec); } } diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index 9af9b2f55ad..6699e8f8701 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -1966,8 +1966,6 @@ static void ui_do_but_textedit_select(bContext *C, uiBlock *block, uiBut *but, u static void ui_numedit_begin(uiBut *but, uiHandleButtonData *data) { - float softrange, softmin, softmax; - if(but->type == BUT_CURVE) { but->editcumap= (CurveMapping*)but->poin; } @@ -1977,10 +1975,12 @@ static void ui_numedit_begin(uiBut *but, uiHandleButtonData *data) } else if(ELEM3(but->type, BUT_NORMAL, HSVCUBE, HSVCIRCLE)) { ui_get_but_vectorf(but, data->origvec); - VECCOPY(data->vec, data->origvec); + copy_v3_v3(data->vec, data->origvec); but->editvec= data->vec; } else { + float softrange, softmin, softmax; + data->startvalue= ui_get_but_val(but); data->origvalue= data->startvalue; data->value= data->origvalue; @@ -3004,6 +3004,9 @@ static int ui_numedit_but_NORMAL(uiBut *but, uiHandleButtonData *data, int mx, i /* button is presumed square */ /* if mouse moves outside of sphere, it does negative normal */ + /* note that both data->vec and data->origvec should be normalized + * else we'll get a hamrless but annoying jump when first clicking */ + fp= data->origvec; rad= (but->x2 - but->x1); radsq= rad*rad; diff --git a/source/blender/editors/interface/interface_intern.h b/source/blender/editors/interface/interface_intern.h index 6fb7677da6e..12e9d39e896 100644 --- a/source/blender/editors/interface/interface_intern.h +++ b/source/blender/editors/interface/interface_intern.h @@ -350,8 +350,8 @@ extern void ui_window_to_region(const ARegion *ar, int *x, int *y); extern double ui_get_but_val(uiBut *but); extern void ui_set_but_val(uiBut *but, double value); extern void ui_set_but_hsv(uiBut *but); -extern void ui_get_but_vectorf(uiBut *but, float *vec); -extern void ui_set_but_vectorf(uiBut *but, float *vec); +extern void ui_get_but_vectorf(uiBut *but, float vec[3]); +extern void ui_set_but_vectorf(uiBut *but, const float vec[3]); extern void ui_hsvcircle_vals_from_pos(float *valrad, float *valdist, rcti *rect, float mx, float my); -- cgit v1.2.3 From 9613de6248b364e58abf01c36d9d1290ecc93dfe Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 15 Oct 2011 09:59:31 +0000 Subject: make sure render layer names are unique when setting through rna. --- source/blender/editors/interface/interface.c | 7 +++++-- source/blender/makesrna/intern/rna_scene.c | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c index a62658349c1..299bec0db8a 100644 --- a/source/blender/editors/interface/interface.c +++ b/source/blender/editors/interface/interface.c @@ -1259,7 +1259,6 @@ void ui_get_but_vectorf(uiBut *but, float vec[3]) void ui_set_but_vectorf(uiBut *but, const float vec[3]) { PropertyRNA *prop; - int a, tot; if(but->editvec) { copy_v3_v3(but->editvec, vec); @@ -1269,11 +1268,15 @@ void ui_set_but_vectorf(uiBut *but, const float vec[3]) prop= but->rnaprop; if(RNA_property_type(prop) == PROP_FLOAT) { + int tot; + int a; + tot= RNA_property_array_length(&but->rnapoin, prop); tot= MIN2(tot, 3); - for(a=0; arnapoin, prop, a, vec[a]); + } } } else if(but->pointype == CHA) { diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index 0eaacc62f33..ccc8151ac7f 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -812,8 +812,8 @@ static void rna_SceneRenderLayer_name_set(PointerRNA *ptr, const char *value) { Scene *scene= (Scene*)ptr->id.data; SceneRenderLayer *rl= (SceneRenderLayer*)ptr->data; - BLI_strncpy_utf8(rl->name, value, sizeof(rl->name)); + BLI_uniquename(&scene->r.layers, rl, "RenderLayer", '.', offsetof(SceneRenderLayer, name), sizeof(rl->name)); if(scene->nodetree) { bNode *node; -- cgit v1.2.3 From d0d16b5ed29c8f209bbeb0dd32a01ae581b5e9f7 Mon Sep 17 00:00:00 2001 From: Thomas Dinges Date: Sat, 15 Oct 2011 10:03:21 +0000 Subject: Last minute UI fix: * Vert/Edge/Face select buttons looked crappy when in EditMode and Wireframe shading. Fixed it. This commit makes the View3D Template a bit narrower in general, but it's very minor, should be no problem. This also fixes some weird increase/decrease of the 3D Mode selector menu when toggling between Textured/Solid and Wireframe/Boundbox shading. --- release/scripts/startup/bl_ui/space_view3d.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py index 068e5a2659a..ff6afa81e65 100644 --- a/release/scripts/startup/bl_ui/space_view3d.py +++ b/release/scripts/startup/bl_ui/space_view3d.py @@ -54,10 +54,11 @@ class VIEW3D_HT_header(Header): else: sub.menu("VIEW3D_MT_object") - row = layout.row() + # Contains buttons like Mode, Pivot, Manipulator, Layer, Mesh Select Mode... - row.template_header_3D() - + layout.template_header_3D() + + row = layout.row() if obj: # Particle edit if obj.mode == 'PARTICLE_EDIT': -- cgit v1.2.3 From f5f82924614e9ab712a98bd39801061698bf7b3d Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 15 Oct 2011 11:07:18 +0000 Subject: ensure BoneGroup names are kept unique. --- source/blender/makesdna/DNA_action_types.h | 4 +++- source/blender/makesrna/intern/rna_pose.c | 12 ++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/source/blender/makesdna/DNA_action_types.h b/source/blender/makesdna/DNA_action_types.h index 492dd34caa6..29e0b18b97d 100644 --- a/source/blender/makesdna/DNA_action_types.h +++ b/source/blender/makesdna/DNA_action_types.h @@ -341,7 +341,7 @@ typedef struct bPose { void *ikparam; /* IK solver parameters, structure depends on iksolver */ bAnimVizSettings avs; /* settings for visualisation of bone animation */ - char proxy_act_bone[32]; /*proxy active bone name*/ + char proxy_act_bone[32]; /* proxy active bone name*/ } bPose; @@ -423,6 +423,8 @@ typedef enum eItasc_Solver { * This is also exploited for bone-groups. Bone-Groups are stored per bPose, and are used * primarily to color bones in the 3d-view. There are other benefits too, but those are mostly related * to Action-Groups. + * + * Note that these two uses each have their own RNA 'ActionGroup' and 'BoneGroup'. */ typedef struct bActionGroup { struct bActionGroup *next, *prev; diff --git a/source/blender/makesrna/intern/rna_pose.c b/source/blender/makesrna/intern/rna_pose.c index b61495edc94..e3a3f93b5f3 100644 --- a/source/blender/makesrna/intern/rna_pose.c +++ b/source/blender/makesrna/intern/rna_pose.c @@ -139,6 +139,17 @@ static void rna_BoneGroup_color_set_set(PointerRNA *ptr, int value) } } +void rna_BoneGroup_name_set(PointerRNA *ptr, const char *value) +{ + Object *ob= ptr->id.data; + bActionGroup *agrp= ptr->data; + + /* copy the new name into the name slot */ + BLI_strncpy_utf8(agrp->name, value, sizeof(agrp->name)); + + BLI_uniquename(&ob->pose->agroups, agrp, "Group", '.', offsetof(bActionGroup, name), sizeof(agrp->name)); +} + static IDProperty *rna_PoseBone_idprops(PointerRNA *ptr, int create) { bPoseChannel *pchan= ptr->data; @@ -657,6 +668,7 @@ static void rna_def_bone_group(BlenderRNA *brna) /* name */ prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE); RNA_def_property_ui_text(prop, "Name", ""); + RNA_def_property_string_funcs(prop, NULL, NULL, "rna_BoneGroup_name_set"); RNA_def_struct_name_property(srna, prop); // TODO: add some runtime-collections stuff to access grouped bones -- cgit v1.2.3 From 58eb0d7967c8402fc021d316f525ddef0f4bad38 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 15 Oct 2011 11:55:09 +0000 Subject: keep particle system names unique --- source/blender/makesrna/intern/rna_particle.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/source/blender/makesrna/intern/rna_particle.c b/source/blender/makesrna/intern/rna_particle.c index f0f782fede2..49005e56367 100644 --- a/source/blender/makesrna/intern/rna_particle.c +++ b/source/blender/makesrna/intern/rna_particle.c @@ -505,6 +505,17 @@ static int rna_PartSettings_is_fluid_get(PointerRNA *ptr) return part->type == PART_FLUID; } +void rna_ParticleSystem_name_set(PointerRNA *ptr, const char *value) +{ + Object *ob= ptr->id.data; + ParticleSystem *part= (ParticleSystem*)ptr->data; + + /* copy the new name into the name slot */ + BLI_strncpy_utf8(part->name, value, sizeof(part->name)); + + BLI_uniquename(&ob->particlesystem, part, "ParticleSystem", '.', offsetof(ParticleSystem, name), sizeof(part->name)); +} + static PointerRNA rna_ParticleSystem_active_particle_target_get(PointerRNA *ptr) { ParticleSystem *psys= (ParticleSystem*)ptr->data; @@ -2617,6 +2628,7 @@ static void rna_def_particle_system(BlenderRNA *brna) prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE); RNA_def_property_ui_text(prop, "Name", "Particle system name"); RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER|NA_RENAME, NULL); + RNA_def_property_string_funcs(prop, NULL, NULL, "rna_ParticleSystem_name_set"); RNA_def_struct_name_property(srna, prop); /* access to particle settings is redirected through functions */ -- cgit v1.2.3 From 843193e4d1fb1b8d3ccb0c2bbd4dc763cc4f7601 Mon Sep 17 00:00:00 2001 From: Jens Verwiebe Date: Sat, 15 Oct 2011 14:03:23 +0000 Subject: Delete applescript for recommit --- .../set_simulation_threads.app/Contents/Info.plist | 44 --------------------- .../Contents/MacOS/applet | Bin 34480 -> 0 bytes .../set_simulation_threads.app/Contents/PkgInfo | 1 - .../Contents/Resources/Scripts/main.scpt | Bin 4432 -> 0 bytes .../Contents/Resources/applet.icns | Bin 40291 -> 0 bytes .../Contents/Resources/applet.rsrc | Bin 362 -> 0 bytes .../Contents/Resources/description.rtfd/TXT.rtf | 4 -- 7 files changed, 49 deletions(-) delete mode 100644 source/darwin/set_simulation_threads.app/Contents/Info.plist delete mode 100755 source/darwin/set_simulation_threads.app/Contents/MacOS/applet delete mode 100644 source/darwin/set_simulation_threads.app/Contents/PkgInfo delete mode 100644 source/darwin/set_simulation_threads.app/Contents/Resources/Scripts/main.scpt delete mode 100644 source/darwin/set_simulation_threads.app/Contents/Resources/applet.icns delete mode 100644 source/darwin/set_simulation_threads.app/Contents/Resources/applet.rsrc delete mode 100644 source/darwin/set_simulation_threads.app/Contents/Resources/description.rtfd/TXT.rtf diff --git a/source/darwin/set_simulation_threads.app/Contents/Info.plist b/source/darwin/set_simulation_threads.app/Contents/Info.plist deleted file mode 100644 index f71939a7795..00000000000 --- a/source/darwin/set_simulation_threads.app/Contents/Info.plist +++ /dev/null @@ -1,44 +0,0 @@ - - - - - CFBundleAllowMixedLocalizations - - CFBundleDevelopmentRegion - English - CFBundleExecutable - applet - CFBundleIconFile - applet - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - set_simulation_threads - CFBundlePackageType - APPL - CFBundleSignature - aplt - LSMinimumSystemVersionByArchitecture - - x86_64 - 10.6 - - LSRequiresCarbon - - WindowState - - dividerCollapsed - - eventLogLevel - -1 - name - ScriptWindowState - positionOfDivider - 284 - savedFrame - 284 477 1474 522 0 0 1920 1178 - selectedTabView - result - - - diff --git a/source/darwin/set_simulation_threads.app/Contents/MacOS/applet b/source/darwin/set_simulation_threads.app/Contents/MacOS/applet deleted file mode 100755 index 0079f4b19d4..00000000000 Binary files a/source/darwin/set_simulation_threads.app/Contents/MacOS/applet and /dev/null differ diff --git a/source/darwin/set_simulation_threads.app/Contents/PkgInfo b/source/darwin/set_simulation_threads.app/Contents/PkgInfo deleted file mode 100644 index 3253614c402..00000000000 --- a/source/darwin/set_simulation_threads.app/Contents/PkgInfo +++ /dev/null @@ -1 +0,0 @@ -APPLaplt \ No newline at end of file diff --git a/source/darwin/set_simulation_threads.app/Contents/Resources/Scripts/main.scpt b/source/darwin/set_simulation_threads.app/Contents/Resources/Scripts/main.scpt deleted file mode 100644 index 611fb64417b..00000000000 Binary files a/source/darwin/set_simulation_threads.app/Contents/Resources/Scripts/main.scpt and /dev/null differ diff --git a/source/darwin/set_simulation_threads.app/Contents/Resources/applet.icns b/source/darwin/set_simulation_threads.app/Contents/Resources/applet.icns deleted file mode 100644 index fcc1f09273d..00000000000 Binary files a/source/darwin/set_simulation_threads.app/Contents/Resources/applet.icns and /dev/null differ diff --git a/source/darwin/set_simulation_threads.app/Contents/Resources/applet.rsrc b/source/darwin/set_simulation_threads.app/Contents/Resources/applet.rsrc deleted file mode 100644 index 43934978719..00000000000 Binary files a/source/darwin/set_simulation_threads.app/Contents/Resources/applet.rsrc and /dev/null differ diff --git a/source/darwin/set_simulation_threads.app/Contents/Resources/description.rtfd/TXT.rtf b/source/darwin/set_simulation_threads.app/Contents/Resources/description.rtfd/TXT.rtf deleted file mode 100644 index 0d0a60c08b5..00000000000 --- a/source/darwin/set_simulation_threads.app/Contents/Resources/description.rtfd/TXT.rtf +++ /dev/null @@ -1,4 +0,0 @@ -{\rtf1\ansi\ansicpg1252\cocoartf1138\cocoasubrtf230 -{\fonttbl} -{\colortbl;\red255\green255\blue255;} -} \ No newline at end of file -- cgit v1.2.3 From 08f8fbbd30cc9e35eae7b064c38fb9ce0c779a8d Mon Sep 17 00:00:00 2001 From: Jens Verwiebe Date: Sat, 15 Oct 2011 14:04:33 +0000 Subject: OSX:recommit applescript, added errorhandling --- .../set_simulation_threads.app/Contents/Info.plist | 44 +++++++++++++++++++++ .../Contents/MacOS/applet | Bin 0 -> 34480 bytes .../set_simulation_threads.app/Contents/PkgInfo | 1 + .../Contents/Resources/Scripts/main.scpt | Bin 0 -> 4542 bytes .../Contents/Resources/applet.icns | Bin 0 -> 40291 bytes .../Contents/Resources/applet.rsrc | Bin 0 -> 362 bytes .../Contents/Resources/description.rtfd/TXT.rtf | 4 ++ 7 files changed, 49 insertions(+) create mode 100644 source/darwin/set_simulation_threads.app/Contents/Info.plist create mode 100755 source/darwin/set_simulation_threads.app/Contents/MacOS/applet create mode 100644 source/darwin/set_simulation_threads.app/Contents/PkgInfo create mode 100644 source/darwin/set_simulation_threads.app/Contents/Resources/Scripts/main.scpt create mode 100644 source/darwin/set_simulation_threads.app/Contents/Resources/applet.icns create mode 100644 source/darwin/set_simulation_threads.app/Contents/Resources/applet.rsrc create mode 100644 source/darwin/set_simulation_threads.app/Contents/Resources/description.rtfd/TXT.rtf diff --git a/source/darwin/set_simulation_threads.app/Contents/Info.plist b/source/darwin/set_simulation_threads.app/Contents/Info.plist new file mode 100644 index 00000000000..71ec4a4d0c1 --- /dev/null +++ b/source/darwin/set_simulation_threads.app/Contents/Info.plist @@ -0,0 +1,44 @@ + + + + + CFBundleAllowMixedLocalizations + + CFBundleDevelopmentRegion + English + CFBundleExecutable + applet + CFBundleIconFile + applet + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + set_simulation_threads + CFBundlePackageType + APPL + CFBundleSignature + aplt + LSMinimumSystemVersionByArchitecture + + x86_64 + 10.6 + + LSRequiresCarbon + + WindowState + + dividerCollapsed + + eventLogLevel + -1 + name + ScriptWindowState + positionOfDivider + 400 + savedFrame + 424 473 1435 704 0 0 1920 1178 + selectedTabView + result + + + diff --git a/source/darwin/set_simulation_threads.app/Contents/MacOS/applet b/source/darwin/set_simulation_threads.app/Contents/MacOS/applet new file mode 100755 index 00000000000..0079f4b19d4 Binary files /dev/null and b/source/darwin/set_simulation_threads.app/Contents/MacOS/applet differ diff --git a/source/darwin/set_simulation_threads.app/Contents/PkgInfo b/source/darwin/set_simulation_threads.app/Contents/PkgInfo new file mode 100644 index 00000000000..3253614c402 --- /dev/null +++ b/source/darwin/set_simulation_threads.app/Contents/PkgInfo @@ -0,0 +1 @@ +APPLaplt \ No newline at end of file diff --git a/source/darwin/set_simulation_threads.app/Contents/Resources/Scripts/main.scpt b/source/darwin/set_simulation_threads.app/Contents/Resources/Scripts/main.scpt new file mode 100644 index 00000000000..44a107abf78 Binary files /dev/null and b/source/darwin/set_simulation_threads.app/Contents/Resources/Scripts/main.scpt differ diff --git a/source/darwin/set_simulation_threads.app/Contents/Resources/applet.icns b/source/darwin/set_simulation_threads.app/Contents/Resources/applet.icns new file mode 100644 index 00000000000..fcc1f09273d Binary files /dev/null and b/source/darwin/set_simulation_threads.app/Contents/Resources/applet.icns differ diff --git a/source/darwin/set_simulation_threads.app/Contents/Resources/applet.rsrc b/source/darwin/set_simulation_threads.app/Contents/Resources/applet.rsrc new file mode 100644 index 00000000000..44dcf1a9f60 Binary files /dev/null and b/source/darwin/set_simulation_threads.app/Contents/Resources/applet.rsrc differ diff --git a/source/darwin/set_simulation_threads.app/Contents/Resources/description.rtfd/TXT.rtf b/source/darwin/set_simulation_threads.app/Contents/Resources/description.rtfd/TXT.rtf new file mode 100644 index 00000000000..0d0a60c08b5 --- /dev/null +++ b/source/darwin/set_simulation_threads.app/Contents/Resources/description.rtfd/TXT.rtf @@ -0,0 +1,4 @@ +{\rtf1\ansi\ansicpg1252\cocoartf1138\cocoasubrtf230 +{\fonttbl} +{\colortbl;\red255\green255\blue255;} +} \ No newline at end of file -- cgit v1.2.3 From 8dce8e0c1747c958713577eadb3a94682a4fa95a Mon Sep 17 00:00:00 2001 From: Jens Verwiebe Date: Sat, 15 Oct 2011 14:13:49 +0000 Subject: OSX: make sure the set_simulation_threads script is always renewed --- build_files/scons/tools/Blender.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/build_files/scons/tools/Blender.py b/build_files/scons/tools/Blender.py index f54ab102415..147316c204a 100644 --- a/build_files/scons/tools/Blender.py +++ b/build_files/scons/tools/Blender.py @@ -592,7 +592,9 @@ def AppIt(target=None, source=None, env=None): commands.getoutput(cmd) cmd = 'install_name_tool -change %s/lib/libgcc_s.1.dylib @executable_path/lib/libgcc_s.1.dylib %s/%s.app/Contents/MacOS/%s'%(instname, installdir, binary, binary) commands.getoutput(cmd) - cmd = 'cp -R %s/source/darwin/set_simulation_threads.app %s/'%(bldroot, installdir) # the omp_num_threads applescript + cmd = 'rm -rf %s/set_simulation_threads.app'%(installdir) # first clear omp_num_threads applescript + commands.getoutput(cmd) + cmd = 'cp -R %s/source/darwin/set_simulation_threads.app %s/'%(bldroot, installdir) # copy the omp_num_threads applescript commands.getoutput(cmd) # extract copy system python, be sure to update other build systems -- cgit v1.2.3 From 7f4bb1f71bfef6914fe610266e97b20346c8f05c Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 15 Oct 2011 14:14:22 +0000 Subject: spelling corrections in comments and quiet warning --- source/blender/blenfont/intern/blf_font.c | 2 +- source/blender/blenkernel/intern/constraint.c | 6 +++--- source/blender/editors/animation/anim_filter.c | 3 ++- source/blender/editors/gpencil/editaction_gpencil.c | 2 +- source/blender/editors/interface/interface.c | 8 ++++---- source/blender/editors/interface/interface_regions.c | 2 +- source/blender/editors/sculpt_paint/paint_image.c | 2 +- source/blender/editors/sculpt_paint/paint_vertex.c | 2 +- source/blender/editors/space_graph/graph_draw.c | 2 +- source/blender/editors/space_sequencer/sequencer_edit.c | 2 +- source/blender/editors/space_view3d/drawobject.c | 2 +- source/blender/editors/transform/transform.c | 2 +- source/blender/makesdna/DNA_action_types.h | 4 ++-- source/blender/makesdna/DNA_constraint_types.h | 2 +- source/blender/makesdna/DNA_ipo_types.h | 2 +- source/blender/makesrna/intern/rna_object_force.c | 2 +- source/blender/python/intern/bpy_library.c | 2 +- 17 files changed, 24 insertions(+), 23 deletions(-) diff --git a/source/blender/blenfont/intern/blf_font.c b/source/blender/blenfont/intern/blf_font.c index 851c6542de0..5161761cf09 100644 --- a/source/blender/blenfont/intern/blf_font.c +++ b/source/blender/blenfont/intern/blf_font.c @@ -217,7 +217,7 @@ void blf_font_buffer(FontBLF *font, const char *str) unsigned int i= 0; GlyphBLF **glyph_ascii_table= font->glyph_cache->glyph_ascii_table; - /* buffer spesific vars*/ + /* buffer specific vars*/ const unsigned char b_col_char[4]= {font->b_col[0] * 255, font->b_col[1] * 255, font->b_col[2] * 255, diff --git a/source/blender/blenkernel/intern/constraint.c b/source/blender/blenkernel/intern/constraint.c index 591e0b6a8d2..08a3eab55e6 100644 --- a/source/blender/blenkernel/intern/constraint.c +++ b/source/blender/blenkernel/intern/constraint.c @@ -1067,7 +1067,7 @@ static void trackto_evaluate (bConstraint *con, bConstraintOb *cob, ListBase *ta cob->matrix[2][2]=size[2]; /* targetmat[2] instead of ownermat[2] is passed to vectomat - * for backwards compatability it seems... (Aligorith) + * for backwards compatibility it seems... (Aligorith) */ sub_v3_v3v3(vec, cob->matrix[3], ct->matrix[3]); vectomat(vec, ct->matrix[2], @@ -2104,7 +2104,7 @@ static void actcon_new_data (void *cdata) { bActionConstraint *data= (bActionConstraint *)cdata; - /* set type to 20 (Loc X), as 0 is Rot X for backwards compatability */ + /* set type to 20 (Loc X), as 0 is Rot X for backwards compatibility */ data->type = 20; } @@ -2161,7 +2161,7 @@ static void actcon_get_tarmat (bConstraint *con, bConstraintOb *cob, bConstraint constraint_target_to_mat4(ct->tar, ct->subtarget, tempmat, CONSTRAINT_SPACE_WORLD, ct->space, con->headtail); /* determine where in transform range target is */ - /* data->type is mapped as follows for backwards compatability: + /* data->type is mapped as follows for backwards compatibility: * 00,01,02 - rotation (it used to be like this) * 10,11,12 - scaling * 20,21,22 - location diff --git a/source/blender/editors/animation/anim_filter.c b/source/blender/editors/animation/anim_filter.c index c982a1d7f86..fe6aed77462 100644 --- a/source/blender/editors/animation/anim_filter.c +++ b/source/blender/editors/animation/anim_filter.c @@ -361,7 +361,8 @@ short ANIM_animdata_get_context (const bContext *C, bAnimContext *ac) _doSubChannels=2; \ else {\ filter_mode |= ANIMFILTER_TMP_PEEK; \ - } + } \ + (void) _doSubChannels; /* ... standard sub-channel filtering can go on here now ... */ #define END_ANIMFILTER_SUBCHANNELS \ filter_mode = _filter; \ diff --git a/source/blender/editors/gpencil/editaction_gpencil.c b/source/blender/editors/gpencil/editaction_gpencil.c index 937d24eed04..b6398c6a2f5 100644 --- a/source/blender/editors/gpencil/editaction_gpencil.c +++ b/source/blender/editors/gpencil/editaction_gpencil.c @@ -259,7 +259,7 @@ void duplicate_gplayer_frames (bGPDlayer *gpl) /* Copy and Paste Tools */ /* - The copy/paste buffer currently stores a set of GP_Layers, with temporary * GP_Frames with the necessary strokes - * - Unless there is only one element in the buffer, names are also tested to check for compatability. + * - Unless there is only one element in the buffer, names are also tested to check for compatibility. * - All pasted frames are offset by the same amount. This is calculated as the difference in the times of * the current frame and the 'first keyframe' (i.e. the earliest one in all channels). * - The earliest frame is calculated per copy operation. diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c index 299bec0db8a..b6c72c2e96f 100644 --- a/source/blender/editors/interface/interface.c +++ b/source/blender/editors/interface/interface.c @@ -575,7 +575,7 @@ static void ui_draw_links(uiBlock *block) /* NOTE: if but->poin is allocated memory for every defbut, things fail... */ static int ui_but_equals_old(uiBut *but, uiBut *oldbut) { - /* various properties are being compared here, hopfully sufficient + /* various properties are being compared here, hopefully sufficient * to catch all cases, but it is simple to add more checks later */ if(but->retval != oldbut->retval) return 0; if(but->rnapoin.data != oldbut->rnapoin.data) return 0; @@ -640,7 +640,7 @@ static int ui_but_update_from_old_block(const bContext *C, uiBlock *block, uiBut // but->flag= oldbut->flag; #else /* exception! redalert flag can't be update from old button. - * perhaps it should only copy spesific flags rather than all. */ + * perhaps it should only copy specific flags rather than all. */ // but->flag= (oldbut->flag & ~UI_BUT_REDALERT) | (but->flag & UI_BUT_REDALERT); #endif // but->active= oldbut->active; @@ -748,7 +748,7 @@ static int ui_but_is_rna_undo(uiBut *but) if(but->rnapoin.id.data) { /* avoid undo push for buttons who's ID are screen or wm level * we could disable undo for buttons with no ID too but may have - * unforseen conciquences, so best check for ID's we _know_ are not + * unforeseen consequences, so best check for ID's we _know_ are not * handled by undo - campbell */ ID *id= but->rnapoin.id.data; if(ID_CHECK_UNDO(id) == FALSE) { @@ -865,7 +865,7 @@ void uiEndBlock(const bContext *C, uiBlock *block) /* inherit flags from 'old' buttons that was drawn here previous, based * on matching buttons, we need this to make button event handling non - * blocking, while still alowing buttons to be remade each redraw as it + * blocking, while still allowing buttons to be remade each redraw as it * is expected by blender code */ for(but=block->buttons.first; but; but=but->next) { if(ui_but_update_from_old_block(C, block, &but)) diff --git a/source/blender/editors/interface/interface_regions.c b/source/blender/editors/interface/interface_regions.c index 622d50752fa..028ab05464b 100644 --- a/source/blender/editors/interface/interface_regions.c +++ b/source/blender/editors/interface/interface_regions.c @@ -368,7 +368,7 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but) /* create tooltip data */ data= MEM_callocN(sizeof(uiTooltipData), "uiTooltipData"); - /* special case, enum rna buttons only have enum item description, use general enum description too before the spesific one */ + /* special case, enum rna buttons only have enum item description, use general enum description too before the specific one */ if(but->rnaprop && RNA_property_type(but->rnaprop) == PROP_ENUM) { const char *descr= RNA_property_description(but->rnaprop); if(descr && descr[0]) { diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c index 1c53be15a0f..9842bc0e1ee 100644 --- a/source/blender/editors/sculpt_paint/paint_image.c +++ b/source/blender/editors/sculpt_paint/paint_image.c @@ -3966,7 +3966,7 @@ static int project_paint_op(void *state, ImBuf *UNUSED(ibufb), float *lastpos, f copy_v2_v2(handles[a].mval, pos); copy_v2_v2(handles[a].prevmval, lastpos); - /* thread spesific */ + /* thread specific */ handles[a].thread_index = a; handles[a].projImages = (ProjPaintImage *)BLI_memarena_alloc(ps->arena_mt[a], ps->image_tot * sizeof(ProjPaintImage)); diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c b/source/blender/editors/sculpt_paint/paint_vertex.c index cf90c43f3e1..87411b97061 100644 --- a/source/blender/editors/sculpt_paint/paint_vertex.c +++ b/source/blender/editors/sculpt_paint/paint_vertex.c @@ -1619,7 +1619,7 @@ static void do_weight_paint_vertex( /* vars which remain the same for every vert } } - /* important to normalize after mirror, otherwise mirror gets wight + /* important to normalize after mirror, otherwise mirror gets weight * which has already been scaled down in relation to other weights, * then scales a second time [#26193]. Tricky multi-paint code doesn't * suffer from this problem - campbell */ diff --git a/source/blender/editors/space_graph/graph_draw.c b/source/blender/editors/space_graph/graph_draw.c index dc5e71f0406..37e6c0b73c9 100644 --- a/source/blender/editors/space_graph/graph_draw.c +++ b/source/blender/editors/space_graph/graph_draw.c @@ -340,7 +340,7 @@ static void draw_fcurve_handles (SpaceIpo *sipo, FCurve *fcu) int sel, b; /* a single call to GL_LINES here around these calls should be sufficient to still - * get separate line segments, but which aren't wrapped with GL_LINE_STRIP everytime we + * get separate line segments, but which aren't wrapped with GL_LINE_STRIP every time we * want a single line */ glBegin(GL_LINES); diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c index da785430d43..45543a9313e 100644 --- a/source/blender/editors/space_sequencer/sequencer_edit.c +++ b/source/blender/editors/space_sequencer/sequencer_edit.c @@ -2977,7 +2977,7 @@ static int sequencer_change_path_exec(bContext *C, wmOperator *op) RNA_string_get(op->ptr, "directory", directory); if (is_relative_path) { - /* TODO, shouldnt this already be relative from the filesel? + /* TODO, shouldn't this already be relative from the filesel? * (as the 'filepath' is) for now just make relative here, * but look into changing after 2.60 - campbell */ BLI_path_rel(directory, bmain->name); diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index eb2e821e398..04531bf5ab2 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -765,7 +765,7 @@ void view3d_cached_text_draw_end(View3D *v3d, ARegion *ar, int depth_write, floa else glDepthMask(0); for(vos= strings->first; vos; vos= vos->next) { -#if 0 // too slow, reading opengl info while drawing is very bad, better to see if we cn use the zbuffer while in pixel space - campbell +#if 0 // too slow, reading opengl info while drawing is very bad, better to see if we can use the zbuffer while in pixel space - campbell if(v3d->zbuf && (vos->flag & V3D_CACHE_TEXT_ZBUF)) { gluProject(vos->vec[0], vos->vec[1], vos->vec[2], mats.modelview, mats.projection, (GLint *)mats.viewport, &ux, &uy, &uz); glReadPixels(ar->winrct.xmin+vos->mval[0]+vos->xoffs, ar->winrct.ymin+vos->mval[1], 1, 1, GL_DEPTH_COMPONENT, GL_FLOAT, &depth); diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c index 73acd1f9000..859c7778883 100644 --- a/source/blender/editors/transform/transform.c +++ b/source/blender/editors/transform/transform.c @@ -1922,7 +1922,7 @@ static void protectedQuaternionBits(short protectflag, float *quat, float *oldqu quat[3]= oldquat[3]; } else { - /* quaternions get limited with euler... (compatability mode) */ + /* quaternions get limited with euler... (compatibility mode) */ float eul[3], oldeul[3], nquat[4], noldquat[4]; float qlen; diff --git a/source/blender/makesdna/DNA_action_types.h b/source/blender/makesdna/DNA_action_types.h index 29e0b18b97d..db574160771 100644 --- a/source/blender/makesdna/DNA_action_types.h +++ b/source/blender/makesdna/DNA_action_types.h @@ -340,7 +340,7 @@ typedef struct bPose { void *ikdata; /* temporary IK data, depends on the IK solver. Not saved in file */ void *ikparam; /* IK solver parameters, structure depends on iksolver */ - bAnimVizSettings avs; /* settings for visualisation of bone animation */ + bAnimVizSettings avs; /* settings for visualization of bone animation */ char proxy_act_bone[32]; /* proxy active bone name*/ } bPose; @@ -653,7 +653,7 @@ typedef enum eAnimEdit_AutoSnap { * Constraint Channels in certain situations. * * Action-Channels can only belong to one group at a time, but they still live the Action's - * list of achans (to preserve backwards compatability, and also minimise the code + * list of achans (to preserve backwards compatibility, and also minimize the code * that would need to be recoded). Grouped achans are stored at the start of the list, according * to the position of the group in the list, and their position within the group. */ diff --git a/source/blender/makesdna/DNA_constraint_types.h b/source/blender/makesdna/DNA_constraint_types.h index e04bdd4ec45..00f6f2433af 100644 --- a/source/blender/makesdna/DNA_constraint_types.h +++ b/source/blender/makesdna/DNA_constraint_types.h @@ -228,7 +228,7 @@ typedef struct bMinMaxConstraint { int minmaxflag; float offset; int flag; - short sticky, stuck, pad1, pad2; /* for backward compatability */ + short sticky, stuck, pad1, pad2; /* for backward compatibility */ float cache[3]; char subtarget[32]; } bMinMaxConstraint; diff --git a/source/blender/makesdna/DNA_ipo_types.h b/source/blender/makesdna/DNA_ipo_types.h index 8fe8b3bcf70..201ea8994ca 100644 --- a/source/blender/makesdna/DNA_ipo_types.h +++ b/source/blender/makesdna/DNA_ipo_types.h @@ -30,7 +30,7 @@ * \deprecated * The contents of this file are now officially depreceated. They were used for the 'old' animation system, * which has (as of 2.50) been replaced with a completely new system by Joshua Leung (aligorith). All defines, - * etc. are only still maintained to provide backwards compatability for old files. + * etc. are only still maintained to provide backwards compatibility for old files. */ #ifndef DNA_IPO_TYPES_H diff --git a/source/blender/makesrna/intern/rna_object_force.c b/source/blender/makesrna/intern/rna_object_force.c index a6e0e9f3331..c36dca22731 100644 --- a/source/blender/makesrna/intern/rna_object_force.c +++ b/source/blender/makesrna/intern/rna_object_force.c @@ -53,7 +53,7 @@ static EnumPropertyItem effector_shape_items[] = { #ifdef RNA_RUNTIME -/* type spesific return values only used from functions */ +/* type specific return values only used from functions */ static EnumPropertyItem curve_shape_items[] = { {PFIELD_SHAPE_POINT, "POINT", 0, "Point", ""}, {PFIELD_SHAPE_PLANE, "PLANE", 0, "Plane", ""}, diff --git a/source/blender/python/intern/bpy_library.c b/source/blender/python/intern/bpy_library.c index 603bb0ed0ac..3b0c6a9ff25 100644 --- a/source/blender/python/intern/bpy_library.c +++ b/source/blender/python/intern/bpy_library.c @@ -58,7 +58,7 @@ typedef struct { PyObject_HEAD /* required python macro */ - /* collection iterator spesific parts */ + /* collection iterator specific parts */ char relpath[FILE_MAX]; char abspath[FILE_MAX]; /* absolute path */ BlendHandle *blo_handle; -- cgit v1.2.3 From 1c8a91d4df9593f3a24efbf945afabb0efa80ccc Mon Sep 17 00:00:00 2001 From: Jens Verwiebe Date: Sat, 15 Oct 2011 14:21:03 +0000 Subject: OSX: add editable applescript to not have the script a blackbox --- source/darwin/blender.app/Contents/Info.plist | 48 ++++++++++----------- .../Contents/Resources/Scripts/main.scpt | Bin 4542 -> 4696 bytes .../darwin/set_simulation_threads_applescript.scpt | Bin 0 -> 5140 bytes 3 files changed, 24 insertions(+), 24 deletions(-) create mode 100644 source/darwin/set_simulation_threads_applescript.scpt diff --git a/source/darwin/blender.app/Contents/Info.plist b/source/darwin/blender.app/Contents/Info.plist index a25c629ce68..7fab4a98c4b 100644 --- a/source/darwin/blender.app/Contents/Info.plist +++ b/source/darwin/blender.app/Contents/Info.plist @@ -2,29 +2,13 @@ - CFBundleInfoDictionaryVersion - 6.0 - CFBundleExecutable - blender - CFBundlePackageType - APPL - CFBundleSignature - ???? - CFBundleIconFile - blender icon.icns - CFBundleName - Blender - CFBundleIdentifier - org.blenderfoundation.blender - CFBundleVersion - ${MACOSX_BUNDLE_LONG_VERSION_STRING}, Blender Foundation - CFBundleShortVersionString - ${MACOSX_BUNDLE_SHORT_VERSION_STRING} - CFBundleGetInfoString - ${MACOSX_BUNDLE_LONG_VERSION_STRING}, Blender Foundation CFBundleDocumentTypes + CFBundleTypeExtensions + + blend + CFBundleTypeIconFile blender file icon.icns CFBundleTypeName @@ -33,16 +17,32 @@ BLND - CFBundleTypeExtensions - - blend - CFBundleTypeRole Editor LSIsAppleDefaultForType + CFBundleExecutable + blender + CFBundleGetInfoString + ${MACOSX_BUNDLE_LONG_VERSION_STRING}, Blender Foundation + CFBundleIconFile + blender icon.icns + CFBundleIdentifier + org.blenderfoundation.blender + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + Blender + CFBundlePackageType + APPL + CFBundleShortVersionString + ${MACOSX_BUNDLE_SHORT_VERSION_STRING} + CFBundleSignature + ???? + CFBundleVersion + ${MACOSX_BUNDLE_LONG_VERSION_STRING}, Blender Foundation LSEnvironment OMP_NUM_THREADS diff --git a/source/darwin/set_simulation_threads.app/Contents/Resources/Scripts/main.scpt b/source/darwin/set_simulation_threads.app/Contents/Resources/Scripts/main.scpt index 44a107abf78..7a0e345348c 100644 Binary files a/source/darwin/set_simulation_threads.app/Contents/Resources/Scripts/main.scpt and b/source/darwin/set_simulation_threads.app/Contents/Resources/Scripts/main.scpt differ diff --git a/source/darwin/set_simulation_threads_applescript.scpt b/source/darwin/set_simulation_threads_applescript.scpt new file mode 100644 index 00000000000..ba05af64178 Binary files /dev/null and b/source/darwin/set_simulation_threads_applescript.scpt differ -- cgit v1.2.3 From 2bba8ad861145ac53e61eba9b09c9d9eb6b39bad Mon Sep 17 00:00:00 2001 From: Dalai Felinto Date: Sat, 15 Oct 2011 23:50:05 +0000 Subject: Set the correct char for Persian name (using \ufbfd instead of the arabic yeh one) --- source/blender/makesrna/intern/rna_userdef.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c index 28525042eda..e2f0f4dab1f 100644 --- a/source/blender/makesrna/intern/rna_userdef.c +++ b/source/blender/makesrna/intern/rna_userdef.c @@ -2541,7 +2541,7 @@ static void rna_def_userdef_system(BlenderRNA *brna) {24, "KOREAN", 0, N_("Korean (한국 언어)"), "ko_KR"}, /*{25, "NEPALI", 0, N_("Nepali (नेपाली)"), "ne_NP"},*/ /* using the utf8 flipped form of Persian (فارسی) */ - {26, "PERSIAN", 0, N_("Persian (ﺱﺭﺎﻓ)"), "fa_PE"}, + {26, "PERSIAN", 0, N_("Persian (ﯽﺳﺭﺎﻓ)"), "fa_PE"}, {0, NULL, 0, NULL, NULL}}; srna= RNA_def_struct(brna, "UserPreferencesSystem", NULL); -- cgit v1.2.3 From 3fd8a914b84ff6e1e0c9e313d0a48cd3438e0b08 Mon Sep 17 00:00:00 2001 From: Daniel Salazar Date: Sun, 16 Oct 2011 09:51:23 +0000 Subject: ID Mask node was limmited at 10000 while OB and Mat IDs reach 32767. Set this limit and it's working fine here in my comps --- source/blender/makesrna/intern/rna_nodetree.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c index 813375a3549..061a21056d0 100644 --- a/source/blender/makesrna/intern/rna_nodetree.c +++ b/source/blender/makesrna/intern/rna_nodetree.c @@ -1871,7 +1871,7 @@ static void def_cmp_id_mask(StructRNA *srna) prop = RNA_def_property(srna, "index", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "custom1"); - RNA_def_property_range(prop, 0, 10000); + RNA_def_property_range(prop, 0, 32767); RNA_def_property_ui_text(prop, "Index", "Pass index number to convert to alpha"); RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); -- cgit v1.2.3 From 92bc72dca19ae50a8e1a36734a7280e10f8e352e Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 16 Oct 2011 11:09:15 +0000 Subject: convenience targets for make doc_py, doc_dna, doc_man --- GNUmakefile | 9 +++++++++ doc/manpage/blender.1.py | 12 +++++++++--- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/GNUmakefile b/GNUmakefile index 52f36b218d8..17a9e87be22 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -147,6 +147,8 @@ help: @echo "" @echo "Documentation Targets" @echo " * doc_py - generate sphinx python api docs" + @echo " * doc_dna - generate blender file format reference" + @echo " * doc_man - generate manpage" @echo "" # ----------------------------------------------------------------------------- @@ -235,6 +237,13 @@ doc_py: cd doc/python_api ; sphinx-build -n -b html sphinx-in sphinx-out @echo "docs written into: '$(BLENDER_DIR)/doc/python_api/sphinx-out/contents.html'" +doc_dna: + $(BUILD_DIR)/bin/blender --background --factory-startup --python doc/blender_file_format/BlendFileDnaExporter_25.py + @echo "docs written into: '$(BLENDER_DIR)/doc/blender_file_format/dna.html'" + +doc_man: + python3 doc/manpage/blender.1.py $(BUILD_DIR)/bin/blender + clean: $(MAKE) -C $(BUILD_DIR) clean diff --git a/doc/manpage/blender.1.py b/doc/manpage/blender.1.py index 40234300994..21df42a4082 100644 --- a/doc/manpage/blender.1.py +++ b/doc/manpage/blender.1.py @@ -22,6 +22,7 @@ import subprocess import os +import sys import time import datetime @@ -43,10 +44,15 @@ def man_format(data): return data +# allow passing blender as argument +if sys.argv[-1].endswith(os.sep + "blender"): + blender_bin = sys.argv[-1] +else: + blender_bin = os.path.join(os.path.dirname(__file__), "../../blender.bin") -blender_bin = os.path.join(os.path.dirname(__file__), "../../blender.bin") - -blender_help = subprocess.Popen([blender_bin, "--help"], stdout=subprocess.PIPE).communicate()[0].decode() +cmd = [blender_bin, "--help"] +print(" executing:", " ".join(cmd)) +blender_help = subprocess.Popen(cmd, stdout=subprocess.PIPE).communicate()[0].decode() blender_version = subprocess.Popen([blender_bin, "--version"], stdout=subprocess.PIPE).communicate()[0].decode().strip() blender_version = blender_version.split("Build")[0] -- cgit v1.2.3 From b6d0daa9cb261b3ce2ba3053ebee86f79caa5f06 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 16 Oct 2011 12:25:42 +0000 Subject: utf8 editing for UI text input, this means backspace, delete, arrow keys properly move the cursor with multi-byte chars. Note that this is only for the interface, text editor and python console still miss this feature. --- source/blender/blenlib/BLI_string.h | 4 + source/blender/blenlib/intern/string_utf8.c | 80 ++++++++++ .../blender/editors/interface/interface_handlers.c | 175 ++++++++++++--------- 3 files changed, 185 insertions(+), 74 deletions(-) diff --git a/source/blender/blenlib/BLI_string.h b/source/blender/blenlib/BLI_string.h index c53ce9dced5..3ac8dba106a 100644 --- a/source/blender/blenlib/BLI_string.h +++ b/source/blender/blenlib/BLI_string.h @@ -147,6 +147,10 @@ void BLI_ascii_strtoupper(char *str, int len); char *BLI_strncpy_utf8(char *dst, const char *src, size_t maxncpy); int BLI_utf8_invalid_byte(const char *str, int length); int BLI_utf8_invalid_strip(char *str, int length); + /* copied from glib */ +char *BLI_str_find_prev_char_utf8(const char *str, const char *p); +char *BLI_str_find_next_char_utf8(const char *p, const char *end); +char *BLI_str_prev_char_utf8(const char *p); #ifdef __cplusplus } diff --git a/source/blender/blenlib/intern/string_utf8.c b/source/blender/blenlib/intern/string_utf8.c index 961a41690f7..dc6cb0ef228 100644 --- a/source/blender/blenlib/intern/string_utf8.c +++ b/source/blender/blenlib/intern/string_utf8.c @@ -183,3 +183,83 @@ char *BLI_strncpy_utf8(char *dst, const char *src, size_t maxncpy) return dst_r; } +/* copied from glib */ +/** + * g_utf8_find_prev_char: + * @str: pointer to the beginning of a UTF-8 encoded string + * @p: pointer to some position within @str + * + * Given a position @p with a UTF-8 encoded string @str, find the start + * of the previous UTF-8 character starting before @p. Returns %NULL if no + * UTF-8 characters are present in @str before @p. + * + * @p does not have to be at the beginning of a UTF-8 character. No check + * is made to see if the character found is actually valid other than + * it starts with an appropriate byte. + * + * Return value: a pointer to the found character or %NULL. + **/ +char * BLI_str_find_prev_char_utf8(const char *str, const char *p) +{ + for (--p; p >= str; --p) { + if ((*p & 0xc0) != 0x80) { + return (char *)p; + } + } + return NULL; +} + +/** + * g_utf8_find_next_char: + * @p: a pointer to a position within a UTF-8 encoded string + * @end: a pointer to the byte following the end of the string, + * or %NULL to indicate that the string is nul-terminated. + * + * Finds the start of the next UTF-8 character in the string after @p. + * + * @p does not have to be at the beginning of a UTF-8 character. No check + * is made to see if the character found is actually valid other than + * it starts with an appropriate byte. + * + * Return value: a pointer to the found character or %NULL + **/ +char *BLI_str_find_next_char_utf8(const char *p, const char *end) +{ + if (*p) { + if (end) { + for (++p; p < end && (*p & 0xc0) == 0x80; ++p) { + /* do nothing */ + } + } + else { + for (++p; (*p & 0xc0) == 0x80; ++p) { + /* do nothing */ + } + } + } + return (p == end) ? NULL : (char *)p; +} + +/** + * g_utf8_prev_char: + * @p: a pointer to a position within a UTF-8 encoded string + * + * Finds the previous UTF-8 character in the string before @p. + * + * @p does not have to be at the beginning of a UTF-8 character. No check + * is made to see if the character found is actually valid other than + * it starts with an appropriate byte. If @p might be the first + * character of the string, you must use g_utf8_find_prev_char() instead. + * + * Return value: a pointer to the found character. + **/ +char *BLI_str_prev_char_utf8(const char *p) +{ + while (1) { + p--; + if ((*p & 0xc0) != 0x80) { + return (char *)p; + } + } +} +/* end glib copy */ diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index 6699e8f8701..f4400d2d7db 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -1252,6 +1252,86 @@ static short test_special_char(char ch) return 0; } +static int ui_textedit_step_next_utf8(const char *str, size_t maxlen, short *pos) +{ + const char *str_end= str + (maxlen + 1); + const char *str_pos= str + (*pos); + const char *str_next= BLI_str_find_next_char_utf8(str_pos, str_end); + if (str_next) { + (*pos) += (str_next - str_pos); + if((*pos) > maxlen) (*pos)= maxlen; + return TRUE; + } + + return FALSE; +} + +static int ui_textedit_step_prev_utf8(const char *str, size_t UNUSED(maxlen), short *pos) +{ + if((*pos) > 0) { + const char *str_pos= str + (*pos); + const char *str_prev= BLI_str_find_prev_char_utf8(str, str_pos); + if (str_prev) { + (*pos) -= (str_pos - str_prev); + return TRUE; + } + } + + return FALSE; +} + +static void ui_textedit_step_utf8(const char *str, size_t maxlen, + short *pos, const char direction, + const short do_jump, const short do_all) +{ + const short pos_prev= *pos; + + if(direction) { /* right*/ + if(do_jump) { + /* jump between special characters (/,\,_,-, etc.), + * look at function test_special_char() for complete + * list of special character, ctr -> */ + while((*pos) < maxlen) { + if (ui_textedit_step_next_utf8(str, maxlen, pos)) { + if(!do_all && test_special_char(str[(*pos)])) break; + } + else { + break; /* unlikely but just incase */ + } + } + } + else { + ui_textedit_step_next_utf8(str, maxlen, pos); + } + } + else { /* left */ + if(do_jump) { + /* left only: compensate for index/change in direction */ + ui_textedit_step_prev_utf8(str, maxlen, pos); + + /* jump between special characters (/,\,_,-, etc.), + * look at function test_special_char() for complete + * list of special character, ctr -> */ + while ((*pos) > 0) { + if (ui_textedit_step_prev_utf8(str, maxlen, pos)) { + if(!do_all && test_special_char(str[(*pos)])) break; + } + else { + break; + } + } + + /* left only: compensate for index/change in direction */ + if(((*pos) != 0) && ABS(pos_prev - (*pos)) > 1) { + ui_textedit_step_next_utf8(str, maxlen, pos); + } + } + else { + ui_textedit_step_prev_utf8(str, maxlen, pos); + } + } +} + static int ui_textedit_delete_selection(uiBut *but, uiHandleButtonData *data) { char *str= data->str; @@ -1294,13 +1374,17 @@ static void ui_textedit_set_cursor_pos(uiBut *but, uiHandleButtonData *data, sho /* mouse dragged outside the widget to the left */ if (x < startx && but->ofs > 0) { - int i= but->ofs; + short i= but->ofs; origstr[but->ofs] = 0; while (i > 0) { - i--; - if (BLF_width(fstyle->uifont_id, origstr+i) > (startx - x)*0.25f) break; // 0.25 == scale factor for less sensitivity + if (ui_textedit_step_prev_utf8(origstr, but->ofs, &i)) { + if (BLF_width(fstyle->uifont_id, origstr+i) > (startx - x)*0.25f) break; // 0.25 == scale factor for less sensitivity + } + else { + break; /* unlikely but possible */ + } } but->ofs = i; but->pos = but->ofs; @@ -1314,9 +1398,13 @@ static void ui_textedit_set_cursor_pos(uiBut *but, uiHandleButtonData *data, sho /* XXX does not take zoom level into account */ while (startx + aspect_sqrt * BLF_width(fstyle->uifont_id, origstr+but->ofs) > x) { if (but->pos <= 0) break; - but->pos--; - origstr[but->pos+but->ofs] = 0; - } + if (ui_textedit_step_prev_utf8(origstr, but->ofs, &but->pos)) { + origstr[but->pos+but->ofs] = 0; + } + else { + break; /* unlikely but possible */ + } + } but->pos += but->ofs; if(but->pos<0) but->pos= 0; } @@ -1391,48 +1479,7 @@ static void ui_textedit_move(uiBut *but, uiHandleButtonData *data, int direction data->selextend = 0; } else { - if(direction) { /* right*/ - if(jump) { - /* jump between special characters (/,\,_,-, etc.), - * look at function test_special_char() for complete - * list of special character, ctr -> */ - while(but->pos < len) { - but->pos++; - if(!jump_all && test_special_char(str[but->pos])) break; - } - } - else { - but->pos++; - if(but->pos > len) but->pos= len; - } - } - else { /* left */ - if(jump) { - - /* left only: compensate for index/change in direction */ - if(but->pos > 0) { - but->pos--; - } - - /* jump between special characters (/,\,_,-, etc.), - * look at function test_special_char() for complete - * list of special character, ctr -> */ - while(but->pos > 0){ - but->pos--; - if(!jump_all && test_special_char(str[but->pos])) break; - } - - /* left only: compensate for index/change in direction */ - if((but->pos != 0) && ABS(pos_prev - but->pos) > 1) { - but->pos++; - } - - } - else { - if(but->pos>0) but->pos--; - } - } - + ui_textedit_step_utf8(str, len, &but->pos, direction, jump, jump_all); if(select) { /* existing selection */ @@ -1498,21 +1545,10 @@ static int ui_textedit_delete(uiBut *but, uiHandleButtonData *data, int directio changed= ui_textedit_delete_selection(but, data); } else if(but->pos>=0 && but->pospos; int step; - - if (jump) { - x = but->pos; - step= 0; - while(x < len) { - x++; - step++; - if(test_special_char(str[x])) break; - } - } - else { - step= 1; - } - + ui_textedit_step_utf8(str, len, &pos, direction, jump, all); + step= pos - but->pos; for(x=but->pos; xpos>0) { + short pos= but->pos; int step; - if (jump) { - x = but->pos; - step= 0; - while(x > 0) { - x--; - step++; - if((step > 1) && test_special_char(str[x])) break; - } - } - else { - step= 1; - } + ui_textedit_step_utf8(str, len, &pos, direction, jump, all); + step= but->pos - pos; for(x=but->pos; x Date: Sun, 16 Oct 2011 13:10:14 +0000 Subject: allow passing BUILD_DIR to convenience makefile as an argument incase you dont want to build in the default path. --- GNUmakefile | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/GNUmakefile b/GNUmakefile index 17a9e87be22..af953143b82 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -34,10 +34,13 @@ OS_NCASE:=$(shell uname -s | tr '[A-Z]' '[a-z]') # Source and Build DIR's BLENDER_DIR:=$(shell pwd -P) -BUILD_DIR:=$(shell dirname $(BLENDER_DIR))/build/$(OS_NCASE) BUILD_TYPE:=Release BUILD_CMAKE_ARGS:= +ifndef BUILD_DIR + BUILD_DIR:=$(shell dirname $(BLENDER_DIR))/build/$(OS_NCASE) +endif + # ----------------------------------------------------------------------------- # additional targets for the build configuration @@ -120,6 +123,9 @@ help: @echo " * headless - build without an interface (renderfarm or server automation)" @echo " * bpy - build as a python module which can be loaded from python directly" @echo "" + @echo " Note, passing the argument 'BUILD_DIR=path' when calling make will override the default build dir." + @echo "" + @echo "" @echo "Project Files for IDE's" @echo " * project_qtcreator - QtCreator Project Files" @echo " * project_netbeans - NetBeans Project Files" @@ -130,9 +136,8 @@ help: @echo " * package_pacman - build an arch linux pacmanpackage" @echo " * package_archive - build an archive package" @echo "" - @echo "Other Targets" + @echo "Other Targets (not assosiated with building blender)" @echo " * translations - update blenders translation files in po/" - # TODO, doxygen and sphinx docs @echo "" @echo "Testing Targets (not assosiated with building blender)" @echo " * test - run ctest, currently tests import/export, operator execution and that python modules load" @@ -145,7 +150,7 @@ help: @echo " * check_splint - run blenders source through splint (C only)" @echo " * check_sparse - run blenders source through sparse (C only)" @echo "" - @echo "Documentation Targets" + @echo "Documentation Targets (not assosiated with building blender)" @echo " * doc_py - generate sphinx python api docs" @echo " * doc_dna - generate blender file format reference" @echo " * doc_man - generate manpage" -- cgit v1.2.3 From 6d5891e7eaa490794461ab02538dfb5f7037faef Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 16 Oct 2011 15:01:13 +0000 Subject: fix bad URL in bgl doc --- doc/python_api/rst/bgl.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/python_api/rst/bgl.rst b/doc/python_api/rst/bgl.rst index 61400351d16..8fe765836a1 100644 --- a/doc/python_api/rst/bgl.rst +++ b/doc/python_api/rst/bgl.rst @@ -20,7 +20,7 @@ OpenGL}" and the online NeHe tutorials are two of the best resources. See :class:`Image.gl_load` and :class:`Image.gl_load`, for example. `OpenGL.org `_ - `NeHe GameDev `_ + `NeHe GameDev `_ .. function:: glAccum(op, value): -- cgit v1.2.3 From 8fae0c6d7e0d24bfa6c12e2121c5fa7a62440141 Mon Sep 17 00:00:00 2001 From: Janne Karhu Date: Sun, 16 Oct 2011 16:14:36 +0000 Subject: Particle dupliobject rotation changes: There has been quite a bit of fuss about particle dupliobject rotation in 2.59, so here are some changes to make things work a bit more consistently and predictably in 2.60. Much of the confusion has been about what the "Initial rotation" for particles actually means. Simply put it's just a vector that that the particles (and the dupliobjects) are aligned to and around which they can be rotated with the phase controls. I've now renamed these controls under a label "Rotation axis". In 2.59 and previous versions the dupliobject's global x-axis was aligned to the particle rotation axis for non-hair particles. This meant that the object's own rotation (in addition to the particle rotation) could effect the dupliobjects' rotations. This old behavior can still be used with the "Rotation" option in the particle render panel when object/group is set as the visualization. This option is also activated automatically for old files to maintain backwards compatibility. Now the default dupliobject rotations ignore the object's own rotation completely and align the object's tracking axis to the particle rotation axis. The tracking axis can be found under the Object tab -> Animation Hacks panel. In 2.58 the way of calculating the rotation for hair didn't work as intended and enabled many non-functional combinations of options. For this reason I removed most of the rotation options for hair in 2.59. Now the options have been reimplemented better and the dupliobject's tracking axis is aligned to the hair direction by default (Rotation axis = Velocity / Hair). All the other axis options work too along with the phase controls. --- .../scripts/startup/bl_ui/properties_particle.py | 34 +++++++---- source/blender/blenkernel/intern/anim.c | 12 +++- source/blender/blenkernel/intern/particle.c | 65 ++++++++++++++-------- source/blender/blenloader/intern/readfile.c | 14 +++++ source/blender/makesdna/DNA_particle_types.h | 3 +- source/blender/makesrna/intern/rna_particle.c | 11 +++- 6 files changed, 99 insertions(+), 40 deletions(-) diff --git a/release/scripts/startup/bl_ui/properties_particle.py b/release/scripts/startup/bl_ui/properties_particle.py index eceefc70b5c..d24aef56a8b 100644 --- a/release/scripts/startup/bl_ui/properties_particle.py +++ b/release/scripts/startup/bl_ui/properties_particle.py @@ -404,10 +404,13 @@ class PARTICLE_PT_rotation(ParticleButtonsPanel, Panel): part = context.space_data.pin_id layout.enabled = particle_panel_enabled(context, psys) + + layout.prop(part, "use_dynamic_rotation") - row = layout.row() - row.label(text="Initial Rotation:") - row.prop(part, "use_dynamic_rotation") + if part.use_dynamic_rotation: + layout.label(text="Initial Rotation Axis:") + else: + layout.label(text="Rotation Axis:") split = layout.split() @@ -419,12 +422,18 @@ class PARTICLE_PT_rotation(ParticleButtonsPanel, Panel): col.prop(part, "phase_factor", slider=True) col.prop(part, "phase_factor_random", text="Random", slider=True) - col = layout.column() - col.label(text="Angular Velocity:") - col.row().prop(part, "angular_velocity_mode", expand=True) - - if part.angular_velocity_mode != 'NONE': - col.prop(part, "angular_velocity_factor", text="") + if part.type != 'HAIR': + col = layout.column() + if part.use_dynamic_rotation: + col.label(text="Initial Angular Velocity:") + else: + col.label(text="Angular Velocity:") + sub = col.row(align=True) + sub.prop(part, "angular_velocity_mode", text="") + subsub = sub.column() + subsub.active = part.angular_velocity_mode != 'NONE' + subsub.prop(part, "angular_velocity_factor", text="") + class PARTICLE_PT_physics(ParticleButtonsPanel, Panel): @@ -832,7 +841,9 @@ class PARTICLE_PT_render(ParticleButtonsPanel, Panel): elif part.render_type == 'OBJECT': col.prop(part, "dupli_object") - col.prop(part, "use_global_dupli") + sub = col.row() + sub.prop(part, "use_global_dupli") + sub.prop(part, "use_rotation_dupli") elif part.render_type == 'GROUP': col.prop(part, "dupli_group") split = layout.split() @@ -841,13 +852,14 @@ class PARTICLE_PT_render(ParticleButtonsPanel, Panel): col.prop(part, "use_whole_group") sub = col.column() sub.active = (part.use_whole_group is False) + sub.prop(part, "use_group_pick_random") sub.prop(part, "use_group_count") col = split.column() sub = col.column() sub.active = (part.use_whole_group is False) sub.prop(part, "use_global_dupli") - sub.prop(part, "use_group_pick_random") + sub.prop(part, "use_rotation_dupli") if part.use_group_count and not part.use_whole_group: row = layout.row() diff --git a/source/blender/blenkernel/intern/anim.c b/source/blender/blenkernel/intern/anim.c index cd2c272a1c2..da6dd5bd39d 100644 --- a/source/blender/blenkernel/intern/anim.c +++ b/source/blender/blenkernel/intern/anim.c @@ -1430,6 +1430,16 @@ static void new_particle_duplilist(ListBase *lb, ID *id, Scene *scene, Object *p VECCOPY(vec, obmat[3]); obmat[3][0] = obmat[3][1] = obmat[3][2] = 0.0f; + + /* particle rotation uses x-axis as the aligned axis, so pre-rotate the object accordingly */ + if((part->draw & PART_DRAW_ROTATE_OB) == 0) { + float xvec[3], q[4]; + xvec[0] = -1.f; + xvec[1] = xvec[2] = 0; + vec_to_quat(q, xvec, ob->trackflag, ob->upflag); + quat_to_mat4(obmat, q); + obmat[3][3]= 1.0f; + } /* Normal particles and cached hair live in global space so we need to * remove the real emitter's transformation before 2nd order duplication. @@ -1448,7 +1458,7 @@ static void new_particle_duplilist(ListBase *lb, ID *id, Scene *scene, Object *p copy_m4_m4(mat, tmat); if(part->draw & PART_DRAW_GLOBAL_OB) - VECADD(mat[3], mat[3], vec); + add_v3_v3v3(mat[3], mat[3], vec); dob= new_dupli_object(lb, ob, mat, ob->lay, counter, GS(id->name) == ID_GR ? OB_DUPLIGROUP : OB_DUPLIPARTS, animated); copy_m4_m4(dob->omat, oldobmat); diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c index 806a7871948..8669c4e0efd 100644 --- a/source/blender/blenkernel/intern/particle.c +++ b/source/blender/blenkernel/intern/particle.c @@ -4384,33 +4384,50 @@ void psys_get_dupli_path_transform(ParticleSimulationData *sim, ParticleData *pa psys_particle_on_emitter(psmd,sim->psys->part->from,pa->num,pa->num_dmcache,pa->fuv,pa->foffset,loc,nor,0,0,0,0); else psys_particle_on_emitter(psmd,PART_FROM_FACE,cpa->num,DMCACHE_ISCHILD,cpa->fuv,cpa->foffset,loc,nor,0,0,0,0); - - copy_m3_m4(nmat, ob->imat); - transpose_m3(nmat); - mul_m3_v3(nmat, nor); - normalize_v3(nor); - - /* make sure that we get a proper side vector */ - if(fabs(dot_v3v3(nor,vec))>0.999999) { - if(fabs(dot_v3v3(nor,xvec))>0.999999) { - nor[0] = 0.0f; - nor[1] = 1.0f; - nor[2] = 0.0f; + + if(psys->part->rotmode == PART_ROT_VEL) { + copy_m3_m4(nmat, ob->imat); + transpose_m3(nmat); + mul_m3_v3(nmat, nor); + normalize_v3(nor); + + /* make sure that we get a proper side vector */ + if(fabs(dot_v3v3(nor,vec))>0.999999) { + if(fabs(dot_v3v3(nor,xvec))>0.999999) { + nor[0] = 0.0f; + nor[1] = 1.0f; + nor[2] = 0.0f; + } + else { + nor[0] = 1.0f; + nor[1] = 0.0f; + nor[2] = 0.0f; + } } - else { - nor[0] = 1.0f; - nor[1] = 0.0f; - nor[2] = 0.0f; + cross_v3_v3v3(side, nor, vec); + normalize_v3(side); + + /* rotate side vector around vec */ + if(psys->part->phasefac != 0) { + float q_phase[4]; + float phasefac = psys->part->phasefac; + if(psys->part->randphasefac != 0.0f) + phasefac += psys->part->randphasefac * PSYS_FRAND((pa-psys->particles) + 20); + axis_angle_to_quat( q_phase, vec, phasefac*(float)M_PI); + + mul_qt_v3(q_phase, side); } - } - cross_v3_v3v3(side, nor, vec); - normalize_v3(side); - cross_v3_v3v3(nor, vec, side); - unit_m4(mat); - VECCOPY(mat[0], vec); - VECCOPY(mat[1], side); - VECCOPY(mat[2], nor); + cross_v3_v3v3(nor, vec, side); + + unit_m4(mat); + VECCOPY(mat[0], vec); + VECCOPY(mat[1], side); + VECCOPY(mat[2], nor); + } + else { + quat_to_mat4(mat, pa->state.rot); + } *scale= len; } diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 76070e42f29..84b9021d080 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -12176,6 +12176,20 @@ static void do_versions(FileData *fd, Library *lib, Main *main) for (ntree=main->nodetree.first; ntree; ntree=ntree->id.next) do_versions_nodetree_image_default_alpha_output(ntree); } + + { + /* support old particle dupliobject rotation settings */ + ParticleSettings *part; + + for (part=main->particle.first; part; part=part->id.next) { + if(ELEM(part->ren_as, PART_DRAW_OB, PART_DRAW_GR)) { + part->draw |= PART_DRAW_ROTATE_OB; + + if(part->rotmode == 0) + part->rotmode = PART_ROT_VEL; + } + } + } } /* WATCH IT!!!: pointers from libdata have not been converted yet here! */ diff --git a/source/blender/makesdna/DNA_particle_types.h b/source/blender/makesdna/DNA_particle_types.h index 9fec5207dbb..da2fce4da82 100644 --- a/source/blender/makesdna/DNA_particle_types.h +++ b/source/blender/makesdna/DNA_particle_types.h @@ -386,7 +386,8 @@ typedef struct ParticleSystem{ /* note, make sure all (runtime) are NULL's in #define PART_DRAW_HEALTH 16 #define PART_ABS_PATH_TIME 32 #define PART_DRAW_COUNT_GR 64 -#define PART_DRAW_BB_LOCK 128 +#define PART_DRAW_BB_LOCK 128 /* used with billboards */ +#define PART_DRAW_ROTATE_OB 128 /* used with dupliobjects/groups */ #define PART_DRAW_PARENT 256 #define PART_DRAW_NUM 512 #define PART_DRAW_RAND_GR 1024 diff --git a/source/blender/makesrna/intern/rna_particle.c b/source/blender/makesrna/intern/rna_particle.c index 49005e56367..43d5f87f0d5 100644 --- a/source/blender/makesrna/intern/rna_particle.c +++ b/source/blender/makesrna/intern/rna_particle.c @@ -1478,7 +1478,7 @@ static void rna_def_particle_settings(BlenderRNA *brna) static EnumPropertyItem rot_mode_items[] = { {0, "NONE", 0, "None", ""}, {PART_ROT_NOR, "NOR", 0, "Normal", ""}, - {PART_ROT_VEL, "VEL", 0, "Velocity", ""}, + {PART_ROT_VEL, "VEL", 0, "Velocity / Hair", ""}, {PART_ROT_GLOB_X, "GLOB_X", 0, "Global X", ""}, {PART_ROT_GLOB_Y, "GLOB_Y", 0, "Global Y", ""}, {PART_ROT_GLOB_Z, "GLOB_Z", 0, "Global Z", ""}, @@ -1733,7 +1733,7 @@ static void rna_def_particle_settings(BlenderRNA *brna) RNA_def_property_enum_sdna(prop, NULL, "rotmode"); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_enum_items(prop, rot_mode_items); - RNA_def_property_ui_text(prop, "Rotation", "Particles initial rotation"); + RNA_def_property_ui_text(prop, "Rotation", "Particle rotation axis"); RNA_def_property_update(prop, 0, "rna_Particle_reset"); prop= RNA_def_property(srna, "angular_velocity_mode", PROP_ENUM, PROP_NONE); @@ -1798,7 +1798,12 @@ static void rna_def_particle_settings(BlenderRNA *brna) prop= RNA_def_property(srna, "use_global_dupli", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_GLOBAL_OB); - RNA_def_property_ui_text(prop, "Use Global", "Use object's global coordinates for duplication"); + RNA_def_property_ui_text(prop, "Global", "Use object's global coordinates for duplication"); + RNA_def_property_update(prop, 0, "rna_Particle_redo"); + + prop= RNA_def_property(srna, "use_rotation_dupli", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_ROTATE_OB); + RNA_def_property_ui_text(prop, "Rotation", "Use object's rotation for duplication (global x-axis is aligned particle rotation axis)"); RNA_def_property_update(prop, 0, "rna_Particle_redo"); prop= RNA_def_property(srna, "use_render_adaptive", PROP_BOOLEAN, PROP_NONE); -- cgit v1.2.3 From 67c15da97de7644fc4deb3ab1b03c3db22f1f647 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 17 Oct 2011 02:20:53 +0000 Subject: docs / clenup (no functional code changes) - added API examples for mathutils.Color/Euler/Quaternion/Matrix. - corrected own bad spelling matricies --> matrices. - minor pep8 edits. - update CMake ignore file list. --- .../cmake/cmake_consistency_check_config.py | 8 ++++++ doc/python_api/examples/mathutils.Color.py | 30 +++++++++++++++++++++ doc/python_api/examples/mathutils.Euler.py | 31 +++++++++++++++++++++- doc/python_api/examples/mathutils.Matrix.py | 27 ++++++++++++++++++- doc/python_api/examples/mathutils.Quaternion.py | 22 ++++++++++++++- doc/python_api/rst/bge.logic.rst | 2 +- .../scripts/startup/bl_ui/properties_particle.py | 3 +-- source/blender/blenkernel/BKE_paint.h | 2 +- source/blender/blenkernel/intern/constraint.c | 2 +- source/blender/editors/util/crazyspace.c | 2 +- source/blender/python/mathutils/mathutils_Matrix.c | 6 ++--- 11 files changed, 123 insertions(+), 12 deletions(-) create mode 100644 doc/python_api/examples/mathutils.Color.py diff --git a/build_files/cmake/cmake_consistency_check_config.py b/build_files/cmake/cmake_consistency_check_config.py index 60a46d3a1dd..86f51273ff5 100644 --- a/build_files/cmake/cmake_consistency_check_config.py +++ b/build_files/cmake/cmake_consistency_check_config.py @@ -27,6 +27,10 @@ IGNORE = ( "extern/eltopo/common/openglutils.cpp", "extern/eltopo/eltopo3d/broadphase_blenderbvh.cpp", "source/blender/imbuf/intern/imbuf_cocoa.m", + "extern/recastnavigation/Recast/Source/RecastLog.cpp", + "extern/recastnavigation/Recast/Source/RecastTimer.cpp", + "entern/audaspace/SRC/AUD_SRCResampleFactory.cpp", + "entern/audaspace/SRC/AUD_SRCResampleReader.cpp", "extern/bullet2/src/BulletCollision/CollisionDispatch/btBox2dBox2dCollisionAlgorithm.h", "extern/bullet2/src/BulletCollision/CollisionDispatch/btConvex2dConvex2dAlgorithm.h", @@ -41,6 +45,10 @@ IGNORE = ( "extern/eltopo/common/meshes/TriangleIndex.hpp", "extern/eltopo/common/meshes/meshloader.h", "extern/eltopo/eltopo3d/broadphase_blenderbvh.h" + "extern/recastnavigation/Recast/Include/RecastLog.h", + "extern/recastnavigation/Recast/Include/RecastTimer.h", + "intern/audaspace/SRC/AUD_SRCResampleFactory.h", + "intern/audaspace/SRC/AUD_SRCResampleReader.h", ) UTF8_CHECK = True diff --git a/doc/python_api/examples/mathutils.Color.py b/doc/python_api/examples/mathutils.Color.py new file mode 100644 index 00000000000..a55f1195bf6 --- /dev/null +++ b/doc/python_api/examples/mathutils.Color.py @@ -0,0 +1,30 @@ +import mathutils + +# color values are represented as RGB values from 0 - 1, this is blue +col = mathutils.Color((0.0, 0.0, 1.0)) + +# as well as r/g/b attribute access you can adjust them by h/s/v +col.s *= 0.5 + +# you can access its components by attribute or index +print("Color R:", col.r) +print("Color G:", col[1]) +print("Color B:", col[-1]) +print("Color HSV: %.2f, %.2f, %.2f", col[:]) + + +# components of an existing color can be set +col[:] = 0.0, 0.5, 1.0 + +# components of an existing color can use slice notation to get a tuple +print("Values: %f, %f, %f" % col[:]) + +# colors can be added and subtracted +col += mathutils.Color((0.25, 0.0, 0.0)) + +# Color can be multiplied, in this example color is scaled to 0-255 +# can printed as integers +print("Color: %d, %d, %d" % (col * 255.0)[:]) + +# This example prints the color as hexidecimal +print("Hexidecimal: %.2x%.2x%.2x" % (col * 255.0)[:]) diff --git a/doc/python_api/examples/mathutils.Euler.py b/doc/python_api/examples/mathutils.Euler.py index bc7702c1d53..3f87cc0ab04 100644 --- a/doc/python_api/examples/mathutils.Euler.py +++ b/doc/python_api/examples/mathutils.Euler.py @@ -1,3 +1,32 @@ import mathutils +import math -# todo +# create a new euler with default axis rotation order +eul = mathutils.Euler((0.0, math.radians(45.0), 0.0), 'XYZ') + +# rotate the euler +eul.rotate_axis(math.radians(10.0), 'Z') + +# you can access its components by attribute or index +print("Euler X", eul.x) +print("Euler Y", eul[1]) +print("Euler Z", eul[-1]) + +# components of an existing euler can be set +eul[:] = 1.0, 2.0, 3.0 + +# components of an existing euler can use slice notation to get a tuple +print("Values: %f, %f, %f" % eul[:]) + +# the order can be set at any time too +eul.order = 'ZYX' + +# eulers can be used to rotate vectors +vec = mathutils.Vector((0.0, 0.0, 1.0)) +vec.rotate(eul) + +# often its useful to convert the euler into a matrix so it can be used as +# transformations with more flexibility +mat_rot = eul.to_matrix() +mat_loc = mathutils.Matrix.Translation((2.0, 3.0, 4.0)) +mat = mat_loc * mat_rot.to_4x4() diff --git a/doc/python_api/examples/mathutils.Matrix.py b/doc/python_api/examples/mathutils.Matrix.py index bc7702c1d53..079070a5ec7 100644 --- a/doc/python_api/examples/mathutils.Matrix.py +++ b/doc/python_api/examples/mathutils.Matrix.py @@ -1,3 +1,28 @@ import mathutils +import math -# todo +# create a location matrix +mat_loc = mathutils.Matrix.Translation((2.0, 3.0, 4.0)) + +# create an identitiy matrix +mat_sca = mathutils.Matrix.Scale(0.5, 4, (0.0, 0.0, 1.0)) + +# create a rotation matrix +mat_rot = mathutils.Matrix.Rotation(math.radians(45.0), 4, 'X') + +# combine transformations +mat_out = mat_loc * mat_rot * mat_sca +print(mat_out) + +# extract components back out of the matrix +loc, rot, sca = mat_out.decompose() +print(loc, rot, sca) + +# it can also be useful to access components of a matrix directly +mat = mathutils.Matrix() +mat[0][0], mat[1][0], mat[2][0] = 0.0, 1.0, 2.0 + +mat[0][0:3] = 0.0, 1.0, 2.0 + +# each item in a matrix is a vector so vector utility functions can be used +mat[0].xyz = 0.0, 1.0, 2.0 diff --git a/doc/python_api/examples/mathutils.Quaternion.py b/doc/python_api/examples/mathutils.Quaternion.py index bc7702c1d53..d8c696e6ba6 100644 --- a/doc/python_api/examples/mathutils.Quaternion.py +++ b/doc/python_api/examples/mathutils.Quaternion.py @@ -1,3 +1,23 @@ import mathutils +import math -# todo +# a new rotation 90 degrees about the Y axis +quat_a = mathutils.Quaternion((0.7071068, 0.0, 0.7071068, 0.0)) + +# passing values to Quaternion's directly can be confusing so axis, angle +# is supported for initializing too +quat_b = mathutils.Quaternion((0.0, 1.0, 0.0), math.radians(90.0)) + +print("Check quaternions match", quat_a == quat_b) + +# like matrices, quaternions can be multiplied to accumulate rotational values +quat_a = mathutils.Quaternion((0.0, 1.0, 0.0), math.radians(90.0)) +quat_b = mathutils.Quaternion((0.0, 0.0, 1.0), math.radians(45.0)) +quat_out = quat_a * quat_b + +# print the quat, euler degrees for mear mortals and (axis, angle) +print("Final Rotation:") +print(quat_out) +print("%.2f, %.2f, %.2f" % tuple(math.degrees(a) for a in quat_out.to_euler())) +print("(%.2f, %.2f, %.2f), %.2f" % (quat_out.axis[:] + + (math.degrees(quat_out.angle), ))) diff --git a/doc/python_api/rst/bge.logic.rst b/doc/python_api/rst/bge.logic.rst index 798491b4710..82e69965840 100644 --- a/doc/python_api/rst/bge.logic.rst +++ b/doc/python_api/rst/bge.logic.rst @@ -106,7 +106,7 @@ There are also methods to access the current :class:`bge.types.KX_Scene` Matricies as used by the game engine are **row major** ``matrix[row][col] = float`` -:class:`bge.types.KX_Camera` has some examples using matricies. +:class:`bge.types.KX_Camera` has some examples using matrices. ********* Variables diff --git a/release/scripts/startup/bl_ui/properties_particle.py b/release/scripts/startup/bl_ui/properties_particle.py index d24aef56a8b..0e7fccae8df 100644 --- a/release/scripts/startup/bl_ui/properties_particle.py +++ b/release/scripts/startup/bl_ui/properties_particle.py @@ -404,7 +404,7 @@ class PARTICLE_PT_rotation(ParticleButtonsPanel, Panel): part = context.space_data.pin_id layout.enabled = particle_panel_enabled(context, psys) - + layout.prop(part, "use_dynamic_rotation") if part.use_dynamic_rotation: @@ -433,7 +433,6 @@ class PARTICLE_PT_rotation(ParticleButtonsPanel, Panel): subsub = sub.column() subsub.active = part.angular_velocity_mode != 'NONE' subsub.prop(part, "angular_velocity_factor", text="") - class PARTICLE_PT_physics(ParticleButtonsPanel, Panel): diff --git a/source/blender/blenkernel/BKE_paint.h b/source/blender/blenkernel/BKE_paint.h index f8463bab55f..89733f1623c 100644 --- a/source/blender/blenkernel/BKE_paint.h +++ b/source/blender/blenkernel/BKE_paint.h @@ -84,7 +84,7 @@ typedef struct SculptSession { int modifiers_active; /* object is deformed with some modifiers */ float (*orig_cos)[3]; /* coords of undeformed mesh */ float (*deform_cos)[3]; /* coords of deformed mesh but without stroke displacement */ - float (*deform_imats)[3][3]; /* crazyspace deformation matricies */ + float (*deform_imats)[3][3]; /* crazyspace deformation matrices */ /* Partial redraw */ int partial_redraw; diff --git a/source/blender/blenkernel/intern/constraint.c b/source/blender/blenkernel/intern/constraint.c index 08a3eab55e6..6dbea2c9ab6 100644 --- a/source/blender/blenkernel/intern/constraint.c +++ b/source/blender/blenkernel/intern/constraint.c @@ -4351,7 +4351,7 @@ short proxylocked_constraints_owner (Object *ob, bPoseChannel *pchan) * constraints either had one or no targets. It used to be called during the main constraint solving * loop, but is now only used for the remaining cases for a few constraints. * - * None of the actual calculations of the matricies should be done here! Also, this function is + * None of the actual calculations of the matrices should be done here! Also, this function is * not to be used by any new constraints, particularly any that have multiple targets. */ void get_constraint_target_matrix (struct Scene *scene, bConstraint *con, int n, short ownertype, void *ownerdata, float mat[][4], float ctime) diff --git a/source/blender/editors/util/crazyspace.c b/source/blender/editors/util/crazyspace.c index 9560924941d..53ccd37952d 100644 --- a/source/blender/editors/util/crazyspace.c +++ b/source/blender/editors/util/crazyspace.c @@ -384,7 +384,7 @@ void crazyspace_build_sculpt(Scene *scene, Object *ob, float (**deformmats)[3][3 int totleft= sculpt_get_first_deform_matrices(scene, ob, deformmats, deformcos); if(totleft) { - /* there are deformation modifier which doesn't support deformation matricies + /* there are deformation modifier which doesn't support deformation matrices calculation. Need additional crazyspace correction */ float (*deformedVerts)[3]= *deformcos; diff --git a/source/blender/python/mathutils/mathutils_Matrix.c b/source/blender/python/mathutils/mathutils_Matrix.c index b1700aa53c6..7570b5642ef 100644 --- a/source/blender/python/mathutils/mathutils_Matrix.c +++ b/source/blender/python/mathutils/mathutils_Matrix.c @@ -1089,7 +1089,7 @@ static PyObject *Matrix_decompose(MatrixObject *self) PyDoc_STRVAR(Matrix_lerp_doc, ".. function:: lerp(other, factor)\n" "\n" -" Returns the interpolation of two matricies.\n" +" Returns the interpolation of two matrices.\n" "\n" " :arg other: value to interpolate with.\n" " :type other: :class:`Matrix`\n" @@ -1669,7 +1669,7 @@ static PyObject *Matrix_subscript(MatrixObject* self, PyObject* item) } else { PyErr_SetString(PyExc_IndexError, - "slice steps not supported with matricies"); + "slice steps not supported with matrices"); return NULL; } } @@ -1701,7 +1701,7 @@ static int Matrix_ass_subscript(MatrixObject* self, PyObject* item, PyObject* va return Matrix_ass_slice(self, start, stop, value); else { PyErr_SetString(PyExc_IndexError, - "slice steps not supported with matricies"); + "slice steps not supported with matrices"); return -1; } } -- cgit v1.2.3 From 61389bba41857ec468b5844e3fd9f713b4d9c4a5 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 17 Oct 2011 06:39:13 +0000 Subject: fix spelling mistakes in comments (and in some python error messages), nothing to effect translations. --- CMakeLists.txt | 2 +- intern/ghost/intern/GHOST_SystemSDL.h | 2 +- intern/ghost/intern/GHOST_WindowSDL.h | 2 +- source/blender/blenkernel/BKE_animsys.h | 2 +- source/blender/blenkernel/BKE_utildefines.h | 2 +- source/blender/blenkernel/intern/cloth.c | 2 +- source/blender/blenkernel/intern/fcurve.c | 2 +- source/blender/blenkernel/intern/seqeffects.c | 2 +- source/blender/blenkernel/intern/softbody.c | 4 ++-- source/blender/blenlib/intern/path_util.c | 2 +- source/blender/blenloader/intern/readfile.c | 2 +- source/blender/editors/animation/anim_channels_edit.c | 2 +- source/blender/editors/include/ED_anim_api.h | 2 +- source/blender/editors/mesh/editmesh_lib.c | 6 +++--- source/blender/editors/mesh/meshtools.c | 2 +- source/blender/editors/physics/particle_edit.c | 2 +- source/blender/editors/sculpt_paint/paint_image.c | 2 +- source/blender/editors/space_outliner/outliner_edit.c | 2 +- source/blender/editors/space_sequencer/sequencer_select.c | 2 +- source/blender/editors/space_view3d/view3d_edit.c | 2 +- source/blender/editors/space_view3d/view3d_fly.c | 4 ++-- source/blender/imbuf/intern/IMB_indexer.h | 2 +- source/blender/makesrna/intern/rna_image_api.c | 2 +- source/blender/modifiers/intern/MOD_screw.c | 2 +- source/blender/modifiers/intern/MOD_simpledeform.c | 4 ++-- source/blender/python/intern/bpy_props.c | 2 +- source/blender/python/intern/bpy_rna.c | 4 ++-- source/blender/python/intern/bpy_rna.h | 2 +- source/blender/python/mathutils/mathutils_Euler.c | 2 +- source/blender/render/intern/include/raycounter.h | 2 +- source/blender/render/intern/raytrace/bvh.h | 2 +- source/blender/windowmanager/intern/wm_operators.c | 4 ++-- source/gameengine/Converter/BL_ArmatureObject.cpp | 2 +- source/gameengine/Expressions/ConstExpr.cpp | 2 +- source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageSensor.cpp | 2 +- 35 files changed, 42 insertions(+), 42 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 405c8850504..6cfda3a01e6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -774,7 +774,7 @@ elseif(WIN32) set(PLATFORM_LINKFLAGS_DEBUG "/NODEFAULTLIB:libcmt.lib /NODEFAULTLIB:libc.lib") else() - # keep GCC spesific stuff here + # keep GCC specific stuff here if(CMAKE_COMPILER_IS_GNUCC) set(PLATFORM_LINKLIBS "-lshell32 -lshfolder -lgdi32 -lmsvcrt -lwinmm -lmingw32 -lm -lws2_32 -lz -lstdc++ -lole32 -luuid -lwsock32") set(PLATFORM_CFLAGS "-pipe -funsigned-char -fno-strict-aliasing") diff --git a/intern/ghost/intern/GHOST_SystemSDL.h b/intern/ghost/intern/GHOST_SystemSDL.h index 87d288117c5..d70bec610d6 100644 --- a/intern/ghost/intern/GHOST_SystemSDL.h +++ b/intern/ghost/intern/GHOST_SystemSDL.h @@ -110,7 +110,7 @@ private: const GHOST_TEmbedderWindowID parentWindow ); - /* SDL spesific */ + /* SDL specific */ GHOST_WindowSDL * findGhostWindow(SDL_Window *sdl_win); bool diff --git a/intern/ghost/intern/GHOST_WindowSDL.h b/intern/ghost/intern/GHOST_WindowSDL.h index 6b016b85126..62e1a71227f 100644 --- a/intern/ghost/intern/GHOST_WindowSDL.h +++ b/intern/ghost/intern/GHOST_WindowSDL.h @@ -70,7 +70,7 @@ public: ~GHOST_WindowSDL(); - /* SDL spesific */ + /* SDL specific */ SDL_Window * getSDLWindow() { diff --git a/source/blender/blenkernel/BKE_animsys.h b/source/blender/blenkernel/BKE_animsys.h index bf619d76e68..cf49c479fe3 100644 --- a/source/blender/blenkernel/BKE_animsys.h +++ b/source/blender/blenkernel/BKE_animsys.h @@ -146,7 +146,7 @@ void BKE_animsys_evaluate_animdata(struct Scene *scene, struct ID *id, struct An void BKE_animsys_evaluate_all_animation(struct Main *main, struct Scene *scene, float ctime); -/* ------------ Specialised API --------------- */ +/* ------------ Specialized API --------------- */ /* There are a few special tools which require these following functions. They are NOT to be used * for standard animation evaluation UNDER ANY CIRCUMSTANCES! * diff --git a/source/blender/blenkernel/BKE_utildefines.h b/source/blender/blenkernel/BKE_utildefines.h index 87684e4895d..f65b937a54b 100644 --- a/source/blender/blenkernel/BKE_utildefines.h +++ b/source/blender/blenkernel/BKE_utildefines.h @@ -29,7 +29,7 @@ /** \file BKE_utildefines.h * \ingroup bke - * \brief blender format spesific macros + * \brief blender format specific macros * \note generic defines should go in BLI_utildefines.h */ diff --git a/source/blender/blenkernel/intern/cloth.c b/source/blender/blenkernel/intern/cloth.c index 1ec573c853a..260b51bc321 100644 --- a/source/blender/blenkernel/intern/cloth.c +++ b/source/blender/blenkernel/intern/cloth.c @@ -974,7 +974,7 @@ static void cloth_from_mesh ( ClothModifierData *clmd, DerivedMesh *dm ) * SPRING NETWORK BUILDING IMPLEMENTATION BEGIN ***************************************************************************************/ -// be carefull: implicit solver has to be resettet when using this one! +// be careful: implicit solver has to be resettet when using this one! // --> only for implicit handling of this spring! int cloth_add_spring ( ClothModifierData *clmd, unsigned int indexA, unsigned int indexB, float restlength, int spring_type) { diff --git a/source/blender/blenkernel/intern/fcurve.c b/source/blender/blenkernel/intern/fcurve.c index e2326b005c1..0303f580e67 100644 --- a/source/blender/blenkernel/intern/fcurve.c +++ b/source/blender/blenkernel/intern/fcurve.c @@ -705,7 +705,7 @@ void bezt_add_to_cfra_elem (ListBase *lb, BezTriple *bezt) /* ***************************** Samples Utilities ******************************* */ /* Some utilities for working with FPoints (i.e. 'sampled' animation curve data, such as - * data imported from BVH/Mocap files), which are specialised for use with high density datasets, + * data imported from BVH/Mocap files), which are specialized for use with high density datasets, * which BezTriples/Keyframe data are ill equipped to do. */ diff --git a/source/blender/blenkernel/intern/seqeffects.c b/source/blender/blenkernel/intern/seqeffects.c index d8d6ed6ea6d..943066537d5 100644 --- a/source/blender/blenkernel/intern/seqeffects.c +++ b/source/blender/blenkernel/intern/seqeffects.c @@ -827,7 +827,7 @@ static void do_cross_effect_float(float facf0, float facf1, int x, int y, } } -/* carefull: also used by speed effect! */ +/* careful: also used by speed effect! */ static struct ImBuf* do_cross_effect( SeqRenderData context, Sequence *UNUSED(seq), float UNUSED(cfra), diff --git a/source/blender/blenkernel/intern/softbody.c b/source/blender/blenkernel/intern/softbody.c index 88f72c33802..65b4a21d0ee 100644 --- a/source/blender/blenkernel/intern/softbody.c +++ b/source/blender/blenkernel/intern/softbody.c @@ -2818,7 +2818,7 @@ static void softbody_calc_forces(Scene *scene, Object *ob, float forcetime, floa if (ob->softflag & OB_SB_FACECOLL) scan_for_ext_face_forces(ob,timenow); /* finish matrix and solve */ -#if (0) // remove onl linking for now .. still i am not sure .. the jacobian can be usefull .. so keep that BM +#if (0) // remove onl linking for now .. still i am not sure .. the jacobian can be useful .. so keep that BM if(nl_flags & NLF_SOLVE){ //double sct,sst=PIL_check_seconds_timer(); for(a=sb->totpoint, bp= sb->bpoint; a>0; a--, bp++) { @@ -3540,7 +3540,7 @@ static void lattice_to_softbody(Scene *scene, Object *ob) } } - /* create some helper edges to enable SB lattice to be usefull at all */ + /* create some helper edges to enable SB lattice to be useful at all */ if (ob->softflag & OB_SB_EDGES){ makelatticesprings(lt,ob->soft->bspring,ob->softflag & OB_SB_QUADS,ob); build_bps_springlist(ob); /* link bps to springs */ diff --git a/source/blender/blenlib/intern/path_util.c b/source/blender/blenlib/intern/path_util.c index fe1d869f898..21f91ce8f14 100644 --- a/source/blender/blenlib/intern/path_util.c +++ b/source/blender/blenlib/intern/path_util.c @@ -1681,7 +1681,7 @@ void BLI_where_am_i(char *fullname, const size_t maxlen, const char *name) #ifdef WITH_BINRELOC - /* linux uses binreloc since argv[0] is not relyable, call br_init( NULL ) first */ + /* linux uses binreloc since argv[0] is not reliable, call br_init( NULL ) first */ path = br_find_exe( NULL ); if (path) { BLI_strncpy(fullname, path, maxlen); diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 84b9021d080..dfaf96a6066 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -13303,7 +13303,7 @@ static void give_base_to_objects(Main *mainvar, Scene *sce, Library *lib, const if( ob->id.flag & LIB_INDIRECT ) { /* IF below is quite confusing! - if we are appending, but this object wasnt just added allong with a group, + if we are appending, but this object wasnt just added along with a group, then this is already used indirectly in the scene somewhere else and we didnt just append it. (ob->id.flag & LIB_PRE_EXISTING)==0 means that this is a newly appended object - Campbell */ diff --git a/source/blender/editors/animation/anim_channels_edit.c b/source/blender/editors/animation/anim_channels_edit.c index 7f05a7c2b1a..b4a86e5d74c 100644 --- a/source/blender/editors/animation/anim_channels_edit.c +++ b/source/blender/editors/animation/anim_channels_edit.c @@ -2447,7 +2447,7 @@ void ED_keymap_animchannels(wmKeyConfig *keyconf) WM_keymap_add_item(keymap, "ANIM_OT_channels_setting_enable", WKEY, KM_PRESS, KM_CTRL|KM_SHIFT, 0); WM_keymap_add_item(keymap, "ANIM_OT_channels_setting_disable", WKEY, KM_PRESS, KM_ALT, 0); - /* settings - specialised hotkeys */ + /* settings - specialized hotkeys */ WM_keymap_add_item(keymap, "ANIM_OT_channels_editable_toggle", TABKEY, KM_PRESS, 0, 0); /* expand/collapse */ diff --git a/source/blender/editors/include/ED_anim_api.h b/source/blender/editors/include/ED_anim_api.h index 3c810f7da2d..0ac5a9e46ce 100644 --- a/source/blender/editors/include/ED_anim_api.h +++ b/source/blender/editors/include/ED_anim_api.h @@ -123,7 +123,7 @@ typedef struct bAnimListElem { /* Some types for easier type-testing - * NOTE: need to keep the order of these synchronised with the channels define code + * NOTE: need to keep the order of these synchronized with the channels define code * which is used for drawing and handling channel lists for */ typedef enum eAnim_ChannelType { diff --git a/source/blender/editors/mesh/editmesh_lib.c b/source/blender/editors/mesh/editmesh_lib.c index 02b5250f67a..8945cac428b 100644 --- a/source/blender/editors/mesh/editmesh_lib.c +++ b/source/blender/editors/mesh/editmesh_lib.c @@ -337,7 +337,7 @@ void EM_editselection_normal(float *normal, EditSelection *ese) } /* Calculate a plane that is rightangles to the edge/vert/faces normal -also make the plane run allong an axis that is related to the geometry, +also make the plane run along an axis that is related to the geometry, because this is used for the manipulators Y axis.*/ void EM_editselection_plane(float *plane, EditSelection *ese) { @@ -345,7 +345,7 @@ void EM_editselection_plane(float *plane, EditSelection *ese) EditVert *eve= ese->data; float vec[3]={0,0,0}; - if (ese->prev) { /*use previously selected data to make a usefull vertex plane */ + if (ese->prev) { /*use previously selected data to make a useful vertex plane */ EM_editselection_center(vec, ese->prev); sub_v3_v3v3(plane, vec, eve->co); } else { @@ -361,7 +361,7 @@ void EM_editselection_plane(float *plane, EditSelection *ese) } else if (ese->type==EDITEDGE) { EditEdge *eed= ese->data; - /*the plane is simple, it runs allong the edge + /*the plane is simple, it runs along the edge however selecting different edges can swap the direction of the y axis. this makes it less likely for the y axis of the manipulator (running along the edge).. to flip less often. diff --git a/source/blender/editors/mesh/meshtools.c b/source/blender/editors/mesh/meshtools.c index 526bf177ab7..e6836d7d5aa 100644 --- a/source/blender/editors/mesh/meshtools.c +++ b/source/blender/editors/mesh/meshtools.c @@ -957,7 +957,7 @@ long mesh_mirrtopo_table(Object *ob, char mode) } } else { for(a=0, medge=me->medge; atotedge; a++, medge++) { - /* This can make realy big numbers, wrapping around here is fine */ + /* This can make really big numbers, wrapping around here is fine */ MirrTopoHash[medge->v1] += MirrTopoHash_Prev[medge->v2]; MirrTopoHash[medge->v2] += MirrTopoHash_Prev[medge->v1]; } diff --git a/source/blender/editors/physics/particle_edit.c b/source/blender/editors/physics/particle_edit.c index 019d6df9b73..740fd5137de 100644 --- a/source/blender/editors/physics/particle_edit.c +++ b/source/blender/editors/physics/particle_edit.c @@ -2970,7 +2970,7 @@ static void brush_puff(PEData *data, int point_index) VECSUB(dco, lastco, co); mul_mat3_m4_v3(imat, dco); /* into particle space */ - /* move the point allong a vector perpendicular to the + /* move the point along a vector perpendicular to the * hairs direction, reduces odd kinks, */ cross_v3_v3v3(c1, ofs, dco); cross_v3_v3v3(c2, c1, dco); diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c index 9842bc0e1ee..c5af8971907 100644 --- a/source/blender/editors/sculpt_paint/paint_image.c +++ b/source/blender/editors/sculpt_paint/paint_image.c @@ -3387,7 +3387,7 @@ static void project_paint_end(ProjPaintState *ps) } /* This is a BIT ODD, but overwrite the undo tiles image info with this pixels original color - * because allocating the tiles allong the way slows down painting */ + * because allocating the tiles along the way slows down painting */ if (is_float) { float *rgba_fp = (float *)tilerect + (((projPixel->x_px - x_round) + (projPixel->y_px - y_round) * IMAPAINT_TILE_SIZE)) * 4; diff --git a/source/blender/editors/space_outliner/outliner_edit.c b/source/blender/editors/space_outliner/outliner_edit.c index 6bfe370d105..1d1abf80fe4 100644 --- a/source/blender/editors/space_outliner/outliner_edit.c +++ b/source/blender/editors/space_outliner/outliner_edit.c @@ -947,7 +947,7 @@ void OUTLINER_OT_show_hierarchy(wmOperatorType *ot) /* ANIMATO OPERATIONS */ /* KeyingSet and Driver Creation - Helper functions */ -/* specialised poll callback for these operators to work in Datablocks view only */ +/* specialized poll callback for these operators to work in Datablocks view only */ static int ed_operator_outliner_datablocks_active(bContext *C) { ScrArea *sa= CTX_wm_area(C); diff --git a/source/blender/editors/space_sequencer/sequencer_select.c b/source/blender/editors/space_sequencer/sequencer_select.c index 7e718dc176a..53a520a355d 100644 --- a/source/blender/editors/space_sequencer/sequencer_select.c +++ b/source/blender/editors/space_sequencer/sequencer_select.c @@ -530,7 +530,7 @@ void SEQUENCER_OT_select(wmOperatorType *ot) -/* run recursivly to select linked */ +/* run recursively to select linked */ static int select_more_less_seq__internal(Scene *scene, int sel, int linked) { Editing *ed= seq_give_editing(scene, FALSE); diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c index 0854f9f3685..115b3756029 100644 --- a/source/blender/editors/space_view3d/view3d_edit.c +++ b/source/blender/editors/space_view3d/view3d_edit.c @@ -450,7 +450,7 @@ static void viewops_data_create(bContext *C, wmOperator *op, wmEvent *event) sub_v3_v3v3(my_pivot, rv3d->ofs, upvec); negate_v3(my_pivot); /* ofs is flipped */ - /* find a new ofs value that is allong the view axis (rather than the mouse location) */ + /* find a new ofs value that is along the view axis (rather than the mouse location) */ closest_to_line_v3(dvec, vod->dyn_ofs, my_pivot, my_origin); vod->dist0 = rv3d->dist = len_v3v3(my_pivot, dvec); diff --git a/source/blender/editors/space_view3d/view3d_fly.c b/source/blender/editors/space_view3d/view3d_fly.c index 02a6cee5140..b66440738b2 100644 --- a/source/blender/editors/space_view3d/view3d_fly.c +++ b/source/blender/editors/space_view3d/view3d_fly.c @@ -179,7 +179,7 @@ typedef struct FlyInfo { /* fly state state */ float speed; /* the speed the view is moving per redraw */ - short axis; /* Axis index to move allong by default Z to move allong the view */ + short axis; /* Axis index to move along by default Z to move along the view */ short pan_view; /* when true, pan the view instead of rotating */ /* relative view axis locking - xlock, zlock @@ -725,7 +725,7 @@ static int flyApply(bContext *C, FlyInfo *fly) RegionView3D *rv3d= fly->rv3d; ARegion *ar = fly->ar; - float mat[3][3], /* 3x3 copy of the view matrix so we can move allong the view axis */ + float mat[3][3], /* 3x3 copy of the view matrix so we can move along the view axis */ dvec[3]={0,0,0}, /* this is the direction thast added to the view offset per redraw */ /* Camera Uprighting variables */ diff --git a/source/blender/imbuf/intern/IMB_indexer.h b/source/blender/imbuf/intern/IMB_indexer.h index bd5a455df98..08fa51966f2 100644 --- a/source/blender/imbuf/intern/IMB_indexer.h +++ b/source/blender/imbuf/intern/IMB_indexer.h @@ -37,7 +37,7 @@ #include "IMB_anim.h" /* - seperate animation index files to solve the following problems: + separate animation index files to solve the following problems: a) different timecodes within one file (like DTS/PTS, Timecode-Track, "implicit" timecodes within DV-files and HDV-files etc.) diff --git a/source/blender/makesrna/intern/rna_image_api.c b/source/blender/makesrna/intern/rna_image_api.c index 50ce816d7a1..473278440e6 100644 --- a/source/blender/makesrna/intern/rna_image_api.c +++ b/source/blender/makesrna/intern/rna_image_api.c @@ -157,7 +157,7 @@ static void rna_Image_unpack(Image *image, ReportList *reports, int method) return; } else { - /* reports its own error on failier */ + /* reports its own error on failure */ unpackImage (reports, image, method); } } diff --git a/source/blender/modifiers/intern/MOD_screw.c b/source/blender/modifiers/intern/MOD_screw.c index 486c98f82a0..663faf0ed19 100644 --- a/source/blender/modifiers/intern/MOD_screw.c +++ b/source/blender/modifiers/intern/MOD_screw.c @@ -357,7 +357,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, if (!totedge) { for (i=0; i < totvert; i++, mv_orig++, mv_new++) { copy_v3_v3(mv_new->co, mv_orig->co); - normalize_v3_v3(vc->no, mv_new->co); /* no edges- this is realy a dummy normal */ + normalize_v3_v3(vc->no, mv_new->co); /* no edges- this is really a dummy normal */ } } else { diff --git a/source/blender/modifiers/intern/MOD_simpledeform.c b/source/blender/modifiers/intern/MOD_simpledeform.c index b2e3c9532b6..7c852527c3d 100644 --- a/source/blender/modifiers/intern/MOD_simpledeform.c +++ b/source/blender/modifiers/intern/MOD_simpledeform.c @@ -326,7 +326,7 @@ static void deformVerts(ModifierData *md, Object *ob, DerivedMesh *dm = derivedData; CustomDataMask dataMask = requiredDataMask(ob, md); - /* we implement requiredDataMask but thats not really usefull since + /* we implement requiredDataMask but thats not really useful since mesh_calc_modifiers pass a NULL derivedData */ if(dataMask) dm= get_dm(ob, NULL, dm, NULL, 0); @@ -346,7 +346,7 @@ static void deformVertsEM(ModifierData *md, Object *ob, DerivedMesh *dm = derivedData; CustomDataMask dataMask = requiredDataMask(ob, md); - /* we implement requiredDataMask but thats not really usefull since + /* we implement requiredDataMask but thats not really useful since mesh_calc_modifiers pass a NULL derivedData */ if(dataMask) dm= get_dm(ob, editData, dm, NULL, 0); diff --git a/source/blender/python/intern/bpy_props.c b/source/blender/python/intern/bpy_props.c index d3963458298..5a78ac8e094 100644 --- a/source/blender/python/intern/bpy_props.c +++ b/source/blender/python/intern/bpy_props.c @@ -359,7 +359,7 @@ static int bpy_struct_id_used(StructRNA *srna, char *identifier) #endif -/* Function that sets RNA, NOTE - self is NULL when called from python, but being abused from C so we can pass the srna allong +/* Function that sets RNA, NOTE - self is NULL when called from python, but being abused from C so we can pass the srna along * This isnt incorrect since its a python object - but be careful */ PyDoc_STRVAR(BPy_BoolProperty_doc, ".. function:: BoolProperty(name=\"\", description=\"\", default=False, options={'ANIMATABLE'}, subtype='NONE', update=None)\n" diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c index 76dcf9729ca..e52df8f9320 100644 --- a/source/blender/python/intern/bpy_rna.c +++ b/source/blender/python/intern/bpy_rna.c @@ -2218,7 +2218,7 @@ static PyObject *pyrna_prop_collection_subscript(BPy_PropertyRNA *self, PyObject } /* generic check to see if a PyObject is compatible with a collection - * -1 on failier, 0 on success, sets the error */ + * -1 on failure, 0 on success, sets the error */ static int pyrna_prop_collection_type_check(BPy_PropertyRNA *self, PyObject *value) { StructRNA *prop_srna; @@ -3800,7 +3800,7 @@ PyDoc_STRVAR(pyrna_struct_get_doc, " Returns the value of the custom property assigned to key or default\n" " when not found (matches pythons dictionary function of the same name).\n" "\n" -" :arg key: The key assosiated with the custom property.\n" +" :arg key: The key associated with the custom property.\n" " :type key: string\n" " :arg default: Optional argument for the value to return if\n" " *key* is not found.\n" diff --git a/source/blender/python/intern/bpy_rna.h b/source/blender/python/intern/bpy_rna.h index 502fa25c872..98afad38abe 100644 --- a/source/blender/python/intern/bpy_rna.h +++ b/source/blender/python/intern/bpy_rna.h @@ -149,7 +149,7 @@ typedef struct { PyObject *in_weakreflist; #endif - /* collection iterator spesific parts */ + /* collection iterator specific parts */ CollectionPropertyIterator iter; } BPy_PropertyCollectionIterRNA; diff --git a/source/blender/python/mathutils/mathutils_Euler.c b/source/blender/python/mathutils/mathutils_Euler.c index d9f741d841a..c6be461a227 100644 --- a/source/blender/python/mathutils/mathutils_Euler.c +++ b/source/blender/python/mathutils/mathutils_Euler.c @@ -75,7 +75,7 @@ static PyObject *Euler_new(PyTypeObject *type, PyObject *args, PyObject *kwds) return newEulerObject(eul, order, Py_NEW, type); } -/* internal use, assuem read callback is done */ +/* internal use, assume read callback is done */ static const char *euler_order_str(EulerObject *self) { static const char order[][4] = {"XYZ", "XZY", "YXZ", "YZX", "ZXY", "ZYX"}; diff --git a/source/blender/render/intern/include/raycounter.h b/source/blender/render/intern/include/raycounter.h index 4d4952cb6c3..7acef6d3c67 100644 --- a/source/blender/render/intern/include/raycounter.h +++ b/source/blender/render/intern/include/raycounter.h @@ -35,7 +35,7 @@ #ifndef RE_RAYCOUNTER_H #define RE_RAYCOUNTER_H -//#define RE_RAYCOUNTER /* enable counters per ray, usefull for measuring raytrace structures performance */ +//#define RE_RAYCOUNTER /* enable counters per ray, useful for measuring raytrace structures performance */ #ifdef __cplusplus extern "C" { diff --git a/source/blender/render/intern/raytrace/bvh.h b/source/blender/render/intern/raytrace/bvh.h index 3ba5bbc624e..c7a1b002d61 100644 --- a/source/blender/render/intern/raytrace/bvh.h +++ b/source/blender/render/intern/raytrace/bvh.h @@ -167,7 +167,7 @@ static inline void bvh_node_merge_bb(Node *node, float *min, float *max) /* - * recursivly transverse a BVH looking for a rayhit using a local stack + * recursively transverse a BVH looking for a rayhit using a local stack */ template static inline void bvh_node_push_childs(Node *node, Isect *isec, Node **stack, int &stack_pos); diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c index 07bab06e52f..b0183d05ac2 100644 --- a/source/blender/windowmanager/intern/wm_operators.c +++ b/source/blender/windowmanager/intern/wm_operators.c @@ -3586,8 +3586,8 @@ static void gesture_circle_modal_keymap(wmKeyConfig *keyconf) WM_modalkeymap_add_item(keymap, LEFTMOUSE, KM_PRESS, KM_SHIFT, 0, GESTURE_MODAL_DESELECT); WM_modalkeymap_add_item(keymap, LEFTMOUSE, KM_RELEASE, KM_SHIFT, 0, GESTURE_MODAL_NOP); #else - WM_modalkeymap_add_item(keymap, MIDDLEMOUSE, KM_PRESS, 0, 0, GESTURE_MODAL_DESELECT); // defailt 2.4x - WM_modalkeymap_add_item(keymap, MIDDLEMOUSE, KM_RELEASE, 0, 0, GESTURE_MODAL_NOP); // defailt 2.4x + WM_modalkeymap_add_item(keymap, MIDDLEMOUSE, KM_PRESS, 0, 0, GESTURE_MODAL_DESELECT); // default 2.4x + WM_modalkeymap_add_item(keymap, MIDDLEMOUSE, KM_RELEASE, 0, 0, GESTURE_MODAL_NOP); // default 2.4x #endif WM_modalkeymap_add_item(keymap, LEFTMOUSE, KM_RELEASE, 0, 0, GESTURE_MODAL_NOP); diff --git a/source/gameengine/Converter/BL_ArmatureObject.cpp b/source/gameengine/Converter/BL_ArmatureObject.cpp index c5bf28b9b8d..43c9bd434c5 100644 --- a/source/gameengine/Converter/BL_ArmatureObject.cpp +++ b/source/gameengine/Converter/BL_ArmatureObject.cpp @@ -663,7 +663,7 @@ KX_PYMETHODDEF_DOC_NOARGS(BL_ArmatureObject, update, "update()\n" "Make sure that the armature will be updated on next graphic frame.\n" "This is automatically done if a KX_ArmatureActuator with mode run is active\n" - "or if an action is playing. This function is usefull in other cases.\n") + "or if an action is playing. This function is useful in other cases.\n") { SetActiveAction(NULL, 0, KX_GetActiveEngine()->GetFrameTime()); Py_RETURN_NONE; diff --git a/source/gameengine/Expressions/ConstExpr.cpp b/source/gameengine/Expressions/ConstExpr.cpp index 8d5a47b2d0d..c41cf5a54f5 100644 --- a/source/gameengine/Expressions/ConstExpr.cpp +++ b/source/gameengine/Expressions/ConstExpr.cpp @@ -99,7 +99,7 @@ bool CConstExpr::NeedsRecalculated() CExpression* CConstExpr::CheckLink(std::vector& brokenlinks) { -// parent checks if child is still usefull. +// parent checks if child is still useful. // When for example it's value it's deleted flag set // then release Value, and return NULL in case of constexpression // else return this... diff --git a/source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageSensor.cpp b/source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageSensor.cpp index a795a4eddc6..7e496136ce2 100644 --- a/source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageSensor.cpp +++ b/source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageSensor.cpp @@ -146,7 +146,7 @@ bool KX_NetworkMessageSensor::Evaluate() // Return always true if a message was received otherwise we can loose messages if (m_IsUp) return true; - // Is it usefull to return also true when the first frame without a message?? + // Is it useful to return also true when the first frame without a message?? // This will cause a fast on/off cycle that seems useless! return result; } -- cgit v1.2.3 From fda20451502fea888019ce0d8b044b5dbecab491 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 17 Oct 2011 06:58:07 +0000 Subject: correct spelling errors in comments --- release/scripts/modules/addon_utils.py | 10 +-- release/scripts/modules/animsys_refactor.py | 2 +- release/scripts/modules/blend_render_info.py | 2 +- release/scripts/modules/bpy/__init__.py | 2 +- release/scripts/modules/bpy/ops.py | 2 +- release/scripts/modules/bpy/utils.py | 8 +- release/scripts/modules/bpy_extras/anim_utils.py | 2 +- release/scripts/modules/bpy_extras/image_utils.py | 6 +- release/scripts/modules/bpy_extras/io_utils.py | 10 +-- .../scripts/modules/bpy_extras/keyconfig_utils.py | 2 +- release/scripts/modules/bpy_extras/mesh_utils.py | 2 +- release/scripts/modules/bpy_extras/object_utils.py | 2 +- release/scripts/modules/bpy_extras/view3d_utils.py | 2 +- release/scripts/modules/bpy_types.py | 18 ++--- release/scripts/modules/console_python.py | 26 +++---- release/scripts/modules/console_shell.py | 2 +- release/scripts/modules/rna_info.py | 6 +- release/scripts/startup/bl_operators/anim.py | 2 +- release/scripts/startup/bl_operators/console.py | 4 +- release/scripts/startup/bl_operators/object.py | 8 +- .../startup/bl_operators/uvcalc_follow_active.py | 12 +-- .../startup/bl_operators/uvcalc_lightmap.py | 26 +++---- .../startup/bl_operators/uvcalc_smart_project.py | 88 +++++++++++----------- .../startup/bl_operators/vertexpaint_dirt.py | 4 +- release/scripts/startup/bl_operators/view3d.py | 4 +- release/scripts/startup/bl_operators/wm.py | 27 ++++--- .../scripts/startup/bl_ui/properties_animviz.py | 4 +- .../startup/bl_ui/properties_data_armature.py | 6 +- .../scripts/startup/bl_ui/properties_data_bone.py | 2 +- .../scripts/startup/bl_ui/properties_material.py | 22 +++--- .../startup/bl_ui/properties_object_constraint.py | 2 +- .../startup/bl_ui/properties_physics_common.py | 2 +- .../scripts/startup/bl_ui/properties_texture.py | 12 +-- release/scripts/startup/bl_ui/space_logic.py | 2 +- release/scripts/startup/bl_ui/space_userpref.py | 4 +- .../scripts/startup/bl_ui/space_userpref_keymap.py | 6 +- release/scripts/startup/bl_ui/space_view3d.py | 8 +- .../scripts/startup/bl_ui/space_view3d_toolbar.py | 12 +-- release/scripts/templates/gamelogic_module.py | 2 +- 39 files changed, 181 insertions(+), 182 deletions(-) diff --git a/release/scripts/modules/addon_utils.py b/release/scripts/modules/addon_utils.py index ef9a4615ff2..26611fb93ad 100644 --- a/release/scripts/modules/addon_utils.py +++ b/release/scripts/modules/addon_utils.py @@ -165,7 +165,7 @@ def modules(module_cache): if mod: module_cache[mod_name] = mod - # just incase we get stale modules, not likely + # just in case we get stale modules, not likely for mod_stale in modules_stale: del module_cache[mod_stale] del modules_stale @@ -209,7 +209,7 @@ def enable(module_name, default_set=True): :arg module_name: The name of the addon and module. :type module_name: string - :return: the loaded module or None on failier. + :return: the loaded module or None on failure. :rtype: module """ @@ -262,7 +262,7 @@ def enable(module_name, default_set=True): # * OK loaded successfully! * if default_set: - # just incase its enabled alredy + # just in case its enabled already ext = _bpy.context.user_preferences.addons.get(module_name) if not ext: ext = _bpy.context.user_preferences.addons.new() @@ -286,7 +286,7 @@ def disable(module_name, default_set=True): import sys mod = sys.modules.get(module_name) - # possible this addon is from a previous session and didnt load a + # possible this addon is from a previous session and didn't load a # module this time. So even if the module is not found, still disable # the addon in the user prefs. if mod: @@ -300,7 +300,7 @@ def disable(module_name, default_set=True): else: print("addon_utils.disable", module_name, "not loaded") - # could be in more then once, unlikely but better do this just incase. + # could be in more then once, unlikely but better do this just in case. addons = _bpy.context.user_preferences.addons if default_set: diff --git a/release/scripts/modules/animsys_refactor.py b/release/scripts/modules/animsys_refactor.py index 88097ed3d28..64110b0f620 100644 --- a/release/scripts/modules/animsys_refactor.py +++ b/release/scripts/modules/animsys_refactor.py @@ -73,7 +73,7 @@ class DataPathBuilder(object): try: print("base." + item_new) base_new = eval("base." + item_new) - break # found, dont keep looking + break # found, don't keep looking except: pass diff --git a/release/scripts/modules/blend_render_info.py b/release/scripts/modules/blend_render_info.py index 43820e82340..7c30b480d6b 100755 --- a/release/scripts/modules/blend_render_info.py +++ b/release/scripts/modules/blend_render_info.py @@ -69,7 +69,7 @@ def read_blend_rend_chunk(path): struct.unpack('>i' if is_big_endian else '= 3600.0: # hours hours = int(time / 3600.0) time = time % 3600.0 - if time >= 60.0: # mins + if time >= 60.0: # minutes minutes = int(time / 60.0) time = time % 60.0 diff --git a/release/scripts/modules/bpy_extras/anim_utils.py b/release/scripts/modules/bpy_extras/anim_utils.py index 9848586a144..6b0ab1c3adc 100644 --- a/release/scripts/modules/bpy_extras/anim_utils.py +++ b/release/scripts/modules/bpy_extras/anim_utils.py @@ -158,7 +158,7 @@ def bake_action(frame_start, # ------------------------------------------------------------------------- # Create action - # incase animation data hassnt been created + # in case animation data hassnt been created atd = obj.animation_data_create() if action is None: action = bpy.data.actions.new("Action") diff --git a/release/scripts/modules/bpy_extras/image_utils.py b/release/scripts/modules/bpy_extras/image_utils.py index 02959fae534..52050b08bc7 100644 --- a/release/scripts/modules/bpy_extras/image_utils.py +++ b/release/scripts/modules/bpy_extras/image_utils.py @@ -43,10 +43,10 @@ def load_image(imagepath, the end will be ignored. :type dirname: string :arg place_holder: if True a new place holder image will be created. - this is usefull so later you can relink the image to its original data. + this is useful so later you can relink the image to its original data. :type place_holder: bool - :arg recursive: If True, directories will be recursivly searched. - Be carefull with this if you have files in your root directory because + :arg recursive: If True, directories will be recursively searched. + Be careful with this if you have files in your root directory because it may take a long time. :type recursive: bool :arg ncase_cmp: on non windows systems, find the correct case for the file. diff --git a/release/scripts/modules/bpy_extras/io_utils.py b/release/scripts/modules/bpy_extras/io_utils.py index 5d28ceaa34c..3d71feaf79e 100644 --- a/release/scripts/modules/bpy_extras/io_utils.py +++ b/release/scripts/modules/bpy_extras/io_utils.py @@ -114,7 +114,7 @@ class ImportHelper: # Axis conversion function, not pretty LUT -# use lookup tabes to convert between any axis +# use lookup table to convert between any axis _axis_convert_matrix = ( ((-1.0, 0.0, 0.0), (0.0, -1.0, 0.0), (0.0, 0.0, 1.0)), ((-1.0, 0.0, 0.0), (0.0, 0.0, -1.0), (0.0, -1.0, 0.0)), @@ -302,7 +302,7 @@ def free_derived_objects(ob): def unpack_list(list_of_tuples): flat_list = [] - flat_list_extend = flat_list.extend # a tich faster + flat_list_extend = flat_list.extend # a tiny bit faster for t in list_of_tuples: flat_list_extend(t) return flat_list @@ -318,7 +318,7 @@ def unpack_face_list(list_of_tuples): if len(t) == 3: if t[2] == 0: t = t[1], t[2], t[0] - else: # assuem quad + else: # assume quad if t[3] == 0 or t[2] == 0: t = t[2], t[3], t[0], t[1] @@ -371,7 +371,7 @@ def path_reference(filepath, :arg copy_subdir: the subdirectory of *base_dst* to use when mode='COPY'. :type copy_subdir: string :arg copy_set: collect from/to pairs when mode='COPY', - pass to *path_reference_copy* when exportign is done. + pass to *path_reference_copy* when exporting is done. :type copy_set: set :arg library: The library this path is relative to. :type library: :class:`bpy.types.Library` or None @@ -450,7 +450,7 @@ def unique_name(key, name, name_dict, name_max=-1, clean_func=None, sep="."): :arg key: unique item this name belongs to, name_dict[key] will be reused when available. This can be the object, mesh, material, etc instance its self. - :type key: any hashable object assosiated with the *name*. + :type key: any hashable object associated with the *name*. :arg name: The name used to create a unique value in *name_dict*. :type name: string :arg name_dict: This is used to cache namespace to ensure no collisions diff --git a/release/scripts/modules/bpy_extras/keyconfig_utils.py b/release/scripts/modules/bpy_extras/keyconfig_utils.py index 78f010245a0..6eb19c0ff05 100644 --- a/release/scripts/modules/bpy_extras/keyconfig_utils.py +++ b/release/scripts/modules/bpy_extras/keyconfig_utils.py @@ -21,7 +21,7 @@ KM_HIERARCHY = [ ('Window', 'EMPTY', 'WINDOW', []), # file save, window change, exit ('Screen', 'EMPTY', 'WINDOW', [ # full screen, undo, screenshot - ('Screen Editing', 'EMPTY', 'WINDOW', []), # resizing, action corners + ('Screen Editing', 'EMPTY', 'WINDOW', []), # re-sizing, action corners ]), ('View2D', 'EMPTY', 'WINDOW', []), # view 2d navigation (per region) diff --git a/release/scripts/modules/bpy_extras/mesh_utils.py b/release/scripts/modules/bpy_extras/mesh_utils.py index 7bc6dae3cc6..8149675000f 100644 --- a/release/scripts/modules/bpy_extras/mesh_utils.py +++ b/release/scripts/modules/bpy_extras/mesh_utils.py @@ -50,7 +50,7 @@ def mesh_linked_faces(mesh): face_groups = [[f] for f in mesh.faces] face_mapping = list(range(len(mesh.faces))) # map old, new face location - # Now clump faces iterativly + # Now clump faces iteratively ok = True while ok: ok = False diff --git a/release/scripts/modules/bpy_extras/object_utils.py b/release/scripts/modules/bpy_extras/object_utils.py index 3081e6f172e..c9c1dc05476 100644 --- a/release/scripts/modules/bpy_extras/object_utils.py +++ b/release/scripts/modules/bpy_extras/object_utils.py @@ -119,7 +119,7 @@ def object_data_add(context, obdata, operator=None): obj_act = scene.objects.active # XXX - # caused because entering editmodedoes not add a empty undo slot! + # caused because entering edit-mode does not add a empty undo slot! if context.user_preferences.edit.use_enter_edit_mode: if not (obj_act and obj_act.mode == 'EDIT' and diff --git a/release/scripts/modules/bpy_extras/view3d_utils.py b/release/scripts/modules/bpy_extras/view3d_utils.py index c18a74bbb09..32f7b654690 100644 --- a/release/scripts/modules/bpy_extras/view3d_utils.py +++ b/release/scripts/modules/bpy_extras/view3d_utils.py @@ -27,7 +27,7 @@ __all__ = ( def region_2d_to_vector_3d(region, rv3d, coord): """ - Return a direction vector from the viewport at the spesific 2d region + Return a direction vector from the viewport at the specific 2d region coordinate. :arg region: region of the 3D viewport, typically bpy.context.region. diff --git a/release/scripts/modules/bpy_types.py b/release/scripts/modules/bpy_types.py index 6b65f720a5c..cee0712e814 100644 --- a/release/scripts/modules/bpy_types.py +++ b/release/scripts/modules/bpy_types.py @@ -49,7 +49,7 @@ class Library(bpy_types.ID): @property def users_id(self): - """ID datablocks which use this library""" + """ID data blocks which use this library""" import bpy # See: readblenentry.c, IDTYPE_FLAGS_ISLINKABLE, we could make this an attribute in rna. @@ -220,9 +220,9 @@ class _GenericBone: @property def children_recursive_basename(self): """ - Returns a chain of children with the same base name as this bone - Only direct chains are supported, forks caused by multiple children with matching basenames will - terminate the function and not be returned. + Returns a chain of children with the same base name as this bone. + Only direct chains are supported, forks caused by multiple children + with matching base names will terminate the function and not be returned. """ basename = self.basename chain = [] @@ -256,7 +256,7 @@ class _GenericBone: bones = id_data.pose.bones elif id_data_type == bpy_types.Armature: bones = id_data.edit_bones - if not bones: # not in editmode + if not bones: # not in edit mode bones = id_data.bones return bones @@ -284,11 +284,11 @@ class EditBone(StructRNA, _GenericBone, metaclass=StructMetaPropGroup): def transform(self, matrix, scale=True, roll=True): """ - Transform the the bones head, tail, roll and envalope (when the matrix has a scale component). + Transform the the bones head, tail, roll and envelope (when the matrix has a scale component). :arg matrix: 3x3 or 4x4 transformation matrix. :type matrix: :class:`mathutils.Matrix` - :arg scale: Scale the bone envalope by the matrix. + :arg scale: Scale the bone envelope by the matrix. :type scale: bool :arg roll: Correct the roll to point in the same relative direction to the head and tail. :type roll: bool @@ -318,7 +318,7 @@ class Mesh(bpy_types.ID): def from_pydata(self, vertices, edges, faces): """ - Make a mesh from a list of verts/edges/faces + Make a mesh from a list of vertices/edges/faces Until we have a nicer way to make geometry, use this. :arg vertices: float triplets each representing (X, Y, Z) eg: [(0.0, 1.0, 0.5), ...]. @@ -553,7 +553,7 @@ class _GenericUI: operator_context_default = self.layout.operator_context for func in draw_ls._draw_funcs: - # so bad menu functions dont stop the entire menu from drawing. + # so bad menu functions don't stop the entire menu from drawing try: func(self, context) except: diff --git a/release/scripts/modules/console_python.py b/release/scripts/modules/console_python.py index 94d0c8c8614..f11ccf84f0b 100644 --- a/release/scripts/modules/console_python.py +++ b/release/scripts/modules/console_python.py @@ -50,7 +50,7 @@ def replace_help(namespace): def get_console(console_id): ''' helper function for console operators - currently each text datablock gets its own + currently each text data block gets its own console - code.InteractiveConsole() ...which is stored in this function. @@ -65,7 +65,7 @@ def get_console(console_id): consoles = get_console.consoles = {} get_console.consoles_namespace_hash = hash_next else: - # check if clearning the namespace is needed to avoid a memory leak. + # check if clearing the namespace is needed to avoid a memory leak. # the window manager is normally loaded with new blend files # so this is a reasonable way to deal with namespace clearing. # bpy.data hashing is reset by undo so cant be used. @@ -135,7 +135,7 @@ def execute(context): sys.stdout = stdout sys.stderr = stderr - # dont allow the stdin to be used, can lock blender. + # don't allow the stdin to be used, can lock blender. stdin_backup = sys.stdin sys.stdin = None @@ -143,14 +143,14 @@ def execute(context): main_mod_back = sys.modules["__main__"] sys.modules["__main__"] = console._bpy_main_mod - # incase exception happens - line = "" # incase of encodingf error + # in case exception happens + line = "" # in case of encoding error is_multiline = False try: line = line_object.body - # run the console, "\n" executes a multiline statement + # run the console, "\n" executes a multi line statement line_exec = line if line.strip() else "\n" is_multiline = console.push(line_exec) @@ -222,8 +222,8 @@ def autocomplete(context): if not console: return {'CANCELLED'} - # dont allow the stdin to be used, can lock blender. - # note: unlikely stdin would be used for autocomp. but its possible. + # don't allow the stdin to be used, can lock blender. + # note: unlikely stdin would be used for autocomplete. but its possible. stdin_backup = sys.stdin sys.stdin = None @@ -238,8 +238,8 @@ def autocomplete(context): current_line = sc.history[-1] line = current_line.body - # This function isnt aware of the text editor or being an operator - # just does the autocomp then copy its results back + # This function isn't aware of the text editor or being an operator + # just does the autocomplete then copy its results back result = intellisense.expand( line=line, cursor=current_line.current_character, @@ -250,7 +250,7 @@ def autocomplete(context): current_line.body, current_line.current_character, scrollback = result del result - # update sel. setting body should really do this! + # update selection. setting body should really do this! ofs = len(line_new) - len(line) sc.select_start += ofs sc.select_end += ofs @@ -263,12 +263,12 @@ def autocomplete(context): if _BPY_MAIN_OWN: sys.modules["__main__"] = main_mod_back - # Separate automplete output by command prompts + # Separate autocomplete output by command prompts if scrollback != '': bpy.ops.console.scrollback_append(text=sc.prompt + current_line.body, type='INPUT') # Now we need to copy back the line from blender back into the - # text editor. This will change when we dont use the text editor + # text editor. This will change when we don't use the text editor # anymore if scrollback: add_scrollback(scrollback, 'INFO') diff --git a/release/scripts/modules/console_shell.py b/release/scripts/modules/console_shell.py index 7a6f45c426f..772d46c8bf3 100644 --- a/release/scripts/modules/console_shell.py +++ b/release/scripts/modules/console_shell.py @@ -64,7 +64,7 @@ def execute(context): def autocomplete(context): - # sc = context.space_data + #~ sc = context.space_data # TODO return {'CANCELLED'} diff --git a/release/scripts/modules/rna_info.py b/release/scripts/modules/rna_info.py index d95c3920cf9..4116bfda0c7 100644 --- a/release/scripts/modules/rna_info.py +++ b/release/scripts/modules/rna_info.py @@ -292,7 +292,7 @@ class InfoPropertyRNA: elif as_arg: if not self.is_required: type_info.append("optional") - else: # readonly is only useful for selfs, not args + else: # readonly is only useful for self's, not args if self.is_readonly: type_info.append("readonly") @@ -519,7 +519,7 @@ def BuildRNAInfo(): # Done ordering structs - # precalc vars to avoid a lot of looping + # precalculate vars to avoid a lot of looping for (rna_base, identifier, rna_struct) in structs: # rna_struct_path = full_rna_struct_path(rna_struct) @@ -634,7 +634,7 @@ if __name__ == "__main__": struct = rna_info.BuildRNAInfo()[0] data = [] for struct_id, v in sorted(struct.items()): - struct_id_str = v.identifier # "".join(sid for sid in struct_id if struct_id) + struct_id_str = v.identifier #~ "".join(sid for sid in struct_id if struct_id) for base in v.get_bases(): struct_id_str = base.identifier + "|" + struct_id_str diff --git a/release/scripts/startup/bl_operators/anim.py b/release/scripts/startup/bl_operators/anim.py index 7d1f3b8f5f0..3051914cf00 100644 --- a/release/scripts/startup/bl_operators/anim.py +++ b/release/scripts/startup/bl_operators/anim.py @@ -87,7 +87,7 @@ class ANIM_OT_keying_set_export(Operator): # -------------------------------------------------------- # generate and write set of lookups for id's used in paths - # cache for syncing ID-blocks to bpy paths + shorthands + # cache for syncing ID-blocks to bpy paths + shorthand's id_to_paths_cache = {} for ksp in ks.paths: diff --git a/release/scripts/startup/bl_operators/console.py b/release/scripts/startup/bl_operators/console.py index 109ca758ea8..8afcdf5f67e 100644 --- a/release/scripts/startup/bl_operators/console.py +++ b/release/scripts/startup/bl_operators/console.py @@ -62,7 +62,7 @@ class ConsoleAutocomplete(Operator): class ConsoleBanner(Operator): - '''Print a message whem the terminal initializes''' + '''Print a message when the terminal initializes''' bl_idname = "console.banner" bl_label = "Console Banner" @@ -97,7 +97,7 @@ class ConsoleLanguage(Operator): def execute(self, context): sc = context.space_data - # defailt to python + # default to python sc.language = self.language bpy.ops.console.banner() diff --git a/release/scripts/startup/bl_operators/object.py b/release/scripts/startup/bl_operators/object.py index d7c6cfc0565..51c530db672 100644 --- a/release/scripts/startup/bl_operators/object.py +++ b/release/scripts/startup/bl_operators/object.py @@ -174,7 +174,7 @@ class SelectHierarchy(Operator): select_new.sort(key=lambda obj_iter: obj_iter.name) act_new = select_new[0] - # dont edit any object settings above this + # don't edit any object settings above this if select_new: if not self.extend: bpy.ops.object.select_all(action='DESELECT') @@ -331,7 +331,7 @@ class ShapeTransfer(Operator): orig_shape_coords = me_cos(ob_act.active_shape_key.data) orig_normals = me_nos(me.vertices) - # the actual mverts location isnt as relyable as the base shape :S + # the actual mverts location isn't as reliable as the base shape :S # orig_coords = me_cos(me.vertices) orig_coords = me_cos(me.shape_keys.key_blocks[0].data) @@ -721,8 +721,8 @@ class TransformsToDeltasAnim(Operator): fcu.data_path = "delta_rotation_quaternion" obj.rotation_quaternion.identity() # XXX: currently not implemented - # elif fcu.data_path == "rotation_axis_angle": - # fcu.data_path = "delta_rotation_axis_angle" + #~ elif fcu.data_path == "rotation_axis_angle": + #~ fcu.data_path = "delta_rotation_axis_angle" elif fcu.data_path == "scale": fcu.data_path = "delta_scale" obj.scale = 1.0, 1.0, 1.0 diff --git a/release/scripts/startup/bl_operators/uvcalc_follow_active.py b/release/scripts/startup/bl_operators/uvcalc_follow_active.py index 05656f5397d..324414b8bcb 100644 --- a/release/scripts/startup/bl_operators/uvcalc_follow_active.py +++ b/release/scripts/startup/bl_operators/uvcalc_follow_active.py @@ -104,13 +104,13 @@ def extend(obj, operator, EXTEND_MODE): uvs_vhash_target[edgepair_inner_target[1]][:] = uvs_vhash_source[edgepair_inner_source[iB]] # Set the 2 UV's on the target face that are not touching - # for this we need to do basic expaning on the source faces UV's + # for this we need to do basic expanding on the source faces UV's if EXTEND_MODE == 'LENGTH': try: # divide by zero is possible ''' measure the length of each face from the middle of each edge to the opposite - allong the axis we are copying, use this + along the axis we are copying, use this ''' i1a = edgepair_outer_target[iB] i2a = edgepair_inner_target[iA] @@ -158,11 +158,11 @@ def extend(obj, operator, EXTEND_MODE): # Modes # 0 unsearched # 1:mapped, use search from this face. - removed!! - # 2:all siblings have been searched. dont search again. + # 2:all siblings have been searched. don't search again. face_modes = [0] * len(face_sel) face_modes[face_act_local_index] = 1 # extend UV's from this face. - # Edge connectivty + # Edge connectivity edge_faces = {} for i, f in enumerate(face_sel): for edkey in f.edge_keys: @@ -181,7 +181,7 @@ def extend(obj, operator, EXTEND_MODE): looplen[0] += (me_verts[ed[0]].co - me_verts[ed[1]].co).length looplen[0] = looplen[0] / len(loop) - # remove seams, so we dont map accross seams. + # remove seams, so we don't map across seams. for ed in me.edges: if ed.use_seam: # remove the edge pair if we can @@ -213,7 +213,7 @@ def extend(obj, operator, EXTEND_MODE): face_modes[i] = 1 # we can map from this one now. ok = True # keep searching - face_modes[i] = 2 # dont search again + face_modes[i] = 2 # don't search again if is_editmode: bpy.ops.object.mode_set(mode='EDIT') diff --git a/release/scripts/startup/bl_operators/uvcalc_lightmap.py b/release/scripts/startup/bl_operators/uvcalc_lightmap.py index d9cdb1794c2..52548817620 100644 --- a/release/scripts/startup/bl_operators/uvcalc_lightmap.py +++ b/release/scripts/startup/bl_operators/uvcalc_lightmap.py @@ -36,7 +36,7 @@ class prettyface(object): def __init__(self, data): self.has_parent = False - self.rot = False # only used for triables + self.rot = False # only used for triangles self.xoff = 0 self.yoff = 0 @@ -157,7 +157,7 @@ class prettyface(object): angles_co.sort() I = [i for a, i in angles_co] - # fuv = f.uv + #~ fuv = f.uv fuv = f.id_data.uv_textures.active.data[f.index].uv # XXX25 if self.rot: @@ -200,8 +200,8 @@ def lightmap_uvpack(meshes, ''' BOX_DIV if the maximum division of the UV map that a box may be consolidated into. - Basicly, a lower value will be slower but waist less space - and a higher value will have more clumpy boxes but more waisted space + Basically, a lower value will be slower but waist less space + and a higher value will have more clumpy boxes but more wasted space ''' import time from math import sqrt @@ -321,7 +321,7 @@ def lightmap_uvpack(meshes, lengths.append(curr_len) curr_len = curr_len / 2.0 - # Dont allow boxes smaller then the margin + # Don't allow boxes smaller then the margin # since we contract on the margin, boxes that are smaller will create errors # print(curr_len, side_len/MARGIN_DIV) if curr_len / 4.0 < side_len / PREF_MARGIN_DIV: @@ -371,9 +371,9 @@ def lightmap_uvpack(meshes, print("...done") # Since the boxes are sized in powers of 2, we can neatly group them into bigger squares - # this is done hierarchily, so that we may avoid running the pack function + # this is done hierarchically, so that we may avoid running the pack function # on many thousands of boxes, (under 1k is best) because it would get slow. - # Using an off and even dict us usefull because they are packed differently + # Using an off and even dict us useful because they are packed differently # where w/h are the same, their packed in groups of 4 # where they are different they are packed in pairs # @@ -393,14 +393,14 @@ def lightmap_uvpack(meshes, # Count the number of boxes consolidated, only used for stats. c = 0 - # This is tricky. the total area of all packed boxes, then squt that to get an estimated size + # This is tricky. the total area of all packed boxes, then sqrt() that to get an estimated size # this is used then converted into out INT space so we can compare it with # the ints assigned to the boxes size - # and divided by BOX_DIV, basicly if BOX_DIV is 8 - # ...then the maximum box consolidataion (recursive grouping) will have a max width & height + # and divided by BOX_DIV, basically if BOX_DIV is 8 + # ...then the maximum box consolidation (recursive grouping) will have a max width & height # ...1/8th of the UV size. # ...limiting this is needed or you end up with bug unused texture spaces - # ...however if its too high, boxpacking is way too slow for high poly meshes. + # ...however if its too high, box-packing is way too slow for high poly meshes. float_to_int_factor = lengths_to_ints[0][0] if float_to_int_factor > 0: max_int_dimension = int(((side_len / float_to_int_factor)) / PREF_BOX_DIV) @@ -409,7 +409,7 @@ def lightmap_uvpack(meshes, max_int_dimension = 0.0 # wont be used ok = False - # RECURSIVE prettyface grouping + # RECURSIVE pretty face grouping while ok: ok = False @@ -456,7 +456,7 @@ def lightmap_uvpack(meshes, pretty_faces = [pf for pf in pretty_faces if not pf.has_parent] - # spin every second prettyface + # spin every second pretty-face # if there all vertical you get less efficiently used texture space i = len(pretty_faces) d = 0 diff --git a/release/scripts/startup/bl_operators/uvcalc_smart_project.py b/release/scripts/startup/bl_operators/uvcalc_smart_project.py index 5985a37a0c9..1248fc24ed7 100644 --- a/release/scripts/startup/bl_operators/uvcalc_smart_project.py +++ b/release/scripts/startup/bl_operators/uvcalc_smart_project.py @@ -34,7 +34,7 @@ USER_FILL_HOLES_QUALITY = None def pointInTri2D(v, v1, v2, v3): key = v1.x, v1.y, v2.x, v2.y, v3.x, v3.y - # Commented because its slower to do the bounds check, we should realy cache the bounds info for each face. + # Commented because its slower to do the bounds check, we should really cache the bounds info for each face. ''' # BOUNDS CHECK xmin= 1000000 @@ -119,7 +119,7 @@ def boundsEdgeLoop(edges): """ # Turns the islands into a list of unpordered edges (Non internal) -# Onlt for UV's +# Only for UV's # only returns outline edges for intersection tests. and unique points. def island2Edge(island): @@ -141,7 +141,7 @@ def island2Edge(island): else: i1= vIdx; i2= vIdx-1 - try: edges[ f_uvkey[i1], f_uvkey[i2] ] *= 0 # sets eny edge with more then 1 user to 0 are not returned. + try: edges[ f_uvkey[i1], f_uvkey[i2] ] *= 0 # sets any edge with more then 1 user to 0 are not returned. except: edges[ f_uvkey[i1], f_uvkey[i2] ] = (f.uv[i1] - f.uv[i2]).length, # If 2 are the same then they will be together, but full [a,b] order is not correct. @@ -162,10 +162,10 @@ def island2Edge(island): return length_sorted_edges, [v.to_3d() for v in unique_points.values()] # ========================= NOT WORKING???? -# Find if a points inside an edge loop, un-orderd. +# Find if a points inside an edge loop, un-ordered. # pt is and x/y # edges are a non ordered loop of edges. -# #offsets are the edge x and y offset. +# offsets are the edge x and y offset. """ def pointInEdges(pt, edges): # @@ -223,7 +223,7 @@ def islandIntersectUvIsland(source, target, SourceOffset): if pointInIsland(pv+SourceOffset, target[0]): return 2 # SOURCE INSIDE TARGET - # 2 test for a part of the target being totaly inside the source. + # 2 test for a part of the target being totally inside the source. for pv in target[7]: if pointInIsland(pv-SourceOffset, source[0]): return 3 # PART OF TARGET INSIDE SOURCE. @@ -242,7 +242,7 @@ def testNewVecLs2DRotIsBetter(vecs, mat=-1, bestAreaSoFar = -1): for i, v in enumerate(vecs): - # Do this allong the way + # Do this along the way if mat != -1: v = vecs[i] = mat * v x= v.x @@ -252,7 +252,7 @@ def testNewVecLs2DRotIsBetter(vecs, mat=-1, bestAreaSoFar = -1): if x>maxx: maxx= x if y>maxy: maxy= y - # Spesific to this algo, bail out if we get bigger then the current area + # Specific to this algo, bail out if we get bigger then the current area if bestAreaSoFar != -1 and (maxx-minx) * (maxy-miny) > bestAreaSoFar: return (BIG_NUM, None), None w = maxx-minx @@ -262,7 +262,7 @@ def testNewVecLs2DRotIsBetter(vecs, mat=-1, bestAreaSoFar = -1): def optiRotateUvIsland(faces): global currentArea - # Bestfit Rotation + # Best-fit Rotation def best2dRotation(uvVecs, MAT1, MAT2): global currentArea @@ -318,7 +318,7 @@ def optiRotateUvIsland(faces): currentArea = newAreaPos # 45d done - # Testcase different rotations and find the onfe that best fits in a square + # Testcase different rotations and find the one that best fits in a square for ROTMAT in RotMatStepRotation: uvVecs = best2dRotation(uvVecs, ROTMAT[0], ROTMAT[1]) @@ -409,7 +409,7 @@ def mergeUvIslands(islandList): BREAK= False while areaIslandIdx < len(decoratedIslandListAreaSort) and not BREAK: sourceIsland = decoratedIslandListAreaSort[areaIslandIdx] - # Alredy packed? + # Already packed? if not sourceIsland[0]: areaIslandIdx+=1 else: @@ -420,7 +420,7 @@ def mergeUvIslands(islandList): BREAK= True break - # Now we have 2 islands, is the efficience of the islands lowers theres an + # Now we have 2 islands, if the efficiency of the islands lowers theres an # increasing likely hood that we can fit merge into the bigger UV island. # this ensures a tight fit. @@ -435,12 +435,12 @@ def mergeUvIslands(islandList): pass else: - # ([island, totFaceArea, efficiency, islandArea, w,h]) - # Waisted space on target is greater then UV bounding island area. + #~ ([island, totFaceArea, efficiency, islandArea, w,h]) + # Wasted space on target is greater then UV bounding island area. - # if targetIsland[3] > (sourceIsland[2]) and\ # - # print USER_FREE_SPACE_TO_TEST_QUALITY + #~ if targetIsland[3] > (sourceIsland[2]) and\ # + #~ print USER_FREE_SPACE_TO_TEST_QUALITY if targetIsland[2] > (sourceIsland[1] * USER_FREE_SPACE_TO_TEST_QUALITY) and\ targetIsland[4] > sourceIsland[4] and\ targetIsland[5] > sourceIsland[5]: @@ -456,7 +456,7 @@ def mergeUvIslands(islandList): boxLeft = 0 - # Distllllance we can move between whilst staying inside the targets bounds. + # Distance we can move between whilst staying inside the targets bounds. testWidth = targetIsland[4] - sourceIsland[4] testHeight = targetIsland[5] - sourceIsland[5] @@ -474,25 +474,25 @@ def mergeUvIslands(islandList): boxLeft = 0 # Start 1 back so we can jump into the loop. boxBottom= 0 #-yIncrement - ##testcount= 0 + #~ testcount= 0 while boxBottom <= testHeight: # Should we use this? - not needed for now. - #if Window.GetKeyQualifiers() & ctrl: - # BREAK= True - # break + #~ if Window.GetKeyQualifiers() & ctrl: + #~ BREAK= True + #~ break ##testcount+=1 #print 'Testing intersect' Intersect = islandIntersectUvIsland(sourceIsland, targetIsland, Vector((boxLeft, boxBottom))) #print 'Done', Intersect - if Intersect == 1: # Line intersect, dont bother with this any more + if Intersect == 1: # Line intersect, don't bother with this any more pass if Intersect == 2: # Source inside target ''' We have an intersection, if we are inside the target - then move us 1 whole width accross, + then move us 1 whole width across, Its possible this is a bad idea since 2 skinny Angular faces could join without 1 whole move, but its a lot more optimal to speed this up since we have already tested for it. @@ -500,7 +500,7 @@ def mergeUvIslands(islandList): It gives about 10% speedup with minimal errors. ''' #print 'ass' - # Move the test allong its width + SMALL_NUM + # Move the test along its width + SMALL_NUM #boxLeft += sourceIsland[4] + SMALL_NUM boxLeft += sourceIsland[4] elif Intersect == 0: # No intersection?? Place it. @@ -551,7 +551,7 @@ def mergeUvIslands(islandList): break - # INCREMENR NEXT LOCATION + # INCREMENT NEXT LOCATION if boxLeft > testWidth: boxBottom += yIncrement boxLeft = 0.0 @@ -572,8 +572,8 @@ def mergeUvIslands(islandList): # Takes groups of faces. assumes face groups are UV groups. def getUvIslands(faceGroups, me): - # Get seams so we dont cross over seams - edge_seams = {} # shoudl be a set + # Get seams so we don't cross over seams + edge_seams = {} # should be a set for ed in me.edges: if ed.use_seam: edge_seams[ed.key] = None # dummy var- use sets! @@ -609,7 +609,7 @@ def getUvIslands(faceGroups, me): # Modes # 0 - face not yet touched. # 1 - added to island list, and need to search - # 2 - touched and searched - dont touch again. + # 2 - touched and searched - don't touch again. face_modes = [0] * len(faces) # initialize zero - untested. face_modes[0] = 1 # start the search with face 1 @@ -633,7 +633,7 @@ def getUvIslands(faceGroups, me): face_modes[ii] = ok = 1 # mark as searched newIsland.append(faces[ii]) - # mark as searched, dont look again. + # mark as searched, don't look again. face_modes[i] = 2 islandList.append(newIsland) @@ -664,8 +664,8 @@ def packIslands(islandList): # Now we have UV islands, we need to pack them. - # Make a synchronised list with the islands - # so we can box pak the islands. + # Make a synchronized list with the islands + # so we can box pack the islands. packBoxes = [] # Keep a list of X/Y offset so we can save time by writing the @@ -716,14 +716,14 @@ def packIslands(islandList): # print 'Box Packing Time:', time.time() - time1 #if len(pa ckedLs) != len(islandList): - # raise "Error packed boxes differes from original length" + # raise "Error packed boxes differs from original length" #print '\tWriting Packed Data to faces' #XXX Window.DrawProgressBar(0.8, 'Writing Packed Data to faces') # Sort by ID, so there in sync again islandIdx = len(islandList) - # Having these here avoids devide by 0 + # Having these here avoids divide by 0 if islandIdx: if USER_STRETCH_ASPECT: @@ -845,9 +845,9 @@ def main(context, time.sleep(10) ''' -#XXX if not Draw.PupBlock(ob % len(obList), pup_block): -#XXX return -#XXX del ob +#~ XXX if not Draw.PupBlock(ob % len(obList), pup_block): +#~ XXX return +#~ XXX del ob # Convert from being button types @@ -859,10 +859,10 @@ def main(context, is_editmode = (context.active_object.mode == 'EDIT') if is_editmode: bpy.ops.object.mode_set(mode='OBJECT') - # Assume face select mode! an annoying hack to toggle face select mode because Mesh dosent like faceSelectMode. + # Assume face select mode! an annoying hack to toggle face select mode because Mesh doesn't like faceSelectMode. if USER_SHARE_SPACE: - # Sort by data name so we get consistant results + # Sort by data name so we get consistent results obList.sort(key = lambda ob: ob.data.name) collected_islandList= [] @@ -870,7 +870,7 @@ def main(context, time1 = time.time() - # Tag as False se we dont operate on the same mesh twice. + # Tag as False so we don't operate on the same mesh twice. #XXX bpy.data.meshes.tag = False for me in bpy.data.meshes: me.tag = False @@ -885,7 +885,7 @@ def main(context, # Tag as used me.tag = True - if not me.uv_textures: # Mesh has no UV Coords, dont bother. + if not me.uv_textures: # Mesh has no UV Coords, don't bother. me.uv_textures.new() uv_layer = me.uv_textures.active.data @@ -902,7 +902,7 @@ def main(context, #XXX Window.DrawProgressBar(0.1, 'SmartProj UV Unwrapper, mapping "%s", %i faces.' % (me.name, len(meshFaces))) # ======= - # Generate a projection list from face normals, this is ment to be smart :) + # Generate a projection list from face normals, this is meant to be smart :) # make a list of face props that are in sync with meshFaces # Make a Face List that is sorted by area. @@ -928,7 +928,7 @@ def main(context, # Initialize projectVecs if USER_VIEW_INIT: # Generate Projection - projectVecs = [Vector(Window.GetViewVector()) * ob.matrix_world.inverted().to_3x3()] # We add to this allong the way + projectVecs = [Vector(Window.GetViewVector()) * ob.matrix_world.inverted().to_3x3()] # We add to this along the way else: projectVecs = [] @@ -936,7 +936,7 @@ def main(context, newProjectMeshFaces = [] # Popping stuffs it up. - # Predent that the most unique angke is ages away to start the loop off + # Pretend that the most unique angle is ages away to start the loop off mostUniqueAngle = -1.0 # This is popped @@ -950,7 +950,7 @@ def main(context, # add all the faces that are close. for fIdx in range(len(tempMeshFaces)-1, -1, -1): - # Use half the angle limit so we dont overweight faces towards this + # Use half the angle limit so we don't overweight faces towards this # normal and hog all the faces. if newProjectVec.dot(tempMeshFaces[fIdx].no) > USER_PROJECTION_LIMIT_HALF_CONVERTED: newProjectMeshFaces.append(tempMeshFaces.pop(fIdx)) diff --git a/release/scripts/startup/bl_operators/vertexpaint_dirt.py b/release/scripts/startup/bl_operators/vertexpaint_dirt.py index 4c78adb7161..ce4942ae238 100644 --- a/release/scripts/startup/bl_operators/vertexpaint_dirt.py +++ b/release/scripts/startup/bl_operators/vertexpaint_dirt.py @@ -16,7 +16,7 @@ # along with this program; if not, write to the Free Software Foundation, # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # -# ***** END GPL LICENCE BLOCK ***** +# ***** END GPL LICENSE BLOCK ***** # -------------------------------------------------------------------------- # @@ -69,7 +69,7 @@ def applyVertexDirt(me, blur_iterations, blur_strength, clamp_dirt, clamp_clean, vec /= tot_con - # angle is the acos of the dot product between vert and connected verts normals + # angle is the acos() of the dot product between vert and connected verts normals ang = acos(no.dot(vec)) # enforce min/max diff --git a/release/scripts/startup/bl_operators/view3d.py b/release/scripts/startup/bl_operators/view3d.py index 05b53219119..315b7e5c4fc 100644 --- a/release/scripts/startup/bl_operators/view3d.py +++ b/release/scripts/startup/bl_operators/view3d.py @@ -33,7 +33,7 @@ class VIEW3D_OT_edit_mesh_extrude_individual_move(Operator): totface = mesh.total_face_sel totedge = mesh.total_edge_sel - # totvert = mesh.total_vert_sel + #~ totvert = mesh.total_vert_sel if select_mode[2] and totface == 1: bpy.ops.mesh.extrude_region_move('INVOKE_REGION_WIN', @@ -65,7 +65,7 @@ class VIEW3D_OT_edit_mesh_extrude_move(Operator): totface = mesh.total_face_sel totedge = mesh.total_edge_sel - # totvert = mesh.total_vert_sel + #~ totvert = mesh.total_vert_sel if totface >= 1: bpy.ops.mesh.extrude_region_move('INVOKE_REGION_WIN', diff --git a/release/scripts/startup/bl_operators/wm.py b/release/scripts/startup/bl_operators/wm.py index 85e79914ce3..63104ca00c3 100644 --- a/release/scripts/startup/bl_operators/wm.py +++ b/release/scripts/startup/bl_operators/wm.py @@ -70,7 +70,7 @@ def context_path_validate(context, data_path): # One of the items in the rna path is None, just ignore this value = Ellipsis else: - # We have a real error in the rna path, dont ignore that + # We have a real error in the rna path, don't ignore that raise return value @@ -103,7 +103,7 @@ def operator_value_is_undo(value): def operator_path_is_undo(context, data_path): # note that if we have data paths that use strings this could fail - # luckily we dont do this! + # luckily we don't do this! # # When we cant find the data owner assume no undo is needed. data_path_head, data_path_sep, data_path_tail = data_path.rpartition(".") @@ -425,7 +425,7 @@ class WM_OT_context_cycle_enum(Operator): rna_struct_str, rna_prop_str = data_path.rsplit('.', 1) i = rna_prop_str.find('[') - # just incse we get "context.foo.bar[0]" + # just in case we get "context.foo.bar[0]" if i != -1: rna_prop_str = rna_prop_str[0:i] @@ -820,8 +820,7 @@ class WM_OT_doc_view(Operator): class_name = rna_parent.identifier rna_parent = rna_parent.base - # It so happens that epydoc nests these, not sphinx - # class_name_full = self._nested_class_string(class_name) + #~ class_name_full = self._nested_class_string(class_name) url = ("%s/bpy.types.%s.html#bpy.types.%s.%s" % (self._prefix, class_name, class_name, class_prop)) @@ -1014,7 +1013,7 @@ class WM_OT_properties_edit(Operator): item = eval("context.%s" % data_path) # setup defaults - prop_ui = rna_idprop_ui_prop_get(item, self.property, False) # dont create + prop_ui = rna_idprop_ui_prop_get(item, self.property, False) # don't create if prop_ui: self.min = prop_ui.get("min", -1000000000) self.max = prop_ui.get("max", 1000000000) @@ -1171,7 +1170,7 @@ class WM_OT_copy_prev_settings(Operator): shutil.rmtree(os.path.join(path_dst, 'scripts')) shutil.rmtree(os.path.join(path_dst, 'plugins')) - # dont loose users work if they open the splash later. + # don't loose users work if they open the splash later. if bpy.data.is_saved is bpy.data.is_dirty is False: bpy.ops.wm.read_homefile() else: @@ -1372,9 +1371,9 @@ class WM_OT_keyitem_add(Operator): km = context.keymap if km.is_modal: - km.keymap_items.new_modal("", 'A', 'PRESS') # kmi + km.keymap_items.new_modal("", 'A', 'PRESS') #~ kmi else: - km.keymap_items.new("none", 'A', 'PRESS') # kmi + km.keymap_items.new("none", 'A', 'PRESS') #~ kmi # clear filter and expand keymap so we can see the newly added item if context.space_data.filter_text != "": @@ -1556,7 +1555,7 @@ class WM_OT_addon_install(Operator): pyfile = self.filepath if self.target == 'DEFAULT': - # dont use bpy.utils.script_paths("addons") because we may not be able to write to it. + # don't use bpy.utils.script_paths("addons") because we may not be able to write to it. path_addons = bpy.utils.user_resource('SCRIPTS', "addons", create=True) else: path_addons = bpy.context.user_preferences.filepaths.script_directory @@ -1637,7 +1636,7 @@ class WM_OT_addon_install(Operator): addons_new.discard("modules") # disable any addons we may have enabled previously and removed. - # this is unlikely but do just incase. bug [#23978] + # this is unlikely but do just in case. bug [#23978] for new_addon in addons_new: addon_utils.disable(new_addon) @@ -1652,11 +1651,11 @@ class WM_OT_addon_install(Operator): context.window_manager.addon_search = info["name"] break - # incase a new module path was created to install this addon. + # in case a new module path was created to install this addon. bpy.utils.refresh_script_paths() # TODO, should not be a warning. - # self.report({'WARNING'}, "File installed to '%s'\n" % path_dest) + #~ self.report({'WARNING'}, "File installed to '%s'\n" % path_dest) return {'FINISHED'} def invoke(self, context, event): @@ -1699,7 +1698,7 @@ class WM_OT_addon_remove(Operator): self.report('WARNING', "Addon path %r could not be found" % path) return {'CANCELLED'} - # incase its enabled + # in case its enabled addon_utils.disable(self.module) import shutil diff --git a/release/scripts/startup/bl_ui/properties_animviz.py b/release/scripts/startup/bl_ui/properties_animviz.py index 3b33a7ccc61..93feb8adc7a 100644 --- a/release/scripts/startup/bl_ui/properties_animviz.py +++ b/release/scripts/startup/bl_ui/properties_animviz.py @@ -21,8 +21,8 @@ # Generic Panels (Independent of DataType) # NOTE: -# The specialised panel types are derived in their respective UI modules -# dont register these classes since they are only helpers. +# The specialized panel types are derived in their respective UI modules +# don't register these classes since they are only helpers. class MotionPathButtonsPanel(): diff --git a/release/scripts/startup/bl_ui/properties_data_armature.py b/release/scripts/startup/bl_ui/properties_data_armature.py index e4744fdb04f..5dadcba2621 100644 --- a/release/scripts/startup/bl_ui/properties_data_armature.py +++ b/release/scripts/startup/bl_ui/properties_data_armature.py @@ -214,7 +214,7 @@ class DATA_PT_pose_library(ArmatureButtonsPanel, Panel): layout.prop(pose_marker_active, "name") -# TODO: this panel will soon be depreceated too +# TODO: this panel will soon be deprecated deprecated too class DATA_PT_ghost(ArmatureButtonsPanel, Panel): bl_label = "Ghost" @@ -301,7 +301,7 @@ class DATA_PT_motion_paths(MotionPathButtonsPanel, Panel): @classmethod def poll(cls, context): - # XXX: include posemode check? + # XXX: include pose-mode check? return (context.object) and (context.armature) def draw(self, context): @@ -324,7 +324,7 @@ class DATA_PT_onion_skinning(OnionSkinButtonsPanel): # , Panel): # inherit from @classmethod def poll(cls, context): - # XXX: include posemode check? + # XXX: include pose-mode check? return (context.object) and (context.armature) def draw(self, context): diff --git a/release/scripts/startup/bl_ui/properties_data_bone.py b/release/scripts/startup/bl_ui/properties_data_bone.py index b3eaf88d5bf..807e5e63bc5 100644 --- a/release/scripts/startup/bl_ui/properties_data_bone.py +++ b/release/scripts/startup/bl_ui/properties_data_bone.py @@ -189,7 +189,7 @@ class BONE_PT_display(BoneButtonsPanel, Panel): return context.bone def draw(self, context): - # note. this works ok in editmode but isnt + # note. this works ok in edit-mode but isn't # all that useful so disabling for now. layout = self.layout diff --git a/release/scripts/startup/bl_ui/properties_material.py b/release/scripts/startup/bl_ui/properties_material.py index 5b00402520e..62cb735fda9 100644 --- a/release/scripts/startup/bl_ui/properties_material.py +++ b/release/scripts/startup/bl_ui/properties_material.py @@ -87,7 +87,7 @@ class MATERIAL_PT_context_material(MaterialButtonsPanel, Panel): @classmethod def poll(cls, context): - # An exception, dont call the parent poll func because + # An exception, don't call the parent poll func because # this manages materials for all engine types engine = context.scene.render.engine @@ -537,7 +537,7 @@ class MATERIAL_PT_halo(MaterialButtonsPanel, Panel): def draw(self, context): layout = self.layout - mat = context.material # dont use node material + mat = context.material # don't use node material halo = mat.halo def number_but(layout, toggle, number, name, color): @@ -595,7 +595,7 @@ class MATERIAL_PT_flare(MaterialButtonsPanel, Panel): def draw(self, context): layout = self.layout - mat = context.material # dont use node material + mat = context.material # don't use node material halo = mat.halo layout.active = halo.use_flare_mode @@ -622,7 +622,7 @@ class MATERIAL_PT_game_settings(MaterialButtonsPanel, bpy.types.Panel): def draw(self, context): layout = self.layout - game = context.material.game_settings # dont use node material + game = context.material.game_settings # don't use node material row = layout.row() row.prop(game, "use_backface_culling") @@ -653,7 +653,7 @@ class MATERIAL_PT_physics(MaterialButtonsPanel, bpy.types.Panel): layout = self.layout layout.active = context.material.game_settings.physics - phys = context.material.physics # dont use node material + phys = context.material.physics # don't use node material split = layout.split() row = split.row() @@ -686,7 +686,7 @@ class MATERIAL_PT_strand(MaterialButtonsPanel, Panel): def draw(self, context): layout = self.layout - mat = context.material # dont use node material + mat = context.material # don't use node material tan = mat.strand split = layout.split() @@ -862,7 +862,7 @@ class MATERIAL_PT_volume_density(VolumeButtonsPanel, Panel): def draw(self, context): layout = self.layout - vol = context.material.volume # dont use node material + vol = context.material.volume # don't use node material row = layout.row() row.prop(vol, "density") @@ -876,7 +876,7 @@ class MATERIAL_PT_volume_shading(VolumeButtonsPanel, Panel): def draw(self, context): layout = self.layout - vol = context.material.volume # dont use node material + vol = context.material.volume # don't use node material split = layout.split() @@ -901,7 +901,7 @@ class MATERIAL_PT_volume_lighting(VolumeButtonsPanel, Panel): def draw(self, context): layout = self.layout - vol = context.material.volume # dont use node material + vol = context.material.volume # don't use node material split = layout.split() @@ -942,7 +942,7 @@ class MATERIAL_PT_volume_transp(VolumeButtonsPanel, Panel): def draw(self, context): layout = self.layout - mat = context.material # dont use node material + mat = context.material # don't use node material layout.prop(mat, "transparency_method", expand=True) @@ -954,7 +954,7 @@ class MATERIAL_PT_volume_integration(VolumeButtonsPanel, Panel): def draw(self, context): layout = self.layout - vol = context.material.volume # dont use node material + vol = context.material.volume # don't use node material split = layout.split() diff --git a/release/scripts/startup/bl_ui/properties_object_constraint.py b/release/scripts/startup/bl_ui/properties_object_constraint.py index 05fac2026a0..dc19f58ca35 100644 --- a/release/scripts/startup/bl_ui/properties_object_constraint.py +++ b/release/scripts/startup/bl_ui/properties_object_constraint.py @@ -658,7 +658,7 @@ class ConstraintButtonsPanel(): row.label(text="Source to Destination Mapping:") # note: chr(187) is the ASCII arrow ( >> ). Blender Text Editor can't - # open it. Thus we are using the hardcoded value instead. + # open it. Thus we are using the hard-coded value instead. row = col.row() row.prop(con, "map_to_x_from", expand=False, text="") row.label(text=" %s X" % chr(187)) diff --git a/release/scripts/startup/bl_ui/properties_physics_common.py b/release/scripts/startup/bl_ui/properties_physics_common.py index 204e25d9f01..64dad98d99a 100644 --- a/release/scripts/startup/bl_ui/properties_physics_common.py +++ b/release/scripts/startup/bl_ui/properties_physics_common.py @@ -76,7 +76,7 @@ class PHYSICS_PT_add(PhysicButtonsPanel, Panel): physics_add(self, col, context.smoke, "Smoke", 'SMOKE', 'MOD_SMOKE', True) -#cachetype can be 'PSYS' 'HAIR' 'SMOKE' etc +# cache-type can be 'PSYS' 'HAIR' 'SMOKE' etc def point_cache_ui(self, context, cache, enabled, cachetype): layout = self.layout diff --git a/release/scripts/startup/bl_ui/properties_texture.py b/release/scripts/startup/bl_ui/properties_texture.py index 34f5a948ee7..73947c21a80 100644 --- a/release/scripts/startup/bl_ui/properties_texture.py +++ b/release/scripts/startup/bl_ui/properties_texture.py @@ -927,9 +927,9 @@ class TEXTURE_PT_influence(TextureSlotPanel, Panel): factor_but(col, "use_map_warp", "warp_factor", "Warp") factor_but(col, "use_map_displacement", "displacement_factor", "Displace") - #sub = col.column() - #sub.active = tex.use_map_translucency or tex.map_emit or tex.map_alpha or tex.map_raymir or tex.map_hardness or tex.map_ambient or tex.map_specularity or tex.map_reflection or tex.map_mirror - #sub.prop(tex, "default_value", text="Amount", slider=True) + #~ sub = col.column() + #~ sub.active = tex.use_map_translucency or tex.map_emit or tex.map_alpha or tex.map_raymir or tex.map_hardness or tex.map_ambient or tex.map_specularity or tex.map_reflection or tex.map_mirror + #~ sub.prop(tex, "default_value", text="Amount", slider=True) elif idblock.type == 'HALO': layout.label(text="Halo:") @@ -1014,7 +1014,7 @@ class TEXTURE_PT_influence(TextureSlotPanel, Panel): col = split.column() col.prop(tex, "blend_type", text="Blend") col.prop(tex, "use_rgb_to_intensity") - # color is used on grayscale textures even when use_rgb_to_intensity is disabled. + # color is used on gray-scale textures even when use_rgb_to_intensity is disabled. col.prop(tex, "color", text="") col = split.column() @@ -1027,14 +1027,14 @@ class TEXTURE_PT_influence(TextureSlotPanel, Panel): if isinstance(idblock, bpy.types.Material): layout.label(text="Bump Mapping:") - # only show bump settings if activated but not for normalmap images + # only show bump settings if activated but not for normal-map images row = layout.row() sub = row.row() sub.active = (tex.use_map_normal or tex.use_map_warp) and not (tex.texture.type == 'IMAGE' and (tex.texture.use_normal_map or tex.texture.use_derivative_map)) sub.prop(tex, "bump_method", text="Method") - # the space setting is supported for: derivmaps + bumpmaps (DEFAULT,BEST_QUALITY), not for normalmaps + # the space setting is supported for: derivative-maps + bump-maps (DEFAULT,BEST_QUALITY), not for normal-maps sub = row.row() sub.active = (tex.use_map_normal or tex.use_map_warp) and not (tex.texture.type == 'IMAGE' and tex.texture.use_normal_map) and ((tex.bump_method in {'BUMP_DEFAULT', 'BUMP_BEST_QUALITY'}) or (tex.texture.type == 'IMAGE' and tex.texture.use_derivative_map)) sub.prop(tex, "bump_objectspace", text="Space") diff --git a/release/scripts/startup/bl_ui/space_logic.py b/release/scripts/startup/bl_ui/space_logic.py index 869a91124d3..1ae8095fab3 100644 --- a/release/scripts/startup/bl_ui/space_logic.py +++ b/release/scripts/startup/bl_ui/space_logic.py @@ -45,7 +45,7 @@ class LOGIC_PT_properties(Panel): row = box.row() row.prop(prop, "name", text="") row.prop(prop, "type", text="") - row.prop(prop, "value", text="", toggle=True) # we dont care about the type. rna will display correctly + row.prop(prop, "value", text="", toggle=True) # we don't care about the type. rna will display correctly row.prop(prop, "show_debug", text="", toggle=True, icon='INFO') row.operator("object.game_property_remove", text="", icon='X', emboss=False).index = i diff --git a/release/scripts/startup/bl_ui/space_userpref.py b/release/scripts/startup/bl_ui/space_userpref.py index 1ec6cc39164..96a08e57157 100644 --- a/release/scripts/startup/bl_ui/space_userpref.py +++ b/release/scripts/startup/bl_ui/space_userpref.py @@ -426,8 +426,8 @@ class USERPREF_PT_system(Panel): col.label(text="Anisotropic Filtering") col.prop(system, "anisotropic_filter", text="") col.prop(system, "use_vertex_buffer_objects") - #Anti-aliasing is disabled as it breaks broder/lasso select - #col.prop(system, "use_antialiasing") + # Anti-aliasing is disabled as it breaks border/lasso select + #~ col.prop(system, "use_antialiasing") col.label(text="Window Draw Method:") col.prop(system, "window_draw_method", text="") col.label(text="Text Draw Options:") diff --git a/release/scripts/startup/bl_ui/space_userpref_keymap.py b/release/scripts/startup/bl_ui/space_userpref_keymap.py index c2e3a145f36..2c537efa61b 100644 --- a/release/scripts/startup/bl_ui/space_userpref_keymap.py +++ b/release/scripts/startup/bl_ui/space_userpref_keymap.py @@ -262,7 +262,7 @@ class InputKeyMapPanel: row = subcol.row(align=True) - #row.prop_search(wm.keyconfigs, "active", wm, "keyconfigs", text="Key Config:") + #~ row.prop_search(wm.keyconfigs, "active", wm, "keyconfigs", text="Key Config:") text = bpy.path.display_name(context.window_manager.keyconfigs.active.name) if not text: text = "Blender (default)" @@ -270,8 +270,8 @@ class InputKeyMapPanel: row.operator("wm.keyconfig_preset_add", text="", icon="ZOOMIN") row.operator("wm.keyconfig_preset_add", text="", icon="ZOOMOUT").remove_active = True -# layout.context_pointer_set("keyconfig", wm.keyconfigs.active) -# row.operator("wm.keyconfig_remove", text="", icon='X') + #~ layout.context_pointer_set("keyconfig", wm.keyconfigs.active) + #~ row.operator("wm.keyconfig_remove", text="", icon='X') row.prop(context.space_data, "filter_text", icon="VIEWZOOM") diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py index ff6afa81e65..e4beee66871 100644 --- a/release/scripts/startup/bl_ui/space_view3d.py +++ b/release/scripts/startup/bl_ui/space_view3d.py @@ -1142,7 +1142,7 @@ class VIEW3D_MT_sculpt(Menu): layout.prop(sculpt, "use_threaded", text="Threaded Sculpt") layout.prop(sculpt, "show_brush") - # TODO, make availabel from paint menu! + # TODO, make available from paint menu! layout.prop(tool_settings, "sculpt_paint_use_unified_size", text="Unify Size") layout.prop(tool_settings, "sculpt_paint_use_unified_strength", text="Unify Strength") @@ -1413,7 +1413,7 @@ class BoneOptions: data_path_iter = "selected_bones" opt_suffix = "" options.append("lock") - else: # posemode + else: # pose-mode bone_props = bpy.types.Bone.bl_rna.properties data_path_iter = "selected_pose_bones" opt_suffix = "bone." @@ -2172,7 +2172,7 @@ class VIEW3D_PT_view3d_meshdisplay(Panel): @classmethod def poll(cls, context): - # The active object check is needed because of localmode + # The active object check is needed because of local-mode return (context.active_object and (context.mode == 'EDIT_MESH')) def draw(self, context): @@ -2233,7 +2233,7 @@ class VIEW3D_PT_background_image(Panel): @classmethod def poll(cls, context): view = context.space_data - # bg = context.space_data.background_image + #~ bg = context.space_data.background_image return (view) def draw_header(self, context): diff --git a/release/scripts/startup/bl_ui/space_view3d_toolbar.py b/release/scripts/startup/bl_ui/space_view3d_toolbar.py index 8f1833f952b..a78992d4a07 100644 --- a/release/scripts/startup/bl_ui/space_view3d_toolbar.py +++ b/release/scripts/startup/bl_ui/space_view3d_toolbar.py @@ -63,7 +63,7 @@ def draw_gpencil_tools(context, layout): row.prop(context.tool_settings, "use_grease_pencil_sessions") -# ********** default tools for objectmode **************** +# ********** default tools for object-mode **************** class VIEW3D_PT_tools_objectmode(View3DPanel, Panel): bl_context = "objectmode" @@ -385,7 +385,7 @@ class VIEW3D_PT_tools_latticeedit(View3DPanel, Panel): draw_gpencil_tools(context, layout) -# ********** default tools for posemode **************** +# ********** default tools for pose-mode **************** class VIEW3D_PT_tools_posemode(View3DPanel, Panel): @@ -1043,7 +1043,7 @@ class VIEW3D_PT_tools_brush_appearance(PaintPanel, Panel): row = col.row(align=True) row.prop(brush, "icon_filepath", text="") -# ********** default tools for weightpaint **************** +# ********** default tools for weight-paint **************** class VIEW3D_PT_tools_weightpaint(View3DPanel, Panel): @@ -1097,9 +1097,9 @@ class VIEW3D_PT_tools_weightpaint_options(View3DPanel, Panel): # col.prop(wpaint, "mul", text="") # Also missing now: -# Soft, Vgroup, X-Mirror and "Clear" Operator. +# Soft, Vertex-Group, X-Mirror and "Clear" Operator. -# ********** default tools for vertexpaint **************** +# ********** default tools for vertex-paint **************** class VIEW3D_PT_tools_vertexpaint(View3DPanel, Panel): @@ -1128,7 +1128,7 @@ class VIEW3D_PT_tools_vertexpaint(View3DPanel, Panel): # col.label(text="Multiply:") # col.prop(vpaint, "mul", text="") -# ********** default tools for texturepaint **************** +# ********** default tools for texture-paint **************** class VIEW3D_PT_tools_projectpaint(View3DPanel, Panel): diff --git a/release/scripts/templates/gamelogic_module.py b/release/scripts/templates/gamelogic_module.py index fcc8a8839c9..88c8cf0d75b 100644 --- a/release/scripts/templates/gamelogic_module.py +++ b/release/scripts/templates/gamelogic_module.py @@ -8,7 +8,7 @@ import bge # variables defined here will only be set once when the -# module is first imported. Set object spesific vars +# module is first imported. Set object specific vars # inside the function if you intend to use the module # with multiple objects. -- cgit v1.2.3 From 9a5921883eb240399690a4ee66b2a86f8f17a84e Mon Sep 17 00:00:00 2001 From: Jens Verwiebe Date: Mon, 17 Oct 2011 10:30:08 +0000 Subject: OSX: Start with OMP_NUM_THREADS default unchanged, to let the user decide about optimized value, default == all cores used --- source/darwin/blender.app/Contents/Info.plist | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/darwin/blender.app/Contents/Info.plist b/source/darwin/blender.app/Contents/Info.plist index 7fab4a98c4b..9aeb617a051 100644 --- a/source/darwin/blender.app/Contents/Info.plist +++ b/source/darwin/blender.app/Contents/Info.plist @@ -46,7 +46,7 @@ LSEnvironment OMP_NUM_THREADS - 2 + -- cgit v1.2.3 From 70abd2a304ffefb2590b914dc413f64874327298 Mon Sep 17 00:00:00 2001 From: Jens Verwiebe Date: Mon, 17 Oct 2011 10:41:47 +0000 Subject: OSX: omp script rework part1 --- .../set_simulation_threads.app/Contents/Info.plist | 44 --------------------- .../Contents/MacOS/applet | Bin 34480 -> 0 bytes .../set_simulation_threads.app/Contents/PkgInfo | 1 - .../Contents/Resources/Scripts/main.scpt | Bin 4696 -> 0 bytes .../Contents/Resources/applet.icns | Bin 40291 -> 0 bytes .../Contents/Resources/applet.rsrc | Bin 362 -> 0 bytes .../Contents/Resources/description.rtfd/TXT.rtf | 4 -- 7 files changed, 49 deletions(-) delete mode 100644 source/darwin/set_simulation_threads.app/Contents/Info.plist delete mode 100755 source/darwin/set_simulation_threads.app/Contents/MacOS/applet delete mode 100644 source/darwin/set_simulation_threads.app/Contents/PkgInfo delete mode 100644 source/darwin/set_simulation_threads.app/Contents/Resources/Scripts/main.scpt delete mode 100644 source/darwin/set_simulation_threads.app/Contents/Resources/applet.icns delete mode 100644 source/darwin/set_simulation_threads.app/Contents/Resources/applet.rsrc delete mode 100644 source/darwin/set_simulation_threads.app/Contents/Resources/description.rtfd/TXT.rtf diff --git a/source/darwin/set_simulation_threads.app/Contents/Info.plist b/source/darwin/set_simulation_threads.app/Contents/Info.plist deleted file mode 100644 index 71ec4a4d0c1..00000000000 --- a/source/darwin/set_simulation_threads.app/Contents/Info.plist +++ /dev/null @@ -1,44 +0,0 @@ - - - - - CFBundleAllowMixedLocalizations - - CFBundleDevelopmentRegion - English - CFBundleExecutable - applet - CFBundleIconFile - applet - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - set_simulation_threads - CFBundlePackageType - APPL - CFBundleSignature - aplt - LSMinimumSystemVersionByArchitecture - - x86_64 - 10.6 - - LSRequiresCarbon - - WindowState - - dividerCollapsed - - eventLogLevel - -1 - name - ScriptWindowState - positionOfDivider - 400 - savedFrame - 424 473 1435 704 0 0 1920 1178 - selectedTabView - result - - - diff --git a/source/darwin/set_simulation_threads.app/Contents/MacOS/applet b/source/darwin/set_simulation_threads.app/Contents/MacOS/applet deleted file mode 100755 index 0079f4b19d4..00000000000 Binary files a/source/darwin/set_simulation_threads.app/Contents/MacOS/applet and /dev/null differ diff --git a/source/darwin/set_simulation_threads.app/Contents/PkgInfo b/source/darwin/set_simulation_threads.app/Contents/PkgInfo deleted file mode 100644 index 3253614c402..00000000000 --- a/source/darwin/set_simulation_threads.app/Contents/PkgInfo +++ /dev/null @@ -1 +0,0 @@ -APPLaplt \ No newline at end of file diff --git a/source/darwin/set_simulation_threads.app/Contents/Resources/Scripts/main.scpt b/source/darwin/set_simulation_threads.app/Contents/Resources/Scripts/main.scpt deleted file mode 100644 index 7a0e345348c..00000000000 Binary files a/source/darwin/set_simulation_threads.app/Contents/Resources/Scripts/main.scpt and /dev/null differ diff --git a/source/darwin/set_simulation_threads.app/Contents/Resources/applet.icns b/source/darwin/set_simulation_threads.app/Contents/Resources/applet.icns deleted file mode 100644 index fcc1f09273d..00000000000 Binary files a/source/darwin/set_simulation_threads.app/Contents/Resources/applet.icns and /dev/null differ diff --git a/source/darwin/set_simulation_threads.app/Contents/Resources/applet.rsrc b/source/darwin/set_simulation_threads.app/Contents/Resources/applet.rsrc deleted file mode 100644 index 44dcf1a9f60..00000000000 Binary files a/source/darwin/set_simulation_threads.app/Contents/Resources/applet.rsrc and /dev/null differ diff --git a/source/darwin/set_simulation_threads.app/Contents/Resources/description.rtfd/TXT.rtf b/source/darwin/set_simulation_threads.app/Contents/Resources/description.rtfd/TXT.rtf deleted file mode 100644 index 0d0a60c08b5..00000000000 --- a/source/darwin/set_simulation_threads.app/Contents/Resources/description.rtfd/TXT.rtf +++ /dev/null @@ -1,4 +0,0 @@ -{\rtf1\ansi\ansicpg1252\cocoartf1138\cocoasubrtf230 -{\fonttbl} -{\colortbl;\red255\green255\blue255;} -} \ No newline at end of file -- cgit v1.2.3 From 3335cf41f66c01e6fe710de695595a5aaddc3e41 Mon Sep 17 00:00:00 2001 From: Jens Verwiebe Date: Mon, 17 Oct 2011 10:43:32 +0000 Subject: OSX: omp script rework part2 --- .../set_simulation_threads.app/Contents/Info.plist | 44 +++++++++++++++++++++ .../Contents/MacOS/applet | Bin 0 -> 34480 bytes .../set_simulation_threads.app/Contents/PkgInfo | 1 + .../Contents/Resources/Scripts/main.scpt | Bin 0 -> 4696 bytes .../Contents/Resources/applet.icns | Bin 0 -> 40291 bytes .../Contents/Resources/applet.rsrc | Bin 0 -> 362 bytes .../Contents/Resources/description.rtfd/TXT.rtf | 4 ++ .../darwin/set_simulation_threads_applescript.scpt | Bin 5140 -> 5144 bytes 8 files changed, 49 insertions(+) create mode 100644 source/darwin/set_simulation_threads.app/Contents/Info.plist create mode 100755 source/darwin/set_simulation_threads.app/Contents/MacOS/applet create mode 100644 source/darwin/set_simulation_threads.app/Contents/PkgInfo create mode 100644 source/darwin/set_simulation_threads.app/Contents/Resources/Scripts/main.scpt create mode 100644 source/darwin/set_simulation_threads.app/Contents/Resources/applet.icns create mode 100644 source/darwin/set_simulation_threads.app/Contents/Resources/applet.rsrc create mode 100644 source/darwin/set_simulation_threads.app/Contents/Resources/description.rtfd/TXT.rtf diff --git a/source/darwin/set_simulation_threads.app/Contents/Info.plist b/source/darwin/set_simulation_threads.app/Contents/Info.plist new file mode 100644 index 00000000000..44d6783599c --- /dev/null +++ b/source/darwin/set_simulation_threads.app/Contents/Info.plist @@ -0,0 +1,44 @@ + + + + + CFBundleAllowMixedLocalizations + + CFBundleDevelopmentRegion + English + CFBundleExecutable + applet + CFBundleIconFile + applet + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + set_simulation_threads + CFBundlePackageType + APPL + CFBundleSignature + aplt + LSMinimumSystemVersionByArchitecture + + x86_64 + 10.6 + + LSRequiresCarbon + + WindowState + + dividerCollapsed + + eventLogLevel + -1 + name + ScriptWindowState + positionOfDivider + 470 + savedFrame + 199 169 1197 810 0 0 1920 1178 + selectedTabView + result + + + diff --git a/source/darwin/set_simulation_threads.app/Contents/MacOS/applet b/source/darwin/set_simulation_threads.app/Contents/MacOS/applet new file mode 100755 index 00000000000..0079f4b19d4 Binary files /dev/null and b/source/darwin/set_simulation_threads.app/Contents/MacOS/applet differ diff --git a/source/darwin/set_simulation_threads.app/Contents/PkgInfo b/source/darwin/set_simulation_threads.app/Contents/PkgInfo new file mode 100644 index 00000000000..3253614c402 --- /dev/null +++ b/source/darwin/set_simulation_threads.app/Contents/PkgInfo @@ -0,0 +1 @@ +APPLaplt \ No newline at end of file diff --git a/source/darwin/set_simulation_threads.app/Contents/Resources/Scripts/main.scpt b/source/darwin/set_simulation_threads.app/Contents/Resources/Scripts/main.scpt new file mode 100644 index 00000000000..d905e27cb6d Binary files /dev/null and b/source/darwin/set_simulation_threads.app/Contents/Resources/Scripts/main.scpt differ diff --git a/source/darwin/set_simulation_threads.app/Contents/Resources/applet.icns b/source/darwin/set_simulation_threads.app/Contents/Resources/applet.icns new file mode 100644 index 00000000000..fcc1f09273d Binary files /dev/null and b/source/darwin/set_simulation_threads.app/Contents/Resources/applet.icns differ diff --git a/source/darwin/set_simulation_threads.app/Contents/Resources/applet.rsrc b/source/darwin/set_simulation_threads.app/Contents/Resources/applet.rsrc new file mode 100644 index 00000000000..54735c5cb04 Binary files /dev/null and b/source/darwin/set_simulation_threads.app/Contents/Resources/applet.rsrc differ diff --git a/source/darwin/set_simulation_threads.app/Contents/Resources/description.rtfd/TXT.rtf b/source/darwin/set_simulation_threads.app/Contents/Resources/description.rtfd/TXT.rtf new file mode 100644 index 00000000000..0d0a60c08b5 --- /dev/null +++ b/source/darwin/set_simulation_threads.app/Contents/Resources/description.rtfd/TXT.rtf @@ -0,0 +1,4 @@ +{\rtf1\ansi\ansicpg1252\cocoartf1138\cocoasubrtf230 +{\fonttbl} +{\colortbl;\red255\green255\blue255;} +} \ No newline at end of file diff --git a/source/darwin/set_simulation_threads_applescript.scpt b/source/darwin/set_simulation_threads_applescript.scpt index ba05af64178..82ea5357de5 100644 Binary files a/source/darwin/set_simulation_threads_applescript.scpt and b/source/darwin/set_simulation_threads_applescript.scpt differ -- cgit v1.2.3 From 2dc6ca49b32ef2a8d73855b1f10a841792b94216 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 17 Oct 2011 10:43:55 +0000 Subject: py docs: added python doc section on script performance and a note on relative file paths in the gotcha's page. also added script for spell checking py comments. --- doc/python_api/rst/info_best_practice.rst | 233 +++++++++++++++++++++++++++++- doc/python_api/rst/info_gotcha.rst | 20 +++ 2 files changed, 251 insertions(+), 2 deletions(-) diff --git a/doc/python_api/rst/info_best_practice.rst b/doc/python_api/rst/info_best_practice.rst index 2fbc636613c..2e5b5bd285c 100644 --- a/doc/python_api/rst/info_best_practice.rst +++ b/doc/python_api/rst/info_best_practice.rst @@ -2,8 +2,9 @@ Best Practice ************* +When writing you're own scripts python is great for new developers to pick up and become productive, but you can also pick up odd habits or at least write scripts that are not easy for others to understand. -TODO: Intro text +For you're own work this is of course fine, but if you want to collaborate with others or have you're work included with blender there are practices we encourage. Style Conventions @@ -61,5 +62,233 @@ TODO: Thomas Script Efficiency ================= -TODO: Campbell +List Manipulation (General Python Tips) +--------------------------------------- + +Searching for list items +^^^^^^^^^^^^^^^^^^^^^^^^ + +In Python there are some handy list functions that save you having to search through the list. + +Even though you're not looping on the list data **python is**, so you need to be aware of functions that will slow down your script by searching the whole list. + +.. code-block:: python + + my_list.count(list_item) + my_list.index(list_item) + my_list.remove(list_item) + if list_item in my_list: ... + + +Modifying Lists +^^^^^^^^^^^^^^^ +In python we can add and remove from a list, This is slower when the list length is modifier, especially at the start of the list, since all the data after the index of modification needs to be moved up or down 1 place. + +The most simple way to add onto the end of the list is to use ``my_list.append(list_item)`` or ``my_list.extend(some_list)`` and the fastest way to remove an item is ``my_list.pop()`` or ``del my_list[-1]``. + +To use an index you can use ``my_list.insert(index, list_item)`` or ``list.pop(index)`` for list removal, but these are slower. + +Sometimes its faster (but more memory hungry) to just rebuild the list. + + +Say you want to remove all triangle faces in a list. + +Rather than... + +.. code-block:: python + + faces = mesh.faces[:] # make a list copy of the meshes faces + f_idx = len(faces) # Loop backwards + while f_idx: # while the value is not 0 + f_idx -= 1 + + if len(faces[f_idx].vertices) == 3: + faces.pop(f_idx) # remove the triangle + + +It's faster to build a new list with list comprehension. + +.. code-block:: python + + faces = [f for f in mesh.faces if len(f.vertices) != 3] + + +Adding List Items +^^^^^^^^^^^^^^^^^ + +If you have a list that you want to add onto another list, rather then... + +.. code-block:: python + +for l in some_list: + my_list.append(l) + +Use... + +.. code-block:: python + + my_list.extend([a, b, c...]) + + +Note that insert can be used when needed, but it is slower than append especially when inserting at the start of a long list. + +This example shows a very sub-optimal way of making a reversed list. + + +.. code-block:: python + + reverse_list = [] + for list_item in some_list: + reverse_list.insert(0, list_item) + + +Removing List Items +^^^^^^^^^^^^^^^^^^^ + +Use ``my_list.pop(index)`` rather than ``my_list.remove(list_item)`` + +This requires you to have the index of the list item but is faster since ``remove()`` will search the list. + +Here is an example of how to remove items in 1 loop, removing the last items first, which is faster (as explained above). + +.. code-block:: python + + list_index = len(my_list) + + while list_index: + list_index -= 1 + if my_list[list_index].some_test_attribute == 1: + my_list.pop(list_index) + + +This example shows a fast way of removing items, for use in cases were where you can alter the list order without breaking the scripts functionality. This works by swapping 2 list items, so the item you remove is always last. + +.. code-block:: python + + pop_index = 5 + + # swap so the pop_index is last. + my_list[-1], my_list[pop_index] = my_list[pop_index], my_list[-1] + + # remove last item (pop_index) + my_list.pop() + + +When removing many items in a large list this can provide a good speedup. + + +Avoid Copying Lists +^^^^^^^^^^^^^^^^^^^ + +When passing a list/dictionary to a function, it is faster to have the function modify the list rather then returning a new list so python dosn't have tp duplicate the list in memory. + +Functions that modify a list in-place are more efficient then functions that create new lists. + + +This is generally slower so only use for functions when it makes sense not to modify the list in place. + +>>> my_list = some_list_func(my_list) + + +This is generally faster since there is no re-assignment and no list duplication. + +>>> some_list_func(vec) + + +Also note that passing a sliced list makes a copy of the list in python memory + +>>> foobar(my_list[:]) + +If my_list was a large array containing 10000's of items, a copy could use a lot of extra memory. + + +Writing Strings to a File (Python General) +------------------------------------------ + +Here are 3 ways of joining multiple strings into 1 string for writing + +This really applies to any area of your code that involves a lot of string joining. + + +Pythons string addition, *don't use if you can help it, especially when writing data in a loop.* + +>>> file.write(str1 + " " + str2 + " " + str3 + "\n") + + +String formatting. Use this when you're writing string data from floats and int's + +>>> file.write("%s %s %s\n" % (str1, str2, str3)) + + +Pythons string joining function. To join a list of strings + +>>> file.write(" ".join([str1, str2, str3, "\n"])) + + +join is fastest on many strings, string formatting is quite fast too (better for converting data types). String arithmetic is slowest. + + +Parsing Strings (Import/Exporting) +---------------------------------- + +Since many file formats are ASCII, the way you parse/export strings can make a large difference in how fast your script runs. + +When importing strings to make into blender there are a few ways to parse the string. + +Parsing Numbers +^^^^^^^^^^^^^^^ + +Use ``float(string)`` rather than ``eval(string)``, if you know the value will be an int then ``int(string)``, float() will work for an int too but its faster to read ints with int(). + +Checking String Start/End +^^^^^^^^^^^^^^^^^^^^^^^^^ + +If your checking the start of a string for a keyword, rather than... + +>>> if line[0:5] == "vert ": ... + +Use... + +>>> if line.startswith("vert "): + +Using ``startswith()`` is slightly faster (approx 5%) and also avoids a possible error with the slice length not matching the string length. + +my_string.endswith("foo_bar") can be used for line endings too. + +if your unsure whether the text is upper or lower case use lower or upper string function. + +>>> if line.lower().startswith("vert ") + + +Use try/except Sparingly +------------------------ + +The **try** statement useful to save time writing error checking code. + +However **try** is significantly slower then an **if** since an exception has to be set each time, so avoid using **try** in areas of your code that execute in a loop and runs many times. + +There are cases where using **try** is faster than checking weather the condition will raise an error, so it is worth experimenting. + + +Value Comparison +---------------- + +Python has two ways to compare values ``a == b`` and ``a is b``, The difference is that ``==`` may run the objects comparison function ``__cmp__()`` where as ``is`` compares identity, that both variables reference the same item in memory. + +In cases where you know you are checking for the same value which is referenced from multiple places, ``is`` is faster. + + +Time You're Code +---------------- + +While developing a script its good to time it to be aware of any changes in performance, this can be done simply. + +.. code-block:: python + + import time + time_start = time.time() + + # do something... + + print("My Script Finished: %.4f sec" % time.time() - time_start) diff --git a/doc/python_api/rst/info_gotcha.rst b/doc/python_api/rst/info_gotcha.rst index e7903dcf96a..b17debbb15c 100644 --- a/doc/python_api/rst/info_gotcha.rst +++ b/doc/python_api/rst/info_gotcha.rst @@ -223,6 +223,26 @@ While writing scripts that deal with armatures you may find you have to switch b This is mainly an issue with editmode since pose data can be manipulated without having to be in pose mode, however for operator access you may still need to enter pose mode. +Relative File Paths +=================== + +Blenders relative file paths are not compatible with standard python modules such as ``sys`` and ``os``. + +Built in python functions don't understand blenders ``//`` prefix which denotes the blend file path. + +A common case where you would run into this problem is when exporting a material with assosiated image paths. + +>>> bpy.path.abspath(image.filepath) + + +When using blender data from linked libraries there is an unfortunate complication since the path will be relative to the library rather then the open blend file. When the data block may be from an external blend file pass the library argument from the `bpy.types.ID`. + +>>> bpy.path.abspath(image.filepath, library=image.library) + + +These returns the absolute path which can be used with native python modules. + + Unicode Problems ================ -- cgit v1.2.3 From cc1ed7cbc503508c20a003b19ea569b575d328ed Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 17 Oct 2011 13:54:47 +0000 Subject: fix/update for credits script and bad formatting in sphinx docs. --- doc/python_api/rst/info_best_practice.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/python_api/rst/info_best_practice.rst b/doc/python_api/rst/info_best_practice.rst index 2e5b5bd285c..180a9fd1aa3 100644 --- a/doc/python_api/rst/info_best_practice.rst +++ b/doc/python_api/rst/info_best_practice.rst @@ -121,8 +121,8 @@ If you have a list that you want to add onto another list, rather then... .. code-block:: python -for l in some_list: - my_list.append(l) + for l in some_list: + my_list.append(l) Use... -- cgit v1.2.3 From ea314902479a66149e8e548768e715f84c1f3b6c Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 17 Oct 2011 14:44:21 +0000 Subject: update man before ahoy --- doc/manpage/blender.1 | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/doc/manpage/blender.1 b/doc/manpage/blender.1 index 20cd40e32ee..620a90e61d2 100644 --- a/doc/manpage/blender.1 +++ b/doc/manpage/blender.1 @@ -1,4 +1,4 @@ -.TH "BLENDER" "1" "September 22, 2011" "Blender Blender 2\&.59 (sub 3)" +.TH "BLENDER" "1" "October 17, 2011" "Blender Blender 2\&.60 (sub 0)" .SH NAME blender \- a 3D modelling and rendering package @@ -15,7 +15,7 @@ Use Blender to create TV commercials, to make technical visualizations, business http://www.blender.org .SH OPTIONS -Blender 2.59 (sub 3) +Blender 2.59 (sub 4) Usage: blender [args ...] [file] [args ...] .br .SS "Render Options:" @@ -382,6 +382,7 @@ Arguments are executed in the order they are given. eg \fIBLENDER_SYSTEM_DATAFILES\fR Directory for system wide data files. \fIBLENDER_SYSTEM_PYTHON\fR Directory for system python libraries. \fITMP\fR or \fITMPDIR\fR Store temporary files here. + \fISDL_AUDIODRIVER\fR LibSDL audio driver \- alsa, esd, dma. \fIPYTHONHOME\fR Path to the python directory, eg. /usr/lib/python. .br .br -- cgit v1.2.3 From b8da571036ee79cad6bb893c252d6879318d10c8 Mon Sep 17 00:00:00 2001 From: Ton Roosendaal Date: Mon, 17 Oct 2011 15:07:08 +0000 Subject: Blender 2.60 release commit! New splash: thanks to Kent Trammell! And thanks to judges committee: Beorn Leonard, Pratik Solanki and Brandon Phoenix. Next: tag & build! --- source/blender/blenkernel/BKE_blender.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/blender/blenkernel/BKE_blender.h b/source/blender/blenkernel/BKE_blender.h index f6910fede8e..18aa0d8e0ae 100644 --- a/source/blender/blenkernel/BKE_blender.h +++ b/source/blender/blenkernel/BKE_blender.h @@ -43,8 +43,8 @@ extern "C" { /* these lines are grep'd, watch out for our not-so-awesome regex * and keep comment above the defines. * Use STRINGIFY() rather than defining with quotes */ -#define BLENDER_VERSION 259 -#define BLENDER_SUBVERSION 4 +#define BLENDER_VERSION 260 +#define BLENDER_SUBVERSION 0 #define BLENDER_MINVERSION 250 #define BLENDER_MINSUBVERSION 0 -- cgit v1.2.3 From d795b55b7329f515db5bc6f44cd47a2bff169de3 Mon Sep 17 00:00:00 2001 From: Thomas Dinges Date: Mon, 17 Oct 2011 15:09:23 +0000 Subject: BLENDER_VERSION_CYCLE: rc > release --- source/blender/blenkernel/BKE_blender.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/blender/blenkernel/BKE_blender.h b/source/blender/blenkernel/BKE_blender.h index 18aa0d8e0ae..e01586cb7d0 100644 --- a/source/blender/blenkernel/BKE_blender.h +++ b/source/blender/blenkernel/BKE_blender.h @@ -53,7 +53,7 @@ extern "C" { /* can be left blank, otherwise a,b,c... etc with no quotes */ #define BLENDER_VERSION_CHAR /* alpha/beta/rc/release, docs use this */ -#define BLENDER_VERSION_CYCLE rc +#define BLENDER_VERSION_CYCLE release struct ListBase; struct MemFile; -- cgit v1.2.3 From dc907ef876b128c9767394d00dfc719d55ba077e Mon Sep 17 00:00:00 2001 From: Jens Verwiebe Date: Mon, 17 Oct 2011 16:36:03 +0000 Subject: Allow symlinks in user_scripts, this fixes raised exeption in copy_prefs for version_updates --- release/scripts/startup/bl_operators/wm.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/release/scripts/startup/bl_operators/wm.py b/release/scripts/startup/bl_operators/wm.py index 63104ca00c3..a539e2693c1 100644 --- a/release/scripts/startup/bl_operators/wm.py +++ b/release/scripts/startup/bl_operators/wm.py @@ -1161,7 +1161,7 @@ class WM_OT_copy_prev_settings(Operator): elif not os.path.isdir(path_src): self.report({'ERROR'}, "Source path %r exists" % path_src) else: - shutil.copytree(path_src, path_dst) + shutil.copytree(path_src, path_dst, symlinks=True) # in 2.57 and earlier windows installers, system scripts were copied # into the configuration directory, don't want to copy those -- cgit v1.2.3 From 408a2c62b974c10c7d19ad419dfca479dec59f65 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 19 Oct 2011 00:41:48 +0000 Subject: fix for armatures in wire draw mode not displaying in solid mode. note, this isn't a showstopper bugfix. --- source/blender/editors/space_view3d/drawarmature.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/blender/editors/space_view3d/drawarmature.c b/source/blender/editors/space_view3d/drawarmature.c index 83a695ba72a..eed86467eaa 100644 --- a/source/blender/editors/space_view3d/drawarmature.c +++ b/source/blender/editors/space_view3d/drawarmature.c @@ -1839,7 +1839,7 @@ static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base, } /* wire draw over solid only in posemode */ - if ((dt <= OB_WIRE) || (arm->flag & ARM_POSEMODE) || (arm->drawtype==ARM_LINE)) { + if ((dt <= OB_WIRE) || (arm->flag & ARM_POSEMODE) || ELEM(arm->drawtype, ARM_LINE, ARM_WIRE)) { /* draw line check first. we do selection indices */ if ELEM(arm->drawtype, ARM_LINE, ARM_WIRE) { if (arm->flag & ARM_POSEMODE) @@ -2512,7 +2512,7 @@ int draw_armature(Scene *scene, View3D *v3d, ARegion *ar, Base *base, int dt, in if(v3d->flag2 & V3D_RENDER_OVERRIDE) return 1; - if(dt>OB_WIRE && arm->drawtype!=ARM_LINE) { + if(dt>OB_WIRE && !ELEM(arm->drawtype, ARM_LINE, ARM_WIRE)) { /* we use color for solid lighting */ glColorMaterial(GL_FRONT_AND_BACK, GL_SPECULAR); glEnable(GL_COLOR_MATERIAL); -- cgit v1.2.3 From 0d7bd0f9b63db4c7891137d18ae6a40e652e190f Mon Sep 17 00:00:00 2001 From: Lukas Toenne Date: Wed, 19 Oct 2011 17:08:35 +0000 Subject: Adds an update flag to the bNode struct (similar to bNodeTree->update). This prevents access to non-existent typeinfo during type initialization, when node types have been removed and such nodes are deleted from older files. All blenkernel functions now only set the node->update flag instead of directly calling the update function. All operators, etc. calling blenkernel functions to modify nodes should make a ntreeUpdate call afterward (they already did that anyway). Editor/RNA/renderer/etc. high-level functions still can do immediate updates by using nodeUpdate and nodeUpdateID (replacing NodeTagChanged/NodeTagIDChanged respectively). These old functions were previously used only for setting compositor node needexec flags and clearing cached data, but have become generic update functions that require type-specific functionality (i.e. a valid typeinfo struct). --- source/blender/blenkernel/BKE_node.h | 7 ++- source/blender/blenkernel/intern/depsgraph.c | 2 +- source/blender/blenkernel/intern/image.c | 2 +- source/blender/blenkernel/intern/node.c | 52 +++++++++++++--------- source/blender/editors/render/render_internal.c | 4 +- source/blender/editors/space_node/node_draw.c | 4 +- source/blender/editors/space_node/node_edit.c | 22 ++++----- source/blender/editors/space_node/space_node.c | 4 +- source/blender/makesdna/DNA_node_types.h | 11 ++++- source/blender/makesrna/intern/rna_nodetree.c | 4 +- .../blender/nodes/composite/node_composite_tree.c | 27 ++++++----- source/blender/nodes/intern/node_common.c | 6 ++- source/blender/nodes/shader/node_shader_tree.c | 7 ++- source/blender/nodes/texture/node_texture_tree.c | 2 +- source/blender/render/intern/source/pipeline.c | 2 +- 15 files changed, 92 insertions(+), 64 deletions(-) diff --git a/source/blender/blenkernel/BKE_node.h b/source/blender/blenkernel/BKE_node.h index 1de3c295f4d..b75a8cb29ec 100644 --- a/source/blender/blenkernel/BKE_node.h +++ b/source/blender/blenkernel/BKE_node.h @@ -346,9 +346,8 @@ struct bNode *nodeGetActiveID(struct bNodeTree *ntree, short idtype); int nodeSetActiveID(struct bNodeTree *ntree, short idtype, struct ID *id); void nodeClearActiveID(struct bNodeTree *ntree, short idtype); -void NodeTagChanged(struct bNodeTree *ntree, struct bNode *node); -int NodeTagIDChanged(struct bNodeTree *ntree, struct ID *id); -void ntreeClearTags(struct bNodeTree *ntree); +void nodeUpdate(struct bNodeTree *ntree, struct bNode *node); +int nodeUpdateID(struct bNodeTree *ntree, struct ID *id); void nodeFreePreview(struct bNode *node); @@ -601,7 +600,7 @@ void ntreeCompositTagRender(struct Scene *sce); int ntreeCompositTagAnimated(struct bNodeTree *ntree); void ntreeCompositTagGenerators(struct bNodeTree *ntree); void ntreeCompositForceHidden(struct bNodeTree *ntree, struct Scene *scene); - +void ntreeCompositClearTags(struct bNodeTree *ntree); /* ************** TEXTURE NODES *************** */ diff --git a/source/blender/blenkernel/intern/depsgraph.c b/source/blender/blenkernel/intern/depsgraph.c index 80a40c0a3a3..8d0c20ecc52 100644 --- a/source/blender/blenkernel/intern/depsgraph.c +++ b/source/blender/blenkernel/intern/depsgraph.c @@ -1962,7 +1962,7 @@ static void dag_tag_renderlayers(Scene *sce, unsigned int lay) if(node->id==(ID *)sce) { SceneRenderLayer *srl= BLI_findlink(&sce->r.layers, node->custom1); if(srl && (srl->lay & lay_changed)) - NodeTagChanged(sce->nodetree, node); + nodeUpdate(sce->nodetree, node); } } } diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c index cf8f96c143a..1de581034a4 100644 --- a/source/blender/blenkernel/intern/image.c +++ b/source/blender/blenkernel/intern/image.c @@ -1514,7 +1514,7 @@ void BKE_image_signal(Image *ima, ImageUser *iuser, int signal) Scene *scene; for(scene= G.main->scene.first; scene; scene= scene->id.next) { if(scene->nodetree) { - NodeTagIDChanged(scene->nodetree, &ima->id); + nodeUpdateID(scene->nodetree, &ima->id); } } } diff --git a/source/blender/blenkernel/intern/node.c b/source/blender/blenkernel/intern/node.c index f0be3c99f13..a46b358798a 100644 --- a/source/blender/blenkernel/intern/node.c +++ b/source/blender/blenkernel/intern/node.c @@ -184,7 +184,7 @@ bNodeSocket *nodeAddSocket(bNodeTree *ntree, bNode *node, int in_out, const char else if (in_out==SOCK_OUT) BLI_addtail(&node->outputs, sock); - ntree->update |= NTREE_UPDATE_NODES; + node->update |= NODE_UPDATE; return sock; } @@ -197,7 +197,7 @@ bNodeSocket *nodeInsertSocket(bNodeTree *ntree, bNode *node, int in_out, bNodeSo else if (in_out==SOCK_OUT) BLI_insertlinkbefore(&node->outputs, next_sock, sock); - ntree->update |= NTREE_UPDATE_NODES; + node->update |= NODE_UPDATE; return sock; } @@ -221,7 +221,7 @@ void nodeRemoveSocket(bNodeTree *ntree, bNode *node, bNodeSocket *sock) MEM_freeN(sock->default_value); MEM_freeN(sock); - ntree->update |= NTREE_UPDATE_NODES; + node->update |= NODE_UPDATE; } void nodeRemoveAllSockets(bNodeTree *ntree, bNode *node) @@ -246,7 +246,7 @@ void nodeRemoveAllSockets(bNodeTree *ntree, bNode *node) BLI_freelistN(&node->outputs); - ntree->update |= NTREE_UPDATE_NODES; + node->update |= NODE_UPDATE; } /* finds a node based on its name */ @@ -823,7 +823,7 @@ void nodeUnlinkNode(bNodeTree *ntree, bNode *node) if(link->fromnode==node) { lb= &node->outputs; if (link->tonode) - NodeTagChanged(ntree, link->tonode); + link->tonode->update |= NODE_UPDATE; } else if(link->tonode==node) lb= &node->inputs; @@ -1495,18 +1495,19 @@ void ntreeUpdateTree(bNodeTree *ntree) /* update individual nodes */ for (n=0; n < totnodes; ++n) { node = deplist[n]; - if (ntreetype->update_node) - ntreetype->update_node(ntree, node); - else if (node->typeinfo->updatefunc) - node->typeinfo->updatefunc(ntree, node); + + /* node tree update tags override individual node update flags */ + if ((node->update & NODE_UPDATE) || (ntree->update & NTREE_UPDATE)) { + if (ntreetype->update_node) + ntreetype->update_node(ntree, node); + else if (node->typeinfo->updatefunc) + node->typeinfo->updatefunc(ntree, node); + } + /* clear update flag */ + node->update = 0; } MEM_freeN(deplist); - - /* ensures only a single output node is enabled, texnode allows multiple though */ - if(ntree->type!=NTREE_TEXTURE) - ntreeSetOutput(ntree); - } /* general tree updates */ @@ -1518,6 +1519,9 @@ void ntreeUpdateTree(bNodeTree *ntree) if (ntreetype->update) ntreetype->update(ntree); else { + /* Trees can be associated with a specific node type (i.e. group nodes), + * in that case a tree update function may be defined by that node type. + */ bNodeType *ntype= node_get_type(ntree, ntree->nodetype); if (ntype && ntype->updatetreefunc) ntype->updatetreefunc(ntree); @@ -1530,24 +1534,24 @@ void ntreeUpdateTree(bNodeTree *ntree) ntree->update = 0; } -void NodeTagChanged(bNodeTree *ntree, bNode *node) +void nodeUpdate(bNodeTree *ntree, bNode *node) { - bNodeTreeType *ntreetype = ntreeGetType(ntree->type); + bNodeTreeType *ntreetype= ntreeGetType(ntree->type); - /* extra null pointer checks here because this is called when unlinking - unknown nodes on file load, so typeinfo pointers may not be set */ - if (ntreetype && ntreetype->update_node) + if (ntreetype->update_node) ntreetype->update_node(ntree, node); - else if (node->typeinfo && node->typeinfo->updatefunc) + else if (node->typeinfo->updatefunc) node->typeinfo->updatefunc(ntree, node); + /* clear update flag */ + node->update = 0; } -int NodeTagIDChanged(bNodeTree *ntree, ID *id) +int nodeUpdateID(bNodeTree *ntree, ID *id) { bNodeTreeType *ntreetype; bNode *node; int change = FALSE; - + if(ELEM(NULL, id, ntree)) return change; @@ -1558,6 +1562,8 @@ int NodeTagIDChanged(bNodeTree *ntree, ID *id) if(node->id==id) { change = TRUE; ntreetype->update_node(ntree, node); + /* clear update flag */ + node->update = 0; } } } @@ -1567,6 +1573,8 @@ int NodeTagIDChanged(bNodeTree *ntree, ID *id) change = TRUE; if (node->typeinfo->updatefunc) node->typeinfo->updatefunc(ntree, node); + /* clear update flag */ + node->update = 0; } } } diff --git a/source/blender/editors/render/render_internal.c b/source/blender/editors/render/render_internal.c index 0b350e3afd0..d80f3fef125 100644 --- a/source/blender/editors/render/render_internal.c +++ b/source/blender/editors/render/render_internal.c @@ -398,13 +398,13 @@ static void render_endjob(void *rjv) ED_update_for_newframe(G.main, rj->scene, rj->win->screen, 1); /* XXX above function sets all tags in nodes */ - ntreeClearTags(rj->scene->nodetree); + ntreeCompositClearTags(rj->scene->nodetree); /* potentially set by caller */ rj->scene->r.scemode &= ~R_NO_FRAME_UPDATE; if(rj->srl) { - NodeTagIDChanged(rj->scene->nodetree, &rj->scene->id); + nodeUpdateID(rj->scene->nodetree, &rj->scene->id); WM_main_add_notifier(NC_NODE|NA_EDITED, rj->scene); } diff --git a/source/blender/editors/space_node/node_draw.c b/source/blender/editors/space_node/node_draw.c index e713ed5a678..baa47d4147e 100644 --- a/source/blender/editors/space_node/node_draw.c +++ b/source/blender/editors/space_node/node_draw.c @@ -102,12 +102,12 @@ void ED_node_changed_update(ID *id, bNode *node) WM_main_add_notifier(NC_MATERIAL|ND_SHADING_DRAW, id); } else if(treetype==NTREE_COMPOSIT) { - NodeTagChanged(edittree, node); + nodeUpdate(edittree, node); /* don't use NodeTagIDChanged, it gives far too many recomposites for image, scene layers, ... */ node= node_tree_get_editgroup(nodetree); if(node) - NodeTagIDChanged(nodetree, node->id); + nodeUpdateID(nodetree, node->id); WM_main_add_notifier(NC_SCENE|ND_NODES, id); } diff --git a/source/blender/editors/space_node/node_edit.c b/source/blender/editors/space_node/node_edit.c index baa755ef841..85942901c00 100644 --- a/source/blender/editors/space_node/node_edit.c +++ b/source/blender/editors/space_node/node_edit.c @@ -496,17 +496,17 @@ void snode_set_context(SpaceNode *snode, Scene *scene) node_tree_from_ID(snode->id, &snode->nodetree, &snode->edittree, NULL); } -static void snode_tag_changed(SpaceNode *snode, bNode *node) +static void snode_update(SpaceNode *snode, bNode *node) { bNode *gnode; if (node) - NodeTagChanged(snode->edittree, node); + nodeUpdate(snode->edittree, node); /* if inside group, tag entire group */ gnode= node_tree_get_editgroup(snode->nodetree); if(gnode) - NodeTagIDChanged(snode->nodetree, gnode->id); + nodeUpdateID(snode->nodetree, gnode->id); } static int has_nodetree(bNodeTree *ntree, bNodeTree *lookup) @@ -1775,7 +1775,7 @@ static void node_link_viewer(SpaceNode *snode, bNode *tonode) link->fromsock= sock; } ntreeUpdateTree(snode->edittree); - snode_tag_changed(snode, node); + snode_update(snode, node); } } } @@ -2127,7 +2127,7 @@ void snode_autoconnect(SpaceNode *snode, int allow_multiple, int replace) continue; } - snode_tag_changed(snode, node_to); + snode_update(snode, node_to); ++numlinks; break; } @@ -2175,7 +2175,7 @@ bNode *node_add_node(SpaceNode *snode, Main *bmain, Scene *scene, bNodeTemplate if(node->id) id_us_plus(node->id); - snode_tag_changed(snode, node); + snode_update(snode, node); } if(snode->nodetree->type==NTREE_TEXTURE) { @@ -2412,7 +2412,7 @@ static int node_link_modal(bContext *C, wmOperator *op, wmEvent *event) case MIDDLEMOUSE: if(link->tosock && link->fromsock) { /* send changed events for original tonode and new */ - snode_tag_changed(snode, link->tonode); + snode_update(snode, link->tonode); /* we might need to remove a link */ if(in_out==SOCK_OUT) @@ -2495,7 +2495,7 @@ static int node_link_init(SpaceNode *snode, bNodeLinkDrag *nldrag) if(link) { /* send changed event to original tonode */ if(link->tonode) - snode_tag_changed(snode, link->tonode); + snode_update(snode, link->tonode); nldrag->node= link->fromnode; nldrag->sock= link->fromsock; @@ -2663,7 +2663,7 @@ static int cut_links_exec(bContext *C, wmOperator *op) next= link->next; if(cut_links_intersect(link, mcoords, i)) { - snode_tag_changed(snode, link->tonode); + snode_update(snode, link->tonode); nodeRemLink(snode->edittree, link); } } @@ -2794,7 +2794,7 @@ void ED_node_link_insert(ScrArea *sa) nodeAddLink(snode->edittree, select, socket_best_match(&select->outputs, sockto->type), node, sockto); ntreeUpdateTree(snode->edittree); /* needed for pointers */ - snode_tag_changed(snode, select); + snode_update(snode, select); ED_node_changed_update(snode->id, select); } } @@ -3198,7 +3198,7 @@ static int node_mute_exec(bContext *C, wmOperator *UNUSED(op)) /* Be able to mute in-/output nodes as well. - DingTo if(node->inputs.first && node->outputs.first) { */ node->flag ^= NODE_MUTED; - snode_tag_changed(snode, node); + snode_update(snode, node); } } diff --git a/source/blender/editors/space_node/space_node.c b/source/blender/editors/space_node/space_node.c index 9c4581a43da..1047e906a10 100644 --- a/source/blender/editors/space_node/space_node.c +++ b/source/blender/editors/space_node/space_node.c @@ -244,10 +244,10 @@ static void node_area_listener(ScrArea *sa, wmNotifier *wmn) if(type==NTREE_COMPOSIT) { Scene *scene= wmn->window->screen->scene; - /* note that NodeTagIDChanged is already called by BKE_image_signal() on all + /* note that nodeUpdateID is already called by BKE_image_signal() on all * scenes so really this is just to know if the images is used in the compo else * painting on images could become very slow when the compositor is open. */ - if(NodeTagIDChanged(scene->nodetree, wmn->reference)) + if(nodeUpdateID(scene->nodetree, wmn->reference)) ED_area_tag_refresh(sa); } } diff --git a/source/blender/makesdna/DNA_node_types.h b/source/blender/makesdna/DNA_node_types.h index 4cfd0b56b70..f03cc200a56 100644 --- a/source/blender/makesdna/DNA_node_types.h +++ b/source/blender/makesdna/DNA_node_types.h @@ -154,7 +154,9 @@ typedef struct bNode { float locx, locy; /* root offset for drawing */ float width, height; /* node custom width and height */ float miniwidth; /* node width if hidden */ - int pad; + + int update; /* update flags */ + char label[32]; /* custom user-defined label */ short custom1, custom2; /* to be abused for buttons */ float custom3, custom4; @@ -192,6 +194,13 @@ typedef struct bNode { /* automatic flag for nodes included in transforms */ #define NODE_TRANSFORM (1<<13) +/* node->update */ +/* XXX NODE_UPDATE is a generic update flag. More fine-grained updates + * might be used in the future, but currently all work the same way. + */ +#define NODE_UPDATE 0xFFFF /* generic update flag (includes all others) */ +#define NODE_UPDATE_ID 1 /* associated id data block has changed */ + typedef struct bNodeLink { struct bNodeLink *next, *prev; diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c index 061a21056d0..7d20378d55e 100644 --- a/source/blender/makesrna/intern/rna_nodetree.c +++ b/source/blender/makesrna/intern/rna_nodetree.c @@ -568,7 +568,7 @@ static bNode *rna_NodeTree_node_new(bNodeTree *ntree, bContext *UNUSED(C), Repor } else { ntreeUpdateTree(ntree); /* update group node socket links*/ - NodeTagChanged(ntree, node); + nodeUpdate(ntree, node); WM_main_add_notifier(NC_NODE|NA_EDITED, ntree); if (group) @@ -651,7 +651,7 @@ static bNodeLink *rna_NodeTree_link_new(bNodeTree *ntree, ReportList *reports, b ret= nodeAddLink(ntree, fromnode, in, tonode, out); if(ret) { - NodeTagChanged(ntree, tonode); + nodeUpdate(ntree, tonode); ntreeUpdateTree(ntree); diff --git a/source/blender/nodes/composite/node_composite_tree.c b/source/blender/nodes/composite/node_composite_tree.c index 5c58070be9d..6f4939ecbdd 100644 --- a/source/blender/nodes/composite/node_composite_tree.c +++ b/source/blender/nodes/composite/node_composite_tree.c @@ -183,6 +183,11 @@ static void local_merge(bNodeTree *localtree, bNodeTree *ntree) } } +static void update(bNodeTree *ntree) +{ + ntreeSetOutput(ntree); +} + bNodeTreeType ntreeType_Composite = { /* type */ NTREE_COMPOSIT, /* idname */ "NTCompositing Nodetree", @@ -195,7 +200,7 @@ bNodeTreeType ntreeType_Composite = { /* localize */ localize, /* local_sync */ local_sync, /* local_merge */ local_merge, - /* update */ NULL, + /* update */ update, /* update_node */ update_node }; @@ -716,9 +721,9 @@ void ntreeCompositTagRender(Scene *curscene) for(node= sce->nodetree->nodes.first; node; node= node->next) { if(node->id==(ID *)curscene || node->type==CMP_NODE_COMPOSITE) - NodeTagChanged(sce->nodetree, node); + nodeUpdate(sce->nodetree, node); else if(node->type==CMP_NODE_TEXTURE) /* uses scene sizex/sizey */ - NodeTagChanged(sce->nodetree, node); + nodeUpdate(sce->nodetree, node); } } } @@ -745,7 +750,7 @@ static int node_animation_properties(bNodeTree *ntree, bNode *node) for (index=0; indextype==CMP_NODE_IMAGE) { Image *ima= (Image *)node->id; if(ima && ELEM(ima->source, IMA_SRC_MOVIE, IMA_SRC_SEQUENCE)) { - NodeTagChanged(ntree, node); + nodeUpdate(ntree, node); tagged= 1; } } else if(node->type==CMP_NODE_TIME) { - NodeTagChanged(ntree, node); + nodeUpdate(ntree, node); tagged= 1; } /* here was tag render layer, but this is called after a render, so re-composites fail */ else if(node->type==NODE_GROUP) { if( ntreeCompositTagAnimated((bNodeTree *)node->id) ) { - NodeTagChanged(ntree, node); + nodeUpdate(ntree, node); } } } @@ -818,12 +823,12 @@ void ntreeCompositTagGenerators(bNodeTree *ntree) for(node= ntree->nodes.first; node; node= node->next) { if( ELEM(node->type, CMP_NODE_R_LAYERS, CMP_NODE_IMAGE)) - NodeTagChanged(ntree, node); + nodeUpdate(ntree, node); } } /* XXX after render animation system gets a refresh, this call allows composite to end clean */ -void ntreeClearTags(bNodeTree *ntree) +void ntreeCompositClearTags(bNodeTree *ntree) { bNode *node; @@ -832,6 +837,6 @@ void ntreeClearTags(bNodeTree *ntree) for(node= ntree->nodes.first; node; node= node->next) { node->need_exec= 0; if(node->type==NODE_GROUP) - ntreeClearTags((bNodeTree *)node->id); + ntreeCompositClearTags((bNodeTree *)node->id); } } diff --git a/source/blender/nodes/intern/node_common.c b/source/blender/nodes/intern/node_common.c index 56f80840112..4dbf4b96b74 100644 --- a/source/blender/nodes/intern/node_common.c +++ b/source/blender/nodes/intern/node_common.c @@ -239,9 +239,11 @@ bNode *node_group_make_from_selected(bNodeTree *ntree) } } + /* update of the group tree */ ngroup->update |= NTREE_UPDATE; ntreeUpdateTree(ngroup); - ntree->update |= NTREE_UPDATE_NODES|NTREE_UPDATE_LINKS; + /* update of the tree containing the group instance node */ + ntree->update |= NTREE_UPDATE_NODES | NTREE_UPDATE_LINKS; ntreeUpdateTree(ntree); return gnode; @@ -559,7 +561,7 @@ int node_group_ungroup(bNodeTree *ntree, bNode *gnode) /* free the group tree (takes care of user count) */ free_libblock(&G.main->nodetree, wgroup); - ntree->update |= NTREE_UPDATE_NODES|NTREE_UPDATE_LINKS; + ntree->update |= NTREE_UPDATE_NODES | NTREE_UPDATE_LINKS; ntreeUpdateTree(ntree); return 1; diff --git a/source/blender/nodes/shader/node_shader_tree.c b/source/blender/nodes/shader/node_shader_tree.c index 28f0f983454..9f3e7ce3c73 100644 --- a/source/blender/nodes/shader/node_shader_tree.c +++ b/source/blender/nodes/shader/node_shader_tree.c @@ -85,6 +85,11 @@ static void local_sync(bNodeTree *localtree, bNodeTree *ntree) } } +static void update(bNodeTree *ntree) +{ + ntreeSetOutput(ntree); +} + bNodeTreeType ntreeType_Shader = { /* type */ NTREE_SHADER, /* id_name */ "NTShader Nodetree", @@ -97,7 +102,7 @@ bNodeTreeType ntreeType_Shader = { /* localize */ NULL, /* local_sync */ local_sync, /* local_merge */ NULL, - /* update */ NULL, + /* update */ update, /* update_node */ NULL }; diff --git a/source/blender/nodes/texture/node_texture_tree.c b/source/blender/nodes/texture/node_texture_tree.c index 603aa7ceb77..2b016177820 100644 --- a/source/blender/nodes/texture/node_texture_tree.c +++ b/source/blender/nodes/texture/node_texture_tree.c @@ -108,7 +108,7 @@ int ntreeTexTagAnimated(bNodeTree *ntree) for(node= ntree->nodes.first; node; node= node->next) { if(node->type==TEX_NODE_CURVE_TIME) { - NodeTagChanged(ntree, node); + nodeUpdate(ntree, node); return 1; } else if(node->type==NODE_GROUP) { diff --git a/source/blender/render/intern/source/pipeline.c b/source/blender/render/intern/source/pipeline.c index 7835ae6dcd3..19dc0538dba 100644 --- a/source/blender/render/intern/source/pipeline.c +++ b/source/blender/render/intern/source/pipeline.c @@ -2261,7 +2261,7 @@ static void ntree_render_scenes(Render *re) restore_scene= (scene != re->scene); node->id->flag &= ~LIB_DOIT; - NodeTagChanged(re->scene->nodetree, node); + nodeUpdate(re->scene->nodetree, node); } } } -- cgit v1.2.3 From c97aa671f4f5082d61f5e8f08281323e514708d0 Mon Sep 17 00:00:00 2001 From: Peter Schlaile Date: Wed, 19 Oct 2011 18:21:08 +0000 Subject: == Sequencer == do_versions fix: hd audio tracks within metastrips were not properly upgraded from 2.49 files, resulting in broken unusable tracks, which were rendered as black strips as a bonus. --- source/blender/blenloader/intern/readfile.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index dfaf96a6066..a6474fb5044 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -10215,8 +10215,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) { if(scene->ed && scene->ed->seqbasep) { - for(seq = scene->ed->seqbasep->first; seq; seq = seq->next) - { + SEQ_BEGIN(scene->ed, seq) { if(seq->type == SEQ_HD_SOUND) { char str[FILE_MAX]; @@ -10236,6 +10235,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) seq->strip->dir); } } + SEQ_END } } -- cgit v1.2.3 From 4d2a28c2a9408463b182e67c47accb31b8ea7df9 Mon Sep 17 00:00:00 2001 From: Thomas Dinges Date: Wed, 19 Oct 2011 18:46:16 +0000 Subject: Revert own commit 41026. It now had issues when hiding menus with the - icon, space selector disappeared. I am sorry for that, but I consider this a show stopper eventually. :( This commit introduces the issue with narrowed verts/edge/face select in solid/edit mode again. --- release/scripts/startup/bl_ui/space_view3d.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py index e4beee66871..c6a26cd9bbf 100644 --- a/release/scripts/startup/bl_ui/space_view3d.py +++ b/release/scripts/startup/bl_ui/space_view3d.py @@ -56,9 +56,9 @@ class VIEW3D_HT_header(Header): # Contains buttons like Mode, Pivot, Manipulator, Layer, Mesh Select Mode... - layout.template_header_3D() + row = layout.row() #XXX Narrowed down vert/edge/face selector in edit mode/solid drawmode. -DingTo + row.template_header_3D() - row = layout.row() if obj: # Particle edit if obj.mode == 'PARTICLE_EDIT': -- cgit v1.2.3 From c661a4b1ab80162d0fac4fd0e2066b806e2acdce Mon Sep 17 00:00:00 2001 From: Jens Verwiebe Date: Wed, 19 Oct 2011 19:12:41 +0000 Subject: OSX: set at least initial OMP_NUM_THREADS value to avoid warnings in log, remove applescript for now --- source/darwin/blender.app/Contents/Info.plist | 2 +- .../set_simulation_threads.app/Contents/Info.plist | 44 --------------------- .../Contents/MacOS/applet | Bin 34480 -> 0 bytes .../set_simulation_threads.app/Contents/PkgInfo | 1 - .../Contents/Resources/Scripts/main.scpt | Bin 4696 -> 0 bytes .../Contents/Resources/applet.icns | Bin 40291 -> 0 bytes .../Contents/Resources/applet.rsrc | Bin 362 -> 0 bytes .../Contents/Resources/description.rtfd/TXT.rtf | 4 -- .../darwin/set_simulation_threads_applescript.scpt | Bin 5144 -> 0 bytes 9 files changed, 1 insertion(+), 50 deletions(-) delete mode 100644 source/darwin/set_simulation_threads.app/Contents/Info.plist delete mode 100755 source/darwin/set_simulation_threads.app/Contents/MacOS/applet delete mode 100644 source/darwin/set_simulation_threads.app/Contents/PkgInfo delete mode 100644 source/darwin/set_simulation_threads.app/Contents/Resources/Scripts/main.scpt delete mode 100644 source/darwin/set_simulation_threads.app/Contents/Resources/applet.icns delete mode 100644 source/darwin/set_simulation_threads.app/Contents/Resources/applet.rsrc delete mode 100644 source/darwin/set_simulation_threads.app/Contents/Resources/description.rtfd/TXT.rtf delete mode 100644 source/darwin/set_simulation_threads_applescript.scpt diff --git a/source/darwin/blender.app/Contents/Info.plist b/source/darwin/blender.app/Contents/Info.plist index 9aeb617a051..37920dc8181 100644 --- a/source/darwin/blender.app/Contents/Info.plist +++ b/source/darwin/blender.app/Contents/Info.plist @@ -46,7 +46,7 @@ LSEnvironment OMP_NUM_THREADS - + 4 diff --git a/source/darwin/set_simulation_threads.app/Contents/Info.plist b/source/darwin/set_simulation_threads.app/Contents/Info.plist deleted file mode 100644 index 44d6783599c..00000000000 --- a/source/darwin/set_simulation_threads.app/Contents/Info.plist +++ /dev/null @@ -1,44 +0,0 @@ - - - - - CFBundleAllowMixedLocalizations - - CFBundleDevelopmentRegion - English - CFBundleExecutable - applet - CFBundleIconFile - applet - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - set_simulation_threads - CFBundlePackageType - APPL - CFBundleSignature - aplt - LSMinimumSystemVersionByArchitecture - - x86_64 - 10.6 - - LSRequiresCarbon - - WindowState - - dividerCollapsed - - eventLogLevel - -1 - name - ScriptWindowState - positionOfDivider - 470 - savedFrame - 199 169 1197 810 0 0 1920 1178 - selectedTabView - result - - - diff --git a/source/darwin/set_simulation_threads.app/Contents/MacOS/applet b/source/darwin/set_simulation_threads.app/Contents/MacOS/applet deleted file mode 100755 index 0079f4b19d4..00000000000 Binary files a/source/darwin/set_simulation_threads.app/Contents/MacOS/applet and /dev/null differ diff --git a/source/darwin/set_simulation_threads.app/Contents/PkgInfo b/source/darwin/set_simulation_threads.app/Contents/PkgInfo deleted file mode 100644 index 3253614c402..00000000000 --- a/source/darwin/set_simulation_threads.app/Contents/PkgInfo +++ /dev/null @@ -1 +0,0 @@ -APPLaplt \ No newline at end of file diff --git a/source/darwin/set_simulation_threads.app/Contents/Resources/Scripts/main.scpt b/source/darwin/set_simulation_threads.app/Contents/Resources/Scripts/main.scpt deleted file mode 100644 index d905e27cb6d..00000000000 Binary files a/source/darwin/set_simulation_threads.app/Contents/Resources/Scripts/main.scpt and /dev/null differ diff --git a/source/darwin/set_simulation_threads.app/Contents/Resources/applet.icns b/source/darwin/set_simulation_threads.app/Contents/Resources/applet.icns deleted file mode 100644 index fcc1f09273d..00000000000 Binary files a/source/darwin/set_simulation_threads.app/Contents/Resources/applet.icns and /dev/null differ diff --git a/source/darwin/set_simulation_threads.app/Contents/Resources/applet.rsrc b/source/darwin/set_simulation_threads.app/Contents/Resources/applet.rsrc deleted file mode 100644 index 54735c5cb04..00000000000 Binary files a/source/darwin/set_simulation_threads.app/Contents/Resources/applet.rsrc and /dev/null differ diff --git a/source/darwin/set_simulation_threads.app/Contents/Resources/description.rtfd/TXT.rtf b/source/darwin/set_simulation_threads.app/Contents/Resources/description.rtfd/TXT.rtf deleted file mode 100644 index 0d0a60c08b5..00000000000 --- a/source/darwin/set_simulation_threads.app/Contents/Resources/description.rtfd/TXT.rtf +++ /dev/null @@ -1,4 +0,0 @@ -{\rtf1\ansi\ansicpg1252\cocoartf1138\cocoasubrtf230 -{\fonttbl} -{\colortbl;\red255\green255\blue255;} -} \ No newline at end of file diff --git a/source/darwin/set_simulation_threads_applescript.scpt b/source/darwin/set_simulation_threads_applescript.scpt deleted file mode 100644 index 82ea5357de5..00000000000 Binary files a/source/darwin/set_simulation_threads_applescript.scpt and /dev/null differ -- cgit v1.2.3 From f6f9288f353eed07cb298a7be3585f0bf3f620dd Mon Sep 17 00:00:00 2001 From: Jens Verwiebe Date: Wed, 19 Oct 2011 19:15:35 +0000 Subject: replace former applescript with an editable one --- .../set_simulation_threads.app/Contents/Info.plist | 44 +++++++++++++++++++++ .../Contents/MacOS/applet | Bin 0 -> 34480 bytes .../set_simulation_threads.app/Contents/PkgInfo | 1 + .../Contents/Resources/Scripts/main.scpt | Bin 0 -> 7664 bytes .../Contents/Resources/applet.icns | Bin 0 -> 40291 bytes .../Contents/Resources/applet.rsrc | Bin 0 -> 362 bytes .../Contents/Resources/description.rtfd/TXT.rtf | 4 ++ 7 files changed, 49 insertions(+) create mode 100644 source/darwin/set_simulation_threads.app/Contents/Info.plist create mode 100755 source/darwin/set_simulation_threads.app/Contents/MacOS/applet create mode 100644 source/darwin/set_simulation_threads.app/Contents/PkgInfo create mode 100644 source/darwin/set_simulation_threads.app/Contents/Resources/Scripts/main.scpt create mode 100644 source/darwin/set_simulation_threads.app/Contents/Resources/applet.icns create mode 100644 source/darwin/set_simulation_threads.app/Contents/Resources/applet.rsrc create mode 100644 source/darwin/set_simulation_threads.app/Contents/Resources/description.rtfd/TXT.rtf diff --git a/source/darwin/set_simulation_threads.app/Contents/Info.plist b/source/darwin/set_simulation_threads.app/Contents/Info.plist new file mode 100644 index 00000000000..eb80955e5a6 --- /dev/null +++ b/source/darwin/set_simulation_threads.app/Contents/Info.plist @@ -0,0 +1,44 @@ + + + + + CFBundleAllowMixedLocalizations + + CFBundleDevelopmentRegion + English + CFBundleExecutable + applet + CFBundleIconFile + applet + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + set_simulation_threads + CFBundlePackageType + APPL + CFBundleSignature + aplt + LSMinimumSystemVersionByArchitecture + + x86_64 + 10.6 + + LSRequiresCarbon + + WindowState + + dividerCollapsed + + eventLogLevel + -1 + name + ScriptWindowState + positionOfDivider + 493 + savedFrame + 698 332 1163 846 0 0 1920 1178 + selectedTabView + result + + + diff --git a/source/darwin/set_simulation_threads.app/Contents/MacOS/applet b/source/darwin/set_simulation_threads.app/Contents/MacOS/applet new file mode 100755 index 00000000000..0079f4b19d4 Binary files /dev/null and b/source/darwin/set_simulation_threads.app/Contents/MacOS/applet differ diff --git a/source/darwin/set_simulation_threads.app/Contents/PkgInfo b/source/darwin/set_simulation_threads.app/Contents/PkgInfo new file mode 100644 index 00000000000..3253614c402 --- /dev/null +++ b/source/darwin/set_simulation_threads.app/Contents/PkgInfo @@ -0,0 +1 @@ +APPLaplt \ No newline at end of file diff --git a/source/darwin/set_simulation_threads.app/Contents/Resources/Scripts/main.scpt b/source/darwin/set_simulation_threads.app/Contents/Resources/Scripts/main.scpt new file mode 100644 index 00000000000..fa562578a80 Binary files /dev/null and b/source/darwin/set_simulation_threads.app/Contents/Resources/Scripts/main.scpt differ diff --git a/source/darwin/set_simulation_threads.app/Contents/Resources/applet.icns b/source/darwin/set_simulation_threads.app/Contents/Resources/applet.icns new file mode 100644 index 00000000000..fcc1f09273d Binary files /dev/null and b/source/darwin/set_simulation_threads.app/Contents/Resources/applet.icns differ diff --git a/source/darwin/set_simulation_threads.app/Contents/Resources/applet.rsrc b/source/darwin/set_simulation_threads.app/Contents/Resources/applet.rsrc new file mode 100644 index 00000000000..540621d0b9e Binary files /dev/null and b/source/darwin/set_simulation_threads.app/Contents/Resources/applet.rsrc differ diff --git a/source/darwin/set_simulation_threads.app/Contents/Resources/description.rtfd/TXT.rtf b/source/darwin/set_simulation_threads.app/Contents/Resources/description.rtfd/TXT.rtf new file mode 100644 index 00000000000..0d0a60c08b5 --- /dev/null +++ b/source/darwin/set_simulation_threads.app/Contents/Resources/description.rtfd/TXT.rtf @@ -0,0 +1,4 @@ +{\rtf1\ansi\ansicpg1252\cocoartf1138\cocoasubrtf230 +{\fonttbl} +{\colortbl;\red255\green255\blue255;} +} \ No newline at end of file -- cgit v1.2.3 From 617d3cb85237c5178b09fefedcd75313653b52ce Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 19 Oct 2011 21:55:27 +0000 Subject: pass -noaudio when running blender for various utilities - doc-gen and tests. --- GNUmakefile | 6 +++--- doc/blender_file_format/BlendFileDnaExporter_25.py | 6 +++--- doc/blender_file_format/README | 6 +++--- doc/python_api/sphinx_doc_gen.py | 4 ++-- doc/python_api/sphinx_doc_gen.sh | 2 +- source/blender/makesrna/rna_cleanup/rna_cleaner.py | 2 +- source/blender/makesrna/rna_cleanup/rna_update.sh | 2 +- source/tests/CMakeLists.txt | 2 +- source/tests/rna_info_dump.py | 2 +- 9 files changed, 16 insertions(+), 16 deletions(-) diff --git a/GNUmakefile b/GNUmakefile index af953143b82..c68c8684687 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -174,7 +174,7 @@ package_archive: # Other Targets # translations: - $(BUILD_DIR)/bin/blender --background --factory-startup --python po/update_msg.py + $(BUILD_DIR)/bin/blender --background -noaudio --factory-startup --python po/update_msg.py python3 po/update_pot.py python3 po/update_po.py python3 po/update_mo.py @@ -238,12 +238,12 @@ check_sparse: # Simple version of ./doc/python_api/sphinx_doc_gen.sh with no PDF generation. doc_py: - $(BUILD_DIR)/bin/blender --background --factory-startup --python doc/python_api/sphinx_doc_gen.py + $(BUILD_DIR)/bin/blender --background -noaudio --factory-startup --python doc/python_api/sphinx_doc_gen.py cd doc/python_api ; sphinx-build -n -b html sphinx-in sphinx-out @echo "docs written into: '$(BLENDER_DIR)/doc/python_api/sphinx-out/contents.html'" doc_dna: - $(BUILD_DIR)/bin/blender --background --factory-startup --python doc/blender_file_format/BlendFileDnaExporter_25.py + $(BUILD_DIR)/bin/blender --background -noaudio --factory-startup --python doc/blender_file_format/BlendFileDnaExporter_25.py @echo "docs written into: '$(BLENDER_DIR)/doc/blender_file_format/dna.html'" doc_man: diff --git a/doc/blender_file_format/BlendFileDnaExporter_25.py b/doc/blender_file_format/BlendFileDnaExporter_25.py index 988c992fd78..bc5b2e73c7e 100755 --- a/doc/blender_file_format/BlendFileDnaExporter_25.py +++ b/doc/blender_file_format/BlendFileDnaExporter_25.py @@ -379,15 +379,15 @@ class DNACatalogHTML: def usage(): - print("\nUsage: \n\tblender2.5 -b -P BlendFileDnaExporter_25.py [-- [options]]") + print("\nUsage: \n\tblender2.5 --background -noaudio --python BlendFileDnaExporter_25.py [-- [options]]") print("Options:") print("\t--dna-keep-blend: doesn't delete the produced blend file DNA export to html") print("\t--dna-debug: sets the logging level to DEBUG (lots of additional info)") print("\t--dna-versioned saves version informations in the html and blend filenames") print("\t--dna-overwrite-css overwrite dna.css, useful when modifying css in the script") print("Examples:") - print("\tdefault: % blender2.5 -b -P BlendFileDnaExporter_25.py") - print("\twith options: % blender2.5 -b -P BlendFileDnaExporter_25.py -- --dna-keep-blend --dna-debug\n") + print("\tdefault: % blender2.5 --background -noaudio --python BlendFileDnaExporter_25.py") + print("\twith options: % blender2.5 --background -noaudio --python BlendFileDnaExporter_25.py -- --dna-keep-blend --dna-debug\n") ###################################################### diff --git a/doc/blender_file_format/README b/doc/blender_file_format/README index 55dc3b83e49..f28d4b3f6b6 100644 --- a/doc/blender_file_format/README +++ b/doc/blender_file_format/README @@ -16,14 +16,14 @@ Below you have the help message with a list of options you can use. Usage: - blender2.5 -b -P BlendFileDnaExporter_25.py [-- [options]] + blender2.5 --background -noaudio --python BlendFileDnaExporter_25.py [-- [options]] Options: --dna-keep-blend: doesn't delete the produced blend file DNA export to html --dna-debug: sets the logging level to DEBUG (lots of additional info) --dna-versioned saves version informations in the html and blend filenames --dna-overwrite-css overwrite dna.css, useful when modifying css in the script Examples: - default: % blender2.5 -b -P BlendFileDnaExporter_25.py - with options: % blender2.5 -b -P BlendFileDnaExporter_25.py -- --dna-keep-blend --dna-debug + default: % blender2.5 --background -noaudio --python BlendFileDnaExporter_25.py + with options: % blender2.5 --background -noaudio --python BlendFileDnaExporter_25.py -- --dna-keep-blend --dna-debug diff --git a/doc/python_api/sphinx_doc_gen.py b/doc/python_api/sphinx_doc_gen.py index 2ccf67e2db4..017c2acc363 100644 --- a/doc/python_api/sphinx_doc_gen.py +++ b/doc/python_api/sphinx_doc_gen.py @@ -27,7 +27,7 @@ For HTML generation ------------------- - Run this script from blenders root path once you have compiled blender - ./blender.bin --background --python doc/python_api/sphinx_doc_gen.py + ./blender.bin --background -noaudio --python doc/python_api/sphinx_doc_gen.py This will generate python files in doc/python_api/sphinx-in/ providing ./blender.bin is or links to the blender executable @@ -94,7 +94,7 @@ else: # for quick rebuilds """ rm -rf /b/doc/python_api/sphinx-* && \ -./blender.bin --background --factory-startup --python doc/python_api/sphinx_doc_gen.py && \ +./blender.bin --background -noaudio --factory-startup --python doc/python_api/sphinx_doc_gen.py && \ sphinx-build doc/python_api/sphinx-in doc/python_api/sphinx-out """ diff --git a/doc/python_api/sphinx_doc_gen.sh b/doc/python_api/sphinx_doc_gen.sh index 307476d9a92..fad9bfbbf90 100755 --- a/doc/python_api/sphinx_doc_gen.sh +++ b/doc/python_api/sphinx_doc_gen.sh @@ -48,7 +48,7 @@ SPHINXBASE=doc/python_api if $DO_EXE_BLENDER ; then # dont delete existing docs, now partial updates are used for quick builds. - $BLENDER --background --factory-startup --python $SPHINXBASE/sphinx_doc_gen.py + $BLENDER --background -noaudio --factory-startup --python $SPHINXBASE/sphinx_doc_gen.py fi diff --git a/source/blender/makesrna/rna_cleanup/rna_cleaner.py b/source/blender/makesrna/rna_cleanup/rna_cleaner.py index 5df6e9a86ff..ca610eeb024 100755 --- a/source/blender/makesrna/rna_cleanup/rna_cleaner.py +++ b/source/blender/makesrna/rna_cleanup/rna_cleaner.py @@ -8,7 +8,7 @@ Typical line in the input file (elements in [] are optional). [comment *] ToolSettings.snap_align_rotation -> use_snap_align_rotation: boolean [Align rotation with the snapping target] Geterate output format from blender run this: - ./blender.bin --background --python ./release/scripts/modules/rna_info.py 2> source/blender/makesrna/rna_cleanup/out.txt + ./blender.bin --background -noaudio --python ./release/scripts/modules/rna_info.py 2> source/blender/makesrna/rna_cleanup/out.txt """ diff --git a/source/blender/makesrna/rna_cleanup/rna_update.sh b/source/blender/makesrna/rna_cleanup/rna_update.sh index a4d686cc482..e3119191cb2 100755 --- a/source/blender/makesrna/rna_cleanup/rna_update.sh +++ b/source/blender/makesrna/rna_cleanup/rna_update.sh @@ -1,5 +1,5 @@ cd ../../../../ -./blender.bin --background --python ./release/scripts/modules/rna_info.py 2> source/blender/makesrna/rna_cleanup/out.txt +./blender.bin --background -noaudio --python ./release/scripts/modules/rna_info.py 2> source/blender/makesrna/rna_cleanup/out.txt cd ./source/blender/makesrna/rna_cleanup/ ./rna_cleaner.py out.txt ./rna_cleaner.py rna_properties.txt diff --git a/source/tests/CMakeLists.txt b/source/tests/CMakeLists.txt index c5a6831a4cb..64cc79de879 100644 --- a/source/tests/CMakeLists.txt +++ b/source/tests/CMakeLists.txt @@ -43,7 +43,7 @@ else() endif() # for testing with valgrind prefix: valgrind --track-origins=yes --error-limit=no -set(TEST_BLENDER_EXE ${TEST_BLENDER_EXE} --background --factory-startup --env-system-scripts ${CMAKE_SOURCE_DIR}/release/scripts) +set(TEST_BLENDER_EXE ${TEST_BLENDER_EXE} --background -noaudio --factory-startup --env-system-scripts ${CMAKE_SOURCE_DIR}/release/scripts) # ------------------------------------------------------------------------------ diff --git a/source/tests/rna_info_dump.py b/source/tests/rna_info_dump.py index 62c1248d733..293c02dfb84 100644 --- a/source/tests/rna_info_dump.py +++ b/source/tests/rna_info_dump.py @@ -19,7 +19,7 @@ # # Used for generating API diff's between releases -# ./blender.bin --background --python release/test/rna_info_dump.py +# ./blender.bin --background -noaudio --python release/test/rna_info_dump.py import bpy -- cgit v1.2.3 From 0e66576f02afebdb4016249a9d7013ee5c1f0c36 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 19 Oct 2011 22:40:03 +0000 Subject: replace RNA function string lookups with direct assignments, currently the lookup returns the same pointer every time. some of these functions - panel/operator poll for eg, are called many times per redraw so while not a bottleneck its unnecessary. --- source/blender/makesrna/intern/rna_animation.c | 12 ++++++++--- source/blender/makesrna/intern/rna_render.c | 4 +++- source/blender/makesrna/intern/rna_ui.c | 24 ++++++++++++++++------ source/blender/makesrna/intern/rna_wm.c | 28 +++++++++++++++++++------- 4 files changed, 51 insertions(+), 17 deletions(-) diff --git a/source/blender/makesrna/intern/rna_animation.c b/source/blender/makesrna/intern/rna_animation.c index ebf8990adf3..21e99d312d6 100644 --- a/source/blender/makesrna/intern/rna_animation.c +++ b/source/blender/makesrna/intern/rna_animation.c @@ -80,6 +80,8 @@ static void rna_AnimData_action_set(PointerRNA *ptr, PointerRNA value) /* wrapper for poll callback */ static int RKS_POLL_rna_internal(KeyingSetInfo *ksi, bContext *C) { + extern FunctionRNA rna_KeyingSetInfo_poll_func; + PointerRNA ptr; ParameterList list; FunctionRNA *func; @@ -87,7 +89,7 @@ static int RKS_POLL_rna_internal(KeyingSetInfo *ksi, bContext *C) int ok; RNA_pointer_create(NULL, ksi->ext.srna, ksi, &ptr); - func= RNA_struct_find_function(&ptr, "poll"); + func= &rna_KeyingSetInfo_poll_func; /* RNA_struct_find_function(&ptr, "poll"); */ RNA_parameter_list_create(&list, &ptr, func); /* hook up arguments */ @@ -108,12 +110,14 @@ static int RKS_POLL_rna_internal(KeyingSetInfo *ksi, bContext *C) /* wrapper for iterator callback */ static void RKS_ITER_rna_internal(KeyingSetInfo *ksi, bContext *C, KeyingSet *ks) { + extern FunctionRNA rna_KeyingSetInfo_iterator_func; + PointerRNA ptr; ParameterList list; FunctionRNA *func; RNA_pointer_create(NULL, ksi->ext.srna, ksi, &ptr); - func= RNA_struct_find_function(&ptr, "iterator"); + func= &rna_KeyingSetInfo_iterator_func; /* RNA_struct_find_function(&ptr, "poll"); */ RNA_parameter_list_create(&list, &ptr, func); /* hook up arguments */ @@ -129,12 +133,14 @@ static void RKS_ITER_rna_internal(KeyingSetInfo *ksi, bContext *C, KeyingSet *ks /* wrapper for generator callback */ static void RKS_GEN_rna_internal(KeyingSetInfo *ksi, bContext *C, KeyingSet *ks, PointerRNA *data) { + extern FunctionRNA rna_KeyingSetInfo_generate_func; + PointerRNA ptr; ParameterList list; FunctionRNA *func; RNA_pointer_create(NULL, ksi->ext.srna, ksi, &ptr); - func= RNA_struct_find_function(&ptr, "generate"); + func= &rna_KeyingSetInfo_generate_func; /* RNA_struct_find_generate(&ptr, "poll"); */ RNA_parameter_list_create(&list, &ptr, func); /* hook up arguments */ diff --git a/source/blender/makesrna/intern/rna_render.c b/source/blender/makesrna/intern/rna_render.c index f5fab9d2f33..a2e68668856 100644 --- a/source/blender/makesrna/intern/rna_render.c +++ b/source/blender/makesrna/intern/rna_render.c @@ -88,12 +88,14 @@ void RE_engines_exit(void) static void engine_render(RenderEngine *engine, struct Scene *scene) { + extern FunctionRNA rna_RenderEngine_render_func; + PointerRNA ptr; ParameterList list; FunctionRNA *func; RNA_pointer_create(NULL, engine->type->ext.srna, engine, &ptr); - func= RNA_struct_find_function(&ptr, "render"); + func= &rna_RenderEngine_render_func; /* RNA_struct_find_function(&ptr, "render"); */ RNA_parameter_list_create(&list, &ptr, func); RNA_parameter_set_lookup(&list, "scene", &scene); diff --git a/source/blender/makesrna/intern/rna_ui.c b/source/blender/makesrna/intern/rna_ui.c index 2c2bc4704bf..2a62a39ef33 100644 --- a/source/blender/makesrna/intern/rna_ui.c +++ b/source/blender/makesrna/intern/rna_ui.c @@ -95,6 +95,8 @@ static ARegionType *region_type_find(ReportList *reports, int space_type, int re static int panel_poll(const bContext *C, PanelType *pt) { + extern FunctionRNA rna_Panel_poll_func; + PointerRNA ptr; ParameterList list; FunctionRNA *func; @@ -102,7 +104,7 @@ static int panel_poll(const bContext *C, PanelType *pt) int visible; RNA_pointer_create(NULL, pt->ext.srna, NULL, &ptr); /* dummy */ - func= RNA_struct_find_function(&ptr, "poll"); + func= &rna_Panel_poll_func; /* RNA_struct_find_function(&ptr, "poll"); */ RNA_parameter_list_create(&list, &ptr, func); RNA_parameter_set_lookup(&list, "context", &C); @@ -118,12 +120,14 @@ static int panel_poll(const bContext *C, PanelType *pt) static void panel_draw(const bContext *C, Panel *pnl) { + extern FunctionRNA rna_Panel_draw_func; + PointerRNA ptr; ParameterList list; FunctionRNA *func; RNA_pointer_create(&CTX_wm_screen(C)->id, pnl->type->ext.srna, pnl, &ptr); - func= RNA_struct_find_function(&ptr, "draw"); + func= &rna_Panel_draw_func;/* RNA_struct_find_function(&ptr, "draw"); */ RNA_parameter_list_create(&list, &ptr, func); RNA_parameter_set_lookup(&list, "context", &C); @@ -134,12 +138,14 @@ static void panel_draw(const bContext *C, Panel *pnl) static void panel_draw_header(const bContext *C, Panel *pnl) { + extern FunctionRNA rna_Panel_draw_header_func; + PointerRNA ptr; ParameterList list; FunctionRNA *func; RNA_pointer_create(&CTX_wm_screen(C)->id, pnl->type->ext.srna, pnl, &ptr); - func= RNA_struct_find_function(&ptr, "draw_header"); + func= &rna_Panel_draw_header_func; /* RNA_struct_find_function(&ptr, "draw_header"); */ RNA_parameter_list_create(&list, &ptr, func); RNA_parameter_set_lookup(&list, "context", &C); @@ -249,12 +255,14 @@ static StructRNA* rna_Panel_refine(PointerRNA *ptr) static void header_draw(const bContext *C, Header *hdr) { + extern FunctionRNA rna_Header_draw_func; + PointerRNA htr; ParameterList list; FunctionRNA *func; RNA_pointer_create(&CTX_wm_screen(C)->id, hdr->type->ext.srna, hdr, &htr); - func= RNA_struct_find_function(&htr, "draw"); + func= &rna_Header_draw_func; /* RNA_struct_find_function(&htr, "draw"); */ RNA_parameter_list_create(&list, &htr, func); RNA_parameter_set_lookup(&list, "context", &C); @@ -347,6 +355,8 @@ static StructRNA* rna_Header_refine(PointerRNA *htr) static int menu_poll(const bContext *C, MenuType *pt) { + extern FunctionRNA rna_Menu_poll_func; + PointerRNA ptr; ParameterList list; FunctionRNA *func; @@ -354,7 +364,7 @@ static int menu_poll(const bContext *C, MenuType *pt) int visible; RNA_pointer_create(NULL, pt->ext.srna, NULL, &ptr); /* dummy */ - func= RNA_struct_find_function(&ptr, "poll"); + func= &rna_Menu_poll_func; /* RNA_struct_find_function(&ptr, "poll"); */ RNA_parameter_list_create(&list, &ptr, func); RNA_parameter_set_lookup(&list, "context", &C); @@ -370,12 +380,14 @@ static int menu_poll(const bContext *C, MenuType *pt) static void menu_draw(const bContext *C, Menu *hdr) { + extern FunctionRNA rna_Menu_draw_func; + PointerRNA mtr; ParameterList list; FunctionRNA *func; RNA_pointer_create(&CTX_wm_screen(C)->id, hdr->type->ext.srna, hdr, &mtr); - func= RNA_struct_find_function(&mtr, "draw"); + func= &rna_Menu_draw_func; /* RNA_struct_find_function(&mtr, "draw"); */ RNA_parameter_list_create(&list, &mtr, func); RNA_parameter_set_lookup(&list, "context", &C); diff --git a/source/blender/makesrna/intern/rna_wm.c b/source/blender/makesrna/intern/rna_wm.c index e9df79acd4a..f8383b1d451 100644 --- a/source/blender/makesrna/intern/rna_wm.c +++ b/source/blender/makesrna/intern/rna_wm.c @@ -762,6 +762,8 @@ static void rna_Operator_unregister(struct Main *bmain, StructRNA *type) static int operator_poll(bContext *C, wmOperatorType *ot) { + extern FunctionRNA rna_Operator_poll_func; + PointerRNA ptr; ParameterList list; FunctionRNA *func; @@ -769,7 +771,7 @@ static int operator_poll(bContext *C, wmOperatorType *ot) int visible; RNA_pointer_create(NULL, ot->ext.srna, NULL, &ptr); /* dummy */ - func= RNA_struct_find_function(&ptr, "poll"); + func= &rna_Operator_poll_func; /* RNA_struct_find_function(&ptr, "poll"); */ RNA_parameter_list_create(&list, &ptr, func); RNA_parameter_set_lookup(&list, "context", &C); @@ -785,6 +787,8 @@ static int operator_poll(bContext *C, wmOperatorType *ot) static int operator_execute(bContext *C, wmOperator *op) { + extern FunctionRNA rna_Operator_execute_func; + PointerRNA opr; ParameterList list; FunctionRNA *func; @@ -792,7 +796,7 @@ static int operator_execute(bContext *C, wmOperator *op) int result; RNA_pointer_create(&CTX_wm_screen(C)->id, op->type->ext.srna, op, &opr); - func= RNA_struct_find_function(&opr, "execute"); + func= &rna_Operator_execute_func; /* RNA_struct_find_function(&opr, "execute"); */ RNA_parameter_list_create(&list, &opr, func); RNA_parameter_set_lookup(&list, "context", &C); @@ -809,6 +813,8 @@ static int operator_execute(bContext *C, wmOperator *op) /* same as execute() but no return value */ static int operator_check(bContext *C, wmOperator *op) { + extern FunctionRNA rna_Operator_check_func; + PointerRNA opr; ParameterList list; FunctionRNA *func; @@ -816,7 +822,7 @@ static int operator_check(bContext *C, wmOperator *op) int result; RNA_pointer_create(&CTX_wm_screen(C)->id, op->type->ext.srna, op, &opr); - func= RNA_struct_find_function(&opr, "check"); + func= &rna_Operator_check_func; /* RNA_struct_find_function(&opr, "check"); */ RNA_parameter_list_create(&list, &opr, func); RNA_parameter_set_lookup(&list, "context", &C); @@ -832,6 +838,8 @@ static int operator_check(bContext *C, wmOperator *op) static int operator_invoke(bContext *C, wmOperator *op, wmEvent *event) { + extern FunctionRNA rna_Operator_invoke_func; + PointerRNA opr; ParameterList list; FunctionRNA *func; @@ -839,7 +847,7 @@ static int operator_invoke(bContext *C, wmOperator *op, wmEvent *event) int result; RNA_pointer_create(&CTX_wm_screen(C)->id, op->type->ext.srna, op, &opr); - func= RNA_struct_find_function(&opr, "invoke"); + func= &rna_Operator_invoke_func; /* RNA_struct_find_function(&opr, "invoke"); */ RNA_parameter_list_create(&list, &opr, func); RNA_parameter_set_lookup(&list, "context", &C); @@ -857,6 +865,8 @@ static int operator_invoke(bContext *C, wmOperator *op, wmEvent *event) /* same as invoke */ static int operator_modal(bContext *C, wmOperator *op, wmEvent *event) { + extern FunctionRNA rna_Operator_modal_func; + PointerRNA opr; ParameterList list; FunctionRNA *func; @@ -864,7 +874,7 @@ static int operator_modal(bContext *C, wmOperator *op, wmEvent *event) int result; RNA_pointer_create(&CTX_wm_screen(C)->id, op->type->ext.srna, op, &opr); - func= RNA_struct_find_function(&opr, "modal"); + func= &rna_Operator_modal_func; /* RNA_struct_find_function(&opr, "modal"); */ RNA_parameter_list_create(&list, &opr, func); RNA_parameter_set_lookup(&list, "context", &C); @@ -881,12 +891,14 @@ static int operator_modal(bContext *C, wmOperator *op, wmEvent *event) static void operator_draw(bContext *C, wmOperator *op) { + extern FunctionRNA rna_Operator_draw_func; + PointerRNA opr; ParameterList list; FunctionRNA *func; RNA_pointer_create(&CTX_wm_screen(C)->id, op->type->ext.srna, op, &opr); - func= RNA_struct_find_function(&opr, "draw"); + func= &rna_Operator_draw_func; /* RNA_struct_find_function(&opr, "draw"); */ RNA_parameter_list_create(&list, &opr, func); RNA_parameter_set_lookup(&list, "context", &C); @@ -898,6 +910,8 @@ static void operator_draw(bContext *C, wmOperator *op) /* same as exec(), but call cancel */ static int operator_cancel(bContext *C, wmOperator *op) { + extern FunctionRNA rna_Operator_cancel_func; + PointerRNA opr; ParameterList list; FunctionRNA *func; @@ -905,7 +919,7 @@ static int operator_cancel(bContext *C, wmOperator *op) int result; RNA_pointer_create(&CTX_wm_screen(C)->id, op->type->ext.srna, op, &opr); - func= RNA_struct_find_function(&opr, "cancel"); + func= &rna_Operator_cancel_func; /* RNA_struct_find_function(&opr, "cancel"); */ RNA_parameter_list_create(&list, &opr, func); RNA_parameter_set_lookup(&list, "context", &C); -- cgit v1.2.3 From 364fcde86d3cdcb09d075a0445fc2e1eb64170d5 Mon Sep 17 00:00:00 2001 From: Antony Riakiotakis Date: Wed, 19 Oct 2011 23:04:48 +0000 Subject: #fix: Saving OpenEXR images as floats ignores color profile. This was not noticable in renderer because it works in linear color space. Painting on the image editor, saving and reloading was problematic though. --- .../blender/imbuf/intern/openexr/openexr_api.cpp | 56 ++++++++++++++++------ 1 file changed, 42 insertions(+), 14 deletions(-) diff --git a/source/blender/imbuf/intern/openexr/openexr_api.cpp b/source/blender/imbuf/intern/openexr/openexr_api.cpp index e064d7f760d..aa7defb2f39 100644 --- a/source/blender/imbuf/intern/openexr/openexr_api.cpp +++ b/source/blender/imbuf/intern/openexr/openexr_api.cpp @@ -342,27 +342,55 @@ static int imb_save_openexr_float(struct ImBuf *ibuf, const char *name, int flag FrameBuffer frameBuffer; OutputFile *file = new OutputFile(name, header); - int xstride = sizeof(float) * channels; - int ystride = - xstride*width; - float *rect[4] = {NULL, NULL, NULL, NULL}; - - /* last scanline, stride negative */ - rect[0]= ibuf->rect_float + channels*(height-1)*width; - rect[1]= rect[0]+1; - rect[2]= rect[0]+2; - rect[3]= (channels >= 4)? rect[0]+3:rect[0]; /* red as alpha, is this needed since alpha isnt written? */ - - frameBuffer.insert ("R", Slice (FLOAT, (char *)rect[0], xstride, ystride)); - frameBuffer.insert ("G", Slice (FLOAT, (char *)rect[1], xstride, ystride)); - frameBuffer.insert ("B", Slice (FLOAT, (char *)rect[2], xstride, ystride)); + int xstride = sizeof(float) * 4; + int ystride = xstride*width; + float *init_to = new float [4 * width*height * sizeof(float)]; + float *from, *to = init_to; + + frameBuffer.insert ("R", Slice (FLOAT, (char *)init_to, xstride, ystride)); + frameBuffer.insert ("G", Slice (FLOAT, (char *)(init_to + 1), xstride, ystride)); + frameBuffer.insert ("B", Slice (FLOAT, (char *)(init_to + 2), xstride, ystride)); if (ibuf->depth==32 && channels >= 4) - frameBuffer.insert ("A", Slice (FLOAT, (char *)rect[3], xstride, ystride)); + frameBuffer.insert ("A", Slice (FLOAT, (char *)(init_to + 3), xstride, ystride)); if (write_zbuf) frameBuffer.insert ("Z", Slice (FLOAT, (char *) (ibuf->zbuf_float + (height-1)*width), sizeof(float), sizeof(float) * -width)); + + if(ibuf->profile == IB_PROFILE_LINEAR_RGB) { + for (int i = ibuf->y-1; i >= 0; i--) + { + from= ibuf->rect_float + channels*i*width; + + for (int j = ibuf->x; j > 0; j--) + { + to[0] = from[0]; + to[1] = from[1]; + to[2] = from[2]; + to[3] = (channels >= 4)? from[3]: 1.0f; + to+= 4; from += 4; + } + } + } + else { + for (int i = ibuf->y-1; i >= 0; i--) + { + from= ibuf->rect_float + channels*i*width; + + for (int j = ibuf->x; j > 0; j--) + { + to[0] = srgb_to_linearrgb(from[0]); + to[1] = srgb_to_linearrgb(from[1]); + to[2] = srgb_to_linearrgb(from[2]); + to[3] = (channels >= 4)? from[3]: 1.0f; + to+= 4; from += 4; + } + } + } + file->setFrameBuffer (frameBuffer); file->writePixels (height); delete file; + delete [] init_to; } catch (const std::exception &exc) { -- cgit v1.2.3 From 5cf593a778e3dca51a5ebd6b4c23ce6c7b0a7ac6 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 19 Oct 2011 23:10:54 +0000 Subject: strcpy() --> BLI_strncpy(), where source strings are not fixed and target size is known. --- source/blender/blenkernel/BKE_packedFile.h | 2 +- source/blender/blenkernel/intern/image.c | 6 +-- source/blender/blenkernel/intern/modifier.c | 4 +- source/blender/blenkernel/intern/node.c | 2 +- source/blender/blenkernel/intern/packedFile.c | 53 +++++++++++----------- source/blender/blenkernel/intern/pointcache.c | 10 ++-- source/blender/blenkernel/intern/property.c | 6 +-- source/blender/blenkernel/intern/sequencer.c | 14 +++--- source/blender/blenkernel/intern/sound.c | 4 +- source/blender/blenkernel/intern/texture.c | 2 +- source/blender/blenlib/intern/fileops.c | 8 ++-- source/blender/blenlib/intern/freetypefont.c | 2 +- source/blender/blenlib/intern/storage.c | 12 ++--- source/blender/blenloader/BLO_readfile.h | 2 +- source/blender/blenloader/BLO_runtime.h | 4 +- source/blender/blenloader/intern/readblenentry.c | 2 +- source/blender/blenloader/intern/readfile.c | 16 +++---- source/blender/blenloader/intern/runtime.c | 4 +- source/blender/collada/AnimationImporter.cpp | 4 +- source/blender/editors/armature/editarmature.c | 6 +-- source/blender/editors/armature/poselib.c | 9 ++-- .../blender/editors/gpencil/editaction_gpencil.c | 2 +- source/blender/editors/interface/resources.c | 2 +- source/blender/editors/object/object_constraint.c | 2 +- source/blender/editors/object/object_relations.c | 10 ++-- source/blender/editors/object/object_vgroup.c | 2 +- source/blender/editors/render/render_preview.c | 2 +- source/blender/editors/screen/screendump.c | 2 +- source/blender/editors/sculpt_paint/paint_image.c | 4 +- source/blender/editors/sculpt_paint/sculpt_undo.c | 2 +- .../editors/space_sequencer/sequencer_add.c | 2 +- .../editors/space_sequencer/sequencer_edit.c | 4 +- source/blender/imbuf/intern/anim_movie.c | 2 +- source/blender/makesrna/intern/rna_lattice.c | 7 +-- source/blender/makesrna/intern/rna_object_force.c | 8 ++-- source/blender/modifiers/intern/MOD_solidify.c | 3 +- source/blender/nodes/intern/node_common.c | 4 +- .../blender/render/intern/source/renderdatabase.c | 4 +- source/gameengine/GamePlayer/ghost/GPG_ghost.cpp | 6 +-- 39 files changed, 118 insertions(+), 122 deletions(-) diff --git a/source/blender/blenkernel/BKE_packedFile.h b/source/blender/blenkernel/BKE_packedFile.h index 556ff26e621..f1c7356e6b0 100644 --- a/source/blender/blenkernel/BKE_packedFile.h +++ b/source/blender/blenkernel/BKE_packedFile.h @@ -51,7 +51,7 @@ struct PackedFile *newPackedFileMemory(void *mem, int memlen); void packAll(struct Main *bmain, struct ReportList *reports); /* unpack */ -char *unpackFile(struct ReportList *reports, char *abs_name, char *local_name, struct PackedFile *pf, int how); +char *unpackFile(struct ReportList *reports, const char *abs_name, const char *local_name, struct PackedFile *pf, int how); int unpackVFont(struct ReportList *reports, struct VFont *vfont, int how); int unpackSound(struct Main *bmain, struct ReportList *reports, struct bSound *sound, int how); int unpackImage(struct ReportList *reports, struct Image *ima, int how); diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c index 1de581034a4..37982e7fec9 100644 --- a/source/blender/blenkernel/intern/image.c +++ b/source/blender/blenkernel/intern/image.c @@ -906,8 +906,8 @@ static void stampdata(Scene *scene, Object *camera, StampData *stamp_data, int d if (scene->r.stamp & R_STAMP_MARKER) { char *name = scene_find_last_marker_name(scene, CFRA); - - if (name) strcpy(text, name); + + if (name) BLI_strncpy(text, name, sizeof(text)); else strcpy(text, ""); BLI_snprintf(stamp_data->marker, sizeof(stamp_data->marker), do_prefix ? "Marker %s":"%s", text); @@ -980,7 +980,7 @@ static void stampdata(Scene *scene, Object *camera, StampData *stamp_data, int d if (scene->r.stamp & R_STAMP_SEQSTRIP) { Sequence *seq= seq_foreground_frame_get(scene, scene->r.cfra); - if (seq) strcpy(text, seq->name+2); + if (seq) BLI_strncpy(text, seq->name+2, sizeof(text)); else strcpy(text, ""); BLI_snprintf(stamp_data->strip, sizeof(stamp_data->strip), do_prefix ? "Strip %s":"%s", text); diff --git a/source/blender/blenkernel/intern/modifier.c b/source/blender/blenkernel/intern/modifier.c index 9de75a49998..2cee9676e5e 100644 --- a/source/blender/blenkernel/intern/modifier.c +++ b/source/blender/blenkernel/intern/modifier.c @@ -86,8 +86,8 @@ ModifierData *modifier_new(int type) ModifierTypeInfo *mti = modifierType_getInfo(type); ModifierData *md = MEM_callocN(mti->structSize, mti->structName); - // FIXME: we need to make the name always be unique somehow... - strcpy(md->name, mti->name); + /* note, this name must be made unique later */ + BLI_strncpy(md->name, mti->name, sizeof(md->name)); md->type = type; md->mode = eModifierMode_Realtime diff --git a/source/blender/blenkernel/intern/node.c b/source/blender/blenkernel/intern/node.c index a46b358798a..cb1f52a6265 100644 --- a/source/blender/blenkernel/intern/node.c +++ b/source/blender/blenkernel/intern/node.c @@ -374,7 +374,7 @@ void nodeMakeDynamicType(bNode *node) /*node->typeinfo= MEM_dupallocN(ntype);*/ bNodeType *newtype= MEM_callocN(sizeof(bNodeType), "dynamic bNodeType"); *newtype= *ntype; - strcpy(newtype->name, ntype->name); + BLI_strncpy(newtype->name, ntype->name, sizeof(newtype->name)); node->typeinfo= newtype; } } diff --git a/source/blender/blenkernel/intern/packedFile.c b/source/blender/blenkernel/intern/packedFile.c index 2c8975e9cb4..0041cd33c14 100644 --- a/source/blender/blenkernel/intern/packedFile.c +++ b/source/blender/blenkernel/intern/packedFile.c @@ -182,7 +182,7 @@ PackedFile *newPackedFile(ReportList *reports, const char *filename, const char // convert relative filenames to absolute filenames - strcpy(name, filename); + BLI_strncpy(name, filename, sizeof(name)); BLI_path_abs(name, basepath); // open the file @@ -240,7 +240,7 @@ void packAll(Main *bmain, ReportList *reports) } -/* +#if 0 // attempt to create a function that generates an unique filename // this will work when all funtions in fileops.c understand relative filenames... @@ -249,6 +249,7 @@ static char *find_new_name(char *name) { char tempname[FILE_MAXDIR + FILE_MAXFILE]; char *newname; + size_t len; if (fop_exists(name)) { for (number = 1; number <= 999; number++) { @@ -258,14 +259,12 @@ static char *find_new_name(char *name) } } } - - newname = mallocN(strlen(tempname) + 1, "find_new_name"); - strcpy(newname, tempname); - - return(newname); + len= strlen(tempname) + 1; + newname = MEM_mallocN(len, "find_new_name"); + memcpy(newname, tempname, len * sizeof(char)); + return newname; } - -*/ +#endif int writePackedFile(ReportList *reports, const char *filename, PackedFile *pf, int guimode) { @@ -277,12 +276,12 @@ int writePackedFile(ReportList *reports, const char *filename, PackedFile *pf, i if (guimode) {} //XXX waitcursor(1); - strcpy(name, filename); + BLI_strncpy(name, filename, sizeof(name)); BLI_path_abs(name, G.main->name); if (BLI_exists(name)) { for (number = 1; number <= 999; number++) { - sprintf(tempname, "%s.%03d_", name, number); + BLI_snprintf(tempname, sizeof(tempname), "%s.%03d_", name, number); if (! BLI_exists(tempname)) { if (BLI_copy_fileops(name, tempname) == RET_OK) { remove_tmp = TRUE; @@ -342,7 +341,7 @@ int checkPackedFile(const char *filename, PackedFile *pf) char buf[4096]; char name[FILE_MAXDIR + FILE_MAXFILE]; - strcpy(name, filename); + BLI_strncpy(name, filename, sizeof(name)); BLI_path_abs(name, G.main->name); if (stat(name, &st)) { @@ -392,9 +391,10 @@ there was an error or when the user desides to cancel the operation. */ -char *unpackFile(ReportList *reports, char *abs_name, char *local_name, PackedFile *pf, int how) +char *unpackFile(ReportList *reports, const char *abs_name, const char *local_name, PackedFile *pf, int how) { - char *newname = NULL, *temp = NULL; + char *newname = NULL; + const char *temp = NULL; // char newabs[FILE_MAXDIR + FILE_MAXFILE]; // char newlocal[FILE_MAXDIR + FILE_MAXFILE]; @@ -437,12 +437,11 @@ char *unpackFile(ReportList *reports, char *abs_name, char *local_name, PackedFi } if (temp) { - newname = MEM_mallocN(strlen(temp) + 1, "unpack_file newname"); - strcpy(newname, temp); + newname= BLI_strdup(temp); } } - return (newname); + return newname; } @@ -453,17 +452,17 @@ int unpackVFont(ReportList *reports, VFont *vfont, int how) int ret_value = RET_ERROR; if (vfont != NULL) { - strcpy(localname, vfont->name); + BLI_strncpy(localname, vfont->name, sizeof(localname)); BLI_splitdirstring(localname, fi); - sprintf(localname, "//fonts/%s", fi); + BLI_snprintf(localname, sizeof(localname), "//fonts/%s", fi); newname = unpackFile(reports, vfont->name, localname, vfont->packedfile, how); if (newname != NULL) { ret_value = RET_OK; freePackedFile(vfont->packedfile); vfont->packedfile = NULL; - strcpy(vfont->name, newname); + BLI_strncpy(vfont->name, newname, sizeof(vfont->name)); MEM_freeN(newname); } } @@ -478,13 +477,13 @@ int unpackSound(Main *bmain, ReportList *reports, bSound *sound, int how) int ret_value = RET_ERROR; if (sound != NULL) { - strcpy(localname, sound->name); + BLI_strncpy(localname, sound->name, sizeof(localname)); BLI_splitdirstring(localname, fi); - sprintf(localname, "//sounds/%s", fi); + BLI_snprintf(localname, sizeof(localname), "//sounds/%s", fi); newname = unpackFile(reports, sound->name, localname, sound->packedfile, how); if (newname != NULL) { - strcpy(sound->name, newname); + BLI_strncpy(sound->name, newname, sizeof(sound->name)); MEM_freeN(newname); freePackedFile(sound->packedfile); @@ -506,16 +505,16 @@ int unpackImage(ReportList *reports, Image *ima, int how) int ret_value = RET_ERROR; if (ima != NULL) { - strcpy(localname, ima->name); + BLI_strncpy(localname, ima->name, sizeof(localname)); BLI_splitdirstring(localname, fi); - sprintf(localname, "//textures/%s", fi); - + BLI_snprintf(localname, sizeof(localname), "//textures/%s", fi); + newname = unpackFile(reports, ima->name, localname, ima->packedfile, how); if (newname != NULL) { ret_value = RET_OK; freePackedFile(ima->packedfile); ima->packedfile = NULL; - strcpy(ima->name, newname); + BLI_strncpy(ima->name, newname, sizeof(ima->name)); MEM_freeN(newname); BKE_image_signal(ima, NULL, IMA_SIGNAL_RELOAD); } diff --git a/source/blender/blenkernel/intern/pointcache.c b/source/blender/blenkernel/intern/pointcache.c index bc5bc87b1fa..8e5452e2704 100644 --- a/source/blender/blenkernel/intern/pointcache.c +++ b/source/blender/blenkernel/intern/pointcache.c @@ -2891,24 +2891,24 @@ void BKE_ptcache_disk_cache_rename(PTCacheID *pid, char *from, char *to) char ext[MAX_PTCACHE_PATH]; /* save old name */ - strcpy(old_name, pid->cache->name); + BLI_strncpy(old_name, pid->cache->name, sizeof(old_name)); /* get "from" filename */ - strcpy(pid->cache->name, from); + BLI_strncpy(pid->cache->name, from, sizeof(pid->cache->name)); len = ptcache_filename(pid, old_filename, 0, 0, 0); /* no path */ ptcache_path(pid, path); dir = opendir(path); if(dir==NULL) { - strcpy(pid->cache->name, old_name); + BLI_strncpy(pid->cache->name, old_name, sizeof(pid->cache->name)); return; } BLI_snprintf(ext, sizeof(ext), "_%02u"PTCACHE_EXT, pid->stack_index); /* put new name into cache */ - strcpy(pid->cache->name, to); + BLI_strncpy(pid->cache->name, to, sizeof(pid->cache->name)); while ((de = readdir(dir)) != NULL) { if (strstr(de->d_name, ext)) { /* do we have the right extension?*/ @@ -2963,7 +2963,7 @@ void BKE_ptcache_load_external(PTCacheID *pid) if(cache->index >= 0) BLI_snprintf(ext, sizeof(ext), "_%02d"PTCACHE_EXT, cache->index); else - strcpy(ext, PTCACHE_EXT); + BLI_strncpy(ext, PTCACHE_EXT, sizeof(ext)); while ((de = readdir(dir)) != NULL) { if (strstr(de->d_name, ext)) { /* do we have the right extension?*/ diff --git a/source/blender/blenkernel/intern/property.c b/source/blender/blenkernel/intern/property.c index cdf2e39a4dd..e0e2876f79e 100644 --- a/source/blender/blenkernel/intern/property.c +++ b/source/blender/blenkernel/intern/property.c @@ -166,7 +166,7 @@ void unique_property(bProperty *first, bProperty *prop, int force) int i= 0; /* strip numbers */ - strcpy(base_name, prop->name); + BLI_strncpy(base_name, prop->name, sizeof(base_name)); for(i= strlen(base_name)-1; (i>=0 && isdigit(base_name[i])); i--) { base_name[i]= '\0'; } @@ -178,7 +178,7 @@ void unique_property(bProperty *first, bProperty *prop, int force) strcat(new_name, num); } while(get_property__internal(first, prop, new_name)); - strcpy(prop->name, new_name); + BLI_strncpy(prop->name, new_name, sizeof(prop->name)); } } } @@ -257,7 +257,7 @@ void set_property(bProperty *prop, char *str) *((float *)&prop->data)= (float)atof(str); break; case GPROP_STRING: - strcpy(prop->poin, str); + strcpy(prop->poin, str); /* TODO - check size? */ break; } diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c index 00534400cf1..a7c19130929 100644 --- a/source/blender/blenkernel/intern/sequencer.c +++ b/source/blender/blenkernel/intern/sequencer.c @@ -866,8 +866,8 @@ void seqbase_unique_name_recursive(ListBase *seqbasep, struct Sequence *seq) SeqUniqueInfo sui; char *dot; sui.seq= seq; - strcpy(sui.name_src, seq->name+2); - strcpy(sui.name_dest, seq->name+2); + BLI_strncpy(sui.name_src, seq->name+2, sizeof(sui.name_src)); + BLI_strncpy(sui.name_dest, seq->name+2, sizeof(sui.name_dest)); sui.count= 1; sui.match= 1; /* assume the worst to start the loop */ @@ -887,7 +887,7 @@ void seqbase_unique_name_recursive(ListBase *seqbasep, struct Sequence *seq) seqbase_recursive_apply(seqbasep, seqbase_unique_name_recursive_cb, &sui); } - strcpy(seq->name+2, sui.name_dest); + BLI_strncpy(seq->name+2, sui.name_dest, sizeof(seq->name)-2); } static const char *give_seqname_by_type(int type) @@ -1204,7 +1204,7 @@ static int seq_proxy_get_fname(SeqRenderData context, Sequence * seq, int cfra, sorry folks, please rebuild your proxies... */ if (seq->flag & (SEQ_USE_PROXY_CUSTOM_DIR|SEQ_USE_PROXY_CUSTOM_FILE)) { - strcpy(dir, seq->strip->proxy->dir); + BLI_strncpy(dir, seq->strip->proxy->dir, sizeof(dir)); } else if (seq->type == SEQ_IMAGE) { BLI_snprintf(dir, PROXY_MAXFILE, "%s/BL_proxy", seq->strip->dir); } else { @@ -3360,9 +3360,9 @@ int seq_swap(Sequence *seq_a, Sequence *seq_b, const char **error_str) SWAP(Sequence, *seq_a, *seq_b); /* swap back names so animation fcurves dont get swapped */ - strcpy(name, seq_a->name+2); - strcpy(seq_a->name+2, seq_b->name+2); - strcpy(seq_b->name+2, name); + BLI_strncpy(name, seq_a->name+2, sizeof(name)); + BLI_strncpy(seq_a->name+2, seq_b->name+2, sizeof(seq_b->name)-2); + BLI_strncpy(seq_b->name+2, name, sizeof(seq_b->name)-2); /* swap back opacity, and overlay mode */ SWAP(int, seq_a->blend_mode, seq_b->blend_mode); diff --git a/source/blender/blenkernel/intern/sound.c b/source/blender/blenkernel/intern/sound.c index 07df12d5468..02e381fe9b4 100644 --- a/source/blender/blenkernel/intern/sound.c +++ b/source/blender/blenkernel/intern/sound.c @@ -79,9 +79,9 @@ struct bSound* sound_new_file(struct Main *bmain, const char *filename) char str[FILE_MAX]; char *path; - int len; + size_t len; - strcpy(str, filename); + BLI_strncpy(str, filename, sizeof(str)); path = /*bmain ? bmain->name :*/ G.main->name; diff --git a/source/blender/blenkernel/intern/texture.c b/source/blender/blenkernel/intern/texture.c index d344f79bb6c..7d720aed62c 100644 --- a/source/blender/blenkernel/intern/texture.c +++ b/source/blender/blenkernel/intern/texture.c @@ -992,7 +992,7 @@ void autotexname(Tex *tex) if(tex->type==TEX_IMAGE) { ima= tex->ima; if(ima) { - strcpy(di, ima->name); + BLI_strncpy(di, ima->name, sizeof(di)); BLI_splitdirstring(di, fi); strcpy(di, "I."); strcat(di, fi); diff --git a/source/blender/blenlib/intern/fileops.c b/source/blender/blenlib/intern/fileops.c index 9ccd7fbe121..e848ad8d0d3 100644 --- a/source/blender/blenlib/intern/fileops.c +++ b/source/blender/blenlib/intern/fileops.c @@ -227,7 +227,7 @@ int BLI_move(const char *file, const char *to) { // it has to be 'mv filename filename' and not // 'mv filename destdir' - strcpy(str, to); + BLI_strncpy(str, to, sizeof(str)); // points 'to' to a directory ? if (BLI_last_slash(str) == (str + strlen(str) - 1)) { if (BLI_last_slash(file) != NULL) { @@ -252,7 +252,7 @@ int BLI_copy_fileops(const char *file, const char *to) { // it has to be 'cp filename filename' and not // 'cp filename destdir' - strcpy(str, to); + BLI_strncpy(str, to, sizeof(str)); // points 'to' to a directory ? if (BLI_last_slash(str) == (str + strlen(str) - 1)) { if (BLI_last_slash(file) != NULL) { @@ -286,7 +286,7 @@ void BLI_recurdir_fileops(const char *dirname) { // blah1/blah2/ (with slash) after creating // blah1/blah2 (without slash) - strcpy(tmp, dirname); + BLI_strncpy(tmp, dirname, sizeof(tmp)); lslash= BLI_last_slash(tmp); if (lslash == tmp + strlen(tmp) - 1) { @@ -371,7 +371,7 @@ void BLI_recurdir_fileops(const char *dirname) { if (BLI_exists(dirname)) return; - strcpy(tmp, dirname); + BLI_strncpy(tmp, dirname, sizeof(tmp)); lslash= BLI_last_slash(tmp); if (lslash) { diff --git a/source/blender/blenlib/intern/freetypefont.c b/source/blender/blenlib/intern/freetypefont.c index 0fe028eb3c0..7e5d03423e5 100644 --- a/source/blender/blenlib/intern/freetypefont.c +++ b/source/blender/blenlib/intern/freetypefont.c @@ -364,7 +364,7 @@ static VFontData *objfnt_to_ftvfontdata(PackedFile * pf) // get the name fontname = FT_Get_Postscript_Name(face); - strcpy(vfd->name, (fontname == NULL) ? "" : fontname); + BLI_strncpy(vfd->name, (fontname == NULL) ? "" : fontname, sizeof(vfd->name)); // Extract the first 256 character from TTF lcode= charcode= FT_Get_First_Char(face, &glyph_index); diff --git a/source/blender/blenlib/intern/storage.c b/source/blender/blenlib/intern/storage.c index e336b914ffa..7638e95b4ec 100644 --- a/source/blender/blenlib/intern/storage.c +++ b/source/blender/blenlib/intern/storage.c @@ -304,15 +304,15 @@ void BLI_adddirstrings(void) for(num=0, file= files; nummode1, types[0]); - strcpy(file->mode2, types[0]); - strcpy(file->mode3, types[0]); + BLI_strncpy(file->mode1, types[0], sizeof(file->mode1)); + BLI_strncpy(file->mode2, types[0], sizeof(file->mode2)); + BLI_strncpy(file->mode3, types[0], sizeof(file->mode3)); #else mode = file->s.st_mode; - strcpy(file->mode1, types[(mode & 0700) >> 6]); - strcpy(file->mode2, types[(mode & 0070) >> 3]); - strcpy(file->mode3, types[(mode & 0007)]); + BLI_strncpy(file->mode1, types[(mode & 0700) >> 6], sizeof(file->mode1)); + BLI_strncpy(file->mode2, types[(mode & 0070) >> 3], sizeof(file->mode2)); + BLI_strncpy(file->mode3, types[(mode & 0007)], sizeof(file->mode3)); if (((mode & S_ISGID) == S_ISGID) && (file->mode2[2]=='-'))file->mode2[2]='l'; diff --git a/source/blender/blenloader/BLO_readfile.h b/source/blender/blenloader/BLO_readfile.h index e7be98d955d..2799b2165f0 100644 --- a/source/blender/blenloader/BLO_readfile.h +++ b/source/blender/blenloader/BLO_readfile.h @@ -252,7 +252,7 @@ void BLO_library_append_end(const struct bContext *C, struct Main *mainl, BlendH void *BLO_library_read_struct(struct FileData *fd, struct BHead *bh, const char *blockname); -BlendFileData* blo_read_blendafterruntime(int file, char *name, int actualsize, struct ReportList *reports); +BlendFileData* blo_read_blendafterruntime(int file, const char *name, int actualsize, struct ReportList *reports); #ifdef __cplusplus } diff --git a/source/blender/blenloader/BLO_runtime.h b/source/blender/blenloader/BLO_runtime.h index 920b14e92fa..0a3ceeefa78 100644 --- a/source/blender/blenloader/BLO_runtime.h +++ b/source/blender/blenloader/BLO_runtime.h @@ -42,8 +42,8 @@ extern "C" { struct BlendFileData; struct ReportList; -int BLO_is_a_runtime(char *file); -struct BlendFileData *BLO_read_runtime(char *file, struct ReportList *reports); +int BLO_is_a_runtime(const char *file); +struct BlendFileData *BLO_read_runtime(const char *file, struct ReportList *reports); #ifdef __cplusplus } diff --git a/source/blender/blenloader/intern/readblenentry.c b/source/blender/blenloader/intern/readblenentry.c index 0e93e5fa8c0..220784c9ff7 100644 --- a/source/blender/blenloader/intern/readblenentry.c +++ b/source/blender/blenloader/intern/readblenentry.c @@ -288,7 +288,7 @@ BlendFileData *BLO_read_from_memfile(Main *oldmain, const char *filename, MemFil fd = blo_openblendermemfile(memfile, reports); if (fd) { fd->reports= reports; - strcpy(fd->relabase, filename); + BLI_strncpy(fd->relabase, filename, sizeof(fd->relabase)); /* clear ob->proxy_from pointers in old main */ blo_clear_proxy_pointers_from_lib(oldmain); diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index a6474fb5044..667550bcaa0 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -9275,7 +9275,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) simasel->prv_h = 96; simasel->prv_w = 96; simasel->flag = 7; /* ??? elubie */ - strcpy (simasel->dir, U.textudir); /* TON */ + BLI_strncpy (simasel->dir, U.textudir, sizeof(simasel->dir)); /* TON */ simasel->file[0]= '\0'; simasel->returnfunc = NULL; @@ -9498,7 +9498,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) ct= MEM_callocN(sizeof(bConstraintTarget), "PyConTarget"); ct->tar = data->tar; - strcpy(ct->subtarget, data->subtarget); + BLI_strncpy(ct->subtarget, data->subtarget, sizeof(ct->subtarget)); ct->space = con->tarspace; BLI_addtail(&data->targets, ct); @@ -9528,7 +9528,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) ct= MEM_callocN(sizeof(bConstraintTarget), "PyConTarget"); ct->tar = data->tar; - strcpy(ct->subtarget, data->subtarget); + BLI_strncpy(ct->subtarget, data->subtarget, sizeof(ct->subtarget)); ct->space = con->tarspace; BLI_addtail(&data->targets, ct); @@ -12008,8 +12008,8 @@ static void do_versions(FileData *fd, Library *lib, Main *main) aa->flag = ia->flag; aa->sta = ia->sta; aa->end = ia->end; - strcpy(aa->name, ia->name); - strcpy(aa->frameProp, ia->frameProp); + BLI_strncpy(aa->name, ia->name, sizeof(aa->name)); + BLI_strncpy(aa->frameProp, ia->frameProp, sizeof(aa->frameProp)); if (ob->adt) aa->act = ob->adt->action; @@ -13651,8 +13651,8 @@ static void read_libraries(FileData *basefd, ListBase *mainlist) printf(" enter a new path:\n"); if(scanf("%s", newlib_path) > 0) { - strcpy(mainptr->curlib->name, newlib_path); - strcpy(mainptr->curlib->filepath, newlib_path); + BLI_strncpy(mainptr->curlib->name, newlib_path, sizeof(mainptr->curlib->name)); + BLI_strncpy(mainptr->curlib->filepath, newlib_path, sizeof(mainptr->curlib->filepath)); cleanup_path(G.main->name, mainptr->curlib->filepath); fd= blo_openblenderfile(mainptr->curlib->filepath, basefd->reports); @@ -13768,7 +13768,7 @@ static void read_libraries(FileData *basefd, ListBase *mainlist) /* reading runtime */ -BlendFileData *blo_read_blendafterruntime(int file, char *name, int actualsize, ReportList *reports) +BlendFileData *blo_read_blendafterruntime(int file, const char *name, int actualsize, ReportList *reports) { BlendFileData *bfd = NULL; FileData *fd = filedata_new(); diff --git a/source/blender/blenloader/intern/runtime.c b/source/blender/blenloader/intern/runtime.c index f5308b5ea5c..7a241e007f2 100644 --- a/source/blender/blenloader/intern/runtime.c +++ b/source/blender/blenloader/intern/runtime.c @@ -68,7 +68,7 @@ static int handle_read_msb_int(int handle) return (buf[0]<<24) + (buf[1]<<16) + (buf[2]<<8) + (buf[3]<<0); } -int BLO_is_a_runtime(char *path) +int BLO_is_a_runtime(const char *path) { int res= 0, fd= open(path, O_BINARY|O_RDONLY, 0); int datastart; @@ -97,7 +97,7 @@ cleanup: return res; } -BlendFileData *BLO_read_runtime(char *path, ReportList *reports) +BlendFileData *BLO_read_runtime(const char *path, ReportList *reports) { BlendFileData *bfd= NULL; size_t actualsize; diff --git a/source/blender/collada/AnimationImporter.cpp b/source/blender/collada/AnimationImporter.cpp index f3a6e2371bb..dec93c0ff63 100644 --- a/source/blender/collada/AnimationImporter.cpp +++ b/source/blender/collada/AnimationImporter.cpp @@ -691,7 +691,7 @@ void AnimationImporter::apply_matrix_curves( Object * ob, std::vector& if (is_joint) BLI_snprintf(rna_path, sizeof(rna_path), "%s.%s", joint_path, tm_str); else - strcpy(rna_path, tm_str); + BLI_strncpy(rna_path, tm_str, sizeof(rna_path)); newcu[i] = create_fcurve(axis, rna_path); newcu[i]->totvert = frames.size(); } @@ -1246,7 +1246,7 @@ Object *AnimationImporter::translate_animation_OLD(COLLADAFW::Node *node, if (is_joint) BLI_snprintf(rna_path, sizeof(rna_path), "%s.%s", joint_path, tm_str); else - strcpy(rna_path, tm_str); + BLI_strncpy(rna_path, tm_str, sizeof(rna_path)); newcu[i] = create_fcurve(axis, rna_path); #ifdef ARMATURE_TEST diff --git a/source/blender/editors/armature/editarmature.c b/source/blender/editors/armature/editarmature.c index 20368bbf57b..11fd932eed6 100644 --- a/source/blender/editors/armature/editarmature.c +++ b/source/blender/editors/armature/editarmature.c @@ -824,7 +824,7 @@ static void joined_armature_fix_links(Object *tarArm, Object *srcArm, bPoseChann } else if (strcmp(ct->subtarget, pchan->name)==0) { ct->tar = tarArm; - strcpy(ct->subtarget, curbone->name); + BLI_strncpy(ct->subtarget, curbone->name, sizeof(ct->subtarget)); } } } @@ -871,7 +871,7 @@ static void joined_armature_fix_links(Object *tarArm, Object *srcArm, bPoseChann } else if (strcmp(ct->subtarget, pchan->name)==0) { ct->tar = tarArm; - strcpy(ct->subtarget, curbone->name); + BLI_strncpy(ct->subtarget, curbone->name, sizeof(ct->subtarget)); } } } @@ -2503,7 +2503,7 @@ void updateDuplicateSubtargetObjects(EditBone *dupBone, ListBase *editbones, Obj */ if (oldtarget->temp) { newtarget = (EditBone *) oldtarget->temp; - strcpy(ct->subtarget, newtarget->name); + BLI_strncpy(ct->subtarget, newtarget->name, sizeof(ct->subtarget)); } } } diff --git a/source/blender/editors/armature/poselib.c b/source/blender/editors/armature/poselib.c index bf2e17c4e87..e7c7ebf3ece 100644 --- a/source/blender/editors/armature/poselib.c +++ b/source/blender/editors/armature/poselib.c @@ -997,11 +997,8 @@ static void poselib_preview_apply (bContext *C, wmOperator *op) } /* get marker name */ - if (pld->marker) - strcpy(markern, pld->marker->name); - else - strcpy(markern, "No Matches"); - + BLI_strncpy(markern, pld->marker ? pld->marker->name : "No Matches", sizeof(markern)); + sprintf(pld->headerstr, "PoseLib Previewing Pose: Filter - [%s] | Current Pose - \"%s\" | Use ScrollWheel or PageUp/Down to change", tempstr, markern); ED_area_headerprint(pld->sa, pld->headerstr); } @@ -1186,7 +1183,7 @@ static int poselib_preview_handle_event (bContext *UNUSED(C), wmOperator *op, wm /* backup stuff that needs to occur before every operation * - make a copy of searchstr, so that we know if cache needs to be rebuilt */ - strcpy(pld->searchold, pld->searchstr); + BLI_strncpy(pld->searchold, pld->searchstr, sizeof(pld->searchold)); /* if we're currently showing the original pose, only certain events are handled */ if (pld->flag & PL_PREVIEW_SHOWORIGINAL) { diff --git a/source/blender/editors/gpencil/editaction_gpencil.c b/source/blender/editors/gpencil/editaction_gpencil.c index b6398c6a2f5..56210864593 100644 --- a/source/blender/editors/gpencil/editaction_gpencil.c +++ b/source/blender/editors/gpencil/editaction_gpencil.c @@ -311,7 +311,7 @@ void copy_gpdata () gpln= MEM_callocN(sizeof(bGPDlayer), "GPCopyPasteLayer"); gpln->frames.first= gpln->frames.last= NULL; - strcpy(gpln->info, gpls->info); + BLI_strncpy(gpln->info, gpls->info, sizeof(gpln->info)); BLI_addtail(&gpcopybuf, gpln); diff --git a/source/blender/editors/interface/resources.c b/source/blender/editors/interface/resources.c index 9b9237f70cf..fd511948bac 100644 --- a/source/blender/editors/interface/resources.c +++ b/source/blender/editors/interface/resources.c @@ -1151,7 +1151,7 @@ void init_userdef_do_versions(void) vDM_ColorBand_store((U.flag & USER_CUSTOM_RANGE) ? (&U.coba_weight):NULL); if (bmain->versionfile <= 191) { - strcpy(U.plugtexdir, U.textudir); + BLI_strncpy(U.plugtexdir, U.textudir, sizeof(U.plugtexdir)); strcpy(U.sounddir, "/"); } diff --git a/source/blender/editors/object/object_constraint.c b/source/blender/editors/object/object_constraint.c index 6c553289052..ec7c6cc6108 100644 --- a/source/blender/editors/object/object_constraint.c +++ b/source/blender/editors/object/object_constraint.c @@ -245,7 +245,7 @@ static void set_constraint_nth_target (bConstraint *con, Object *target, const c for (ct=targets.first, i=0; ct; ct= ct->next, i++) { if (i == index) { ct->tar= target; - strcpy(ct->subtarget, subtarget); + BLI_strncpy(ct->subtarget, subtarget, sizeof(ct->subtarget)); break; } } diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c index 389c0941cc2..49a71018719 100644 --- a/source/blender/editors/object/object_relations.c +++ b/source/blender/editors/object/object_relations.c @@ -334,11 +334,9 @@ static int make_proxy_exec (bContext *C, wmOperator *op) /* Add new object for the proxy */ newob= add_object(scene, OB_EMPTY); - if (gob) - strcpy(name, gob->id.name+2); - else - strcpy(name, ob->id.name+2); - strcat(name, "_proxy"); + + BLI_snprintf(name, sizeof(name), "%s_proxy", ((ID *)(gob ? gob : ob))->name); + rename_id(&newob->id, name); /* set layers OK */ @@ -605,7 +603,7 @@ static int parent_set_exec(bContext *C, wmOperator *op) /* handle types */ if (pchan) - strcpy(ob->parsubstr, pchan->name); + BLI_strncpy(ob->parsubstr, pchan->name, sizeof(ob->parsubstr)); else ob->parsubstr[0]= 0; diff --git a/source/blender/editors/object/object_vgroup.c b/source/blender/editors/object/object_vgroup.c index 7b4db347315..c1b21865504 100644 --- a/source/blender/editors/object/object_vgroup.c +++ b/source/blender/editors/object/object_vgroup.c @@ -669,7 +669,7 @@ static void vgroup_duplicate(Object *ob) } cdg = defgroup_duplicate(dg); - strcpy(cdg->name, name); + BLI_strncpy(cdg->name, name, sizeof(cdg->name)); defgroup_unique_name(cdg, ob); BLI_addtail(&ob->defbase, cdg); diff --git a/source/blender/editors/render/render_preview.c b/source/blender/editors/render/render_preview.c index 70709a22d3d..697cddfcee0 100644 --- a/source/blender/editors/render/render_preview.c +++ b/source/blender/editors/render/render_preview.c @@ -261,7 +261,7 @@ static Scene *preview_prepare_scene(Scene *scene, ID *id, int id_type, ShaderPre sce->r.alphamode= R_ADDSKY; sce->r.cfra= scene->r.cfra; - strcpy(sce->r.engine, scene->r.engine); + BLI_strncpy(sce->r.engine, scene->r.engine, sizeof(sce->r.engine)); if(id_type==ID_MA) { Material *mat= NULL, *origmat= (Material *)id; diff --git a/source/blender/editors/screen/screendump.c b/source/blender/editors/screen/screendump.c index 3010adafe20..27c311aa04f 100644 --- a/source/blender/editors/screen/screendump.c +++ b/source/blender/editors/screen/screendump.c @@ -157,7 +157,7 @@ static int screenshot_exec(bContext *C, wmOperator *op) RNA_string_get(op->ptr, "filepath", path); - strcpy(G.ima, path); + BLI_strncpy(G.ima, path, sizeof(G.ima)); BLI_path_abs(path, G.main->name); /* BKE_add_image_extension() checks for if extension was already set */ diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c index c5af8971907..b6b22c391b8 100644 --- a/source/blender/editors/sculpt_paint/paint_image.c +++ b/source/blender/editors/sculpt_paint/paint_image.c @@ -401,7 +401,7 @@ static void *image_undo_push_tile(Image *ima, ImBuf *ibuf, ImBuf **tmpibuf, int *tmpibuf = IMB_allocImBuf(IMAPAINT_TILE_SIZE, IMAPAINT_TILE_SIZE, 32, IB_rectfloat|IB_rect); tile= MEM_callocN(sizeof(UndoImageTile), "UndoImageTile"); - strcpy(tile->idname, ima->id.name); + BLI_strncpy(tile->idname, ima->id.name, sizeof(tile->idname)); tile->x= x_tile; tile->y= y_tile; @@ -409,7 +409,7 @@ static void *image_undo_push_tile(Image *ima, ImBuf *ibuf, ImBuf **tmpibuf, int allocsize *= (ibuf->rect_float)? sizeof(float): sizeof(char); tile->rect= MEM_mapallocN(allocsize, "UndeImageTile.rect"); - strcpy(tile->ibufname, ibuf->name); + BLI_strncpy(tile->ibufname, ibuf->name, sizeof(tile->ibufname)); tile->gen_type= ima->gen_type; tile->source= ima->source; diff --git a/source/blender/editors/sculpt_paint/sculpt_undo.c b/source/blender/editors/sculpt_paint/sculpt_undo.c index 13b6fef3004..a32487e7117 100644 --- a/source/blender/editors/sculpt_paint/sculpt_undo.c +++ b/source/blender/editors/sculpt_paint/sculpt_undo.c @@ -262,7 +262,7 @@ SculptUndoNode *sculpt_undo_push_node(Object *ob, PBVHNode *node) } unode= MEM_callocN(sizeof(SculptUndoNode), "SculptUndoNode"); - strcpy(unode->idname, ob->id.name); + BLI_strncpy(unode->idname, ob->id.name, sizeof(unode->idname)); unode->node= node; BLI_pbvh_node_num_verts(ss->pbvh, node, &totvert, &allvert); diff --git a/source/blender/editors/space_sequencer/sequencer_add.c b/source/blender/editors/space_sequencer/sequencer_add.c index 7fa4e62359a..7e4d02036ef 100644 --- a/source/blender/editors/space_sequencer/sequencer_add.c +++ b/source/blender/editors/space_sequencer/sequencer_add.c @@ -235,7 +235,7 @@ static int sequencer_add_scene_strip_exec(bContext *C, wmOperator *op) strip->stripdata= MEM_callocN(seq->len*sizeof(StripElem), "stripelem"); - strcpy(seq->name+2, sce_seq->id.name+2); + BLI_strncpy(seq->name+2, sce_seq->id.name+2, sizeof(seq->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); diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c index 45543a9313e..33d2a27f789 100644 --- a/source/blender/editors/space_sequencer/sequencer_edit.c +++ b/source/blender/editors/space_sequencer/sequencer_edit.c @@ -929,11 +929,11 @@ static void UNUSED_FUNCTION(seq_remap_paths)(Scene *scene) if(last_seq==NULL) return; - BLI_strncpy(from, last_seq->strip->dir, FILE_MAX); + BLI_strncpy(from, last_seq->strip->dir, sizeof(from)); // XXX if (0==sbutton(from, 0, sizeof(from)-1, "From: ")) // return; - strcpy(to, from); + BLI_strncpy(to, from, sizeof(to)); // XXX if (0==sbutton(to, 0, sizeof(to)-1, "To: ")) // return; diff --git a/source/blender/imbuf/intern/anim_movie.c b/source/blender/imbuf/intern/anim_movie.c index c1ef8c4792b..34c39b1083a 100644 --- a/source/blender/imbuf/intern/anim_movie.c +++ b/source/blender/imbuf/intern/anim_movie.c @@ -1175,7 +1175,7 @@ static struct ImBuf * anim_getnew(struct anim * anim) { case ANIM_SEQUENCE: ibuf = IMB_loadiffname(anim->name, anim->ib_flags); if (ibuf) { - strcpy(anim->first, anim->name); + BLI_strncpy(anim->first, anim->name, sizeof(anim->first)); anim->duration = 1; } break; diff --git a/source/blender/makesrna/intern/rna_lattice.c b/source/blender/makesrna/intern/rna_lattice.c index 2a81c4f0a2c..f30fea659ae 100644 --- a/source/blender/makesrna/intern/rna_lattice.c +++ b/source/blender/makesrna/intern/rna_lattice.c @@ -179,10 +179,11 @@ static void rna_Lattice_points_w_set(PointerRNA *ptr, int value) static void rna_Lattice_vg_name_set(PointerRNA *ptr, const char *value) { Lattice *lt= ptr->data; - strcpy(lt->vgroup, value); + BLI_strncpy(lt->vgroup, value, sizeof(lt->vgroup)); - if(lt->editlatt) - strcpy(lt->editlatt->latt->vgroup, value); + if(lt->editlatt) { + BLI_strncpy(lt->editlatt->latt->vgroup, value, sizeof(lt->editlatt->latt->vgroup)); + } } /* annoying, but is a consequence of RNA structures... */ diff --git a/source/blender/makesrna/intern/rna_object_force.c b/source/blender/makesrna/intern/rna_object_force.c index c36dca22731..8db1faee04d 100644 --- a/source/blender/makesrna/intern/rna_object_force.c +++ b/source/blender/makesrna/intern/rna_object_force.c @@ -193,7 +193,7 @@ static void rna_Cache_idname_change(Main *UNUSED(bmain), Scene *UNUSED(scene), P pid2 = pid; else if(cache->name[0] != '\0' && strcmp(cache->name,pid->cache->name)==0) { /*TODO: report "name exists" to user */ - strcpy(cache->name, cache->prev_name); + BLI_strncpy(cache->name, cache->prev_name, sizeof(cache->name)); new_name = 0; } } @@ -203,13 +203,13 @@ static void rna_Cache_idname_change(Main *UNUSED(bmain), Scene *UNUSED(scene), P char old_name[80]; char new_name[80]; - strcpy(old_name, cache->prev_name); - strcpy(new_name, cache->name); + BLI_strncpy(old_name, cache->prev_name, sizeof(old_name)); + BLI_strncpy(new_name, cache->name, sizeof(new_name)); BKE_ptcache_disk_cache_rename(pid2, old_name, new_name); } - strcpy(cache->prev_name, cache->name); + BLI_strncpy(cache->prev_name, cache->name, sizeof(cache->prev_name)); } } diff --git a/source/blender/modifiers/intern/MOD_solidify.c b/source/blender/modifiers/intern/MOD_solidify.c index 757da28e4b5..f2e3a0d016a 100644 --- a/source/blender/modifiers/intern/MOD_solidify.c +++ b/source/blender/modifiers/intern/MOD_solidify.c @@ -40,6 +40,7 @@ #include "BLI_math.h" #include "BLI_edgehash.h" #include "BLI_utildefines.h" +#include "BLI_string.h" #include "BKE_cdderivedmesh.h" #include "BKE_mesh.h" @@ -183,7 +184,7 @@ static void copyData(ModifierData *md, ModifierData *target) tsmd->crease_outer = smd->crease_outer; tsmd->crease_rim = smd->crease_rim; tsmd->flag = smd->flag; - strcpy(tsmd->defgrp_name, smd->defgrp_name); + BLI_strncpy(tsmd->defgrp_name, smd->defgrp_name, sizeof(tsmd->defgrp_name)); } static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md) diff --git a/source/blender/nodes/intern/node_common.c b/source/blender/nodes/intern/node_common.c index 4dbf4b96b74..6214f39dc0a 100644 --- a/source/blender/nodes/intern/node_common.c +++ b/source/blender/nodes/intern/node_common.c @@ -718,7 +718,7 @@ static bNodeSocket *group_verify_socket(bNodeTree *ntree, ListBase *lb, int in_o if(sock) { sock->groupsock = gsock; - strcpy(sock->name, gsock->name); + BLI_strncpy(sock->name, gsock->name, sizeof(sock->name)); sock->type= gsock->type; /* XXX hack: group socket input/output roles are inverted internally, @@ -903,7 +903,7 @@ static void loop_sync(bNodeTree *ntree, int sync_in_out) if (mirror->own_index == GET_INT_FROM_POINTER(sock->storage)) break; /* make sure the name is the same (only for identification by user, no deeper meaning) */ - strcpy(mirror->name, sock->name); + BLI_strncpy(mirror->name, sock->name, sizeof(mirror->name)); /* fix the socket order if necessary */ if (mirror != sync) { BLI_remlink(sync_lb, mirror); diff --git a/source/blender/render/intern/source/renderdatabase.c b/source/blender/render/intern/source/renderdatabase.c index 7a39342ac8d..a73bf93841d 100644 --- a/source/blender/render/intern/source/renderdatabase.c +++ b/source/blender/render/intern/source/renderdatabase.c @@ -481,12 +481,12 @@ void RE_set_customdata_names(ObjectRen *obr, CustomData *data) layer= &data->layers[i]; if (layer->type == CD_MTFACE) { - strcpy(obr->mtface[mtfn++], layer->name); + BLI_strncpy(obr->mtface[mtfn++], layer->name, sizeof(layer->name)); obr->actmtface= CLAMPIS(layer->active_rnd, 0, numtf); obr->bakemtface= layer->active; } else if (layer->type == CD_MCOL) { - strcpy(obr->mcol[mcn++], layer->name); + BLI_strncpy(obr->mcol[mcn++], layer->name, sizeof(layer->name)); obr->actmcol= CLAMPIS(layer->active_rnd, 0, numcol); } } diff --git a/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp b/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp index f5bd3a91c26..ea17b9adcfd 100644 --- a/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp +++ b/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp @@ -309,7 +309,7 @@ static void get_filename(int argc, char **argv, char *filename) #endif // !_APPLE } -static BlendFileData *load_game_data(char *progname, char *filename = NULL, char *relativename = NULL) +static BlendFileData *load_game_data(const char *progname, char *filename = NULL, char *relativename = NULL) { ReportList reports; BlendFileData *bfd = NULL; @@ -321,7 +321,7 @@ static BlendFileData *load_game_data(char *progname, char *filename = NULL, char bfd= BLO_read_runtime(progname, &reports); if (bfd) { bfd->type= BLENFILETYPE_RUNTIME; - strcpy(bfd->main->name, progname); + BLI_strncpy(bfd->main->name, progname, sizeof(bfd->main->name)); } } else { bfd= BLO_read_from_file(progname, &reports); @@ -766,7 +766,7 @@ int main(int argc, char** argv) char basedpath[240]; // base the actuator filename relative to the last file - strcpy(basedpath, exitstring.Ptr()); + BLI_strncpy(basedpath, exitstring.Ptr(), sizeof(basedpath)); BLI_path_abs(basedpath, pathname); bfd = load_game_data(basedpath); -- cgit v1.2.3 From 4512f10db981bdd9083bd6763fc993f2a162ac53 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 20 Oct 2011 00:19:21 +0000 Subject: misc edits - rename define DISABLE_SDL --> WITH_SDL (which was already used in some places) - blenders interation preset was using orbit rather then turntable 3d view preference (different from factory defaults). - tagged some unused rna args. --- build_files/scons/tools/Blender.py | 4 +- release/scripts/presets/interaction/blender.py | 2 +- source/blender/blenkernel/SConscript | 3 +- source/blender/blenlib/BLI_utildefines.h | 2 +- source/blender/makesdna/DNA_space_types.h | 3 +- source/blender/makesrna/intern/rna_action.c | 3 +- source/blender/makesrna/intern/rna_actuator.c | 2 +- source/blender/makesrna/intern/rna_boid.c | 2 +- source/blender/makesrna/intern/rna_curve.c | 2 +- source/blender/makesrna/intern/rna_fluidsim.c | 3 +- source/blender/makesrna/intern/rna_rna.c | 6 +-- source/blender/makesrna/intern/rna_scene.c | 2 +- source/blender/makesrna/intern/rna_space.c | 2 +- source/blender/makesrna/intern/rna_texture.c | 10 ++--- source/blender/makesrna/intern/rna_userdef.c | 2 +- source/creator/CMakeLists.txt | 4 +- source/creator/creator.c | 4 +- source/gameengine/GameLogic/CMakeLists.txt | 4 +- .../gameengine/GameLogic/Joystick/SCA_Joystick.cpp | 44 +++++++++++----------- .../gameengine/GameLogic/Joystick/SCA_Joystick.h | 12 +++--- .../GameLogic/Joystick/SCA_JoystickEvents.cpp | 8 ++-- .../GameLogic/Joystick/SCA_JoystickPrivate.h | 4 +- .../gameengine/GameLogic/SCA_JoystickManager.cpp | 2 +- source/gameengine/GameLogic/SConscript | 3 +- source/gameengine/Ketsji/CMakeLists.txt | 3 +- source/gameengine/Ketsji/SConscript | 3 +- 26 files changed, 68 insertions(+), 71 deletions(-) diff --git a/build_files/scons/tools/Blender.py b/build_files/scons/tools/Blender.py index 147316c204a..c802eee4fb6 100644 --- a/build_files/scons/tools/Blender.py +++ b/build_files/scons/tools/Blender.py @@ -316,8 +316,8 @@ def creator(env): if env['WITH_BF_TIFF']: defs.append('WITH_TIFF') - if not env['WITH_BF_SDL']: - defs.append('DISABLE_SDL') + if env['WITH_BF_SDL']: + defs.append('WITH_SDL') if env['WITH_BF_PYTHON']: incs.append('#/source/blender/python') diff --git a/release/scripts/presets/interaction/blender.py b/release/scripts/presets/interaction/blender.py index 3b6ce13d7e0..c5454e479a3 100644 --- a/release/scripts/presets/interaction/blender.py +++ b/release/scripts/presets/interaction/blender.py @@ -9,5 +9,5 @@ bpy.context.user_preferences.edit.use_insertkey_xyz_to_rgb = False bpy.context.user_preferences.inputs.select_mouse = 'RIGHT' bpy.context.user_preferences.inputs.view_zoom_method = 'DOLLY' bpy.context.user_preferences.inputs.view_zoom_axis = 'VERTICAL' -bpy.context.user_preferences.inputs.view_rotate_method = 'TRACKBALL' +bpy.context.user_preferences.inputs.view_rotate_method = 'TURNTABLE' bpy.context.user_preferences.inputs.invert_mouse_zoom = False diff --git a/source/blender/blenkernel/SConscript b/source/blender/blenkernel/SConscript index 7d7ab56ec3f..512eec4021f 100644 --- a/source/blender/blenkernel/SConscript +++ b/source/blender/blenkernel/SConscript @@ -41,8 +41,7 @@ if env['WITH_BF_QUICKTIME']: if env['WITH_BF_SDL']: incs += ' ' + env['BF_SDL_INC'] -else: - defs.append('DISABLE_SDL') + defs.append('WITH_SDL') if env['WITH_BF_OPENEXR']: defs.append('WITH_OPENEXR') diff --git a/source/blender/blenlib/BLI_utildefines.h b/source/blender/blenlib/BLI_utildefines.h index 456ee72c4e0..b2b3e7381c6 100644 --- a/source/blender/blenlib/BLI_utildefines.h +++ b/source/blender/blenlib/BLI_utildefines.h @@ -221,7 +221,7 @@ # else # define _dummy_abort() (void)0 # endif -# ifdef __GNUC__ /* just want to check if __func__ is available */ +# if defined(__GNUC__) || defined(_MSC_VER) /* just want to check if __func__ is available */ # define BLI_assert(a) \ do { \ if (!(a)) { \ diff --git a/source/blender/makesdna/DNA_space_types.h b/source/blender/makesdna/DNA_space_types.h index 1627d4d2acb..13be1253184 100644 --- a/source/blender/makesdna/DNA_space_types.h +++ b/source/blender/makesdna/DNA_space_types.h @@ -434,7 +434,8 @@ typedef struct SpaceLogic { struct bGPdata *gpd; /* grease-pencil data */ } SpaceLogic; - +/* note, this entire struct isnt used anymore!, + * may remove some day - campbell */ typedef struct SpaceImaSel { SpaceLink *next, *prev; ListBase regionbase; /* storage of regions for inactive spaces */ diff --git a/source/blender/makesrna/intern/rna_action.c b/source/blender/makesrna/intern/rna_action.c index 44c37f93b5e..f2d1578388d 100644 --- a/source/blender/makesrna/intern/rna_action.c +++ b/source/blender/makesrna/intern/rna_action.c @@ -132,7 +132,7 @@ static void rna_Action_fcurve_remove(bAction *act, ReportList *reports, FCurve * } } -static TimeMarker *rna_Action_pose_markers_new(bAction *act, ReportList *reports, const char name[]) +static TimeMarker *rna_Action_pose_markers_new(bAction *act, const char name[]) { TimeMarker *marker = MEM_callocN(sizeof(TimeMarker), "TimeMarker"); marker->flag= 1; @@ -550,7 +550,6 @@ static void rna_def_action_pose_markers(BlenderRNA *brna, PropertyRNA *cprop) func= RNA_def_function(srna, "new", "rna_Action_pose_markers_new"); RNA_def_function_ui_description(func, "Add a pose marker to the action"); - RNA_def_function_flag(func, FUNC_USE_REPORTS); parm= RNA_def_string(func, "name", "Marker", 0, "", "New name for the marker (not unique)"); RNA_def_property_flag(parm, PROP_REQUIRED); diff --git a/source/blender/makesrna/intern/rna_actuator.c b/source/blender/makesrna/intern/rna_actuator.c index d828139a6d5..2859a7bb89b 100644 --- a/source/blender/makesrna/intern/rna_actuator.c +++ b/source/blender/makesrna/intern/rna_actuator.c @@ -450,7 +450,7 @@ EnumPropertyItem *rna_Actuator_type_itemf(bContext *C, PointerRNA *ptr, Property return item; } -static void rna_Actuator_Armature_update(Main *bmain, Scene *scene, PointerRNA *ptr) +static void rna_Actuator_Armature_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr) { bActuator *act= (bActuator *)ptr->data; bArmatureActuator *aa = act->data; diff --git a/source/blender/makesrna/intern/rna_boid.c b/source/blender/makesrna/intern/rna_boid.c index 357f613f65f..e21f6aeb26f 100644 --- a/source/blender/makesrna/intern/rna_boid.c +++ b/source/blender/makesrna/intern/rna_boid.c @@ -76,7 +76,7 @@ EnumPropertyItem boidruleset_type_items[] ={ #include "BKE_depsgraph.h" #include "BKE_particle.h" -static void rna_Boids_reset(Main *bmain, Scene *scene, PointerRNA *ptr) +static void rna_Boids_reset(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr) { if(ptr->type==&RNA_ParticleSystem) { ParticleSystem *psys = (ParticleSystem*)ptr->data; diff --git a/source/blender/makesrna/intern/rna_curve.c b/source/blender/makesrna/intern/rna_curve.c index edae977f3f6..49f39a207d2 100644 --- a/source/blender/makesrna/intern/rna_curve.c +++ b/source/blender/makesrna/intern/rna_curve.c @@ -292,7 +292,7 @@ static void rna_Curve_dimension_set(PointerRNA *ptr, int value) } } -static EnumPropertyItem *rna_Curve_fill_mode_itemf(bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), int *free) +static EnumPropertyItem *rna_Curve_fill_mode_itemf(bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), int *UNUSED(free)) { Curve *cu= (Curve*)ptr->id.data; diff --git a/source/blender/makesrna/intern/rna_fluidsim.c b/source/blender/makesrna/intern/rna_fluidsim.c index ba90aca47a3..c114c44ad77 100644 --- a/source/blender/makesrna/intern/rna_fluidsim.c +++ b/source/blender/makesrna/intern/rna_fluidsim.c @@ -173,6 +173,7 @@ static void rna_FluidSettings_update_type(Main *bmain, Scene *scene, PointerRNA static void rna_DomainFluidSettings_memory_estimate_get(PointerRNA *ptr, char *value) { #ifdef DISABLE_ELBEEM + (void)ptr; value[0]= '\0'; #else Object *ob= (Object*)ptr->id.data; @@ -182,7 +183,7 @@ static void rna_DomainFluidSettings_memory_estimate_get(PointerRNA *ptr, char *v #endif } -static int rna_DomainFluidSettings_memory_estimate_length(PointerRNA *ptr) +static int rna_DomainFluidSettings_memory_estimate_length(PointerRNA *UNUSED(ptr)) { #ifdef DISABLE_ELBEEM return 0; diff --git a/source/blender/makesrna/intern/rna_rna.c b/source/blender/makesrna/intern/rna_rna.c index 376b0c529d0..31c872f43f8 100644 --- a/source/blender/makesrna/intern/rna_rna.c +++ b/source/blender/makesrna/intern/rna_rna.c @@ -167,7 +167,7 @@ static int rna_idproperty_known(CollectionPropertyIterator *iter, void *data) return 0; } -static int rna_property_builtin(CollectionPropertyIterator *iter, void *data) +static int rna_property_builtin(CollectionPropertyIterator *UNUSED(iter), void *data) { PropertyRNA *prop= (PropertyRNA*)data; @@ -176,7 +176,7 @@ static int rna_property_builtin(CollectionPropertyIterator *iter, void *data) return (prop->flag & PROP_BUILTIN); } -static int rna_function_builtin(CollectionPropertyIterator *iter, void *data) +static int rna_function_builtin(CollectionPropertyIterator *UNUSED(iter), void *data) { FunctionRNA *func= (FunctionRNA*)data; @@ -775,7 +775,7 @@ static int rna_EnumProperty_default_get(PointerRNA *ptr) return ((EnumPropertyRNA*)prop)->defaultvalue; } -static int rna_enum_check_separator(CollectionPropertyIterator *iter, void *data) +static int rna_enum_check_separator(CollectionPropertyIterator *UNUSED(iter), void *data) { EnumPropertyItem *item= (EnumPropertyItem*)data; diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index ccc8151ac7f..09824616936 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -1054,7 +1054,7 @@ static KeyingSet *rna_Scene_keying_set_new(Scene *sce, ReportList *reports, cons * is not for general use and only for the few cases where changing scene * settings and NOT for general purpose updates, possibly this should be * given its own notifier. */ -static void rna_Scene_update_active_object_data(Main *bmain, Scene *scene, PointerRNA *ptr) +static void rna_Scene_update_active_object_data(Main *UNUSED(bmain), Scene *scene, PointerRNA *ptr) { Object *ob= OBACT; if(ob) { diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c index 8afcd61b9c8..cbe06e6cab5 100644 --- a/source/blender/makesrna/intern/rna_space.c +++ b/source/blender/makesrna/intern/rna_space.c @@ -860,7 +860,7 @@ static int rna_SpaceNodeEditor_node_tree_poll(PointerRNA *ptr, PointerRNA value) return (ntree->nodetype==0 && ntree->type == snode->treetype); } -static void rna_SpaceNodeEditor_node_tree_update(Main *bmain, Scene *scene, PointerRNA *ptr) +static void rna_SpaceNodeEditor_node_tree_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *ptr) { SpaceNode *snode= (SpaceNode*)ptr->data; diff --git a/source/blender/makesrna/intern/rna_texture.c b/source/blender/makesrna/intern/rna_texture.c index b5e8acb76e5..03f0a4ba363 100644 --- a/source/blender/makesrna/intern/rna_texture.c +++ b/source/blender/makesrna/intern/rna_texture.c @@ -133,7 +133,7 @@ static StructRNA *rna_Texture_refine(struct PointerRNA *ptr) } } -static void rna_Texture_update(Main *bmain, Scene *scene, PointerRNA *ptr) +static void rna_Texture_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr) { Tex *tex= ptr->id.data; @@ -162,7 +162,7 @@ static void rna_Texture_voxeldata_image_update(Main *bmain, Scene *scene, Pointe /* Used for Texture Properties, used (also) for/in Nodes */ -static void rna_Texture_nodes_update(Main *bmain, Scene *scene, PointerRNA *ptr) +static void rna_Texture_nodes_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr) { Tex *tex= ptr->id.data; @@ -177,7 +177,7 @@ static void rna_Texture_type_set(PointerRNA *ptr, int value) tex_set_type(tex, value); } -void rna_TextureSlot_update(Main *bmain, Scene *scene, PointerRNA *ptr) +void rna_TextureSlot_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr) { ID *id= ptr->id.data; @@ -388,12 +388,12 @@ static void rna_PointDensity_psys_set(PointerRNA *ptr, PointerRNA value) pd->psys= BLI_findindex(&ob->particlesystem, value.data) + 1; } -static char *rna_PointDensity_path(PointerRNA *ptr) +static char *rna_PointDensity_path(PointerRNA *UNUSED(ptr)) { return BLI_sprintfN("point_density"); } -static char *rna_VoxelData_path(PointerRNA *ptr) +static char *rna_VoxelData_path(PointerRNA *UNUSED(ptr)) { return BLI_sprintfN("voxel_data"); } diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c index e2f0f4dab1f..9202647981b 100644 --- a/source/blender/makesrna/intern/rna_userdef.c +++ b/source/blender/makesrna/intern/rna_userdef.c @@ -72,7 +72,7 @@ static void rna_userdef_update(Main *UNUSED(bmain), Scene *UNUSED(scene), Pointe WM_main_add_notifier(NC_WINDOW, NULL); } -static void rna_userdef_dpi_update(Main *bmain, Scene *scene, PointerRNA *ptr) +static void rna_userdef_dpi_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *UNUSED(ptr)) { U.widget_unit = (U.dpi * 20 + 36)/72; WM_main_add_notifier(NC_WINDOW, NULL); /* full redraw */ diff --git a/source/creator/CMakeLists.txt b/source/creator/CMakeLists.txt index e7a1ff14f03..b4e9d4d262e 100644 --- a/source/creator/CMakeLists.txt +++ b/source/creator/CMakeLists.txt @@ -88,8 +88,8 @@ if(WITH_GAMEENGINE) add_definitions(-DWITH_GAMEENGINE) endif() -if(NOT WITH_SDL) - add_definitions(-DDISABLE_SDL) +if(WITH_SDL) + add_definitions(-DWITH_SDL) endif() if(WITH_BINRELOC) diff --git a/source/creator/creator.c b/source/creator/creator.c index 3ce469de4e8..f6b99a9f73c 100644 --- a/source/creator/creator.c +++ b/source/creator/creator.c @@ -305,7 +305,7 @@ static int print_help(int UNUSED(argc), const char **UNUSED(argv), void *data) #else printf (" $TMP or $TMPDIR Store temporary files here.\n"); #endif -#ifndef DISABLE_SDL +#ifdef WITH_SDL printf (" $SDL_AUDIODRIVER LibSDL audio driver - alsa, esd, dma.\n"); #endif printf (" $PYTHONHOME Path to the python directory, eg. /usr/lib/python.\n\n"); @@ -1213,7 +1213,7 @@ int main(int argc, const char **argv) /* this is properly initialized with user defs, but this is default */ BLI_where_is_temp(btempdir, FILE_MAX, 1); /* call after loading the startup.blend so we can read U.tempdir */ -#ifndef DISABLE_SDL +#ifdef WITH_SDL BLI_setenv("SDL_VIDEODRIVER", "dummy"); #endif } diff --git a/source/gameengine/GameLogic/CMakeLists.txt b/source/gameengine/GameLogic/CMakeLists.txt index bd417165337..9a57de60517 100644 --- a/source/gameengine/GameLogic/CMakeLists.txt +++ b/source/gameengine/GameLogic/CMakeLists.txt @@ -131,8 +131,8 @@ if(WITH_SDL) list(APPEND INC_SYS ${SDL_INCLUDE_DIR} ) -else() - add_definitions(-DDISABLE_SDL) + + add_definitions(-DWITH_SDL) endif() blender_add_lib(ge_logic "${SRC}" "${INC}" "${INC_SYS}") diff --git a/source/gameengine/GameLogic/Joystick/SCA_Joystick.cpp b/source/gameengine/GameLogic/Joystick/SCA_Joystick.cpp index 48ba09e67d2..0547d97285d 100644 --- a/source/gameengine/GameLogic/Joystick/SCA_Joystick.cpp +++ b/source/gameengine/GameLogic/Joystick/SCA_Joystick.cpp @@ -29,8 +29,8 @@ * \ingroup gamelogic */ -#ifndef DISABLE_SDL -#include +#ifdef WITH_SDL +# include #endif #include @@ -57,7 +57,7 @@ SCA_Joystick::SCA_Joystick(short int index) for(int i=0; i= JOYINDEX_MAX) { echo("Error-invalid joystick index: " << joyindex); return NULL; @@ -107,14 +107,14 @@ SCA_Joystick *SCA_Joystick::GetInstance( short int joyindex ) m_refCount++; } return m_instance[joyindex]; -#endif +#endif /* WITH_SDL */ } void SCA_Joystick::ReleaseInstance() { if (--m_refCount == 0) { -#ifndef DISABLE_SDL +#ifdef WITH_SDL int i; for (i=0; i=m_joynum) { // don't print a message, because this is done anyway @@ -257,13 +257,13 @@ bool SCA_Joystick::CreateJoystickDevice(void) } return true; -#endif +#endif /* WITH_SDL */ } void SCA_Joystick::DestroyJoystickDevice(void) { -#ifndef DISABLE_SDL +#ifdef WITH_SDL if (m_isinit){ if(SDL_JoystickOpened(m_joyindex)){ echo("Closing-joystick " << m_joyindex); @@ -271,12 +271,12 @@ void SCA_Joystick::DestroyJoystickDevice(void) } m_isinit = false; } -#endif +#endif /* WITH_SDL */ } int SCA_Joystick::Connected(void) { -#ifndef DISABLE_SDL +#ifdef WITH_SDL if (m_isinit && SDL_JoystickOpened(m_joyindex)) return 1; #endif @@ -285,7 +285,7 @@ int SCA_Joystick::Connected(void) int SCA_Joystick::pGetAxis(int axisnum, int udlr) { -#ifndef DISABLE_SDL +#ifdef WITH_SDL return m_axis_array[(axisnum*2)+udlr]; #endif return 0; @@ -293,7 +293,7 @@ int SCA_Joystick::pGetAxis(int axisnum, int udlr) int SCA_Joystick::pAxisTest(int axisnum) { -#ifndef DISABLE_SDL +#ifdef WITH_SDL short i1= m_axis_array[(axisnum*2)]; short i2= m_axis_array[(axisnum*2)+1]; @@ -304,7 +304,7 @@ int SCA_Joystick::pAxisTest(int axisnum) if (i2 < 0) i2 = -i2; if (i1 +#ifdef WITH_SDL +# include #endif #include "SCA_Joystick.h" #include "SCA_JoystickPrivate.h" -#ifndef DISABLE_SDL +#ifdef WITH_SDL void SCA_Joystick::OnAxisMotion(SDL_Event* sdl_event) { if(sdl_event->jaxis.axis >= JOYAXIS_MAX) @@ -125,4 +125,4 @@ void SCA_Joystick::HandleEvents(void) } } } -#endif +#endif /* WITH_SDL */ diff --git a/source/gameengine/GameLogic/Joystick/SCA_JoystickPrivate.h b/source/gameengine/GameLogic/Joystick/SCA_JoystickPrivate.h index 02dd8145bb7..472a7353190 100644 --- a/source/gameengine/GameLogic/Joystick/SCA_JoystickPrivate.h +++ b/source/gameengine/GameLogic/Joystick/SCA_JoystickPrivate.h @@ -33,7 +33,7 @@ #define __SCA_JOYSTICKPRIVATE_H__ #include "SCA_Joystick.h" -#ifndef DISABLE_SDL +#ifdef WITH_SDL class SCA_Joystick::PrivateData { public: @@ -47,6 +47,6 @@ public: { } }; -#endif +#endif /* WITH_SDL */ #endif diff --git a/source/gameengine/GameLogic/SCA_JoystickManager.cpp b/source/gameengine/GameLogic/SCA_JoystickManager.cpp index b61e4f4edca..2942384055b 100644 --- a/source/gameengine/GameLogic/SCA_JoystickManager.cpp +++ b/source/gameengine/GameLogic/SCA_JoystickManager.cpp @@ -65,7 +65,7 @@ void SCA_JoystickManager::NextFrame(double curtime,double deltatime) } else { ; -#ifndef DISABLE_SDL +#ifdef WITH_SDL SCA_Joystick::HandleEvents(); /* Handle all SDL Joystick events */ #endif SG_DList::iterator it(m_sensors); diff --git a/source/gameengine/GameLogic/SConscript b/source/gameengine/GameLogic/SConscript index d6323882267..62bdbc29544 100644 --- a/source/gameengine/GameLogic/SConscript +++ b/source/gameengine/GameLogic/SConscript @@ -10,9 +10,8 @@ incs += ' #/source/gameengine/Rasterizer #/source/gameengine/SceneGraph' defs = [] if env['WITH_BF_SDL']: + defs.append('WITH_SDL') incs += ' ' + env['BF_SDL_INC'] -else: - defs.append('DISABLE_SDL') if env['WITH_BF_PYTHON']: incs += ' ' + env['BF_PYTHON_INC'] diff --git a/source/gameengine/Ketsji/CMakeLists.txt b/source/gameengine/Ketsji/CMakeLists.txt index 9d8b1781869..329ac890cd2 100644 --- a/source/gameengine/Ketsji/CMakeLists.txt +++ b/source/gameengine/Ketsji/CMakeLists.txt @@ -225,8 +225,7 @@ if(WITH_SDL) list(APPEND INC_SYS ${SDL_INCLUDE_DIR} ) -else() - add_definitions(-DDISABLE_SDL) + add_definitions(-DWITH_SDL) endif() if(WITH_CODEC_FFMPEG) diff --git a/source/gameengine/Ketsji/SConscript b/source/gameengine/Ketsji/SConscript index 9b453ed76d5..064f09df9f3 100644 --- a/source/gameengine/Ketsji/SConscript +++ b/source/gameengine/Ketsji/SConscript @@ -27,8 +27,7 @@ incs += ' ' + env['BF_OPENGL_INC'] if env['WITH_BF_SDL']: incs += ' ' + env['BF_SDL_INC'] -else: - defs.append('DISABLE_SDL') + defs.append('WITH_SDL') if env['WITH_BF_PYTHON']: incs += ' ' + env['BF_PYTHON_INC'] -- cgit v1.2.3 From 445279524a6c10fc09cd365a63fa9b69e364be83 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 20 Oct 2011 00:48:00 +0000 Subject: debug build option WITH_PYTHON_UI_INFO, so you can right click and edit the python source for UI layout directly. --- CMakeLists.txt | 8 +++ source/blender/editors/interface/interface.c | 18 +++++ .../blender/editors/interface/interface_handlers.c | 11 +++ .../blender/editors/interface/interface_intern.h | 5 ++ source/blender/editors/space_text/space_text.c | 5 ++ source/blender/python/generic/py_capi_utils.c | 9 +++ source/blender/python/generic/py_capi_utils.h | 1 + source/blender/windowmanager/intern/wm_operators.c | 82 ++++++++++++++++++++++ 8 files changed, 139 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6cfda3a01e6..6e3247a7d2c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -213,6 +213,10 @@ mark_as_advanced(WITH_CXX_GUARDEDALLOC) option(WITH_ASSERT_ABORT "Call abort() when raising an assertion through BLI_assert()" OFF) mark_as_advanced(WITH_ASSERT_ABORT) +option(WITH_PYTHON_UI_INFO "Allow navigating to UI source from the context menu" OFF) +mark_as_advanced(WITH_PYTHON_UI_INFO) + + if(APPLE) if(NOT CMAKE_OSX_ARCHITECTURES) set(CMAKE_OSX_ARCHITECTURES x86_64 CACHE STRING @@ -1326,6 +1330,10 @@ if(WITH_ASSERT_ABORT) add_definitions(-DWITH_ASSERT_ABORT) endif() +if(WITH_PYTHON_UI_INFO) + add_definitions(-DWITH_PYTHON_UI_INFO) +endif() + # message(STATUS "Using CFLAGS: ${CMAKE_C_FLAGS}") # message(STATUS "Using CXXFLAGS: ${CMAKE_CXX_FLAGS}") diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c index b6c72c2e96f..ac1fab365f0 100644 --- a/source/blender/editors/interface/interface.c +++ b/source/blender/editors/interface/interface.c @@ -2559,6 +2559,24 @@ static uiBut *ui_def_but(uiBlock *block, int type, int retval, const char *str, if(block->curlayout) ui_layout_add_but(block->curlayout, but); +#ifdef WITH_PYTHON_UI_INFO + { + extern void PyC_FileAndNum_Safe(const char **filename, int *lineno); + + const char *fn; + int lineno= -1; + PyC_FileAndNum_Safe(&fn, &lineno); + if (lineno != -1) { + BLI_strncpy(but->py_dbg_fn, fn, sizeof(but->py_dbg_fn)); + but->py_dbg_ln= lineno; + } + else { + but->py_dbg_fn[0]= '\0'; + but->py_dbg_ln= -1; + } + } +#endif /* WITH_PYTHON_UI_INFO */ + return but; } diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index f4400d2d7db..4df9d7f12e2 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -4438,6 +4438,17 @@ static int ui_but_menu(bContext *C, uiBut *but) } } +#ifdef WITH_PYTHON_UI_INFO + if (but->py_dbg_ln != -1) { + PointerRNA ptr_props; + + WM_operator_properties_create(&ptr_props, "WM_OT_text_edit"); + RNA_string_set(&ptr_props, "filepath", but->py_dbg_fn); + RNA_int_set(&ptr_props, "line", but->py_dbg_ln); + uiItemFullO(layout, "WM_OT_text_edit", "Edit Source", ICON_NONE, ptr_props.data, WM_OP_EXEC_DEFAULT, 0); + } +#endif /* WITH_PYTHON_UI_INFO */ + uiPupMenuEnd(C, pup); return 1; diff --git a/source/blender/editors/interface/interface_intern.h b/source/blender/editors/interface/interface_intern.h index 12e9d39e896..c5843397c12 100644 --- a/source/blender/editors/interface/interface_intern.h +++ b/source/blender/editors/interface/interface_intern.h @@ -252,6 +252,11 @@ struct uiBut { /* pointer back */ uiBlock *block; + +#ifdef WITH_PYTHON_UI_INFO + char py_dbg_fn[240]; + int py_dbg_ln; +#endif }; struct uiBlock { diff --git a/source/blender/editors/space_text/space_text.c b/source/blender/editors/space_text/space_text.c index 47f051e1ec4..51f4f1e579c 100644 --- a/source/blender/editors/space_text/space_text.c +++ b/source/blender/editors/space_text/space_text.c @@ -136,7 +136,12 @@ static void text_listener(ScrArea *sa, wmNotifier *wmn) switch(wmn->data) { case ND_DISPLAY: + ED_area_tag_redraw(sa); + break; case ND_CURSOR: + if(st->text && st->text == wmn->reference) + text_scroll_to_cursor(st, sa); + ED_area_tag_redraw(sa); break; } diff --git a/source/blender/python/generic/py_capi_utils.c b/source/blender/python/generic/py_capi_utils.c index 1bccc8a24c4..e658532db24 100644 --- a/source/blender/python/generic/py_capi_utils.c +++ b/source/blender/python/generic/py_capi_utils.c @@ -184,6 +184,15 @@ void PyC_FileAndNum(const char **filename, int *lineno) } } +void PyC_FileAndNum_Safe(const char **filename, int *lineno) +{ + if(!PYC_INTERPRETER_ACTIVE) { + return; + } + + PyC_FileAndNum(filename, lineno); +} + /* Would be nice if python had this built in */ PyObject *PyC_Object_GetAttrStringArgs(PyObject *o, Py_ssize_t n, ...) { diff --git a/source/blender/python/generic/py_capi_utils.h b/source/blender/python/generic/py_capi_utils.h index 03a8637710e..f38ce209be2 100644 --- a/source/blender/python/generic/py_capi_utils.h +++ b/source/blender/python/generic/py_capi_utils.h @@ -36,6 +36,7 @@ PyObject * PyC_ExceptionBuffer(void); PyObject * PyC_Object_GetAttrStringArgs(PyObject *o, Py_ssize_t n, ...); PyObject * PyC_Err_Format_Prefix(PyObject *exception_type_prefix, const char *format, ...); void PyC_FileAndNum(const char **filename, int *lineno); +void PyC_FileAndNum_Safe(const char **filename, int *lineno); /* checks python is running */ int PyC_AsArray(void *array, PyObject *value, const int length, const PyTypeObject *type, const short is_double, const char *error_prefix); /* follow http://www.python.org/dev/peps/pep-0383/ */ diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c index b0183d05ac2..4924457da1a 100644 --- a/source/blender/windowmanager/intern/wm_operators.c +++ b/source/blender/windowmanager/intern/wm_operators.c @@ -105,6 +105,11 @@ static GHash *global_ops_hash= NULL; +#ifdef WITH_PYTHON_UI_INFO +# include "DNA_text_types.h" +# include "BKE_text.h" +#endif + /* ************ operator API, exported ********** */ @@ -3505,6 +3510,79 @@ static void operatortype_ghash_free_cb(wmOperatorType *ot) MEM_freeN(ot); } +#ifdef WITH_PYTHON_UI_INFO + +static ScrArea *biggest_text_view(bContext *C) +{ + bScreen *sc= CTX_wm_screen(C); + ScrArea *sa, *big= NULL; + int size, maxsize= 0; + + for(sa= sc->areabase.first; sa; sa= sa->next) { + if(sa->spacetype==SPACE_TEXT) { + size= sa->winx * sa->winy; + if(size > maxsize) { + maxsize= size; + big= sa; + } + } + } + return big; +} + +static int wm_text_edit_exec(bContext *C, wmOperator *op) +{ + Main *bmain= CTX_data_main(C); + Text *text; + + char filepath[240]; + int line= RNA_int_get(op->ptr, "line"); + RNA_string_get(op->ptr, "filepath", filepath); + + for (text=bmain->text.first; text; text=text->id.next) { + if (text->name && BLI_path_cmp(text->name, filepath) == 0) { + break; + } + } + + if (text == NULL) { + text= add_text(filepath, bmain->name); + } + + if (text == NULL) { + BKE_reportf(op->reports, RPT_WARNING, "file: '%s' can't be opened", filepath); + return OPERATOR_CANCELLED; + } + else { + /* naughty!, find text area to set, not good behavior + * but since this is a dev tool lets allow it - campbell */ + ScrArea *sa= biggest_text_view(C); + if(sa) { + SpaceText *st= sa->spacedata.first; + st->text= text; + } + + txt_move_toline(text, line - 1, FALSE); + WM_event_add_notifier(C, NC_TEXT|ND_CURSOR, text); + } + + return OPERATOR_FINISHED; +} + +static void WM_OT_text_edit(wmOperatorType *ot) +{ + ot->name= "Edit Text File"; + ot->idname= "WM_OT_text_edit"; + + ot->exec= wm_text_edit_exec; + + RNA_def_string_file_path(ot->srna, "filepath", "", FILE_MAX, "Path", ""); + RNA_def_int(ot->srna, "line", 0, INT_MIN, INT_MAX, "Line", "", 0, INT_MAX); +} + +#endif /* WITH_PYTHON_UI_INFO */ + + /* ******************************************************* */ /* called on initialize WM_exit() */ void wm_operatortype_free(void) @@ -3548,6 +3626,10 @@ void wm_operatortype_init(void) WM_operatortype_append(WM_OT_collada_import); #endif +#ifdef WITH_PYTHON_UI_INFO + WM_operatortype_append(WM_OT_text_edit); +#endif + } /* circleselect-like modal operators */ -- cgit v1.2.3 From 8e58fceab1452fc914e0fe88aaf7ecc80ea9bdb6 Mon Sep 17 00:00:00 2001 From: Joshua Leung Date: Thu, 20 Oct 2011 05:18:02 +0000 Subject: Bugfix [#28976] crash when moving keys in dopesheet editor --- source/blender/editors/transform/transform_conversions.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c index c4295b15858..879dc425091 100644 --- a/source/blender/editors/transform/transform_conversions.c +++ b/source/blender/editors/transform/transform_conversions.c @@ -2947,7 +2947,7 @@ static TransData *ActionFCurveToTransData(TransData *td, TransData2D **td2dv, FC TransData2D *td2d = *td2dv; int i; - if (fcu == NULL) + if (ELEM(NULL, fcu, fcu->bezt)) return td; for (i=0, bezt=fcu->bezt; i < fcu->totvert; i++, bezt++) { -- cgit v1.2.3 From 9bbec84e7e14f11f86baeaea6a9a2bce6b7499de Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 20 Oct 2011 05:30:26 +0000 Subject: initial support for unicode keyboard input for ghost & blenders WM. - currently X11 only, depends on Xinput (but should not break other os's). - ghost stores utf8 buffer, copies to wmEvent's - UI text input is currently the only area that uses this - not console or text editor. - no rna access yet. --- intern/ghost/GHOST_Types.h | 1 + intern/ghost/intern/GHOST_EventKey.h | 5 +- intern/ghost/intern/GHOST_SystemCarbon.cpp | 2 +- intern/ghost/intern/GHOST_SystemCocoa.mm | 6 ++- intern/ghost/intern/GHOST_SystemSDL.cpp | 2 +- intern/ghost/intern/GHOST_SystemWin32.cpp | 3 +- intern/ghost/intern/GHOST_SystemX11.cpp | 55 +++++++++++++++++++++- intern/ghost/intern/GHOST_SystemX11.h | 17 +++++++ intern/ghost/intern/GHOST_WindowX11.cpp | 14 ++++++ intern/ghost/intern/GHOST_WindowX11.h | 8 ++++ .../blender/editors/interface/interface_handlers.c | 40 +++++++++++++++- source/blender/windowmanager/WM_types.h | 4 +- .../blender/windowmanager/intern/wm_event_system.c | 1 + source/gameengine/Ketsji/KX_PythonInit.cpp | 2 +- 14 files changed, 148 insertions(+), 12 deletions(-) diff --git a/intern/ghost/GHOST_Types.h b/intern/ghost/GHOST_Types.h index dd399a7aa95..78fc3f69c7a 100644 --- a/intern/ghost/GHOST_Types.h +++ b/intern/ghost/GHOST_Types.h @@ -468,6 +468,7 @@ typedef struct { GHOST_TKey key; /** The ascii code for the key event ('\0' if none). */ char ascii; + char utf8_buf[6]; } GHOST_TEventKeyData; typedef struct { diff --git a/intern/ghost/intern/GHOST_EventKey.h b/intern/ghost/intern/GHOST_EventKey.h index 3581cd86b20..a8fca1e8f2d 100644 --- a/intern/ghost/intern/GHOST_EventKey.h +++ b/intern/ghost/intern/GHOST_EventKey.h @@ -55,6 +55,7 @@ public: { m_keyEventData.key = key; m_keyEventData.ascii = '\0'; + m_keyEventData.utf8_buf[0]= '\0'; m_data = &m_keyEventData; } @@ -65,11 +66,13 @@ public: * @param key The key code of the key. * @param ascii The ascii code for the key event. */ - GHOST_EventKey(GHOST_TUns64 msec, GHOST_TEventType type, GHOST_IWindow* window, GHOST_TKey key, char ascii) + GHOST_EventKey(GHOST_TUns64 msec, GHOST_TEventType type, GHOST_IWindow* window, GHOST_TKey key, char ascii, const char utf8_buf[6]) : GHOST_Event(msec, type, window) { m_keyEventData.key = key; m_keyEventData.ascii = ascii; + if (utf8_buf) memcpy(m_keyEventData.utf8_buf, utf8_buf, sizeof(m_keyEventData.utf8_buf)); + else m_keyEventData.utf8_buf[0]= '\0'; m_data = &m_keyEventData; } diff --git a/intern/ghost/intern/GHOST_SystemCarbon.cpp b/intern/ghost/intern/GHOST_SystemCarbon.cpp index 02ff5c0f559..762966c9b9e 100644 --- a/intern/ghost/intern/GHOST_SystemCarbon.cpp +++ b/intern/ghost/intern/GHOST_SystemCarbon.cpp @@ -931,7 +931,7 @@ OSStatus GHOST_SystemCarbon::handleKeyEvent(EventRef event) } else { type = GHOST_kEventKeyUp; } - pushEvent( new GHOST_EventKey( getMilliSeconds(), type, window, key, ascii) ); + pushEvent( new GHOST_EventKey( getMilliSeconds(), type, window, key, ascii, NULL) ); // } break; diff --git a/intern/ghost/intern/GHOST_SystemCocoa.mm b/intern/ghost/intern/GHOST_SystemCocoa.mm index 303c2b24497..e8ec13f20df 100644 --- a/intern/ghost/intern/GHOST_SystemCocoa.mm +++ b/intern/ghost/intern/GHOST_SystemCocoa.mm @@ -1656,6 +1656,8 @@ GHOST_TSuccess GHOST_SystemCocoa::handleKeyEvent(void *eventPtr) } switch ([event type]) { + char utf8_buf[6]= {'\0'}; /* TODO, unicode input */ + case NSKeyDown: case NSKeyUp: charsIgnoringModifiers = [event charactersIgnoringModifiers]; @@ -1684,10 +1686,10 @@ GHOST_TSuccess GHOST_SystemCocoa::handleKeyEvent(void *eventPtr) break; //Cmd-Q is directly handled by Cocoa if ([event type] == NSKeyDown) { - pushEvent( new GHOST_EventKey([event timestamp]*1000, GHOST_kEventKeyDown, window, keyCode, ascii) ); + pushEvent( new GHOST_EventKey([event timestamp]*1000, GHOST_kEventKeyDown, window, keyCode, ascii, utf8_buf) ); //printf("\nKey down rawCode=0x%x charsIgnoringModifiers=%c keyCode=%u ascii=%i %c",[event keyCode],[charsIgnoringModifiers length]>0?[charsIgnoringModifiers characterAtIndex:0]:' ',keyCode,ascii,ascii); } else { - pushEvent( new GHOST_EventKey([event timestamp]*1000, GHOST_kEventKeyUp, window, keyCode, ascii) ); + pushEvent( new GHOST_EventKey([event timestamp]*1000, GHOST_kEventKeyUp, window, keyCode, ascii, utf8_buf) ); //printf("\nKey up rawCode=0x%x charsIgnoringModifiers=%c keyCode=%u ascii=%i %c",[event keyCode],[charsIgnoringModifiers length]>0?[charsIgnoringModifiers characterAtIndex:0]:' ',keyCode,ascii,ascii); } break; diff --git a/intern/ghost/intern/GHOST_SystemSDL.cpp b/intern/ghost/intern/GHOST_SystemSDL.cpp index f2cc45731fa..11bd562f767 100644 --- a/intern/ghost/intern/GHOST_SystemSDL.cpp +++ b/intern/ghost/intern/GHOST_SystemSDL.cpp @@ -441,7 +441,7 @@ GHOST_SystemSDL::processEvent(SDL_Event *sdl_event) } } - g_event= new GHOST_EventKey(getMilliSeconds(), type, window, gkey, sym); + g_event= new GHOST_EventKey(getMilliSeconds(), type, window, gkey, sym, NULL); } break; } diff --git a/intern/ghost/intern/GHOST_SystemWin32.cpp b/intern/ghost/intern/GHOST_SystemWin32.cpp index 38f3985b139..24b6474732e 100644 --- a/intern/ghost/intern/GHOST_SystemWin32.cpp +++ b/intern/ghost/intern/GHOST_SystemWin32.cpp @@ -725,7 +725,8 @@ GHOST_EventKey* GHOST_SystemWin32::processKeyEvent(GHOST_IWindow *window, RAWINP (LPSTR) &ascii, 1, NULL,NULL); - event = new GHOST_EventKey(system->getMilliSeconds(), keyDown ? GHOST_kEventKeyDown: GHOST_kEventKeyUp, window, key, ascii); + /* TODO, last arg is utf8, need to pass utf8 arg */ + event = new GHOST_EventKey(system->getMilliSeconds(), keyDown ? GHOST_kEventKeyDown: GHOST_kEventKeyUp, window, key, ascii, NULL); #ifdef GHOST_DEBUG std::cout << ascii << std::endl; diff --git a/intern/ghost/intern/GHOST_SystemX11.cpp b/intern/ghost/intern/GHOST_SystemX11.cpp index 27a61cf57fc..209ffe501f4 100644 --- a/intern/ghost/intern/GHOST_SystemX11.cpp +++ b/intern/ghost/intern/GHOST_SystemX11.cpp @@ -89,6 +89,11 @@ GHOST_SystemX11( abort(); //was return before, but this would just mean it will crash later } + /* Open a connection to the X input manager */ +#if defined(WITH_X11_XINPUT) && defined(X_HAVE_UTF8_STRING) + m_xim = XOpenIM(m_display, NULL, (char *)GHOST_X11_RES_NAME, (char *)GHOST_X11_RES_CLASS); +#endif + m_delete_window_atom = XInternAtom(m_display, "WM_DELETE_WINDOW", True); @@ -141,6 +146,10 @@ GHOST_SystemX11( GHOST_SystemX11:: ~GHOST_SystemX11() { +#if defined(WITH_X11_XINPUT) && defined(X_HAVE_UTF8_STRING) + XCloseIM(m_xim); +#endif + XCloseDisplay(m_display); } @@ -500,9 +509,9 @@ GHOST_SystemX11::processEvent(XEvent *xe) case KeyRelease: { XKeyEvent *xke = &(xe->xkey); - KeySym key_sym = XLookupKeysym(xke,0); char ascii; + char utf8_buf[6]; /* 6 is enough for a utf8 char */ GHOST_TKey gkey = convertXKey(key_sym); GHOST_TEventType type = (xke->type == KeyPress) ? @@ -512,13 +521,55 @@ GHOST_SystemX11::processEvent(XEvent *xe) ascii = '\0'; } +#if defined(WITH_X11_XINPUT) && defined(X_HAVE_UTF8_STRING) + /* getting unicode on key-up events gives XLookupNone status */ + if (xke->type == KeyPress) { + Status status; + int len; + + /* use utf8 because its not locale depentant, from xorg docs */ + if (!(len= Xutf8LookupString(window->getX11_XIC(), xke, utf8_buf, sizeof(utf8_buf), &key_sym, &status))) { + utf8_buf[0]= '\0'; + } + + if ((status == XLookupChars || status == XLookupBoth)) { + if ((unsigned char)utf8_buf[0] >= 32) { /* not an ascii control character */ + /* do nothing for now, this is valid utf8 */ + } + else { + utf8_buf[0]= '\0'; + } + } + else if (status == XLookupKeySym) { + /* this key doesn't have a text representation, it is a command + key of some sort */; + } + else { + printf("Bad keycode lookup. Keysym 0x%x Status: %s\n", + (unsigned int) key_sym, + (status == XBufferOverflow ? "BufferOverflow" : + status == XLookupNone ? "XLookupNone" : + status == XLookupKeySym ? "XLookupKeySym" : + "Unknown status")); + + printf("'%.*s' %p %p\n", len, utf8_buf, window->getX11_XIC(), m_xim); + } + } + else { + utf8_buf[0]= '\0'; + } +#else + utf8_buf[0]= '\0'; +#endif + g_event = new GHOST_EventKey( getMilliSeconds(), type, window, gkey, - ascii + ascii, + utf8_buf ); break; diff --git a/intern/ghost/intern/GHOST_SystemX11.h b/intern/ghost/intern/GHOST_SystemX11.h index b43d955d156..af45d68450f 100644 --- a/intern/ghost/intern/GHOST_SystemX11.h +++ b/intern/ghost/intern/GHOST_SystemX11.h @@ -40,6 +40,12 @@ #include "GHOST_System.h" #include "../GHOST_Types.h" +#if defined(WITH_X11_XINPUT) && defined(X_HAVE_UTF8_STRING) +# define GHOST_X11_RES_NAME "Blender" /* res_name */ +# define GHOST_X11_RES_CLASS "Blender" /* res_class */ +#endif + + class GHOST_WindowX11; /** @@ -203,6 +209,14 @@ public: return m_display; } +#if defined(WITH_X11_XINPUT) && defined(X_HAVE_UTF8_STRING) + XIM + getX11_XIM( + ) { + return m_xim; + } +#endif + /* Helped function for get data from the clipboard. */ void getClipboard_xcout(XEvent evt, Atom sel, Atom target, unsigned char **txt, unsigned long *len, @@ -258,6 +272,9 @@ public: private : Display * m_display; +#if defined(WITH_X11_XINPUT) && defined(X_HAVE_UTF8_STRING) + XIM m_xim; +#endif /// The vector of windows that need to be updated. std::vector m_dirty_windows; diff --git a/intern/ghost/intern/GHOST_WindowX11.cpp b/intern/ghost/intern/GHOST_WindowX11.cpp index 160980b6331..d26224d956a 100644 --- a/intern/ghost/intern/GHOST_WindowX11.cpp +++ b/intern/ghost/intern/GHOST_WindowX11.cpp @@ -392,6 +392,13 @@ GHOST_WindowX11( } } +#if defined(WITH_X11_XINPUT) && defined(X_HAVE_UTF8_STRING) + m_xic = XCreateIC(m_system->getX11_XIM(), XNClientWindow, m_window, XNFocusWindow, m_window, + XNInputStyle, XIMPreeditNothing | XIMStatusNothing, + XNResourceName, GHOST_X11_RES_NAME, XNResourceClass, + GHOST_X11_RES_CLASS, NULL); +#endif + // Set the window icon XWMHints *xwmhints = XAllocWMHints(); XImage *x_image, *mask_image; @@ -1304,6 +1311,13 @@ GHOST_WindowX11:: XSetSelectionOwner(m_display, Clipboard_atom, None, CurrentTime); } +#if defined(WITH_X11_XINPUT) && defined(X_HAVE_UTF8_STRING) + if (m_xic) { + XDestroyIC(m_xic); + } +#endif + + XDestroyWindow(m_display, m_window); XFree(m_visual); } diff --git a/intern/ghost/intern/GHOST_WindowX11.h b/intern/ghost/intern/GHOST_WindowX11.h index 2cb269ea919..ee662945eaa 100644 --- a/intern/ghost/intern/GHOST_WindowX11.h +++ b/intern/ghost/intern/GHOST_WindowX11.h @@ -221,6 +221,10 @@ public: { return NULL; } #endif // WITH_X11_XINPUT +#if defined(WITH_X11_XINPUT) && defined(X_HAVE_UTF8_STRING) + XIC getX11_XIC() { return m_xic; } +#endif + /* * Need this in case that we want start the window * in FullScree or Maximized state. @@ -363,6 +367,10 @@ private : XTablet m_xtablet; #endif +#if defined(WITH_X11_XINPUT) && defined(X_HAVE_UTF8_STRING) + XIC m_xic; +#endif + void icccmSetState(int state); int icccmGetState() const; diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index 4df9d7f12e2..85103b42244 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -1428,6 +1428,36 @@ static void ui_textedit_set_cursor_select(uiBut *but, uiHandleButtonData *data, ui_check_but(but); } +/* note: utf8 & ascii funcs should be merged */ +static int ui_textedit_type_utf8(uiBut *but, uiHandleButtonData *data, const char utf8_buf[6]) +{ + char *str; + int len, x, changed= 0; + size_t step= BLI_strnlen(utf8_buf, sizeof(utf8_buf)); + + str= data->str; + len= strlen(str); + + if(len-(but->selend - but->selsta)+1 <= data->maxlen) { + /* type over the current selection */ + if ((but->selend - but->selsta) > 0) + changed= ui_textedit_delete_selection(but, data); + + len= strlen(str); + if(len+step < data->maxlen) { + for(x= data->maxlen; x>but->pos; x--) + str[x]= str[x-step]; + memcpy(&str[but->pos], utf8_buf, step * sizeof(char)); + str[len+step]= '\0'; + + but->pos += step; + changed= 1; + } + } + + return changed; +} + static int ui_textedit_type_ascii(uiBut *but, uiHandleButtonData *data, char ascii) { char *str; @@ -1939,7 +1969,15 @@ static void ui_do_but_textedit(bContext *C, uiBlock *block, uiBut *but, uiHandle if(event->type == PADPERIOD && ascii == ',') ascii = '.'; - changed= ui_textedit_type_ascii(but, data, ascii); + if(event->utf8_buf[0]) { + /* keep this printf until utf8 is well tested */ + printf("%s: utf8 char '%s'\n", __func__, event->utf8_buf); + changed= ui_textedit_type_utf8(but, data, event->utf8_buf); + } + else { + changed= ui_textedit_type_ascii(but, data, ascii); + } + retval= WM_UI_HANDLER_BREAK; } diff --git a/source/blender/windowmanager/WM_types.h b/source/blender/windowmanager/WM_types.h index fec59e97194..f28fb08ac6e 100644 --- a/source/blender/windowmanager/WM_types.h +++ b/source/blender/windowmanager/WM_types.h @@ -341,8 +341,8 @@ typedef struct wmEvent { short val; /* press, release, scrollvalue */ int x, y; /* mouse pointer position, screen coord */ int mval[2]; /* region mouse position, name convention pre 2.5 :) */ - short unicode; /* future, ghost? */ - char ascii; /* from ghost */ + char utf8_buf[6]; /* from, ghost if utf8 is enabled for the platform */ + char ascii; /* from ghost, fallback if utf8 isnt set */ char pad; /* previous state */ diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c index 33e98007fed..7dcb4cf091f 100644 --- a/source/blender/windowmanager/intern/wm_event_system.c +++ b/source/blender/windowmanager/intern/wm_event_system.c @@ -2578,6 +2578,7 @@ void wm_event_add_ghostevent(wmWindowManager *wm, wmWindow *win, int type, int U GHOST_TEventKeyData *kd= customdata; event.type= convert_key(kd->key); event.ascii= kd->ascii; + strcpy(event.utf8_buf, kd->utf8_buf); event.val= (type==GHOST_kEventKeyDown)?KM_PRESS:KM_RELEASE; /* exclude arrow keys, esc, etc from text input */ diff --git a/source/gameengine/Ketsji/KX_PythonInit.cpp b/source/gameengine/Ketsji/KX_PythonInit.cpp index 40917a67c2f..e86831b9323 100644 --- a/source/gameengine/Ketsji/KX_PythonInit.cpp +++ b/source/gameengine/Ketsji/KX_PythonInit.cpp @@ -1816,7 +1816,7 @@ PyObject* initGamePlayerPythonScripting(const STR_String& progname, TPythonSecur /* Yet another gotcha in the py api * Cant run PySys_SetArgv more then once because this adds the * binary dir to the sys.path each time. - * Id have thaught python being totally restarted would make this ok but + * Id have thought python being totally restarted would make this ok but * somehow it remembers the sys.path - Campbell */ static bool first_time = true; -- cgit v1.2.3 From e0604e5941f958f332911b0948cddfc1f21f0014 Mon Sep 17 00:00:00 2001 From: Dalai Felinto Date: Thu, 20 Oct 2011 06:29:14 +0000 Subject: OSX fix for recent utf8 commit --- intern/ghost/intern/GHOST_SystemCocoa.mm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/intern/ghost/intern/GHOST_SystemCocoa.mm b/intern/ghost/intern/GHOST_SystemCocoa.mm index e8ec13f20df..58a856375bb 100644 --- a/intern/ghost/intern/GHOST_SystemCocoa.mm +++ b/intern/ghost/intern/GHOST_SystemCocoa.mm @@ -1655,8 +1655,8 @@ GHOST_TSuccess GHOST_SystemCocoa::handleKeyEvent(void *eventPtr) return GHOST_kFailure; } + char utf8_buf[6]= {'\0'}; /* TODO, unicode input */ switch ([event type]) { - char utf8_buf[6]= {'\0'}; /* TODO, unicode input */ case NSKeyDown: case NSKeyUp: -- cgit v1.2.3 From 415f35d1dc916edcb9b050f25ae406c6eee2b63d Mon Sep 17 00:00:00 2001 From: Dalai Felinto Date: Thu, 20 Oct 2011 06:38:45 +0000 Subject: =?UTF-8?q?bge=20bugfix:=20patch=20#28893=20"Fix=20for=20#28753=20?= =?UTF-8?q?and=20some=20other=20changes=20for=20BGE=20projection=20code"?= =?UTF-8?q?=20by=20Juha=20M=C3=A4ki-Kanto=20(kanttori)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp | 9 ++++++++- source/gameengine/Ketsji/KX_KetsjiEngine.cpp | 10 ++++++++-- source/gameengine/Ketsji/KX_MouseFocusSensor.cpp | 18 +++++++----------- source/gameengine/Rasterizer/RAS_FramingManager.cpp | 2 +- 4 files changed, 24 insertions(+), 15 deletions(-) diff --git a/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp b/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp index ce542671425..af4df5035bb 100644 --- a/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp +++ b/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp @@ -360,7 +360,14 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, rcti *c ketsjiengine->SetCameraOverrideUseOrtho((rv3d->persp == RV3D_ORTHO)); ketsjiengine->SetCameraOverrideProjectionMatrix(MT_CmMatrix4x4(rv3d->winmat)); ketsjiengine->SetCameraOverrideViewMatrix(MT_CmMatrix4x4(rv3d->viewmat)); - ketsjiengine->SetCameraOverrideClipping(v3d->near, v3d->far); + if(rv3d->persp == RV3D_ORTHO) + { + ketsjiengine->SetCameraOverrideClipping(-v3d->far, v3d->far); + } + else + { + ketsjiengine->SetCameraOverrideClipping(v3d->near, v3d->far); + } ketsjiengine->SetCameraOverrideLens(v3d->lens); } diff --git a/source/gameengine/Ketsji/KX_KetsjiEngine.cpp b/source/gameengine/Ketsji/KX_KetsjiEngine.cpp index 8e6126bb173..afc3bf2b53d 100644 --- a/source/gameengine/Ketsji/KX_KetsjiEngine.cpp +++ b/source/gameengine/Ketsji/KX_KetsjiEngine.cpp @@ -1400,8 +1400,14 @@ void KX_KetsjiEngine::PostProcessScene(KX_Scene* scene) KX_Camera* activecam = NULL; RAS_CameraData camdata = RAS_CameraData(); - if (override_camera) camdata.m_lens = m_overrideCamLens; - + if (override_camera) + { + camdata.m_lens = m_overrideCamLens; + camdata.m_clipstart = m_overrideCamNear; + camdata.m_clipend = m_overrideCamFar; + + camdata.m_perspective= !m_overrideCamUseOrtho; + } activecam = new KX_Camera(scene,KX_Scene::m_callbacks,camdata); activecam->SetName("__default__cam__"); diff --git a/source/gameengine/Ketsji/KX_MouseFocusSensor.cpp b/source/gameengine/Ketsji/KX_MouseFocusSensor.cpp index 34f5c26415d..e1978263a12 100644 --- a/source/gameengine/Ketsji/KX_MouseFocusSensor.cpp +++ b/source/gameengine/Ketsji/KX_MouseFocusSensor.cpp @@ -240,29 +240,23 @@ bool KX_MouseFocusSensor::ParentObjectHasFocusCamera(KX_Camera *cam) /* build the from and to point in normalized device coordinates - * Looks like normailized device coordinates are [-1,1] in x [-1,1] in y - * [0,-1] in z + * Normalized device coordinates are [-1,1] in x, y, z * * The actual z coordinates used don't have to be exact just infront and * behind of the near and far clip planes. */ frompoint.setValue( (2 * (m_x-x_lb) / width) - 1.0, 1.0 - (2 * (m_y_inv - y_lb) / height), - /*cam->GetCameraData()->m_perspective ? 0.0:cdata->m_clipstart,*/ /* real clipstart is scaled in ortho for some reason, zero is ok */ - 0.0, /* nearclip, see above comments */ + -1.0, 1.0 ); topoint.setValue( (2 * (m_x-x_lb) / width) - 1.0, 1.0 - (2 * (m_y_inv-y_lb) / height), - cam->GetCameraData()->m_perspective ? 1.0:cam->GetCameraData()->m_clipend, /* farclip, see above comments */ + 1.0, 1.0 ); - - /* camera to world */ - MT_Transform wcs_camcs_tranform = cam->GetWorldToCamera(); - MT_Transform cams_wcs_transform; - cams_wcs_transform.invert(wcs_camcs_tranform); - MT_Matrix4x4 camcs_wcs_matrix = MT_Matrix4x4(cams_wcs_transform); + /* camera to world */ + MT_Matrix4x4 camcs_wcs_matrix = MT_Matrix4x4(cam->GetCameraToWorld()); /* badly defined, the first time round.... I wonder why... I might * want to guard against floating point errors here.*/ @@ -272,6 +266,8 @@ bool KX_MouseFocusSensor::ParentObjectHasFocusCamera(KX_Camera *cam) /* shoot-points: clip to cam to wcs . win to clip was already done.*/ frompoint = clip_camcs_matrix * frompoint; topoint = clip_camcs_matrix * topoint; + /* clipstart = - (frompoint[2] / frompoint[3]) + * clipend = - (topoint[2] / topoint[3]) */ frompoint = camcs_wcs_matrix * frompoint; topoint = camcs_wcs_matrix * topoint; diff --git a/source/gameengine/Rasterizer/RAS_FramingManager.cpp b/source/gameengine/Rasterizer/RAS_FramingManager.cpp index edacd1dd0f1..6ca402691cb 100644 --- a/source/gameengine/Rasterizer/RAS_FramingManager.cpp +++ b/source/gameengine/Rasterizer/RAS_FramingManager.cpp @@ -99,7 +99,7 @@ ComputeDefaultOrtho( frustum.x1 = -frustum.x2; frustum.y2 = sizeY; frustum.y1 = -frustum.y2; - frustum.camnear = -camfar; + frustum.camnear = camnear; frustum.camfar = camfar; } -- cgit v1.2.3 From 3a51a446c1b14a5e4ac68007eef2d8a8bfdc49de Mon Sep 17 00:00:00 2001 From: Joerg Mueller Date: Thu, 20 Oct 2011 07:03:08 +0000 Subject: Fix for 7.1 audio export being misscalculated... --- intern/audaspace/intern/AUD_ChannelMapperReader.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/intern/audaspace/intern/AUD_ChannelMapperReader.cpp b/intern/audaspace/intern/AUD_ChannelMapperReader.cpp index 27d10ce6dc8..7764164a9b0 100644 --- a/intern/audaspace/intern/AUD_ChannelMapperReader.cpp +++ b/intern/audaspace/intern/AUD_ChannelMapperReader.cpp @@ -352,7 +352,7 @@ const float AUD_ChannelMapperReader::SURROUND71_ANGLES[] = 0.0f * M_PI / 180.0f, 0.0f * M_PI / 180.0f, -110.0f * M_PI / 180.0f, - 110.0f * M_PI / 180.0f + 110.0f * M_PI / 180.0f, -150.0f * M_PI / 180.0f, 150.0f * M_PI / 180.0f }; -- cgit v1.2.3 From 7aca04ad0a5d71f555008671ba740a6396bb0db0 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 20 Oct 2011 07:12:14 +0000 Subject: minor changes to test editing - use BLI_strncpy_utf8 for utf8 buttons when pasting. - reuse code for ui_textedit_type_ascii / ui_textedit_type_utf8. - use memmove rather then for() loops in string editing. - merge jump/all arguments in interface_handlers.c into one enum arg. --- source/blender/editors/interface/interface.c | 4 +- source/blender/editors/interface/interface_anim.c | 4 +- .../blender/editors/interface/interface_handlers.c | 129 ++++++++------------- .../blender/editors/interface/interface_intern.h | 1 + 4 files changed, 56 insertions(+), 82 deletions(-) diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c index ac1fab365f0..16edd0a1a9e 100644 --- a/source/blender/editors/interface/interface.c +++ b/source/blender/editors/interface/interface.c @@ -1747,7 +1747,9 @@ int ui_set_but_string(bContext *C, uiBut *but, const char *str) } else if(but->type == TEX) { /* string */ - BLI_strncpy(but->poin, str, but->hardmax); + if(ui_is_but_utf8(but)) BLI_strncpy_utf8(but->poin, str, but->hardmax); + else BLI_strncpy(but->poin, str, but->hardmax); + return 1; } else if(but->type == SEARCH_MENU) { diff --git a/source/blender/editors/interface/interface_anim.c b/source/blender/editors/interface/interface_anim.c index 6c661ba014e..545d60bfcb9 100644 --- a/source/blender/editors/interface/interface_anim.c +++ b/source/blender/editors/interface/interface_anim.c @@ -115,7 +115,7 @@ int ui_but_anim_expression_set(uiBut *but, const char *str) driver= fcu->driver; if(driver && driver->type == DRIVER_TYPE_PYTHON) { - BLI_strncpy(driver->expression, str, sizeof(driver->expression)); + BLI_strncpy_utf8(driver->expression, str, sizeof(driver->expression)); driver->flag |= DRIVER_FLAG_RECOMPILE; WM_event_add_notifier(but->block->evil_C, NC_ANIMATION|ND_KEYFRAME, NULL); return 1; @@ -164,7 +164,7 @@ int ui_but_anim_expression_create(uiBut *but, const char *str) /* set the expression */ // TODO: need some way of identifying variables used - BLI_strncpy(driver->expression, str, sizeof(driver->expression)); + BLI_strncpy_utf8(driver->expression, str, sizeof(driver->expression)); /* FIXME: for now, assume that * - for expressions, users are likely to be using "frame" -> current frame" as a variable diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index 85103b42244..1f30f8a5109 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -107,6 +107,12 @@ typedef enum uiHandleButtonState { BUTTON_STATE_EXIT } uiHandleButtonState; +typedef enum uiButtonJumpType { + BUTTON_EDIT_JUMP_NONE, + BUTTON_EDIT_JUMP_DELIM, + BUTTON_EDIT_JUMP_ALL +} uiButtonJumpType; + typedef struct uiHandleButtonData { wmWindowManager *wm; wmWindow *window; @@ -260,7 +266,7 @@ static int ui_is_a_warp_but(uiBut *but) } /* file selectors are exempt from utf-8 checks */ -static int ui_is_utf8_but(uiBut *but) +int ui_is_but_utf8(uiBut *but) { if (but->rnaprop) { const int subtype= RNA_property_subtype(but->rnaprop); @@ -1163,7 +1169,10 @@ static void ui_but_copy_paste(bContext *C, uiBut *but, uiHandleButtonData *data, } else { button_activate_state(C, but, BUTTON_STATE_TEXT_EDITING); - BLI_strncpy(active_data->str, buf, active_data->maxlen); + + if(ui_is_but_utf8(but)) BLI_strncpy_utf8(active_data->str, buf, active_data->maxlen); + else BLI_strncpy(active_data->str, buf, active_data->maxlen); + if(but->type == SEARCH_MENU) { /* else uiSearchboxData.active member is not updated [#26856] */ ui_searchbox_update(C, data->searchbox, but, 1); @@ -1282,18 +1291,18 @@ static int ui_textedit_step_prev_utf8(const char *str, size_t UNUSED(maxlen), sh static void ui_textedit_step_utf8(const char *str, size_t maxlen, short *pos, const char direction, - const short do_jump, const short do_all) + uiButtonJumpType jump) { const short pos_prev= *pos; if(direction) { /* right*/ - if(do_jump) { + if(jump != BUTTON_EDIT_JUMP_NONE) { /* jump between special characters (/,\,_,-, etc.), * look at function test_special_char() for complete * list of special character, ctr -> */ while((*pos) < maxlen) { if (ui_textedit_step_next_utf8(str, maxlen, pos)) { - if(!do_all && test_special_char(str[(*pos)])) break; + if((jump != BUTTON_EDIT_JUMP_ALL) && test_special_char(str[(*pos)])) break; } else { break; /* unlikely but just incase */ @@ -1305,7 +1314,7 @@ static void ui_textedit_step_utf8(const char *str, size_t maxlen, } } else { /* left */ - if(do_jump) { + if(jump != BUTTON_EDIT_JUMP_NONE) { /* left only: compensate for index/change in direction */ ui_textedit_step_prev_utf8(str, maxlen, pos); @@ -1314,7 +1323,7 @@ static void ui_textedit_step_utf8(const char *str, size_t maxlen, * list of special character, ctr -> */ while ((*pos) > 0) { if (ui_textedit_step_prev_utf8(str, maxlen, pos)) { - if(!do_all && test_special_char(str[(*pos)])) break; + if((jump != BUTTON_EDIT_JUMP_ALL) && test_special_char(str[(*pos)])) break; } else { break; @@ -1432,24 +1441,23 @@ static void ui_textedit_set_cursor_select(uiBut *but, uiHandleButtonData *data, static int ui_textedit_type_utf8(uiBut *but, uiHandleButtonData *data, const char utf8_buf[6]) { char *str; - int len, x, changed= 0; - size_t step= BLI_strnlen(utf8_buf, sizeof(utf8_buf)); + int len, changed= 0; str= data->str; len= strlen(str); if(len-(but->selend - but->selsta)+1 <= data->maxlen) { + int step= BLI_strnlen(utf8_buf, sizeof(utf8_buf)); + /* type over the current selection */ - if ((but->selend - but->selsta) > 0) + if ((but->selend - but->selsta) > 0) { changed= ui_textedit_delete_selection(but, data); + len= strlen(str); + } - len= strlen(str); - if(len+step < data->maxlen) { - for(x= data->maxlen; x>but->pos; x--) - str[x]= str[x-step]; + if(len + step < data->maxlen) { + memmove(&str[but->pos + step], &str[but->pos], (len + 1) - but->pos); memcpy(&str[but->pos], utf8_buf, step * sizeof(char)); - str[len+step]= '\0'; - but->pos += step; changed= 1; } @@ -1460,33 +1468,11 @@ static int ui_textedit_type_utf8(uiBut *but, uiHandleButtonData *data, const cha static int ui_textedit_type_ascii(uiBut *but, uiHandleButtonData *data, char ascii) { - char *str; - int len, x, changed= 0; - - str= data->str; - len= strlen(str); - - if(len-(but->selend - but->selsta)+1 <= data->maxlen) { - /* type over the current selection */ - if ((but->selend - but->selsta) > 0) - changed= ui_textedit_delete_selection(but, data); - - len= strlen(str); - if(len+1 < data->maxlen) { - for(x= data->maxlen; x>but->pos; x--) - str[x]= str[x-1]; - str[but->pos]= ascii; - str[len+1]= '\0'; - - but->pos++; - changed= 1; - } - } - - return changed; + char utf8_buf[6]= {ascii, '\0'}; + return ui_textedit_type_utf8(but, data, utf8_buf); } -static void ui_textedit_move(uiBut *but, uiHandleButtonData *data, int direction, int select, int jump, int jump_all) +static void ui_textedit_move(uiBut *but, uiHandleButtonData *data, int direction, int select, uiButtonJumpType jump) { const char *str= data->str; const int len= strlen(str); @@ -1495,7 +1481,7 @@ static void ui_textedit_move(uiBut *but, uiHandleButtonData *data, int direction /* special case, quit selection and set cursor */ if (has_sel && !select) { - if (jump_all) { + if (jump == BUTTON_EDIT_JUMP_ALL) { but->selsta = but->selend= but->pos = direction ? len : 0; } else { @@ -1509,7 +1495,7 @@ static void ui_textedit_move(uiBut *but, uiHandleButtonData *data, int direction data->selextend = 0; } else { - ui_textedit_step_utf8(str, len, &but->pos, direction, jump, jump_all); + ui_textedit_step_utf8(str, len, &but->pos, direction, jump); if(select) { /* existing selection */ @@ -1558,35 +1544,33 @@ static void ui_textedit_move(uiBut *but, uiHandleButtonData *data, int direction } } -static int ui_textedit_delete(uiBut *but, uiHandleButtonData *data, int direction, const int all, const int jump) +static int ui_textedit_delete(uiBut *but, uiHandleButtonData *data, int direction, uiButtonJumpType jump) { char *str= data->str; const int len= strlen(str); - int x, changed= 0; + int changed= 0; - if(all) { + if(jump == BUTTON_EDIT_JUMP_ALL) { if(len) changed=1; - str[0]= 0; + str[0]= '\0'; but->pos= 0; } else if(direction) { /* delete */ if ((but->selend - but->selsta) > 0) { changed= ui_textedit_delete_selection(but, data); } - else if(but->pos>=0 && but->pospos>=0 && but->pospos; int step; - ui_textedit_step_utf8(str, len, &pos, direction, jump, all); + ui_textedit_step_utf8(str, len, &pos, direction, jump); step= pos - but->pos; - for(x=but->pos; xpos], &str[but->pos + step], (len + 1) - but->pos); changed= 1; } } else { /* backspace */ - if(len!=0) { + if (len != 0) { if ((but->selend - but->selsta) > 0) { changed= ui_textedit_delete_selection(but, data); } @@ -1594,13 +1578,9 @@ static int ui_textedit_delete(uiBut *but, uiHandleButtonData *data, int directio short pos= but->pos; int step; - ui_textedit_step_utf8(str, len, &pos, direction, jump, all); + ui_textedit_step_utf8(str, len, &pos, direction, jump); step= but->pos - pos; - - for(x=but->pos; xpos - step], &str[but->pos], (len + 1) - but->pos); but->pos -= step; changed= 1; } @@ -1710,19 +1690,9 @@ static void ui_textedit_begin(bContext *C, uiBut *but, uiHandleButtonData *data) ui_get_but_string(but, data->str, data->maxlen); if(ELEM3(but->type, NUM, NUMABS, NUMSLI)) { - /* XXX: we dont have utf editing yet so for numbers its best to strip out utf chars - * this is so the deg' synbol isnt included in number editing fields: bug 22274 */ - int i; - for(i=0; data->str[i]; i++) { - if(!isascii(data->str[i])) { - /* no stripping actually: just convert to alt name */ - ui_convert_to_unit_alt_name(but, data->str, data->maxlen); - break; - } - } + ui_convert_to_unit_alt_name(but, data->str, data->maxlen); } - - + data->origstr= BLI_strdup(data->str); data->selextend= 0; data->selstartx= 0; @@ -1747,7 +1717,7 @@ static void ui_textedit_begin(bContext *C, uiBut *but, uiHandleButtonData *data) static void ui_textedit_end(bContext *C, uiBut *but, uiHandleButtonData *data) { if(but) { - if(ui_is_utf8_but(but)) { + if(ui_is_but_utf8(but)) { int strip= BLI_utf8_invalid_strip(but->editstr, strlen(but->editstr)); /* not a file?, strip non utf-8 chars */ if(strip) { @@ -1899,11 +1869,11 @@ static void ui_do_but_textedit(bContext *C, uiBlock *block, uiBut *but, uiHandle } break; case RIGHTARROWKEY: - ui_textedit_move(but, data, 1, event->shift, event->ctrl, FALSE); + ui_textedit_move(but, data, 1, event->shift, event->ctrl ? BUTTON_EDIT_JUMP_DELIM : BUTTON_EDIT_JUMP_NONE); retval= WM_UI_HANDLER_BREAK; break; case LEFTARROWKEY: - ui_textedit_move(but, data, 0, event->shift, event->ctrl, FALSE); + ui_textedit_move(but, data, 0, event->shift, event->ctrl ? BUTTON_EDIT_JUMP_DELIM : BUTTON_EDIT_JUMP_NONE); retval= WM_UI_HANDLER_BREAK; break; case DOWNARROWKEY: @@ -1913,7 +1883,7 @@ static void ui_do_but_textedit(bContext *C, uiBlock *block, uiBut *but, uiHandle } /* pass on purposedly */ case ENDKEY: - ui_textedit_move(but, data, 1, event->shift, TRUE, TRUE); + ui_textedit_move(but, data, 1, event->shift, BUTTON_EDIT_JUMP_ALL); retval= WM_UI_HANDLER_BREAK; break; case UPARROWKEY: @@ -1923,7 +1893,7 @@ static void ui_do_but_textedit(bContext *C, uiBlock *block, uiBut *but, uiHandle } /* pass on purposedly */ case HOMEKEY: - ui_textedit_move(but, data, 0, event->shift, TRUE, TRUE); + ui_textedit_move(but, data, 0, event->shift, BUTTON_EDIT_JUMP_ALL); retval= WM_UI_HANDLER_BREAK; break; case PADENTER: @@ -1932,12 +1902,12 @@ static void ui_do_but_textedit(bContext *C, uiBlock *block, uiBut *but, uiHandle retval= WM_UI_HANDLER_BREAK; break; case DELKEY: - changed= ui_textedit_delete(but, data, 1, 0, event->ctrl); + changed= ui_textedit_delete(but, data, 1, event->ctrl ? BUTTON_EDIT_JUMP_DELIM : BUTTON_EDIT_JUMP_NONE); retval= WM_UI_HANDLER_BREAK; break; case BACKSPACEKEY: - changed= ui_textedit_delete(but, data, 0, event->shift, event->ctrl); + changed= ui_textedit_delete(but, data, 0, event->shift ? BUTTON_EDIT_JUMP_ALL : (event->ctrl ? BUTTON_EDIT_JUMP_DELIM : BUTTON_EDIT_JUMP_NONE)); retval= WM_UI_HANDLER_BREAK; break; @@ -1969,9 +1939,10 @@ static void ui_do_but_textedit(bContext *C, uiBlock *block, uiBut *but, uiHandle if(event->type == PADPERIOD && ascii == ',') ascii = '.'; - if(event->utf8_buf[0]) { + if(event->utf8_buf[0] || 1) { /* keep this printf until utf8 is well tested */ printf("%s: utf8 char '%s'\n", __func__, event->utf8_buf); + // strcpy(event->utf8_buf, "12345"); changed= ui_textedit_type_utf8(but, data, event->utf8_buf); } else { diff --git a/source/blender/editors/interface/interface_intern.h b/source/blender/editors/interface/interface_intern.h index c5843397c12..b7a2227f98a 100644 --- a/source/blender/editors/interface/interface_intern.h +++ b/source/blender/editors/interface/interface_intern.h @@ -373,6 +373,7 @@ extern void ui_check_but(uiBut *but); extern int ui_is_but_float(uiBut *but); extern int ui_is_but_unit(uiBut *but); extern int ui_is_but_rna_valid(uiBut *but); +extern int ui_is_but_utf8(uiBut *but); extern void ui_bounds_block(uiBlock *block); extern void ui_block_translate(uiBlock *block, int x, int y); -- cgit v1.2.3 From f1fe89acf1f42df4becfc5dd53d2d3ea8635a72c Mon Sep 17 00:00:00 2001 From: Mitchell Stokes Date: Thu, 20 Oct 2011 07:20:17 +0000 Subject: Fix for bug #28979 "Action actuator breaks animation" reported by Goran Milovanovic. Apparently IPO options can be set too frequently... --- source/gameengine/Ketsji/BL_Action.cpp | 5 ----- 1 file changed, 5 deletions(-) diff --git a/source/gameengine/Ketsji/BL_Action.cpp b/source/gameengine/Ketsji/BL_Action.cpp index 08794042e37..9e8f53ad219 100644 --- a/source/gameengine/Ketsji/BL_Action.cpp +++ b/source/gameengine/Ketsji/BL_Action.cpp @@ -361,9 +361,6 @@ void BL_Action::Update(float curtime) break; } - - if (!m_done) - InitIPO(); } if (m_obj->GetGameObjectType() == SCA_IObject::OBJ_ARMATURE) @@ -446,8 +443,6 @@ void BL_Action::Update(float curtime) obj->SetActiveAction(NULL, 0, curtime); } - - InitIPO(); m_obj->UpdateIPO(m_localtime, m_ipo_flags & ACT_IPOFLAG_CHILD); } } -- cgit v1.2.3 From daf51fe6cd1b47d3727e932bb465b8e2a8723d41 Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Thu, 20 Oct 2011 07:56:04 +0000 Subject: A big set of UI messages fixes and tweaks! No functional changes. --- release/scripts/startup/bl_operators/anim.py | 2 +- release/scripts/startup/bl_operators/object.py | 2 +- release/scripts/startup/bl_operators/presets.py | 2 +- .../bl_operators/screen_play_rendered_anim.py | 2 +- .../startup/bl_operators/vertexpaint_dirt.py | 2 +- source/blender/editors/armature/poseobject.c | 2 +- source/blender/editors/curve/editfont.c | 2 +- source/blender/editors/object/object_edit.c | 2 +- source/blender/editors/object/object_hook.c | 2 +- source/blender/editors/screen/screen_ops.c | 2 +- source/blender/editors/space_image/image_buttons.c | 4 +- source/blender/editors/space_info/info_report.c | 2 +- source/blender/editors/space_logic/logic_ops.c | 4 +- source/blender/makesrna/intern/rna_curve.c | 8 +-- source/blender/makesrna/intern/rna_fcurve.c | 5 +- source/blender/makesrna/intern/rna_image.c | 8 +-- source/blender/makesrna/intern/rna_mesh.c | 21 ++++--- source/blender/makesrna/intern/rna_nodetree.c | 6 +- source/blender/makesrna/intern/rna_object.c | 16 ++--- source/blender/makesrna/intern/rna_object_force.c | 32 ++++++---- source/blender/makesrna/intern/rna_pose.c | 68 ++++++++++++++-------- source/blender/makesrna/intern/rna_scene.c | 20 +++---- source/blender/makesrna/intern/rna_sculpt_paint.c | 19 ++++-- source/blender/makesrna/intern/rna_sequencer.c | 2 +- source/blender/makesrna/intern/rna_smoke.c | 8 +-- source/blender/makesrna/intern/rna_texture.c | 12 ++-- source/blender/makesrna/intern/rna_userdef.c | 14 ++--- source/blender/makesrna/intern/rna_wm.c | 2 +- source/blender/makesrna/intern/rna_world.c | 4 +- 29 files changed, 160 insertions(+), 115 deletions(-) diff --git a/release/scripts/startup/bl_operators/anim.py b/release/scripts/startup/bl_operators/anim.py index 3051914cf00..e1d33198142 100644 --- a/release/scripts/startup/bl_operators/anim.py +++ b/release/scripts/startup/bl_operators/anim.py @@ -228,7 +228,7 @@ class BakeAction(Operator): class ClearUselessActions(Operator): """Mark actions with no F-Curves for deletion after save+reload of """ \ - """file preserving "action libraries""" + """file preserving \"action libraries\"""" bl_idname = "anim.clear_useless_actions" bl_label = "Clear Useless Actions" bl_options = {'REGISTER', 'UNDO'} diff --git a/release/scripts/startup/bl_operators/object.py b/release/scripts/startup/bl_operators/object.py index 51c530db672..738cc7b24e0 100644 --- a/release/scripts/startup/bl_operators/object.py +++ b/release/scripts/startup/bl_operators/object.py @@ -122,7 +122,7 @@ class SelectCamera(Operator): class SelectHierarchy(Operator): - '''Select object relative to the active objects position''' \ + '''Select object relative to the active object's position''' \ '''in the hierarchy''' bl_idname = "object.select_hierarchy" bl_label = "Select Hierarchy" diff --git a/release/scripts/startup/bl_operators/presets.py b/release/scripts/startup/bl_operators/presets.py index 2fd0c4a9e12..2e42105fbf0 100644 --- a/release/scripts/startup/bl_operators/presets.py +++ b/release/scripts/startup/bl_operators/presets.py @@ -142,7 +142,7 @@ class AddPresetBase(): class ExecutePreset(Operator): - ''' Executes a preset ''' + '''Execute a preset''' bl_idname = "script.execute_preset" bl_label = "Execute a Python Preset" diff --git a/release/scripts/startup/bl_operators/screen_play_rendered_anim.py b/release/scripts/startup/bl_operators/screen_play_rendered_anim.py index 3479a3f9e53..5ee7cf86142 100644 --- a/release/scripts/startup/bl_operators/screen_play_rendered_anim.py +++ b/release/scripts/startup/bl_operators/screen_play_rendered_anim.py @@ -66,7 +66,7 @@ def guess_player_path(preset): class PlayRenderedAnim(Operator): - '''Plays back rendered frames/movies using an external player''' + '''Play back rendered frames/movies using an external player''' bl_idname = "render.play_rendered_anim" bl_label = "Play Rendered Animation" bl_options = {'REGISTER'} diff --git a/release/scripts/startup/bl_operators/vertexpaint_dirt.py b/release/scripts/startup/bl_operators/vertexpaint_dirt.py index ce4942ae238..5fb5c7f39cf 100644 --- a/release/scripts/startup/bl_operators/vertexpaint_dirt.py +++ b/release/scripts/startup/bl_operators/vertexpaint_dirt.py @@ -159,7 +159,7 @@ class VertexPaintDirt(Operator): ) blur_iterations = IntProperty( name="Blur Iterations", - description="Number times to blur the colors. (higher blurs more)", + description="Number times to blur the colors (higher blurs more)", min=0, max=40, default=1, ) diff --git a/source/blender/editors/armature/poseobject.c b/source/blender/editors/armature/poseobject.c index 61935aa72ca..a978f327993 100644 --- a/source/blender/editors/armature/poseobject.c +++ b/source/blender/editors/armature/poseobject.c @@ -1197,7 +1197,7 @@ void POSE_OT_paste (wmOperatorType *ot) /* identifiers */ ot->name= "Paste Pose"; ot->idname= "POSE_OT_paste"; - ot->description= "Pastes the stored pose on to the current pose"; + ot->description= "Paste the stored pose on to the current pose"; /* api callbacks */ ot->exec= pose_paste_exec; diff --git a/source/blender/editors/curve/editfont.c b/source/blender/editors/curve/editfont.c index 1f2ef79e091..60b1cc8f5cd 100644 --- a/source/blender/editors/curve/editfont.c +++ b/source/blender/editors/curve/editfont.c @@ -1046,7 +1046,7 @@ void FONT_OT_change_spacing(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; /* properties */ - RNA_def_int(ot->srna, "delta", 1, -20, 20, "Delta", "Amount to decrease or increasing character spacing with", -20, 20); + RNA_def_int(ot->srna, "delta", 1, -20, 20, "Delta", "Amount to decrease or increase character spacing with", -20, 20); } /************************* change character **********************/ diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c index 76cbfdc88e7..0ad11d1a997 100644 --- a/source/blender/editors/object/object_edit.c +++ b/source/blender/editors/object/object_edit.c @@ -585,7 +585,7 @@ void OBJECT_OT_posemode_toggle(wmOperatorType *ot) /* identifiers */ ot->name= "Toggle Pose Mode"; ot->idname= "OBJECT_OT_posemode_toggle"; - ot->description= "Enables or disables posing/selecting bones"; + ot->description= "Enable or disable posing/selecting bones"; /* api callbacks */ ot->exec= posemode_exec; diff --git a/source/blender/editors/object/object_hook.c b/source/blender/editors/object/object_hook.c index ce01bef34f6..9f1ad8e4c3c 100644 --- a/source/blender/editors/object/object_hook.c +++ b/source/blender/editors/object/object_hook.c @@ -837,7 +837,7 @@ void OBJECT_OT_hook_select(wmOperatorType *ot) /* identifiers */ ot->name= "Select Hook"; - ot->description= "Selects effected vertices on mesh"; + ot->description= "Select affected vertices on mesh"; ot->idname= "OBJECT_OT_hook_select"; /* callbacks */ diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c index a2be1e8fa6f..bae6fa9d6b0 100644 --- a/source/blender/editors/screen/screen_ops.c +++ b/source/blender/editors/screen/screen_ops.c @@ -649,7 +649,7 @@ static void SCREEN_OT_actionzone(wmOperatorType *ot) ot->flag= OPTYPE_BLOCKING; - RNA_def_int(ot->srna, "modifier", 0, 0, 2, "modifier", "modifier state", 0, 2); + RNA_def_int(ot->srna, "modifier", 0, 0, 2, "Modifier", "Modifier state", 0, 2); } /* ************** swap area operator *********************************** */ diff --git a/source/blender/editors/space_image/image_buttons.c b/source/blender/editors/space_image/image_buttons.c index 71d9dd3adcb..beeb5e3532f 100644 --- a/source/blender/editors/space_image/image_buttons.c +++ b/source/blender/editors/space_image/image_buttons.c @@ -704,8 +704,8 @@ void uiTemplateImage(uiLayout *layout, bContext *C, PointerRNA *ptr, const char sprintf(str, "(%d) Frames:", iuser->framenr); else strcpy(str, "Frames:"); uiBlockBeginAlign(block); - uiDefButI(block, NUM, imagechanged, str, 10, 90,150, 20, &iuser->frames, 0.0, MAXFRAMEF, 0, 0, "Sets the number of images of a movie to use"); - uiDefButI(block, NUM, imagechanged, "StartFr:", 160,90,150,20, &iuser->sfra, 1.0, MAXFRAMEF, 0, 0, "Sets the global starting frame of the movie"); + uiDefButI(block, NUM, imagechanged, str, 10, 90,150, 20, &iuser->frames, 0.0, MAXFRAMEF, 0, 0, "Number of images of a movie to use"); + uiDefButI(block, NUM, imagechanged, "StartFr:", 160,90,150,20, &iuser->sfra, 1.0, MAXFRAMEF, 0, 0, "Global starting frame of the movie"); } #endif } diff --git a/source/blender/editors/space_info/info_report.c b/source/blender/editors/space_info/info_report.c index d0a80cddf56..52930626964 100644 --- a/source/blender/editors/space_info/info_report.c +++ b/source/blender/editors/space_info/info_report.c @@ -160,7 +160,7 @@ void INFO_OT_select_pick(wmOperatorType *ot) /* ot->flag= OPTYPE_REGISTER; */ /* properties */ - RNA_def_int(ot->srna, "report_index", 0, 0, INT_MAX, "Report", "The index of the report", 0, INT_MAX); + RNA_def_int(ot->srna, "report_index", 0, 0, INT_MAX, "Report", "Index of the report", 0, INT_MAX); } diff --git a/source/blender/editors/space_logic/logic_ops.c b/source/blender/editors/space_logic/logic_ops.c index b7f9af09348..b1c0dd02e4b 100644 --- a/source/blender/editors/space_logic/logic_ops.c +++ b/source/blender/editors/space_logic/logic_ops.c @@ -478,7 +478,7 @@ static int actuator_remove_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(e static void LOGIC_OT_actuator_remove(wmOperatorType *ot) { ot->name= "Remove Actuator"; - ot->description= "Remove a actuator from the active object"; + ot->description= "Remove an actuator from the active object"; ot->idname= "LOGIC_OT_actuator_remove"; ot->invoke= actuator_remove_invoke; @@ -533,7 +533,7 @@ static void LOGIC_OT_actuator_add(wmOperatorType *ot) /* identifiers */ ot->name= "Add Actuator"; - ot->description = "Add a actuator to the active object"; + ot->description = "Add an actuator to the active object"; ot->idname= "LOGIC_OT_actuator_add"; /* api callbacks */ diff --git a/source/blender/makesrna/intern/rna_curve.c b/source/blender/makesrna/intern/rna_curve.c index 49f39a207d2..c03a10f2170 100644 --- a/source/blender/makesrna/intern/rna_curve.c +++ b/source/blender/makesrna/intern/rna_curve.c @@ -722,7 +722,7 @@ static void rna_def_bpoint(BlenderRNA *brna) prop= RNA_def_property(srna, "weight", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "vec[3]"); - RNA_def_property_ui_text(prop, "Weight", "Nurbs weight"); + RNA_def_property_ui_text(prop, "Weight", "NURBS weight"); RNA_def_property_update(prop, 0, "rna_Curve_update_data"); /* Number values */ @@ -1446,7 +1446,7 @@ static void rna_def_curve_nurb(BlenderRNA *brna) srna= RNA_def_struct(brna, "Spline", NULL); RNA_def_struct_sdna(srna, "Nurb"); - RNA_def_struct_ui_text(srna, "Spline", "Element of a curve, either Nurbs, Bezier or Polyline or a character with text objects"); + RNA_def_struct_ui_text(srna, "Spline", "Element of a curve, either NURBS, Bezier or Polyline or a character with text objects"); prop= RNA_def_property(srna, "points", PROP_COLLECTION, PROP_NONE); RNA_def_property_collection_sdna(prop, NULL, "bp", NULL); @@ -1496,13 +1496,13 @@ static void rna_def_curve_nurb(BlenderRNA *brna) prop= RNA_def_property(srna, "order_u", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "orderu"); RNA_def_property_range(prop, 2, 6); - RNA_def_property_ui_text(prop, "Order U", "Nurbs order in the U direction (For splines and surfaces), Higher values let points influence a greater area"); + RNA_def_property_ui_text(prop, "Order U", "NURBS order in the U direction (for splines and surfaces, higher values let points influence a greater area)"); RNA_def_property_update(prop, 0, "rna_Nurb_update_knot_u"); prop= RNA_def_property(srna, "order_v", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "orderv"); RNA_def_property_range(prop, 2, 6); - RNA_def_property_ui_text(prop, "Order V", "Nurbs order in the V direction (For surfaces only), Higher values let points influence a greater area"); + RNA_def_property_ui_text(prop, "Order V", "NURBS order in the V direction (for surfaces only, higher values let points influence a greater area)"); RNA_def_property_update(prop, 0, "rna_Nurb_update_knot_v"); diff --git a/source/blender/makesrna/intern/rna_fcurve.c b/source/blender/makesrna/intern/rna_fcurve.c index 43812ad4a01..08a71e0cd4f 100644 --- a/source/blender/makesrna/intern/rna_fcurve.c +++ b/source/blender/makesrna/intern/rna_fcurve.c @@ -1368,13 +1368,14 @@ static void rna_def_fkeyframe(BlenderRNA *brna) RNA_def_property_enum_sdna(prop, NULL, "ipo"); RNA_def_property_enum_items(prop, beztriple_interpolation_mode_items); RNA_def_property_ui_text(prop, "Interpolation", - "Interpolation method to use for segment of the curve from this Keyframe until the next Keyframe"); + "Interpolation method to use for segment of the F-Curve from " + "this Keyframe until the next Keyframe"); RNA_def_property_update(prop, NC_ANIMATION|ND_KEYFRAME_PROP, NULL); prop= RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "hide"); RNA_def_property_enum_items(prop, beztriple_keyframe_type_items); - RNA_def_property_ui_text(prop, "Type", "The type of keyframe (for visual purposes only"); + RNA_def_property_ui_text(prop, "Type", "Type of keyframe (for visual purposes only)"); RNA_def_property_update(prop, NC_ANIMATION|ND_KEYFRAME_PROP, NULL); /* Vector values */ diff --git a/source/blender/makesrna/intern/rna_image.c b/source/blender/makesrna/intern/rna_image.c index eac4932ac43..66bcc5951cd 100644 --- a/source/blender/makesrna/intern/rna_image.c +++ b/source/blender/makesrna/intern/rna_image.c @@ -369,25 +369,25 @@ static void rna_def_imageuser(BlenderRNA *brna) prop= RNA_def_property(srna, "frame_duration", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "frames"); RNA_def_property_range(prop, 0, MAXFRAMEF); - RNA_def_property_ui_text(prop, "Frames", "Sets the number of images of a movie to use"); + RNA_def_property_ui_text(prop, "Frames", "Number of images of a movie to use"); RNA_def_property_update(prop, 0, "rna_ImageUser_update"); prop= RNA_def_property(srna, "frame_offset", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "offset"); RNA_def_property_range(prop, MINAFRAMEF, MAXFRAMEF); - RNA_def_property_ui_text(prop, "Offset", "Offsets the number of the frame to use in the animation"); + RNA_def_property_ui_text(prop, "Offset", "Offset the number of the frame to use in the animation"); RNA_def_property_update(prop, 0, "rna_ImageUser_update"); prop= RNA_def_property(srna, "frame_start", PROP_INT, PROP_TIME); RNA_def_property_int_sdna(prop, NULL, "sfra"); RNA_def_property_range(prop, MINAFRAMEF, MAXFRAMEF); - RNA_def_property_ui_text(prop, "Start Frame", "Sets the global starting frame of the movie/sequence, assuming first picture has a #1"); + RNA_def_property_ui_text(prop, "Start Frame", "Global starting frame of the movie/sequence, assuming first picture has a #1"); RNA_def_property_update(prop, 0, "rna_ImageUser_update"); prop= RNA_def_property(srna, "fields_per_frame", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "fie_ima"); RNA_def_property_range(prop, 1, 200); - RNA_def_property_ui_text(prop, "Fields per Frame", "The number of fields per rendered frame (2 fields is 1 image)"); + RNA_def_property_ui_text(prop, "Fields per Frame", "Number of fields per rendered frame (2 fields is 1 image)"); RNA_def_property_update(prop, 0, "rna_ImageUser_update"); prop= RNA_def_property(srna, "multilayer_layer", PROP_INT, PROP_UNSIGNED); diff --git a/source/blender/makesrna/intern/rna_mesh.c b/source/blender/makesrna/intern/rna_mesh.c index d35b7ad38fb..c4f33f9cf10 100644 --- a/source/blender/makesrna/intern/rna_mesh.c +++ b/source/blender/makesrna/intern/rna_mesh.c @@ -1383,20 +1383,20 @@ static void rna_def_mtface(BlenderRNA *brna) prop= RNA_def_property(srna, "active", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_funcs(prop, "rna_MeshTextureFaceLayer_active_get", "rna_MeshTextureFaceLayer_active_set"); - RNA_def_property_ui_text(prop, "Active", "Sets the layer as active for display and editing"); + RNA_def_property_ui_text(prop, "Active", "Set the layer as active for display and editing"); RNA_def_property_update(prop, 0, "rna_Mesh_update_data"); prop= RNA_def_property(srna, "active_render", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "active_rnd", 0); RNA_def_property_boolean_funcs(prop, "rna_MeshTextureFaceLayer_active_render_get", "rna_MeshTextureFaceLayer_active_render_set"); - RNA_def_property_ui_text(prop, "Active Render", "Sets the layer as active for rendering"); + RNA_def_property_ui_text(prop, "Active Render", "Set the layer as active for rendering"); RNA_def_property_update(prop, 0, "rna_Mesh_update_data"); prop= RNA_def_property(srna, "active_clone", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "active_clone", 0); RNA_def_property_boolean_funcs(prop, "rna_MeshTextureFaceLayer_clone_get", "rna_MeshTextureFaceLayer_clone_set"); - RNA_def_property_ui_text(prop, "Active Clone", "Sets the layer as active for cloning"); + RNA_def_property_ui_text(prop, "Active Clone", "Set the layer as active for cloning"); RNA_def_property_update(prop, 0, "rna_Mesh_update_data"); prop= RNA_def_property(srna, "data", PROP_COLLECTION, PROP_NONE); @@ -1835,7 +1835,8 @@ static void rna_def_mesh(BlenderRNA *brna) /* UV textures */ prop= RNA_def_property(srna, "uv_textures", PROP_COLLECTION, PROP_NONE); RNA_def_property_collection_sdna(prop, NULL, "fdata.layers", "fdata.totlayer"); - RNA_def_property_collection_funcs(prop, "rna_Mesh_uv_textures_begin", NULL, NULL, NULL, "rna_Mesh_uv_textures_length", NULL, NULL, NULL); + RNA_def_property_collection_funcs(prop, "rna_Mesh_uv_textures_begin", NULL, NULL, NULL, + "rna_Mesh_uv_textures_length", NULL, NULL, NULL); RNA_def_property_struct_type(prop, "MeshTextureFaceLayer"); RNA_def_property_ui_text(prop, "UV Textures", ""); rna_def_uv_textures(brna, prop); @@ -1865,26 +1866,30 @@ static void rna_def_mesh(BlenderRNA *brna) prop= RNA_def_property(srna, "vertex_colors", PROP_COLLECTION, PROP_NONE); RNA_def_property_collection_sdna(prop, NULL, "fdata.layers", "fdata.totlayer"); - RNA_def_property_collection_funcs(prop, "rna_Mesh_vertex_colors_begin", NULL, NULL, NULL, "rna_Mesh_vertex_colors_length", NULL, NULL, NULL); + RNA_def_property_collection_funcs(prop, "rna_Mesh_vertex_colors_begin", NULL, NULL, NULL, + "rna_Mesh_vertex_colors_length", NULL, NULL, NULL); RNA_def_property_struct_type(prop, "MeshColorLayer"); RNA_def_property_ui_text(prop, "Vertex Colors", ""); rna_def_vertex_colors(brna, prop); prop= RNA_def_property(srna, "layers_float", PROP_COLLECTION, PROP_NONE); RNA_def_property_collection_sdna(prop, NULL, "fdata.layers", "fdata.totlayer"); - RNA_def_property_collection_funcs(prop, "rna_Mesh_float_layers_begin", NULL, NULL, NULL, "rna_Mesh_float_layers_length", NULL, NULL, NULL); + RNA_def_property_collection_funcs(prop, "rna_Mesh_float_layers_begin", NULL, NULL, NULL, + "rna_Mesh_float_layers_length", NULL, NULL, NULL); RNA_def_property_struct_type(prop, "MeshFloatPropertyLayer"); RNA_def_property_ui_text(prop, "Float Property Layers", ""); prop= RNA_def_property(srna, "layers_int", PROP_COLLECTION, PROP_NONE); RNA_def_property_collection_sdna(prop, NULL, "fdata.layers", "fdata.totlayer"); - RNA_def_property_collection_funcs(prop, "rna_Mesh_int_layers_begin", NULL, NULL, NULL, "rna_Mesh_int_layers_length", NULL, NULL, NULL); + RNA_def_property_collection_funcs(prop, "rna_Mesh_int_layers_begin", NULL, NULL, NULL, + "rna_Mesh_int_layers_length", NULL, NULL, NULL); RNA_def_property_struct_type(prop, "MeshIntPropertyLayer"); RNA_def_property_ui_text(prop, "Int Property Layers", ""); prop= RNA_def_property(srna, "layers_string", PROP_COLLECTION, PROP_NONE); RNA_def_property_collection_sdna(prop, NULL, "fdata.layers", "fdata.totlayer"); - RNA_def_property_collection_funcs(prop, "rna_Mesh_string_layers_begin", NULL, NULL, NULL, "rna_Mesh_string_layers_length", NULL, NULL, NULL); + RNA_def_property_collection_funcs(prop, "rna_Mesh_string_layers_begin", NULL, NULL, NULL, + "rna_Mesh_string_layers_length", NULL, NULL, NULL); RNA_def_property_struct_type(prop, "MeshStringPropertyLayer"); RNA_def_property_ui_text(prop, "String Property Layers", ""); diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c index 7d20378d55e..0677b848fee 100644 --- a/source/blender/makesrna/intern/rna_nodetree.c +++ b/source/blender/makesrna/intern/rna_nodetree.c @@ -1403,19 +1403,19 @@ static void def_cmp_image(StructRNA *srna) prop = RNA_def_property(srna, "frame_duration", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "frames"); RNA_def_property_range(prop, 0, MAXFRAMEF); - RNA_def_property_ui_text(prop, "Frames", "Sets the number of images of a movie to use"); /* copied from the rna_image.c */ + RNA_def_property_ui_text(prop, "Frames", "Number of images of a movie to use"); /* copied from the rna_image.c */ RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); prop = RNA_def_property(srna, "frame_start", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "sfra"); RNA_def_property_range(prop, MINAFRAMEF, MAXFRAMEF); - RNA_def_property_ui_text(prop, "Start Frame", "Sets the global starting frame of the movie/sequence, assuming first picture has a #1"); /* copied from the rna_image.c */ + RNA_def_property_ui_text(prop, "Start Frame", "Global starting frame of the movie/sequence, assuming first picture has a #1"); /* copied from the rna_image.c */ RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); prop = RNA_def_property(srna, "frame_offset", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "offset"); RNA_def_property_range(prop, MINAFRAMEF, MAXFRAMEF); - RNA_def_property_ui_text(prop, "Offset", "Offsets the number of the frame to use in the animation"); /* copied from the rna_image.c */ + RNA_def_property_ui_text(prop, "Offset", "Offset the number of the frame to use in the animation"); /* copied from the rna_image.c */ RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); prop = RNA_def_property(srna, "use_cyclic", PROP_BOOLEAN, PROP_NONE); diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c index bbbec3bcf9a..e329df8470d 100644 --- a/source/blender/makesrna/intern/rna_object.c +++ b/source/blender/makesrna/intern/rna_object.c @@ -1397,7 +1397,7 @@ static void rna_def_object_game_settings(BlenderRNA *brna) prop= RNA_def_property(srna, "controllers", PROP_COLLECTION, PROP_NONE); RNA_def_property_struct_type(prop, "Controller"); RNA_def_property_ui_text(prop, "Controllers", - "Game engine controllers to process events, connecting sensor to actuators"); + "Game engine controllers to process events, connecting sensors to actuators"); prop= RNA_def_property(srna, "actuators", PROP_COLLECTION, PROP_NONE); RNA_def_property_struct_type(prop, "Actuator"); @@ -1426,7 +1426,7 @@ static void rna_def_object_game_settings(BlenderRNA *brna) RNA_def_property_enum_sdna(prop, NULL, "body_type"); RNA_def_property_enum_items(prop, body_type_items); RNA_def_property_enum_funcs(prop, "rna_GameObjectSettings_physics_type_get", "rna_GameObjectSettings_physics_type_set", NULL); - RNA_def_property_ui_text(prop, "Physics Type", "Selects the type of physical representation"); + RNA_def_property_ui_text(prop, "Physics Type", "Select the type of physical representation"); RNA_def_property_update(prop, NC_LOGIC, NULL); prop= RNA_def_property(srna, "use_actor", PROP_BOOLEAN, PROP_NONE); @@ -1488,20 +1488,20 @@ static void rna_def_object_game_settings(BlenderRNA *brna) /* lock rotation */ prop= RNA_def_property(srna, "lock_rotation_x", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "gameflag2", OB_LOCK_RIGID_BODY_X_ROT_AXIS); - RNA_def_property_ui_text(prop, "Lock X Rotation Axis", "Disable simulation of angular motion along the X axis"); + RNA_def_property_ui_text(prop, "Lock X Rotation Axis", "Disable simulation of angular motion along the X axis"); prop= RNA_def_property(srna, "lock_rotation_y", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "gameflag2", OB_LOCK_RIGID_BODY_Y_ROT_AXIS); - RNA_def_property_ui_text(prop, "Lock Y Rotation Axis", "Disable simulation of angular motion along the Y axis"); + RNA_def_property_ui_text(prop, "Lock Y Rotation Axis", "Disable simulation of angular motion along the Y axis"); prop= RNA_def_property(srna, "lock_rotation_z", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "gameflag2", OB_LOCK_RIGID_BODY_Z_ROT_AXIS); - RNA_def_property_ui_text(prop, "Lock Z Rotation Axis", "Disable simulation of angular motion along the Z axis"); + RNA_def_property_ui_text(prop, "Lock Z Rotation Axis", "Disable simulation of angular motion along the Z axis"); /* is this used anywhere ? */ prop= RNA_def_property(srna, "use_activity_culling", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_negative_sdna(prop, NULL, "gameflag2", OB_NEVER_DO_ACTIVITY_CULLING); - RNA_def_property_ui_text(prop, "Lock Z Rotation Axis", "Disable simulation of angular motion along the Z axis"); + RNA_def_property_ui_text(prop, "Lock Z Rotation Axis", "Disable simulation of angular motion along the Z axis"); prop= RNA_def_property(srna, "use_material_physics_fh", PROP_BOOLEAN, PROP_NONE); @@ -1526,7 +1526,7 @@ static void rna_def_object_game_settings(BlenderRNA *brna) RNA_def_property_float_sdna(prop, NULL, "anisotropicFriction"); RNA_def_property_range(prop, 0.0, 1.0); RNA_def_property_ui_text(prop, "Friction Coefficients", - "Relative friction coefficient in the in the X, Y and Z directions, " + "Relative friction coefficients in the in the X, Y and Z directions, " "when anisotropic friction is enabled"); prop= RNA_def_property(srna, "use_collision_bounds", PROP_BOOLEAN, PROP_NONE); @@ -1537,7 +1537,7 @@ static void rna_def_object_game_settings(BlenderRNA *brna) RNA_def_property_enum_sdna(prop, NULL, "boundtype"); RNA_def_property_enum_items(prop, collision_bounds_items); RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_Object_collision_bounds_itemf"); - RNA_def_property_ui_text(prop, "Collision Bounds", "Selects the collision type"); + RNA_def_property_ui_text(prop, "Collision Bounds", "Select the collision type"); RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL); prop= RNA_def_property(srna, "use_collision_compound", PROP_BOOLEAN, PROP_NONE); diff --git a/source/blender/makesrna/intern/rna_object_force.c b/source/blender/makesrna/intern/rna_object_force.c index 8db1faee04d..597f8730e72 100644 --- a/source/blender/makesrna/intern/rna_object_force.c +++ b/source/blender/makesrna/intern/rna_object_force.c @@ -679,7 +679,8 @@ static void rna_softbody_update(Main *UNUSED(bmain), Scene *UNUSED(scene), Point } -static EnumPropertyItem *rna_Effector_shape_itemf(bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), int *UNUSED(free)) +static EnumPropertyItem *rna_Effector_shape_itemf(bContext *UNUSED(C), PointerRNA *ptr, + PropertyRNA *UNUSED(prop), int *UNUSED(free)) { Object *ob= NULL; @@ -725,7 +726,8 @@ static void rna_def_ptcache_point_caches(BlenderRNA *brna, PropertyRNA *cprop) RNA_def_struct_ui_text(srna, "Point Caches", "Collection of point caches"); prop= RNA_def_property(srna, "active_index", PROP_INT, PROP_UNSIGNED); - RNA_def_property_int_funcs(prop, "rna_Cache_active_point_cache_index_get", "rna_Cache_active_point_cache_index_set", "rna_Cache_active_point_cache_index_range"); + RNA_def_property_int_funcs(prop, "rna_Cache_active_point_cache_index_get", "rna_Cache_active_point_cache_index_set", + "rna_Cache_active_point_cache_index_range"); RNA_def_property_ui_text(prop, "Active Point Cache Index", ""); RNA_def_property_update(prop, NC_OBJECT, "rna_Cache_change"); } @@ -827,7 +829,8 @@ static void rna_def_pointcache(BlenderRNA *brna) RNA_def_property_update(prop, NC_OBJECT, "rna_Cache_idname_change"); prop= RNA_def_property(srna, "point_caches", PROP_COLLECTION, PROP_NONE); - RNA_def_property_collection_funcs(prop, "rna_Cache_list_begin", "rna_iterator_listbase_next", "rna_iterator_listbase_end", "rna_iterator_listbase_get", NULL, NULL, NULL, NULL); + RNA_def_property_collection_funcs(prop, "rna_Cache_list_begin", "rna_iterator_listbase_next", + "rna_iterator_listbase_end", "rna_iterator_listbase_get", NULL, NULL, NULL, NULL); RNA_def_property_struct_type(prop, "PointCache"); RNA_def_property_ui_text(prop, "Point Cache List", "Point cache list"); rna_def_ptcache_point_caches(brna, prop); @@ -914,7 +917,8 @@ static void rna_def_collision(BlenderRNA *brna) prop= RNA_def_property(srna, "absorption", PROP_FLOAT, PROP_FACTOR); RNA_def_property_range(prop, 0.0f, 1.0f); RNA_def_property_ui_range(prop, 0.0f, 1.0f, 1, 2); - RNA_def_property_ui_text(prop, "Absorption", "How much of effector force gets lost during collision with this object (in percent)"); + RNA_def_property_ui_text(prop, "Absorption", + "How much of effector force gets lost during collision with this object (in percent)"); RNA_def_property_update(prop, 0, "rna_CollisionSettings_update"); } @@ -1128,7 +1132,9 @@ static void rna_def_field(BlenderRNA *brna) prop= RNA_def_property(srna, "texture_mode", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "tex_mode"); RNA_def_property_enum_items(prop, texture_items); - RNA_def_property_ui_text(prop, "Texture Mode", "How the texture effect is calculated (RGB & Curl need a RGB texture else Gradient will be used instead)"); + RNA_def_property_ui_text(prop, "Texture Mode", + "How the texture effect is calculated (RGB & Curl need a RGB texture, " + "else Gradient will be used instead)"); RNA_def_property_update(prop, 0, "rna_FieldSettings_update"); prop= RNA_def_property(srna, "z_direction", PROP_ENUM, PROP_NONE); @@ -1423,7 +1429,10 @@ static void rna_def_game_softbody(BlenderRNA *brna) prop= RNA_def_property(srna, "weld_threshold", PROP_FLOAT, PROP_DISTANCE); RNA_def_property_float_sdna(prop, NULL, "welding"); RNA_def_property_range(prop, 0.0f, 0.01f); - RNA_def_property_ui_text(prop, "Welding", "Welding threshold: distance between nearby vertices to be considered equal => set to 0.0 to disable welding test and speed up scene loading (ok if the mesh has no duplicates)"); + RNA_def_property_ui_text(prop, "Welding", + "Welding threshold: distance between nearby vertices to be considered equal " + "=> set to 0.0 to disable welding test and speed up scene loading " + "(ok if the mesh has no duplicates)"); /* Integers */ @@ -1435,7 +1444,7 @@ static void rna_def_game_softbody(BlenderRNA *brna) prop= RNA_def_property(srna, "cluster_iterations", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "numclusteriterations"); RNA_def_property_range(prop, 1, 128); - RNA_def_property_ui_text(prop, "Cluster Iterations", "Specify the number of cluster iterations"); + RNA_def_property_ui_text(prop, "Cluster Iterations", "Number of cluster iterations"); /* Booleans */ @@ -1519,7 +1528,8 @@ static void rna_def_softbody(BlenderRNA *brna) prop= RNA_def_property(srna, "vertex_group_goal", PROP_STRING, PROP_NONE); RNA_def_property_string_sdna(prop, NULL, "vertgroup"); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); /* not impossible .. but not supported yet */ - RNA_def_property_string_funcs(prop, "rna_SoftBodySettings_goal_vgroup_get", "rna_SoftBodySettings_goal_vgroup_length", "rna_SoftBodySettings_goal_vgroup_set"); + RNA_def_property_string_funcs(prop, "rna_SoftBodySettings_goal_vgroup_get", "rna_SoftBodySettings_goal_vgroup_length", + "rna_SoftBodySettings_goal_vgroup_set"); RNA_def_property_ui_text(prop, "Goal Vertex Group", "Control point weight values"); prop= RNA_def_property(srna, "goal_min", PROP_FLOAT, PROP_NONE); @@ -1641,7 +1651,8 @@ static void rna_def_softbody(BlenderRNA *brna) prop= RNA_def_property(srna, "error_threshold", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "rklimit"); RNA_def_property_range(prop, 0.001f, 10.0f); - RNA_def_property_ui_text(prop, "Error Limit", "The Runge-Kutta ODE solver error limit, low value gives more precision, high values speed"); + RNA_def_property_ui_text(prop, "Error Limit", + "The Runge-Kutta ODE solver error limit, low value gives more precision, high values speed"); RNA_def_property_update(prop, 0, "rna_softbody_update"); prop= RNA_def_property(srna, "step_min", PROP_INT, PROP_NONE); @@ -1665,7 +1676,8 @@ static void rna_def_softbody(BlenderRNA *brna) prop= RNA_def_property(srna, "fuzzy", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "fuzzyness"); RNA_def_property_range(prop, 1, 100); - RNA_def_property_ui_text(prop, "Fuzzy", "Fuzziness while on collision, high values make collision handling faster but less stable"); + RNA_def_property_ui_text(prop, "Fuzzy", + "Fuzziness while on collision, high values make collision handling faster but less stable"); RNA_def_property_update(prop, 0, "rna_softbody_update"); prop= RNA_def_property(srna, "use_auto_step", PROP_BOOLEAN, PROP_NONE); diff --git a/source/blender/makesrna/intern/rna_pose.c b/source/blender/makesrna/intern/rna_pose.c index e3a3f93b5f3..d224bd0d4e5 100644 --- a/source/blender/makesrna/intern/rna_pose.c +++ b/source/blender/makesrna/intern/rna_pose.c @@ -48,13 +48,14 @@ // XXX: this RNA enum define is currently duplicated for objects, since there is some text here which is not applicable EnumPropertyItem posebone_rotmode_items[] = { {ROT_MODE_QUAT, "QUATERNION", 0, "Quaternion (WXYZ)", "No Gimbal Lock (default)"}, - {ROT_MODE_XYZ, "XYZ", 0, "XYZ Euler", "XYZ Rotation Order. Prone to Gimbal Lock"}, - {ROT_MODE_XZY, "XZY", 0, "XZY Euler", "XZY Rotation Order. Prone to Gimbal Lock"}, - {ROT_MODE_YXZ, "YXZ", 0, "YXZ Euler", "YXZ Rotation Order. Prone to Gimbal Lock"}, - {ROT_MODE_YZX, "YZX", 0, "YZX Euler", "YZX Rotation Order. Prone to Gimbal Lock"}, - {ROT_MODE_ZXY, "ZXY", 0, "ZXY Euler", "ZXY Rotation Order. Prone to Gimbal Lock"}, - {ROT_MODE_ZYX, "ZYX", 0, "ZYX Euler", "ZYX Rotation Order. Prone to Gimbal Lock"}, - {ROT_MODE_AXISANGLE, "AXIS_ANGLE", 0, "Axis Angle", "Axis Angle (W+XYZ). Defines a rotation around some axis defined by 3D-Vector"}, + {ROT_MODE_XYZ, "XYZ", 0, "XYZ Euler", "XYZ Rotation Order (prone to Gimbal Lock)"}, + {ROT_MODE_XZY, "XZY", 0, "XZY Euler", "XZY Rotation Order (prone to Gimbal Lock)"}, + {ROT_MODE_YXZ, "YXZ", 0, "YXZ Euler", "YXZ Rotation Order (prone to Gimbal Lock)"}, + {ROT_MODE_YZX, "YZX", 0, "YZX Euler", "YZX Rotation Order (prone to Gimbal Lock)"}, + {ROT_MODE_ZXY, "ZXY", 0, "ZXY Euler", "ZXY Rotation Order (prone to Gimbal Lock)"}, + {ROT_MODE_ZYX, "ZYX", 0, "ZYX Euler", "ZYX Rotation Order (prone to Gimbal Lock)"}, + {ROT_MODE_AXISANGLE, "AXIS_ANGLE", 0, "Axis Angle", + "Axis Angle (W+XYZ), defines a rotation around some axis defined by 3D-Vector"}, {0, NULL, 0, NULL, NULL}}; #ifdef RNA_RUNTIME @@ -717,7 +718,8 @@ static void rna_def_pose_channel_constraints(BlenderRNA *brna, PropertyRNA *cpro /* Collection active property */ prop= RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE); RNA_def_property_struct_type(prop, "Constraint"); - RNA_def_property_pointer_funcs(prop, "rna_PoseChannel_active_constraint_get", "rna_PoseChannel_active_constraint_set", NULL, NULL); + RNA_def_property_pointer_funcs(prop, "rna_PoseChannel_active_constraint_get", + "rna_PoseChannel_active_constraint_set", NULL, NULL); RNA_def_property_flag(prop, PROP_EDITABLE); RNA_def_property_ui_text(prop, "Active Constraint", "Active PoseChannel constraint"); @@ -820,7 +822,8 @@ static void rna_def_pose_channel(BlenderRNA *brna) */ prop= RNA_def_property(srna, "rotation_axis_angle", PROP_FLOAT, PROP_AXISANGLE); RNA_def_property_array(prop, 4); - RNA_def_property_float_funcs(prop, "rna_PoseChannel_rotation_axis_angle_get", "rna_PoseChannel_rotation_axis_angle_set", NULL); + RNA_def_property_float_funcs(prop, "rna_PoseChannel_rotation_axis_angle_get", + "rna_PoseChannel_rotation_axis_angle_set", NULL); RNA_def_property_editable_array_func(prop, "rna_PoseChannel_rotation_4d_editable"); RNA_def_property_float_array_default(prop, default_axisAngle); RNA_def_property_ui_text(prop, "Axis-Angle Rotation", "Angle of Rotation for Axis-Angle rotation representation"); @@ -853,7 +856,7 @@ static void rna_def_pose_channel(BlenderRNA *brna) prop= RNA_def_property(srna, "matrix_basis", PROP_FLOAT, PROP_MATRIX); RNA_def_property_multi_array(prop, 2, matrix_dimsize); RNA_def_property_ui_text(prop, "Basis Matrix", - "Provides an alternative access to loc/scale/rotation relative to the parent and own rest bone"); + "Alternative access to location/scale/rotation relative to the parent and own rest bone"); RNA_def_property_float_funcs(prop, "rna_PoseChannel_matrix_basis_get", "rna_PoseChannel_matrix_basis_set", NULL); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Pose_update"); @@ -1039,7 +1042,8 @@ static void rna_def_pose_channel(BlenderRNA *brna) RNA_def_property_int_sdna(prop, NULL, "agrp_index"); RNA_def_property_flag(prop, PROP_EDITABLE); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); - RNA_def_property_int_funcs(prop, "rna_PoseChannel_bone_group_index_get", "rna_PoseChannel_bone_group_index_set", "rna_PoseChannel_bone_group_index_range"); + RNA_def_property_int_funcs(prop, "rna_PoseChannel_bone_group_index_get", "rna_PoseChannel_bone_group_index_set", + "rna_PoseChannel_bone_group_index_range"); RNA_def_property_ui_text(prop, "Bone Group Index", "Bone Group this pose channel belongs to (0=no group)"); RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable"); RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Pose_update"); @@ -1072,7 +1076,8 @@ static void rna_def_pose_channel(BlenderRNA *brna) // XXX this is sub-optimal - it really should be included above, but due to technical reasons we can't do this! prop= RNA_def_property(srna, "lock_rotation_w", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "protectflag", OB_LOCK_ROTW); - RNA_def_property_ui_text(prop, "Lock Rotation (4D Angle)", "Lock editing of 'angle' component of four-component rotations in the interface"); + RNA_def_property_ui_text(prop, "Lock Rotation (4D Angle)", + "Lock editing of 'angle' component of four-component rotations in the interface"); RNA_def_property_ui_icon(prop, ICON_UNLOCKED, 1); RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable"); RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Pose_update"); @@ -1080,7 +1085,8 @@ static void rna_def_pose_channel(BlenderRNA *brna) // XXX this needs a better name prop= RNA_def_property(srna, "lock_rotations_4d", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "protectflag", OB_LOCK_ROT4D); - RNA_def_property_ui_text(prop, "Lock Rotations (4D)", "Lock editing of four component rotations by components (instead of as Eulers)"); + RNA_def_property_ui_text(prop, "Lock Rotations (4D)", + "Lock editing of four component rotations by components (instead of as Eulers)"); RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable"); RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Pose_update"); @@ -1098,13 +1104,17 @@ static void rna_def_pose_channel(BlenderRNA *brna) static void rna_def_pose_itasc(BlenderRNA *brna) { static const EnumPropertyItem prop_itasc_mode_items[]= { - {0, "ANIMATION", 0, "Animation", "Stateless solver computing pose starting from current action and non-IK constraints"}, - {ITASC_SIMULATION, "SIMULATION", 0, "Simulation", "Statefull solver running in real-time context and ignoring actions and non-IK constraints"}, + {0, "ANIMATION", 0, "Animation", + "Stateless solver computing pose starting from current action and non-IK constraints"}, + {ITASC_SIMULATION, "SIMULATION", 0, "Simulation", + "Statefull solver running in real-time context and ignoring actions and non-IK constraints"}, {0, NULL, 0, NULL, NULL}}; static const EnumPropertyItem prop_itasc_reiteration_items[]= { {0, "NEVER", 0, "Never", "The solver does not reiterate, not even on first frame (starts from rest pose)"}, - {ITASC_INITIAL_REITERATION, "INITIAL", 0, "Initial", "The solver reiterates (converges) on the first frame but not on subsequent frame"}, - {ITASC_INITIAL_REITERATION|ITASC_REITERATION, "ALWAYS", 0, "Always", "The solver reiterates (converges) on all frames"}, + {ITASC_INITIAL_REITERATION, "INITIAL", 0, "Initial", + "The solver reiterates (converges) on the first frame but not on subsequent frame"}, + {ITASC_INITIAL_REITERATION|ITASC_REITERATION, "ALWAYS", 0, "Always", + "The solver reiterates (converges) on all frames"}, {0, NULL, 0, NULL, NULL}}; StructRNA *srna; @@ -1141,12 +1151,15 @@ static void rna_def_pose_itasc(BlenderRNA *brna) prop= RNA_def_property(srna, "reiteration_method", PROP_ENUM, PROP_NONE); RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag"); RNA_def_property_enum_items(prop, prop_itasc_reiteration_items); - RNA_def_property_ui_text(prop, "Reiteration", "Defines if the solver is allowed to reiterate (converges until precision is met) on none, first or all frames"); + RNA_def_property_ui_text(prop, "Reiteration", + "Defines if the solver is allowed to reiterate (converges until " + "precision is met) on none, first or all frames"); RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Itasc_update"); prop= RNA_def_property(srna, "use_auto_step", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", ITASC_AUTO_STEP); - RNA_def_property_ui_text(prop, "Auto step", "Automatically determine the optimal number of steps for best performance/accuracy trade off"); + RNA_def_property_ui_text(prop, "Auto step", + "Automatically determine the optimal number of steps for best performance/accuracy trade off"); RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Itasc_update"); prop= RNA_def_property(srna, "step_min", PROP_FLOAT, PROP_NONE); @@ -1164,7 +1177,8 @@ static void rna_def_pose_itasc(BlenderRNA *brna) prop= RNA_def_property(srna, "feedback", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "feedback"); RNA_def_property_range(prop, 0.0f,100.0f); - RNA_def_property_ui_text(prop, "Feedback", "Feedback coefficient for error correction. Average response time=1/feedback. Default=20"); + RNA_def_property_ui_text(prop, "Feedback", + "Feedback coefficient for error correction. Average response time=1/feedback. Default=20"); RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Itasc_update"); prop= RNA_def_property(srna, "velocity_max", PROP_FLOAT, PROP_NONE); @@ -1182,13 +1196,17 @@ static void rna_def_pose_itasc(BlenderRNA *brna) prop= RNA_def_property(srna, "damping_max", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "dampmax"); RNA_def_property_range(prop, 0.0f,1.0f); - RNA_def_property_ui_text(prop, "Damp", "Maximum damping coefficient when singular value is nearly 0. Higher values=more stability, less reactivity. Default=0.5"); + RNA_def_property_ui_text(prop, "Damp", + "Maximum damping coefficient when singular value is nearly 0 " + "(higher values=more stability, less reactivity - default=0.5)"); RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Itasc_update"); prop= RNA_def_property(srna, "damping_epsilon", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "dampeps"); RNA_def_property_range(prop, 0.0f,1.0f); - RNA_def_property_ui_text(prop, "Epsilon", "Singular value under which damping is progressively applied. Higher values=more stability, less reactivity. Default=0.1"); + RNA_def_property_ui_text(prop, "Epsilon", + "Singular value under which damping is progressively applied " + "(higher values=more stability, less reactivity - default=0.1)"); RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Itasc_update"); } @@ -1232,7 +1250,8 @@ static void rna_def_bone_groups(BlenderRNA *brna, PropertyRNA *cprop) prop= RNA_def_property(srna, "active_index", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "active_group"); - RNA_def_property_int_funcs(prop, "rna_Pose_active_bone_group_index_get", "rna_Pose_active_bone_group_index_set", "rna_Pose_active_bone_group_index_range"); + RNA_def_property_int_funcs(prop, "rna_Pose_active_bone_group_index_get", "rna_Pose_active_bone_group_index_set", + "rna_Pose_active_bone_group_index_range"); RNA_def_property_ui_text(prop, "Active Bone Group Index", "Active index in bone groups array"); RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Pose_update"); } @@ -1265,7 +1284,8 @@ static void rna_def_pose(BlenderRNA *brna) RNA_def_property_enum_sdna(prop, NULL, "iksolver"); RNA_def_property_enum_funcs(prop, NULL, "rna_Pose_ik_solver_set", NULL); RNA_def_property_enum_items(prop, prop_iksolver_items); - RNA_def_property_ui_text(prop, "IK Solver", "Selection of IK solver for IK chain, current choice is 0 for Legacy, 1 for iTaSC"); + RNA_def_property_ui_text(prop, "IK Solver", + "Selection of IK solver for IK chain, current choice is 0 for Legacy, 1 for iTaSC"); RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Pose_ik_solver_update"); prop= RNA_def_property(srna, "ik_param", PROP_POINTER, PROP_NONE); diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index 09824616936..70ff5682717 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -1755,13 +1755,13 @@ static void rna_def_scene_game_recast_data(BlenderRNA *brna) prop= RNA_def_property(srna, "region_min_size", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "regionminsize"); RNA_def_property_ui_range(prop, 0, 150, 1, 2); - RNA_def_property_ui_text(prop, "Min Region Size", "Minimum regions size. Smaller regions will be deleted"); + RNA_def_property_ui_text(prop, "Min Region Size", "Minimum regions size (smaller regions will be deleted)"); RNA_def_property_update(prop, NC_SCENE, NULL); prop= RNA_def_property(srna, "region_merge_size", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "regionmergesize"); RNA_def_property_ui_range(prop, 0, 150, 1, 2); - RNA_def_property_ui_text(prop, "Merged Region Size", "Minimum regions size. Smaller regions will be merged"); + RNA_def_property_ui_text(prop, "Merged Region Size", "Minimum regions size (smaller regions will be merged)"); RNA_def_property_update(prop, NC_SCENE, NULL); prop= RNA_def_property(srna, "edge_max_len", PROP_FLOAT, PROP_NONE); @@ -1977,7 +1977,7 @@ static void rna_def_scene_game_data(BlenderRNA *brna) RNA_def_property_int_sdna(prop, NULL, "occlusionRes"); RNA_def_property_range(prop, 128.0, 1024.0); RNA_def_property_ui_text(prop, "Occlusion Resolution", - "The size of the occlusion buffer in pixel, use higher value for better precision (slower)"); + "Size of the occlusion buffer in pixel, use higher value for better precision (slower)"); RNA_def_property_update(prop, NC_SCENE, NULL); prop= RNA_def_property(srna, "fps", PROP_INT, PROP_NONE); @@ -1985,7 +1985,7 @@ static void rna_def_scene_game_data(BlenderRNA *brna) RNA_def_property_ui_range(prop, 1, 60, 1, 1); RNA_def_property_range(prop, 1, 250); RNA_def_property_ui_text(prop, "Frames Per Second", - "The nominal number of game frames per second " + "Nominal number of game frames per second " "(physics fixed timestep = 1/fps, independently of actual frame rate)"); RNA_def_property_update(prop, NC_SCENE, NULL); @@ -1994,7 +1994,7 @@ static void rna_def_scene_game_data(BlenderRNA *brna) RNA_def_property_ui_range(prop, 1, 5, 1, 1); RNA_def_property_range(prop, 1, 5); RNA_def_property_ui_text(prop, "Max Logic Steps", - "Sets the maximum number of logic frame per game frame if graphics slows down the game, " + "Maximum number of logic frame per game frame if graphics slows down the game, " "higher value allows better synchronization with physics"); RNA_def_property_update(prop, NC_SCENE, NULL); @@ -2003,7 +2003,7 @@ static void rna_def_scene_game_data(BlenderRNA *brna) RNA_def_property_ui_range(prop, 1, 5, 1, 1); RNA_def_property_range(prop, 1, 5); RNA_def_property_ui_text(prop, "Max Physics Steps", - "Sets the maximum number of physics step per game frame if graphics slows down the game, " + "Maximum number of physics step per game frame if graphics slows down the game, " "higher value allows physics to keep up with realtime"); RNA_def_property_update(prop, NC_SCENE, NULL); @@ -2012,7 +2012,7 @@ static void rna_def_scene_game_data(BlenderRNA *brna) RNA_def_property_ui_range(prop, 1, 5, 1, 1); RNA_def_property_range(prop, 1, 5); RNA_def_property_ui_text(prop, "Physics Sub Steps", - "Sets the number of simulation substep per physic timestep, " + "Number of simulation substep per physic timestep, " "higher value give better physics precision"); RNA_def_property_update(prop, NC_SCENE, NULL); @@ -2066,7 +2066,7 @@ static void rna_def_scene_game_data(BlenderRNA *brna) prop= RNA_def_property(srna, "use_animation_record", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", GAME_ENABLE_ANIMATION_RECORD); - RNA_def_property_ui_text(prop, "Record Animation", "Record animation to fcurves"); + RNA_def_property_ui_text(prop, "Record Animation", "Record animation to F-Curves"); prop= RNA_def_property(srna, "use_auto_start", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_funcs(prop, "rna_GameSettings_auto_start_get", "rna_GameSettings_auto_start_set"); @@ -2075,8 +2075,8 @@ static void rna_def_scene_game_data(BlenderRNA *brna) prop= RNA_def_property(srna, "restrict_animation_updates", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", GAME_RESTRICT_ANIM_UPDATES); RNA_def_property_ui_text(prop, "Restrict Animation Updates", - "Restrict the number of animation updates to the animation FPS. This is " - "better for performance, but can cause issues with smooth playback"); + "Restrict the number of animation updates to the animation FPS (this is " + "better for performance, but can cause issues with smooth playback)"); /* materials */ prop= RNA_def_property(srna, "material_mode", PROP_ENUM, PROP_NONE); diff --git a/source/blender/makesrna/intern/rna_sculpt_paint.c b/source/blender/makesrna/intern/rna_sculpt_paint.c index 28b96f3b08b..d169ee5079b 100644 --- a/source/blender/makesrna/intern/rna_sculpt_paint.c +++ b/source/blender/makesrna/intern/rna_sculpt_paint.c @@ -127,7 +127,8 @@ static void rna_ParticleEdit_tool_set(PointerRNA *ptr, int value) pset->brushtype = value; } -static EnumPropertyItem *rna_ParticleEdit_tool_itemf(bContext *C, PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), int *UNUSED(free)) +static EnumPropertyItem *rna_ParticleEdit_tool_itemf(bContext *C, PointerRNA *UNUSED(ptr), + PropertyRNA *UNUSED(prop), int *UNUSED(free)) { Scene *scene= CTX_data_scene(C); Object *ob= (scene->basact)? scene->basact->object: NULL; @@ -275,7 +276,8 @@ static void rna_def_sculpt(BlenderRNA *brna) prop= RNA_def_property(srna, "use_symmetry_feather", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flags", SCULPT_SYMMETRY_FEATHER); - RNA_def_property_ui_text(prop, "Symmetry Feathering", "Reduce the strength of the brush where it overlaps symmetrical daubs"); + RNA_def_property_ui_text(prop, "Symmetry Feathering", + "Reduce the strength of the brush where it overlaps symmetrical daubs"); prop= RNA_def_property(srna, "use_threaded", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flags", SCULPT_USE_OPENMP); @@ -283,7 +285,9 @@ static void rna_def_sculpt(BlenderRNA *brna) prop= RNA_def_property(srna, "use_deform_only", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flags", SCULPT_ONLY_DEFORM); - RNA_def_property_ui_text(prop, "Use Deform Only", "Use only deformation modifiers (temporary disable all constructive modifiers except multi-resolution)"); + RNA_def_property_ui_text(prop, "Use Deform Only", + "Use only deformation modifiers (temporary disable all " + "constructive modifiers except multi-resolution)"); RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Sculpt_update"); } @@ -345,7 +349,8 @@ static void rna_def_image_paint(BlenderRNA *brna) prop= RNA_def_property(srna, "use_clone_layer", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", IMAGEPAINT_PROJECT_LAYER_CLONE); - RNA_def_property_ui_text(prop, "Clone Layer", "Use another UV layer as clone source, otherwise use 3D the cursor as the source"); + RNA_def_property_ui_text(prop, "Clone Layer", + "Use another UV layer as clone source, otherwise use 3D the cursor as the source"); /* integers */ @@ -357,7 +362,8 @@ static void rna_def_image_paint(BlenderRNA *brna) RNA_def_property_range(prop, 0, 90); RNA_def_property_ui_text(prop, "Angle", "Paint most on faces pointing towards the view according to this angle"); - prop= RNA_def_int_array(srna, "screen_grab_size", 2, NULL, 0, 0, "screen_grab_size", "Size to capture the image for re-projecting", 0, 0); + prop= RNA_def_int_array(srna, "screen_grab_size", 2, NULL, 0, 0, "screen_grab_size", + "Size to capture the image for re-projecting", 0, 0); RNA_def_property_range(prop, 512, 16384); } @@ -518,7 +524,8 @@ static void rna_def_particle_edit(BlenderRNA *brna) prop= RNA_def_property(srna, "use_puff_volume", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", PE_BRUSH_DATA_PUFF_VOLUME); - RNA_def_property_ui_text(prop, "Puff Volume", "Apply puff to unselected end-points, (helps maintain hair volume when puffing root)"); + RNA_def_property_ui_text(prop, "Puff Volume", + "Apply puff to unselected end-points (helps maintain hair volume when puffing root)"); prop= RNA_def_property(srna, "length_mode", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "invert"); diff --git a/source/blender/makesrna/intern/rna_sequencer.c b/source/blender/makesrna/intern/rna_sequencer.c index b90f10693ac..9d72eeacf3e 100644 --- a/source/blender/makesrna/intern/rna_sequencer.c +++ b/source/blender/makesrna/intern/rna_sequencer.c @@ -1190,7 +1190,7 @@ static void rna_def_editor(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Overlay Offset", ""); RNA_def_property_int_funcs(prop, "rna_SequenceEditor_overlay_frame_get", "rna_SequenceEditor_overlay_frame_set", NULL); RNA_def_property_update(prop, NC_SPACE|ND_SPACE_SEQUENCER, NULL); - RNA_def_property_ui_text(prop, "Active Strip", "Sequencers active strip"); + RNA_def_property_ui_text(prop, "Active Strip", "Sequencer's active strip"); } static void rna_def_filter_video(StructRNA *srna) diff --git a/source/blender/makesrna/intern/rna_smoke.c b/source/blender/makesrna/intern/rna_smoke.c index 217d68860f2..44bdeba3e2e 100644 --- a/source/blender/makesrna/intern/rna_smoke.c +++ b/source/blender/makesrna/intern/rna_smoke.c @@ -177,14 +177,14 @@ static void rna_def_smoke_domain_settings(BlenderRNA *brna) RNA_def_property_float_sdna(prop, NULL, "alpha"); RNA_def_property_range(prop, -5.0, 5.0); RNA_def_property_ui_range(prop, -5.0, 5.0, 0.02, 5); - RNA_def_property_ui_text(prop, "Density", "How much density effects smoke motion, higher value results in faster rising smoke"); + RNA_def_property_ui_text(prop, "Density", "How much density affects smoke motion (higher value results in faster rising smoke)"); RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Smoke_reset"); prop= RNA_def_property(srna, "beta", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "beta"); RNA_def_property_range(prop, -5.0, 5.0); RNA_def_property_ui_range(prop, -5.0, 5.0, 0.02, 5); - RNA_def_property_ui_text(prop, "Heat", "How much heat effects smoke motion, higher value results in faster rising smoke"); + RNA_def_property_ui_text(prop, "Heat", "How much heat affects smoke motion (higher value results in faster rising smoke)"); RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Smoke_reset"); prop= RNA_def_property(srna, "collision_group", PROP_POINTER, PROP_NONE); @@ -245,7 +245,7 @@ static void rna_def_smoke_domain_settings(BlenderRNA *brna) prop= RNA_def_property(srna, "collision_extents", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "border_collisions"); RNA_def_property_enum_items(prop, smoke_domain_colli_items); - RNA_def_property_ui_text(prop, "Border Collisions", "Selects which domain border will be treated as collision object"); + RNA_def_property_ui_text(prop, "Border Collisions", "Select which domain border will be treated as collision object"); RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Smoke_reset"); prop= RNA_def_property(srna, "effector_weights", PROP_POINTER, PROP_NONE); @@ -313,7 +313,7 @@ static void rna_def_smoke_flow_settings(BlenderRNA *brna) prop= RNA_def_property(srna, "initial_velocity", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_SMOKE_FLOW_INITVELOCITY); - RNA_def_property_ui_text(prop, "Initial Velocity", "Smoke inherits it's velocity from the emitter particle"); + RNA_def_property_ui_text(prop, "Initial Velocity", "Smoke inherits its velocity from the emitter particle"); prop= RNA_def_property(srna, "velocity_factor", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "vel_multi"); diff --git a/source/blender/makesrna/intern/rna_texture.c b/source/blender/makesrna/intern/rna_texture.c index 03f0a4ba363..1babf5e61a1 100644 --- a/source/blender/makesrna/intern/rna_texture.c +++ b/source/blender/makesrna/intern/rna_texture.c @@ -698,7 +698,7 @@ static EnumPropertyItem prop_noise_basis_items[] = { {TEX_VORONOI_CRACKLE, "VORONOI_CRACKLE", 0, "Voronoi Crackle", "Noise algorithm - Voronoi Crackle: Voronoi tessellation with sharp edges"}, {TEX_CELLNOISE, "CELL_NOISE", 0, "Cell Noise", - "Noise algorithm - Cell Noise: Square cell tessallation"}, + "Noise algorithm - Cell Noise: Square cell tessellation"}, {0, NULL, 0, NULL, NULL}}; static EnumPropertyItem prop_noise_type[] = { @@ -1525,13 +1525,13 @@ static void rna_def_texture_pointdensity(BlenderRNA *brna) prop= RNA_def_property(srna, "particle_cache_space", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "psys_cache_space"); RNA_def_property_enum_items(prop, particle_cache_items); - RNA_def_property_ui_text(prop, "Particle Cache", "Co-ordinate system to cache particles in"); + RNA_def_property_ui_text(prop, "Particle Cache", "Coordinate system to cache particles in"); RNA_def_property_update(prop, 0, "rna_Texture_update"); prop= RNA_def_property(srna, "vertex_cache_space", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "ob_cache_space"); RNA_def_property_enum_items(prop, vertice_cache_items); - RNA_def_property_ui_text(prop, "Vertices Cache", "Co-ordinate system to cache vertices in"); + RNA_def_property_ui_text(prop, "Vertices Cache", "Coordinate system to cache vertices in"); RNA_def_property_update(prop, 0, "rna_Texture_update"); prop= RNA_def_property(srna, "radius", PROP_FLOAT, PROP_NONE); @@ -1657,9 +1657,9 @@ static void rna_def_texture_voxeldata(BlenderRNA *brna) {0, NULL, 0, NULL, NULL}}; static EnumPropertyItem voxeldata_extension[] = { - {TEX_EXTEND, "EXTEND", 0, "Extend", "Extends by repeating edge pixels of the image"}, - {TEX_CLIP, "CLIP", 0, "Clip", "Clips to image size and sets exterior pixels as transparent"}, - {TEX_REPEAT, "REPEAT", 0, "Repeat", "Causes the image to repeat horizontally and vertically"}, + {TEX_EXTEND, "EXTEND", 0, "Extend", "Extend by repeating edge pixels of the image"}, + {TEX_CLIP, "CLIP", 0, "Clip", "Clip to image size and set exterior pixels as transparent"}, + {TEX_REPEAT, "REPEAT", 0, "Repeat", "Cause the image to repeat horizontally and vertically"}, {0, NULL, 0, NULL, NULL}}; static EnumPropertyItem smoked_type_items[] = { diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c index 9202647981b..0c3ff108c03 100644 --- a/source/blender/makesrna/intern/rna_userdef.c +++ b/source/blender/makesrna/intern/rna_userdef.c @@ -813,25 +813,25 @@ static void rna_def_userdef_theme_spaces_curves(StructRNA *srna, short incl_nurb prop= RNA_def_property(srna, "nurb_uline", PROP_FLOAT, PROP_COLOR_GAMMA); RNA_def_property_float_sdna(prop, NULL, "nurb_uline"); RNA_def_property_array(prop, 3); - RNA_def_property_ui_text(prop, "Nurb U-lines", ""); + RNA_def_property_ui_text(prop, "NURBS U-lines", ""); RNA_def_property_update(prop, 0, "rna_userdef_update"); prop= RNA_def_property(srna, "nurb_vline", PROP_FLOAT, PROP_COLOR_GAMMA); RNA_def_property_float_sdna(prop, NULL, "nurb_vline"); RNA_def_property_array(prop, 3); - RNA_def_property_ui_text(prop, "Nurb V-lines", ""); + RNA_def_property_ui_text(prop, "NURBS V-lines", ""); RNA_def_property_update(prop, 0, "rna_userdef_update"); prop= RNA_def_property(srna, "nurb_sel_uline", PROP_FLOAT, PROP_COLOR_GAMMA); RNA_def_property_float_sdna(prop, NULL, "nurb_sel_uline"); RNA_def_property_array(prop, 3); - RNA_def_property_ui_text(prop, "Nurb active U-lines", ""); + RNA_def_property_ui_text(prop, "NURBS active U-lines", ""); RNA_def_property_update(prop, 0, "rna_userdef_update"); prop= RNA_def_property(srna, "nurb_sel_vline", PROP_FLOAT, PROP_COLOR_GAMMA); RNA_def_property_float_sdna(prop, NULL, "nurb_sel_vline"); RNA_def_property_array(prop, 3); - RNA_def_property_ui_text(prop, "Nurb active V-lines", ""); + RNA_def_property_ui_text(prop, "NURBS active V-lines", ""); RNA_def_property_update(prop, 0, "rna_userdef_update"); prop= RNA_def_property(srna, "act_spline", PROP_FLOAT, PROP_COLOR_GAMMA); @@ -1984,19 +1984,19 @@ static void rna_def_userdef_solidlight(BlenderRNA *brna) RNA_def_property_float_sdna(prop, NULL, "vec"); RNA_def_property_array(prop, 3); RNA_def_property_float_array_default(prop, default_dir); - RNA_def_property_ui_text(prop, "Direction", "The direction that the OpenGL light is shining"); + RNA_def_property_ui_text(prop, "Direction", "Direction that the OpenGL light is shining"); RNA_def_property_update(prop, 0, "rna_UserDef_viewport_lights_update"); prop= RNA_def_property(srna, "diffuse_color", PROP_FLOAT, PROP_COLOR); RNA_def_property_float_sdna(prop, NULL, "col"); RNA_def_property_array(prop, 3); - RNA_def_property_ui_text(prop, "Diffuse Color", "The diffuse color of the OpenGL light"); + RNA_def_property_ui_text(prop, "Diffuse Color", "Diffuse color of the OpenGL light"); RNA_def_property_update(prop, 0, "rna_UserDef_viewport_lights_update"); prop= RNA_def_property(srna, "specular_color", PROP_FLOAT, PROP_COLOR); RNA_def_property_float_sdna(prop, NULL, "spec"); RNA_def_property_array(prop, 3); - RNA_def_property_ui_text(prop, "Specular Color", "The color of the lights specular highlight"); + RNA_def_property_ui_text(prop, "Specular Color", "Color of the light's specular highlight"); RNA_def_property_update(prop, 0, "rna_UserDef_viewport_lights_update"); } diff --git a/source/blender/makesrna/intern/rna_wm.c b/source/blender/makesrna/intern/rna_wm.c index f8383b1d451..676fe1e092d 100644 --- a/source/blender/makesrna/intern/rna_wm.c +++ b/source/blender/makesrna/intern/rna_wm.c @@ -1703,7 +1703,7 @@ static void rna_def_keyconfig(BlenderRNA *brna) prop= RNA_def_property(srna, "id", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "id"); RNA_def_property_clear_flag(prop, PROP_EDITABLE); - RNA_def_property_ui_text(prop, "id", "ID of the item"); + RNA_def_property_ui_text(prop, "ID", "ID of the item"); RNA_def_property_update(prop, 0, "rna_KeyMapItem_update"); prop= RNA_def_property(srna, "any", PROP_BOOLEAN, PROP_NONE); diff --git a/source/blender/makesrna/intern/rna_world.c b/source/blender/makesrna/intern/rna_world.c index 11ec327c306..62975763874 100644 --- a/source/blender/makesrna/intern/rna_world.c +++ b/source/blender/makesrna/intern/rna_world.c @@ -409,7 +409,7 @@ static void rna_def_world_mist(BlenderRNA *brna) RNA_def_property_float_sdna(prop, NULL, "mistdist"); RNA_def_property_range(prop, 0, FLT_MAX); RNA_def_property_ui_range(prop, 0, 10000, 10, 2); - RNA_def_property_ui_text(prop, "Depth", "The distance over which the mist effect fades in"); + RNA_def_property_ui_text(prop, "Depth", "Distance over which the mist effect fades in"); RNA_def_property_update(prop, 0, "rna_World_draw_mist_update"); prop= RNA_def_property(srna, "height", PROP_FLOAT, PROP_DISTANCE); @@ -433,7 +433,7 @@ static void rna_def_world_stars(BlenderRNA *brna) srna= RNA_def_struct(brna, "WorldStarsSettings", NULL); RNA_def_struct_sdna(srna, "World"); RNA_def_struct_nested(brna, srna, "World"); - RNA_def_struct_ui_text(srna, "World Stars", "Stars setting for a World data-block"); + RNA_def_struct_ui_text(srna, "World Stars", "Stars settings for a World data-block"); prop= RNA_def_property(srna, "use_stars", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "mode", WO_STARS); -- cgit v1.2.3 From 9969ebffa60d37762bf20b67b3cf1fd6430ff9fa Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Thu, 20 Oct 2011 08:03:29 +0000 Subject: Fix #28942: Minimize stretch in UV editing has no continues grab --- source/blender/editors/uvedit/uvedit_unwrap_ops.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/blender/editors/uvedit/uvedit_unwrap_ops.c b/source/blender/editors/uvedit/uvedit_unwrap_ops.c index ae4718d8f56..7f6394e822b 100644 --- a/source/blender/editors/uvedit/uvedit_unwrap_ops.c +++ b/source/blender/editors/uvedit/uvedit_unwrap_ops.c @@ -464,7 +464,7 @@ void UV_OT_minimize_stretch(wmOperatorType *ot) /* identifiers */ ot->name= "Minimize Stretch"; ot->idname= "UV_OT_minimize_stretch"; - ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; + ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_GRAB_POINTER|OPTYPE_BLOCKING; ot->description="Reduce UV stretching by relaxing angles"; /* api callbacks */ -- cgit v1.2.3 From 1555d4b1a8ff43414b6ab5e87097d53f86c86a00 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 20 Oct 2011 08:12:39 +0000 Subject: fix [#28902] Rendering and visibility icons in modifier panel move between clicks --- .../editors/interface/interface_templates.c | 32 ++++++++++++++-------- 1 file changed, 21 insertions(+), 11 deletions(-) diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c index 4dcdeab2169..77a25307651 100644 --- a/source/blender/editors/interface/interface_templates.c +++ b/source/blender/editors/interface/interface_templates.c @@ -759,18 +759,28 @@ static uiLayout *draw_modifier(uiLayout *layout, Scene *scene, Object *ob, Modif if (mti->flags & eModifierTypeFlag_SupportsEditmode) uiItemR(row, &ptr, "show_in_editmode", 0, "", ICON_NONE); } - if ((ob->type==OB_MESH) && modifier_couldBeCage(scene, md) && (index <= lastCageIndex)) - { - /* -- convert to rna ? */ - but = uiDefIconButBitI(block, TOG, eModifierMode_OnCage, 0, ICON_MESH_DATA, 0, 0, UI_UNIT_X-2, UI_UNIT_Y, &md->mode, 0.0, 0.0, 0.0, 0.0, - UI_translate_do_tooltip(N_("Apply modifier to editing cage during Editmode"))); - if (index < cageIndex) - uiButSetFlag(but, UI_BUT_DISABLED); - uiButSetFunc(but, modifiers_setOnCage, ob, md); - } - /* tesselation point for curve-typed objects */ - if (ELEM3(ob->type, OB_CURVE, OB_SURF, OB_FONT)) { + if (ob->type==OB_MESH) { + if (modifier_couldBeCage(scene, md) && (index <= lastCageIndex)) + { + /* -- convert to rna ? */ + but = uiDefIconButBitI(block, TOG, eModifierMode_OnCage, 0, ICON_MESH_DATA, 0, 0, UI_UNIT_X-2, UI_UNIT_Y, &md->mode, 0.0, 0.0, 0.0, 0.0, + UI_translate_do_tooltip(N_("Apply modifier to editing cage during Editmode"))); + if (index < cageIndex) + uiButSetFlag(but, UI_BUT_DISABLED); + uiButSetFunc(but, modifiers_setOnCage, ob, md); + } + else { + uiBlockEndAlign(block); + + /* place holder button */ + uiBlockSetEmboss(block, UI_EMBOSSN); + but= uiDefIconBut(block, BUT, 0, ICON_NONE, 0, 0, UI_UNIT_X-2, UI_UNIT_Y, NULL, 0.0, 0.0, 0.0, 0.0, NULL); + uiButSetFlag(but, UI_BUT_DISABLED); + uiBlockSetEmboss(block, UI_EMBOSS); + } + } /* tesselation point for curve-typed objects */ + else if (ELEM3(ob->type, OB_CURVE, OB_SURF, OB_FONT)) { /* some modifiers could work with pre-tesselated curves only */ if (ELEM3(md->type, eModifierType_Hook, eModifierType_Softbody, eModifierType_MeshDeform)) { /* add disabled pre-tesselated button, so users could have -- cgit v1.2.3 From f037642843bf7f7b8fe219d73480c896d7746372 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Thu, 20 Oct 2011 08:19:51 +0000 Subject: Fix #28937: Text Editor Selection (Scroll Bar) Do not start selection if mouse cursor.x >= scrollbar.x --- source/blender/editors/space_text/text_ops.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/source/blender/editors/space_text/text_ops.c b/source/blender/editors/space_text/text_ops.c index 8d40550961f..242bccd2376 100644 --- a/source/blender/editors/space_text/text_ops.c +++ b/source/blender/editors/space_text/text_ops.c @@ -2583,6 +2583,9 @@ static int set_selection_invoke(bContext *C, wmOperator *op, wmEvent *event) SpaceText *st= CTX_wm_space_text(C); SetSelection *ssel; + if(event->mval[0]>=st->txtbar.xmin) + return OPERATOR_PASS_THROUGH; + op->customdata= MEM_callocN(sizeof(SetSelection), "SetCursor"); ssel= op->customdata; ssel->selecting= RNA_boolean_get(op->ptr, "select"); -- cgit v1.2.3 From e02dfe4a79b3632b3143d5d45e0dee1463ff7aa6 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Thu, 20 Oct 2011 08:32:26 +0000 Subject: Fix #28938: Black frames when composite output node even with disabled nodes --- source/blender/render/intern/source/pipeline.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/blender/render/intern/source/pipeline.c b/source/blender/render/intern/source/pipeline.c index 19dc0538dba..3db73816025 100644 --- a/source/blender/render/intern/source/pipeline.c +++ b/source/blender/render/intern/source/pipeline.c @@ -2468,7 +2468,7 @@ static void do_render_composite_fields_blur_3d(Render *re) ntreeCompositTagAnimated(ntree); } - if(ntree && re->r.scemode & R_DOCOMP) { + if(ntree && re->scene->use_nodes && re->r.scemode & R_DOCOMP) { /* checks if there are render-result nodes that need scene */ if((re->r.scemode & R_SINGLE_LAYER)==0) ntree_render_scenes(re); -- cgit v1.2.3 From 8d6a554d7502029f04aca33efcdd004744b9bd84 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 20 Oct 2011 09:47:05 +0000 Subject: - add BLI_string_utf8.h for unicode functions. - move font.c unicode functions into string_utf8.c and rename to fit with other BLI_string funcs. --- source/blender/blenkernel/BKE_font.h | 5 - source/blender/blenkernel/intern/font.c | 140 +------------------ source/blender/blenkernel/intern/particle_system.c | 1 - source/blender/blenkernel/intern/smoke.c | 3 +- source/blender/blenlib/BLI_blenlib.h | 2 + source/blender/blenlib/BLI_string.h | 14 +- source/blender/blenlib/BLI_string_utf8.h | 55 ++++++++ source/blender/blenlib/CMakeLists.txt | 1 + source/blender/blenlib/intern/BLI_args.c | 1 - source/blender/blenlib/intern/string_utf8.c | 155 +++++++++++++++++++++ source/blender/editors/curve/editfont.c | 14 +- source/blender/editors/interface/interface_anim.c | 1 + source/blender/editors/interface/interface_draw.c | 4 +- .../editors/interface/interface_templates.c | 1 - source/blender/editors/space_file/fsmenu.c | 1 - source/blender/imbuf/intern/indexer.c | 3 +- source/blender/makesrna/intern/rna_curve.c | 2 +- source/blender/makesrna/intern/rna_define.c | 1 - source/blender/python/generic/py_capi_utils.c | 4 +- source/blender/python/intern/bpy_interface.c | 4 +- source/blender/windowmanager/intern/wm_operators.c | 1 - 21 files changed, 234 insertions(+), 179 deletions(-) create mode 100644 source/blender/blenlib/BLI_string_utf8.h diff --git a/source/blender/blenkernel/BKE_font.h b/source/blender/blenkernel/BKE_font.h index e4e8805164a..214ae03b453 100644 --- a/source/blender/blenkernel/BKE_font.h +++ b/source/blender/blenkernel/BKE_font.h @@ -85,11 +85,6 @@ struct chartrans *BKE_text_to_curve(struct Main *bmain, struct Scene *scene, str int BKE_font_getselection(struct Object *ob, int *start, int *end); -size_t chtoutf8(const unsigned long c, char o[4]); -void wcs2utf8s(char *dst, const wchar_t *src); -size_t wcsleninu8(wchar_t *src); -size_t utf8towchar(wchar_t *w, const char *c); - #ifdef __cplusplus } #endif diff --git a/source/blender/blenkernel/intern/font.c b/source/blender/blenkernel/intern/font.c index 9c01b35b91a..068e70bbb50 100644 --- a/source/blender/blenkernel/intern/font.c +++ b/source/blender/blenkernel/intern/font.c @@ -64,142 +64,6 @@ static ListBase ttfdata= {NULL, NULL}; -/* UTF-8 <-> wchar transformations */ -size_t chtoutf8(const unsigned long c, char o[4]) -{ - // Variables and initialization -/* memset(o, 0, 4); */ - - // Create the utf-8 string - if (c < 0x80) { - o[0] = (char) c; - return 1; - } - else if (c < 0x800) { - o[0] = (0xC0 | (c>>6)); - o[1] = (0x80 | (c & 0x3f)); - return 2; - } - else if (c < 0x10000) { - o[0] = (0xe0 | (c >> 12)); - o[1] = (0x80 | (c >>6 & 0x3f)); - o[2] = (0x80 | (c & 0x3f)); - return 3; - } - else if (c < 0x200000) { - o[0] = (0xf0 | (c>>18)); - o[1] = (0x80 | (c >>12 & 0x3f)); - o[2] = (0x80 | (c >> 6 & 0x3f)); - o[3] = (0x80 | (c & 0x3f)); - return 4; - } - - /* should we assert here? */ - return 0; -} - -void wcs2utf8s(char *dst, const wchar_t *src) -{ - while(*src) { - dst += chtoutf8(*src++, dst); - } - - *dst= '\0'; -} - -size_t wcsleninu8(wchar_t *src) -{ - char ch_dummy[4]; - size_t len = 0; - - while(*src) { - len += chtoutf8(*src++, ch_dummy); - } - - return len; -} - -static size_t utf8slen(const char *strc) -{ - int len=0; - - while(*strc) { - if ((*strc & 0xe0) == 0xc0) { - if((strc[1] & 0x80) && (strc[1] & 0x40) == 0x00) - strc++; - } else if ((*strc & 0xf0) == 0xe0) { - if((strc[1] & strc[2] & 0x80) && ((strc[1] | strc[2]) & 0x40) == 0x00) - strc += 2; - } else if ((*strc & 0xf8) == 0xf0) { - if((strc[1] & strc[2] & strc[3] & 0x80) && ((strc[1] | strc[2] | strc[3]) & 0x40) == 0x00) - strc += 3; - } - - strc++; - len++; - } - - return len; -} - - -/* Converts Unicode to wchar - -According to RFC 3629 "UTF-8, a transformation format of ISO 10646" -(http://tools.ietf.org/html/rfc3629), the valid UTF-8 encoding are: - - Char. number range | UTF-8 octet sequence - (hexadecimal) | (binary) - --------------------+--------------------------------------------- - 0000 0000-0000 007F | 0xxxxxxx - 0000 0080-0000 07FF | 110xxxxx 10xxxxxx - 0000 0800-0000 FFFF | 1110xxxx 10xxxxxx 10xxxxxx - 0001 0000-0010 FFFF | 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx - -If the encoding incidated by the first character is incorrect (because the -1 to 3 following characters do not match 10xxxxxx), the output is a '?' and -only a single input character is consumed. - -*/ - -size_t utf8towchar(wchar_t *w, const char *c) -{ - int len=0; - - if(w==NULL || c==NULL) return(0); - - while(*c) { - if ((*c & 0xe0) == 0xc0) { - if((c[1] & 0x80) && (c[1] & 0x40) == 0x00) { - *w=((c[0] &0x1f)<<6) | (c[1]&0x3f); - c++; - } else { - *w = '?'; - } - } else if ((*c & 0xf0) == 0xe0) { - if((c[1] & c[2] & 0x80) && ((c[1] | c[2]) & 0x40) == 0x00) { - *w=((c[0] & 0x0f)<<12) | ((c[1]&0x3f)<<6) | (c[2]&0x3f); - c += 2; - } else { - *w = '?'; - } - } else if ((*c & 0xf8) == 0xf0) { - if((c[1] & c[2] & c[3] & 0x80) && ((c[1] | c[2] | c[3]) & 0x40) == 0x00) { - *w=((c[0] & 0x07)<<18) | ((c[1]&0x1f)<<12) | ((c[2]&0x3f)<<6) | (c[3]&0x3f); - c += 3; - } else { - *w = '?'; - } - } else - *w=(c[0] & 0x7f); - - c++; - w++; - len++; - } - return len; -} - /* The vfont code */ void free_vfont(struct VFont *vf) { @@ -691,10 +555,10 @@ struct chartrans *BKE_text_to_curve(Main *bmain, Scene *scene, Object *ob, int m if(vfont == NULL) return NULL; // Create unicode string - utf8len = utf8slen(cu->str); + utf8len = BLI_strlen_utf8(cu->str); mem = MEM_callocN(((utf8len + 1) * sizeof(wchar_t)), "convertedmem"); - utf8towchar(mem, cu->str); + BLI_strncpy_wchar_from_utf8(mem, cu->str, utf8len + 1); // Count the wchar_t string length slen = wcslen(mem); diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c index 7b2d621aff2..64a90e15b60 100644 --- a/source/blender/blenkernel/intern/particle_system.c +++ b/source/blender/blenkernel/intern/particle_system.c @@ -70,7 +70,6 @@ #include "BLI_listbase.h" #include "BLI_threads.h" #include "BLI_storage.h" /* For _LARGEFILE64_SOURCE; zlib needs this on some systems */ -#include "BLI_string.h" #include "BLI_utildefines.h" #include "BKE_main.h" diff --git a/source/blender/blenkernel/intern/smoke.c b/source/blender/blenkernel/intern/smoke.c index 85140841f15..49c8831f06c 100644 --- a/source/blender/blenkernel/intern/smoke.c +++ b/source/blender/blenkernel/intern/smoke.c @@ -812,13 +812,12 @@ void smokeModifier_copy(struct SmokeModifierData *smd, struct SmokeModifierData } } +#ifdef WITH_SMOKE // forward decleration static void smoke_calc_transparency(float *result, float *input, float *p0, float *p1, int res[3], float dx, float *light, bresenham_callback cb, float correct); static float calc_voxel_transp(float *result, float *input, int res[3], int *pixel, float *tRay, float correct); -#ifdef WITH_SMOKE - static int get_lamp(Scene *scene, float *light) { Base *base_tmp = NULL; diff --git a/source/blender/blenlib/BLI_blenlib.h b/source/blender/blenlib/BLI_blenlib.h index ba5d04f3021..cda7a51c47f 100644 --- a/source/blender/blenlib/BLI_blenlib.h +++ b/source/blender/blenlib/BLI_blenlib.h @@ -74,6 +74,8 @@ extern "C" { #include "BLI_string.h" +#include "BLI_string_utf8.h" + #include "BLI_path_util.h" #include "BLI_storage.h" diff --git a/source/blender/blenlib/BLI_string.h b/source/blender/blenlib/BLI_string.h index 3ac8dba106a..958f240e3a8 100644 --- a/source/blender/blenlib/BLI_string.h +++ b/source/blender/blenlib/BLI_string.h @@ -25,9 +25,7 @@ * Contributor(s): none yet. * * ***** END GPL LICENSE BLOCK ***** - * - * $Id$ -*/ + */ #ifndef BLI_STRING_H #define BLI_STRING_H @@ -142,16 +140,6 @@ void BLI_timestr(double _time, char *str); /* time var is global */ void BLI_ascii_strtolower(char *str, int len); void BLI_ascii_strtoupper(char *str, int len); - -/* string_utf8.c - may move these into their own header some day - campbell */ -char *BLI_strncpy_utf8(char *dst, const char *src, size_t maxncpy); -int BLI_utf8_invalid_byte(const char *str, int length); -int BLI_utf8_invalid_strip(char *str, int length); - /* copied from glib */ -char *BLI_str_find_prev_char_utf8(const char *str, const char *p); -char *BLI_str_find_next_char_utf8(const char *p, const char *end); -char *BLI_str_prev_char_utf8(const char *p); - #ifdef __cplusplus } #endif diff --git a/source/blender/blenlib/BLI_string_utf8.h b/source/blender/blenlib/BLI_string_utf8.h new file mode 100644 index 00000000000..15884c4d2d9 --- /dev/null +++ b/source/blender/blenlib/BLI_string_utf8.h @@ -0,0 +1,55 @@ +/* + * $Id: + * + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * Contributor(s): none yet. + * + * ***** END GPL LICENSE BLOCK ***** + */ + +#ifndef BLI_STRING_UTF8_H +#define BLI_STRING_UTF8_H + +/** \file BLI_string.h + * \ingroup bli + */ + +#ifdef __cplusplus +extern "C" { +#endif + +char *BLI_strncpy_utf8(char *dst, const char *src, size_t maxncpy); +int BLI_utf8_invalid_byte(const char *str, int length); +int BLI_utf8_invalid_strip(char *str, int length); + + /* copied from glib */ +char *BLI_str_find_prev_char_utf8(const char *str, const char *p); +char *BLI_str_find_next_char_utf8(const char *p, const char *end); +char *BLI_str_prev_char_utf8(const char *p); + + /* wchar_t functions, copied from blenders own font.c originally */ +size_t BLI_wstrlen_utf8(const wchar_t *src); +size_t BLI_strlen_utf8(const char *strc); +size_t BLI_strncpy_wchar_as_utf8(char *dst, const wchar_t *src, const size_t maxcpy); +size_t BLI_strncpy_wchar_from_utf8(wchar_t *dst, const char *src, const size_t maxcpy); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/source/blender/blenlib/CMakeLists.txt b/source/blender/blenlib/CMakeLists.txt index aa822731474..ea9f72c19c3 100644 --- a/source/blender/blenlib/CMakeLists.txt +++ b/source/blender/blenlib/CMakeLists.txt @@ -128,6 +128,7 @@ set(SRC BLI_storage.h BLI_storage_types.h BLI_string.h + BLI_string_utf8.h BLI_threads.h BLI_utildefines.h BLI_uvproject.h diff --git a/source/blender/blenlib/intern/BLI_args.c b/source/blender/blenlib/intern/BLI_args.c index cf3605a80ff..82891b1e121 100644 --- a/source/blender/blenlib/intern/BLI_args.c +++ b/source/blender/blenlib/intern/BLI_args.c @@ -39,7 +39,6 @@ #include "MEM_guardedalloc.h" #include "BLI_listbase.h" -#include "BLI_string.h" #include "BLI_utildefines.h" #include "BLI_args.h" #include "BLI_ghash.h" diff --git a/source/blender/blenlib/intern/string_utf8.c b/source/blender/blenlib/intern/string_utf8.c index dc6cb0ef228..f331d13e580 100644 --- a/source/blender/blenlib/intern/string_utf8.c +++ b/source/blender/blenlib/intern/string_utf8.c @@ -31,6 +31,8 @@ */ #include +#include +#include #include "BLI_string.h" @@ -183,6 +185,159 @@ char *BLI_strncpy_utf8(char *dst, const char *src, size_t maxncpy) return dst_r; } + +/* --------------------------------------------------------------------------*/ +/* wchar_t / utf8 functions */ + +/* UTF-8 <-> wchar transformations */ +static size_t chtoutf8(const unsigned long c, char o[4]) +{ + // Variables and initialization +/* memset(o, 0, 4); */ + + // Create the utf-8 string + if (c < 0x80) { + o[0] = (char) c; + return 1; + } + else if (c < 0x800) { + o[0] = (0xC0 | (c>>6)); + o[1] = (0x80 | (c & 0x3f)); + return 2; + } + else if (c < 0x10000) { + o[0] = (0xe0 | (c >> 12)); + o[1] = (0x80 | (c >>6 & 0x3f)); + o[2] = (0x80 | (c & 0x3f)); + return 3; + } + else if (c < 0x200000) { + o[0] = (0xf0 | (c>>18)); + o[1] = (0x80 | (c >>12 & 0x3f)); + o[2] = (0x80 | (c >> 6 & 0x3f)); + o[3] = (0x80 | (c & 0x3f)); + return 4; + } + + /* should we assert here? */ + return 0; +} + +size_t BLI_strncpy_wchar_as_utf8(char *dst, const wchar_t *src, const size_t maxcpy) +{ + size_t len = 0; + while(*src && len < maxcpy) { /* XXX can still run over the buffer because utf8 size isnt known :| */ + len += chtoutf8(*src++, dst+len); + } + + dst[len]= '\0'; + + return len; +} + +/* wchar len in utf8 */ +size_t BLI_wstrlen_utf8(const wchar_t *src) +{ + char ch_dummy[4]; + size_t len = 0; + + while(*src) { + len += chtoutf8(*src++, ch_dummy); + } + + return len; +} + +// utf8slen +size_t BLI_strlen_utf8(const char *strc) +{ + int len=0; + + while(*strc) { + if ((*strc & 0xe0) == 0xc0) { + if((strc[1] & 0x80) && (strc[1] & 0x40) == 0x00) + strc++; + } else if ((*strc & 0xf0) == 0xe0) { + if((strc[1] & strc[2] & 0x80) && ((strc[1] | strc[2]) & 0x40) == 0x00) + strc += 2; + } else if ((*strc & 0xf8) == 0xf0) { + if((strc[1] & strc[2] & strc[3] & 0x80) && ((strc[1] | strc[2] | strc[3]) & 0x40) == 0x00) + strc += 3; + } + + strc++; + len++; + } + + return len; +} + + +/* Converts Unicode to wchar + +According to RFC 3629 "UTF-8, a transformation format of ISO 10646" +(http://tools.ietf.org/html/rfc3629), the valid UTF-8 encoding are: + + Char. number range | UTF-8 octet sequence + (hexadecimal) | (binary) + --------------------+--------------------------------------------- + 0000 0000-0000 007F | 0xxxxxxx + 0000 0080-0000 07FF | 110xxxxx 10xxxxxx + 0000 0800-0000 FFFF | 1110xxxx 10xxxxxx 10xxxxxx + 0001 0000-0010 FFFF | 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx + +If the encoding incidated by the first character is incorrect (because the +1 to 3 following characters do not match 10xxxxxx), the output is a '?' and +only a single input character is consumed. + +*/ + +size_t BLI_strncpy_wchar_from_utf8(wchar_t *dst_w, const char *src_c, const size_t maxcpy) +{ + int len=0; + + if(dst_w==NULL || src_c==NULL) return(0); + + while(*src_c && len < maxcpy) { + if ((*src_c & 0xe0) == 0xc0) { + if((src_c[1] & 0x80) && (src_c[1] & 0x40) == 0x00) { + *dst_w=((src_c[0] &0x1f)<<6) | (src_c[1]&0x3f); + src_c++; + } else { + *dst_w = '?'; + } + } else if ((*src_c & 0xf0) == 0xe0) { + if((src_c[1] & src_c[2] & 0x80) && ((src_c[1] | src_c[2]) & 0x40) == 0x00) { + *dst_w=((src_c[0] & 0x0f)<<12) | ((src_c[1]&0x3f)<<6) | (src_c[2]&0x3f); + src_c += 2; + } else { + *dst_w = '?'; + } + } else if ((*src_c & 0xf8) == 0xf0) { + if((src_c[1] & src_c[2] & src_c[3] & 0x80) && ((src_c[1] | src_c[2] | src_c[3]) & 0x40) == 0x00) { + *dst_w=((src_c[0] & 0x07)<<18) | ((src_c[1]&0x1f)<<12) | ((src_c[2]&0x3f)<<6) | (src_c[3]&0x3f); + src_c += 3; + } else { + *dst_w = '?'; + } + } else { + *dst_w=(src_c[0] & 0x7f); + } + + src_c++; + dst_w++; + len++; + } + return len; +} + +/* end wchar_t / utf8 functions */ +/* --------------------------------------------------------------------------*/ + + + + + /* copied from glib */ /** * g_utf8_find_prev_char: diff --git a/source/blender/editors/curve/editfont.c b/source/blender/editors/curve/editfont.c index 60b1cc8f5cd..03e226e3a75 100644 --- a/source/blender/editors/curve/editfont.c +++ b/source/blender/editors/curve/editfont.c @@ -221,13 +221,13 @@ static void update_string(Curve *cu) MEM_freeN(cu->str); // Calculate the actual string length in UTF-8 variable characters - len = wcsleninu8(ef->textbuf); + len = BLI_wstrlen_utf8(ef->textbuf); // Alloc memory for UTF-8 variable char length string cu->str = MEM_callocN(len + sizeof(wchar_t), "str"); // Copy the wchar to UTF-8 - wcs2utf8s(cu->str, ef->textbuf); + BLI_strncpy_wchar_as_utf8(cu->str, ef->textbuf, len + 1); } static int insert_into_textbuf(Object *obedit, uintptr_t c) @@ -373,7 +373,7 @@ static int paste_file(bContext *C, ReportList *reports, const char *filename) if(cu->len+filelentextbuf, mem); MEM_freeN(mem); cu->len += tmplen; @@ -1241,10 +1241,10 @@ static int insert_text_exec(bContext *C, wmOperator *op) return OPERATOR_CANCELLED; inserted_utf8= RNA_string_get_alloc(op->ptr, "text", NULL, 0); - len= strlen(inserted_utf8); + len= BLI_strlen_utf8(inserted_utf8); inserted_text= MEM_callocN(sizeof(wchar_t)*(len+1), "FONT_insert_text"); - utf8towchar(inserted_text, inserted_utf8); + BLI_strncpy_wchar_from_utf8(inserted_text, inserted_utf8, len+1); for(a=0; aptr, "text", inserted_utf8); } @@ -1478,7 +1478,7 @@ void make_editText(Object *obedit) } // Convert the original text to wchar_t - utf8towchar(ef->textbuf, cu->str); + BLI_strncpy_wchar_from_utf8(ef->textbuf, cu->str, MAXTEXT+4); /* length is bogus */ wcscpy(ef->oldstr, ef->textbuf); cu->len= wcslen(ef->textbuf); diff --git a/source/blender/editors/interface/interface_anim.c b/source/blender/editors/interface/interface_anim.c index 545d60bfcb9..aeb8ad99dd2 100644 --- a/source/blender/editors/interface/interface_anim.c +++ b/source/blender/editors/interface/interface_anim.c @@ -38,6 +38,7 @@ #include "BLI_listbase.h" #include "BLI_string.h" +#include "BLI_string_utf8.h" #include "BLI_utildefines.h" #include "BKE_context.h" diff --git a/source/blender/editors/interface/interface_draw.c b/source/blender/editors/interface/interface_draw.c index a40900fb39b..aefe773fdad 100644 --- a/source/blender/editors/interface/interface_draw.c +++ b/source/blender/editors/interface/interface_draw.c @@ -600,13 +600,13 @@ static void ui_draw_but_CHARTAB(uiBut *but) wstr[0] = cs; if(strcmp(G.selfont->name, FO_BUILTIN_NAME)) { - wcs2utf8s((char *)ustr, (wchar_t *)wstr); + BLI_strncpy_wchar_as_utf8((char *)ustr, (wchar_t *)wstr, sizeof(ustr)); } else { if(G.ui_international == TRUE) { - wcs2utf8s((char *)ustr, (wchar_t *)wstr); + BLI_strncpy_wchar_as_utf8((char *)ustr, (wchar_t *)wstr, sizeof(ustr)); } else { diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c index 77a25307651..0375345afcc 100644 --- a/source/blender/editors/interface/interface_templates.c +++ b/source/blender/editors/interface/interface_templates.c @@ -38,7 +38,6 @@ #include "DNA_scene_types.h" #include "DNA_userdef_types.h" -#include "BLI_string.h" #include "BLI_utildefines.h" #include "BLI_ghash.h" diff --git a/source/blender/editors/space_file/fsmenu.c b/source/blender/editors/space_file/fsmenu.c index aa2ea124fe0..bd9a38ab27e 100644 --- a/source/blender/editors/space_file/fsmenu.c +++ b/source/blender/editors/space_file/fsmenu.c @@ -44,7 +44,6 @@ #include "BLI_blenlib.h" #include "BLI_linklist.h" #include "BLI_dynstr.h" -#include "BLI_string.h" #ifdef WIN32 #include /* need to include windows.h so _WIN32_IE is defined */ diff --git a/source/blender/imbuf/intern/indexer.c b/source/blender/imbuf/intern/indexer.c index 635813d856e..e4abd8b329d 100644 --- a/source/blender/imbuf/intern/indexer.c +++ b/source/blender/imbuf/intern/indexer.c @@ -29,10 +29,11 @@ #include "AVI_avi.h" #include "imbuf.h" #include "MEM_guardedalloc.h" + #include "BLI_utildefines.h" #include "BLI_blenlib.h" #include "BLI_math_base.h" -#include "BLI_string.h" + #include "MEM_guardedalloc.h" #include "DNA_userdef_types.h" #include "BKE_global.h" diff --git a/source/blender/makesrna/intern/rna_curve.c b/source/blender/makesrna/intern/rna_curve.c index c03a10f2170..8bdbdcefc61 100644 --- a/source/blender/makesrna/intern/rna_curve.c +++ b/source/blender/makesrna/intern/rna_curve.c @@ -483,7 +483,7 @@ void rna_Curve_body_set(PointerRNA *ptr, const char *value) cu->str = MEM_callocN(len + sizeof(wchar_t), "str"); cu->strinfo = MEM_callocN( (len+4) *sizeof(CharInfo), "strinfo"); /* don't know why this is +4, just duplicating load_editText() */ - //wcs2utf8s(cu->str, value); // value is not wchar_t + //BLI_strncpy_wchar_as_utf8(cu->str, value, len+1); // value is not wchar_t BLI_strncpy(cu->str, value, len+1); } diff --git a/source/blender/makesrna/intern/rna_define.c b/source/blender/makesrna/intern/rna_define.c index ab469c19e15..06571a454be 100644 --- a/source/blender/makesrna/intern/rna_define.c +++ b/source/blender/makesrna/intern/rna_define.c @@ -39,7 +39,6 @@ #include "DNA_genfile.h" #include "DNA_sdna_types.h" -#include "BLI_string.h" #include "BLI_utildefines.h" #include "BLI_ghash.h" diff --git a/source/blender/python/generic/py_capi_utils.c b/source/blender/python/generic/py_capi_utils.c index e658532db24..575495e186e 100644 --- a/source/blender/python/generic/py_capi_utils.c +++ b/source/blender/python/generic/py_capi_utils.c @@ -30,7 +30,7 @@ #include "py_capi_utils.h" -#include "BKE_font.h" /* only for utf8towchar, should replace with py funcs but too late in release now */ +#include "BLI_string_utf8.h" /* only for BLI_strncpy_wchar_from_utf8, should replace with py funcs but too late in release now */ #ifdef _WIN32 /* BLI_setenv */ #include "BLI_path_util.h" @@ -478,7 +478,7 @@ void PyC_SetHomePath(const char *py_path_bundle) /* cant use this, on linux gives bug: #23018, TODO: try LANG="en_US.UTF-8" /usr/bin/blender, suggested 22008 */ /* mbstowcs(py_path_bundle_wchar, py_path_bundle, FILE_MAXDIR); */ - utf8towchar(py_path_bundle_wchar, py_path_bundle); + BLI_strncpy_wchar_from_utf8(py_path_bundle_wchar, py_path_bundle, sizeof(py_path_bundle_wchar) / sizeof(wchar_t)); Py_SetPythonHome(py_path_bundle_wchar); // printf("found python (wchar_t) '%ls'\n", py_path_bundle_wchar); diff --git a/source/blender/python/intern/bpy_interface.c b/source/blender/python/intern/bpy_interface.c index aaa813137c6..ddbd557375c 100644 --- a/source/blender/python/intern/bpy_interface.c +++ b/source/blender/python/intern/bpy_interface.c @@ -52,12 +52,12 @@ #include "BLI_path_util.h" #include "BLI_math_base.h" #include "BLI_string.h" +#include "BLI_string_utf8.h" #include "BLI_utildefines.h" #include "BKE_context.h" #include "BKE_text.h" -#include "BKE_font.h" /* only for utf8towchar */ #include "BKE_main.h" #include "BKE_global.h" /* only for script checking */ @@ -194,7 +194,7 @@ void BPY_python_start(int argc, const char **argv) /* not essential but nice to set our name */ static wchar_t bprogname_wchar[FILE_MAXDIR+FILE_MAXFILE]; /* python holds a reference */ - utf8towchar(bprogname_wchar, bprogname); + BLI_strncpy_wchar_from_utf8(bprogname_wchar, bprogname, sizeof(bprogname_wchar) / sizeof(wchar_t)); Py_SetProgramName(bprogname_wchar); /* must run before python initializes */ diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c index 4924457da1a..1face062e7e 100644 --- a/source/blender/windowmanager/intern/wm_operators.c +++ b/source/blender/windowmanager/intern/wm_operators.c @@ -56,7 +56,6 @@ #include "BLI_blenlib.h" #include "BLI_dynstr.h" /*for WM_operator_pystring */ #include "BLI_math.h" -#include "BLI_string.h" #include "BLI_utildefines.h" #include "BLI_ghash.h" -- cgit v1.2.3 From fe30dcbfb6281857435759b5c36ff390d7c067cb Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Thu, 20 Oct 2011 09:53:02 +0000 Subject: Minor: fix [#28899] Frequently used modelling modifiers moved further out of reach by new Vertex Weight modifiers. --- source/blender/makesrna/intern/rna_modifier.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c index fbf54a76cd9..c33fa0bc7f8 100644 --- a/source/blender/makesrna/intern/rna_modifier.c +++ b/source/blender/makesrna/intern/rna_modifier.c @@ -55,6 +55,11 @@ #include "WM_types.h" EnumPropertyItem modifier_type_items[] ={ + {0, "", 0, "Modify", ""}, + {eModifierType_UVProject, "UV_PROJECT", ICON_MOD_UVPROJECT, "UV Project", ""}, + {eModifierType_WeightVGEdit, "VERTEX_WEIGHT_EDIT", ICON_MOD_VERTEX_WEIGHT, "Vertex Weight Edit", ""}, + {eModifierType_WeightVGMix, "VERTEX_WEIGHT_MIX", ICON_MOD_VERTEX_WEIGHT, "Vertex Weight Mix", ""}, + {eModifierType_WeightVGProximity, "VERTEX_WEIGHT_PROXIMITY", ICON_MOD_VERTEX_WEIGHT, "Vertex Weight Proximity", ""}, {0, "", 0, "Generate", ""}, {eModifierType_Array, "ARRAY", ICON_MOD_ARRAY, "Array", ""}, {eModifierType_Bevel, "BEVEL", ICON_MOD_BEVEL, "Bevel", ""}, @@ -68,11 +73,6 @@ EnumPropertyItem modifier_type_items[] ={ {eModifierType_Screw, "SCREW", ICON_MOD_SCREW, "Screw", ""}, {eModifierType_Solidify, "SOLIDIFY", ICON_MOD_SOLIDIFY, "Solidify", ""}, {eModifierType_Subsurf, "SUBSURF", ICON_MOD_SUBSURF, "Subdivision Surface", ""}, - {0, "", 0, "Modify", ""}, - {eModifierType_UVProject, "UV_PROJECT", ICON_MOD_UVPROJECT, "UV Project", ""}, - {eModifierType_WeightVGEdit, "VERTEX_WEIGHT_EDIT", ICON_MOD_VERTEX_WEIGHT, "Vertex Weight Edit", ""}, - {eModifierType_WeightVGMix, "VERTEX_WEIGHT_MIX", ICON_MOD_VERTEX_WEIGHT, "Vertex Weight Mix", ""}, - {eModifierType_WeightVGProximity, "VERTEX_WEIGHT_PROXIMITY", ICON_MOD_VERTEX_WEIGHT, "Vertex Weight Proximity", ""}, {0, "", 0, "Deform", ""}, {eModifierType_Armature, "ARMATURE", ICON_MOD_ARMATURE, "Armature", ""}, {eModifierType_Cast, "CAST", ICON_MOD_CAST, "Cast", ""}, -- cgit v1.2.3 From 36017e2af9a3015876b4f573f00630cdae39c1ac Mon Sep 17 00:00:00 2001 From: Jens Verwiebe Date: Thu, 20 Oct 2011 10:35:54 +0000 Subject: OSX: dalai's patch for utf8 support, todo: uppercase chars not working yet --- intern/ghost/intern/GHOST_SystemCocoa.mm | 33 ++++++++++++++++++++++++++++---- 1 file changed, 29 insertions(+), 4 deletions(-) diff --git a/intern/ghost/intern/GHOST_SystemCocoa.mm b/intern/ghost/intern/GHOST_SystemCocoa.mm index 58a856375bb..1dfb8e36422 100644 --- a/intern/ghost/intern/GHOST_SystemCocoa.mm +++ b/intern/ghost/intern/GHOST_SystemCocoa.mm @@ -1654,8 +1654,17 @@ GHOST_TSuccess GHOST_SystemCocoa::handleKeyEvent(void *eventPtr) //printf("\nW failure for event 0x%x",[event type]); return GHOST_kFailure; } + + /* unicode input - not entirely supported yet + * but we are getting the right byte, Blender is not drawing it though + * also some languages may need special treatment: + - Japanese: romanji is used as input, and every 2 letters OSX converts the text + to Hiragana/Katakana. + - Korean: one add one letter at a time, and then the OSX join them in the equivalent + combined letter. + */ + char utf8_buf[6]= {'\0'}; - char utf8_buf[6]= {'\0'}; /* TODO, unicode input */ switch ([event type]) { case NSKeyDown: @@ -1669,7 +1678,7 @@ GHOST_TSuccess GHOST_SystemCocoa::handleKeyEvent(void *eventPtr) keyCode = convertKey([event keyCode],0, [event type] == NSKeyDown?kUCKeyActionDown:kUCKeyActionUp); - + /* ascii */ characters = [event characters]; if ([characters length]>0) { //Check for dead keys //Convert characters to iso latin 1 encoding @@ -1681,16 +1690,32 @@ GHOST_TSuccess GHOST_SystemCocoa::handleKeyEvent(void *eventPtr) } else ascii= 0; + + /* unicode */ + if ([characters length]>0) { + convertedCharacters = [characters dataUsingEncoding:NSUTF8StringEncoding]; + if ([convertedCharacters length]>0) { + utf8_buf[0] = ((char*)[convertedCharacters bytes])[0]; + utf8_buf[1] = ((char*)[convertedCharacters bytes])[1]; + utf8_buf[2] = ((char*)[convertedCharacters bytes])[2]; + utf8_buf[3] = ((char*)[convertedCharacters bytes])[3]; + utf8_buf[4] = ((char*)[convertedCharacters bytes])[4]; + utf8_buf[5] = ((char*)[convertedCharacters bytes])[5]; + } + else { + utf8_buf[0] = '\0'; + } + } if ((keyCode == GHOST_kKeyQ) && (m_modifierMask & NSCommandKeyMask)) break; //Cmd-Q is directly handled by Cocoa if ([event type] == NSKeyDown) { pushEvent( new GHOST_EventKey([event timestamp]*1000, GHOST_kEventKeyDown, window, keyCode, ascii, utf8_buf) ); - //printf("\nKey down rawCode=0x%x charsIgnoringModifiers=%c keyCode=%u ascii=%i %c",[event keyCode],[charsIgnoringModifiers length]>0?[charsIgnoringModifiers characterAtIndex:0]:' ',keyCode,ascii,ascii); + //printf("Key down rawCode=0x%x charsIgnoringModifiers=%c keyCode=%u ascii=%i %c utf8=%s\n",[event keyCode],[charsIgnoringModifiers length]>0?[charsIgnoringModifiers characterAtIndex:0]:' ',keyCode,ascii,ascii, utf8_buf); } else { pushEvent( new GHOST_EventKey([event timestamp]*1000, GHOST_kEventKeyUp, window, keyCode, ascii, utf8_buf) ); - //printf("\nKey up rawCode=0x%x charsIgnoringModifiers=%c keyCode=%u ascii=%i %c",[event keyCode],[charsIgnoringModifiers length]>0?[charsIgnoringModifiers characterAtIndex:0]:' ',keyCode,ascii,ascii); + //printf("Key down rawCode=0x%x charsIgnoringModifiers=%c keyCode=%u ascii=%i %c utf8=%s\n",[event keyCode],[charsIgnoringModifiers length]>0?[charsIgnoringModifiers characterAtIndex:0]:' ',keyCode,ascii,ascii, utf8_buf); } break; -- cgit v1.2.3 From 70ba7d02dbb44a20ac6d405d75e81806fc7ce4b5 Mon Sep 17 00:00:00 2001 From: Lukas Toenne Date: Thu, 20 Oct 2011 10:36:02 +0000 Subject: Fix for #28980, could enter infinite loop during node socket verification if dynamic sockets are present. Note: in this particular bug report the sockets have some faulty flag settings (none of them should be flagged as SOCK_DYNAMIC), needs more info. --- source/blender/nodes/intern/node_socket.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/source/blender/nodes/intern/node_socket.c b/source/blender/nodes/intern/node_socket.c index 51e48b84383..74f15af88a2 100644 --- a/source/blender/nodes/intern/node_socket.c +++ b/source/blender/nodes/intern/node_socket.c @@ -405,15 +405,15 @@ static bNodeSocket *verify_socket_template(bNodeTree *ntree, bNode *node, int in static void verify_socket_template_list(bNodeTree *ntree, bNode *node, int in_out, ListBase *socklist, bNodeSocketTemplate *stemp_first) { - bNodeSocket *sock; + bNodeSocket *sock, *nextsock; bNodeSocketTemplate *stemp; /* no inputs anymore? */ if(stemp_first==NULL) { - while(socklist->first) { - sock = (bNodeSocket*)socklist->first; + for (sock = (bNodeSocket*)socklist->first; sock; sock=nextsock) { + nextsock = sock->next; if (!(sock->flag & SOCK_DYNAMIC)) - nodeRemoveSocket(ntree, node, socklist->first); + nodeRemoveSocket(ntree, node, sock); } } else { @@ -424,10 +424,10 @@ static void verify_socket_template_list(bNodeTree *ntree, bNode *node, int in_ou stemp++; } /* leftovers are removed */ - while(socklist->first) { - sock = (bNodeSocket*)socklist->first; + for (sock = (bNodeSocket*)socklist->first; sock; sock=nextsock) { + nextsock = sock->next; if (!(sock->flag & SOCK_DYNAMIC)) - nodeRemoveSocket(ntree, node, socklist->first); + nodeRemoveSocket(ntree, node, sock); } /* and we put back the verified sockets */ -- cgit v1.2.3 From 3d501ca70fb3811ced1fdad5e4a170d173531a94 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 20 Oct 2011 10:47:38 +0000 Subject: unicode text input for 3d text. --- source/blender/blenlib/BLI_string_utf8.h | 2 +- source/blender/editors/curve/editfont.c | 16 ++++++++++++++-- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/source/blender/blenlib/BLI_string_utf8.h b/source/blender/blenlib/BLI_string_utf8.h index 15884c4d2d9..b7a9c204bfe 100644 --- a/source/blender/blenlib/BLI_string_utf8.h +++ b/source/blender/blenlib/BLI_string_utf8.h @@ -25,7 +25,7 @@ #ifndef BLI_STRING_UTF8_H #define BLI_STRING_UTF8_H -/** \file BLI_string.h +/** \file BLI_string_utf8.h * \ingroup bli */ diff --git a/source/blender/editors/curve/editfont.c b/source/blender/editors/curve/editfont.c index 03e226e3a75..dff5be059c3 100644 --- a/source/blender/editors/curve/editfont.c +++ b/source/blender/editors/curve/editfont.c @@ -1291,8 +1291,20 @@ static int insert_text_invoke(bContext *C, wmOperator *op, wmEvent *evt) if(val && ascii) { /* handle case like TAB (== 9) */ - if((ascii > 31 && ascii < 254 && ascii != 127) || (ascii==13) || (ascii==10) || (ascii==8)) { - if(accentcode) { + if( (ascii > 31 && ascii < 254 && ascii != 127) || + (ascii==13) || + (ascii==10) || + (ascii==8) || + (evt->utf8_buf[0])) + { + + if (evt->utf8_buf[0]) { + BLI_strncpy_wchar_from_utf8(inserted_text, evt->utf8_buf, 1); + ascii= inserted_text[0]; + insert_into_textbuf(obedit, ascii); + accentcode= 0; + } + else if(accentcode) { if(cu->pos>0) { inserted_text[0]= findaccent(ef->textbuf[cu->pos-1], ascii); ef->textbuf[cu->pos-1]= inserted_text[0]; -- cgit v1.2.3 From 2f92b5bc3fa11609e07ba7bc0859275ee3ccf12b Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 20 Oct 2011 11:18:57 +0000 Subject: fixes for unicode input, should work for operator textinput now. --- source/blender/editors/curve/editfont.c | 2 +- source/blender/editors/interface/interface_handlers.c | 4 ++-- source/blender/windowmanager/intern/wm_event_system.c | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/source/blender/editors/curve/editfont.c b/source/blender/editors/curve/editfont.c index dff5be059c3..c80f5c85c25 100644 --- a/source/blender/editors/curve/editfont.c +++ b/source/blender/editors/curve/editfont.c @@ -1289,7 +1289,7 @@ static int insert_text_invoke(bContext *C, wmOperator *op, wmEvent *evt) else if(event==BACKSPACEKEY) ascii= 0; - if(val && ascii) { + if(val && (ascii || evt->utf8_buf[0])) { /* handle case like TAB (== 9) */ if( (ascii > 31 && ascii < 254 && ascii != 127) || (ascii==13) || diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index 1f30f8a5109..c02bbafce15 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -1930,7 +1930,7 @@ static void ui_do_but_textedit(bContext *C, uiBlock *block, uiBut *but, uiHandle break; } - if(event->ascii && (retval == WM_UI_HANDLER_CONTINUE)) { + if((event->ascii || event->utf8_buf[0]) && (retval == WM_UI_HANDLER_CONTINUE)) { char ascii = event->ascii; /* exception that's useful for number buttons, some keyboard @@ -1939,7 +1939,7 @@ static void ui_do_but_textedit(bContext *C, uiBlock *block, uiBut *but, uiHandle if(event->type == PADPERIOD && ascii == ',') ascii = '.'; - if(event->utf8_buf[0] || 1) { + if(event->utf8_buf[0]) { /* keep this printf until utf8 is well tested */ printf("%s: utf8 char '%s'\n", __func__, event->utf8_buf); // strcpy(event->utf8_buf, "12345"); diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c index 7dcb4cf091f..6fd84b4c315 100644 --- a/source/blender/windowmanager/intern/wm_event_system.c +++ b/source/blender/windowmanager/intern/wm_event_system.c @@ -1146,7 +1146,7 @@ static int wm_eventmatch(wmEvent *winevent, wmKeyMapItem *kmi) /* the matching rules */ if(kmitype==KM_TEXTINPUT) - if(ISTEXTINPUT(winevent->type) && winevent->ascii) return 1; + if(ISTEXTINPUT(winevent->type) && (winevent->ascii || winevent->utf8_buf[0])) return 1; if(kmitype!=KM_ANY) if(winevent->type!=kmitype) return 0; -- cgit v1.2.3 From a828845f27557242d59eb881ca2d5a43c8915636 Mon Sep 17 00:00:00 2001 From: Antony Riakiotakis Date: Thu, 20 Oct 2011 12:15:39 +0000 Subject: reverting 41124, maybe better solution is to enforce linear space in generated float images --- .../blender/imbuf/intern/openexr/openexr_api.cpp | 56 ++++++---------------- 1 file changed, 14 insertions(+), 42 deletions(-) diff --git a/source/blender/imbuf/intern/openexr/openexr_api.cpp b/source/blender/imbuf/intern/openexr/openexr_api.cpp index aa7defb2f39..e064d7f760d 100644 --- a/source/blender/imbuf/intern/openexr/openexr_api.cpp +++ b/source/blender/imbuf/intern/openexr/openexr_api.cpp @@ -342,55 +342,27 @@ static int imb_save_openexr_float(struct ImBuf *ibuf, const char *name, int flag FrameBuffer frameBuffer; OutputFile *file = new OutputFile(name, header); - int xstride = sizeof(float) * 4; - int ystride = xstride*width; - float *init_to = new float [4 * width*height * sizeof(float)]; - float *from, *to = init_to; - - frameBuffer.insert ("R", Slice (FLOAT, (char *)init_to, xstride, ystride)); - frameBuffer.insert ("G", Slice (FLOAT, (char *)(init_to + 1), xstride, ystride)); - frameBuffer.insert ("B", Slice (FLOAT, (char *)(init_to + 2), xstride, ystride)); + int xstride = sizeof(float) * channels; + int ystride = - xstride*width; + float *rect[4] = {NULL, NULL, NULL, NULL}; + + /* last scanline, stride negative */ + rect[0]= ibuf->rect_float + channels*(height-1)*width; + rect[1]= rect[0]+1; + rect[2]= rect[0]+2; + rect[3]= (channels >= 4)? rect[0]+3:rect[0]; /* red as alpha, is this needed since alpha isnt written? */ + + frameBuffer.insert ("R", Slice (FLOAT, (char *)rect[0], xstride, ystride)); + frameBuffer.insert ("G", Slice (FLOAT, (char *)rect[1], xstride, ystride)); + frameBuffer.insert ("B", Slice (FLOAT, (char *)rect[2], xstride, ystride)); if (ibuf->depth==32 && channels >= 4) - frameBuffer.insert ("A", Slice (FLOAT, (char *)(init_to + 3), xstride, ystride)); + frameBuffer.insert ("A", Slice (FLOAT, (char *)rect[3], xstride, ystride)); if (write_zbuf) frameBuffer.insert ("Z", Slice (FLOAT, (char *) (ibuf->zbuf_float + (height-1)*width), sizeof(float), sizeof(float) * -width)); - - if(ibuf->profile == IB_PROFILE_LINEAR_RGB) { - for (int i = ibuf->y-1; i >= 0; i--) - { - from= ibuf->rect_float + channels*i*width; - - for (int j = ibuf->x; j > 0; j--) - { - to[0] = from[0]; - to[1] = from[1]; - to[2] = from[2]; - to[3] = (channels >= 4)? from[3]: 1.0f; - to+= 4; from += 4; - } - } - } - else { - for (int i = ibuf->y-1; i >= 0; i--) - { - from= ibuf->rect_float + channels*i*width; - - for (int j = ibuf->x; j > 0; j--) - { - to[0] = srgb_to_linearrgb(from[0]); - to[1] = srgb_to_linearrgb(from[1]); - to[2] = srgb_to_linearrgb(from[2]); - to[3] = (channels >= 4)? from[3]: 1.0f; - to+= 4; from += 4; - } - } - } - file->setFrameBuffer (frameBuffer); file->writePixels (height); delete file; - delete [] init_to; } catch (const std::exception &exc) { -- cgit v1.2.3 From 2bd9519e39f7c383005fd531f4c7dd92cce246ad Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 20 Oct 2011 13:50:24 +0000 Subject: BLI_ghash.h was including BLI_blenlib.h, remove from ghash header and include in each file --- source/blender/blenkernel/intern/BME_conversions.c | 1 + source/blender/blenkernel/intern/BME_eulers.c | 1 + source/blender/blenkernel/intern/BME_mesh.c | 2 +- source/blender/blenkernel/intern/BME_structure.c | 1 + source/blender/blenkernel/intern/depsgraph.c | 1 + source/blender/blenkernel/intern/modifier.c | 3 +++ source/blender/blenkernel/intern/nla.c | 3 +++ source/blender/blenkernel/intern/softbody.c | 1 + source/blender/blenlib/BLI_ghash.h | 7 ------- source/blender/blenlib/intern/BLI_args.c | 4 +++- source/blender/blenlib/intern/BLI_ghash.c | 9 +++++++++ source/blender/blenloader/intern/readblenentry.c | 2 ++ source/blender/editors/interface/interface_templates.c | 1 + source/blender/editors/sculpt_paint/sculpt_undo.c | 2 ++ source/blender/modifiers/intern/MOD_bevel.c | 1 + source/blender/modifiers/intern/MOD_boolean_util.c | 1 + source/blender/modifiers/intern/MOD_mask.c | 2 ++ source/blender/python/intern/bpy_operator.c | 1 + 18 files changed, 34 insertions(+), 9 deletions(-) diff --git a/source/blender/blenkernel/intern/BME_conversions.c b/source/blender/blenkernel/intern/BME_conversions.c index 9a3c9462934..8b5cfe1b882 100644 --- a/source/blender/blenkernel/intern/BME_conversions.c +++ b/source/blender/blenkernel/intern/BME_conversions.c @@ -44,6 +44,7 @@ #include "DNA_scene_types.h" #include "BLI_edgehash.h" +#include "BLI_listbase.h" #include "BLI_utildefines.h" #include "BKE_mesh.h" diff --git a/source/blender/blenkernel/intern/BME_eulers.c b/source/blender/blenkernel/intern/BME_eulers.c index 593f50a65e7..bbd439dcb93 100644 --- a/source/blender/blenkernel/intern/BME_eulers.c +++ b/source/blender/blenkernel/intern/BME_eulers.c @@ -38,6 +38,7 @@ #include "MEM_guardedalloc.h" +#include "BLI_listbase.h" #include "BLI_utildefines.h" #include "bmesh_private.h" diff --git a/source/blender/blenkernel/intern/BME_mesh.c b/source/blender/blenkernel/intern/BME_mesh.c index 62a9601da13..e34f2ee1e50 100644 --- a/source/blender/blenkernel/intern/BME_mesh.c +++ b/source/blender/blenkernel/intern/BME_mesh.c @@ -37,7 +37,7 @@ */ - +#include "BLI_listbase.h" #include "MEM_guardedalloc.h" #include "BKE_bmesh.h" #include "bmesh_private.h" diff --git a/source/blender/blenkernel/intern/BME_structure.c b/source/blender/blenkernel/intern/BME_structure.c index bd5241adb6b..c385ad4fcda 100644 --- a/source/blender/blenkernel/intern/BME_structure.c +++ b/source/blender/blenkernel/intern/BME_structure.c @@ -40,6 +40,7 @@ #include #include "MEM_guardedalloc.h" +#include "BLI_listbase.h" #include "BLI_utildefines.h" #include "BKE_bmesh.h" /** diff --git a/source/blender/blenkernel/intern/depsgraph.c b/source/blender/blenkernel/intern/depsgraph.c index 8d0c20ecc52..d3c5942b685 100644 --- a/source/blender/blenkernel/intern/depsgraph.c +++ b/source/blender/blenkernel/intern/depsgraph.c @@ -38,6 +38,7 @@ #include "BLI_winstuff.h" #include "BLI_utildefines.h" +#include "BLI_listbase.h" #include "BLI_ghash.h" #include "DNA_anim_types.h" diff --git a/source/blender/blenkernel/intern/modifier.c b/source/blender/blenkernel/intern/modifier.c index 2cee9676e5e..edddcb4a6b2 100644 --- a/source/blender/blenkernel/intern/modifier.c +++ b/source/blender/blenkernel/intern/modifier.c @@ -52,6 +52,9 @@ #include "DNA_meshdata_types.h" #include "BLI_utildefines.h" +#include "BLI_path_util.h" +#include "BLI_listbase.h" +#include "BLI_string.h" #include "BKE_bmesh.h" #include "BKE_cloth.h" diff --git a/source/blender/blenkernel/intern/nla.c b/source/blender/blenkernel/intern/nla.c index 97347d85deb..15513675c7a 100644 --- a/source/blender/blenkernel/intern/nla.c +++ b/source/blender/blenkernel/intern/nla.c @@ -42,6 +42,9 @@ #include "MEM_guardedalloc.h" #include "BLI_utildefines.h" +#include "BLI_path_util.h" +#include "BLI_listbase.h" +#include "BLI_string.h" #include "BLI_ghash.h" #include "DNA_anim_types.h" diff --git a/source/blender/blenkernel/intern/softbody.c b/source/blender/blenkernel/intern/softbody.c index 65b4a21d0ee..8787ec07d9c 100644 --- a/source/blender/blenkernel/intern/softbody.c +++ b/source/blender/blenkernel/intern/softbody.c @@ -68,6 +68,7 @@ variables on the UI for now #include "BLI_math.h" #include "BLI_utildefines.h" +#include "BLI_listbase.h" #include "BLI_ghash.h" #include "BLI_threads.h" diff --git a/source/blender/blenlib/BLI_ghash.h b/source/blender/blenlib/BLI_ghash.h index e4afc6ad79b..e4ef834822f 100644 --- a/source/blender/blenlib/BLI_ghash.h +++ b/source/blender/blenlib/BLI_ghash.h @@ -39,13 +39,6 @@ extern "C" { #endif -#include -#include -#include - -#include "BLI_mempool.h" -#include "BLI_blenlib.h" - typedef unsigned int (*GHashHashFP) (const void *key); typedef int (*GHashCmpFP) (const void *a, const void *b); typedef void (*GHashKeyFreeFP) (void *key); diff --git a/source/blender/blenlib/intern/BLI_args.c b/source/blender/blenlib/intern/BLI_args.c index 82891b1e121..00903aa42cd 100644 --- a/source/blender/blenlib/intern/BLI_args.c +++ b/source/blender/blenlib/intern/BLI_args.c @@ -35,11 +35,13 @@ #include /* for tolower */ +#include #include "MEM_guardedalloc.h" -#include "BLI_listbase.h" #include "BLI_utildefines.h" +#include "BLI_listbase.h" +#include "BLI_string.h" #include "BLI_args.h" #include "BLI_ghash.h" diff --git a/source/blender/blenlib/intern/BLI_ghash.c b/source/blender/blenlib/intern/BLI_ghash.c index 03e3b7ab560..e34abaf15f9 100644 --- a/source/blender/blenlib/intern/BLI_ghash.c +++ b/source/blender/blenlib/intern/BLI_ghash.c @@ -32,11 +32,20 @@ * \ingroup bli */ +#include +#include + #include "MEM_guardedalloc.h" + + +// #include "BLI_blenlib.h" + +#include "BLI_mempool.h" #include "BLI_utildefines.h" #include "BLI_ghash.h" + #include "BLO_sys_types.h" // for intptr_t support /***/ diff --git a/source/blender/blenloader/intern/readblenentry.c b/source/blender/blenloader/intern/readblenentry.c index 220784c9ff7..ded5a95df5a 100644 --- a/source/blender/blenloader/intern/readblenentry.c +++ b/source/blender/blenloader/intern/readblenentry.c @@ -44,6 +44,8 @@ #include "MEM_guardedalloc.h" #include "BLI_utildefines.h" +#include "BLI_listbase.h" +#include "BLI_string.h" #include "BLI_ghash.h" #include "BLI_linklist.h" diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c index 0375345afcc..e264146a6e3 100644 --- a/source/blender/editors/interface/interface_templates.c +++ b/source/blender/editors/interface/interface_templates.c @@ -39,6 +39,7 @@ #include "DNA_userdef_types.h" #include "BLI_utildefines.h" +#include "BLI_string.h" #include "BLI_ghash.h" #include "BKE_animsys.h" diff --git a/source/blender/editors/sculpt_paint/sculpt_undo.c b/source/blender/editors/sculpt_paint/sculpt_undo.c index a32487e7117..7656e51d241 100644 --- a/source/blender/editors/sculpt_paint/sculpt_undo.c +++ b/source/blender/editors/sculpt_paint/sculpt_undo.c @@ -39,6 +39,8 @@ #include "BLI_math.h" #include "BLI_utildefines.h" +#include "BLI_string.h" +#include "BLI_listbase.h" #include "BLI_ghash.h" #include "BLI_threads.h" diff --git a/source/blender/modifiers/intern/MOD_bevel.c b/source/blender/modifiers/intern/MOD_bevel.c index 197e6a24342..3397dad2460 100644 --- a/source/blender/modifiers/intern/MOD_bevel.c +++ b/source/blender/modifiers/intern/MOD_bevel.c @@ -37,6 +37,7 @@ #include "MEM_guardedalloc.h" #include "BLI_utildefines.h" +#include "BLI_string.h" #include "BKE_bmesh.h" #include "BKE_cdderivedmesh.h" diff --git a/source/blender/modifiers/intern/MOD_boolean_util.c b/source/blender/modifiers/intern/MOD_boolean_util.c index 9d83e351b2b..01245ca4e01 100644 --- a/source/blender/modifiers/intern/MOD_boolean_util.c +++ b/source/blender/modifiers/intern/MOD_boolean_util.c @@ -43,6 +43,7 @@ #include "BLI_math.h" #include "BLI_utildefines.h" +#include "BLI_listbase.h" #include "BLI_ghash.h" #include "BKE_cdderivedmesh.h" diff --git a/source/blender/modifiers/intern/MOD_mask.c b/source/blender/modifiers/intern/MOD_mask.c index b7cdac9e246..ad1e0806327 100644 --- a/source/blender/modifiers/intern/MOD_mask.c +++ b/source/blender/modifiers/intern/MOD_mask.c @@ -38,6 +38,8 @@ #include "MEM_guardedalloc.h" #include "BLI_utildefines.h" +#include "BLI_listbase.h" +#include "BLI_string.h" #include "BLI_ghash.h" #include "DNA_armature_types.h" diff --git a/source/blender/python/intern/bpy_operator.c b/source/blender/python/intern/bpy_operator.c index b5fd7851458..7e8b9b7b6df 100644 --- a/source/blender/python/intern/bpy_operator.c +++ b/source/blender/python/intern/bpy_operator.c @@ -44,6 +44,7 @@ #include "../generic/bpy_internal_import.h" #include "BLI_utildefines.h" +#include "BLI_string.h" #include "RNA_access.h" #include "RNA_enum_types.h" -- cgit v1.2.3 From 7131b00a431770da69a0dbc32c8616d560360de0 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Thu, 20 Oct 2011 14:54:22 +0000 Subject: Fix missing updates when changing smoke flow settings. --- source/blender/makesrna/intern/rna_smoke.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/source/blender/makesrna/intern/rna_smoke.c b/source/blender/makesrna/intern/rna_smoke.c index 44bdeba3e2e..c40548ade6b 100644 --- a/source/blender/makesrna/intern/rna_smoke.c +++ b/source/blender/makesrna/intern/rna_smoke.c @@ -289,12 +289,14 @@ static void rna_def_smoke_flow_settings(BlenderRNA *brna) RNA_def_property_range(prop, 0.001, 1); RNA_def_property_ui_range(prop, 0.001, 1.0, 1.0, 4); RNA_def_property_ui_text(prop, "Density", ""); + RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Smoke_reset"); prop= RNA_def_property(srna, "temperature", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "temp"); RNA_def_property_range(prop, -10, 10); RNA_def_property_ui_range(prop, -10, 10, 1, 1); RNA_def_property_ui_text(prop, "Temp. Diff.", "Temperature difference to ambient temperature"); + RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Smoke_reset"); prop= RNA_def_property(srna, "particle_system", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "psys"); @@ -306,20 +308,24 @@ static void rna_def_smoke_flow_settings(BlenderRNA *brna) prop= RNA_def_property(srna, "use_outflow", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "type", MOD_SMOKE_FLOW_TYPE_OUTFLOW); RNA_def_property_ui_text(prop, "Outflow", "Delete smoke from simulation"); + RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Smoke_reset"); prop= RNA_def_property(srna, "use_absolute", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_SMOKE_FLOW_ABSOLUTE); RNA_def_property_ui_text(prop, "Absolute Density", "Only allow given density value in emitter area"); + RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Smoke_reset"); prop= RNA_def_property(srna, "initial_velocity", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_SMOKE_FLOW_INITVELOCITY); RNA_def_property_ui_text(prop, "Initial Velocity", "Smoke inherits its velocity from the emitter particle"); + RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Smoke_reset"); prop= RNA_def_property(srna, "velocity_factor", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "vel_multi"); RNA_def_property_range(prop, -2.0, 2.0); RNA_def_property_ui_range(prop, -2.0, 2.0, 0.05, 5); RNA_def_property_ui_text(prop, "Multiplier", "Multiplier to adjust velocity passed to smoke"); + RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Smoke_reset"); } static void rna_def_smoke_coll_settings(BlenderRNA *brna) -- cgit v1.2.3 From 4ea8cb25295d0e61a1fcf1cd16028a3586ed5921 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Thu, 20 Oct 2011 14:55:02 +0000 Subject: Fix missing node editor update when assigning/removing materials on objects. --- source/blender/editors/space_node/space_node.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/source/blender/editors/space_node/space_node.c b/source/blender/editors/space_node/space_node.c index 1047e906a10..1d9723f598b 100644 --- a/source/blender/editors/space_node/space_node.c +++ b/source/blender/editors/space_node/space_node.c @@ -214,6 +214,12 @@ static void node_area_listener(ScrArea *sa, wmNotifier *wmn) ED_area_tag_refresh(sa); } break; + case NC_OBJECT: + if(type==NTREE_SHADER) { + if(wmn->data==ND_OB_SHADING) + ED_area_tag_refresh(sa); + } + break; case NC_TEXT: /* pynodes */ if(wmn->data==ND_SHADING) -- cgit v1.2.3 From f21043f32e2726ff0ee08b19aa8b634eeef7cf3e Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Thu, 20 Oct 2011 14:58:53 +0000 Subject: UI tweak: user texture datablock chooser for fields and warp modifier, more consistent with other places. --- release/scripts/startup/bl_ui/properties_data_modifier.py | 2 +- release/scripts/startup/bl_ui/properties_physics_field.py | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/release/scripts/startup/bl_ui/properties_data_modifier.py b/release/scripts/startup/bl_ui/properties_data_modifier.py index 62261af729f..e4b152834fc 100644 --- a/release/scripts/startup/bl_ui/properties_data_modifier.py +++ b/release/scripts/startup/bl_ui/properties_data_modifier.py @@ -665,7 +665,7 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel): split = layout.split() col = split.column() col.label(text="Texture:") - col.prop(md, "texture", text="") + col.template_ID(md, "texture", new="texture.new") col = split.column() col.label(text="Texture Coordinates:") diff --git a/release/scripts/startup/bl_ui/properties_physics_field.py b/release/scripts/startup/bl_ui/properties_physics_field.py index f0755962580..2229b9dc3da 100644 --- a/release/scripts/startup/bl_ui/properties_physics_field.py +++ b/release/scripts/startup/bl_ui/properties_physics_field.py @@ -61,6 +61,10 @@ class PHYSICS_PT_field(PhysicButtonsPanel, Panel): split = layout.split(percentage=0.2) split.label(text="Shape:") split.prop(field, "shape", text="") + elif field.type == 'TEXTURE': + split = layout.split(percentage=0.2) + split.label(text="Texture:") + split.row().template_ID(field, "texture", new="texture.new") split = layout.split() @@ -103,7 +107,6 @@ class PHYSICS_PT_field(PhysicButtonsPanel, Panel): elif field.type == 'TEXTURE': col = split.column() col.prop(field, "strength") - col.prop(field, "texture", text="") col.prop(field, "texture_mode", text="") col.prop(field, "texture_nabla") -- cgit v1.2.3 From 458394690f7d9a274dbd6e248195894331bb63e0 Mon Sep 17 00:00:00 2001 From: Thomas Dinges Date: Thu, 20 Oct 2011 15:04:48 +0000 Subject: Version cycle: * Bcon1, alpha. --- source/blender/blenkernel/BKE_blender.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/blender/blenkernel/BKE_blender.h b/source/blender/blenkernel/BKE_blender.h index e01586cb7d0..0cad398995a 100644 --- a/source/blender/blenkernel/BKE_blender.h +++ b/source/blender/blenkernel/BKE_blender.h @@ -53,7 +53,7 @@ extern "C" { /* can be left blank, otherwise a,b,c... etc with no quotes */ #define BLENDER_VERSION_CHAR /* alpha/beta/rc/release, docs use this */ -#define BLENDER_VERSION_CYCLE release +#define BLENDER_VERSION_CYCLE alpha struct ListBase; struct MemFile; -- cgit v1.2.3 From aba149189b7f0ee08765d2ef63a94080d02bdbf4 Mon Sep 17 00:00:00 2001 From: "Guillermo S. Romero" Date: Thu, 20 Oct 2011 17:55:50 +0000 Subject: SVN maintenance. --- source/blender/blenlib/BLI_string_utf8.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/blender/blenlib/BLI_string_utf8.h b/source/blender/blenlib/BLI_string_utf8.h index b7a9c204bfe..c3bb81dd03f 100644 --- a/source/blender/blenlib/BLI_string_utf8.h +++ b/source/blender/blenlib/BLI_string_utf8.h @@ -1,5 +1,5 @@ /* - * $Id: + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * -- cgit v1.2.3