From e98e37598486adb2d5babbee5563ce112c010846 Mon Sep 17 00:00:00 2001 From: Trevor SANDY Date: Sun, 21 May 2023 11:17:00 +0200 Subject: [PATCH] Blender addon - render command --- common/lc_commands.cpp | 21 ++++++++++++++++++--- common/lc_commands.h | 4 +++- common/lc_mainwindow.cpp | 30 +++++++++++++++++++++++++----- common/lc_mainwindow.h | 2 +- 4 files changed, 47 insertions(+), 10 deletions(-) diff --git a/common/lc_commands.cpp b/common/lc_commands.cpp index 8fcdc45d..c9424e7c 100644 --- a/common/lc_commands.cpp +++ b/common/lc_commands.cpp @@ -108,13 +108,28 @@ const lcCommand gCommands[] = QT_TRANSLATE_NOOP("Status", "Export the current model in Wavefront OBJ format"), "" }, - // LC_FILE_RENDER + // LC_FILE_RENDER_POVRAY { - QT_TRANSLATE_NOOP("Action", "File.Render"), - QT_TRANSLATE_NOOP("Menu", "&Render..."), + QT_TRANSLATE_NOOP("Action", "File.Render.POVRay"), + QT_TRANSLATE_NOOP("Menu", "&POV-Ray Render..."), QT_TRANSLATE_NOOP("Status", "Render the current model using POV-Ray"), "" }, + // LC_FILE_RENDER_BLENDER + { + QT_TRANSLATE_NOOP("Action", "File.Render.Blender"), + QT_TRANSLATE_NOOP("Menu", "&Bender Render..."), + QT_TRANSLATE_NOOP("Status", "Render the current model using Blender"), + "" + }, + + // LC_FILE_RENDER_OPEN_IN_BLENDER + { + QT_TRANSLATE_NOOP("Action", "File.Render.OpenInBlender"), + QT_TRANSLATE_NOOP("Menu", "&Open In Blender..."), + QT_TRANSLATE_NOOP("Status", "Open the current model in Blender"), + "" + }, // LC_FILE_INSTRUCTIONS { QT_TRANSLATE_NOOP("Action", "File.Instructions"), diff --git a/common/lc_commands.h b/common/lc_commands.h index 9dec3cef..f49d28fc 100644 --- a/common/lc_commands.h +++ b/common/lc_commands.h @@ -17,7 +17,9 @@ enum lcCommandId LC_FILE_EXPORT_CSV, LC_FILE_EXPORT_POVRAY, LC_FILE_EXPORT_WAVEFRONT, - LC_FILE_RENDER, + LC_FILE_RENDER_POVRAY, + LC_FILE_RENDER_BLENDER, + LC_FILE_RENDER_OPEN_IN_BLENDER, LC_FILE_INSTRUCTIONS, LC_FILE_PRINT, LC_FILE_PRINT_PREVIEW, diff --git a/common/lc_mainwindow.cpp b/common/lc_mainwindow.cpp index fac10cac..759e7871 100644 --- a/common/lc_mainwindow.cpp +++ b/common/lc_mainwindow.cpp @@ -251,6 +251,21 @@ void lcMainWindow::CreateActions() EditActionPanIcon.addFile(":/resources/action_pan_16.png"); mActions[LC_EDIT_ACTION_PAN]->setIcon(EditActionPanIcon); + QIcon FileRenderPOVRayIcon; + FileRenderPOVRayIcon.addFile(":/resources/file_render_povray.png"); + FileRenderPOVRayIcon.addFile(":/resources/file_render_povray_16.png"); + mActions[LC_FILE_RENDER_POVRAY]->setIcon(FileRenderPOVRayIcon); + + QIcon FileRenderBlenderIcon; + FileRenderBlenderIcon.addFile(":/resources/file_render_blender.png"); + FileRenderBlenderIcon.addFile(":/resources/file_render_blender_16.png"); + mActions[LC_FILE_RENDER_BLENDER]->setIcon(FileRenderBlenderIcon); + + QIcon FileOpenInBlenderIcon; + FileOpenInBlenderIcon.addFile(":/resources/file_render_open_in_blender.png"); + FileOpenInBlenderIcon.addFile(":/resources/file_render_open_in_blender_16.png"); + mActions[LC_FILE_RENDER_OPEN_IN_BLENDER]->setIcon(FileOpenInBlenderIcon); + mActions[LC_EDIT_ACTION_CAMERA]->setIcon(QIcon(":/resources/action_camera.png")); mActions[LC_EDIT_ACTION_ROTATE_VIEW]->setIcon(QIcon(":/resources/action_rotate_view.png")); mActions[LC_EDIT_ACTION_ROLL]->setIcon(QIcon(":/resources/action_roll.png")); @@ -443,7 +458,10 @@ void lcMainWindow::CreateMenus() ExportMenu->addAction(mActions[LC_FILE_EXPORT_POVRAY]); ExportMenu->addAction(mActions[LC_FILE_EXPORT_WAVEFRONT]); FileMenu->addSeparator(); - FileMenu->addAction(mActions[LC_FILE_RENDER]); + QMenu* RenderMenu = FileMenu->addMenu(tr("&Render")); + RenderMenu->addAction(mActions[LC_FILE_RENDER_POVRAY]); + RenderMenu->addAction(mActions[LC_FILE_RENDER_BLENDER]); + RenderMenu->addAction(mActions[LC_FILE_RENDER_OPEN_IN_BLENDER]); FileMenu->addAction(mActions[LC_FILE_INSTRUCTIONS]); FileMenu->addAction(mActions[LC_FILE_PRINT]); FileMenu->addAction(mActions[LC_FILE_PRINT_PREVIEW]); @@ -1264,9 +1282,9 @@ void lcMainWindow::ShowHTMLDialog() lcGetActiveProject()->ExportHTML(Options); } -void lcMainWindow::ShowRenderDialog() +void lcMainWindow::ShowRenderDialog(int Command) { - lcRenderDialog Dialog(this); + lcRenderDialog Dialog(this, Command); Dialog.exec(); } @@ -2603,8 +2621,10 @@ void lcMainWindow::HandleCommand(lcCommandId CommandId) lcGetActiveProject()->ExportWavefront(QString()); break; - case LC_FILE_RENDER: - ShowRenderDialog(); + case LC_FILE_RENDER_POVRAY: + case LC_FILE_RENDER_BLENDER: + case LC_FILE_RENDER_OPEN_IN_BLENDER: + ShowRenderDialog(CommandId - LC_FILE_RENDER_POVRAY); break; case LC_FILE_INSTRUCTIONS: diff --git a/common/lc_mainwindow.h b/common/lc_mainwindow.h index 4531a154..72ec97a0 100644 --- a/common/lc_mainwindow.h +++ b/common/lc_mainwindow.h @@ -326,7 +326,7 @@ protected: void ShowUpdatesDialog(); void ShowAboutDialog(); void ShowHTMLDialog(); - void ShowRenderDialog(); + void ShowRenderDialog(int Command); void ShowInstructionsDialog(); void ShowPrintDialog(); void CreatePreviewWidget();