added scons option BF_WITH_PYTHON (defined as DISABLE_PYTHON)
authorCampbell Barton <ideasman42@gmail.com>
Tue, 28 Oct 2008 18:47:13 +0000 (18:47 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Tue, 28 Oct 2008 18:47:13 +0000 (18:47 +0000)
41 files changed:
SConstruct
source/blender/SConscript
source/blender/blenkernel/SConscript
source/blender/blenkernel/intern/constraint.c
source/blender/blenkernel/intern/depsgraph.c
source/blender/blenkernel/intern/exotic.c
source/blender/blenkernel/intern/ipo.c
source/blender/blenkernel/intern/material.c
source/blender/blenkernel/intern/object.c
source/blender/blenkernel/intern/scene.c
source/blender/blenkernel/intern/script.c
source/blender/blenkernel/intern/text.c
source/blender/blenkernel/intern/world.c
source/blender/nodes/SConscript
source/blender/nodes/intern/SHD_nodes/SHD_dynamic.c
source/blender/src/SConscript
source/blender/src/buttons_object.c
source/blender/src/drawipo.c
source/blender/src/drawscript.c
source/blender/src/drawtext.c
source/blender/src/drawview.c
source/blender/src/editconstraint.c
source/blender/src/editface.c
source/blender/src/editmesh_add.c
source/blender/src/editscreen.c
source/blender/src/header_image.c
source/blender/src/header_info.c
source/blender/src/header_oops.c
source/blender/src/header_script.c
source/blender/src/header_text.c
source/blender/src/header_view3d.c
source/blender/src/headerbuttons.c
source/blender/src/interface.c
source/blender/src/renderwin.c
source/blender/src/space.c
source/blender/src/toolbox.c
source/blender/src/usiblender.c
source/creator/SConscript
source/creator/creator.c
tools/Blender.py
tools/btools.py

index 48115a39b1d659b2a5cb91c66f7065fd43847b7e..25cb6800b1d8afefac6829f5f5a0719ba1ff9977 100644 (file)
@@ -277,6 +277,7 @@ if 'blenderlite' in B.targets:
     env['WITH_BF_BINRELOC'] = False
     env['BF_BUILDINFO'] = False
     env['BF_NO_ELBEEM'] = True
+    env['WITH_BF_PYTHON'] = False
 
 # lastly we check for root_build_dir ( we should not do before, otherwise we might do wrong builddir
 #B.root_build_dir = B.arguments.get('BF_BUILDDIR', '..'+os.sep+'build'+os.sep+platform+os.sep)
index decbbf3564224805e277cc86c1c31609e12b973f..543a0bf5ed6255ffb51f8f6f5ff247fc64f40a6b 100644 (file)
@@ -11,13 +11,17 @@ SConscript(['avi/SConscript',
             'imbuf/SConscript',
             'imbuf/intern/cineon/SConscript',
             'makesdna/SConscript',
-            'python/SConscript',
             'radiosity/SConscript',
             'readblenfile/SConscript',
             'render/SConscript',
             'src/SConscript',
             'nodes/SConscript'])
 
+
+
+if env['WITH_BF_PYTHON']:
+    SConscript(['python/SConscript'])
+
 if env['WITH_BF_YAFRAY']:
     SConscript(['yafray/SConscript'])
 
index 82743ef5ea771b54790171a7e08cdfc84b73f062..8714023c645ecfcc94f0e923b01364214f19472d 100644 (file)
@@ -19,8 +19,11 @@ incs += ' ' + env['BF_SDL_INC']
 
 defs = ''
 
+if not env['WITH_BF_PYTHON']:
+       defs += 'DISABLE_PYTHON'
+
 if env['WITH_BF_INTERNATIONAL']:
-       defs += 'WITH_FREETYPE2'
+       defs += ' WITH_FREETYPE2'
 
 if env['WITH_BF_VERSE']:
        defs += ' WITH_VERSE'
@@ -49,4 +52,7 @@ if env['BF_NO_ELBEEM']:
 if env['WITH_BF_PLAYER']:
     SConscript(['bad_level_call_stubs/SConscript'])
 
+if env['WITH_BF_PYTHON']:
+       defs += 'DISABLE_PYTHON'
+
 env.BlenderLib ( libname = 'bf_blenkernel', sources = sources, includes = Split(incs), defines = Split(defs), libtype=['core','player'], priority = [65, 20] )
index 4914732b801291d74e8e885c7a4eae7b50621e90..5639f00ee39fce2a4b2895b80917c9bb946a8032 100644 (file)
@@ -64,8 +64,9 @@
 #include "BKE_library.h"
 #include "BKE_idprop.h"
 
-
+#ifndef DISABLE_PYTHON
 #include "BPY_extern.h"
+#endif
 
 #include "blendef.h"
 
@@ -1814,6 +1815,7 @@ static bConstraintTypeInfo CTI_SIZELIKE = {
        sizelike_evaluate /* evaluate */
 };
 
+
 /* ----------- Python Constraint -------------- */
 
 static void pycon_free (bConstraint *con)
@@ -1888,8 +1890,10 @@ static void pycon_get_tarmat (bConstraint *con, bConstraintOb *cob, bConstraintT
                constraint_target_to_mat4(ct->tar, ct->subtarget, ct->matrix, CONSTRAINT_SPACE_WORLD, ct->space, con->headtail);
                
                /* only execute target calculation if allowed */
+#ifndef DISABLE_PYTHON
                if (G.f & G_DOSCRIPTLINKS)
                        BPY_pyconstraint_target(data, ct);
+#endif
        }
        else if (ct)
                Mat4One(ct->matrix);
@@ -1897,6 +1901,9 @@ static void pycon_get_tarmat (bConstraint *con, bConstraintOb *cob, bConstraintT
 
 static void pycon_evaluate (bConstraint *con, bConstraintOb *cob, ListBase *targets)
 {
+#ifdef DISABLE_PYTHON
+       return;
+#else
        bPythonConstraint *data= con->data;
        
        /* only evaluate in python if we're allowed to do so */
@@ -1913,6 +1920,7 @@ static void pycon_evaluate (bConstraint *con, bConstraintOb *cob, ListBase *targ
        
        /* Now, run the actual 'constraint' function, which should only access the matrices */
        BPY_pyconstraint_eval(data, cob, targets);
+#endif /* DISABLE_PYTHON */
 }
 
 static bConstraintTypeInfo CTI_PYTHON = {
index 7f4910a976505527ba2830d4b2d1dfa7c4534e1f..6914de29d43a99f60cf5d50a9cd2b0c2e7bcd43d 100644 (file)
@@ -79,7 +79,9 @@
 #include "MEM_guardedalloc.h"
 #include "blendef.h"
 
+#ifndef DISABLE_PYTHON
 #include "BPY_extern.h"
+#endif
 
  #include "depsgraph_private.h"
  
@@ -313,6 +315,7 @@ static void dag_add_driver_relation(Ipo *ipo, DagForest *dag, DagNode *node, int
 
                                if ((icu->driver->flag & IPO_DRIVER_FLAG_INVALID) || (icu->driver->name[0] == '\0'))
                                        continue; /* empty or invalid expression */
+#ifndef DISABLE_PYTHON
                                else {
                                        /* now we need refs to all objects mentioned in this
                                         * pydriver expression, to call 'dag_add_relation'
@@ -334,6 +337,7 @@ static void dag_add_driver_relation(Ipo *ipo, DagForest *dag, DagNode *node, int
                                                MEM_freeN(obarray);
                                        }
                                }
+#endif /* DISABLE_PYTHON */
                        }
                        else if (icu->driver->ob) {
                                node1 = dag_get_node(dag, icu->driver->ob);
index 561b564ac39657a9009225773bc2476d9704bd47..9fb8d17d730da2b794da9d9270e723ad38dc24cf 100644 (file)
 #include "BKE_curve.h"
 #include "BKE_customdata.h"
 
+#ifndef DISABLE_PYTHON
 #include "BPY_extern.h"
+#endif
 
 #include "blendef.h"
 
@@ -2427,6 +2429,7 @@ int BKE_read_exotic(char *name)
                                                read_stl_mesh_binary(name);
                                        retval = 1;
                                }
+#ifndef DISABLE_PYTHON
                                // TODO: this should not be in the kernel...
                                else { // unknown format, call Python importloader 
                                        if (BPY_call_importloader(name)) {
@@ -2436,6 +2439,7 @@ int BKE_read_exotic(char *name)
                                        }       
                                
                                }
+#endif /* DISABLE_PYTHON */
                                waitcursor(0);
                        }
                }
index 9f0ea0f13887662ce0c6d7c962905c171c3b681b..29db0ddd808bb7f30d8c0e284989dba55b0dccfa 100644 (file)
 #include "BKE_main.h"
 #include "BKE_mesh.h"
 #include "BKE_object.h"
+
+#ifndef DISABLE_PYTHON
 #include "BPY_extern.h" /* for BPY_pydriver_eval() */
+#endif
 
 #define SMALL -1.0e-10
 
@@ -1008,6 +1011,7 @@ static void posechannel_get_local_transform (bPoseChannel *pchan, float loc[], f
  */
 static float eval_driver (IpoDriver *driver, float ipotime)
 {
+#ifndef DISABLE_PYTHON
        /* currently, drivers are either PyDrivers (evaluating a PyExpression, or Object/Pose-Channel transforms) */
        if (driver->type == IPO_DRIVER_TYPE_PYTHON) {
                /* check for empty or invalid expression */
@@ -1022,7 +1026,10 @@ static float eval_driver (IpoDriver *driver, float ipotime)
                 */
                return BPY_pydriver_eval(driver);
        }
-       else {
+       else
+#endif /* DISABLE_PYTHON */
+       {
+
                Object *ob= driver->ob;
                
                /* must have an object to evaluate */
index f05b84f6e90ddc8727c9af9467fbbd015feb17a5..27f4fd3bc051110fa1458dbb6631a937cdd8aff3 100644 (file)
@@ -59,7 +59,9 @@
 #include "BKE_node.h"
 #include "BKE_utildefines.h"
 
+#ifndef DISABLE_PYTHON
 #include "BPY_extern.h"
+#endif
 
 #include "GPU_material.h"
 
@@ -78,7 +80,9 @@ void free_material(Material *ma)
        MTex *mtex;
        int a;
 
+#ifndef DISABLE_PYTHON
        BPY_free_scriptlink(&ma->scriptlink);
+#endif
        
        for(a=0; a<MAX_MTEX; a++) {
                mtex= ma->mtex[a];
@@ -201,8 +205,10 @@ Material *copy_material(Material *ma)
                        id_us_plus((ID *)man->mtex[a]->tex);
                }
        }
-       
+
+#ifndef DISABLE_PYTHON 
        BPY_copy_scriptlink(&ma->scriptlink);
+#endif
        
        if(ma->ramp_col) man->ramp_col= MEM_dupallocN(ma->ramp_col);
        if(ma->ramp_spec) man->ramp_spec= MEM_dupallocN(ma->ramp_spec);
index b6f6820ca738f60ac79aaa63affebf3cca9383a2..77c891ee82eb0bcabae44ac7c0240eb82d15effe 100644 (file)
 
 #include "LBM_fluidsim.h"
 
+#ifndef DISABLE_PYTHON
 #include "BPY_extern.h"
+#endif
 
 #include "GPU_material.h"
 
@@ -269,8 +271,10 @@ void free_object(Object *ob)
        free_constraints(&ob->constraints);
        free_constraint_channels(&ob->constraintChannels);
        free_nlastrips(&ob->nlastrips);
-       
+
+#ifndef DISABLE_PYTHON 
        BPY_free_scriptlink(&ob->scriptlink);
+#endif
        
        if(ob->pd){
                if(ob->pd->tex)
@@ -637,9 +641,9 @@ Camera *copy_camera(Camera *cam)
        
        camn= copy_libblock(cam);
        id_us_plus((ID *)camn->ipo);
-
+#ifndef DISABLE_PYTHON
        BPY_copy_scriptlink(&camn->scriptlink);
-       
+#endif 
        return camn;
 }
 
@@ -786,9 +790,9 @@ Lamp *copy_lamp(Lamp *la)
        id_us_plus((ID *)lan->ipo);
 
        if (la->preview) lan->preview = BKE_previewimg_copy(la->preview);
-
+#ifndef DISABLE_PYTHON
        BPY_copy_scriptlink(&la->scriptlink);
-       
+#endif
        return lan;
 }
 
@@ -846,7 +850,9 @@ void make_local_lamp(Lamp *la)
 
 void free_camera(Camera *ca)
 {
+#ifndef DISABLE_PYTHON
        BPY_free_scriptlink(&ca->scriptlink);
+#endif
 }
 
 void free_lamp(Lamp *la)
@@ -855,8 +861,9 @@ void free_lamp(Lamp *la)
        int a;
 
        /* scriptlinks */
-               
+#ifndef DISABLE_PYTHON
        BPY_free_scriptlink(&la->scriptlink);
+#endif
 
        for(a=0; a<MAX_MTEX; a++) {
                mtex= la->mtex[a];
@@ -1202,9 +1209,9 @@ Object *copy_object(Object *ob)
                modifier_copyData(md, nmd);
                BLI_addtail(&obn->modifiers, nmd);
        }
-       
+#ifndef DISABLE_PYTHON 
        BPY_copy_scriptlink(&ob->scriptlink);
-       
+#endif
        obn->prop.first = obn->prop.last = NULL;
        copy_properties(&obn->prop, &ob->prop);
        
@@ -1918,10 +1925,11 @@ void where_is_object_time(Object *ob, float ctime)
                
                constraints_clear_evalob(cob);
        }
-       
+#ifndef DISABLE_PYTHON
        if(ob->scriptlink.totscript && !during_script()) {
                if (G.f & G_DOSCRIPTLINKS) BPY_do_pyscript((ID *)ob, SCRIPT_REDRAW);
        }
+#endif
        
        /* set negative scale flag in object */
        Crossf(vec, ob->obmat[0], ob->obmat[1]);
@@ -2288,7 +2296,9 @@ void object_handle_update(Object *ob)
                        }
                        else
                                where_is_object(ob);
+#ifndef DISABLE_PYTHON
                        if (G.f & G_DOSCRIPTLINKS) BPY_do_pyscript((ID *)ob, SCRIPT_OBJECTUPDATE);
+#endif
                }
                
                if(ob->recalc & OB_RECALC_DATA) {
@@ -2364,7 +2374,9 @@ void object_handle_update(Object *ob)
                                                psys_get_modifier(ob, psys)->flag &= ~eParticleSystemFlag_psys_updated;
                                }
                        }
+#ifndef DISABLE_PYTHON
                        if (G.f & G_DOSCRIPTLINKS) BPY_do_pyscript((ID *)ob, SCRIPT_OBDATAUPDATE);
+#endif
                }
 
                /* the no-group proxy case, we call update */
index dea36a69643c4cafd8d45277434554304d7f2ebc..c71d3c7fdd2bede1fca0386ce4a712ee450d52c2 100644 (file)
 #include "BIF_previewrender.h"
 #include "BIF_editseq.h"
 
+#ifndef DISABLE_PYTHON
 #include "BPY_extern.h"
+#endif
+
 #include "BLI_arithb.h"
 #include "BLI_blenlib.h"
 
@@ -139,7 +142,10 @@ void free_scene(Scene *sce)
        if(sce->radio) MEM_freeN(sce->radio);
        sce->radio= 0;
        
+#ifndef DISABLE_PYTHON
        BPY_free_scriptlink(&sce->scriptlink);
+#endif
+       
        if (sce->r.avicodecdata) {
                free_avicodecdata(sce->r.avicodecdata);
                MEM_freeN(sce->r.avicodecdata);
@@ -570,9 +576,9 @@ void scene_update_for_newframe(Scene *sce, unsigned int lay)
        
        /* object ipos are calculated in where_is_object */
        do_all_data_ipos();
-       
+#ifndef DISABLE_PYTHON
        if (G.f & G_DOSCRIPTLINKS) BPY_do_all_scripts(SCRIPT_FRAMECHANGED, 0);
-
+#endif
        /* sets first, we allow per definition current scene to have dependencies on sets */
        for(sce= sce->set; sce; sce= sce->set)
                scene_update(sce, lay);
index b93821da21884d5cf51c58e6adfc0f94176a9903..6145f6c30637f41183892bd5e830ae24e2e16e83 100644 (file)
@@ -44,7 +44,9 @@
 #include "BKE_global.h"
 #include "BKE_main.h"
 
+#ifndef DISABLE_PYTHON
 #include "BPY_extern.h" // Blender Python library
+#endif
 
 #ifdef HAVE_CONFIG_H
 #include <config.h>
@@ -57,5 +59,7 @@
 void free_script (Script *script)
 {
        if (!script) return;
+#ifndef DISABLE_PYTHON
        BPY_clear_script(script);
+#endif
 }
index 9e6efa59d71c38cada8b4bbdce3b28b55be3972c..1ff757a5823fb291ab190be69fc458cedc56b73c 100644 (file)
@@ -47,7 +47,9 @@
 #include "BKE_global.h"
 #include "BKE_main.h"
 
+#ifdef DISABLE_PYTHON
 #include "BPY_extern.h"
+#endif
 
 #ifdef HAVE_CONFIG_H
 #include <config.h>
@@ -158,7 +160,9 @@ void free_text(Text *text)
 
        if(text->name) MEM_freeN(text->name);
        MEM_freeN(text->undo_buf);
+#ifndef DISABLE_PYTHON
        if (text->compiled) BPY_free_compiled_text(text);
+#endif
 }
 
 Text *add_empty_text(char *name) 
@@ -571,7 +575,9 @@ int txt_get_span (TextLine *from, TextLine *to)
 static void txt_make_dirty (Text *text)
 {
        text->flags |= TXT_ISDIRTY;
+#ifndef DISABLE_PYTHON
        if (text->compiled) BPY_free_compiled_text(text);
+#endif
 }
 
 /* 0:whitespace, 1:punct, 2:alphanumeric */
index 814d6f8baf1475386cf2b45b0d68c077c11b9ead..2e89ce3f80536010e2bdea24b317391ef151ec4e 100644 (file)
@@ -54,7 +54,9 @@
 #include "BKE_main.h"
 #include "BKE_icons.h"
 
+#ifndef DISABLE_PYTHON
 #include "BPY_extern.h"
+#endif
 
 #ifdef HAVE_CONFIG_H
 #include <config.h>
@@ -64,9 +66,10 @@ void free_world(World *wrld)
 {
        MTex *mtex;
        int a;
-       
+
+#ifndef DISABLE_PYTHON
        BPY_free_scriptlink(&wrld->scriptlink);
-       
+#endif
        for(a=0; a<MAX_MTEX; a++) {
                mtex= wrld->mtex[a];
                if(mtex && mtex->tex) mtex->tex->id.us--;
@@ -124,9 +127,9 @@ World *copy_world(World *wrld)
        }
        
        if (wrld->preview) wrldn->preview = BKE_previewimg_copy(wrld->preview);
-
+#ifndef DISABLE_PYTHON
        BPY_copy_scriptlink(&wrld->scriptlink);
-
+#endif
        id_us_plus((ID *)wrldn->ipo);
        
        return wrldn;
index f80f4b521dbf476c8bac5c67ef3d0d25aa066730..038ce4b749e0726f351cdcd90ea44ee3b13435f7 100644 (file)
@@ -21,8 +21,11 @@ incs += ' ' + env['BF_SDL_INC']
 
 defs = ''
 
+if not env['WITH_BF_PYTHON']:
+    defs += 'DISABLE_PYTHON'
+
 if env['WITH_BF_INTERNATIONAL']:
-    defs += 'WITH_FREETYPE2'
+    defs += ' WITH_FREETYPE2'
 
 if env['WITH_BF_VERSE']:
     defs += ' WITH_VERSE'
index 49473b213cec9183fc0a90e839e7bfd62b149f01..2065ac2ed338a7730f29ac9ce1da25ad1d1bbeef 100644 (file)
  * ***** END GPL LICENSE BLOCK *****
  */
 
+#ifndef DISABLE_PYTHON
 #include <Python.h>
 #include <compile.h>
 #include <eval.h>
+#endif
 
 #include "DNA_text_types.h"
 #include "BKE_text.h"
 #include "BKE_utildefines.h"
 
+#ifndef DISABLE_PYTHON
 #include "api2_2x/Node.h"
 #include "api2_2x/gen_utils.h"
 #include "BPY_extern.h"
+#endif
 
 #include "../SHD_util.h"
 
@@ -45,6 +49,7 @@ static void node_dynamic_setup(bNode *node);
 static void node_dynamic_exec_cb(void *data, bNode *node, bNodeStack **in, bNodeStack **out);
 static void node_dynamic_free_storage_cb(bNode *node);
 
+#ifndef DISABLE_PYTHON
 static PyObject *init_dynamicdict(void) {
        PyObject *newscriptdict;
        PyGILState_STATE gilstate = PyGILState_Ensure();
@@ -58,6 +63,7 @@ static PyObject *init_dynamicdict(void) {
 
        return newscriptdict;
 }
+#endif
 
 static bNodeType *node_dynamic_find_typeinfo(ListBase *list, ID *id)
 {
@@ -140,12 +146,12 @@ static void node_dynamic_update_socket_links(bNode *node, bNodeTree *ntree)
 
 static void node_dynamic_free_storage_cb(bNode *node)
 {
+#ifndef DISABLE_PYTHON
        NodeScriptDict *nsd;
        PyObject *pydict;
        BPy_Node *pynode;
 
        if (!node->storage) return;
-
        nsd = (NodeScriptDict *)(node->storage);
        pydict = nsd->dict;
        if (pydict) {
@@ -155,6 +161,7 @@ static void node_dynamic_free_storage_cb(bNode *node)
        if (pynode) {
                Py_DECREF(pynode);
        }
+#endif
        MEM_freeN(node->storage);
        node->storage = NULL;
 }
@@ -169,6 +176,7 @@ static void node_dynamic_disable(bNode *node)
 /* Disable all pynodes using the given text (script) id */
 static void node_dynamic_disable_all_by_id(ID *id)
 {
+#ifndef DISABLE_PYTHON
        Material *ma; /* XXX hardcoded for shaders */
 
        for (ma= G.main->mat.first; ma; ma= ma->id.next) {
@@ -183,6 +191,7 @@ static void node_dynamic_disable_all_by_id(ID *id)
                        }
                }
        }
+#endif
 }
 
 static void node_rem_socklist_links(bNodeTree *ntree, ListBase *lb)
@@ -327,6 +336,7 @@ int nodeDynamicUnlinkText(ID *txtid) {
 
 static void node_dynamic_pyerror_print(bNode *node)
 {
+#ifndef DISABLE_PYTHON
        PyGILState_STATE gilstate = PyGILState_Ensure();
 
        fprintf(stderr, "\nError in dynamic node script \"%s\":\n", node->name);
@@ -334,6 +344,7 @@ static void node_dynamic_pyerror_print(bNode *node)
        else { fprintf(stderr, "Not a valid dynamic node Python script.\n"); }
 
        PyGILState_Release(gilstate);
+#endif
 }
 
 static void node_dynamic_register_type(bNode *node)
@@ -348,6 +359,7 @@ static void node_dynamic_register_type(bNode *node)
        node->typeinfo->name = BLI_strdup(node->name);
 }
 
+#ifndef DISABLE_PYTHON
 /* node_dynamic_get_pynode:
  * Find the pynode definition from the script */
 static PyObject *node_dynamic_get_pynode(PyObject *dict)
@@ -389,9 +401,13 @@ static PyObject *node_dynamic_get_pynode(PyObject *dict)
                "no PyNode definition found in the script!");
        return NULL;
 }
+#endif /* DISABLE_PYTHON */
 
 static int node_dynamic_parse(struct bNode *node)
 {
+#ifdef DISABLE_PYTHON
+       return -1;
+#else
        PyObject *dict= NULL;
        PyObject *pynode_data= NULL;
        PyObject *pynode= NULL;
@@ -479,12 +495,14 @@ static int node_dynamic_parse(struct bNode *node)
        }
 
        return 0;
+#endif
 }
 
 /* node_dynamic_setup: prepare for execution (state: NODE_DYNAMIC_READY)
  * pynodes already linked to a script (node->id != NULL). */
 static void node_dynamic_setup(bNode *node)
 {
+#ifndef DISABLE_PYTHON
        NodeScriptDict *nsd = NULL;
        bNodeTree *nodetree = NULL;
        bNodeType *ntype = NULL;
@@ -608,7 +626,7 @@ static void node_dynamic_setup(bNode *node)
        node->custom1 = BSET(node->custom1, NODE_DYNAMIC_READY);
 
        PyGILState_Release(gilstate);
-
+#endif /* DISABLE_PYTHON */
        return;
 }
 
@@ -641,6 +659,9 @@ static void node_dynamic_init_cb(bNode *node) {
 /* node_dynamic_copy_cb: pynode copy callback */
 static void node_dynamic_copy_cb(bNode *orig_node, bNode *new_node)
 {
+#ifdef DISABLE_PYTHON
+       return;
+#else
        NodeScriptDict *nsd;
        PyGILState_STATE gilstate;
 
@@ -657,11 +678,15 @@ static void node_dynamic_copy_cb(bNode *orig_node, bNode *new_node)
                Py_INCREF((PyObject *)(nsd->dict));
 
        PyGILState_Release(gilstate);
+#endif
 }
 
 /* node_dynamic_exec_cb: the execution callback called per pixel
  * during rendering. */
 static void node_dynamic_exec_cb(void *data, bNode *node, bNodeStack **in, bNodeStack **out) {
+#ifdef DISABLE_PYTHON
+       return;
+#else
        BPy_Node *mynode = NULL;
        NodeScriptDict *nsd = NULL;
        PyObject *pyresult = NULL;
@@ -716,6 +741,7 @@ static void node_dynamic_exec_cb(void *data, bNode *node, bNodeStack **in, bNode
                        PyGILState_Release(gilstate);
                }
        }
+#endif
 }
 
 bNodeType node_dynamic_typeinfo = {
index 47b269c85d73bb9af01e1d128c7dffae3c58b81f..4ebaad673f2a86e7719c3e4df6072e2fce94523c 100644 (file)
@@ -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')
 
index a8ce9da8780f56460d57a1eda976996a34c27e1f..6162a12d06d5ceabe7ae6cdbdee343d8a85788a0 100644 (file)
 #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;
index aee00baef8e2598490f6288448608d0b1a53f7d5..973782d7463a4d10bcef69af6974739597f3b661 100644 (file)
@@ -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);
index c744449d1dbfc2d02e9ffe33388731283c11fe06..f9e2d138a787415c82107f1fa24bcc586aed8af5 100644 (file)
@@ -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;
 }
index ca1f6cff202fee725d653cd4bebb31b8c200caaf..1c8380c7a7da3a0a4affac53b72cce2c0c68f0c9 100644 (file)
 
 #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();
 }
index 8f2623575aa75a4c4d00db3e55bf7c91fa6686af..2e6f6c18073a1f871460c92a4c9865da2e405521 100644 (file)
 #include "BSE_time.h"
 #include "BSE_view.h"
 
+#ifndef DISABLE_PYTHON
 #include "BPY_extern.h"
+#endif
 
 #include "RE_render_ext.h"
 
@@ -3350,6 +3352,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);
@@ -3359,7 +3362,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)
index b6243a339442ad7a958b04489a3f3e858e85cbcc..42972e4aa5dd32b25341fbb4042e16b167a3f6a2 100644 (file)
@@ -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 ------------------ */
index 77c27dfa3dbc8ef5db7a6f0da751bfbd8b97f459..53fb6dbffb1a96fd1e68fe281a3c20f31130a892 100644 (file)
 #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;
index 4dc64b0f9334bc19953801e1976107d30447a601..16a5b049da2eacb8c241692840913fd654e9a579 100644 (file)
 #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) {
index 2557894d0e0ba30966fb06116e48b1f45eb09e42..3cc306c8ea9700922ee200b28bf3ff761c4c2ab1 100644 (file)
 #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;
 }
index 4ca287d81c535fa75eb8c278adabc5d029ee9a78..cf8f3c5c99df4aea4dcc1ab474c76fde64617817 100644 (file)
 #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);
        }
index 28248c052b3e2bb79a7eaaab8f7bb6b0d59ea82c..b6bd00d2ad698114487947bb507070d2aaeebb2f 100644 (file)
 
 #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, "");
index 68326c330ad2430f723ad91fde798ff27369ce60..b839029c139fc49619c0a3f854b5c7b8b043b6cc 100644 (file)
 
 #include "BKE_depsgraph.h"
 
+#ifndef DISABLE_PYTHON
 #include "BPY_extern.h"
 #include "BPY_menus.h"
+#endif
 
 static int viewmovetemp = 0;
 
index 53c4b9b59531a6134c5835be57e27e03268f08c9..2bf58fb28736eb98db3dcf84d8f93923d8d424b4 100644 (file)
 #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);
index 9bb59a81192dd76140addd0a6a4d92a9dd359c56..9268642db2f722c4c28e3b021624a4fd3ffa53e4 100644 (file)
 
 #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;
index d57fa18a7055ea98feb8ae70aa2d76ce89b96eb7..e2caf97df051342d8224b01d6a7e38a08a8c7dad 100644 (file)
 #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();
index 44044841a99f4ba92851689675d40b825220a164..7c97fa8431d70c424f637acfdd76cfe232561f34 100644 (file)
 #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();
index 7c1a4668a56483bc4a35d36ce72b3e2942df6a62..28baf87baa1eb60e98fdef79574a423a08cf9a4e 100644 (file)
@@ -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);
index b4d78b7fa37ad78691332e176e52d1616d4f6060..bbac70e9e5e6050e5f453ae65437b225ef7309f6 100644 (file)
 
 #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)
index c26620ccbf2ca6586d984c100e5aa8f04b769728..b6221c2f84b5926138c62db0b51b681836bb3fb7 100644 (file)
 
 #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)
index 55feb4c030557f7368674d97a201dd2bd3d86199..1c028c3f18be4e898b0d840888cb14cb1bcbaecd 100644 (file)
 #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;
        
index 7fdc672596436946586f18f53cb413a3e16f3475..cd7f80344dcb5e62a63e98e26caadfe85acc27f3 100644 (file)
 #include "BDR_imagepaint.h"
 #include "BDR_vpaint.h"
 
+#ifndef DISABLE_PYTHON
 #include "BPY_extern.h"
+#endif
 
 #include "blendef.h"
 
@@ -677,11 +679,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;
 }
 
@@ -914,8 +918,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)) {
@@ -1125,9 +1131,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 */
index c5a661abd69bc83c0ae450ef6494173c674df04e..1655664370736f8820b2cede6a1bab7d1755286e 100644 (file)
@@ -25,4 +25,7 @@ if env['WITH_BF_OPENEXR']:
 if not env['WITH_BF_SDL']:
        defs.append('DISABLE_SDL')
 
+if not env['WITH_BF_PYTHON']:
+       defs.append('DISABLE_PYTHON')
+
 env.BlenderLib ( libname = 'blender_creator', sources = Split(sources), includes = Split(incs), defines = defs, libtype='core', priority = 1 )
index b5360b31a0a349939f10d08e72d36d9378c01da4..872a5f4d4971d2e0da6f857a47c4a39fe3fc1110 100644 (file)
@@ -72,7 +72,9 @@
 
 #include "IMB_imbuf.h" // for quicktime_init
 
+#ifndef DISABLE_PYTHON
 #include "BPY_extern.h"
+#endif
 
 #include "RE_pipeline.h"
 
@@ -515,9 +517,9 @@ int main(int argc, char **argv)
 
                if ( (G.windowstate == G_WINDOWSTATE_BORDER) || (G.windowstate == G_WINDOWSTATE_FULLSCREEN)) 
                        setprefsize(stax, stay, sizx, sizy, 0);
-               
+#ifndef DISABLE_PYTHON         
                BPY_start_python(argc, argv);
-               
+#endif         
                /**
                 * NOTE: sound_init_audio() *must be* after start_python,
                 * at least on FreeBSD.
@@ -539,8 +541,9 @@ int main(int argc, char **argv)
 #endif
        }
        else {
+#ifndef DISABLE_PYTHON
                BPY_start_python(argc, argv);
-               
+#endif         
                BLI_where_is_temp( btempdir, 0 ); /* call after loading the .B.blend so we can read U.tempdir */
                
                // (ton) Commented out. I have no idea whats thisfor... will mail around!
@@ -549,7 +552,7 @@ int main(int argc, char **argv)
         // sound_init_audio();
         // if (G.f & G_DEBUG) printf("setting audio to: %d\n", audio);
        }
-
+#ifndef DISABLE_PYTHON
        /**
         * NOTE: the U.pythondir string is NULL until BIF_init() is executed,
         * so we provide the BPY_ function below to append the user defined
@@ -559,7 +562,8 @@ int main(int argc, char **argv)
         * on U.pythondir.
         */
        BPY_post_start_python();
-
+#endif
+       
 #ifdef WITH_QUICKTIME
 
        quicktime_init();
@@ -644,13 +648,14 @@ int main(int argc, char **argv)
                                        if (a < argc) {
                                                int frame= MIN2(MAXFRAME, MAX2(1, atoi(argv[a])));
                                                Render *re= RE_NewRender(G.scene->id.name);
-
+#ifndef DISABLE_PYTHON
                                                if (G.f & G_DOSCRIPTLINKS)
                                                        BPY_do_all_scripts(SCRIPT_RENDER, 0);
-
+#endif
                                                RE_BlenderAnim(re, G.scene, frame, frame, G.scene->frame_step);
-
+#ifndef DISABLE_PYTHON
                                                BPY_do_all_scripts(SCRIPT_POSTRENDER, 0);
+#endif
                                        }
                                } else {
                                        printf("\nError: no blend loaded. cannot use '-f'.\n");
@@ -659,14 +664,15 @@ int main(int argc, char **argv)
                        case 'a':
                                if (G.scene) {
                                        Render *re= RE_NewRender(G.scene->id.name);
-
+#ifndef DISABLE_PYTHON
                                        if (G.f & G_DOSCRIPTLINKS)
                                                BPY_do_all_scripts(SCRIPT_RENDER, 1);
-
+#endif
                                        RE_BlenderAnim(re, G.scene, G.scene->r.sfra, G.scene->r.efra, G.scene->frame_step);
-
+#ifndef DISABLE_PYTHON
                                        if (G.f & G_DOSCRIPTLINKS)
                                                BPY_do_all_scripts(SCRIPT_POSTRENDER, 1);
+#endif
                                } else {
                                        printf("\nError: no blend loaded. cannot use '-a'.\n");
                                }
@@ -704,6 +710,7 @@ int main(int argc, char **argv)
                                }
                                break;
                        case 'P':
+#ifndef DISABLE_PYTHON
                                a++;
                                if (a < argc) {
                                        /* If we're not running in background mode, then give python a valid screen */
@@ -714,6 +721,9 @@ int main(int argc, char **argv)
                                        BPY_run_python_script (argv[a]);
                                }
                                else printf("\nError: you must specify a Python script after '-P '.\n");
+#else
+                               printf("This blender was built without python support\n");
+#endif /* DISABLE_PYTHON */
                                break;
                        case 'o':
                                a++;
index dd617f3c5637c1f838e88038e6f9cce539f5c6f9..abd6cbda4dd5a9835854ac4e1aaaff5e966684bd 100644 (file)
@@ -110,7 +110,6 @@ def setup_staticlibs(lenv):
     ]
     libincs = [
         '/usr/lib',
-        lenv['BF_PYTHON_LIBPATH'],
         lenv['BF_OPENGL_LIBPATH'],
         lenv['BF_JPEG_LIBPATH'],
         lenv['BF_PNG_LIBPATH'],
@@ -118,6 +117,8 @@ def setup_staticlibs(lenv):
         lenv['BF_ICONV_LIBPATH']
         ]
 
+    if lenv['WITH_BF_PYTHON']:
+        libincs += Split(lenv['BF_PYTHON_LIBPATH'])
     if lenv['WITH_BF_SDL']:
         libincs += Split(lenv['BF_SDL_LIBPATH'])
     if lenv['WITH_BF_FFMPEG']:
@@ -138,7 +139,7 @@ def setup_staticlibs(lenv):
     if lenv['WITH_BF_STATICOPENGL']:
         statlibs += Split(lenv['BF_OPENGL_LIB_STATIC'])
 
-    if lenv['WITH_BF_STATICPYTHON']:
+    if lenv['WITH_BF_PYTHON'] and lenv['WITH_BF_STATICPYTHON']:
         statlibs += Split(lenv['BF_PYTHON_LIB_STATIC'])
 
     if lenv['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross'):
@@ -154,7 +155,7 @@ def setup_syslibs(lenv):
         lenv['BF_ZLIB_LIB']
         ]
 
-    if not lenv['WITH_BF_STATICPYTHON']:
+    if lenv['WITH_BF_PYTHON'] and not lenv['WITH_BF_STATICPYTHON']:
         if lenv['BF_DEBUG'] and lenv['OURPLATFORM'] in ('win32-vc'):
             syslibs.append(lenv['BF_PYTHON_LIB']+'_d')
         else:
@@ -449,15 +450,18 @@ class BlenderEnvironment(SConsEnvironment):
                 lenv.Prepend(LINKFLAGS = ['/DEBUG','/PDB:'+progname+'.pdb'])
         if  lenv['OURPLATFORM']=='linux2':
             lenv.Append(LINKFLAGS = lenv['PLATFORM_LINKFLAGS'])
-            lenv.Append(LINKFLAGS = lenv['BF_PYTHON_LINKFLAGS'])
+            if lenv['WITH_BF_PYTHON']:
+                lenv.Append(LINKFLAGS = lenv['BF_PYTHON_LINKFLAGS'])
         if  lenv['OURPLATFORM']=='sunos5':
             lenv.Append(LINKFLAGS = lenv['PLATFORM_LINKFLAGS'])
-            lenv.Append(LINKFLAGS = lenv['BF_PYTHON_LINKFLAGS'])
+            if lenv['WITH_BF_PYTHON']:
+                lenv.Append(LINKFLAGS = lenv['BF_PYTHON_LINKFLAGS'])
             if lenv['CXX'].endswith('CC'):
                  lenv.Replace(LINK = '$CXX')
         if  lenv['OURPLATFORM']=='darwin':
             lenv.Append(LINKFLAGS = lenv['PLATFORM_LINKFLAGS'])
-            lenv.Append(LINKFLAGS = lenv['BF_PYTHON_LINKFLAGS'])
+            if lenv['WITH_BF_PYTHON']:
+                lenv.Append(LINKFLAGS = lenv['BF_PYTHON_LINKFLAGS'])
             lenv.Append(LINKFLAGS = lenv['BF_OPENGL_LINKFLAGS'])
         if lenv['BF_PROFILE']:
                 lenv.Append(LINKFLAGS = lenv['BF_PROFILE_FLAGS'])
index e16e78488de7ae30207b443bfdce77c4629d11f0..26f66568eb8e53ae692a38c73cbfdac6f8ce979a 100755 (executable)
@@ -27,7 +27,7 @@ def print_arguments(args, bc):
 
 def validate_arguments(args, bc):
     opts_list = [
-            'BF_PYTHON', 'BF_PYTHON_VERSION', 'BF_PYTHON_INC', 'BF_PYTHON_BINARY', 'BF_PYTHON_LIB', 'BF_PYTHON_LIBPATH', 'BF_PYTHON_LINKFLAGS', 'WITH_BF_STATICPYTHON', 'BF_PYTHON_LIB_STATIC',
+            'WITH_BF_PYTHON', 'BF_PYTHON', 'BF_PYTHON_VERSION', 'BF_PYTHON_INC', 'BF_PYTHON_BINARY', 'BF_PYTHON_LIB', 'BF_PYTHON_LIBPATH', 'BF_PYTHON_LINKFLAGS', 'WITH_BF_STATICPYTHON', 'BF_PYTHON_LIB_STATIC',
             'WITH_BF_OPENAL', 'BF_OPENAL', 'BF_OPENAL_INC', 'BF_OPENAL_LIB', 'BF_OPENAL_LIBPATH', 'WITH_BF_STATICOPENAL', 'BF_OPENAL_LIB_STATIC',
             'WITH_BF_SDL', 'BF_SDL', 'BF_SDL_INC', 'BF_SDL_LIB', 'BF_SDL_LIBPATH',
             'BF_PTHREADS', 'BF_PTHREADS_INC', 'BF_PTHREADS_LIB', 'BF_PTHREADS_LIBPATH',
@@ -145,6 +145,7 @@ def read_opts(cfg, args):
         ('VERSE_REGEN_PROTO', 'Whether to regenerate the protocol files', 'yes'),
         ('BF_DEBUG_LIBS', 'list of libraries to build with debug symbols'),
 
+        (BoolOption('WITH_BF_PYTHON', 'Compile with python', True)),
         ('BF_PYTHON', 'base path for python', ''),
         ('BF_PYTHON_VERSION', 'Python version to use', ''),
         ('BF_PYTHON_INC', 'include path for Python headers', ''),