mirror of
https://github.com/kaosat-dev/Blender_bevy_components_workflow.git
synced 2024-11-23 04:10:53 +00:00
14 lines
436 B
Python
14 lines
436 B
Python
|
import json
|
||
|
import bpy
|
||
|
|
||
|
def upsert_settings(name, data):
|
||
|
stored_settings = bpy.data.texts[name] if name in bpy.data.texts else bpy.data.texts.new(name)
|
||
|
stored_settings.clear()
|
||
|
stored_settings.write(json.dumps(data))
|
||
|
|
||
|
def load_settings(name):
|
||
|
stored_settings = bpy.data.texts[name] if name in bpy.data.texts else None
|
||
|
if stored_settings != None:
|
||
|
return json.loads(stored_settings.as_string())
|
||
|
return None
|