Cleanup: Clang-Tidy else-after-return fixes
This addresses warnings from Clang-Tidy's `readability-else-after-return` rule. This should be the final commit of the series of commits that addresses this particular rule. No functional changes.
This commit is contained in:
parent
3d48d99647
commit
c04088fed1
Notes:
blender-bot
2023-12-22 20:14:11 +01:00
Referenced by commit 10e2b77121
, Cleanup: makesrna, Clang-tidy else-after-return-fixes.
|
@ -12,7 +12,6 @@ Checks: >
|
|||
|
||||
-readability-misleading-indentation,
|
||||
|
||||
-readability-else-after-return,
|
||||
-readability-inconsistent-declaration-parameter-name,
|
||||
-readability-redundant-preprocessor,
|
||||
-readability-function-size,
|
||||
|
|
|
@ -249,9 +249,8 @@ size_t MEM_guarded_allocN_len(const void *vmemh)
|
|||
memh--;
|
||||
return memh->len;
|
||||
}
|
||||
else {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void *MEM_guarded_dupallocN(const void *vmemh)
|
||||
|
@ -611,12 +610,11 @@ static int compare_len(const void *p1, const void *p2)
|
|||
if (pb1->len < pb2->len) {
|
||||
return 1;
|
||||
}
|
||||
else if (pb1->len == pb2->len) {
|
||||
if (pb1->len == pb2->len) {
|
||||
return 0;
|
||||
}
|
||||
else {
|
||||
return -1;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
void MEM_guarded_printmemlist_stats(void)
|
||||
|
@ -682,7 +680,7 @@ void MEM_guarded_printmemlist_stats(void)
|
|||
if (a == b) {
|
||||
continue;
|
||||
}
|
||||
else if (strcmp(printblock[a].name, printblock[b].name) == 0) {
|
||||
if (strcmp(printblock[a].name, printblock[b].name) == 0) {
|
||||
printblock[b].len += printblock[a].len;
|
||||
printblock[b].items++;
|
||||
}
|
||||
|
@ -1213,8 +1211,7 @@ const char *MEM_guarded_name_ptr(void *vmemh)
|
|||
memh--;
|
||||
return memh->name;
|
||||
}
|
||||
else {
|
||||
return "MEM_guarded_name_ptr(NULL)";
|
||||
}
|
||||
|
||||
return "MEM_guarded_name_ptr(NULL)";
|
||||
}
|
||||
#endif /* NDEBUG */
|
||||
|
|
|
@ -94,9 +94,8 @@ size_t MEM_lockfree_allocN_len(const void *vmemh)
|
|||
if (vmemh) {
|
||||
return MEMHEAD_FROM_PTR(vmemh)->len & ~((size_t)(MEMHEAD_ALIGN_FLAG));
|
||||
}
|
||||
else {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void MEM_lockfree_freeN(void *vmemh)
|
||||
|
@ -436,8 +435,7 @@ const char *MEM_lockfree_name_ptr(void *vmemh)
|
|||
if (vmemh) {
|
||||
return "unknown block name ptr";
|
||||
}
|
||||
else {
|
||||
return "MEM_lockfree_name_ptr(NULL)";
|
||||
}
|
||||
|
||||
return "MEM_lockfree_name_ptr(NULL)";
|
||||
}
|
||||
#endif /* NDEBUG */
|
||||
|
|
|
@ -120,9 +120,9 @@ const char *BLT_translate_do(const char *msgctxt, const char *msgid)
|
|||
if (BLT_translate()) {
|
||||
return BLT_pgettext(msgctxt, msgid);
|
||||
}
|
||||
else {
|
||||
return msgid;
|
||||
}
|
||||
|
||||
return msgid;
|
||||
|
||||
#else
|
||||
(void)msgctxt;
|
||||
return msgid;
|
||||
|
@ -135,9 +135,9 @@ const char *BLT_translate_do_iface(const char *msgctxt, const char *msgid)
|
|||
if (BLT_translate_iface()) {
|
||||
return BLT_pgettext(msgctxt, msgid);
|
||||
}
|
||||
else {
|
||||
return msgid;
|
||||
}
|
||||
|
||||
return msgid;
|
||||
|
||||
#else
|
||||
(void)msgctxt;
|
||||
return msgid;
|
||||
|
@ -150,9 +150,9 @@ const char *BLT_translate_do_tooltip(const char *msgctxt, const char *msgid)
|
|||
if (BLT_translate_tooltips()) {
|
||||
return BLT_pgettext(msgctxt, msgid);
|
||||
}
|
||||
else {
|
||||
return msgid;
|
||||
}
|
||||
|
||||
return msgid;
|
||||
|
||||
#else
|
||||
(void)msgctxt;
|
||||
return msgid;
|
||||
|
@ -165,9 +165,9 @@ const char *BLT_translate_do_new_dataname(const char *msgctxt, const char *msgid
|
|||
if (BLT_translate_new_dataname()) {
|
||||
return BLT_pgettext(msgctxt, msgid);
|
||||
}
|
||||
else {
|
||||
return msgid;
|
||||
}
|
||||
|
||||
return msgid;
|
||||
|
||||
#else
|
||||
(void)msgctxt;
|
||||
return msgid;
|
||||
|
|
|
@ -179,13 +179,12 @@ BMLoop *BM_loop_other_vert_loop_by_edge(BMLoop *l, BMEdge *e)
|
|||
if (l->e == e) {
|
||||
return l->next;
|
||||
}
|
||||
else if (l->prev->e == e) {
|
||||
if (l->prev->e == e) {
|
||||
return l->prev;
|
||||
}
|
||||
else {
|
||||
BLI_assert(0);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
BLI_assert(0);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -42,14 +42,13 @@ bool AttributesInfoBuilder::add(StringRef name, const CPPType &type, const void
|
|||
defaults_.append(dst);
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
const CPPType &stored_type = *types_[names_.index_of_as(name)];
|
||||
if (stored_type != type) {
|
||||
std::cout << "Warning: Tried to add an attribute twice with different types (" << name
|
||||
<< ": " << stored_type.name() << ", " << type.name() << ").\n";
|
||||
}
|
||||
return false;
|
||||
|
||||
const CPPType &stored_type = *types_[names_.index_of_as(name)];
|
||||
if (stored_type != type) {
|
||||
std::cout << "Warning: Tried to add an attribute twice with different types (" << name << ": "
|
||||
<< stored_type.name() << ", " << type.name() << ").\n";
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
AttributesInfo::AttributesInfo(const AttributesInfoBuilder &builder)
|
||||
|
|
|
@ -519,7 +519,7 @@ MFNetworkEvaluationStorage::~MFNetworkEvaluationStorage()
|
|||
if (any_value == nullptr) {
|
||||
continue;
|
||||
}
|
||||
else if (any_value->type == ValueType::OwnSingle) {
|
||||
if (any_value->type == ValueType::OwnSingle) {
|
||||
OwnSingleValue *value = (OwnSingleValue *)any_value;
|
||||
GMutableSpan span = value->span;
|
||||
const CPPType &type = span.type();
|
||||
|
@ -710,10 +710,9 @@ GMutableSpan MFNetworkEvaluationStorage::get_single_output__full(const MFOutputS
|
|||
|
||||
return span;
|
||||
}
|
||||
else {
|
||||
BLI_assert(any_value->type == ValueType::OutputSingle);
|
||||
return ((OutputSingleValue *)any_value)->span;
|
||||
}
|
||||
|
||||
BLI_assert(any_value->type == ValueType::OutputSingle);
|
||||
return ((OutputSingleValue *)any_value)->span;
|
||||
}
|
||||
|
||||
GMutableSpan MFNetworkEvaluationStorage::get_single_output__single(const MFOutputSocket &socket)
|
||||
|
@ -729,12 +728,11 @@ GMutableSpan MFNetworkEvaluationStorage::get_single_output__single(const MFOutpu
|
|||
|
||||
return value->span;
|
||||
}
|
||||
else {
|
||||
BLI_assert(any_value->type == ValueType::OutputSingle);
|
||||
GMutableSpan span = ((OutputSingleValue *)any_value)->span;
|
||||
BLI_assert(span.size() == 1);
|
||||
return span;
|
||||
}
|
||||
|
||||
BLI_assert(any_value->type == ValueType::OutputSingle);
|
||||
GMutableSpan span = ((OutputSingleValue *)any_value)->span;
|
||||
BLI_assert(span.size() == 1);
|
||||
return span;
|
||||
}
|
||||
|
||||
GVectorArray &MFNetworkEvaluationStorage::get_vector_output__full(const MFOutputSocket &socket)
|
||||
|
@ -749,10 +747,9 @@ GVectorArray &MFNetworkEvaluationStorage::get_vector_output__full(const MFOutput
|
|||
|
||||
return *value->vector_array;
|
||||
}
|
||||
else {
|
||||
BLI_assert(any_value->type == ValueType::OutputVector);
|
||||
return *((OutputVectorValue *)any_value)->vector_array;
|
||||
}
|
||||
|
||||
BLI_assert(any_value->type == ValueType::OutputVector);
|
||||
return *((OutputVectorValue *)any_value)->vector_array;
|
||||
}
|
||||
|
||||
GVectorArray &MFNetworkEvaluationStorage::get_vector_output__single(const MFOutputSocket &socket)
|
||||
|
@ -767,12 +764,11 @@ GVectorArray &MFNetworkEvaluationStorage::get_vector_output__single(const MFOutp
|
|||
|
||||
return *value->vector_array;
|
||||
}
|
||||
else {
|
||||
BLI_assert(any_value->type == ValueType::OutputVector);
|
||||
GVectorArray &vector_array = *((OutputVectorValue *)any_value)->vector_array;
|
||||
BLI_assert(vector_array.size() == 1);
|
||||
return vector_array;
|
||||
}
|
||||
|
||||
BLI_assert(any_value->type == ValueType::OutputVector);
|
||||
GVectorArray &vector_array = *((OutputVectorValue *)any_value)->vector_array;
|
||||
BLI_assert(vector_array.size() == 1);
|
||||
return vector_array;
|
||||
}
|
||||
|
||||
GMutableSpan MFNetworkEvaluationStorage::get_mutable_single__full(const MFInputSocket &input,
|
||||
|
@ -955,15 +951,14 @@ GVSpan MFNetworkEvaluationStorage::get_single_input__full(const MFInputSocket &s
|
|||
if (value->is_single_allocated) {
|
||||
return GVSpan::FromSingle(value->span.type(), value->span.data(), min_array_size_);
|
||||
}
|
||||
else {
|
||||
return value->span;
|
||||
}
|
||||
|
||||
return value->span;
|
||||
}
|
||||
else if (any_value->type == ValueType::InputSingle) {
|
||||
if (any_value->type == ValueType::InputSingle) {
|
||||
InputSingleValue *value = (InputSingleValue *)any_value;
|
||||
return value->virtual_span;
|
||||
}
|
||||
else if (any_value->type == ValueType::OutputSingle) {
|
||||
if (any_value->type == ValueType::OutputSingle) {
|
||||
OutputSingleValue *value = (OutputSingleValue *)any_value;
|
||||
BLI_assert(value->is_computed);
|
||||
return value->span;
|
||||
|
@ -984,12 +979,12 @@ GVSpan MFNetworkEvaluationStorage::get_single_input__single(const MFInputSocket
|
|||
BLI_assert(value->span.size() == 1);
|
||||
return value->span;
|
||||
}
|
||||
else if (any_value->type == ValueType::InputSingle) {
|
||||
if (any_value->type == ValueType::InputSingle) {
|
||||
InputSingleValue *value = (InputSingleValue *)any_value;
|
||||
BLI_assert(value->virtual_span.is_single_element());
|
||||
return value->virtual_span;
|
||||
}
|
||||
else if (any_value->type == ValueType::OutputSingle) {
|
||||
if (any_value->type == ValueType::OutputSingle) {
|
||||
OutputSingleValue *value = (OutputSingleValue *)any_value;
|
||||
BLI_assert(value->is_computed);
|
||||
BLI_assert(value->span.size() == 1);
|
||||
|
@ -1012,15 +1007,14 @@ GVArraySpan MFNetworkEvaluationStorage::get_vector_input__full(const MFInputSock
|
|||
GSpan span = (*value->vector_array)[0];
|
||||
return GVArraySpan(span, min_array_size_);
|
||||
}
|
||||
else {
|
||||
return *value->vector_array;
|
||||
}
|
||||
|
||||
return *value->vector_array;
|
||||
}
|
||||
else if (any_value->type == ValueType::InputVector) {
|
||||
if (any_value->type == ValueType::InputVector) {
|
||||
InputVectorValue *value = (InputVectorValue *)any_value;
|
||||
return value->virtual_array_span;
|
||||
}
|
||||
else if (any_value->type == ValueType::OutputVector) {
|
||||
if (any_value->type == ValueType::OutputVector) {
|
||||
OutputVectorValue *value = (OutputVectorValue *)any_value;
|
||||
return *value->vector_array;
|
||||
}
|
||||
|
@ -1040,12 +1034,12 @@ GVArraySpan MFNetworkEvaluationStorage::get_vector_input__single(const MFInputSo
|
|||
BLI_assert(value->vector_array->size() == 1);
|
||||
return *value->vector_array;
|
||||
}
|
||||
else if (any_value->type == ValueType::InputVector) {
|
||||
if (any_value->type == ValueType::InputVector) {
|
||||
InputVectorValue *value = (InputVectorValue *)any_value;
|
||||
BLI_assert(value->virtual_array_span.is_single_array());
|
||||
return value->virtual_array_span;
|
||||
}
|
||||
else if (any_value->type == ValueType::OutputVector) {
|
||||
if (any_value->type == ValueType::OutputVector) {
|
||||
OutputVectorValue *value = (OutputVectorValue *)any_value;
|
||||
BLI_assert(value->vector_array->size() == 1);
|
||||
return *value->vector_array;
|
||||
|
|
|
@ -45,9 +45,8 @@ static bool set_tag_and_check_if_modified(bool &tag, bool new_value)
|
|||
tag = new_value;
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
static Array<bool> mask_nodes_to_the_left(MFNetwork &network, Span<MFNode *> nodes)
|
||||
|
|
|
@ -180,9 +180,8 @@ float get_modifier_point_weight(MDeformVert *dvert, bool inverse, int def_nr)
|
|||
if (inverse == 1) {
|
||||
return 1.0f;
|
||||
}
|
||||
else {
|
||||
return -1.0f;
|
||||
}
|
||||
|
||||
return -1.0f;
|
||||
}
|
||||
|
||||
return weight;
|
||||
|
|
|
@ -484,7 +484,7 @@ static void generate_geometry(GpencilModifierData *md,
|
|||
/* Early exit */
|
||||
return;
|
||||
}
|
||||
else if (ctime >= end_frame) {
|
||||
if (ctime >= end_frame) {
|
||||
/* Past End - Animation finished. Display final result. */
|
||||
if (reverse) {
|
||||
/* 1) Reverse = Start with all, end with nothing.
|
||||
|
|
|
@ -120,7 +120,7 @@ static float gpencil_hook_falloff(const struct GPHookData_cb *tData, const float
|
|||
if (len_sq > tData->falloff_sq) {
|
||||
return 0.0f;
|
||||
}
|
||||
else if (len_sq > 0.0f) {
|
||||
if (len_sq > 0.0f) {
|
||||
float fac;
|
||||
|
||||
if (tData->falloff_type == eGPHook_Falloff_Const) {
|
||||
|
|
|
@ -452,21 +452,20 @@ static void execute_posetree(struct Depsgraph *depsgraph,
|
|||
/* don't solve IK when we are setting the pole angle */
|
||||
break;
|
||||
}
|
||||
else {
|
||||
mul_m4_m4m4(goal, goalinv, rootmat);
|
||||
copy_v3_v3(polepos, goal[3]);
|
||||
poleconstrain = 1;
|
||||
|
||||
/* for pole targets, we blend the result of the ik solver
|
||||
* instead of the target position, otherwise we can't get
|
||||
* a smooth transition */
|
||||
resultblend = 1;
|
||||
resultinf = target->con->enforce;
|
||||
mul_m4_m4m4(goal, goalinv, rootmat);
|
||||
copy_v3_v3(polepos, goal[3]);
|
||||
poleconstrain = 1;
|
||||
|
||||
if (data->flag & CONSTRAINT_IK_GETANGLE) {
|
||||
poleangledata = data;
|
||||
data->flag &= ~CONSTRAINT_IK_GETANGLE;
|
||||
}
|
||||
/* for pole targets, we blend the result of the ik solver
|
||||
* instead of the target position, otherwise we can't get
|
||||
* a smooth transition */
|
||||
resultblend = 1;
|
||||
resultinf = target->con->enforce;
|
||||
|
||||
if (data->flag & CONSTRAINT_IK_GETANGLE) {
|
||||
poleangledata = data;
|
||||
data->flag &= ~CONSTRAINT_IK_GETANGLE;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -446,24 +446,21 @@ static double EulerAngleFromMatrix(const KDL::Rotation &R, int axis)
|
|||
if (axis == 0) {
|
||||
return -KDL::atan2(R(1, 2), R(2, 2));
|
||||
}
|
||||
else if (axis == 1) {
|
||||
if (axis == 1) {
|
||||
return KDL::atan2(-R(0, 2), t);
|
||||
}
|
||||
else {
|
||||
return -KDL::atan2(R(0, 1), R(0, 0));
|
||||
}
|
||||
|
||||
return -KDL::atan2(R(0, 1), R(0, 0));
|
||||
}
|
||||
else {
|
||||
if (axis == 0) {
|
||||
return -KDL::atan2(-R(2, 1), R(1, 1));
|
||||
}
|
||||
else if (axis == 1) {
|
||||
return KDL::atan2(-R(0, 2), t);
|
||||
}
|
||||
else {
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
if (axis == 0) {
|
||||
return -KDL::atan2(-R(2, 1), R(1, 1));
|
||||
}
|
||||
if (axis == 1) {
|
||||
return KDL::atan2(-R(0, 2), t);
|
||||
}
|
||||
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
static double ComputeTwist(const KDL::Rotation &R)
|
||||
|
|
|
@ -356,141 +356,140 @@ static bool init_structDNA(SDNA *sdna, bool do_endian_swap, const char **r_error
|
|||
*r_error_message = "SDNA error in SDNA file";
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
const char *cp;
|
||||
|
||||
const char *cp;
|
||||
|
||||
data++;
|
||||
/* Names array ('NAME') */
|
||||
if (*data == MAKE_ID('N', 'A', 'M', 'E')) {
|
||||
data++;
|
||||
|
||||
sdna->names_len = *data;
|
||||
if (do_endian_swap) {
|
||||
BLI_endian_switch_int32(&sdna->names_len);
|
||||
}
|
||||
sdna->names_len_alloc = sdna->names_len;
|
||||
|
||||
data++;
|
||||
/* Names array ('NAME') */
|
||||
if (*data == MAKE_ID('N', 'A', 'M', 'E')) {
|
||||
data++;
|
||||
sdna->names = MEM_callocN(sizeof(void *) * sdna->names_len, "sdnanames");
|
||||
}
|
||||
else {
|
||||
*r_error_message = "NAME error in SDNA file";
|
||||
return false;
|
||||
}
|
||||
|
||||
sdna->names_len = *data;
|
||||
if (do_endian_swap) {
|
||||
BLI_endian_switch_int32(&sdna->names_len);
|
||||
cp = (char *)data;
|
||||
for (int nr = 0; nr < sdna->names_len; nr++) {
|
||||
sdna->names[nr] = cp;
|
||||
|
||||
/* "float gravity [3]" was parsed wrong giving both "gravity" and
|
||||
* "[3]" members. we rename "[3]", and later set the type of
|
||||
* "gravity" to "void" so the offsets work out correct */
|
||||
if (*cp == '[' && strcmp(cp, "[3]") == 0) {
|
||||
if (nr && strcmp(sdna->names[nr - 1], "Cvi") == 0) {
|
||||
sdna->names[nr] = "gravity[3]";
|
||||
gravity_fix = nr;
|
||||
}
|
||||
sdna->names_len_alloc = sdna->names_len;
|
||||
|
||||
data++;
|
||||
sdna->names = MEM_callocN(sizeof(void *) * sdna->names_len, "sdnanames");
|
||||
}
|
||||
else {
|
||||
*r_error_message = "NAME error in SDNA file";
|
||||
return false;
|
||||
}
|
||||
|
||||
cp = (char *)data;
|
||||
for (int nr = 0; nr < sdna->names_len; nr++) {
|
||||
sdna->names[nr] = cp;
|
||||
|
||||
/* "float gravity [3]" was parsed wrong giving both "gravity" and
|
||||
* "[3]" members. we rename "[3]", and later set the type of
|
||||
* "gravity" to "void" so the offsets work out correct */
|
||||
if (*cp == '[' && strcmp(cp, "[3]") == 0) {
|
||||
if (nr && strcmp(sdna->names[nr - 1], "Cvi") == 0) {
|
||||
sdna->names[nr] = "gravity[3]";
|
||||
gravity_fix = nr;
|
||||
}
|
||||
}
|
||||
while (*cp) {
|
||||
cp++;
|
||||
}
|
||||
while (*cp) {
|
||||
cp++;
|
||||
}
|
||||
cp++;
|
||||
}
|
||||
|
||||
cp = pad_up_4(cp);
|
||||
cp = pad_up_4(cp);
|
||||
|
||||
/* Type names array ('TYPE') */
|
||||
data = (int *)cp;
|
||||
if (*data == MAKE_ID('T', 'Y', 'P', 'E')) {
|
||||
data++;
|
||||
/* Type names array ('TYPE') */
|
||||
data = (int *)cp;
|
||||
if (*data == MAKE_ID('T', 'Y', 'P', 'E')) {
|
||||
data++;
|
||||
|
||||
sdna->types_len = *data;
|
||||
if (do_endian_swap) {
|
||||
BLI_endian_switch_int32(&sdna->types_len);
|
||||
}
|
||||
|
||||
data++;
|
||||
sdna->types = MEM_callocN(sizeof(void *) * sdna->types_len, "sdnatypes");
|
||||
}
|
||||
else {
|
||||
*r_error_message = "TYPE error in SDNA file";
|
||||
return false;
|
||||
sdna->types_len = *data;
|
||||
if (do_endian_swap) {
|
||||
BLI_endian_switch_int32(&sdna->types_len);
|
||||
}
|
||||
|
||||
cp = (char *)data;
|
||||
for (int nr = 0; nr < sdna->types_len; nr++) {
|
||||
/* WARNING! See: DNA_struct_rename_legacy_hack_static_from_alias docs. */
|
||||
sdna->types[nr] = DNA_struct_rename_legacy_hack_static_from_alias(cp);
|
||||
while (*cp) {
|
||||
cp++;
|
||||
}
|
||||
data++;
|
||||
sdna->types = MEM_callocN(sizeof(void *) * sdna->types_len, "sdnatypes");
|
||||
}
|
||||
else {
|
||||
*r_error_message = "TYPE error in SDNA file";
|
||||
return false;
|
||||
}
|
||||
|
||||
cp = (char *)data;
|
||||
for (int nr = 0; nr < sdna->types_len; nr++) {
|
||||
/* WARNING! See: DNA_struct_rename_legacy_hack_static_from_alias docs. */
|
||||
sdna->types[nr] = DNA_struct_rename_legacy_hack_static_from_alias(cp);
|
||||
while (*cp) {
|
||||
cp++;
|
||||
}
|
||||
cp++;
|
||||
}
|
||||
|
||||
cp = pad_up_4(cp);
|
||||
|
||||
/* Type lengths array ('TLEN') */
|
||||
data = (int *)cp;
|
||||
if (*data == MAKE_ID('T', 'L', 'E', 'N')) {
|
||||
data++;
|
||||
sp = (short *)data;
|
||||
sdna->types_size = sp;
|
||||
|
||||
if (do_endian_swap) {
|
||||
BLI_endian_switch_int16_array(sp, sdna->types_len);
|
||||
}
|
||||
|
||||
sp += sdna->types_len;
|
||||
}
|
||||
else {
|
||||
*r_error_message = "TLEN error in SDNA file";
|
||||
return false;
|
||||
}
|
||||
/* prevent BUS error */
|
||||
if (sdna->types_len & 1) {
|
||||
sp++;
|
||||
}
|
||||
|
||||
/* Struct array ('STRC') */
|
||||
data = (int *)sp;
|
||||
if (*data == MAKE_ID('S', 'T', 'R', 'C')) {
|
||||
data++;
|
||||
|
||||
sdna->structs_len = *data;
|
||||
if (do_endian_swap) {
|
||||
BLI_endian_switch_int32(&sdna->structs_len);
|
||||
}
|
||||
|
||||
data++;
|
||||
sdna->structs = MEM_callocN(sizeof(void *) * sdna->structs_len, "sdnastrcs");
|
||||
}
|
||||
else {
|
||||
*r_error_message = "STRC error in SDNA file";
|
||||
return false;
|
||||
}
|
||||
cp = pad_up_4(cp);
|
||||
|
||||
/* Type lengths array ('TLEN') */
|
||||
data = (int *)cp;
|
||||
if (*data == MAKE_ID('T', 'L', 'E', 'N')) {
|
||||
data++;
|
||||
sp = (short *)data;
|
||||
for (int nr = 0; nr < sdna->structs_len; nr++) {
|
||||
sdna->structs[nr] = sp;
|
||||
sdna->types_size = sp;
|
||||
|
||||
if (do_endian_swap) {
|
||||
short a;
|
||||
if (do_endian_swap) {
|
||||
BLI_endian_switch_int16_array(sp, sdna->types_len);
|
||||
}
|
||||
|
||||
sp += sdna->types_len;
|
||||
}
|
||||
else {
|
||||
*r_error_message = "TLEN error in SDNA file";
|
||||
return false;
|
||||
}
|
||||
/* prevent BUS error */
|
||||
if (sdna->types_len & 1) {
|
||||
sp++;
|
||||
}
|
||||
|
||||
/* Struct array ('STRC') */
|
||||
data = (int *)sp;
|
||||
if (*data == MAKE_ID('S', 'T', 'R', 'C')) {
|
||||
data++;
|
||||
|
||||
sdna->structs_len = *data;
|
||||
if (do_endian_swap) {
|
||||
BLI_endian_switch_int32(&sdna->structs_len);
|
||||
}
|
||||
|
||||
data++;
|
||||
sdna->structs = MEM_callocN(sizeof(void *) * sdna->structs_len, "sdnastrcs");
|
||||
}
|
||||
else {
|
||||
*r_error_message = "STRC error in SDNA file";
|
||||
return false;
|
||||
}
|
||||
|
||||
sp = (short *)data;
|
||||
for (int nr = 0; nr < sdna->structs_len; nr++) {
|
||||
sdna->structs[nr] = sp;
|
||||
|
||||
if (do_endian_swap) {
|
||||
short a;
|
||||
|
||||
BLI_endian_switch_int16(&sp[0]);
|
||||
BLI_endian_switch_int16(&sp[1]);
|
||||
|
||||
a = sp[1];
|
||||
sp += 2;
|
||||
while (a--) {
|
||||
BLI_endian_switch_int16(&sp[0]);
|
||||
BLI_endian_switch_int16(&sp[1]);
|
||||
|
||||
a = sp[1];
|
||||
sp += 2;
|
||||
while (a--) {
|
||||
BLI_endian_switch_int16(&sp[0]);
|
||||
BLI_endian_switch_int16(&sp[1]);
|
||||
sp += 2;
|
||||
}
|
||||
}
|
||||
else {
|
||||
sp += 2 * sp[1] + 2;
|
||||
}
|
||||
}
|
||||
else {
|
||||
sp += 2 * sp[1] + 2;
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
|
@ -578,16 +577,15 @@ SDNA *DNA_sdna_from_data(const void *data,
|
|||
if (init_structDNA(sdna, do_endian_swap, &error_message)) {
|
||||
return sdna;
|
||||
}
|
||||
else {
|
||||
if (r_error_message == NULL) {
|
||||
fprintf(stderr, "Error decoding blend file SDNA: %s\n", error_message);
|
||||
}
|
||||
else {
|
||||
*r_error_message = error_message;
|
||||
}
|
||||
DNA_sdna_free(sdna);
|
||||
return NULL;
|
||||
|
||||
if (r_error_message == NULL) {
|
||||
fprintf(stderr, "Error decoding blend file SDNA: %s\n", error_message);
|
||||
}
|
||||
else {
|
||||
*r_error_message = error_message;
|
||||
}
|
||||
DNA_sdna_free(sdna);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -764,34 +762,33 @@ static eSDNA_Type sdna_type_nr(const char *dna_type)
|
|||
if (STR_ELEM(dna_type, "char", "const char")) {
|
||||
return SDNA_TYPE_CHAR;
|
||||
}
|
||||
else if (STR_ELEM(dna_type, "uchar", "unsigned char")) {
|
||||
if (STR_ELEM(dna_type, "uchar", "unsigned char")) {
|
||||
return SDNA_TYPE_UCHAR;
|
||||
}
|
||||
else if (STR_ELEM(dna_type, "short")) {
|
||||
if (STR_ELEM(dna_type, "short")) {
|
||||
return SDNA_TYPE_SHORT;
|
||||
}
|
||||
else if (STR_ELEM(dna_type, "ushort", "unsigned short")) {
|
||||
if (STR_ELEM(dna_type, "ushort", "unsigned short")) {
|
||||
return SDNA_TYPE_USHORT;
|
||||
}
|
||||
else if (STR_ELEM(dna_type, "int")) {
|
||||
if (STR_ELEM(dna_type, "int")) {
|
||||
return SDNA_TYPE_INT;
|
||||
}
|
||||
else if (STR_ELEM(dna_type, "float")) {
|
||||
if (STR_ELEM(dna_type, "float")) {
|
||||
return SDNA_TYPE_FLOAT;
|
||||
}
|
||||
else if (STR_ELEM(dna_type, "double")) {
|
||||
if (STR_ELEM(dna_type, "double")) {
|
||||
return SDNA_TYPE_DOUBLE;
|
||||
}
|
||||
else if (STR_ELEM(dna_type, "int64_t")) {
|
||||
if (STR_ELEM(dna_type, "int64_t")) {
|
||||
return SDNA_TYPE_INT64;
|
||||
}
|
||||
else if (STR_ELEM(dna_type, "uint64_t")) {
|
||||
if (STR_ELEM(dna_type, "uint64_t")) {
|
||||
return SDNA_TYPE_UINT64;
|
||||
}
|
||||
/* invalid! */
|
||||
else {
|
||||
return -1;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1150,7 +1147,7 @@ static void reconstruct_elem(const SDNA *newsdna,
|
|||
|
||||
return;
|
||||
}
|
||||
else if (countpos != 0) { /* name is an array */
|
||||
if (countpos != 0) { /* name is an array */
|
||||
|
||||
if (oname[countpos] == '[' && strncmp(name, oname, countpos) == 0) { /* basis equal */
|
||||
const int new_name_array_len = newsdna->names_array_len[new_name_nr];
|
||||
|
|
|
@ -360,7 +360,7 @@ static int add_type(const char *str, int size)
|
|||
if (str[0] == 0) {
|
||||
return -1;
|
||||
}
|
||||
else if (strchr(str, '*')) {
|
||||
if (strchr(str, '*')) {
|
||||
/* note: this is valid C syntax but we can't parse, complain!
|
||||
* `struct SomeStruct* some_var;` <-- correct but we cant handle right now. */
|
||||
return -1;
|
||||
|
|
|
@ -117,12 +117,11 @@ static float mix_weight(float weight, float weight2, char mix_mode)
|
|||
if (mix_mode == MOD_WVG_MIX_DIF) {
|
||||
return (weight < weight2 ? weight2 - weight : weight - weight2);
|
||||
}
|
||||
else if (mix_mode == MOD_WVG_MIX_AVG) {
|
||||
if (mix_mode == MOD_WVG_MIX_AVG) {
|
||||
return (weight + weight2) * 0.5f;
|
||||
}
|
||||
else {
|
||||
return weight2;
|
||||
}
|
||||
|
||||
return weight2;
|
||||
}
|
||||
|
||||
/**************************************
|
||||
|
|
|
@ -491,7 +491,7 @@ static float clipx_rctf(rctf *rf, float x1, float x2)
|
|||
rf->xmin = rf->xmax;
|
||||
return 0.0;
|
||||
}
|
||||
else if (size != 0.0f) {
|
||||
if (size != 0.0f) {
|
||||
return BLI_rctf_size_x(rf) / size;
|
||||
}
|
||||
return 1.0;
|
||||
|
@ -514,7 +514,7 @@ static float clipy_rctf(rctf *rf, float y1, float y2)
|
|||
rf->ymin = rf->ymax;
|
||||
return 0.0;
|
||||
}
|
||||
else if (size != 0.0f) {
|
||||
if (size != 0.0f) {
|
||||
return BLI_rctf_size_y(rf) / size;
|
||||
}
|
||||
return 1.0;
|
||||
|
|
|
@ -281,9 +281,8 @@ RenderLayer *RE_GetRenderLayer(RenderResult *rr, const char *name)
|
|||
if (rr == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
else {
|
||||
return BLI_findstring(&rr->layers, name, offsetof(RenderLayer, name));
|
||||
}
|
||||
|
||||
return BLI_findstring(&rr->layers, name, offsetof(RenderLayer, name));
|
||||
}
|
||||
|
||||
bool RE_HasSingleLayer(Render *re)
|
||||
|
@ -1655,9 +1654,8 @@ static bool check_valid_compositing_camera(Scene *scene, Object *camera_override
|
|||
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return (camera_override != NULL || scene->camera != NULL);
|
||||
}
|
||||
|
||||
return (camera_override != NULL || scene->camera != NULL);
|
||||
}
|
||||
|
||||
static bool check_valid_camera_multiview(Scene *scene, Object *camera, ReportList *reports)
|
||||
|
@ -1755,7 +1753,7 @@ static bool node_tree_has_composite_output(bNodeTree *ntree)
|
|||
if (ELEM(node->type, CMP_NODE_COMPOSITE, CMP_NODE_OUTPUT_FILE)) {
|
||||
return true;
|
||||
}
|
||||
else if (ELEM(node->type, NODE_GROUP, NODE_CUSTOM_GROUP)) {
|
||||
if (ELEM(node->type, NODE_GROUP, NODE_CUSTOM_GROUP)) {
|
||||
if (node->id) {
|
||||
if (node_tree_has_composite_output((bNodeTree *)node->id)) {
|
||||
return true;
|
||||
|
@ -2506,9 +2504,8 @@ void RE_RenderAnim(Render *re,
|
|||
/* Skip this frame, but could update for physics and particles system. */
|
||||
continue;
|
||||
}
|
||||
else {
|
||||
nfra += tfra;
|
||||
}
|
||||
|
||||
nfra += tfra;
|
||||
|
||||
/* Touch/NoOverwrite options are only valid for image's */
|
||||
if (is_movie == false) {
|
||||
|
@ -2863,7 +2860,7 @@ RenderPass *RE_pass_find_by_name(volatile RenderLayer *rl, const char *name, con
|
|||
if (viewname == NULL || viewname[0] == '\0') {
|
||||
break;
|
||||
}
|
||||
else if (STREQ(rp->view, viewname)) {
|
||||
if (STREQ(rp->view, viewname)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -709,7 +709,7 @@ static int order_render_passes(const void *a, const void *b)
|
|||
if (passtype_a > passtype_b) {
|
||||
return 1;
|
||||
}
|
||||
else if (passtype_a < passtype_b) {
|
||||
if (passtype_a < passtype_b) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
@ -728,7 +728,7 @@ static int order_render_passes(const void *a, const void *b)
|
|||
if (STREQ(rpa->view, STEREO_LEFT_NAME)) {
|
||||
return 0;
|
||||
}
|
||||
else if (STREQ(rpb->view, STEREO_LEFT_NAME)) {
|
||||
if (STREQ(rpb->view, STEREO_LEFT_NAME)) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -736,7 +736,7 @@ static int order_render_passes(const void *a, const void *b)
|
|||
if (STREQ(rpa->view, STEREO_RIGHT_NAME)) {
|
||||
return 0;
|
||||
}
|
||||
else if (STREQ(rpb->view, STEREO_RIGHT_NAME)) {
|
||||
if (STREQ(rpb->view, STEREO_RIGHT_NAME)) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -930,9 +930,8 @@ bool RE_WriteRenderResult(ReportList *reports,
|
|||
if (!STREQ(view, viewname)) {
|
||||
continue;
|
||||
}
|
||||
else {
|
||||
viewname = "";
|
||||
}
|
||||
|
||||
viewname = "";
|
||||
}
|
||||
|
||||
/* Skip compositing if only a single other layer is requested. */
|
||||
|
@ -993,9 +992,8 @@ bool RE_WriteRenderResult(ReportList *reports,
|
|||
if (!STREQ(view, viewname)) {
|
||||
continue;
|
||||
}
|
||||
else {
|
||||
viewname = "";
|
||||
}
|
||||
|
||||
viewname = "";
|
||||
}
|
||||
|
||||
/* We only store RGBA passes as half float, for
|
||||
|
|
|
@ -1381,20 +1381,19 @@ static int multitex_nodes_intern(Tex *tex,
|
|||
|
||||
return rgbnor;
|
||||
}
|
||||
else {
|
||||
return multitex(tex,
|
||||
texvec,
|
||||
dxt,
|
||||
dyt,
|
||||
osatex,
|
||||
texres,
|
||||
thread,
|
||||
which_output,
|
||||
pool,
|
||||
skip_load_image,
|
||||
texnode_preview,
|
||||
use_nodes);
|
||||
}
|
||||
|
||||
return multitex(tex,
|
||||
texvec,
|
||||
dxt,
|
||||
dyt,
|
||||
osatex,
|
||||
texres,
|
||||
thread,
|
||||
which_output,
|
||||
pool,
|
||||
skip_load_image,
|
||||
texnode_preview,
|
||||
use_nodes);
|
||||
}
|
||||
|
||||
/* this is called from the shader and texture nodes
|
||||
|
|
|
@ -710,9 +710,8 @@ BLI_INLINE float hair_volume_density_divergence(float density,
|
|||
if (density > density_threshold && density > target_density) {
|
||||
return strength * logf(target_density / density);
|
||||
}
|
||||
else {
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
bool SIM_hair_volume_solve_divergence(HairGrid *grid,
|
||||
|
@ -1030,14 +1029,13 @@ bool SIM_hair_volume_solve_divergence(HairGrid *grid,
|
|||
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
/* Clear result in case of error */
|
||||
for (i = 0, vert = grid->verts; i < num_cells; i++, vert++) {
|
||||
zero_v3(vert->velocity_smooth);
|
||||
}
|
||||
|
||||
return false;
|
||||
/* Clear result in case of error */
|
||||
for (i = 0, vert = grid->verts; i < num_cells; i++, vert++) {
|
||||
zero_v3(vert->velocity_smooth);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
#if 0 /* XXX weighting is incorrect, disabled for now */
|
||||
|
|
|
@ -1711,9 +1711,8 @@ BLI_INLINE float fbstar(float length, float L, float kb, float cb)
|
|||
if (tempfb_fl < fbstar_fl) {
|
||||
return fbstar_fl;
|
||||
}
|
||||
else {
|
||||
return tempfb_fl;
|
||||
}
|
||||
|
||||
return tempfb_fl;
|
||||
}
|
||||
|
||||
// function to calculae bending spring force (taken from Choi & Co)
|
||||
|
@ -1725,9 +1724,8 @@ BLI_INLINE float fbstar_jacobi(float length, float L, float kb, float cb)
|
|||
if (tempfb_fl < fbstar_fl) {
|
||||
return -cb;
|
||||
}
|
||||
else {
|
||||
return -kb * fbderiv(length, L);
|
||||
}
|
||||
|
||||
return -kb * fbderiv(length, L);
|
||||
}
|
||||
|
||||
/* calculate elonglation */
|
||||
|
@ -1864,9 +1862,8 @@ bool SIM_mass_spring_force_spring_bending(
|
|||
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
BLI_INLINE void poly_avg(lfVector *data, const int *inds, int len, float r_avg[3])
|
||||
|
@ -2352,9 +2349,8 @@ bool SIM_mass_spring_force_spring_goal(Implicit_Data *data,
|
|||
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
#endif /* IMPLICIT_SOLVER_BLENDER */
|
||||
|
|
|
@ -102,9 +102,8 @@ fn::GVSpan ParticleFunctionEvaluator::get(int output_index, StringRef expected_n
|
|||
if (particle_fn_.output_is_global_[output_index]) {
|
||||
return fn::GVSpan::FromSingleWithMaxSize(type, buffer);
|
||||
}
|
||||
else {
|
||||
return fn::GVSpan(fn::GSpan(type, buffer, mask_.min_array_size()));
|
||||
}
|
||||
|
||||
return fn::GVSpan(fn::GSpan(type, buffer, mask_.min_array_size()));
|
||||
}
|
||||
|
||||
void ParticleFunctionEvaluator::compute_globals()
|
||||
|
|
Loading…
Reference in New Issue