Lines 1471-1482
static int wm_open_mainfile_exec(bContext *C, wmOperator *op)
Link Here
|
1471 |
G.fileflags &= ~G_FILE_NO_UI; |
1471 |
G.fileflags &= ~G_FILE_NO_UI; |
1472 |
else |
1472 |
else |
1473 |
G.fileflags |= G_FILE_NO_UI; |
1473 |
G.fileflags |= G_FILE_NO_UI; |
1474 |
|
1474 |
|
1475 |
if(RNA_boolean_get(op->ptr, "use_scripts")) |
1475 |
/* Restrict "Trusted Source" mode to Blender in --enable-autoexec mode */ |
|
|
1476 |
if(RNA_boolean_get(op->ptr, "use_scripts") && (!(G.f & G_SCRIPT_OVERRIDE_PREF))) |
1476 |
G.f |= G_SCRIPT_AUTOEXEC; |
1477 |
G.f |= G_SCRIPT_AUTOEXEC; |
1477 |
else |
1478 |
else |
1478 |
G.f &= ~G_SCRIPT_AUTOEXEC; |
1479 |
G.f &= ~G_SCRIPT_AUTOEXEC; |
1479 |
|
1480 |
|
1480 |
// XXX wm in context is not set correctly after WM_read_file -> crash |
1481 |
// XXX wm in context is not set correctly after WM_read_file -> crash |
1481 |
// do it before for now, but is this correct with multiple windows? |
1482 |
// do it before for now, but is this correct with multiple windows? |
1482 |
WM_event_add_notifier(C, NC_WINDOW, NULL); |
1483 |
WM_event_add_notifier(C, NC_WINDOW, NULL); |
Lines 1488-1493
static int wm_open_mainfile_exec(bContext *C, wmOperator *op)
Link Here
|
1488 |
|
1489 |
|
1489 |
static void WM_OT_open_mainfile(wmOperatorType *ot) |
1490 |
static void WM_OT_open_mainfile(wmOperatorType *ot) |
1490 |
{ |
1491 |
{ |
|
|
1492 |
PropertyRNA * use_scripts_checkbox = NULL; |
1493 |
|
1491 |
ot->name= "Open Blender File"; |
1494 |
ot->name= "Open Blender File"; |
1492 |
ot->idname= "WM_OT_open_mainfile"; |
1495 |
ot->idname= "WM_OT_open_mainfile"; |
1493 |
ot->description="Open a Blender file"; |
1496 |
ot->description="Open a Blender file"; |
Lines 1499-1505
static void WM_OT_open_mainfile(wmOperatorType *ot)
Link Here
|
1499 |
WM_operator_properties_filesel(ot, FOLDERFILE|BLENDERFILE, FILE_BLENDER, FILE_OPENFILE, WM_FILESEL_FILEPATH); |
1502 |
WM_operator_properties_filesel(ot, FOLDERFILE|BLENDERFILE, FILE_BLENDER, FILE_OPENFILE, WM_FILESEL_FILEPATH); |
1500 |
|
1503 |
|
1501 |
RNA_def_boolean(ot->srna, "load_ui", 1, "Load UI", "Load user interface setup in the .blend file"); |
1504 |
RNA_def_boolean(ot->srna, "load_ui", 1, "Load UI", "Load user interface setup in the .blend file"); |
1502 |
RNA_def_boolean(ot->srna, "use_scripts", 1, "Trusted Source", "Allow blend file execute scripts automatically, default available from system preferences"); |
1505 |
use_scripts_checkbox = RNA_def_boolean(ot->srna, "use_scripts", |
|
|
1506 |
!!(G.f & G_SCRIPT_AUTOEXEC), "Trusted Source", |
1507 |
"Allow blend file execute scripts automatically, default available from system preferences"); |
1508 |
/* Disable "Trusted Source" checkbox unless Blender run with --enable-autoexec */ |
1509 |
if (use_scripts_checkbox && (G.f & G_SCRIPT_OVERRIDE_PREF)) |
1510 |
RNA_def_property_clear_flag(use_scripts_checkbox, PROP_EDITABLE); |
1503 |
} |
1511 |
} |
1504 |
|
1512 |
|
1505 |
/* **************** link/append *************** */ |
1513 |
/* **************** link/append *************** */ |
1506 |
- |
|
|