void SceneTreeEditor::_compute_hash(Node *p_node, uint64_t &hash) {

	hash = hash_djb2_one_64(p_node->get_instance_id(), hash);
	if (p_node->get_parent())
		hash = hash_djb2_one_64(p_node->get_parent()->get_instance_id(), hash); //so a reparent still produces a different hash

	for (int i = 0; i < p_node->get_child_count(); i++) {

		_compute_hash(p_node->get_child(i), hash);
	}
}
void SceneTreeEditor::_update_tree() {

	if (!is_inside_tree()) {
		tree_dirty = false;
		return;
	}

	updating_tree = true;
	tree->clear();
	if (get_scene_node()) {
		_add_nodes(get_scene_node(), NULL);
		last_hash = hash_djb2_one_64(0);
		_compute_hash(get_scene_node(), last_hash);
	}
	updating_tree = false;

	tree_dirty = false;
}
Beispiel #3
0
void SceneTreeEditor::_test_update_tree() {

	pending_test_update=false;

	if (!is_inside_tree())
		return;

	if(tree_dirty)
		return; // don't even bother

	uint64_t hash = hash_djb2_one_64(0);
	if (get_scene_node())
		_compute_hash(get_scene_node(),hash);
	//test hash
	if (hash==last_hash)
		return; // did not change

	MessageQueue::get_singleton()->push_call(this,"_update_tree");
	tree_dirty=true;
}