mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-05-08 03:39:02 +08:00
Merge branch 'master' of github.com:Ultimaker/Cura
This commit is contained in:
commit
cc2ad9dec0
@ -498,8 +498,10 @@ class MaterialManager(QObject):
|
||||
# Ensure all settings are saved.
|
||||
self._application.saveSettings()
|
||||
|
||||
global_stack = self._application.getGlobalContainerStack()
|
||||
approximate_diameter = str(round(global_stack.getProperty("material_diameter", "value")))
|
||||
machine_manager = self._application.getMachineManager()
|
||||
extruder_stack = machine_manager.activeStack
|
||||
|
||||
approximate_diameter = str(extruder_stack.approximateMaterialDiameter)
|
||||
root_material_id = "generic_pla"
|
||||
root_material_id = self.getRootMaterialIDForDiameter(root_material_id, approximate_diameter)
|
||||
material_group = self.getMaterialGroup(root_material_id)
|
||||
|
@ -41,7 +41,7 @@ class CuraSceneNode(SceneNode):
|
||||
# Use the support extruder instead of the active extruder if this is a support_mesh
|
||||
if per_mesh_stack:
|
||||
if per_mesh_stack.getProperty("support_mesh", "value"):
|
||||
return extruders[int(global_container_stack.getProperty("support_extruder_nr", "value"))]
|
||||
return extruders[int(global_container_stack.getExtruderPositionValueWithDefault("support_extruder_nr"))]
|
||||
|
||||
# It's only set if you explicitly choose an extruder
|
||||
extruder_id = self.callDecoration("getActiveExtruder")
|
||||
|
@ -8,6 +8,7 @@ from typing import Any, Optional
|
||||
from PyQt5.QtCore import pyqtProperty, pyqtSignal, QObject
|
||||
from UM.FlameProfiler import pyqtSlot
|
||||
|
||||
from UM.Application import Application
|
||||
from UM.Decorators import override
|
||||
from UM.Logger import Logger
|
||||
from UM.Settings.ContainerStack import ContainerStack, InvalidContainerStackError
|
||||
@ -314,6 +315,13 @@ class CuraContainerStack(ContainerStack):
|
||||
|
||||
return cls._findInstanceContainerDefinitionId(definitions[0])
|
||||
|
||||
## getProperty for extruder positions, with translation from -1 to default extruder number
|
||||
def getExtruderPositionValueWithDefault(self, key):
|
||||
value = self.getProperty(key, "value")
|
||||
if value == -1:
|
||||
value = int(Application.getInstance().getMachineManager().defaultExtruderPosition)
|
||||
return value
|
||||
|
||||
## private:
|
||||
|
||||
# Private helper class to keep track of container positions and their types.
|
||||
|
@ -5,6 +5,7 @@ from typing import Any, TYPE_CHECKING, Optional
|
||||
|
||||
from PyQt5.QtCore import pyqtProperty, pyqtSignal
|
||||
|
||||
from UM.Application import Application
|
||||
from UM.Decorators import override
|
||||
from UM.MimeTypeDatabase import MimeType, MimeTypeDatabase
|
||||
from UM.Settings.ContainerStack import ContainerStack
|
||||
@ -111,6 +112,8 @@ class ExtruderStack(CuraContainerStack):
|
||||
|
||||
limit_to_extruder = super().getProperty(key, "limit_to_extruder", context)
|
||||
if limit_to_extruder is not None:
|
||||
if limit_to_extruder == -1:
|
||||
limit_to_extruder = int(Application.getInstance().getMachineManager().defaultExtruderPosition)
|
||||
limit_to_extruder = str(limit_to_extruder)
|
||||
if (limit_to_extruder is not None and limit_to_extruder != "-1") and self.getMetaDataEntry("position") != str(limit_to_extruder):
|
||||
if str(limit_to_extruder) in self.getNextStack().extruders:
|
||||
|
@ -7,6 +7,7 @@ from typing import Any, Dict, Optional
|
||||
|
||||
from PyQt5.QtCore import pyqtProperty
|
||||
|
||||
from UM.Application import Application
|
||||
from UM.Decorators import override
|
||||
|
||||
from UM.MimeTypeDatabase import MimeType, MimeTypeDatabase
|
||||
@ -104,6 +105,8 @@ class GlobalStack(CuraContainerStack):
|
||||
# Handle the "limit_to_extruder" property.
|
||||
limit_to_extruder = super().getProperty(key, "limit_to_extruder", context)
|
||||
if limit_to_extruder is not None:
|
||||
if limit_to_extruder == -1:
|
||||
limit_to_extruder = int(Application.getInstance().getMachineManager().defaultExtruderPosition)
|
||||
limit_to_extruder = str(limit_to_extruder)
|
||||
if limit_to_extruder is not None and limit_to_extruder != "-1" and limit_to_extruder in self._extruders:
|
||||
if super().getProperty(key, "settable_per_extruder", context):
|
||||
|
@ -1227,7 +1227,7 @@ class MachineManager(QObject):
|
||||
self._updateQualityWithMaterial()
|
||||
|
||||
@pyqtSlot(str, "QVariant")
|
||||
def setVariantGroup(self, position, container_node):
|
||||
def setVariant(self, position, container_node):
|
||||
position = str(position)
|
||||
self.blurSettings.emit()
|
||||
with postponeSignals(*self._getContainerChangedSignals(), compress = CompressTechnique.CompressPerParameterValue):
|
||||
|
@ -3,13 +3,14 @@ from typing import Any, Optional
|
||||
from UM.Application import Application
|
||||
from UM.Decorators import override
|
||||
from UM.Settings.Interfaces import PropertyEvaluationContext
|
||||
from UM.Settings.ContainerStack import ContainerStack
|
||||
from UM.Settings.SettingInstance import InstanceState
|
||||
|
||||
from .CuraContainerStack import CuraContainerStack
|
||||
|
||||
class PerObjectContainerStack(ContainerStack):
|
||||
|
||||
@override(ContainerStack)
|
||||
class PerObjectContainerStack(CuraContainerStack):
|
||||
|
||||
@override(CuraContainerStack)
|
||||
def getProperty(self, key: str, property_name: str, context: Optional[PropertyEvaluationContext] = None) -> Any:
|
||||
if context is None:
|
||||
context = PropertyEvaluationContext()
|
||||
@ -51,8 +52,8 @@ class PerObjectContainerStack(ContainerStack):
|
||||
context.popContainer()
|
||||
return result
|
||||
|
||||
@override(ContainerStack)
|
||||
def setNextStack(self, stack: ContainerStack):
|
||||
@override(CuraContainerStack)
|
||||
def setNextStack(self, stack: CuraContainerStack):
|
||||
super().setNextStack(stack)
|
||||
|
||||
# trigger signal to re-evaluate all default settings
|
||||
|
@ -3,7 +3,6 @@
|
||||
|
||||
import copy
|
||||
|
||||
from UM.Scene.Iterator.DepthFirstIterator import DepthFirstIterator
|
||||
from UM.Scene.SceneNodeDecorator import SceneNodeDecorator
|
||||
from UM.Signal import Signal, signalemitter
|
||||
from UM.Settings.InstanceContainer import InstanceContainer
|
||||
@ -33,9 +32,11 @@ class SettingOverrideDecorator(SceneNodeDecorator):
|
||||
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
self._stack = PerObjectContainerStack(stack_id = "per_object_stack_" + str(id(self)))
|
||||
self._stack = PerObjectContainerStack(container_id = "per_object_stack_" + str(id(self)))
|
||||
self._stack.setDirty(False) # This stack does not need to be saved.
|
||||
self._stack.addContainer(InstanceContainer(container_id = "SettingOverrideInstanceContainer"))
|
||||
user_container = InstanceContainer(container_id = "SettingOverrideInstanceContainer")
|
||||
user_container.addMetaDataEntry("type", "user")
|
||||
self._stack.userChanges = user_container
|
||||
self._extruder_stack = ExtruderManager.getInstance().getExtruderStack(0).getId()
|
||||
|
||||
self._is_non_printing_mesh = False
|
||||
|
@ -146,7 +146,7 @@ class SliceInfo(Extension):
|
||||
model_stack = node.callDecoration("getStack")
|
||||
if model_stack:
|
||||
model_settings["support_enabled"] = model_stack.getProperty("support_enable", "value")
|
||||
model_settings["support_extruder_nr"] = int(model_stack.getProperty("support_extruder_nr", "value"))
|
||||
model_settings["support_extruder_nr"] = int(model_stack.getExtruderPositionValueWithDefault("support_extruder_nr"))
|
||||
|
||||
# Mesh modifiers;
|
||||
model_settings["infill_mesh"] = model_stack.getProperty("infill_mesh", "value")
|
||||
@ -177,7 +177,7 @@ class SliceInfo(Extension):
|
||||
|
||||
# Support settings
|
||||
print_settings["support_enabled"] = global_container_stack.getProperty("support_enable", "value")
|
||||
print_settings["support_extruder_nr"] = int(global_container_stack.getProperty("support_extruder_nr", "value"))
|
||||
print_settings["support_extruder_nr"] = int(global_container_stack.getExtruderPositionValueWithDefault("support_extruder_nr"))
|
||||
|
||||
# Platform adhesion settings
|
||||
print_settings["adhesion_type"] = global_container_stack.getProperty("adhesion_type", "value")
|
||||
|
@ -62,7 +62,7 @@ class SolidView(View):
|
||||
|
||||
global_container_stack = Application.getInstance().getGlobalContainerStack()
|
||||
if global_container_stack:
|
||||
support_extruder_nr = global_container_stack.getProperty("support_extruder_nr", "value")
|
||||
support_extruder_nr = global_container_stack.getExtruderPositionValueWithDefault("support_extruder_nr")
|
||||
support_angle_stack = Application.getInstance().getExtruderManager().getExtruderStack(support_extruder_nr)
|
||||
|
||||
if support_angle_stack is not None and Preferences.getInstance().getValue("view/show_overhang"):
|
||||
@ -89,7 +89,7 @@ class SolidView(View):
|
||||
# Use the support extruder instead of the active extruder if this is a support_mesh
|
||||
if per_mesh_stack:
|
||||
if per_mesh_stack.getProperty("support_mesh", "value"):
|
||||
extruder_index = int(global_container_stack.getProperty("support_extruder_nr", "value"))
|
||||
extruder_index = int(global_container_stack.getExtruderPositionValueWithDefault("support_extruder_nr"))
|
||||
|
||||
try:
|
||||
material_color = self._extruders_model.getItem(extruder_index)["color"]
|
||||
|
@ -32,7 +32,7 @@ Menu
|
||||
}
|
||||
exclusiveGroup: group
|
||||
onTriggered: {
|
||||
Cura.MachineManager.setVariantGroup(menu.extruderIndex, model.container_node);
|
||||
Cura.MachineManager.setVariant(menu.extruderIndex, model.container_node);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -13,11 +13,8 @@ Menu
|
||||
title: catalog.i18nc("@action:inmenu", "Visible Settings")
|
||||
|
||||
property QtObject settingVisibilityPresetsModel: CuraApplication.getSettingVisibilityPresetsModel()
|
||||
property bool showingSearchResults
|
||||
property bool showingAllSettings
|
||||
|
||||
signal showAllSettings()
|
||||
signal showSettingVisibilityProfile()
|
||||
|
||||
Instantiator
|
||||
{
|
||||
@ -43,7 +40,7 @@ Menu
|
||||
MenuSeparator {}
|
||||
MenuItem
|
||||
{
|
||||
text: catalog.i18nc("@action:inmenu", "All Settings")
|
||||
text: catalog.i18nc("@action:inmenu", "Show All Settings")
|
||||
checkable: true
|
||||
checked: showingAllSettings
|
||||
exclusiveGroup: group
|
||||
|
@ -72,11 +72,11 @@ UM.PreferencesPage
|
||||
{
|
||||
if(parent.checkedState == Qt.Unchecked || parent.checkedState == Qt.PartiallyChecked)
|
||||
{
|
||||
definitionsModel.setAllVisible(true)
|
||||
definitionsModel.setAllExpandedVisible(true)
|
||||
}
|
||||
else
|
||||
{
|
||||
definitionsModel.setAllVisible(false)
|
||||
definitionsModel.setAllExpandedVisible(false)
|
||||
}
|
||||
|
||||
// After change set "Custom" option
|
||||
|
@ -18,7 +18,6 @@ Item
|
||||
property QtObject settingVisibilityPresetsModel: CuraApplication.getSettingVisibilityPresetsModel()
|
||||
property Action configureSettings
|
||||
property bool findingSettings
|
||||
property bool showingAllSettings
|
||||
signal showTooltip(Item item, point location, string text)
|
||||
signal hideTooltip()
|
||||
|
||||
@ -140,21 +139,9 @@ Item
|
||||
}
|
||||
menu: SettingVisibilityPresetsMenu
|
||||
{
|
||||
showingSearchResults: findingSettings
|
||||
showingAllSettings: showingAllSettings
|
||||
|
||||
onShowAllSettings:
|
||||
{
|
||||
base.showingAllSettings = true;
|
||||
base.findingSettings = false;
|
||||
filter.text = "";
|
||||
filter.updateDefinitionModel();
|
||||
}
|
||||
onShowSettingVisibilityProfile:
|
||||
{
|
||||
base.showingAllSettings = false;
|
||||
base.findingSettings = false;
|
||||
filter.text = "";
|
||||
definitionsModel.setAllVisible(true);
|
||||
filter.updateDefinitionModel();
|
||||
}
|
||||
}
|
||||
@ -219,10 +206,6 @@ Item
|
||||
findingSettings = (text.length > 0);
|
||||
if(findingSettings != lastFindingSettings)
|
||||
{
|
||||
if(findingSettings)
|
||||
{
|
||||
showingAllSettings = false;
|
||||
}
|
||||
updateDefinitionModel();
|
||||
lastFindingSettings = findingSettings;
|
||||
}
|
||||
@ -235,7 +218,7 @@ Item
|
||||
|
||||
function updateDefinitionModel()
|
||||
{
|
||||
if(findingSettings || showingAllSettings)
|
||||
if(findingSettings)
|
||||
{
|
||||
expandedCategories = definitionsModel.expanded.slice();
|
||||
definitionsModel.expanded = [""]; // keep categories closed while to prevent render while making settings visible one by one
|
||||
@ -558,13 +541,13 @@ Item
|
||||
MenuItem
|
||||
{
|
||||
//: Settings context menu action
|
||||
visible: !(findingSettings || showingAllSettings);
|
||||
visible: !findingSettings
|
||||
text: catalog.i18nc("@action:menu", "Hide this setting");
|
||||
onTriggered:
|
||||
{
|
||||
definitionsModel.hide(contextMenu.key);
|
||||
// visible settings have changed, so we're no longer showing a preset
|
||||
if (settingVisibilityPresetsModel.activePreset != "" && !showingAllSettings)
|
||||
if (settingVisibilityPresetsModel.activePreset != "")
|
||||
{
|
||||
settingVisibilityPresetsModel.setActivePreset("custom");
|
||||
}
|
||||
@ -584,7 +567,7 @@ Item
|
||||
return catalog.i18nc("@action:menu", "Keep this setting visible");
|
||||
}
|
||||
}
|
||||
visible: (findingSettings || showingAllSettings);
|
||||
visible: findingSettings
|
||||
onTriggered:
|
||||
{
|
||||
if (contextMenu.settingVisible)
|
||||
@ -596,7 +579,7 @@ Item
|
||||
definitionsModel.show(contextMenu.key);
|
||||
}
|
||||
// visible settings have changed, so we're no longer showing a preset
|
||||
if (settingVisibilityPresetsModel.activePreset != "" && !showingAllSettings)
|
||||
if (settingVisibilityPresetsModel.activePreset != "")
|
||||
{
|
||||
settingVisibilityPresetsModel.setActivePreset("custom");
|
||||
}
|
||||
|
@ -46,6 +46,7 @@ retraction_count_max = 25
|
||||
retraction_extrusion_window = 1
|
||||
retraction_hop = 2
|
||||
retraction_hop_only_when_collides = True
|
||||
retraction_min_travel = =line_width * 2
|
||||
skin_overlap = 5
|
||||
speed_equalize_flow_enabled = True
|
||||
speed_layer_0 = 20
|
||||
|
@ -57,7 +57,7 @@ retraction_count_max = 15
|
||||
retraction_extrusion_window = =retraction_amount
|
||||
retraction_hop = 2
|
||||
retraction_hop_only_when_collides = True
|
||||
retraction_min_travel = 5
|
||||
retraction_min_travel = =line_width * 3
|
||||
retraction_prime_speed = 15
|
||||
skin_overlap = 5
|
||||
speed_layer_0 = 20
|
||||
|
@ -46,6 +46,7 @@ retraction_count_max = 25
|
||||
retraction_extrusion_window = 1
|
||||
retraction_hop = 2
|
||||
retraction_hop_only_when_collides = True
|
||||
retraction_min_travel = =line_width * 2
|
||||
skin_overlap = 5
|
||||
speed_equalize_flow_enabled = True
|
||||
speed_layer_0 = 20
|
||||
|
@ -57,7 +57,7 @@ retraction_count_max = 15
|
||||
retraction_extrusion_window = =retraction_amount
|
||||
retraction_hop = 2
|
||||
retraction_hop_only_when_collides = True
|
||||
retraction_min_travel = 5
|
||||
retraction_min_travel = =line_width * 3
|
||||
retraction_prime_speed = 15
|
||||
skin_overlap = 5
|
||||
speed_layer_0 = 20
|
||||
|
Loading…
x
Reference in New Issue
Block a user