diff options
author | Martin Poirier <theeth@yahoo.com> | 2008-10-28 23:26:38 +0300 |
---|---|---|
committer | Martin Poirier <theeth@yahoo.com> | 2008-10-28 23:26:38 +0300 |
commit | 4baa2d780011e5612b3fbbeb11a97acf41d90f58 (patch) | |
tree | 9164300ceabb05a67a8b0dab7e4608f82e2fb329 /source/blender/src | |
parent | 025e4b046a527cdb58bccbccdec2f26d3973336c (diff) |
merge 17206:17211harmonic-skeleton
Diffstat (limited to 'source/blender/src')
-rw-r--r-- | source/blender/src/SConscript | 3 | ||||
-rw-r--r-- | source/blender/src/buttons_object.c | 5 | ||||
-rw-r--r-- | source/blender/src/drawipo.c | 7 | ||||
-rw-r--r-- | source/blender/src/drawscript.c | 13 | ||||
-rw-r--r-- | source/blender/src/drawtext.c | 18 | ||||
-rw-r--r-- | source/blender/src/drawview.c | 5 | ||||
-rw-r--r-- | source/blender/src/editconstraint.c | 21 | ||||
-rw-r--r-- | source/blender/src/editface.c | 11 | ||||
-rw-r--r-- | source/blender/src/editmesh_add.c | 9 | ||||
-rw-r--r-- | source/blender/src/editscreen.c | 16 | ||||
-rw-r--r-- | source/blender/src/header_image.c | 17 | ||||
-rw-r--r-- | source/blender/src/header_info.c | 92 | ||||
-rw-r--r-- | source/blender/src/header_oops.c | 2 | ||||
-rw-r--r-- | source/blender/src/header_script.c | 10 | ||||
-rw-r--r-- | source/blender/src/header_text.c | 26 | ||||
-rw-r--r-- | source/blender/src/header_view3d.c | 56 | ||||
-rw-r--r-- | source/blender/src/headerbuttons.c | 8 | ||||
-rw-r--r-- | source/blender/src/interface.c | 8 | ||||
-rw-r--r-- | source/blender/src/renderwin.c | 8 | ||||
-rw-r--r-- | source/blender/src/space.c | 20 | ||||
-rw-r--r-- | source/blender/src/toolbox.c | 11 | ||||
-rw-r--r-- | source/blender/src/usiblender.c | 10 |
22 files changed, 291 insertions, 85 deletions
diff --git a/source/blender/src/SConscript b/source/blender/src/SConscript index 47b269c85d7..4ebaad673f2 100644 --- a/source/blender/src/SConscript +++ b/source/blender/src/SConscript @@ -36,6 +36,9 @@ incs += ' ' + env['BF_OPENGL_INC'] defs = [] +if not env['WITH_BF_PYTHON']: + defs.append('DISABLE_PYTHON') + if env['BF_TWEAK_MODE']: defs.append('TWEAK_MODE') diff --git a/source/blender/src/buttons_object.c b/source/blender/src/buttons_object.c index a8ce9da8780..6162a12d06d 100644 --- a/source/blender/src/buttons_object.c +++ b/source/blender/src/buttons_object.c @@ -152,7 +152,10 @@ #include "BSE_edit.h" #include "BDR_editobject.h" + +#ifndef DISABLE_PYTHON #include "BPY_extern.h" +#endif #include "butspace.h" // own module @@ -643,6 +646,7 @@ static void draw_constraint (uiBlock *block, ListBase *list, bConstraint *con, s } else { switch (con->type) { +#ifndef DISABLE_PYTHON case CONSTRAINT_TYPE_PYTHON: { bPythonConstraint *data = con->data; @@ -724,6 +728,7 @@ static void draw_constraint (uiBlock *block, ListBase *list, bConstraint *con, s draw_constraint_spaceselect(block, con, *xco, *yco-(73+theight), is_armature_owner(ob), -1); } break; +#endif /* DISABLE_PYTHON */ case CONSTRAINT_TYPE_ACTION: { bActionConstraint *data = con->data; diff --git a/source/blender/src/drawipo.c b/source/blender/src/drawipo.c index aee00baef8e..973782d7463 100644 --- a/source/blender/src/drawipo.c +++ b/source/blender/src/drawipo.c @@ -86,7 +86,9 @@ #include "BSE_editnla_types.h" #include "BSE_time.h" +#ifndef DISABLE_PYTHON #include "BPY_extern.h" +#endif #include "mydevice.h" #include "blendef.h" @@ -1925,6 +1927,7 @@ void do_ipobuts(unsigned short event) ei= get_active_editipo(); if(ei) { if(ei->icu->driver) { +#ifndef DISABLE_PYTHON if (ei->icu->driver->type == IPO_DRIVER_TYPE_PYTHON) { /* first del pydriver's global dict, just in case * an available pydrivers.py module needs to be reloaded */ @@ -1933,7 +1936,9 @@ void do_ipobuts(unsigned short event) BPY_pydriver_eval(ei->icu->driver); DAG_scene_sort(G.scene); } - else if(G.sipo->blocktype==ID_KE || G.sipo->blocktype==ID_AC) + else +#endif + if(G.sipo->blocktype==ID_KE || G.sipo->blocktype==ID_AC) DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA); else DAG_object_flush_update(G.scene, ob, OB_RECALC_OB); diff --git a/source/blender/src/drawscript.c b/source/blender/src/drawscript.c index c744449d1db..f9e2d138a78 100644 --- a/source/blender/src/drawscript.c +++ b/source/blender/src/drawscript.c @@ -55,7 +55,9 @@ #include "BKE_global.h" #include "BKE_main.h" +#ifndef DISABLE_PYTHON #include "BPY_extern.h" +#endif #include "BIF_gl.h" #include "BIF_keyval.h" @@ -87,6 +89,9 @@ void drawscriptspace(ScrArea *sa, void *spacedata) glClear(GL_COLOR_BUFFER_BIT); myortho2(-0.5, curarea->winrct.xmax-curarea->winrct.xmin-0.5, -0.5, curarea->winrct.ymax-curarea->winrct.ymin-0.5); +#ifdef DISABLE_PYTHON + return; +#else if (!sc->script) return; script = sc->script; @@ -115,10 +120,12 @@ void drawscriptspace(ScrArea *sa, void *spacedata) addqueue(curarea->win, MOUSEX, 0); } } +#endif /* DISABLE_PYTHON */ } void winqreadscriptspace(struct ScrArea *sa, void *spacedata, struct BWinEvent *evt) { +#ifndef DISABLE_PYTHON unsigned short event = evt->event; short val = evt->val; char ascii = evt->ascii; @@ -163,19 +170,21 @@ void winqreadscriptspace(struct ScrArea *sa, void *spacedata, struct BWinEvent * if (event == QKEY) if (val && (G.qual & LR_CTRLKEY) && okee("Quit Blender")) exit_usiblender(); } - +#endif return; + } void free_scriptspace (SpaceScript *sc) { if (!sc) return; - +#ifndef DISABLE_PYTHON /*free buttons references*/ if (sc->but_refs) { BPy_Set_DrawButtonsList(sc->but_refs); BPy_Free_DrawButtonsList(); sc->but_refs = NULL; } +#endif sc->script = NULL; } diff --git a/source/blender/src/drawtext.c b/source/blender/src/drawtext.c index ca1f6cff202..1c8380c7a7d 100644 --- a/source/blender/src/drawtext.c +++ b/source/blender/src/drawtext.c @@ -71,8 +71,10 @@ #include "BSE_filesel.h" +#ifndef DISABLE_PYTHON #include "BPY_extern.h" #include "BPY_menus.h" +#endif #include "mydevice.h" #include "blendef.h" @@ -1841,7 +1843,8 @@ void unlink_text(Text *text) bScreen *scr; ScrArea *area; SpaceLink *sl; - + +#ifndef DISABLE_PYTHON /* check if this text was used as script link: * this check function unsets the pointers and returns how many * script links used this Text */ @@ -1852,7 +1855,8 @@ void unlink_text(Text *text) if (nodeDynamicUnlinkText ((ID*)text)) { allqueue(REDRAWNODE, 0); } - +#endif + for (scr= G.main->screen.first; scr; scr= scr->id.next) { for (area= scr->areabase.first; area; area= area->next) { for (sl= area->spacedata.first; sl; sl= sl->next) { @@ -2050,7 +2054,9 @@ void run_python_script(SpaceText *st) { Text *text=st->text; char *py_filename; - +#ifdef DISABLE_PYTHON + error("python disabled in this build"); +#else if (!BPY_txt_do_python_Text(text)) { int lineno = BPY_Err_getLinenumber(); // jump to error if happened in current text: @@ -2072,6 +2078,7 @@ void run_python_script(SpaceText *st) "check console"); } } +#endif } static void set_tabs(Text *text) @@ -2929,8 +2936,10 @@ void winqreadtextspace(ScrArea *sa, void *spacedata, BWinEvent *evt) break; /* BREAK Q */ case RKEY: if (G.qual == LR_ALTKEY) { +#ifndef DISABLE_PYTHON if (text->compiled) BPY_free_compiled_text(text); text->compiled = NULL; +#endif if (okee("Reopen text")) { if (!reopen_text(text)) error("Could not reopen file"); @@ -3199,13 +3208,14 @@ void winqreadtextspace(ScrArea *sa, void *spacedata, BWinEvent *evt) } } +#ifndef DISABLE_PYTHON /* Run text plugin scripts if enabled */ if (st->doplugins && event && val) { if (BPY_menu_do_shortcut(PYMENU_TEXTPLUGIN, event, G.qual)) { do_draw= 1; } } - +#endif if (do_draw) redraw_alltext(); } diff --git a/source/blender/src/drawview.c b/source/blender/src/drawview.c index a169848aa62..de3e464060d 100644 --- a/source/blender/src/drawview.c +++ b/source/blender/src/drawview.c @@ -153,7 +153,9 @@ #include "BSE_time.h" #include "BSE_view.h" +#ifndef DISABLE_PYTHON #include "BPY_extern.h" +#endif #include "RE_render_ext.h" @@ -3354,6 +3356,7 @@ void drawview3dspace(ScrArea *sa, void *spacedata) } } +#ifndef DISABLE_PYTHON /* run any view3d draw handler script links */ if (sa->scriptlink.totscript) BPY_do_spacehandlers(sa, 0, 0, SPACEHANDLER_VIEW3D_DRAW); @@ -3363,7 +3366,7 @@ void drawview3dspace(ScrArea *sa, void *spacedata) !during_script()) { BPY_do_pyscript((ID *)G.scene, SCRIPT_REDRAW); } - +#endif } void drawview3d_render(struct View3D *v3d, float viewmat[][4], int winx, int winy, float winmat[][4], int shadow) diff --git a/source/blender/src/editconstraint.c b/source/blender/src/editconstraint.c index b6243a33944..42972e4aa5d 100644 --- a/source/blender/src/editconstraint.c +++ b/source/blender/src/editconstraint.c @@ -65,7 +65,9 @@ #include "BIF_space.h" #include "BIF_toolbox.h" +#ifndef DISABLE_PYTHON #include "BPY_extern.h" +#endif #include "blendef.h" #include "nla.h" @@ -444,7 +446,7 @@ void add_constraint (short only_IK) else if (nr==18) { char *menustr; int scriptint= 0; - +#ifndef DISABLE_PYTHON /* popup a list of usable scripts */ menustr = buildmenu_pyconstraints(NULL, &scriptint); scriptint = pupmenu(menustr); @@ -459,6 +461,7 @@ void add_constraint (short only_IK) /* make sure target allowance is set correctly */ BPY_pyconstraint_update(ob, con); } +#endif } else if (nr==19) { con = add_new_constraint(CONSTRAINT_TYPE_CHILDOF); @@ -700,7 +703,8 @@ static void test_constraints (Object *owner, const char substring[]) /* clear disabled-flag first */ curcon->flag &= ~CONSTRAINT_DISABLE; - + +#ifndef DISABLE_PYTHON /* Check specialised data (settings) for constraints that need this */ if (curcon->type == CONSTRAINT_TYPE_PYTHON) { bPythonConstraint *data = curcon->data; @@ -711,16 +715,16 @@ static void test_constraints (Object *owner, const char substring[]) } else if (BPY_is_pyconstraint(data->text)==0) { curcon->flag |= CONSTRAINT_DISABLE; - } - else { + } else { /* does the constraint require target input... also validates targets */ BPY_pyconstraint_update(owner, curcon); } - /* targets have already been checked for this */ continue; } - else if (curcon->type == CONSTRAINT_TYPE_KINEMATIC) { + else +#endif + if (curcon->type == CONSTRAINT_TYPE_KINEMATIC) { bKinematicConstraint *data = curcon->data; /* bad: we need a separate set of checks here as poletarget is @@ -869,6 +873,7 @@ void validate_pyconstraint_cb (void *arg1, void *arg2) data->text = text; } +#ifndef DISABLE_PYTHON /* this returns a string for the list of usable pyconstraint script names */ char *buildmenu_pyconstraints (Text *con_text, int *pyconindex) { @@ -909,15 +914,17 @@ char *buildmenu_pyconstraints (Text *con_text, int *pyconindex) return str; } +#endif /* DISABLE_PYTHON */ /* this callback gets called when the 'refresh' button of a pyconstraint gets pressed */ void update_pyconstraint_cb (void *arg1, void *arg2) { Object *owner= (Object *)arg1; bConstraint *con= (bConstraint *)arg2; - +#ifndef DISABLE_PYTHON if (owner && con) BPY_pyconstraint_update(owner, con); +#endif } /* ------------- Child-Of Constraint ------------------ */ diff --git a/source/blender/src/editface.c b/source/blender/src/editface.c index 77c27dfa3db..53fb6dbffb1 100644 --- a/source/blender/src/editface.c +++ b/source/blender/src/editface.c @@ -99,8 +99,10 @@ #include "BDR_unwrapper.h" #include "BDR_editobject.h" +#ifndef DISABLE_PYTHON #include "BPY_extern.h" #include "BPY_menus.h" +#endif /* Pupmenu codes: */ #define UV_CUBE_MAPPING 2 @@ -1238,7 +1240,9 @@ void face_borderselect() void uv_autocalc_tface() { short mode, i=0, has_pymenu=0; /* pymenu must be bigger then UV_*_MAPPING */ +#ifndef DISABLE_PYTHON BPyMenu *pym; +#endif char menu_number[3]; /* uvmenu, will add python items */ @@ -1253,7 +1257,7 @@ void uv_autocalc_tface() MENUSTRING("Project from View (Bounds)",UV_BOUNDS_MAPPING) "|%l|" MENUSTRING("Reset", UV_RESET_MAPPING); - +#ifndef DISABLE_PYTHON /* note that we account for the 10 previous entries with i+10: */ for (pym = BPyMenuTable[PYMENU_UVCALCULATION]; pym; pym = pym->next, i++) { @@ -1268,14 +1272,15 @@ void uv_autocalc_tface() sprintf(menu_number, "%d", i+10); strcat(uvmenu, menu_number); } +#endif mode= pupmenu(uvmenu); - +#ifndef DISABLE_PYTHON if (mode >= 10) { BPY_menu_do_python(PYMENU_UVCALCULATION, mode - 10); return; } - +#endif switch(mode) { case UV_CUBE_MAPPING: calculate_uv_map(B_UVAUTO_CUBE); break; diff --git a/source/blender/src/editmesh_add.c b/source/blender/src/editmesh_add.c index 4dc64b0f933..16a5b049da2 100644 --- a/source/blender/src/editmesh_add.c +++ b/source/blender/src/editmesh_add.c @@ -90,8 +90,10 @@ #include "editmesh.h" /* bpymenu */ +#ifndef DISABLE_PYTHON #include "BPY_extern.h" #include "BPY_menus.h" +#endif static float icovert[12][3] = { {0,0,-200}, @@ -686,14 +688,17 @@ void addedgeface_mesh(void) } else if(amount > 4) { +#ifndef DISABLE_PYTHON /* Python Menu */ BPyMenu *pym; +#endif char menu_number[3]; int i=0, has_pymenu=0, ret; /* facemenu, will add python items */ char facemenu[4096]= "Make Faces%t|Auto%x1|Make FGon%x2|Clear FGon%x3"; +#ifndef DISABLE_PYTHON /* note that we account for the 10 previous entries with i+4: */ for (pym = BPyMenuTable[PYMENU_MESHFACEKEY]; pym; pym = pym->next, i++) { @@ -708,16 +713,18 @@ void addedgeface_mesh(void) sprintf(menu_number, "%d", i+4); strcat(facemenu, menu_number); } - +#endif ret= pupmenu(facemenu); if(ret==1) addfaces_from_edgenet(); else if(ret==2) make_fgon(1); else if(ret==3) make_fgon(0); +#ifndef DISABLE_PYTHON else if (ret >= 4) { BPY_menu_do_python(PYMENU_MESHFACEKEY, ret - 4); return; } +#endif return; } else if(amount<2) { diff --git a/source/blender/src/editscreen.c b/source/blender/src/editscreen.c index 2557894d0e0..3cc306c8ea9 100644 --- a/source/blender/src/editscreen.c +++ b/source/blender/src/editscreen.c @@ -104,7 +104,10 @@ #include "BSE_seqaudio.h" #include "BSE_view.h" +#ifndef DISABLE_PYTHON #include "BPY_extern.h" +#endif + #include "mydevice.h" #include "blendef.h" @@ -1378,11 +1381,13 @@ void screenmain(void) BIF_read_file(ext_load_str); sound_initialize_sounds(); } +#ifndef DISABLE_PYTHON else if ((event==ONLOAD_SCRIPT) && BPY_has_onload_script()) { /* event queued in setup_app_data() in blender.c, where G.f is checked */ onload_script = 1; firsttime = 1; /* see last 'if' in this function */ } +#endif else { towin= 1; } @@ -1518,13 +1523,14 @@ void screenmain(void) } /* Bizar hack. The event queue has mutated... */ if ( (firsttime) && (event == 0) ) { - +#ifndef DISABLE_PYTHON if (onload_script) { /* OnLoad scriptlink */ BPY_do_pyscript(&G.scene->id, SCRIPT_ONLOAD); onload_script = 0; - } - else if (G.fileflags & G_FILE_AUTOPLAY) { + } else +#endif + if (G.fileflags & G_FILE_AUTOPLAY) { // SET AUTOPLAY in G.flags for // other fileloads @@ -1887,9 +1893,9 @@ static void del_area(ScrArea *sa) uiFreeBlocks(&sa->uiblocks); uiFreePanels(&sa->panels); - +#ifndef DISABLE_PYTHON BPY_free_scriptlink(&sa->scriptlink); - +#endif if(sa==curarea) curarea= NULL; if(sa==g_activearea) g_activearea= NULL; } diff --git a/source/blender/src/header_image.c b/source/blender/src/header_image.c index 4ca287d81c5..cf8f3c5c99d 100644 --- a/source/blender/src/header_image.c +++ b/source/blender/src/header_image.c @@ -82,8 +82,10 @@ #include "BSE_trans_types.h" #include "BSE_edit.h" +#ifndef DISABLE_PYTHON #include "BPY_extern.h" #include "BPY_menus.h" +#endif #include "IMB_imbuf_types.h" @@ -658,8 +660,9 @@ static uiBlock *image_image_rtmappingmenu(void *arg_unused) static void do_image_imagemenu(void *arg, int event) { /* events >=20 are registered bpython scripts */ +#ifndef DISABLE_PYTHON if (event >= 20) BPY_menu_do_python(PYMENU_IMAGE, event - 20); - +#endif switch(event) { case 0: @@ -704,7 +707,9 @@ static uiBlock *image_imagemenu(void *arg_unused) ImBuf *ibuf= BKE_image_get_ibuf(G.sima->image, &G.sima->iuser); uiBlock *block; short yco= 0, menuwidth=150; +#ifndef DISABLE_PYTHON BPyMenu *pym; +#endif int i = 0; block= uiNewBlock(&curarea->uiblocks, "image_imagemenu", UI_EMBOSSP, UI_HELV, curarea->headwin); @@ -749,7 +754,7 @@ static uiBlock *image_imagemenu(void *arg_unused) uiDefIconTextBlockBut(block, image_image_rtmappingmenu, NULL, ICON_RIGHTARROW_THIN, "Realtime Texture Mapping", 0, yco-=20, 120, 19, ""); // uiDefIconTextBut(block, BUTM, 1, ICON_MENU_PANEL, "Realtime Texture Animation|", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 7, ""); } - +#ifndef DISABLE_PYTHON /* note that we acount for the N previous entries with i+20: */ for (pym = BPyMenuTable[PYMENU_IMAGE]; pym; pym = pym->next, i++) { @@ -757,7 +762,7 @@ static uiBlock *image_imagemenu(void *arg_unused) NULL, 0.0, 0.0, 1, i+20, pym->tooltip?pym->tooltip:pym->filename); } - +#endif if(curarea->headertype==HEADERTOP) { uiBlockSetDirection(block, UI_DOWN); } @@ -948,6 +953,7 @@ static uiBlock *image_uvs_weldalignmenu(void *arg_unused) return block; } +#ifndef DISABLE_PYTHON static void do_image_uvs_scriptsmenu(void *arg, int event) { BPY_menu_do_python(PYMENU_UV, event); @@ -978,6 +984,7 @@ static uiBlock *image_uvs_scriptsmenu (void *args_unused) return block; } +#endif /* DISABLE_PYTHON */ static void do_image_uvsmenu(void *arg, int event) { @@ -1088,10 +1095,12 @@ static uiBlock *image_uvsmenu(void *arg_unused) uiDefIconTextBlockBut(block, image_uvs_showhidemenu, NULL, ICON_RIGHTARROW_THIN, "Show/Hide Faces", 0, yco-=20, menuwidth, 19, ""); +#ifndef DISABLE_PYTHON uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, ""); uiDefIconTextBlockBut(block, image_uvs_scriptsmenu, NULL, ICON_RIGHTARROW_THIN, "Scripts", 0, yco-=20, 120, 19, ""); - +#endif + if(curarea->headertype==HEADERTOP) { uiBlockSetDirection(block, UI_DOWN); } diff --git a/source/blender/src/header_info.c b/source/blender/src/header_info.c index 28248c052b3..b6bd00d2ad6 100644 --- a/source/blender/src/header_info.c +++ b/source/blender/src/header_info.c @@ -115,8 +115,10 @@ #include "MEM_guardedalloc.h" +#ifndef DISABLE_PYTHON #include "BPY_extern.h" #include "BPY_menus.h" +#endif #include "GPU_extensions.h" #include "GPU_material.h" @@ -332,8 +334,9 @@ Scene *copy_scene(Scene *sce, int level) obase= obase->next; base= base->next; } +#ifndef DISABLE_PYTHON BPY_copy_scriptlink(&sce->scriptlink); - +#endif /* sculpt data */ sce->sculptdata.session = NULL; if (sce->sculptdata.cumap) { @@ -650,12 +653,14 @@ static void do_info_file_importmenu(void *arg, int event) areawinset(sa->win); } +#ifndef DISABLE_PYTHON /* events >=3 are registered bpython scripts */ if (event >= 3) { BPY_menu_do_python(PYMENU_IMPORT, event - 3); BIF_undo_push("Import file"); - } - else { + } else +#endif + { switch(event) { case 0: /* DXF */ @@ -677,7 +682,9 @@ static uiBlock *info_file_importmenu(void *arg_unused) { uiBlock *block; short yco = 20, menuwidth = 120; +#ifndef DISABLE_PYTHON BPyMenu *pym; +#endif int i = 0; block= uiNewBlock(&curarea->uiblocks, "importmenu", UI_EMBOSSP, UI_HELV, G.curscreen->mainwin); @@ -690,13 +697,13 @@ static uiBlock *info_file_importmenu(void *arg_unused) 0, yco-=20, 120, 19, NULL, 0.0, 0.0, 1, 0, ""); uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "STL...", 0, yco-=20, 120, 19, NULL, 0.0, 0.0, 1, 2, ""); - +#ifndef DISABLE_PYTHON uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, ""); for (pym = BPyMenuTable[PYMENU_IMPORT]; pym; pym = pym->next, i++) { uiDefIconTextBut(block, BUTM, 1, ICON_PYTHON, pym->name, 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, i+3, pym->tooltip?pym->tooltip:pym->filename); } - +#endif uiBlockSetDirection(block, UI_RIGHT); uiTextBoundsBlock(block, 60); @@ -712,11 +719,12 @@ static void do_info_file_exportmenu(void *arg, int event) if (!sa) sa= closest_bigger_area(); areawinset(sa->win); } - +#ifndef DISABLE_PYTHON /* events >=3 are registered bpython scripts */ if (event >= 3) BPY_menu_do_python(PYMENU_EXPORT, event - 3); - - else switch(event) { + else +#endif + switch(event) { case 0: write_vrml_fs(); @@ -735,7 +743,9 @@ static uiBlock *info_file_exportmenu(void *arg_unused) { uiBlock *block; short yco = 20, menuwidth = 120; +#ifndef DISABLE_PYTHON BPyMenu *pym; +#endif int i = 0; block= uiNewBlock(&curarea->uiblocks, "exportmenu", UI_EMBOSSP, UI_HELV, G.curscreen->mainwin); @@ -749,6 +759,7 @@ static uiBlock *info_file_exportmenu(void *arg_unused) uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "STL...", 0, yco-=20, 120, 19, NULL, 0.0, 0.0, 1, 2, ""); +#ifndef DISABLE_PYTHON uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, ""); /* note that we acount for the 3 previous entries with i+3: */ @@ -757,7 +768,7 @@ static uiBlock *info_file_exportmenu(void *arg_unused) NULL, 0.0, 0.0, 1, i+3, pym->tooltip?pym->tooltip:pym->filename); } - +#endif uiBlockSetDirection(block, UI_RIGHT); uiTextBoundsBlock(block, 60); @@ -1160,9 +1171,12 @@ static uiBlock *info_filemenu(void *arg_unused) void do_info_add_meshmenu(void *arg, int event) { +#ifndef DISABLE_PYTHON if (event>=20) { BPY_menu_do_python(PYMENU_ADDMESH, event - 20); - } else { + } else +#endif + { switch(event) { case 0: /* Plane */ @@ -1214,7 +1228,9 @@ static uiBlock *info_add_meshmenu(void *arg_unused) short yco= 0; /* Python Menu */ +#ifndef DISABLE_PYTHON BPyMenu *pym; +#endif int i=0; block= uiNewBlock(&curarea->uiblocks, "add_meshmenu", UI_EMBOSSP, UI_HELV, G.curscreen->mainwin); @@ -1231,7 +1247,7 @@ static uiBlock *info_add_meshmenu(void *arg_unused) uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Grid|", 0, yco-=20, 160, 19, NULL, 0.0, 0.0, 1, 8, ""); uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Monkey|", 0, yco-=20, 160, 19, NULL, 0.0, 0.0, 1, 9, ""); - +#ifndef DISABLE_PYTHON pym = BPyMenuTable[PYMENU_ADDMESH]; if (pym) { uiDefIconTextBut(block, SEPR, 0, ICON_BLANK1, "", 0, yco-=6, 160, 6, NULL, 0.0, 0.0, 0, 0, ""); @@ -1240,7 +1256,8 @@ static uiBlock *info_add_meshmenu(void *arg_unused) uiDefIconTextBut(block, BUTM, 1, ICON_PYTHON, pym->name, 0, yco-=20, 160, 19, NULL, 0.0, 0.0, 1, i+20, pym->tooltip?pym->tooltip:pym->filename); } } - +#endif + uiBlockSetDirection(block, UI_RIGHT); uiTextBoundsBlock(block, 50); @@ -1496,9 +1513,12 @@ static uiBlock *info_add_groupmenu(void *arg_unused) void do_info_addmenu(void *arg, int event) { +#ifndef DISABLE_PYTHON if (event>=20) { BPY_menu_do_python(PYMENU_ADD, event - 20); - } else { + } else +#endif + { switch(event) { case 0: /* Mesh */ @@ -1547,7 +1567,9 @@ static uiBlock *info_addmenu(void *arg_unused) { /* static short tog=0; */ uiBlock *block; +#ifndef DISABLE_PYTHON BPyMenu *pym; +#endif int i=0; short yco= 0; @@ -1575,6 +1597,7 @@ static uiBlock *info_addmenu(void *arg_unused) uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Armature", 0, yco-=20, 120, 19, NULL, 0.0, 0.0, 1, 8, ""); uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Lattice", 0, yco-=20, 120, 19, NULL, 0.0, 0.0, 1, 9, ""); +#ifndef DISABLE_PYTHON pym = BPyMenuTable[PYMENU_ADD]; if (pym) { uiDefIconTextBut(block, SEPR, 0, ICON_BLANK1, "", 0, yco-=6, 1620, 6, NULL, 0.0, 0.0, 0, 0, ""); @@ -1583,7 +1606,8 @@ static uiBlock *info_addmenu(void *arg_unused) uiDefIconTextBut(block, BUTM, 1, ICON_PYTHON, pym->name, 0, yco-=20, 120, 19, NULL, 0.0, 0.0, 1, i+20, pym->tooltip?pym->tooltip:pym->filename); } } - +#endif + uiBlockSetDirection(block, UI_DOWN); uiTextBoundsBlock(block, 80); @@ -1948,9 +1972,10 @@ static void do_info_rendermenu(void *arg, int event) if (!sa) sa= closest_bigger_area(); areawinset(sa->win); } - +#ifndef DISABLE_PYTHON BPY_menu_do_python(PYMENU_RENDER, event - 10); BIF_undo_push("Rendering Script"); +#endif } else { switch(event) { @@ -1998,7 +2023,9 @@ static void do_info_rendermenu(void *arg, int event) static uiBlock *info_rendermenu(void *arg_unused) { uiBlock *block; +#ifndef DISABLE_PYTHON BPyMenu *pym; +#endif short yco= 0; short menuwidth=120; int i=0; @@ -2026,12 +2053,14 @@ static uiBlock *info_rendermenu(void *arg_unused) uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Render Settings|F10", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 7, ""); +#ifndef DISABLE_PYTHON uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, ""); for (pym = BPyMenuTable[PYMENU_RENDER]; pym; pym = pym->next, i++) { uiDefIconTextBut(block, BUTM, 1, ICON_PYTHON, pym->name, 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, i+10, pym->tooltip?pym->tooltip:pym->filename); } - +#endif + uiBlockSetDirection(block, UI_DOWN); uiTextBoundsBlock(block, 80); @@ -2042,8 +2071,9 @@ static uiBlock *info_rendermenu(void *arg_unused) static void do_info_help_websitesmenu(void *arg, int event) { +#ifndef DISABLE_PYTHON BPY_menu_do_python(PYMENU_HELPWEBSITES, event); - +#endif allqueue(REDRAWVIEW3D, 0); } @@ -2051,17 +2081,19 @@ static void do_info_help_websitesmenu(void *arg, int event) static uiBlock *info_help_websitesmenu(void *arg_unused) { uiBlock *block; +#ifndef DISABLE_PYTHON BPyMenu *pym; +#endif short yco = 20, menuwidth = 120; int i = 0; block= uiNewBlock(&curarea->uiblocks, "info_help_websitesmenu", UI_EMBOSSP, UI_HELV, G.curscreen->mainwin); uiBlockSetButmFunc(block, do_info_help_websitesmenu, NULL); - +#ifndef DISABLE_PYTHON for (pym = BPyMenuTable[PYMENU_HELPWEBSITES]; pym; pym = pym->next, i++) { uiDefIconTextBut(block, BUTM, 1, ICON_PYTHON, pym->name, 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, i, pym->tooltip?pym->tooltip:pym->filename); } - +#endif uiBlockSetDirection(block, UI_RIGHT); uiTextBoundsBlock(block, 60); @@ -2071,8 +2103,11 @@ static uiBlock *info_help_websitesmenu(void *arg_unused) static void do_info_help_systemmenu(void *arg, int event) { /* events >=10 are registered bpython scripts */ +#ifndef DISABLE_PYTHON if (event >= 10) BPY_menu_do_python(PYMENU_HELPSYSTEM, event - 10); - else { + else +#endif + { switch(event) { case 1: /* Benchmark */ @@ -2102,7 +2137,9 @@ static void do_info_help_systemmenu(void *arg, int event) static uiBlock *info_help_systemmenu(void *arg_unused) { uiBlock *block; +#ifndef DISABLE_PYTHON BPyMenu *pym; +#endif short yco = 20, menuwidth = 120; int i = 0; @@ -2110,11 +2147,11 @@ static uiBlock *info_help_systemmenu(void *arg_unused) uiBlockSetButmFunc(block, do_info_help_systemmenu, NULL); uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Benchmark", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, ""); - +#ifndef DISABLE_PYTHON for (pym = BPyMenuTable[PYMENU_HELPSYSTEM]; pym; pym = pym->next, i++) { uiDefIconTextBut(block, BUTM, 1, ICON_PYTHON, pym->name, 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, i+10, pym->tooltip?pym->tooltip:pym->filename); } - +#endif uiBlockSetDirection(block, UI_RIGHT); uiTextBoundsBlock(block, 60); @@ -2132,8 +2169,11 @@ static void do_info_helpmenu(void *arg, int event) } /* events >=10 are registered bpython scripts */ +#ifndef DISABLE_PYTHON if (event >= 10) BPY_menu_do_python(PYMENU_HELP, event - 10); - else { + else +#endif + { switch(event) { case 0: /* About Blender */ @@ -2150,20 +2190,22 @@ static uiBlock *info_helpmenu(void *arg_unused) uiBlock *block; short yco= 0; short menuwidth=120; +#ifndef DISABLE_PYTHON BPyMenu *pym; +#endif int i = 0; block= uiNewBlock(&curarea->uiblocks, "info_helpmenu", UI_EMBOSSP, UI_HELV, curarea->headwin); uiBlockSetButmFunc(block, do_info_helpmenu, NULL); uiDefIconTextBut(block, BUTM, B_SHOWSPLASH, ICON_BLANK1, "About Blender...", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, ""); - +#ifndef DISABLE_PYTHON uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, ""); for (pym = BPyMenuTable[PYMENU_HELP]; pym; pym = pym->next, i++) { uiDefIconTextBut(block, BUTM, 1, ICON_PYTHON, pym->name, 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, i+10, pym->tooltip?pym->tooltip:pym->filename); } - +#endif uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, ""); uiDefIconTextBlockBut(block, info_help_websitesmenu, NULL, ICON_RIGHTARROW_THIN, "Websites", 0, yco-=20, 120, 19, ""); diff --git a/source/blender/src/header_oops.c b/source/blender/src/header_oops.c index 68326c330ad..b839029c139 100644 --- a/source/blender/src/header_oops.c +++ b/source/blender/src/header_oops.c @@ -63,8 +63,10 @@ #include "BKE_depsgraph.h" +#ifndef DISABLE_PYTHON #include "BPY_extern.h" #include "BPY_menus.h" +#endif static int viewmovetemp = 0; diff --git a/source/blender/src/header_script.c b/source/blender/src/header_script.c index 53c4b9b5953..2bf58fb2873 100644 --- a/source/blender/src/header_script.c +++ b/source/blender/src/header_script.c @@ -57,8 +57,10 @@ #include "BKE_sca.h" #include "BSE_filesel.h" +#ifndef DISABLE_PYTHON #include "BPY_extern.h" #include "BPY_menus.h" +#endif #include "blendef.h" #include "mydevice.h" @@ -68,6 +70,7 @@ /* ********************** SCRIPT ****************************** */ /* action executed after clicking in Scripts menu */ +#ifndef DISABLE_PYTHON static void do_scripts_submenus(void *int_arg, int event) { int menutype = (intptr_t)int_arg; @@ -152,6 +155,7 @@ static uiBlock *script_scriptsmenu(void *arg_unused) uiTextBoundsBlock(block, 50); return block; } +#endif /* DISABLE_PYTHON */ void do_script_buttons(unsigned short event) { @@ -160,6 +164,7 @@ void do_script_buttons(unsigned short event) int nr= 1; Script *script = sc->script; +#ifndef DISABLE_PYTHON if (!sc) return; if (sc->spacetype != SPACE_SCRIPT) return; @@ -200,7 +205,7 @@ void do_script_buttons(unsigned short event) } break; } - +#endif return; } @@ -240,6 +245,7 @@ void script_buttons(void) uiBlockSetEmboss(block, UI_EMBOSS); xco+=XIC; +#ifndef DISABLE_PYTHON /* pull down menus */ if((curarea->flag & HEADER_NO_PULLDOWN)==0) { uiBlockSetEmboss(block, UI_EMBOSSP); @@ -248,7 +254,7 @@ void script_buttons(void) uiDefPulldownBut(block,script_scriptsmenu, NULL, "Scripts", xco, 0, xmax, 20, ""); xco+=xmax; } - +#endif uiBlockSetEmboss(block, UI_EMBOSS); uiBlockBeginAlign(block); diff --git a/source/blender/src/header_text.c b/source/blender/src/header_text.c index 9bb59a81192..9268642db2f 100644 --- a/source/blender/src/header_text.c +++ b/source/blender/src/header_text.c @@ -84,8 +84,10 @@ #include "BLI_blenlib.h" +#ifndef DISABLE_PYTHON #include "BPY_extern.h" #include "BPY_menus.h" +#endif #include "blendef.h" #include "mydevice.h" @@ -166,11 +168,12 @@ void do_text_buttons(unsigned short event) st->text = st->text->id.next; pop_space_text(st); } - + +#ifndef DISABLE_PYTHON BPY_clear_bad_scriptlinks(text); BPY_free_pyconstraint_links(text); free_text_controllers(text); - +#endif unlink_text(text); free_libblock(&G.main->text, text); @@ -231,7 +234,7 @@ void do_text_buttons(unsigned short event) break; } } - +#ifndef DISABLE_PYTHON static void do_text_template_scriptsmenu(void *arg, int event) { BPY_menu_do_python(PYMENU_SCRIPTTEMPLATE, event); @@ -293,6 +296,7 @@ static uiBlock *text_plugin_scriptsmenu (void *args_unused) return block; } +#endif /* action executed after clicking in File menu */ static void do_text_filemenu(void *arg, int event) @@ -316,8 +320,10 @@ static void do_text_filemenu(void *arg, int event) activate_fileselect(FILE_SPECIAL, "Open Text File", G.sce, add_text_fs); break; case 3: +#ifndef DISABLE_PYTHON if (text->compiled) BPY_free_compiled_text(text); text->compiled = NULL; +#endif if (okee("Reopen Text")) { if (!reopen_text(text)) { error("Could not reopen file"); @@ -339,6 +345,7 @@ static void do_text_filemenu(void *arg, int event) run_python_script(st); break; case 8: +#ifndef DISABLE_PYTHON { Object *ob; bConstraint *con; @@ -373,6 +380,7 @@ static void do_text_filemenu(void *arg, int event) } } } +#endif break; default: break; @@ -820,16 +828,18 @@ static uiBlock *text_filemenu(void *arg_unused) uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, ""); uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Run Python Script|Alt P", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 7, ""); - +#ifndef DISABLE_PYTHON if (BPY_is_pyconstraint(text)) uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Refresh All PyConstraints", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 8, ""); - +#endif uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, ""); } - + +#ifndef DISABLE_PYTHON uiDefIconTextBlockBut(block, text_template_scriptsmenu, NULL, ICON_RIGHTARROW_THIN, "Script Templates", 0, yco-=20, 120, 19, ""); uiDefIconTextBlockBut(block, text_plugin_scriptsmenu, NULL, ICON_RIGHTARROW_THIN, "Text Plugins", 0, yco-=20, 120, 19, ""); - +#endif + if(curarea->headertype==HEADERTOP) { uiBlockSetDirection(block, UI_DOWN); } @@ -924,8 +934,10 @@ static short do_modification_check(SpaceText *st_v) { } else { switch (pupmenu("File Modified Outside Blender %t|Reload from disk %x0|Make text internal (separate copy) %x1|Ignore %x2")) { case 0: +#ifndef DISABLE_PYTHON if (text->compiled) BPY_free_compiled_text(text); text->compiled = NULL; +#endif reopen_text(text); if (st->showsyntax) txt_format_text(st); return 1; diff --git a/source/blender/src/header_view3d.c b/source/blender/src/header_view3d.c index d57fa18a705..e2caf97df05 100644 --- a/source/blender/src/header_view3d.c +++ b/source/blender/src/header_view3d.c @@ -125,8 +125,10 @@ #include "BIF_verse.h" #endif +#ifndef DISABLE_PYTHON #include "BPY_extern.h" #include "BPY_menus.h" +#endif #include "blendef.h" #include "multires.h" @@ -461,6 +463,7 @@ static uiBlock *view3d_view_alignviewmenu(void *arg_unused) return block; } +#ifndef DISABLE_PYTHON static void do_view3d_view_spacehandlers(void *arg, int event) { Text *text = G.main->text.first; @@ -548,6 +551,7 @@ static uiBlock *view3d_view_spacehandlers(void *arg_unused) return block; } +#endif /* DISABLE_PYTHON */ static void do_view3d_viewmenu(void *arg, int event) { @@ -691,8 +695,10 @@ static uiBlock *view3d_viewmenu(void *arg_unused) uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Play Back Animation|Alt A", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 13, ""); +#ifndef DISABLE_PYTHON uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, ""); uiDefIconTextBlockBut(block, view3d_view_spacehandlers, NULL, ICON_RIGHTARROW_THIN, "Space Handler Scripts", 0, yco-=20, 120, 19, ""); +#endif if(curarea->headertype==HEADERTOP) { uiBlockSetDirection(block, UI_DOWN); @@ -1468,8 +1474,10 @@ static uiBlock *view3d_select_pose_armaturemenu(void *arg_unused) void do_view3d_select_faceselmenu(void *arg, int event) { /* events >= 6 are registered bpython scripts */ +#ifndef DISABLE_PYTHON if (event >= 6) BPY_menu_do_python(PYMENU_FACESELECT, event - 6); - +#endif + switch(event) { case 0: /* border select */ borderselect(); @@ -1491,7 +1499,9 @@ static uiBlock *view3d_select_faceselmenu(void *arg_unused) { uiBlock *block; short yco= 0, menuwidth=120; +#ifndef DISABLE_PYTHON BPyMenu *pym; +#endif int i = 0; block= uiNewBlock(&curarea->uiblocks, "view3d_select_faceselmenu", UI_EMBOSSP, UI_HELV, curarea->headwin); @@ -1507,6 +1517,7 @@ static uiBlock *view3d_select_faceselmenu(void *arg_unused) uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, ""); uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Linked Faces|Ctrl L", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 4, ""); +#ifndef DISABLE_PYTHON uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, ""); /* note that we account for the 6 previous entries with i+6: */ @@ -1515,7 +1526,8 @@ static uiBlock *view3d_select_faceselmenu(void *arg_unused) menuwidth, 19, NULL, 0.0, 0.0, 1, i+6, pym->tooltip?pym->tooltip:pym->filename); } - +#endif + if(curarea->headertype==HEADERTOP) { uiBlockSetDirection(block, UI_DOWN); } @@ -2445,6 +2457,7 @@ static uiBlock *view3d_edit_object_showhidemenu(void *arg_unused) return block; } +#ifndef DISABLE_PYTHON static void do_view3d_edit_object_scriptsmenu(void *arg, int event) { BPY_menu_do_python(PYMENU_OBJECT, event); @@ -2471,6 +2484,7 @@ static uiBlock *view3d_edit_object_scriptsmenu(void *arg_unused) return block; } +#endif /* DISABLE_PYTHON */ #ifdef WITH_VERSE extern ListBase session_list; @@ -2610,9 +2624,10 @@ static uiBlock *view3d_edit_objectmenu(void *arg_unused) uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Move to Layer...|M", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 10, ""); uiDefIconTextBlockBut(block, view3d_edit_object_showhidemenu, NULL, ICON_RIGHTARROW_THIN, "Show/Hide Objects", 0, yco-=20, 120, 19, ""); +#ifndef DISABLE_PYTHON uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, ""); uiDefIconTextBlockBut(block, view3d_edit_object_scriptsmenu, NULL, ICON_RIGHTARROW_THIN, "Scripts", 0, yco-=20, 120, 19, ""); - +#endif if(curarea->headertype==HEADERTOP) { uiBlockSetDirection(block, UI_DOWN); @@ -3078,6 +3093,7 @@ static uiBlock *view3d_edit_mesh_showhidemenu(void *arg_unused) return block; } +#ifndef DISABLE_PYTHON static void do_view3d_edit_mesh_scriptsmenu(void *arg, int event) { BPY_menu_do_python(PYMENU_MESH, event); @@ -3104,6 +3120,7 @@ static uiBlock *view3d_edit_mesh_scriptsmenu(void *arg_unused) return block; } +#endif /* DISABLE_PYTHON */ static void do_view3d_edit_meshmenu(void *arg, int event) { @@ -3248,9 +3265,11 @@ static uiBlock *view3d_edit_meshmenu(void *arg_unused) uiDefIconTextBlockBut(block, view3d_edit_mesh_showhidemenu, NULL, ICON_RIGHTARROW_THIN, "Show/Hide Vertices", 0, yco-=20, 120, 19, ""); +#ifndef DISABLE_PYTHON uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, ""); uiDefIconTextBlockBut(block, view3d_edit_mesh_scriptsmenu, NULL, ICON_RIGHTARROW_THIN, "Scripts", 0, yco-=20, 120, 19, ""); - +#endif + if(curarea->headertype==HEADERTOP) { uiBlockSetDirection(block, UI_DOWN); } @@ -3965,7 +3984,7 @@ static void do_view3d_edit_armaturemenu(void *arg, int event) } - +#ifndef DISABLE_PYTHON static void do_view3d_scripts_armaturemenu(void *arg, int event) { BPY_menu_do_python(PYMENU_ARMATURE, event); @@ -3996,6 +4015,7 @@ static uiBlock *view3d_scripts_armaturemenu(void *args_unused) return block; } +#endif /* DISABLE_PYTHON */ static void do_view3d_armature_settingsmenu(void *arg, int event) { @@ -4077,10 +4097,11 @@ static uiBlock *view3d_edit_armaturemenu(void *arg_unused) uiDefIconTextBlockBut(block, view3d_edit_armature_parentmenu, NULL, ICON_RIGHTARROW_THIN, "Parent", 0, yco-=20, 120, 19, ""); uiDefIconTextBlockBut(block, view3d_armature_settingsmenu, NULL, ICON_RIGHTARROW_THIN, "Bone Settings", 0, yco-=20, 120, 19, ""); +#ifndef DISABLE_PYTHON uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, ""); uiDefIconTextBlockBut(block, view3d_scripts_armaturemenu, NULL, ICON_RIGHTARROW_THIN, "Scripts", 0, yco-=20, 120, 19, ""); - +#endif if(curarea->headertype==HEADERTOP) { uiBlockSetDirection(block, UI_DOWN); } @@ -4486,8 +4507,9 @@ static uiBlock *view3d_pose_armaturemenu(void *arg_unused) static void do_view3d_vpaintmenu(void *arg, int event) { /* events >= 3 are registered bpython scripts */ +#ifndef DISABLE_PYTHON if (event >= 3) BPY_menu_do_python(PYMENU_VERTEXPAINT, event - 3); - +#endif switch(event) { case 0: /* undo vertex painting */ BIF_undo(); @@ -4509,7 +4531,9 @@ static uiBlock *view3d_vpaintmenu(void *arg_unused) { uiBlock *block; short yco= 0, menuwidth=120; +#ifndef DISABLE_PYTHON BPyMenu *pym; +#endif int i=0; block= uiNewBlock(&curarea->uiblocks, "view3d_paintmenu", UI_EMBOSSP, UI_HELV, curarea->headwin); @@ -4519,6 +4543,7 @@ static uiBlock *view3d_vpaintmenu(void *arg_unused) uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Set Vertex Colors|Shift K", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, ""); uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Set Shaded Vertex Colors", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, ""); +#ifndef DISABLE_PYTHON /* note that we account for the 3 previous entries with i+3: even if the last item isnt displayed, it dosent matter */ for (pym = BPyMenuTable[PYMENU_VERTEXPAINT]; pym; pym = pym->next, i++) { @@ -4526,7 +4551,8 @@ static uiBlock *view3d_vpaintmenu(void *arg_unused) menuwidth, 19, NULL, 0.0, 0.0, 1, i+3, pym->tooltip?pym->tooltip:pym->filename); } - +#endif + if(curarea->headertype==HEADERTOP) { uiBlockSetDirection(block, UI_DOWN); } @@ -4581,8 +4607,9 @@ static void do_view3d_wpaintmenu(void *arg, int event) Object *ob= OBACT; /* events >= 3 are registered bpython scripts */ +#ifndef DISABLE_PYTHON if (event >= 4) BPY_menu_do_python(PYMENU_WEIGHTPAINT, event - 4); - +#endif switch(event) { case 0: /* undo weight painting */ BIF_undo(); @@ -4604,7 +4631,9 @@ static uiBlock *view3d_wpaintmenu(void *arg_unused) { uiBlock *block; short yco= 0, menuwidth=120, menunr=1; +#ifndef DISABLE_PYTHON BPyMenu *pym; +#endif int i=0; block= uiNewBlock(&curarea->uiblocks, "view3d_paintmenu", UI_EMBOSSP, UI_HELV, curarea->headwin); @@ -4624,7 +4653,8 @@ static uiBlock *view3d_wpaintmenu(void *arg_unused) uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, ""); menunr++; } - + +#ifndef DISABLE_PYTHON /* note that we account for the 4 previous entries with i+4: even if the last item isnt displayed, it dosent matter */ for (pym = BPyMenuTable[PYMENU_WEIGHTPAINT]; pym; pym = pym->next, i++) { @@ -4632,7 +4662,8 @@ static uiBlock *view3d_wpaintmenu(void *arg_unused) menuwidth, 19, NULL, 0.0, 0.0, 1, i+4, pym->tooltip?pym->tooltip:pym->filename); } - +#endif + if(curarea->headertype==HEADERTOP) { uiBlockSetDirection(block, UI_DOWN); } @@ -4904,8 +4935,9 @@ static uiBlock *view3d_faceselmenu(void *arg_unused) void do_view3d_select_particlemenu(void *arg, int event) { /* events >= 6 are registered bpython scripts */ +#ifndef DISABLE_PYTHON if (event >= 6) BPY_menu_do_python(PYMENU_FACESELECT, event - 6); - +#endif switch(event) { case 0: PE_borderselect(); diff --git a/source/blender/src/headerbuttons.c b/source/blender/src/headerbuttons.c index 44044841a99..7c97fa8431d 100644 --- a/source/blender/src/headerbuttons.c +++ b/source/blender/src/headerbuttons.c @@ -161,8 +161,10 @@ #include "BDR_editmball.h" #include "BDR_sculptmode.h" +#ifndef DISABLE_PYTHON #include "BPY_extern.h" #include "BPY_menus.h" +#endif #include "GPU_draw.h" @@ -535,6 +537,7 @@ static void filesel_u_renderdir(char *name) allqueue(REDRAWALL, 0); } +#ifndef DISABLE_PYTHON static void filesel_u_pythondir(char *name) { char dir[FILE_MAXDIR], file[FILE_MAXFILE]; @@ -550,6 +553,7 @@ static void filesel_u_pythondir(char *name) error("Invalid scripts dir: check console"); } } +#endif static void filesel_u_sounddir(char *name) { @@ -1525,7 +1529,7 @@ void do_global_buttons(unsigned short event) activate_fileselect(FILE_SPECIAL, "SELECT RENDER PATH", U.renderdir, filesel_u_renderdir); break; - +#ifndef DISABLE_PYTHON case B_PYMENUEVAL: /* is button from space.c *info* */ waitcursor( 1 ); /* can take some time */ if (BPY_path_update() == 0) { /* re-eval scripts registration in menus */ @@ -1542,7 +1546,7 @@ void do_global_buttons(unsigned short event) activate_fileselect(FILE_SPECIAL, "SELECT SCRIPT PATH", U.pythondir, filesel_u_pythondir); break; - +#endif case B_SOUNDDIRFILESEL: /* is button from space.c *info* */ if(curarea->spacetype==SPACE_INFO) { sa= closest_bigger_area(); diff --git a/source/blender/src/interface.c b/source/blender/src/interface.c index 7c1a4668a56..28baf87baa1 100644 --- a/source/blender/src/interface.c +++ b/source/blender/src/interface.c @@ -96,7 +96,9 @@ #include "BSE_view.h" +#ifndef DISABLE_PYTHON #include "BPY_extern.h" /* for BPY_button_eval */ +#endif #include "GHOST_Types.h" /* for tablet data */ @@ -2144,6 +2146,7 @@ static int ui_act_as_text_but(uiBut *but) but->max= max; if(textleft==0) but->flag &= ~UI_TEXT_LEFT; +#ifndef DISABLE_PYTHON if(BPY_button_eval(str, &value)) { /* Uncomment this if you want to see an error message (and annoy users) */ /* error("Invalid Python expression, check console");*/ @@ -2152,7 +2155,10 @@ static int ui_act_as_text_but(uiBut *but) if(str[0]) retval = 0; /* invalidate return value if eval failed, except when string was null */ } - +#else + value=atof(str); +#endif + if(but->pointype!=FLO) value= (int)value; if(but->type==NUMABS) value= fabs(value); diff --git a/source/blender/src/renderwin.c b/source/blender/src/renderwin.c index b4d78b7fa37..bbac70e9e5e 100644 --- a/source/blender/src/renderwin.c +++ b/source/blender/src/renderwin.c @@ -88,7 +88,10 @@ #include "BDR_sculptmode.h" #include "BDR_editobject.h" + +#ifndef DISABLE_PYTHON #include "BPY_extern.h" /* for BPY_do_all_scripts */ +#endif #include "BSE_view.h" #include "BSE_drawview.h" @@ -1273,8 +1276,10 @@ void BIF_store_spare(void) /* set up display, render an image or scene */ void BIF_do_render(int anim) { +#ifndef DISABLE_PYTHON if (G.f & G_DOSCRIPTLINKS) BPY_do_all_scripts(SCRIPT_RENDER, anim); +#endif BIF_store_spare(); @@ -1286,8 +1291,9 @@ void BIF_do_render(int anim) } if(G.scene->r.dither_intensity != 0.0f) BIF_redraw_render_rect(); - +#ifndef DISABLE_PYTHON if (G.f & G_DOSCRIPTLINKS) BPY_do_all_scripts(SCRIPT_POSTRENDER, anim); +#endif } void do_ogl_view3d_render(Render *re, View3D *v3d, int winx, int winy) diff --git a/source/blender/src/space.c b/source/blender/src/space.c index c26620ccbf2..b6221c2f84b 100644 --- a/source/blender/src/space.c +++ b/source/blender/src/space.c @@ -168,7 +168,9 @@ #include "PIL_time.h" +#ifndef DISABLE_PYTHON #include "BPY_extern.h" +#endif #include "butspace.h" #include "mydevice.h" @@ -1079,7 +1081,9 @@ void BIF_undo(void) else { /* now also in faceselect mode */ if(U.uiflag & USER_GLOBALUNDO) { +#ifndef DISABLE_PYTHON BPY_scripts_clear_pyobjects(); +#endif BKE_undo_step(1); sound_initialize_sounds(); } @@ -1248,12 +1252,13 @@ static void winqreadview3dspace(ScrArea *sa, void *spacedata, BWinEvent *evt) * - grease-pencil also defaults to leftmouse */ if(event==LEFTMOUSE) { +#ifndef DISABLE_PYTHON /* run any view3d event handler script links */ if (sa->scriptlink.totscript) { if (BPY_do_spacehandlers(sa, event, val, SPACEHANDLER_VIEW3D_EVENT)) return; /* return if event was processed (swallowed) by handler(s) */ } - +#endif if(gpencil_do_paint(sa, L_MOUSE)) return; if(BIF_do_manipulator(sa)) return; } @@ -1309,10 +1314,12 @@ static void winqreadview3dspace(ScrArea *sa, void *spacedata, BWinEvent *evt) } } +#ifndef DISABLE_PYTHON /* run any view3d event handler script links */ if (event && sa->scriptlink.totscript) if (BPY_do_spacehandlers(sa, event, val, SPACEHANDLER_VIEW3D_EVENT)) return; /* return if event was processed (swallowed) by handler(s) */ +#endif /* TEXTEDITING?? */ if((G.obedit) && G.obedit->type==OB_FONT) { @@ -4324,7 +4331,8 @@ void drawinfospace(ScrArea *sa, void *spacedata) (xpos+edgsp+(1*mpref)+(1*midsp)),y2,mpref,buth, &(U.uiflag), 0, 0, 0, 0, "Allows all codecs for rendering (not guaranteed)"); #endif - + +#ifndef DISABLE_PYTHON uiDefBut(block, LABEL,0,"Auto Run Python Scripts", (xpos+edgsp+(1*midsp)+(1*mpref)),y6label,mpref,buth, 0, 0, 0, 0, 0, ""); @@ -4332,7 +4340,8 @@ void drawinfospace(ScrArea *sa, void *spacedata) uiDefButBitI(block, TOGN, USER_DONT_DOSCRIPTLINKS, REDRAWBUTSSCRIPT, "Enabled by Default", (xpos+edgsp+(1*mpref)+(1*midsp)),y5,mpref,buth, &(U.flag), 0, 0, 0, 0, "Allow any .blend file to run scripts automatically (unsafe with blend files from an untrusted source)"); - +#endif + uiDefBut(block, LABEL,0,"Keyboard:", (xpos+edgsp+(3*midsp)+(3*mpref)),y2label,mpref,buth, 0, 0, 0, 0, 0, ""); @@ -4511,6 +4520,7 @@ void drawinfospace(ScrArea *sa, void *spacedata) 0, 0, 0, 0, 0, "Select the default render output location"); uiBlockEndAlign(block); +#ifndef DISABLE_PYTHON uiBlockBeginAlign(block); uiDefBut(block, TEX, B_PYMENUEVAL, "Python Scripts: ", (xpos+edgsp+lpref+midsp),y1,(lpref-2*smfileselbut),buth, @@ -4522,7 +4532,7 @@ void drawinfospace(ScrArea *sa, void *spacedata) (xpos+edgsp+(2*lpref)+midsp-smfileselbut),y1,smfileselbut,buth, 0, 0, 0, 0, 0, "Select the default Python script location"); uiBlockEndAlign(block); - +#endif uiBlockBeginAlign(block); uiDefBut(block, TEX, 0, "Sounds: ", @@ -7081,6 +7091,7 @@ SpaceType *spacetext_get_type(void) static void spacescript_change(ScrArea *sa, void *spacedata) { +#ifndef DISABLE_PYTHON SpaceScript *sc = (SpaceScript*) spacedata; /*clear all temp button references*/ @@ -7089,6 +7100,7 @@ static void spacescript_change(ScrArea *sa, void *spacedata) BPy_Free_DrawButtonsList(); sc->but_refs = NULL; } +#endif } SpaceType *spacescript_get_type(void) diff --git a/source/blender/src/toolbox.c b/source/blender/src/toolbox.c index 55feb4c0305..1c028c3f18b 100644 --- a/source/blender/src/toolbox.c +++ b/source/blender/src/toolbox.c @@ -121,8 +121,10 @@ #include "mydevice.h" /* bpymenu */ +#ifndef DISABLE_PYTHON #include "BPY_extern.h" #include "BPY_menus.h" +#endif #include "BLO_sys_types.h" // for intptr_t support @@ -1924,12 +1926,15 @@ static TBitem *create_mesh_sublevel(ListBase *storage) Link *link; TBitem *meshmenu, *mm; int totmenu= 10, totpymenu=0, a=0; - + +#ifndef DISABLE_PYTHON /* Python Menu */ BPyMenu *pym; /* count the python menu items*/ for (pym = BPyMenuTable[PYMENU_ADDMESH]; pym; pym = pym->next, totpymenu++) {} +#endif + if (totpymenu) totmenu += totpymenu+1; /* add 1 for the seperator */ link= MEM_callocN(sizeof(Link) + sizeof(TBitem)*(totmenu+1), "mesh menu"); @@ -1948,6 +1953,7 @@ static TBitem *create_mesh_sublevel(ListBase *storage) mm->icon = 0; mm->retval= a; mm->name = "Monkey"; mm++; a++; /* a == 10 */ +#ifndef DISABLE_PYTHON if (totpymenu) { int i=0; mm->icon = 0; mm->retval= 0; mm->name = "SEPR"; mm++; @@ -1960,7 +1966,8 @@ static TBitem *create_mesh_sublevel(ListBase *storage) mm++; a++; } } - +#endif + /* terminate the menu */ mm->icon= -1; mm->retval= a; mm->name= ""; mm->poin= do_info_add_meshmenu; diff --git a/source/blender/src/usiblender.c b/source/blender/src/usiblender.c index 762264d5bc5..16c26336b89 100644 --- a/source/blender/src/usiblender.c +++ b/source/blender/src/usiblender.c @@ -134,7 +134,9 @@ #include "BDR_imagepaint.h" #include "BDR_vpaint.h" +#ifndef DISABLE_PYTHON #include "BPY_extern.h" +#endif #include "blendef.h" @@ -679,11 +681,13 @@ int BIF_read_homefile(int from_memory) undo_imagepaint_clear(); BKE_reset_undo(); BKE_write_undo("Original"); /* save current state */ - + +#ifndef DISABLE_PYTHON /* if from memory, need to refresh python scripts */ if (from_memory) { BPY_path_update(); } +#endif return success; } @@ -916,8 +920,10 @@ void BIF_write_file(char *target) return; } +#ifndef DISABLE_PYTHON /* send the OnSave event */ if (G.f & G_DOSCRIPTLINKS) BPY_do_pyscript(&G.scene->id, SCRIPT_ONSAVE); +#endif for (li= G.main->library.first; li; li= li->id.next) { if (li->parent==NULL && BLI_streq(li->name, target)) { @@ -1130,9 +1136,11 @@ void exit_usiblender(void) free_editArmature(); free_posebuf(); +#ifndef DISABLE_PYTHON /* before free_blender so py's gc happens while library still exists */ /* needed at least for a rare sigsegv that can happen in pydrivers */ BPY_end_python(); +#endif fastshade_free_render(); /* shaded view */ free_blender(); /* blender.c, does entire library */ |