home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!cs.utexas.edu!sun-barr!ames!olivea!sgigate!sgi!fido!krypton!gavin
- From: gavin@krypton.asd.sgi.com (Gavin Bell)
- Newsgroups: comp.sys.sgi
- Subject: Re: Inventor Question
- Message-ID: <1go6veINN40j@fido.asd.sgi.com>
- Date: 16 Dec 92 21:27:10 GMT
- References: <1992Dec16.162928.16505@erenj.com>
- Organization: Silicon Graphics, Inc. Mountain View, CA
- Lines: 27
- NNTP-Posting-Host: krypton.asd.sgi.com
-
- In <1992Dec16.162928.16505@erenj.com> ram@ramsgi.erenj.com (ram rajagopalan) writes:
- > This may be a really stupid question, but here it is. I am in the
- > process of learning inventor, and I am trying to set the value for
- > the fields in the nodes. I get a compile time error in attempting
- > to do this. Any pointers would be appreciated. Code segment follows.
- > I am using the C binding ...
- > SoCmplx *sph_cmplx;
- > sph_cmplx = SoCmplxCreate();
- > sph_cmplx->value = 0.25;
-
- Ah. sph_cmplx->values is a field of type SoSFFloat, not a regular
- 'float'. The compiler is complaining because you are trying to assign
- a float to an SoSFFloat. When you set a field's value, Inventor does
- some extra stuff so that data sensors will notice the change and fire.
-
- So, in C, you have to call a method to set a field's value; your code
- should look like:
-
- SoSFloatSet(&sph_cmplx->value, 0.25);
-
- In C++, Inventor 'overloads' the '=' function to essentially do this
- for you automatically.
-
-
-
- --
- --gavin (gavin@sgi.com, (415)390-1024)
-