Posts tonen met het label scripting. Alle posts tonen
Posts tonen met het label scripting. Alle posts tonen

zondag 29 september 2013

Python : Save and Load Dictionaries with json

Dictionaries are a very useful element in python to manage your data.
I often save and load dictionaries to a file to use as save and load systems in my tools.

The example underneath shows how to save a dictionary to a text file with json.dumps() and loading it back in using json.load()

Save a dictionary to a file

import json
dict = {"hello" : "dictionary", "this" : "is", "awesome" : {"sub" : "collection"}}
dictString= json.dumps(dict, sort_keys=False ,ensure_ascii=True ,indent=2)
fs = open("c:/dict.txt","w")
fs.write(dictString)
fs.close()


Loads a dictionary from a file

import json
fs = open("c:/dict.txt")
dict = json.load(fs)
fs.close()
print dict

zaterdag 20 juli 2013

Python : Improving your print()

the print() function is a function that is the used the most during programming. It sends a piece of string to the console so we can get some feedback.

Of course on the way we are adding a lot of print() to debug, to print data and even to print error messages.

messages
Using print to share messages can be handy for developers. But it is totaly not for artists. Artist will most of the time not look to consoles and just say that the tool is broken and don't look further. For artist you will have to embed the messaging more inside the tool or using messageboxes.

variables print("assetsToBuild=%s" % assetsToBuild)
when printing data of integers, arrays to see if the content is correct of the container it can get confusing which variable is which, especially if you have other prints coming in from other modules.

For me I found a solution that gives a clear overview of what is happening in my code which is the following:

assetsToBuild = ["harry","mario","box"]
print("assetsToBuild=%s" % assetsToBuild)
output : assetsToBuild = ["harry","mario","box"]

this will give much more meaning to the print. The label is the same as the variable.
This makes debugging easier and is a great motivation to choose good variable names.

Conclusion
When placing data in the console try to respect a good structure. This will help you so much in visualising what code is doing. Motivates your variable names. And this way you will have to do less time in cleaning up your output prints.

donderdag 11 juli 2013

External Maxscript IDE

External Maxscript IDE. A tool for developing Scripts in 3ds max and easily manipulate 3dsMax from your favorite IDE or application.

Controlling 3dsmax through commandline. I connected it to notepad++ using the 'Run...' functions, this way using control+E I could send commands to 3ds max.





woensdag 10 juli 2013

Track Maker

A fast way for creating Continuous threads, (for example tanks, escalators,..) Easy To Use! Select your track Items and the spline, click on "Build track" and Ready!

Live editing and friendly-Rigged so that you can use it in expanding your vehicles/models.
Another cool thing is that you can create amazing looking complex meshes in no time with perfect control.
These quick examples are made with TrackMaker (aprox, 2min for each model)

Download : http://www.scriptspot.com/3ds-max/scripts/trackmaker







Color It !


Give your whole scene color in no time ! Perfect for first layout or color to your animation rigs.
I used 'Color It !' for giving color to the animation rigs, there were over 200 characters and props so this tool made the job much easier. Thanks to Color It I could easily color it in with colors of the reference art.

System colors everything in using multimaterial and material ID
Exporting and Saving these colors to Ini Files