Procedural Prefabs - Add mesh modifier support (#5894)

* Clean up error output

Signed-off-by: amzn-mike <80125227+amzn-mike@users.noreply.github.com>

* Add mesh modifiers to scene_data.py

Add example usage of modifiers to scene_mesh_to_prefab.py

Signed-off-by: amzn-mike <80125227+amzn-mike@users.noreply.github.com>

* Add type hints, cleanup dict creation, fix variable naming

Signed-off-by: amzn-mike <80125227+amzn-mike@users.noreply.github.com>

* Add documentation

Signed-off-by: amzn-mike <80125227+amzn-mike@users.noreply.github.com>

* Rename DefaultOrValue to __default_or_value

Signed-off-by: amzn-mike <80125227+amzn-mike@users.noreply.github.com>
This commit is contained in:
amzn-mike
2021-11-30 15:44:20 -06:00
committed by GitHub
parent b3bf02a4d5
commit b7f051fb9a
2 changed files with 164 additions and 24 deletions
@@ -5,7 +5,7 @@
# SPDX-License-Identifier: Apache-2.0 OR MIT
#
#
import os, traceback, binascii, sys, json, pathlib
import os, traceback, binascii, sys, json, pathlib, logging
import azlmbr.math
import azlmbr.bus
@@ -15,9 +15,9 @@ import azlmbr.bus
def log_exception_traceback():
exc_type, exc_value, exc_tb = sys.exc_info()
data = traceback.format_exception(exc_type, exc_value, exc_tb)
print(str(data))
data = traceback.format_exc()
logger = logging.getLogger('python')
logger.error(data)
def get_mesh_node_names(sceneGraph):
import azlmbr.scene as sceneApi
@@ -114,12 +114,18 @@ def update_manifest(scene):
mesh_group['id'] = '{' + str(uuid.uuid5(uuid.NAMESPACE_DNS, source_filename_only + mesh_path)) + '}'
# Set our current node as the only node that is included in this MeshGroup
scene_manifest.mesh_group_select_node(mesh_group, mesh_path)
scene_manifest.mesh_group_add_comment(mesh_group, "Hello World")
# Explicitly remove all other nodes to prevent implicit inclusions
for node in all_node_paths:
if node != mesh_path:
scene_manifest.mesh_group_unselect_node(mesh_group, node)
scene_manifest.mesh_group_add_cloth_rule(mesh_group, mesh_path, "Col0", 1, "Col0", 2, "Col0", 2, 3)
scene_manifest.mesh_group_add_advanced_mesh_rule(mesh_group, True, False, True, "Col0")
scene_manifest.mesh_group_add_skin_rule(mesh_group, 3, 0.002)
scene_manifest.mesh_group_add_tangent_rule(mesh_group, 1, 0)
# Create an editor entity
entity_id = azlmbr.entity.EntityUtilityBus(azlmbr.bus.Broadcast, "CreateEditorReadyEntity", mesh_group_name)
# Add an EditorMeshComponent to the entity