Page MenuHome

Game Engine Publishing | Assets paths listing upgrade
Needs ReviewPublic

Authored by Oren Titane (Genome36) on Aug 7 2014, 8:47 PM.

Details

Reviewers
Mitchell Stokes (moguri)
Group Reviewers
Game Engine
Summary

This revision introduces a new method of importing assets to be included into the game package. By adding the constructor "bpy_extras.io_utils.ImportHelper" to the "class PublishAddAssetPath(bpy.types.Operator)" we benefit of a custom file importer that can be modified to suite our needs. This upgrade let's us import a list of assets files all at once instead of adding a field and setting the path manually.

Diff Detail

Event Timeline

Oren Titane (Genome36) retitled this revision from to Game Engine Publishing | Assets paths listing upgrade.
Oren Titane (Genome36) updated this object.
Mitchell Stokes (moguri) requested changes to this revision.Aug 15 2014, 6:00 AM
Mitchell Stokes (moguri) edited edge metadata.

In general, the execute function could be cleaned up quite a bit:

def execute(self, context):
    for file in self.files:
        asset = context.scene.ge_publish_settings.asset_paths.add()
        path = os.path.join(self.directory, file.name)

        if context.user_preferences.filepaths.use_relative_paths:
            asset.name = bpy.path.relpath(path)
        else:
            asset.name = bpy.path.abspath(path)

        self.report({'INFO'}, "Asset path: %s" % asset.name)
game_engine_publishing.py
445

This could be outside of the if, and just display asset.name.

This revision now requires changes to proceed.Aug 15 2014, 6:00 AM
Oren Titane (Genome36) set the repository for this revision to rBA Blender Add-ons.Aug 9 2015, 9:26 PM
Oren Titane (Genome36) edited edge metadata.

Simplified source relpath / abspath.