TD Python Tutorial?

Links and discussions concerning tutorials
Post Reply
Falam

TD Python Tutorial?

Post by Falam » 23 Jul 2013, 15:51

For anyone who bought this tutorial, did you have some prior programming knowledge and did that knowledge include finding your way around the SDK ?

Moderator edit: moved the thread and added a question mark to its title - HB

User avatar
csaez
Posts: 253
Joined: 09 Jul 2012, 15:31
Skype: csaezmargotta
Location: Sydney, Australia
Contact:

Re: TD Python Tutorial?

Post by csaez » 23 Jul 2013, 20:59

Hi Falam,
I've seen some of your question on the programming forum and I would recommend taking an introduction course about some programming language before Raff's course (codeacademy.com offers some free courses on python and javascript), once you understand the basics of the language (builtin types, control flow, loops, functions) will be much easier dig into the details of the SDK.

Cheers!

Falam

Re: TD Python Tutorial?

Post by Falam » 26 Jul 2013, 01:05

You say it will be easier, I am studying JS, the syntax etc. That still doesn't help when create a function to search the scene for objects with point cluster of a specific name, specific being a name such as "eye" or "ear".

That is exactly what I meant by search model for a specific node. Search all the objects, materials, that are within a model for a specific shader node, then tell me of those objects materials including the specific shader node, which are contained to the material (render tree branch), and which are unconnected sitting in the render tree window.

This can be very useful in production, when you are working you may have applied a shader node, or a ICE Tree node, you realize, you need to apply this shader node or ICE tree node to all your objects, well you would need another script to apply a specific ICE Tree node to all the objects. When it comes to Shader nodes, the solution is simple. Find a specific shader node that is connected to the object and which objects the shader node is unconnected in a model, or maybe they are not in a model, either way. Then with the help of MMShaderTools apply the shader node you want to all those objects. I haven't saved time getting a working script that can compliment MMShader Tools, I lack the SDK knowledge and I'm still weak in programming. I hope someone can understand besides learning how loops and functions work which are crucial part to program, once learned, it can leave someone like me confused when reading the SDK.

User avatar
csaez
Posts: 253
Joined: 09 Jul 2012, 15:31
Skype: csaezmargotta
Location: Sydney, Australia
Contact:

Re: TD Python Tutorial?

Post by csaez » 26 Jul 2013, 03:13

Well, the only way to learn the sdk is reading the docs...

Let's try the first one :)
Falam wrote:... create a function to search the scene for objects with point cluster of a specific name, specific being a name such as "eye" or "ear".
How to find objects?
- Finding 3d objects

Nice, but all of the suggested methods return a collection... what's a collection?
- XSICollection

Cool, I know how to get a collection of point clusters... but I need their owners, what about that?
- SubComponent.Parent3DObject

Let's code this thing!

Code: Select all

function GetPntClsOwners(name){
    var owners = new ActiveXObject("XSI.Collection");
    owners.Unique = true;
    var clusters = Application.FindObjects2(siClusterID).Filter("pnt");
    for(var i=0; i<clusters.Count; i++){
        var cls = clusters(i);
        if(name == cls.Name){
            owners.Add(cls.Parent3DObject);
        }
    }
    return owners
}

Application.LogMessage(GetPntClsOwners("ear"))
Does that make any sense?

User avatar
xsisupport
Posts: 713
Joined: 09 Jun 2009, 11:02
Location: Montreal Canada
Contact:

Re: TD Python Tutorial?

Post by xsisupport » 26 Jul 2013, 16:29

The other only way to learn the SDK is to do stuff with it.

Here's a bunch of posts about finding stuff with the XSI SDK.
// Steve Blair
// "You're not a runner, you're just a guy who runs" -- my wife
//
// My Blogs: Arnold | Softimage

luceric
Posts: 1251
Joined: 22 Jun 2009, 00:08

Re: TD Python Tutorial?

Post by luceric » 26 Jul 2013, 18:25

hello here are my thoughts on this, althought I am working 100% of the time with the Maya SDK (mostly in Python) and not XSI's.

I think you should not spend another minute of your time with Jscript, just go to python. There are both weird, but you'll get more help (ex: stack exchange) and documentation with Python. Any trick you learn with Jscript in XSI will be of no use to you anywhere else, it's just a waste of time.

I have not seen Raffaele's tutorial (strike two against my opinions having any validity, I guess) but I think you could just go ahead and buy it if programming in XSI is what you want to do and you have the cash. Who cares if it take a year to understand it all.

You don't have the programming basics right now but Python is something you pick up while using it and while looking at working code. You can't really learn a language on its own, it's not going to sink in. I assume Raffaele's tutorial will show plenty of example of working code you can then copy and practice with.

It'll take probably.. a few months to get comfortable with python. But it's not language you need to know fully to do stuff with it. You just need to know control flow and python lists to get started.
Raffael's course does include an introduction to Python

If you're not actually going to program seriously later, it might not be worth it to learn all this stuff. Think about whether you want to use the software, or program it. Life is too short to write code if you don't love it. The way the XSI SDK works is a bizarre mix of COM legacy, wrappers for that, and other ideas, which is why one ends up copying samples from a blogs. A lot of that is learning XSI's quirks and not something that's applicable to programming in general.

Falam

Re: TD Python Tutorial?

Post by Falam » 28 Jul 2013, 06:31

lueric - I do have plans to program stuff to help improve my workflow, who knows maybe even spend half of my time programming. I want to know if anyone has had little programming experience, bought Raffs tutorial and at-least a quarter of the way though the tutorial was able to script some tools for Softimage, or grasp any other software SDK ?

csaez - Your example was helpful, although I really, really want to see the "find specific shader in model" script in Jscript, complete, then I should be able to take things from that point, ahead (plus I have a deadline). There has been a script posted thanks to someone on the forum, it wasn't exactly there, but close :). My last post explained more in detail, I would be extremely grateful.

Code: Select all

You don't have the programming basics right now but Python is something you pick up while using it and while looking at working code. You can't really learn a language on its own, it's not going to sink in. I assume Raffaele's tutorial will show plenty of example of working code you can then copy and practice with.
What do you mean, you can't learn a language on your own ? Do you mean completely, solo ? If so this is true, it can be hard. I look towards the forums for help, until things start to flow more naturally :) I don't mind the JScript syntax, I'm not good at it, slowly when I spend the time understanding. Does the Softimage have DOM system hierarchy ?
If you're not actually going to program seriously later, it might not be worth it to learn all this stuff. Think about whether you want to use the software, or program it. Life is too short to write code if you don't love it. The way the XSI SDK works is a bizarre mix of COM legacy, wrappers for that, and other ideas, which is why one ends up copying samples from a blogs. A lot of that is learning XSI's quirks and not something that's applicable to programming in general.
Could you elaborate what you mean by the statements in bold ? :)

User avatar
Hirazi Blue
Administrator
Posts: 5107
Joined: 04 Jun 2009, 12:15

Re: TD Python Tutorial?

Post by Hirazi Blue » 28 Jul 2013, 12:35

luceric wrote:If you're not actually going to program seriously later, it might not be worth it to learn all this stuff. Think about whether you want to use the software, or program it. Life is too short to write code if you don't love it.
luceric makes some valid points in his last post.
I do however think, that coding is one of these things,
you'll never love (or learn to love),
unless you actually try it.
Coding gets such "bad press" "lately".

It's sometimes tough to learn, but it beats being creative... =))
Stay safe, sane & healthy!

luceric
Posts: 1251
Joined: 22 Jun 2009, 00:08

Re: TD Python Tutorial?

Post by luceric » 28 Jul 2013, 12:58

"learn a language on its own" means sitting down and learning the language itself, for example by reading the manuals, as opposed to learn a language while trying to do something meaningful. if you don't need right now what you're reading, it doesn't sink in.

xsi doesnt have DOM. the only why you're asking this question is because the whole internet is using javascript to program web pages in a web browser and nothing they talk about applies to using jscript in xsi, which obviously isnt a web browser. on the other hand, the python library is the same everywhere.

Falam

Re: TD Python Tutorial?

Post by Falam » 28 Jul 2013, 18:08

When I comes to creating scripts such as this script, which I desperately need; asking once or twice the community for help, may be fine, but if it happens to frequently, people will abandon your requests, and simply label you. I may not be a avid coder, it may come in handy that is why I'm leaning JScript, and which is why I'm asking the question about learning the SDK. Sometimes you can't do things without a script, which is one component of doing 3D work, along with everything else :)

Quote from earlier post
That is exactly what I meant by search model for a specific node. Search all the objects, materials, that are within a model for a specific shader node, then tell me of those objects materials including the specific shader node, which are contained to the material (render tree branch), and which are unconnected sitting in the render tree window.

Falam

Re: TD Python Tutorial?

Post by Falam » 30 Jul 2013, 01:28

csaez seems to point out there is an order to the SDK, is this set in stone, it would be helpful ?

User avatar
myara
Posts: 403
Joined: 28 Sep 2011, 10:33

Re: TD Python Tutorial?

Post by myara » 30 Jul 2013, 13:53

I haven't bought Raffaele's Tutorial but I'm very interested.

This is my comparison about the 3 scripting languages.

Python
Is "the" scripting language to learn now. There are a lot of packages using Python so you could adapt your code to another software like Maya if you have to.
Photoshop and AE doesn't support it by default, but you can still workaround that.
It's probably the slowest when dealing with loops but you can optimize your code if you know your stuff.
The code is cleaner and faster to write when you are familiar with the language.
The error messages aren't very helpful. You'll only have red letters in your Script Editor that says "invalid syntax" or "unexpected EOF". VBS and JS are more friendly in this aspect.

I would pick this one. In fact I'm writing in Python when I can, but I'm still using JScript when I have to deal with complex stuff only because I'm more familiar with JS.

JScript
It was "the" scripting language to learn in SI some years ago. If you pick this one you'll probably have more samples and info about it. You may learn faster JS because of that, and like I was saying, the error messages are more helpful, a little more newbie friendly.
Good Python stuff may be a little more difficult to find, but the "library" out there is growing pretty fast.
Maya's mel is a little similar so you may be able to do some things in mel if you have to. It will still be painful.
It may help you if you do web stuff too.
I think the process is faster than Python, but Python may be faster to write due to it's syntax.
Helge Mathee did a video tutorial based on JS, I don't know if you can still buy it.

VBS
I wouldn't recommend it, but it may be the easiest to do simple things. I think it could be OK if you plan to stick with very simple things and want fast results.
When you try to write more complex stuff, it will be difficult to keep things in order.
The fastest when you have to deal with weights or things like that.
I use it sometimes when I have to deal with weights, vertex colors.
And also use it for Windows scripts (scripts to deal with files and directories and run from Windows Explorer) because it has an InputBox and MsgBox built in.
M.Yara
Character Modeler | Softimage Generalist (sort of)

Falam

Re: TD Python Tutorial?

Post by Falam » 30 Jul 2013, 16:02

myara wrote:I haven't bought Raffaele's Tutorial but I'm very interested.

This is my comparison about the 3 scripting languages.

Python
Is "the" scripting language to learn now. There are a lot of packages using Python so you could adapt your code to another software like Maya if you have to.
Photoshop and AE doesn't support it by default, but you can still workaround that.
It's probably the slowest when dealing with loops but you can optimize your code if you know your stuff.
The code is cleaner and faster to write when you are familiar with the language.
The error messages aren't very helpful. You'll only have red letters in your Script Editor that says "invalid syntax" or "unexpected EOF". VBS and JS are more friendly in this aspect.

I would pick this one. In fact I'm writing in Python when I can, but I'm still using JScript when I have to deal with complex stuff only because I'm more familiar with JS.

JScript
It was "the" scripting language to learn in SI some years ago. If you pick this one you'll probably have more samples and info about it. You may learn faster JS because of that, and like I was saying, the error messages are more helpful, a little more newbie friendly.
Good Python stuff may be a little more difficult to find, but the "library" out there is growing pretty fast.
Maya's mel is a little similar so you may be able to do some things in mel if you have to. It will still be painful.
It may help you if you do web stuff too.
I think the process is faster than Python, but Python may be faster to write due to it's syntax.
Helge Mathee did a video tutorial based on JS, I don't know if you can still buy it.

VBS
I wouldn't recommend it, but it may be the easiest to do simple things. I think it could be OK if you plan to stick with very simple things and want fast results.
When you try to write more complex stuff, it will be difficult to keep things in order.
The fastest when you have to deal with weights or things like that.
I use it sometimes when I have to deal with weights, vertex colors.
And also use it for Windows scripts (scripts to deal with files and directories and run from Windows Explorer) because it has an InputBox and MsgBox built in.
Heldge Mathee has moved to Python. I'd love to see his older JS tutorial, especially if he shows how to move around in the SDK, if he doesn't, I'd wouldn't mind seeing it. Your explanation was clear and helpful, what I took from it was, JS and Python are still both valid languages to learn and can be helpful in many situations Thank You

User avatar
Hirazi Blue
Administrator
Posts: 5107
Joined: 04 Jun 2009, 12:15

Re: TD Python Tutorial?

Post by Hirazi Blue » 30 Jul 2013, 20:12

To which I want to add: make sure you only try to learn one scripting language. It doesn't really matter much which one you choose. Trying to learn more than one a a time would be extremely counterproductive and terribly confusing...
Stay safe, sane & healthy!

Post Reply

Who is online

Users browsing this forum: No registered users and 22 guests