KX_PythonInit.cpp - workaround for current sandbox and possible fix. no real change for now but others may want to look into it.
blendef.h - removed some unused defines. editipo_mods.c - deselect all was selecting instead.
This commit is contained in:
@@ -42,8 +42,6 @@
|
||||
#define MAXSEQ 32
|
||||
|
||||
/* in buttons.c */
|
||||
#define MAX_EFFECT 20
|
||||
|
||||
#ifndef MAXFLOAT
|
||||
#define MAXFLOAT ((float)3.40282347e+38)
|
||||
#endif
|
||||
@@ -67,8 +65,6 @@
|
||||
#define RET_OK 0
|
||||
#define RET_ERROR 1
|
||||
#define RET_CANCEL 2
|
||||
#define RET_YES (1 == 1)
|
||||
#define RET_NO (1 == 0)
|
||||
|
||||
#if defined(__sgi) || defined(__sparc) || defined(__sparc__) || defined (__PPC__) || defined (__ppc__) || defined (__hppa__) || defined (__BIG_ENDIAN__)
|
||||
/* big endian */
|
||||
@@ -90,7 +86,6 @@
|
||||
#define VERSE 3
|
||||
/*#endif*/
|
||||
#define DESELECT 0
|
||||
#define NOT_YET 0
|
||||
#define VISIBLE 0
|
||||
#define LAST 0
|
||||
|
||||
@@ -132,10 +127,6 @@
|
||||
#define BEZ_DESEL(bezt) { (bezt)->f1 &= ~SELECT; (bezt)->f2 &= ~SELECT; (bezt)->f3 &= ~SELECT; }
|
||||
#define BEZ_INVSEL(bezt) { (bezt)->f1 ^= SELECT; (bezt)->f2 ^= SELECT; (bezt)->f3 ^= SELECT; }
|
||||
|
||||
/* psfont */
|
||||
#define FNT_PDRAW 1
|
||||
#define FNT_HAEBERLI 2
|
||||
|
||||
/* getbutton */
|
||||
|
||||
/* do_global_buttons(event) */
|
||||
@@ -176,7 +167,6 @@
|
||||
/* EVENT < 50: alones en locals */
|
||||
|
||||
#define B_KEEPDATA 60
|
||||
#define B_CONSOLETOG 61
|
||||
#define B_DRAWINFO 62
|
||||
#define B_REDRCURW3D 63
|
||||
#define B_FLIPINFOMENU 64
|
||||
@@ -224,12 +214,10 @@
|
||||
/* watch: codes 102-132 in in use for layers */
|
||||
#define B_AUTOKEY 139
|
||||
#define B_SCENELOCK 140
|
||||
#define B_LOCALVIEW 141
|
||||
#define B_U_CAPSLOCK 142
|
||||
|
||||
#define B_VIEWBUT 146
|
||||
#define B_PERSP 147
|
||||
#define B_PROPTOOL 148
|
||||
#define B_VIEWRENDER 149
|
||||
#define B_STARTGAME 150
|
||||
|
||||
@@ -270,9 +258,8 @@
|
||||
|
||||
/* OOPS: 250 */
|
||||
#define B_OOPSHOME 251
|
||||
#define B_OOPSBORDER 252
|
||||
#define B_NEWOOPS 253
|
||||
#define B_OOPSVIEWSEL 254
|
||||
#define B_NEWOOPS 252
|
||||
#define B_OOPSVIEWSEL 253
|
||||
|
||||
/* INFO: 300 */
|
||||
/* watch: also in filesel.c and editobject.c */
|
||||
@@ -280,8 +267,6 @@
|
||||
#define B_INFODELSCR 302
|
||||
#define B_INFOSCE 304
|
||||
#define B_INFODELSCE 305
|
||||
#define B_FILEMENU 306
|
||||
#define B_PACKFILE 307
|
||||
|
||||
#define B_CONSOLEOUT 308
|
||||
#define B_CONSOLENUMLINES 309
|
||||
@@ -295,11 +280,7 @@
|
||||
#define B_RESTOREFONT 317
|
||||
#define B_USETEXTUREFONT 318
|
||||
|
||||
#define B_UITHEMECHANGED 320
|
||||
#define B_UITHEMECOLORMOD 321
|
||||
#define B_UITHEMERESET 322
|
||||
#define B_UITHEMEIMPORT 323
|
||||
#define B_UITHEMEEXPORT 324
|
||||
|
||||
#define B_MEMCACHELIMIT 325
|
||||
#define B_WPAINT_RANGE 326
|
||||
@@ -324,15 +305,9 @@
|
||||
#define B_SIMAGELOAD 353
|
||||
#define B_SIMA_REDR_IMA_3D 354
|
||||
#define B_SIMAGETILE 355
|
||||
#define B_BE_SQUARE 356
|
||||
#define B_TWINANIM 357
|
||||
#define B_SIMAGEREPLACE 358
|
||||
#define B_CLIP_UV 359
|
||||
#define B_SIMAGELOAD1 360
|
||||
#define B_SIMAGEREPLACE1 361
|
||||
#define B_SIMAGEPAINTTOOL 362
|
||||
#define B_SIMAPACKIMA 363
|
||||
#define B_SIMAGESAVE 364
|
||||
#define B_SIMACLONEBROWSE 365
|
||||
#define B_SIMACLONEDELETE 366
|
||||
#define B_SIMANOTHING 368
|
||||
@@ -364,8 +339,7 @@
|
||||
#define B_BUTSPREVIEW 402
|
||||
#define B_MATCOPY 403
|
||||
#define B_MATPASTE 404
|
||||
#define B_MESHTYPE 405
|
||||
#define B_CONTEXT_SWITCH 406
|
||||
#define B_CONTEXT_SWITCH 405
|
||||
|
||||
/* IMASEL: 450 */
|
||||
/* in imasel.h - not any more - elubie */
|
||||
@@ -375,8 +349,6 @@
|
||||
|
||||
/* TEXT: 500 */
|
||||
#define B_TEXTBROWSE 501
|
||||
#define B_TEXTALONE 502
|
||||
#define B_TEXTLOCAL 503
|
||||
#define B_TEXTDELETE 504
|
||||
#define B_TEXTFONT 505
|
||||
#define B_TEXTSTORE 506
|
||||
@@ -400,14 +372,12 @@
|
||||
#define B_RELOADDIR 552
|
||||
|
||||
/* SEQUENCE: 600 */
|
||||
#define B_SEQHOME 601
|
||||
#define B_SEQCLEAR 602
|
||||
#define B_SEQCLEAR 601
|
||||
|
||||
/* SOUND: 650 */
|
||||
#define B_SOUNDBROWSE 651
|
||||
#define B_SOUNDBROWSE2 652
|
||||
#define B_SOUNDHOME 653
|
||||
#define B_PACKSOUND 654
|
||||
|
||||
/* ACTION: 701 - 750 */
|
||||
#define B_ACTHOME 701
|
||||
@@ -441,9 +411,8 @@
|
||||
#define B_NLAHOME 801
|
||||
|
||||
/* NODE: 851-900 */
|
||||
#define B_NODEHOME 851
|
||||
#define B_NODE_USEMAT 852
|
||||
#define B_NODE_USESCENE 853
|
||||
#define B_NODE_USEMAT 851
|
||||
#define B_NODE_USESCENE 852
|
||||
|
||||
/* FREE 901 - 999 */
|
||||
|
||||
|
||||
@@ -281,9 +281,6 @@ void curvemap_buttons(struct uiBlock *block, struct CurveMapping *cumap, char la
|
||||
#define B_SOFTBODY_BAKE 1422
|
||||
#define B_SOFTBODY_BAKE_FREE 1423
|
||||
|
||||
/* this has MAX_EFFECT settings! Next free define is 1450... */
|
||||
#define B_SELEFFECT 1430
|
||||
|
||||
/* Fluidsim button defines */
|
||||
#define B_FLUIDSIM_BAKE 1450
|
||||
#define B_FLUIDSIM_SELDIR 1451
|
||||
|
||||
@@ -228,7 +228,7 @@ void deselectall_editipo(void)
|
||||
bezt= ei->icu->bezt;
|
||||
b= ei->icu->totvert;
|
||||
while(b--) {
|
||||
BEZ_SEL(bezt);
|
||||
BEZ_DESEL(bezt);
|
||||
bezt++;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -211,10 +211,6 @@ void do_buts_buttons(short event)
|
||||
scrarea_queue_winredraw(curarea);
|
||||
}
|
||||
break;
|
||||
case B_MESHTYPE:
|
||||
allqueue(REDRAWBUTSEDIT, 0);
|
||||
allqueue(REDRAWVIEW3D, 0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -5221,16 +5221,6 @@ void do_view3d_buttons(short event)
|
||||
}
|
||||
break;
|
||||
|
||||
case B_LOCALVIEW:
|
||||
if(G.vd->localview) initlocalview();
|
||||
else {
|
||||
endlocalview(curarea);
|
||||
/* new layers might need unflushed events events */
|
||||
DAG_scene_update_flags(G.scene, G.vd->lay); /* tags all that moves and flushes*/
|
||||
}
|
||||
scrarea_queue_headredraw(curarea);
|
||||
break;
|
||||
|
||||
case B_VIEWBUT:
|
||||
|
||||
if(G.vd->viewbut==1) persptoetsen(PAD7);
|
||||
@@ -5247,9 +5237,6 @@ void do_view3d_buttons(short event)
|
||||
persptoetsen(PAD5);
|
||||
}
|
||||
|
||||
break;
|
||||
case B_PROPTOOL:
|
||||
allqueue(REDRAWHEADERS, 0);
|
||||
break;
|
||||
case B_VIEWRENDER:
|
||||
if (curarea->spacetype==SPACE_VIEW3D) {
|
||||
|
||||
@@ -1047,6 +1047,21 @@ PyObject *KXpy_import(PyObject *self, PyObject *args)
|
||||
|
||||
}
|
||||
|
||||
/* override python file type functions */
|
||||
#if 0
|
||||
static int
|
||||
file_init(PyObject *self, PyObject *args, PyObject *kwds)
|
||||
{
|
||||
KXpy_file(NULL, NULL);
|
||||
return -1;
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
file_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
|
||||
{
|
||||
return KXpy_file(NULL, NULL);
|
||||
}
|
||||
#endif
|
||||
|
||||
static PyMethodDef meth_open[] = {{ "open", KXpy_open, METH_VARARGS, "(disabled)"}};
|
||||
static PyMethodDef meth_reload[] = {{ "reload", KXpy_reload, METH_VARARGS, "(disabled)"}};
|
||||
@@ -1060,7 +1075,6 @@ static PyMethodDef meth_import[] = {{ "import", KXpy_import, METH_VARARGS, "our
|
||||
//static PyObject *g_oldimport = 0;
|
||||
//static int g_security = 0;
|
||||
|
||||
|
||||
void setSandbox(TPythonSecurityLevel level)
|
||||
{
|
||||
PyObject *m = PyImport_AddModule("__builtin__");
|
||||
@@ -1081,6 +1095,19 @@ void setSandbox(TPythonSecurityLevel level)
|
||||
// our own import
|
||||
PyDict_SetItemString(d, "__import__", PyCFunction_New(meth_import, NULL));
|
||||
//g_security = level;
|
||||
|
||||
// Overiding file dosnt stop it being accessed if your sneaky
|
||||
// f = [ t for t in (1).__class__.__mro__[-1].__subclasses__() if t.__name__ == 'file'][0]('/some_file.txt', 'w')
|
||||
// f.write('...')
|
||||
// so overwrite the file types functions. be very careful here still, since python uses python.
|
||||
// ps - python devs frown deeply upon this.
|
||||
|
||||
/* this could mess up pythons internals, if we are serious about sandboxing
|
||||
* issues like the one above need to be solved, possibly modify __subclasses__ is safer? */
|
||||
#if 0
|
||||
PyFile_Type.tp_init = file_init;
|
||||
PyFile_Type.tp_new = file_new;
|
||||
#endif
|
||||
//}
|
||||
break;
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user