Hello guys,
Made two simple beginner tutorials on how to use Python with XSI.
I hope you like it, comments are welcome.
regards
stefan andersson
Hello guys,
Made two simple beginner tutorials on how to use Python with XSI.
I hope you like it, comments are welcome.
regards
stefan andersson
one note Stefan:
You use Hungarian notation for your variables (as I often do myself, heritage of old C days) which means your variable names are usually prefixed by the type expected.
In that case using something like oObj for a single object in a selection is fine, the o should stand for (com)Object. When you name a string oSomething though it gets confusing.
intVar for integers, strVar for strings, collVar for collections and so on is usually the correct way to type-annotate variable names.
If you store an object’s name in a string and call it oMyobject somebody down the line is gonna go bunters when he tries to query that return like if it was the object and not its name in a string.
Good job on everything else 
ok… you are the man… 
I’ll try and be better at how I name my variables.
stefan slaps himself on the fingers
thanks
stefan
I find it annoying sometimes that XSI supports so many languages, it’s harder to find documentation in the language you’re using, and things can get confusing… Pyhton support is great though, I just wish it was the default instead of VB.
That’s Systems Hungarian. There’s also Apps Hungarian, where you’d use, for example, urlHome instead of strUrl (everybody knows an URL is a string anyway). Likewise you’d use e.g. rowID, colID, indexMainLoop (all integers but you don’t necessarily want to mix them) etc.
Joel Spolsky wrote an entertaining article: http://www.joelonsoftware.com/articles/Wrong.html
I would probably shoot myself in the foot with a large caliber sooner than I’d use systems hungarian, or use the full extent of the notation to things like function by return, type from type etc, especially so in scripting.
The original notation the way it was explained in the early VS manuals and then in the MFC docs, for variables only, still applies decently enough to a non strongly typed language with an SDK like XSI’s though (or at least I find it so).
There are few enough and univocal enough types, that you can notate it without risking odd discrepancies, and a lot of the critiques moved against it are usually tied strongly to C++ and modern compilers, and molding system hungarian into fictitiously typing python isn’t necessarily a terrible thing.
There’s also the fact, often forgotten by the haters, that hungarian notation isn’t compulsory all throughout the code, and a more personal (or lack of) notation is perfectly fine to support object orientation and polymorphism and doesn’t preclude the use of sys hungarian for the more granular and static elements.
Thanks for the article link though, had read it a while ago and forgot it existed, it’s still a nice read.
ok, part III (dictionarys)
http://sanders3d.blogspot.com/
Thanks for the explanation of Hungarian notation, I will try and be better at what I type from now on 
regards
stefan
You mean you’d sooner shoot yourself than use Apps Hungarian? That’s the one that advocates AFromB, etc.
I wouldn’t take it to the extreme but I think some the principles of Apps Hungarian can be useful when scripting for XSI, for example, prefixes like gxfo and lxfo to distinguish between global and local transforms. In contrast things like oVar in Systems Hungarian aren’t very useful; knowing that something is an object doesn’t really tell you very much.
Anyway, I can appreciate the irony of a Microsoft convention like Hungarian notation being used in Python on Linux.
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.