在3D场景编辑器中撤消 [英] Undo in 3D-Scene editor

查看:94
本文介绍了在3D场景编辑器中撤消的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在考虑在3D场景编辑器中创建(开发,编程)撤消"动作.

I am thinking about creating (developing, programming) "undo" action in 3D-Scene editor. Is there a standard solution?

推荐答案

要实现撤消,您需要能够在应用程序中实现状态"的概念.

最简单的机制可能是每次更改对象时都将其复制,然后将旧值放在保存堆栈中.

保存堆栈的记录中应包含以下成员.
1.行动-将被撤消的事情.编辑/删除/插入...
2.旧对象*-删除对象的指针.
3. New Object *-指向已添加的新对象的指针.

因此,每次发生更改时,请将更改后的状态压入堆栈.
撤消操作后,将最后一个操作弹出并撤消.

这是开始实施的基本方法.如何实现它以及需要什么附加功能将取决于应用程序的结构和编码样式.
To implement undo, you need to be able to implement the concept of ''state'' in your application.

The simplest mechanism might be to copy an object every time you change it, and put the old value on a save stack.

The save stack should have the following members in the records.
1. Action - What will be undone. Edit/Delete/Insert...
2. Old Object * - A pointer the object removed.
3. New Object * - A pointer to the new object that was added.

So every time there''s a change, push the changed state on the stack.
And when you undo, pop the last action off and reverse it.

This is a basic way to start your implementation. How you implement it and what additional features you''ll need will be up to how your application is structured and your coding style.


这篇关于在3D场景编辑器中撤消的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆