added scons option BF_WITH_PYTHON (defined as DISABLE_PYTHON)
This commit is contained in:
		@@ -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] )
 | 
			
		||||
 
 | 
			
		||||
@@ -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 = {
 | 
			
		||||
 
 | 
			
		||||
@@ -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);
 | 
			
		||||
 
 | 
			
		||||
@@ -117,7 +117,9 @@
 | 
			
		||||
#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);
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 
 | 
			
		||||
@@ -73,7 +73,10 @@
 | 
			
		||||
#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 */
 | 
			
		||||
 
 | 
			
		||||
@@ -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);
 | 
			
		||||
 
 | 
			
		||||
@@ -111,7 +111,9 @@
 | 
			
		||||
 | 
			
		||||
#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 */
 | 
			
		||||
 
 | 
			
		||||
@@ -82,7 +82,10 @@
 | 
			
		||||
#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);
 | 
			
		||||
 
 | 
			
		||||
@@ -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
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -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 */
 | 
			
		||||
 
 | 
			
		||||
@@ -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;
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user