Cleanup: remove return value from ED_object_add_generic_get_opts
This was never false, many callers already ignored the return value.
This commit is contained in:
parent
1d9ed41560
commit
01f8e20681
|
@ -509,11 +509,8 @@ static int curvesurf_prim_add(bContext *C, wmOperator *op, int type, int isSurf)
|
|||
|
||||
WM_operator_view3d_unit_defaults(C, op);
|
||||
|
||||
if (!ED_object_add_generic_get_opts(
|
||||
C, op, 'Z', loc, rot, nullptr, &enter_editmode, &local_view_bits, nullptr))
|
||||
{
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
ED_object_add_generic_get_opts(
|
||||
C, op, 'Z', loc, rot, nullptr, &enter_editmode, &local_view_bits, nullptr);
|
||||
|
||||
if (!isSurf) { /* adding curve */
|
||||
if (obedit == nullptr || obedit->type != OB_CURVES_LEGACY) {
|
||||
|
|
|
@ -343,7 +343,7 @@ void ED_object_add_unit_props_radius_ex(wmOperatorType *ot, float default_value)
|
|||
void ED_object_add_unit_props_radius(wmOperatorType *ot);
|
||||
void ED_object_add_generic_props(wmOperatorType *ot, bool do_editmode);
|
||||
void ED_object_add_mesh_props(wmOperatorType *ot);
|
||||
bool ED_object_add_generic_get_opts(bContext *C,
|
||||
void ED_object_add_generic_get_opts(bContext *C,
|
||||
wmOperator *op,
|
||||
char view_align_axis,
|
||||
float r_loc[3],
|
||||
|
|
|
@ -466,7 +466,7 @@ void ED_object_add_mesh_props(wmOperatorType *ot)
|
|||
RNA_def_boolean(ot->srna, "calc_uvs", true, "Generate UVs", "Generate a default UV map");
|
||||
}
|
||||
|
||||
bool ED_object_add_generic_get_opts(bContext *C,
|
||||
void ED_object_add_generic_get_opts(bContext *C,
|
||||
wmOperator *op,
|
||||
const char view_align_axis,
|
||||
float r_loc[3],
|
||||
|
@ -603,8 +603,6 @@ bool ED_object_add_generic_get_opts(bContext *C,
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Object *ED_object_add_type_with_obdata(bContext *C,
|
||||
|
@ -697,11 +695,9 @@ static int object_add_exec(bContext *C, wmOperator *op)
|
|||
bool enter_editmode;
|
||||
float loc[3], rot[3], radius;
|
||||
WM_operator_view3d_unit_defaults(C, op);
|
||||
if (!ED_object_add_generic_get_opts(
|
||||
C, op, 'Z', loc, rot, nullptr, &enter_editmode, &local_view_bits, nullptr))
|
||||
{
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
ED_object_add_generic_get_opts(
|
||||
C, op, 'Z', loc, rot, nullptr, &enter_editmode, &local_view_bits, nullptr);
|
||||
|
||||
radius = RNA_float_get(op->ptr, "radius");
|
||||
Object *ob = ED_object_add_type(
|
||||
C, RNA_enum_get(op->ptr, "type"), nullptr, loc, rot, enter_editmode, local_view_bits);
|
||||
|
@ -767,11 +763,9 @@ static int lightprobe_add_exec(bContext *C, wmOperator *op)
|
|||
ushort local_view_bits;
|
||||
float loc[3], rot[3];
|
||||
WM_operator_view3d_unit_defaults(C, op);
|
||||
if (!ED_object_add_generic_get_opts(
|
||||
C, op, 'Z', loc, rot, nullptr, &enter_editmode, &local_view_bits, nullptr))
|
||||
{
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
ED_object_add_generic_get_opts(
|
||||
C, op, 'Z', loc, rot, nullptr, &enter_editmode, &local_view_bits, nullptr);
|
||||
|
||||
int type = RNA_enum_get(op->ptr, "type");
|
||||
float radius = RNA_float_get(op->ptr, "radius");
|
||||
|
||||
|
@ -860,11 +854,9 @@ static int effector_add_exec(bContext *C, wmOperator *op)
|
|||
ushort local_view_bits;
|
||||
float loc[3], rot[3];
|
||||
WM_operator_view3d_unit_defaults(C, op);
|
||||
if (!ED_object_add_generic_get_opts(
|
||||
C, op, 'Z', loc, rot, nullptr, &enter_editmode, &local_view_bits, nullptr))
|
||||
{
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
ED_object_add_generic_get_opts(
|
||||
C, op, 'Z', loc, rot, nullptr, &enter_editmode, &local_view_bits, nullptr);
|
||||
|
||||
const ePFieldType type = static_cast<ePFieldType>(RNA_enum_get(op->ptr, "type"));
|
||||
float dia = RNA_float_get(op->ptr, "radius");
|
||||
|
||||
|
@ -940,11 +932,9 @@ static int object_camera_add_exec(bContext *C, wmOperator *op)
|
|||
ushort local_view_bits;
|
||||
bool enter_editmode;
|
||||
float loc[3], rot[3];
|
||||
if (!ED_object_add_generic_get_opts(
|
||||
C, op, 'Z', loc, rot, nullptr, &enter_editmode, &local_view_bits, nullptr))
|
||||
{
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
ED_object_add_generic_get_opts(
|
||||
C, op, 'Z', loc, rot, nullptr, &enter_editmode, &local_view_bits, nullptr);
|
||||
|
||||
Object *ob = ED_object_add_type(C, OB_CAMERA, nullptr, loc, rot, false, local_view_bits);
|
||||
|
||||
if (v3d) {
|
||||
|
@ -1002,11 +992,8 @@ static int object_metaball_add_exec(bContext *C, wmOperator *op)
|
|||
bool enter_editmode;
|
||||
float loc[3], rot[3];
|
||||
WM_operator_view3d_unit_defaults(C, op);
|
||||
if (!ED_object_add_generic_get_opts(
|
||||
C, op, 'Z', loc, rot, nullptr, &enter_editmode, &local_view_bits, nullptr))
|
||||
{
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
ED_object_add_generic_get_opts(
|
||||
C, op, 'Z', loc, rot, nullptr, &enter_editmode, &local_view_bits, nullptr);
|
||||
|
||||
bool newob = false;
|
||||
BKE_view_layer_synced_ensure(scene, view_layer);
|
||||
|
@ -1075,11 +1062,9 @@ static int object_add_text_exec(bContext *C, wmOperator *op)
|
|||
float loc[3], rot[3];
|
||||
|
||||
WM_operator_view3d_unit_defaults(C, op);
|
||||
if (!ED_object_add_generic_get_opts(
|
||||
C, op, 'Z', loc, rot, nullptr, &enter_editmode, &local_view_bits, nullptr))
|
||||
{
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
ED_object_add_generic_get_opts(
|
||||
C, op, 'Z', loc, rot, nullptr, &enter_editmode, &local_view_bits, nullptr);
|
||||
|
||||
if (obedit && obedit->type == OB_FONT) {
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
|
@ -1131,11 +1116,9 @@ static int object_armature_add_exec(bContext *C, wmOperator *op)
|
|||
bool view_aligned = rv3d && (U.flag & USER_ADD_VIEWALIGNED);
|
||||
|
||||
WM_operator_view3d_unit_defaults(C, op);
|
||||
if (!ED_object_add_generic_get_opts(
|
||||
C, op, 'Z', loc, rot, nullptr, &enter_editmode, &local_view_bits, nullptr))
|
||||
{
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
ED_object_add_generic_get_opts(
|
||||
C, op, 'Z', loc, rot, nullptr, &enter_editmode, &local_view_bits, nullptr);
|
||||
|
||||
if ((obedit == nullptr) || (obedit->type != OB_ARMATURE)) {
|
||||
obedit = ED_object_add_type(C, OB_ARMATURE, nullptr, loc, rot, true, local_view_bits);
|
||||
ED_object_editmode_enter_ex(bmain, scene, obedit, 0);
|
||||
|
@ -1199,11 +1182,9 @@ static int object_empty_add_exec(bContext *C, wmOperator *op)
|
|||
float loc[3], rot[3];
|
||||
|
||||
WM_operator_view3d_unit_defaults(C, op);
|
||||
if (!ED_object_add_generic_get_opts(
|
||||
C, op, 'Z', loc, rot, nullptr, nullptr, &local_view_bits, nullptr))
|
||||
{
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
ED_object_add_generic_get_opts(
|
||||
C, op, 'Z', loc, rot, nullptr, nullptr, &local_view_bits, nullptr);
|
||||
|
||||
ob = ED_object_add_type(C, OB_EMPTY, nullptr, loc, rot, false, local_view_bits);
|
||||
|
||||
BKE_object_empty_draw_type_set(ob, type);
|
||||
|
@ -1247,11 +1228,9 @@ static int object_image_add_exec(bContext *C, wmOperator *op)
|
|||
ushort local_view_bits;
|
||||
float loc[3], rot[3];
|
||||
|
||||
if (!ED_object_add_generic_get_opts(
|
||||
C, op, 'Z', loc, rot, nullptr, nullptr, &local_view_bits, nullptr))
|
||||
{
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
ED_object_add_generic_get_opts(
|
||||
C, op, 'Z', loc, rot, nullptr, nullptr, &local_view_bits, nullptr);
|
||||
|
||||
Object *ob = ED_object_add_type(C, OB_EMPTY, nullptr, loc, rot, false, local_view_bits);
|
||||
ob->empty_drawsize = 5.0f;
|
||||
|
||||
|
@ -1412,11 +1391,9 @@ static int object_gpencil_add_exec(bContext *C, wmOperator *op)
|
|||
|
||||
/* NOTE: We use 'Y' here (not 'Z'), as. */
|
||||
WM_operator_view3d_unit_defaults(C, op);
|
||||
if (!ED_object_add_generic_get_opts(
|
||||
C, op, 'Y', loc, rot, nullptr, nullptr, &local_view_bits, nullptr))
|
||||
{
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
ED_object_add_generic_get_opts(
|
||||
C, op, 'Y', loc, rot, nullptr, nullptr, &local_view_bits, nullptr);
|
||||
|
||||
/* Add new object if not currently editing a GP object. */
|
||||
if ((gpd == nullptr) || (GPENCIL_ANY_MODE(gpd) == false)) {
|
||||
const char *ob_name = nullptr;
|
||||
|
@ -1664,11 +1641,8 @@ static int object_grease_pencil_add_exec(bContext *C, wmOperator *op)
|
|||
|
||||
/* NOTE: We use 'Y' here (not 'Z'), as. */
|
||||
WM_operator_view3d_unit_defaults(C, op);
|
||||
if (!ED_object_add_generic_get_opts(
|
||||
C, op, 'Y', loc, rot, nullptr, nullptr, &local_view_bits, nullptr))
|
||||
{
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
ED_object_add_generic_get_opts(
|
||||
C, op, 'Y', loc, rot, nullptr, nullptr, &local_view_bits, nullptr);
|
||||
|
||||
const char *ob_name = nullptr;
|
||||
switch (type) {
|
||||
|
@ -1866,11 +1840,9 @@ static int object_light_add_exec(bContext *C, wmOperator *op)
|
|||
float loc[3], rot[3];
|
||||
|
||||
WM_operator_view3d_unit_defaults(C, op);
|
||||
if (!ED_object_add_generic_get_opts(
|
||||
C, op, 'Z', loc, rot, nullptr, nullptr, &local_view_bits, nullptr))
|
||||
{
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
ED_object_add_generic_get_opts(
|
||||
C, op, 'Z', loc, rot, nullptr, nullptr, &local_view_bits, nullptr);
|
||||
|
||||
ob = ED_object_add_type(C, OB_LAMP, get_light_defname(type), loc, rot, false, local_view_bits);
|
||||
|
||||
float size = RNA_float_get(op->ptr, "radius");
|
||||
|
@ -1973,18 +1945,15 @@ static std::optional<CollectionAddInfo> collection_add_info_get_from_op(bContext
|
|||
return std::nullopt;
|
||||
}
|
||||
|
||||
if (!ED_object_add_generic_get_opts(C,
|
||||
op,
|
||||
'Z',
|
||||
add_info.loc,
|
||||
add_info.rot,
|
||||
nullptr,
|
||||
nullptr,
|
||||
&add_info.local_view_bits,
|
||||
nullptr))
|
||||
{
|
||||
return std::nullopt;
|
||||
}
|
||||
ED_object_add_generic_get_opts(C,
|
||||
op,
|
||||
'Z',
|
||||
add_info.loc,
|
||||
add_info.rot,
|
||||
nullptr,
|
||||
nullptr,
|
||||
&add_info.local_view_bits,
|
||||
nullptr);
|
||||
|
||||
ViewLayer *view_layer = CTX_data_view_layer(C);
|
||||
|
||||
|
@ -2209,11 +2178,8 @@ static int object_data_instance_add_exec(bContext *C, wmOperator *op)
|
|||
}
|
||||
}
|
||||
|
||||
if (!ED_object_add_generic_get_opts(
|
||||
C, op, 'Z', loc, rot, nullptr, nullptr, &local_view_bits, nullptr))
|
||||
{
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
ED_object_add_generic_get_opts(
|
||||
C, op, 'Z', loc, rot, nullptr, nullptr, &local_view_bits, nullptr);
|
||||
|
||||
ED_object_add_type_with_obdata(
|
||||
C, object_type, id->name + 2, loc, rot, false, local_view_bits, id);
|
||||
|
@ -2258,11 +2224,9 @@ static int object_speaker_add_exec(bContext *C, wmOperator *op)
|
|||
|
||||
ushort local_view_bits;
|
||||
float loc[3], rot[3];
|
||||
if (!ED_object_add_generic_get_opts(
|
||||
C, op, 'Z', loc, rot, nullptr, nullptr, &local_view_bits, nullptr))
|
||||
{
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
ED_object_add_generic_get_opts(
|
||||
C, op, 'Z', loc, rot, nullptr, nullptr, &local_view_bits, nullptr);
|
||||
|
||||
Object *ob = ED_object_add_type(C, OB_SPEAKER, nullptr, loc, rot, false, local_view_bits);
|
||||
const bool is_liboverride = ID_IS_OVERRIDE_LIBRARY(ob);
|
||||
|
||||
|
@ -2319,11 +2283,8 @@ static int object_curves_random_add_exec(bContext *C, wmOperator *op)
|
|||
|
||||
ushort local_view_bits;
|
||||
float loc[3], rot[3];
|
||||
if (!ED_object_add_generic_get_opts(
|
||||
C, op, 'Z', loc, rot, nullptr, nullptr, &local_view_bits, nullptr))
|
||||
{
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
ED_object_add_generic_get_opts(
|
||||
C, op, 'Z', loc, rot, nullptr, nullptr, &local_view_bits, nullptr);
|
||||
|
||||
Object *object = ED_object_add_type(C, OB_CURVES, nullptr, loc, rot, false, local_view_bits);
|
||||
|
||||
|
@ -2355,11 +2316,8 @@ static int object_curves_empty_hair_add_exec(bContext *C, wmOperator *op)
|
|||
Scene *scene = CTX_data_scene(C);
|
||||
|
||||
ushort local_view_bits;
|
||||
if (!ED_object_add_generic_get_opts(
|
||||
C, op, 'Z', nullptr, nullptr, nullptr, nullptr, &local_view_bits, nullptr))
|
||||
{
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
ED_object_add_generic_get_opts(
|
||||
C, op, 'Z', nullptr, nullptr, nullptr, nullptr, &local_view_bits, nullptr);
|
||||
|
||||
Object *surface_ob = CTX_data_active_object(C);
|
||||
BLI_assert(surface_ob != nullptr);
|
||||
|
@ -2439,11 +2397,8 @@ static int object_pointcloud_add_exec(bContext *C, wmOperator *op)
|
|||
{
|
||||
ushort local_view_bits;
|
||||
float loc[3], rot[3];
|
||||
if (!ED_object_add_generic_get_opts(
|
||||
C, op, 'Z', loc, rot, nullptr, nullptr, &local_view_bits, nullptr))
|
||||
{
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
ED_object_add_generic_get_opts(
|
||||
C, op, 'Z', loc, rot, nullptr, nullptr, &local_view_bits, nullptr);
|
||||
|
||||
Object *object = ED_object_add_type(C, OB_POINTCLOUD, nullptr, loc, rot, false, local_view_bits);
|
||||
object->dtx |= OB_DRAWBOUNDOX; /* TODO: remove once there is actual drawing. */
|
||||
|
|
|
@ -41,11 +41,9 @@ static Object *object_volume_add(bContext *C, wmOperator *op, const char *name)
|
|||
ushort local_view_bits;
|
||||
float loc[3], rot[3];
|
||||
|
||||
if (!ED_object_add_generic_get_opts(
|
||||
C, op, 'Z', loc, rot, nullptr, nullptr, &local_view_bits, nullptr))
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
ED_object_add_generic_get_opts(
|
||||
C, op, 'Z', loc, rot, nullptr, nullptr, &local_view_bits, nullptr);
|
||||
|
||||
return ED_object_add_type(C, OB_VOLUME, name, loc, rot, false, local_view_bits);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue