mirror of
https://github.com/kaosat-dev/Blender_bevy_components_workflow.git
synced 2024-11-22 11:50:53 +00:00
feat(Blenvy): overhauled pieces of export to make use of Bevy 0.14 upgrade
* aka we have scene_gltf_extras, no more need for cumbersome xxx_components objects ! * still wip
This commit is contained in:
parent
00bf600ccf
commit
8b4bb473dc
@ -156,12 +156,16 @@ General issues:
|
||||
- [ ] rename project to Blenvy
|
||||
- [ ] replace all references to the old 2 add-ons with those to Blenvy
|
||||
- [ ] rename repo to "Blenvy"
|
||||
- [x] switch to bevy 0.14 rc2
|
||||
- [ ] find a solution for the new color handling
|
||||
- [ ] add back lighting_components
|
||||
- [ ] check if scene components are being deleted through our scene re-orgs in the spawn post process
|
||||
|
||||
|
||||
- [ ] simplify testing example:
|
||||
- [ ] remove use of rapier physics (or even the whole common boilerplate ?)
|
||||
- [x] remove use of rapier physics (or even the whole common boilerplate ?)
|
||||
- [ ] remove/replace bevy editor pls with some native ui to display hierarchies
|
||||
- [ ] switch to bevy rc2
|
||||
|
||||
|
||||
- [ ] simplify examples:
|
||||
- [ ] a full fledged demo (including physics & co)
|
||||
|
@ -20,23 +20,13 @@ def generate_temporary_scene_and_export(settings, gltf_export_settings, gltf_out
|
||||
temp_root_collection = temp_scene.collection
|
||||
|
||||
print("additional_dataAAAAAAAAAAAAAAAH", additional_data)
|
||||
properties_black_list = ['user_assets', 'components_meta']
|
||||
if additional_data is not None: # FIXME not a fan of having this here
|
||||
for entry in dict(additional_data):
|
||||
print("entry in additional data", entry)
|
||||
if entry == "local_assets":
|
||||
temp_scene["local_assets"] = additional_data[entry] # this is for bevy 0.14
|
||||
temp_root_collection["local_assets"] = additional_data[entry] # for previous bevy versions, remove when migration done
|
||||
bla = "[(name: \"test_asset\", path: \"audio/fake.mp3\")]"
|
||||
local_assets = additional_data.get(entry, [])
|
||||
local_assets = [entry for entry in local_assets]
|
||||
add_scene_property(temp_scene, 'assets_components', {"LocalAssets": f"LocalAssets({local_assets})".replace("'", '')})
|
||||
|
||||
if entry == entry == "AllAssets":
|
||||
temp_scene["AllAssets"] = additional_data[entry]
|
||||
temp_root_collection["AllAssets"] = additional_data[entry] # for previous bevy versions, remove when migration done
|
||||
all_assets = additional_data.get(entry, [])
|
||||
all_assets = [entry for entry in all_assets]
|
||||
add_scene_property(temp_scene, 'assets_components', {"AllAssets": f"AllAssets({all_assets})".replace("'", '')})
|
||||
# we copy everything over except those on the black list
|
||||
if entry not in properties_black_list:
|
||||
print("entry in additional data", entry, "value", additional_data[entry], "in", additional_data.name)
|
||||
temp_scene[entry] = additional_data[entry]
|
||||
|
||||
# save active scene
|
||||
active_scene = bpy.context.window.scene
|
||||
@ -121,11 +111,11 @@ def clear_hollow_scene(temp_scene, original_root_collection):
|
||||
def restore_original_names(collection):
|
||||
if collection.name.endswith("____bak"):
|
||||
collection.name = collection.name.replace("____bak", "")
|
||||
for object in collection.objects:
|
||||
if object.instance_type == 'COLLECTION':
|
||||
for object in collection.all_objects:
|
||||
"""if object.instance_type == 'COLLECTION':
|
||||
if object.name.endswith("____bak"):
|
||||
object.name = object.name.replace("____bak", "")
|
||||
else:
|
||||
else: """
|
||||
if object.name.endswith("____bak"):
|
||||
object.name = object.name.replace("____bak", "")
|
||||
for child_collection in collection.children:
|
||||
|
@ -5,32 +5,33 @@ from blenvy.core.object_makers import make_empty
|
||||
# TODO: replace this with placing scene level custom properties once support for that has been added to bevy_gltf
|
||||
def upsert_scene_components(main_scenes):
|
||||
for scene in main_scenes:
|
||||
lighting_components_name = f"lighting_components_{scene.name}"
|
||||
"""lighting_components_name = f"lighting_components_{scene.name}"
|
||||
lighting_components = bpy.data.objects.get(lighting_components_name, None)
|
||||
if not lighting_components:
|
||||
root_collection = scene.collection
|
||||
lighting_components = make_empty('lighting_components_'+scene.name, [0,0,0], [0,0,0], [0,0,0], root_collection)
|
||||
lighting_components = make_empty('lighting_components_'+scene.name, [0,0,0], [0,0,0], [0,0,0], root_collection)"""
|
||||
|
||||
if scene.world is not None:
|
||||
lighting_components['BlenderBackgroundShader'] = ambient_color_to_component(scene.world)
|
||||
lighting_components['BlenderShadowSettings'] = scene_shadows_to_component(scene)
|
||||
"""if scene.world is not None:
|
||||
lighting_components['BlenderBackgroundShader'] = ambient_color_to_component(scene.world)""" # FIXME add back
|
||||
scene['BlenderShadowSettings'] = scene_shadows_to_component(scene)
|
||||
|
||||
if scene.eevee.use_bloom:
|
||||
lighting_components['BloomSettings'] = scene_bloom_to_component(scene)
|
||||
elif 'BloomSettings' in lighting_components:
|
||||
del lighting_components['BloomSettings']
|
||||
scene['BloomSettings'] = scene_bloom_to_component(scene)
|
||||
elif 'BloomSettings' in scene:
|
||||
del scene['BloomSettings']
|
||||
|
||||
if scene.eevee.use_gtao:
|
||||
lighting_components['SSAOSettings'] = scene_ao_to_component(scene)
|
||||
elif 'SSAOSettings' in lighting_components:
|
||||
del lighting_components['SSAOSettings']
|
||||
scene['SSAOSettings'] = scene_ao_to_component(scene)
|
||||
elif 'SSAOSettings' in scene:
|
||||
del scene['SSAOSettings']
|
||||
|
||||
def remove_scene_components(main_scenes):
|
||||
for scene in main_scenes:
|
||||
pass
|
||||
"""for scene in main_scenes:
|
||||
lighting_components_name = f"lighting_components_{scene.name}"
|
||||
lighting_components = bpy.data.objects.get(lighting_components_name, None)
|
||||
if lighting_components:
|
||||
bpy.data.objects.remove(lighting_components, do_unlink=True)
|
||||
bpy.data.objects.remove(lighting_components, do_unlink=True)"""
|
||||
|
||||
|
||||
def ambient_color_to_component(world):
|
||||
@ -44,7 +45,7 @@ def ambient_color_to_component(world):
|
||||
|
||||
|
||||
if color is not None and strength is not None:
|
||||
colorRgba = f"Rgba(red: {color[0]}, green: {color[1]}, blue: {color[2]}, alpha: {color[3]})"
|
||||
colorRgba = f"LinearRgba(red: {color[0]}, green: {color[1]}, blue: {color[2]}, alpha: {color[3]})"
|
||||
component = f"( color: {colorRgba}, strength: {strength})"
|
||||
return component
|
||||
return None
|
||||
|
Loading…
Reference in New Issue
Block a user