refactor(properties): remove detail sections
This commit is contained in:
parent
de6f6c933b
commit
70f65270aa
1 changed files with 1 additions and 220 deletions
|
|
@ -11,40 +11,6 @@ use crate::t;
|
||||||
/// shows a count-only summary instead. Bulk edits still go through the ribbon.
|
/// shows a count-only summary instead. Bulk edits still go through the ribbon.
|
||||||
const MAX_PROP_AGGREGATE: usize = 2_000;
|
const MAX_PROP_AGGREGATE: usize = 2_000;
|
||||||
|
|
||||||
fn material_color_text(color: &acadrust::objects::MaterialColor) -> String {
|
|
||||||
let rgb = color
|
|
||||||
.rgb
|
|
||||||
.map(|value| format!("#{:06X}", value as u32 & 0x00ff_ffff))
|
|
||||||
.unwrap_or_else(|| "Object".to_string());
|
|
||||||
format!("{rgb}, factor {:.3}", color.factor)
|
|
||||||
}
|
|
||||||
|
|
||||||
fn material_map_text(map: &acadrust::objects::MaterialMap) -> String {
|
|
||||||
let source = match map.source {
|
|
||||||
1 => {
|
|
||||||
if map.file_name.trim().is_empty() {
|
|
||||||
"File".to_string()
|
|
||||||
} else {
|
|
||||||
map.file_name.clone()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
2 => format!(
|
|
||||||
"Procedural {:#?}",
|
|
||||||
map.texture
|
|
||||||
),
|
|
||||||
0 => "Scene".to_string(),
|
|
||||||
value => format!("Source {value}"),
|
|
||||||
};
|
|
||||||
format!(
|
|
||||||
"{source}; blend {:.3}; projection {}; tiling {}; auto {}; transform {:?}",
|
|
||||||
map.blend_factor,
|
|
||||||
map.projection,
|
|
||||||
map.tiling,
|
|
||||||
map.auto_transform,
|
|
||||||
map.transform
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
fn visual_style_properties_text(style: &acadrust::objects::VisualStyle) -> String {
|
fn visual_style_properties_text(style: &acadrust::objects::VisualStyle) -> String {
|
||||||
style
|
style
|
||||||
.properties
|
.properties
|
||||||
|
|
@ -392,21 +358,6 @@ impl OpenCADStudio {
|
||||||
let group_names = self.tabs[i].scene.group_names_for_entity(handle);
|
let group_names = self.tabs[i].scene.group_names_for_entity(handle);
|
||||||
let mut sections =
|
let mut sections =
|
||||||
dispatch::properties_sectioned(handle, entity, &text_style_names);
|
dispatch::properties_sectioned(handle, entity, &text_style_names);
|
||||||
sections.insert(
|
|
||||||
0,
|
|
||||||
crate::scene::model::object::PropSection {
|
|
||||||
title: t!("Coordinates").into_owned(),
|
|
||||||
props: vec![crate::entities::common::ro_prop(
|
|
||||||
t!("Coordinate system").as_ref(),
|
|
||||||
"coordinate_system",
|
|
||||||
self.tabs[i]
|
|
||||||
.active_ucs
|
|
||||||
.as_ref()
|
|
||||||
.map(|ucs| ucs.name.clone())
|
|
||||||
.unwrap_or_else(|| "WCS".to_string()),
|
|
||||||
)],
|
|
||||||
},
|
|
||||||
);
|
|
||||||
|
|
||||||
// Turn the Material row into an editable picker: the source
|
// Turn the Material row into an editable picker: the source
|
||||||
// options (ByLayer / ByBlock) plus every named material the
|
// options (ByLayer / ByBlock) plus every named material the
|
||||||
|
|
@ -450,161 +401,6 @@ impl OpenCADStudio {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let effective_handle = match common.material_flags {
|
|
||||||
3 => common.material_handle,
|
|
||||||
0 => doc
|
|
||||||
.layers
|
|
||||||
.get(&common.layer)
|
|
||||||
.map(|layer| layer.material)
|
|
||||||
.filter(|handle| handle.is_valid()),
|
|
||||||
_ => None,
|
|
||||||
};
|
|
||||||
if let Some(acadrust::objects::ObjectType::Material(material)) =
|
|
||||||
effective_handle.and_then(|handle| doc.objects.get(&handle))
|
|
||||||
{
|
|
||||||
use crate::entities::common::ro_prop;
|
|
||||||
sections.push(crate::scene::model::object::PropSection {
|
|
||||||
title: t!("Material Details").into_owned(),
|
|
||||||
props: vec![
|
|
||||||
ro_prop(t!("Name").as_ref(), "mat_name", material.name.clone()),
|
|
||||||
ro_prop(
|
|
||||||
t!("Description").as_ref(),
|
|
||||||
"mat_description",
|
|
||||||
material.description.clone(),
|
|
||||||
),
|
|
||||||
ro_prop(
|
|
||||||
t!("Ambient").as_ref(),
|
|
||||||
"mat_ambient",
|
|
||||||
material_color_text(&material.ambient_color),
|
|
||||||
),
|
|
||||||
ro_prop(
|
|
||||||
t!("Diffuse").as_ref(),
|
|
||||||
"mat_diffuse",
|
|
||||||
material_color_text(&material.diffuse_color),
|
|
||||||
),
|
|
||||||
ro_prop(
|
|
||||||
t!("Specular").as_ref(),
|
|
||||||
"mat_specular",
|
|
||||||
material_color_text(&material.specular_color),
|
|
||||||
),
|
|
||||||
ro_prop(
|
|
||||||
t!("Gloss").as_ref(),
|
|
||||||
"mat_gloss",
|
|
||||||
format!("{:.3}", material.specular_gloss_factor),
|
|
||||||
),
|
|
||||||
ro_prop(
|
|
||||||
t!("Opacity").as_ref(),
|
|
||||||
"mat_opacity",
|
|
||||||
format!("{:.3}", material.opacity_percent),
|
|
||||||
),
|
|
||||||
ro_prop(
|
|
||||||
t!("Reflectivity").as_ref(),
|
|
||||||
"mat_reflectivity",
|
|
||||||
format!("{:.3}", material.reflectivity),
|
|
||||||
),
|
|
||||||
ro_prop(
|
|
||||||
t!("Translucence").as_ref(),
|
|
||||||
"mat_translucence",
|
|
||||||
format!("{:.3}", material.translucence),
|
|
||||||
),
|
|
||||||
ro_prop(
|
|
||||||
t!("Refraction").as_ref(),
|
|
||||||
"mat_refraction",
|
|
||||||
format!("{:.3}", material.refraction_index),
|
|
||||||
),
|
|
||||||
ro_prop(
|
|
||||||
t!("Self Illumination").as_ref(),
|
|
||||||
"mat_self_illumination",
|
|
||||||
format!("{:.3}", material.self_illumination),
|
|
||||||
),
|
|
||||||
ro_prop(
|
|
||||||
t!("Luminance").as_ref(),
|
|
||||||
"mat_luminance",
|
|
||||||
format!(
|
|
||||||
"{:.3} (mode {})",
|
|
||||||
material.luminance, material.luminance_mode
|
|
||||||
),
|
|
||||||
),
|
|
||||||
ro_prop(
|
|
||||||
t!("Diffuse Map").as_ref(),
|
|
||||||
"mat_diffuse_map",
|
|
||||||
material_map_text(&material.diffuse_map),
|
|
||||||
),
|
|
||||||
ro_prop(
|
|
||||||
t!("Specular Map").as_ref(),
|
|
||||||
"mat_specular_map",
|
|
||||||
material_map_text(&material.specular_map),
|
|
||||||
),
|
|
||||||
ro_prop(
|
|
||||||
t!("Reflection Map").as_ref(),
|
|
||||||
"mat_reflection_map",
|
|
||||||
material_map_text(&material.reflection_map),
|
|
||||||
),
|
|
||||||
ro_prop(
|
|
||||||
t!("Opacity Map").as_ref(),
|
|
||||||
"mat_opacity_map",
|
|
||||||
material_map_text(&material.opacity_map),
|
|
||||||
),
|
|
||||||
ro_prop(
|
|
||||||
t!("Bump Map").as_ref(),
|
|
||||||
"mat_bump_map",
|
|
||||||
material_map_text(&material.bump_map),
|
|
||||||
),
|
|
||||||
ro_prop(
|
|
||||||
t!("Refraction Map").as_ref(),
|
|
||||||
"mat_refraction_map",
|
|
||||||
material_map_text(&material.refraction_map),
|
|
||||||
),
|
|
||||||
ro_prop(
|
|
||||||
t!("Normal Map").as_ref(),
|
|
||||||
"mat_normal_map",
|
|
||||||
material_map_text(&material.normal_map),
|
|
||||||
),
|
|
||||||
ro_prop(
|
|
||||||
t!("Render Flags").as_ref(),
|
|
||||||
"mat_render_flags",
|
|
||||||
format!(
|
|
||||||
"illumination {}; channels {}; mode {}; two-sided {}",
|
|
||||||
material.illumination_model,
|
|
||||||
material.channel_flags,
|
|
||||||
material.mode,
|
|
||||||
material.two_sided_material
|
|
||||||
),
|
|
||||||
),
|
|
||||||
ro_prop(
|
|
||||||
t!("Advanced").as_ref(),
|
|
||||||
"mat_advanced",
|
|
||||||
format!(
|
|
||||||
"normal method {}; strength {:.3}; bump {:.3}; reflect {:.3}; transmit {:.3}; bleed {:.3}",
|
|
||||||
material.normal_map_method,
|
|
||||||
material.normal_map_strength,
|
|
||||||
material.indirect_bump_scale,
|
|
||||||
material.reflectance_scale,
|
|
||||||
material.transmittance_scale,
|
|
||||||
material.color_bleed_scale
|
|
||||||
),
|
|
||||||
),
|
|
||||||
ro_prop(
|
|
||||||
t!("Indirect Lighting").as_ref(),
|
|
||||||
"mat_indirect_lighting",
|
|
||||||
format!(
|
|
||||||
"global {}; final gather {}",
|
|
||||||
material.global_illumination,
|
|
||||||
material.final_gather
|
|
||||||
),
|
|
||||||
),
|
|
||||||
ro_prop(
|
|
||||||
t!("Source State").as_ref(),
|
|
||||||
"mat_source_state",
|
|
||||||
format!(
|
|
||||||
"advanced {}; anonymous {}",
|
|
||||||
material.advanced_data_present,
|
|
||||||
material.is_anonymous
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
@ -1591,22 +1387,7 @@ impl OpenCADStudio {
|
||||||
.iter()
|
.iter()
|
||||||
.map(|(handle, entity)| (*handle, entity))
|
.map(|(handle, entity)| (*handle, entity))
|
||||||
.collect();
|
.collect();
|
||||||
let mut sections = aggregate_sections(&local_refs, &text_style_names);
|
let sections = aggregate_sections(&local_refs, &text_style_names);
|
||||||
sections.insert(
|
|
||||||
0,
|
|
||||||
crate::scene::model::object::PropSection {
|
|
||||||
title: t!("Coordinates").into_owned(),
|
|
||||||
props: vec![crate::entities::common::ro_prop(
|
|
||||||
t!("Coordinate system").as_ref(),
|
|
||||||
"coordinate_system",
|
|
||||||
self.tabs[i]
|
|
||||||
.active_ucs
|
|
||||||
.as_ref()
|
|
||||||
.map(|ucs| ucs.name.clone())
|
|
||||||
.unwrap_or_else(|| "WCS".to_string()),
|
|
||||||
)],
|
|
||||||
},
|
|
||||||
);
|
|
||||||
ui::PropertiesPanel {
|
ui::PropertiesPanel {
|
||||||
choice_combos: sections
|
choice_combos: sections
|
||||||
.iter()
|
.iter()
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue