home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.sys.sgi
- Path: sparky!uunet!zaphod.mps.ohio-state.edu!saimiri.primate.wisc.edu!sdd.hp.com!think.com!spool.mu.edu!yale.edu!jvnc.net!nj.nec.com!brad
- From: brad@research.nj.nec.com (Brad Gianulis)
- Subject: Re: Inventor Question
- Message-ID: <1992Dec17.025040.2312@research.nj.nec.com>
- Originator: brad@eames
- Sender: news@research.nj.nec.com
- Organization: NEC Research Institute
- References: <1992Dec16.162928.16505@erenj.com> <1go6veINN40j@fido.asd.sgi.com>
- Date: Thu, 17 Dec 92 02:50:40 GMT
- Lines: 45
-
- In article <1go6veINN40j@fido.asd.sgi.com> gavin@krypton.asd.sgi.com (Gavin Bell) writes:
- >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)
-
-
- So, Gavin, in C++, wouldn't that be:
-
- sph_cmplx->value.setValue( 0.25 );
-
-
- (I'm learning Inventor (and C++), too. and just want to make sure I got
- it right).
-
-
-
- Brad Gianulis
- NEC Research Institute
- Princeton, NJ
- (609) 951-2776
- brad@research.nj.nec.com
-