svn merge -r41310:41329 ^/trunk/blender

This commit is contained in:
Campbell Barton 2011-10-28 05:17:09 +00:00
commit ff837cbe9b
52 changed files with 476 additions and 490 deletions

@ -67,7 +67,7 @@ Data Access
Accessing datablocks
^^^^^^^^^^^^^^^^^^^^
Python accesses Blender's data in the same way as the animation system and user interface, which means any setting that is changed via a button can also be changed from Python.
Python accesses Blender's data in the same way as the animation system and user interface; this implies that any setting that can be changed via a button can also be changed from Python.
Accessing data from the currently loaded blend file is done with the module :mod:`bpy.data`. This gives access to library data. For example:
@ -101,7 +101,7 @@ Unlike Python's dictionaries, both methods are acceptable; however, the index of
Accessing attributes
^^^^^^^^^^^^^^^^^^^^
Once you have a data block such as a material, object, groups etc. its attributes can be accessed just like changing a setting in the interface; in fact, the button tooltip also displays the Python attribute which can help in finding what settings to change in a script.
Once you have a data block, such as a material, object, groups etc., its attributes can be accessed much like you would change a setting using the graphical interface. In fact, the tooltip for each button also displays the Python attribute which can help in finding what settings to change in a script.
>>> bpy.data.objects[0].name
'Camera'
@ -179,7 +179,7 @@ So ``bpy.context.object = obj`` will raise an error.
But ``bpy.context.scene.objects.active = obj`` will work as expected.
The context attributes change depending on where it is accessed. The 3D view has different context members to the Console, so take care when accessing context attributes that the user state is known.
The context attributes change depending on where they are accessed. The 3D view has different context members than the console, so take care when accessing context attributes that the user state is known.
See :mod:`bpy.context` API reference
@ -256,6 +256,8 @@ To run the script:
#. Press Ctrl+Right twice to change to the Scripting layout.
#. Click the button labeled ``New`` and the confirmation pop up in order to create a new text block.
#. Press Ctrl+V to paste the code into the text panel (the upper left frame).
#. Click on the button **Run Script**.
@ -269,6 +271,7 @@ To run the script:
.. seealso:: The class members with the **bl_** prefix are documented in the API
reference :class:`bpy.types.Operator`
.. note:: The output from the ``main`` function is sent to the terminal; in order to see this, be sure to :ref:`use the terminal <use_the_terminal>`.
Example Panel
-------------
@ -285,6 +288,8 @@ To run the script:
#. Press Ctrl+Right twice to change to the Scripting layout
#. Click the button labeled ``New`` and the confirmation pop up in order to create a new text block.
#. Press Ctrl+V to paste the code into the text panel (the upper left frame)
#. Click on the button **Run Script**.
@ -310,7 +315,7 @@ Types
Blender defines a number of Python types but also uses Python native types.
Blender's Python API can be split up into 3 categories.
Blender's Python API can be split up into 3 categories.
Native Types

@ -7,6 +7,8 @@ Here are various suggestions that you might find useful when writing scripts.
Some of these are just python features that scripters may not have thought to use with blender, others are blender specific.
.. _use_the_terminal:
Use The Terminal
================

@ -102,7 +102,7 @@ sphinx-build doc/python_api/sphinx-in doc/python_api/sphinx-out
# extra info, not api reference docs
# stored in ./rst/info/
INFO_DOCS = (
("info_quickstart.rst", "Blender/Python Quickstart: new to blender/scripting and want to get you're feet wet?"),
("info_quickstart.rst", "Blender/Python Quickstart: new to blender/scripting and want to get your feet wet?"),
("info_overview.rst", "Blender/Python API Overview: a more complete explanation of python integration"),
("info_best_practice.rst", "Best Practice: Conventions to follow for writing good scripts"),
("info_tips_and_tricks.rst", "Tips and Tricks: Hints to help you while writeing scripts for blender"),

@ -107,8 +107,8 @@ if window_system in ('win32-vc', 'win32-mingw', 'cygwin', 'linuxcross', 'win64-v
if window_system in ('win32-vc', 'win64-vc'):
env.BlenderLib ('bf_intern_ghost', sources, Split(incs), defines=defs, libtype=['intern','player'], priority = [40,15]) #, cc_compileflags=env['CCFLAGS'].append('/WX') )
elif env['WITH_GHOST_COCOA']: # always use Apple-gcc-4.2 for objC language, for gnu-compilers do not support it fully yet
env.BlenderLib ('bf_intern_ghost', sources, Split(incs), defines=defs, libtype=['intern','player'], priority = [40,15], cc_compilerchange='/usr/bin/gcc-4.2', cxx_compilerchange='/usr/bin/g++-4.2' )
elif env['WITH_GHOST_COCOA']: # always use default-Apple-gcc for objC language, for gnu-compilers do not support it fully yet
env.BlenderLib ('bf_intern_ghost', sources, Split(incs), defines=defs, libtype=['intern','player'], priority = [40,15], cc_compilerchange='/usr/bin/gcc', cxx_compilerchange='/usr/bin/g++' )
print "GHOST COCOA WILL BE COMPILED WITH APPLE GCC"
else:

@ -578,7 +578,7 @@ GHOST_SystemCocoa::GHOST_SystemCocoa()
if (strstr(rstring,"MacBookAir") ||
(strstr(rstring,"MacBook") && (rstring[strlen(rstring)-3]>='5') && (rstring[strlen(rstring)-3]<='9')))
m_hasMultiTouchTrackpad = true;
else m_hasMultiTouchTrackpad = false;
else m_hasMultiTouchTrackpad = true;
free( rstring );
rstring = NULL;

@ -1585,30 +1585,3 @@ setWindowCustomCursorShape(
return GHOST_kSuccess;
}
/*
void glutCustomCursor(char *data1, char *data2, int size)
{
Pixmap source, mask;
Cursor cursor;
XColor fg, bg;
if(XAllocNamedColor(__glutDisplay, DefaultColormap(__glutDisplay, __glutScreen),
"White", &fg, &fg) == 0) return;
if(XAllocNamedColor(__glutDisplay, DefaultColormap(__glutDisplay, __glutScreen),
"Red", &bg, &bg) == 0) return;
source= XCreateBitmapFromData(__glutDisplay, xdraw, data2, size, size);
mask= XCreateBitmapFromData(__glutDisplay, xdraw, data1, size, size);
cursor= XCreatePixmapCursor(__glutDisplay, source, mask, &fg, &bg, 7, 7);
XFreePixmap(__glutDisplay, source);
XFreePixmap(__glutDisplay, mask);
XDefineCursor(__glutDisplay, xdraw, cursor);
}
*/

Before

Width:  |  Height:  |  Size: 210 KiB

After

Width:  |  Height:  |  Size: 210 KiB

@ -145,7 +145,11 @@ class ProjectEdit(Operator):
for image in bpy.data.images:
image.tag = True
if 'FINISHED' not in bpy.ops.paint.image_from_view():
# opengl buffer may fail, we can't help this, but best report it.
try:
ret = bpy.ops.paint.image_from_view()
except RuntimeError as err:
self.report({'ERROR'}, str(err))
return {'CANCELLED'}
image_new = None

@ -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);

@ -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);

@ -42,6 +42,9 @@
#include "BKE_deform.h"
#include "BLI_blenlib.h"
#include "BLI_utildefines.h"
#include "BLI_cellalloc.h"

@ -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;

@ -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);

@ -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];

@ -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

@ -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;

@ -47,7 +47,7 @@ if(WITH_BLENDER)
# images
splash.png.c
blenderbuttons.c
blender_icons.png.c
# brushes
add.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,

@ -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[];

@ -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 */

@ -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 */

@ -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 */

@ -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;
}

@ -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 */

@ -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);

@ -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;

@ -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;
}

@ -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;

@ -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 *******************/

File diff suppressed because it is too large Load Diff

@ -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);

@ -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;

@ -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];

@ -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 */

@ -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!");
}
}

@ -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)

@ -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)

@ -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!");
}

@ -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,

@ -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,

@ -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;

@ -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();

@ -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;

@ -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);

@ -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) {

@ -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;

@ -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 */

@ -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);

@ -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);
}

@ -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

@ -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)

@ -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;