From 4c1d86d28c1fd7457f98059d173930489ca54c57 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Mon, 27 Jul 2015 10:53:47 +0200 Subject: [PATCH 1/5] Grouping & ungrouping is now in both context menus --- resources/qml/Cura.qml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/resources/qml/Cura.qml b/resources/qml/Cura.qml index ffe911a6a3..3c87dffe8a 100644 --- a/resources/qml/Cura.qml +++ b/resources/qml/Cura.qml @@ -378,27 +378,28 @@ UM.MainWindow { id: objectContextMenu; property variant objectId: -1; - MenuItem { action: actions.centerObject; } MenuItem { action: actions.deleteObject; } MenuItem { action: actions.multiplyObject; } MenuItem { action: actions.splitObject; } - MenuItem { action: actions.groupObjects;} - MenuItem { action: actions.unGroupObjects;} + MenuSeparator { } MenuItem { action: actions.deleteAll; } MenuItem { action: actions.reloadAll; } MenuItem { action: actions.resetAllTranslation; } MenuItem { action: actions.resetAll; } + MenuItem { action: actions.groupObjects;} + MenuItem { action: actions.unGroupObjects;} } Menu { id: contextMenu; - MenuItem { action: actions.deleteAll; } MenuItem { action: actions.reloadAll; } MenuItem { action: actions.resetAllTranslation; } MenuItem { action: actions.resetAll; } + MenuItem { action: actions.groupObjects;} + MenuItem { action: actions.unGroupObjects;} } Connections { From 19d711fb8044db0d275327e9d5370fef4dfdc67b Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Mon, 27 Jul 2015 14:25:27 +0200 Subject: [PATCH 2/5] Added merging for multi material --- cura/CuraApplication.py | 19 +++++++++++++++++++ cura/MultiMaterialDecorator.py | 8 ++++++++ cura/PlatformPhysics.py | 13 +++++++++++-- resources/qml/Actions.qml | 9 +++++++++ resources/qml/Cura.qml | 7 +++++++ 5 files changed, 54 insertions(+), 2 deletions(-) create mode 100644 cura/MultiMaterialDecorator.py diff --git a/cura/CuraApplication.py b/cura/CuraApplication.py index e7eb9e2725..4b773b9273 100644 --- a/cura/CuraApplication.py +++ b/cura/CuraApplication.py @@ -36,6 +36,7 @@ from . import BuildVolume from . import CameraAnimation from . import PrintInformation from . import CuraActions +from . import MultiMaterialDecorator from PyQt5.QtCore import pyqtSlot, QUrl, Qt, pyqtSignal, pyqtProperty from PyQt5.QtGui import QColor, QIcon @@ -425,7 +426,25 @@ class CuraApplication(QtApplication): self.getActiveMachine().setSettingValueByKey(key, value) + @pyqtSlot() + def mergeSelected(self): + self.groupSelected() + try: + group_node = Selection.getAllSelectedObjects()[0] + except Exception as e: + return + multi_material_decorator = MultiMaterialDecorator.MultiMaterialDecorator() + group_node.addDecorator(multi_material_decorator) + # Reset the position of each node + for node in group_node.getChildren(): + new_position = node.getPosition() + new_position.setX(0) + new_position.setZ(0) + node.setPosition(new_position) + # Use the previously found center of the group bounding box as the new location of the group + group_node.setPosition((group_node.getBoundingBox().maximum + group_node.getBoundingBox().minimum) / 2) + @pyqtSlot() def groupSelected(self): group_node = SceneNode() diff --git a/cura/MultiMaterialDecorator.py b/cura/MultiMaterialDecorator.py new file mode 100644 index 0000000000..c702ecef13 --- /dev/null +++ b/cura/MultiMaterialDecorator.py @@ -0,0 +1,8 @@ +from UM.Scene.SceneNodeDecorator import SceneNodeDecorator + +class MultiMaterialDecorator(SceneNodeDecorator): + def __init__(self): + super().__init__() + + def isMultiMaterial(self): + return True \ No newline at end of file diff --git a/cura/PlatformPhysics.py b/cura/PlatformPhysics.py index 20e5c9ecc4..7f6c1df3b9 100644 --- a/cura/PlatformPhysics.py +++ b/cura/PlatformPhysics.py @@ -80,9 +80,18 @@ class PlatformPhysics: # Check for collisions between convex hulls for other_node in BreadthFirstIterator(root): # Ignore root, ourselves and anything that is not a normal SceneNode. - if other_node is root or type(other_node) is not SceneNode or other_node is node or other_node in node.getAllChildren() or node in other_node.getAllChildren(): + if other_node is root or type(other_node) is not SceneNode or other_node is node: continue + # Ignore colissions of a group with it's own children + if other_node in node.getAllChildren() or node in other_node.getAllChildren(): + continue + + # Ignore colissions within a group + if other_node.getParent().callDecoration("isGroup") is not None: + if node.getParent().callDecoration("isGroup") is other_node.getParent().callDecoration("isGroup"): + continue + # Ignore nodes that do not have the right properties set. if not other_node.callDecoration("getConvexHull") or not other_node.getBoundingBox(): continue @@ -95,7 +104,7 @@ class PlatformPhysics: overlap = node.callDecoration("getConvexHull").intersectsPolygon(other_node.callDecoration("getConvexHull")) if overlap is None: continue - + move_vector.setX(overlap[0] * 1.1) move_vector.setZ(overlap[1] * 1.1) convex_hull = node.callDecoration("getConvexHull") diff --git a/resources/qml/Actions.qml b/resources/qml/Actions.qml index a223e00bb7..d364b462b6 100644 --- a/resources/qml/Actions.qml +++ b/resources/qml/Actions.qml @@ -19,6 +19,8 @@ Item { property alias centerObject: centerObjectAction; property alias groupObjects: groupObjectsAction; property alias unGroupObjects:unGroupObjectsAction; + property alias mergeObjects: mergeObjectsAction; + //property alias unMergeObjects: unMergeObjectsAction; property alias multiplyObject: multiplyObjectAction; property alias splitObject: splitObjectAction; @@ -139,6 +141,13 @@ Item { enabled: UM.Scene.isGroupSelected } + Action + { + id: mergeObjectsAction + text: qsTr("Merge objects"); + enabled: UM.Scene.numObjectsSelected > 1 ? true: false + } + Action { id: multiplyObjectAction; //: Duplicate object action diff --git a/resources/qml/Cura.qml b/resources/qml/Cura.qml index 3c87dffe8a..35a1ad5e6c 100644 --- a/resources/qml/Cura.qml +++ b/resources/qml/Cura.qml @@ -357,6 +357,11 @@ UM.MainWindow { { Printer.ungroupSelected() } + + mergeObjects.onTriggered: + { + Printer.mergeSelected() + } deleteAll.onTriggered: Printer.deleteAll() resetAllTranslation.onTriggered: Printer.resetAllTranslation() @@ -390,6 +395,7 @@ UM.MainWindow { MenuItem { action: actions.resetAll; } MenuItem { action: actions.groupObjects;} MenuItem { action: actions.unGroupObjects;} + MenuItem { action: actions.mergeObjects;} } Menu { @@ -400,6 +406,7 @@ UM.MainWindow { MenuItem { action: actions.resetAll; } MenuItem { action: actions.groupObjects;} MenuItem { action: actions.unGroupObjects;} + MenuItem { action: actions.mergeObjects;} } Connections { From 4318b7e5abf1f65b592b0c2da76cb0b4a8f58f63 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Mon, 27 Jul 2015 14:36:24 +0200 Subject: [PATCH 3/5] Original center is now used for merging --- cura/CuraApplication.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/cura/CuraApplication.py b/cura/CuraApplication.py index 4b773b9273..876bbeae3b 100644 --- a/cura/CuraApplication.py +++ b/cura/CuraApplication.py @@ -437,13 +437,12 @@ class CuraApplication(QtApplication): group_node.addDecorator(multi_material_decorator) # Reset the position of each node for node in group_node.getChildren(): - new_position = node.getPosition() - new_position.setX(0) - new_position.setZ(0) + new_position = node.getMeshData().getCenterPosition() + new_position.setY(0) node.setPosition(new_position) # Use the previously found center of the group bounding box as the new location of the group - group_node.setPosition((group_node.getBoundingBox().maximum + group_node.getBoundingBox().minimum) / 2) + group_node.setPosition(group_node.getBoundingBox().center) @pyqtSlot() def groupSelected(self): From c1b2ad8a86067e3bf8228753d4118bb104ac0caf Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Tue, 28 Jul 2015 09:15:32 +0200 Subject: [PATCH 4/5] Update README.md --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index dc1f0df1c7..bb5a293b3d 100644 --- a/README.md +++ b/README.md @@ -5,6 +5,12 @@ This is the new, shiny frontend for Cura. [daid/Cura](https://github.com/daid/Cu We re-worked the whole GUI code at Ultimaker, because the old code started to become a unmaintainable. + +Logging Issues +------------ +Use [this](https://github.com/Ultimaker/Uranium/wiki/Bug-Reporting-Template) template to report issues. New issues that do not adhere to this template will take us a lot longer to handle and will therefore have a lower pirority. + + Dependencies ------------ From 9c90a1abcdb84bd319c3a11b70aa6481bd584110 Mon Sep 17 00:00:00 2001 From: awhiemstra Date: Tue, 28 Jul 2015 10:16:49 +0200 Subject: [PATCH 5/5] Add log file information --- README.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/README.md b/README.md index bb5a293b3d..2fb2d6f682 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,11 @@ Logging Issues ------------ Use [this](https://github.com/Ultimaker/Uranium/wiki/Bug-Reporting-Template) template to report issues. New issues that do not adhere to this template will take us a lot longer to handle and will therefore have a lower pirority. +For crashes and similar issues, please attach the following information: + +* (On Windows) The log as produced by dxdiag (start -> run -> dxdiag -> save output) +* The Cura GUI log file, located at (Windows) $User/AppData/Local/cura/cura.log, (OSX) $User/.cura/cura.log +* The Cura Engine log, using Help -> Show Engine Log Dependencies ------------