本文整理汇总了C++中AnimationPlayer::connect方法的典型用法代码示例。如果您正苦于以下问题:C++ AnimationPlayer::connect方法的具体用法?C++ AnimationPlayer::connect怎么用?C++ AnimationPlayer::connect使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AnimationPlayer
的用法示例。
在下文中一共展示了AnimationPlayer::connect方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: _process_graph
void AnimationTree::_process_graph(float p_delta) {
_update_properties(); //if properties need updating, update them
//check all tracks, see if they need modification
root_motion_transform = Transform();
if (!root.is_valid()) {
ERR_PRINT("AnimationTree: root AnimationNode is not set, disabling playback.");
set_active(false);
cache_valid = false;
return;
}
if (!has_node(animation_player)) {
ERR_PRINT("AnimationTree: no valid AnimationPlayer path set, disabling playback");
set_active(false);
cache_valid = false;
return;
}
AnimationPlayer *player = Object::cast_to<AnimationPlayer>(get_node(animation_player));
ObjectID current_animation_player = 0;
if (player) {
current_animation_player = player->get_instance_id();
}
if (last_animation_player != current_animation_player) {
if (last_animation_player) {
Object *old_player = ObjectDB::get_instance(last_animation_player);
if (old_player) {
old_player->disconnect("caches_cleared", this, "_clear_caches");
}
}
if (player) {
player->connect("caches_cleared", this, "_clear_caches");
}
last_animation_player = current_animation_player;
}
if (!player) {
ERR_PRINT("AnimationTree: path points to a node not an AnimationPlayer, disabling playback");
set_active(false);
cache_valid = false;
return;
}
if (!cache_valid) {
if (!_update_caches(player)) {
return;
}
}
{ //setup
process_pass++;
state.valid = true;
state.invalid_reasons = "";
state.animation_states.clear(); //will need to be re-created
state.valid = true;
state.player = player;
state.last_pass = process_pass;
state.tree = this;
// root source blends
root->blends.resize(state.track_count);
float *src_blendsw = root->blends.ptrw();
for (int i = 0; i < state.track_count; i++) {
src_blendsw[i] = 1.0; //by default all go to 1 for the root input
}
}
//process
{
if (started) {
//if started, seek
root->_pre_process(SceneStringNames::get_singleton()->parameters_base_path, NULL, &state, 0, true, Vector<StringName>());
started = false;
}
root->_pre_process(SceneStringNames::get_singleton()->parameters_base_path, NULL, &state, p_delta, false, Vector<StringName>());
}
if (!state.valid) {
return; //state is not valid. do nothing.
}
//apply value/transform/bezier blends to track caches and execute method/audio/animation tracks
{
//.........这里部分代码省略.........