Improve message in Project Settings when there's no project + cleanup

Also show a button to set up a project.
This commit is contained in:
Julian Eisel 2022-10-07 11:55:23 +02:00
parent 0cba4a12a3
commit b2b00cb8ea
2 changed files with 10 additions and 4 deletions

View File

@ -113,7 +113,7 @@ class PROJECTSETTINGS_PT_save_project_settings(Panel):
PROJECTSETTINGS_HT_header.draw_buttons(layout, context)
class PROJECTSETTINGS_PT_no_project(CenterAlignMixIn, Panel):
class PROJECTSETTINGS_PT_no_project(Panel):
bl_space_type = 'PROJECT_SETTINGS'
bl_region_type = 'WINDOW'
# Special hardcoded context.
@ -125,10 +125,17 @@ class PROJECTSETTINGS_PT_no_project(CenterAlignMixIn, Panel):
def poll(cls, context):
return (context.project is None)
def draw_centered(self, context, layout):
def draw(self, context):
layout = self.layout
layout.label(text="No active project.", icon='INFO')
col = layout.column(align=True)
col.label(text="Open/store a file inside of a project directory, or set up a new project")
col.label(text="by choosing a project directory.")
row = layout.row()
split = row.split(factor=0.3)
split.operator("wm.new_project", text="Set up Project...")
class PROJECTSETTINGS_PT_setup(CenterAlignMixIn, Panel):

View File

@ -2359,7 +2359,6 @@ static bool wm_project_has_active_poll(bContext *C)
return active_project != NULL;
}
/* Only save the prefs block. operator entry */
static int wm_save_project_settings_exec(bContext *UNUSED(C), wmOperator *UNUSED(op))
{
BlenderProject *active_project = CTX_wm_project();
@ -2487,7 +2486,7 @@ void WM_OT_delete_project_setup(wmOperatorType *ot)
ot->idname = "WM_OT_delete_project_setup";
ot->description =
"Remove the configuration of the current project with all settings, but keep project files "
"(such as .blend files) untouched.";
"(such as .blend files) untouched";
ot->invoke = WM_operator_confirm;
ot->exec = wm_delete_project_setup_exec;