Skip to content

Commit e7e2d41

Browse files
Apply suggestions from code review
Co-authored-by: A Thousand Ships <96648715+AThousandShips@users.noreply.github.com>
1 parent 9beb95c commit e7e2d41

7 files changed

Lines changed: 124 additions & 127 deletions

File tree

editor/shader/text_shader_editor.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1408,7 +1408,7 @@ TextShaderEditor::TextShaderEditor() {
14081408
confirm_convert_shader->set_text(TTR("This shader does not appear to be a 3.x shader.\nAre you sure you want to convert it?"));
14091409
confirm_convert_shader->get_ok_button()->set_text(TTR("Convert"));
14101410
confirm_convert_shader->get_cancel_button()->set_text(TTR("Cancel"));
1411-
confirm_convert_shader->connect("confirmed", callable_mp(this, &TextShaderEditor::_convert_shader));
1411+
confirm_convert_shader->connect(SceneStringName(confirmed), callable_mp(this, &TextShaderEditor::_convert_shader));
14121412
add_child(confirm_convert_shader);
14131413
#endif
14141414
_editor_settings_changed();

scene/animation/animation_mixer.cpp

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -258,22 +258,22 @@ TypedArray<StringName> AnimationMixer::_get_animation_library_list() const {
258258
}
259259

260260
#if !defined(_3D_DISABLED) && !defined(DISABLE_DEPRECATED)
261-
bool AnimationMixer::_recalc_animation(Ref<Animation> &anim) {
261+
bool AnimationMixer::_recalc_animation(Ref<Animation> &p_anim) {
262262
HashMap<int, Vector<real_t>> new_track_values_map;
263263
Node *parent = get_node_or_null(root_node);
264264
if (!parent) {
265265
return false;
266266
}
267267

268-
for (int i = 0; i < anim->get_track_count(); i++) {
269-
int track_type = anim->track_get_type(i);
270-
if (!anim->track_is_relative_to_rest(i)) {
268+
for (int i = 0; i < p_anim->get_track_count(); i++) {
269+
int track_type = p_anim->track_get_type(i);
270+
if (!p_anim->track_is_relative_to_rest(i)) {
271271
continue;
272272
}
273273
if (track_type == Animation::TYPE_POSITION_3D || track_type == Animation::TYPE_ROTATION_3D || track_type == Animation::TYPE_SCALE_3D) {
274-
NodePath path = anim->track_get_path(i);
274+
NodePath path = p_anim->track_get_path(i);
275275
Node *node = parent->get_node(path);
276-
ERR_FAIL_COND_V(!node, false);
276+
ERR_FAIL_NULL_V(node, false);
277277
Skeleton3D *skel = Object::cast_to<Skeleton3D>(node);
278278
if (!skel) { // transforming non-skeleton node, not relative to rest
279279
continue;
@@ -292,14 +292,14 @@ bool AnimationMixer::_recalc_animation(Ref<Animation> &anim) {
292292
if (track_type == Animation::TYPE_ROTATION_3D) {
293293
track_size = ROTATION_TRACK_SIZE;
294294
}
295-
new_track_values_map[i].resize(track_size * anim->track_get_key_count(i));
295+
new_track_values_map[i].resize(track_size * p_anim->track_get_key_count(i));
296296
real_t *r = new_track_values_map[i].ptrw();
297-
for (int j = 0; j < anim->track_get_key_count(i); j++) {
298-
real_t time = anim->track_get_key_time(i, j);
299-
real_t transition = anim->track_get_key_transition(i, j);
297+
for (int j = 0; j < p_anim->track_get_key_count(i); j++) {
298+
real_t time = p_anim->track_get_key_time(i, j);
299+
real_t transition = p_anim->track_get_key_transition(i, j);
300300
if (track_type == Animation::TYPE_POSITION_3D) {
301-
Vector3 a_pos = anim->track_get_key_value(i, j);
302-
Transform3D t = Transform3D();
301+
Vector3 a_pos = p_anim->track_get_key_value(i, j);
302+
Transform3D t;
303303
t.set_origin(a_pos);
304304
Vector3 new_a_pos = (rest * t).origin;
305305

@@ -310,8 +310,8 @@ bool AnimationMixer::_recalc_animation(Ref<Animation> &anim) {
310310
ofs[3] = new_a_pos.y;
311311
ofs[4] = new_a_pos.z;
312312
} else if (track_type == Animation::TYPE_ROTATION_3D) {
313-
Quaternion q = anim->track_get_key_value(i, j);
314-
Transform3D t = Transform3D();
313+
Quaternion q = p_anim->track_get_key_value(i, j);
314+
Transform3D t;
315315
t.basis.rotate(q);
316316
Quaternion new_q = (rest * t).basis.get_rotation_quaternion();
317317
real_t *ofs = &r[j * ROTATION_TRACK_SIZE];
@@ -322,8 +322,8 @@ bool AnimationMixer::_recalc_animation(Ref<Animation> &anim) {
322322
ofs[4] = new_q.z;
323323
ofs[5] = new_q.w;
324324
} else if (track_type == Animation::TYPE_SCALE_3D) {
325-
Vector3 v = anim->track_get_key_value(i, j);
326-
Transform3D t = Transform3D();
325+
Vector3 v = p_anim->track_get_key_value(i, j);
326+
Transform3D t;
327327
t.scale(v);
328328
Vector3 new_v = (rest * t).basis.get_scale();
329329

@@ -340,14 +340,14 @@ bool AnimationMixer::_recalc_animation(Ref<Animation> &anim) {
340340
if (new_track_values_map.is_empty()) {
341341
return false;
342342
}
343-
for (int i = 0; i < anim->get_track_count(); i++) {
343+
for (int i = 0; i < p_anim->get_track_count(); i++) {
344344
if (!new_track_values_map.has(i)) {
345345
continue;
346346
}
347-
anim->set("tracks/" + itos(i) + "/keys", new_track_values_map[i]);
348-
anim->set("tracks/" + itos(i) + "/relative_to_rest", false);
347+
p_anim->set("tracks/" + itos(i) + "/keys", new_track_values_map[i]);
348+
p_anim->set("tracks/" + itos(i) + "/relative_to_rest", false);
349349
}
350-
anim->emit_changed();
350+
p_anim->emit_changed();
351351
return true;
352352
}
353353
#endif // !defined(_3D_DISABLED) || !defined(DISABLE_DEPRECATED)

0 commit comments

Comments
 (0)