Commit c01c6527 authored by Frank Bessou's avatar Frank Bessou

Improve altimetry mesh visualisation panel

We display the opacities in the reverse order and extract them in their
own panel. We also extract the height map range in its own panel.
The height map color gradient also get its panel.
parent 4339fc4fd68
Pipeline #9510 passed with stage
in 1 minute and 45 seconds
......@@ -244,8 +244,7 @@ def _create_altimetry_material(image):
mat_wrapper = ShaderNodeLayersWrapper(material, base_color.outputs[0])
height_color_out = tu.create_height_gradient_node(node_tree,
"height_map_range")
height_color_out = tu.create_height_gradient_node(node_tree, "height_map")
mat_wrapper.add_layer("height", height_color_out, initial_opacity=1)
img_color_out, img_alpha_out = tu.create_image_texture_node(
......
......@@ -144,7 +144,7 @@ def create_image_texture_node(node_tree, image):
return tex_image_node.outputs
def create_height_gradient_node(node_tree, mapping_node_name):
def create_height_gradient_node(node_tree, node_name_prefix):
nodes = node_tree.nodes
links = node_tree.links
......@@ -153,7 +153,7 @@ def create_height_gradient_node(node_tree, mapping_node_name):
links.new(sep_xyz.inputs[0], geometry_node.outputs[0])
map_range = nodes.new("ShaderNodeMapRange")
map_range.name = mapping_node_name
map_range.name = f"{node_name_prefix}_range"
map_range.inputs[1].default_value = 0 # From Min
map_range.inputs[2].default_value = 1000 # From Max
map_range.inputs[3].default_value = 0 # To Min
......@@ -161,6 +161,7 @@ def create_height_gradient_node(node_tree, mapping_node_name):
links.new(map_range.inputs[0], sep_xyz.outputs[2])
val_to_rgb = nodes.new("ShaderNodeValToRGB")
val_to_rgb.name = f"{node_name_prefix}_val_to_rgb"
color_ramp = val_to_rgb.color_ramp
# color_ramp.interpolation = "CARDINAL"
colors = color_ramp.elements
......
......@@ -94,40 +94,97 @@ class TYMPANPROPERTIES_PT_altimetry_mesh(Panel):
bl_options = {'HIDE_HEADER'}
def draw(self, context):
obj = context.object
layout = self.layout
material = obj.material_slots[0].material
layout.use_property_split = True
obj = context.object
row = layout.row(align=True)
row.prop(obj, "projected_image")
row.operator("blty.update_altimetry_projection",
text="",
icon="FILE_REFRESH")
@classmethod
def poll(cls, context):
obj = context.object
return obj and is_altimetry_mesh(obj)
class TYMPANPROPERTIES_PT_altimetry_mesh_layers_opacity(Panel):
bl_label = "Layers Opacity"
bl_parent_id = "TYMPANPROPERTIES_PT_altimetry_mesh"
bl_space_type = 'PROPERTIES'
bl_region_type = 'WINDOW'
bl_context = 'object'
def draw(self, context):
layout = self.layout
layout.use_property_decorate
layout.use_property_split = True
obj = context.object
material = obj.material_slots[0].material
# Grounds Projection
grounds_alpha_mult = material.node_tree.nodes["grounds"].inputs[0]
layout.prop(grounds_alpha_mult, "default_value",
text="Grounds")
# Reference Image Projection
image_alpha_mult = material.node_tree.nodes["image"].inputs[0]
layout.prop(image_alpha_mult, "default_value",
text="Texture")
# Height Map
col = layout.column(align=True)
image_alpha_mult = material.node_tree.nodes["height"].inputs[0]
col.prop(image_alpha_mult, "default_value",
text="Height Map Opacity")
height_map_range = material.node_tree.nodes["height_map_range"]
layout.prop(image_alpha_mult, "default_value",
text="Height Map")
class TYMPANPROPERTIES_PT_altimetry_mesh_height_map_range(Panel):
bl_label = "Height Map Range"
bl_parent_id = "TYMPANPROPERTIES_PT_altimetry_mesh"
bl_space_type = 'PROPERTIES'
bl_region_type = 'WINDOW'
bl_context = 'object'
bl_options = {'DEFAULT_CLOSED'}
def draw(self, context):
layout = self.layout
layout.use_property_split = True
obj = context.object
material = obj.material_slots[0].material
nodes = material.node_tree.nodes
height_map_range = nodes["height_map_range"]
col = layout.column(align=True)
col.prop(height_map_range.inputs[1], "default_value",
text="Min Height")
col.prop(height_map_range.inputs[2], "default_value",
text="Max Height")
# Reference Image Projection
image_alpha_mult = material.node_tree.nodes["image"].inputs[0]
layout.prop(image_alpha_mult, "default_value",
text="Texture Opacity")
# Grounds Projection
grounds_alpha_mult = material.node_tree.nodes["grounds"].inputs[0]
layout.prop(grounds_alpha_mult, "default_value",
text="Grounds Opacity")
class TYMPANPROPERTIES_PT_altimetry_mesh_height_map_gradient(Panel):
bl_label = "Height Map Gradient"
bl_parent_id = "TYMPANPROPERTIES_PT_altimetry_mesh"
bl_space_type = 'PROPERTIES'
bl_region_type = 'WINDOW'
bl_context = 'object'
bl_options = {'DEFAULT_CLOSED'}
def draw(self, context):
layout = self.layout
layout.use_property_split = True
layout.use_property_decorate = False
@classmethod
def poll(cls, context):
obj = context.object
return obj and is_altimetry_mesh(obj)
material = obj.material_slots[0].material
nodes = material.node_tree.nodes
height_map_val_to_rgb_node = nodes["height_map_val_to_rgb"]
layout.template_color_ramp(height_map_val_to_rgb_node, "color_ramp")
classes = (
......@@ -135,6 +192,9 @@ classes = (
TYMPANPROPERTIES_PT_level_curve,
TYMPANPROPERTIES_PT_ground_map,
TYMPANPROPERTIES_PT_altimetry_mesh,
TYMPANPROPERTIES_PT_altimetry_mesh_layers_opacity,
TYMPANPROPERTIES_PT_altimetry_mesh_height_map_range,
TYMPANPROPERTIES_PT_altimetry_mesh_height_map_gradient,
)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment