Cleanup: style

This commit is contained in:
Campbell Barton 2018-10-07 17:49:22 +11:00
parent db1a04313c
commit ee2e30683c
6 changed files with 34 additions and 27 deletions

View File

@ -505,7 +505,7 @@ static int armature_duplicate_selected_exec(bContext *C, wmOperator *op)
if (arm->flag & ARM_MIRROR_EDIT) {
for (ebone_iter = arm->edbo->first; ebone_iter; ebone_iter = ebone_iter->next) {
if (EBONE_VISIBLE(arm, ebone_iter) &&
(ebone_iter->flag & BONE_SELECTED))
(ebone_iter->flag & BONE_SELECTED))
{
EditBone *ebone;
@ -520,7 +520,7 @@ static int armature_duplicate_selected_exec(bContext *C, wmOperator *op)
/* Find the selected bones and duplicate them as needed */
for (ebone_iter = arm->edbo->first; ebone_iter && ebone_iter != ebone_first_dupe; ebone_iter = ebone_iter->next) {
if (EBONE_VISIBLE(arm, ebone_iter) &&
(ebone_iter->flag & BONE_SELECTED))
(ebone_iter->flag & BONE_SELECTED))
{
EditBone *ebone;
char new_bone_name_buff[MAXBONENAME];
@ -547,7 +547,7 @@ static int armature_duplicate_selected_exec(bContext *C, wmOperator *op)
/* Run though the list and fix the pointers */
for (ebone_iter = arm->edbo->first; ebone_iter && ebone_iter != ebone_first_dupe; ebone_iter = ebone_iter->next) {
if (EBONE_VISIBLE(arm, ebone_iter) &&
(ebone_iter->flag & BONE_SELECTED))
(ebone_iter->flag & BONE_SELECTED))
{
EditBone *ebone = ebone_iter->temp.ebone;
@ -660,7 +660,7 @@ static int armature_symmetrize_exec(bContext *C, wmOperator *op)
/* Select mirrored bones */
for (ebone_iter = arm->edbo->first; ebone_iter; ebone_iter = ebone_iter->next) {
if (EBONE_VISIBLE(arm, ebone_iter) &&
(ebone_iter->flag & BONE_SELECTED))
(ebone_iter->flag & BONE_SELECTED))
{
char name_flip[MAXBONENAME];
@ -718,9 +718,9 @@ static int armature_symmetrize_exec(bContext *C, wmOperator *op)
/* Find the selected bones and duplicate them as needed, with mirrored name */
for (ebone_iter = arm->edbo->first; ebone_iter && ebone_iter != ebone_first_dupe; ebone_iter = ebone_iter->next) {
if (EBONE_VISIBLE(arm, ebone_iter) &&
(ebone_iter->flag & BONE_SELECTED) &&
/* will be set if the mirror bone already exists (no need to make a new one) */
(ebone_iter->temp.ebone == NULL))
(ebone_iter->flag & BONE_SELECTED) &&
/* will be set if the mirror bone already exists (no need to make a new one) */
(ebone_iter->temp.ebone == NULL))
{
char name_flip[MAXBONENAME];
@ -759,9 +759,10 @@ static int armature_symmetrize_exec(bContext *C, wmOperator *op)
}
else {
/* the parent may have been duplicated, if not lookup the mirror parent */
EditBone *ebone_parent =
(ebone_iter->parent->temp.ebone ?
ebone_iter->parent->temp.ebone : ED_armature_ebone_get_mirrored(arm->edbo, ebone_iter->parent));
EditBone *ebone_parent = (
ebone_iter->parent->temp.ebone ?
ebone_iter->parent->temp.ebone :
ED_armature_ebone_get_mirrored(arm->edbo, ebone_iter->parent));
if (ebone_parent == NULL) {
/* If the mirror lookup failed, (but the current bone has a parent)
@ -796,14 +797,20 @@ static int armature_symmetrize_exec(bContext *C, wmOperator *op)
* so we don't need this anymore */
/* Deselect the old bones and select the new ones */
for (ebone_iter = arm->edbo->first; ebone_iter && ebone_iter != ebone_first_dupe; ebone_iter = ebone_iter->next) {
for (ebone_iter = arm->edbo->first;
ebone_iter && ebone_iter != ebone_first_dupe;
ebone_iter = ebone_iter->next)
{
if (EBONE_VISIBLE(arm, ebone_iter)) {
ebone_iter->flag &= ~(BONE_SELECTED | BONE_TIPSEL | BONE_ROOTSEL);
}
}
/* New bones will be selected, but some of the bones may already exist */
for (ebone_iter = arm->edbo->first; ebone_iter && ebone_iter != ebone_first_dupe; ebone_iter = ebone_iter->next) {
for (ebone_iter = arm->edbo->first;
ebone_iter && ebone_iter != ebone_first_dupe;
ebone_iter = ebone_iter->next)
{
EditBone *ebone = ebone_iter->temp.ebone;
if (ebone && EBONE_SELECTABLE(arm, ebone)) {
ED_armature_ebone_select_set(ebone, true);
@ -936,7 +943,8 @@ static int armature_extrude_exec(bContext *C, wmOperator *op)
copy_v3_v3(newbone->tail, newbone->head);
newbone->parent = ebone;
newbone->flag = ebone->flag & (BONE_TIPSEL | BONE_RELATIVE_PARENTING); // copies it, in case mirrored bone
/* copies it, in case mirrored bone */
newbone->flag = ebone->flag & (BONE_TIPSEL | BONE_RELATIVE_PARENTING);
if (newbone->parent) newbone->flag |= BONE_CONNECTED;
}

View File

@ -966,7 +966,7 @@ static int armature_merge_exec(bContext *C, wmOperator *op)
/* get chains (ends on chains) */
chains_find_tips(arm->edbo, &chains);
if (BLI_listbase_is_empty(&chains)) {
continue;
continue;
}
/* each 'chain' is the last bone in the chain (with no children) */
@ -982,8 +982,8 @@ static int armature_merge_exec(bContext *C, wmOperator *op)
for (ebo = chain->data; ebo; child = ebo, ebo = ebo->parent) {
/* check if visible + selected */
if (EBONE_VISIBLE(arm, ebo) &&
((ebo->flag & BONE_CONNECTED) || (ebo->parent == NULL)) &&
(ebo->flag & BONE_SELECTED) )
((ebo->flag & BONE_CONNECTED) || (ebo->parent == NULL)) &&
(ebo->flag & BONE_SELECTED) )
{
/* set either end or start (end gets priority, unless it is already set) */
if (bend == NULL) {

View File

@ -429,10 +429,10 @@ static int armature_flip_names_exec(bContext *C, wmOperator *op)
BLI_addtail(&bones_names, BLI_genericNodeN(ebone->name));
if (arm->flag & ARM_MIRROR_EDIT) {
EditBone *flipbone = ED_armature_ebone_get_mirrored(arm->edbo, ebone);
if ((flipbone) && !(flipbone->flag & BONE_SELECTED)) {
BLI_addtail(&bones_names, BLI_genericNodeN(flipbone->name));
}
EditBone *flipbone = ED_armature_ebone_get_mirrored(arm->edbo, ebone);
if ((flipbone) && !(flipbone->flag & BONE_SELECTED)) {
BLI_addtail(&bones_names, BLI_genericNodeN(flipbone->name));
}
}
}
}

View File

@ -1252,10 +1252,10 @@ static void rna_def_gpencil_grid(BlenderRNA *brna)
srna = RNA_def_struct(brna, "GreasePencilGrid", NULL);
RNA_def_struct_sdna(srna, "bGPgrid");
RNA_def_struct_nested(brna, srna, "GreasePencil");
RNA_def_struct_path_func(srna, "rna_GreasePencilGrid_path");
RNA_def_struct_ui_text(srna, "Grid and Canvas Settings",
"Settings for grid and canvas in 3D viewport");
"Settings for grid and canvas in 3D viewport");
prop = RNA_def_property(srna, "scale", PROP_FLOAT, PROP_XYZ);
RNA_def_property_float_sdna(prop, NULL, "scale");

View File

@ -132,7 +132,7 @@ Py_LOCAL_INLINE(int64_t) PyC_Long_AsI64(PyObject *value) { return (int64_t)PyLo
Py_LOCAL_INLINE(uint64_t) PyC_Long_AsU64(PyObject *value) { return (uint64_t)PyLong_AsUnsignedLongLong(value); }
/* utils for format string in `struct` module style syntax */
Py_LOCAL_INLINE(char) PyC_Formatstr_get(char *typestr)
Py_LOCAL_INLINE(char) PyC_Formatstr_get(const char *typestr)
{
switch (typestr[0]) {
case '!':

View File

@ -146,10 +146,9 @@ static int bpygpu_ParseVertFetchMode(PyObject *o, void *p)
static int get_default_fetch_mode(GPUVertCompType type)
{
switch (type)
{
case GPU_COMP_F32: return GPU_FETCH_FLOAT;
default: return -1;
switch (type) {
case GPU_COMP_F32: return GPU_FETCH_FLOAT;
default: return -1;
}
}