Object Sequence Loader

The object sequence loader is a script that loads a sequence of 3d model files in a format Vue can import (obj, vob, 3ds, lwo, shd, cob and some other formats)

[wpdm_package id=100]

Tested using Vue 5 Infinite 5.11-02 and Vue 6 Pre Release

How does it work?

It first loads the objects into the scene. These are then hidden (usually beneath the ground but you can change where they are kept) and then switched into a visible area for each frame you render. By creating an animation, the Python script will automatically switch these objects in and out to give you an animation.

Note: These do not appear as keyframed animations unless you have auto keyframing turned on and have rendered the complete sequence of steps that make up the animation.

What version of Vue does it work with?

The script will work with Vue 5 Infinite and Vue 6 Infinite. Vue 6’s improved importing and real world units provide significant improvements to the results of using the object sequence importer.

What other programmes does it work with?

It has been tested with objects exported from RealFlow 3, RealFlow 4 and XFrog 3.5 Full. It should work with any programme that can make a set of 3d models in a format that Vue can import.

What are the limitations?

This is an early development which is currently limited to standalone animations.

Mini Previews and HyperVue are not supported. The Python script necessitates animation sequences in order to correctly switch the objects between frames.

Object files can consume a lot of memory, so it is best to initially experiment with simple sequences of small object files to learn how to use the script.

How do I prepare the sequence?

Take your 3D objects and place them in a directory.

The sequence must have sequentially numbered file names. The numbering does not have to begin with 0 or 1. For example:

  • 1.lwo, 2.lwo, 3.lwo, 4.lwo… …100.lwo, 101.lwo
  • Mesh010001.obj, Mesh010002.obj, Mesh010003.obj…
  • Flower_blossom_00001.obj, Flower_blossom_00002.obj, Flower_blossom_00003.obj
  • 5.3ds, 6.3ds, 7.3ds

How do I run the Script?

Download the script and uncompress the zip file. You should now have a file called objsequenceloader.py .

Place a copy of the script objsequenceloader.py in the directory with the objects.

Run the Python Script and follow the options. For more help on running a script see my Vue Python for Beginners Tutorials.

The script may not work with script quick load menu in Vue after other operations have been used. For reliable run it with Run python script…

A number of options will be presented to you. Respond to each one in turn. If this is your first time using the script I would suggest using the following options:

  • Group objects: Yes
  • Drop on import: No
  • Align on import: No

I’ll write some documentation to explain all the options soon.

I’m Using XFrog is there anything I should know?

If you are importing a sequence of objects from Xfrog you will be asked for a file name prefix. This is the part of the filename before the first 0 in the numbering sequence. So for a sequence including Flower_blossom_00001.obj use Flower_blossom_.

What Happens when I’ve Answered all the Questions?

When you have completed all of the options the script will start to load the objects.

The settings from your last object import will be used by Vue while importing the files. The loading process may take some time.

Once the script has finished loading the files a dialogue box will pop up to let you know.

The Sequence is Loaded what do I do next?

You will notice several objects in the scene:

  • Imported Object Target
  • Imported Object Out of Shot
  • Either the individual objects or a group of objects depending on the options you selected

The Imported Object Target is where the object for a specific frame will be displayed. You can scale the objects by scaling this object. You can rotate them by rotating it. You can position them by position it. If you selected Drop on import make sure this is over something else in the scene so that when the object is dropped it has somewhere to land. The Imported Object Target will not appear in renders.

The Imported Object Out of Shot is where objects that don’t appear in a specific frame will be placed. It starts at a position that should be out of shot. If it isn’t you can move it. If you do move it and want to see the objects reposition render a frame and all the objects should move. The Imported Object Out of Shot object will not appear in renders.

How do I render my animation?

When you are ready to render the animation open the animation rendering panel. If you do not have any other animation in the scene you will need to tell Vue how many frames to render by selecting Render Sequence and entering appropriate numbers. You should then be able to render your animation.

How can I save the sequence?

If you want to save the sequence the results of using this script you must render the scenes animation before saving. This will create key frames in the scene for the objects. To perform this process quickly render a very small version of the animation with preview quality. Once this has been done delete you can delete Imported Object Target and the Imported Object Out of Shot objects. They will not have any effect on the sequence when it is reloaded.

Vue Crashed while loading the objects. What can I do?

If you have too many objects in the sequence for your computer to cope with Vue may crash. If this happen try loading the sequence in smaller parts and then compiling the final animation in video editing software.

There don’t seem to be any animation paths. Is the script broken?

Earlier versions of the script created animation paths for each object. This technique has now been superseded. Instead a technique similar to a 3d flipbook is used. Each time a frame is rendered the script moves an appropriate object to be displayed and moves the others elsewhere.

I want to have two sequences in the same animation. Can I do this?

Running this script multiple times on the same scene is only possible if the earlier import has had key frames created by rendering an animation sequence. Once a second import is carried out the first import will not be editable by moving the target objects.

Can I use this with Network Rendering?

This script hasn’t been tested with network rendering. It may be possible to network render an animation created using this script by first using the technique for saving the animation. I’ve not tried this. If you try it and it works please e-mail me so I can update other users.

A pop up telling me I have nothing to drop on. What should I do?>

The problem is with the drop on import option. When using drop on import raise the height of the Imported Object Target and ensure it is dropping onto an object.

Can I change the textures of the object in Vue?


  1. #******************************************************
  2. # Loads a sequence of object files into Vue
  3. #
  4. # - objsequenceloader.py
  5. # - By Mark Caldwell
  6. # - Version 0.2.3
  7. # - 8th December 2006
  8. # - Copyright Mark Caldwell 2006
  9. # - Tested with Vue 6 Pre Release
  10. #
  11. # Warning: This script can be memory intensive with
  12. # complex modesls or when importing long sequences.
  13. # Save your Vue scene before running it.
  14. #
  15. # How to use in 5 easy steps
  16. #
  17. # 1. Download this file onto your computer
  18. #
  19. # 2. Place in Directory Containing Object Files named
  20. # Mesh01001.obj, Mesh01002.obj, Mesh01003.obj and so on
  21. # for Realflow, somename_00001.obj, somename_00002.obj and so on
  22. # for Xfrong (The file extension can be any of
  23. # the types Vue can import and somename will vary)
  24. # or 1.obj, 2.obj, 3.obj and so on for other
  25. # types of file import (The file extension can be any of
  26. # the types Vue can import)
  27. #
  28. # 3. Then run script and supply responses when prompted.
  29. #
  30. # 4. Wait while it loads the objects in
  31. #
  32. # 5. Position the "Imported Object Target" where you want the
  33. # objects to be placed during rendering. Scale or rotate this object
  34. # to scale and rotate the imported objects. This object won't appear
  35. # in your pictures. You can also move where they are put when not used
  36. # by moving "Imported Object Out of Shot". After moving this render a
  37. # single frame to change where the objects are placed.
  38. #
  39. # To run it go to Python -> Run Python Script
  40. # Then locate the file on your computer
  41. #
  42. #******************************************************
  44. infinity=[0,0,-10000] # The position to place objects when not displayed [x,y,z]
  45. start=[0,0,0] # The position to place object when displayed [x,y,z]
  47. #----------------------------------------------
  48. # End of Configuration: Don't edit after this
  49. #----------------------------------------------
  51. #----------------------------------------------
  52. # Functions
  53. #----------------------------------------------
  55. def FindExtreemVertex (object,pos,highorlow):
  56. obj=object.ToMesh()
  57. verticescount=obj.CountMeshVertices()
  58. vertices=obj.MeshVertices ()
  60. if highorlow=='high':
  61. high=vertices[0][pos]
  63. for i in range(0,verticescount):
  64. vertex=vertices[i]
  65. if vertex [pos]>high:
  66. high=vertex[pos]
  67. return high
  68. elif highorlow=='low':
  69. low=vertices[0][pos]
  71. for i in range(0,verticescount):
  72. vertex=vertices[i]
  73. if vertex [pos]valmax and highorlow=='high':
  74. valmax=val
  75. elif val=objrecordnumber:
  76. currentobjnumber=objrecordnumber-2
  78. if currentobjnumber<0:
  79. currentobjnumber=0
  81. obj=objectlist[currentobjnumber]
  82. position=pyObj.Position()
  83. rotation=pyObj.GetRotationAngles ()
  84. scale=pyObj.GetScale()
  86. x=biggestextremity[0]-extreem[currentobjnumber][0]+position[0]
  87. y=biggestextremity[1]-extreem[currentobjnumber][1]+position[1]
  88. z=biggestextremity[2]-extreem[currentobjnumber][2]+position[2]
  90. if flipyz==1:
  91. rot=270
  92. else:
  93. rot=0
  95. obj.SetPosition(x,y,z)
  96. obj.SetRotationAngles (rotation[0]+rot,rotation[1],rotation[2])
  97. obj.ResizeAxis(scale[0],scale[1],scale[2])
  99. if drop=='1':
  100. pyObj.Move(0,0,1000)
  101. DeselectAll()
  102. Select(obj)
  103. Drop()
  104. pyObj.Move(0,0,-1000)
  106. #----------------------------------------------
  107. # Internal Variables Set Up: Don't alter these
  108. #----------------------------------------------
  110. x=0
  111. objnumber=1
  112. obj=[]
  113. objectlist=[]
  114. extension='obj'
  115. framegap=1
  116. extreem=[]
  117. biggestextremity=[0,0,0]
  118. objrecordnumber=1
  120. #---------------------------------------------------
  121. # Get User Input
  122. #---------------------------------------------------
  124. typeofimport=Prompt('Type of Sequence to Import. \n1: Numbered files \n2: RealFlow3 \n3: RealFlow4\n4: Xfrog','1',true,'Type of Import')
  126. if typeofimport=='2':
  127. extension='obj'
  128. filetype=1
  129. flipyz=2
  130. elif typeofimport=='3':
  131. extension='obj'
  132. filetype=2
  133. flipyz=2
  134. elif typeofimport=='4':
  135. extension=Prompt('File extension on files \nmaking up sequence','obj',true,'File Extension')
  136. filestart=Prompt('File name prefix on files \nmaking up sequence','',true,'File Prefix')
  137. filetype=3
  138. flipyz=1
  139. else:
  140. extension=Prompt('File extension on files \nmaking up sequence','obj',true,'File Extension')
  141. flipyz=Prompt('Switch Y and Z axis \n 1: Yes \n2: No','2',true,'')
  142. filetype=0
  144. import_type=Prompt('Import whole sequence?\n 1: Yes \n2: No','1',true,'')
  146. if import_type=='2':
  147. objnumber=Prompt('First frame object number?','1',true,'')
  148. objnumber=int(objnumber)
  149. maxobjnumber=Prompt('Last frame object number?','10',true,'')
  150. maxobjnumber=int(maxobjnumber)
  151. else:
  152. objnumber=1
  153. maxobjnumber=10
  155. framegapret=Prompt('Number of frames to wait between loading each object','1',true,'File Extension')
  156. framegap=int(framegapret)
  158. group=Prompt('Group Objects?\n 1: Yes \n2: No','1',true,'')
  160. drop=Prompt('Drop on import \n 1: Yes \n2: No','1',true,'')
  162. align=Prompt('Align on import \n 1: Yes \n2: No','1',true,'')
  164. if align=='1':
  165. alignx=Prompt('Alignment X \n1: Left \n2: Right','1',true,'')
  166. if alignx=='1':
  167. xalign='high'
  168. biggestextremity[0]=-10000
  169. else:
  170. xalign='low'
  171. biggestextremity[0]=10000
  173. aligny=Prompt('Alignment Y \n 1: Back \n2: Front','1',true,'')
  174. if aligny=='1':
  175. yalign='high'
  176. biggestextremity[1]=-10000
  177. else:
  178. yalign='low'
  179. biggestextremity[1]=10000
  181. alignz=Prompt('Alignment Z \n 1: Top \n2: Bottom','1',true,'')
  183. if alignz=='1':
  184. zalign='high'
  185. biggestextremity[2]=-10000
  186. else:
  187. zalign='low'
  188. biggestextremity[2]=10000
  190. if group=='1':
  191. group=1
  192. else:
  193. group=2
  195. #---------------------------------------------------
  196. # Main Script Body
  197. #---------------------------------------------------
  199. SetCurrentFrame (0)
  201. # Load objects
  203. while obj!=None and objnumber<=maxobjnumber:
  204. if filetype==1:
  205. x=3-len(str(objnumber))
  206. filename='Mesh01'+'0'*x+str(objnumber)+'.'+extension
  207. elif filetype==2:
  208. x=5-len(str(objnumber))
  209. filename='Mesh01'+'0'*x+str(objnumber)+'.'+extension
  210. elif filetype==3:
  211. x=5-len(str(objnumber))
  212. filename=filestart+'0'*x+str(objnumber)+'.'+extension
  213. else:
  214. filename=str(objnumber)+'.'+extension
  216. obj=ImportObject(filename)
  218. if obj!=None:
  219. objnumber=objnumber+1
  220. objrecordnumber=objrecordnumber+1
  222. if import_type=='1':
  223. maxobjnumber=maxobjnumber+1
  225. objectlist.append(obj)
  227. obj.SetPosition(infinity[0],infinity[1],infinity[2])
  229. if flipyz==1:
  230. obj.SetRotationAngles (270,0,0)
  232. if align=='1':
  233. extremityx=FindExtreem (obj,0,xalign)
  234. if extremityx>biggestextremity[0] and xalign=='high':
  235. biggestextremity[0]=extremityx
  236. elif extremityybiggestextremity[1] and yalign=='high':
  237. biggestextremity[1]=extremityy
  238. elif extremityybiggestextremity[2] and zalign=='high':
  239. biggestextremity[2]=extremityz
  240. elif extremityz0:
  241. pyObj=AddPythonObject((-5,-5,-5),(5,5,5),true)
  242. pyObj.SetPosition(0,0,0)
  243. pyObj.SetInitFrameCallback(FlickBookCallback)
  244. pyObj.SetName('Imported Object Target')
  245. pyObjInf=AddPythonObject((-5,-5,-5),(5,5,5),true)
  246. pyObjInf.SetPosition(infinity[0],infinity[1],infinity[2])
  247. pyObjInf.SetName('Imported Object Out of Shot')
  249. # Group imported objects
  251. if group==1:
  252. DeselectAll()
  253. for i in range(0,(objrecordnumber-1)):
  254. Select(objectlist[i])
  255. Group()
  256. DeselectAll()
  258. Message("Objects Imported","Success")
  259. else:
  260. Message("No Objects Imported","Failure")

I’d like to thank e-on software, greenworks and Roderick Davies for their help in developing and testing this script.

impworks © Copyright Mark Caldwell 1996 - 2022