Isotropix Forums

Help with python imports needed :)

Clarisse Scripting related topics

Re: Help with python imports needed :)

Unread postby bvaldes » Mon May 13, 2019 8:48 am

Hi,

About VSCode extention, this is true, that not working. I will take a look at home when I have time.

About the import ix_helper working in Clarisse, this is normal that it doesn't work in Clarisse. The goal of this package it allow you to use Clarisse stuff outside of Clarisse. If you take a look to the content of ix_helper.py the ix.api is injected inside of this python file.
Inside of Clarisse you have to use the standard ix module that is already loaded.

Regards
Benoit VALDES
Isotropix
Clarisse QA
User avatar
bvaldes
 
Posts: 384
Joined: Mon Sep 26, 2016 10:44 am

Re: Help with python imports needed :)

Unread postby atnreg » Tue May 14, 2019 8:27 am

bvaldes wrote:About VSCode extention, this is true, that not working. I will take a look at home when I have time.

Ok, I'll look forward to it :)

About the import ix_helper working in Clarisse, this is normal that it doesn't work in Clarisse. The goal of this package it allow you to use Clarisse stuff outside of Clarisse. If you take a look to the content of ix_helper.py the ix.api is injected inside of this python file.
Inside of Clarisse you have to use the standard ix module that is already loaded.

Hmm..then it is not useful as of course the code I write in VSCode must work inside Clarisse :D
Is there any import combination that gives the linter ok result and still works in Clarisse?
You said you use VSCode for Clarisse code as well, so you don't use linting then? :o

Antti
Antti
AMD Ryzen Threadripper 2990wx (32c/64t),64GB RAM,NVIDIA GTX 1080ti,Win10
Clarisse 4.0SP3,Blender2.80,Fusion360,ZBrush,Onyx,Houdini,SubstPnt...
Started: Clarisse 2016/10 (Py 2017/01), Python 2016/11
No business, just fun :)
atnreg
 
Posts: 508
Joined: Mon Sep 19, 2016 4:20 pm
Location: Helsinki, Finland

Re: Help with python imports needed :)

Unread postby bvaldes » Wed May 15, 2019 8:17 am

Hi,

To make a generic import that work both in VSCode and in Clarisse you can do something like that:

python code

import sys
if not "ix" in sys.modules:
import ix_helper
ix = ix_helper.ix


About VSCode and the auto-completion, I don't use it for Clarisse. Most of time the functions are not written in python so the arguments are *args that is not really helpful. So the only thing that can auto-completion do is to purpose you a function but you don't know how to use it because there is no doc neither arguments. Most of time I am searching in the documentation and I am using the Clarisse auto-completion to look for a function and get what is needed in the documentation. VSCode is my default IDE so I write code faster with it than with Clarisse's one, even without completion.

Keep in mind that you are using a module that is not really supposed to be standalone so the linter won't help you that much except to fix wrong variable/functions name. I agree with you that could be very nice if VSCode would have complete intellisense for Clarisse but it's not even possible for Clarisse right now so it will be more difficult to have it for VSCode.

I hope this will help you.

Beat regards
Benoit VALDES
Isotropix
Clarisse QA
User avatar
bvaldes
 
Posts: 384
Joined: Mon Sep 26, 2016 10:44 am

Re: Help with python imports needed :)

Unread postby atnreg » Thu May 16, 2019 2:48 pm

Thank you, that solves all other linter errors except ix.api is still not found :?
Where the api is actually defined and how it is made to be ix.api? :o
Antti
AMD Ryzen Threadripper 2990wx (32c/64t),64GB RAM,NVIDIA GTX 1080ti,Win10
Clarisse 4.0SP3,Blender2.80,Fusion360,ZBrush,Onyx,Houdini,SubstPnt...
Started: Clarisse 2016/10 (Py 2017/01), Python 2016/11
No business, just fun :)
atnreg
 
Posts: 508
Joined: Mon Sep 19, 2016 4:20 pm
Location: Helsinki, Finland

Re: Help with python imports needed :)

Unread postby bvaldes » Fri May 17, 2019 8:12 am

Hi,

It's defined in the ix_helper module. But with a weird way to do that the linter doesn't understand. You can if you want create your own ix_helper module to fix the issue.

Regards
Benoit VALDES
Isotropix
Clarisse QA
User avatar
bvaldes
 
Posts: 384
Joined: Mon Sep 26, 2016 10:44 am

Previous

Return to Scripting