Isotropix Forums

Using import_geometries parameter 'import_mats_mode'

Clarisse Scripting related topics

Using import_geometries parameter 'import_mats_mode'

Unread postby atnreg » Mon Mar 27, 2017 6:33 pm

Hi!

I have working code that imports geometries using ix.import_geometries().
But I would like to prevent Clarisse from asking if I want to load materials.

The SDK says there is flag for that but I cannot get it to work, Clarisse crashes every time :o

Some of my trials were:
ix.import_geometries(files,import_mats_mode=-1)
ix.import_geometries(files,-1)
ix.import_geometries(files,int(-1))
and even
mats=-1
ix.import_geometries(files,mats)
ix.import_geometries(files,import_mats_mode=mats)

It works fine as this (but of course asks):
ix.import_geometries(files)

So the problem is not in files array.

Please could you give simple example call to that function so that Clarisse will not ask for materials and does not crash :)

Thank you!

Antti
Intel i7(6-core),32GB RAM,NVIDIA GTX690 (2GPU)+GTX Titan Black,Win10Pro 64bit
Clarisse 3.5SP2,Blender,ZBrush,Onyx,(3D-Coat,Lightwave+Octane...)
Clarisse since 2016-09-29 (Py 2017-01-04), Python since 2016-11-10
I do all 3D stuff for fun, no business
atnreg
 
Posts: 254
Joined: Mon Sep 19, 2016 5:20 pm
Location: Helsinki, Finland

Re: Using import_geometries parameter 'import_mats_mode'

Unread postby bvaldes » Tue Mar 28, 2017 10:37 am

Hi,

To begin with, there is nowhere inside the doc a function "ix.import_geometries()" with 2 or more arguments. All the functions ix.something() are helpers written directly in python (unlike others functions which are wrapped from C++).
You maybe have found a function like this: "IOHelpers::import_geometries(...)". This is an example to achieve what you want:

python code

title = "Import Geometry Files..."
filter = "Known Files\t*.{lwo,obj}\nLightWave Object Files\t*.lwo\nWavefront Object Files\t*.obj"
filenames = ix.api.GuiWidget.open_files(ix.application, ix.application.get_current_project_filename(), title, filter)
objects = ix.api.OfObjectVector() # Contain the imported items
ix.api.IOHelpers.import_geometries(ix.application, filenames, objects, -1) # -1 is for no import materials

Hope this help, regards.
Benoit VALDES
Isotropix
Clarisse QA
User avatar
bvaldes
 
Posts: 141
Joined: Mon Sep 26, 2016 11:44 am

Re: Using import_geometries parameter 'import_mats_mode'

Unread postby atnreg » Tue Mar 28, 2017 2:53 pm

Hi!

Thank you VERY much, I have tried that one too but obviously with wrong parameters because it gave Python errors immediately. I am a bit confused in SDK which refer to ix.xxx and which ix.api.IOHelpers, it should be obvious but for me it does not seem to be :D
Well, life is learning ;)

Again, thank you VERY much, now my script works without asking 'stupid' questions!

Antti
Intel i7(6-core),32GB RAM,NVIDIA GTX690 (2GPU)+GTX Titan Black,Win10Pro 64bit
Clarisse 3.5SP2,Blender,ZBrush,Onyx,(3D-Coat,Lightwave+Octane...)
Clarisse since 2016-09-29 (Py 2017-01-04), Python since 2016-11-10
I do all 3D stuff for fun, no business
atnreg
 
Posts: 254
Joined: Mon Sep 19, 2016 5:20 pm
Location: Helsinki, Finland


Return to Scripting