diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-10-28 09:17:09 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-10-28 09:17:09 +0400 |
commit | ff837cbe9b2a27678a6111207ce60b64f44d5917 (patch) | |
tree | de1f188ed4d2b0659a8ebecb3a1e8b4792483065 /source | |
parent | c914b11614fff23bca5b601da24f02ab51b9db52 (diff) | |
parent | 4b635d16316d12dd4c57e1dcf99092551e6bbe35 (diff) |
svn merge -r41310:41329 ^/trunk/blender
Diffstat (limited to 'source')
44 files changed, 456 insertions, 454 deletions
diff --git a/source/blender/blenkernel/BKE_image.h b/source/blender/blenkernel/BKE_image.h index c7e269a3b75..adb34f4c501 100644 --- a/source/blender/blenkernel/BKE_image.h +++ b/source/blender/blenkernel/BKE_image.h @@ -58,7 +58,7 @@ int BKE_ftype_to_imtype(int ftype); int BKE_imtype_to_ftype(int imtype); int BKE_imtype_is_movie(int imtype); -struct anim *openanim(char * name, int flags, int streamindex); +struct anim *openanim(const char *name, int flags, int streamindex); void image_de_interlace(struct Image *ima, int odd); diff --git a/source/blender/blenkernel/BKE_library.h b/source/blender/blenkernel/BKE_library.h index 59ced28d53e..e2033915caa 100644 --- a/source/blender/blenkernel/BKE_library.h +++ b/source/blender/blenkernel/BKE_library.h @@ -78,7 +78,7 @@ void rename_id(struct ID *id, const char *name); void name_uiprefix_id(char *name, struct ID *id); void test_idbutton(char *name); void text_idbutton(struct ID *id, char *text); -void all_local(struct Library *lib, int untagged_only); +void BKE_library_make_local(struct Main *bmain, struct Library *lib, int untagged_only); struct ID *find_id(const char *type, const char *name); void clear_id_newpoins(void); diff --git a/source/blender/blenkernel/intern/deform.c b/source/blender/blenkernel/intern/deform.c index 037e63f1d23..429848f3dcb 100644 --- a/source/blender/blenkernel/intern/deform.c +++ b/source/blender/blenkernel/intern/deform.c @@ -42,6 +42,9 @@ #include "BKE_deform.h" #include "BLI_blenlib.h" +#include "BLI_utildefines.h" + + #include "BLI_cellalloc.h" diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c index d88cbc33926..8bce7515695 100644 --- a/source/blender/blenkernel/intern/image.c +++ b/source/blender/blenkernel/intern/image.c @@ -1500,7 +1500,7 @@ void BKE_makepicstring(char *string, const char *base, int frame, int imtype, co } /* used by sequencer too */ -struct anim *openanim(char *name, int flags, int streamindex) +struct anim *openanim(const char *name, int flags, int streamindex) { struct anim *anim; struct ImBuf *ibuf; diff --git a/source/blender/blenkernel/intern/library.c b/source/blender/blenkernel/intern/library.c index 8a557817406..8feec71e36e 100644 --- a/source/blender/blenkernel/intern/library.c +++ b/source/blender/blenkernel/intern/library.c @@ -1277,16 +1277,6 @@ void clear_id_newpoins(void) } } -/* only for library fixes */ -static void image_fix_relative_path(Image *ima) -{ - if(ima->id.lib==NULL) return; - if(strncmp(ima->name, "//", 2)==0) { - BLI_path_abs(ima->name, ima->id.lib->filepath); - BLI_path_rel(ima->name, G.main->name); - } -} - #define LIBTAG(a) if(a && a->id.lib) {a->id.flag &=~LIB_INDIRECT; a->id.flag |= LIB_EXTERN;} static void lib_indirect_test_id(ID *id, Library *lib) @@ -1361,14 +1351,15 @@ void tag_main(struct Main *mainvar, const short tag) } } -/* if lib!=NULL, only all from lib local */ -void all_local(Library *lib, int untagged_only) +/* if lib!=NULL, only all from lib local + * bmain is almost certainly G.main */ +void BKE_library_make_local(Main *bmain, Library *lib, int untagged_only) { ListBase *lbarray[MAX_LIBARRAY], tempbase={NULL, NULL}; ID *id, *idn; int a; - a= set_listbasepointers(G.main, lbarray); + a= set_listbasepointers(bmain, lbarray); while(a--) { id= lbarray[a]->first; @@ -1385,17 +1376,16 @@ void all_local(Library *lib, int untagged_only) (untagged_only==0 || !(id->flag & LIB_PRE_EXISTING))) { if(lib==NULL || id->lib==lib) { - id->flag &= ~(LIB_EXTERN|LIB_INDIRECT|LIB_NEW); - if(id->lib) { - /* relative file patch */ - if(GS(id->name)==ID_IM) - image_fix_relative_path((Image *)id); - - id->lib= NULL; - new_id(lbarray[a], id, NULL); /* new_id only does it with double names */ + id_clear_lib_data(bmain, id); /* sets 'id->flag' */ + + /* why sort alphabetically here but not in + * id_clear_lib_data() ? - campbell */ sort_alpha_id(lbarray[a], id); } + else { + id->flag &= ~(LIB_EXTERN|LIB_INDIRECT|LIB_NEW); + } } } id= idn; @@ -1410,7 +1400,7 @@ void all_local(Library *lib, int untagged_only) } /* patch 3: make sure library data isn't indirect falsely... */ - a= set_listbasepointers(G.main, lbarray); + a= set_listbasepointers(bmain, lbarray); while(a--) { for(id= lbarray[a]->first; id; id=id->next) lib_indirect_test_id(id, lib); diff --git a/source/blender/collada/ArmatureImporter.cpp b/source/blender/collada/ArmatureImporter.cpp index 219cf47d857..7e9634da21d 100644 --- a/source/blender/collada/ArmatureImporter.cpp +++ b/source/blender/collada/ArmatureImporter.cpp @@ -567,7 +567,7 @@ void ArmatureImporter::create_armature_bones(SkinInfo& skin) // is a child of a node (not joint), root should be true since // this is where we build armature bones from -void ArmatureImporter::set_pose ( Object * ob_arm , COLLADAFW::Node * root_node , char *parentname, float parent_mat[][4]) +void ArmatureImporter::set_pose ( Object * ob_arm , COLLADAFW::Node * root_node , const char *parentname, float parent_mat[][4]) { char * bone_name = (char *) bc_get_joint_name ( root_node); float mat[4][4]; diff --git a/source/blender/collada/ArmatureImporter.h b/source/blender/collada/ArmatureImporter.h index cc8c3de57f0..d2e3b8be4f5 100644 --- a/source/blender/collada/ArmatureImporter.h +++ b/source/blender/collada/ArmatureImporter.h @@ -113,7 +113,7 @@ private: void fix_leaf_bones(); - void set_pose ( Object * ob_arm , COLLADAFW::Node * root_node ,char * parentname, float parent_mat[][4]); + void set_pose ( Object * ob_arm , COLLADAFW::Node * root_node , const char *parentname, float parent_mat[][4]); #if 0 diff --git a/source/blender/editors/curve/editfont.c b/source/blender/editors/curve/editfont.c index 14c687cc8b1..909be0504c9 100644 --- a/source/blender/editors/curve/editfont.c +++ b/source/blender/editors/curve/editfont.c @@ -1654,14 +1654,14 @@ static void font_ui_template_init(bContext *C, wmOperator *op) uiIDContextProperty(C, &pprop->ptr, &pprop->prop); } -static int open_cancel(bContext *UNUSED(C), wmOperator *op) +static int font_open_cancel(bContext *UNUSED(C), wmOperator *op) { MEM_freeN(op->customdata); op->customdata= NULL; return OPERATOR_CANCELLED; } -static int open_exec(bContext *C, wmOperator *op) +static int font_open_exec(bContext *C, wmOperator *op) { struct Main *bmain= CTX_data_main(C); VFont *font; @@ -1719,7 +1719,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, "filepath")) - return open_exec(C, op); + return font_open_exec(C, op); RNA_string_set(op->ptr, "filepath", path); WM_event_add_fileselect(C, op); @@ -1734,9 +1734,9 @@ void FONT_OT_open(wmOperatorType *ot) ot->idname= "FONT_OT_open"; /* api callbacks */ - ot->exec= open_exec; + ot->exec= font_open_exec; ot->invoke= open_invoke; - ot->cancel= open_cancel; + ot->cancel= font_open_cancel; /* flags */ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; diff --git a/source/blender/editors/datafiles/CMakeLists.txt b/source/blender/editors/datafiles/CMakeLists.txt index ae24456383b..946e1c66ad7 100644 --- a/source/blender/editors/datafiles/CMakeLists.txt +++ b/source/blender/editors/datafiles/CMakeLists.txt @@ -47,7 +47,7 @@ if(WITH_BLENDER) # images splash.png.c - blenderbuttons.c + blender_icons.png.c # brushes add.png.c diff --git a/source/blender/editors/datafiles/blenderbuttons.c b/source/blender/editors/datafiles/blender_icons.png.c index 243e9838e9e..a53e2813d2e 100644 --- a/source/blender/editors/datafiles/blenderbuttons.c +++ b/source/blender/editors/datafiles/blender_icons.png.c @@ -1,7 +1,7 @@ -/* DataToC output of file <blenderbuttons> */ +/* DataToC output of file <blender_icons_png> */ -int datatoc_blenderbuttons_size= 214916; -char datatoc_blenderbuttons[]= { +int datatoc_blender_icons_png_size= 214916; +char datatoc_blender_icons_png[]= { 137, 80, 78, 71, 13, 10, 26, 10, 0, 0, 0, 13, 73, 72, 68, 82, 0, 0, 2, 90, 0, 0, 2,128, 8, 6, 0, 0, 0, 68,254,214,163, 0, 0, 10, 79,105, 67, 67, 80, 80,104,111,116,111,115,104,111,112, 32, 73, 67, 67, 32,112,114,111,102,105,108,101, 0, 0,120,218,157, 83, diff --git a/source/blender/editors/include/ED_datafiles.h b/source/blender/editors/include/ED_datafiles.h index a31d01358f4..2c4472c4636 100644 --- a/source/blender/editors/include/ED_datafiles.h +++ b/source/blender/editors/include/ED_datafiles.h @@ -36,8 +36,8 @@ extern int datatoc_startup_blend_size; extern char datatoc_startup_blend[]; -extern int datatoc_blenderbuttons_size; -extern char datatoc_blenderbuttons[]; +extern int datatoc_blender_icons_png_size; +extern char datatoc_blender_icons_png[]; extern int datatoc_prvicons_size; extern char datatoc_prvicons[]; diff --git a/source/blender/editors/interface/interface_icons.c b/source/blender/editors/interface/interface_icons.c index b35e20bfe31..089458f1da4 100644 --- a/source/blender/editors/interface/interface_icons.c +++ b/source/blender/editors/interface/interface_icons.c @@ -527,7 +527,7 @@ static void init_internal_icons(void) } } if(bbuf==NULL) - bbuf = IMB_ibImageFromMemory((unsigned char*)datatoc_blenderbuttons, datatoc_blenderbuttons_size, IB_rect, "<blender icons>"); + bbuf = IMB_ibImageFromMemory((unsigned char*)datatoc_blender_icons_png, datatoc_blender_icons_png_size, IB_rect, "<blender icons>"); if(bbuf) { /* free existing texture if any */ diff --git a/source/blender/editors/metaball/mball_edit.c b/source/blender/editors/metaball/mball_edit.c index 84a466a3d5b..f378fac6ac7 100644 --- a/source/blender/editors/metaball/mball_edit.c +++ b/source/blender/editors/metaball/mball_edit.c @@ -121,7 +121,7 @@ MetaElem *add_metaball_primitive(bContext *C, float mat[4][4], int type, int UNU /***************************** Select/Deselect operator *****************************/ /* Select or deselect all MetaElements */ -static int select_all_exec(bContext *C, wmOperator *op) +static int mball_select_all_exec(bContext *C, wmOperator *op) { //Scene *scene= CTX_data_scene(C); Object *obedit= CTX_data_edit_object(C); @@ -171,7 +171,7 @@ void MBALL_OT_select_all(wmOperatorType *ot) ot->idname= "MBALL_OT_select_all"; /* callback functions */ - ot->exec= select_all_exec; + ot->exec= mball_select_all_exec; ot->poll= ED_operator_editmball; /* flags */ diff --git a/source/blender/editors/object/object_lattice.c b/source/blender/editors/object/object_lattice.c index 2dc321d482a..c1ba0b207cb 100644 --- a/source/blender/editors/object/object_lattice.c +++ b/source/blender/editors/object/object_lattice.c @@ -186,7 +186,7 @@ void ED_setflagsLatt(Object *obedit, int flag) } } -static int select_all_exec(bContext *C, wmOperator *op) +static int lattice_select_all_exec(bContext *C, wmOperator *op) { Object *obedit= CTX_data_edit_object(C); Lattice *lt= obedit->data; @@ -244,7 +244,7 @@ void LATTICE_OT_select_all(wmOperatorType *ot) ot->idname= "LATTICE_OT_select_all"; /* api callbacks */ - ot->exec= select_all_exec; + ot->exec= lattice_select_all_exec; ot->poll= ED_operator_editlattice; /* flags */ diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c index 78c2b3ad01e..84d92318a8f 100644 --- a/source/blender/editors/object/object_relations.c +++ b/source/blender/editors/object/object_relations.c @@ -1713,6 +1713,7 @@ static void make_local_makelocalmaterial(Material *ma) static int make_local_exec(bContext *C, wmOperator *op) { + Main *bmain= CTX_data_main(C); AnimData *adt; ParticleSystem *psys; Material *ma, ***matarar; @@ -1721,7 +1722,7 @@ static int make_local_exec(bContext *C, wmOperator *op) int a, b, mode= RNA_enum_get(op->ptr, "type"); if(mode==3) { - all_local(NULL, 0); /* NULL is all libs */ + BKE_library_make_local(bmain, NULL, 0); /* NULL is all libs */ WM_event_add_notifier(C, NC_WINDOW, NULL); return OPERATOR_FINISHED; } diff --git a/source/blender/editors/physics/particle_edit.c b/source/blender/editors/physics/particle_edit.c index fe253df8f85..18185feb3d3 100644 --- a/source/blender/editors/physics/particle_edit.c +++ b/source/blender/editors/physics/particle_edit.c @@ -1296,7 +1296,7 @@ static void toggle_key_select(PEData *data, int point_index, int key_index) /************************ de select all operator ************************/ -static int select_all_exec(bContext *C, wmOperator *op) +static int pe_select_all_exec(bContext *C, wmOperator *op) { Scene *scene= CTX_data_scene(C); Object *ob= CTX_data_active_object(C); @@ -1358,7 +1358,7 @@ void PARTICLE_OT_select_all(wmOperatorType *ot) ot->idname= "PARTICLE_OT_select_all"; /* api callbacks */ - ot->exec= select_all_exec; + ot->exec= pe_select_all_exec; ot->poll= PE_poll; /* flags */ diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c index 1d2bab1862a..ee3b2620432 100644 --- a/source/blender/editors/sculpt_paint/paint_image.c +++ b/source/blender/editors/sculpt_paint/paint_image.c @@ -5607,7 +5607,7 @@ static int texture_paint_image_from_view_exec(bContext *C, wmOperator *op) if(h > maxsize) h= maxsize; ibuf= ED_view3d_draw_offscreen_imbuf(CTX_data_scene(C), CTX_wm_view3d(C), CTX_wm_region(C), w, h, IB_rect, err_out); - if(!ibuf) { + if(!ibuf || 1) { /* Mostly happens when OpenGL offscreen buffer was failed to create, */ /* but could be other reasons. Should be handled in the future. nazgul */ BKE_reportf(op->reports, RPT_ERROR, "Failed to create OpenGL offscreen buffer: %s", err_out); diff --git a/source/blender/editors/sound/sound_ops.c b/source/blender/editors/sound/sound_ops.c index d8157743438..623cfc48827 100644 --- a/source/blender/editors/sound/sound_ops.c +++ b/source/blender/editors/sound/sound_ops.c @@ -77,14 +77,14 @@ /******************** open sound operator ********************/ -static int open_cancel(bContext *UNUSED(C), wmOperator *op) +static int sound_open_cancel(bContext *UNUSED(C), wmOperator *op) { MEM_freeN(op->customdata); op->customdata= NULL; return OPERATOR_CANCELLED; } -static void open_init(bContext *C, wmOperator *op) +static void sound_open_init(bContext *C, wmOperator *op) { PropertyPointerRNA *pprop; @@ -93,7 +93,7 @@ static void open_init(bContext *C, wmOperator *op) } #ifdef WITH_AUDASPACE -static int open_exec(bContext *C, wmOperator *op) +static int sound_open_exec(bContext *C, wmOperator *op) { char path[FILE_MAX]; bSound *sound; @@ -106,7 +106,7 @@ static int open_exec(bContext *C, wmOperator *op) sound = sound_new_file(bmain, path); if(!op->customdata) - open_init(C, op); + sound_open_init(C, op); if (sound==NULL || sound->playback_handle == NULL) { if(op->customdata) MEM_freeN(op->customdata); @@ -151,7 +151,7 @@ static int open_exec(bContext *C, wmOperator *op) #else //WITH_AUDASPACE -static int open_exec(bContext *UNUSED(C), wmOperator *op) +static int sound_open_exec(bContext *UNUSED(C), wmOperator *op) { BKE_report(op->reports, RPT_ERROR, "Compiled without sound support"); @@ -160,12 +160,12 @@ static int open_exec(bContext *UNUSED(C), wmOperator *op) #endif -static int open_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int sound_open_invoke(bContext *C, wmOperator *op, wmEvent *event) { if(RNA_property_is_set(op->ptr, "filepath")) - return open_exec(C, op); + return sound_open_exec(C, op); - open_init(C, op); + sound_open_init(C, op); return WM_operator_filesel(C, op, event); } @@ -178,9 +178,9 @@ static void SOUND_OT_open(wmOperatorType *ot) ot->idname= "SOUND_OT_open"; /* api callbacks */ - ot->exec= open_exec; - ot->invoke= open_invoke; - ot->cancel= open_cancel; + ot->exec= sound_open_exec; + ot->invoke= sound_open_invoke; + ot->cancel= sound_open_cancel; /* flags */ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; @@ -199,9 +199,9 @@ static void SOUND_OT_open_mono(wmOperatorType *ot) ot->idname= "SOUND_OT_open_mono"; /* api callbacks */ - ot->exec= open_exec; - ot->invoke= open_invoke; - ot->cancel= open_cancel; + ot->exec= sound_open_exec; + ot->invoke= sound_open_invoke; + ot->cancel= sound_open_cancel; /* flags */ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; @@ -214,7 +214,7 @@ static void SOUND_OT_open_mono(wmOperatorType *ot) /******************** mixdown operator ********************/ -static int mixdown_exec(bContext *C, wmOperator *op) +static int sound_mixdown_exec(bContext *C, wmOperator *op) { #ifdef WITH_AUDASPACE char path[FILE_MAX]; @@ -257,15 +257,15 @@ static int mixdown_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int mixdown_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int sound_mixdown_invoke(bContext *C, wmOperator *op, wmEvent *event) { if(RNA_property_is_set(op->ptr, "filepath")) - return mixdown_exec(C, op); + return sound_mixdown_exec(C, op); return WM_operator_filesel(C, op, event); } -static int mixdown_draw_check_prop(PropertyRNA *prop) +static int sound_mixdown_draw_check_prop(PropertyRNA *prop) { const char *prop_id= RNA_property_identifier(prop); return !( strcmp(prop_id, "filepath") == 0 || @@ -275,7 +275,7 @@ static int mixdown_draw_check_prop(PropertyRNA *prop) } #ifdef WITH_AUDASPACE -static void mixdown_draw(bContext *C, wmOperator *op) +static void sound_mixdown_draw(bContext *C, wmOperator *op) { static EnumPropertyItem pcm_format_items[] = { {AUD_FORMAT_U8, "U8", 0, "U8", "8 bit unsigned"}, @@ -424,7 +424,7 @@ static void mixdown_draw(bContext *C, wmOperator *op) RNA_pointer_create(&wm->id, op->type->srna, op->properties, &ptr); /* main draw call */ - uiDefAutoButsRNA(layout, &ptr, mixdown_draw_check_prop, '\0'); + uiDefAutoButsRNA(layout, &ptr, sound_mixdown_draw_check_prop, '\0'); } #endif // WITH_AUDASPACE @@ -476,11 +476,11 @@ static void SOUND_OT_mixdown(wmOperatorType *ot) ot->idname= "SOUND_OT_mixdown"; /* api callbacks */ - ot->exec= mixdown_exec; - ot->invoke= mixdown_invoke; + ot->exec= sound_mixdown_exec; + ot->invoke= sound_mixdown_invoke; #ifdef WITH_AUDASPACE - ot->ui= mixdown_draw; + ot->ui= sound_mixdown_draw; #endif /* flags */ ot->flag= OPTYPE_REGISTER; @@ -509,7 +509,7 @@ static int sound_poll(bContext *C) } /********************* pack operator *********************/ -static int pack_exec(bContext *C, wmOperator *op) +static int sound_pack_exec(bContext *C, wmOperator *op) { Main *bmain= CTX_data_main(C); Editing* ed = CTX_data_scene(C)->ed; @@ -537,7 +537,7 @@ static void SOUND_OT_pack(wmOperatorType *ot) ot->idname= "SOUND_OT_pack"; /* api callbacks */ - ot->exec= pack_exec; + ot->exec= sound_pack_exec; ot->poll= sound_poll; /* flags */ @@ -615,7 +615,7 @@ static void SOUND_OT_unpack(wmOperatorType *ot) /* ******************************************************* */ -static int update_animation_flags_exec(bContext *C, wmOperator *UNUSED(op)) +static int sound_update_animation_flags_exec(bContext *C, wmOperator *UNUSED(op)) { Sequence* seq; Scene* scene = CTX_data_scene(C); @@ -667,7 +667,7 @@ static void SOUND_OT_update_animation_flags(wmOperatorType *ot) ot->idname= "SOUND_OT_update_animation_flags"; /* api callbacks */ - ot->exec= update_animation_flags_exec; + ot->exec= sound_update_animation_flags_exec; /* flags */ ot->flag= OPTYPE_REGISTER; @@ -675,14 +675,14 @@ static void SOUND_OT_update_animation_flags(wmOperatorType *ot) /* ******************************************************* */ -static int bake_animation_exec(bContext *C, wmOperator *UNUSED(op)) +static int sound_bake_animation_exec(bContext *C, wmOperator *UNUSED(op)) { Main* bmain = CTX_data_main(C); Scene* scene = CTX_data_scene(C); int oldfra = scene->r.cfra; int cfra; - update_animation_flags_exec(C, NULL); + sound_update_animation_flags_exec(C, NULL); for(cfra = scene->r.sfra > 0 ? scene->r.sfra - 1 : 0; cfra <= scene->r.efra + 1; cfra++) { @@ -704,7 +704,7 @@ static void SOUND_OT_bake_animation(wmOperatorType *ot) ot->idname= "SOUND_OT_bake_animation"; /* api callbacks */ - ot->exec= bake_animation_exec; + ot->exec= sound_bake_animation_exec; /* flags */ ot->flag= OPTYPE_REGISTER; diff --git a/source/blender/editors/space_console/console_ops.c b/source/blender/editors/space_console/console_ops.c index 9ac9f730fdc..23316616a57 100644 --- a/source/blender/editors/space_console/console_ops.c +++ b/source/blender/editors/space_console/console_ops.c @@ -282,7 +282,7 @@ static int console_line_insert(ConsoleLine *ci, char *str) /* static funcs for text editing */ /* similar to the text editor, with some not used. keep compatible */ -static EnumPropertyItem move_type_items[]= { +static EnumPropertyItem console_move_type_items[]= { {LINE_BEGIN, "LINE_BEGIN", 0, "Line Begin", ""}, {LINE_END, "LINE_END", 0, "Line End", ""}, {PREV_CHAR, "PREVIOUS_CHARACTER", 0, "Previous Character", ""}, @@ -291,7 +291,7 @@ static EnumPropertyItem move_type_items[]= { {NEXT_WORD, "NEXT_WORD", 0, "Next Word", ""}, {0, NULL, 0, NULL, NULL}}; -static int move_exec(bContext *C, wmOperator *op) +static int console_move_exec(bContext *C, wmOperator *op) { ConsoleLine *ci= console_history_verify(C); @@ -364,15 +364,15 @@ void CONSOLE_OT_move(wmOperatorType *ot) ot->idname= "CONSOLE_OT_move"; /* api callbacks */ - ot->exec= move_exec; + ot->exec= console_move_exec; ot->poll= ED_operator_console_active; /* properties */ - RNA_def_enum(ot->srna, "type", move_type_items, LINE_BEGIN, "Type", "Where to move cursor to"); + RNA_def_enum(ot->srna, "type", console_move_type_items, LINE_BEGIN, "Type", "Where to move cursor to"); } #define TAB_LENGTH 4 -static int insert_exec(bContext *C, wmOperator *op) +static int console_insert_exec(bContext *C, wmOperator *op) { SpaceConsole *sc= CTX_wm_space_console(C); ARegion *ar= CTX_wm_region(C); @@ -408,7 +408,7 @@ static int insert_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int insert_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int console_insert_invoke(bContext *C, wmOperator *op, wmEvent *event) { // if(!RNA_property_is_set(op->ptr, "text")) { /* always set from keymap XXX */ if(!RNA_string_length(op->ptr, "text")) { @@ -424,7 +424,7 @@ static int insert_invoke(bContext *C, wmOperator *op, wmEvent *event) RNA_string_set(op->ptr, "text", str); } } - return insert_exec(C, op); + return console_insert_exec(C, op); } void CONSOLE_OT_insert(wmOperatorType *ot) @@ -435,8 +435,8 @@ void CONSOLE_OT_insert(wmOperatorType *ot) ot->idname= "CONSOLE_OT_insert"; /* api callbacks */ - ot->exec= insert_exec; - ot->invoke= insert_invoke; + ot->exec= console_insert_exec; + ot->invoke= console_insert_invoke; ot->poll= ED_operator_console_active; /* properties */ @@ -444,14 +444,14 @@ void CONSOLE_OT_insert(wmOperatorType *ot) } -static EnumPropertyItem delete_type_items[]= { +static EnumPropertyItem console_delete_type_items[]= { {DEL_NEXT_CHAR, "NEXT_CHARACTER", 0, "Next Character", ""}, {DEL_PREV_CHAR, "PREVIOUS_CHARACTER", 0, "Previous Character", ""}, // {DEL_NEXT_WORD, "NEXT_WORD", 0, "Next Word", ""}, // {DEL_PREV_WORD, "PREVIOUS_WORD", 0, "Previous Word", ""}, {0, NULL, 0, NULL, NULL}}; -static int delete_exec(bContext *C, wmOperator *op) +static int console_delete_exec(bContext *C, wmOperator *op) { SpaceConsole *sc= CTX_wm_space_console(C); ARegion *ar= CTX_wm_region(C); @@ -506,16 +506,16 @@ void CONSOLE_OT_delete(wmOperatorType *ot) ot->idname= "CONSOLE_OT_delete"; /* api callbacks */ - ot->exec= delete_exec; + ot->exec= console_delete_exec; ot->poll= ED_operator_console_active; /* properties */ - RNA_def_enum(ot->srna, "type", delete_type_items, DEL_NEXT_CHAR, "Type", "Which part of the text to delete"); + RNA_def_enum(ot->srna, "type", console_delete_type_items, DEL_NEXT_CHAR, "Type", "Which part of the text to delete"); } /* the python exec operator uses this */ -static int clear_exec(bContext *C, wmOperator *op) +static int console_clear_exec(bContext *C, wmOperator *op) { SpaceConsole *sc= CTX_wm_space_console(C); ARegion *ar= CTX_wm_region(C); @@ -549,7 +549,7 @@ void CONSOLE_OT_clear(wmOperatorType *ot) ot->idname= "CONSOLE_OT_clear"; /* api callbacks */ - ot->exec= clear_exec; + ot->exec= console_clear_exec; ot->poll= ED_operator_console_active; /* properties */ @@ -560,7 +560,7 @@ void CONSOLE_OT_clear(wmOperatorType *ot) /* the python exec operator uses this */ -static int history_cycle_exec(bContext *C, wmOperator *op) +static int console_history_cycle_exec(bContext *C, wmOperator *op) { SpaceConsole *sc= CTX_wm_space_console(C); ARegion *ar= CTX_wm_region(C); @@ -617,7 +617,7 @@ void CONSOLE_OT_history_cycle(wmOperatorType *ot) ot->idname= "CONSOLE_OT_history_cycle"; /* api callbacks */ - ot->exec= history_cycle_exec; + ot->exec= console_history_cycle_exec; ot->poll= ED_operator_console_active; /* properties */ @@ -626,7 +626,7 @@ void CONSOLE_OT_history_cycle(wmOperatorType *ot) /* the python exec operator uses this */ -static int history_append_exec(bContext *C, wmOperator *op) +static int console_history_append_exec(bContext *C, wmOperator *op) { SpaceConsole *sc= CTX_wm_space_console(C); ARegion *ar= CTX_wm_region(C); @@ -668,7 +668,7 @@ void CONSOLE_OT_history_append(wmOperatorType *ot) ot->idname= "CONSOLE_OT_history_append"; /* api callbacks */ - ot->exec= history_append_exec; + ot->exec= console_history_append_exec; ot->poll= ED_operator_console_active; /* properties */ @@ -679,7 +679,7 @@ void CONSOLE_OT_history_append(wmOperatorType *ot) /* the python exec operator uses this */ -static int scrollback_append_exec(bContext *C, wmOperator *op) +static int console_scrollback_append_exec(bContext *C, wmOperator *op) { SpaceConsole *sc= CTX_wm_space_console(C); ARegion *ar= CTX_wm_region(C); @@ -722,7 +722,7 @@ void CONSOLE_OT_scrollback_append(wmOperatorType *ot) ot->idname= "CONSOLE_OT_scrollback_append"; /* api callbacks */ - ot->exec= scrollback_append_exec; + ot->exec= console_scrollback_append_exec; ot->poll= ED_operator_console_active; /* properties */ @@ -731,7 +731,7 @@ void CONSOLE_OT_scrollback_append(wmOperatorType *ot) } -static int copy_exec(bContext *C, wmOperator *UNUSED(op)) +static int console_copy_exec(bContext *C, wmOperator *UNUSED(op)) { SpaceConsole *sc= CTX_wm_space_console(C); @@ -806,12 +806,12 @@ void CONSOLE_OT_copy(wmOperatorType *ot) /* api callbacks */ ot->poll= ED_operator_console_active; - ot->exec= copy_exec; + ot->exec= console_copy_exec; /* properties */ } -static int paste_exec(bContext *C, wmOperator *UNUSED(op)) +static int console_paste_exec(bContext *C, wmOperator *UNUSED(op)) { SpaceConsole *sc= CTX_wm_space_console(C); ARegion *ar= CTX_wm_region(C); @@ -859,7 +859,7 @@ void CONSOLE_OT_paste(wmOperatorType *ot) /* api callbacks */ ot->poll= ED_operator_console_active; - ot->exec= paste_exec; + ot->exec= console_paste_exec; /* properties */ } @@ -870,7 +870,7 @@ typedef struct SetConsoleCursor { } SetConsoleCursor; // TODO, cursor placement without selection -static void set_cursor_to_pos(SpaceConsole *sc, ARegion *ar, SetConsoleCursor *scu, int mval[2], int UNUSED(sel)) +static void console_cursor_set_to_pos(SpaceConsole *sc, ARegion *ar, SetConsoleCursor *scu, int mval[2], int UNUSED(sel)) { int pos; pos= console_char_pick(sc, ar, mval); @@ -908,7 +908,7 @@ static void console_modal_select_apply(bContext *C, wmOperator *op, wmEvent *eve sel_prev[0]= sc->sel_start; sel_prev[1]= sc->sel_end; - set_cursor_to_pos(sc, ar, scu, mval, TRUE); + console_cursor_set_to_pos(sc, ar, scu, mval, TRUE); /* only redraw if the selection changed */ if(sel_prev[0] != sc->sel_start || sel_prev[1] != sc->sel_end) { @@ -916,7 +916,7 @@ static void console_modal_select_apply(bContext *C, wmOperator *op, wmEvent *eve } } -static void set_cursor_exit(bContext *UNUSED(C), wmOperator *op) +static void console_cursor_set_exit(bContext *UNUSED(C), wmOperator *op) { // SpaceConsole *sc= CTX_wm_space_console(C); SetConsoleCursor *scu= op->customdata; @@ -958,7 +958,7 @@ static int console_modal_select(bContext *C, wmOperator *op, wmEvent *event) case LEFTMOUSE: case MIDDLEMOUSE: case RIGHTMOUSE: - set_cursor_exit(C, op); + console_cursor_set_exit(C, op); return OPERATOR_FINISHED; case MOUSEMOVE: console_modal_select_apply(C, op, event); @@ -970,7 +970,7 @@ static int console_modal_select(bContext *C, wmOperator *op, wmEvent *event) static int console_modal_select_cancel(bContext *C, wmOperator *op) { - set_cursor_exit(C, op); + console_cursor_set_exit(C, op); return OPERATOR_FINISHED; } diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c index f5164dc32d3..c83baf24c1c 100644 --- a/source/blender/editors/space_image/image_ops.c +++ b/source/blender/editors/space_image/image_ops.c @@ -134,18 +134,27 @@ static int space_image_file_exists_poll(bContext *C) SpaceImage *sima= CTX_wm_space_image(C); ImBuf *ibuf; void *lock; - int poll= 0; + int ret= FALSE; char name[FILE_MAX]; ibuf= ED_space_image_acquire_buffer(sima, &lock); if(ibuf) { BLI_strncpy(name, ibuf->name, FILE_MAX); BLI_path_abs(name, bmain->name); - poll= (BLI_exists(name) && BLI_file_is_writable(name)); + + if(BLI_exists(name) == FALSE) { + CTX_wm_operator_poll_msg_set(C, "image file not found"); + } + else if (BLI_file_is_writable(name) == FALSE) { + CTX_wm_operator_poll_msg_set(C, "image path can't be written to"); + } + else { + ret= TRUE; + } } ED_space_image_release_buffer(sima, lock); - return poll; + return ret; } return 0; } @@ -177,7 +186,7 @@ typedef struct ViewPanData { int event_type; } ViewPanData; -static void view_pan_init(bContext *C, wmOperator *op, wmEvent *event) +static void image_view_pan_init(bContext *C, wmOperator *op, wmEvent *event) { SpaceImage *sima= CTX_wm_space_image(C); ViewPanData *vpd; @@ -194,7 +203,7 @@ static void view_pan_init(bContext *C, wmOperator *op, wmEvent *event) WM_event_add_modal_handler(C, op); } -static void view_pan_exit(bContext *C, wmOperator *op, int cancel) +static void image_view_pan_exit(bContext *C, wmOperator *op, int cancel) { SpaceImage *sima= CTX_wm_space_image(C); ViewPanData *vpd= op->customdata; @@ -209,7 +218,7 @@ static void view_pan_exit(bContext *C, wmOperator *op, int cancel) MEM_freeN(op->customdata); } -static int view_pan_exec(bContext *C, wmOperator *op) +static int image_view_pan_exec(bContext *C, wmOperator *op) { SpaceImage *sima= CTX_wm_space_image(C); float offset[2]; @@ -232,7 +241,7 @@ static int view_pan_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int view_pan_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int image_view_pan_invoke(bContext *C, wmOperator *op, wmEvent *event) { if (event->type == MOUSEPAN) { SpaceImage *sima= CTX_wm_space_image(C); @@ -242,16 +251,16 @@ static int view_pan_invoke(bContext *C, wmOperator *op, wmEvent *event) offset[1]= (event->y - event->prevy)/sima->zoom; RNA_float_set_array(op->ptr, "offset", offset); - view_pan_exec(C, op); + image_view_pan_exec(C, op); return OPERATOR_FINISHED; } else { - view_pan_init(C, op, event); + image_view_pan_init(C, op, event); return OPERATOR_RUNNING_MODAL; } } -static int view_pan_modal(bContext *C, wmOperator *op, wmEvent *event) +static int image_view_pan_modal(bContext *C, wmOperator *op, wmEvent *event) { SpaceImage *sima= CTX_wm_space_image(C); ViewPanData *vpd= op->customdata; @@ -264,11 +273,11 @@ static int view_pan_modal(bContext *C, wmOperator *op, wmEvent *event) offset[0]= (vpd->x - event->x)/sima->zoom; offset[1]= (vpd->y - event->y)/sima->zoom; RNA_float_set_array(op->ptr, "offset", offset); - view_pan_exec(C, op); + image_view_pan_exec(C, op); break; default: if(event->type==vpd->event_type && event->val==KM_RELEASE) { - view_pan_exit(C, op, 0); + image_view_pan_exit(C, op, 0); return OPERATOR_FINISHED; } break; @@ -277,9 +286,9 @@ static int view_pan_modal(bContext *C, wmOperator *op, wmEvent *event) return OPERATOR_RUNNING_MODAL; } -static int view_pan_cancel(bContext *C, wmOperator *op) +static int image_view_pan_cancel(bContext *C, wmOperator *op) { - view_pan_exit(C, op, 1); + image_view_pan_exit(C, op, 1); return OPERATOR_CANCELLED; } @@ -290,10 +299,10 @@ void IMAGE_OT_view_pan(wmOperatorType *ot) ot->idname= "IMAGE_OT_view_pan"; /* api callbacks */ - ot->exec= view_pan_exec; - ot->invoke= view_pan_invoke; - ot->modal= view_pan_modal; - ot->cancel= view_pan_cancel; + ot->exec= image_view_pan_exec; + ot->invoke= image_view_pan_invoke; + ot->modal= image_view_pan_modal; + ot->cancel= image_view_pan_cancel; ot->poll= space_image_main_area_poll; /* flags */ @@ -312,7 +321,7 @@ typedef struct ViewZoomData { int event_type; } ViewZoomData; -static void view_zoom_init(bContext *C, wmOperator *op, wmEvent *event) +static void image_view_zoom_init(bContext *C, wmOperator *op, wmEvent *event) { SpaceImage *sima= CTX_wm_space_image(C); ViewZoomData *vpd; @@ -328,7 +337,7 @@ static void view_zoom_init(bContext *C, wmOperator *op, wmEvent *event) WM_event_add_modal_handler(C, op); } -static void view_zoom_exit(bContext *C, wmOperator *op, int cancel) +static void image_view_zoom_exit(bContext *C, wmOperator *op, int cancel) { SpaceImage *sima= CTX_wm_space_image(C); ViewZoomData *vpd= op->customdata; @@ -342,7 +351,7 @@ static void view_zoom_exit(bContext *C, wmOperator *op, int cancel) MEM_freeN(op->customdata); } -static int view_zoom_exec(bContext *C, wmOperator *op) +static int image_view_zoom_exec(bContext *C, wmOperator *op) { SpaceImage *sima= CTX_wm_space_image(C); ARegion *ar= CTX_wm_region(C); @@ -363,7 +372,7 @@ static int view_zoom_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int view_zoom_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int image_view_zoom_invoke(bContext *C, wmOperator *op, wmEvent *event) { if (event->type == MOUSEZOOM) { SpaceImage *sima= CTX_wm_space_image(C); @@ -378,12 +387,12 @@ static int view_zoom_invoke(bContext *C, wmOperator *op, wmEvent *event) return OPERATOR_FINISHED; } else { - view_zoom_init(C, op, event); + image_view_zoom_init(C, op, event); return OPERATOR_RUNNING_MODAL; } } -static int view_zoom_modal(bContext *C, wmOperator *op, wmEvent *event) +static int image_view_zoom_modal(bContext *C, wmOperator *op, wmEvent *event) { SpaceImage *sima= CTX_wm_space_image(C); ARegion *ar= CTX_wm_region(C); @@ -399,7 +408,7 @@ static int view_zoom_modal(bContext *C, wmOperator *op, wmEvent *event) break; default: if(event->type==vpd->event_type && event->val==KM_RELEASE) { - view_zoom_exit(C, op, 0); + image_view_zoom_exit(C, op, 0); return OPERATOR_FINISHED; } break; @@ -408,9 +417,9 @@ static int view_zoom_modal(bContext *C, wmOperator *op, wmEvent *event) return OPERATOR_RUNNING_MODAL; } -static int view_zoom_cancel(bContext *C, wmOperator *op) +static int image_view_zoom_cancel(bContext *C, wmOperator *op) { - view_zoom_exit(C, op, 1); + image_view_zoom_exit(C, op, 1); return OPERATOR_CANCELLED; } @@ -421,10 +430,10 @@ void IMAGE_OT_view_zoom(wmOperatorType *ot) ot->idname= "IMAGE_OT_view_zoom"; /* api callbacks */ - ot->exec= view_zoom_exec; - ot->invoke= view_zoom_invoke; - ot->modal= view_zoom_modal; - ot->cancel= view_zoom_cancel; + ot->exec= image_view_zoom_exec; + ot->invoke= image_view_zoom_invoke; + ot->modal= image_view_zoom_modal; + ot->cancel= image_view_zoom_cancel; ot->poll= space_image_main_area_poll; /* flags */ @@ -443,7 +452,7 @@ void IMAGE_OT_view_zoom(wmOperatorType *ot) * that explains the negative signs in the code below */ -static int view_ndof_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *event) +static int image_view_ndof_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *event) { if (event->type != NDOF_MOTION) return OPERATOR_CANCELLED; @@ -489,7 +498,7 @@ void IMAGE_OT_view_ndof(wmOperatorType *ot) ot->idname= "IMAGE_OT_view_ndof"; /* api callbacks */ - ot->invoke= view_ndof_invoke; + ot->invoke= image_view_ndof_invoke; } /********************** view all operator *********************/ @@ -498,7 +507,7 @@ void IMAGE_OT_view_ndof(wmOperatorType *ot) * Default behavior is to reset the position of the image and set the zoom to 1 * If the image will not fit within the window rectangle, the zoom is adjusted */ -static int view_all_exec(bContext *C, wmOperator *UNUSED(op)) +static int image_view_all_exec(bContext *C, wmOperator *UNUSED(op)) { SpaceImage *sima; ARegion *ar; @@ -542,13 +551,13 @@ void IMAGE_OT_view_all(wmOperatorType *ot) ot->idname= "IMAGE_OT_view_all"; /* api callbacks */ - ot->exec= view_all_exec; + ot->exec= image_view_all_exec; ot->poll= space_image_main_area_poll; } /********************** view selected operator *********************/ -static int view_selected_exec(bContext *C, wmOperator *UNUSED(op)) +static int image_view_selected_exec(bContext *C, wmOperator *UNUSED(op)) { SpaceImage *sima; ARegion *ar; @@ -591,7 +600,7 @@ static int view_selected_exec(bContext *C, wmOperator *UNUSED(op)) return OPERATOR_FINISHED; } -static int view_selected_poll(bContext *C) +static int image_view_selected_poll(bContext *C) { return (space_image_main_area_poll(C) && ED_operator_uvedit(C)); } @@ -603,13 +612,13 @@ void IMAGE_OT_view_selected(wmOperatorType *ot) ot->idname= "IMAGE_OT_view_selected"; /* api callbacks */ - ot->exec= view_selected_exec; - ot->poll= view_selected_poll; + ot->exec= image_view_selected_exec; + ot->poll= image_view_selected_poll; } /********************** view zoom in/out operator *********************/ -static int view_zoom_in_exec(bContext *C, wmOperator *UNUSED(op)) +static int image_view_zoom_in_exec(bContext *C, wmOperator *UNUSED(op)) { SpaceImage *sima= CTX_wm_space_image(C); ARegion *ar= CTX_wm_region(C); @@ -628,11 +637,11 @@ void IMAGE_OT_view_zoom_in(wmOperatorType *ot) ot->idname= "IMAGE_OT_view_zoom_in"; /* api callbacks */ - ot->exec= view_zoom_in_exec; + ot->exec= image_view_zoom_in_exec; ot->poll= space_image_main_area_poll; } -static int view_zoom_out_exec(bContext *C, wmOperator *UNUSED(op)) +static int image_view_zoom_out_exec(bContext *C, wmOperator *UNUSED(op)) { SpaceImage *sima= CTX_wm_space_image(C); ARegion *ar= CTX_wm_region(C); @@ -651,13 +660,13 @@ void IMAGE_OT_view_zoom_out(wmOperatorType *ot) ot->idname= "IMAGE_OT_view_zoom_out"; /* api callbacks */ - ot->exec= view_zoom_out_exec; + ot->exec= image_view_zoom_out_exec; ot->poll= space_image_main_area_poll; } /********************** view zoom ratio operator *********************/ -static int view_zoom_ratio_exec(bContext *C, wmOperator *op) +static int image_view_zoom_ratio_exec(bContext *C, wmOperator *op) { SpaceImage *sima= CTX_wm_space_image(C); ARegion *ar= CTX_wm_region(C); @@ -689,7 +698,7 @@ void IMAGE_OT_view_zoom_ratio(wmOperatorType *ot) ot->idname= "IMAGE_OT_view_zoom_ratio"; /* api callbacks */ - ot->exec= view_zoom_ratio_exec; + ot->exec= image_view_zoom_ratio_exec; ot->poll= space_image_main_area_poll; /* properties */ @@ -740,7 +749,7 @@ static void image_filesel(bContext *C, wmOperator *op, const char *path) /******************** open image operator ********************/ -static void open_init(bContext *C, wmOperator *op) +static void image_open_init(bContext *C, wmOperator *op) { PropertyPointerRNA *pprop; @@ -748,14 +757,14 @@ static void open_init(bContext *C, wmOperator *op) uiIDContextProperty(C, &pprop->ptr, &pprop->prop); } -static int open_cancel(bContext *UNUSED(C), wmOperator *op) +static int image_open_cancel(bContext *UNUSED(C), wmOperator *op) { MEM_freeN(op->customdata); op->customdata= NULL; return OPERATOR_CANCELLED; } -static int open_exec(bContext *C, wmOperator *op) +static int image_open_exec(bContext *C, wmOperator *op) { SpaceImage *sima= CTX_wm_space_image(C); /* XXX other space types can call */ Scene *scene= CTX_data_scene(C); @@ -780,7 +789,7 @@ static int open_exec(bContext *C, wmOperator *op) } if(!op->customdata) - open_init(C, op); + image_open_init(C, op); /* hook into UI */ pprop= op->customdata; @@ -823,7 +832,7 @@ static int open_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int open_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) +static int image_open_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { SpaceImage *sima= CTX_wm_space_image(C); /* XXX other space types can call */ char *path=U.textudir; @@ -843,9 +852,9 @@ static int open_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) path= ima->name; if(RNA_property_is_set(op->ptr, "filepath")) - return open_exec(C, op); + return image_open_exec(C, op); - open_init(C, op); + image_open_init(C, op); image_filesel(C, op, path); @@ -861,9 +870,9 @@ void IMAGE_OT_open(wmOperatorType *ot) ot->idname= "IMAGE_OT_open"; /* api callbacks */ - ot->exec= open_exec; - ot->invoke= open_invoke; - ot->cancel= open_cancel; + ot->exec= image_open_exec; + ot->invoke= image_open_invoke; + ot->cancel= image_open_cancel; /* flags */ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; @@ -874,7 +883,7 @@ void IMAGE_OT_open(wmOperatorType *ot) /******************** replace image operator ********************/ -static int replace_exec(bContext *C, wmOperator *op) +static int image_replace_exec(bContext *C, wmOperator *op) { SpaceImage *sima= CTX_wm_space_image(C); char str[FILE_MAX]; @@ -894,7 +903,7 @@ static int replace_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int replace_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) +static int image_replace_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { SpaceImage *sima= CTX_wm_space_image(C); @@ -902,7 +911,7 @@ static int replace_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) return OPERATOR_CANCELLED; if(RNA_property_is_set(op->ptr, "filepath")) - return replace_exec(C, op); + return image_replace_exec(C, op); if(!RNA_property_is_set(op->ptr, "relative_path")) RNA_boolean_set(op->ptr, "relative_path", (strncmp(sima->image->name, "//", 2))==0); @@ -919,8 +928,8 @@ void IMAGE_OT_replace(wmOperatorType *ot) ot->idname= "IMAGE_OT_replace"; /* api callbacks */ - ot->exec= replace_exec; - ot->invoke= replace_invoke; + ot->exec= image_replace_exec; + ot->invoke= image_replace_invoke; ot->poll= space_image_poll; /* flags */ @@ -1032,7 +1041,7 @@ static void save_image_doit(bContext *C, SpaceImage *sima, wmOperator *op, SaveI ImBuf *ibuf= ED_space_image_acquire_buffer(sima, &lock); if (ibuf) { - Main *bmain= CTX_data_main(C); + const char *relbase= ID_BLEND_PATH(CTX_data_main(C), &ima->id); const short relative= (RNA_struct_find_property(op->ptr, "relative_path") && RNA_boolean_get(op->ptr, "relative_path")); const short save_copy= (RNA_struct_find_property(op->ptr, "copy") && RNA_boolean_get(op->ptr, "copy")); short ok= FALSE; @@ -1075,19 +1084,11 @@ static void save_image_doit(bContext *C, SpaceImage *sima, wmOperator *op, SaveI ok= TRUE; } - if(ok) { - if(relative) - BLI_path_rel(simopts->filepath, bmain->name); /* only after saving */ - - if(ibuf->name[0]==0) { - BLI_strncpy(ibuf->name, simopts->filepath, sizeof(ibuf->name)); - BLI_strncpy(ima->name, simopts->filepath, sizeof(ima->name)); - } - + if (ok) { if(!save_copy) { if(do_newpath) { - BLI_strncpy(ima->name, simopts->filepath, sizeof(ima->name)); BLI_strncpy(ibuf->name, simopts->filepath, sizeof(ibuf->name)); + BLI_strncpy(ima->name, simopts->filepath, sizeof(ima->name)); } ibuf->userflags &= ~IB_BITMAPDIRTY; @@ -1112,6 +1113,11 @@ static void save_image_doit(bContext *C, SpaceImage *sima, wmOperator *op, SaveI ima->source= IMA_SRC_FILE; ima->type= IMA_TYPE_IMAGE; } + + /* only image path, never ibuf */ + if(relative) { + BLI_path_rel(ima->name, relbase); /* only after saving */ + } } } else { @@ -1127,7 +1133,7 @@ static void save_image_doit(bContext *C, SpaceImage *sima, wmOperator *op, SaveI ED_space_image_release_buffer(sima, lock); } -static int save_as_exec(bContext *C, wmOperator *op) +static int image_save_as_exec(bContext *C, wmOperator *op) { SpaceImage *sima= CTX_wm_space_image(C); SaveImageOptions simopts; @@ -1143,7 +1149,7 @@ static int save_as_exec(bContext *C, wmOperator *op) } -static int save_as_check(bContext *UNUSED(C), wmOperator *op) +static int image_save_as_check(bContext *UNUSED(C), wmOperator *op) { char filepath[FILE_MAX]; RNA_string_get(op->ptr, "filepath", filepath); @@ -1154,7 +1160,7 @@ static int save_as_check(bContext *UNUSED(C), wmOperator *op) return FALSE; } -static int save_as_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) +static int image_save_as_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { SpaceImage *sima= CTX_wm_space_image(C); Image *ima = ED_space_image(sima); @@ -1162,7 +1168,7 @@ static int save_as_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) SaveImageOptions simopts; if(RNA_property_is_set(op->ptr, "filepath")) - return save_as_exec(C, op); + return image_save_as_exec(C, op); if (save_image_options_init(&simopts, sima, scene, TRUE) == 0) return OPERATOR_CANCELLED; @@ -1188,9 +1194,9 @@ void IMAGE_OT_save_as(wmOperatorType *ot) ot->idname= "IMAGE_OT_save_as"; /* api callbacks */ - ot->exec= save_as_exec; - ot->check= save_as_check; - ot->invoke= save_as_invoke; + ot->exec= image_save_as_exec; + ot->check= image_save_as_check; + ot->invoke= image_save_as_invoke; ot->poll= space_image_buffer_exists_poll; /* flags */ @@ -1211,7 +1217,7 @@ void IMAGE_OT_save_as(wmOperatorType *ot) /******************** save image operator ********************/ -static int save_exec(bContext *C, wmOperator *op) +static int image_save_exec(bContext *C, wmOperator *op) { SpaceImage *sima= CTX_wm_space_image(C); Scene *scene= CTX_data_scene(C); @@ -1239,7 +1245,7 @@ void IMAGE_OT_save(wmOperatorType *ot) ot->idname= "IMAGE_OT_save"; /* api callbacks */ - ot->exec= save_exec; + ot->exec= image_save_exec; ot->poll= space_image_file_exists_poll; /* flags */ @@ -1248,7 +1254,7 @@ void IMAGE_OT_save(wmOperatorType *ot) /******************* save sequence operator ********************/ -static int save_sequence_exec(bContext *C, wmOperator *op) +static int image_save_sequence_exec(bContext *C, wmOperator *op) { Main *bmain= CTX_data_main(C); SpaceImage *sima= CTX_wm_space_image(C); @@ -1316,7 +1322,7 @@ void IMAGE_OT_save_sequence(wmOperatorType *ot) ot->idname= "IMAGE_OT_save_sequence"; /* api callbacks */ - ot->exec= save_sequence_exec; + ot->exec= image_save_sequence_exec; ot->poll= space_image_buffer_exists_poll; /* flags */ @@ -1325,7 +1331,7 @@ void IMAGE_OT_save_sequence(wmOperatorType *ot) /******************** reload image operator ********************/ -static int reload_exec(bContext *C, wmOperator *UNUSED(op)) +static int image_reload_exec(bContext *C, wmOperator *UNUSED(op)) { Image *ima= CTX_data_edit_image(C); SpaceImage *sima= CTX_wm_space_image(C); @@ -1351,7 +1357,7 @@ void IMAGE_OT_reload(wmOperatorType *ot) ot->idname= "IMAGE_OT_reload"; /* api callbacks */ - ot->exec= reload_exec; + ot->exec= image_reload_exec; /* flags */ ot->flag= OPTYPE_REGISTER; /* no undo, image buffer is not handled by undo */ @@ -1538,7 +1544,7 @@ void IMAGE_OT_invert(wmOperatorType *ot) /********************* pack operator *********************/ -static int pack_test(bContext *C, wmOperator *op) +static int image_pack_test(bContext *C, wmOperator *op) { Image *ima= CTX_data_edit_image(C); int as_png= RNA_boolean_get(op->ptr, "as_png"); @@ -1556,14 +1562,14 @@ static int pack_test(bContext *C, wmOperator *op) return 1; } -static int pack_exec(bContext *C, wmOperator *op) +static int image_pack_exec(bContext *C, wmOperator *op) { struct Main *bmain= CTX_data_main(C); Image *ima= CTX_data_edit_image(C); ImBuf *ibuf= BKE_image_get_ibuf(ima, NULL); int as_png= RNA_boolean_get(op->ptr, "as_png"); - if(!pack_test(C, op)) + if(!image_pack_test(C, op)) return OPERATOR_CANCELLED; if(!as_png && (ibuf && (ibuf->userflags & IB_BITMAPDIRTY))) { @@ -1581,7 +1587,7 @@ static int pack_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int pack_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) +static int image_pack_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { Image *ima= CTX_data_edit_image(C); ImBuf *ibuf= BKE_image_get_ibuf(ima, NULL); @@ -1589,7 +1595,7 @@ static int pack_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) uiLayout *layout; int as_png= RNA_boolean_get(op->ptr, "as_png"); - if(!pack_test(C, op)) + if(!image_pack_test(C, op)) return OPERATOR_CANCELLED; if(!as_png && (ibuf && (ibuf->userflags & IB_BITMAPDIRTY))) { @@ -1601,7 +1607,7 @@ static int pack_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) return OPERATOR_CANCELLED; } - return pack_exec(C, op); + return image_pack_exec(C, op); } void IMAGE_OT_pack(wmOperatorType *ot) @@ -1612,8 +1618,8 @@ void IMAGE_OT_pack(wmOperatorType *ot) ot->idname= "IMAGE_OT_pack"; /* api callbacks */ - ot->exec= pack_exec; - ot->invoke= pack_invoke; + ot->exec= image_pack_exec; + ot->invoke= image_pack_invoke; /* flags */ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; @@ -1721,7 +1727,7 @@ typedef struct ImageSampleInfo { int draw; } ImageSampleInfo; -static void sample_draw(const bContext *UNUSED(C), ARegion *ar, void *arg_info) +static void image_sample_draw(const bContext *UNUSED(C), ARegion *ar, void *arg_info) { ImageSampleInfo *info= arg_info; if(info->draw) { @@ -1730,7 +1736,7 @@ static void sample_draw(const bContext *UNUSED(C), ARegion *ar, void *arg_info) } } -static void sample_apply(bContext *C, wmOperator *op, wmEvent *event) +static void image_sample_apply(bContext *C, wmOperator *op, wmEvent *event) { SpaceImage *sima= CTX_wm_space_image(C); ARegion *ar= CTX_wm_region(C); @@ -1840,7 +1846,7 @@ static void sample_apply(bContext *C, wmOperator *op, wmEvent *event) ED_area_tag_redraw(CTX_wm_area(C)); } -static void sample_exit(bContext *C, wmOperator *op) +static void image_sample_exit(bContext *C, wmOperator *op) { ImageSampleInfo *info= op->customdata; @@ -1849,7 +1855,7 @@ static void sample_exit(bContext *C, wmOperator *op) MEM_freeN(info); } -static int sample_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int image_sample_invoke(bContext *C, wmOperator *op, wmEvent *event) { SpaceImage *sima= CTX_wm_space_image(C); ARegion *ar= CTX_wm_region(C); @@ -1860,34 +1866,34 @@ static int sample_invoke(bContext *C, wmOperator *op, wmEvent *event) info= MEM_callocN(sizeof(ImageSampleInfo), "ImageSampleInfo"); info->art= ar->type; - info->draw_handle = ED_region_draw_cb_activate(ar->type, sample_draw, info, REGION_DRAW_POST_PIXEL); + info->draw_handle = ED_region_draw_cb_activate(ar->type, image_sample_draw, info, REGION_DRAW_POST_PIXEL); op->customdata= info; - sample_apply(C, op, event); + image_sample_apply(C, op, event); WM_event_add_modal_handler(C, op); return OPERATOR_RUNNING_MODAL; } -static int sample_modal(bContext *C, wmOperator *op, wmEvent *event) +static int image_sample_modal(bContext *C, wmOperator *op, wmEvent *event) { switch(event->type) { case LEFTMOUSE: case RIGHTMOUSE: // XXX hardcoded - sample_exit(C, op); + image_sample_exit(C, op); return OPERATOR_CANCELLED; case MOUSEMOVE: - sample_apply(C, op, event); + image_sample_apply(C, op, event); break; } return OPERATOR_RUNNING_MODAL; } -static int sample_cancel(bContext *C, wmOperator *op) +static int image_sample_cancel(bContext *C, wmOperator *op) { - sample_exit(C, op); + image_sample_exit(C, op); return OPERATOR_CANCELLED; } @@ -1898,9 +1904,9 @@ void IMAGE_OT_sample(wmOperatorType *ot) ot->idname= "IMAGE_OT_sample"; /* api callbacks */ - ot->invoke= sample_invoke; - ot->modal= sample_modal; - ot->cancel= sample_cancel; + ot->invoke= image_sample_invoke; + ot->modal= image_sample_modal; + ot->cancel= image_sample_cancel; ot->poll= space_image_main_area_poll; /* flags */ @@ -1908,7 +1914,7 @@ void IMAGE_OT_sample(wmOperatorType *ot) } /******************** sample line operator ********************/ -static int sample_line_exec(bContext *C, wmOperator *op) +static int image_sample_line_exec(bContext *C, wmOperator *op) { SpaceImage *sima= CTX_wm_space_image(C); ARegion *ar= CTX_wm_region(C); @@ -1989,7 +1995,7 @@ static int sample_line_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int sample_line_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int image_sample_line_invoke(bContext *C, wmOperator *op, wmEvent *event) { SpaceImage *sima= CTX_wm_space_image(C); @@ -2006,9 +2012,9 @@ void IMAGE_OT_sample_line(wmOperatorType *ot) ot->idname= "IMAGE_OT_sample_line"; /* api callbacks */ - ot->invoke= sample_line_invoke; + ot->invoke= image_sample_line_invoke; ot->modal= WM_gesture_straightline_modal; - ot->exec= sample_line_exec; + ot->exec= image_sample_line_exec; ot->poll= space_image_main_area_poll; ot->cancel= WM_gesture_straightline_cancel; @@ -2035,9 +2041,9 @@ void IMAGE_OT_curves_point_set(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; /* api callbacks */ - ot->invoke= sample_invoke; - ot->modal= sample_modal; - ot->cancel= sample_cancel; + ot->invoke= image_sample_invoke; + ot->modal= image_sample_modal; + ot->cancel= image_sample_cancel; ot->poll= space_image_main_area_poll; /* properties */ @@ -2052,7 +2058,7 @@ typedef struct RecordCompositeData { int sfra, efra; } RecordCompositeData; -static int record_composite_apply(bContext *C, wmOperator *op) +static int image_record_composite_apply(bContext *C, wmOperator *op) { SpaceImage *sima= CTX_wm_space_image(C); RecordCompositeData *rcd= op->customdata; @@ -2080,7 +2086,7 @@ static int record_composite_apply(bContext *C, wmOperator *op) return (scene->r.cfra <= rcd->efra); } -static int record_composite_init(bContext *C, wmOperator *op) +static int image_record_composite_init(bContext *C, wmOperator *op) { SpaceImage *sima= CTX_wm_space_image(C); Scene *scene= CTX_data_scene(C); @@ -2101,7 +2107,7 @@ static int record_composite_init(bContext *C, wmOperator *op) return 1; } -static void record_composite_exit(bContext *C, wmOperator *op) +static void image_record_composite_exit(bContext *C, wmOperator *op) { Scene *scene= CTX_data_scene(C); SpaceImage *sima= CTX_wm_space_image(C); @@ -2122,60 +2128,60 @@ static void record_composite_exit(bContext *C, wmOperator *op) MEM_freeN(rcd); } -static int record_composite_exec(bContext *C, wmOperator *op) +static int image_record_composite_exec(bContext *C, wmOperator *op) { - if(!record_composite_init(C, op)) + if(!image_record_composite_init(C, op)) return OPERATOR_CANCELLED; - while(record_composite_apply(C, op)) + while(image_record_composite_apply(C, op)) ; - record_composite_exit(C, op); + image_record_composite_exit(C, op); return OPERATOR_FINISHED; } -static int record_composite_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) +static int image_record_composite_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { RecordCompositeData *rcd; - if(!record_composite_init(C, op)) + if(!image_record_composite_init(C, op)) return OPERATOR_CANCELLED; rcd= op->customdata; rcd->timer= WM_event_add_timer(CTX_wm_manager(C), CTX_wm_window(C), TIMER, 0.0f); WM_event_add_modal_handler(C, op); - if(!record_composite_apply(C, op)) + if(!image_record_composite_apply(C, op)) return OPERATOR_FINISHED; return OPERATOR_RUNNING_MODAL; } -static int record_composite_modal(bContext *C, wmOperator *op, wmEvent *event) +static int image_record_composite_modal(bContext *C, wmOperator *op, wmEvent *event) { RecordCompositeData *rcd= op->customdata; switch(event->type) { case TIMER: if(rcd->timer == event->customdata) { - if(!record_composite_apply(C, op)) { - record_composite_exit(C, op); + if(!image_record_composite_apply(C, op)) { + image_record_composite_exit(C, op); return OPERATOR_FINISHED; } } break; case ESCKEY: - record_composite_exit(C, op); + image_record_composite_exit(C, op); return OPERATOR_FINISHED; } return OPERATOR_RUNNING_MODAL; } -static int record_composite_cancel(bContext *C, wmOperator *op) +static int image_record_composite_cancel(bContext *C, wmOperator *op) { - record_composite_exit(C, op); + image_record_composite_exit(C, op); return OPERATOR_CANCELLED; } @@ -2186,23 +2192,23 @@ void IMAGE_OT_record_composite(wmOperatorType *ot) ot->idname= "IMAGE_OT_record_composite"; /* api callbacks */ - ot->exec= record_composite_exec; - ot->invoke= record_composite_invoke; - ot->modal= record_composite_modal; - ot->cancel= record_composite_cancel; + ot->exec= image_record_composite_exec; + ot->invoke= image_record_composite_invoke; + ot->modal= image_record_composite_modal; + ot->cancel= image_record_composite_cancel; ot->poll= space_image_buffer_exists_poll; } /********************* cycle render slot operator *********************/ -static int cycle_render_slot_poll(bContext *C) +static int image_cycle_render_slot_poll(bContext *C) { Image *ima= CTX_data_edit_image(C); return (ima && ima->type == IMA_TYPE_R_RESULT); } -static int cycle_render_slot_exec(bContext *C, wmOperator *op) +static int image_cycle_render_slot_exec(bContext *C, wmOperator *op) { Image *ima= CTX_data_edit_image(C); int a, slot, cur= ima->render_slot; @@ -2241,8 +2247,8 @@ void IMAGE_OT_cycle_render_slot(wmOperatorType *ot) ot->idname= "IMAGE_OT_cycle_render_slot"; /* api callbacks */ - ot->exec= cycle_render_slot_exec; - ot->poll= cycle_render_slot_poll; + ot->exec= image_cycle_render_slot_exec; + ot->poll= image_cycle_render_slot_poll; /* flags */ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; diff --git a/source/blender/editors/space_text/text_header.c b/source/blender/editors/space_text/text_header.c index 7fde4266655..b8e53f752e2 100644 --- a/source/blender/editors/space_text/text_header.c +++ b/source/blender/editors/space_text/text_header.c @@ -98,12 +98,12 @@ static ARegion *text_has_properties_region(ScrArea *sa) return arnew; } -static int properties_poll(bContext *C) +static int text_properties_poll(bContext *C) { return (CTX_wm_space_text(C) != NULL); } -static int properties_exec(bContext *C, wmOperator *UNUSED(op)) +static int text_properties_exec(bContext *C, wmOperator *UNUSED(op)) { ScrArea *sa= CTX_wm_area(C); ARegion *ar= text_has_properties_region(sa); @@ -122,8 +122,8 @@ void TEXT_OT_properties(wmOperatorType *ot) ot->idname= "TEXT_OT_properties"; /* api callbacks */ - ot->exec= properties_exec; - ot->poll= properties_poll; + ot->exec= text_properties_exec; + ot->poll= text_properties_poll; } /******************** XXX popup menus *******************/ diff --git a/source/blender/editors/space_text/text_ops.c b/source/blender/editors/space_text/text_ops.c index ffcf2606a04..e36cdd32ab8 100644 --- a/source/blender/editors/space_text/text_ops.c +++ b/source/blender/editors/space_text/text_ops.c @@ -153,7 +153,7 @@ void text_update_edited(Text *text) /******************* new operator *********************/ -static int new_exec(bContext *C, wmOperator *UNUSED(op)) +static int text_new_exec(bContext *C, wmOperator *UNUSED(op)) { SpaceText *st= CTX_wm_space_text(C); Text *text; @@ -196,7 +196,7 @@ void TEXT_OT_new(wmOperatorType *ot) /* api callbacks */ ot->invoke= WM_operator_confirm; - ot->exec= new_exec; + ot->exec= text_new_exec; ot->poll= text_new_poll; /* flags */ @@ -205,7 +205,7 @@ void TEXT_OT_new(wmOperatorType *ot) /******************* open operator *********************/ -static void open_init(bContext *C, wmOperator *op) +static void text_open_init(bContext *C, wmOperator *op) { PropertyPointerRNA *pprop; @@ -213,13 +213,13 @@ static void open_init(bContext *C, wmOperator *op) uiIDContextProperty(C, &pprop->ptr, &pprop->prop); } -static int open_cancel(bContext *UNUSED(C), wmOperator *op) +static int text_open_cancel(bContext *UNUSED(C), wmOperator *op) { MEM_freeN(op->customdata); return OPERATOR_CANCELLED; } -static int open_exec(bContext *C, wmOperator *op) +static int text_open_exec(bContext *C, wmOperator *op) { SpaceText *st= CTX_wm_space_text(C); Text *text; @@ -238,7 +238,7 @@ static int open_exec(bContext *C, wmOperator *op) } if(!op->customdata) - open_init(C, op); + text_open_init(C, op); /* hook into UI */ pprop= op->customdata; @@ -272,15 +272,15 @@ static int open_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int open_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) +static int text_open_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { Text *text= CTX_data_edit_text(C); char *path= (text && text->name)? text->name: G.main->name; if(RNA_property_is_set(op->ptr, "filepath")) - return open_exec(C, op); + return text_open_exec(C, op); - open_init(C, op); + text_open_init(C, op); RNA_string_set(op->ptr, "filepath", path); WM_event_add_fileselect(C, op); @@ -295,9 +295,9 @@ void TEXT_OT_open(wmOperatorType *ot) ot->description= "Open a new text data block"; /* api callbacks */ - ot->exec= open_exec; - ot->invoke= open_invoke; - ot->cancel= open_cancel; + ot->exec= text_open_exec; + ot->invoke= text_open_invoke; + ot->cancel= text_open_cancel; ot->poll= text_new_poll; /* flags */ @@ -310,7 +310,7 @@ void TEXT_OT_open(wmOperatorType *ot) /******************* reload operator *********************/ -static int reload_exec(bContext *C, wmOperator *op) +static int text_reload_exec(bContext *C, wmOperator *op) { Text *text= CTX_data_edit_text(C); @@ -340,7 +340,7 @@ void TEXT_OT_reload(wmOperatorType *ot) ot->description= "Reload active text data block from its file"; /* api callbacks */ - ot->exec= reload_exec; + ot->exec= text_reload_exec; ot->invoke= WM_operator_confirm; ot->poll= text_edit_poll; } @@ -353,7 +353,7 @@ static int text_unlink_poll(bContext *C) return CTX_data_edit_text(C) != NULL; } -static int unlink_exec(bContext *C, wmOperator *UNUSED(op)) +static int text_unlink_exec(bContext *C, wmOperator *UNUSED(op)) { Main *bmain= CTX_data_main(C); SpaceText *st= CTX_wm_space_text(C); @@ -390,7 +390,7 @@ void TEXT_OT_unlink(wmOperatorType *ot) ot->description= "Unlink active text data block"; /* api callbacks */ - ot->exec= unlink_exec; + ot->exec= text_unlink_exec; ot->invoke= WM_operator_confirm; ot->poll= text_unlink_poll; @@ -400,7 +400,7 @@ void TEXT_OT_unlink(wmOperatorType *ot) /******************* make internal operator *********************/ -static int make_internal_exec(bContext *C, wmOperator *UNUSED(op)) +static int text_make_internal_exec(bContext *C, wmOperator *UNUSED(op)) { Text *text= CTX_data_edit_text(C); @@ -425,7 +425,7 @@ void TEXT_OT_make_internal(wmOperatorType *ot) ot->description= "Make active text file internal"; /* api callbacks */ - ot->exec= make_internal_exec; + ot->exec= text_make_internal_exec; ot->poll= text_edit_poll; /* flags */ @@ -434,7 +434,7 @@ void TEXT_OT_make_internal(wmOperatorType *ot) /******************* save operator *********************/ -static int save_poll(bContext *C) +static int text_save_poll(bContext *C) { Text *text= CTX_data_edit_text(C); @@ -482,7 +482,7 @@ static void txt_write_file(Text *text, ReportList *reports) text->flags ^= TXT_ISDIRTY; } -static int save_exec(bContext *C, wmOperator *op) +static int text_save_exec(bContext *C, wmOperator *op) { Text *text= CTX_data_edit_text(C); @@ -502,13 +502,13 @@ void TEXT_OT_save(wmOperatorType *ot) ot->description= "Save active text data block"; /* api callbacks */ - ot->exec= save_exec; - ot->poll= save_poll; + ot->exec= text_save_exec; + ot->poll= text_save_poll; } /******************* save as operator *********************/ -static int save_as_exec(bContext *C, wmOperator *op) +static int text_save_as_exec(bContext *C, wmOperator *op) { Text *text= CTX_data_edit_text(C); char str[FILE_MAX]; @@ -530,13 +530,13 @@ static int save_as_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int save_as_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) +static int text_save_as_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { Text *text= CTX_data_edit_text(C); char *str; if(RNA_property_is_set(op->ptr, "filepath")) - return save_as_exec(C, op); + return text_save_as_exec(C, op); if(text->name) str= text->name; @@ -559,8 +559,8 @@ void TEXT_OT_save_as(wmOperatorType *ot) ot->description= "Save active text file with options"; /* api callbacks */ - ot->exec= save_as_exec; - ot->invoke= save_as_invoke; + ot->exec= text_save_as_exec; + ot->invoke= text_save_as_invoke; ot->poll= text_edit_poll; /* properties */ @@ -569,12 +569,12 @@ void TEXT_OT_save_as(wmOperatorType *ot) /******************* run script operator *********************/ -static int run_script_poll(bContext *C) +static int text_run_script_poll(bContext *C) { return (CTX_data_edit_text(C) != NULL); } -static int run_script(bContext *C, ReportList *reports) +static int text_run_script(bContext *C, ReportList *reports) { #ifdef WITH_PYTHON Text *text= CTX_data_edit_text(C); @@ -608,7 +608,7 @@ static int run_script(bContext *C, ReportList *reports) return OPERATOR_CANCELLED; } -static int run_script_exec(bContext *C, wmOperator *op) +static int text_run_script_exec(bContext *C, wmOperator *op) { #ifndef WITH_PYTHON (void)C; /* unused */ @@ -617,7 +617,7 @@ static int run_script_exec(bContext *C, wmOperator *op) return OPERATOR_CANCELLED; #else - return run_script(C, op->reports); + return text_run_script(C, op->reports); #endif } @@ -629,8 +629,8 @@ void TEXT_OT_run_script(wmOperatorType *ot) ot->description= "Run active script"; /* api callbacks */ - ot->poll= run_script_poll; - ot->exec= run_script_exec; + ot->poll= text_run_script_poll; + ot->exec= text_run_script_exec; /* flags */ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; @@ -638,7 +638,7 @@ void TEXT_OT_run_script(wmOperatorType *ot) /******************* refresh pyconstraints operator *********************/ -static int refresh_pyconstraints_exec(bContext *UNUSED(C), wmOperator *UNUSED(op)) +static int text_refresh_pyconstraints_exec(bContext *UNUSED(C), wmOperator *UNUSED(op)) { #ifdef WITH_PYTHON #if 0 @@ -689,7 +689,7 @@ void TEXT_OT_refresh_pyconstraints(wmOperatorType *ot) ot->description= "Refresh all pyconstraints"; /* api callbacks */ - ot->exec= refresh_pyconstraints_exec; + ot->exec= text_refresh_pyconstraints_exec; ot->poll= text_edit_poll; } @@ -777,7 +777,7 @@ static char *txt_copy_selected(Text *text) return buf; } -static int paste_exec(bContext *C, wmOperator *op) +static int text_paste_exec(bContext *C, wmOperator *op) { Text *text= CTX_data_edit_text(C); char *buf; @@ -800,7 +800,7 @@ static int paste_exec(bContext *C, wmOperator *op) /* run the script while editing, evil but useful */ if(CTX_wm_space_text(C)->live_edit) - run_script(C, NULL); + text_run_script(C, NULL); return OPERATOR_FINISHED; } @@ -813,7 +813,7 @@ void TEXT_OT_paste(wmOperatorType *ot) ot->description= "Paste text from clipboard"; /* api callbacks */ - ot->exec= paste_exec; + ot->exec= text_paste_exec; ot->poll= text_edit_poll; /* properties */ @@ -834,7 +834,7 @@ static void txt_copy_clipboard(Text *text) } } -static int copy_exec(bContext *C, wmOperator *UNUSED(op)) +static int text_copy_exec(bContext *C, wmOperator *UNUSED(op)) { Text *text= CTX_data_edit_text(C); @@ -851,13 +851,13 @@ void TEXT_OT_copy(wmOperatorType *ot) ot->description= "Copy selected text to clipboard"; /* api callbacks */ - ot->exec= copy_exec; + ot->exec= text_copy_exec; ot->poll= text_edit_poll; } /******************* cut operator *********************/ -static int cut_exec(bContext *C, wmOperator *UNUSED(op)) +static int text_cut_exec(bContext *C, wmOperator *UNUSED(op)) { Text *text= CTX_data_edit_text(C); @@ -871,7 +871,7 @@ static int cut_exec(bContext *C, wmOperator *UNUSED(op)) /* run the script while editing, evil but useful */ if(CTX_wm_space_text(C)->live_edit) - run_script(C, NULL); + text_run_script(C, NULL); return OPERATOR_FINISHED; } @@ -884,13 +884,13 @@ void TEXT_OT_cut(wmOperatorType *ot) ot->description= "Cut selected text to clipboard"; /* api callbacks */ - ot->exec= cut_exec; + ot->exec= text_cut_exec; ot->poll= text_edit_poll; } /******************* indent operator *********************/ -static int indent_exec(bContext *C, wmOperator *UNUSED(op)) +static int text_indent_exec(bContext *C, wmOperator *UNUSED(op)) { Text *text= CTX_data_edit_text(C); @@ -919,13 +919,13 @@ void TEXT_OT_indent(wmOperatorType *ot) ot->description= "Indent selected text"; /* api callbacks */ - ot->exec= indent_exec; + ot->exec= text_indent_exec; ot->poll= text_edit_poll; } /******************* unindent operator *********************/ -static int unindent_exec(bContext *C, wmOperator *UNUSED(op)) +static int text_unindent_exec(bContext *C, wmOperator *UNUSED(op)) { Text *text= CTX_data_edit_text(C); @@ -954,13 +954,13 @@ void TEXT_OT_unindent(wmOperatorType *ot) ot->description= "Unindent selected text"; /* api callbacks */ - ot->exec= unindent_exec; + ot->exec= text_unindent_exec; ot->poll= text_edit_poll; } /******************* line break operator *********************/ -static int line_break_exec(bContext *C, wmOperator *UNUSED(op)) +static int text_line_break_exec(bContext *C, wmOperator *UNUSED(op)) { SpaceText *st= CTX_wm_space_text(C); Text *text= CTX_data_edit_text(C); @@ -1001,13 +1001,13 @@ void TEXT_OT_line_break(wmOperatorType *ot) ot->description= "Insert line break at cursor position"; /* api callbacks */ - ot->exec= line_break_exec; + ot->exec= text_line_break_exec; ot->poll= text_edit_poll; } /******************* comment operator *********************/ -static int comment_exec(bContext *C, wmOperator *UNUSED(op)) +static int text_comment_exec(bContext *C, wmOperator *UNUSED(op)) { Text *text= CTX_data_edit_text(C); @@ -1034,13 +1034,13 @@ void TEXT_OT_comment(wmOperatorType *ot) ot->description= "Convert selected text to comment"; /* api callbacks */ - ot->exec= comment_exec; + ot->exec= text_comment_exec; ot->poll= text_edit_poll; } /******************* uncomment operator *********************/ -static int uncomment_exec(bContext *C, wmOperator *UNUSED(op)) +static int text_uncomment_exec(bContext *C, wmOperator *UNUSED(op)) { Text *text= CTX_data_edit_text(C); @@ -1068,7 +1068,7 @@ void TEXT_OT_uncomment(wmOperatorType *ot) ot->description= "Convert selected comment to text"; /* api callbacks */ - ot->exec= uncomment_exec; + ot->exec= text_uncomment_exec; ot->poll= text_edit_poll; } @@ -1080,7 +1080,7 @@ static EnumPropertyItem whitespace_type_items[]= { {TO_TABS, "TABS", 0, "To Tabs", NULL}, {0, NULL, 0, NULL, NULL}}; -static int convert_whitespace_exec(bContext *C, wmOperator *op) +static int text_convert_whitespace_exec(bContext *C, wmOperator *op) { SpaceText *st= CTX_wm_space_text(C); Text *text= CTX_data_edit_text(C); @@ -1208,7 +1208,7 @@ void TEXT_OT_convert_whitespace(wmOperatorType *ot) ot->description= "Convert whitespaces by type"; /* api callbacks */ - ot->exec= convert_whitespace_exec; + ot->exec= text_convert_whitespace_exec; ot->poll= text_edit_poll; /* properties */ @@ -1217,7 +1217,7 @@ void TEXT_OT_convert_whitespace(wmOperatorType *ot) /******************* select all operator *********************/ -static int select_all_exec(bContext *C, wmOperator *UNUSED(op)) +static int text_select_all_exec(bContext *C, wmOperator *UNUSED(op)) { Text *text= CTX_data_edit_text(C); @@ -1237,13 +1237,13 @@ void TEXT_OT_select_all(wmOperatorType *ot) ot->description= "Select all text"; /* api callbacks */ - ot->exec= select_all_exec; + ot->exec= text_select_all_exec; ot->poll= text_edit_poll; } /******************* select line operator *********************/ -static int select_line_exec(bContext *C, wmOperator *UNUSED(op)) +static int text_select_line_exec(bContext *C, wmOperator *UNUSED(op)) { Text *text= CTX_data_edit_text(C); @@ -1263,13 +1263,13 @@ void TEXT_OT_select_line(wmOperatorType *ot) ot->description= "Select text by line"; /* api callbacks */ - ot->exec= select_line_exec; + ot->exec= text_select_line_exec; ot->poll= text_edit_poll; } /******************* select word operator *********************/ -static int select_word_exec(bContext *C, wmOperator *UNUSED(op)) +static int text_select_word_exec(bContext *C, wmOperator *UNUSED(op)) { Text *text= CTX_data_edit_text(C); @@ -1290,13 +1290,13 @@ void TEXT_OT_select_word(wmOperatorType *ot) ot->description= "Select word under cursor"; /* api callbacks */ - ot->exec= select_word_exec; + ot->exec= text_select_word_exec; ot->poll= text_edit_poll; } /******************* previous marker operator *********************/ -static int previous_marker_exec(bContext *C, wmOperator *UNUSED(op)) +static int text_previous_marker_exec(bContext *C, wmOperator *UNUSED(op)) { Text *text= CTX_data_edit_text(C); TextMarker *mrk; @@ -1326,13 +1326,13 @@ void TEXT_OT_previous_marker(wmOperatorType *ot) ot->description= "Move to previous marker"; /* api callbacks */ - ot->exec= previous_marker_exec; + ot->exec= text_previous_marker_exec; ot->poll= text_edit_poll; } /******************* next marker operator *********************/ -static int next_marker_exec(bContext *C, wmOperator *UNUSED(op)) +static int text_next_marker_exec(bContext *C, wmOperator *UNUSED(op)) { Text *text= CTX_data_edit_text(C); TextMarker *mrk; @@ -1362,13 +1362,13 @@ void TEXT_OT_next_marker(wmOperatorType *ot) ot->description= "Move to next marker"; /* api callbacks */ - ot->exec= next_marker_exec; + ot->exec= text_next_marker_exec; ot->poll= text_edit_poll; } /******************* clear all markers operator *********************/ -static int clear_all_markers_exec(bContext *C, wmOperator *UNUSED(op)) +static int text_clear_all_markers_exec(bContext *C, wmOperator *UNUSED(op)) { Text *text= CTX_data_edit_text(C); @@ -1388,7 +1388,7 @@ void TEXT_OT_markers_clear(wmOperatorType *ot) ot->description= "Clear all markers"; /* api callbacks */ - ot->exec= clear_all_markers_exec; + ot->exec= text_clear_all_markers_exec; ot->poll= text_edit_poll; } @@ -1573,7 +1573,7 @@ static int cursor_skip_find_line(SpaceText* st, ARegion *ar, return 1; } -static void wrap_move_bol(SpaceText *st, ARegion *ar, short sel) +static void txt_wrap_move_bol(SpaceText *st, ARegion *ar, short sel) { Text *text= st->text; TextLine **linep; @@ -1641,7 +1641,7 @@ static void wrap_move_bol(SpaceText *st, ARegion *ar, short sel) txt_undo_add_toop(text, sel?UNDO_STO:UNDO_CTO, oldl, oldc, oldl, *charp); } -static void wrap_move_eol(SpaceText *st, ARegion *ar, short sel) +static void txt_wrap_move_eol(SpaceText *st, ARegion *ar, short sel) { Text *text= st->text; TextLine **linep; @@ -1705,7 +1705,7 @@ static void wrap_move_eol(SpaceText *st, ARegion *ar, short sel) txt_undo_add_toop(text, sel?UNDO_STO:UNDO_CTO, oldl, oldc, oldl, *charp); } -static void wrap_move_up(SpaceText *st, ARegion *ar, short sel) +static void txt_wrap_move_up(SpaceText *st, ARegion *ar, short sel) { Text *text= st->text; TextLine **linep; @@ -1741,7 +1741,7 @@ static void wrap_move_up(SpaceText *st, ARegion *ar, short sel) txt_undo_add_toop(text, sel?UNDO_STO:UNDO_CTO, oldl, oldc, newl, *charp); } -static void wrap_move_down(SpaceText *st, ARegion *ar, short sel) +static void txt_wrap_move_down(SpaceText *st, ARegion *ar, short sel) { Text *text= st->text; TextLine **linep; @@ -1814,7 +1814,7 @@ static void cursor_skip(SpaceText* st, ARegion *ar, Text *text, int lines, int s txt_undo_add_toop(text, sel?UNDO_STO:UNDO_CTO, oldl, oldc, txt_get_span(text->lines.first, *linep), *charp); } -static int move_cursor(bContext *C, int type, int select) +static int text_move_cursor(bContext *C, int type, int select) { SpaceText *st= CTX_wm_space_text(C); Text *text= CTX_data_edit_text(C); @@ -1826,12 +1826,12 @@ static int move_cursor(bContext *C, int type, int select) switch(type) { case LINE_BEGIN: - if(st && st->wordwrap && ar) wrap_move_bol(st, ar, select); + if(st && st->wordwrap && ar) txt_wrap_move_bol(st, ar, select); else txt_move_bol(text, select); break; case LINE_END: - if(st && st->wordwrap && ar) wrap_move_eol(st, ar, select); + if(st && st->wordwrap && ar) txt_wrap_move_eol(st, ar, select); else txt_move_eol(text, select); break; @@ -1860,12 +1860,12 @@ static int move_cursor(bContext *C, int type, int select) break; case PREV_LINE: - if(st && st->wordwrap && ar) wrap_move_up(st, ar, select); + if(st && st->wordwrap && ar) txt_wrap_move_up(st, ar, select); else txt_move_up(text, select); break; case NEXT_LINE: - if(st && st->wordwrap && ar) wrap_move_down(st, ar, select); + if(st && st->wordwrap && ar) txt_wrap_move_down(st, ar, select); else txt_move_down(text, select); break; @@ -1886,11 +1886,11 @@ static int move_cursor(bContext *C, int type, int select) return OPERATOR_FINISHED; } -static int move_exec(bContext *C, wmOperator *op) +static int text_move_exec(bContext *C, wmOperator *op) { int type= RNA_enum_get(op->ptr, "type"); - return move_cursor(C, type, 0); + return text_move_cursor(C, type, 0); } void TEXT_OT_move(wmOperatorType *ot) @@ -1901,7 +1901,7 @@ void TEXT_OT_move(wmOperatorType *ot) ot->description= "Move cursor to position type"; /* api callbacks */ - ot->exec= move_exec; + ot->exec= text_move_exec; ot->poll= text_edit_poll; /* properties */ @@ -1910,11 +1910,11 @@ void TEXT_OT_move(wmOperatorType *ot) /******************* move select operator ********************/ -static int move_select_exec(bContext *C, wmOperator *op) +static int text_move_select_exec(bContext *C, wmOperator *op) { int type= RNA_enum_get(op->ptr, "type"); - return move_cursor(C, type, 1); + return text_move_cursor(C, type, 1); } void TEXT_OT_move_select(wmOperatorType *ot) @@ -1925,7 +1925,7 @@ void TEXT_OT_move_select(wmOperatorType *ot) ot->description= "Make selection from current cursor position to new cursor position type"; /* api callbacks */ - ot->exec= move_select_exec; + ot->exec= text_move_select_exec; ot->poll= text_space_edit_poll; /* properties */ @@ -1934,7 +1934,7 @@ void TEXT_OT_move_select(wmOperatorType *ot) /******************* jump operator *********************/ -static int jump_exec(bContext *C, wmOperator *op) +static int text_jump_exec(bContext *C, wmOperator *op) { Text *text= CTX_data_edit_text(C); int line= RNA_int_get(op->ptr, "line"); @@ -1953,7 +1953,7 @@ static int jump_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int jump_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) +static int text_jump_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { return WM_operator_props_dialog_popup(C,op,200,100); @@ -1967,8 +1967,8 @@ void TEXT_OT_jump(wmOperatorType *ot) ot->description= "Jump cursor to line"; /* api callbacks */ - ot->invoke= jump_invoke; - ot->exec= jump_exec; + ot->invoke= text_jump_invoke; + ot->exec= text_jump_exec; ot->poll= text_edit_poll; /* properties */ @@ -1984,7 +1984,7 @@ static EnumPropertyItem delete_type_items[]= { {DEL_PREV_WORD, "PREVIOUS_WORD", 0, "Previous Word", ""}, {0, NULL, 0, NULL, NULL}}; -static int delete_exec(bContext *C, wmOperator *op) +static int text_delete_exec(bContext *C, wmOperator *op) { Text *text= CTX_data_edit_text(C); int type= RNA_enum_get(op->ptr, "type"); @@ -2007,7 +2007,7 @@ static int delete_exec(bContext *C, wmOperator *op) /* run the script while editing, evil but useful */ if(CTX_wm_space_text(C)->live_edit) - run_script(C, NULL); + text_run_script(C, NULL); return OPERATOR_FINISHED; } @@ -2020,7 +2020,7 @@ void TEXT_OT_delete(wmOperatorType *ot) ot->description= "Delete text by cursor position"; /* api callbacks */ - ot->exec= delete_exec; + ot->exec= text_delete_exec; ot->poll= text_edit_poll; /* properties */ @@ -2029,7 +2029,7 @@ void TEXT_OT_delete(wmOperatorType *ot) /******************* toggle overwrite operator **********************/ -static int toggle_overwrite_exec(bContext *C, wmOperator *UNUSED(op)) +static int text_toggle_overwrite_exec(bContext *C, wmOperator *UNUSED(op)) { SpaceText *st= CTX_wm_space_text(C); @@ -2048,14 +2048,14 @@ void TEXT_OT_overwrite_toggle(wmOperatorType *ot) ot->description= "Toggle overwrite while typing"; /* api callbacks */ - ot->exec= toggle_overwrite_exec; + ot->exec= text_toggle_overwrite_exec; ot->poll= text_space_edit_poll; } /******************* scroll operator **********************/ /* Moves the view vertically by the specified number of lines */ -static void screen_skip(SpaceText *st, ARegion *ar, int lines) +static void txt_screen_skip(SpaceText *st, ARegion *ar, int lines) { int last; @@ -2091,7 +2091,7 @@ static int text_scroll_poll(bContext *C) return CTX_data_edit_text(C) != NULL; } -static int scroll_exec(bContext *C, wmOperator *op) +static int text_scroll_exec(bContext *C, wmOperator *op) { SpaceText *st= CTX_wm_space_text(C); ARegion *ar= CTX_wm_region(C); @@ -2101,14 +2101,14 @@ static int scroll_exec(bContext *C, wmOperator *op) if(lines == 0) return OPERATOR_CANCELLED; - screen_skip(st, ar, lines*U.wheellinescroll); + txt_screen_skip(st, ar, lines*U.wheellinescroll); ED_area_tag_redraw(CTX_wm_area(C)); return OPERATOR_FINISHED; } -static void scroll_apply(bContext *C, wmOperator *op, wmEvent *event) +static void text_scroll_apply(bContext *C, wmOperator *op, wmEvent *event) { SpaceText *st= CTX_wm_space_text(C); ARegion *ar= CTX_wm_region(C); @@ -2140,7 +2140,7 @@ static void scroll_apply(bContext *C, wmOperator *op, wmEvent *event) } if(txtdelta[0] || txtdelta[1]) { - screen_skip(st, ar, txtdelta[1]); + txt_screen_skip(st, ar, txtdelta[1]); if(st->wordwrap) { st->left= 0; @@ -2165,7 +2165,7 @@ static void scroll_exit(bContext *C, wmOperator *op) MEM_freeN(op->customdata); } -static int scroll_modal(bContext *C, wmOperator *op, wmEvent *event) +static int text_scroll_modal(bContext *C, wmOperator *op, wmEvent *event) { TextScroll *tsc= op->customdata; SpaceText *st= CTX_wm_space_text(C); @@ -2174,7 +2174,7 @@ static int scroll_modal(bContext *C, wmOperator *op, wmEvent *event) switch(event->type) { case MOUSEMOVE: if(tsc->zone == SCROLLHANDLE_BAR) - scroll_apply(C, op, event); + text_scroll_apply(C, op, event); break; case LEFTMOUSE: case RIGHTMOUSE: @@ -2198,20 +2198,20 @@ static int scroll_modal(bContext *C, wmOperator *op, wmEvent *event) return OPERATOR_RUNNING_MODAL; } -static int scroll_cancel(bContext *C, wmOperator *op) +static int text_scroll_cancel(bContext *C, wmOperator *op) { scroll_exit(C, op); return OPERATOR_CANCELLED; } -static int scroll_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int text_scroll_invoke(bContext *C, wmOperator *op, wmEvent *event) { SpaceText *st= CTX_wm_space_text(C); TextScroll *tsc; if(RNA_property_is_set(op->ptr, "lines")) - return scroll_exec(C, op); + return text_scroll_exec(C, op); tsc= MEM_callocN(sizeof(TextScroll), "TextScroll"); tsc->first= 1; @@ -2230,7 +2230,7 @@ static int scroll_invoke(bContext *C, wmOperator *op, wmEvent *event) tsc->delta[1] = (event->y - event->prevy)*st->lheight/4; tsc->first = 0; tsc->scrollbar = 0; - scroll_apply(C, op, event); + text_scroll_apply(C, op, event); scroll_exit(C, op); return OPERATOR_FINISHED; } @@ -2251,10 +2251,10 @@ void TEXT_OT_scroll(wmOperatorType *ot) ot->description= "Scroll text screen"; /* api callbacks */ - ot->exec= scroll_exec; - ot->invoke= scroll_invoke; - ot->modal= scroll_modal; - ot->cancel= scroll_cancel; + ot->exec= text_scroll_exec; + ot->invoke= text_scroll_invoke; + ot->modal= text_scroll_modal; + ot->cancel= text_scroll_cancel; ot->poll= text_scroll_poll; /* flags */ @@ -2282,7 +2282,7 @@ static int text_region_scroll_poll(bContext *C) return 1; } -static int scroll_bar_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int text_scroll_bar_invoke(bContext *C, wmOperator *op, wmEvent *event) { SpaceText *st= CTX_wm_space_text(C); ARegion *ar= CTX_wm_region(C); @@ -2291,7 +2291,7 @@ static int scroll_bar_invoke(bContext *C, wmOperator *op, wmEvent *event) int zone= -1; if(RNA_property_is_set(op->ptr, "lines")) - return scroll_exec(C, op); + return text_scroll_exec(C, op); /* verify we are in the right zone */ if(mval[0]>st->txtbar.xmin && mval[0]<st->txtbar.xmax) { @@ -2334,9 +2334,9 @@ void TEXT_OT_scroll_bar(wmOperatorType *ot) ot->description= "Scroll text screen"; /* api callbacks */ - ot->invoke= scroll_bar_invoke; - ot->modal= scroll_modal; - ot->cancel= scroll_cancel; + ot->invoke= text_scroll_bar_invoke; + ot->modal= text_scroll_modal; + ot->cancel= text_scroll_cancel; ot->poll= text_region_scroll_poll; /* flags */ @@ -2354,7 +2354,7 @@ typedef struct SetSelection { short old[2]; } SetSelection; -static void set_cursor_to_pos(SpaceText *st, ARegion *ar, int x, int y, int sel) +static void text_cursor_set_to_pos(SpaceText *st, ARegion *ar, int x, int y, int sel) { FlattenString fs; Text *text= st->text; @@ -2514,7 +2514,7 @@ static void set_cursor_to_pos(SpaceText *st, ARegion *ar, int x, int y, int sel) if(!sel) txt_pop_sel(text); } -static void set_cursor_apply(bContext *C, wmOperator *op, wmEvent *event) +static void text_cursor_set_apply(bContext *C, wmOperator *op, wmEvent *event) { SpaceText *st= CTX_wm_space_text(C); ARegion *ar= CTX_wm_region(C); @@ -2522,9 +2522,9 @@ static void set_cursor_apply(bContext *C, wmOperator *op, wmEvent *event) if(event->mval[1]<0 || event->mval[1]>ar->winy) { int d= (ssel->old[1]-event->mval[1])*st->pix_per_line; - if(d) screen_skip(st, ar, d); + if(d) txt_screen_skip(st, ar, d); - set_cursor_to_pos(st, ar, event->mval[0], event->mval[1]<0?0:ar->winy, 1); + text_cursor_set_to_pos(st, ar, event->mval[0], event->mval[1]<0?0:ar->winy, 1); text_update_cursor_moved(C); WM_event_add_notifier(C, NC_TEXT|ND_CURSOR, st->text); @@ -2533,14 +2533,14 @@ static void set_cursor_apply(bContext *C, wmOperator *op, wmEvent *event) if(event->mval[0]>ar->winx) st->left++; else if(event->mval[0]<0 && st->left>0) st->left--; - set_cursor_to_pos(st, ar, event->mval[0], event->mval[1], 1); + text_cursor_set_to_pos(st, ar, event->mval[0], event->mval[1], 1); text_update_cursor_moved(C); WM_event_add_notifier(C, NC_TEXT|ND_CURSOR, st->text); // XXX PIL_sleep_ms(10); } else { - set_cursor_to_pos(st, ar, event->mval[0], event->mval[1], 1); + text_cursor_set_to_pos(st, ar, event->mval[0], event->mval[1], 1); text_update_cursor_moved(C); WM_event_add_notifier(C, NC_TEXT|ND_CURSOR, st->text); @@ -2550,7 +2550,7 @@ static void set_cursor_apply(bContext *C, wmOperator *op, wmEvent *event) } } -static void set_cursor_exit(bContext *C, wmOperator *op) +static void text_cursor_set_exit(bContext *C, wmOperator *op) { SpaceText *st= CTX_wm_space_text(C); Text *text= st->text; @@ -2576,7 +2576,7 @@ static void set_cursor_exit(bContext *C, wmOperator *op) MEM_freeN(ssel); } -static int set_selection_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int text_set_selection_invoke(bContext *C, wmOperator *op, wmEvent *event) { SpaceText *st= CTX_wm_space_text(C); SetSelection *ssel; @@ -2596,30 +2596,30 @@ static int set_selection_invoke(bContext *C, wmOperator *op, wmEvent *event) WM_event_add_modal_handler(C, op); - set_cursor_apply(C, op, event); + text_cursor_set_apply(C, op, event); return OPERATOR_RUNNING_MODAL; } -static int set_selection_modal(bContext *C, wmOperator *op, wmEvent *event) +static int text_set_selection_modal(bContext *C, wmOperator *op, wmEvent *event) { switch(event->type) { case LEFTMOUSE: case MIDDLEMOUSE: case RIGHTMOUSE: - set_cursor_exit(C, op); + text_cursor_set_exit(C, op); return OPERATOR_FINISHED; case MOUSEMOVE: - set_cursor_apply(C, op, event); + text_cursor_set_apply(C, op, event); break; } return OPERATOR_RUNNING_MODAL; } -static int set_selection_cancel(bContext *C, wmOperator *op) +static int text_set_selection_cancel(bContext *C, wmOperator *op) { - set_cursor_exit(C, op); + text_cursor_set_exit(C, op); return OPERATOR_FINISHED; } @@ -2631,9 +2631,9 @@ void TEXT_OT_selection_set(wmOperatorType *ot) ot->description= "Set cursor selection"; /* api callbacks */ - ot->invoke= set_selection_invoke; - ot->modal= set_selection_modal; - ot->cancel= set_selection_cancel; + ot->invoke= text_set_selection_invoke; + ot->modal= text_set_selection_modal; + ot->cancel= text_set_selection_cancel; ot->poll= text_region_edit_poll; /* properties */ @@ -2642,7 +2642,7 @@ void TEXT_OT_selection_set(wmOperatorType *ot) /******************* set cursor operator **********************/ -static int set_cursor_exec(bContext *C, wmOperator *op) +static int text_cursor_set_exec(bContext *C, wmOperator *op) { SpaceText *st= CTX_wm_space_text(C); Text *text= st->text; @@ -2654,7 +2654,7 @@ static int set_cursor_exec(bContext *C, wmOperator *op) oldl= txt_get_span(text->lines.first, text->curl); oldc= text->curc; - set_cursor_to_pos(st, ar, x, y, 0); + text_cursor_set_to_pos(st, ar, x, y, 0); txt_undo_add_toop(text, UNDO_CTO, oldl, oldc, txt_get_span(text->lines.first, text->curl), text->curc); @@ -2664,7 +2664,7 @@ static int set_cursor_exec(bContext *C, wmOperator *op) return OPERATOR_PASS_THROUGH; } -static int set_cursor_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int text_cursor_set_invoke(bContext *C, wmOperator *op, wmEvent *event) { SpaceText *st= CTX_wm_space_text(C); @@ -2674,7 +2674,7 @@ static int set_cursor_invoke(bContext *C, wmOperator *op, wmEvent *event) RNA_int_set(op->ptr, "x", event->mval[0]); RNA_int_set(op->ptr, "y", event->mval[1]); - return set_cursor_exec(C, op); + return text_cursor_set_exec(C, op); } void TEXT_OT_cursor_set(wmOperatorType *ot) @@ -2685,8 +2685,8 @@ void TEXT_OT_cursor_set(wmOperatorType *ot) ot->description= "Set cursor position"; /* api callbacks */ - ot->invoke= set_cursor_invoke; - ot->exec= set_cursor_exec; + ot->invoke= text_cursor_set_invoke; + ot->exec= text_cursor_set_exec; ot->poll= text_region_edit_poll; /* properties */ @@ -2696,7 +2696,7 @@ void TEXT_OT_cursor_set(wmOperatorType *ot) /******************* line number operator **********************/ -static int line_number_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *event) +static int text_line_number_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *event) { SpaceText *st= CTX_wm_space_text(C); Text *text= CTX_data_edit_text(C); @@ -2741,13 +2741,13 @@ void TEXT_OT_line_number(wmOperatorType *ot) ot->description= "The current line number"; /* api callbacks */ - ot->invoke= line_number_invoke; + ot->invoke= text_line_number_invoke; ot->poll= text_region_edit_poll; } /******************* insert operator **********************/ -static int insert_exec(bContext *C, wmOperator *op) +static int text_insert_exec(bContext *C, wmOperator *op) { SpaceText *st= CTX_wm_space_text(C); Text *text= CTX_data_edit_text(C); @@ -2781,7 +2781,7 @@ static int insert_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int insert_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int text_insert_invoke(bContext *C, wmOperator *op, wmEvent *event) { int ret; @@ -2799,11 +2799,11 @@ static int insert_invoke(bContext *C, wmOperator *op, wmEvent *event) } } - ret = insert_exec(C, op); + ret = text_insert_exec(C, op); /* run the script while editing, evil but useful */ if(ret==OPERATOR_FINISHED && CTX_wm_space_text(C)->live_edit) - run_script(C, NULL); + text_run_script(C, NULL); return ret; } @@ -2816,8 +2816,8 @@ void TEXT_OT_insert(wmOperatorType *ot) ot->description= "Insert text at cursor position"; /* api callbacks */ - ot->exec= insert_exec; - ot->invoke= insert_invoke; + ot->exec= text_insert_exec; + ot->invoke= text_insert_invoke; ot->poll= text_edit_poll; /* properties */ @@ -2831,7 +2831,7 @@ void TEXT_OT_insert(wmOperatorType *ot) #define TEXT_REPLACE 1 #define TEXT_MARK_ALL 2 -static int find_and_replace(bContext *C, wmOperator *op, short mode) +static int text_find_and_replace(bContext *C, wmOperator *op, short mode) { Main *bmain= CTX_data_main(C); SpaceText *st= CTX_wm_space_text(C); @@ -2922,9 +2922,9 @@ static int find_and_replace(bContext *C, wmOperator *op, short mode) return OPERATOR_FINISHED; } -static int find_exec(bContext *C, wmOperator *op) +static int text_find_exec(bContext *C, wmOperator *op) { - return find_and_replace(C, op, TEXT_FIND); + return text_find_and_replace(C, op, TEXT_FIND); } void TEXT_OT_find(wmOperatorType *ot) @@ -2935,15 +2935,15 @@ void TEXT_OT_find(wmOperatorType *ot) ot->description= "Find specified text"; /* api callbacks */ - ot->exec= find_exec; + ot->exec= text_find_exec; ot->poll= text_space_edit_poll; } /******************* replace operator *********************/ -static int replace_exec(bContext *C, wmOperator *op) +static int text_replace_exec(bContext *C, wmOperator *op) { - return find_and_replace(C, op, TEXT_REPLACE); + return text_find_and_replace(C, op, TEXT_REPLACE); } void TEXT_OT_replace(wmOperatorType *ot) @@ -2954,15 +2954,15 @@ void TEXT_OT_replace(wmOperatorType *ot) ot->description= "Replace text with the specified text"; /* api callbacks */ - ot->exec= replace_exec; + ot->exec= text_replace_exec; ot->poll= text_space_edit_poll; } /******************* mark all operator *********************/ -static int mark_all_exec(bContext *C, wmOperator *op) +static int text_mark_all_exec(bContext *C, wmOperator *op) { - return find_and_replace(C, op, TEXT_MARK_ALL); + return text_find_and_replace(C, op, TEXT_MARK_ALL); } void TEXT_OT_mark_all(wmOperatorType *ot) @@ -2973,13 +2973,13 @@ void TEXT_OT_mark_all(wmOperatorType *ot) ot->description= "Mark all specified text"; /* api callbacks */ - ot->exec= mark_all_exec; + ot->exec= text_mark_all_exec; ot->poll= text_space_edit_poll; } /******************* find set selected *********************/ -static int find_set_selected_exec(bContext *C, wmOperator *op) +static int text_find_set_selected_exec(bContext *C, wmOperator *op) { SpaceText *st= CTX_wm_space_text(C); Text *text= CTX_data_edit_text(C); @@ -2992,7 +2992,7 @@ static int find_set_selected_exec(bContext *C, wmOperator *op) if(!st->findstr[0]) return OPERATOR_FINISHED; - return find_and_replace(C, op, TEXT_FIND); + return text_find_and_replace(C, op, TEXT_FIND); } void TEXT_OT_find_set_selected(wmOperatorType *ot) @@ -3003,13 +3003,13 @@ void TEXT_OT_find_set_selected(wmOperatorType *ot) ot->description= "Find specified text and set as selected"; /* api callbacks */ - ot->exec= find_set_selected_exec; + ot->exec= text_find_set_selected_exec; ot->poll= text_space_edit_poll; } /******************* replace set selected *********************/ -static int replace_set_selected_exec(bContext *C, wmOperator *UNUSED(op)) +static int text_replace_set_selected_exec(bContext *C, wmOperator *UNUSED(op)) { SpaceText *st= CTX_wm_space_text(C); Text *text= CTX_data_edit_text(C); @@ -3030,7 +3030,7 @@ void TEXT_OT_replace_set_selected(wmOperatorType *ot) ot->description= "Replace text with specified text and set as selected"; /* api callbacks */ - ot->exec= replace_set_selected_exec; + ot->exec= text_replace_set_selected_exec; ot->poll= text_space_edit_poll; } @@ -3099,18 +3099,18 @@ static void text_ignore_modified(Text *text) text->mtime= st.st_mtime; } -static int resolve_conflict_exec(bContext *C, wmOperator *op) +static int text_resolve_conflict_exec(bContext *C, wmOperator *op) { Text *text= CTX_data_edit_text(C); int resolution= RNA_enum_get(op->ptr, "resolution"); switch(resolution) { case RESOLVE_RELOAD: - return reload_exec(C, op); + return text_reload_exec(C, op); case RESOLVE_SAVE: - return save_exec(C, op); + return text_save_exec(C, op); case RESOLVE_MAKE_INTERNAL: - return make_internal_exec(C, op); + return text_make_internal_exec(C, op); case RESOLVE_IGNORE: text_ignore_modified(text); return OPERATOR_FINISHED; @@ -3119,7 +3119,7 @@ static int resolve_conflict_exec(bContext *C, wmOperator *op) return OPERATOR_CANCELLED; } -static int resolve_conflict_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) +static int text_resolve_conflict_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { Text *text= CTX_data_edit_text(C); uiPopupMenu *pup; @@ -3165,9 +3165,9 @@ void TEXT_OT_resolve_conflict(wmOperatorType *ot) ot->description= "When external text is out of sync, resolve the conflict"; /* api callbacks */ - ot->exec= resolve_conflict_exec; - ot->invoke= resolve_conflict_invoke; - ot->poll= save_poll; + ot->exec= text_resolve_conflict_exec; + ot->invoke= text_resolve_conflict_invoke; + ot->poll= text_save_poll; /* properties */ RNA_def_enum(ot->srna, "resolution", resolution_items, RESOLVE_IGNORE, "Resolution", "How to solve conflict due to differences in internal and external text"); @@ -3175,7 +3175,7 @@ void TEXT_OT_resolve_conflict(wmOperatorType *ot) /********************** to 3d object operator *****************/ -static int to_3d_object_exec(bContext *C, wmOperator *op) +static int text_to_3d_object_exec(bContext *C, wmOperator *op) { Text *text= CTX_data_edit_text(C); int split_lines= RNA_boolean_get(op->ptr, "split_lines"); @@ -3193,7 +3193,7 @@ void TEXT_OT_to_3d_object(wmOperatorType *ot) ot->description= "Create 3d text object from active text data block"; /* api callbacks */ - ot->exec= to_3d_object_exec; + ot->exec= text_to_3d_object_exec; ot->poll= text_edit_poll; /* flags */ diff --git a/source/blender/makesdna/intern/makesdna.c b/source/blender/makesdna/intern/makesdna.c index 39cb1743c25..a966523d990 100644 --- a/source/blender/makesdna/intern/makesdna.c +++ b/source/blender/makesdna/intern/makesdna.c @@ -168,35 +168,35 @@ static int additional_slen_offset; * \param str char * \param len int */ -int add_type(const char *str, int len); +static int add_type(const char *str, int len); /** * Add variable \c str to * \param str */ -int add_name(char *str); +static int add_name(const char *str); /** * Search whether this structure type was already found, and if not, * add it. */ -short *add_struct(int namecode); +static short *add_struct(int namecode); /** * Remove comments from this buffer. Assumes that the buffer refers to * ascii-code text. */ -int preprocess_include(char *maindata, int len); +static int preprocess_include(char *maindata, int len); /** * Scan this file for serializable types. */ -int convert_include(char *filename); +static int convert_include(char *filename); /** * Determine how many bytes are needed for an array. */ -int arraysize(char *astr, int len); +static int arraysize(char *astr, int len); /** * Determine how many bytes are needed for each struct. @@ -267,12 +267,12 @@ int add_type(const char *str, int len) * cases, unfortunately. These are explicitly checked. * * */ -int add_name(char *str) +static int add_name(const char *str) { int nr, i, j, k; char *cp; char buf[255]; /* stupid limit, change it :) */ - char *name; + const char *name; additional_slen_offset = 0; @@ -422,7 +422,7 @@ short *add_struct(int namecode) return sp; } -int preprocess_include(char *maindata, int len) +static int preprocess_include(char *maindata, int len) { int a, newlen, comment = 0; char *cp, *temp, *md; @@ -1087,7 +1087,7 @@ static int make_structDNA(char *baseDirectory, FILE *file) /* ************************* END MAKE DNA ********************** */ -static void make_bad_file(char *file, int line) +static void make_bad_file(const char *file, int line) { FILE *fp= fopen(file, "w"); fprintf(fp, "#error \"Error! can't make correct DNA.c file from %s:%d, STUPID!\"\n", __FILE__, line); diff --git a/source/blender/makesrna/intern/makesrna.c b/source/blender/makesrna/intern/makesrna.c index d7fb9536587..adedcbb18b3 100644 --- a/source/blender/makesrna/intern/makesrna.c +++ b/source/blender/makesrna/intern/makesrna.c @@ -2768,14 +2768,14 @@ static void rna_generate_header_cpp(BlenderRNA *brna, FILE *f) fprintf(f, "}\n\n#endif /* __RNA_BLENDER_CPP_H__ */\n\n"); } -static void make_bad_file(char *file, int line) +static void make_bad_file(const char *file, int line) { FILE *fp= fopen(file, "w"); fprintf(fp, "#error \"Error! can't make correct RNA file from %s:%d, STUPID!\"\n", __FILE__, line); fclose(fp); } -static int rna_preprocess(char *outfile) +static int rna_preprocess(const char *outfile) { BlenderRNA *brna; StructDefRNA *ds; diff --git a/source/blender/python/generic/bpy_internal_import.c b/source/blender/python/generic/bpy_internal_import.c index ac54cef7d4d..293ade35584 100644 --- a/source/blender/python/generic/bpy_internal_import.c +++ b/source/blender/python/generic/bpy_internal_import.c @@ -124,7 +124,7 @@ PyObject *bpy_text_import(Text *text) return PyImport_ExecCodeModule(modulename, text->compiled); } -PyObject *bpy_text_import_name(char *name, int *found) +PyObject *bpy_text_import_name(const char *name, int *found) { Text *text; char txtname[MAX_ID_NAME-2]; diff --git a/source/blender/python/generic/bpy_internal_import.h b/source/blender/python/generic/bpy_internal_import.h index 8bc10234a9b..2ce644715e9 100644 --- a/source/blender/python/generic/bpy_internal_import.h +++ b/source/blender/python/generic/bpy_internal_import.h @@ -49,7 +49,7 @@ struct Text; void bpy_import_init(PyObject *builtins); PyObject* bpy_text_import(struct Text *text); -PyObject* bpy_text_import_name(char *name, int *found); +PyObject* bpy_text_import_name(const char *name, int *found); PyObject* bpy_text_reimport(PyObject *module, int *found); /* void bpy_text_clear_modules(int clear_all);*/ /* Clear user modules */ diff --git a/source/blender/python/intern/bpy_library.c b/source/blender/python/intern/bpy_library.c index 651a626244f..382a513f40a 100644 --- a/source/blender/python/intern/bpy_library.c +++ b/source/blender/python/intern/bpy_library.c @@ -310,13 +310,14 @@ static void bpy_lib_exit_warn_type(BPy_Library *self, PyObject *item) static PyObject *bpy_lib_exit(BPy_Library *self, PyObject *UNUSED(args)) { + Main *bmain= CTX_data_main(BPy_GetContext()); Main *mainl= NULL; int err= 0; flag_all_listbases_ids(LIB_PRE_EXISTING, 1); /* here appending/linking starts */ - mainl= BLO_library_append_begin(CTX_data_main(BPy_GetContext()), &(self->blo_handle), self->relpath); + mainl= BLO_library_append_begin(bmain, &(self->blo_handle), self->relpath); { int i= 0, code; @@ -399,7 +400,7 @@ static PyObject *bpy_lib_exit(BPy_Library *self, PyObject *UNUSED(args)) /* append, rather than linking */ if ((self->flag & FILE_LINK)==0) { Library *lib= BLI_findstring(&G.main->library, self->abspath, offsetof(Library, name)); - if (lib) all_local(lib, 1); + if (lib) BKE_library_make_local(bmain, lib, 1); else BLI_assert(!"cant find name of just added library!"); } } diff --git a/source/blender/quicktime/SConscript b/source/blender/quicktime/SConscript index a128ded965c..db1d4a4f1ab 100644 --- a/source/blender/quicktime/SConscript +++ b/source/blender/quicktime/SConscript @@ -35,6 +35,6 @@ defs=['WITH_QUICKTIME'] if env['WITH_GHOST_COCOA']: defs.append('GHOST_COCOA') - env.BlenderLib ('bf_quicktime', sources=source_files, includes=incs, defines=defs, libtype=types, priority=priorities, cc_compilerchange='/usr/bin/gcc-4.2', cxx_compilerchange='/usr/bin/g++-4.2') # always use Apple-gcc-4.2 for objC language, for gnu-compilers do not support it fully yet + env.BlenderLib ('bf_quicktime', sources=source_files, includes=incs, defines=defs, libtype=types, priority=priorities, cc_compilerchange='/usr/bin/gcc', cxx_compilerchange='/usr/bin/g++') # always use default-Apple-gcc for objC language, gnu-compilers do not support it fully yet else: env.BlenderLib ('bf_quicktime', sources=source_files, includes=incs, defines=defs, libtype=types, priority=priorities) diff --git a/source/blender/render/intern/source/pipeline.c b/source/blender/render/intern/source/pipeline.c index bbe32765443..64b36c1fd12 100644 --- a/source/blender/render/intern/source/pipeline.c +++ b/source/blender/render/intern/source/pipeline.c @@ -405,7 +405,7 @@ static const char *get_pass_name(int passtype, int channel) return "Unknown"; } -static int passtype_from_name(char *str) +static int passtype_from_name(const char *str) { if(strcmp(str, "Combined")==0) diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c index a817761bd65..32d4ba857e6 100644 --- a/source/blender/windowmanager/intern/wm_operators.c +++ b/source/blender/windowmanager/intern/wm_operators.c @@ -1745,7 +1745,7 @@ static int wm_link_append_exec(bContext *C, wmOperator *op) /* append, rather than linking */ if((flag & FILE_LINK)==0) { Library *lib= BLI_findstring(&bmain->library, libname, offsetof(Library, filepath)); - if(lib) all_local(lib, 1); + if(lib) BKE_library_make_local(bmain, lib, 1); else BLI_assert(!"cant find name of just added library!"); } diff --git a/source/gameengine/Converter/KX_ConvertActuators.cpp b/source/gameengine/Converter/KX_ConvertActuators.cpp index 6e9c51eaa83..f4b173763d3 100644 --- a/source/gameengine/Converter/KX_ConvertActuators.cpp +++ b/source/gameengine/Converter/KX_ConvertActuators.cpp @@ -111,7 +111,7 @@ KX_BLENDERTRUNC needed to round 'almost' zero values to zero, else velocities et #define KX_BLENDERTRUNC(x) (( x < 0.0001 && x > -0.0001 ) ? 0.0 : x) -void BL_ConvertActuators(char* maggiename, +void BL_ConvertActuators(const char* maggiename, struct Object* blenderobject, KX_GameObject* gameobj, SCA_LogicManager* logicmgr, diff --git a/source/gameengine/Converter/KX_ConvertActuators.h b/source/gameengine/Converter/KX_ConvertActuators.h index e1c1d22337c..836bcd860fa 100644 --- a/source/gameengine/Converter/KX_ConvertActuators.h +++ b/source/gameengine/Converter/KX_ConvertActuators.h @@ -32,7 +32,7 @@ #ifndef __KX_CONVERTACTUATORS_H #define __KX_CONVERTACTUATORS_H -void BL_ConvertActuators(char* maggiename, +void BL_ConvertActuators(const char* maggiename, struct Object* blenderobject, class KX_GameObject* gameobj, class SCA_LogicManager* logicmgr, diff --git a/source/gameengine/GamePlayer/common/GPC_Engine.cpp b/source/gameengine/GamePlayer/common/GPC_Engine.cpp index d846e9ae83c..6548310b99c 100644 --- a/source/gameengine/GamePlayer/common/GPC_Engine.cpp +++ b/source/gameengine/GamePlayer/common/GPC_Engine.cpp @@ -131,7 +131,7 @@ GPC_Engine::~GPC_Engine() } -bool GPC_Engine::Start(char *filename) +bool GPC_Engine::Start(const char *filename) { ReportList reports; BlendFileData *bfd; diff --git a/source/gameengine/GamePlayer/common/GPC_Engine.h b/source/gameengine/GamePlayer/common/GPC_Engine.h index 5df8834dbae..70e5a3ee631 100644 --- a/source/gameengine/GamePlayer/common/GPC_Engine.h +++ b/source/gameengine/GamePlayer/common/GPC_Engine.h @@ -102,9 +102,9 @@ public: // Initialize() functions are not put here since they have // different prototypes for Unix and Windows void StartLoadingAnimation(); - bool Start(char *filename); // file-on-disk starter + bool Start(const char *filename); // file-on-disk starter bool Start(unsigned char *blenderDataBuffer, - unsigned int blenderDataBufferSize); // file-in-memory starter + unsigned int blenderDataBufferSize); // file-in-memory starter void Stop(); virtual void Exit(); diff --git a/source/gameengine/Ketsji/KX_CameraActuator.cpp b/source/gameengine/Ketsji/KX_CameraActuator.cpp index 47c10439f02..d4aae68dafb 100644 --- a/source/gameengine/Ketsji/KX_CameraActuator.cpp +++ b/source/gameengine/Ketsji/KX_CameraActuator.cpp @@ -346,7 +346,7 @@ bool KX_CameraActuator::Update(double curtime, bool frame) return true; } -CValue *KX_CameraActuator::findObject(char *obName) +CValue *KX_CameraActuator::findObject(const char *obName) { /* hook to object system */ return NULL; diff --git a/source/gameengine/Ketsji/KX_CameraActuator.h b/source/gameengine/Ketsji/KX_CameraActuator.h index 5c2535f9c3d..c06904ea56b 100644 --- a/source/gameengine/Ketsji/KX_CameraActuator.h +++ b/source/gameengine/Ketsji/KX_CameraActuator.h @@ -77,7 +77,7 @@ private : float m_damping; /* get the KX_IGameObject with this name */ - CValue *findObject(char *obName); + CValue *findObject(const char *obName); /* parse x or y to a toggle pick */ bool string2axischoice(const char *axisString); diff --git a/source/gameengine/Ketsji/KX_IpoActuator.cpp b/source/gameengine/Ketsji/KX_IpoActuator.cpp index 563ceba1d64..878bdcedfda 100644 --- a/source/gameengine/Ketsji/KX_IpoActuator.cpp +++ b/source/gameengine/Ketsji/KX_IpoActuator.cpp @@ -382,7 +382,8 @@ void KX_IpoActuator::ResetStartTime() this->m_starttime = -2.0*fabs(this->m_endframe - this->m_startframe) - 1.0; } -int KX_IpoActuator::string2mode(char* modename) { +int KX_IpoActuator::string2mode(const char *modename) +{ IpoActType res = KX_ACT_IPO_NODEF; if (strcmp(modename, S_KX_ACT_IPO_PLAY_STRING)==0) { diff --git a/source/gameengine/Ketsji/KX_IpoActuator.h b/source/gameengine/Ketsji/KX_IpoActuator.h index e9820fa0eeb..5ee008ac5e3 100644 --- a/source/gameengine/Ketsji/KX_IpoActuator.h +++ b/source/gameengine/Ketsji/KX_IpoActuator.h @@ -118,7 +118,7 @@ public: static const char *S_KX_ACT_IPO_KEY2KEY_STRING; static const char *S_KX_ACT_IPO_FROM_PROP_STRING; - int string2mode(char* modename); + int string2mode(const char *modename); int m_type; diff --git a/source/gameengine/Ketsji/KX_PythonInit.cpp b/source/gameengine/Ketsji/KX_PythonInit.cpp index 2f7b0c06dcd..25145e87b78 100644 --- a/source/gameengine/Ketsji/KX_PythonInit.cpp +++ b/source/gameengine/Ketsji/KX_PythonInit.cpp @@ -1089,7 +1089,7 @@ static PyObject* gPyDisableMotionBlur(PyObject*) Py_RETURN_NONE; } -int getGLSLSettingFlag(char *setting) +static int getGLSLSettingFlag(const char *setting) { if(strcmp(setting, "lights") == 0) return GAME_GLSL_NO_LIGHTS; @@ -1725,7 +1725,7 @@ static void backupPySysObjects(void) * * "/home/me/foo.blend" -> "/home/me/scripts" */ -static void initPySysObjects__append(PyObject *sys_path, char *filename) +static void initPySysObjects__append(PyObject *sys_path, const char *filename) { PyObject *item; char expanded[FILE_MAXDIR + FILE_MAXFILE]; @@ -2325,7 +2325,7 @@ int loadGamePythonConfig(char *marshal_buffer, int marshal_length) return 0; } -void pathGamePythonConfig( char *path ) +void pathGamePythonConfig(char *path) { int len = strlen(gp_GamePythonPathOrig); // Always use the first loaded blend filename @@ -2339,7 +2339,7 @@ void pathGamePythonConfig( char *path ) } } -void setGamePythonPath(char *path) +void setGamePythonPath(const char *path) { BLI_strncpy(gp_GamePythonPath, path, sizeof(gp_GamePythonPath)); BLI_cleanup_file(NULL, gp_GamePythonPath); /* not absolutely needed but makes resolving path problems less confusing later */ diff --git a/source/gameengine/Ketsji/KX_PythonInit.h b/source/gameengine/Ketsji/KX_PythonInit.h index dd2a75d793e..40d2d38a465 100644 --- a/source/gameengine/Ketsji/KX_PythonInit.h +++ b/source/gameengine/Ketsji/KX_PythonInit.h @@ -54,7 +54,7 @@ void exitGamePythonScripting(); void setupGamePython(KX_KetsjiEngine* ketsjiengine, KX_Scene* startscene, Main *blenderdata, PyObject *pyGlobalDict, PyObject **gameLogic, PyObject **gameLogic_keys, int argc, char** argv); -void setGamePythonPath(char *path); +void setGamePythonPath(const char *path); void resetGamePythonPath(); void pathGamePythonConfig( char *path ); int saveGamePythonConfig( char **marshal_buffer); diff --git a/source/gameengine/Ketsji/KX_SceneActuator.cpp b/source/gameengine/Ketsji/KX_SceneActuator.cpp index af6de882c99..16474437142 100644 --- a/source/gameengine/Ketsji/KX_SceneActuator.cpp +++ b/source/gameengine/Ketsji/KX_SceneActuator.cpp @@ -190,7 +190,7 @@ bool KX_SceneActuator::Update() /* returns a camera if the name is valid */ -KX_Camera* KX_SceneActuator::FindCamera(char *camName) +KX_Camera* KX_SceneActuator::FindCamera(const char *camName) { KX_SceneList* sl = m_KetsjiEngine->CurrentScenes(); STR_String name = STR_String(camName); @@ -208,7 +208,7 @@ KX_Camera* KX_SceneActuator::FindCamera(char *camName) -KX_Scene* KX_SceneActuator::FindScene(char * sceneName) +KX_Scene* KX_SceneActuator::FindScene(const char * sceneName) { return m_KetsjiEngine->FindScene(sceneName); } diff --git a/source/gameengine/Ketsji/KX_SceneActuator.h b/source/gameengine/Ketsji/KX_SceneActuator.h index 4dbd489d0c8..30f325a775e 100644 --- a/source/gameengine/Ketsji/KX_SceneActuator.h +++ b/source/gameengine/Ketsji/KX_SceneActuator.h @@ -54,9 +54,9 @@ class KX_SceneActuator : public SCA_IActuator class KX_Camera* m_camera; /** Is this a valid scene? */ - class KX_Scene* FindScene(char* sceneName); + class KX_Scene* FindScene(const char* sceneName); /** Is this a valid camera? */ - class KX_Camera* FindCamera(char* cameraName); + class KX_Camera* FindCamera(const char* cameraName); public: enum SCA_SceneActuatorMode diff --git a/source/gameengine/VideoTexture/Texture.cpp b/source/gameengine/VideoTexture/Texture.cpp index 2066afbbf27..ba9922d455f 100644 --- a/source/gameengine/VideoTexture/Texture.cpp +++ b/source/gameengine/VideoTexture/Texture.cpp @@ -107,7 +107,7 @@ RAS_IPolyMaterial * getMaterial (PyObject *obj, short matID) // get material ID -short getMaterialID (PyObject * obj, char * name) +short getMaterialID(PyObject * obj, const char *name) { // search for material for (short matID = 0;; ++matID) diff --git a/source/gameengine/VideoTexture/Texture.h b/source/gameengine/VideoTexture/Texture.h index 52e1dfeb148..4dce0021509 100644 --- a/source/gameengine/VideoTexture/Texture.h +++ b/source/gameengine/VideoTexture/Texture.h @@ -85,7 +85,7 @@ void loadTexture (unsigned int texId, unsigned int * texture, short * size, RAS_IPolyMaterial * getMaterial (PyObject *obj, short matID); // get material ID -short getMaterialID (PyObject * obj, char * name); +short getMaterialID (PyObject * obj, const char *name); // Exceptions extern ExceptionID MaterialNotAvail; |