forked from bartvdbraak/blender
- move vgroup lock buttons on the panel into the vgroup specials menu.
- merge object.vertex_group_lock_all / object.vertex_group_invert_locks / "object.vertex_group_unlock_all into one operator. - change lock button from a checkbox to a lock icon.
This commit is contained in:
parent
86777f46e1
commit
df433c7a1d
@ -35,6 +35,10 @@ class MESH_MT_vertex_group_specials(Menu):
|
||||
layout.operator("object.vertex_group_copy_to_selected", icon='LINK_AREA')
|
||||
layout.operator("object.vertex_group_mirror", icon='ARROW_LEFTRIGHT')
|
||||
layout.operator("object.vertex_group_remove", icon='X', text="Delete All").all = True
|
||||
layout.separator()
|
||||
layout.operator("object.vertex_group_lock", icon='LOCK', text="Lock All").action = 'SELECT'
|
||||
layout.operator("object.vertex_group_lock", icon='UNLOCK', text="UnLock All").action = 'DESELECT'
|
||||
layout.operator("object.vertex_group_lock", icon='LOCK', text="Lock Invert All").action = 'INVERT'
|
||||
|
||||
|
||||
class MESH_MT_shape_key_specials(Menu):
|
||||
@ -144,9 +148,6 @@ class DATA_PT_vertex_groups(MeshButtonsPanel, Panel):
|
||||
row.template_list(ob, "vertex_groups", ob.vertex_groups, "active_index", rows=rows)
|
||||
|
||||
col = row.column(align=True)
|
||||
# Jason was here, this was replaced by hardcoded list view checkboxes. #
|
||||
#col.prop(group, "flag")
|
||||
|
||||
col.operator("object.vertex_group_add", icon='ZOOMIN', text="")
|
||||
col.operator("object.vertex_group_remove", icon='ZOOMOUT', text="")
|
||||
col.menu("MESH_MT_vertex_group_specials", icon='DOWNARROW_HLT', text="")
|
||||
@ -157,14 +158,6 @@ class DATA_PT_vertex_groups(MeshButtonsPanel, Panel):
|
||||
if group:
|
||||
row = layout.row()
|
||||
row.prop(group, "name")
|
||||
#Jason was here
|
||||
# add buttons to make it faster to lock/unlock vgroups
|
||||
if ob.mode == 'WEIGHT_PAINT' and len(ob.vertex_groups) > 0:
|
||||
row = layout.row()
|
||||
sub = row.row(align=True)
|
||||
sub.operator("object.vertex_group_lock_all", text="Lock All")
|
||||
sub.operator("object.vertex_group_invert_locks", text="Invert Locks")
|
||||
sub.operator("object.vertex_group_unlock_all", text="Unlock All")
|
||||
|
||||
if ob.mode == 'EDIT' and len(ob.vertex_groups) > 0:
|
||||
row = layout.row()
|
||||
|
@ -2126,9 +2126,16 @@ static void list_item_row(bContext *C, uiLayout *layout, PointerRNA *ptr, Pointe
|
||||
}
|
||||
/* Jason was here: I need the RNA struct for vertex groups */
|
||||
else if(itemptr->type == &RNA_VertexGroup) {
|
||||
bDeformGroup *dg= (bDeformGroup *)itemptr->data;
|
||||
uiItemL(sub, name, icon);
|
||||
uiBlockSetEmboss(block, UI_EMBOSS);
|
||||
/* RNA does not allow nice lock icons, use lower level buttons */
|
||||
#if 0
|
||||
uiDefButR(block, OPTION, 0, "", 0, 0, UI_UNIT_X, UI_UNIT_Y, itemptr, "lock_weight", 0, 0, 0, 0, 0, NULL);
|
||||
#else
|
||||
uiBlockSetEmboss(block, UI_EMBOSSN);
|
||||
uiDefIconButBitC(block, TOG, DG_LOCK_WEIGHT, 0, (dg->flag & DG_LOCK_WEIGHT) ? ICON_LOCKED : ICON_UNLOCKED, 0, 0, UI_UNIT_X, UI_UNIT_Y, &dg->flag, 0, 0, 0, 0, "Maintain relative weights while painting");
|
||||
uiBlockSetEmboss(block, UI_EMBOSS);
|
||||
#endif
|
||||
}
|
||||
else if(itemptr->type == &RNA_KeyingSetPath) {
|
||||
KS_Path *ksp = (KS_Path*)itemptr->data;
|
||||
|
@ -201,9 +201,7 @@ void OBJECT_OT_vertex_group_normalize(struct wmOperatorType *ot);
|
||||
void OBJECT_OT_vertex_group_normalize_all(struct wmOperatorType *ot);
|
||||
void OBJECT_OT_vertex_group_levels(struct wmOperatorType *ot);
|
||||
/* Jason was here */
|
||||
void OBJECT_OT_vertex_group_lock_all(struct wmOperatorType *ot);
|
||||
void OBJECT_OT_vertex_group_invert_locks(struct wmOperatorType *ot);
|
||||
void OBJECT_OT_vertex_group_unlock_all(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_invert(struct wmOperatorType *ot);
|
||||
|
@ -175,9 +175,7 @@ void ED_operatortypes_object(void)
|
||||
WM_operatortype_append(OBJECT_OT_vertex_group_normalize);
|
||||
WM_operatortype_append(OBJECT_OT_vertex_group_normalize_all);
|
||||
/* Jason was here */
|
||||
WM_operatortype_append(OBJECT_OT_vertex_group_invert_locks);
|
||||
WM_operatortype_append(OBJECT_OT_vertex_group_lock_all);
|
||||
WM_operatortype_append(OBJECT_OT_vertex_group_unlock_all);
|
||||
WM_operatortype_append(OBJECT_OT_vertex_group_lock);
|
||||
WM_operatortype_append(OBJECT_OT_vertex_group_fix);
|
||||
|
||||
WM_operatortype_append(OBJECT_OT_vertex_group_invert);
|
||||
|
@ -1292,31 +1292,34 @@ static void vgroup_normalize_all(Object *ob, int lock_active)
|
||||
|
||||
if (dvert_array) MEM_freeN(dvert_array);
|
||||
}
|
||||
|
||||
/* Jason was here */
|
||||
static void vgroup_invert_locks(Object *ob)
|
||||
static void vgroup_lock_all(Object *ob, int action)
|
||||
{
|
||||
bDeformGroup *dg = ob->defbase.first;
|
||||
while(dg) {
|
||||
dg->flag = !dg->flag;
|
||||
dg = dg->next;
|
||||
bDeformGroup *dg;
|
||||
|
||||
if(action == SEL_TOGGLE) {
|
||||
action= SEL_SELECT;
|
||||
for(dg= ob->defbase.first; dg; dg= dg->next) {
|
||||
if(dg->flag & DG_LOCK_WEIGHT) {
|
||||
action= SEL_DESELECT;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/* Jason was here */
|
||||
static void vgroup_lock_all(Object *ob)
|
||||
{
|
||||
bDeformGroup *dg = ob->defbase.first;
|
||||
while(dg) {
|
||||
dg->flag |= DG_LOCK_WEIGHT;
|
||||
dg = dg->next;
|
||||
}
|
||||
}
|
||||
/* Jason was here */
|
||||
static void vgroup_unlock_all(Object *ob)
|
||||
{
|
||||
bDeformGroup *dg = ob->defbase.first;
|
||||
while(dg) {
|
||||
dg->flag &= ~DG_LOCK_WEIGHT;
|
||||
dg = dg->next;
|
||||
|
||||
for(dg= ob->defbase.first; dg; dg= dg->next) {
|
||||
switch(action) {
|
||||
case SEL_SELECT:
|
||||
dg->flag |= DG_LOCK_WEIGHT;
|
||||
break;
|
||||
case SEL_DESELECT:
|
||||
dg->flag &= ~DG_LOCK_WEIGHT;
|
||||
break;
|
||||
case SEL_INVERT:
|
||||
dg->flag ^= DG_LOCK_WEIGHT;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -2375,75 +2378,35 @@ void OBJECT_OT_vertex_group_fix(wmOperatorType *ot)
|
||||
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);
|
||||
}
|
||||
|
||||
/* Jason was here */
|
||||
static int vertex_group_invert_locks_exec(bContext *C, wmOperator *UNUSED(op))
|
||||
static int vertex_group_lock_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data;
|
||||
|
||||
vgroup_invert_locks(ob);
|
||||
int action = RNA_enum_get(op->ptr, "action");
|
||||
|
||||
vgroup_lock_all(ob, action);
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
/* Jason was here */
|
||||
void OBJECT_OT_vertex_group_invert_locks(wmOperatorType *ot)
|
||||
void OBJECT_OT_vertex_group_lock(wmOperatorType *ot)
|
||||
{
|
||||
/* identifiers */
|
||||
ot->name= "Invert All Vertex Group Locks";
|
||||
ot->idname= "OBJECT_OT_vertex_group_invert_locks";
|
||||
ot->name= "Change the Lock On Vertex Groups";
|
||||
ot->idname= "OBJECT_OT_vertex_group_lock";
|
||||
|
||||
/* api callbacks */
|
||||
ot->poll= vertex_group_poll;
|
||||
ot->exec= vertex_group_invert_locks_exec;
|
||||
ot->exec= vertex_group_lock_exec;
|
||||
|
||||
/* flags */
|
||||
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
|
||||
|
||||
WM_operator_properties_select_all(ot);
|
||||
}
|
||||
/* Jason was here */
|
||||
static int vertex_group_lock_all_exec(bContext *C, wmOperator *UNUSED(op))
|
||||
{
|
||||
Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data;
|
||||
|
||||
vgroup_lock_all(ob);
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
/* Jason was here */
|
||||
void OBJECT_OT_vertex_group_lock_all(wmOperatorType *ot)
|
||||
{
|
||||
/* identifiers */
|
||||
ot->name= "Turn on all Vertex Group Locks";
|
||||
ot->idname= "OBJECT_OT_vertex_group_lock_all";
|
||||
|
||||
/* api callbacks */
|
||||
ot->poll= vertex_group_poll;
|
||||
ot->exec= vertex_group_lock_all_exec;
|
||||
|
||||
/* flags */
|
||||
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
|
||||
}
|
||||
/* Jason was here */
|
||||
static int vertex_group_unlock_all_exec(bContext *C, wmOperator *UNUSED(op))
|
||||
{
|
||||
Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data;
|
||||
|
||||
vgroup_unlock_all(ob);
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
/* Jason was here */
|
||||
void OBJECT_OT_vertex_group_unlock_all(wmOperatorType *ot)
|
||||
{
|
||||
/* identifiers */
|
||||
ot->name= "Turn off all Vertex Group Locks";
|
||||
ot->idname= "OBJECT_OT_vertex_group_unlock_all";
|
||||
|
||||
/* api callbacks */
|
||||
ot->poll= vertex_group_poll;
|
||||
ot->exec= vertex_group_unlock_all_exec;
|
||||
|
||||
/* flags */
|
||||
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
|
||||
}
|
||||
static int vertex_group_invert_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data;
|
||||
|
@ -759,12 +759,12 @@ typedef struct ToolSettings {
|
||||
short snap_flag, snap_target;
|
||||
short proportional, prop_mode;
|
||||
char proportional_objects; /* proportional edit, object mode */
|
||||
char pad[7];
|
||||
char pad[5];
|
||||
|
||||
int auto_normalize; /*auto normalizing mode in wpaint*/
|
||||
char auto_normalize; /*auto normalizing mode in wpaint*/
|
||||
|
||||
//Jason
|
||||
int multipaint; /* paint multiple bones in wpaint */
|
||||
char multipaint; /* paint multiple bones in wpaint */
|
||||
|
||||
short sculpt_paint_settings; /* user preferences for sculpt and paint */
|
||||
short pad1;
|
||||
|
Loading…
Reference in New Issue
Block a user