Blender V2.61 - r43446
|
#include "BLI_editVert.h"
#include "BLI_math.h"
#include "BLI_string.h"
#include "BLI_utildefines.h"
#include "DNA_mesh_types.h"
#include "DNA_meshdata_types.h"
#include "DNA_modifier_types.h"
#include "DNA_object_types.h"
#include "BKE_cdderivedmesh.h"
#include "BKE_deform.h"
#include "BKE_mesh.h"
#include "BKE_modifier.h"
#include "BKE_shrinkwrap.h"
#include "BKE_texture.h"
#include "depsgraph_private.h"
#include "MEM_guardedalloc.h"
#include "MOD_util.h"
#include "MOD_weightvg_util.h"
Go to the source code of this file.
Defines | |
#define | DO_PROFILE 0 |
#define | OUT_OF_MEMORY() ((void)printf("WeightVGProximity: Out of memory.\n")) |
Functions | |
static void | get_vert2geom_distance (int numVerts, float(*v_cos)[3], float *dist_v, float *dist_e, float *dist_f, DerivedMesh *target, const SpaceTransform *loc2trgt) |
static void | get_vert2ob_distance (int numVerts, float(*v_cos)[3], float *dist, Object *ob, Object *obr) |
static float | get_ob2ob_distance (const Object *ob, const Object *obr) |
void | do_map (float *weights, const int nidx, const float min_d, const float max_d, short mode) |
static void | initData (ModifierData *md) |
static void | copyData (ModifierData *md, ModifierData *target) |
static CustomDataMask | requiredDataMask (Object *UNUSED(ob), ModifierData *md) |
static int | dependsOnTime (ModifierData *md) |
static void | foreachObjectLink (ModifierData *md, Object *ob, void(*walk)(void *userData, Object *ob, Object **obpoin), void *userData) |
static void | foreachIDLink (ModifierData *md, Object *ob, IDWalkFunc walk, void *userData) |
static void | foreachTexLink (ModifierData *md, Object *ob, TexWalkFunc walk, void *userData) |
static void | updateDepgraph (ModifierData *md, DagForest *forest, struct Scene *UNUSED(scene), Object *UNUSED(ob), DagNode *obNode) |
static int | isDisabled (ModifierData *md, int UNUSED(useRenderParams)) |
static DerivedMesh * | applyModifier (ModifierData *md, Object *ob, DerivedMesh *derivedData, int UNUSED(useRenderParams), int UNUSED(isFinalCalc)) |
static DerivedMesh * | applyModifierEM (ModifierData *md, Object *ob, struct EditMesh *UNUSED(editData), DerivedMesh *derivedData) |
Variables | |
ModifierTypeInfo | modifierType_WeightVGProximity |
Definition in file MOD_weightvgproximity.c.
#define DO_PROFILE 0 |
Definition at line 31 of file MOD_weightvgproximity.c.
#define OUT_OF_MEMORY | ( | ) | ((void)printf("WeightVGProximity: Out of memory.\n")) |
Definition at line 64 of file MOD_weightvgproximity.c.
Referenced by get_vert2geom_distance().
static DerivedMesh* applyModifier | ( | ModifierData * | md, |
Object * | ob, | ||
DerivedMesh * | derivedData, | ||
int | UNUSEDuseRenderParams, | ||
int | UNUSEDisFinalCalc | ||
) | [static] |
Definition at line 339 of file MOD_weightvgproximity.c.
References CD_MDEFORMVERT, CDDM_from_curve(), CDDM_from_editmesh(), CDDM_from_mesh(), copy_v3_v3(), CustomData_duplicate_referenced_layer(), Object::data, Object::defbase, defgroup_name_index(), WeightVGProximityModifierData::defgrp_name, defvert_find_index(), Object::derivedFinal, do_map(), Mesh::edit_mesh, ELEM3, WeightVGProximityModifierData::falloff_type, FALSE, ListBase::first, FLT_MAX, get_ob2ob_distance(), get_vert2geom_distance(), get_vert2ob_distance(), DerivedMesh::getNumVerts, DerivedMesh::getVertCos, i, if(), indices, WeightVGProximityModifierData::mask_constant, WeightVGProximityModifierData::mask_defgrp_name, WeightVGProximityModifierData::mask_tex_map_obj, WeightVGProximityModifierData::mask_tex_mapping, WeightVGProximityModifierData::mask_tex_use_channel, WeightVGProximityModifierData::mask_tex_uvlayer_name, WeightVGProximityModifierData::mask_texture, WeightVGProximityModifierData::max_dist, MEM_freeN(), MEM_mallocN(), WeightVGProximityModifierData::min_dist, minf(), MOD_WVG_PROXIMITY_GEOM_EDGES, MOD_WVG_PROXIMITY_GEOM_FACES, MOD_WVG_PROXIMITY_GEOM_VERTS, MOD_WVG_PROXIMITY_GEOMETRY, MOD_WVG_PROXIMITY_OBJECT, NULL, OB_CURVE, OB_FONT, OB_MESH, OB_SURF, WeightVGProximityModifierData::proximity_flags, WeightVGProximityModifierData::proximity_mode, WeightVGProximityModifierData::proximity_ob_target, DerivedMesh::release, space_transform_setup, TIMEIT_END, TIMEIT_START, TRUE, Object::type, DerivedMesh::vertData, MDeformWeight::weight, weightvg_do_mask(), and weightvg_update_vg().
Referenced by applyModifierEM().
static DerivedMesh* applyModifierEM | ( | ModifierData * | md, |
Object * | ob, | ||
struct EditMesh * | UNUSEDeditData, | ||
DerivedMesh * | derivedData | ||
) | [static] |
Definition at line 520 of file MOD_weightvgproximity.c.
References applyModifier().
static void copyData | ( | ModifierData * | md, |
ModifierData * | target | ||
) | [static] |
Definition at line 236 of file MOD_weightvgproximity.c.
References BLI_strncpy(), WeightVGProximityModifierData::defgrp_name, WeightVGProximityModifierData::falloff_type, WeightVGProximityModifierData::mask_constant, WeightVGProximityModifierData::mask_defgrp_name, WeightVGProximityModifierData::mask_tex_map_obj, WeightVGProximityModifierData::mask_tex_mapping, WeightVGProximityModifierData::mask_tex_use_channel, WeightVGProximityModifierData::mask_tex_uvlayer_name, WeightVGProximityModifierData::mask_texture, WeightVGProximityModifierData::max_dist, WeightVGProximityModifierData::min_dist, WeightVGProximityModifierData::proximity_flags, WeightVGProximityModifierData::proximity_mode, and WeightVGProximityModifierData::proximity_ob_target.
static int dependsOnTime | ( | ModifierData * | md | ) | [static] |
Definition at line 274 of file MOD_weightvgproximity.c.
References BKE_texture_dependsOnTime(), and WeightVGProximityModifierData::mask_texture.
void do_map | ( | float * | weights, |
const int | nidx, | ||
const float | min_d, | ||
const float | max_d, | ||
short | mode | ||
) |
Maps distances to weights, with an optionnal “smoothing” mapping.
Definition at line 189 of file MOD_weightvgproximity.c.
References ELEM, i, MOD_WVG_MAPPING_CURVE, MOD_WVG_MAPPING_NONE, NULL, and weightvg_do_map().
Referenced by applyModifier().
static void foreachIDLink | ( | ModifierData * | md, |
Object * | ob, | ||
IDWalkFunc | walk, | ||
void * | userData | ||
) | [static] |
Definition at line 292 of file MOD_weightvgproximity.c.
References foreachObjectLink(), and WeightVGProximityModifierData::mask_texture.
static void foreachObjectLink | ( | ModifierData * | md, |
Object * | ob, | ||
void(*)(void *userData, Object *ob, Object **obpoin) | walk, | ||
void * | userData | ||
) | [static] |
Definition at line 283 of file MOD_weightvgproximity.c.
References WeightVGProximityModifierData::mask_tex_map_obj, and WeightVGProximityModifierData::proximity_ob_target.
Referenced by foreachIDLink().
static void foreachTexLink | ( | ModifierData * | md, |
Object * | ob, | ||
TexWalkFunc | walk, | ||
void * | userData | ||
) | [static] |
Definition at line 301 of file MOD_weightvgproximity.c.
Returns the real distance between an object and another reference object. Note that it works in final world space (i.e. with constraints etc. applied).
Definition at line 181 of file MOD_weightvgproximity.c.
References len_v3v3(), and Object::obmat.
Referenced by applyModifier().
static void get_vert2geom_distance | ( | int | numVerts, |
float(*) | v_cos[3], | ||
float * | dist_v, | ||
float * | dist_e, | ||
float * | dist_f, | ||
DerivedMesh * | target, | ||
const SpaceTransform * | loc2trgt | ||
) | [static] |
Find nearest vertex and/or edge and/or face, for each vertex (adapted from shrinkwrap.c).
Definition at line 69 of file MOD_weightvgproximity.c.
References BLI_bvhtree_find_nearest(), bvhtree_from_mesh_edges(), bvhtree_from_mesh_faces(), bvhtree_from_mesh_verts(), BVHTreeNearest::co, copy_v3_v3(), BVHTreeNearest::dist, FLT_MAX, free_bvhtree_from_mesh(), i, BVHTreeNearest::index, len_squared_v3v3(), BVHTreeFromMesh::nearest_callback, NULL, NULL_BVHTreeFromMesh, NULL_BVHTreeNearest, OUT_OF_MEMORY, space_transform_apply(), sqrtf, and BVHTreeFromMesh::tree.
Referenced by applyModifier().
static void get_vert2ob_distance | ( | int | numVerts, |
float(*) | v_cos[3], | ||
float * | dist, | ||
Object * | ob, | ||
Object * | obr | ||
) | [static] |
Returns the real distance between a vertex and another reference object. Note that it works in final world space (i.e. with constraints etc. applied).
Definition at line 162 of file MOD_weightvgproximity.c.
References i, len_v3v3(), mul_v3_m4v3(), and Object::obmat.
Referenced by applyModifier().
static void initData | ( | ModifierData * | md | ) | [static] |
Definition at line 221 of file MOD_weightvgproximity.c.
References WeightVGProximityModifierData::falloff_type, WeightVGProximityModifierData::mask_constant, WeightVGProximityModifierData::mask_tex_mapping, WeightVGProximityModifierData::mask_tex_use_channel, WeightVGProximityModifierData::max_dist, MOD_DISP_MAP_LOCAL, MOD_WVG_MAPPING_NONE, MOD_WVG_MASK_TEX_USE_INT, MOD_WVG_PROXIMITY_GEOM_VERTS, MOD_WVG_PROXIMITY_OBJECT, WeightVGProximityModifierData::proximity_flags, and WeightVGProximityModifierData::proximity_mode.
static int isDisabled | ( | ModifierData * | md, |
int | UNUSEDuseRenderParams | ||
) | [static] |
Definition at line 330 of file MOD_weightvgproximity.c.
References WeightVGProximityModifierData::defgrp_name, NULL, and WeightVGProximityModifierData::proximity_ob_target.
static CustomDataMask requiredDataMask | ( | Object * | UNUSEDob, |
ModifierData * | md | ||
) | [static] |
Definition at line 259 of file MOD_weightvgproximity.c.
References CD_MASK_MDEFORMVERT, CD_MASK_MTFACE, WeightVGProximityModifierData::mask_tex_mapping, and MOD_DISP_MAP_UV.
static void updateDepgraph | ( | ModifierData * | md, |
DagForest * | forest, | ||
struct Scene * | UNUSEDscene, | ||
Object * | UNUSEDob, | ||
DagNode * | obNode | ||
) | [static] |
Definition at line 306 of file MOD_weightvgproximity.c.
References dag_add_relation(), dag_get_node(), DAG_RL_DATA_DATA, DAG_RL_OB_DATA, WeightVGProximityModifierData::mask_tex_map_obj, WeightVGProximityModifierData::mask_tex_mapping, MOD_DISP_MAP_GLOBAL, MOD_DISP_MAP_OBJECT, and WeightVGProximityModifierData::proximity_ob_target.
{ "VertexWeightProximity", "WeightVGProximityModifierData", sizeof(WeightVGProximityModifierData), eModifierTypeType_NonGeometrical, eModifierTypeFlag_AcceptsMesh |eModifierTypeFlag_SupportsEditmode, copyData, NULL, NULL, NULL, NULL, applyModifier, applyModifierEM, initData, requiredDataMask, NULL, isDisabled, updateDepgraph, dependsOnTime, NULL, foreachObjectLink, foreachIDLink, foreachTexLink, }
Definition at line 528 of file MOD_weightvgproximity.c.