Пример #1
0
/**
 * Only write the userdef in a .blend, merging with the existing blend file.
 * \return success
 *
 * \note In the future we should re-evaluate user preferences,
 * possibly splitting out system/hardware specific prefs.
 */
bool BKE_blendfile_userdef_write_app_template(const char *filepath, ReportList *reports)
{
	/* if it fails, overwrite is OK. */
	UserDef *userdef_default = BKE_blendfile_userdef_read(filepath, NULL);
	if (userdef_default == NULL) {
		return BKE_blendfile_userdef_write(filepath, reports);
	}

	BKE_blender_userdef_app_template_data_swap(&U, userdef_default);
	bool ok = BKE_blendfile_userdef_write(filepath, reports);
	BKE_blender_userdef_app_template_data_swap(&U, userdef_default);
	BKE_blender_userdef_data_free(userdef_default, false);
	MEM_freeN(userdef_default);
	return ok;
}
Пример #2
0
void BKE_blender_userdef_app_template_data_set(UserDef *userdef)
{
  BKE_blender_userdef_app_template_data_swap(&U, userdef);
  BKE_blender_userdef_data_free(userdef, true);
}