mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-14 01:25:51 +08:00
Added grouping action
This commit is contained in:
parent
c6f5ceaf56
commit
2683fa0958
@ -22,6 +22,7 @@ from UM.Math.Polygon import Polygon
|
||||
|
||||
from UM.Scene.BoxRenderer import BoxRenderer
|
||||
from UM.Scene.Selection import Selection
|
||||
from UM.Scene.GroupDecorator import GroupDecorator
|
||||
|
||||
from UM.Operations.AddSceneNodeOperation import AddSceneNodeOperation
|
||||
from UM.Operations.RemoveSceneNodeOperation import RemoveSceneNodeOperation
|
||||
@ -417,6 +418,17 @@ class CuraApplication(QtApplication):
|
||||
|
||||
self.getActiveMachine().setSettingValueByKey(key, value)
|
||||
|
||||
|
||||
@pyqtSlot()
|
||||
def groupSelected(self):
|
||||
group_node = SceneNode()
|
||||
group_decorator = GroupDecorator()
|
||||
group_node.addDecorator(group_decorator)
|
||||
group_node.setParent(self.getController().getScene().getRoot())
|
||||
for node in Selection.getAllSelectedObjects():
|
||||
node.setParent(group_node)
|
||||
|
||||
|
||||
## Add an output device that can be written to.
|
||||
#
|
||||
# \param id \type{string} The identifier used to identify the device.
|
||||
|
@ -3,6 +3,7 @@
|
||||
|
||||
import QtQuick 2.2
|
||||
import QtQuick.Controls 1.1
|
||||
import UM 1.0 as UM
|
||||
|
||||
Item {
|
||||
property alias open: openAction;
|
||||
@ -16,6 +17,7 @@ Item {
|
||||
|
||||
property alias deleteObject: deleteObjectAction;
|
||||
property alias centerObject: centerObjectAction;
|
||||
property alias groupObjects: groupObjectsAction;
|
||||
property alias multiplyObject: multiplyObjectAction;
|
||||
property alias splitObject: splitObjectAction;
|
||||
|
||||
@ -121,6 +123,13 @@ Item {
|
||||
text: qsTr("Center Object on Platform");
|
||||
}
|
||||
|
||||
Action
|
||||
{
|
||||
id: groupObjectsAction
|
||||
text: qsTr("Group objects");
|
||||
enabled: UM.Scene.numObjectsSelected > 1 ? true: false
|
||||
}
|
||||
|
||||
Action {
|
||||
id: multiplyObjectAction;
|
||||
//: Duplicate object action
|
||||
|
@ -348,6 +348,11 @@ UM.MainWindow {
|
||||
}
|
||||
}
|
||||
|
||||
groupObjects.onTriggered:
|
||||
{
|
||||
Printer.groupSelected()
|
||||
}
|
||||
|
||||
deleteAll.onTriggered: Printer.deleteAll()
|
||||
resetAllTranslation.onTriggered: Printer.resetAllTranslation()
|
||||
resetAll.onTriggered: Printer.resetAll()
|
||||
@ -373,6 +378,7 @@ UM.MainWindow {
|
||||
MenuItem { action: actions.deleteObject; }
|
||||
MenuItem { action: actions.multiplyObject; }
|
||||
MenuItem { action: actions.splitObject; }
|
||||
MenuItem { action: actions.groupObjects;}
|
||||
MenuSeparator { }
|
||||
MenuItem { action: actions.deleteAll; }
|
||||
MenuItem { action: actions.reloadAll; }
|
||||
|
Loading…
x
Reference in New Issue
Block a user