1
$\begingroup$

I want to write a program that can write a json file that record values for cloth simulation setting and read the json file.

For example, when I finish a good cloth simulation, I can export a json file that contains all the values assigned in quality, mass, air and sprint etc.

Or when I load the json file, blender assign 3 to air_damping in ClothSettings if "air_damping":3 is read. If there is no "mass" key in the json, blender use the default mass value or the assigned value in blender.

$\endgroup$
1
$\begingroup$

OK, I am silly.... setattr(settings, "mass", 0.5) makes it......

$\endgroup$
  • 1
    $\begingroup$ If settings is a blender ClothSettings instance could also use settings.mass = 0.5 ... which is IMO more readable, I'd use set attribute when you have key, value pairs setattr(settings, key, value) $\endgroup$ – batFINGER Mar 16 '18 at 6:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.