Import_3ds: Improved aspect calculation #104815

Merged
Sebastian Sille merged 70 commits from :main into main 2023-08-03 17:59:45 +02:00
Showing only changes of commit 90c5f4aead - Show all commits

View File

@ -704,9 +704,9 @@ def process_next_chunk(context, file, previous_chunk, imported_objects, CONSTRAI
else: else:
contextWorld.use_nodes = True contextWorld.use_nodes = True
read_chunk(file, temp_chunk) read_chunk(file, temp_chunk)
if temp_chunk.ID == RGB: if temp_chunk.ID == COLOR_F:
contextWorld.node_tree.nodes['Background'].inputs[0].default_value[:3] = read_float_array(temp_chunk) contextWorld.node_tree.nodes['Background'].inputs[0].default_value[:3] = read_float_array(temp_chunk)
elif temp_chunk.ID == RGBF: elif temp_chunk.ID == LIN_COLOR_F:
contextWorld.node_tree.nodes['Background'].inputs[0].default_value[:3] = read_float_array(temp_chunk) contextWorld.node_tree.nodes['Background'].inputs[0].default_value[:3] = read_float_array(temp_chunk)
else: skip_to_end(file, temp_chunk) else: skip_to_end(file, temp_chunk)
new_chunk.bytes_read += temp_chunk.bytes_read new_chunk.bytes_read += temp_chunk.bytes_read
@ -730,6 +730,37 @@ def process_next_chunk(context, file, previous_chunk, imported_objects, CONSTRAI
links.new(bitmapnode.outputs['Color'], nodes['Background'].inputs[0]) links.new(bitmapnode.outputs['Color'], nodes['Background'].inputs[0])
new_chunk.bytes_read += read_str_len new_chunk.bytes_read += read_str_len
# If fog chunk
elif new_chunk.ID == LAYER_FOG:
if contextWorld is None:
path, filename = os.path.split(file.name)
realname, ext = os.path.splitext(filename)
contextWorld = bpy.data.worlds.new("LayerFog: " + realname)
context.scene.world = contextWorld
else:
contextWorld.use_nodes = True
links = newWorld.node_tree.links
nodes = newWorld.node_tree.nodes
context.view_layer.use_pass_mist = False
layerfog = nodes.new(type='ShaderNodeVolumeScatter')
layerfog.label = "Layer Fog"
layerfog.location = (300, 100)
links.new(layerfog.outputs['Volume'], nodes['World Output'].inputs['Volume'])
world.mist_settings.start = read_float(new_chunk)
world.mist_settings.depth = read_float(new_chunk)
layerfog.inputs[1].default_value = read_float(new_chunk)
layerfogflag = read_long(new_chunk)
read_chunk(file, temp_chunk)
if temp_chunk.ID == COLOR_F:
layerfog.inputs[0].default_value[:3] = read_float_array(temp_chunk)
elif temp_chunk.ID == LIN_COLOR_F:
layerfog.inputs[0].default_value[:3] = read_float_array(temp_chunk)
else:
skip_to_end(file, temp_chunk)
new_chunk.bytes_read += temp_chunk.bytes_read
elif new_chunk.ID == USE_LAYER_FOG:
context.view_layer.use_pass_mist = True
# is it an object info chunk? # is it an object info chunk?
elif new_chunk.ID == OBJECTINFO: elif new_chunk.ID == OBJECTINFO:
process_next_chunk(context, file, new_chunk, imported_objects, CONSTRAIN, process_next_chunk(context, file, new_chunk, imported_objects, CONSTRAIN,