Starting C++?

Discussions concerning programming of SOFTIMAGE©
User avatar
Hirazi Blue
Administrator
Posts: 5113
Joined: 04 Jun 2009, 10:15

Starting C++?

Post by Hirazi Blue » 01 Aug 2012, 08:21

So once again I have decided to try and teach myself some C++ (my on-off project for the last 15 years). As I have tried before and failed miserably and now what to approach the subject purely from a practical (Softimage related) POV, I was wondering if someone had some nice pointers (pun intended) on how to approach the subject "C++ for Softimage" efficiently. What parts of the language can be easily "ignored", for instance? What parts should specifically NOT be overlooker/underestimated? Where do you start in Softimage? Are there any good introductions/tutorials into the wonderful world of Softimage specific C++ that I should be aware of? Any help, tips, suggestions and the like would be more than welcome as it seems a daunting, momentous task and even writing this almost makes me want to give up already again. Thanks in advance...
~x(
Stay safe, sane & healthy!

RomanSI
Posts: 3
Joined: 30 Jul 2012, 04:47

Re: Starting C++?

Post by RomanSI » 01 Aug 2012, 13:30

Hello!
I am not a programmer, but I think If you have never studied the C++, you need the whole basis of the C++. Even for the study of any other language, C++ is necessary in the first place as a base.

Roman,
P.S.: I also began to learn C++ :)

scaron
Posts: 119
Joined: 08 Jul 2009, 03:16

Re: Starting C++?

Post by scaron » 02 Aug 2012, 02:05

@hirazi, can you program plugins with softimage using jscript or python? how confident are you with them? if you can't do this then you are adding a lot more complexity to your learning process. otherwise here are my comments...

the softimage c++ api is quite similar to the scripting api, of course minus the language differences and the fact you are using a dynamic typing in a scripted language versus c++. there are a few convention differences with methods and properties like ".Value" in scripting and ".GetValue()" in c++. otherwise once you know softimage very well you can make a gradual transition into c++. i personally made this transition over the course of 4 or so years so dont expect any overnight success. i also want to be clear i am still a n00b when it comes to c++ but i can create c++ softimage plugins while i struggle with c++ outside of the api.

make a command in your scripting language of choice, then make a c++ version of it. keep converting, keep learning, try new plugin types etc. look at the examples in the SDK example workgroup and look at freely available code here and elsewhere. in fact i put three c++ projects on my github page (https://github.com/caron) feel free to download them and compile them from source, learn and contribute back :)

s

User avatar
Hirazi Blue
Administrator
Posts: 5113
Joined: 04 Jun 2009, 10:15

Re: Starting C++?

Post by Hirazi Blue » 02 Aug 2012, 05:53

Thanks for your reply. I would say I'm fairly confident in Python (and some other programming languages not relevant to Softimage).The basic concepts shouldn't pose too much of a problem ("famous last words"), although I always have had difficulties seeing the actual point of Object Oriented Programming, so I always tended to shy away from that. And that's something I obviously will no longer be able to do.
Like you say it won't be something to learn overnight, that is why I want to prepare myself for this task as best as possible. Your suggestion to dig into existing source code is a good one...
;)
Stay safe, sane & healthy!

User avatar
rray
Moderator
Posts: 1810
Joined: 26 Sep 2009, 13:51
Location: Bonn, Germany

Re: Starting C++?

Post by rray » 02 Aug 2012, 08:08

I've not seen a lot if any of the object oriented features used in the Softimage C++ plugins I peeked into. I'd suggest skip that part. Then again "they say" if you get into the procedural style first, it becomes more difficult to get used to the OO aspects, or rather to recognize the situations where it could be useful. But I don't think there are too many of them when writing Softimage plugins which are rather small projects usually.
softimage resources section updated Sep 26th 2026

iamVFX
Posts: 697
Joined: 24 Sep 2010, 16:28

Re: Starting C++?

Post by iamVFX » 02 Aug 2012, 15:52

Hirazi Blue wrote:I always have had difficulties seeing the actual point of Object Oriented Programming, so I always tended to shy away from that. And that's something I obviously will no longer be able to do.
Nope, you can keep ignore it. As I understood OO means use of objects and classes.

Object is just an instance of a class. Classes are often overused for no reason, because many of the programmers miss the point: they were created for object instantiations with set of parameters that specific and different from each other. It has no use in Softimage since all scripts and custom commands can be executed multiple times or can use callbacks. It make sense when you create your own API for an application so other programmers could have access to it.

And, for Softimage especially, there is no use of C++ if you wouldn't use 3rd-party libraries or tool sdk. If you do...
Hirazi Blue wrote:What parts of the language can be easily "ignored", for instance?
Arrays and raw pointers for sure. Pointers as a whole if it possible.
Hirazi Blue wrote:What parts should specifically NOT be overlooker/underestimated?
Vector, String and other standard libraries
Last edited by iamVFX on 02 Aug 2012, 18:24, edited 4 times in total.

User avatar
Daniel Brassard
Posts: 878
Joined: 18 Mar 2010, 22:38
Location: St. Thomas, Ontario

Re: Starting C++?

Post by Daniel Brassard » 02 Aug 2012, 16:10

Recommended book on C++:

http://www.stroustrup.com/Programming/
http://www.amazon.com/C-Programming-Lan ... b_title_bk

The fourth edition include the newer C++11 standard

Both from the creator of C++.
$ifndef "Softimage"
set "Softimage" "true"
$endif

iamVFX
Posts: 697
Joined: 24 Sep 2010, 16:28

Re: Starting C++?

Post by iamVFX » 02 Aug 2012, 16:19

Daniel Brassard wrote:Recommended book on C++:

http://www.stroustrup.com/Programming/
http://www.amazon.com/C-Programming-Lan ... b_title_bk

The fourth edition include the newer C++11 standard

Both from the creator of C++.
Yes! But they are large, if you just want to dive in faster I'll recommend The C++ Language Tutorial, it's free also (but little bit outdated, be sure to skip "Compound data types" chapter)

User avatar
Hirazi Blue
Administrator
Posts: 5113
Joined: 04 Jun 2009, 10:15

Re: Starting C++?

Post by Hirazi Blue » 02 Aug 2012, 17:46

Useful suggestions. Thanks guys! :-bd
Stay safe, sane & healthy!

Butachan
Posts: 23
Joined: 31 Jul 2012, 08:48

Re: Starting C++?

Post by Butachan » 03 Aug 2012, 10:06

Hi guys just wanted to say thanks for the tips for starters aswell.
I have been also wondering if it was worth it to jump into cpp or increase my skills within the scripting and now ice environment.

I must say I was really considering the idea back in v7 but as ICE developed and hence the tools to accomplish complex effects within the program the incentivation to make the jump to cpp became smaller. I hope I am making some sense here.

Anyway, thanks for the tips.

iamVFX
Posts: 697
Joined: 24 Sep 2010, 16:28

Re: Starting C++?

Post by iamVFX » 04 Aug 2012, 13:26

Butachan wrote:Hi guys just wanted to say thanks for the tips for starters aswell.
I have been also wondering if it was worth it to jump into cpp or increase my skills within the scripting and now ice environment.

I must say I was really considering the idea back in v7 but as ICE developed and hence the tools to accomplish complex effects within the program the incentivation to make the jump to cpp became smaller. I hope I am making some sense here.

Anyway, thanks for the tips.
It depends on what you're going to achive. If you want to make plugin for Softimage - what kind of plugin do you want to make? Will it simplify your work or not? How much time have you got to make it?

In Softimage you do need use C++ in a few cases - if you want to connect your C++ library that calculates something faster than multithreaded ICE, if you want to connect 3rd-party libraries to Softimage (Momentum, ImplosiaFX etc.) or if you want make your own tool with use of Tool SDK api. The main difference between tool that made with use of Tool SDK and scripting one ( PickPosition() ) is what level of flexibility you want. Do you need just tool that respond only on mouse button clicks or should it take into account click-n-drag feature or draw stuff with opengl for convenience? PickPosition() can do pretty much everything in my experience, but for stuff like Comb tool, like Houdini have, you need mouse drag feature and opengl for displaying normals that will change with each new mouse position.

If you just want to call Softimage API commands (In 98% of cases) there is no difference in speed whether it'll be called through C++ or Python or whatever, because they're provided by COM architecture from which Softimage is mostly made of.

Differences in speed occurs when you test your code by switching back and forth between SDK docs and IDE, compile and reload plugin in Softimage to update and see the changes instead of just open script editor, type some code and try it. The developer's speed is matter because life is so short and we are so small :D

User avatar
Nolan
Posts: 56
Joined: 11 Apr 2011, 21:47

Re: Starting C++?

Post by Nolan » 18 Aug 2012, 04:23

C++ free eBooks x2 Thinking In CPP 2nd edition
http://mindview.net/Books/TICPP/ThinkingInCPP2e.html

The XSI API via Python
XSIScriptingUsingPython.pdf
http://s3.darkvertex.com/mirror/XSIScri ... Python.pdf

C++11 books in the works
C++ Primer ( Moo ) Aug 2012, Reference
The C++ Programming Language ( Stroustrup ) Late 2012, Reference
Effective C++ ( Meyers) 2013-2014, Style guidance
C++ Coding Standards ( Sutter, Alecanrescu ) 2015 , Established guidance
Nolan
Second Nature Ltd
www.2ndNature.co.nz