diff --git a/resources/qml/Preferences/MaterialView.qml b/resources/qml/Preferences/MaterialView.qml index a7017d7f62..bab0b703d2 100644 --- a/resources/qml/Preferences/MaterialView.qml +++ b/resources/qml/Preferences/MaterialView.qml @@ -515,7 +515,7 @@ TabView if(entry_name in materialPreferenceValues[material_guid] && materialPreferenceValues[material_guid][entry_name] == new_value) { // value has not changed - return + return; } materialPreferenceValues[material_guid][entry_name] = new_value; @@ -531,34 +531,33 @@ TabView } var material_weight = Cura.ContainerManager.getContainerMetaDataEntry(base.containerId, "properties", "weight"); - if(material_weight != undefined && material_weight != "") - { - return material_weight - } - return 0; + return material_weight || 0; } // update the display name of the material - function updateMaterialDisplayName (old_name, new_name) { + function updateMaterialDisplayName (old_name, new_name) + { // don't change when new name is the same if (old_name == new_name) { - return + return; } // update the values - base.materialManager.setMaterialName(base.currentMaterialNode, new_name) - materialProperties.name = new_name + base.materialManager.setMaterialName(base.currentMaterialNode, new_name); + materialProperties.name = new_name; } // update the type of the material - function updateMaterialType (old_type, new_type) { - base.setMetaDataEntry("material", old_type, new_type) - materialProperties.material= new_type + function updateMaterialType (old_type, new_type) + { + base.setMetaDataEntry("material", old_type, new_type); + materialProperties.material= new_type; } // update the brand of the material - function updateMaterialBrand (old_brand, new_brand) { - base.setMetaDataEntry("brand", old_brand, new_brand) - materialProperties.brand = new_brand + function updateMaterialBrand (old_brand, new_brand) + { + base.setMetaDataEntry("brand", old_brand, new_brand); + materialProperties.brand = new_brand; } }