Page MenuHome

Saving Cloth Preset gives error due to old code in presets.py
Closed, ResolvedPublic

Description

System Information
OSX 10.11.6
Interl Iris Pro

Blender Version
2.80 #60b930af3e73

Adding a new preset for Cloth in 2.80 results in an error. I find old settings in the preset.py file.
See error below;

Traceback (most recent call last):
  File "/Applications/blender-2.80.0-git20181226.60b930af3e73-x86_64/blender.app/Contents/Resources/2.80/scripts/startup/bl_operators/presets.py", line 161, in execute
    value = eval(rna_path)
  File "<string>", line 1, in <module>
AttributeError: 'ClothSettings' object has no attribute 'spring_damping'

location: <unknown location>:-1

1 Add plane and subdevide

  1. Add cloth and do any changes
  2. Now save this as a preset

PS
This means no presets can be saved. I had made a couple and now after checking them, they are empty
While some do contain some settings.

After checking the preset files in > Presets > Cloth > i also see "spring_damping", so these are also wrong

My guess the save preset files needs to be adjusted to the settings, they need to be added "AddPresetCloth" Operator

class AddPresetCloth(AddPresetBase, Operator):
    """Add or remove a Cloth Preset"""
    bl_idname = "cloth.preset_add"
    bl_label = "Add Cloth Preset"
    preset_menu = "CLOTH_PT_presets"

    preset_defines = [
        "cloth = bpy.context.cloth"
    ]

    preset_values = [
        "cloth.settings.air_damping",
        "cloth.settings.bending_stiffness",
        "cloth.settings.mass",
        "cloth.settings.quality",
        "cloth.settings.spring_damping",
        "cloth.settings.structural_stiffness",
    ]

    preset_subdir = "cloth"

Event Timeline

After adjust "presets.py" in startup > operators > presets.py presets now save without errors.

This is adjust operator, with the new values

class AddPresetCloth(AddPresetBase, Operator):
    """Add or remove a Cloth Preset"""
    bl_idname = "cloth.preset_add"
    bl_label = "Add Cloth Preset"
    preset_menu = "CLOTH_PT_presets"

    preset_defines = [
        "cloth = bpy.context.cloth"
    ]

    preset_values = [
        "cloth.settings.quality",
        "cloth.settings.mass",
        "cloth.settings.air_damping",
        "cloth.settings.bending_model",
        "cloth.settings.tension_stiffness",
        "cloth.settings.shear_stiffness",
        "cloth.settings.bending_stiffness",
        "cloth.settings.tension_damping",
        "cloth.settings.shear_damping",
        "cloth.settings.bending_damping",
    ]

    preset_subdir = "cloth"

I was checking the presets files and noticed in the #60b930af3e73 the presets have the new values. Yet they dont have the setting "setting.bending_model"

This means "setting.compression_stiffness" also needs to be added to presets.py in startup > operators > presets.py

Philipp Oeser (lichtwerk) triaged this task as Confirmed, Medium priority.Dec 28 2018, 9:38 AM
Philipp Oeser (lichtwerk) claimed this task.

@Rombout Versluijs (rombout): thx for the heads up, will check shortly...