x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Undo Python Script is not working

The description here seems very clearly, but my test code is not working. The undo entry "My Transaction Test" is in the Undo-History, but it is not undoing the translation. Anyone can help?

 import unreal
 actors = unreal.EditorLevelLibrary.get_selected_level_actors() 
 location = actors[0].get_actor_location()
 with unreal.ScopedEditorTransaction("My Transaction Test") as trans:
     location.z += 28 
     actors[0].set_actor_location(location, False, True)


Maybe I have to explicit set the enter and exit points of the commands to undo? https://api.unrealengine.com/INT/PythonAPI/class/ScopedEditorTransaction.html?highlight=scoped

Product Version: UE 4.21
Tags:
more ▼

asked Feb 08 '19 at 05:59 PM in Using UE4

avatar image

SebaSopp
91 3 5 17

avatar image csprance Feb 24 '19 at 05:29 PM

The enter and exit are magic methods that are called when you use the with command so that wouldn't be it.

avatar image Claudio.Alvaro Jul 11 '19 at 01:44 PM

Try using attributes accessible with set_editor_property instead. Something along the lines of:

 actors[0].set_editor_property('actor_location', location)

I believe the undo stack might expect all the bells and whistles that come with the ui commands and set_editor_property/get_editor_property seem to hook into that, as opposed to accessing a property/function directly.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

0 answers: sort voted first
Be the first one to answer this question
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question