Revision: 44630
          http://brlcad.svn.sourceforge.net/brlcad/?rev=44630&view=rev
Author:   bob1961
Date:     2011-05-18 19:37:14 +0000 (Wed, 18 May 2011)

Log Message:
-----------
Colors were not getting imported for combinations. Standardized attributes on 
import before calling object specific import func. Moved ATTR enum definitions 
from db5_types.c to raytrace.h

Modified Paths:
--------------
    brlcad/trunk/include/raytrace.h
    brlcad/trunk/src/librt/comb/comb.c
    brlcad/trunk/src/librt/db5_io.c
    brlcad/trunk/src/librt/db5_types.c

Modified: brlcad/trunk/include/raytrace.h
===================================================================
--- brlcad/trunk/include/raytrace.h     2011-05-18 16:58:47 UTC (rev 44629)
+++ brlcad/trunk/include/raytrace.h     2011-05-18 19:37:14 UTC (rev 44630)
@@ -6054,6 +6054,24 @@
 
 
 /**
+ * Define standard attribute types in BRL-CAD geometry. (See the
+ * gattributes manual page) these should be a collective enumeration
+ * starting from 0 and increasing without any gaps in the numbers so
+ * db5_standard_attribute() can be used as an index-based iterator.
+ */
+enum {
+    ATTR_REGION = 0,
+    ATTR_REGION_ID,
+    ATTR_MATERIAL_ID,
+    ATTR_AIR,
+    ATTR_LOS,
+    ATTR_COLOR,
+    ATTR_SHADER,
+    ATTR_INHERIT,
+    ATTR_NULL
+};
+
+/**
  * D B 5 _ S T A N D A R D _ A T T R I B U T E
  *
  * Function returns the string name for a given standard attribute

Modified: brlcad/trunk/src/librt/comb/comb.c
===================================================================
--- brlcad/trunk/src/librt/comb/comb.c  2011-05-18 16:58:47 UTC (rev 44629)
+++ brlcad/trunk/src/librt/comb/comb.c  2011-05-18 19:37:14 UTC (rev 44630)
@@ -722,7 +722,8 @@
 
     /* Unpack the attributes */
     comb->rgb_valid = 0;
-    if ((ap = bu_avs_get(&ip->idb_avs, "rgb")) != NULL) {
+    
+    if ((ap = bu_avs_get(&ip->idb_avs, db5_standard_attribute(ATTR_COLOR))) != 
NULL) {
        int ibuf[3];
        if (sscanf(ap, "%d/%d/%d", ibuf, ibuf+1, ibuf+2) == 3) {
            VMOVE(comb->rgb, ibuf);
@@ -731,10 +732,10 @@
            bu_log("unable to parse 'rgb' attribute '%s'\n", ap);
        }
     }
-    if ((ap = bu_avs_get(&ip->idb_avs, "inherit")) != NULL) {
+    if ((ap = bu_avs_get(&ip->idb_avs, db5_standard_attribute(ATTR_INHERIT))) 
!= NULL) {
        comb->inherit = atoi(ap);
     }
-    if ((ap = bu_avs_get(&ip->idb_avs, "region")) != NULL) {
+    if ((ap = bu_avs_get(&ip->idb_avs, db5_standard_attribute(ATTR_REGION))) 
!= NULL) {
        /* Presence of this attribute implies it is a region */
        comb->region_flag = 1;
 
@@ -758,20 +759,20 @@
        }
 
        /* get the other GIFT "region" attributes */
-       if ((ap = bu_avs_get(&ip->idb_avs, "region_id")) != NULL) {
+       if ((ap = bu_avs_get(&ip->idb_avs, 
db5_standard_attribute(ATTR_REGION_ID))) != NULL) {
            comb->region_id = atol(ap);
        }
-       if ((ap = bu_avs_get(&ip->idb_avs, "aircode")) != NULL) {
+       if ((ap = bu_avs_get(&ip->idb_avs, db5_standard_attribute(ATTR_AIR))) 
!= NULL) {
            comb->aircode = atol(ap);
        }
-       if ((ap = bu_avs_get(&ip->idb_avs, "material_id")) != NULL) {
+       if ((ap = bu_avs_get(&ip->idb_avs, 
db5_standard_attribute(ATTR_MATERIAL_ID))) != NULL) {
            comb->GIFTmater = atol(ap);
        }
-       if ((ap = bu_avs_get(&ip->idb_avs, "los")) != NULL) {
+       if ((ap = bu_avs_get(&ip->idb_avs, db5_standard_attribute(ATTR_LOS))) 
!= NULL) {
            comb->los = atol(ap);
        }
     }
-    if ((ap = bu_avs_get(&ip->idb_avs, "shader")) != NULL) {
+    if ((ap = bu_avs_get(&ip->idb_avs, db5_standard_attribute(ATTR_SHADER))) 
!= NULL) {
        bu_vls_strcat(&comb->shader, ap);
     }
 

Modified: brlcad/trunk/src/librt/db5_io.c
===================================================================
--- brlcad/trunk/src/librt/db5_io.c     2011-05-18 16:58:47 UTC (rev 44629)
+++ brlcad/trunk/src/librt/db5_io.c     2011-05-18 19:37:14 UTC (rev 44630)
@@ -1014,6 +1014,8 @@
                   name);
            return -8;
        }
+
+       (void)db5_standardize_avs(&ip->idb_avs);
     }
 
     if (!raw.body.ext_buf) {

Modified: brlcad/trunk/src/librt/db5_types.c
===================================================================
--- brlcad/trunk/src/librt/db5_types.c  2011-05-18 16:58:47 UTC (rev 44629)
+++ brlcad/trunk/src/librt/db5_types.c  2011-05-18 19:37:14 UTC (rev 44630)
@@ -37,26 +37,7 @@
 #include "db5.h"
 #include "raytrace.h"
 
-/**
- * Define standard attribute types in BRL-CAD geometry. (See the
- * gattributes manual page) these should be a collective enumeration
- * starting from 0 and increasing without any gaps in the numbers so
- * db5_standard_attribute() can be used as an index-based iterator.
- */
 
-enum {
-    ATTR_REGION = 0,
-    ATTR_REGION_ID,
-    ATTR_MATERIAL_ID,
-    ATTR_AIR,
-    ATTR_LOS,
-    ATTR_COLOR,
-    ATTR_SHADER,
-    ATTR_INHERIT,
-    ATTR_NULL
-};
-
-
 struct db5_type {
     int major_code;
     int minor_code;


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
What Every C/C++ and Fortran developer Should Know!
Read this article and learn how Intel has extended the reach of its 
next-generation tools to help Windows* and Linux* C/C++ and Fortran 
developers boost performance applications - including clusters. 
http://p.sf.net/sfu/intel-dev2devmay
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits

Reply via email to