Announcement

Collapse
No announcement yet.

Spline not editable when set in Construction Script

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

    Spline not editable when set in Construction Script

    If Spline Component points are set in Construction Script (or are altered e.g. by Set Tangent at Spline Point), spline becomes uneditable in editor and during gameplay. Point handles become pink (instead of white) and it's impossible to change their position via Set Location at Spline Point.

    Is this a bug or by design? Maybe is there some workaround, even if it would need to change something in C++?

    #2
    In 4.9 if you add spline points in construction script then you can't edit them in the editor. But set location at point does work in real time. I have a tank tread animation done like that and i ca move control points on every tick.
    Youtube Channel

    Comment


      #3
      Originally posted by BoredEngineer View Post
      In 4.9 if you add spline points in construction script then you can't edit them in the editor. But set location at point does work in real time. I have a tank tread animation done like that and i ca move control points on every tick.
      It's a pity... Well, maybe some C++ folks would know how to change it via cpp...

      Originally posted by BoredEngineer View Post
      But set location at point does work in real time. I have a tank tread animation done like that and i ca move control points on every tick.
      That's interesting, in my case it doesn't work. I've tried plugging this:
      Click image for larger version

Name:	1.png
Views:	1
Size:	51.6 KB
ID:	1087385

      ... Into Event Tick, Begin Play, and other places... Still, the point doesn't change its location during gameplay. I have around 7 points in my spline (set in construction script) and I've tried changing location of spline nr 0, 1, 2, 3, 4... None of them changed their position. (However, it works when I disable Construction Script and add points manually in editor)
      Last edited by Slavq; 09-11-2015, 08:01 AM.

      Comment


        #4
        How exactly did you set them in construction script? Can you see your spline properly in actor's vieport?

        If you want to edit spline in editor then don't interact with it in construction. Otherwise check answer hub, some had to switch to 4.9 to get spline working and he was able to edit constructed spline, it was just glitchy or weird how you can do that.

        In my case I've edited an empty spline in editor. Manually wrote down its tangents and positions into arrays and then populated another spline from construction to have it as a default setup.

        Just to be on the same page, I'm talking about non render spline component not mesh component.
        Last edited by BoredEngineer; 09-11-2015, 10:48 AM.
        Youtube Channel

        Comment


          #5
          Arrrgh, I get it, sometimes I'm really dumb
          I have a Spline component and Spline Mesh Components added along spline. Spline points was correctly changing their locations, but I didn't updated Spline Mesh Component position by "Set Start and End" node - so they stood in the same place and I've thought that it's not working.
          So, remember kids, after moving spline points while using Spline Mesh Component, always update Spline Mesh Component properties!

          Thanks for help bro!
          - Slavq, the dumb IT Engineer

          Comment


            #6
            To allow editing of Splines created in c++ you need to do 2 things.

            1. In SplineComponent.h change the line
            //UPROPERTY(VisibleAnywhere, Category = Spline)
            //bool bSplineHasBeenEdited;
            to..
            UPROPERTY(EditAnywhere, Category = Spline, meta = (DisplayName = "Override Construction Script"))
            bool bSplineHasBeenEdited;
            2. Once you have added the spline points in c++ you manually set the variable like
            MySplineComp->bSplineHasBeenEdited = true;
            http://unrealdeveloper.uk

            Comment


              #7
              So how to do it on BP if it is on other blueprint

              SplineBase (my BP which has has spline-and add mesh) in the construction script iterate over the points in the spline and add the SplineMesh to each one, and it work nicely.

              So Im trying to update a spline at runtime, but from other blueprint (say the player) I search for all the actors of "SplineBase" then with the display name I search for one specific and return it that is "Get Spline Aguja" in the tick, so apparently with the debug blue print the value is updated, but I don't see moving anythingg.

              Thought here says that I need to also update the SplineMesh components, don't know if I need to remove them first, or how to actually get them or update them.

              I did follow this https://www.youtube.com/watch?v=7YUxM0NDWRY for create the SplineBase.


              (if it serve for something I can add splineBase to the map, and add points in between and see how it updates the shape, the nodes inside [knots??] are white so yeah I can edit them on the map).

              NOTE: fon't take into account the unconnected parts, I just say, lets try with 0 index)
              Attached Files
              Last edited by tyoc213; 10-13-2015, 03:05 AM.

              Comment


                #8
                Can't edit the spline in the Blueprint Viewport, only instanced-based. Why?

                Comment


                  #9
                  Click image for larger version

Name:	InputSplinePointsToConstructionScript.PNG
Views:	1
Size:	21.0 KB
ID:	1108112

                  Add this thingy to your construction script after adding the spline points via the Add Splint Point functions. This will allow you to change them in the editor after the construction script has run.

                  Comment

                  Working...
                  X