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"

Using .csv data to generate objects in level

Hey guys,

So the question title may be a bit misleading. I have a .csv file that contains times/information about notes for a music game I'm beginning development on.

I've imported the .csv as a DataTable into the Engine. What I want to do is use it to generate physical note objects in the level that I can then manipulate and save as part of the level in in the editor.

The reason I can't simply spawn them in the game and then use them from there is because, while this is a beat-matching music game, it takes on a path the player is running down that will have scenery in it and characters coming and going based upon different points in the song. With that in mind, we want to be able to edit and add this stuff in based upon where the notes are in the editor.

Anyone know of a good way to do this?


Product Version: Not Selected
more ▼

asked May 27 '14 at 10:18 PM in Using UE4

avatar image

6 5 7 8

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

2 answers: sort voted first

I don't think it's as simple as just importing the .CSV asset into the editor. There has to be a custom-written hook up, so far as I can gather from this: https://docs.unrealengine.com/latest/INT/Programming/Gameplay/DataDriven/index.html

In a forum post (https://forums.unrealengine.com/showthread.php?2925-Read-data-from-File-Some-kind-of-dynamic-level&p=25750&viewfull=1#post25750) Joe Conley writes: "The format the .csv files are in isn't well documented yet, nor is the process of defining the type of data for the columns in a Data Table, but I'm hoping to write a blog post on it sometime in the near future. Right now this is a C++ feature, but we're looking into making it more accessible from Blueprints and require less programming (or preferably none), but we have a fair amount of work to do in this regard."

more ▼

answered Jun 15 '14 at 04:46 AM

avatar image

1.1k 46 47 87

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

I'm also very interested in this workflow. I came across RAMA's blueprint plugin library recently and there's a node in there called load string array from file. This lets you read in any txt file and seperate each line into an index to form an array. I tried using this to bring in transforms from Maya. It works for the most part, but I'm having an issue getting the rotations to match from Maya to UE4...

For anyone that's willing to help out, here's my mel script to save out transform data from Maya as a txt file

//STEP 1: // Define Your File Path // folder must exist for it to save the file.

string $filePath = "C:/mel/ue4CSV_test001.txt";

//STEP 2: // select all the objects you want to send then run this:

$fileId = fopen $filePath "w"; string $sel[] = ls -sl; int $count = size $sel; for ($i=0; $i<$count; $i++) { select $sel[$i]; string $transform; vector $p = xform -q -ws -t; vector $r = xform -q -ws -ro; vector $s = xform -q -ws -s; $transform = ($p.x + "," + $p.y + "," + $p.z + "," + $r.x + "," + $r.y + "," + $r.z + "," + $s.x + "," + $s.y + "," + $s.z);

 fprint $fileId ($transform + "\n");

} fclose $fileId;

You can find Rama's plugin here: https://wiki.unrealengine.com/Rama%27s_Vertex_Snap_Editor_Plugin#All_Future_Updates

Here's my simple blueprint for getting the values from the txt file alt text

This is what the layout looks like in Maya: alt text notice how the shapes follow the pattern and don't intersect with one another

Here's my result in UE4: alt text you can see that they follow for the most part, but some of them are rotated incorrectly and intersect with one another. This is a simple example, but it looks even worse trying to populate a scene as most of the objects are rotated incorectly.

I know Maya is Y up and UE4 is Z up, so thats why I have swapped the Y and Z inputs in the blueprint. I also found that inverting the yaw gave better results in some orientations, but broke in others...

I know this must be possible as things like mtu exist... https://forums.unrealengine.com/showthread.php?22515-m2u-interactive-sync-script-for-Maya-gt-UE4

If anyone could help out with a solution to this I would be very grateful! :D

thanks, Richard

blueprintsetup.jpg (149.9 kB)
mayalayout.jpg (103.1 kB)
ue4layout.jpg (61.4 kB)
more ▼

answered Jul 06 '16 at 01:40 PM

avatar image

41 1 3 5

avatar image richst42 Jul 06 '16 at 01:43 PM

doesnt look like the script was formatted properly, here is it again:

 //STEP 1: // Define Your File Path
 //folder must exist for it to save the file.
 string $filePath = "C:/mel/ue4CSV_test001.txt";
 //STEP 2: // select all the objects you want to send then run this:
 $fileId = `fopen $filePath "w"`;
 string $sel[] = `ls -sl`;
 int $count = `size $sel`;
 for ($i=0; $i<$count; $i++)
     select $sel[$i];
     string $transform;
     vector $p = `xform -q -ws -t`;
     vector $r = `xform -q -ws -ro`;
     vector $s = `xform -q -ws -s`;
     $transform = ($p.x + "," + $p.y + "," + $p.z + "," + $r.x + "," + $r.y + "," + $r.z + "," + $s.x + "," + $s.y + "," + $s.z);
     fprint $fileId ($transform + "\n");
 fclose $fileId;
(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
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