Blender  V3.3
Classes | Macros | Typedefs | Functions | Variables
MOD_weighted_normal.c File Reference
#include "MEM_guardedalloc.h"
#include "BLI_bitmap.h"
#include "BLI_linklist.h"
#include "BLI_math.h"
#include "BLT_translation.h"
#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_context.h"
#include "BKE_deform.h"
#include "BKE_lib_id.h"
#include "BKE_mesh.h"
#include "BKE_screen.h"
#include "UI_interface.h"
#include "UI_resources.h"
#include "RNA_access.h"
#include "RNA_prototypes.h"
#include "MOD_modifiertypes.h"
#include "MOD_ui_common.h"
#include "MOD_util.h"
#include "bmesh.h"

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
 

Typedefs

typedef struct ModePair ModePair
 
typedef struct WeightedNormalDataAggregateItem WeightedNormalDataAggregateItem
 
typedef struct WeightedNormalData WeightedNormalData
 

Functions

static int modepair_cmp_by_val_inverse (const void *p1, const void *p2)
 
static bool check_item_poly_strength (WeightedNormalData *wn_data, WeightedNormalDataAggregateItem *item_data, const int mp_index)
 
static void aggregate_item_normal (WeightedNormalModifierData *wnmd, WeightedNormalData *wn_data, WeightedNormalDataAggregateItem *item_data, const int mv_index, const int mp_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 MeshmodifyMesh (ModifierData *md, const ModifierEvalContext *ctx, Mesh *mesh)
 
static void initData (ModifierData *md)
 
static void requiredDataMask (Object *UNUSED(ob), ModifierData *md, CustomData_MeshMasks *r_cddata_masks)
 
static bool dependsOnNormals (ModifierData *UNUSED(md))
 
static void panel_draw (const bContext *UNUSED(C), Panel *panel)
 
static void panelRegister (ARegionType *region_type)
 

Variables

ModifierTypeInfo modifierType_WeightedNormal
 

Macro Definition Documentation

◆ CLNORS_VALID_VEC_LEN

#define CLNORS_VALID_VEC_LEN   (1e-6f)

Definition at line 40 of file MOD_weighted_normal.c.

◆ NUM_CACHED_INVERSE_POWERS_OF_WEIGHT

#define NUM_CACHED_INVERSE_POWERS_OF_WEIGHT   128

Definition at line 66 of file MOD_weighted_normal.c.

Typedef Documentation

◆ ModePair

typedef struct ModePair ModePair

◆ WeightedNormalData

◆ WeightedNormalDataAggregateItem

Function Documentation

◆ aggregate_item_normal()

static void aggregate_item_normal ( WeightedNormalModifierData wnmd,
WeightedNormalData wn_data,
WeightedNormalDataAggregateItem item_data,
const int  mv_index,
const int  mp_index,
const float  curr_val,
const bool  use_face_influence 
)
static

◆ apply_weights_vertex_normal()

static void apply_weights_vertex_normal ( WeightedNormalModifierData wnmd,
WeightedNormalData wn_data 
)
static

Definition at line 181 of file MOD_weighted_normal.c.

References aggregate_item_normal(), BKE_lnor_spacearr_free(), BKE_mesh_normals_loop_custom_from_vertices_set(), BKE_mesh_normals_loop_custom_set(), BKE_mesh_normals_loop_split(), BLI_assert, BLI_assert_unreachable, BLI_BITMAP_ENABLE, BLI_BITMAP_NEW, BLI_BITMAP_TEST, WeightedNormalData::clnors, CLNORS_VALID_VEC_LEN, copy_v3_v3(), WeightedNormalDataAggregateItem::curr_strength, WeightedNormalData::dvert, WeightedNormalData::edges_num, FACE_STRENGTH_WEAK, WeightedNormalModifierData::flag, MLoopNorSpace::flags, float(), WeightedNormalData::has_clnors, ModePair::index, is_zero_v3(), WeightedNormalData::items_data, WeightedNormalData::loop_to_poly, MLoopNorSpace::loops, WeightedNormalData::loops_num, MPoly::loopstart, MLoopNorSpaceArray::lspacearr, WeightedNormalData::medge, MEM_calloc_arrayN, MEM_freeN, MEM_SAFE_FREE, MLNOR_SPACE_IS_SINGLE, WeightedNormalData::mloop, 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, WeightedNormalData::mpoly, WeightedNormalData::mvert, LinkNode::next, normal, WeightedNormalDataAggregateItem::normal, normalize_v3(), NULL, POINTER_AS_INT, WeightedNormalData::poly_strength, WeightedNormalData::polynors, WeightedNormalData::polys_num, MLoopNorSpaceArray::spaces_num, WeightedNormalData::split_angle, MPoly::totloop, MLoopNorSpace::user_data, MLoop::v, ModePair::val, WeightedNormalData::vert_normals, WeightedNormalData::verts_num, and zero_v3().

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

◆ check_item_poly_strength()

static bool check_item_poly_strength ( WeightedNormalData wn_data,
WeightedNormalDataAggregateItem item_data,
const int  mp_index 
)
static

Check strength of given poly 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 108 of file MOD_weighted_normal.c.

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

Referenced by aggregate_item_normal().

◆ dependsOnNormals()

static bool dependsOnNormals ( ModifierData UNUSEDmd)
static

Definition at line 694 of file MOD_weighted_normal.c.

◆ initData()

static void initData ( 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 48 of file MOD_weighted_normal.c.

References ModePair::val.

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

◆ modifyMesh()

static Mesh* modifyMesh ( ModifierData md,
const ModifierEvalContext ctx,
Mesh mesh 
)
static

◆ panel_draw()

static void panel_draw ( const bContext UNUSEDC,
Panel panel 
)
static

◆ panelRegister()

static void panelRegister ( ARegionType region_type)
static

◆ requiredDataMask()

static void requiredDataMask ( Object UNUSEDob,
ModifierData md,
CustomData_MeshMasks r_cddata_masks 
)
static

◆ wn_corner_angle()

static void wn_corner_angle ( WeightedNormalModifierData wnmd,
WeightedNormalData wn_data 
)
static

◆ wn_face_area()

static void wn_face_area ( WeightedNormalModifierData wnmd,
WeightedNormalData wn_data 
)
static

◆ wn_face_with_angle()

static void wn_face_with_angle ( WeightedNormalModifierData wnmd,
WeightedNormalData wn_data 
)
static

Variable Documentation

◆ modifierType_WeightedNormal

ModifierTypeInfo modifierType_WeightedNormal

Definition at line 728 of file MOD_weighted_normal.c.