@dan rathbun said:
@richmorin said:
I have a bunch of configuration data that I want to serialize, write to a file, and have my plugin load.
Suggestions, anyone?
The 3rd, option is to use the Sketchup.write_defaultand Sketchup.read_defaultmethods to store your plugin options in the Windows Registry (win32) or Plist file (Mac).
Con here is that your options must be 'flatfile' data. No multi-level data is allowed.
Actually not entirely true.
You can set up the text fields of your attributes anyway you wish, since it's your plugin that will use them.
If it's easier, and faster for loading.. you can have 'array' fields.
ie, a single attribute value can actually be a CSV list of multiple values. (You can use whatever delimiter you wish, not just comma.)
del = '%' # delimiter
valListString = arrayOfValues.join(del)
# then assign valListString to attribute value
# reading is opposite
# assign attribute value to valListString
arrayOfValues = valListString.split(del)
# you'd need to iterate the array and convert
# any number strings to numerics
# see the Sketchup extenstion String.to_l
Sketchup extenstion String.to_l