mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-19 04:37:51 -06:00
CURA-4525 wip objects menu
This commit is contained in:
parent
5b368fbfd5
commit
5050124699
6 changed files with 144 additions and 6 deletions
|
@ -292,6 +292,8 @@ class CuraApplication(QtApplication):
|
||||||
preferences.addPreference("metadata/setting_version", 0)
|
preferences.addPreference("metadata/setting_version", 0)
|
||||||
preferences.setValue("metadata/setting_version", self.SettingVersion) #Don't make it equal to the default so that the setting version always gets written to the file.
|
preferences.setValue("metadata/setting_version", self.SettingVersion) #Don't make it equal to the default so that the setting version always gets written to the file.
|
||||||
|
|
||||||
|
preferences.addPreference("view/build_plate_number", 0)
|
||||||
|
|
||||||
preferences.addPreference("cura/active_mode", "simple")
|
preferences.addPreference("cura/active_mode", "simple")
|
||||||
|
|
||||||
preferences.addPreference("cura/categories_expanded", "")
|
preferences.addPreference("cura/categories_expanded", "")
|
||||||
|
@ -1462,6 +1464,8 @@ class CuraApplication(QtApplication):
|
||||||
def setActiveBuildPlate(self, nr):
|
def setActiveBuildPlate(self, nr):
|
||||||
Logger.log("d", "Select build plate: %s" % nr)
|
Logger.log("d", "Select build plate: %s" % nr)
|
||||||
self._active_build_plate = nr
|
self._active_build_plate = nr
|
||||||
|
Preferences.setValue("view/build_plate_number", self._active_build_plate)
|
||||||
|
|
||||||
self.activeBuildPlateChanged.emit()
|
self.activeBuildPlateChanged.emit()
|
||||||
|
|
||||||
@pyqtSlot()
|
@pyqtSlot()
|
||||||
|
|
|
@ -140,6 +140,10 @@ class StartSliceJob(Job):
|
||||||
temp_list = []
|
temp_list = []
|
||||||
for node in DepthFirstIterator(self._scene.getRoot()):
|
for node in DepthFirstIterator(self._scene.getRoot()):
|
||||||
if type(node) is SceneNode and node.getMeshData() and node.getMeshData().getVertices() is not None:
|
if type(node) is SceneNode and node.getMeshData() and node.getMeshData().getVertices() is not None:
|
||||||
|
|
||||||
|
# temp hack to filter on build plate 0
|
||||||
|
if (node.callDecoration("getBuildPlateNumber") == 0):
|
||||||
|
|
||||||
if not getattr(node, "_outside_buildarea", False)\
|
if not getattr(node, "_outside_buildarea", False)\
|
||||||
or (node.callDecoration("getStack") and any(node.callDecoration("getStack").getProperty(setting, "value") for setting in self._not_printed_mesh_settings)):
|
or (node.callDecoration("getStack") and any(node.callDecoration("getStack").getProperty(setting, "value") for setting in self._not_printed_mesh_settings)):
|
||||||
temp_list.append(node)
|
temp_list.append(node)
|
||||||
|
|
|
@ -71,10 +71,11 @@ class SolidView(View):
|
||||||
else:
|
else:
|
||||||
self._enabled_shader.setUniformValue("u_overhangAngle", math.cos(math.radians(0)))
|
self._enabled_shader.setUniformValue("u_overhangAngle", math.cos(math.radians(0)))
|
||||||
|
|
||||||
|
activeBuildPlateNumber = Preferences.getInstance().getValue("view/build_plate_number") or 0
|
||||||
|
|
||||||
for node in DepthFirstIterator(scene.getRoot()):
|
for node in DepthFirstIterator(scene.getRoot()):
|
||||||
if not node.render(renderer):
|
if not node.render(renderer):
|
||||||
if node.getMeshData() and node.isVisible():
|
if node.getMeshData() and node.isVisible() and (node.callDecoration("getBuildPlateNumber") == activeBuildPlateNumber):
|
||||||
uniforms = {}
|
uniforms = {}
|
||||||
shade_factor = 1.0
|
shade_factor = 1.0
|
||||||
|
|
||||||
|
|
|
@ -340,6 +340,22 @@ UM.MainWindow
|
||||||
action: Cura.Actions.open;
|
action: Cura.Actions.open;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Button
|
||||||
|
{
|
||||||
|
id: objectsButton;
|
||||||
|
text: catalog.i18nc("@action:button","Objects");
|
||||||
|
iconSource: UM.Theme.getIcon("load")
|
||||||
|
style: UM.Theme.styles.tool_button
|
||||||
|
tooltip: '';
|
||||||
|
anchors
|
||||||
|
{
|
||||||
|
top: openFileButton.bottom;
|
||||||
|
topMargin: UM.Theme.getSize("default_margin").height;
|
||||||
|
left: parent.left;
|
||||||
|
}
|
||||||
|
action: triggerObjectsList;
|
||||||
|
}
|
||||||
|
|
||||||
Toolbar
|
Toolbar
|
||||||
{
|
{
|
||||||
id: toolbar;
|
id: toolbar;
|
||||||
|
@ -348,7 +364,7 @@ UM.MainWindow
|
||||||
property int mouseY: base.mouseY
|
property int mouseY: base.mouseY
|
||||||
|
|
||||||
anchors {
|
anchors {
|
||||||
top: openFileButton.bottom;
|
top: objectsButton.bottom;
|
||||||
topMargin: UM.Theme.getSize("window_margin").height;
|
topMargin: UM.Theme.getSize("window_margin").height;
|
||||||
left: parent.left;
|
left: parent.left;
|
||||||
}
|
}
|
||||||
|
@ -380,6 +396,29 @@ UM.MainWindow
|
||||||
monitoringPrint: base.showPrintMonitor
|
monitoringPrint: base.showPrintMonitor
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Action
|
||||||
|
{
|
||||||
|
id: triggerObjectsList;
|
||||||
|
text: catalog.i18nc("@action:inmenu menubar:file","&Open File(s)...");
|
||||||
|
iconName: "document-open";
|
||||||
|
shortcut: StandardKey.Open;
|
||||||
|
onTriggered: objectsList.visible = !objectsList.visible;
|
||||||
|
}
|
||||||
|
|
||||||
|
ObjectsList
|
||||||
|
{
|
||||||
|
id: objectsList;
|
||||||
|
visible: false;
|
||||||
|
anchors
|
||||||
|
{
|
||||||
|
top: objectsButton.top;
|
||||||
|
left: objectsButton.right;
|
||||||
|
leftMargin: UM.Theme.getSize("default_margin").width;
|
||||||
|
rightMargin: UM.Theme.getSize("default_margin").width;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
Rectangle
|
Rectangle
|
||||||
{
|
{
|
||||||
id: viewportOverlay
|
id: viewportOverlay
|
||||||
|
|
88
resources/qml/ObjectsList.qml
Normal file
88
resources/qml/ObjectsList.qml
Normal file
|
@ -0,0 +1,88 @@
|
||||||
|
// Copyright (c) 2017 Ultimaker B.V.
|
||||||
|
// Cura is released under the terms of the LGPLv3 or higher.
|
||||||
|
|
||||||
|
import QtQuick 2.2
|
||||||
|
import QtQuick.Controls 1.1
|
||||||
|
import QtQuick.Controls.Styles 1.1
|
||||||
|
import QtQuick.Layouts 1.1
|
||||||
|
import QtQuick.Dialogs 1.1
|
||||||
|
|
||||||
|
import UM 1.3 as UM
|
||||||
|
import Cura 1.0 as Cura
|
||||||
|
|
||||||
|
import "Menus"
|
||||||
|
|
||||||
|
Rectangle
|
||||||
|
{
|
||||||
|
id: base;
|
||||||
|
|
||||||
|
color: UM.Theme.getColor("tool_panel_background")
|
||||||
|
|
||||||
|
width: UM.Theme.getSize("objects_menu_size").width
|
||||||
|
height: UM.Theme.getSize("objects_menu_size").height
|
||||||
|
|
||||||
|
Button
|
||||||
|
{
|
||||||
|
id: openFileButton;
|
||||||
|
text: catalog.i18nc("@action:button","Open File");
|
||||||
|
iconSource: UM.Theme.getIcon("load")
|
||||||
|
style: UM.Theme.styles.tool_button
|
||||||
|
tooltip: '';
|
||||||
|
anchors
|
||||||
|
{
|
||||||
|
top: parent.top;
|
||||||
|
topMargin: UM.Theme.getSize("default_margin").height;
|
||||||
|
left: parent.left;
|
||||||
|
leftMargin: UM.Theme.getSize("default_margin").height;
|
||||||
|
}
|
||||||
|
action: Cura.Actions.open;
|
||||||
|
}
|
||||||
|
|
||||||
|
ListModel
|
||||||
|
{
|
||||||
|
id: objectsListModel;
|
||||||
|
|
||||||
|
ListElement {
|
||||||
|
name: "Apple"
|
||||||
|
cost: 2.45
|
||||||
|
}
|
||||||
|
ListElement {
|
||||||
|
name: "Orange"
|
||||||
|
cost: 3.25
|
||||||
|
}
|
||||||
|
ListElement {
|
||||||
|
name: "Banana"
|
||||||
|
cost: 1.95
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Component {
|
||||||
|
id: objectDelegate
|
||||||
|
Rectangle {
|
||||||
|
height: 30
|
||||||
|
|
||||||
|
Text {
|
||||||
|
text: name
|
||||||
|
color: red
|
||||||
|
}
|
||||||
|
//Text { text: '$' + cost }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ListView
|
||||||
|
{
|
||||||
|
model: objectsListModel;
|
||||||
|
anchors
|
||||||
|
{
|
||||||
|
top: openFileButton.bottom;
|
||||||
|
topMargin: UM.Theme.getSize("default_margin").height;
|
||||||
|
left: parent.left;
|
||||||
|
leftMargin: UM.Theme.getSize("default_margin").height;
|
||||||
|
}
|
||||||
|
width: parent.width - 2 * UM.Theme.getSize("default_margin").height
|
||||||
|
height: 100
|
||||||
|
|
||||||
|
delegate: objectDelegate
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -374,6 +374,8 @@
|
||||||
|
|
||||||
"infill_button_margin": [0.5, 0.5],
|
"infill_button_margin": [0.5, 0.5],
|
||||||
|
|
||||||
"jobspecs_line": [2.0, 2.0]
|
"jobspecs_line": [2.0, 2.0],
|
||||||
|
|
||||||
|
"objects_menu_size": [20, 30]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue