josich Posted November 23, 2019 Share Posted November 23, 2019 (edited) Hi, In my path of learn python I did this simple tool which creates a HDA to select and assing a matcap to one object. Basically opens a folder selector interface and creates a matcap material (from game dev tools) . The material is assigned to the selected objects and generates an slider where you can choose one of the textures stored in the folder. The max value of the slider is adjusted relative to the number of textures existing in the folder. It's pretty simple tool but I struggled a bit how to approach the best solution and how to store global variables and retrieve it from other part of the code. I don't know if this is the best way to do this, probably there are other solutions more direct and clever, but it has been a good learning exercice. Would be nice if you can test it and give me any advice. The download link is in the description of the youtube video. Thanks, O. Edited November 23, 2019 by josich 1 Quote Link to comment Share on other sites More sharing options...
Librarian Posted November 23, 2019 Share Posted November 23, 2019 Thanx Oscar Quote Link to comment Share on other sites More sharing options...
flcc Posted November 29, 2019 Share Posted November 29, 2019 (edited) Hi josich Trying to try you nice asset, I get this : Traceback (most recent call last): File "opdef:/Object/oscar_matcap_matt?OnCreated", line 3, in <module> ImportError: No module named oscarscr The python file is in the python2.7Libs folder I tried to put it in a "oscarscr" folder but no way. Thanks anyway Edited November 30, 2019 by flcc 1 Quote Link to comment Share on other sites More sharing options...
josich Posted December 4, 2019 Author Share Posted December 4, 2019 (edited) On 29/11/2019 at 1:02 AM, flcc said: Hi josich Trying to try you nice asset, I get this : Traceback (most recent call last): File "opdef:/Object/oscar_matcap_matt?OnCreated", line 3, in <module> ImportError: No module named oscarscr The python file is in the python2.7Libs folder I tried to put it in a "oscarscr" folder but no way. Thanks anyway Hey sorry for the late response. My fault, you can fix it easily: 1- Right click on Matcap (Geo Context) node, and click on Type propeties... 2- At Script tab, select OnCreated module ( left side) 3- At right side you will see the script of this module. Change line 3 : "From oscarscr import matcap_selector as mcs" For this: "import matcap_selector as mcs" ( if you pasted the python script in the python2.7Libs folder) 4- Accept ( Unlock and Save) Other important consideration is to have installed game dev tools ( the script use a shader of this add on) . Im not sure if in Houdini18 is called sideFxLabs In my case I have created a folder for my scripts called "oscarscr" and I missed to change that. You can create one with this structure if you want: In this path ( is not the only place you can do this, but to simplify..): C:\Users\YourUserName\Documentos\houdini17.5 Create this two folders: C:\Users\YourUserName\Documents\houdini17.5\scripts\python and inside create a blank .py file called "__init__" Now Houdini will watch inide this folder for python scripts. In my case I had a folder called oscarscr there. Let me know if you keep having problems. Regards, Oscar Edited December 4, 2019 by josich 1 Quote Link to comment Share on other sites More sharing options...
flcc Posted December 4, 2019 Share Posted December 4, 2019 Yes it works now Vers handy. However, it seems the script, does not support spaces in the path of the texture folder. At first I get this message : Traceback (most recent call last): File "opdef:/Object/oscar_matcap_matt?OnCreated", line 10, in <module> WindowsError: (3, 'Le chemin d\x92acc\xe8s sp\xe9cifi\xe9 est introuvable', 'D:/Projets_2019/0 CommonMaps/Matcap_Textures/Matcap_Textures\\*.*') the space in "0 CommonMaps" was the culprit. 8 hours ago, josich said: In my case I have created a folder for my scripts called "oscarscr" and I missed to change that. You can create one with this structure if you want: In this path ( is not the only place you can do this, but to simplify..): C:\Users\YourUserName\Documentos\houdini17.5 Create this two folders: C:\Users\YourUserName\Documents\houdini17.5\scripts\python and inside create a blank .py file called "__init__" Now Houdini will watch inide this folder for python scripts. In my case I had a folder called oscarscr there. Let me know if you keep having problems. Good to know Thanks again 1 Quote Link to comment Share on other sites More sharing options...
josich Posted December 5, 2019 Author Share Posted December 5, 2019 (edited) Thanks @flcc for taking your time and test the script. At this moment I'm not at home, but I will fix all these problems and upload the script again. Please let me know if you find any other issue. Regards Oscar P.D: I fixed the problem and should be simplier to install the script. Thanks @flcc for the feedback. Edited December 10, 2019 by josich Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.