edits to radish before merge with trunk
- removed some unused functions. - renamed vars to make more sense paint_vertex.c 'flags' --> 'lock_flags' - some odd modifications were made in unrealted, commented code, copy these back from trunk. - rename vertex_group_fix 'cp' property to 'accuracy' - make style more consistant with trunk. - remove 'Radish' comments.
This commit is contained in:
@@ -1072,7 +1072,6 @@ class VIEW3D_MT_paint_weight(Menu):
|
|||||||
layout.operator("object.vertex_group_invert", text="Invert")
|
layout.operator("object.vertex_group_invert", text="Invert")
|
||||||
layout.operator("object.vertex_group_clean", text="Clean")
|
layout.operator("object.vertex_group_clean", text="Clean")
|
||||||
layout.operator("object.vertex_group_levels", text="Levels")
|
layout.operator("object.vertex_group_levels", text="Levels")
|
||||||
# Radish
|
|
||||||
layout.operator("object.vertex_group_fix", text="Fix Deforms")
|
layout.operator("object.vertex_group_fix", text="Fix Deforms")
|
||||||
|
|
||||||
layout.separator()
|
layout.separator()
|
||||||
|
@@ -646,7 +646,6 @@ class VIEW3D_PT_tools_brush(PaintPanel, Panel):
|
|||||||
elif context.weight_paint_object and brush:
|
elif context.weight_paint_object and brush:
|
||||||
layout.prop(context.tool_settings, "vertex_group_weight", text="Weight", slider=True)
|
layout.prop(context.tool_settings, "vertex_group_weight", text="Weight", slider=True)
|
||||||
layout.prop(context.tool_settings, "use_auto_normalize", text="Auto Normalize")
|
layout.prop(context.tool_settings, "use_auto_normalize", text="Auto Normalize")
|
||||||
# Radish
|
|
||||||
layout.prop(context.tool_settings, "use_multipaint", text="Multi-Paint")
|
layout.prop(context.tool_settings, "use_multipaint", text="Multi-Paint")
|
||||||
|
|
||||||
col = layout.column()
|
col = layout.column()
|
||||||
|
@@ -59,8 +59,8 @@ void paint_brush_set(struct Paint *paint, struct Brush *br);
|
|||||||
* Texture paint could be removed since selected faces are not used
|
* Texture paint could be removed since selected faces are not used
|
||||||
* however hiding faces is useful */
|
* however hiding faces is useful */
|
||||||
int paint_facesel_test(struct Object *ob);
|
int paint_facesel_test(struct Object *ob);
|
||||||
|
|
||||||
int paint_vertsel_test(struct Object *ob);
|
int paint_vertsel_test(struct Object *ob);
|
||||||
|
|
||||||
/* Session data (mode-specific) */
|
/* Session data (mode-specific) */
|
||||||
|
|
||||||
typedef struct SculptSession {
|
typedef struct SculptSession {
|
||||||
|
@@ -40,9 +40,7 @@
|
|||||||
#include "DNA_cloth_types.h"
|
#include "DNA_cloth_types.h"
|
||||||
#include "DNA_key_types.h"
|
#include "DNA_key_types.h"
|
||||||
#include "DNA_meshdata_types.h"
|
#include "DNA_meshdata_types.h"
|
||||||
|
|
||||||
#include "DNA_armature_types.h"
|
#include "DNA_armature_types.h"
|
||||||
|
|
||||||
#include "DNA_object_types.h"
|
#include "DNA_object_types.h"
|
||||||
#include "DNA_scene_types.h" // N_T
|
#include "DNA_scene_types.h" // N_T
|
||||||
|
|
||||||
@@ -1761,7 +1759,6 @@ static void add_weight_mcol_dm(Object *ob, DerivedMesh *dm, int const draw_flag)
|
|||||||
unsigned char *wtcol;
|
unsigned char *wtcol;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
|
||||||
int defbase_len = BLI_countlist(&ob->defbase);
|
int defbase_len = BLI_countlist(&ob->defbase);
|
||||||
char *defbase_sel = MEM_mallocN(defbase_len * sizeof(char), __func__);
|
char *defbase_sel = MEM_mallocN(defbase_len * sizeof(char), __func__);
|
||||||
int selected = get_selected_defgroups(ob, defbase_sel, defbase_len);
|
int selected = get_selected_defgroups(ob, defbase_sel, defbase_len);
|
||||||
@@ -1807,7 +1804,6 @@ static void mesh_calc_modifiers(Scene *scene, Object *ob, float (*inputVertexCos
|
|||||||
int has_multires = mmd != NULL, multires_applied = 0;
|
int has_multires = mmd != NULL, multires_applied = 0;
|
||||||
int sculpt_mode = ob->mode & OB_MODE_SCULPT && ob->sculpt;
|
int sculpt_mode = ob->mode & OB_MODE_SCULPT && ob->sculpt;
|
||||||
|
|
||||||
|
|
||||||
int draw_flag= ((scene->toolsettings->multipaint ? CALC_WP_MULTIPAINT : 0) |
|
int draw_flag= ((scene->toolsettings->multipaint ? CALC_WP_MULTIPAINT : 0) |
|
||||||
(scene->toolsettings->auto_normalize ? CALC_WP_AUTO_NORMALIZE : 0));
|
(scene->toolsettings->auto_normalize ? CALC_WP_AUTO_NORMALIZE : 0));
|
||||||
|
|
||||||
|
@@ -2870,7 +2870,7 @@ void psys_cache_paths(ParticleSimulationData *sim, float cfra)
|
|||||||
PARTICLE_P;
|
PARTICLE_P;
|
||||||
|
|
||||||
float birthtime = 0.0, dietime = 0.0;
|
float birthtime = 0.0, dietime = 0.0;
|
||||||
float t, time = 0.0, dfra = 1.0 /* frs_sec = sim->scene->r.frs_sec*/ /*UNUSED*/;
|
float t, time = 0.0, dfra = 1.0 /* , frs_sec = sim->scene->r.frs_sec*/ /*UNUSED*/;
|
||||||
float col[4] = {0.5f, 0.5f, 0.5f, 1.0f};
|
float col[4] = {0.5f, 0.5f, 0.5f, 1.0f};
|
||||||
float prev_tangent[3] = {0.0f, 0.0f, 0.0f}, hairmat[4][4];
|
float prev_tangent[3] = {0.0f, 0.0f, 0.0f}, hairmat[4][4];
|
||||||
float rotmat[3][3];
|
float rotmat[3][3];
|
||||||
|
@@ -657,26 +657,41 @@ void heat_bone_weighting(Object *ob, Mesh *me, float (*verts)[3], int numsource,
|
|||||||
int *vertsflipped = NULL, *mask= NULL;
|
int *vertsflipped = NULL, *mask= NULL;
|
||||||
int a, totface, j, bbone, firstsegment, lastsegment;
|
int a, totface, j, bbone, firstsegment, lastsegment;
|
||||||
|
|
||||||
|
MVert *mvert = me->mvert;
|
||||||
MVert *mv = me->mvert;
|
|
||||||
int use_vert_sel= FALSE;
|
int use_vert_sel= FALSE;
|
||||||
|
int use_face_sel= FALSE;
|
||||||
|
|
||||||
*err_str= NULL;
|
*err_str= NULL;
|
||||||
|
|
||||||
/* count triangles and create mask */
|
/* count triangles and create mask */
|
||||||
if((me->editflag & ME_EDIT_PAINT_MASK) || (use_vert_sel= ((me->editflag & ME_EDIT_VERT_SEL) != 0)))
|
if( (use_face_sel= (me->editflag & ME_EDIT_PAINT_MASK) != 0) ||
|
||||||
|
(use_vert_sel= ((me->editflag & ME_EDIT_VERT_SEL) != 0)))
|
||||||
|
{
|
||||||
mask= MEM_callocN(sizeof(int)*me->totvert, "heat_bone_weighting mask");
|
mask= MEM_callocN(sizeof(int)*me->totvert, "heat_bone_weighting mask");
|
||||||
|
}
|
||||||
|
|
||||||
for(totface=0, a=0, mface=me->mface; a<me->totface; a++, mface++) {
|
for(totface=0, a=0, mface=me->mface; a<me->totface; a++, mface++) {
|
||||||
totface++;
|
totface++;
|
||||||
if(mface->v4) totface++;
|
if(mface->v4) totface++;
|
||||||
|
|
||||||
/* (added selectedVerts content for vertex mask, they used to just equal 1) */
|
/* (added selectedVerts content for vertex mask, they used to just equal 1) */
|
||||||
if(mask && ((mface->flag & ME_FACE_SEL) || use_vert_sel)) {
|
if(use_vert_sel) {
|
||||||
mask[mface->v1]= use_vert_sel ? ((mv+mface->v1)->flag & 1): 1;
|
mask[mface->v1]= (mvert[mface->v1].flag & SELECT) != 0;
|
||||||
mask[mface->v2]= use_vert_sel ? ((mv+mface->v2)->flag & 1): 1;
|
mask[mface->v2]= (mvert[mface->v2].flag & SELECT) != 0;
|
||||||
mask[mface->v3]= use_vert_sel ? ((mv+mface->v3)->flag & 1): 1;
|
mask[mface->v3]= (mvert[mface->v3].flag & SELECT) != 0;
|
||||||
if(mface->v4)
|
if(mface->v4) {
|
||||||
mask[mface->v4]= use_vert_sel ? ((mv+mface->v4)->flag & 1): 1;
|
mask[mface->v4]= (mvert[mface->v4].flag & SELECT) != 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if(use_face_sel) {
|
||||||
|
mask[mface->v1]= 1;
|
||||||
|
mask[mface->v2]= 1;
|
||||||
|
mask[mface->v3]= 1;
|
||||||
|
if(mface->v4) {
|
||||||
|
mask[mface->v4]= 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -216,9 +216,6 @@ void ED_view3d_project_float(struct ARegion *a, const float vec[3], float adr[2]
|
|||||||
void ED_view3d_calc_camera_border(struct Scene *scene, struct ARegion *ar, struct View3D *v3d, struct RegionView3D *rv3d, struct rctf *viewborder_r, short do_shift);
|
void ED_view3d_calc_camera_border(struct Scene *scene, struct ARegion *ar, struct View3D *v3d, struct RegionView3D *rv3d, struct rctf *viewborder_r, short do_shift);
|
||||||
|
|
||||||
/* drawobject.c iterators */
|
/* drawobject.c iterators */
|
||||||
|
|
||||||
void mesh_obmode_foreachScreenVert(struct ViewContext *vc, void (*func)(void *userData, struct MVert *mv, int x, int y, int index), void *userData, int clipVerts);
|
|
||||||
|
|
||||||
void mesh_foreachScreenVert(struct ViewContext *vc, void (*func)(void *userData, struct EditVert *eve, int x, int y, int index), void *userData, int clipVerts);
|
void mesh_foreachScreenVert(struct ViewContext *vc, void (*func)(void *userData, struct EditVert *eve, int x, int y, int index), void *userData, int clipVerts);
|
||||||
void mesh_foreachScreenEdge(struct ViewContext *vc, void (*func)(void *userData, struct EditEdge *eed, int x0, int y0, int x1, int y1, int index), void *userData, int clipVerts);
|
void mesh_foreachScreenEdge(struct ViewContext *vc, void (*func)(void *userData, struct EditEdge *eed, int x0, int y0, int x1, int y1, int index), void *userData, int clipVerts);
|
||||||
void mesh_foreachScreenFace(struct ViewContext *vc, void (*func)(void *userData, struct EditFace *efa, int x, int y, int index), void *userData);
|
void mesh_foreachScreenFace(struct ViewContext *vc, void (*func)(void *userData, struct EditFace *efa, int x, int y, int index), void *userData);
|
||||||
|
@@ -3778,7 +3778,7 @@ static int ui_numedit_but_WAVEFORM(uiBut *but, uiHandleButtonData *data, int mx,
|
|||||||
Scopes *scopes = (Scopes *)but->poin;
|
Scopes *scopes = (Scopes *)but->poin;
|
||||||
/* rcti rect; */
|
/* rcti rect; */
|
||||||
int changed= 1;
|
int changed= 1;
|
||||||
float /* dx, */ dy /* yfac=1.f */; /* UNUSED */
|
float /* dx, */ dy /* , yfac=1.f */; /* UNUSED */
|
||||||
|
|
||||||
/* rect.xmin= but->x1; rect.xmax= but->x2; */
|
/* rect.xmin= but->x1; rect.xmax= but->x2; */
|
||||||
/* rect.ymin= but->y1; rect.ymax= but->y2; */
|
/* rect.ymin= but->y1; rect.ymax= but->y2; */
|
||||||
|
@@ -2124,7 +2124,6 @@ static void list_item_row(bContext *C, uiLayout *layout, PointerRNA *ptr, Pointe
|
|||||||
//uiItemR(row, itemptr, "mute", 0, "", ICON_MUTE_IPO_OFF);
|
//uiItemR(row, itemptr, "mute", 0, "", ICON_MUTE_IPO_OFF);
|
||||||
uiBlockSetEmboss(block, UI_EMBOSS);
|
uiBlockSetEmboss(block, UI_EMBOSS);
|
||||||
}
|
}
|
||||||
/* I need the RNA struct for vertex groups */
|
|
||||||
else if(itemptr->type == &RNA_VertexGroup) {
|
else if(itemptr->type == &RNA_VertexGroup) {
|
||||||
bDeformGroup *dg= (bDeformGroup *)itemptr->data;
|
bDeformGroup *dg= (bDeformGroup *)itemptr->data;
|
||||||
uiItemL(sub, name, icon);
|
uiItemL(sub, name, icon);
|
||||||
|
@@ -1967,7 +1967,7 @@ void paintvert_flush_flags(Object *ob)
|
|||||||
{
|
{
|
||||||
Mesh *me= get_mesh(ob);
|
Mesh *me= get_mesh(ob);
|
||||||
DerivedMesh *dm= ob->derivedFinal;
|
DerivedMesh *dm= ob->derivedFinal;
|
||||||
MVert *verts, *mv, *mv_orig;
|
MVert *dm_mvert, *dm_mv;
|
||||||
int *index_array = NULL;
|
int *index_array = NULL;
|
||||||
int totvert;
|
int totvert;
|
||||||
int i;
|
int i;
|
||||||
@@ -1977,18 +1977,23 @@ void paintvert_flush_flags(Object *ob)
|
|||||||
|
|
||||||
index_array = dm->getVertDataArray(dm, CD_ORIGINDEX);
|
index_array = dm->getVertDataArray(dm, CD_ORIGINDEX);
|
||||||
|
|
||||||
verts = dm->getVertArray(dm);
|
dm_mvert = dm->getVertArray(dm);
|
||||||
totvert = dm->getNumVerts(dm);
|
totvert = dm->getNumVerts(dm);
|
||||||
|
|
||||||
mv= verts;
|
dm_mv= dm_mvert;
|
||||||
|
|
||||||
for (i= 0; i<totvert; i++, mv++) { /* loop over derived mesh faces */
|
|
||||||
if(index_array) {
|
if(index_array) {
|
||||||
mv_orig= me->mvert + index_array[i];
|
int orig_index;
|
||||||
mv->flag= mv_orig->flag;
|
for (i= 0; i<totvert; i++, dm_mv++) {
|
||||||
} else {
|
orig_index= index_array[i];
|
||||||
mv_orig= me->mvert + i;
|
if(orig_index != ORIGINDEX_NONE) {
|
||||||
mv->flag= mv_orig->flag;
|
dm_mv->flag= me->mvert[index_array[i]].flag;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
for (i= 0; i<totvert; i++, dm_mv++) {
|
||||||
|
dm_mv->flag= me->mvert[i].flag;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -200,10 +200,8 @@ void OBJECT_OT_vertex_group_copy(struct wmOperatorType *ot);
|
|||||||
void OBJECT_OT_vertex_group_normalize(struct wmOperatorType *ot);
|
void OBJECT_OT_vertex_group_normalize(struct wmOperatorType *ot);
|
||||||
void OBJECT_OT_vertex_group_normalize_all(struct wmOperatorType *ot);
|
void OBJECT_OT_vertex_group_normalize_all(struct wmOperatorType *ot);
|
||||||
void OBJECT_OT_vertex_group_levels(struct wmOperatorType *ot);
|
void OBJECT_OT_vertex_group_levels(struct wmOperatorType *ot);
|
||||||
|
|
||||||
void OBJECT_OT_vertex_group_lock(struct wmOperatorType *ot);
|
void OBJECT_OT_vertex_group_lock(struct wmOperatorType *ot);
|
||||||
void OBJECT_OT_vertex_group_fix(struct wmOperatorType *ot);
|
void OBJECT_OT_vertex_group_fix(struct wmOperatorType *ot);
|
||||||
|
|
||||||
void OBJECT_OT_vertex_group_invert(struct wmOperatorType *ot);
|
void OBJECT_OT_vertex_group_invert(struct wmOperatorType *ot);
|
||||||
void OBJECT_OT_vertex_group_blend(struct wmOperatorType *ot);
|
void OBJECT_OT_vertex_group_blend(struct wmOperatorType *ot);
|
||||||
void OBJECT_OT_vertex_group_clean(struct wmOperatorType *ot);
|
void OBJECT_OT_vertex_group_clean(struct wmOperatorType *ot);
|
||||||
|
@@ -174,10 +174,8 @@ void ED_operatortypes_object(void)
|
|||||||
WM_operatortype_append(OBJECT_OT_vertex_group_copy);
|
WM_operatortype_append(OBJECT_OT_vertex_group_copy);
|
||||||
WM_operatortype_append(OBJECT_OT_vertex_group_normalize);
|
WM_operatortype_append(OBJECT_OT_vertex_group_normalize);
|
||||||
WM_operatortype_append(OBJECT_OT_vertex_group_normalize_all);
|
WM_operatortype_append(OBJECT_OT_vertex_group_normalize_all);
|
||||||
|
|
||||||
WM_operatortype_append(OBJECT_OT_vertex_group_lock);
|
WM_operatortype_append(OBJECT_OT_vertex_group_lock);
|
||||||
WM_operatortype_append(OBJECT_OT_vertex_group_fix);
|
WM_operatortype_append(OBJECT_OT_vertex_group_fix);
|
||||||
|
|
||||||
WM_operatortype_append(OBJECT_OT_vertex_group_invert);
|
WM_operatortype_append(OBJECT_OT_vertex_group_invert);
|
||||||
WM_operatortype_append(OBJECT_OT_vertex_group_levels);
|
WM_operatortype_append(OBJECT_OT_vertex_group_levels);
|
||||||
WM_operatortype_append(OBJECT_OT_vertex_group_blend);
|
WM_operatortype_append(OBJECT_OT_vertex_group_blend);
|
||||||
|
@@ -719,7 +719,7 @@ static void vgroup_normalize(Object *ob)
|
|||||||
|
|
||||||
for(i = 0; i < dvert_tot; i++) {
|
for(i = 0; i < dvert_tot; i++) {
|
||||||
|
|
||||||
if(use_vert_sel && !((mvert+i)->flag & SELECT)) {
|
if(use_vert_sel && !(mvert[i].flag & SELECT)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -733,7 +733,7 @@ static void vgroup_normalize(Object *ob)
|
|||||||
if(weight_max > 0.0f) {
|
if(weight_max > 0.0f) {
|
||||||
for(i = 0; i < dvert_tot; i++) {
|
for(i = 0; i < dvert_tot; i++) {
|
||||||
|
|
||||||
if(use_vert_sel && !((mvert+i)->flag & SELECT)) {
|
if(use_vert_sel && !(mvert[i].flag & SELECT)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1167,7 +1167,7 @@ static void vgroup_levels(Object *ob, float offset, float gain)
|
|||||||
|
|
||||||
for(i = 0; i < dvert_tot; i++) {
|
for(i = 0; i < dvert_tot; i++) {
|
||||||
|
|
||||||
if(use_vert_sel && !((mvert+i)->flag & SELECT)) {
|
if(use_vert_sel && !(mvert[i].flag & SELECT)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1207,7 +1207,7 @@ static void vgroup_normalize_all(Object *ob, int lock_active)
|
|||||||
float lock_iweight= 1.0f;
|
float lock_iweight= 1.0f;
|
||||||
int j;
|
int j;
|
||||||
|
|
||||||
if(use_vert_sel && !((mvert+i)->flag & SELECT)) {
|
if(use_vert_sel && !(mvert[i].flag & SELECT)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1251,7 +1251,7 @@ static void vgroup_normalize_all(Object *ob, int lock_active)
|
|||||||
for(i = 0; i < dvert_tot; i++) {
|
for(i = 0; i < dvert_tot; i++) {
|
||||||
int j;
|
int j;
|
||||||
|
|
||||||
if(use_vert_sel && !((mvert+i)->flag & SELECT)) {
|
if(use_vert_sel && !(mvert[i].flag & SELECT)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1332,7 +1332,7 @@ static void vgroup_invert(Object *ob, int auto_assign, int auto_remove)
|
|||||||
|
|
||||||
for(i = 0; i < dvert_tot; i++) {
|
for(i = 0; i < dvert_tot; i++) {
|
||||||
|
|
||||||
if(use_vert_sel && !((mvert+i)->flag & SELECT)) {
|
if(use_vert_sel && !(mvert[i].flag & SELECT)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
dvert = dvert_array[i];
|
dvert = dvert_array[i];
|
||||||
@@ -1461,7 +1461,7 @@ static void vgroup_clean(Object *ob, float eul, int keep_single)
|
|||||||
|
|
||||||
for(i = 0; i < dvert_tot; i++) {
|
for(i = 0; i < dvert_tot; i++) {
|
||||||
|
|
||||||
if(use_vert_sel && !((mvert+i)->flag & SELECT)) {
|
if(use_vert_sel && !(mvert[i].flag & SELECT)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
dvert = dvert_array[i];
|
dvert = dvert_array[i];
|
||||||
@@ -1496,7 +1496,7 @@ static void vgroup_clean_all(Object *ob, float eul, int keep_single)
|
|||||||
for(i = 0; i < dvert_tot; i++) {
|
for(i = 0; i < dvert_tot; i++) {
|
||||||
int j;
|
int j;
|
||||||
|
|
||||||
if(use_vert_sel && !((mvert+i)->flag & SELECT)) {
|
if(use_vert_sel && !(mvert[i].flag & SELECT)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2327,7 +2327,7 @@ static int vertex_group_fix_exec(bContext *C, wmOperator *op)
|
|||||||
|
|
||||||
float distToBe= RNA_float_get(op->ptr, "dist");
|
float distToBe= RNA_float_get(op->ptr, "dist");
|
||||||
float strength= RNA_float_get(op->ptr, "strength");
|
float strength= RNA_float_get(op->ptr, "strength");
|
||||||
float cp= RNA_float_get(op->ptr,"cp");
|
float cp= RNA_float_get(op->ptr, "accuracy");
|
||||||
ModifierData *md= ob->modifiers.first;
|
ModifierData *md= ob->modifiers.first;
|
||||||
|
|
||||||
while(md) {
|
while(md) {
|
||||||
@@ -2365,7 +2365,7 @@ void OBJECT_OT_vertex_group_fix(wmOperatorType *ot)
|
|||||||
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
|
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
|
||||||
RNA_def_float(ot->srna, "dist", 0.0f, -FLT_MAX, FLT_MAX, "Distance", "The distance to move to.", -10.0f, 10.0f);
|
RNA_def_float(ot->srna, "dist", 0.0f, -FLT_MAX, FLT_MAX, "Distance", "The distance to move to.", -10.0f, 10.0f);
|
||||||
RNA_def_float(ot->srna, "strength", 1.f, -2.0f, FLT_MAX, "Strength", "The distance moved can be changed by this multiplier.", -2.0f, 2.0f);
|
RNA_def_float(ot->srna, "strength", 1.f, -2.0f, FLT_MAX, "Strength", "The distance moved can be changed by this multiplier.", -2.0f, 2.0f);
|
||||||
RNA_def_float(ot->srna, "cp", 1.0f, 0.05f, FLT_MAX, "Change Sensitivity", "Changes the amount weights are altered with each iteration: lower values are slower.", 0.05f, 1.f);
|
RNA_def_float(ot->srna, "accuracy", 1.0f, 0.05f, FLT_MAX, "Change Sensitivity", "Changes the amount weights are altered with each iteration: lower values are slower.", 0.05f, 1.f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -444,7 +444,7 @@ void wpaint_fill(VPaint *wp, Object *ob, float paintweight)
|
|||||||
for (i=0; i<3 || faceverts[i]; i++) {
|
for (i=0; i<3 || faceverts[i]; i++) {
|
||||||
if(!me->dvert[faceverts[i]].flag) {
|
if(!me->dvert[faceverts[i]].flag) {
|
||||||
|
|
||||||
if(use_vert_sel && ((me->mvert[faceverts[i]].flag & SELECT) == 0)) {
|
if(use_vert_sel && !(me->mvert[faceverts[i]].flag & SELECT)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1147,11 +1147,11 @@ static void do_weight_paint_auto_normalize_all_groups(MDeformVert *dvert, char *
|
|||||||
/*
|
/*
|
||||||
See if the current deform vertex has a locked group
|
See if the current deform vertex has a locked group
|
||||||
*/
|
*/
|
||||||
static char has_locked_group(MDeformVert *dvert, char *flags)
|
static char has_locked_group(MDeformVert *dvert, char *lock_flags)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
for(i = 0; i < dvert->totweight; i++) {
|
for(i = 0; i < dvert->totweight; i++) {
|
||||||
if(flags[(dvert->dw+i)->def_nr] && (dvert->dw+i)->weight > 0.0f) {
|
if(lock_flags[dvert->dw[i].def_nr] && dvert->dw[i].weight > 0.0f) {
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1166,25 +1166,25 @@ static char *gen_lck_flags(Object* ob, int defbase_len)
|
|||||||
char is_locked = FALSE;
|
char is_locked = FALSE;
|
||||||
int i;
|
int i;
|
||||||
//int defbase_len = BLI_countlist(&ob->defbase);
|
//int defbase_len = BLI_countlist(&ob->defbase);
|
||||||
char *flags = MEM_mallocN(defbase_len*sizeof(char), "defflags");
|
char *lock_flags = MEM_mallocN(defbase_len*sizeof(char), "defflags");
|
||||||
bDeformGroup *defgroup;
|
bDeformGroup *defgroup;
|
||||||
|
|
||||||
for(i = 0, defgroup = ob->defbase.first; i < defbase_len && defgroup; defgroup = defgroup->next, i++) {
|
for(i = 0, defgroup = ob->defbase.first; i < defbase_len && defgroup; defgroup = defgroup->next, i++) {
|
||||||
flags[i] = ((defgroup->flag & DG_LOCK_WEIGHT) != 0);
|
lock_flags[i] = ((defgroup->flag & DG_LOCK_WEIGHT) != 0);
|
||||||
is_locked |= flags[i];
|
is_locked |= lock_flags[i];
|
||||||
}
|
}
|
||||||
if(is_locked){
|
if(is_locked){
|
||||||
return flags;
|
return lock_flags;
|
||||||
}
|
}
|
||||||
// don't forget to free it if it is unneeded
|
// don't forget to free it if it is unneeded
|
||||||
MEM_freeN(flags);
|
MEM_freeN(lock_flags);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int has_locked_group_selected(int defbase_len, char *defbase_sel, char *flags) {
|
static int has_locked_group_selected(int defbase_len, char *defbase_sel, char *lock_flags) {
|
||||||
int i;
|
int i;
|
||||||
for(i = 0; i < defbase_len; i++) {
|
for(i = 0; i < defbase_len; i++) {
|
||||||
if(defbase_sel[i] && flags[i]) {
|
if(defbase_sel[i] && lock_flags[i]) {
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1193,13 +1193,13 @@ static int has_locked_group_selected(int defbase_len, char *defbase_sel, char *f
|
|||||||
|
|
||||||
|
|
||||||
#if 0 /* UNUSED */
|
#if 0 /* UNUSED */
|
||||||
static int has_unselected_unlocked_bone_group(int defbase_len, char *defbase_sel, int selected, char *flags, char *bone_groups) {
|
static int has_unselected_unlocked_bone_group(int defbase_len, char *defbase_sel, int selected, char *lock_flags, char *bone_groups) {
|
||||||
int i;
|
int i;
|
||||||
if(defbase_len == selected) {
|
if(defbase_len == selected) {
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
for(i = 0; i < defbase_len; i++) {
|
for(i = 0; i < defbase_len; i++) {
|
||||||
if(bone_groups[i] && !defbase_sel[i] && !flags[i]) {
|
if(bone_groups[i] && !defbase_sel[i] && !lock_flags[i]) {
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1289,7 +1289,7 @@ static float redistribute_change(MDeformVert *ndv, char *change_status, int chan
|
|||||||
// observe the changes made to the weights of groups.
|
// observe the changes made to the weights of groups.
|
||||||
// make sure all locked groups on the vertex have the same deformation
|
// make sure all locked groups on the vertex have the same deformation
|
||||||
// by moving the changes made to groups onto other unlocked groups
|
// by moving the changes made to groups onto other unlocked groups
|
||||||
static void enforce_locks(MDeformVert *odv, MDeformVert *ndv, int defbase_len, char *flags, char *bone_groups, char *validmap) {
|
static void enforce_locks(MDeformVert *odv, MDeformVert *ndv, int defbase_len, char *lock_flags, char *bone_groups, char *validmap) {
|
||||||
float totchange = 0.0f;
|
float totchange = 0.0f;
|
||||||
float totchange_allowed = 0.0f;
|
float totchange_allowed = 0.0f;
|
||||||
float left_over;
|
float left_over;
|
||||||
@@ -1307,7 +1307,7 @@ static void enforce_locks(MDeformVert *odv, MDeformVert *ndv, int defbase_len, c
|
|||||||
char *change_status;
|
char *change_status;
|
||||||
char new_weight_has_zero = FALSE;
|
char new_weight_has_zero = FALSE;
|
||||||
|
|
||||||
if(!flags || !has_locked_group(ndv, flags)) {
|
if(!lock_flags || !has_locked_group(ndv, lock_flags)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// record if a group was changed, unlocked and not changed, or locked
|
// record if a group was changed, unlocked and not changed, or locked
|
||||||
@@ -1318,7 +1318,7 @@ static void enforce_locks(MDeformVert *odv, MDeformVert *ndv, int defbase_len, c
|
|||||||
odw = defvert_find_index(odv, i);
|
odw = defvert_find_index(odv, i);
|
||||||
// the weights are zero, so we can assume a lot
|
// the weights are zero, so we can assume a lot
|
||||||
if(!ndw || !odw) {
|
if(!ndw || !odw) {
|
||||||
if (!flags[i] && bone_groups[i]){
|
if (!lock_flags[i] && bone_groups[i]){
|
||||||
defvert_verify_index(odv, i);
|
defvert_verify_index(odv, i);
|
||||||
defvert_verify_index(ndv, i);
|
defvert_verify_index(ndv, i);
|
||||||
total_valid++;
|
total_valid++;
|
||||||
@@ -1327,15 +1327,17 @@ static void enforce_locks(MDeformVert *odv, MDeformVert *ndv, int defbase_len, c
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// locked groups should not be changed
|
// locked groups should not be changed
|
||||||
if(flags[i]) {
|
if(lock_flags[i]) {
|
||||||
ndw->weight = odw->weight;
|
ndw->weight = odw->weight;
|
||||||
} else if(ndw->weight != odw->weight) { // changed groups are handled here
|
}
|
||||||
|
else if(ndw->weight != odw->weight) { // changed groups are handled here
|
||||||
totchange += ndw->weight - odw->weight;
|
totchange += ndw->weight - odw->weight;
|
||||||
change_status[i] = 2; // was altered already
|
change_status[i] = 2; // was altered already
|
||||||
total_changed++;
|
total_changed++;
|
||||||
if(ndw->weight == 0) {
|
if(ndw->weight == 0) {
|
||||||
new_weight_has_zero = TRUE;
|
new_weight_has_zero = TRUE;
|
||||||
} else if(designatedw == -1){
|
}
|
||||||
|
else if(designatedw == -1){
|
||||||
designatedw = i;
|
designatedw = i;
|
||||||
}
|
}
|
||||||
} // unchanged, unlocked bone groups are handled here
|
} // unchanged, unlocked bone groups are handled here
|
||||||
@@ -1357,17 +1359,19 @@ static void enforce_locks(MDeformVert *odv, MDeformVert *ndv, int defbase_len, c
|
|||||||
// on whether or not you are painting the weight(s) up or down
|
// on whether or not you are painting the weight(s) up or down
|
||||||
if(totchange < 0) {
|
if(totchange < 0) {
|
||||||
totchange_allowed = total_valid - totchange_allowed;
|
totchange_allowed = total_valid - totchange_allowed;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
totchange_allowed *= -1;
|
totchange_allowed *= -1;
|
||||||
}
|
}
|
||||||
left_over = 0;
|
left_over = 0;
|
||||||
if(fabs(totchange_allowed) < fabs(totchange)) {
|
if(fabsf(totchange_allowed) < fabsf(totchange)) {
|
||||||
// this amount goes back onto the changed, unlocked weights
|
// this amount goes back onto the changed, unlocked weights
|
||||||
left_over = fabs(fabs(totchange)-fabs(totchange_allowed));
|
left_over = fabsf(fabsf(totchange) - fabsf(totchange_allowed));
|
||||||
if(totchange > 0) {
|
if(totchange > 0) {
|
||||||
left_over *= -1;
|
left_over *= -1;
|
||||||
}
|
}
|
||||||
}else {
|
}
|
||||||
|
else {
|
||||||
// all of the change will be permitted
|
// all of the change will be permitted
|
||||||
totchange_allowed = -totchange;
|
totchange_allowed = -totchange;
|
||||||
}
|
}
|
||||||
@@ -1399,10 +1403,11 @@ static void enforce_locks(MDeformVert *odv, MDeformVert *ndv, int defbase_len, c
|
|||||||
redistribute_change(ndv, change_status, 2, -2, validmap, left_over, total_changed);
|
redistribute_change(ndv, change_status, 2, -2, validmap, left_over, total_changed);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
// reset the weights
|
// reset the weights
|
||||||
for(i = 0; i < ndv->totweight; i++) {
|
for(i = 0; i < ndv->totweight; i++) {
|
||||||
(ndv->dw+i)->weight = (odv->dw+i)->weight;
|
ndv->dw[i].weight = odv->dw[i].weight;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1416,7 +1421,7 @@ static float get_mp_change(MDeformVert *odv, char *defbase_sel, float brush_chan
|
|||||||
int i;
|
int i;
|
||||||
MDeformWeight *dw;
|
MDeformWeight *dw;
|
||||||
for(i=0; i < odv->totweight; i++) {
|
for(i=0; i < odv->totweight; i++) {
|
||||||
if(defbase_sel[(dw = (odv->dw+i))->def_nr]) {
|
if(defbase_sel[(dw= &odv->dw[i])->def_nr]) {
|
||||||
selwsum += dw->weight;
|
selwsum += dw->weight;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1433,14 +1438,10 @@ static void reset_to_prev(MDeformVert *wv, MDeformVert *dv) {
|
|||||||
MDeformWeight *d;
|
MDeformWeight *d;
|
||||||
MDeformWeight *w;
|
MDeformWeight *w;
|
||||||
for(i = 0; i < dv->totweight; i++) {
|
for(i = 0; i < dv->totweight; i++) {
|
||||||
d = dv->dw+i;
|
d= &dv->dw[i];
|
||||||
w= defvert_find_index(wv, d->def_nr);
|
w= defvert_find_index(wv, d->def_nr);
|
||||||
// if there was no w when there is a d, then the old weight was 0
|
/* if there was no w when there is a d, then the old weight was 0 */
|
||||||
if(w) {
|
d->weight = w ? w->weight : 0.0f;
|
||||||
d->weight = w->weight;
|
|
||||||
} else {
|
|
||||||
d->weight = 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1453,27 +1454,29 @@ static void clamp_weights(MDeformVert *dvert) {
|
|||||||
|
|
||||||
/* fresh start to make multi-paint and locking modular */
|
/* fresh start to make multi-paint and locking modular */
|
||||||
/* returns TRUE if it thinks you need to reset the weights due to normalizing while multi-painting */
|
/* returns TRUE if it thinks you need to reset the weights due to normalizing while multi-painting */
|
||||||
static int apply_mp_lcks_normalize(Mesh *me, int index, MDeformWeight *dw, MDeformWeight *tdw, int defbase_len, float change, float oldChange, float oldw, float neww, char *defbase_sel, int selected, char *bone_groups, char *validmap, char *flags, int multipaint) {
|
static int apply_mp_lcks_normalize(Mesh *me, int index, MDeformWeight *dw, MDeformWeight *tdw, int defbase_len, float change, float oldChange, float oldw, float neww, char *defbase_sel, int selected, char *bone_groups, char *validmap, char *lock_flags, int multipaint)
|
||||||
|
{
|
||||||
MDeformVert *dvert = me->dvert+index;
|
MDeformVert *dvert = me->dvert+index;
|
||||||
MDeformVert dv= {NULL};
|
MDeformVert dv= {NULL};
|
||||||
|
|
||||||
dv.dw= MEM_dupallocN(dvert->dw);
|
dv.dw= MEM_dupallocN(dvert->dw);
|
||||||
dv.flag = dvert->flag;
|
dv.flag = dvert->flag;
|
||||||
dv.totweight = dvert->totweight;
|
dv.totweight = dvert->totweight;
|
||||||
// do not multi-paint if a locked group is selected or the active group is locked
|
/* do not multi-paint if a locked group is selected or the active group is locked
|
||||||
// !flags[dw->def_nr] helps if nothing is selected, but active group is locked
|
* !lock_flags[dw->def_nr] helps if nothing is selected, but active group is locked */
|
||||||
if((flags == NULL) || (has_locked_group_selected(defbase_len, defbase_sel, flags) == FALSE && flags[dw->def_nr] == FALSE)) {
|
if((lock_flags == NULL) || (lock_flags[dw->def_nr] == FALSE && has_locked_group_selected(defbase_len, defbase_sel, lock_flags) == FALSE)) {
|
||||||
if(multipaint && selected > 1) {
|
if(multipaint && selected > 1) {
|
||||||
if(change && change!=1) {
|
if(change && change!=1) {
|
||||||
multipaint_selection(dvert, change, defbase_sel, defbase_len);
|
multipaint_selection(dvert, change, defbase_sel, defbase_len);
|
||||||
}
|
}
|
||||||
} else {// this lets users paint normally, but don't let them paint locked groups
|
}
|
||||||
|
else { /* this lets users paint normally, but don't let them paint locked groups */
|
||||||
dw->weight = neww;
|
dw->weight = neww;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
clamp_weights(dvert);
|
clamp_weights(dvert);
|
||||||
|
|
||||||
enforce_locks(&dv, dvert, defbase_len, flags, bone_groups, validmap);
|
enforce_locks(&dv, dvert, defbase_len, lock_flags, bone_groups, validmap);
|
||||||
|
|
||||||
do_weight_paint_auto_normalize_all_groups(dvert, validmap);
|
do_weight_paint_auto_normalize_all_groups(dvert, validmap);
|
||||||
|
|
||||||
@@ -1484,7 +1487,8 @@ static int apply_mp_lcks_normalize(Mesh *me, int index, MDeformWeight *dw, MDefo
|
|||||||
MEM_freeN(dv.dw);
|
MEM_freeN(dv.dw);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
if(tdw->weight >= oldw) {
|
if(tdw->weight >= oldw) {
|
||||||
MEM_freeN(dv.dw);
|
MEM_freeN(dv.dw);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@@ -1496,13 +1500,13 @@ static int apply_mp_lcks_normalize(Mesh *me, int index, MDeformWeight *dw, MDefo
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// within the current dvert index, get the dw that is selected and has a weight above 0
|
/* within the current dvert index, get the dw that is selected and has a weight
|
||||||
// this helps multi-paint
|
* above 0, this helps multi-paint */
|
||||||
static int get_first_selected_nonzero_weight(MDeformVert *dvert, char *defbase_sel) {
|
static int get_first_selected_nonzero_weight(MDeformVert *dvert, char *defbase_sel) {
|
||||||
int i;
|
int i;
|
||||||
MDeformWeight *dw;
|
MDeformWeight *dw;
|
||||||
for(i=0; i< dvert->totweight; i++) {
|
for(i=0; i< dvert->totweight; i++) {
|
||||||
dw = dvert->dw+i;
|
dw = &dvert->dw[i];
|
||||||
if(defbase_sel[dw->def_nr] && dw->weight > 0) {
|
if(defbase_sel[dw->def_nr] && dw->weight > 0) {
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
@@ -1521,7 +1525,7 @@ static void do_weight_paint_vertex(VPaint *wp, Object *ob, int index,
|
|||||||
MDeformWeight *dw, *uw;
|
MDeformWeight *dw, *uw;
|
||||||
int vgroup= ob->actdef-1;
|
int vgroup= ob->actdef-1;
|
||||||
|
|
||||||
char *flags;
|
char *lock_flags;
|
||||||
|
|
||||||
char *defbase_sel;
|
char *defbase_sel;
|
||||||
int selected;
|
int selected;
|
||||||
@@ -1539,15 +1543,18 @@ static void do_weight_paint_vertex(VPaint *wp, Object *ob, int index,
|
|||||||
if(dw==NULL || uw==NULL)
|
if(dw==NULL || uw==NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
flags = gen_lck_flags(ob, defbase_len = BLI_countlist(&ob->defbase));
|
lock_flags = gen_lck_flags(ob, defbase_len = BLI_countlist(&ob->defbase));
|
||||||
defbase_sel = MEM_mallocN(defbase_len * sizeof(char), "dg_selected_flags");
|
defbase_sel = MEM_mallocN(defbase_len * sizeof(char), "dg_selected_flags");
|
||||||
selected = get_selected_defgroups(ob, defbase_sel, defbase_len);
|
selected = get_selected_defgroups(ob, defbase_sel, defbase_len);
|
||||||
if(!selected && ob->actdef) {
|
if(!selected && ob->actdef) {
|
||||||
selected = 1;
|
selected = 1;
|
||||||
}
|
}
|
||||||
// TODO: De-duplicate the simple weight paint
|
|
||||||
// If there are no locks or multipaint, then there is no need to run the more complicated checks
|
/* TODO: De-duplicate the simple weight paint */
|
||||||
if((multipaint == FALSE || selected <= 1) && (flags == NULL || has_locked_group(me->dvert+index, flags) == FALSE)) {
|
|
||||||
|
/* If there are no locks or multipaint,
|
||||||
|
* then there is no need to run the more complicated checks */
|
||||||
|
if((multipaint == FALSE || selected <= 1) && (lock_flags == NULL || has_locked_group(&me->dvert[index], lock_flags) == FALSE)) {
|
||||||
wpaint_blend(wp, dw, uw, alpha, paintweight, flip, FALSE);
|
wpaint_blend(wp, dw, uw, alpha, paintweight, flip, FALSE);
|
||||||
do_weight_paint_auto_normalize_all_groups(me->dvert+index, validmap);
|
do_weight_paint_auto_normalize_all_groups(me->dvert+index, validmap);
|
||||||
|
|
||||||
@@ -1562,9 +1569,10 @@ static void do_weight_paint_vertex(VPaint *wp, Object *ob, int index,
|
|||||||
do_weight_paint_auto_normalize_all_groups(me->dvert+j, validmap);
|
do_weight_paint_auto_normalize_all_groups(me->dvert+j, validmap);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
// use locks and/or multipaint
|
else { /* use locks and/or multipaint */
|
||||||
// Need to know which groups are bone groups
|
|
||||||
|
/* Need to know which groups are bone groups */
|
||||||
char *bone_groups = validmap ? validmap : wpaint_make_validmap(ob);
|
char *bone_groups = validmap ? validmap : wpaint_make_validmap(ob);
|
||||||
|
|
||||||
float oldw;
|
float oldw;
|
||||||
@@ -1593,7 +1601,7 @@ static void do_weight_paint_vertex(VPaint *wp, Object *ob, int index,
|
|||||||
if(!tdw->weight) {
|
if(!tdw->weight) {
|
||||||
i = get_first_selected_nonzero_weight(me->dvert+index, defbase_sel);
|
i = get_first_selected_nonzero_weight(me->dvert+index, defbase_sel);
|
||||||
if(i>=0) {
|
if(i>=0) {
|
||||||
tdw = ((me->dvert+index)->dw+i);
|
tdw = &(me->dvert[index].dw[i]);
|
||||||
tuw = defvert_verify_index(wp->wpaint_prev+index, tdw->def_nr);
|
tuw = defvert_verify_index(wp->wpaint_prev+index, tdw->def_nr);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -1631,7 +1639,7 @@ static void do_weight_paint_vertex(VPaint *wp, Object *ob, int index,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(apply_mp_lcks_normalize(me, index, dw, tdw, defbase_len, change, oldChange, oldw, neww, defbase_sel, selected, bone_groups, validmap, flags, multipaint)) {
|
if(apply_mp_lcks_normalize(me, index, dw, tdw, defbase_len, change, oldChange, oldw, neww, defbase_sel, selected, bone_groups, validmap, lock_flags, multipaint)) {
|
||||||
reset_to_prev(&dv, me->dvert+index);
|
reset_to_prev(&dv, me->dvert+index);
|
||||||
change = 0;
|
change = 0;
|
||||||
oldChange = 0;
|
oldChange = 0;
|
||||||
@@ -1650,15 +1658,15 @@ static void do_weight_paint_vertex(VPaint *wp, Object *ob, int index,
|
|||||||
|
|
||||||
//uw->weight= dw->weight;
|
//uw->weight= dw->weight;
|
||||||
|
|
||||||
apply_mp_lcks_normalize(me, j, uw, tdw, defbase_len, change, oldChange, oldw, neww, defbase_sel, selected, bone_groups, validmap, flags, multipaint);
|
apply_mp_lcks_normalize(me, j, uw, tdw, defbase_len, change, oldChange, oldw, neww, defbase_sel, selected, bone_groups, validmap, lock_flags, multipaint);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(!validmap) {
|
if(!validmap) {
|
||||||
MEM_freeN(bone_groups);
|
MEM_freeN(bone_groups);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(flags) {
|
if(lock_flags) {
|
||||||
MEM_freeN(flags);
|
MEM_freeN(lock_flags);
|
||||||
}
|
}
|
||||||
MEM_freeN(defbase_sel);
|
MEM_freeN(defbase_sel);
|
||||||
}
|
}
|
||||||
@@ -1916,8 +1924,6 @@ static void wpaint_stroke_update_step(bContext *C, struct PaintStroke *stroke, P
|
|||||||
int totindex, index, totw, flip;
|
int totindex, index, totw, flip;
|
||||||
float alpha;
|
float alpha;
|
||||||
float mval[2], pressure;
|
float mval[2], pressure;
|
||||||
|
|
||||||
|
|
||||||
int use_vert_sel;
|
int use_vert_sel;
|
||||||
|
|
||||||
/* cannot paint if there is no stroke data */
|
/* cannot paint if there is no stroke data */
|
||||||
@@ -1946,7 +1952,6 @@ static void wpaint_stroke_update_step(bContext *C, struct PaintStroke *stroke, P
|
|||||||
|
|
||||||
swap_m4m4(wpd->vc.rv3d->persmat, mat);
|
swap_m4m4(wpd->vc.rv3d->persmat, mat);
|
||||||
|
|
||||||
|
|
||||||
use_vert_sel= (me->editflag & ME_EDIT_VERT_SEL) != 0;
|
use_vert_sel= (me->editflag & ME_EDIT_VERT_SEL) != 0;
|
||||||
|
|
||||||
/* which faces are involved */
|
/* which faces are involved */
|
||||||
|
@@ -77,7 +77,6 @@
|
|||||||
#include "BKE_pointcache.h"
|
#include "BKE_pointcache.h"
|
||||||
#include "BKE_unit.h"
|
#include "BKE_unit.h"
|
||||||
|
|
||||||
|
|
||||||
#include "smoke_API.h"
|
#include "smoke_API.h"
|
||||||
|
|
||||||
#include "IMB_imbuf.h"
|
#include "IMB_imbuf.h"
|
||||||
@@ -86,7 +85,6 @@
|
|||||||
#include "BIF_gl.h"
|
#include "BIF_gl.h"
|
||||||
#include "BIF_glutil.h"
|
#include "BIF_glutil.h"
|
||||||
|
|
||||||
#include "GPU_buffers.h"
|
|
||||||
#include "GPU_draw.h"
|
#include "GPU_draw.h"
|
||||||
#include "GPU_extensions.h"
|
#include "GPU_extensions.h"
|
||||||
|
|
||||||
@@ -1742,58 +1740,19 @@ void mesh_foreachScreenVert(ViewContext *vc, void (*func)(void *userData, EditVe
|
|||||||
dm->release(dm);
|
dm->release(dm);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void mesh_obmode_foreachScreenVert__mapFunc(void *userData, int index, float *co, float *UNUSED(no_f), short *UNUSED(no_s))
|
|
||||||
{
|
|
||||||
struct { void (*func)(void *userData, MVert *mv, int x, int y, int index); void *userData; ViewContext vc; int clipVerts; } *data = userData;
|
|
||||||
Mesh *me = data->vc.obact->data;
|
|
||||||
MVert *mv = me->mvert+index;
|
|
||||||
//MVert *dmv = CDDM_get_verts(data->vc.obact->derivedFinal)+index;
|
|
||||||
//MVert *mv = CDDM_get_verts(data->vc.obact->derivedFinal)+index;
|
|
||||||
if ((mv->flag & ME_HIDE)==0) {
|
|
||||||
short s[2]= {IS_CLIPPED, 0};
|
|
||||||
|
|
||||||
if (data->clipVerts) {
|
|
||||||
view3d_project_short_clip(data->vc.ar, co, s, 1);
|
|
||||||
} else {
|
|
||||||
view3d_project_short_noclip(data->vc.ar, co, s);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (s[0]!=IS_CLIPPED)
|
|
||||||
data->func(data->userData, mv, s[0], s[1], index);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void mesh_obmode_foreachScreenVert(ViewContext *vc, void (*func)(void *userData, MVert *mv, int x, int y, int index), void *userData, int clipVerts)
|
|
||||||
{
|
|
||||||
struct { void (*func)(void *userData, MVert *mv, int x, int y, int index); void *userData; ViewContext vc; int clipVerts; } data;
|
|
||||||
DerivedMesh *dm = mesh_get_derived_final(vc->scene, vc->obact, CD_MASK_BAREMESH);
|
|
||||||
|
|
||||||
data.vc= *vc;
|
|
||||||
data.func = func;
|
|
||||||
data.userData = userData;
|
|
||||||
data.clipVerts = clipVerts;
|
|
||||||
|
|
||||||
if(clipVerts)
|
|
||||||
ED_view3d_local_clipping(vc->rv3d, vc->obact->obmat); /* for local clipping lookups */
|
|
||||||
|
|
||||||
dm->foreachMappedVert(dm, mesh_obmode_foreachScreenVert__mapFunc, &data);
|
|
||||||
|
|
||||||
dm->release(dm);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* draw callback */
|
/* draw callback */
|
||||||
static void drawSelectedVertices__mapFunc(void *userData, int index, float *co, float *no_f, short *no_s)
|
static void drawSelectedVertices__mapFunc(void *userData, int index, float *co, float *UNUSED(no_f), short *UNUSED(no_s))
|
||||||
{
|
{
|
||||||
MVert *mv = userData;
|
MVert *mv = &((MVert *)userData)[index];
|
||||||
mv+=index;
|
|
||||||
//printf("%d\n", index);
|
|
||||||
if(!(mv->flag & ME_HIDE)) {
|
if(!(mv->flag & ME_HIDE)) {
|
||||||
const char sel= mv->flag & 1;
|
const char sel= mv->flag & SELECT;
|
||||||
|
|
||||||
// TODO define selected color
|
// TODO define selected color
|
||||||
if(sel) {
|
if(sel) {
|
||||||
glColor3f(1.0f, 1.0f, 0.0f);
|
glColor3f(1.0f, 1.0f, 0.0f);
|
||||||
}else {
|
}
|
||||||
|
else {
|
||||||
glColor3f(0.0f, 0.0f, 0.0f);
|
glColor3f(0.0f, 0.0f, 0.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -6594,7 +6553,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag)
|
|||||||
static void bbs_obmode_mesh_verts__mapFunc(void *userData, int index, float *co, float *UNUSED(no_f), short *UNUSED(no_s))
|
static void bbs_obmode_mesh_verts__mapFunc(void *userData, int index, float *co, float *UNUSED(no_f), short *UNUSED(no_s))
|
||||||
{
|
{
|
||||||
struct {void* offset; MVert *mvert;} *data = userData;
|
struct {void* offset; MVert *mvert;} *data = userData;
|
||||||
MVert *mv = data->mvert+index;
|
MVert *mv = &data->mvert[index];
|
||||||
int offset = (intptr_t) data->offset;
|
int offset = (intptr_t) data->offset;
|
||||||
|
|
||||||
if (!(mv->flag & ME_HIDE)) {
|
if (!(mv->flag & ME_HIDE)) {
|
||||||
|
@@ -502,7 +502,8 @@ void uiTemplateHeader3D(uiLayout *layout, struct bContext *C)
|
|||||||
RNA_pointer_create(&ob->id, &RNA_Mesh, ob->data, &meshptr);
|
RNA_pointer_create(&ob->id, &RNA_Mesh, ob->data, &meshptr);
|
||||||
if(ob->mode & (OB_MODE_TEXTURE_PAINT|OB_MODE_VERTEX_PAINT)) {
|
if(ob->mode & (OB_MODE_TEXTURE_PAINT|OB_MODE_VERTEX_PAINT)) {
|
||||||
uiItemR(layout, &meshptr, "use_paint_mask", UI_ITEM_R_ICON_ONLY, "", ICON_NONE);
|
uiItemR(layout, &meshptr, "use_paint_mask", UI_ITEM_R_ICON_ONLY, "", ICON_NONE);
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
|
|
||||||
row= uiLayoutRow(layout, 1);
|
row= uiLayoutRow(layout, 1);
|
||||||
uiItemR(row, &meshptr, "use_paint_mask", UI_ITEM_R_ICON_ONLY, "", ICON_NONE);
|
uiItemR(row, &meshptr, "use_paint_mask", UI_ITEM_R_ICON_ONLY, "", ICON_NONE);
|
||||||
|
@@ -38,7 +38,7 @@
|
|||||||
|
|
||||||
/* This array contains the bytes used to pad the buffer to the next
|
/* This array contains the bytes used to pad the buffer to the next
|
||||||
64-byte boundary. (RFC 1321, 3.1: Step 1) */
|
64-byte boundary. (RFC 1321, 3.1: Step 1) */
|
||||||
static const unsigned char fillbuf[64] = { 0x80, 0 /* 0, 0, ... */ };
|
static const unsigned char fillbuf[64] = { 0x80, 0 /* , 0, 0, ... */ };
|
||||||
|
|
||||||
|
|
||||||
/* Initialize structure containing state of computation.
|
/* Initialize structure containing state of computation.
|
||||||
|
@@ -762,8 +762,6 @@ typedef struct ToolSettings {
|
|||||||
char pad[5];
|
char pad[5];
|
||||||
|
|
||||||
char auto_normalize; /*auto normalizing mode in wpaint*/
|
char auto_normalize; /*auto normalizing mode in wpaint*/
|
||||||
|
|
||||||
|
|
||||||
char multipaint; /* paint multiple bones in wpaint */
|
char multipaint; /* paint multiple bones in wpaint */
|
||||||
|
|
||||||
short sculpt_paint_settings; /* user preferences for sculpt and paint */
|
short sculpt_paint_settings; /* user preferences for sculpt and paint */
|
||||||
|
Reference in New Issue
Block a user