Mesh: Replace auto smooth with node group #108014
|
@ -198,9 +198,9 @@ class DATA_PT_normals(MeshButtonsPanel, Panel):
|
||||||
mesh = context.mesh
|
mesh = context.mesh
|
||||||
|
|
||||||
if mesh.has_custom_normals:
|
if mesh.has_custom_normals:
|
||||||
col.operator("mesh.customdata_custom_splitnormals_clear", icon='X')
|
layout.operator("mesh.customdata_custom_splitnormals_clear", icon='X')
|
||||||
else:
|
else:
|
||||||
col.operator("mesh.customdata_custom_splitnormals_add", icon='ADD')
|
layout.operator("mesh.customdata_custom_splitnormals_add", icon='ADD')
|
||||||
|
|
||||||
|
|
||||||
class DATA_PT_texture_space(MeshButtonsPanel, Panel):
|
class DATA_PT_texture_space(MeshButtonsPanel, Panel):
|
||||||
|
|
|
@ -131,7 +131,17 @@ static void version_mesh_objects_replace_auto_smooth(Main &bmain)
|
||||||
STRNCPY(md->modifier.name, DATA_("Auto Smooth"));
|
STRNCPY(md->modifier.name, DATA_("Auto Smooth"));
|
||||||
BKE_modifier_unique_name(&object->modifiers, &md->modifier);
|
BKE_modifier_unique_name(&object->modifiers, &md->modifier);
|
||||||
md->node_group = auto_smooth_node_tree;
|
md->node_group = auto_smooth_node_tree;
|
||||||
BLI_addtail(&object->modifiers, md);
|
if (!BLI_listbase_is_empty(&object->modifiers) &&
|
||||||
|
static_cast<ModifierData *>(object->modifiers.last)->type == eModifierType_Subsurf)
|
||||||
|
{
|
||||||
|
/* Add the auto smooth node group before the last subdivision surface modifier if possible.
|
||||||
|
* Subdivision surface modifiers have special handling for interpolating face corner normals,
|
||||||
|
* and recalculating them afterwards isn't usually helpful and can be much slower. */
|
||||||
|
BLI_insertlinkbefore(&object->modifiers, object->modifiers.last, md);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
BLI_addtail(&object->modifiers, md);
|
||||||
|
}
|
||||||
|
|
||||||
md->settings.properties = bke::idprop::create_group("Nodes Modifier Settings").release();
|
md->settings.properties = bke::idprop::create_group("Nodes Modifier Settings").release();
|
||||||
IDProperty *angle_prop = bke::idprop::create(DATA_("Input_1"), mesh->smoothresh).release();
|
IDProperty *angle_prop = bke::idprop::create(DATA_("Input_1"), mesh->smoothresh).release();
|
||||||
|
|
|
@ -749,6 +749,7 @@ static int mesh_customdata_custom_splitnormals_add_exec(bContext *C, wmOperator
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
CustomData_add_layer(&me->ldata, CD_CUSTOMLOOPNORMAL, CD_SET_DEFAULT, me->totloop);
|
CustomData_add_layer(&me->ldata, CD_CUSTOMLOOPNORMAL, CD_SET_DEFAULT, me->totloop);
|
||||||
|
me->runtime->corner_normals_dirty = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
DEG_id_tag_update(&me->id, 0);
|
DEG_id_tag_update(&me->id, 0);
|
||||||
|
|
|
@ -2451,8 +2451,7 @@ static void rna_def_mlooptri(BlenderRNA *brna)
|
||||||
RNA_def_property_ui_text(
|
RNA_def_property_ui_text(
|
||||||
prop,
|
prop,
|
||||||
"Split Normals",
|
"Split Normals",
|
||||||
"Local space unit length split normals vectors of the vertices of this triangle "
|
"Local space unit length split normal vectors of the face corners of this triangle");
|
||||||
"(must be computed beforehand using calc_normals_split or calc_tangents)");
|
|
||||||
|
|
||||||
prop = RNA_def_property(srna, "area", PROP_FLOAT, PROP_UNSIGNED);
|
prop = RNA_def_property(srna, "area", PROP_FLOAT, PROP_UNSIGNED);
|
||||||
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
||||||
|
|
Loading…
Reference in New Issue