soupday / cc_blender_tools

Add-on for Blender, for importing and auto-setup of character creator 3 & 4 and iClone 7 & 8 character exports into Blender.
GNU General Public License v3.0
446 stars 80 forks source link

Issue about import obj #5

Closed highway007 closed 3 years ago

highway007 commented 3 years ago

Thanks for your great work! When I run "bpy.ops.cc3.importer(param="IMPORT_QUALITY")" in python script, blender crash.(It is fine by click on UI:"import Character") here are the error message: Info: Importing Character, please wait for import to finish and materials to build... Error : EXCEPTION_ACCESS_VIOLATION Address : 0x00007FFB08DB6945 Module : python37.dll Thread : 000006c4 Writing: C:\Users\admin\AppData\Local\Temp\imp_render_model.crash.txt blender 2.91.0 Can you tell me the way to import model through the addon with python script? thx a lot!

soupday commented 3 years ago

The import sequence is done modally so it doesn't entirely lock up the interface for the whole duration, but it only works through the INVOKE_DEFAULT context. so calling: bpy.ops.cc3.importer("INVOKE_DEFAULT", param="IMPORT_QUALITY"), will call the operator and bring up the file selection window.

I always meant to get this working from code, but never quite got round to it.

If you want to supply the filepath directly, I've just put some code into the main branch that checks if the operator was invoked or not and if not it will run the import sequence non modally, and so that will require a filepath: bpy.ops.cc3.importer(param="IMPORT_QUALITY", filepath="path\to\file.fbx")

highway007 commented 3 years ago

The import sequence is done modally so it doesn't entirely lock up the interface for the whole duration, but it only works through the INVOKE_DEFAULT context. so calling: bpy.ops.cc3.importer("INVOKE_DEFAULT", param="IMPORT_QUALITY"), will call the operator and bring up the file selection window.

I always meant to get this working from code, but never quite got round to it.

If you want to supply the filepath directly, I've just put some code into the main branch that checks if the operator was invoked or not and if not it will run the import sequence non modally, and so that will require a filepath: bpy.ops.cc3.importer(param="IMPORT_QUALITY", filepath="path\to\file.fbx")

It works ! Thx for your patient answer. :D