Blender  V2.93
MOD_weightvg_util.h
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version 2
5  * of the License, or (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software Foundation,
14  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15  *
16  * The Original Code is Copyright (C) 2011 by Bastien Montagne.
17  * All rights reserved.
18  */
19 
24 #pragma once
25 
26 struct CurveMapping;
27 struct MDeformVert;
28 struct MDeformWeight;
29 struct Mesh;
30 struct ModifierEvalContext;
31 struct Object;
32 struct PointerRNA;
33 struct RNG;
34 struct Scene;
35 struct Tex;
36 struct uiLayout;
37 
38 /*
39  * XXX I'd like to make modified weights visible in WeightPaint mode,
40  * but couldn't figure a way to do this...
41  * Maybe this will need changes in mesh_calc_modifiers?
42  * Or the WeightPaint mode code itself?
43  */
44 
45 /**************************************
46  * Util functions. *
47  **************************************/
48 
49 /* We cannot divide by zero (what a surprise...).
50  * So if -MOD_WEIGHTVGROUP_DIVMODE_ZEROFLOOR < weightf < MOD_WEIGHTVGROUP_DIVMODE_ZEROFLOOR,
51  * we clamp weightf to this value (or its negative version).
52  * Also used to avoid null power factor.
53  */
54 #define MOD_WVG_ZEROFLOOR 1.0e-32f
55 
56 void weightvg_do_map(int num,
57  float *new_w,
58  short falloff_type,
59  const bool do_invert,
60  struct CurveMapping *cmap,
61  struct RNG *rng);
62 
64  const int num,
65  const int *indices,
66  float *org_w,
67  const float *new_w,
68  Object *ob,
69  struct Mesh *mesh,
70  const float fact,
71  const char defgrp_name[MAX_VGROUP_NAME],
72  struct Scene *scene,
73  Tex *texture,
74  const int tex_use_channel,
75  const int tex_mapping,
76  Object *tex_map_object,
77  const char *text_map_bone,
78  const char *tex_uvlayer_name,
79  const bool invert_vgroup_mask);
80 
81 void weightvg_update_vg(struct MDeformVert *dvert,
82  int defgrp_idx,
83  struct MDeformWeight **dws,
84  int num,
85  const int *indices,
86  const float *weights,
87  const bool do_add,
88  const float add_thresh,
89  const bool do_rem,
90  const float rem_thresh,
91  const bool do_normalize);
92 
93 void weightvg_ui_common(const bContext *C, PointerRNA *ob_ptr, PointerRNA *ptr, uiLayout *layout);
#define MAX_VGROUP_NAME
void weightvg_update_vg(struct MDeformVert *dvert, int defgrp_idx, struct MDeformWeight **dws, int num, const int *indices, const float *weights, const bool do_add, const float add_thresh, const bool do_rem, const float rem_thresh, const bool do_normalize)
void weightvg_ui_common(const bContext *C, PointerRNA *ob_ptr, PointerRNA *ptr, uiLayout *layout)
void weightvg_do_map(int num, float *new_w, short falloff_type, const bool do_invert, struct CurveMapping *cmap, struct RNG *rng)
void weightvg_do_mask(const ModifierEvalContext *ctx, const int num, const int *indices, float *org_w, const float *new_w, Object *ob, struct Mesh *mesh, const float fact, const char defgrp_name[MAX_VGROUP_NAME], struct Scene *scene, Tex *texture, const int tex_use_channel, const int tex_mapping, Object *tex_map_object, const char *text_map_bone, const char *tex_uvlayer_name, const bool invert_vgroup_mask)
#define C
Definition: RandGen.cpp:39
Scene scene
static ushort indices[]
Definition: rand.cc:48
PointerRNA * ptr
Definition: wm_files.c:3157