@@ -71,9 +71,7 @@ bool UndoRedo::_redo(bool p_execute) {
71
71
}
72
72
73
73
current_action++;
74
- if (p_execute) {
75
- _process_operation_list (actions.write [current_action].do_ops .front ());
76
- }
74
+ _process_operation_list (actions.write [current_action].do_ops .front (), p_execute);
77
75
version++;
78
76
emit_signal (SNAME (" version_changed" ));
79
77
@@ -321,7 +319,7 @@ void UndoRedo::commit_action(bool p_execute) {
321
319
}
322
320
}
323
321
324
- void UndoRedo::_process_operation_list (List<Operation>::Element *E) {
322
+ void UndoRedo::_process_operation_list (List<Operation>::Element *E, bool p_execute ) {
325
323
const int PREALLOCATE_ARGS_COUNT = 16 ;
326
324
327
325
LocalVector<const Variant *> args;
@@ -337,18 +335,20 @@ void UndoRedo::_process_operation_list(List<Operation>::Element *E) {
337
335
338
336
switch (op.type ) {
339
337
case Operation::TYPE_METHOD: {
340
- Callable::CallError ce;
341
- Variant ret;
342
- op.callable .callp (nullptr , 0 , ret, ce);
343
- if (ce.error != Callable::CallError::CALL_OK) {
344
- ERR_PRINT (" Error calling UndoRedo method operation '" + String (op.name ) + " ': " + Variant::get_call_error_text (obj, op.name , nullptr , 0 , ce));
345
- }
338
+ if (p_execute) {
339
+ Callable::CallError ce;
340
+ Variant ret;
341
+ op.callable .callp (nullptr , 0 , ret, ce);
342
+ if (ce.error != Callable::CallError::CALL_OK) {
343
+ ERR_PRINT (" Error calling UndoRedo method operation '" + String (op.name ) + " ': " + Variant::get_call_error_text (obj, op.name , nullptr , 0 , ce));
344
+ }
346
345
#ifdef TOOLS_ENABLED
347
- Resource *res = Object::cast_to<Resource>(obj);
348
- if (res) {
349
- res->set_edited (true );
350
- }
346
+ Resource *res = Object::cast_to<Resource>(obj);
347
+ if (res) {
348
+ res->set_edited (true );
349
+ }
351
350
#endif
351
+ }
352
352
353
353
if (method_callback) {
354
354
Vector<Variant> binds;
@@ -373,13 +373,16 @@ void UndoRedo::_process_operation_list(List<Operation>::Element *E) {
373
373
}
374
374
} break ;
375
375
case Operation::TYPE_PROPERTY: {
376
- obj->set (op.name , op.value );
376
+ if (p_execute) {
377
+ obj->set (op.name , op.value );
377
378
#ifdef TOOLS_ENABLED
378
- Resource *res = Object::cast_to<Resource>(obj);
379
- if (res) {
380
- res->set_edited (true );
381
- }
379
+ Resource *res = Object::cast_to<Resource>(obj);
380
+ if (res) {
381
+ res->set_edited (true );
382
+ }
382
383
#endif
384
+ }
385
+
383
386
if (property_callback) {
384
387
property_callback (prop_callback_ud, obj, op.name , op.value );
385
388
}
@@ -400,7 +403,7 @@ bool UndoRedo::undo() {
400
403
if (current_action < 0 ) {
401
404
return false ; // nothing to redo
402
405
}
403
- _process_operation_list (actions.write [current_action].undo_ops .front ());
406
+ _process_operation_list (actions.write [current_action].undo_ops .front (), true );
404
407
current_action--;
405
408
version--;
406
409
emit_signal (SNAME (" version_changed" ));
0 commit comments