Revision: 44649 http://brlcad.svn.sourceforge.net/brlcad/?rev=44649&view=rev Author: starseeker Date: 2011-05-20 18:31:56 +0000 (Fri, 20 May 2011)
Log Message: ----------- Well... grab the attributes from the first region in the path and use them... does this get us what we need? Modified Paths: -------------- brlcad/trunk/src/librt/tree.c Modified: brlcad/trunk/src/librt/tree.c =================================================================== --- brlcad/trunk/src/librt/tree.c 2011-05-20 17:37:17 UTC (rev 44648) +++ brlcad/trunk/src/librt/tree.c 2011-05-20 18:31:56 UTC (rev 44649) @@ -151,7 +151,7 @@ _rt_gettree_region_end(struct db_tree_state *tsp, const struct db_full_path *pathp, union tree *curtree, genptr_t client_data) { struct region *rp; - struct directory *dp; + struct directory *dp = NULL; size_t shader_len=0; struct rt_i *rtip; Tcl_HashTable *tbl = (Tcl_HashTable *)client_data; @@ -159,6 +159,8 @@ matp_t inv_mat; struct bu_attribute_value_set avs; struct bu_attribute_value_pair *avpp; + int i = 0; + int region_found = 0; RT_CK_DBI(tsp->ts_dbip); RT_CK_FULL_PATH(pathp); @@ -180,18 +182,24 @@ rp->reg_gmater = tsp->ts_gmater; rp->reg_los = tsp->ts_los; - dp = (struct directory *)DB_FULL_PATH_CUR_DIR(pathp); - if (dp) { - printf("name: %s\n", dp->d_namep); - bu_avs_init_empty(&avs); - if (!db5_get_attributes(tsp->ts_dbip, &avs, dp)) { - bu_avs_print(&avs, "db5_get_attribute results:"); - bu_avs_init_empty(&(rp->attr_values)); - for(BU_AVS_FOR(avpp, &(tsp->ts_attrs))) { + while (pathp->fp_len - i > 0 && !region_found) { + dp = (struct directory *)DB_FULL_PATH_GET(pathp, i); + if (dp->d_flags & RT_DIR_REGION) { + region_found = 1; + } + i++; + } + if (dp && region_found) { + printf("name: %s\n", dp->d_namep); + bu_avs_init_empty(&avs); + if (!db5_get_attributes(tsp->ts_dbip, &avs, dp)) { + bu_avs_print(&avs, "db5_get_attribute results:"); + bu_avs_init_empty(&(rp->attr_values)); + for(BU_AVS_FOR(avpp, &(tsp->ts_attrs))) { bu_avs_add(&(rp->attr_values), avpp->name, bu_avs_get(&avs, avpp->name)); - } - } - } + } + } + } rp->reg_mater = tsp->ts_mater; /* struct copy */ if (tsp->ts_mater.ma_shader) 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 brlcad-commits@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/brlcad-commits