当前位置: 首页>>代码示例>>C++>>正文


C++ UndoRedo::add_undo_method方法代码示例

本文整理汇总了C++中UndoRedo::add_undo_method方法的典型用法代码示例。如果您正苦于以下问题:C++ UndoRedo::add_undo_method方法的具体用法?C++ UndoRedo::add_undo_method怎么用?C++ UndoRedo::add_undo_method使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UndoRedo的用法示例。


在下文中一共展示了UndoRedo::add_undo_method方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: _press_a_key_confirm

void EditorSettingsDialog::_press_a_key_confirm() {

	if (last_wait_for_key.type!=InputEvent::KEY)
		return;

	InputEvent ie;
	ie.type=InputEvent::KEY;
	ie.key.scancode=last_wait_for_key.key.scancode;
	ie.key.mod=last_wait_for_key.key.mod;

	Ref<ShortCut> sc = EditorSettings::get_singleton()->get_shortcut(shortcut_configured);

	UndoRedo *ur = EditorNode::get_singleton()->get_undo_redo();
	ur->create_action("Change Shortcut '"+shortcut_configured+"'");
	ur->add_do_method(sc.ptr(),"set_shortcut",ie);
	ur->add_undo_method(sc.ptr(),"set_shortcut",sc->get_shortcut());
	ur->add_do_method(this,"_update_shortcuts");
	ur->add_undo_method(this,"_update_shortcuts");
	ur->add_do_method(this,"_settings_changed");
	ur->add_undo_method(this,"_settings_changed");
	ur->commit_action();



}
开发者ID:03050903,项目名称:godot,代码行数:25,代码来源:settings_config_dialog.cpp

示例2: _effect_edited

void EditorAudioBus::_effect_edited() {

	if (updating_bus)
		return;

	TreeItem *effect = effects->get_edited();
	if (!effect)
		return;

	if (effect->get_metadata(0) == Variant()) {
		Rect2 area = effects->get_item_rect(effect);

		effect_options->set_position(effects->get_global_position() + area.position + Vector2(0, area.size.y));
		effect_options->popup();
		//add effect
	} else {
		int index = effect->get_metadata(0);
		updating_bus = true;

		UndoRedo *ur = EditorNode::get_singleton()->get_undo_redo();
		ur->create_action(TTR("Select Audio Bus Send"));
		ur->add_do_method(AudioServer::get_singleton(), "set_bus_effect_enabled", get_index(), index, effect->is_checked(0));
		ur->add_undo_method(AudioServer::get_singleton(), "set_bus_effect_enabled", get_index(), index, AudioServer::get_singleton()->is_bus_effect_enabled(get_index(), index));
		ur->add_do_method(buses, "_update_bus", get_index());
		ur->add_undo_method(buses, "_update_bus", get_index());
		ur->commit_action();

		updating_bus = false;
	}
}
开发者ID:louisVottero,项目名称:godot,代码行数:30,代码来源:editor_audio_buses.cpp

示例3: _press_a_key_confirm

void EditorSettingsDialog::_press_a_key_confirm() {

	if (last_wait_for_key.is_null())
		return;

	Ref<InputEventKey> ie;
	ie.instance();
	ie->set_scancode(last_wait_for_key->get_scancode());
	ie->set_shift(last_wait_for_key->get_shift());
	ie->set_control(last_wait_for_key->get_control());
	ie->set_alt(last_wait_for_key->get_alt());
	ie->set_metakey(last_wait_for_key->get_metakey());

	Ref<ShortCut> sc = EditorSettings::get_singleton()->get_shortcut(shortcut_configured);

	UndoRedo *ur = EditorNode::get_singleton()->get_undo_redo();
	ur->create_action("Change Shortcut '" + shortcut_configured + "'");
	ur->add_do_method(sc.ptr(), "set_shortcut", ie);
	ur->add_undo_method(sc.ptr(), "set_shortcut", sc->get_shortcut());
	ur->add_do_method(this, "_update_shortcuts");
	ur->add_undo_method(this, "_update_shortcuts");
	ur->add_do_method(this, "_settings_changed");
	ur->add_undo_method(this, "_settings_changed");
	ur->commit_action();
}
开发者ID:GalanCM,项目名称:godot,代码行数:25,代码来源:settings_config_dialog.cpp

示例4: commit_handle

void PathSpatialGizmo::commit_handle(int p_idx, const Variant &p_restore, bool p_cancel) {

	Ref<Curve3D> c = path->get_curve();
	if (c.is_null())
		return;

	UndoRedo *ur = SpatialEditor::get_singleton()->get_undo_redo();

	if (p_idx < c->get_point_count()) {

		if (p_cancel) {

			c->set_point_pos(p_idx, p_restore);
			return;
		}
		ur->create_action(TTR("Set Curve Point Pos"));
		ur->add_do_method(c.ptr(), "set_point_pos", p_idx, c->get_point_pos(p_idx));
		ur->add_undo_method(c.ptr(), "set_point_pos", p_idx, p_restore);
		ur->commit_action();

		return;
	}

	p_idx = p_idx - c->get_point_count() + 1;

	int idx = p_idx / 2;
	int t = p_idx % 2;

	Vector3 ofs;

	if (p_cancel) {

		return;
	}

	if (t == 0) {

		if (p_cancel) {

			c->set_point_in(p_idx, p_restore);
			return;
		}
		ur->create_action(TTR("Set Curve In Pos"));
		ur->add_do_method(c.ptr(), "set_point_in", idx, c->get_point_in(idx));
		ur->add_undo_method(c.ptr(), "set_point_in", idx, p_restore);
		ur->commit_action();

	} else {
		if (p_cancel) {

			c->set_point_out(idx, p_restore);
			return;
		}
		ur->create_action(TTR("Set Curve Out Pos"));
		ur->add_do_method(c.ptr(), "set_point_out", idx, c->get_point_out(idx));
		ur->add_undo_method(c.ptr(), "set_point_out", idx, p_restore);
		ur->commit_action();
	}
}
开发者ID:allkhor,项目名称:godot,代码行数:59,代码来源:path_editor_plugin.cpp

示例5: drop_data_fw

void EditorAudioBus::drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from) {

	Dictionary d = p_data;

	TreeItem *item = effects->get_item_at_position(p_point);
	if (!item)
		return;
	int pos = effects->get_drop_section_at_position(p_point);
	Variant md = item->get_metadata(0);

	int paste_at;
	int bus = d["bus"];
	int effect = d["effect"];

	if (md.get_type() == Variant::INT) {
		paste_at = md;
		if (pos > 0)
			paste_at++;

		if (bus == get_index() && paste_at > effect) {
			paste_at--;
		}
	} else {
		paste_at = -1;
	}

	bool enabled = AudioServer::get_singleton()->is_bus_effect_enabled(bus, effect);

	UndoRedo *ur = EditorNode::get_singleton()->get_undo_redo();
	ur->create_action(TTR("Move Bus Effect"));
	ur->add_do_method(AudioServer::get_singleton(), "remove_bus_effect", bus, effect);
	ur->add_do_method(AudioServer::get_singleton(), "add_bus_effect", get_index(), AudioServer::get_singleton()->get_bus_effect(bus, effect), paste_at);

	if (paste_at == -1) {
		paste_at = AudioServer::get_singleton()->get_bus_effect_count(get_index());
		if (bus == get_index()) {
			paste_at--;
		}
	}
	if (!enabled) {
		ur->add_do_method(AudioServer::get_singleton(), "set_bus_effect_enabled", get_index(), paste_at, false);
	}

	ur->add_undo_method(AudioServer::get_singleton(), "remove_bus_effect", get_index(), paste_at);
	ur->add_undo_method(AudioServer::get_singleton(), "add_bus_effect", bus, AudioServer::get_singleton()->get_bus_effect(bus, effect), effect);
	if (!enabled) {
		ur->add_undo_method(AudioServer::get_singleton(), "set_bus_effect_enabled", bus, effect, false);
	}

	ur->add_do_method(buses, "_update_bus", get_index());
	ur->add_undo_method(buses, "_update_bus", get_index());
	if (get_index() != bus) {
		ur->add_do_method(buses, "_update_bus", bus);
		ur->add_undo_method(buses, "_update_bus", bus);
	}
	ur->commit_action();
}
开发者ID:louisVottero,项目名称:godot,代码行数:57,代码来源:editor_audio_buses.cpp

示例6: _delete_bus

void EditorAudioBuses::_delete_bus(Object *p_which) {

	EditorAudioBus *bus = Object::cast_to<EditorAudioBus>(p_which);
	int index = bus->get_index();
	if (index == 0) {
		EditorNode::get_singleton()->show_warning(TTR("Master bus can't be deleted!"));
		return;
	}

	UndoRedo *ur = EditorNode::get_singleton()->get_undo_redo();

	ur->create_action(TTR("Delete Audio Bus"));
	ur->add_do_method(AudioServer::get_singleton(), "remove_bus", index);
	ur->add_undo_method(AudioServer::get_singleton(), "add_bus", index);
	ur->add_undo_method(AudioServer::get_singleton(), "set_bus_name", index, AudioServer::get_singleton()->get_bus_name(index));
	ur->add_undo_method(AudioServer::get_singleton(), "set_bus_volume_db", index, AudioServer::get_singleton()->get_bus_volume_db(index));
	ur->add_undo_method(AudioServer::get_singleton(), "set_bus_send", index, AudioServer::get_singleton()->get_bus_send(index));
	ur->add_undo_method(AudioServer::get_singleton(), "set_bus_solo", index, AudioServer::get_singleton()->is_bus_solo(index));
	ur->add_undo_method(AudioServer::get_singleton(), "set_bus_mute", index, AudioServer::get_singleton()->is_bus_mute(index));
	ur->add_undo_method(AudioServer::get_singleton(), "set_bus_bypass_effects", index, AudioServer::get_singleton()->is_bus_bypassing_effects(index));
	for (int i = 0; i < AudioServer::get_singleton()->get_bus_effect_count(index); i++) {

		ur->add_undo_method(AudioServer::get_singleton(), "add_bus_effect", index, AudioServer::get_singleton()->get_bus_effect(index, i));
		ur->add_undo_method(AudioServer::get_singleton(), "set_bus_effect_enabled", index, i, AudioServer::get_singleton()->is_bus_effect_enabled(index, i));
	}
	ur->add_do_method(this, "_update_buses");
	ur->add_undo_method(this, "_update_buses");
	ur->commit_action();
}
开发者ID:louisVottero,项目名称:godot,代码行数:29,代码来源:editor_audio_buses.cpp

示例7: _name_changed

void EditorAudioBus::_name_changed(const String &p_new_name) {

	if (p_new_name == AudioServer::get_singleton()->get_bus_name(get_index()))
		return;

	String attempt = p_new_name;
	int attempts = 1;

	while (true) {

		bool name_free = true;
		for (int i = 0; i < AudioServer::get_singleton()->get_bus_count(); i++) {

			if (AudioServer::get_singleton()->get_bus_name(i) == attempt) {
				name_free = false;
				break;
			}
		}

		if (name_free) {
			break;
		}

		attempts++;
		attempt = p_new_name + " " + itos(attempts);
	}
	updating_bus = true;

	UndoRedo *ur = EditorNode::get_singleton()->get_undo_redo();

	StringName current = AudioServer::get_singleton()->get_bus_name(get_index());
	ur->create_action(TTR("Rename Audio Bus"));
	ur->add_do_method(AudioServer::get_singleton(), "set_bus_name", get_index(), attempt);
	ur->add_undo_method(AudioServer::get_singleton(), "set_bus_name", get_index(), current);

	for (int i = 0; i < AudioServer::get_singleton()->get_bus_count(); i++) {
		if (AudioServer::get_singleton()->get_bus_send(i) == current) {
			ur->add_do_method(AudioServer::get_singleton(), "set_bus_send", i, attempt);
			ur->add_undo_method(AudioServer::get_singleton(), "set_bus_send", i, current);
		}
	}

	ur->add_do_method(buses, "_update_bus", get_index());
	ur->add_undo_method(buses, "_update_bus", get_index());

	ur->add_do_method(buses, "_update_sends");
	ur->add_undo_method(buses, "_update_sends");
	ur->commit_action();

	updating_bus = false;

	track_name->release_focus();
}
开发者ID:louisVottero,项目名称:godot,代码行数:53,代码来源:editor_audio_buses.cpp

示例8: _add_bus

void EditorAudioBuses::_add_bus() {

	UndoRedo *ur = EditorNode::get_singleton()->get_undo_redo();

	//need to simulate new name, so we can undi :(
	ur->create_action(TTR("Add Audio Bus"));
	ur->add_do_method(AudioServer::get_singleton(), "set_bus_count", AudioServer::get_singleton()->get_bus_count() + 1);
	ur->add_undo_method(AudioServer::get_singleton(), "set_bus_count", AudioServer::get_singleton()->get_bus_count());
	ur->add_do_method(this, "_update_buses");
	ur->add_undo_method(this, "_update_buses");
	ur->commit_action();
}
开发者ID:louisVottero,项目名称:godot,代码行数:12,代码来源:editor_audio_buses.cpp

示例9: _reset_bus_volume

void EditorAudioBuses::_reset_bus_volume(Object *p_which) {

	EditorAudioBus *bus = Object::cast_to<EditorAudioBus>(p_which);
	int index = bus->get_index();

	UndoRedo *ur = EditorNode::get_singleton()->get_undo_redo();
	ur->create_action(TTR("Reset Bus Volume"));
	ur->add_do_method(AudioServer::get_singleton(), "set_bus_volume_db", index, 0.f);
	ur->add_undo_method(AudioServer::get_singleton(), "set_bus_volume_db", index, AudioServer::get_singleton()->get_bus_volume_db(index));
	ur->add_do_method(this, "_update_buses");
	ur->add_undo_method(this, "_update_buses");
	ur->commit_action();
}
开发者ID:louisVottero,项目名称:godot,代码行数:13,代码来源:editor_audio_buses.cpp

示例10: _send_selected

void EditorAudioBus::_send_selected(int p_which) {

	updating_bus = true;

	UndoRedo *ur = EditorNode::get_singleton()->get_undo_redo();
	ur->create_action("Select Audio Bus Send");
	ur->add_do_method(AudioServer::get_singleton(), "set_bus_send", get_index(), send->get_item_text(p_which));
	ur->add_undo_method(AudioServer::get_singleton(), "set_bus_send", get_index(), AudioServer::get_singleton()->get_bus_send(get_index()));
	ur->add_do_method(buses, "_update_bus", get_index());
	ur->add_undo_method(buses, "_update_bus", get_index());
	ur->commit_action();

	updating_bus = false;
}
开发者ID:louisVottero,项目名称:godot,代码行数:14,代码来源:editor_audio_buses.cpp

示例11: _bypass_toggled

void EditorAudioBus::_bypass_toggled() {

	updating_bus = true;

	UndoRedo *ur = EditorNode::get_singleton()->get_undo_redo();
	ur->create_action(TTR("Toggle Audio Bus Bypass Effects"));
	ur->add_do_method(AudioServer::get_singleton(), "set_bus_bypass_effects", get_index(), bypass->is_pressed());
	ur->add_undo_method(AudioServer::get_singleton(), "set_bus_bypass_effects", get_index(), AudioServer::get_singleton()->is_bus_bypassing_effects(get_index()));
	ur->add_do_method(buses, "_update_bus", get_index());
	ur->add_undo_method(buses, "_update_bus", get_index());
	ur->commit_action();

	updating_bus = false;
}
开发者ID:louisVottero,项目名称:godot,代码行数:14,代码来源:editor_audio_buses.cpp

示例12: _create_outline_mesh

void MeshInstanceEditor::_create_outline_mesh() {

    Ref<Mesh> mesh = node->get_mesh();
    if (mesh.is_null()) {
        err_dialog->set_text(TTR("MeshInstance lacks a Mesh!"));
        err_dialog->popup_centered_minsize();
        return;
    }

    Ref<Mesh> mesho = mesh->create_outline(outline_size->get_val());

    if (mesho.is_null()) {
        err_dialog->set_text(TTR("Could not create outline!"));
        err_dialog->popup_centered_minsize();
        return;
    }

    MeshInstance *mi = memnew( MeshInstance );
    mi->set_mesh(mesho);
    Node *owner=node->get_owner();
    if (get_tree()->get_edited_scene_root()==node) {
        owner=node;
    }

    UndoRedo *ur = EditorNode::get_singleton()->get_undo_redo();

    ur->create_action(TTR("Create Outline"));

    ur->add_do_method(node,"add_child",mi);
    ur->add_do_method(mi,"set_owner",owner);

    ur->add_do_reference(mi);
    ur->add_undo_method(node,"remove_child",mi);
    ur->commit_action();
}
开发者ID:SasoriOlkof,项目名称:godot,代码行数:35,代码来源:mesh_instance_editor_plugin.cpp

示例13: _volume_db_changed

void EditorAudioBus::_volume_db_changed(float p_db) {

	if (updating_bus)
		return;

	updating_bus = true;

	UndoRedo *ur = EditorNode::get_singleton()->get_undo_redo();
	ur->create_action(TTR("Change Audio Bus Volume"), UndoRedo::MERGE_ENDS);
	ur->add_do_method(AudioServer::get_singleton(), "set_bus_volume_db", get_index(), p_db);
	ur->add_undo_method(AudioServer::get_singleton(), "set_bus_volume_db", get_index(), AudioServer::get_singleton()->get_bus_volume_db(get_index()));
	ur->add_do_method(buses, "_update_bus", get_index());
	ur->add_undo_method(buses, "_update_bus", get_index());
	ur->commit_action();

	updating_bus = false;
}
开发者ID:louisVottero,项目名称:godot,代码行数:17,代码来源:editor_audio_buses.cpp

示例14: _delete_effect_pressed

void EditorAudioBus::_delete_effect_pressed(int p_option) {

	TreeItem *item = effects->get_selected();
	if (!item)
		return;

	if (item->get_metadata(0).get_type() != Variant::INT)
		return;

	int index = item->get_metadata(0);

	UndoRedo *ur = EditorNode::get_singleton()->get_undo_redo();
	ur->create_action(TTR("Delete Bus Effect"));
	ur->add_do_method(AudioServer::get_singleton(), "remove_bus_effect", get_index(), index);
	ur->add_undo_method(AudioServer::get_singleton(), "add_bus_effect", get_index(), AudioServer::get_singleton()->get_bus_effect(get_index(), index), index);
	ur->add_undo_method(AudioServer::get_singleton(), "set_bus_effect_enabled", get_index(), index, AudioServer::get_singleton()->is_bus_effect_enabled(get_index(), index));
	ur->add_do_method(buses, "_update_bus", get_index());
	ur->add_undo_method(buses, "_update_bus", get_index());
	ur->commit_action();
}
开发者ID:louisVottero,项目名称:godot,代码行数:20,代码来源:editor_audio_buses.cpp

示例15: _duplicate_bus

void EditorAudioBuses::_duplicate_bus(int p_which) {

	int add_at_pos = p_which + 1;
	UndoRedo *ur = EditorNode::get_singleton()->get_undo_redo();
	ur->create_action(TTR("Duplicate Audio Bus"));
	ur->add_do_method(AudioServer::get_singleton(), "add_bus", add_at_pos);
	ur->add_do_method(AudioServer::get_singleton(), "set_bus_name", add_at_pos, AudioServer::get_singleton()->get_bus_name(p_which) + " Copy");
	ur->add_do_method(AudioServer::get_singleton(), "set_bus_volume_db", add_at_pos, AudioServer::get_singleton()->get_bus_volume_db(p_which));
	ur->add_do_method(AudioServer::get_singleton(), "set_bus_send", add_at_pos, AudioServer::get_singleton()->get_bus_send(p_which));
	ur->add_do_method(AudioServer::get_singleton(), "set_bus_solo", add_at_pos, AudioServer::get_singleton()->is_bus_solo(p_which));
	ur->add_do_method(AudioServer::get_singleton(), "set_bus_mute", add_at_pos, AudioServer::get_singleton()->is_bus_mute(p_which));
	ur->add_do_method(AudioServer::get_singleton(), "set_bus_bypass_effects", add_at_pos, AudioServer::get_singleton()->is_bus_bypassing_effects(p_which));
	for (int i = 0; i < AudioServer::get_singleton()->get_bus_effect_count(p_which); i++) {

		ur->add_do_method(AudioServer::get_singleton(), "add_bus_effect", add_at_pos, AudioServer::get_singleton()->get_bus_effect(p_which, i));
		ur->add_do_method(AudioServer::get_singleton(), "set_bus_effect_enabled", add_at_pos, i, AudioServer::get_singleton()->is_bus_effect_enabled(p_which, i));
	}
	ur->add_undo_method(AudioServer::get_singleton(), "remove_bus", add_at_pos);
	ur->add_do_method(this, "_update_buses");
	ur->add_undo_method(this, "_update_buses");
	ur->commit_action();
}
开发者ID:louisVottero,项目名称:godot,代码行数:22,代码来源:editor_audio_buses.cpp


注:本文中的UndoRedo::add_undo_method方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。