Added a magic token to ensure only plugin data can be parsed from the clipboard

This commit is contained in:
2025-03-20 15:25:39 +01:00
parent 18f75eed25
commit e65d6d8a75
2 changed files with 22 additions and 6 deletions
+18 -1
View File
@@ -1,8 +1,25 @@
import bpy
import json
from copy import copy
from os.path import abspath
from pprint import pprint
import bpy
format_token = "#FMT:NODE_KIT#"
def dump_nkit_format(data: str) -> str:
return format_token + json.dumps(data)
def parse_nkit_format(data: str) -> str | None:
if data.startswith(format_token):
print(data[len(format_token):])
return json.loads(data[len(format_token):])
return None
def get_default(prop: bpy.types.Property):
"""Get the default value of a Blender property"""