home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / sys / sgi / 18111 < prev    next >
Encoding:
Internet Message Format  |  1992-12-16  |  1.4 KB

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