Continues the work of the material subsystem improvements. This merge covers the continued development of the material editor. The primary improvements are in the handling of 2D and 3D array properties. These properties are now fully editable, and can be saved and restored. The cards now separate the author and license. These were previously saved as a single item. Future support will be provided for standard open source licenses. Saving operations validate the cards to ensure UUIDs of materials are considered. Warnings are given when a save could potentially impact the models, such as saving over a material instead of creating a new instance. The editor is still not complete. There are a number of functional elements, such as drag/drop operations, folder creation, and deletion operations that need to be added to the main tree. State needs to be saved and restored to improve the user experience. The appearance preview also needs significant work. This will be handled in a future PR.
75 lines
2.7 KiB
C++
75 lines
2.7 KiB
C++
/***************************************************************************
|
|
* Copyright (c) 2023 David Carter <dcarter@david.carter.ca> *
|
|
* *
|
|
* This file is part of FreeCAD. *
|
|
* *
|
|
* FreeCAD is free software: you can redistribute it and/or modify it *
|
|
* under the terms of the GNU Lesser General Public License as *
|
|
* published by the Free Software Foundation, either version 2.1 of the *
|
|
* License, or (at your option) any later version. *
|
|
* *
|
|
* FreeCAD is distributed in the hope that it will be useful, but *
|
|
* WITHOUT ANY WARRANTY; without even the implied warranty of *
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
|
|
* Lesser General Public License for more details. *
|
|
* *
|
|
* You should have received a copy of the GNU Lesser General Public *
|
|
* License along with FreeCAD. If not, see *
|
|
* <https://www.gnu.org/licenses/>. *
|
|
* *
|
|
**************************************************************************/
|
|
|
|
|
|
#include "PreCompiled.h"
|
|
|
|
#include <Gui/MenuManager.h>
|
|
#include <Gui/ToolBarManager.h>
|
|
|
|
#include "Workbench.h"
|
|
|
|
using namespace MatGui;
|
|
|
|
|
|
#if 0 // needed for Qt's lupdate utility
|
|
qApp->translate("Workbench", "&Materials");
|
|
qApp->translate("Workbench", "Materials");
|
|
#endif
|
|
|
|
/// @namespace MatGui @class Workbench
|
|
TYPESYSTEM_SOURCE(MatGui::Workbench, Gui::StdWorkbench)
|
|
|
|
Workbench::Workbench() = default;
|
|
|
|
Workbench::~Workbench() = default;
|
|
|
|
Gui::MenuItem* Workbench::setupMenuBar() const
|
|
{
|
|
Gui::MenuItem* root = StdWorkbench::setupMenuBar();
|
|
Gui::MenuItem* item = root->findItem("&Windows");
|
|
|
|
Gui::MenuItem* part = new Gui::MenuItem;
|
|
root->insertItem(item, part);
|
|
part->setCommand("&Materials");
|
|
*part << "Materials_Edit";
|
|
|
|
return root;
|
|
}
|
|
|
|
Gui::ToolBarItem* Workbench::setupToolBars() const
|
|
{
|
|
Gui::ToolBarItem* root = StdWorkbench::setupToolBars();
|
|
|
|
Gui::ToolBarItem* solids = new Gui::ToolBarItem(root);
|
|
solids->setCommand("Materials");
|
|
*solids << "Materials_Edit";
|
|
|
|
return root;
|
|
}
|
|
|
|
Gui::ToolBarItem* Workbench::setupCommandBars() const
|
|
{
|
|
// Part tools
|
|
Gui::ToolBarItem* root = new Gui::ToolBarItem;
|
|
return root;
|
|
}
|