mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-08-07 22:13:58 -06:00
Merge pull request #4618 from Ultimaker/CURA-5834_fix_material_model_update
CURA-5834 Fix material model update
This commit is contained in:
commit
3dab627670
7 changed files with 73 additions and 23 deletions
|
@ -926,7 +926,7 @@ class ThreeMFWorkspaceReader(WorkspaceReader):
|
|||
build_plate_id = global_stack.variant.getId()
|
||||
|
||||
# get material diameter of this extruder
|
||||
machine_material_diameter = extruder_stack.materialDiameter
|
||||
machine_material_diameter = extruder_stack.getCompatibleMaterialDiameter()
|
||||
material_node = material_manager.getMaterialNode(global_stack.definition.getId(),
|
||||
extruder_stack.variant.getName(),
|
||||
build_plate_id,
|
||||
|
|
|
@ -408,6 +408,10 @@ Cura.MachineAction
|
|||
manager.updateMaterialForDiameter(settingsTabs.currentIndex - 1);
|
||||
}
|
||||
}
|
||||
function setValueFunction(value)
|
||||
{
|
||||
Cura.MachineManager.activeStack.compatibleMaterialDiameter = value
|
||||
}
|
||||
property bool isExtruderSetting: true
|
||||
}
|
||||
|
||||
|
@ -564,6 +568,7 @@ Cura.MachineAction
|
|||
property bool _forceUpdateOnChange: (typeof(forceUpdateOnChange) === 'undefined') ? false : forceUpdateOnChange
|
||||
property string _label: (typeof(label) === 'undefined') ? "" : label
|
||||
property string _tooltip: (typeof(tooltip) === 'undefined') ? propertyProvider.properties.description : tooltip
|
||||
property var _setValueFunction: (typeof(setValueFunction) === 'undefined') ? undefined : setValueFunction
|
||||
|
||||
UM.SettingPropertyProvider
|
||||
{
|
||||
|
@ -616,14 +621,32 @@ Cura.MachineAction
|
|||
{
|
||||
if (propertyProvider && text != propertyProvider.properties.value)
|
||||
{
|
||||
propertyProvider.setPropertyValue("value", text);
|
||||
// For some properties like the extruder-compatible material diameter, they need to
|
||||
// trigger many updates, such as the available materials, the current material may
|
||||
// need to be switched, etc. Although setting the diameter can be done directly via
|
||||
// the provider, all the updates that need to be triggered then need to depend on
|
||||
// the metadata update, a signal that can be fired way too often. The update functions
|
||||
// can have if-checks to filter out the irrelevant updates, but still it incurs unnecessary
|
||||
// overhead.
|
||||
// The ExtruderStack class has a dedicated function for this call "setCompatibleMaterialDiameter()",
|
||||
// and it triggers the diameter update signals only when it is needed. Here it is optionally
|
||||
// choose to use setCompatibleMaterialDiameter() or other more specific functions that
|
||||
// are available.
|
||||
if (_setValueFunction !== undefined)
|
||||
{
|
||||
_setValueFunction(text)
|
||||
}
|
||||
else
|
||||
{
|
||||
propertyProvider.setPropertyValue("value", text)
|
||||
}
|
||||
if(_forceUpdateOnChange)
|
||||
{
|
||||
manager.forceUpdate();
|
||||
manager.forceUpdate()
|
||||
}
|
||||
if(_afterOnEditingFinished)
|
||||
{
|
||||
_afterOnEditingFinished();
|
||||
_afterOnEditingFinished()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue