Announcement

Collapse
No announcement yet.

Actor properties set during the game, preserved in editor

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Actor properties set during the game, preserved in editor

    The house actor what I'm working stores the furniture, doors, stairs, etc, in arrays. To fill the array, I place the staticmesh in the house, which is located at 0,0,0. Then I copy the location and rotation values from the staticmeshes to the house array slots. It's very, very tedious.

    There are some way to run the game, execute some function that fill the array by looking the static meshes in the house, and when return to the editor, the array values will be preserved? So I can store all as an archetype.

    Provisional blog: http://cobaltudk.blogspot.com.es/
    Videos: https://www.youtube.com/user/cobaltudk
    Facebook: https://www.facebook.com/babylonprojectgame/

    #2
    you cannot save stuff from the game back into the editor
    however you can execute the function at editor time using the ancient and hidden trick of a custom brush

    I have a couple of these which I use for debugging my custom paths, snapping meshes, etc
    here's how it goes:

    Code:
    class myEditorTool extends BrushBuilder;
    
    var() bool bSomething;
    var() int SomeInt;
    
    event bool Build()
    {
     local WorldInfo WI;
     local Actor worldActor;
     local Vector newLoc;
    
     WI = class'Engine'.static.GetCurrentWorldInfo();
    
     foreach WI.AllActors(class'Actor', worldActor)
     {
      `log("hi this is "$worldActor);
      worldActor.SomeFunction();
      worldActor.SomeProperty = "blah";
     }
    
     return false;
    }
    
    defaultproperties
    {
        BitmapFilename="DownArrowBlue" // Engine\EditorResources\wxRes\DownArrowBlue.png - will only accept png cursors from that folder
        ToolTip="My Editor Tool"
    }
    just by creating this class and compiling, a new button will appear in the editor on the left panel at the bottom of the brush tools.
    left-clicking the button will execute the Build() function. keep in mind you can't use anything that requires ticking (i.e. timers)
    the editor-exposed bSomething / SomeInt variables will show up in a popup if you right-click the button. at that time changing any variable will run the Build() function
    Last edited by Chosker; 11-08-2017, 04:21 PM.
    Follow me on Twitter!
    Developer of Elium - Prison Escape
    Local Image-Based Lighting for UE4

    Comment


      #3
      It works perfectly, just what I needed, thanks a lot!
      Provisional blog: http://cobaltudk.blogspot.com.es/
      Videos: https://www.youtube.com/user/cobaltudk
      Facebook: https://www.facebook.com/babylonprojectgame/

      Comment


        #4
        glad it worked
        Follow me on Twitter!
        Developer of Elium - Prison Escape
        Local Image-Based Lighting for UE4

        Comment

        Working...
        X