0
$\begingroup$

I'm having a problem trying to import multiple models from a format that uses a custom plugin. I press a to select them all, but only the first is imported. I have well over a thousand models, how would I go about doing this? I tried the solution here: How to batch import Wavefront OBJ files?, but it only works for OBJs. How would I do this for .rip files?

The plugin I am using is located here: https://github.com/Dummiesman/RipImport

$\endgroup$
  • $\begingroup$ I don't know enough about scripting, but my blind guess is you would replace bpy.ops.import_scene.obj with watever operator i used for importing rip files, possibly bpy.ops.import_scene.rip (?) $\endgroup$ – Duarte Farrajota Ramos Apr 19 '17 at 1:27
1
$\begingroup$

You can do this by calling bpy.ops.import_scene.rip() as shown below:

import os
import bpy

path_to_rip_dir = os.path.join('C:\\', 'rips') #where C:\\rips\\ has the list of rip files

file_list = sorted(os.listdir(path_to_rip_dir))

rip_list = [item for item in file_list if item.endswith('.rip')]

for item in rip_list:
    path_to_file = os.path.join(path_to_rip_dir, item)
    bpy.ops.import_scene.rip(filepath = path_to_file)

You will need to install the addon first as mentioned in the readme file of the addon:

  • Blender 32 Bit: On 32 bit Blender installations, extract the downloaded ZIP file to C:\Program Files (x86)\Blender Foundation\Blender\2.77\scripts\addon

  • Blender 64 Bit: On 64 bit Blender installations, extract the downloaded ZIP file to C:\Program Files\Blender Foundation\Blender\2.77\scripts\addons

  • After you extract the Add-on, it will NOT show up in your
    import/export list by default!

  • After extracting the Add-on, start Blender. Once Blender is
    started, open up File->User Preferences, and navigate over to the
    Add-ons tab. Find the add-on or search "NinjaRipper", and enable it. Click "Save User Preferences" on the bottom of the dialog, and close the dialog.

  • Now you will be able to use the Add-on.
$\endgroup$
  • $\begingroup$ What do the different keywords mean? I can't seem to get this to run... $\endgroup$ – Zac Perry Apr 19 '17 at 1:45
  • $\begingroup$ @ZacPerry just remove the **keywords from the last line, try import_rip.load(self, context) instead $\endgroup$ – Tak Apr 19 '17 at 1:46
  • $\begingroup$ Still does not function, gives me 'NameError: name 'import_rip' is not defined'. Maybe you could try basing your script off the one in the addon? Its on the github page in the original post. $\endgroup$ – Zac Perry Apr 19 '17 at 1:49
  • $\begingroup$ @ZacPerry did you install the add-on? it works fine with me $\endgroup$ – Tak Apr 19 '17 at 1:55
  • $\begingroup$ The original addon? Yes. The script you pasted in, no. I used it in the text editor. Maybe try using an actual model: drive.google.com/file/d/0B0JlgUd0NeDVdmtOTGhFRGtDUXc/… $\endgroup$ – Zac Perry Apr 19 '17 at 1:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.