Announcement

Collapse
No announcement yet.

Unreal.js

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

    #76
    Quickly answers

    Your Javascript component working with Actor, but i have a widget which the Init (creating and add to viewport) when E key is pressed. How can i get access to this widget and override Event?

    Comment


      #77
      In JS, you can access any actors which are already spawned in your world. 'GWorld.GetAllActorsOfClass(Actor)'. (FYI, current build doesn't let you can access LevelBlueprintActor).

      let actor = GWorld.GetAllActorsOfClass(YourPreciousBPActor).OutActors[0]
      let widget = actor.YourPublicVarName
      widget.HelloWidget()

      -- <extending your BP class> --

      class YourNiceActor extends Blueprint.Load('/Game/YourBP').GeneratedClass {
      MethodToOverride(arguments...) {
      console.log('hello JS')
      this.AnotherMethod()
      }
      }

      /* kinda ugly for now */
      let YourNiceActor_C = require('uclass')()(global,YourNiceActor)
      .... <please refer to helloUMG.js> ....
      Last edited by nako_sung; 03-11-2016, 03:21 PM.

      Comment


        #78
        I try it. Thank you!

        Comment


          #79
          Thank you very much, I will take a look - but I feel like a complete noob. I'll share my progress here,...

          Comment


            #80
            I just updated a new example and video: https://www.youtube.com/watch?v=Kl4LVaiHqGw Snippet editor written in UMG.

            Click image for larger version

Name:	SnippetScreenshot.png
Views:	3
Size:	956.4 KB
ID:	1102297
            Last edited by nako_sung; 03-12-2016, 07:22 PM.

            Comment


              #81
              I don't know if this is the right place to ask, but...
              If you extended a class such as BTTask or BTNode (for the AI system), would you be able to access that from within the behavior tree editor just as you would with a C++ or Blueprint class? Or is extending classes solely for the purpose of being able to create them within JS?

              EDIT: I think I've just figured it out. Once you call compile(class) or require('class')()(global, class) on your class, it becomes loaded into the UE4 reflection system as a proxy object (I'm guessing), therefore becomes usable?
              Last edited by fabian.s123; 03-12-2016, 07:58 AM.

              Comment


                #82
                #Unreal.js demo is available!

                https://github.com/ncsoft/Unreal.js/...itorSample.zip
                Last edited by nako_sung; 03-12-2016, 08:30 AM.

                Comment


                  #83
                  Yes. JS generated class is fully accessible by other BP's and C++ classes, but they cannot link/refer to generated class directly.
                  Last edited by nako_sung; 03-12-2016, 09:14 AM.

                  Comment


                    #84
                    nako_sung: "In JS, you can access any actors which are already spawned in your world.".

                    1. That is, as i understand, I need to create some Actor like Cube and place in scene. Then somehow i need put my widget inside this Actor (to variable) and then through GetAllActors i get this variable and intercat with it. I understand correctly?

                    2. If yes, i need create some LogicActor and put to them all UMG widgets to access them from JS.

                    Comment


                      #85
                      1. Widget can be created within JS.
                      `GWorld.CreateWidget(WidgetClass, GWorld.GetPlayerController(0))`

                      1-1. You can define your widget in JS. (please refer to helloUMG.js)
                      1-2. You can use your UMG BP. GWorld.CreateWidget(Blueprint.Load(your-umg-path).GeneratedClass,...)

                      Comment


                        #86
                        1-2 what i need. I try and its working. Thank you.

                        I install Node.js Tools for VS 2015. Qualifier: localhost:5858. Script open in VS is helloBlueprint.js (drag and drop to IDE, not project setup). But in Available Process is nothing, when click to Refresh AttachToProcess write error Make sure that the process is running. Help please.

                        What books you are using for writing this plugin? How you start your work. With which began its work? Interesting how creating this projects..

                        Comment


                          #87
                          You can attach debug enabled javascript context marked with Context.SetAsDebugContext ().

                          In fact I don't have any programming language books. I usually love googling!

                          Comment


                            #88
                            If I'm not tired yet you...

                            1. my logic of level is:
                            Actor walk and overlap trigger, then i press E key and creating Widget. When i press button in Widget i calculate some math logic. I try put this logic inside JS.

                            If i creating (init) this Widget inside JS, my Blueprint (press E, overlap) breaking.. How can i embed UnrealJS in this logic without breaking created Blueprint?

                            I need synth Blueprint and UnrealJS..

                            2. When i creating process for debugging, all work fine. I start level inside UE, than attach to process.. but how can i debug for example Main function variables (when i start unreal Main is already calling and i can not debug)?
                            Last edited by florentine3d; 03-14-2016, 04:17 AM.

                            Comment


                              #89
                              1. All you want is just calculating something. You can define a placeholder Blueprint class which has several overridable functions. And then in JS you can extend that class to override functions, and let your BP know 'new JS generated class'.

                              2. You can add some function to wait until debugger attached by placing some Widget or timer (setTimeout(main,5000)).

                              Comment


                                #90
                                Thank you very mush.
                                Last edited by florentine3d; 03-14-2016, 07:06 AM.

                                Comment

                                Working...
                                X