This commit is contained in:
Tim Kuipers 2015-09-03 18:34:48 +02:00
commit 2ecdac441f
12 changed files with 338 additions and 103 deletions

View file

@ -29,16 +29,24 @@ class ConvexHullNode(SceneNode):
self._node.parentChanged.connect(self._onNodeParentChanged)
self._node.decoratorsChanged.connect(self._onNodeDecoratorsChanged)
self._onNodeDecoratorsChanged(self._node)
self.convexHullHeadMesh = None
self._hull = hull
hull_points = self._hull.getPoints()
hull_mesh = self.createHullMesh(self._hull.getPoints())
if hull_mesh:
self.setMeshData(hull_mesh)
convex_hull_head = self._node.callDecoration("getConvexHullHead")
if convex_hull_head:
self.convexHullHeadMesh = self.createHullMesh(convex_hull_head.getPoints())
def createHullMesh(self, hull_points):
mesh = MeshData()
if len(hull_points) > 3:
center = (hull_points.min(0) + hull_points.max(0)) / 2.0
mesh.addVertex(center[0], 0.1, center[1])
else: #Hull has not enough points
return
else:
return None
for point in hull_points:
mesh.addVertex(point[0], 0.1, point[1])
indices = []
@ -48,8 +56,7 @@ class ConvexHullNode(SceneNode):
indices.append([0, mesh.getVertexCount() - 1, 1])
mesh.addIndices(numpy.array(indices, numpy.int32))
self.setMeshData(mesh)
return mesh
def getWatchedNode(self):
return self._node
@ -61,6 +68,8 @@ class ConvexHullNode(SceneNode):
if self.getParent():
self._material.setUniformValue("u_color", self._color)
renderer.queueNode(self, material = self._material, transparent = True)
if self.convexHullHeadMesh:
renderer.queueNode(self, material = self._material,transparent = True, mesh = self.convexHullHeadMesh)
return True

View file

@ -2,6 +2,7 @@
# Cura is released under the terms of the AGPLv3 or higher.
from UM.Scene.Iterator import Iterator
from UM.Scene.SceneNode import SceneNode
from functools import cmp_to_key
from UM.Application import Application
@ -10,13 +11,16 @@ from UM.Application import Application
# Take note that the list of nodes can have children (that may or may not contain mesh data)
class OneAtATimeIterator(Iterator.Iterator):
def __init__(self, scene_node):
super(OneAtATimeIterator, self).__init__(scene_node) # Call super to make multiple inheritence work.
super().__init__(scene_node) # Call super to make multiple inheritence work.
self._hit_map = [[]]
self._original_node_list = []
def _fillStack(self):
node_list = []
for node in self._scene_node.getChildren():
if not type(node) is SceneNode:
continue
if node.getBoundingBox().height > Application.getInstance().getMachineManager().getActiveProfile().getSettingValue("gantry_height"):
return
if node.callDecoration("getConvexHull"):

View file

@ -111,7 +111,11 @@ class PlatformPhysics:
# Get the overlap distance for both convex hulls. If this returns None, there is no intersection.
try:
overlap = node.callDecoration("getConvexHull").intersectsPolygon(other_node.callDecoration("getConvexHull"))
head_hull = node.callDecoration("getConvexHullHead")
if head_hull:
overlap = head_hull.intersectsPolygon(other_node.callDecoration("getConvexHull"))
else:
overlap = node.callDecoration("getConvexHull").intersectsPolygon(other_node.callDecoration("getConvexHull"))
except:
overlap = None #It can sometimes occur that the caclulated convex hull has no size, in which case there is no overlap.

View file

@ -33,6 +33,7 @@ Item
property alias addMachine: addMachineAction;
property alias configureMachines: settingsAction;
property alias manageProfiles: manageProfilesAction;
property alias preferences: preferencesAction;
@ -101,6 +102,13 @@ Item
iconName: "configure";
}
Action
{
id: manageProfilesAction;
//: manage profiles action
text: catalog.i18nc("@action","Manage Profiles");
}
Action
{
id: documentationAction;

View file

@ -301,9 +301,9 @@ UM.MainWindow
anchors
{
top: parent.top;
topMargin: UM.Theme.sizes.loadfile_margin.height
//topMargin: UM.Theme.sizes.loadfile_margin.height
left: parent.left;
leftMargin: UM.Theme.sizes.loadfile_margin.width
//leftMargin: UM.Theme.sizes.loadfile_margin.width
}
action: actions.open;
}
@ -393,6 +393,7 @@ UM.MainWindow
addMachineAction: actions.addMachine;
configureMachinesAction: actions.configureMachines;
manageProfilesAction: actions.manageProfiles;
}
Rectangle
@ -503,6 +504,7 @@ UM.MainWindow
preferences.onTriggered: preferences.visible = true;
configureMachines.onTriggered: { preferences.visible = true; preferences.setPage(2); }
manageProfiles.onTriggered: { preferences.visible = true; preferences.setPage(4); }
documentation.onTriggered: CuraActions.openDocumentation();
reportBug.onTriggered: CuraActions.openBugReportPage();

View file

@ -12,6 +12,7 @@ Column{
id: base;
UM.I18nCatalog { id: catalog; name:"cura"}
property int totalHeightProfileSetup: childrenRect.height
property Action manageProfilesAction
spacing: 0
Rectangle{
@ -87,17 +88,17 @@ Column{
ToolButton {
id: globalProfileSelection
text: UM.MachineManager.activeProfile
width: parent.width/100*45
width: parent.width/100*55
height: UM.Theme.sizes.setting_control.height
anchors.right: parent.right
anchors.rightMargin: (UM.Theme.sizes.default_margin.width * 2) + saveProfileButton.width
anchors.rightMargin: UM.Theme.sizes.default_margin.width
anchors.verticalCenter: parent.verticalCenter
tooltip: UM.MachineManager.activeProfile
style: UM.Theme.styles.sidebar_header_button
menu: Menu
{
id: machineSelectionMenu
id: profileSelectionMenu
Instantiator
{
model: UM.ProfilesModel { }
@ -109,36 +110,42 @@ Column{
exclusiveGroup: profileSelectionMenuGroup;
onTriggered: UM.MachineManager.setActiveProfile(model.name)
}
onObjectAdded: machineSelectionMenu.insertItem(index, object)
onObjectRemoved: machineSelectionMenu.removeItem(object)
onObjectAdded: profileSelectionMenu.insertItem(index, object)
onObjectRemoved: profileSelectionMenu.removeItem(object)
}
ExclusiveGroup { id: profileSelectionMenuGroup; }
}
Button {
id: saveProfileButton
visible: true
anchors.top: parent.top
x: globalProfileSelection.width + 2
width: parent.width/100*25
text: catalog.i18nc("@action:button", "Save");
height: parent.height
style: ButtonStyle {
background: Rectangle {
color: control.hovered ? UM.Theme.colors.load_save_button_hover : UM.Theme.colors.load_save_button
Behavior on color { ColorAnimation { duration: 50; } }
width: actualLabel.width + UM.Theme.sizes.default_margin.width
Label {
id: actualLabel
anchors.centerIn: parent
color: UM.Theme.colors.load_save_button_text
font: UM.Theme.fonts.default
text: control.text;
}
}
label: Item { }
MenuSeparator { }
MenuItem {
action: base.manageProfilesAction;
}
}
// Button {
// id: saveProfileButton
// visible: true
// anchors.top: parent.top
// x: globalProfileSelection.width + 2
// width: parent.width/100*25
// text: catalog.i18nc("@action:button", "Save");
// height: parent.height
//
// style: ButtonStyle {
// background: Rectangle {
// color: control.hovered ? UM.Theme.colors.load_save_button_hover : UM.Theme.colors.load_save_button
// Behavior on color { ColorAnimation { duration: 50; } }
// width: actualLabel.width + UM.Theme.sizes.default_margin.width
// Label {
// id: actualLabel
// anchors.centerIn: parent
// color: UM.Theme.colors.load_save_button_text
// font: UM.Theme.fonts.default
// text: control.text;
// }
// }
// label: Item { }
// }
// }
}
}
Rectangle{

View file

@ -15,79 +15,96 @@ Rectangle {
property bool activity: Printer.getPlatformActivity;
Behavior on progress { NumberAnimation { duration: 250; } }
property int totalHeight: childrenRect.height
property string fileBaseName
property variant activeMachineInstance: UM.MachineManager.activeMachineInstance
onActiveMachineInstanceChanged:
{
base.createFileName()
}
UM.I18nCatalog { id: catalog; name:"cura"}
property variant printDuration: PrintInformation.currentPrintTime;
property real printMaterialAmount: PrintInformation.materialAmount;
function createFileName(baseName){
var splitMachineName = UM.Application.machineName.split(" ")
function createFileName(){
var splitMachineName = UM.MachineManager.activeMachineInstance.split(" ")
var abbrMachine = ''
for (var i = 0; i < splitMachineName.length; i++){
if (splitMachineName[i].search(/ultimaker/i) != -1)
if (splitMachineName[i].search(/ultimaker/i) != -1){
abbrMachine += 'UM'
else
abbrMachine += splitMachineName[i].charAt(0)
}
else{
if (splitMachineName[i].charAt(0).search(/[0-9]/g) == -1)
abbrMachine += splitMachineName[i].charAt(0)
}
var regExpAdditives = /[0-9\+]/g;
var resultAdditives = splitMachineName[i].match(regExpAdditives);
if (resultAdditives != null){
for (var j = 0; j < resultAdditives.length; j++){ abbrMachine += resultAdditives[j] }
for (var j = 0; j < resultAdditives.length; j++){
abbrMachine += resultAdditives[j]
}
}
}
printJobTextfield.text = abbrMachine + '_' + baseName
//printJobTextfield.text = abbrMachine + '_' + base.fileBaseName
}
Connections {
target: openDialog
onHasMesh: base.createFileName(name)
onHasMesh: {
base.fileBaseName = name
base.createFileName()
}
}
Rectangle{
id: printJobRow
implicitWidth: base.width;
implicitHeight: UM.Theme.sizes.sidebar_header.height
//implicitHeight: UM.Theme.sizes.sidebar_header.height /////////////remove this TODO
implicitHeight: 1
anchors.top: parent.top
color: UM.Theme.colors.sidebar_header_bar
Label{
id: printJobTextfieldLabel
text: catalog.i18nc("@label","Printjob name");
anchors.left: parent.left
anchors.leftMargin: UM.Theme.sizes.default_margin.width;
anchors.verticalCenter: parent.verticalCenter
font: UM.Theme.fonts.default;
color: UM.Theme.colors.text_white
}
TextField {
id: printJobTextfield
anchors.right: parent.right
anchors.rightMargin: UM.Theme.sizes.default_margin.width;
anchors.verticalCenter: parent.verticalCenter
width: parent.width/100*55
height: UM.Theme.sizes.sidebar_inputFields.height
property int unremovableSpacing: 5
text: ''
onEditingFinished: {
if (printJobTextfield.text != ''){
printJobTextfield.focus = false
}
}
validator: RegExpValidator {
regExp: /^[^\\ \/ \.]*$/
}
style: TextFieldStyle{
textColor: UM.Theme.colors.setting_control_text;
font: UM.Theme.fonts.default;
background: Rectangle {
radius: 0
implicitWidth: parent.width
implicitHeight: parent.height
border.width: 1;
border.color: UM.Theme.colors.slider_groove_border;
}
}
}
//color: UM.Theme.colors.sidebar_header_bar
color: UM.Theme.colors.setting_control_border
// Label{
// id: printJobTextfieldLabel
// text: catalog.i18nc("@label","Printjob name");
// anchors.left: parent.left
// anchors.leftMargin: UM.Theme.sizes.default_margin.width;
// anchors.verticalCenter: parent.verticalCenter
// font: UM.Theme.fonts.default;
// color: UM.Theme.colors.text_white
// }
// TextField {
// id: printJobTextfield
// anchors.right: parent.right
// anchors.rightMargin: UM.Theme.sizes.default_margin.width;
// anchors.verticalCenter: parent.verticalCenter
// width: parent.width/100*55
// height: UM.Theme.sizes.sidebar_inputFields.height
// property int unremovableSpacing: 5
// text: ''
// onEditingFinished: {
// if (printJobTextfield.text != ''){
// printJobTextfield.focus = false
// }
// }
// validator: RegExpValidator {
// regExp: /^[^\\ \/ \.]*$/
// }
// style: TextFieldStyle{
// textColor: UM.Theme.colors.setting_control_text;
// font: UM.Theme.fonts.default;
// background: Rectangle {
// radius: 0
// implicitWidth: parent.width
// implicitHeight: parent.height
// border.width: 1;
// border.color: UM.Theme.colors.slider_groove_border;
// }
// }
// }
}
Rectangle {

View file

@ -14,6 +14,7 @@ Rectangle
property Action addMachineAction;
property Action configureMachinesAction;
property Action manageProfilesAction;
color: UM.Theme.colors.sidebar;
UM.I18nCatalog { id: catalog; name:"cura"}
@ -64,6 +65,7 @@ Rectangle
ProfileSetup {
id: profileItem
manageProfilesAction: base.manageProfilesAction
anchors.top: header.bottom
width: parent.width
height: totalHeightProfileSetup

View file

@ -11,23 +11,167 @@ import UM 1.1 as UM
Item
{
id: base;
anchors.fill: parent;
anchors.leftMargin: UM.Theme.sizes.default_margin.width;
anchors.rightMargin: UM.Theme.sizes.default_margin.width;
property Action configureSettings;
property variant minimumPrintTime: PrintInformation.minimumPrintTime;
property variant maximumPrintTime: PrintInformation.maximumPrintTime;
Component.onCompleted: PrintInformation.enabled = true
Component.onDestruction: PrintInformation.enabled = false
UM.I18nCatalog { id: catalog; name:"cura"}
ColumnLayout
{
anchors.fill: parent;
// Rectangle {
// anchors.top: simpleModeGrid.top
// anchors.left: simpleModeGrid.left
// width: simpleModeGrid.width
// height: simpleModeGrid.height
// color: "blue"
// }
Grid {
id: simpleModeGrid
anchors.fill: parent;
columns: 2
spacing: 0
// Rectangle{
// id: infillLabelCell
// width: base.width/100*45
// height: 100
// Column {
// spacing: 0
// anchors{
// top: parent.top
// topMargin: UM.Theme.sizes.default_margin.height
// right: parent.right
// rightMargin: UM.Theme.sizes.default_margin.width
// bottom: parent.bottom
// bottomMargin: UM.Theme.sizes.default_margin.height
// left: parent.left
// leftMargin: UM.Theme.sizes.default_margin.width
// }
//
// Label{
// id: infillLabel
// //: Infill selection label
// text: catalog.i18nc("@label","Infill:");
// font: UM.Theme.fonts.default;
// }
// Label{
// id: infillCaption
// width: infillLabelCell.width - UM.Theme.sizes.default_margin.width
// text: "hier staat overig tekst hier staat overig tekst hier staat overig tekst"
// font: UM.Theme.fonts.caption
// wrapMode: Text.Wrap
// color: UM.Theme.colors.text
// }
// }
// }
//
// Rectangle{
// id: infillCell
// height: 100
// width: base.width/100*55
// Row {
// spacing: 0
// anchors.right: parent.right
// anchors.rightMargin: UM.Theme.sizes.default_margin.width
// Rectangle {
// id: infillWrapper
// width: infillCell.width/4;
// height: infillCell.height
// Rectangle{
// id: infillIconLining
// anchors.top: parent.top
// anchors.topMargin: UM.Theme.sizes.default_margin.height
// anchors.horizontalCenter: parent.horizontalCenter
// z: parent.z + 1
// width: parent.width - UM.Theme.sizes.default_margin.width/2
// height: parent.width - UM.Theme.sizes.default_margin.width/2
// color: "grey"
// border.color: "black"
// border.width:1
// UM.RecolorImage {
// id: infillIcon
// z: parent.z + 1
// anchors.verticalCenter: parent.verticalCenter
// anchors.horizontalCenter: parent.horizontalCenter
// width: UM.Theme.sizes.save_button_specs_icons.width
// height: UM.Theme.sizes.save_button_specs_icons.height
// sourceSize.width: width
// sourceSize.height: width
// color: UM.Theme.colors.text_hover
// source: UM.Theme.icons.print_time;
// }
// }
// Label{
// //: Infill version label "light:
// text: catalog.i18nc("@label","Light");
// anchors.top: infillIconLining.bottom
// anchors.horizontalCenter: parent.horizontalCenter
// font.bold: true
// }
// }
// Rectangle {
// color: "green";
// width: infillCell.width/4;
// height: infillCell.height
// }
// Rectangle {
// color: "blue";
// width: infillCell.width/4;
// height: infillCell.height
// }
// Rectangle {
// color: "yellow";
// width: infillCell.width/4;
// height: infillCell.height
// }
// }
// }
Rectangle {
width: parent.width/100*45 - UM.Theme.sizes.default_margin.width
height: 100
Label{
anchors.left: parent.left
anchors.leftMargin: UM.Theme.sizes.default_margin.width
//: Helpers selection label
text: catalog.i18nc("@label","Helpers:");
font: UM.Theme.fonts.default;
}
}
Rectangle {
width: parent.width/100*55 - UM.Theme.sizes.default_margin.width
height: 100
Column {
spacing: 4
CheckBox{
Layout.preferredHeight: UM.Theme.sizes.section.height;
//: Setting enable skirt adhesion checkbox
text: catalog.i18nc("@action:checkbox","Enable Skirt Adhesion");
style: UM.Theme.styles.checkbox;
checked: Printer.getSettingValue("skirt_line_count");
onCheckedChanged: Printer.setSettingValue("skirt_line_count", checked);
}
CheckBox{
Layout.preferredHeight: UM.Theme.sizes.section.height;
//: Setting enable support checkbox
text: catalog.i18nc("@action:checkbox","Enable Support");
style: UM.Theme.styles.checkbox;
checked: Printer.getSettingValue("support_enable");
onCheckedChanged: Printer.setSettingValue("support_enable", checked);
}
}
}
}
/*
Item
{
Layout.fillWidth: true;
@ -130,5 +274,5 @@ Item
}
Item { Layout.fillWidth: true; Layout.fillHeight: true; }
}
}*/
}

View file

@ -28,7 +28,7 @@ Item {
model: UM.Models.toolModel
Button {
text: model.name;
text: model.name
iconSource: UM.Theme.icons[model.icon];
checkable: true;

View file

@ -1,7 +1,45 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 19.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.2" baseProfile="tiny" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
x="0px" y="0px" viewBox="0 0 30 30" xml:space="preserve">
<path d="M30,20L25.1,6.7L27.6,0H12.9l1.6,5H7.1H6.9H6.4l2.3,6H2.4l2.4,6.2L0,30h19.5l-1.7-4h7.5h0.1h0.6l-2.3-6H30z M17.5,25
l-2.8-7.5l2.4-6.5H9.6L7.7,6h7.2h7.5l-2.4,6.4l2.9,7.6l2,5H17.5z"/>
</svg>
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Generator: Adobe Illustrator 19.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
version="1.2"
id="Layer_1"
x="0px"
y="0px"
viewBox="0 0 30 30"
xml:space="preserve"
inkscape:version="0.91 r13725"
sodipodi:docname="setting_per_object.svg"><metadata
id="metadata9"><rdf:RDF><cc:Work
rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /></cc:Work></rdf:RDF></metadata><defs
id="defs7" /><sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1440"
inkscape:window-height="834"
id="namedview5"
showgrid="false"
inkscape:zoom="7.8666667"
inkscape:cx="15"
inkscape:cy="15"
inkscape:window-x="0"
inkscape:window-y="27"
inkscape:window-maximized="1"
inkscape:current-layer="Layer_1" /><path
d="M30,20L25.1,6.7L27.6,0H12.9l1.6,5H7.1H6.9H6.4l2.3,6H2.4l2.4,6.2L0,30h19.5l-1.7-4h7.5h0.1h0.6l-2.3-6H30z M17.5,25 l-2.8-7.5l2.4-6.5H9.6L7.7,6h7.2h7.5l-2.4,6.4l2.9,7.6l2,5H17.5z"
id="path3"
style="fill:#ffffff" /></svg>

Before

Width:  |  Height:  |  Size: 526 B

After

Width:  |  Height:  |  Size: 1.7 KiB

Before After
Before After

View file

@ -121,7 +121,7 @@
"checkbox_hover": [245, 245, 245, 255],
"checkbox_border": [174, 174, 174, 255],
"checkbox_mark": [35, 35, 35, 255],
"checkbox_text": [140, 144, 154, 255],
"checkbox_text": [0, 0, 0, 255],
"tooltip": [255, 225, 146, 255],