mirror of
https://github.com/kaosat-dev/Blender_bevy_components_workflow.git
synced 2024-12-23 16:14:10 +00:00
006e3c16f7
* added Asset propertygroup & User Assets collections to collections & scenes to store them explicitely * overhauled UI to make use of this : also means names & paths are editable after the fact * overhauled testing asset hierarchy scan accordingly * added expertimental export of bevy_asset_loader compatible asset.ron files per level * related tweaks & additions
30 lines
1.1 KiB
Python
30 lines
1.1 KiB
Python
import json
|
|
|
|
def get_user_assets(scene_or_collection):
|
|
user_assets = getattr(scene_or_collection, 'user_assets', [])
|
|
return user_assets
|
|
|
|
def get_generated_assets(scene_or_collection):
|
|
generated_assets = []
|
|
return generated_assets
|
|
|
|
def get_user_assets_as_list(scene_or_collection):
|
|
raw = get_user_assets(scene_or_collection)
|
|
result = []
|
|
for asset in raw:
|
|
result.append({"name": asset.name, "path": asset.path, "type": "MODEL", "internal": False, "parent": None})
|
|
return result
|
|
|
|
def upsert_asset(scene_or_collection, asset):
|
|
new_asset = scene_or_collection.user_assets.add()
|
|
new_asset.name = asset["name"]
|
|
new_asset.path = asset["path"]
|
|
|
|
def remove_asset(scene_or_collection, asset):
|
|
scene_or_collection.user_assets.remove(scene_or_collection.user_assets.find(asset["path"]))
|
|
|
|
def does_asset_exist(scene_or_collection, ref_asset):
|
|
user_assets = getattr(scene_or_collection, 'user_assets', [])
|
|
in_list = [asset for asset in user_assets if (asset.path == ref_asset["path"])]
|
|
in_list = len(in_list) > 0
|
|
return in_list |