I got some(500) x3d-files exported form Paraview and I want to import them with blender in order to animate and render them. Every file represents a single timestep, so it should be added to its own frame. The import of single files workes fine, but I have no idea how I can loop the importskript. I used the forums search but all I found, was that I have to use python for this issue and I never found a usefull howto.
Thanks for your help.
harwen
This is possible! It would be VERY helpful if the .x3d were named something useful like file001.x3d, file002.x3d, file003.x3d and so on. A script could be written to import the script that loads .x3d files and then every time you change the frame it will load up the appropriate .x3d file. This is HIGHLY inefficient but it would be the easiest way. The other option would be to load up all the files at once and then make only the one needed for that frame unhidden. This wouldn’t be too hard either. Depending on the number of frames and the size of the object you are wanting to import, one of these ways will be better suited than the other. So a few questions…
How many frames are you looking at using? About 500 you said
Is each object big? (ie memory) cuz there might be 500 of them stored in memory
Once you import them, are you immediately going to render and be done? or are you going to be doing alot of work after you import them before rendering?
Thank you for your quick response. @1 Usually I got 500-1000 files as results. @2 It depends, if I use paraview export the size is about 400-500kb. If I use my own writer I got files at a size of 50-100kb. @3 I want to do some postproduction stuff like adding materials, but structure of the imported files should not be changed.
I would prefer an easy solution. Like your first suggestion. Actually I am new to python. But should this look like this example?
for i in range(5):
file = open("filename00"+i)
//start importer
//insert grid
file.close()
//change frame
For this I got some questions:
how can I access the python script for the importer?
How can I change the frame?
I tried to find some answers in the API Documentation. But I wasn’t that helpful to me.
Well, the good thing you can do with blender is have it run a script every time the frame is changed. So when you change the frame in blender, ie playing animation, or arrow keys. You could run a script like this…
import Blender
import import_web3d
#delete old mesh from last frame
frame = Blender.Get("curframe")
obj = import_web3d.load_web3d("file" + str(frame) + ".x3d")
#setmaterial on obj, not for sure how right now
obj.setMaterial(mat)
# change location or whatever is needed
As you can see i imported the script that handles the x3d files. And using this script, the script would not need to change the frame.
Is there any way you could zip up all the files, or several of them and send them to me( Filehosting, email…) so i could test some stuff out?
Thank you for you quick help. I can set up a small test case, zip the files and sent them to you via Email.
Of course I got an other question about your skript.
Where do i have to put the x3d files in order to import them. Realiv to the blend-file?
You save the imported object in obj. What will happen if there are two oder more objects in the x3d file?
Sorry, i had a very busy weekend. To answer your questions, i don’t know. I would have to do some testing to find out. You can email the zip of the files to dail8859 at yahoo dot com. I’ll see what i can figure out with them.