Add support for Location objects in converter syntax

This commit is contained in:
Ben 2019-10-09 01:06:52 +01:00
parent 361bcced50
commit 993ab2ba69

View File

@ -295,6 +295,17 @@ class FlooringConverter(IConverter):
return None return None
class LocationConverter(IConverter):
description = """Converts a location ID into a houdini.data.Location instance"""
async def convert(self, ctx):
location_id = int(ctx.argument)
if location_id in ctx.p.server.locations:
return await ctx.p.server.locations.get(location_id)
return None
class StampConverter(IConverter): class StampConverter(IConverter):
description = """Converts a stamp ID into a houdini.data.Stamp instance""" description = """Converts a stamp ID into a houdini.data.Stamp instance"""
@ -396,6 +407,7 @@ ConverterTypes = {
Furniture: FurnitureConverter, Furniture: FurnitureConverter,
Igloo: IglooConverter, Igloo: IglooConverter,
Flooring: FlooringConverter, Flooring: FlooringConverter,
Location: LocationConverter,
Stamp: StampConverter Stamp: StampConverter
} }