Friday, 27 October 2023

Python debug tip

 Want to know a secret?

"*"*100 takes me about 1 second to type.

Why not wrap it in a print?

 

print("*"*100)

print("var_a:", var_a) 

print("var_b:", var_b) 

print("var_c:", var_c)  

Result:

//****************************************************************************************************

// var_a: pineapple

// var_b: 64

// var_c: <__main__.Dog object at 0x00000248A53D7748> # 

//************************************************************************************************

 

Isn't that easier to read?

How to change all paths in Houdini scene file

The Problem:

I need to change all paths in a Houdini scene file due to a drive change - oh no! All my nodes are invalid, my scene is broken and everything is on fire. Or is it? No its not, i'll tell you why:

The Fix:

 1.) Windows > Hscript Textport

 

2.) Type opchange YOUROLDLOCATION YOURNEWLOCATION

(press enter)













And there you go, all nodes referencing YOUROLDLOCATION will have search'n'replaced it with YOURNEWLOCATION. Magic. Everything fixed. :)


Monday, 23 October 2023

How to install numpy for Maya

I needed to install numpy for Maya the other day because its a dependancy of a package that I use.
But how? How do you install numpy for Maya?

Like this:
1.) Press windows, type in cmd and press enter
2.) type in: cd C:\Program Files\Autodesk\Maya20??\bin
3.) type in: mayapy -m pip install numpy

Obviously, replace the ?? in your Maya install directory with your version number.
And there you go - numpy installed! :)