Announcement

Collapse
No announcement yet.

C++ Reflections and a simple Interpreter

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

    C++ Reflections and a simple Interpreter

    Hi. I need to write a simple interpreter in c++ for my game, but I'm having trouble understanding the documentation (which is lacking).

    How do I get and set a values of a UProperty for an object?
    How do I invoke methods of an object?
    How do I pass a "list" of arguments for the method?
    How do I get the return value of the method?
    Can I find/get a property or method by name (string)?

    Thanks.

    #2
    No one ever worked with Unreal's reflection system? *cough* bump *cough*

    Comment


      #3
      I think the reason why no one answer your questions are, those are pretty basic questions, and you can get the answers easily by digging into the source code?

      Comment


        #4
        Originally posted by thelONE View Post
        I think the reason why no one answer your questions are, those are pretty basic questions, and you can get the answers easily by digging into the source code?
        If it worked like that, then no one would ever come here to ask questions. Instead of wasting your arrogance on strangers you could post something useful.

        Comment


          #5
          Nope, you should try your best to find the answers yourself before coming here to beg for an answer, especially for this kind of pretty basic question.
          You should not only read the documentation, which is pretty limited, but also dig into the source code. The reflection system in Unreal Engine is pretty amazing and you can learn a lot by browsing the engine source.

          Comment


            #6
            Hi OtherDude

            Did you see this blog post about Unreal Property System?

            https://www.unrealengine.com/blog/un...tem-reflection
            Support my RTS Game (Agora) on Patreon!
            Unreal Nexus - Create Share and Experience!
            Unreal Engine 4 World-Wide User Map

            [PLUGIN] Aws Gamelift Client Plugin
            [TOOL] Create your own binary release of UE4 from GitHub source
            My UE4 Tutorials and Misc Tools

            Lead Programmer at YetiTech Studios
            Your Friendly Neighborhood
            Satheesh PV (a.k.a RyanJon2040) | Twitter, Instagram, Facebook, LinkedIn, YouTube, Google+

            Comment


              #7
              Originally posted by ryanjon2040 View Post
              Hi OtherDude

              Did you see this blog post about Unreal Property System?

              https://www.unrealengine.com/blog/un...tem-reflection
              I've already read that post and it wasn't very helpful.

              The interpreter and virtual machine are already done. The only thing left to do is hook it up with the reflection system so I can change UObject field values and invoke functions.

              I was looking into the reflection system, but I can't find a way to use it correctly. To retrieve a UObject function I'm doing something like this:

              Code:
              UFunction* func = myUObject->FindFunction("someFunction");
              func->Invoke(myUobject, ..., ...);
              But I don't know what to pass as the second (FFrame) and third (void*) arguments.

              For the UObject field values I'm trying to use something like:

              Code:
              UProperty* prop = myUObject->GetClass()->FindPropertyByName("someProperty");
              But I don't know how to change the actual value of the variable.

              Any ideas?
              Last edited by OtherDude; 08-16-2015, 01:16 PM.

              Comment


                #8
                Take a look at the ScriptPlugin, specifically the ScriptGeneratorPlugin that generates wrappers that call UObject functions with parameters. You may find this thread useful.
                Contact: enlight in #unrealengine IRC channel on Freenode, or @macagonator on Twitter

                Comment

                Working...
                X