本文整理汇总了C++中UndoRedo::add_do_property方法的典型用法代码示例。如果您正苦于以下问题:C++ UndoRedo::add_do_property方法的具体用法?C++ UndoRedo::add_do_property怎么用?C++ UndoRedo::add_do_property使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UndoRedo
的用法示例。
在下文中一共展示了UndoRedo::add_do_property方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: _set_impl
bool MultiNodeEdit::_set_impl(const StringName &p_name, const Variant &p_value, const String &p_field) {
Node *es = EditorNode::get_singleton()->get_edited_scene();
if (!es)
return false;
String name = p_name;
if (name == "scripts") { // script set is intercepted at object level (check Variant Object::get() ) ,so use a different name
name = "script";
}
UndoRedo *ur = EditorNode::get_singleton()->get_undo_redo();
ur->create_action(TTR("MultiNode Set") + " " + String(name));
for (const List<NodePath>::Element *E = nodes.front(); E; E = E->next()) {
if (!es->has_node(E->get()))
continue;
Node *n = es->get_node(E->get());
if (!n)
continue;
if (p_value.get_type() == Variant::NODE_PATH) {
Node *tonode = n->get_node(p_value);
NodePath p_path = n->get_path_to(tonode);
ur->add_do_property(n, name, p_path);
} else {
Variant new_value;
if (p_field == "") {
// whole value
new_value = p_value;
} else {
// only one field
new_value = fieldwise_assign(n->get(name), p_value, p_field);
}
ur->add_do_property(n, name, new_value);
}
ur->add_undo_property(n, name, n->get(name));
}
ur->add_do_method(EditorNode::get_singleton()->get_inspector(), "refresh");
ur->add_undo_method(EditorNode::get_singleton()->get_inspector(), "refresh");
ur->commit_action();
return true;
}