Import_3ds: Improved aspect calculation #104815
@ -1578,11 +1578,12 @@ def save(operator, context, filepath="", scale_factor=1.0, use_scene_unit=False,
|
|||||||
background_color_chunk = _3ds_chunk(RGB)
|
background_color_chunk = _3ds_chunk(RGB)
|
||||||
background_chunk = _3ds_chunk(SOLIDBACKGND)
|
background_chunk = _3ds_chunk(SOLIDBACKGND)
|
||||||
background_flag = _3ds_chunk(USE_SOLIDBGND)
|
background_flag = _3ds_chunk(USE_SOLIDBGND)
|
||||||
bgshader = 'ADD_SHADER', 'MIX_SHADER', 'OUTPUT_WORLD'
|
bgtype = 'BACKGROUND'
|
||||||
bgtexture = 'TEX_IMAGE', 'TEX_ENVIRONMENT'
|
bgshade = 'ADD_SHADER', 'MIX_SHADER', 'OUTPUT_WORLD'
|
||||||
acol, bcol = 'EMISSION', 'BACKGROUND'
|
bg_tex = 'TEX_IMAGE', 'TEX_ENVIRONMENT'
|
||||||
bg_color = next((lk.from_node.inputs[0].default_value[:3] for lk in ntree if lk.from_node.type == bcol and lk.to_node.type in bgshader), world.color)
|
bg_color = next((lk.from_node.inputs[0].default_value[:3] for lk in ntree if lk.from_node.type == bgtype and lk.to_node.type in bgshade), world.color)
|
||||||
bg_image = next((lk.from_node.image.name for lk in ntree if lk.from_node.type in bgtexture and lk.to_node.type in {acol, bcol}), False)
|
bg_mixer = next((lk.from_node.type for lk in ntree if lk.from_node.type in {'MIX', 'MIX_RGB'} and lk.to_node.type == bgtype), bgtype)
|
||||||
|
bg_image = next((lk.from_node.image.name for lk in ntree if lk.from_node.type in bg_tex and lk.to_node.type == bg_mixer), False)
|
||||||
background_color_chunk.add_variable("color", _3ds_float_color(bg_color))
|
background_color_chunk.add_variable("color", _3ds_float_color(bg_color))
|
||||||
background_chunk.add_subchunk(background_color_chunk)
|
background_chunk.add_subchunk(background_color_chunk)
|
||||||
if bg_image:
|
if bg_image:
|
||||||
|
@ -735,11 +735,17 @@ def process_next_chunk(context, file, previous_chunk, imported_objects, CONSTRAI
|
|||||||
contextWorld.use_nodes = True
|
contextWorld.use_nodes = True
|
||||||
links = contextWorld.node_tree.links
|
links = contextWorld.node_tree.links
|
||||||
nodes = contextWorld.node_tree.nodes
|
nodes = contextWorld.node_tree.nodes
|
||||||
|
bitmap_mix = nodes.new(type='ShaderNodeMixRGB')
|
||||||
bitmapnode = nodes.new(type='ShaderNodeTexEnvironment')
|
bitmapnode = nodes.new(type='ShaderNodeTexEnvironment')
|
||||||
|
bitmap_mix.label = "Solid Color"
|
||||||
bitmapnode.label = bitmap_name
|
bitmapnode.label = bitmap_name
|
||||||
|
bitmap_mix.location = (-250, 300)
|
||||||
bitmapnode.location = (-300, 300)
|
bitmapnode.location = (-300, 300)
|
||||||
|
bitmap_mix.inputs[2].default_value = nodes['Background'].inputs[0].default_value
|
||||||
bitmapnode.image = load_image(bitmap_name, dirname, place_holder=False, recursive=IMAGE_SEARCH, check_existing=True)
|
bitmapnode.image = load_image(bitmap_name, dirname, place_holder=False, recursive=IMAGE_SEARCH, check_existing=True)
|
||||||
links.new(bitmapnode.outputs['Color'], nodes['Background'].inputs[0])
|
bitmap_mix.inputs[0].default_value = 0.0 if bitmapnode.image is not None else 1.0
|
||||||
|
links.new(bitmap_mix.outputs['Color'], nodes['Background'].inputs[0])
|
||||||
|
links.new(bitmapnode.outputs['Color'], bitmap_mix.inputs[1])
|
||||||
new_chunk.bytes_read += read_str_len
|
new_chunk.bytes_read += read_str_len
|
||||||
|
|
||||||
# If fog chunk
|
# If fog chunk
|
||||||
|
Loading…
Reference in New Issue
Block a user