Cleanup: early return & avoid compare strings unnecessarily
`transform_poll_property` can be smarter in the conditions.
This commit is contained in:
parent
57b148efbc
commit
31745a53f4
@ -558,33 +558,28 @@ static bool transform_poll_property(const bContext *C, wmOperator *op, const Pro
|
||||
const char *prop_id = RNA_property_identifier(prop);
|
||||
|
||||
/* Orientation/Constraints. */
|
||||
{
|
||||
if (STRPREFIX(prop_id, "constraint")) {
|
||||
/* Hide orientation axis if no constraints are set, since it won't be used. */
|
||||
PropertyRNA *prop_con = RNA_struct_find_property(op->ptr, "orient_type");
|
||||
if (!ELEM(prop_con, nullptr, prop)) {
|
||||
if (STRPREFIX(prop_id, "constraint")) {
|
||||
|
||||
/* Special case: show constraint axis if we don't have values,
|
||||
* needed for mirror operator. */
|
||||
if (STREQ(prop_id, "constraint_axis") &&
|
||||
(RNA_struct_find_property(op->ptr, "value") == nullptr))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
/* Special case: show constraint axis if we don't have values,
|
||||
* needed for mirror operator. */
|
||||
if (STREQ(prop_id, "constraint_axis") &&
|
||||
(RNA_struct_find_property(op->ptr, "value") == nullptr))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/* Orientation Axis. */
|
||||
{
|
||||
if (STREQ(prop_id, "orient_axis")) {
|
||||
eTfmMode mode = (eTfmMode)transformops_mode(op);
|
||||
if (mode == TFM_ALIGN) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (STREQ(prop_id, "orient_axis")) {
|
||||
eTfmMode mode = (eTfmMode)transformops_mode(op);
|
||||
return mode != TFM_ALIGN;
|
||||
}
|
||||
|
||||
/* Proportional Editing. */
|
||||
@ -604,15 +599,12 @@ static bool transform_poll_property(const bContext *C, wmOperator *op, const Pro
|
||||
* - "use_proportional_projected". */
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/* Snapping. */
|
||||
{
|
||||
if (STREQ(prop_id, "use_snap_project")) {
|
||||
if (RNA_boolean_get(op->ptr, "snap") == false) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (STREQ(prop_id, "use_snap_project")) {
|
||||
return RNA_boolean_get(op->ptr, "snap");
|
||||
}
|
||||
|
||||
return true;
|
||||
|
Loading…
Reference in New Issue
Block a user