Blender V4.3
MOD_weighted_normal.cc File Reference
#include "MEM_guardedalloc.h"
#include "BLI_array_utils.hh"
#include "BLI_bitmap.h"
#include "BLI_linklist.h"
#include "BLI_math_vector.h"
#include "BLT_translation.hh"
#include "DNA_defaults.h"
#include "DNA_mesh_types.h"
#include "DNA_meshdata_types.h"
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
#include "DNA_screen_types.h"
#include "BKE_attribute.hh"
#include "BKE_context.hh"
#include "BKE_deform.hh"
#include "BKE_lib_id.hh"
#include "BKE_mesh.hh"
#include "BKE_mesh_mapping.hh"
#include "BKE_screen.hh"
#include "UI_interface.hh"
#include "UI_resources.hh"
#include "RNA_access.hh"
#include "RNA_prototypes.hh"
#include "MOD_modifiertypes.hh"
#include "MOD_ui_common.hh"
#include "MOD_util.hh"
#include "bmesh.hh"

Go to the source code of this file.

Classes

struct  ModePair
 
struct  WeightedNormalDataAggregateItem
 
struct  WeightedNormalData
 

Macros

#define CLNORS_VALID_VEC_LEN   (1e-6f)
 
#define NUM_CACHED_INVERSE_POWERS_OF_WEIGHT   128
 

Functions

static int modepair_cmp_by_val_inverse (const void *p1, const void *p2)
 
static bool check_item_face_strength (WeightedNormalData *wn_data, WeightedNormalDataAggregateItem *item_data, const int face_index)
 
static void aggregate_item_normal (WeightedNormalModifierData *wnmd, WeightedNormalData *wn_data, WeightedNormalDataAggregateItem *item_data, const int mv_index, const int face_index, const float curr_val, const bool use_face_influence)
 
static void apply_weights_vertex_normal (WeightedNormalModifierData *wnmd, WeightedNormalData *wn_data)
 
static void wn_face_area (WeightedNormalModifierData *wnmd, WeightedNormalData *wn_data)
 
static void wn_corner_angle (WeightedNormalModifierData *wnmd, WeightedNormalData *wn_data)
 
static void wn_face_with_angle (WeightedNormalModifierData *wnmd, WeightedNormalData *wn_data)
 
static Meshmodify_mesh (ModifierData *md, const ModifierEvalContext *ctx, Mesh *mesh)
 
static void init_data (ModifierData *md)
 
static void required_data_mask (ModifierData *md, CustomData_MeshMasks *r_cddata_masks)
 
static void panel_draw (const bContext *, Panel *panel)
 
static void panel_register (ARegionType *region_type)
 

Variables

ModifierTypeInfo modifierType_WeightedNormal
 

Macro Definition Documentation

◆ CLNORS_VALID_VEC_LEN

#define CLNORS_VALID_VEC_LEN   (1e-6f)

Definition at line 45 of file MOD_weighted_normal.cc.

Referenced by apply_weights_vertex_normal().

◆ NUM_CACHED_INVERSE_POWERS_OF_WEIGHT

#define NUM_CACHED_INVERSE_POWERS_OF_WEIGHT   128

Definition at line 71 of file MOD_weighted_normal.cc.

Referenced by aggregate_item_normal().

Function Documentation

◆ aggregate_item_normal()

◆ apply_weights_vertex_normal()

static void apply_weights_vertex_normal ( WeightedNormalModifierData * wnmd,
WeightedNormalData * wn_data )
static

Definition at line 186 of file MOD_weighted_normal.cc.

References aggregate_item_normal(), BLI_assert_unreachable, WeightedNormalData::clnors, CLNORS_VALID_VEC_LEN, copy_v3_v3(), WeightedNormalData::corner_edges, blender::bke::mesh::CornerNormalSpaceArray::corner_space_indices, WeightedNormalData::corner_verts, WeightedNormalDataAggregateItem::curr_strength, blender::MutableSpan< T >::data(), WeightedNormalData::dvert, WeightedNormalData::edges, WeightedNormalData::face_normals, WeightedNormalData::face_strength, FACE_STRENGTH_WEAK, WeightedNormalData::faces, WeightedNormalModifierData::flag, WeightedNormalData::has_clnors, ModePair::index, blender::Array< T, InlineBufferCapacity, Allocator >::index_range(), is_zero_v3(), WeightedNormalData::items_data, WeightedNormalData::loop_to_face, MOD_WEIGHTEDNORMAL_FACE_INFLUENCE, MOD_WEIGHTEDNORMAL_KEEP_SHARP, MOD_WEIGHTEDNORMAL_MODE_ANGLE, MOD_WEIGHTEDNORMAL_MODE_FACE, MOD_WEIGHTEDNORMAL_MODE_FACE_ANGLE, WeightedNormalData::mode, WeightedNormalData::mode_pair, WeightedNormalDataAggregateItem::normal, normalize_v3(), blender::bke::mesh::normals_calc_corners(), blender::bke::mesh::normals_corner_custom_set(), blender::bke::mesh::normals_corner_custom_set_from_verts(), blender::Array< T, InlineBufferCapacity, Allocator >::reinitialize(), WeightedNormalData::sharp_edges, WeightedNormalData::sharp_faces, blender::Span< T >::size(), blender::bke::mesh::CornerNormalSpaceArray::spaces, ModePair::val, WeightedNormalData::vert_normals, WeightedNormalData::vert_positions, WeightedNormalData::verts_num, and zero_v3().

Referenced by wn_corner_angle(), wn_face_area(), and wn_face_with_angle().

◆ check_item_face_strength()

static bool check_item_face_strength ( WeightedNormalData * wn_data,
WeightedNormalDataAggregateItem * item_data,
const int face_index )
static

Check strength of given face compared to those found so far for that given item (vertex or smooth fan), and reset matching item_data in case we get a stronger new strength.

Definition at line 111 of file MOD_weighted_normal.cc.

References BLI_assert, WeightedNormalDataAggregateItem::curr_strength, WeightedNormalDataAggregateItem::curr_val, WeightedNormalData::face_strength, WeightedNormalDataAggregateItem::loops_num, WeightedNormalDataAggregateItem::normal, and zero_v3().

Referenced by aggregate_item_normal().

◆ init_data()

static void init_data ( ModifierData * md)
static

◆ modepair_cmp_by_val_inverse()

static int modepair_cmp_by_val_inverse ( const void * p1,
const void * p2 )
static

Definition at line 53 of file MOD_weighted_normal.cc.

References ModePair::val.

Referenced by wn_corner_angle(), wn_face_area(), and wn_face_with_angle().

◆ modify_mesh()

◆ panel_draw()

◆ panel_register()

static void panel_register ( ARegionType * region_type)
static

◆ required_data_mask()

◆ wn_corner_angle()

◆ wn_face_area()

◆ wn_face_with_angle()

Variable Documentation

◆ modifierType_WeightedNormal

ModifierTypeInfo modifierType_WeightedNormal

Definition at line 629 of file MOD_weighted_normal.cc.