Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 364291 | Differences between
and this patch

Collapse All | Expand All

(-)a/source/blender/makesrna/intern/rna_userdef.c (+7 lines)
Lines 107-112 static void rna_userdef_script_autoexec_update(Main *bmain, Scene *scene, Pointe Link Here
107
	}
107
	}
108
}
108
}
109
109
110
static int rna_userdef_script_autoexec_editable(Main *bmain, Scene *scene, PointerRNA *ptr) {
111
	/* Disable "Auto Run Python Scripts" checkbox unless Blender run with --enable-autoexec */
112
	return !(G.f & G_SCRIPT_OVERRIDE_PREF);
113
}
114
110
static void rna_userdef_mipmap_update(Main *bmain, Scene *scene, PointerRNA *ptr)
115
static void rna_userdef_mipmap_update(Main *bmain, Scene *scene, PointerRNA *ptr)
111
{
116
{
112
	GPU_set_mipmap(!(U.gameflags & USER_DISABLE_MIPMAP));
117
	GPU_set_mipmap(!(U.gameflags & USER_DISABLE_MIPMAP));
Lines 2508-2513 static void rna_def_userdef_system(BlenderRNA *brna) Link Here
2508
	RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", USER_SCRIPT_AUTOEXEC_DISABLE);
2513
	RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", USER_SCRIPT_AUTOEXEC_DISABLE);
2509
	RNA_def_property_ui_text(prop, "Auto Run Python Scripts", "Allow any .blend file to run scripts automatically (unsafe with blend files from an untrusted source)");
2514
	RNA_def_property_ui_text(prop, "Auto Run Python Scripts", "Allow any .blend file to run scripts automatically (unsafe with blend files from an untrusted source)");
2510
	RNA_def_property_update(prop, 0, "rna_userdef_script_autoexec_update");
2515
	RNA_def_property_update(prop, 0, "rna_userdef_script_autoexec_update");
2516
	/* Disable "Auto Run Python Scripts" checkbox unless Blender run with --enable-autoexec */
2517
	RNA_def_property_editable_func(prop, "rna_userdef_script_autoexec_editable");
2511
2518
2512
	prop= RNA_def_property(srna, "use_tabs_as_spaces", PROP_BOOLEAN, PROP_NONE);
2519
	prop= RNA_def_property(srna, "use_tabs_as_spaces", PROP_BOOLEAN, PROP_NONE);
2513
	RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", USER_TXT_TABSTOSPACES_DISABLE);
2520
	RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", USER_TXT_TABSTOSPACES_DISABLE);
(-)a/source/blender/windowmanager/intern/wm_files.c (+4 lines)
Lines 276-281 static void wm_init_userdef(bContext *C) Link Here
276
		else											  G.f &= ~G_SCRIPT_AUTOEXEC;
276
		else											  G.f &= ~G_SCRIPT_AUTOEXEC;
277
	}
277
	}
278
	if(U.tempdir[0]) BLI_where_is_temp(btempdir, FILE_MAX, 1);
278
	if(U.tempdir[0]) BLI_where_is_temp(btempdir, FILE_MAX, 1);
279
280
	/* Workaround to fix default of "Auto Run Python Scripts" checkbox */
281
	if ((G.f & G_SCRIPT_OVERRIDE_PREF) && !(G.f & G_SCRIPT_AUTOEXEC))
282
		U.flag |= USER_SCRIPT_AUTOEXEC_DISABLE;
279
}
283
}
280
284
281
void WM_read_file(bContext *C, const char *name, ReportList *reports)
285
void WM_read_file(bContext *C, const char *name, ReportList *reports)
(-)a/source/blender/windowmanager/intern/wm_operators.c (-5 / +12 lines)
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
- 

Return to bug 364291