Merge pull request #865 from trevorsandy/BLENDER_LDRAW_ADDON
Blender LDraw Addon
@@ -0,0 +1,461 @@
|
||||
#pragma once
|
||||
|
||||
#include <QWidget>
|
||||
#include <QDialog>
|
||||
#include "qtimer.h"
|
||||
|
||||
#define LC_UNIX_SHELL "/bin/sh"
|
||||
#define LC_WINDOWS_SHELL "cmd.exe"
|
||||
#define LC_BLENDER_ADDON_BLEND_FILE "leocad.blend"
|
||||
#define LC_BLENDER_ADDON_IMPORT_MODULE "TN"
|
||||
#define LC_BLENDER_ADDON_FOLDER_STR "io_scene_render_ldraw"
|
||||
|
||||
class QFormLayout;
|
||||
class QGridLayout;
|
||||
class QLabel;
|
||||
class QGroupBox;
|
||||
class QLineEdit;
|
||||
class QCheckBox;
|
||||
class QComboBox;
|
||||
class QPushButton;
|
||||
class QScrollArea;
|
||||
class QProgressBar;
|
||||
class QProcess;
|
||||
class QTimer;
|
||||
|
||||
class lcHttpReply;
|
||||
class lcBlenderPreferences;
|
||||
|
||||
class lcBlenderPreferencesDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
|
||||
explicit lcBlenderPreferencesDialog(int Width, int Height, double Scale, QWidget* Parent = nullptr);
|
||||
|
||||
virtual ~lcBlenderPreferencesDialog();
|
||||
|
||||
static bool GetBlenderPreferences(int& Width, int& Height, double& Scale, QWidget* Parent = nullptr);
|
||||
|
||||
public slots:
|
||||
void ShowPathsGroup();
|
||||
void ResetSettings();
|
||||
void EnableButton(bool);
|
||||
void accept() override;
|
||||
void reject() override;
|
||||
|
||||
private:
|
||||
QPushButton* mApplyButton;
|
||||
QPushButton* mResetButton;
|
||||
QPushButton* mPathsButton;
|
||||
lcBlenderPreferences* mPreferences;
|
||||
};
|
||||
|
||||
class lcBlenderPreferences : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
|
||||
explicit lcBlenderPreferences(int Width, int Height, double Scale, QWidget* Parent = nullptr);
|
||||
|
||||
~lcBlenderPreferences();
|
||||
|
||||
static void LoadSettings();
|
||||
static void SaveSettings();
|
||||
static bool ExportParameterFile();
|
||||
static bool SettingsModified(bool Update = true, QString const& Module = QString());
|
||||
static int ShowMessage(QString const& Header, QString const& Title = QString(), QString const& Body = QString(), QString const& Detail = QString(), const int Buttons = MBB_OK, const int Icon = 3 /*QMessageBox::Critical*/);
|
||||
|
||||
void Apply(const int Response = QDialog::Accepted);
|
||||
|
||||
int mImageWidth;
|
||||
int mImageHeight;
|
||||
qreal mScale;
|
||||
|
||||
protected:
|
||||
static int NumPaths(bool DefaultSettings = false);
|
||||
static int NumSettings(bool DefaultSettings = false);
|
||||
static int NumSettingsMM(bool DefaultSettings = false);
|
||||
static bool GetBlenderAddon(const QString& BlenderDir);
|
||||
static bool ExtractBlenderAddon(const QString& BlenderDir);
|
||||
static void LoadDefaultParameters(QByteArray& Buffer, int Which);
|
||||
static bool OverwriteFile(const QString& File);
|
||||
|
||||
QString ReadStdErr(bool& Error) const;
|
||||
void ClearGroupBox(QGroupBox* GroupBox);
|
||||
void InitPathsAndSettings();
|
||||
void InitPathsAndSettingsMM();
|
||||
bool ExtractAddon(const QString FileName, QString &Result);
|
||||
|
||||
signals:
|
||||
void SettingChangedSig(bool);
|
||||
|
||||
public slots:
|
||||
void ResetSettings();
|
||||
void ShowPathsGroup();
|
||||
bool PromptCancel();
|
||||
|
||||
private slots:
|
||||
void BrowseBlender(bool);
|
||||
void ConfigureBlenderAddon(bool = false, bool = false, bool = false);
|
||||
void UpdateBlenderAddon();
|
||||
void EnableImportModule();
|
||||
void SizeChanged(const QString&);
|
||||
void SetDefaultColor(int);
|
||||
void ColorButtonClicked(bool);
|
||||
void SetModelSize(bool = false);
|
||||
void ValidateColourScheme(int);
|
||||
void SettingChanged(int = -1);
|
||||
void SettingChanged(const QString&);
|
||||
void PathChanged();
|
||||
bool PromptAccept();
|
||||
void Update();
|
||||
void ReadStdOut();
|
||||
void ReadStdOut(const QString&, QString&);
|
||||
void WriteStdOut();
|
||||
void GetStandardOutput();
|
||||
void ShowResult();
|
||||
void StatusUpdate(bool, bool = true, const QString& = QString());
|
||||
void DownloadFinished(lcHttpReply*);
|
||||
|
||||
private:
|
||||
enum BlenderPathType
|
||||
{
|
||||
PATH_BLENDER, // 0 QLineEdit/QPushButton
|
||||
PATH_BLENDFILE, // 1 QLineEdit/QPushButton
|
||||
PATH_ENVIRONMENT, // 2 QLineEdit/QPushButton
|
||||
PATH_LDCONFIG, // 3 QLineEdit/QPushButton
|
||||
PATH_LDRAW, // 4 QLineEdit/QPushButton
|
||||
PATH_LSYNTH, // 5 QLineEdit/QPushButton
|
||||
PATH_STUD_LOGO, // 6 QLineEdit/QPushButton
|
||||
PATH_STUDIO_LDRAW, // 7 QLineEdit/QPushButton
|
||||
|
||||
NUM_PATHS
|
||||
};
|
||||
|
||||
enum BlenderLabelType
|
||||
{
|
||||
LBL_ADD_ENVIRONMENT, // 0 QCheckBox
|
||||
DEFAULT_SETTINGS, // 1
|
||||
LBL_ADD_GAPS = DEFAULT_SETTINGS, // 1 QCheckBox
|
||||
LBL_BEVEL_EDGES, // 2 QCheckBox
|
||||
LBL_BLENDFILE_TRUSTED, // 3 QCheckBox
|
||||
LBL_CROP_IMAGE, // 4 QCheckBox
|
||||
LBL_CURVED_WALLS, // 5 QCheckBox
|
||||
LBL_FLATTEN_HIERARCHY, // 6 QCheckBox
|
||||
NUM_COMBO_ITEMS, // 7
|
||||
LBL_IMPORT_CAMERAS = NUM_COMBO_ITEMS, // 7 QCheckBox
|
||||
LBL_IMPORT_LIGHTS, // 8 QCheckBox
|
||||
LBL_INSTANCE_STUDS, // 9 QCheckBox
|
||||
LBL_KEEP_ASPECT_RATIO, // 10 QCheckBox
|
||||
LBL_LINK_PARTS, // 11 QCheckBox
|
||||
LBL_MINIFIG_HIERARCHY, // 12 QCheckBox
|
||||
LBL_NUMBER_NODES, // 13 QCheckBox
|
||||
LBL_OVERWRITE_IMAGE, // 14 QCheckBox
|
||||
LBL_OVERWRITE_MATERIALS, // 15 QCheckBox
|
||||
LBL_OVERWRITE_MESHES, // 16 QCheckBox
|
||||
LBL_POSITION_CAMERA, // 17 QCheckBox
|
||||
LBL_REMOVE_DOUBLES, // 18 QCheckBox
|
||||
LBL_RENDER_WINDOW, // 19 QCheckBox
|
||||
LBL_USE_ARCHIVE_LIBS, // 20 QChekcBox
|
||||
LBL_SEARCH_ADDL_PATHS, // 21 QCheckBox
|
||||
LBL_SMOOTH_SHADING, // 22 QCheckBox
|
||||
LBL_TRANSPARENT_BACKGROUND, // 23 QCheckBox
|
||||
LBL_UNOFFICIAL_PARTS, // 24 QCheckBox
|
||||
LBL_USE_LOGO_STUDS, // 25 QCheckBox
|
||||
LBL_VERBOSE, // 26 QCheckBox
|
||||
|
||||
LBL_BEVEL_WIDTH, // 27/0 QLineEdit
|
||||
LBL_CAMERA_BORDER_PERCENT, // 28/1 QLineEdit
|
||||
LBL_DEFAULT_COLOUR, // 29/2 QLineEdit
|
||||
LBL_GAPS_SIZE, // 30/3 QLineEdit
|
||||
LBL_IMAGE_WIDTH, // 31/4 QLineEdit
|
||||
LBL_IMAGE_HEIGHT, // 32/5 QLineEdit
|
||||
LBL_IMAGE_SCALE, // 33/6 QLineEdit
|
||||
LBL_RENDER_PERCENTAGE, // 34/7 QLineEdit
|
||||
|
||||
LBL_COLOUR_SCHEME, // 35/0 QComboBox
|
||||
LBL_FLEX_PARTS_SOURCE, // 36/1 QComboBox
|
||||
LBL_LOGO_STUD_VERSION, // 27/2 QComboBox
|
||||
LBL_LOOK, // 38/3 QComboBox
|
||||
LBL_POSITION_OBJECT, // 39/4 QComboBox
|
||||
LBL_RESOLUTION, // 40/5 QComboBox
|
||||
LBL_RESOLVE_NORMALS, // 41/6 QComboBox
|
||||
|
||||
NUM_SETTINGS
|
||||
};
|
||||
|
||||
enum BlenderControlType
|
||||
{
|
||||
CTL_BLENDER_PATH_EDIT, // 0
|
||||
CTL_ADD_ENVIRONMENT_BOX = CTL_BLENDER_PATH_EDIT, // 0
|
||||
CTL_BEVEL_WIDTH_EDIT = CTL_BLENDER_PATH_EDIT, // 0
|
||||
CTL_COLOUR_SCHEME_COMBO = CTL_BLENDER_PATH_EDIT, // 0
|
||||
CTL_ADD_GAPS_BOX, // 1
|
||||
CTL_CAMERA_BORDER_PERCENT_EDIT = CTL_ADD_GAPS_BOX, // 1
|
||||
CTL_FLEX_PARTS_SOURCE_COMBO = CTL_ADD_GAPS_BOX, // 1
|
||||
CTL_BEVEL_EDGES_BOX, // 2
|
||||
CTL_DEFAULT_COLOUR_EDIT = CTL_BEVEL_EDGES_BOX, // 2
|
||||
CTL_LOGO_STUD_VERSION_COMBO = CTL_BEVEL_EDGES_BOX, // 2
|
||||
CTL_BLENDFILE_TRUSTED_BOX, // 3
|
||||
CTL_GAPS_SIZE_EDIT = CTL_BLENDFILE_TRUSTED_BOX, // 3
|
||||
CTL_LOOK_COMBO = CTL_BLENDFILE_TRUSTED_BOX, // 3
|
||||
CTL_CROP_IMAGE_BOX, // 4
|
||||
CTL_IMAGE_WIDTH_EDIT = CTL_CROP_IMAGE_BOX, // 4
|
||||
CTL_POSITION_OBJECT_COMBO = CTL_CROP_IMAGE_BOX, // 4
|
||||
CTL_CURVED_WALLS_BOX, // 5
|
||||
CTL_IMAGE_HEIGHT_EDIT = CTL_CURVED_WALLS_BOX, // 5
|
||||
CTL_RESOLUTION_COMBO = CTL_CURVED_WALLS_BOX, // 5
|
||||
CTL_FLATTEN_HIERARCHY_BOX, // 6
|
||||
CTL_IMAGE_SCALE_EDIT = CTL_FLATTEN_HIERARCHY_BOX, // 6
|
||||
CTL_RESOLVE_NORMALS_COMBO = CTL_FLATTEN_HIERARCHY_BOX, // 6
|
||||
CTL_IMPORT_CAMERAS_BOX, // 7
|
||||
CTL_RENDER_PERCENTAGE_EDIT = CTL_IMPORT_CAMERAS_BOX, // 7
|
||||
CTL_IMPORT_LIGHTS_BOX, // 8
|
||||
CTL_INSTANCE_STUDS_BOX, // 9
|
||||
CTL_KEEP_ASPECT_RATIO_BOX, // 10
|
||||
CTL_LINK_PARTS_BOX, // 11
|
||||
CTL_MINIFIG_HIERARCHY_BOX, // 12
|
||||
CTL_NUMBER_NODES_BOX, // 13
|
||||
CTL_OVERWRITE_IMAGE_BOX, // 14
|
||||
CTL_OVERWRITE_MATERIALS_BOX, // 15
|
||||
CTL_OVERWRITE_MESHES_BOX, // 16
|
||||
CTL_POSITION_CAMERA_BOX, // 17
|
||||
CTL_REMOVE_DOUBLES_BOX, // 18
|
||||
CTL_RENDER_WINDOW_BOX, // 19
|
||||
CTL_USE_ARCHIVE_LIBS_BOX, // 20
|
||||
CTL_SEARCH_ADDL_PATHS_BOX, // 21
|
||||
CTL_SMOOTH_SHADING_BOX, // 22
|
||||
CTL_TRANSPARENT_BACKGROUND_BOX, // 23
|
||||
CTL_UNOFFICIAL_PARTS_BOX, // 24
|
||||
CTL_USE_LOGO_STUDS_BOX, // 25
|
||||
CTL_VERBOSE_BOX, // 26
|
||||
};
|
||||
|
||||
enum BlenderLabelTypeMM
|
||||
{
|
||||
LBL_ADD_ENVIRONMENT_MM, // 0 QCheckBox
|
||||
LBL_BEVEL_EDGES_MM, // 1 QCheckBox
|
||||
LBL_BLEND_FILE_TRUSTED_MM, // 2 QCheckBox
|
||||
LBL_CROP_IMAGE_MM, // 3 QCheckBox
|
||||
LBL_DISPLAY_LOGO, // 4 QCheckBox
|
||||
LBL_IMPORT_CAMERAS_MM, // 5 QCheckBox
|
||||
LBL_IMPORT_EDGES, // 6 QCheckBox
|
||||
NUM_COMBO_ITEMS_MM, // 7
|
||||
LBL_IMPORT_LIGHTS_MM = NUM_COMBO_ITEMS_MM, // 7 QCheckBox
|
||||
LBL_KEEP_ASPECT_RATIO_MM, // 8 QCheckBox
|
||||
LBL_MAKE_GAPS, // 9 QCheckBox
|
||||
LBL_META_BFC, // 10 QCheckBox
|
||||
LBL_META_CLEAR, // 11 QCheckBox
|
||||
LBL_META_GROUP, // 12 QCheckBox
|
||||
LBL_META_PAUSE, // 13 QCheckBox
|
||||
LBL_META_PRINT_WRITE, // 14 QCheckBox
|
||||
LBL_META_SAVE, // 15 QCheckBox
|
||||
LBL_META_STEP, // 16 QCheckBox
|
||||
LBL_META_STEP_GROUPS, // 17 QCheckBox
|
||||
LBL_META_TEXMAP, // 18 QCheckBox
|
||||
LBL_NO_STUDS, // 19 QCheckBox
|
||||
LBL_OVERWRITE_IMAGE_MM, // 20 QCheckBox
|
||||
LBL_POSITION_CAMERA_MM, // 21 QCheckBox
|
||||
LBL_PARENT_TO_EMPTY, // 22 QCheckBox
|
||||
LBL_PREFER_STUDIO, // 23 QCheckBox
|
||||
LBL_PREFER_UNOFFICIAL, // 24 QCheckBox
|
||||
LBL_PRESERVE_HIERARCHY, // 25 QCheckBox
|
||||
LBL_PROFILE, // 26 QCheckBox
|
||||
LBL_RECALCULATE_NORMALS, // 27 QCheckBox
|
||||
LBL_REMOVE_DOUBLES_MM, // 28 QCheckBox
|
||||
LBL_RENDER_WINDOW_MM, // 29 QCheckBox
|
||||
LBL_SEARCH_ADDL_PATHS_MM, // 30 QCheckBox
|
||||
LBL_SETEND_FRAME, // 31 QCheckBox
|
||||
LBL_SET_TIMELINE_MARKERS, // 32 QCheckBox
|
||||
LBL_SHADE_SMOOTH, // 33 QCheckBox
|
||||
LBL_TRANSPARENT_BACKGROUND_MM, // 34 QCheckBox
|
||||
LBL_TREAT_MODELS_WITH_SUBPARTS_AS_PARTS, // 35 QCheckBox
|
||||
LBL_TREAT_SHORTCUT_AS_MODEL, // 36 QCheckBox
|
||||
LBL_TRIANGULATE, // 37 QCheckBox
|
||||
LBL_USE_ARCHIVE_LIBRARY_MM, // 38 QCheckBox
|
||||
LBL_USE_FREESTYLE_EDGES, // 39 QCheckBox
|
||||
LBL_VERBOSE_MM, // 40 QCheckBox
|
||||
|
||||
LBL_BEVEL_SEGMENTS, // 41/ 0 QLineEdit
|
||||
LBL_BEVEL_WEIGHT, // 42/ 1 QLineEdit
|
||||
LBL_BEVEL_WIDTH_MM, // 43/ 2 QLineEdit
|
||||
LBL_CAMERA_BORDER_PERCENT_MM, // 44/ 3 QLineEdit
|
||||
LBL_FRAMES_PER_STEP, // 45/ 4 QLineEdit
|
||||
LBL_GAP_SCALE, // 46/ 5 QLineEdit
|
||||
LBL_IMPORT_SCALE, // 47/ 6 QLineEdit
|
||||
LBL_MERGE_DISTANCE, // 48/ 7 QLineEdit
|
||||
LBL_RENDER_PERCENTAGE_MM, // 49/ 8 QLineEdit
|
||||
LBL_RESOLUTION_WIDTH, // 50/ 9 QLineEdit
|
||||
LBL_RESOLUTION_HEIGHT, // 51/10 QLineEdit
|
||||
LBL_STARTING_STEP_FRAME, // 52/11 QLineEdit
|
||||
|
||||
LBL_CHOSEN_LOGO, // 53/ 0 QComboBox
|
||||
LBL_COLOUR_SCHEME_MM, // 54/ 1 QComboBox
|
||||
LBL_GAP_SCALE_STRATEGY, // 55/ 2 QComboBox
|
||||
LBL_GAP_TARGET, // 56/ 3 QComboBox
|
||||
LBL_RESOLUTION_MM, // 57/ 4 QComboBox
|
||||
LBL_SMOOTH_TYPE, // 58/ 5 QComboBox
|
||||
|
||||
NUM_SETTINGS_MM
|
||||
};
|
||||
|
||||
enum BlenderControlTypeMM
|
||||
{
|
||||
CTL_BLENDER_PATH_EDIT_MM, // 0
|
||||
CTL_ADD_ENVIRONMENT_BOX_MM = CTL_BLENDER_PATH_EDIT_MM, // 0
|
||||
CTL_BEVEL_SEGMENTS_EDIT = CTL_BLENDER_PATH_EDIT_MM, // 0
|
||||
CTL_CHOSEN_LOGO_COMBO = CTL_BLENDER_PATH_EDIT_MM, // 0
|
||||
CTL_BEVEL_EDGES_BOX_MM, // 1
|
||||
CTL_BEVEL_WEIGHT_EDIT = CTL_BEVEL_EDGES_BOX_MM, // 1
|
||||
CTL_COLOUR_SCHEME_COMBO_MM = CTL_BEVEL_EDGES_BOX_MM, // 1
|
||||
CTL_BLEND_FILE_TRUSTED_BOX_MM, // 2
|
||||
CTL_BEVEL_WIDTH_EDIT_MM = CTL_BLEND_FILE_TRUSTED_BOX_MM,// 2
|
||||
CTL_GAP_SCALE_STRATEGY_COMBO = CTL_BLEND_FILE_TRUSTED_BOX_MM,// 2
|
||||
CTL_CROP_IMAGE_BOX_MM, // 3
|
||||
CTL_CAMERA_BORDER_PERCENT_EDIT_MM = CTL_CROP_IMAGE_BOX_MM, // 3
|
||||
CTL_GAP_TARGET_COMBO = CTL_CROP_IMAGE_BOX_MM, // 3
|
||||
CTL_DISPLAY_LOGO_BOX, // 4
|
||||
CTL_FRAMES_PER_STEP_EDIT = CTL_DISPLAY_LOGO_BOX, // 4
|
||||
CTL_RESOLUTION_COMBO_MM = CTL_DISPLAY_LOGO_BOX, // 4
|
||||
CTL_IMPORT_CAMERAS_BOX_MM, // 5
|
||||
CTL_GAP_SCALE_EDIT = CTL_IMPORT_CAMERAS_BOX_MM, // 5
|
||||
CTL_SMOOTH_TYPE_COMBO = CTL_IMPORT_CAMERAS_BOX_MM, // 5
|
||||
CTL_IMPORT_EDGES_BOX, // 6
|
||||
CTL_IMPORT_SCALE_EDIT = CTL_IMPORT_EDGES_BOX, // 6
|
||||
CTL_IMPORT_LIGHTS_BOX_MM, // 7
|
||||
CTL_MERGE_DISTANCE_EDIT = CTL_IMPORT_LIGHTS_BOX_MM, // 7
|
||||
CTL_KEEP_ASPECT_RATIO_BOX_MM, // 8
|
||||
CTL_RENDER_PERCENTAGE_EDIT_MM = CTL_KEEP_ASPECT_RATIO_BOX_MM, // 8
|
||||
CTL_MAKE_GAPS_BOX, // 9
|
||||
CTL_RESOLUTION_WIDTH_EDIT = CTL_MAKE_GAPS_BOX, // 9
|
||||
CTL_META_BFC_BOX, // 10
|
||||
CTL_RESOLUTION_HEIGHT_EDIT = CTL_META_BFC_BOX, // 10
|
||||
CTL_META_CLEAR_BOX, // 11
|
||||
CTL_STARTING_STEP_FRAME_EDIT = CTL_META_CLEAR_BOX, // 11
|
||||
CTL_META_GROUP_BOX, // 12
|
||||
CTL_META_PAUSE_BOX, // 13
|
||||
CTL_META_PRINT_WRITE_BOX, // 14
|
||||
CTL_META_SAVE_BOX, // 15
|
||||
CTL_META_STEP_BOX, // 16
|
||||
CTL_META_STEP_GROUPS_BOX, // 17
|
||||
CTL_META_TEXMAP_BOX, // 18
|
||||
CTL_NO_STUDS_BOX, // 19
|
||||
CTL_POSITION_CAMERA_BOX_MM, // 10
|
||||
CTL_OVERWRITE_IMAGE_BOX_MM, // 21
|
||||
CTL_PARENT_TO_EMPTY_BOX, // 22
|
||||
CTL_PREFER_STUDIO_BOX, // 23
|
||||
CTL_PREFER_UNOFFICIAL_BOX, // 24
|
||||
CTL_PRESERVE_HIERARCHY_BOX, // 25
|
||||
CTL_PROFILE_BOX, // 26
|
||||
CTL_RECALCULATE_NORMALS_BOX, // 27
|
||||
CTL_REMOVE_DOUBLES_BOX_MM, // 28
|
||||
CTL_RENDER_WINDOW_BOX_MM, // 29
|
||||
CTL_SEARCH_ADDL_PATHS_MM_BOX, // 20
|
||||
CTL_SETEND_FRAME_BOX, // 31
|
||||
CTL_SET_TIMELINE_MARKERS_BOX, // 32
|
||||
CTL_SHADE_SMOOTH_BOX, // 33
|
||||
CTL_TRANSPARENT_BACKGROUND_BOX_MM, // 34
|
||||
CTL_TREAT_MODELS_WITH_SUBPARTS_AS_PARTS_BOX, // 35
|
||||
CTL_TREAT_SHORTCUT_AS_MODEL_BOX, // 36
|
||||
CTL_TRIANGULATE_BOX, // 37
|
||||
CTL_USE_ARCHIVE_LIBRARY_BOX_MM, // 38
|
||||
CTL_USE_FREESTYLE_EDGES_BOX, // 39
|
||||
CTL_VERBOSE_BOX_MM // 40
|
||||
};
|
||||
|
||||
enum BlenderBrickType
|
||||
{
|
||||
PARAMS_CUSTOM_COLOURS,
|
||||
PARAMS_SLOPED_BRICKS,
|
||||
PARAMS_LIGHTED_BRICKS
|
||||
};
|
||||
|
||||
enum MessageBoxButtonsType
|
||||
{
|
||||
MBB_OK,
|
||||
MBB_YES,
|
||||
MBB_YES_NO
|
||||
};
|
||||
|
||||
struct BlenderSettings
|
||||
{
|
||||
QString key;
|
||||
QString value;
|
||||
QString label;
|
||||
QString tooltip;
|
||||
};
|
||||
|
||||
struct BlenderPaths
|
||||
{
|
||||
QString key;
|
||||
QString key_mm;
|
||||
QString value;
|
||||
QString label;
|
||||
QString tooltip;
|
||||
};
|
||||
|
||||
struct ComboItems
|
||||
{
|
||||
QString dataList;
|
||||
QString itemList;
|
||||
};
|
||||
|
||||
static BlenderPaths mBlenderPaths[];
|
||||
static BlenderPaths mDefaultPaths[];
|
||||
static BlenderSettings mBlenderSettings[];
|
||||
static BlenderSettings mBlenderSettingsMM[];
|
||||
static BlenderSettings mDefaultSettings[];
|
||||
static BlenderSettings mDefaultSettingsMM[];
|
||||
static ComboItems mComboItems[];
|
||||
static ComboItems mComboItemsMM[];
|
||||
|
||||
QList<QLineEdit*> mPathLineEditList;
|
||||
QList<QPushButton*> mPathBrowseButtonList;
|
||||
QList<QLabel*> mSettingLabelList;
|
||||
QList<QCheckBox*> mCheckBoxList;
|
||||
QList<QLineEdit*> mLineEditList;
|
||||
QList<QComboBox*> mComboBoxList;
|
||||
|
||||
QWidget* mContent = nullptr;
|
||||
|
||||
QFormLayout* mForm = nullptr;
|
||||
QGridLayout* mExeGridLayout = nullptr;
|
||||
QGridLayout* mAddonGridLayout = nullptr;
|
||||
QGridLayout* mPathsGridLayout = nullptr;
|
||||
QFormLayout* mSettingsSubform = nullptr;
|
||||
|
||||
QLineEdit* mBlenderVersionEdit = nullptr;
|
||||
QLabel* mBlenderVersionLabel = nullptr;
|
||||
QLineEdit* mAddonVersionEdit = nullptr;
|
||||
QLabel* mAddonVersionLabel = nullptr;
|
||||
QGroupBox* mModulesBox = nullptr;
|
||||
QCheckBox* mImportActBox = nullptr;
|
||||
QCheckBox* mImportMMActBox = nullptr;
|
||||
QCheckBox* mRenderActBox = nullptr;
|
||||
QGroupBox* mSettingsBox = nullptr;
|
||||
QGroupBox* mPathsBox = nullptr;
|
||||
|
||||
QAction* mDefaultColourEditAction = nullptr;
|
||||
QPushButton* mAddonUpdateButton = nullptr;
|
||||
QPushButton* mAddonStdOutButton = nullptr;
|
||||
QPushButton* mPathsGroupButton = nullptr;
|
||||
|
||||
QProgressBar* mProgressBar = nullptr;
|
||||
QProcess* mProcess = nullptr;
|
||||
|
||||
lcHttpReply *mHttpReply = nullptr;
|
||||
QByteArray mData;
|
||||
|
||||
QTimer mUpdateTimer;
|
||||
|
||||
QStringList mStdOutList;
|
||||
QString mDataDir;
|
||||
QString mBlenderVersion;
|
||||
QString mAddonVersion;
|
||||
bool mConfigured;
|
||||
bool mDialogCancelled;
|
||||
bool mBlenderVersionFound;
|
||||
};
|
||||
|
||||
extern class lcBlenderPreferences* gAddonPreferences;
|
||||
@@ -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", "&Blender 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"),
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -326,7 +326,7 @@ protected:
|
||||
void ShowUpdatesDialog();
|
||||
void ShowAboutDialog();
|
||||
void ShowHTMLDialog();
|
||||
void ShowRenderDialog();
|
||||
void ShowRenderDialog(int Command);
|
||||
void ShowInstructionsDialog();
|
||||
void ShowPrintDialog();
|
||||
void CreatePreviewWidget();
|
||||
|
||||
@@ -263,7 +263,7 @@ void lcModel::UpdatePieceInfo(std::vector<lcModel*>& UpdatedModels)
|
||||
mPieceInfo->SetBoundingBox(Min, Max);
|
||||
}
|
||||
|
||||
void lcModel::SaveLDraw(QTextStream& Stream, bool SelectedOnly) const
|
||||
void lcModel::SaveLDraw(QTextStream& Stream, bool SelectedOnly, lcStep LastStep) const
|
||||
{
|
||||
const QLatin1String LineEnding("\r\n");
|
||||
|
||||
@@ -273,12 +273,16 @@ void lcModel::SaveLDraw(QTextStream& Stream, bool SelectedOnly) const
|
||||
lcStep Step = 1;
|
||||
int CurrentLine = 0;
|
||||
int AddedSteps = 0;
|
||||
bool SavedStep = false;
|
||||
|
||||
for (lcPiece* Piece : mPieces)
|
||||
{
|
||||
if (SelectedOnly && !Piece->IsSelected())
|
||||
continue;
|
||||
|
||||
if (SavedStep = (LastStep != 0 && Piece->GetStepShow() > LastStep))
|
||||
break;
|
||||
|
||||
while (Piece->GetFileLine() > CurrentLine && CurrentLine < mFileLines.size())
|
||||
{
|
||||
QString Line = mFileLines[CurrentLine];
|
||||
@@ -391,7 +395,7 @@ void lcModel::SaveLDraw(QTextStream& Stream, bool SelectedOnly) const
|
||||
Stream << QLatin1String("0 !LEOCAD SYNTH END\r\n");
|
||||
}
|
||||
|
||||
while (CurrentLine < mFileLines.size())
|
||||
while (!SavedStep && CurrentLine < mFileLines.size())
|
||||
{
|
||||
QString Line = mFileLines[CurrentLine];
|
||||
QTextStream LineStream(&Line, QIODevice::ReadOnly);
|
||||
@@ -1103,7 +1107,7 @@ void lcModel::Copy()
|
||||
QByteArray File;
|
||||
QTextStream Stream(&File, QIODevice::WriteOnly);
|
||||
|
||||
SaveLDraw(Stream, true);
|
||||
SaveLDraw(Stream, true, 0);
|
||||
|
||||
gApplication->ExportClipboard(File);
|
||||
}
|
||||
@@ -1297,7 +1301,7 @@ QImage lcModel::GetPartsListImage(int MaxWidth, lcStep Step, quint32 BackgroundC
|
||||
if (Step == 0)
|
||||
GetPartsList(gDefaultColor, true, false, PartsList);
|
||||
else
|
||||
GetPartsListForStep(Step, gDefaultColor, PartsList);
|
||||
GetPartsListForStep(Step, gDefaultColor, PartsList, false);
|
||||
|
||||
if (PartsList.empty())
|
||||
return QImage();
|
||||
@@ -1625,7 +1629,7 @@ void lcModel::SaveCheckpoint(const QString& Description)
|
||||
ModelHistoryEntry->Description = Description;
|
||||
|
||||
QTextStream Stream(&ModelHistoryEntry->File);
|
||||
SaveLDraw(Stream, false);
|
||||
SaveLDraw(Stream, false, 0);
|
||||
|
||||
mUndoHistory.insert(mUndoHistory.begin(), ModelHistoryEntry);
|
||||
for (lcModelHistoryEntry* Entry : mRedoHistory)
|
||||
@@ -3323,11 +3327,11 @@ void lcModel::GetPartsList(int DefaultColorIndex, bool ScanSubModels, bool AddSu
|
||||
}
|
||||
}
|
||||
|
||||
void lcModel::GetPartsListForStep(lcStep Step, int DefaultColorIndex, lcPartsList& PartsList) const
|
||||
void lcModel::GetPartsListForStep(lcStep Step, int DefaultColorIndex, lcPartsList& PartsList, bool Cumulative) const
|
||||
{
|
||||
for (const lcPiece* Piece : mPieces)
|
||||
{
|
||||
if (Piece->GetStepShow() != Step || Piece->IsHidden())
|
||||
if (Cumulative ? Piece->GetStepShow() > Step : Piece->GetStepShow() != Step || Piece->IsHidden())
|
||||
continue;
|
||||
|
||||
int ColorIndex = Piece->GetColorIndex();
|
||||
|
||||
@@ -205,7 +205,7 @@ public:
|
||||
void RemoveFocusPieceFromGroup();
|
||||
void ShowEditGroupsDialog();
|
||||
|
||||
void SaveLDraw(QTextStream& Stream, bool SelectedOnly) const;
|
||||
void SaveLDraw(QTextStream& Stream, bool SelectedOnly, lcStep LastStep) const;
|
||||
void LoadLDraw(QIODevice& Device, Project* Project);
|
||||
bool LoadBinary(lcFile* File);
|
||||
bool LoadLDD(const QString& FileData);
|
||||
@@ -263,7 +263,7 @@ public:
|
||||
bool GetVisiblePiecesBoundingBox(lcVector3& Min, lcVector3& Max) const;
|
||||
std::vector<lcVector3> GetPiecesBoundingBoxPoints() const;
|
||||
void GetPartsList(int DefaultColorIndex, bool ScanSubModels, bool AddSubModels, lcPartsList& PartsList) const;
|
||||
void GetPartsListForStep(lcStep Step, int DefaultColorIndex, lcPartsList& PartsList) const;
|
||||
void GetPartsListForStep(lcStep Step, int DefaultColorIndex, lcPartsList& PartsList, bool Cumulative) const;
|
||||
void GetModelParts(const lcMatrix44& WorldMatrix, int DefaultColorIndex, std::vector<lcModelPartsEntry>& ModelParts) const;
|
||||
void GetSelectionInformation(int* Flags, lcArray<lcObject*>& Selection, lcObject** Focus) const;
|
||||
lcArray<lcObject*> GetSelectionModePieces(const lcPiece* SelectedPiece) const;
|
||||
|
||||
@@ -140,8 +140,15 @@ static lcProfileEntry gProfileEntries[LC_NUM_PROFILE_KEYS] =
|
||||
|
||||
lcProfileEntry("POVRay", "Path", "/usr/bin/povray"), // LC_PROFILE_POVRAY_PATH
|
||||
lcProfileEntry("POVRay", "LGEOPath", ""), // LC_PROFILE_POVRAY_LGEO_PATH
|
||||
lcProfileEntry("POVRay", "Width", 1280), // LC_PROFILE_POVRAY_WIDTH
|
||||
lcProfileEntry("POVRay", "Height", 720), // LC_PROFILE_POVRAY_HEIGHT
|
||||
|
||||
lcProfileEntry("Render", "Width", 1280), // LC_PROFILE_RENDER_WIDTH
|
||||
lcProfileEntry("Render", "Height", 720), // LC_PROFILE_RENDER_HEIGHT
|
||||
|
||||
lcProfileEntry("Blender", "Path", ""), // LC_PROFILE_BLENDER_PATH
|
||||
lcProfileEntry("Blender", "LDrawConfigPath", ""), // LC_PROFILE_BLENDER_LDRAW_CONFIG_PATH
|
||||
lcProfileEntry("Blender", "Version", ""), // LC_PROFILE_BLENDER_VERSION
|
||||
lcProfileEntry("Blender", "AddonVersion", ""), // LC_PROFILE_BLENDER_ADDON_VERSION
|
||||
lcProfileEntry("Blender", "ImportModule", ""), // LC_PROFILE_BLENDER_IMPORT_MODULE
|
||||
|
||||
lcProfileEntry("Settgins", "PreviewViewSphereEnabled", 0), // LC_PROFILE_PREVIEW_VIEW_SPHERE_ENABLED
|
||||
lcProfileEntry("Settings", "PreviewViewSphereSize", 75), // LC_PROFILE_PREVIEW_VIEW_SPHERE_SIZE
|
||||
|
||||
@@ -88,8 +88,13 @@ enum LC_PROFILE_KEY
|
||||
LC_PROFILE_HTML_IMAGE_HEIGHT,
|
||||
LC_PROFILE_POVRAY_PATH,
|
||||
LC_PROFILE_POVRAY_LGEO_PATH,
|
||||
LC_PROFILE_POVRAY_WIDTH,
|
||||
LC_PROFILE_POVRAY_HEIGHT,
|
||||
LC_PROFILE_RENDER_WIDTH,
|
||||
LC_PROFILE_RENDER_HEIGHT,
|
||||
LC_PROFILE_BLENDER_PATH,
|
||||
LC_PROFILE_BLENDER_LDRAW_CONFIG_PATH,
|
||||
LC_PROFILE_BLENDER_VERSION,
|
||||
LC_PROFILE_BLENDER_ADDON_VERSION,
|
||||
LC_PROFILE_BLENDER_IMPORT_MODULE,
|
||||
|
||||
LC_PROFILE_PREVIEW_VIEW_SPHERE_ENABLED,
|
||||
LC_PROFILE_PREVIEW_VIEW_SPHERE_SIZE,
|
||||
|
||||
@@ -299,7 +299,7 @@ void Project::ShowModelListDialog()
|
||||
QByteArray File;
|
||||
|
||||
QTextStream SaveStream(&File);
|
||||
Source->SaveLDraw(SaveStream, false);
|
||||
Source->SaveLDraw(SaveStream, false, 0);
|
||||
SaveStream.flush();
|
||||
|
||||
QBuffer Buffer(&File);
|
||||
@@ -517,7 +517,7 @@ bool Project::Save(QTextStream& Stream)
|
||||
if (MPD)
|
||||
Stream << QLatin1String("0 FILE ") << Model->GetProperties().mFileName << QLatin1String("\r\n");
|
||||
|
||||
Model->SaveLDraw(Stream, false);
|
||||
Model->SaveLDraw(Stream, false, 0);
|
||||
Model->SetSaved();
|
||||
|
||||
if (MPD)
|
||||
@@ -652,6 +652,109 @@ std::vector<lcModelPartsEntry> Project::GetModelParts()
|
||||
return ModelParts;
|
||||
}
|
||||
|
||||
bool Project::ExportCurrentStep(const QString& FileName)
|
||||
{
|
||||
QFile File(FileName);
|
||||
|
||||
if (!File.open(QIODevice::WriteOnly))
|
||||
{
|
||||
QMessageBox::warning(gMainWindow, tr("Error"), tr("Error writing to file '%1':\n%2").arg(FileName, File.errorString()));
|
||||
return false;
|
||||
}
|
||||
|
||||
QStringList Models;
|
||||
|
||||
Models.append(lcGetActiveModel()->GetProperties().mFileName);
|
||||
|
||||
std::function<void(const QString&)> ParseStepModel = [&](const QString& ModelName)
|
||||
{
|
||||
Models.append(ModelName);
|
||||
|
||||
for (lcModel* Model : mModels)
|
||||
{
|
||||
if (Model->GetProperties().mFileName == ModelName)
|
||||
{
|
||||
lcPartsList ModelParts;
|
||||
|
||||
Model->GetPartsList(gDefaultColor, false, true, ModelParts);
|
||||
|
||||
for (const auto& PartIt : ModelParts)
|
||||
{
|
||||
const PieceInfo* PartInfo = PartIt.first;
|
||||
|
||||
if (PartInfo->IsModel())
|
||||
{
|
||||
ParseStepModel(PartInfo->mFileName);
|
||||
}
|
||||
else
|
||||
continue;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const lcStep CurrentStep = lcGetActiveModel()->GetCurrentStep();
|
||||
|
||||
bool MPD = mModels.GetSize() > 1;
|
||||
|
||||
if (MPD)
|
||||
{
|
||||
lcPartsList StepParts;
|
||||
|
||||
lcGetActiveModel()->GetPartsListForStep(CurrentStep, gDefaultColor, StepParts, true);
|
||||
|
||||
if (!StepParts.empty())
|
||||
{
|
||||
for (const auto& PartIt : StepParts)
|
||||
{
|
||||
const PieceInfo *PartInfo = PartIt.first;
|
||||
|
||||
if (PartInfo->IsModel())
|
||||
{
|
||||
ParseStepModel(PartInfo->mFileName);
|
||||
}
|
||||
else
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
QTextStream Stream(&File);
|
||||
|
||||
for (lcModel* Model : mModels)
|
||||
{
|
||||
if (!Models.contains(Model->GetProperties().mFileName))
|
||||
continue;
|
||||
|
||||
const lcStep ModelStep = Model->GetCurrentStep();
|
||||
|
||||
if (!Model->IsActive())
|
||||
Model->SetTemporaryStep(CurrentStep);
|
||||
|
||||
if (MPD)
|
||||
Stream << QLatin1String("0 FILE ") << Model->GetProperties().mFileName << QLatin1String("\r\n");
|
||||
|
||||
Model->SaveLDraw(Stream, false, CurrentStep);
|
||||
|
||||
if (MPD)
|
||||
Stream << QLatin1String("0 NOFILE\r\n");
|
||||
|
||||
if (!Model->IsActive())
|
||||
{
|
||||
Model->SetTemporaryStep(ModelStep);
|
||||
Model->CalculateStep(LC_STEP_MAX);
|
||||
}
|
||||
}
|
||||
|
||||
File.close();
|
||||
|
||||
lcSetProfileString(LC_PROFILE_PROJECTS_PATH, QFileInfo(FileName).absolutePath());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Project::ExportModel(const QString& FileName, lcModel* Model) const
|
||||
{
|
||||
QFile File(FileName);
|
||||
@@ -664,7 +767,7 @@ bool Project::ExportModel(const QString& FileName, lcModel* Model) const
|
||||
|
||||
QTextStream Stream(&File);
|
||||
|
||||
Model->SaveLDraw(Stream, false);
|
||||
Model->SaveLDraw(Stream, false, 0);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -89,6 +89,7 @@ public:
|
||||
bool ImportInventory(const QByteArray& Inventory, const QString& Name, const QString& Description);
|
||||
|
||||
void SaveImage();
|
||||
bool ExportCurrentStep(const QString& FileName);
|
||||
bool ExportModel(const QString& FileName, lcModel* Model) const;
|
||||
bool Export3DStudio(const QString& FileName);
|
||||
void ExportBrickLink();
|
||||
|
||||
@@ -175,6 +175,7 @@ SOURCES += \
|
||||
common/lc_aboutdialog.cpp \
|
||||
common/lc_application.cpp \
|
||||
common/lc_arraydialog.cpp \
|
||||
common/lc_blenderpreferences.cpp \
|
||||
common/lc_bricklink.cpp \
|
||||
common/lc_category.cpp \
|
||||
common/lc_categorydialog.cpp \
|
||||
@@ -244,6 +245,7 @@ HEADERS += \
|
||||
common/lc_application.h \
|
||||
common/lc_array.h \
|
||||
common/lc_arraydialog.h \
|
||||
common/lc_blenderpreferences.h \
|
||||
common/lc_bricklink.h \
|
||||
common/lc_category.h \
|
||||
common/lc_categorydialog.h \
|
||||
|
||||
@@ -19,6 +19,9 @@
|
||||
<file>resources/file_open_16.png</file>
|
||||
<file>resources/file_print_16.png</file>
|
||||
<file>resources/file_print_preview_16.png</file>
|
||||
<file>resources/file_render_blender_16.png</file>
|
||||
<file>resources/file_render_open_in_blender_16.png</file>
|
||||
<file>resources/file_render_povray_16.png</file>
|
||||
<file>resources/file_save_16.png</file>
|
||||
<file>resources/action_camera.png</file>
|
||||
<file>resources/action_color_picker.png</file>
|
||||
@@ -77,6 +80,10 @@
|
||||
<file>resources/file_open.png</file>
|
||||
<file>resources/file_print.png</file>
|
||||
<file>resources/file_print_preview.png</file>
|
||||
<file>resources/file_render_blender.png</file>
|
||||
<file>resources/file_render_blender_logo_1280x720.png</file>
|
||||
<file>resources/file_render_open_in_blender.png</file>
|
||||
<file>resources/file_render_povray.png</file>
|
||||
<file>resources/file_save.png</file>
|
||||
<file>resources/time_first.png</file>
|
||||
<file>resources/time_last.png</file>
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#include "lc_glextensions.h"
|
||||
#include "pieceinf.h"
|
||||
#include "lc_edgecolordialog.h"
|
||||
#include "lc_blenderpreferences.h"
|
||||
|
||||
static const char* gLanguageLocales[] =
|
||||
{
|
||||
@@ -365,6 +366,23 @@ void lcQPreferencesDialog::on_partsArchiveBrowse_clicked()
|
||||
ui->partsLibrary->setText(QDir::toNativeSeparators(result));
|
||||
}
|
||||
|
||||
void lcQPreferencesDialog::on_BlenderAddonSettingsButton_clicked()
|
||||
{
|
||||
int Width = 1280;
|
||||
int Height = 720;
|
||||
double Scale = 1.0f;
|
||||
|
||||
lcBlenderPreferencesDialog::GetBlenderPreferences(
|
||||
Width,
|
||||
Height,
|
||||
Scale,
|
||||
this);
|
||||
|
||||
Q_UNUSED(Width)
|
||||
Q_UNUSED(Height)
|
||||
Q_UNUSED(Scale)
|
||||
}
|
||||
|
||||
void lcQPreferencesDialog::on_ColorConfigBrowseButton_clicked()
|
||||
{
|
||||
QString Result = QFileDialog::getOpenFileName(this, tr("Select Color Configuration File"), ui->ColorConfigEdit->text(), tr("Settings Files (*.ldr);;All Files (*.*)"));
|
||||
|
||||
@@ -67,6 +67,7 @@ public slots:
|
||||
void ColorButtonClicked();
|
||||
void AutomateEdgeColor();
|
||||
void on_AutomateEdgeColor_toggled();
|
||||
void on_BlenderAddonSettingsButton_clicked();
|
||||
void on_studStyleCombo_currentIndexChanged(int index);
|
||||
void on_antiAliasing_toggled();
|
||||
void on_edgeLines_toggled();
|
||||
|
||||
@@ -333,10 +333,17 @@
|
||||
<item>
|
||||
<widget class="QWidget" name="widget" native="true">
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="13" column="2">
|
||||
<widget class="QToolButton" name="HighContrastButton">
|
||||
<item row="12" column="0">
|
||||
<widget class="QCheckBox" name="MeshLOD">
|
||||
<property name="text">
|
||||
<string>Contrast Settings...</string>
|
||||
<string>Mesh LOD</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="10" column="1">
|
||||
<widget class="QToolButton" name="FadeStepsColor">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -359,6 +366,64 @@
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="10" column="0">
|
||||
<widget class="QCheckBox" name="FadeSteps">
|
||||
<property name="text">
|
||||
<string>Fade Previous Steps</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="12" column="1">
|
||||
<widget class="QSlider" name="MeshLODSlider">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="tickPosition">
|
||||
<enum>QSlider::NoTicks</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="12" column="2">
|
||||
<widget class="QLabel" name="MeshLODLabel">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QCheckBox" name="antiAliasing">
|
||||
<property name="text">
|
||||
<string>Anti-aliasing</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="13" column="0">
|
||||
<widget class="QLabel" name="label_24">
|
||||
<property name="text">
|
||||
<string>Stud Style</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="11" column="0">
|
||||
<widget class="QCheckBox" name="HighlightNewParts">
|
||||
<property name="text">
|
||||
<string>Highlight New Parts</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="14" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Shading Mode:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="13" column="1">
|
||||
<widget class="QComboBox" name="studStyleCombo">
|
||||
<item>
|
||||
@@ -403,10 +468,10 @@
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="14" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<item row="13" column="2">
|
||||
<widget class="QToolButton" name="HighContrastButton">
|
||||
<property name="text">
|
||||
<string>Shading Mode:</string>
|
||||
<string>Contrast Settings...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -423,20 +488,6 @@
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="13" column="0">
|
||||
<widget class="QLabel" name="label_24">
|
||||
<property name="text">
|
||||
<string>Stud Style</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QCheckBox" name="antiAliasing">
|
||||
<property name="text">
|
||||
<string>Anti-aliasing</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QComboBox" name="antiAliasingSamples">
|
||||
<item>
|
||||
@@ -463,54 +514,17 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="11" column="0">
|
||||
<widget class="QCheckBox" name="HighlightNewParts">
|
||||
<item row="15" column="0">
|
||||
<widget class="QLabel" name="label_39">
|
||||
<property name="text">
|
||||
<string>Highlight New Parts</string>
|
||||
<string>Blender LDraw Render:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="12" column="0">
|
||||
<widget class="QCheckBox" name="MeshLOD">
|
||||
<item row="15" column="1">
|
||||
<widget class="QToolButton" name="BlenderAddonSettingsButton">
|
||||
<property name="text">
|
||||
<string>Mesh LOD</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="12" column="1">
|
||||
<widget class="QSlider" name="MeshLODSlider">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="tickPosition">
|
||||
<enum>QSlider::NoTicks</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="10" column="1">
|
||||
<widget class="QToolButton" name="FadeStepsColor">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="10" column="0">
|
||||
<widget class="QCheckBox" name="FadeSteps">
|
||||
<property name="text">
|
||||
<string>Fade Previous Steps</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="12" column="2">
|
||||
<widget class="QLabel" name="MeshLODLabel">
|
||||
<property name="text">
|
||||
<string/>
|
||||
<string>Addon Settings...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -2007,6 +2021,7 @@
|
||||
<tabstop>studStyleCombo</tabstop>
|
||||
<tabstop>HighContrastButton</tabstop>
|
||||
<tabstop>ShadingMode</tabstop>
|
||||
<tabstop>BlenderAddonSettingsButton</tabstop>
|
||||
<tabstop>edgeLines</tabstop>
|
||||
<tabstop>ConditionalLinesCheckBox</tabstop>
|
||||
<tabstop>AutomateEdgeColor</tabstop>
|
||||
|
||||
@@ -6,6 +6,18 @@ namespace Ui {
|
||||
class lcRenderDialog;
|
||||
}
|
||||
|
||||
class lcRenderProcess : public QProcess
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit lcRenderProcess(QObject* parent = nullptr)
|
||||
: QProcess(parent)
|
||||
{
|
||||
}
|
||||
~lcRenderProcess();
|
||||
};
|
||||
|
||||
class lcRenderPreviewWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
@@ -36,34 +48,61 @@ class lcRenderDialog : public QDialog
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit lcRenderDialog(QWidget* Parent);
|
||||
explicit lcRenderDialog(QWidget* Parent, int Command);
|
||||
~lcRenderDialog();
|
||||
|
||||
public slots:
|
||||
void reject() override;
|
||||
void on_RenderButton_clicked();
|
||||
void on_OutputBrowseButton_clicked();
|
||||
void on_RenderSettingsButton_clicked();
|
||||
void on_RenderOutputButton_clicked();
|
||||
void Update();
|
||||
|
||||
protected slots:
|
||||
void ReadStdErr();
|
||||
void WriteStdLog(bool = false);
|
||||
void ReadStdOut();
|
||||
void WriteStdOut();
|
||||
void UpdateElapsedTime() const;
|
||||
|
||||
protected:
|
||||
QString GetOutputFileName() const;
|
||||
QString GetStdOutFileName() const;
|
||||
QString GetStdErrFileName() const;
|
||||
QString GetPOVFileName() const;
|
||||
QString ReadStdErr(bool& Error) const;
|
||||
void CloseProcess();
|
||||
bool PromptCancel();
|
||||
void ShowResult();
|
||||
|
||||
#ifndef QT_NO_PROCESS
|
||||
QProcess* mProcess;
|
||||
#ifdef Q_OS_WIN
|
||||
int TerminateChildProcess(const qint64 Pid, const qint64 Ppid);
|
||||
#endif
|
||||
#ifndef QT_NO_PROCESS
|
||||
lcRenderProcess* mProcess;
|
||||
#endif
|
||||
enum CommandType
|
||||
{
|
||||
POVRAY_RENDER,
|
||||
BLENDER_RENDER,
|
||||
OPEN_IN_BLENDER
|
||||
};
|
||||
|
||||
QTimer mUpdateTimer;
|
||||
QElapsedTimer mRenderTime;
|
||||
QFile mOutputFile;
|
||||
void* mOutputBuffer;
|
||||
QImage mImage;
|
||||
QStringList mStdErrList;
|
||||
QStringList mStdOutList;
|
||||
|
||||
int mWidth;
|
||||
int mHeight;
|
||||
int mPreviewWidth;
|
||||
int mPreviewHeight;
|
||||
int mCommand;
|
||||
int mBlendProgValue;
|
||||
int mBlendProgMax;
|
||||
double mScale;
|
||||
QString mImportModule;
|
||||
QString mDataPath;
|
||||
|
||||
Ui::lcRenderDialog* ui;
|
||||
};
|
||||
|
||||
@@ -48,6 +48,16 @@
|
||||
<item>
|
||||
<widget class="QLineEdit" name="HeightEdit"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="RenderSettingsButton">
|
||||
<property name="toolTip">
|
||||
<string>Blender addon settings</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Settings...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="qualityLabel">
|
||||
<property name="text">
|
||||
@@ -110,6 +120,13 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="renderLabel">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="RenderButton">
|
||||
<property name="text">
|
||||
@@ -117,6 +134,16 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="RenderOutputButton">
|
||||
<property name="toolTip">
|
||||
<string>Open the standard output log</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Output...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
@@ -135,9 +162,13 @@
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<tabstops>
|
||||
<tabstop>WidthEdit</tabstop>
|
||||
<tabstop>HeightEdit</tabstop>
|
||||
<tabstop>RenderSettingsButton</tabstop>
|
||||
<tabstop>QualityComboBox</tabstop>
|
||||
<tabstop>OutputEdit</tabstop>
|
||||
<tabstop>OutputBrowseButton</tabstop>
|
||||
<tabstop>RenderButton</tabstop>
|
||||
</tabstops>
|
||||
<resources/>
|
||||
<connections/>
|
||||
|
||||
|
After Width: | Height: | Size: 1.8 KiB |
|
After Width: | Height: | Size: 1.3 KiB |
|
After Width: | Height: | Size: 81 KiB |
|
After Width: | Height: | Size: 2.0 KiB |
|
After Width: | Height: | Size: 1.2 KiB |
|
After Width: | Height: | Size: 2.0 KiB |
|
After Width: | Height: | Size: 932 B |