f44f06c9f0
* AssImp set to be the default FBX processor (#78) If you encounter issues, reach out to the Helios team with details, and then switch back to FBX SDK locally by changing FBXImporter.h * Merge pull request #219 from aws-lumberyard-dev/sceneapi_scripting LYN-3030: Fix to export_chunks_builder.py to match the AssImp node paths * Hide some automated test folders from the asset processor for automatedtesting. This is necessary because these assets should only be processed when running the test, and not any time AP is launched for this project. * Putting these test assets back to visible to Asset Processor. These tests need to be updated at some point to handle that, but they won't work with this change for now. Note that until this is addressed, these tests may randomly time out if they're the first tests run on a clean asset processor, and these tests launch AP without using a unique port, so the test can also fail if an Asset Processor executable is hanging open. Grabbed the change I missed from the 1.0 branch merge, no idea how this got lost. * Moved from main to periodic. Allen and Fuzzy were already on board, and I think with the potential flakiness in this test, we don't want this in main. Co-authored-by: jackalbe <23512001+jackalbe@users.noreply.github.com>
80 lines
3.1 KiB
Python
80 lines
3.1 KiB
Python
"""
|
|
All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
|
its licensors.
|
|
For complete copyright and license terms please see the LICENSE at the root of this
|
|
distribution (the "License"). All use of this software is governed by the License,
|
|
or, if provided, by the license below or the license accompanying this file. Do not
|
|
remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
"""
|
|
import uuid, os
|
|
import azlmbr.scene as sceneApi
|
|
import azlmbr.scene.graph
|
|
from scene_api import scene_data as sceneData
|
|
|
|
def get_mesh_node_names(sceneGraph):
|
|
meshDataList = []
|
|
node = sceneGraph.get_root()
|
|
children = []
|
|
|
|
while node.IsValid():
|
|
# store children to process after siblings
|
|
if sceneGraph.has_node_child(node):
|
|
children.append(sceneGraph.get_node_child(node))
|
|
|
|
# store any node that has mesh data content
|
|
nodeContent = sceneGraph.get_node_content(node)
|
|
if nodeContent is not None and nodeContent.CastWithTypeName('MeshData'):
|
|
if sceneGraph.is_node_end_point(node) is False:
|
|
nodeName = sceneData.SceneGraphName(sceneGraph.get_node_name(node))
|
|
nodePath = nodeName.get_path()
|
|
if (len(nodeName.get_path())):
|
|
meshDataList.append(sceneData.SceneGraphName(sceneGraph.get_node_name(node)))
|
|
|
|
# advance to next node
|
|
if sceneGraph.has_node_sibling(node):
|
|
node = sceneGraph.get_node_sibling(node)
|
|
elif children:
|
|
node = children.pop()
|
|
else:
|
|
node = azlmbr.scene.graph.NodeIndex()
|
|
|
|
return meshDataList
|
|
|
|
def update_manifest(scene):
|
|
graph = sceneData.SceneGraph(scene.graph)
|
|
meshNameList = get_mesh_node_names(graph)
|
|
sceneManifest = sceneData.SceneManifest()
|
|
sourceFilenameOnly = os.path.basename(scene.sourceFilename)
|
|
sourceFilenameOnly = sourceFilenameOnly.replace('.','_')
|
|
|
|
for activeMeshIndex in range(len(meshNameList)):
|
|
chunkName = meshNameList[activeMeshIndex]
|
|
chunkPath = chunkName.get_path()
|
|
meshGroupName = '{}_{}'.format(sourceFilenameOnly, chunkName.get_name())
|
|
meshGroup = sceneManifest.add_mesh_group(meshGroupName)
|
|
meshGroup['id'] = '{' + str(uuid.uuid5(uuid.NAMESPACE_DNS, sourceFilenameOnly + chunkPath)) + '}'
|
|
sceneManifest.mesh_group_add_comment(meshGroup, 'auto generated by scene manifest')
|
|
sceneManifest.mesh_group_add_advanced_coordinate_system(meshGroup, None, None, None, 1.0)
|
|
sceneManifest.mesh_group_select_node(meshGroup, chunkPath)
|
|
|
|
return sceneManifest.export()
|
|
|
|
mySceneJobHandler = None
|
|
|
|
def on_update_manifest(args):
|
|
scene = args[0]
|
|
result = update_manifest(scene)
|
|
global mySceneJobHandler
|
|
mySceneJobHandler.disconnect()
|
|
mySceneJobHandler = None
|
|
return result
|
|
|
|
def main():
|
|
global mySceneJobHandler
|
|
mySceneJobHandler = sceneApi.ScriptBuildingNotificationBusHandler()
|
|
mySceneJobHandler.connect()
|
|
mySceneJobHandler.add_callback('OnUpdateManifest', on_update_manifest)
|
|
|
|
if __name__ == "__main__":
|
|
main() |