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
|
- [ ] rename project to Blenvy
|
||||||
- [ ] replace all references to the old 2 add-ons with those to Blenvy
|
- [ ] replace all references to the old 2 add-ons with those to Blenvy
|
||||||
- [ ] rename repo 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:
|
- [ ] 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
|
- [ ] remove/replace bevy editor pls with some native ui to display hierarchies
|
||||||
- [ ] switch to bevy rc2
|
|
||||||
|
|
||||||
- [ ] simplify examples:
|
- [ ] simplify examples:
|
||||||
- [ ] a full fledged demo (including physics & co)
|
- [ ] 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
|
temp_root_collection = temp_scene.collection
|
||||||
|
|
||||||
print("additional_dataAAAAAAAAAAAAAAAH", additional_data)
|
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
|
if additional_data is not None: # FIXME not a fan of having this here
|
||||||
for entry in dict(additional_data):
|
for entry in dict(additional_data):
|
||||||
print("entry in additional data", entry)
|
# we copy everything over except those on the black list
|
||||||
if entry == "local_assets":
|
if entry not in properties_black_list:
|
||||||
temp_scene["local_assets"] = additional_data[entry] # this is for bevy 0.14
|
print("entry in additional data", entry, "value", additional_data[entry], "in", additional_data.name)
|
||||||
temp_root_collection["local_assets"] = additional_data[entry] # for previous bevy versions, remove when migration done
|
temp_scene[entry] = additional_data[entry]
|
||||||
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("'", '')})
|
|
||||||
|
|
||||||
# save active scene
|
# save active scene
|
||||||
active_scene = bpy.context.window.scene
|
active_scene = bpy.context.window.scene
|
||||||
|
@ -121,13 +111,13 @@ def clear_hollow_scene(temp_scene, original_root_collection):
|
||||||
def restore_original_names(collection):
|
def restore_original_names(collection):
|
||||||
if collection.name.endswith("____bak"):
|
if collection.name.endswith("____bak"):
|
||||||
collection.name = collection.name.replace("____bak", "")
|
collection.name = collection.name.replace("____bak", "")
|
||||||
for object in collection.objects:
|
for object in collection.all_objects:
|
||||||
if object.instance_type == 'COLLECTION':
|
"""if object.instance_type == 'COLLECTION':
|
||||||
if object.name.endswith("____bak"):
|
|
||||||
object.name = object.name.replace("____bak", "")
|
|
||||||
else:
|
|
||||||
if object.name.endswith("____bak"):
|
if object.name.endswith("____bak"):
|
||||||
object.name = object.name.replace("____bak", "")
|
object.name = object.name.replace("____bak", "")
|
||||||
|
else: """
|
||||||
|
if object.name.endswith("____bak"):
|
||||||
|
object.name = object.name.replace("____bak", "")
|
||||||
for child_collection in collection.children:
|
for child_collection in collection.children:
|
||||||
restore_original_names(child_collection)
|
restore_original_names(child_collection)
|
||||||
|
|
||||||
|
|
|
@ -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
|
# 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):
|
def upsert_scene_components(main_scenes):
|
||||||
for scene in 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)
|
lighting_components = bpy.data.objects.get(lighting_components_name, None)
|
||||||
if not lighting_components:
|
if not lighting_components:
|
||||||
root_collection = scene.collection
|
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:
|
"""if scene.world is not None:
|
||||||
lighting_components['BlenderBackgroundShader'] = ambient_color_to_component(scene.world)
|
lighting_components['BlenderBackgroundShader'] = ambient_color_to_component(scene.world)""" # FIXME add back
|
||||||
lighting_components['BlenderShadowSettings'] = scene_shadows_to_component(scene)
|
scene['BlenderShadowSettings'] = scene_shadows_to_component(scene)
|
||||||
|
|
||||||
if scene.eevee.use_bloom:
|
if scene.eevee.use_bloom:
|
||||||
lighting_components['BloomSettings'] = scene_bloom_to_component(scene)
|
scene['BloomSettings'] = scene_bloom_to_component(scene)
|
||||||
elif 'BloomSettings' in lighting_components:
|
elif 'BloomSettings' in scene:
|
||||||
del lighting_components['BloomSettings']
|
del scene['BloomSettings']
|
||||||
|
|
||||||
if scene.eevee.use_gtao:
|
if scene.eevee.use_gtao:
|
||||||
lighting_components['SSAOSettings'] = scene_ao_to_component(scene)
|
scene['SSAOSettings'] = scene_ao_to_component(scene)
|
||||||
elif 'SSAOSettings' in lighting_components:
|
elif 'SSAOSettings' in scene:
|
||||||
del lighting_components['SSAOSettings']
|
del scene['SSAOSettings']
|
||||||
|
|
||||||
def remove_scene_components(main_scenes):
|
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_name = f"lighting_components_{scene.name}"
|
||||||
lighting_components = bpy.data.objects.get(lighting_components_name, None)
|
lighting_components = bpy.data.objects.get(lighting_components_name, None)
|
||||||
if lighting_components:
|
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):
|
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:
|
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})"
|
component = f"( color: {colorRgba}, strength: {strength})"
|
||||||
return component
|
return component
|
||||||
return None
|
return None
|
||||||
|
|
Loading…
Reference in New Issue