From 74b3df5f99ceba7e13e55715146ee45714772b29 Mon Sep 17 00:00:00 2001 From: Olivier Charvin Date: Mon, 16 Oct 2023 12:14:07 +0200 Subject: [PATCH] Add support for IES lights Add support for tracing `.ies` files referenced by lights. Reviewed-on: https://projects.blender.org/blender/blender-asset-tracer/pulls/92883 --- CHANGELOG.md | 1 + blender_asset_tracer/trace/blocks2assets.py | 15 +++++++++++++++ 2 files changed, 16 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ae5d96d..93be45a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ changed functionality, fixed bugs). # Version 1.16 (in development) - Add `BlendFileBlock.raw_data()` and `.as_string()` functions. These functions interpret the data in a `BlendFileBlock` as either `bytes` or `string`. This can be used to obtain the contents of a `char*` (instead of the more common embedded `char[N]` array). +- Add support for IES lights ([#92883](https://projects.blender.org/blender/blender-asset-tracer/pulls/92883)). # Version 1.15 (2022-12-16) diff --git a/blender_asset_tracer/trace/blocks2assets.py b/blender_asset_tracer/trace/blocks2assets.py index 962f82a..98ab395 100644 --- a/blender_asset_tracer/trace/blocks2assets.py +++ b/blender_asset_tracer/trace/blocks2assets.py @@ -213,3 +213,18 @@ def vector_font(block: blendfile.BlendFileBlock) -> typing.Iterator[result.Block if path == b"": # builtin font return yield result.BlockUsage(block, path, path_full_field=field) + + +@dna_code("LA") +@skip_packed +def lamp(block: blendfile.BlendFileBlock) -> typing.Iterator[result.BlockUsage]: + """Lamp data blocks.""" + block_ntree = block.get_pointer(b"nodetree", None) + if block_ntree is None: + return + for node in iterators.listbase(block_ntree.get_pointer((b"nodes", b"first"))): + storage = node.get_pointer(b"storage") + if not storage: + continue + path, field = storage.get(b"filepath", return_field=True) + yield result.BlockUsage(block, path, path_full_field=field)