Skip to content

Commit

Permalink
Fix script line size exceeding 2048, fix missing colection pane
Browse files Browse the repository at this point in the history
  • Loading branch information
vbousquet committed Aug 20, 2023
1 parent 03c5033 commit 640cd6e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
4 changes: 2 additions & 2 deletions addons/vpx_lightmapper/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -843,15 +843,15 @@ def draw(self, context):
col = context.collection
bake_col = vlm_collections.get_collection(context.scene.collection, 'VLM.Bake', create=False)
light_col = vlm_collections.get_collection(context.scene.collection, 'VLM.Lights', create=False)
if col.name in bake_col.children:
if bake_col and col.name in bake_col.children:
layout.prop(col.vlmSettings, 'bake_mode', expand=True)
layout.prop(col.vlmSettings, 'depth_bias', expand=True)
layout.prop(col.vlmSettings, 'is_opaque', expand=True)
sub = layout.column()
sub.enabled = not col.vlmSettings.is_opaque
sub.prop(col.vlmSettings, 'refraction_probe', expand=True)
layout.prop(col.vlmSettings, 'reflection_probe', expand=True)
elif col.name in light_col.children:
elif light_col and col.name in light_col.children:
layout.prop(col.vlmSettings, 'light_mode', expand=True)
layout.prop(col.vlmSettings, 'world', expand=True)
else:
Expand Down
12 changes: 11 additions & 1 deletion addons/vpx_lightmapper/vlm_export.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,17 @@ def get_vpx_sync_light(obj, context, light_col):


def push_map_array(prefix, name, parts):
return f'Dim {prefix}_{name}: {prefix}_{name}=Array(' + ', '.join([f'{elem_ref(export_name(obj.name))}' for obj in parts]) + ')\n'
code = f'Dim {prefix}_{name}: {prefix}_{name}=Array('
line_start = 0
for i, obj in enumerate(parts):
if i>0: code += ', '
name = elem_ref(export_name(obj.name))
if len(code) + len(name) - line_start >= 1024: # VBS maximum line length is 2048
code += "_\n\t"
line_start = len(code)
code += name
code += ')\n'
return code


def get_script_arrays(result_col):
Expand Down

0 comments on commit 640cd6e

Please sign in to comment.