These changes fix bug 2278126 (i.e. rt doesn't get geometry path right). The tact was to replace the solids list with a display list where each item in the list refers to what was asked to be drawn. Each of these display list items has its own solids list.
svn:revision:35068 svn:branch:trunk svn:account:bob1961
This commit is contained in:
1 parent
aa8f29d794
commit
d7ef83f14c
56 files changed
+1644
-1386
No files matched your search
+12
-2
@@ -71,6 +71,7 @@ __BEGIN_DECLS
|
||||
#define INV_4096_V 0.000244140625
|
||||
|
||||
#define GED_NULL (struct ged *)0
|
||||
#define GED_DISPLAY_LIST_NULL (struct ged_display_list *)0
|
||||
#define GED_DRAWABLE_NULL (struct ged_drawable *)0
|
||||
#define GED_VIEW_NULL (struct ged_view *)0
|
||||
|
||||
@@ -339,9 +340,16 @@ struct ged_qray_fmt {
|
||||
struct bu_vls fmt;
|
||||
};
|
||||
|
||||
struct ged_display_list {
|
||||
struct bu_list l;
|
||||
struct directory *gdl_dp;
|
||||
struct bu_vls gdl_path;
|
||||
struct bu_list gdl_headSolid; /**< @brief head of solid list for this object */
|
||||
};
|
||||
|
||||
struct ged_drawable {
|
||||
struct bu_list l;
|
||||
struct bu_list gd_headSolid; /**< @brief head of solid list */
|
||||
struct bu_list gd_headDisplay; /**< @brief head of display list */
|
||||
struct bu_list gd_headVDraw; /**< @brief head of vdraw list */
|
||||
struct vd_curve *gd_currVHead; /**< @brief current vdraw head */
|
||||
struct solid *gd_freeSolids; /**< @brief ptr to head of free solid list */
|
||||
@@ -430,6 +438,8 @@ struct ged {
|
||||
void (*ged_refresh_handler)(); /**< @brief function for handling refresh requests */
|
||||
void (*ged_output_handler)(); /**< @brief function for handling output */
|
||||
char *ged_output_script; /**< @brief script for use by the outputHandler */
|
||||
|
||||
int ged_internal_call;
|
||||
};
|
||||
|
||||
typedef int (*ged_func_ptr)(struct ged *, int, const char *[]);
|
||||
@@ -510,7 +520,7 @@ GED_EXPORT BU_EXTERN(int ged_inside_internal,
|
||||
(struct ged *gedp,
|
||||
struct rt_db_internal *ip,
|
||||
int argc,
|
||||
char *argv[],
|
||||
const char *argv[],
|
||||
int arg,
|
||||
char *o_name));
|
||||
|
||||
|
||||
+6
-2
@@ -2631,8 +2631,12 @@ RT_EXPORT BU_EXTERN(int db_identical_full_paths,
|
||||
(const struct db_full_path *a,
|
||||
const struct db_full_path *b));
|
||||
RT_EXPORT BU_EXTERN(int db_full_path_subset,
|
||||
(const struct db_full_path *a,
|
||||
const struct db_full_path *b));
|
||||
(const struct db_full_path *a,
|
||||
const struct db_full_path *b,
|
||||
int skip_first));
|
||||
RT_EXPORT BU_EXTERN(int db_full_path_match_top,
|
||||
(const struct db_full_path *a,
|
||||
const struct db_full_path *b));
|
||||
RT_EXPORT BU_EXTERN(int db_full_path_search,
|
||||
(const struct db_full_path *a,
|
||||
const struct directory *dp));
|
||||
|
||||
+22
-10
@@ -41,7 +41,10 @@
|
||||
int
|
||||
ged_autoview(struct ged *gedp, int argc, const char *argv[])
|
||||
{
|
||||
register struct ged_display_list *gdlp;
|
||||
register struct ged_display_list *next_gdlp;
|
||||
register struct solid *sp;
|
||||
register int is_empty = 1;
|
||||
vect_t min, max;
|
||||
vect_t minus, plus;
|
||||
vect_t center;
|
||||
@@ -65,18 +68,27 @@ ged_autoview(struct ged *gedp, int argc, const char *argv[])
|
||||
VSETALL(max, -INFINITY);
|
||||
VSETALL(sqrt_small, SQRT_SMALL_FASTF);
|
||||
|
||||
FOR_ALL_SOLIDS(sp, &gedp->ged_gdp->gd_headSolid) {
|
||||
minus[X] = sp->s_center[X] - sp->s_size;
|
||||
minus[Y] = sp->s_center[Y] - sp->s_size;
|
||||
minus[Z] = sp->s_center[Z] - sp->s_size;
|
||||
VMIN(min, minus);
|
||||
plus[X] = sp->s_center[X] + sp->s_size;
|
||||
plus[Y] = sp->s_center[Y] + sp->s_size;
|
||||
plus[Z] = sp->s_center[Z] + sp->s_size;
|
||||
VMAX(max, plus);
|
||||
gdlp = BU_LIST_NEXT(ged_display_list, &gedp->ged_gdp->gd_headDisplay);
|
||||
while (BU_LIST_NOT_HEAD(gdlp, &gedp->ged_gdp->gd_headDisplay)) {
|
||||
next_gdlp = BU_LIST_PNEXT(ged_display_list, gdlp);
|
||||
|
||||
FOR_ALL_SOLIDS(sp, &gdlp->gdl_headSolid) {
|
||||
minus[X] = sp->s_center[X] - sp->s_size;
|
||||
minus[Y] = sp->s_center[Y] - sp->s_size;
|
||||
minus[Z] = sp->s_center[Z] - sp->s_size;
|
||||
VMIN(min, minus);
|
||||
plus[X] = sp->s_center[X] + sp->s_size;
|
||||
plus[Y] = sp->s_center[Y] + sp->s_size;
|
||||
plus[Z] = sp->s_center[Z] + sp->s_size;
|
||||
VMAX(max, plus);
|
||||
|
||||
is_empty = 0;
|
||||
}
|
||||
|
||||
gdlp = next_gdlp;
|
||||
}
|
||||
|
||||
if (BU_LIST_IS_EMPTY(&gedp->ged_gdp->gd_headSolid)) {
|
||||
if (is_empty) {
|
||||
/* Nothing is in view */
|
||||
VSETALL(center, 0.0);
|
||||
VSETALL(radial, 1000.0); /* 1 meter */
|
||||
|
||||
+6
-2
@@ -2080,6 +2080,7 @@ fix_halfs(struct ged_client_data *dgcdp)
|
||||
int
|
||||
ged_E(struct ged *gedp, int argc, const char *argv[])
|
||||
{
|
||||
register int i;
|
||||
register int c;
|
||||
struct ged_client_data *dgcdp;
|
||||
static const char *usage = "[-C#/#/# -s] objects(s)";
|
||||
@@ -2151,7 +2152,10 @@ ged_E(struct ged *gedp, int argc, const char *argv[])
|
||||
argc -= bu_optind;
|
||||
argv += bu_optind;
|
||||
|
||||
ged_eraseobjpath(gedp, argc-1, argv+1, LOOKUP_QUIET, 0);
|
||||
for (i = 0; i < argc; ++i) {
|
||||
ged_erasePathFromDisplay(gedp, argv[i]);
|
||||
ged_addToDisplay(gedp, argv[i]);
|
||||
}
|
||||
|
||||
#if 0
|
||||
gedp->ged_wdbp->wdb_ttol.magic = RT_TESS_TOL_MAGIC;
|
||||
@@ -2217,7 +2221,7 @@ ged_E(struct ged *gedp, int argc, const char *argv[])
|
||||
bu_free((char *)dgcdp->rtip, "rt_i structure for 'E'");
|
||||
}
|
||||
|
||||
ged_color_soltab((struct solid *)&gedp->ged_gdp->gd_headSolid);
|
||||
ged_color_soltab(&gedp->ged_gdp->gd_headDisplay);
|
||||
(void)time(&dgcdp->etime);
|
||||
|
||||
/* free leaf_list */
|
||||
|
||||
+1
-1
@@ -150,7 +150,7 @@ _ged_edcolor(struct ged *gedp, int argc, const char *argv[])
|
||||
|
||||
/* if there are drawables, update their colors */
|
||||
if (gedp->ged_gdp)
|
||||
ged_color_soltab((struct solid *)&gedp->ged_gdp->gd_headSolid);
|
||||
ged_color_soltab(&gedp->ged_gdp->gd_headDisplay);
|
||||
|
||||
return GED_OK;
|
||||
}
|
||||
|
||||
+2
-2
@@ -3621,7 +3621,7 @@ dgo_eraseobjall(struct dg_obj *dgop,
|
||||
sp = BU_LIST_NEXT(solid, &dgop->dgo_headSolid);
|
||||
while (BU_LIST_NOT_HEAD(sp, &dgop->dgo_headSolid)) {
|
||||
nsp = BU_LIST_PNEXT(solid, sp);
|
||||
if (db_full_path_subset(&sp->s_fullpath, &subpath)) {
|
||||
if (db_full_path_subset(&sp->s_fullpath, &subpath, 0)) {
|
||||
BU_LIST_DEQUEUE(&sp->l);
|
||||
FREE_SOLID(sp, &FreeSolid.l);
|
||||
}
|
||||
@@ -3711,7 +3711,7 @@ dgo_eraseobj(struct dg_obj *dgop,
|
||||
sp = BU_LIST_FIRST(solid, &dgop->dgo_headSolid);
|
||||
while (BU_LIST_NOT_HEAD(sp, &dgop->dgo_headSolid)) {
|
||||
nsp = BU_LIST_PNEXT(solid, sp);
|
||||
if (db_full_path_subset(&sp->s_fullpath, &subpath)) {
|
||||
if (db_full_path_subset(&sp->s_fullpath, &subpath, 0)) {
|
||||
BU_LIST_DEQUEUE(&sp->l);
|
||||
FREE_SOLID(sp, &FreeSolid.l);
|
||||
}
|
||||
|
||||
+137
-95
@@ -123,7 +123,7 @@ ged_drawH_part2(int dashflag, struct bu_list *vhead, struct db_full_path *pathp,
|
||||
GET_SOLID(sp, &FreeSolid.l);
|
||||
/* NOTICE: The structure is dirty & not initialized for you! */
|
||||
|
||||
sp->s_dlist = BU_LIST_LAST(solid, &dgcdp->gedp->ged_gdp->gd_headSolid)->s_dlist + 1;
|
||||
sp->s_dlist = BU_LIST_LAST(solid, &dgcdp->gdlp->gdl_headSolid)->s_dlist + 1;
|
||||
} else {
|
||||
/* Just updating an existing solid.
|
||||
* 'tsp' and 'pathpos' will not be used
|
||||
@@ -179,22 +179,9 @@ ged_drawH_part2(int dashflag, struct bu_list *vhead, struct db_full_path *pathp,
|
||||
|
||||
/* Add to linked list of solid structs */
|
||||
bu_semaphore_acquire(RT_SEM_MODEL);
|
||||
BU_LIST_APPEND(dgcdp->gedp->ged_gdp->gd_headSolid.back, &sp->l);
|
||||
BU_LIST_APPEND(dgcdp->gdlp->gdl_headSolid.back, &sp->l);
|
||||
bu_semaphore_release(RT_SEM_MODEL);
|
||||
}
|
||||
|
||||
#if 0
|
||||
/* Solid is successfully drawn */
|
||||
if (!existing_sp) {
|
||||
/* Add to linked list of solid structs */
|
||||
bu_semaphore_acquire(RT_SEM_MODEL);
|
||||
BU_LIST_APPEND(dgcdp->gedp->ged_gdp->gd_headSolid.back, &sp->l);
|
||||
bu_semaphore_release(RT_SEM_MODEL);
|
||||
} else {
|
||||
/* replacing existing solid -- struct already linked in */
|
||||
sp->s_flag = UP;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -558,12 +545,17 @@ ged_drawtrees(struct ged *gedp, int argc, const char *argv[], int kind, struct g
|
||||
int dgo_enable_fastpath = 0;
|
||||
struct model *dgo_nmg_model;
|
||||
struct ged_client_data *dgcdp;
|
||||
register int i;
|
||||
int ac = 1;
|
||||
char *av[2];
|
||||
|
||||
RT_CHECK_DBI(gedp->ged_wdbp->dbip);
|
||||
|
||||
if (argc <= 0)
|
||||
return(-1); /* FAIL */
|
||||
|
||||
av[1] = (char *)0;
|
||||
|
||||
/* options are already parsed into _dgcdp */
|
||||
if (_dgcdp != (struct ged_client_data *)0) {
|
||||
BU_GETSTRUCT(dgcdp, ged_client_data);
|
||||
@@ -719,6 +711,10 @@ ged_drawtrees(struct ged *gedp, int argc, const char *argv[], int kind, struct g
|
||||
bu_free((genptr_t)dgcdp, "ged_drawtrees: dgcdp");
|
||||
return(-1);
|
||||
case 1: /* Wireframes */
|
||||
{
|
||||
union tree *(*reg_end_func) (struct db_tree_state *, struct db_full_path *, union tree *, genptr_t);
|
||||
union tree *(*leaf_func) (struct db_tree_state *, struct db_full_path *, struct rt_db_internal *, genptr_t);
|
||||
|
||||
/*
|
||||
* If asking for wireframe and in shaded_mode and no shaded mode override,
|
||||
* or asking for wireframe and shaded mode is being overridden with a value
|
||||
@@ -731,43 +727,31 @@ ged_drawtrees(struct ged *gedp, int argc, const char *argv[], int kind, struct g
|
||||
* are drawn as shaded polygons.
|
||||
*/
|
||||
if (GED_SHADED_MODE_BOTS <= dgcdp->dmode && dgcdp->dmode <= GED_SHADED_MODE_ALL) {
|
||||
int i;
|
||||
int ac = 1;
|
||||
char *av[2];
|
||||
#if 0
|
||||
struct directory *dp;
|
||||
#endif
|
||||
reg_end_func = ged_bot_check_region_end;
|
||||
leaf_func = ged_bot_check_leaf;
|
||||
} else {
|
||||
reg_end_func = ged_wireframe_region_end;
|
||||
leaf_func = ged_wireframe_leaf;
|
||||
}
|
||||
|
||||
av[1] = (char *)0;
|
||||
for (i = 0; i < argc; ++i) {
|
||||
dgcdp->gdlp = ged_addToDisplay(gedp, argv[i]);
|
||||
|
||||
for (i = 0; i < argc; ++i) {
|
||||
#if 0
|
||||
if ((dp = db_lookup(gedp->ged_wdbp->dbip, argv[i], LOOKUP_NOISY)) == DIR_NULL)
|
||||
continue;
|
||||
#endif
|
||||
if (dgcdp->gdlp == GED_DISPLAY_LIST_NULL)
|
||||
continue;
|
||||
|
||||
av[0] = (char *)argv[i];
|
||||
|
||||
ret = db_walk_tree(gedp->ged_wdbp->dbip,
|
||||
ac,
|
||||
(const char **)av,
|
||||
ncpu,
|
||||
&gedp->ged_wdbp->wdb_initial_tree_state,
|
||||
0,
|
||||
ged_bot_check_region_end,
|
||||
ged_bot_check_leaf,
|
||||
(genptr_t)dgcdp);
|
||||
}
|
||||
} else
|
||||
av[0] = (char *)argv[i];
|
||||
ret = db_walk_tree(gedp->ged_wdbp->dbip,
|
||||
argc,
|
||||
(const char **)argv,
|
||||
ac,
|
||||
(const char **)av,
|
||||
ncpu,
|
||||
&gedp->ged_wdbp->wdb_initial_tree_state,
|
||||
0, /* take all regions */
|
||||
ged_wireframe_region_end,
|
||||
ged_wireframe_leaf,
|
||||
0,
|
||||
reg_end_func,
|
||||
leaf_func,
|
||||
(genptr_t)dgcdp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 2: /* Big-E */
|
||||
bu_vls_printf(&gedp->ged_result_str, "drawtrees: can't do big-E here\n");
|
||||
@@ -783,13 +767,23 @@ ged_drawtrees(struct ged *gedp, int argc, const char *argv[], int kind, struct g
|
||||
dgcdp->draw_edge_uses_vbp = rt_vlblock_init();
|
||||
}
|
||||
|
||||
ret = db_walk_tree(gedp->ged_wdbp->dbip, argc, (const char **)argv,
|
||||
ncpu,
|
||||
&gedp->ged_wdbp->wdb_initial_tree_state,
|
||||
dgo_enable_fastpath ? ged_nmg_region_start : 0,
|
||||
ged_nmg_region_end,
|
||||
dgo_nmg_use_tnurbs ? nmg_booltree_leaf_tnurb : nmg_booltree_leaf_tess,
|
||||
(genptr_t)dgcdp);
|
||||
for (i = 0; i < argc; ++i) {
|
||||
dgcdp->gdlp = ged_addToDisplay(gedp, argv[i]);
|
||||
|
||||
if (dgcdp->gdlp == GED_DISPLAY_LIST_NULL)
|
||||
continue;
|
||||
|
||||
av[0] = (char *)argv[i];
|
||||
ret = db_walk_tree(gedp->ged_wdbp->dbip,
|
||||
ac,
|
||||
(const char **)av,
|
||||
ncpu,
|
||||
&gedp->ged_wdbp->wdb_initial_tree_state,
|
||||
dgo_enable_fastpath ? ged_nmg_region_start : 0,
|
||||
ged_nmg_region_end,
|
||||
dgo_nmg_use_tnurbs ? nmg_booltree_leaf_tnurb : nmg_booltree_leaf_tess,
|
||||
(genptr_t)dgcdp);
|
||||
}
|
||||
|
||||
if (dgcdp->draw_edge_uses) {
|
||||
ged_cvt_vlblock_to_solids(gedp, dgcdp->draw_edge_uses_vbp, "_EDGEUSES_", 0);
|
||||
@@ -953,9 +947,9 @@ ged_invent_solid(struct ged *gedp,
|
||||
int dmode)
|
||||
{
|
||||
register struct directory *dp;
|
||||
struct directory *dpp[2] = {DIR_NULL, DIR_NULL};
|
||||
register struct solid *sp;
|
||||
unsigned char type='0';
|
||||
register struct solid *sp;
|
||||
struct ged_display_list *gdlp;
|
||||
unsigned char type='0';
|
||||
|
||||
if (gedp->ged_wdbp->dbip == DBI_NULL)
|
||||
return 0;
|
||||
@@ -971,8 +965,7 @@ ged_invent_solid(struct ged *gedp,
|
||||
* Name exists from some other overlay,
|
||||
* zap any associated solids
|
||||
*/
|
||||
dpp[0] = dp;
|
||||
ged_eraseobjall(gedp, dpp);
|
||||
ged_erasePathFromDisplay(gedp, name);
|
||||
}
|
||||
/* Need to enter phony name in directory structure */
|
||||
dp = db_diradd(gedp->ged_wdbp->dbip, name, RT_DIR_PHONY_ADDR, 0, DIR_SOLID, (genptr_t)&type);
|
||||
@@ -993,6 +986,8 @@ ged_invent_solid(struct ged *gedp,
|
||||
/* set path information -- this is a top level node */
|
||||
db_add_node_to_full_path( &sp->s_fullpath, dp );
|
||||
|
||||
gdlp = ged_addToDisplay(gedp, name);
|
||||
|
||||
sp->s_iflag = DOWN;
|
||||
sp->s_soldash = 0;
|
||||
sp->s_Eflag = 1; /* Can't be solid edited! */
|
||||
@@ -1000,7 +995,7 @@ ged_invent_solid(struct ged *gedp,
|
||||
sp->s_color[1] = sp->s_basecolor[1] = (rgb>> 8) & 0xFF;
|
||||
sp->s_color[2] = sp->s_basecolor[2] = (rgb ) & 0xFF;
|
||||
sp->s_regionid = 0;
|
||||
sp->s_dlist = BU_LIST_LAST(solid, &gedp->ged_gdp->gd_headSolid)->s_dlist + 1;
|
||||
sp->s_dlist = BU_LIST_LAST(solid, &gdlp->gdl_headSolid)->s_dlist + 1;
|
||||
|
||||
sp->s_uflag = 0;
|
||||
sp->s_dflag = 0;
|
||||
@@ -1011,7 +1006,7 @@ ged_invent_solid(struct ged *gedp,
|
||||
sp->s_dmode = dmode;
|
||||
|
||||
/* Solid successfully drawn, add to linked list of solid structs */
|
||||
BU_LIST_APPEND(gedp->ged_gdp->gd_headSolid.back, &sp->l);
|
||||
BU_LIST_APPEND(gdlp->gdl_headSolid.back, &sp->l);
|
||||
|
||||
return (0); /* OK */
|
||||
}
|
||||
@@ -1024,51 +1019,60 @@ ged_invent_solid(struct ged *gedp,
|
||||
* mater structure.
|
||||
*/
|
||||
void
|
||||
ged_color_soltab(struct solid *hsp)
|
||||
ged_color_soltab(struct bu_list *hdlp)
|
||||
{
|
||||
register struct ged_display_list *gdlp;
|
||||
register struct ged_display_list *next_gdlp;
|
||||
register struct solid *sp;
|
||||
register const struct mater *mp;
|
||||
|
||||
FOR_ALL_SOLIDS(sp, &hsp->l) {
|
||||
sp->s_cflag = 0;
|
||||
gdlp = BU_LIST_NEXT(ged_display_list, hdlp);
|
||||
while (BU_LIST_NOT_HEAD(gdlp, hdlp)) {
|
||||
next_gdlp = BU_LIST_PNEXT(ged_display_list, gdlp);
|
||||
|
||||
/* the user specified the color, so use it */
|
||||
if (sp->s_uflag) {
|
||||
FOR_ALL_SOLIDS(sp, &gdlp->gdl_headSolid) {
|
||||
sp->s_cflag = 0;
|
||||
|
||||
/* the user specified the color, so use it */
|
||||
if (sp->s_uflag) {
|
||||
sp->s_color[0] = sp->s_basecolor[0];
|
||||
sp->s_color[1] = sp->s_basecolor[1];
|
||||
sp->s_color[2] = sp->s_basecolor[2];
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
for (mp = rt_material_head(); mp != MATER_NULL; mp = mp->mt_forw) {
|
||||
if (sp->s_regionid <= mp->mt_high &&
|
||||
sp->s_regionid >= mp->mt_low) {
|
||||
sp->s_color[0] = mp->mt_r;
|
||||
sp->s_color[1] = mp->mt_g;
|
||||
sp->s_color[2] = mp->mt_b;
|
||||
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* There is no region-id-based coloring entry in the
|
||||
* table, so use the combination-record ("mater"
|
||||
* command) based color if one was provided. Otherwise,
|
||||
* use the default wireframe color.
|
||||
* This is the "new way" of coloring things.
|
||||
*/
|
||||
|
||||
/* use wireframe_default_color */
|
||||
if (sp->s_dflag)
|
||||
sp->s_cflag = 1;
|
||||
/* Be conservative and copy color anyway, to avoid black */
|
||||
sp->s_color[0] = sp->s_basecolor[0];
|
||||
sp->s_color[1] = sp->s_basecolor[1];
|
||||
sp->s_color[2] = sp->s_basecolor[2];
|
||||
|
||||
continue;
|
||||
done: ;
|
||||
}
|
||||
|
||||
for (mp = rt_material_head(); mp != MATER_NULL; mp = mp->mt_forw) {
|
||||
if (sp->s_regionid <= mp->mt_high &&
|
||||
sp->s_regionid >= mp->mt_low) {
|
||||
sp->s_color[0] = mp->mt_r;
|
||||
sp->s_color[1] = mp->mt_g;
|
||||
sp->s_color[2] = mp->mt_b;
|
||||
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* There is no region-id-based coloring entry in the
|
||||
* table, so use the combination-record ("mater"
|
||||
* command) based color if one was provided. Otherwise,
|
||||
* use the default wireframe color.
|
||||
* This is the "new way" of coloring things.
|
||||
*/
|
||||
|
||||
/* use wireframe_default_color */
|
||||
if (sp->s_dflag)
|
||||
sp->s_cflag = 1;
|
||||
/* Be conservative and copy color anyway, to avoid black */
|
||||
sp->s_color[0] = sp->s_basecolor[0];
|
||||
sp->s_color[1] = sp->s_basecolor[1];
|
||||
sp->s_color[2] = sp->s_basecolor[2];
|
||||
|
||||
done: ;
|
||||
gdlp = next_gdlp;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1076,6 +1080,7 @@ ged_color_soltab(struct solid *hsp)
|
||||
int
|
||||
ged_draw_guts(struct ged *gedp, int argc, const char *argv[], int kind)
|
||||
{
|
||||
register int i;
|
||||
static const char *usage = "[-R -A -o -C#/#/# -s] <objects | attribute name/value pairs>";
|
||||
|
||||
GED_CHECK_DATABASE_OPEN(gedp, GED_ERROR);
|
||||
@@ -1098,9 +1103,17 @@ ged_draw_guts(struct ged *gedp, int argc, const char *argv[], int kind)
|
||||
/* First, delete any mention of these objects.
|
||||
* Silently skip any leading options (which start with minus signs).
|
||||
*/
|
||||
ged_eraseobjpath(gedp, argc, argv, LOOKUP_QUIET, 0);
|
||||
|
||||
for (i = 0; i < argc; ++i) {
|
||||
/* Skip any options */
|
||||
if (argv[i][0] == '-')
|
||||
continue;
|
||||
|
||||
ged_erasePathFromDisplay(gedp, argv[i]);
|
||||
}
|
||||
|
||||
ged_drawtrees(gedp, argc, argv, kind, (struct ged_client_data *)0);
|
||||
ged_color_soltab((struct solid *)&gedp->ged_gdp->gd_headSolid);
|
||||
ged_color_soltab(&gedp->ged_gdp->gd_headDisplay);
|
||||
|
||||
return GED_OK;
|
||||
}
|
||||
@@ -1118,6 +1131,35 @@ ged_ev(struct ged *gedp, int argc, const char *argv[])
|
||||
}
|
||||
|
||||
|
||||
struct ged_display_list *
|
||||
ged_addToDisplay(struct ged *gedp,
|
||||
const char *name)
|
||||
{
|
||||
register int i;
|
||||
struct directory *dp;
|
||||
register struct ged_display_list *gdlp;
|
||||
char *cp;
|
||||
|
||||
cp = strrchr(name, '/');
|
||||
if (cp == '\0')
|
||||
cp = (char *)name;
|
||||
else
|
||||
++cp;
|
||||
|
||||
if ((dp = db_lookup(gedp->ged_wdbp->dbip, cp, LOOKUP_NOISY)) == DIR_NULL)
|
||||
return GED_DISPLAY_LIST_NULL;
|
||||
|
||||
BU_GETSTRUCT(gdlp, ged_display_list);
|
||||
BU_LIST_INSERT(&gedp->ged_gdp->gd_headDisplay, &gdlp->l);
|
||||
BU_LIST_INIT(&gdlp->gdl_headSolid);
|
||||
gdlp->gdl_dp = dp;
|
||||
bu_vls_init(&gdlp->gdl_path);
|
||||
bu_vls_printf(&gdlp->gdl_path, name);
|
||||
|
||||
return gdlp;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Local Variables:
|
||||
* tab-width: 8
|
||||
|
||||
+149
-186
@@ -44,8 +44,7 @@
|
||||
int
|
||||
ged_erase(struct ged *gedp, int argc, const char *argv[])
|
||||
{
|
||||
int found = 0;
|
||||
int illum = 1;
|
||||
register int i;
|
||||
static const char *usage = "objects(s)";
|
||||
|
||||
GED_CHECK_DATABASE_OPEN(gedp, GED_ERROR);
|
||||
@@ -61,233 +60,197 @@ ged_erase(struct ged *gedp, int argc, const char *argv[])
|
||||
return GED_HELP;
|
||||
}
|
||||
|
||||
ged_eraseobjpath(gedp, argc-1, argv+1, LOOKUP_QUIET, 0);
|
||||
for (i = 1; i < argc; ++i)
|
||||
ged_erasePathFromDisplay(gedp, argv[i]);
|
||||
|
||||
return GED_OK;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Builds an array of directory pointers from argv and calls
|
||||
* either ged_eraseobj or ged_eraseobjall.
|
||||
* Erase/remove the display list item from headDisplay if path matches the list item's path.
|
||||
*
|
||||
*/
|
||||
void
|
||||
ged_eraseobjpath(struct ged *gedp,
|
||||
int argc,
|
||||
const char *argv[],
|
||||
int noisy,
|
||||
int all)
|
||||
ged_erasePathFromDisplay(struct ged *gedp,
|
||||
const char *path)
|
||||
{
|
||||
register struct directory *dp;
|
||||
register int i;
|
||||
register struct ged_display_list *gdlp;
|
||||
register struct ged_display_list *next_gdlp;
|
||||
register struct solid *sp;
|
||||
struct directory *dp;
|
||||
|
||||
for (i = 0; i < argc; i++) {
|
||||
int j;
|
||||
int ac, ac_orig;
|
||||
char **av, **av_orig;
|
||||
struct directory **dpp = (struct directory **)0;
|
||||
gdlp = BU_LIST_NEXT(ged_display_list, &gedp->ged_gdp->gd_headDisplay);
|
||||
while (BU_LIST_NOT_HEAD(gdlp, &gedp->ged_gdp->gd_headDisplay)) {
|
||||
next_gdlp = BU_LIST_PNEXT(ged_display_list, gdlp);
|
||||
|
||||
ac_orig = 1;
|
||||
if (!strcmp(path, bu_vls_addr(&gdlp->gdl_path))) {
|
||||
/* Free up the solids list associated with this display list */
|
||||
while (BU_LIST_WHILE(sp, solid, &gdlp->gdl_headSolid)) {
|
||||
dp = FIRST_SOLID(sp);
|
||||
RT_CK_DIR(dp);
|
||||
if (dp->d_addr == RT_DIR_PHONY_ADDR) {
|
||||
if (db_dirdelete(gedp->ged_wdbp->dbip, dp) < 0) {
|
||||
bu_vls_printf(&gedp->ged_result_str, "ged_zap: db_dirdelete failed\n");
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
char *begin;
|
||||
char *end;
|
||||
char *newstr = strdup(argv[i]);
|
||||
int n;
|
||||
|
||||
/* First count the number of '/' */
|
||||
begin = newstr;
|
||||
while ((end = strchr(begin, '/')) != NULL) {
|
||||
begin = end + 1;
|
||||
++ac_orig;
|
||||
BU_LIST_DEQUEUE(&sp->l);
|
||||
FREE_SOLID(sp, &FreeSolid.l);
|
||||
}
|
||||
av_orig = (char **)bu_calloc(ac_orig+1, sizeof(char *), "ged_eraseobjpath");
|
||||
|
||||
begin = newstr;
|
||||
n = 0;
|
||||
while ((end = strchr(begin, '/')) != NULL) {
|
||||
*end = '\0';
|
||||
av_orig[n++] = bu_strdup(begin);
|
||||
begin = end + 1;
|
||||
}
|
||||
av_orig[n++] = bu_strdup(begin);
|
||||
av_orig[n] = (char *)0;
|
||||
free((void *)newstr);
|
||||
BU_LIST_DEQUEUE(&gdlp->l);
|
||||
bu_vls_free(&gdlp->gdl_path);
|
||||
free((void *)gdlp);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
/* make sure we will not dereference null */
|
||||
if ((ac_orig == 0) || (av_orig == 0) || (*av_orig == 0)) {
|
||||
bu_vls_printf(&gedp->ged_result_str, "WARNING: Asked to look up a null-named database object\n");
|
||||
goto end;
|
||||
}
|
||||
|
||||
/* skip first element if empty */
|
||||
ac = ac_orig;
|
||||
av = av_orig;
|
||||
|
||||
if (*av[0] == '\0') {
|
||||
--ac;
|
||||
++av;
|
||||
}
|
||||
|
||||
/* ignore last element if empty */
|
||||
if (*av[ac-1] == '\0')
|
||||
--ac;
|
||||
|
||||
dpp = bu_calloc(ac+1, sizeof(struct directory *), "ged_eraseobjpath: directory pointers");
|
||||
for (j = 0; j < ac; ++j)
|
||||
if ((dp = db_lookup(gedp->ged_wdbp->dbip, av[j], noisy)) != DIR_NULL)
|
||||
dpp[j] = dp;
|
||||
else
|
||||
goto end;
|
||||
|
||||
dpp[j] = DIR_NULL;
|
||||
|
||||
if (all)
|
||||
ged_eraseobjall(gedp, dpp);
|
||||
else
|
||||
ged_eraseobj(gedp, dpp);
|
||||
|
||||
end:
|
||||
bu_free((genptr_t)dpp, "ged_eraseobjpath: directory pointers");
|
||||
bu_free_argv(ac_orig, (char **)av_orig);
|
||||
gdlp = next_gdlp;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* E R A S E O B J A L L
|
||||
* Erase/remove display list item from headDisplay if name is found anywhere along item's path with
|
||||
* the exception that the first path element is skipped if skip_first is true.
|
||||
*
|
||||
* This routine goes through the solid table and deletes all solids
|
||||
* from the solid list which contain the specified object anywhere in their 'path'
|
||||
* Note - name is not expected to contain path separators.
|
||||
*
|
||||
*/
|
||||
void
|
||||
ged_eraseobjall(struct ged *gedp,
|
||||
register struct directory **dpp)
|
||||
ged_eraseAllNamesFromDisplay(struct ged *gedp,
|
||||
const char *name,
|
||||
const int skip_first)
|
||||
{
|
||||
register struct ged_display_list *gdlp;
|
||||
register struct ged_display_list *next_gdlp;
|
||||
|
||||
gdlp = BU_LIST_NEXT(ged_display_list, &gedp->ged_gdp->gd_headDisplay);
|
||||
while (BU_LIST_NOT_HEAD(gdlp, &gedp->ged_gdp->gd_headDisplay)) {
|
||||
char *dup;
|
||||
char *tok;
|
||||
int first = 1;
|
||||
int found = 0;
|
||||
|
||||
next_gdlp = BU_LIST_PNEXT(ged_display_list, gdlp);
|
||||
|
||||
dup = strdup(bu_vls_addr(&gdlp->gdl_path));
|
||||
tok = strtok(dup, "/");
|
||||
while (tok) {
|
||||
if (first) {
|
||||
first = 0;
|
||||
|
||||
if (skip_first) {
|
||||
tok = strtok((char *)NULL, "/");
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (!strcmp(tok, name)) {
|
||||
ged_freeDisplayListItem(gedp, gdlp);
|
||||
found = 1;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
tok = strtok((char *)NULL, "/");
|
||||
}
|
||||
|
||||
/* Look for name in solids list */
|
||||
if (!found) {
|
||||
struct db_full_path subpath;
|
||||
|
||||
if (db_string_to_path(&subpath, gedp->ged_wdbp->dbip, name) == 0) {
|
||||
ged_eraseAllSubpathsFromSolidList(gedp, gdlp, &subpath, skip_first);
|
||||
db_free_full_path(&subpath);
|
||||
}
|
||||
}
|
||||
|
||||
free((void *)dup);
|
||||
gdlp = next_gdlp;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Erase/remove display list item from headDisplay if path is a subset of item's path.
|
||||
*/
|
||||
void
|
||||
ged_eraseAllPathsFromDisplay(struct ged *gedp,
|
||||
const char *path,
|
||||
const int skip_first)
|
||||
{
|
||||
register struct ged_display_list *gdlp;
|
||||
register struct ged_display_list *next_gdlp;
|
||||
register struct solid *sp;
|
||||
struct directory *dp;
|
||||
struct db_full_path fullpath, subpath;
|
||||
|
||||
if (db_string_to_path(&subpath, gedp->ged_wdbp->dbip, path) == 0) {
|
||||
gdlp = BU_LIST_NEXT(ged_display_list, &gedp->ged_gdp->gd_headDisplay);
|
||||
while (BU_LIST_NOT_HEAD(gdlp, &gedp->ged_gdp->gd_headDisplay)) {
|
||||
next_gdlp = BU_LIST_PNEXT(ged_display_list, gdlp);
|
||||
|
||||
if (db_string_to_path(&fullpath, gedp->ged_wdbp->dbip, bu_vls_addr(&gdlp->gdl_path)) == 0) {
|
||||
if (db_full_path_subset(&fullpath, &subpath, skip_first)) {
|
||||
ged_freeDisplayListItem(gedp, gdlp);
|
||||
} else {
|
||||
ged_eraseAllSubpathsFromSolidList(gedp, gdlp, &subpath, skip_first);
|
||||
}
|
||||
|
||||
db_free_full_path(&fullpath);
|
||||
}
|
||||
|
||||
gdlp = next_gdlp;
|
||||
}
|
||||
|
||||
db_free_full_path(&subpath);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
ged_eraseAllSubpathsFromSolidList(struct ged *gedp,
|
||||
struct ged_display_list *gdlp,
|
||||
struct db_full_path *subpath,
|
||||
const int skip_first)
|
||||
{
|
||||
register struct directory **tmp_dpp;
|
||||
register struct solid *sp;
|
||||
register struct solid *nsp;
|
||||
struct db_full_path subpath;
|
||||
|
||||
if (gedp->ged_wdbp->dbip == DBI_NULL)
|
||||
return;
|
||||
|
||||
if (*dpp == DIR_NULL)
|
||||
return;
|
||||
|
||||
db_full_path_init(&subpath);
|
||||
for (tmp_dpp = dpp; *tmp_dpp != DIR_NULL; ++tmp_dpp) {
|
||||
RT_CK_DIR(*tmp_dpp);
|
||||
db_add_node_to_full_path(&subpath, *tmp_dpp);
|
||||
}
|
||||
|
||||
sp = BU_LIST_NEXT(solid, &gedp->ged_gdp->gd_headSolid);
|
||||
while (BU_LIST_NOT_HEAD(sp, &gedp->ged_gdp->gd_headSolid)) {
|
||||
sp = BU_LIST_NEXT(solid, &gdlp->gdl_headSolid);
|
||||
while (BU_LIST_NOT_HEAD(sp, &gdlp->gdl_headSolid)) {
|
||||
nsp = BU_LIST_PNEXT(solid, sp);
|
||||
if ( db_full_path_subset( &sp->s_fullpath, &subpath ) ) {
|
||||
if (db_full_path_subset(&sp->s_fullpath, subpath, skip_first)) {
|
||||
BU_LIST_DEQUEUE(&sp->l);
|
||||
FREE_SOLID(sp, &FreeSolid.l);
|
||||
}
|
||||
sp = nsp;
|
||||
}
|
||||
|
||||
if ((*dpp)->d_addr == RT_DIR_PHONY_ADDR) {
|
||||
if (db_dirdelete(gedp->ged_wdbp->dbip, *dpp) < 0) {
|
||||
bu_vls_printf(&gedp->ged_result_str, "ged_eraseobjall: db_dirdelete failed\n");
|
||||
}
|
||||
}
|
||||
db_free_full_path(&subpath);
|
||||
}
|
||||
|
||||
/*
|
||||
* E R A S E O B J
|
||||
*
|
||||
* This routine goes through the solid table and deletes all solids
|
||||
* from the solid list which contain the specified object at the
|
||||
* beginning of their 'path'
|
||||
*/
|
||||
void
|
||||
ged_eraseobj(struct ged *gedp,
|
||||
register struct directory **dpp)
|
||||
ged_freeDisplayListItem (struct ged *gedp,
|
||||
struct ged_display_list *gdlp)
|
||||
{
|
||||
#if 1
|
||||
/*XXX
|
||||
* Temporarily put back the old behavior (as seen in Brlcad5.3),
|
||||
* as the behavior after the #else is identical to ged_eraseobjall.
|
||||
*/
|
||||
register struct directory **tmp_dpp;
|
||||
register struct solid *sp;
|
||||
register struct solid *nsp;
|
||||
register int i;
|
||||
struct directory *dp;
|
||||
|
||||
if (gedp->ged_wdbp->dbip == DBI_NULL)
|
||||
return;
|
||||
|
||||
if (*dpp == DIR_NULL)
|
||||
return;
|
||||
|
||||
for (tmp_dpp = dpp; *tmp_dpp != DIR_NULL; ++tmp_dpp)
|
||||
RT_CK_DIR(*tmp_dpp);
|
||||
|
||||
sp = BU_LIST_FIRST(solid, &gedp->ged_gdp->gd_headSolid);
|
||||
while (BU_LIST_NOT_HEAD(sp, &gedp->ged_gdp->gd_headSolid)) {
|
||||
nsp = BU_LIST_PNEXT(solid, sp);
|
||||
for (i = 0, tmp_dpp = dpp;
|
||||
i < sp->s_fullpath.fp_len && *tmp_dpp != DIR_NULL;
|
||||
++i, ++tmp_dpp)
|
||||
if (sp->s_fullpath.fp_names[i] != *tmp_dpp)
|
||||
goto end;
|
||||
|
||||
if (*tmp_dpp != DIR_NULL)
|
||||
goto end;
|
||||
/* Free up the solids list associated with this display list */
|
||||
while (BU_LIST_WHILE(sp, solid, &gdlp->gdl_headSolid)) {
|
||||
dp = FIRST_SOLID(sp);
|
||||
RT_CK_DIR(dp);
|
||||
if (dp->d_addr == RT_DIR_PHONY_ADDR) {
|
||||
if (db_dirdelete(gedp->ged_wdbp->dbip, dp) < 0) {
|
||||
bu_vls_printf(&gedp->ged_result_str, "ged_zap: db_dirdelete failed\n");
|
||||
}
|
||||
}
|
||||
|
||||
BU_LIST_DEQUEUE(&sp->l);
|
||||
FREE_SOLID(sp, &FreeSolid.l);
|
||||
end:
|
||||
sp = nsp;
|
||||
}
|
||||
|
||||
if ((*dpp)->d_addr == RT_DIR_PHONY_ADDR ) {
|
||||
if (db_dirdelete(gedp->ged_wdbp->dbip, *dpp) < 0) {
|
||||
bu_vls_printf(&gedp->ged_result_str, "ged_eraseobj: db_dirdelete failed\n");
|
||||
}
|
||||
}
|
||||
#else
|
||||
register struct directory **tmp_dpp;
|
||||
register struct solid *sp;
|
||||
register struct solid *nsp;
|
||||
struct db_full_path subpath;
|
||||
|
||||
if (gedp->ged_wdbp->dbip == DBI_NULL)
|
||||
return;
|
||||
|
||||
if (*dpp == DIR_NULL)
|
||||
return;
|
||||
|
||||
db_full_path_init(&subpath);
|
||||
for (tmp_dpp = dpp; *tmp_dpp != DIR_NULL; ++tmp_dpp) {
|
||||
RT_CK_DIR(*tmp_dpp);
|
||||
db_add_node_to_full_path(&subpath, *tmp_dpp);
|
||||
}
|
||||
|
||||
sp = BU_LIST_FIRST(solid, &gedp->ged_gdp->gd_headSolid);
|
||||
while (BU_LIST_NOT_HEAD(sp, &gedp->ged_gdp->gd_headSolid)) {
|
||||
nsp = BU_LIST_PNEXT(solid, sp);
|
||||
if ( db_full_path_subset( &sp->s_fullpath, &subpath ) ) {
|
||||
BU_LIST_DEQUEUE(&sp->l);
|
||||
FREE_SOLID(sp, &FreeSolid.l);
|
||||
}
|
||||
sp = nsp;
|
||||
}
|
||||
|
||||
if ((*dpp)->d_addr == RT_DIR_PHONY_ADDR ) {
|
||||
if (db_dirdelete(gedp->ged_wdbp->dbip, *dpp) < 0) {
|
||||
bu_vls_printf(&gedp->ged_result_str, "ged_eraseobj: db_dirdelete failed\n");
|
||||
}
|
||||
}
|
||||
db_free_full_path(&subpath);
|
||||
#endif
|
||||
/* Free up the display list */
|
||||
BU_LIST_DEQUEUE(&gdlp->l);
|
||||
bu_vls_free(&gdlp->gdl_path);
|
||||
free((void *)gdlp);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -43,8 +43,7 @@
|
||||
int
|
||||
ged_erase_all(struct ged *gedp, int argc, const char *argv[])
|
||||
{
|
||||
int found = 0;
|
||||
int illum = 1;
|
||||
register int i;
|
||||
static const char *usage = "objects(s)";
|
||||
|
||||
GED_CHECK_DATABASE_OPEN(gedp, GED_ERROR);
|
||||
@@ -60,7 +59,8 @@ ged_erase_all(struct ged *gedp, int argc, const char *argv[])
|
||||
return GED_HELP;
|
||||
}
|
||||
|
||||
ged_eraseobjpath(gedp, argc-1, argv+1, LOOKUP_QUIET, 1);
|
||||
for (i = 1; i < argc; ++i)
|
||||
ged_eraseAllPathsFromDisplay(gedp, argv[i], 0);
|
||||
|
||||
return GED_OK;
|
||||
}
|
||||
|
||||
+1
-1
@@ -96,7 +96,7 @@ ged_drawable_init(struct ged_drawable *gdp)
|
||||
if (gdp == GED_DRAWABLE_NULL)
|
||||
return;
|
||||
|
||||
BU_LIST_INIT(&gdp->gd_headSolid);
|
||||
BU_LIST_INIT(&gdp->gd_headDisplay);
|
||||
BU_LIST_INIT(&gdp->gd_headVDraw);
|
||||
#if 0
|
||||
BU_LIST_INIT(&gdp->gd_observers.l);
|
||||
|
||||
+57
-30
@@ -64,32 +64,33 @@ struct ged_id_to_names {
|
||||
};
|
||||
|
||||
struct ged_client_data {
|
||||
struct ged *gedp;
|
||||
int wireframe_color_override;
|
||||
int wireframe_color[3];
|
||||
int draw_nmg_only;
|
||||
int nmg_triangulate;
|
||||
int draw_wireframes;
|
||||
int draw_normals;
|
||||
int draw_solid_lines_only;
|
||||
int draw_no_surfaces;
|
||||
int shade_per_vertex_normals;
|
||||
int draw_edge_uses;
|
||||
int fastpath_count; /* statistics */
|
||||
int do_not_draw_nmg_solids_during_debugging;
|
||||
struct bn_vlblock *draw_edge_uses_vbp;
|
||||
int shaded_mode_override;
|
||||
fastf_t transparency;
|
||||
int dmode;
|
||||
struct ged *gedp;
|
||||
struct ged_display_list *gdlp;
|
||||
int wireframe_color_override;
|
||||
int wireframe_color[3];
|
||||
int draw_nmg_only;
|
||||
int nmg_triangulate;
|
||||
int draw_wireframes;
|
||||
int draw_normals;
|
||||
int draw_solid_lines_only;
|
||||
int draw_no_surfaces;
|
||||
int shade_per_vertex_normals;
|
||||
int draw_edge_uses;
|
||||
int fastpath_count; /* statistics */
|
||||
int do_not_draw_nmg_solids_during_debugging;
|
||||
struct bn_vlblock *draw_edge_uses_vbp;
|
||||
int shaded_mode_override;
|
||||
fastf_t transparency;
|
||||
int dmode;
|
||||
/* bigE related members */
|
||||
struct application *ap;
|
||||
struct bu_ptbl leaf_list;
|
||||
struct rt_i *rtip;
|
||||
time_t start_time;
|
||||
time_t etime;
|
||||
long nvectors;
|
||||
int do_polysolids;
|
||||
int num_halfs;
|
||||
struct application *ap;
|
||||
struct bu_ptbl leaf_list;
|
||||
struct rt_i *rtip;
|
||||
time_t start_time;
|
||||
time_t etime;
|
||||
long nvectors;
|
||||
int do_polysolids;
|
||||
int num_halfs;
|
||||
};
|
||||
|
||||
struct ged_rt_client_data {
|
||||
@@ -157,7 +158,7 @@ BU_EXTERN (struct directory *ged_combadd,
|
||||
|
||||
/* defined in draw.c */
|
||||
BU_EXTERN (void ged_color_soltab,
|
||||
(struct solid *hsp));
|
||||
(struct bu_list *hdlp));
|
||||
|
||||
BU_EXTERN (void ged_cvt_vlblock_to_solids,
|
||||
(struct ged *gedp,
|
||||
@@ -178,6 +179,9 @@ BU_EXTERN (int ged_drawtrees,
|
||||
const char *argv[],
|
||||
int kind,
|
||||
struct ged_client_data *_dgcdp));
|
||||
BU_EXTERN (struct ged_display_list *ged_addToDisplay,
|
||||
(struct ged *gedp,
|
||||
const char *name));
|
||||
|
||||
|
||||
/* defined in erase.c */
|
||||
@@ -185,14 +189,37 @@ BU_EXTERN (void ged_eraseobjpath,
|
||||
(struct ged *gedp,
|
||||
int argc,
|
||||
const char *argv[],
|
||||
int noisy,
|
||||
int all));
|
||||
const int noisy,
|
||||
const int all,
|
||||
const int skip_first));
|
||||
BU_EXTERN (void ged_eraseobjall,
|
||||
(struct ged *gedp,
|
||||
register struct directory **dpp));
|
||||
register struct directory **dpp,
|
||||
int skip_first));
|
||||
BU_EXTERN (void ged_eraseobj,
|
||||
(struct ged *gedp,
|
||||
register struct directory **dpp));
|
||||
register struct directory **dpp,
|
||||
int skip_first));
|
||||
BU_EXTERN (void ged_erasePathFromDisplay,
|
||||
(struct ged *gedp,
|
||||
const char *path));
|
||||
BU_EXTERN (void ged_eraseAllNamesFromDisplay,
|
||||
(struct ged *gedp,
|
||||
const char *name,
|
||||
int skip_first));
|
||||
BU_EXTERN (void ged_eraseAllPathsFromDisplay,
|
||||
(struct ged *gedp,
|
||||
const char *path,
|
||||
int skip_first));
|
||||
BU_EXTERN (void ged_eraseAllSubpathsFromSolidList,
|
||||
(struct ged *gedp,
|
||||
struct ged_display_list *gdlp,
|
||||
struct db_full_path *subpath,
|
||||
const int skip_first));
|
||||
BU_EXTERN (void ged_freeDisplayListItem,
|
||||
(struct ged *gedp,
|
||||
struct ged_display_list *gdlp));
|
||||
|
||||
|
||||
/* defined in get_comb.c */
|
||||
BU_EXTERN(void ged_vls_print_matrix,
|
||||
|
||||
+28
-16
@@ -37,7 +37,10 @@
|
||||
int
|
||||
ged_get_autoview(struct ged *gedp, int argc, const char *argv[])
|
||||
{
|
||||
register struct ged_display_list *gdlp;
|
||||
register struct ged_display_list *next_gdlp;
|
||||
register struct solid *sp;
|
||||
register int is_empty = 1;
|
||||
vect_t min, max;
|
||||
vect_t minus, plus;
|
||||
vect_t center;
|
||||
@@ -77,25 +80,34 @@ ged_get_autoview(struct ged *gedp, int argc, const char *argv[])
|
||||
VSETALL(min, INFINITY);
|
||||
VSETALL(max, -INFINITY);
|
||||
|
||||
FOR_ALL_SOLIDS(sp, &gedp->ged_gdp->gd_headSolid) {
|
||||
/* Skip psuedo-solids unless pflag is set */
|
||||
if (!pflag &&
|
||||
sp->s_fullpath.fp_names != (struct directory **)0 &&
|
||||
sp->s_fullpath.fp_names[0] != (struct directory *)0 &&
|
||||
sp->s_fullpath.fp_names[0]->d_addr == RT_DIR_PHONY_ADDR)
|
||||
continue;
|
||||
gdlp = BU_LIST_NEXT(ged_display_list, &gedp->ged_gdp->gd_headDisplay);
|
||||
while (BU_LIST_NOT_HEAD(gdlp, &gedp->ged_gdp->gd_headDisplay)) {
|
||||
next_gdlp = BU_LIST_PNEXT(ged_display_list, gdlp);
|
||||
|
||||
minus[X] = sp->s_center[X] - sp->s_size;
|
||||
minus[Y] = sp->s_center[Y] - sp->s_size;
|
||||
minus[Z] = sp->s_center[Z] - sp->s_size;
|
||||
VMIN(min, minus);
|
||||
plus[X] = sp->s_center[X] + sp->s_size;
|
||||
plus[Y] = sp->s_center[Y] + sp->s_size;
|
||||
plus[Z] = sp->s_center[Z] + sp->s_size;
|
||||
VMAX(max, plus);
|
||||
FOR_ALL_SOLIDS(sp, &gdlp->gdl_headSolid) {
|
||||
/* Skip psuedo-solids unless pflag is set */
|
||||
if (!pflag &&
|
||||
sp->s_fullpath.fp_names != (struct directory **)0 &&
|
||||
sp->s_fullpath.fp_names[0] != (struct directory *)0 &&
|
||||
sp->s_fullpath.fp_names[0]->d_addr == RT_DIR_PHONY_ADDR)
|
||||
continue;
|
||||
|
||||
minus[X] = sp->s_center[X] - sp->s_size;
|
||||
minus[Y] = sp->s_center[Y] - sp->s_size;
|
||||
minus[Z] = sp->s_center[Z] - sp->s_size;
|
||||
VMIN(min, minus);
|
||||
plus[X] = sp->s_center[X] + sp->s_size;
|
||||
plus[Y] = sp->s_center[Y] + sp->s_size;
|
||||
plus[Z] = sp->s_center[Z] + sp->s_size;
|
||||
VMAX(max, plus);
|
||||
|
||||
is_empty = 0;
|
||||
}
|
||||
|
||||
gdlp = next_gdlp;
|
||||
}
|
||||
|
||||
if (BU_LIST_IS_EMPTY(&gedp->ged_gdp->gd_headSolid)) {
|
||||
if (is_empty) {
|
||||
/* Nothing is in view */
|
||||
VSETALL(center, 0.0);
|
||||
VSETALL(radial, 1000.0); /* 1 meter */
|
||||
|
||||
+26
-17
@@ -45,6 +45,8 @@
|
||||
int
|
||||
ged_how(struct ged *gedp, int argc, const char *argv[])
|
||||
{
|
||||
register struct ged_display_list *gdlp;
|
||||
register struct ged_display_list *next_gdlp;
|
||||
register struct solid *sp;
|
||||
int i;
|
||||
struct directory **dpp;
|
||||
@@ -82,25 +84,32 @@ ged_how(struct ged *gedp, int argc, const char *argv[])
|
||||
goto good;
|
||||
}
|
||||
|
||||
FOR_ALL_SOLIDS(sp, &gedp->ged_gdp->gd_headSolid) {
|
||||
for (i = 0, tmp_dpp = dpp;
|
||||
i < sp->s_fullpath.fp_len && *tmp_dpp != DIR_NULL;
|
||||
++i, ++tmp_dpp) {
|
||||
if (sp->s_fullpath.fp_names[i] != *tmp_dpp)
|
||||
break;
|
||||
gdlp = BU_LIST_NEXT(ged_display_list, &gedp->ged_gdp->gd_headDisplay);
|
||||
while (BU_LIST_NOT_HEAD(gdlp, &gedp->ged_gdp->gd_headDisplay)) {
|
||||
next_gdlp = BU_LIST_PNEXT(ged_display_list, gdlp);
|
||||
|
||||
FOR_ALL_SOLIDS(sp, &gdlp->gdl_headSolid) {
|
||||
for (i = 0, tmp_dpp = dpp;
|
||||
i < sp->s_fullpath.fp_len && *tmp_dpp != DIR_NULL;
|
||||
++i, ++tmp_dpp) {
|
||||
if (sp->s_fullpath.fp_names[i] != *tmp_dpp)
|
||||
break;
|
||||
}
|
||||
|
||||
if (*tmp_dpp != DIR_NULL)
|
||||
continue;
|
||||
|
||||
|
||||
/* found a match */
|
||||
if (both)
|
||||
bu_vls_printf(&gedp->ged_result_str, "%d %g", sp->s_dmode, sp->s_transparency);
|
||||
else
|
||||
bu_vls_printf(&gedp->ged_result_str, "%d", sp->s_dmode);
|
||||
|
||||
goto good;
|
||||
}
|
||||
|
||||
if (*tmp_dpp != DIR_NULL)
|
||||
continue;
|
||||
|
||||
|
||||
/* found a match */
|
||||
if (both)
|
||||
bu_vls_printf(&gedp->ged_result_str, "%d %g", sp->s_dmode, sp->s_transparency);
|
||||
else
|
||||
bu_vls_printf(&gedp->ged_result_str, "%d", sp->s_dmode);
|
||||
|
||||
goto good;
|
||||
gdlp = next_gdlp;
|
||||
}
|
||||
|
||||
/* match NOT found */
|
||||
|
||||
+20
-10
@@ -37,6 +37,8 @@
|
||||
int
|
||||
ged_illum(struct ged *gedp, int argc, const char *argv[])
|
||||
{
|
||||
register struct ged_display_list *gdlp;
|
||||
register struct ged_display_list *next_gdlp;
|
||||
register struct solid *sp;
|
||||
int found = 0;
|
||||
int illum = 1;
|
||||
@@ -68,21 +70,29 @@ ged_illum(struct ged *gedp, int argc, const char *argv[])
|
||||
if (argc != 2)
|
||||
goto bad;
|
||||
|
||||
FOR_ALL_SOLIDS(sp, &gedp->ged_gdp->gd_headSolid) {
|
||||
register int i;
|
||||
gdlp = BU_LIST_NEXT(ged_display_list, &gedp->ged_gdp->gd_headDisplay);
|
||||
while (BU_LIST_NOT_HEAD(gdlp, &gedp->ged_gdp->gd_headDisplay)) {
|
||||
next_gdlp = BU_LIST_PNEXT(ged_display_list, gdlp);
|
||||
|
||||
for (i = 0; i < sp->s_fullpath.fp_len; ++i) {
|
||||
if (*argv[1] == *DB_FULL_PATH_GET(&sp->s_fullpath, i)->d_namep &&
|
||||
strcmp(argv[1], DB_FULL_PATH_GET(&sp->s_fullpath, i)->d_namep) == 0) {
|
||||
found = 1;
|
||||
if (illum)
|
||||
sp->s_iflag = UP;
|
||||
else
|
||||
sp->s_iflag = DOWN;
|
||||
FOR_ALL_SOLIDS(sp, &gdlp->gdl_headSolid) {
|
||||
register int i;
|
||||
|
||||
for (i = 0; i < sp->s_fullpath.fp_len; ++i) {
|
||||
if (*argv[1] == *DB_FULL_PATH_GET(&sp->s_fullpath, i)->d_namep &&
|
||||
strcmp(argv[1], DB_FULL_PATH_GET(&sp->s_fullpath, i)->d_namep) == 0) {
|
||||
found = 1;
|
||||
if (illum)
|
||||
sp->s_iflag = UP;
|
||||
else
|
||||
sp->s_iflag = DOWN;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
gdlp = next_gdlp;
|
||||
}
|
||||
|
||||
|
||||
if (!found) {
|
||||
bu_vls_printf(&gedp->ged_result_str, "illum: %s not found", argv[1]);
|
||||
return GED_ERROR;
|
||||
|
||||
+1
-1
@@ -906,7 +906,7 @@ nmgin(struct ged *gedp, struct rt_db_internal *ip, fastf_t thick)
|
||||
}
|
||||
|
||||
int
|
||||
ged_inside_internal(struct ged *gedp, struct rt_db_internal *ip, int argc, char *argv[], int arg, char *o_name)
|
||||
ged_inside_internal(struct ged *gedp, struct rt_db_internal *ip, int argc, const char *argv[], int arg, char *o_name)
|
||||
{
|
||||
register int i;
|
||||
struct directory *dp;
|
||||
|
||||
+1
-3
@@ -87,9 +87,7 @@ ged_kill(struct ged *gedp, int argc, const char *argv[])
|
||||
if (is_phony)
|
||||
continue;
|
||||
|
||||
dpp[0] = dp;
|
||||
dpp [1] = DIR_NULL;
|
||||
ged_eraseobjall(gedp, dpp);
|
||||
ged_eraseAllNamesFromDisplay(gedp, argv[i], 0);
|
||||
|
||||
if (db_delete(gedp->ged_wdbp->dbip, dp) < 0 ||
|
||||
db_dirdelete(gedp->ged_wdbp->dbip, dp) < 0) {
|
||||
|
||||
@@ -57,10 +57,13 @@ ged_killall(struct ged *gedp, int argc, const char *argv[])
|
||||
return GED_ERROR;
|
||||
}
|
||||
|
||||
gedp->ged_internal_call = 1;
|
||||
if ((ret = ged_killrefs(gedp, argc, argv)) != GED_OK) {
|
||||
gedp->ged_internal_call = 0;
|
||||
bu_vls_printf(&gedp->ged_result_str, "KILL skipped because of earlier errors.\n");
|
||||
return ret;
|
||||
}
|
||||
gedp->ged_internal_call = 0;
|
||||
|
||||
/* ALL references removed...now KILL the object[s] */
|
||||
/* reuse argv[] */
|
||||
|
||||
@@ -61,6 +61,11 @@ ged_killrefs(struct ged *gedp, int argc, const char *argv[])
|
||||
return GED_ERROR;
|
||||
}
|
||||
|
||||
if (!gedp->ged_internal_call) {
|
||||
for (k = 1; k < argc; k++)
|
||||
ged_eraseAllNamesFromDisplay(gedp, argv[k], 1);
|
||||
}
|
||||
|
||||
ret = GED_OK;
|
||||
|
||||
FOR_ALL_DIRECTORY_START(dp, gedp->ged_wdbp->dbip) {
|
||||
|
||||
@@ -84,8 +84,6 @@ ged_killtree(struct ged *gedp, int argc, const char *argv[])
|
||||
gktd.killrefs = 0;
|
||||
|
||||
for (i=1; i<argc; i++) {
|
||||
struct directory *dpp[2];
|
||||
|
||||
if ((dp = db_lookup(gedp->ged_wdbp->dbip, argv[i], LOOKUP_NOISY)) == DIR_NULL)
|
||||
continue;
|
||||
|
||||
@@ -93,17 +91,15 @@ ged_killtree(struct ged *gedp, int argc, const char *argv[])
|
||||
if (dp->d_addr == RT_DIR_PHONY_ADDR)
|
||||
continue;
|
||||
|
||||
dpp[0] = dp;
|
||||
dpp [1] = DIR_NULL;
|
||||
ged_eraseobjall(gedp, dpp);
|
||||
|
||||
db_functree(gedp->ged_wdbp->dbip, dp,
|
||||
ged_killtree_callback, ged_killtree_callback,
|
||||
gedp->ged_wdbp->wdb_resp, (genptr_t)&gktd);
|
||||
}
|
||||
|
||||
if (gktd.killrefs && gktd.ac > 1) {
|
||||
gedp->ged_internal_call = 1;
|
||||
(void)ged_killrefs(gedp, gktd.ac, (const char **)gktd.av);
|
||||
gedp->ged_internal_call = 0;
|
||||
|
||||
for (i=1; i<gktd.ac; i++) {
|
||||
bu_vls_printf(&gedp->ged_result_str, "Freeing %s\n", gktd.av[i]);
|
||||
@@ -122,11 +118,14 @@ ged_killtree_callback(struct db_i *dbip,
|
||||
register struct directory *dp,
|
||||
genptr_t ptr)
|
||||
{
|
||||
struct directory *dpp[2];
|
||||
struct ged_killtree_data *gktdp = (struct ged_killtree_data *)ptr;
|
||||
|
||||
if (dbip == DBI_NULL)
|
||||
return;
|
||||
|
||||
ged_eraseAllNamesFromDisplay(gktdp->gedp, dp->d_namep, 0);
|
||||
|
||||
bu_vls_printf(&gktdp->gedp->ged_result_str, "KILL %s: %s\n",
|
||||
(dp->d_flags & DIR_COMB) ? "COMB" : "Solid",
|
||||
dp->d_namep);
|
||||
|
||||
@@ -36,6 +36,7 @@
|
||||
int
|
||||
ged_move(struct ged *gedp, int argc, const char *argv[])
|
||||
{
|
||||
register struct ged_display_list *gdlp;
|
||||
register struct directory *dp;
|
||||
struct rt_db_internal intern;
|
||||
static const char *usage = "from to";
|
||||
@@ -84,6 +85,40 @@ ged_move(struct ged *gedp, int argc, const char *argv[])
|
||||
return GED_ERROR;
|
||||
}
|
||||
|
||||
/* Change object name if it matches the first element in the display list path. */
|
||||
for (BU_LIST_FOR(gdlp, ged_display_list, &gedp->ged_gdp->gd_headDisplay)) {
|
||||
register int first = 1;
|
||||
register int found = 0;
|
||||
struct bu_vls new_path;
|
||||
char *dup = strdup(bu_vls_addr(&gdlp->gdl_path));
|
||||
char *tok = strtok(dup, "/");
|
||||
|
||||
bu_vls_init(&new_path);
|
||||
|
||||
while (tok) {
|
||||
if (first) {
|
||||
first = 0;
|
||||
|
||||
if (!strcmp(tok, argv[1])) {
|
||||
found = 1;
|
||||
bu_vls_printf(&new_path, "%s", argv[2]);
|
||||
} else
|
||||
break; /* no need to go further */
|
||||
} else
|
||||
bu_vls_printf(&new_path, "/%s", tok);
|
||||
|
||||
tok = strtok((char *)NULL, "/");
|
||||
}
|
||||
|
||||
if (found) {
|
||||
bu_vls_free(&gdlp->gdl_path);
|
||||
bu_vls_printf(&gdlp->gdl_path, "%S", &new_path);
|
||||
}
|
||||
|
||||
free((void *)dup);
|
||||
bu_vls_free(&new_path);
|
||||
}
|
||||
|
||||
return GED_OK;
|
||||
}
|
||||
|
||||
|
||||
@@ -37,6 +37,7 @@
|
||||
int
|
||||
ged_move_all(struct ged *gedp, int argc, const char *argv[])
|
||||
{
|
||||
register struct ged_display_list *gdlp;
|
||||
register int i;
|
||||
register struct directory *dp;
|
||||
struct rt_db_internal intern;
|
||||
@@ -193,6 +194,45 @@ ged_move_all(struct ged *gedp, int argc, const char *argv[])
|
||||
|
||||
bu_ptbl_free(&stack);
|
||||
|
||||
/* Change object name anywhere in the display list path. */
|
||||
for (BU_LIST_FOR(gdlp, ged_display_list, &gedp->ged_gdp->gd_headDisplay)) {
|
||||
register int first = 1;
|
||||
register int found = 0;
|
||||
struct bu_vls new_path;
|
||||
char *dup = strdup(bu_vls_addr(&gdlp->gdl_path));
|
||||
char *tok = strtok(dup, "/");
|
||||
|
||||
bu_vls_init(&new_path);
|
||||
|
||||
while (tok) {
|
||||
if (!strcmp(tok, argv[1])) {
|
||||
found = 1;
|
||||
|
||||
if (first) {
|
||||
first = 0;
|
||||
bu_vls_printf(&new_path, "%s", argv[2]);
|
||||
} else
|
||||
bu_vls_printf(&new_path, "/%s", argv[2]);
|
||||
} else {
|
||||
if (first) {
|
||||
first = 0;
|
||||
bu_vls_printf(&new_path, "%s", tok);
|
||||
} else
|
||||
bu_vls_printf(&new_path, "/%s", tok);
|
||||
}
|
||||
|
||||
tok = strtok((char *)NULL, "/");
|
||||
}
|
||||
|
||||
if (found) {
|
||||
bu_vls_free(&gdlp->gdl_path);
|
||||
bu_vls_printf(&gdlp->gdl_path, "%S", &new_path);
|
||||
}
|
||||
|
||||
free((void *)dup);
|
||||
bu_vls_free(&new_path);
|
||||
}
|
||||
|
||||
return GED_OK;
|
||||
}
|
||||
|
||||
|
||||
+11
-2
@@ -70,6 +70,8 @@ extern void ged_cvt_vlblock_to_solids(struct ged *gedp, struct bn_vlblock *vbp,
|
||||
int
|
||||
ged_nirt(struct ged *gedp, int argc, const char *argv[])
|
||||
{
|
||||
register struct ged_display_list *gdlp;
|
||||
register struct ged_display_list *next_gdlp;
|
||||
register char **vp;
|
||||
FILE *fp_in;
|
||||
FILE *fp_out, *fp_err;
|
||||
@@ -569,8 +571,15 @@ ged_nirt(struct ged *gedp, int argc, const char *argv[])
|
||||
|
||||
#endif
|
||||
|
||||
FOR_ALL_SOLIDS(sp, &gedp->ged_gdp->gd_headSolid)
|
||||
sp->s_wflag = DOWN;
|
||||
gdlp = BU_LIST_NEXT(ged_display_list, &gedp->ged_gdp->gd_headDisplay);
|
||||
while (BU_LIST_NOT_HEAD(gdlp, &gedp->ged_gdp->gd_headDisplay)) {
|
||||
next_gdlp = BU_LIST_PNEXT(ged_display_list, gdlp);
|
||||
|
||||
FOR_ALL_SOLIDS(sp, &gdlp->gdl_headSolid)
|
||||
sp->s_wflag = DOWN;
|
||||
|
||||
gdlp = next_gdlp;
|
||||
}
|
||||
|
||||
return GED_OK;
|
||||
}
|
||||
|
||||
+85
-66
@@ -45,6 +45,8 @@
|
||||
int
|
||||
ged_plot(struct ged *gedp, int argc, const char *argv[])
|
||||
{
|
||||
register struct ged_display_list *gdlp;
|
||||
register struct ged_display_list *next_gdlp;
|
||||
register struct solid *sp;
|
||||
register struct bn_vlist *vp;
|
||||
register FILE *fp;
|
||||
@@ -149,21 +151,30 @@ ged_plot(struct ged *gedp, int argc, const char *argv[])
|
||||
-gedp->ged_gvp->gv_center[MDZ] + gedp->ged_gvp->gv_scale);
|
||||
Dashing = 0;
|
||||
pl_linmod(fp, "solid");
|
||||
FOR_ALL_SOLIDS(sp, &gedp->ged_gdp->gd_headSolid) {
|
||||
/* Could check for differences from last color */
|
||||
pl_color(fp,
|
||||
sp->s_color[0],
|
||||
sp->s_color[1],
|
||||
sp->s_color[2]);
|
||||
if (Dashing != sp->s_soldash) {
|
||||
if (sp->s_soldash)
|
||||
pl_linmod(fp, "dotdashed");
|
||||
else
|
||||
pl_linmod(fp, "solid");
|
||||
Dashing = sp->s_soldash;
|
||||
|
||||
gdlp = BU_LIST_NEXT(ged_display_list, &gedp->ged_gdp->gd_headDisplay);
|
||||
while (BU_LIST_NOT_HEAD(gdlp, &gedp->ged_gdp->gd_headDisplay)) {
|
||||
next_gdlp = BU_LIST_PNEXT(ged_display_list, gdlp);
|
||||
|
||||
FOR_ALL_SOLIDS(sp, &gdlp->gdl_headSolid) {
|
||||
/* Could check for differences from last color */
|
||||
pl_color(fp,
|
||||
sp->s_color[0],
|
||||
sp->s_color[1],
|
||||
sp->s_color[2]);
|
||||
if (Dashing != sp->s_soldash) {
|
||||
if (sp->s_soldash)
|
||||
pl_linmod(fp, "dotdashed");
|
||||
else
|
||||
pl_linmod(fp, "solid");
|
||||
Dashing = sp->s_soldash;
|
||||
}
|
||||
rt_vlist_to_uplot(fp, &(sp->s_vlist));
|
||||
}
|
||||
rt_vlist_to_uplot(fp, &(sp->s_vlist));
|
||||
|
||||
gdlp = next_gdlp;
|
||||
}
|
||||
|
||||
goto out;
|
||||
}
|
||||
|
||||
@@ -192,63 +203,71 @@ ged_plot(struct ged *gedp, int argc, const char *argv[])
|
||||
pl_erase(fp);
|
||||
Dashing = 0;
|
||||
pl_linmod(fp, "solid");
|
||||
FOR_ALL_SOLIDS(sp, &gedp->ged_gdp->gd_headSolid) {
|
||||
if (Dashing != sp->s_soldash) {
|
||||
if (sp->s_soldash)
|
||||
pl_linmod(fp, "dotdashed");
|
||||
else
|
||||
pl_linmod(fp, "solid");
|
||||
Dashing = sp->s_soldash;
|
||||
}
|
||||
for (BU_LIST_FOR(vp, bn_vlist, &(sp->s_vlist))) {
|
||||
register int i;
|
||||
register int nused = vp->nused;
|
||||
register int *cmd = vp->cmd;
|
||||
register point_t *pt = vp->pt;
|
||||
for (i = 0; i < nused; i++, cmd++, pt++) {
|
||||
switch (*cmd) {
|
||||
case BN_VLIST_POLY_START:
|
||||
case BN_VLIST_POLY_VERTNORM:
|
||||
continue;
|
||||
case BN_VLIST_POLY_MOVE:
|
||||
case BN_VLIST_LINE_MOVE:
|
||||
/* Move, not draw */
|
||||
MAT4X3PNT(last, gedp->ged_gvp->gv_model2view, *pt);
|
||||
continue;
|
||||
case BN_VLIST_POLY_DRAW:
|
||||
case BN_VLIST_POLY_END:
|
||||
case BN_VLIST_LINE_DRAW:
|
||||
/* draw */
|
||||
MAT4X3PNT(fin, gedp->ged_gvp->gv_model2view, *pt);
|
||||
VMOVE(start, last);
|
||||
VMOVE(last, fin);
|
||||
break;
|
||||
}
|
||||
if (ged_vclip(start, fin, clipmin, clipmax) == 0)
|
||||
continue;
|
||||
|
||||
if (Three_D) {
|
||||
/* Could check for differences from last color */
|
||||
pl_color(fp,
|
||||
sp->s_color[0],
|
||||
sp->s_color[1],
|
||||
sp->s_color[2]);
|
||||
pl_3line(fp,
|
||||
(int)(start[X] * DG_GED_MAX),
|
||||
(int)(start[Y] * DG_GED_MAX),
|
||||
(int)(start[Z] * DG_GED_MAX),
|
||||
(int)(fin[X] * DG_GED_MAX),
|
||||
(int)(fin[Y] * DG_GED_MAX),
|
||||
(int)(fin[Z] * DG_GED_MAX));
|
||||
} else {
|
||||
pl_line(fp,
|
||||
(int)(start[0] * DG_GED_MAX),
|
||||
(int)(start[1] * DG_GED_MAX),
|
||||
(int)(fin[0] * DG_GED_MAX),
|
||||
(int)(fin[1] * DG_GED_MAX));
|
||||
gdlp = BU_LIST_NEXT(ged_display_list, &gedp->ged_gdp->gd_headDisplay);
|
||||
while (BU_LIST_NOT_HEAD(gdlp, &gedp->ged_gdp->gd_headDisplay)) {
|
||||
next_gdlp = BU_LIST_PNEXT(ged_display_list, gdlp);
|
||||
|
||||
FOR_ALL_SOLIDS(sp, &gdlp->gdl_headSolid) {
|
||||
if (Dashing != sp->s_soldash) {
|
||||
if (sp->s_soldash)
|
||||
pl_linmod(fp, "dotdashed");
|
||||
else
|
||||
pl_linmod(fp, "solid");
|
||||
Dashing = sp->s_soldash;
|
||||
}
|
||||
for (BU_LIST_FOR(vp, bn_vlist, &(sp->s_vlist))) {
|
||||
register int i;
|
||||
register int nused = vp->nused;
|
||||
register int *cmd = vp->cmd;
|
||||
register point_t *pt = vp->pt;
|
||||
for (i = 0; i < nused; i++, cmd++, pt++) {
|
||||
switch (*cmd) {
|
||||
case BN_VLIST_POLY_START:
|
||||
case BN_VLIST_POLY_VERTNORM:
|
||||
continue;
|
||||
case BN_VLIST_POLY_MOVE:
|
||||
case BN_VLIST_LINE_MOVE:
|
||||
/* Move, not draw */
|
||||
MAT4X3PNT(last, gedp->ged_gvp->gv_model2view, *pt);
|
||||
continue;
|
||||
case BN_VLIST_POLY_DRAW:
|
||||
case BN_VLIST_POLY_END:
|
||||
case BN_VLIST_LINE_DRAW:
|
||||
/* draw */
|
||||
MAT4X3PNT(fin, gedp->ged_gvp->gv_model2view, *pt);
|
||||
VMOVE(start, last);
|
||||
VMOVE(last, fin);
|
||||
break;
|
||||
}
|
||||
if (ged_vclip(start, fin, clipmin, clipmax) == 0)
|
||||
continue;
|
||||
|
||||
if (Three_D) {
|
||||
/* Could check for differences from last color */
|
||||
pl_color(fp,
|
||||
sp->s_color[0],
|
||||
sp->s_color[1],
|
||||
sp->s_color[2]);
|
||||
pl_3line(fp,
|
||||
(int)(start[X] * DG_GED_MAX),
|
||||
(int)(start[Y] * DG_GED_MAX),
|
||||
(int)(start[Z] * DG_GED_MAX),
|
||||
(int)(fin[X] * DG_GED_MAX),
|
||||
(int)(fin[Y] * DG_GED_MAX),
|
||||
(int)(fin[Z] * DG_GED_MAX));
|
||||
} else {
|
||||
pl_line(fp,
|
||||
(int)(start[0] * DG_GED_MAX),
|
||||
(int)(start[1] * DG_GED_MAX),
|
||||
(int)(fin[0] * DG_GED_MAX),
|
||||
(int)(fin[1] * DG_GED_MAX));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
gdlp = next_gdlp;
|
||||
}
|
||||
out:
|
||||
if (is_pipe)
|
||||
|
||||
+11
-2
@@ -281,6 +281,8 @@ ged_draw_png_solid(struct ged *gedp, unsigned char **image, struct solid *sp, ma
|
||||
static void
|
||||
ged_draw_png_body(struct ged *gedp, unsigned char **image)
|
||||
{
|
||||
register struct ged_display_list *gdlp;
|
||||
register struct ged_display_list *next_gdlp;
|
||||
mat_t new;
|
||||
matp_t mat;
|
||||
mat_t perspective_mat;
|
||||
@@ -309,8 +311,15 @@ ged_draw_png_body(struct ged *gedp, unsigned char **image)
|
||||
mat = new;
|
||||
}
|
||||
|
||||
FOR_ALL_SOLIDS(sp, &gedp->ged_gdp->gd_headSolid) {
|
||||
ged_draw_png_solid(gedp, image, sp, mat);
|
||||
gdlp = BU_LIST_NEXT(ged_display_list, &gedp->ged_gdp->gd_headDisplay);
|
||||
while (BU_LIST_NOT_HEAD(gdlp, &gedp->ged_gdp->gd_headDisplay)) {
|
||||
next_gdlp = BU_LIST_PNEXT(ged_display_list, gdlp);
|
||||
|
||||
FOR_ALL_SOLIDS(sp, &gdlp->gdl_headSolid) {
|
||||
ged_draw_png_solid(gedp, image, sp, mat);
|
||||
}
|
||||
|
||||
gdlp = next_gdlp;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -133,9 +133,8 @@ ged_cm_end(int argc, char **argv)
|
||||
av[1] = NULL;
|
||||
|
||||
(void)ged_zap(ged_current_gedp, 1, av );
|
||||
ged_eraseobjpath(ged_current_gedp, ged_current_gedp->ged_gdp->gd_rt_cmd_len, (const char **)ged_current_gedp->ged_gdp->gd_rt_cmd, LOOKUP_QUIET, 0);
|
||||
ged_drawtrees(ged_current_gedp, ged_current_gedp->ged_gdp->gd_rt_cmd_len, (const char **)ged_current_gedp->ged_gdp->gd_rt_cmd, preview_mode, (struct ged_client_data *)0);
|
||||
ged_color_soltab((struct solid *)&ged_current_gedp->ged_gdp->gd_headSolid);
|
||||
ged_color_soltab(&ged_current_gedp->ged_gdp->gd_headDisplay);
|
||||
}
|
||||
|
||||
if (ged_current_gedp->ged_refresh_handler != GED_REFRESH_CALLBACK_PTR_NULL)
|
||||
|
||||
+11
-2
@@ -233,6 +233,8 @@ ged_draw_ps_solid(struct ged *gedp, FILE *fp, struct solid *sp, matp_t psmat)
|
||||
static void
|
||||
ged_draw_ps_body(struct ged *gedp, FILE *fp)
|
||||
{
|
||||
register struct ged_display_list *gdlp;
|
||||
register struct ged_display_list *next_gdlp;
|
||||
mat_t new;
|
||||
matp_t mat;
|
||||
mat_t perspective_mat;
|
||||
@@ -261,8 +263,15 @@ ged_draw_ps_body(struct ged *gedp, FILE *fp)
|
||||
mat = new;
|
||||
}
|
||||
|
||||
FOR_ALL_SOLIDS(sp, &gedp->ged_gdp->gd_headSolid) {
|
||||
ged_draw_ps_solid(gedp, fp, sp, mat);
|
||||
gdlp = BU_LIST_NEXT(ged_display_list, &gedp->ged_gdp->gd_headDisplay);
|
||||
while (BU_LIST_NOT_HEAD(gdlp, &gedp->ged_gdp->gd_headDisplay)) {
|
||||
next_gdlp = BU_LIST_PNEXT(ged_display_list, gdlp);
|
||||
|
||||
FOR_ALL_SOLIDS(sp, &gdlp->gdl_headSolid) {
|
||||
ged_draw_ps_solid(gedp, fp, sp, mat);
|
||||
}
|
||||
|
||||
gdlp = next_gdlp;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+85
-67
@@ -84,6 +84,8 @@ ged_report(struct ged *gedp, int argc, const char *argv[])
|
||||
static void
|
||||
ged_print_schain(struct ged *gedp, int lvl)
|
||||
{
|
||||
register struct ged_display_list *gdlp;
|
||||
register struct ged_display_list *next_gdlp;
|
||||
register struct solid *sp;
|
||||
register struct bn_vlist *vp;
|
||||
int nvlist;
|
||||
@@ -92,69 +94,76 @@ ged_print_schain(struct ged *gedp, int lvl)
|
||||
if (gedp->ged_wdbp->dbip == DBI_NULL)
|
||||
return;
|
||||
|
||||
FOR_ALL_SOLIDS(sp, &gedp->ged_gdp->gd_headSolid) {
|
||||
if (lvl <= -2) {
|
||||
/* print only leaves */
|
||||
bu_vls_printf(&gedp->ged_result_str, "%s ", LAST_SOLID(sp)->d_namep);
|
||||
continue;
|
||||
}
|
||||
gdlp = BU_LIST_NEXT(ged_display_list, &gedp->ged_gdp->gd_headDisplay);
|
||||
while (BU_LIST_NOT_HEAD(gdlp, &gedp->ged_gdp->gd_headDisplay)) {
|
||||
next_gdlp = BU_LIST_PNEXT(ged_display_list, gdlp);
|
||||
|
||||
db_path_to_vls(&gedp->ged_result_str, &sp->s_fullpath);
|
||||
FOR_ALL_SOLIDS(sp, &gdlp->gdl_headSolid) {
|
||||
if (lvl <= -2) {
|
||||
/* print only leaves */
|
||||
bu_vls_printf(&gedp->ged_result_str, "%s ", LAST_SOLID(sp)->d_namep);
|
||||
continue;
|
||||
}
|
||||
|
||||
if ((lvl != -1) && (sp->s_iflag == UP))
|
||||
bu_vls_printf(&gedp->ged_result_str, " ILLUM");
|
||||
db_path_to_vls(&gedp->ged_result_str, &sp->s_fullpath);
|
||||
|
||||
bu_vls_printf(&gedp->ged_result_str, "\n");
|
||||
if ((lvl != -1) && (sp->s_iflag == UP))
|
||||
bu_vls_printf(&gedp->ged_result_str, " ILLUM");
|
||||
|
||||
if (lvl <= 0)
|
||||
continue;
|
||||
bu_vls_printf(&gedp->ged_result_str, "\n");
|
||||
|
||||
/* convert to the local unit for printing */
|
||||
bu_vls_printf(&gedp->ged_result_str, " cent=(%.3f,%.3f,%.3f) sz=%g ",
|
||||
sp->s_center[X]*gedp->ged_wdbp->dbip->dbi_base2local,
|
||||
sp->s_center[Y]*gedp->ged_wdbp->dbip->dbi_base2local,
|
||||
sp->s_center[Z]*gedp->ged_wdbp->dbip->dbi_base2local,
|
||||
sp->s_size*gedp->ged_wdbp->dbip->dbi_base2local);
|
||||
bu_vls_printf(&gedp->ged_result_str, "reg=%d\n", sp->s_regionid);
|
||||
bu_vls_printf(&gedp->ged_result_str, " basecolor=(%d,%d,%d) color=(%d,%d,%d)%s%s%s\n",
|
||||
sp->s_basecolor[0],
|
||||
sp->s_basecolor[1],
|
||||
sp->s_basecolor[2],
|
||||
sp->s_color[0],
|
||||
sp->s_color[1],
|
||||
sp->s_color[2],
|
||||
sp->s_uflag?" U":"",
|
||||
sp->s_dflag?" D":"",
|
||||
sp->s_cflag?" C":"");
|
||||
|
||||
if (lvl <= 1)
|
||||
continue;
|
||||
|
||||
/* Print the actual vector list */
|
||||
nvlist = 0;
|
||||
npts = 0;
|
||||
for (BU_LIST_FOR(vp, bn_vlist, &(sp->s_vlist))) {
|
||||
register int i;
|
||||
register int nused = vp->nused;
|
||||
register int *cmd = vp->cmd;
|
||||
register point_t *pt = vp->pt;
|
||||
|
||||
BN_CK_VLIST(vp);
|
||||
nvlist++;
|
||||
npts += nused;
|
||||
|
||||
if (lvl <= 2)
|
||||
if (lvl <= 0)
|
||||
continue;
|
||||
|
||||
for (i = 0; i < nused; i++, cmd++, pt++) {
|
||||
bu_vls_printf(&gedp->ged_result_str, " %s (%g, %g, %g)\n",
|
||||
rt_vlist_cmd_descriptions[*cmd],
|
||||
V3ARGS(*pt));
|
||||
/* convert to the local unit for printing */
|
||||
bu_vls_printf(&gedp->ged_result_str, " cent=(%.3f,%.3f,%.3f) sz=%g ",
|
||||
sp->s_center[X]*gedp->ged_wdbp->dbip->dbi_base2local,
|
||||
sp->s_center[Y]*gedp->ged_wdbp->dbip->dbi_base2local,
|
||||
sp->s_center[Z]*gedp->ged_wdbp->dbip->dbi_base2local,
|
||||
sp->s_size*gedp->ged_wdbp->dbip->dbi_base2local);
|
||||
bu_vls_printf(&gedp->ged_result_str, "reg=%d\n", sp->s_regionid);
|
||||
bu_vls_printf(&gedp->ged_result_str, " basecolor=(%d,%d,%d) color=(%d,%d,%d)%s%s%s\n",
|
||||
sp->s_basecolor[0],
|
||||
sp->s_basecolor[1],
|
||||
sp->s_basecolor[2],
|
||||
sp->s_color[0],
|
||||
sp->s_color[1],
|
||||
sp->s_color[2],
|
||||
sp->s_uflag?" U":"",
|
||||
sp->s_dflag?" D":"",
|
||||
sp->s_cflag?" C":"");
|
||||
|
||||
if (lvl <= 1)
|
||||
continue;
|
||||
|
||||
/* Print the actual vector list */
|
||||
nvlist = 0;
|
||||
npts = 0;
|
||||
for (BU_LIST_FOR(vp, bn_vlist, &(sp->s_vlist))) {
|
||||
register int i;
|
||||
register int nused = vp->nused;
|
||||
register int *cmd = vp->cmd;
|
||||
register point_t *pt = vp->pt;
|
||||
|
||||
BN_CK_VLIST(vp);
|
||||
nvlist++;
|
||||
npts += nused;
|
||||
|
||||
if (lvl <= 2)
|
||||
continue;
|
||||
|
||||
for (i = 0; i < nused; i++, cmd++, pt++) {
|
||||
bu_vls_printf(&gedp->ged_result_str, " %s (%g, %g, %g)\n",
|
||||
rt_vlist_cmd_descriptions[*cmd],
|
||||
V3ARGS(*pt));
|
||||
}
|
||||
}
|
||||
|
||||
bu_vls_printf(&gedp->ged_result_str, " %d vlist structures, %d pts\n", nvlist, npts);
|
||||
bu_vls_printf(&gedp->ged_result_str, " %d pts (via rt_ck_vlist)\n", rt_ck_vlist(&(sp->s_vlist)));
|
||||
}
|
||||
|
||||
bu_vls_printf(&gedp->ged_result_str, " %d vlist structures, %d pts\n", nvlist, npts);
|
||||
bu_vls_printf(&gedp->ged_result_str, " %d pts (via rt_ck_vlist)\n", rt_ck_vlist(&(sp->s_vlist)));
|
||||
gdlp = next_gdlp;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -168,30 +177,39 @@ ged_print_schain(struct ged *gedp, int lvl)
|
||||
static void
|
||||
ged_print_schain_vlcmds(struct ged *gedp)
|
||||
{
|
||||
register struct ged_display_list *gdlp;
|
||||
register struct ged_display_list *next_gdlp;
|
||||
register struct solid *sp;
|
||||
register struct bn_vlist *vp;
|
||||
|
||||
if (gedp->ged_wdbp->dbip == DBI_NULL)
|
||||
return;
|
||||
|
||||
FOR_ALL_SOLIDS(sp, &gedp->ged_gdp->gd_headSolid) {
|
||||
bu_vls_printf(&gedp->ged_result_str, "-1 %d %d %d\n",
|
||||
sp->s_color[0],
|
||||
sp->s_color[1],
|
||||
sp->s_color[2]);
|
||||
gdlp = BU_LIST_NEXT(ged_display_list, &gedp->ged_gdp->gd_headDisplay);
|
||||
while (BU_LIST_NOT_HEAD(gdlp, &gedp->ged_gdp->gd_headDisplay)) {
|
||||
next_gdlp = BU_LIST_PNEXT(ged_display_list, gdlp);
|
||||
|
||||
/* Print the actual vector list */
|
||||
for (BU_LIST_FOR(vp, bn_vlist, &(sp->s_vlist))) {
|
||||
register int i;
|
||||
register int nused = vp->nused;
|
||||
register int *cmd = vp->cmd;
|
||||
register point_t *pt = vp->pt;
|
||||
FOR_ALL_SOLIDS(sp, &gdlp->gdl_headSolid) {
|
||||
bu_vls_printf(&gedp->ged_result_str, "-1 %d %d %d\n",
|
||||
sp->s_color[0],
|
||||
sp->s_color[1],
|
||||
sp->s_color[2]);
|
||||
|
||||
BN_CK_VLIST(vp);
|
||||
/* Print the actual vector list */
|
||||
for (BU_LIST_FOR(vp, bn_vlist, &(sp->s_vlist))) {
|
||||
register int i;
|
||||
register int nused = vp->nused;
|
||||
register int *cmd = vp->cmd;
|
||||
register point_t *pt = vp->pt;
|
||||
|
||||
for (i = 0; i < nused; i++, cmd++, pt++)
|
||||
bu_vls_printf(&gedp->ged_result_str, "%d %g %g %g\n", *cmd, V3ARGS(*pt));
|
||||
BN_CK_VLIST(vp);
|
||||
|
||||
for (i = 0; i < nused; i++, cmd++, pt++)
|
||||
bu_vls_printf(&gedp->ged_result_str, "%d %g %g %g\n", *cmd, V3ARGS(*pt));
|
||||
}
|
||||
}
|
||||
|
||||
gdlp = next_gdlp;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+68
-47
@@ -285,6 +285,8 @@ ged_rt_write(struct ged *gedp,
|
||||
FILE *fp,
|
||||
vect_t eye_model)
|
||||
{
|
||||
register struct ged_display_list *gdlp;
|
||||
register struct ged_display_list *next_gdlp;
|
||||
register int i;
|
||||
quat_t quat;
|
||||
register struct solid *sp;
|
||||
@@ -296,28 +298,51 @@ ged_rt_write(struct ged *gedp,
|
||||
eye_model[X], eye_model[Y], eye_model[Z] );
|
||||
|
||||
(void)fprintf(fp, "start 0; clean;\n");
|
||||
FOR_ALL_SOLIDS (sp, &gedp->ged_gdp->gd_headSolid) {
|
||||
for (i=0;i<sp->s_fullpath.fp_len;i++) {
|
||||
DB_FULL_PATH_GET(&sp->s_fullpath, i)->d_flags &= ~DIR_USED;
|
||||
}
|
||||
}
|
||||
FOR_ALL_SOLIDS(sp, &gedp->ged_gdp->gd_headSolid) {
|
||||
for (i=0; i<sp->s_fullpath.fp_len; i++ ) {
|
||||
if (!(DB_FULL_PATH_GET(&sp->s_fullpath, i)->d_flags & DIR_USED)) {
|
||||
register struct animate *anp;
|
||||
for (anp = DB_FULL_PATH_GET(&sp->s_fullpath, i)->d_animate; anp;
|
||||
anp=anp->an_forw) {
|
||||
db_write_anim(fp, anp);
|
||||
}
|
||||
DB_FULL_PATH_GET(&sp->s_fullpath, i)->d_flags |= DIR_USED;
|
||||
|
||||
gdlp = BU_LIST_NEXT(ged_display_list, &gedp->ged_gdp->gd_headDisplay);
|
||||
while (BU_LIST_NOT_HEAD(gdlp, &gedp->ged_gdp->gd_headDisplay)) {
|
||||
next_gdlp = BU_LIST_PNEXT(ged_display_list, gdlp);
|
||||
|
||||
FOR_ALL_SOLIDS(sp, &gdlp->gdl_headSolid) {
|
||||
for (i=0;i<sp->s_fullpath.fp_len;i++) {
|
||||
DB_FULL_PATH_GET(&sp->s_fullpath, i)->d_flags &= ~DIR_USED;
|
||||
}
|
||||
}
|
||||
|
||||
gdlp = next_gdlp;
|
||||
}
|
||||
|
||||
FOR_ALL_SOLIDS(sp, &gedp->ged_gdp->gd_headSolid) {
|
||||
for (i=0;i< sp->s_fullpath.fp_len;i++) {
|
||||
DB_FULL_PATH_GET(&sp->s_fullpath, i)->d_flags &= ~DIR_USED;
|
||||
gdlp = BU_LIST_NEXT(ged_display_list, &gedp->ged_gdp->gd_headDisplay);
|
||||
while (BU_LIST_NOT_HEAD(gdlp, &gedp->ged_gdp->gd_headDisplay)) {
|
||||
next_gdlp = BU_LIST_PNEXT(ged_display_list, gdlp);
|
||||
|
||||
FOR_ALL_SOLIDS(sp, &gdlp->gdl_headSolid) {
|
||||
for (i=0; i<sp->s_fullpath.fp_len; i++ ) {
|
||||
if (!(DB_FULL_PATH_GET(&sp->s_fullpath, i)->d_flags & DIR_USED)) {
|
||||
register struct animate *anp;
|
||||
for (anp = DB_FULL_PATH_GET(&sp->s_fullpath, i)->d_animate; anp;
|
||||
anp=anp->an_forw) {
|
||||
db_write_anim(fp, anp);
|
||||
}
|
||||
DB_FULL_PATH_GET(&sp->s_fullpath, i)->d_flags |= DIR_USED;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
gdlp = next_gdlp;
|
||||
}
|
||||
|
||||
gdlp = BU_LIST_NEXT(ged_display_list, &gedp->ged_gdp->gd_headDisplay);
|
||||
while (BU_LIST_NOT_HEAD(gdlp, &gedp->ged_gdp->gd_headDisplay)) {
|
||||
next_gdlp = BU_LIST_PNEXT(ged_display_list, gdlp);
|
||||
|
||||
FOR_ALL_SOLIDS(sp, &gdlp->gdl_headSolid) {
|
||||
for (i=0;i< sp->s_fullpath.fp_len;i++) {
|
||||
DB_FULL_PATH_GET(&sp->s_fullpath, i)->d_flags &= ~DIR_USED;
|
||||
}
|
||||
}
|
||||
|
||||
gdlp = next_gdlp;
|
||||
}
|
||||
(void)fprintf(fp, "end;\n");
|
||||
}
|
||||
@@ -436,35 +461,21 @@ ged_build_tops(struct ged *gedp,
|
||||
char **start,
|
||||
register char **end)
|
||||
{
|
||||
struct ged_display_list *gdlp;
|
||||
register char **vp = start;
|
||||
register struct solid *sp;
|
||||
|
||||
/*
|
||||
* Find all unique top-level entries.
|
||||
* Mark ones already done with s_flag == UP
|
||||
*/
|
||||
FOR_ALL_SOLIDS(sp, &gedp->ged_gdp->gd_headSolid)
|
||||
sp->s_flag = DOWN;
|
||||
FOR_ALL_SOLIDS(sp, &gedp->ged_gdp->gd_headSolid) {
|
||||
register struct solid *forw;
|
||||
struct directory *dp = FIRST_SOLID(sp);
|
||||
|
||||
if (sp->s_flag == UP)
|
||||
for (BU_LIST_FOR(gdlp, ged_display_list, &gedp->ged_gdp->gd_headDisplay)) {
|
||||
if (gdlp->gdl_dp->d_addr == RT_DIR_PHONY_ADDR)
|
||||
continue;
|
||||
if (dp->d_addr == RT_DIR_PHONY_ADDR)
|
||||
continue; /* Ignore overlays, predictor, etc */
|
||||
|
||||
if (vp < end)
|
||||
*vp++ = dp->d_namep;
|
||||
*vp++ = bu_vls_addr(&gdlp->gdl_path);
|
||||
else {
|
||||
bu_vls_printf(&gedp->ged_result_str, "libged: ran out of command vector space at %s\n", dp->d_namep);
|
||||
bu_vls_printf(&gedp->ged_result_str, "libged: ran out of command vector space at %s\n", gdlp->gdl_dp->d_namep);
|
||||
break;
|
||||
}
|
||||
sp->s_flag = UP;
|
||||
for (BU_LIST_PFOR(forw, sp, solid, &gedp->ged_gdp->gd_headSolid)) {
|
||||
if (FIRST_SOLID(forw) == dp)
|
||||
forw->s_flag = UP;
|
||||
}
|
||||
}
|
||||
|
||||
*vp = (char *) 0;
|
||||
return vp-start;
|
||||
}
|
||||
@@ -481,6 +492,8 @@ ged_rt_set_eye_model(struct ged *gedp,
|
||||
MAT4X3PNT(eye_model, gedp->ged_gvp->gv_view2model, temp);
|
||||
} else {
|
||||
/* not doing zclipping, so back out of geometry */
|
||||
register struct ged_display_list *gdlp;
|
||||
register struct ged_display_list *next_gdlp;
|
||||
register struct solid *sp;
|
||||
register int i;
|
||||
vect_t direction;
|
||||
@@ -495,16 +508,24 @@ ged_rt_set_eye_model(struct ged *gedp,
|
||||
extremum[1][i] = -INFINITY;
|
||||
}
|
||||
|
||||
FOR_ALL_SOLIDS (sp, &gedp->ged_gdp->gd_headSolid) {
|
||||
minus[X] = sp->s_center[X] - sp->s_size;
|
||||
minus[Y] = sp->s_center[Y] - sp->s_size;
|
||||
minus[Z] = sp->s_center[Z] - sp->s_size;
|
||||
VMIN( extremum[0], minus );
|
||||
plus[X] = sp->s_center[X] + sp->s_size;
|
||||
plus[Y] = sp->s_center[Y] + sp->s_size;
|
||||
plus[Z] = sp->s_center[Z] + sp->s_size;
|
||||
VMAX( extremum[1], plus );
|
||||
gdlp = BU_LIST_NEXT(ged_display_list, &gedp->ged_gdp->gd_headDisplay);
|
||||
while (BU_LIST_NOT_HEAD(gdlp, &gedp->ged_gdp->gd_headDisplay)) {
|
||||
next_gdlp = BU_LIST_PNEXT(ged_display_list, gdlp);
|
||||
|
||||
FOR_ALL_SOLIDS(sp, &gdlp->gdl_headSolid) {
|
||||
minus[X] = sp->s_center[X] - sp->s_size;
|
||||
minus[Y] = sp->s_center[Y] - sp->s_size;
|
||||
minus[Z] = sp->s_center[Z] - sp->s_size;
|
||||
VMIN( extremum[0], minus );
|
||||
plus[X] = sp->s_center[X] + sp->s_size;
|
||||
plus[Y] = sp->s_center[Y] + sp->s_size;
|
||||
plus[Z] = sp->s_center[Z] + sp->s_size;
|
||||
VMAX( extremum[1], plus );
|
||||
}
|
||||
|
||||
gdlp = next_gdlp;
|
||||
}
|
||||
|
||||
VMOVEN(direction, gedp->ged_gvp->gv_rotation + 8, 3);
|
||||
for (i = 0; i < 3; ++i)
|
||||
if (NEAR_ZERO(direction[i], 1e-10))
|
||||
|
||||
+22
-4
@@ -369,6 +369,8 @@ ged_rtcheck(struct ged *gedp, int argc, const char *argv[])
|
||||
static void
|
||||
ged_rtcheck_vector_handler(ClientData clientData, int mask)
|
||||
{
|
||||
register struct ged_display_list *gdlp;
|
||||
register struct ged_display_list *next_gdlp;
|
||||
int value;
|
||||
struct solid *sp;
|
||||
struct ged_rtcheck *rtcp = (struct ged_rtcheck *)clientData;
|
||||
@@ -381,8 +383,15 @@ ged_rtcheck_vector_handler(ClientData clientData, int mask)
|
||||
Tcl_DeleteFileHandler(rtcp->fd);
|
||||
fclose(rtcp->fp);
|
||||
|
||||
FOR_ALL_SOLIDS(sp, &rtcp->gedp->ged_gdp->gd_headSolid)
|
||||
sp->s_flag = DOWN;
|
||||
gdlp = BU_LIST_NEXT(ged_display_list, &rtcp->gedp->ged_gdp->gd_headDisplay);
|
||||
while (BU_LIST_NOT_HEAD(gdlp, &rtcp->gedp->ged_gdp->gd_headDisplay)) {
|
||||
next_gdlp = BU_LIST_PNEXT(ged_display_list, gdlp);
|
||||
|
||||
FOR_ALL_SOLIDS(sp, &gdlp->gdl_headSolid)
|
||||
sp->s_flag = DOWN;
|
||||
|
||||
gdlp = next_gdlp;
|
||||
}
|
||||
|
||||
/* Add overlay */
|
||||
ged_cvt_vlblock_to_solids(rtcp->gedp, rtcp->vbp, "OVERLAPS", 0);
|
||||
@@ -447,6 +456,8 @@ ged_rtcheck_output_handler(ClientData clientData, int mask)
|
||||
void
|
||||
ged_rtcheck_vector_handler(ClientData clientData, int mask)
|
||||
{
|
||||
register struct ged_display_list *gdlp;
|
||||
register struct ged_display_list *next_gdlp;
|
||||
int value;
|
||||
struct solid *sp;
|
||||
struct ged_rtcheck *rtcp = (struct ged_rtcheck *)clientData;
|
||||
@@ -458,8 +469,15 @@ ged_rtcheck_vector_handler(ClientData clientData, int mask)
|
||||
(ClientData)rtcp);
|
||||
Tcl_Close(rtcp->interp, rtcp->chan);
|
||||
|
||||
FOR_ALL_SOLIDS(sp, &rtcp->gedp->ged_gdp->gd_headSolid)
|
||||
sp->s_flag = DOWN;
|
||||
gdlp = BU_LIST_NEXT(ged_display_list, &rtcp->gedp->ged_gdp->gd_headDisplay);
|
||||
while (BU_LIST_NOT_HEAD(gdlp, &rtcp->gedp->ged_gdp->gd_headDisplay)) {
|
||||
next_gdlp = BU_LIST_PNEXT(ged_display_list, gdlp);
|
||||
|
||||
FOR_ALL_SOLIDS(sp, &gdlp->gdl_headSolid)
|
||||
sp->s_flag = DOWN;
|
||||
|
||||
gdlp = next_gdlp;
|
||||
}
|
||||
|
||||
/* Add overlay */
|
||||
ged_cvt_vlblock_to_solids(rtcp->gedp, rtcp->vbp, "OVERLAPS", 0);
|
||||
|
||||
+8
-21
@@ -41,6 +41,8 @@ static char *ged_basename_without_suffix(register const char *p1, register const
|
||||
int
|
||||
ged_saveview(struct ged *gedp, int argc, const char *argv[])
|
||||
{
|
||||
register struct ged_display_list *gdlp;
|
||||
register struct ged_display_list *next_gdlp;
|
||||
register struct solid *sp;
|
||||
register int i;
|
||||
register FILE *fp;
|
||||
@@ -134,25 +136,13 @@ ged_saveview(struct ged *gedp, int argc, const char *argv[])
|
||||
}
|
||||
(void)fprintf(fp, " %s\\\n ", inputg);
|
||||
|
||||
/* Find all unique top-level entries.
|
||||
* Mark ones already done with s_wflag == UP
|
||||
*/
|
||||
FOR_ALL_SOLIDS(sp, &gedp->ged_gdp->gd_headSolid)
|
||||
sp->s_wflag = DOWN;
|
||||
FOR_ALL_SOLIDS(sp, &gedp->ged_gdp->gd_headSolid) {
|
||||
register struct solid *forw; /* XXX */
|
||||
struct directory *dp = FIRST_SOLID(sp);
|
||||
|
||||
if ( sp->s_wflag == UP )
|
||||
continue;
|
||||
if (dp->d_addr == RT_DIR_PHONY_ADDR) continue;
|
||||
(void)fprintf(fp, "'%s' ", dp->d_namep);
|
||||
sp->s_wflag = UP;
|
||||
for (BU_LIST_PFOR(forw, sp, solid, &gedp->ged_gdp->gd_headSolid)) {
|
||||
if ( FIRST_SOLID(forw) == dp )
|
||||
forw->s_wflag = UP;
|
||||
}
|
||||
gdlp = BU_LIST_NEXT(ged_display_list, &gedp->ged_gdp->gd_headDisplay);
|
||||
while (BU_LIST_NOT_HEAD(gdlp, &gedp->ged_gdp->gd_headDisplay)) {
|
||||
next_gdlp = BU_LIST_PNEXT(ged_display_list, gdlp);
|
||||
(void)fprintf(fp, "'%s' ", bu_vls_addr(&gdlp->gdl_path));
|
||||
gdlp = next_gdlp;
|
||||
}
|
||||
|
||||
(void)fprintf(fp, "\\\n 2>> %s\\\n", outlog);
|
||||
(void)fprintf(fp, " <<EOF\n");
|
||||
|
||||
@@ -166,9 +156,6 @@ ged_saveview(struct ged *gedp, int argc, const char *argv[])
|
||||
(void)fprintf(fp, "\nEOF\n");
|
||||
(void)fclose( fp );
|
||||
|
||||
FOR_ALL_SOLIDS(sp, &gedp->ged_gdp->gd_headSolid)
|
||||
sp->s_wflag = DOWN;
|
||||
|
||||
return GED_OK;
|
||||
}
|
||||
|
||||
|
||||
@@ -42,6 +42,8 @@
|
||||
int
|
||||
ged_set_transparency(struct ged *gedp, int argc, const char *argv[])
|
||||
{
|
||||
register struct ged_display_list *gdlp;
|
||||
register struct ged_display_list *next_gdlp;
|
||||
register struct solid *sp;
|
||||
int i;
|
||||
struct directory **dpp;
|
||||
@@ -77,19 +79,26 @@ ged_set_transparency(struct ged *gedp, int argc, const char *argv[])
|
||||
return GED_OK;
|
||||
}
|
||||
|
||||
FOR_ALL_SOLIDS(sp, &gedp->ged_gdp->gd_headSolid) {
|
||||
for (i = 0, tmp_dpp = dpp;
|
||||
i < sp->s_fullpath.fp_len && *tmp_dpp != DIR_NULL;
|
||||
++i, ++tmp_dpp) {
|
||||
if (sp->s_fullpath.fp_names[i] != *tmp_dpp)
|
||||
break;
|
||||
gdlp = BU_LIST_NEXT(ged_display_list, &gedp->ged_gdp->gd_headDisplay);
|
||||
while (BU_LIST_NOT_HEAD(gdlp, &gedp->ged_gdp->gd_headDisplay)) {
|
||||
next_gdlp = BU_LIST_PNEXT(ged_display_list, gdlp);
|
||||
|
||||
FOR_ALL_SOLIDS(sp, &gdlp->gdl_headSolid) {
|
||||
for (i = 0, tmp_dpp = dpp;
|
||||
i < sp->s_fullpath.fp_len && *tmp_dpp != DIR_NULL;
|
||||
++i, ++tmp_dpp) {
|
||||
if (sp->s_fullpath.fp_names[i] != *tmp_dpp)
|
||||
break;
|
||||
}
|
||||
|
||||
if (*tmp_dpp != DIR_NULL)
|
||||
continue;
|
||||
|
||||
/* found a match */
|
||||
sp->s_transparency = transparency;
|
||||
}
|
||||
|
||||
if (*tmp_dpp != DIR_NULL)
|
||||
continue;
|
||||
|
||||
/* found a match */
|
||||
sp->s_transparency = transparency;
|
||||
gdlp = next_gdlp;
|
||||
}
|
||||
|
||||
if (dpp != (struct directory **)NULL)
|
||||
|
||||
@@ -101,19 +101,7 @@ ged_solids_on_ray(struct ged *gedp, int argc, const char *argv[])
|
||||
extremum[0][i] = INFINITY;
|
||||
extremum[1][i] = -INFINITY;
|
||||
}
|
||||
#if 0
|
||||
FOR_ALL_SOLIDS (sp, &gedp->ged_gdp->gd_headSolid)
|
||||
{
|
||||
minus[X] = sp->s_center[X] - sp->s_size;
|
||||
minus[Y] = sp->s_center[Y] - sp->s_size;
|
||||
minus[Z] = sp->s_center[Z] - sp->s_size;
|
||||
VMIN(extremum[0], minus);
|
||||
plus[X] = sp->s_center[X] + sp->s_size;
|
||||
plus[Y] = sp->s_center[Y] + sp->s_size;
|
||||
plus[Z] = sp->s_center[Z] + sp->s_size;
|
||||
VMAX(extremum[1], plus);
|
||||
}
|
||||
#endif
|
||||
|
||||
VMOVEN(ray_dir, gedp->ged_gvp->gv_rotation + 8, 3);
|
||||
VSCALE(ray_dir, ray_dir, -1.0);
|
||||
for (i = 0; i < 3; ++i)
|
||||
|
||||
@@ -589,9 +589,6 @@ ged_vdraw_send(struct ged *gedp, int argc, const char *argv[])
|
||||
&(gedp->ged_gdp->gd_currVHead->vdc_vhd),
|
||||
gedp->ged_gdp->gd_currVHead->vdc_rgb,
|
||||
1, 0.0, 0);
|
||||
#if 0
|
||||
dgo_notify(dgop, interp);
|
||||
#endif
|
||||
|
||||
bu_vls_printf(&gedp->ged_result_str, "%d", index);
|
||||
|
||||
|
||||
+5
-21
@@ -37,7 +37,7 @@
|
||||
int
|
||||
ged_who(struct ged *gedp, int argc, const char *argv[])
|
||||
{
|
||||
register struct solid *sp;
|
||||
register struct ged_display_list *gdlp;
|
||||
int skip_real, skip_phony;
|
||||
static const char *usage = "[r(eal)|p(hony)|b(oth)]";
|
||||
|
||||
@@ -75,31 +75,15 @@ ged_who(struct ged *gedp, int argc, const char *argv[])
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Find all unique top-level entries.
|
||||
* Mark ones already done with s_flag == UP
|
||||
*/
|
||||
FOR_ALL_SOLIDS(sp, &gedp->ged_gdp->gd_headSolid)
|
||||
sp->s_flag = DOWN;
|
||||
FOR_ALL_SOLIDS(sp, &gedp->ged_gdp->gd_headSolid) {
|
||||
register struct solid *forw; /* XXX */
|
||||
|
||||
if (sp->s_flag == UP)
|
||||
continue;
|
||||
if (FIRST_SOLID(sp)->d_addr == RT_DIR_PHONY_ADDR) {
|
||||
for (BU_LIST_FOR(gdlp, ged_display_list, &gedp->ged_gdp->gd_headDisplay)) {
|
||||
if (gdlp->gdl_dp->d_addr == RT_DIR_PHONY_ADDR) {
|
||||
if (skip_phony) continue;
|
||||
} else {
|
||||
if (skip_real) continue;
|
||||
}
|
||||
bu_vls_printf(&gedp->ged_result_str, "%s ", FIRST_SOLID(sp)->d_namep);
|
||||
sp->s_flag = UP;
|
||||
FOR_REST_OF_SOLIDS(forw, sp, &gedp->ged_gdp->gd_headSolid) {
|
||||
if (FIRST_SOLID(forw) == FIRST_SOLID(sp))
|
||||
forw->s_flag = UP;
|
||||
}
|
||||
|
||||
bu_vls_printf(&gedp->ged_result_str, "%s ", bu_vls_addr(&gdlp->gdl_path));
|
||||
}
|
||||
FOR_ALL_SOLIDS(sp, &gedp->ged_gdp->gd_headSolid)
|
||||
sp->s_flag = DOWN;
|
||||
|
||||
return GED_OK;
|
||||
}
|
||||
|
||||
+16
-12
@@ -44,6 +44,7 @@ ged_zap(struct ged *gedp, int argc, const char *argv[])
|
||||
{
|
||||
register struct solid *sp;
|
||||
register struct solid *nsp;
|
||||
register struct ged_display_list *gdlp;
|
||||
struct directory *dp;
|
||||
|
||||
GED_CHECK_DATABASE_OPEN(gedp, GED_ERROR);
|
||||
@@ -58,21 +59,24 @@ ged_zap(struct ged *gedp, int argc, const char *argv[])
|
||||
return GED_ERROR;
|
||||
}
|
||||
|
||||
sp = BU_LIST_NEXT(solid, &gedp->ged_gdp->gd_headSolid);
|
||||
while (BU_LIST_NOT_HEAD(sp, &gedp->ged_gdp->gd_headSolid)) {
|
||||
dp = FIRST_SOLID(sp);
|
||||
RT_CK_DIR(dp);
|
||||
if (dp->d_addr == RT_DIR_PHONY_ADDR) {
|
||||
if (db_dirdelete(gedp->ged_wdbp->dbip, dp) < 0) {
|
||||
bu_vls_printf(&gedp->ged_result_str, "ged_zap: db_dirdelete failed\n");
|
||||
while (BU_LIST_WHILE(gdlp, ged_display_list, &gedp->ged_gdp->gd_headDisplay)) {
|
||||
while (BU_LIST_WHILE(sp, solid, &gdlp->gdl_headSolid)) {
|
||||
dp = FIRST_SOLID(sp);
|
||||
RT_CK_DIR(dp);
|
||||
if (dp->d_addr == RT_DIR_PHONY_ADDR) {
|
||||
if (db_dirdelete(gedp->ged_wdbp->dbip, dp) < 0) {
|
||||
bu_vls_printf(&gedp->ged_result_str, "ged_zap: db_dirdelete failed\n");
|
||||
}
|
||||
}
|
||||
|
||||
BU_LIST_DEQUEUE(&sp->l);
|
||||
FREE_SOLID(sp, &FreeSolid.l);
|
||||
}
|
||||
|
||||
nsp = BU_LIST_PNEXT(solid, sp);
|
||||
BU_LIST_DEQUEUE(&sp->l);
|
||||
FREE_SOLID(sp, &FreeSolid.l);
|
||||
sp = nsp;
|
||||
}
|
||||
BU_LIST_DEQUEUE(&gdlp->l);
|
||||
bu_vls_free(&gdlp->gdl_path);
|
||||
free((void *)gdlp);
|
||||
}
|
||||
|
||||
return GED_OK;
|
||||
}
|
||||
|
||||
+36
-2
@@ -430,7 +430,8 @@ db_identical_full_paths(
|
||||
int
|
||||
db_full_path_subset(
|
||||
const struct db_full_path *a,
|
||||
const struct db_full_path *b )
|
||||
const struct db_full_path *b,
|
||||
const int skip_first)
|
||||
{
|
||||
register int i;
|
||||
|
||||
@@ -439,7 +440,12 @@ db_full_path_subset(
|
||||
|
||||
if ( b->fp_len > a->fp_len ) return 0;
|
||||
|
||||
for ( i=0; i < a->fp_len; i++ ) {
|
||||
if (skip_first)
|
||||
i = 1;
|
||||
else
|
||||
i = 0;
|
||||
|
||||
for (; i < a->fp_len; i++ ) {
|
||||
register int j;
|
||||
|
||||
if ( a->fp_names[i] != b->fp_names[0] ) continue;
|
||||
@@ -460,6 +466,34 @@ db_full_path_subset(
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* D B _ F U L L _ P A T H _ M A T C H _ T O P
|
||||
*
|
||||
* Returns -
|
||||
* 1 if 'a' matches the top part of 'b'
|
||||
* 0 if not.
|
||||
*
|
||||
* For example, /a/b matches both the top part of /a/b/c and /a/b.
|
||||
*/
|
||||
int
|
||||
db_full_path_match_top(
|
||||
const struct db_full_path *a,
|
||||
const struct db_full_path *b)
|
||||
{
|
||||
register int i;
|
||||
|
||||
RT_CK_FULL_PATH(a);
|
||||
RT_CK_FULL_PATH(b);
|
||||
|
||||
if ( a->fp_len > b->fp_len ) return 0;
|
||||
|
||||
for ( i=0; i < a->fp_len; i++ ) {
|
||||
if ( a->fp_names[i] != b->fp_names[i] ) return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* D B _ F U L L _ P A T H _ S E A R C H
|
||||
|
||||
+47
-24
@@ -511,7 +511,7 @@ static int go_view_func(struct ged *gedp,
|
||||
|
||||
/* Utility Functions */
|
||||
static void go_drawSolid(struct dm *dmp, struct solid *sp);
|
||||
static int go_drawSList(struct dm *dmp, struct bu_list *hsp);
|
||||
static int go_drawDList(struct dm *dmp, struct bu_list *hsp);
|
||||
|
||||
static int go_close_fbs(struct ged_dm_view *gdvp);
|
||||
static void go_fbs_callback();
|
||||
@@ -6135,54 +6135,77 @@ go_drawSolid(struct dm *dmp, struct solid *sp)
|
||||
DM_DRAW_VLIST(dmp, (struct bn_vlist *)&sp->s_vlist);
|
||||
}
|
||||
|
||||
/* Draw all solids in the list */
|
||||
/* Draw all display lists */
|
||||
static int
|
||||
go_drawSList(struct dm *dmp, struct bu_list *hsp)
|
||||
go_drawDList(struct dm *dmp, struct bu_list *hdlp)
|
||||
{
|
||||
register struct ged_display_list *gdlp;
|
||||
register struct ged_display_list *next_gdlp;
|
||||
struct solid *sp;
|
||||
int line_style = -1;
|
||||
|
||||
if (dmp->dm_transparency) {
|
||||
/* First, draw opaque stuff */
|
||||
FOR_ALL_SOLIDS(sp, hsp) {
|
||||
if (sp->s_transparency < 1.0)
|
||||
continue;
|
||||
gdlp = BU_LIST_NEXT(ged_display_list, hdlp);
|
||||
while (BU_LIST_NOT_HEAD(gdlp, hdlp)) {
|
||||
next_gdlp = BU_LIST_PNEXT(ged_display_list, gdlp);
|
||||
|
||||
if (line_style != sp->s_soldash) {
|
||||
line_style = sp->s_soldash;
|
||||
DM_SET_LINE_ATTR(dmp, dmp->dm_lineWidth, line_style);
|
||||
FOR_ALL_SOLIDS(sp, &gdlp->gdl_headSolid) {
|
||||
if (sp->s_transparency < 1.0)
|
||||
continue;
|
||||
|
||||
if (line_style != sp->s_soldash) {
|
||||
line_style = sp->s_soldash;
|
||||
DM_SET_LINE_ATTR(dmp, dmp->dm_lineWidth, line_style);
|
||||
}
|
||||
|
||||
go_drawSolid(dmp, sp);
|
||||
}
|
||||
|
||||
go_drawSolid(dmp, sp);
|
||||
gdlp = next_gdlp;
|
||||
}
|
||||
|
||||
/* disable write to depth buffer */
|
||||
DM_SET_DEPTH_MASK(dmp, 0);
|
||||
|
||||
/* Second, draw transparent stuff */
|
||||
FOR_ALL_SOLIDS(sp, hsp) {
|
||||
/* already drawn above */
|
||||
if (sp->s_transparency == 1.0)
|
||||
continue;
|
||||
gdlp = BU_LIST_NEXT(ged_display_list, hdlp);
|
||||
while (BU_LIST_NOT_HEAD(gdlp, hdlp)) {
|
||||
next_gdlp = BU_LIST_PNEXT(ged_display_list, gdlp);
|
||||
|
||||
if (line_style != sp->s_soldash) {
|
||||
line_style = sp->s_soldash;
|
||||
DM_SET_LINE_ATTR(dmp, dmp->dm_lineWidth, line_style);
|
||||
FOR_ALL_SOLIDS(sp, &gdlp->gdl_headSolid) {
|
||||
/* already drawn above */
|
||||
if (sp->s_transparency == 1.0)
|
||||
continue;
|
||||
|
||||
if (line_style != sp->s_soldash) {
|
||||
line_style = sp->s_soldash;
|
||||
DM_SET_LINE_ATTR(dmp, dmp->dm_lineWidth, line_style);
|
||||
}
|
||||
|
||||
go_drawSolid(dmp, sp);
|
||||
}
|
||||
|
||||
go_drawSolid(dmp, sp);
|
||||
gdlp = next_gdlp;
|
||||
}
|
||||
|
||||
/* re-enable write to depth buffer */
|
||||
DM_SET_DEPTH_MASK(dmp, 1);
|
||||
} else {
|
||||
FOR_ALL_SOLIDS(sp, hsp) {
|
||||
if (line_style != sp->s_soldash) {
|
||||
line_style = sp->s_soldash;
|
||||
DM_SET_LINE_ATTR(dmp, dmp->dm_lineWidth, line_style);
|
||||
gdlp = BU_LIST_NEXT(ged_display_list, hdlp);
|
||||
while (BU_LIST_NOT_HEAD(gdlp, hdlp)) {
|
||||
next_gdlp = BU_LIST_PNEXT(ged_display_list, gdlp);
|
||||
|
||||
FOR_ALL_SOLIDS(sp, &gdlp->gdl_headSolid) {
|
||||
if (line_style != sp->s_soldash) {
|
||||
line_style = sp->s_soldash;
|
||||
DM_SET_LINE_ATTR(dmp, dmp->dm_lineWidth, line_style);
|
||||
}
|
||||
|
||||
go_drawSolid(dmp, sp);
|
||||
}
|
||||
|
||||
go_drawSolid(dmp, sp);
|
||||
gdlp = next_gdlp;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6417,7 +6440,7 @@ go_draw(struct ged_dm_view *gdvp)
|
||||
}
|
||||
|
||||
DM_LOADMATRIX(gdvp->gdv_dmp, mat, 0);
|
||||
go_drawSList(gdvp->gdv_dmp, &gdvp->gdv_gop->go_gedp->ged_gdp->gd_headSolid);
|
||||
go_drawDList(gdvp->gdv_dmp, &gdvp->gdv_gop->go_gedp->ged_gdp->gd_headDisplay);
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
+13
-46
@@ -3501,49 +3501,6 @@ mesh_leaf(struct db_tree_state *tsp, struct db_full_path *pathp, struct rt_db_in
|
||||
|
||||
return curtree;
|
||||
}
|
||||
/**
|
||||
* B U I L D _ T O P S
|
||||
*
|
||||
* Build a command line vector of the tops of all objects in view.
|
||||
*/
|
||||
int
|
||||
build_tops(char **start, char **end)
|
||||
{
|
||||
register char **vp = start;
|
||||
register struct solid *sp;
|
||||
|
||||
/*
|
||||
* Find all unique top-level entries.
|
||||
* Mark ones already done with s_wflag == UP
|
||||
*/
|
||||
FOR_ALL_SOLIDS(sp, &gedp->ged_gdp->gd_headSolid) {
|
||||
sp->s_wflag = DOWN;
|
||||
}
|
||||
FOR_ALL_SOLIDS(sp, &gedp->ged_gdp->gd_headSolid) {
|
||||
register struct solid *forw;
|
||||
struct directory *dp = FIRST_SOLID(sp);
|
||||
|
||||
if ( sp->s_wflag == UP )
|
||||
continue;
|
||||
if ( dp->d_addr == RT_DIR_PHONY_ADDR )
|
||||
continue; /* Ignore overlays, predictor, etc */
|
||||
if ( vp < end )
|
||||
*vp++ = dp->d_namep;
|
||||
else {
|
||||
Tcl_AppendResult(interp, "mged: ran out of comand vector space at ",
|
||||
dp->d_namep, "\n", (char *)NULL);
|
||||
break;
|
||||
}
|
||||
sp->s_wflag = UP;
|
||||
for (BU_LIST_PFOR(forw, sp, solid, &gedp->ged_gdp->gd_headSolid)) {
|
||||
if ( FIRST_SOLID(forw) == dp )
|
||||
forw->s_wflag = UP;
|
||||
}
|
||||
}
|
||||
*vp = (char *) 0;
|
||||
return vp-start;
|
||||
}
|
||||
|
||||
|
||||
HIDDEN union tree *
|
||||
mesh_end_region (register struct db_tree_state *tsp, struct db_full_path *pathp, union tree *curtree, genptr_t client_data)
|
||||
@@ -3612,11 +3569,21 @@ f_jmesh(int argc, char **argv)
|
||||
name = argv[2];
|
||||
}
|
||||
|
||||
topc = build_tops(topv, topv+2000);
|
||||
topc = ged_build_tops(gedp, topv, topv+2000);
|
||||
{
|
||||
register struct ged_display_list *gdlp;
|
||||
register struct ged_display_list *next_gdlp;
|
||||
register struct solid *sp;
|
||||
FOR_ALL_SOLIDS(sp, &gedp->ged_gdp->gd_headSolid) {
|
||||
sp->s_iflag=DOWN;
|
||||
|
||||
gdlp = BU_LIST_NEXT(ged_display_list, &gedp->ged_gdp->gd_headDisplay);
|
||||
while (BU_LIST_NOT_HEAD(gdlp, &gedp->ged_gdp->gd_headDisplay)) {
|
||||
next_gdlp = BU_LIST_PNEXT(ged_display_list, gdlp);
|
||||
|
||||
FOR_ALL_SOLIDS(sp, &gdlp->gdl_headSolid) {
|
||||
sp->s_iflag=DOWN;
|
||||
}
|
||||
|
||||
gdlp = next_gdlp;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -491,7 +491,7 @@ mged_attach(
|
||||
share_dlist(curr_dm_list);
|
||||
|
||||
if (displaylist && mged_variables->mv_dlist && !dlist_state->dl_active) {
|
||||
createDLists(&gedp->ged_gdp->gd_headSolid);
|
||||
createDLists(&gedp->ged_gdp->gd_headDisplay);
|
||||
dlist_state->dl_active = 1;
|
||||
}
|
||||
|
||||
|
||||
+45
-6
@@ -466,13 +466,30 @@ bv_35_25(ClientData clientData, Tcl_Interp *interp, int argc, char **argv) {
|
||||
/* returns 0 if error, !0 if success */
|
||||
static int
|
||||
ill_common(void) {
|
||||
register struct ged_display_list *gdlp;
|
||||
register struct ged_display_list *next_gdlp;
|
||||
int is_empty = 1;
|
||||
|
||||
/* Common part of illumination */
|
||||
if (BU_LIST_IS_EMPTY(&gedp->ged_gdp->gd_headSolid)) {
|
||||
gdlp = BU_LIST_NEXT(ged_display_list, &gedp->ged_gdp->gd_headDisplay);
|
||||
while (BU_LIST_NOT_HEAD(gdlp, &gedp->ged_gdp->gd_headDisplay)) {
|
||||
next_gdlp = BU_LIST_PNEXT(ged_display_list, gdlp);
|
||||
|
||||
if (BU_LIST_NON_EMPTY(&gdlp->gdl_headSolid)) {
|
||||
is_empty = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
gdlp = next_gdlp;
|
||||
}
|
||||
|
||||
if (is_empty) {
|
||||
Tcl_AppendResult(interp, "no solids in view\n", (char *)NULL);
|
||||
return(0); /* BAD */
|
||||
}
|
||||
|
||||
illump = BU_LIST_NEXT(solid, &gedp->ged_gdp->gd_headSolid);/* any valid solid would do */
|
||||
illum_gdlp = gdlp;
|
||||
illump = BU_LIST_NEXT(solid, &gdlp->gdl_headSolid);/* any valid solid would do */
|
||||
illump->s_iflag = UP;
|
||||
edobj = 0; /* sanity */
|
||||
edsol = 0; /* sanity */
|
||||
@@ -624,6 +641,8 @@ be_o_rotate(ClientData clientData, Tcl_Interp *interp, int argc, char **argv) {
|
||||
|
||||
int
|
||||
be_accept(ClientData clientData, Tcl_Interp *interp, int argc, char **argv) {
|
||||
register struct ged_display_list *gdlp;
|
||||
register struct ged_display_list *next_gdlp;
|
||||
register struct solid *sp;
|
||||
register struct dm_list *dmlp;
|
||||
|
||||
@@ -636,9 +655,17 @@ be_accept(ClientData clientData, Tcl_Interp *interp, int argc, char **argv) {
|
||||
mmenu_set_all( MENU_L1, MENU_NULL );
|
||||
mmenu_set_all( MENU_L2, MENU_NULL );
|
||||
|
||||
FOR_ALL_SOLIDS(sp, &gedp->ged_gdp->gd_headSolid)
|
||||
sp->s_iflag = DOWN;
|
||||
gdlp = BU_LIST_NEXT(ged_display_list, &gedp->ged_gdp->gd_headDisplay);
|
||||
while (BU_LIST_NOT_HEAD(gdlp, &gedp->ged_gdp->gd_headDisplay)) {
|
||||
next_gdlp = BU_LIST_PNEXT(ged_display_list, gdlp);
|
||||
|
||||
FOR_ALL_SOLIDS(sp, &gdlp->gdl_headSolid)
|
||||
sp->s_iflag = DOWN;
|
||||
|
||||
gdlp = next_gdlp;
|
||||
}
|
||||
|
||||
illum_gdlp = GED_DISPLAY_LIST_NULL;
|
||||
illump = SOLID_NULL;
|
||||
color_soltab();
|
||||
(void)chg_state( ST_S_EDIT, ST_VIEW, "Edit Accept" );
|
||||
@@ -651,6 +678,7 @@ be_accept(ClientData clientData, Tcl_Interp *interp, int argc, char **argv) {
|
||||
|
||||
mmenu_set_all( MENU_L2, MENU_NULL );
|
||||
|
||||
illum_gdlp = GED_DISPLAY_LIST_NULL;
|
||||
illump = SOLID_NULL;
|
||||
color_soltab();
|
||||
(void)chg_state( ST_O_EDIT, ST_VIEW, "Edit Accept" );
|
||||
@@ -677,6 +705,8 @@ be_accept(ClientData clientData, Tcl_Interp *interp, int argc, char **argv) {
|
||||
|
||||
int
|
||||
be_reject(ClientData clientData, Tcl_Interp *interp, int argc, char **argv) {
|
||||
register struct ged_display_list *gdlp;
|
||||
register struct ged_display_list *next_gdlp;
|
||||
register struct solid *sp;
|
||||
register struct dm_list *dmlp;
|
||||
|
||||
@@ -715,11 +745,20 @@ be_reject(ClientData clientData, Tcl_Interp *interp, int argc, char **argv) {
|
||||
edsol = 0;
|
||||
edobj = 0;
|
||||
es_edflag = -1;
|
||||
illum_gdlp = GED_DISPLAY_LIST_NULL;
|
||||
illump = SOLID_NULL; /* None selected */
|
||||
|
||||
/* Clear illumination flags */
|
||||
FOR_ALL_SOLIDS(sp, &gedp->ged_gdp->gd_headSolid)
|
||||
sp->s_iflag = DOWN;
|
||||
gdlp = BU_LIST_NEXT(ged_display_list, &gedp->ged_gdp->gd_headDisplay);
|
||||
while (BU_LIST_NOT_HEAD(gdlp, &gedp->ged_gdp->gd_headDisplay)) {
|
||||
next_gdlp = BU_LIST_PNEXT(ged_display_list, gdlp);
|
||||
|
||||
FOR_ALL_SOLIDS(sp, &gdlp->gdl_headSolid)
|
||||
sp->s_iflag = DOWN;
|
||||
|
||||
gdlp = next_gdlp;
|
||||
}
|
||||
|
||||
color_soltab();
|
||||
(void)chg_state( state, ST_VIEW, "Edit Reject" );
|
||||
|
||||
|
||||
+38
-8
@@ -151,20 +151,31 @@ f_copy_inv(ClientData clientData, Tcl_Interp *interp, int argc, char **argv)
|
||||
struct solid *
|
||||
find_solid_with_path(register struct db_full_path *pathp)
|
||||
{
|
||||
register struct ged_display_list *gdlp;
|
||||
register struct ged_display_list *next_gdlp;
|
||||
register struct solid *sp;
|
||||
int count = 0;
|
||||
struct solid *ret = (struct solid *)NULL;
|
||||
|
||||
RT_CK_FULL_PATH(pathp);
|
||||
|
||||
FOR_ALL_SOLIDS(sp, &gedp->ged_gdp->gd_headSolid) {
|
||||
if ( !db_identical_full_paths( pathp, &sp->s_fullpath ) ) continue;
|
||||
gdlp = BU_LIST_NEXT(ged_display_list, &gedp->ged_gdp->gd_headDisplay);
|
||||
while (BU_LIST_NOT_HEAD(gdlp, &gedp->ged_gdp->gd_headDisplay)) {
|
||||
next_gdlp = BU_LIST_PNEXT(ged_display_list, gdlp);
|
||||
|
||||
/* Paths are the same */
|
||||
ret = sp;
|
||||
count++;
|
||||
FOR_ALL_SOLIDS(sp, &gdlp->gdl_headSolid) {
|
||||
if ( !db_identical_full_paths( pathp, &sp->s_fullpath ) ) continue;
|
||||
|
||||
/* Paths are the same */
|
||||
illum_gdlp = gdlp;
|
||||
ret = sp;
|
||||
count++;
|
||||
}
|
||||
|
||||
gdlp = next_gdlp;
|
||||
}
|
||||
if ( count > 1 ) {
|
||||
|
||||
if (count > 1) {
|
||||
struct bu_vls tmp_vls;
|
||||
|
||||
bu_vls_init(&tmp_vls);
|
||||
@@ -190,11 +201,14 @@ find_solid_with_path(register struct db_full_path *pathp)
|
||||
int
|
||||
cmd_oed(ClientData clientData, Tcl_Interp *interp, int argc, char **argv)
|
||||
{
|
||||
register struct ged_display_list *gdlp;
|
||||
register struct ged_display_list *next_gdlp;
|
||||
struct db_full_path lhs;
|
||||
struct db_full_path rhs;
|
||||
struct db_full_path both;
|
||||
char *new_argv[4];
|
||||
char number[32];
|
||||
int is_empty = 1;
|
||||
|
||||
CHECK_DBI_NULL;
|
||||
|
||||
@@ -211,7 +225,21 @@ cmd_oed(ClientData clientData, Tcl_Interp *interp, int argc, char **argv)
|
||||
if ( not_state( ST_VIEW, "Object Illuminate" ) ) {
|
||||
return TCL_ERROR;
|
||||
}
|
||||
if (BU_LIST_IS_EMPTY(&gedp->ged_gdp->gd_headSolid)) {
|
||||
|
||||
/* Common part of illumination */
|
||||
gdlp = BU_LIST_NEXT(ged_display_list, &gedp->ged_gdp->gd_headDisplay);
|
||||
while (BU_LIST_NOT_HEAD(gdlp, &gedp->ged_gdp->gd_headDisplay)) {
|
||||
next_gdlp = BU_LIST_PNEXT(ged_display_list, gdlp);
|
||||
|
||||
if (BU_LIST_NON_EMPTY(&gdlp->gdl_headSolid)) {
|
||||
is_empty = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
gdlp = next_gdlp;
|
||||
}
|
||||
|
||||
if (is_empty) {
|
||||
Tcl_AppendResult(interp, "no solids in view", (char *)NULL);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
@@ -237,7 +265,8 @@ cmd_oed(ClientData clientData, Tcl_Interp *interp, int argc, char **argv)
|
||||
db_append_full_path( &both, &rhs );
|
||||
|
||||
/* Patterned after ill_common() ... */
|
||||
illump = BU_LIST_NEXT(solid, &gedp->ged_gdp->gd_headSolid);/* any valid solid would do */
|
||||
illum_gdlp = gdlp;
|
||||
illump = BU_LIST_NEXT(solid, &gdlp->gdl_headSolid);/* any valid solid would do */
|
||||
edobj = 0; /* sanity */
|
||||
movedir = 0; /* No edit modes set */
|
||||
MAT_IDN( modelchanges ); /* No changes yet */
|
||||
@@ -253,6 +282,7 @@ cmd_oed(ClientData clientData, Tcl_Interp *interp, int argc, char **argv)
|
||||
db_free_full_path( &rhs );
|
||||
db_free_full_path( &both );
|
||||
Tcl_AppendResult(interp, "Unable to find solid matching path", (char *)NULL);
|
||||
illum_gdlp = GED_DISPLAY_LIST_NULL;
|
||||
illump = 0;
|
||||
(void)chg_state( ST_O_PICK, ST_VIEW, "error recovery");
|
||||
return TCL_ERROR;
|
||||
|
||||
+86
-135
@@ -256,11 +256,13 @@ edit_com(int argc,
|
||||
int kind,
|
||||
int catch_sigint)
|
||||
{
|
||||
register struct ged_display_list *gdlp;
|
||||
register struct ged_display_list *next_gdlp;
|
||||
register struct dm_list *dmlp;
|
||||
register struct dm_list *save_dmlp;
|
||||
register struct cmd_list *save_cmd_list;
|
||||
int ret;
|
||||
int initial_blank_screen;
|
||||
int initial_blank_screen = 1;
|
||||
|
||||
int flag_A_attr=0;
|
||||
int flag_R_noresize=0;
|
||||
@@ -272,7 +274,18 @@ edit_com(int argc,
|
||||
|
||||
CHECK_DBI_NULL;
|
||||
|
||||
initial_blank_screen = BU_LIST_IS_EMPTY(&gedp->ged_gdp->gd_headSolid);
|
||||
/* Common part of illumination */
|
||||
gdlp = BU_LIST_NEXT(ged_display_list, &gedp->ged_gdp->gd_headDisplay);
|
||||
while (BU_LIST_NOT_HEAD(gdlp, &gedp->ged_gdp->gd_headDisplay)) {
|
||||
next_gdlp = BU_LIST_PNEXT(ged_display_list, gdlp);
|
||||
|
||||
if (BU_LIST_NON_EMPTY(&gdlp->gdl_headSolid)) {
|
||||
initial_blank_screen = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
gdlp = next_gdlp;
|
||||
}
|
||||
|
||||
/* check args for "-A" (attributes) and "-o" and "-R" */
|
||||
bu_vls_init( &vls );
|
||||
@@ -410,6 +423,8 @@ edit_com(int argc,
|
||||
save_dmlp = curr_dm_list;
|
||||
save_cmd_list = curr_cmd_list;
|
||||
FOR_ALL_DISPLAYS(dmlp, &head_dm_list.l) {
|
||||
int non_empty = 0; /* start out empty */
|
||||
|
||||
curr_dm_list = dmlp;
|
||||
if (curr_dm_list->dml_tie)
|
||||
curr_cmd_list = curr_dm_list->dml_tie;
|
||||
@@ -418,9 +433,20 @@ edit_com(int argc,
|
||||
|
||||
gedp->ged_gvp = view_state->vs_gvp;
|
||||
|
||||
gdlp = BU_LIST_NEXT(ged_display_list, &gedp->ged_gdp->gd_headDisplay);
|
||||
while (BU_LIST_NOT_HEAD(gdlp, &gedp->ged_gdp->gd_headDisplay)) {
|
||||
next_gdlp = BU_LIST_PNEXT(ged_display_list, gdlp);
|
||||
|
||||
if (BU_LIST_NON_EMPTY(&gdlp->gdl_headSolid)) {
|
||||
non_empty = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
gdlp = next_gdlp;
|
||||
}
|
||||
|
||||
/* If we went from blank screen to non-blank, resize */
|
||||
if (mged_variables->mv_autosize && initial_blank_screen &&
|
||||
BU_LIST_NON_EMPTY(&gedp->ged_gdp->gd_headSolid)) {
|
||||
if (mged_variables->mv_autosize && initial_blank_screen && non_empty) {
|
||||
struct view_ring *vrp;
|
||||
char *av[2];
|
||||
|
||||
@@ -673,6 +699,8 @@ mged_freemem(void)
|
||||
int
|
||||
cmd_zap(ClientData clientData, Tcl_Interp *interp, int argc, const char *argv[])
|
||||
{
|
||||
register struct ged_display_list *gdlp;
|
||||
register struct ged_display_list *next_gdlp;
|
||||
char *av[2] = {"zap", (char *)0};
|
||||
|
||||
CHECK_DBI_NULL;
|
||||
@@ -683,9 +711,15 @@ cmd_zap(ClientData clientData, Tcl_Interp *interp, int argc, const char *argv[])
|
||||
if (state != ST_VIEW)
|
||||
button(BE_REJECT);
|
||||
|
||||
freeDListsAll(BU_LIST_FIRST(solid, &gedp->ged_gdp->gd_headSolid)->s_dlist,
|
||||
BU_LIST_LAST(solid, &gedp->ged_gdp->gd_headSolid)->s_dlist -
|
||||
BU_LIST_FIRST(solid, &gedp->ged_gdp->gd_headSolid)->s_dlist + 1);
|
||||
gdlp = BU_LIST_NEXT(ged_display_list, &gedp->ged_gdp->gd_headDisplay);
|
||||
while (BU_LIST_NOT_HEAD(gdlp, &gedp->ged_gdp->gd_headDisplay)) {
|
||||
next_gdlp = BU_LIST_PNEXT(ged_display_list, gdlp);
|
||||
freeDListsAll(BU_LIST_FIRST(solid, &gdlp->gdl_headSolid)->s_dlist,
|
||||
BU_LIST_LAST(solid, &gdlp->gdl_headSolid)->s_dlist -
|
||||
BU_LIST_FIRST(solid, &gdlp->gdl_headSolid)->s_dlist + 1);
|
||||
|
||||
gdlp = next_gdlp;
|
||||
}
|
||||
|
||||
ged_zap(gedp, 1, (const char **)av);
|
||||
|
||||
@@ -825,116 +859,6 @@ f_refresh(ClientData clientData, Tcl_Interp *interp, int argc, char **argv)
|
||||
return TCL_OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* E R A S E O B J A L L
|
||||
*
|
||||
* This routine goes through the solid table and deletes all solids
|
||||
* from the solid list which contain the specified object anywhere in their 'path'
|
||||
*/
|
||||
void
|
||||
eraseobjall(register struct directory **dpp)
|
||||
/* this is a partial path spec. XXX should be db_full_path? */
|
||||
{
|
||||
register struct directory **tmp_dpp;
|
||||
register struct solid *sp;
|
||||
register struct solid *nsp;
|
||||
struct db_full_path subpath;
|
||||
|
||||
if (dbip == DBI_NULL)
|
||||
return;
|
||||
|
||||
update_views = 1;
|
||||
|
||||
db_full_path_init(&subpath);
|
||||
for (tmp_dpp = dpp; *tmp_dpp != DIR_NULL; ++tmp_dpp) {
|
||||
RT_CK_DIR(*tmp_dpp);
|
||||
db_add_node_to_full_path(&subpath, *tmp_dpp);
|
||||
}
|
||||
|
||||
sp = BU_LIST_NEXT(solid, &gedp->ged_gdp->gd_headSolid);
|
||||
while (BU_LIST_NOT_HEAD(sp, &gedp->ged_gdp->gd_headSolid)) {
|
||||
nsp = BU_LIST_PNEXT(solid, sp);
|
||||
|
||||
if ( db_full_path_subset( &sp->s_fullpath, &subpath ) ) {
|
||||
freeDListsAll(sp->s_dlist, 1);
|
||||
|
||||
if (state != ST_VIEW && illump == sp)
|
||||
button(BE_REJECT);
|
||||
|
||||
BU_LIST_DEQUEUE(&sp->l);
|
||||
FREE_SOLID(sp, &MGED_FreeSolid.l);
|
||||
}
|
||||
sp = nsp;
|
||||
}
|
||||
|
||||
if ((*dpp)->d_addr == RT_DIR_PHONY_ADDR) {
|
||||
if (db_dirdelete(dbip, *dpp) < 0) {
|
||||
Tcl_AppendResult(interp, "eraseobjall: db_dirdelete failed\n", (char *)NULL);
|
||||
}
|
||||
}
|
||||
|
||||
db_free_full_path(&subpath);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* E R A S E O B J
|
||||
*
|
||||
* This routine goes through the solid table and deletes all solids
|
||||
* from the solid list which contain the specified object at the
|
||||
* beginning of their 'path'
|
||||
*/
|
||||
void
|
||||
eraseobj(register struct directory **dpp)
|
||||
/* this is a partial path spec. XXX should be db_full_path? */
|
||||
{
|
||||
register struct directory **tmp_dpp;
|
||||
register struct solid *sp;
|
||||
register struct solid *nsp;
|
||||
struct db_full_path subpath;
|
||||
|
||||
if (dbip == DBI_NULL)
|
||||
return;
|
||||
|
||||
if (*dpp == DIR_NULL)
|
||||
return;
|
||||
|
||||
update_views = 1;
|
||||
|
||||
db_full_path_init(&subpath);
|
||||
for (tmp_dpp = dpp; *tmp_dpp != DIR_NULL; ++tmp_dpp) {
|
||||
RT_CK_DIR(*tmp_dpp);
|
||||
db_add_node_to_full_path(&subpath, *tmp_dpp);
|
||||
}
|
||||
|
||||
sp = BU_LIST_FIRST(solid, &gedp->ged_gdp->gd_headSolid);
|
||||
while (BU_LIST_NOT_HEAD(sp, &gedp->ged_gdp->gd_headSolid)) {
|
||||
nsp = BU_LIST_PNEXT(solid, sp);
|
||||
|
||||
if ( db_full_path_subset( &sp->s_fullpath, &subpath ) ) {
|
||||
freeDListsAll(sp->s_dlist, 1);
|
||||
|
||||
if (state != ST_VIEW && illump == sp)
|
||||
button( BE_REJECT );
|
||||
|
||||
BU_LIST_DEQUEUE(&sp->l);
|
||||
FREE_SOLID(sp, &MGED_FreeSolid.l);
|
||||
}
|
||||
sp = nsp;
|
||||
}
|
||||
|
||||
if ((*dpp)->d_addr == RT_DIR_PHONY_ADDR ) {
|
||||
if (db_dirdelete(dbip, *dpp) < 0) {
|
||||
Tcl_AppendResult(interp, "eraseobj: db_dirdelete failed\n", (char *)NULL);
|
||||
}
|
||||
}
|
||||
|
||||
db_free_full_path(&subpath);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* P R _ S C H A I N
|
||||
*
|
||||
@@ -1038,6 +962,8 @@ static char ** path_parse (char *path);
|
||||
int
|
||||
f_ill(ClientData clientData, Tcl_Interp *interp, int argc, const char *argv[])
|
||||
{
|
||||
register struct ged_display_list *gdlp;
|
||||
register struct ged_display_list *next_gdlp;
|
||||
register struct directory *dp;
|
||||
register struct solid *sp;
|
||||
struct solid *lastfound = SOLID_NULL;
|
||||
@@ -1165,30 +1091,37 @@ f_ill(ClientData clientData, Tcl_Interp *interp, int argc, const char *argv[])
|
||||
goto bail_out;
|
||||
}
|
||||
|
||||
FOR_ALL_SOLIDS(sp, &gedp->ged_gdp->gd_headSolid) {
|
||||
int a_new_match;
|
||||
gdlp = BU_LIST_NEXT(ged_display_list, &gedp->ged_gdp->gd_headDisplay);
|
||||
while (BU_LIST_NOT_HEAD(gdlp, &gedp->ged_gdp->gd_headDisplay)) {
|
||||
next_gdlp = BU_LIST_PNEXT(ged_display_list, gdlp);
|
||||
|
||||
FOR_ALL_SOLIDS(sp, &gdlp->gdl_headSolid) {
|
||||
int a_new_match;
|
||||
|
||||
/* XXX Could this make use of db_full_path_subset()? */
|
||||
if (nmatch == 0 || nmatch != ri) {
|
||||
i = sp -> s_fullpath.fp_len-1;
|
||||
if (DB_FULL_PATH_GET(&sp->s_fullpath, i) == dp) {
|
||||
a_new_match = 1;
|
||||
j = nm_pieces - 1;
|
||||
for (; a_new_match && (i >= 0) && (j >= 0); --i, --j) {
|
||||
sname = DB_FULL_PATH_GET(&sp->s_fullpath, i)->d_namep;
|
||||
if ((*sname != *(path_piece[j]))
|
||||
|| strcmp(sname, path_piece[j]))
|
||||
a_new_match = 0;
|
||||
}
|
||||
if (nmatch == 0 || nmatch != ri) {
|
||||
i = sp -> s_fullpath.fp_len-1;
|
||||
if (DB_FULL_PATH_GET(&sp->s_fullpath, i) == dp) {
|
||||
a_new_match = 1;
|
||||
j = nm_pieces - 1;
|
||||
for (; a_new_match && (i >= 0) && (j >= 0); --i, --j) {
|
||||
sname = DB_FULL_PATH_GET(&sp->s_fullpath, i)->d_namep;
|
||||
if ((*sname != *(path_piece[j]))
|
||||
|| strcmp(sname, path_piece[j]))
|
||||
a_new_match = 0;
|
||||
}
|
||||
|
||||
if (a_new_match && ((i >= 0) || (j < 0))) {
|
||||
lastfound = sp;
|
||||
++nmatch;
|
||||
if (a_new_match && ((i >= 0) || (j < 0))) {
|
||||
lastfound = sp;
|
||||
++nmatch;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sp->s_iflag = DOWN;
|
||||
}
|
||||
|
||||
sp->s_iflag = DOWN;
|
||||
gdlp = next_gdlp;
|
||||
}
|
||||
|
||||
if (nmatch == 0) {
|
||||
@@ -1265,6 +1198,10 @@ f_ill(ClientData clientData, Tcl_Interp *interp, int argc, const char *argv[])
|
||||
int
|
||||
f_sed(ClientData clientData, Tcl_Interp *interp, int argc, const char *argv[])
|
||||
{
|
||||
register struct ged_display_list *gdlp;
|
||||
register struct ged_display_list *next_gdlp;
|
||||
int is_empty = 1;
|
||||
|
||||
CHECK_DBI_NULL;
|
||||
CHECK_READ_ONLY;
|
||||
|
||||
@@ -1280,7 +1217,21 @@ f_sed(ClientData clientData, Tcl_Interp *interp, int argc, const char *argv[])
|
||||
|
||||
if ( not_state( ST_VIEW, "keyboard solid edit start") )
|
||||
return TCL_ERROR;
|
||||
if (BU_LIST_IS_EMPTY(&gedp->ged_gdp->gd_headSolid)) {
|
||||
|
||||
/* Common part of illumination */
|
||||
gdlp = BU_LIST_NEXT(ged_display_list, &gedp->ged_gdp->gd_headDisplay);
|
||||
while (BU_LIST_NOT_HEAD(gdlp, &gedp->ged_gdp->gd_headDisplay)) {
|
||||
next_gdlp = BU_LIST_PNEXT(ged_display_list, gdlp);
|
||||
|
||||
if (BU_LIST_NON_EMPTY(&gdlp->gdl_headSolid)) {
|
||||
is_empty = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
gdlp = next_gdlp;
|
||||
}
|
||||
|
||||
if (is_empty) {
|
||||
Tcl_AppendResult(interp, "no solids being displayed\n", (char *)NULL);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
|
||||
+2
-2
@@ -231,7 +231,7 @@ cmd_ged_gqa(ClientData clientData, Tcl_Interp *interp, int argc, const char *arg
|
||||
vp = &gedp->ged_gdp->gd_rt_cmd[0];
|
||||
|
||||
/* Grab command name and any options */
|
||||
*vp++ = argv[0];
|
||||
*vp++ = (char *)argv[0];
|
||||
for (i=1; i < argc; i++) {
|
||||
if (argv[i][0] != '-')
|
||||
break;
|
||||
@@ -266,7 +266,7 @@ cmd_ged_gqa(ClientData clientData, Tcl_Interp *interp, int argc, const char *arg
|
||||
&gedp->ged_gdp->gd_rt_cmd[MAXARGS]);
|
||||
}
|
||||
|
||||
ret = (*ctp->ged_func)(gedp, gedp->ged_gdp->gd_rt_cmd_len, gedp->ged_gdp->gd_rt_cmd);
|
||||
ret = (*ctp->ged_func)(gedp, gedp->ged_gdp->gd_rt_cmd_len, (const char **)gedp->ged_gdp->gd_rt_cmd);
|
||||
Tcl_DStringInit(&ds);
|
||||
Tcl_DStringAppend(&ds, bu_vls_addr(&gedp->ged_result_str), -1);
|
||||
Tcl_DStringResult(interp, &ds);
|
||||
|
||||
+36
-17
@@ -842,6 +842,7 @@ drawH_part2(
|
||||
struct db_tree_state *tsp,
|
||||
struct solid *existing_sp)
|
||||
{
|
||||
register struct ged_display_list *gdlp;
|
||||
register struct solid *sp;
|
||||
|
||||
if ( !existing_sp ) {
|
||||
@@ -849,7 +850,9 @@ drawH_part2(
|
||||
GET_SOLID(sp, &MGED_FreeSolid.l);
|
||||
/* NOTICE: The structure is dirty & not initialized for you! */
|
||||
|
||||
sp->s_dlist = BU_LIST_LAST(solid, &gedp->ged_gdp->gd_headSolid)->s_dlist + 1;
|
||||
/* Grab the last display list */
|
||||
gdlp = BU_LIST_PREV(ged_display_list, &gedp->ged_gdp->gd_headDisplay);
|
||||
sp->s_dlist = BU_LIST_LAST(solid, &gdlp->gdl_headSolid)->s_dlist + 1;
|
||||
} else {
|
||||
/* Just updating an existing solid.
|
||||
* 'tsp' and 'pathpos' will not be used
|
||||
@@ -906,7 +909,11 @@ drawH_part2(
|
||||
if ( !existing_sp ) {
|
||||
/* Add to linked list of solid structs */
|
||||
bu_semaphore_acquire( RT_SEM_MODEL );
|
||||
BU_LIST_APPEND(gedp->ged_gdp->gd_headSolid.back, &sp->l);
|
||||
|
||||
/* Grab the last display list */
|
||||
gdlp = BU_LIST_PREV(ged_display_list, &gedp->ged_gdp->gd_headDisplay);
|
||||
BU_LIST_APPEND(gdlp->gdl_headSolid.back, &sp->l);
|
||||
|
||||
bu_semaphore_release( RT_SEM_MODEL );
|
||||
} else {
|
||||
/* replacing existing solid -- struct already linked in */
|
||||
@@ -1123,13 +1130,13 @@ cvt_vlblock_to_solids(
|
||||
av[0] = "erase";
|
||||
av[1] = shortname;
|
||||
av[2] = NULL;
|
||||
(void)ged_erase(gedp, 2, av);
|
||||
(void)ged_erase(gedp, 2, (const char **)av);
|
||||
} else {
|
||||
av[0] = "kill";
|
||||
av[1] = "-f";
|
||||
av[2] = shortname;
|
||||
av[3] = NULL;
|
||||
(void)ged_kill(gedp, 3, av);
|
||||
(void)ged_kill(gedp, 3, (const char **)av);
|
||||
}
|
||||
|
||||
for ( i=0; i < vbp->nused; i++ ) {
|
||||
@@ -1159,9 +1166,9 @@ invent_solid(
|
||||
long rgb,
|
||||
int copy)
|
||||
{
|
||||
struct directory *dp;
|
||||
struct directory *dpp[2] = {DIR_NULL, DIR_NULL};
|
||||
register struct solid *sp;
|
||||
register struct ged_display_list *gdlp;
|
||||
register struct solid *sp;
|
||||
struct directory *dp;
|
||||
int type = 0;
|
||||
|
||||
if (dbip == DBI_NULL)
|
||||
@@ -1176,8 +1183,7 @@ invent_solid(
|
||||
/* Name exists from some other overlay,
|
||||
* zap any associated solids
|
||||
*/
|
||||
dpp[0] = dp;
|
||||
eraseobjall(dpp);
|
||||
ged_erasePathFromDisplay(gedp, name);
|
||||
}
|
||||
/* Need to enter phony name in directory structure */
|
||||
dp = db_diradd( dbip, name, RT_DIR_PHONY_ADDR, 0, DIR_SOLID, &type );
|
||||
@@ -1198,6 +1204,8 @@ invent_solid(
|
||||
/* set path information -- this is a top level node */
|
||||
db_add_node_to_full_path( &sp->s_fullpath, dp );
|
||||
|
||||
gdlp = ged_addToDisplay(gedp, name);
|
||||
|
||||
sp->s_iflag = DOWN;
|
||||
sp->s_soldash = 0;
|
||||
sp->s_Eflag = 1; /* Can't be solid edited! */
|
||||
@@ -1205,10 +1213,13 @@ invent_solid(
|
||||
sp->s_color[1] = sp->s_basecolor[1] = (rgb>> 8) & 0xFF;
|
||||
sp->s_color[2] = sp->s_basecolor[2] = (rgb ) & 0xFF;
|
||||
sp->s_regionid = 0;
|
||||
sp->s_dlist = BU_LIST_LAST(solid, &gedp->ged_gdp->gd_headSolid)->s_dlist + 1;
|
||||
|
||||
/* Solid successfully drawn, add to linked list of solid structs */
|
||||
BU_LIST_APPEND(gedp->ged_gdp->gd_headSolid.back, &sp->l);
|
||||
BU_LIST_APPEND(gdlp->gdl_headSolid.back, &sp->l);
|
||||
|
||||
/* Grab the last display list */
|
||||
gdlp = BU_LIST_PREV(ged_display_list, &gedp->ged_gdp->gd_headDisplay);
|
||||
sp->s_dlist = BU_LIST_LAST(solid, &gdlp->gdl_headSolid)->s_dlist + 1;
|
||||
|
||||
createDListALL(sp);
|
||||
|
||||
@@ -1806,6 +1817,8 @@ add_solid_path_to_result(
|
||||
int
|
||||
cmd_redraw_vlist(ClientData clientData, Tcl_Interp *interp, int argc, char **argv)
|
||||
{
|
||||
register struct ged_display_list *gdlp;
|
||||
register struct ged_display_list *next_gdlp;
|
||||
struct directory *dp;
|
||||
int i;
|
||||
|
||||
@@ -1827,18 +1840,24 @@ cmd_redraw_vlist(ClientData clientData, Tcl_Interp *interp, int argc, char **arg
|
||||
if ( (dp = db_lookup( dbip, argv[i], LOOKUP_NOISY )) == NULL )
|
||||
continue;
|
||||
|
||||
FOR_ALL_SOLIDS(sp, &gedp->ged_gdp->gd_headSolid) {
|
||||
if ( db_full_path_search( &sp->s_fullpath, dp ) ) {
|
||||
gdlp = BU_LIST_NEXT(ged_display_list, &gedp->ged_gdp->gd_headDisplay);
|
||||
while (BU_LIST_NOT_HEAD(gdlp, &gedp->ged_gdp->gd_headDisplay)) {
|
||||
next_gdlp = BU_LIST_PNEXT(ged_display_list, gdlp);
|
||||
|
||||
FOR_ALL_SOLIDS(sp, &gdlp->gdl_headSolid) {
|
||||
if ( db_full_path_search( &sp->s_fullpath, dp ) ) {
|
||||
#if 0
|
||||
add_solid_path_to_result(interp, sp);
|
||||
add_solid_path_to_result(interp, sp);
|
||||
#endif
|
||||
(void)replot_original_solid( sp );
|
||||
sp->s_iflag = DOWN; /* It won't be drawn otherwise */
|
||||
(void)replot_original_solid( sp );
|
||||
sp->s_iflag = DOWN; /* It won't be drawn otherwise */
|
||||
}
|
||||
}
|
||||
|
||||
gdlp = next_gdlp;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
update_views = 1;
|
||||
return TCL_OK;
|
||||
}
|
||||
|
||||
+159
-111
@@ -298,6 +298,8 @@ drawSolid(register struct solid *sp,
|
||||
void
|
||||
dozoom(int which_eye)
|
||||
{
|
||||
register struct ged_display_list *gdlp;
|
||||
register struct ged_display_list *next_gdlp;
|
||||
register struct solid *sp;
|
||||
fastf_t ratio;
|
||||
fastf_t inv_viewsize;
|
||||
@@ -394,115 +396,136 @@ dozoom(int which_eye)
|
||||
|
||||
if (dmp->dm_transparency) {
|
||||
/* First, draw opaque stuff */
|
||||
FOR_ALL_SOLIDS(sp, &gedp->ged_gdp->gd_headSolid) {
|
||||
sp->s_flag = DOWN; /* Not drawn yet */
|
||||
gdlp = BU_LIST_NEXT(ged_display_list, &gedp->ged_gdp->gd_headDisplay);
|
||||
while (BU_LIST_NOT_HEAD(gdlp, &gedp->ged_gdp->gd_headDisplay)) {
|
||||
next_gdlp = BU_LIST_PNEXT(ged_display_list, gdlp);
|
||||
|
||||
/* If part of object edit, will be drawn below */
|
||||
if ( sp->s_iflag == UP )
|
||||
continue;
|
||||
FOR_ALL_SOLIDS(sp, &gdlp->gdl_headSolid) {
|
||||
sp->s_flag = DOWN; /* Not drawn yet */
|
||||
|
||||
if (sp->s_transparency < 1.0)
|
||||
continue;
|
||||
/* If part of object edit, will be drawn below */
|
||||
if ( sp->s_iflag == UP )
|
||||
continue;
|
||||
|
||||
/*
|
||||
* The vectorThreshold stuff in libdm may turn the
|
||||
* Tcl-crank causing curr_dm_list to change.
|
||||
*/
|
||||
if (curr_dm_list != save_dm_list)
|
||||
curr_dm_list = save_dm_list;
|
||||
|
||||
if (dmp->dm_boundFlag) {
|
||||
ratio = sp->s_size * inv_viewsize;
|
||||
if (sp->s_transparency < 1.0)
|
||||
continue;
|
||||
|
||||
/*
|
||||
* Check for this object being bigger than
|
||||
* dmp->dm_bound * the window size, or smaller than a speck.
|
||||
* The vectorThreshold stuff in libdm may turn the
|
||||
* Tcl-crank causing curr_dm_list to change.
|
||||
*/
|
||||
if (ratio < 0.001)
|
||||
continue;
|
||||
if (curr_dm_list != save_dm_list)
|
||||
curr_dm_list = save_dm_list;
|
||||
|
||||
if (dmp->dm_boundFlag) {
|
||||
ratio = sp->s_size * inv_viewsize;
|
||||
|
||||
/*
|
||||
* Check for this object being bigger than
|
||||
* dmp->dm_bound * the window size, or smaller than a speck.
|
||||
*/
|
||||
if (ratio < 0.001)
|
||||
continue;
|
||||
}
|
||||
|
||||
if (linestyle != sp->s_soldash) {
|
||||
linestyle = sp->s_soldash;
|
||||
DM_SET_LINE_ATTR(dmp, mged_variables->mv_linewidth, linestyle);
|
||||
}
|
||||
|
||||
drawSolid(sp, r, g, b);
|
||||
}
|
||||
|
||||
if (linestyle != sp->s_soldash) {
|
||||
linestyle = sp->s_soldash;
|
||||
DM_SET_LINE_ATTR(dmp, mged_variables->mv_linewidth, linestyle);
|
||||
}
|
||||
|
||||
drawSolid(sp, r, g, b);
|
||||
gdlp = next_gdlp;
|
||||
}
|
||||
|
||||
/* disable write to depth buffer */
|
||||
DM_SET_DEPTH_MASK(dmp, 0);
|
||||
|
||||
/* Second, draw transparent stuff */
|
||||
FOR_ALL_SOLIDS(sp, &gedp->ged_gdp->gd_headSolid) {
|
||||
gdlp = BU_LIST_NEXT(ged_display_list, &gedp->ged_gdp->gd_headDisplay);
|
||||
while (BU_LIST_NOT_HEAD(gdlp, &gedp->ged_gdp->gd_headDisplay)) {
|
||||
next_gdlp = BU_LIST_PNEXT(ged_display_list, gdlp);
|
||||
|
||||
/* If part of object edit, will be drawn below */
|
||||
if ( sp->s_iflag == UP )
|
||||
continue;
|
||||
FOR_ALL_SOLIDS(sp, &gdlp->gdl_headSolid) {
|
||||
|
||||
/* already drawn above */
|
||||
if (sp->s_transparency == 1.0)
|
||||
continue;
|
||||
/* If part of object edit, will be drawn below */
|
||||
if ( sp->s_iflag == UP )
|
||||
continue;
|
||||
|
||||
/*
|
||||
* The vectorThreshold stuff in libdm may turn the
|
||||
* Tcl-crank causing curr_dm_list to change.
|
||||
*/
|
||||
if (curr_dm_list != save_dm_list)
|
||||
curr_dm_list = save_dm_list;
|
||||
|
||||
if (dmp->dm_boundFlag) {
|
||||
ratio = sp->s_size * inv_viewsize;
|
||||
/* already drawn above */
|
||||
if (sp->s_transparency == 1.0)
|
||||
continue;
|
||||
|
||||
/*
|
||||
* Check for this object being bigger than
|
||||
* dmp->dm_bound * the window size, or smaller than a speck.
|
||||
* The vectorThreshold stuff in libdm may turn the
|
||||
* Tcl-crank causing curr_dm_list to change.
|
||||
*/
|
||||
if (ratio < 0.001)
|
||||
continue;
|
||||
if (curr_dm_list != save_dm_list)
|
||||
curr_dm_list = save_dm_list;
|
||||
|
||||
if (dmp->dm_boundFlag) {
|
||||
ratio = sp->s_size * inv_viewsize;
|
||||
|
||||
/*
|
||||
* Check for this object being bigger than
|
||||
* dmp->dm_bound * the window size, or smaller than a speck.
|
||||
*/
|
||||
if (ratio < 0.001)
|
||||
continue;
|
||||
}
|
||||
|
||||
if (linestyle != sp->s_soldash) {
|
||||
linestyle = sp->s_soldash;
|
||||
DM_SET_LINE_ATTR(dmp, mged_variables->mv_linewidth, linestyle);
|
||||
}
|
||||
|
||||
drawSolid(sp, r, g, b);
|
||||
}
|
||||
|
||||
if (linestyle != sp->s_soldash) {
|
||||
linestyle = sp->s_soldash;
|
||||
DM_SET_LINE_ATTR(dmp, mged_variables->mv_linewidth, linestyle);
|
||||
}
|
||||
|
||||
drawSolid(sp, r, g, b);
|
||||
gdlp = next_gdlp;
|
||||
}
|
||||
|
||||
/* re-enable write of depth buffer */
|
||||
DM_SET_DEPTH_MASK(dmp, 1);
|
||||
} else {
|
||||
|
||||
FOR_ALL_SOLIDS(sp, &gedp->ged_gdp->gd_headSolid) {
|
||||
sp->s_flag = DOWN; /* Not drawn yet */
|
||||
/* If part of object edit, will be drawn below */
|
||||
if ( sp->s_iflag == UP )
|
||||
continue;
|
||||
gdlp = BU_LIST_NEXT(ged_display_list, &gedp->ged_gdp->gd_headDisplay);
|
||||
while (BU_LIST_NOT_HEAD(gdlp, &gedp->ged_gdp->gd_headDisplay)) {
|
||||
next_gdlp = BU_LIST_PNEXT(ged_display_list, gdlp);
|
||||
|
||||
/*
|
||||
* The vectorThreshold stuff in libdm may turn the
|
||||
* Tcl-crank causing curr_dm_list to change.
|
||||
*/
|
||||
if (curr_dm_list != save_dm_list)
|
||||
curr_dm_list = save_dm_list;
|
||||
|
||||
if (dmp->dm_boundFlag) {
|
||||
ratio = sp->s_size * inv_viewsize;
|
||||
FOR_ALL_SOLIDS(sp, &gdlp->gdl_headSolid) {
|
||||
sp->s_flag = DOWN; /* Not drawn yet */
|
||||
/* If part of object edit, will be drawn below */
|
||||
if ( sp->s_iflag == UP )
|
||||
continue;
|
||||
|
||||
/*
|
||||
* Check for this object being smaller than a speck.
|
||||
* The vectorThreshold stuff in libdm may turn the
|
||||
* Tcl-crank causing curr_dm_list to change.
|
||||
*/
|
||||
if (ratio < 0.001)
|
||||
continue;
|
||||
if (curr_dm_list != save_dm_list)
|
||||
curr_dm_list = save_dm_list;
|
||||
|
||||
if (dmp->dm_boundFlag) {
|
||||
ratio = sp->s_size * inv_viewsize;
|
||||
|
||||
/*
|
||||
* Check for this object being smaller than a speck.
|
||||
*/
|
||||
if (ratio < 0.001)
|
||||
continue;
|
||||
}
|
||||
|
||||
if (linestyle != sp->s_soldash) {
|
||||
linestyle = sp->s_soldash;
|
||||
DM_SET_LINE_ATTR(dmp, mged_variables->mv_linewidth, linestyle);
|
||||
}
|
||||
|
||||
drawSolid(sp, r, g, b);
|
||||
}
|
||||
|
||||
if (linestyle != sp->s_soldash) {
|
||||
linestyle = sp->s_soldash;
|
||||
DM_SET_LINE_ATTR(dmp, mged_variables->mv_linewidth, linestyle);
|
||||
}
|
||||
|
||||
drawSolid(sp, r, g, b);
|
||||
gdlp = next_gdlp;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -542,43 +565,50 @@ dozoom(int which_eye)
|
||||
color_scheme->cs_geo_hl[1],
|
||||
color_scheme->cs_geo_hl[2], 1, 1.0);
|
||||
|
||||
FOR_ALL_SOLIDS(sp, &gedp->ged_gdp->gd_headSolid) {
|
||||
/* Ignore all objects not being edited */
|
||||
if (sp->s_iflag != UP)
|
||||
continue;
|
||||
gdlp = BU_LIST_NEXT(ged_display_list, &gedp->ged_gdp->gd_headDisplay);
|
||||
while (BU_LIST_NOT_HEAD(gdlp, &gedp->ged_gdp->gd_headDisplay)) {
|
||||
next_gdlp = BU_LIST_PNEXT(ged_display_list, gdlp);
|
||||
|
||||
/*
|
||||
* The vectorThreshold stuff in libdm may turn the
|
||||
* Tcl-crank causing curr_dm_list to change.
|
||||
*/
|
||||
if (curr_dm_list != save_dm_list)
|
||||
curr_dm_list = save_dm_list;
|
||||
|
||||
if (dmp->dm_boundFlag) {
|
||||
ratio = sp->s_size * inv_viewsize;
|
||||
/*
|
||||
* Check for this object being smaller than a speck.
|
||||
*/
|
||||
if (ratio < 0.001)
|
||||
FOR_ALL_SOLIDS(sp, &gdlp->gdl_headSolid) {
|
||||
/* Ignore all objects not being edited */
|
||||
if (sp->s_iflag != UP)
|
||||
continue;
|
||||
}
|
||||
|
||||
if (linestyle != sp->s_soldash) {
|
||||
linestyle = sp->s_soldash;
|
||||
DM_SET_LINE_ATTR(dmp, mged_variables->mv_linewidth, linestyle);
|
||||
}
|
||||
/*
|
||||
* The vectorThreshold stuff in libdm may turn the
|
||||
* Tcl-crank causing curr_dm_list to change.
|
||||
*/
|
||||
if (curr_dm_list != save_dm_list)
|
||||
curr_dm_list = save_dm_list;
|
||||
|
||||
if (displaylist && mged_variables->mv_dlist) {
|
||||
DM_DRAWDLIST(dmp, sp->s_dlist);
|
||||
sp->s_flag = UP;
|
||||
ndrawn++;
|
||||
} else {
|
||||
/* draw in immediate mode */
|
||||
if (DM_DRAW_VLIST(dmp, (struct bn_vlist *)&sp->s_vlist) == TCL_OK) {
|
||||
if (dmp->dm_boundFlag) {
|
||||
ratio = sp->s_size * inv_viewsize;
|
||||
/*
|
||||
* Check for this object being smaller than a speck.
|
||||
*/
|
||||
if (ratio < 0.001)
|
||||
continue;
|
||||
}
|
||||
|
||||
if (linestyle != sp->s_soldash) {
|
||||
linestyle = sp->s_soldash;
|
||||
DM_SET_LINE_ATTR(dmp, mged_variables->mv_linewidth, linestyle);
|
||||
}
|
||||
|
||||
if (displaylist && mged_variables->mv_dlist) {
|
||||
DM_DRAWDLIST(dmp, sp->s_dlist);
|
||||
sp->s_flag = UP;
|
||||
ndrawn++;
|
||||
} else {
|
||||
/* draw in immediate mode */
|
||||
if (DM_DRAW_VLIST(dmp, (struct bn_vlist *)&sp->s_vlist) == TCL_OK) {
|
||||
sp->s_flag = UP;
|
||||
ndrawn++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
gdlp = next_gdlp;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -604,12 +634,21 @@ createDList(struct solid *sp)
|
||||
* Create Display Lists
|
||||
*/
|
||||
void
|
||||
createDLists(struct bu_list *hsp)
|
||||
createDLists(struct bu_list *hdlp)
|
||||
{
|
||||
register struct ged_display_list *gdlp;
|
||||
register struct ged_display_list *next_gdlp;
|
||||
register struct solid *sp;
|
||||
|
||||
FOR_ALL_SOLIDS(sp, hsp) {
|
||||
createDList(sp);
|
||||
gdlp = BU_LIST_NEXT(ged_display_list, hdlp);
|
||||
while (BU_LIST_NOT_HEAD(gdlp, hdlp)) {
|
||||
next_gdlp = BU_LIST_PNEXT(ged_display_list, gdlp);
|
||||
|
||||
FOR_ALL_SOLIDS(sp, &gdlp->gdl_headSolid) {
|
||||
createDList(sp);
|
||||
}
|
||||
|
||||
gdlp = next_gdlp;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -653,12 +692,21 @@ createDListALL(struct solid *sp)
|
||||
* for a description.
|
||||
*/
|
||||
void
|
||||
createDListsAll(struct bu_list *hsp)
|
||||
createDListsAll(struct bu_list *hdlp)
|
||||
{
|
||||
struct solid *sp;
|
||||
register struct ged_display_list *gdlp;
|
||||
register struct ged_display_list *next_gdlp;
|
||||
register struct solid *sp;
|
||||
|
||||
FOR_ALL_SOLIDS(sp, hsp) {
|
||||
createDListALL(sp);
|
||||
gdlp = BU_LIST_NEXT(ged_display_list, hdlp);
|
||||
while (BU_LIST_NOT_HEAD(gdlp, hdlp)) {
|
||||
next_gdlp = BU_LIST_PNEXT(ged_display_list, gdlp);
|
||||
|
||||
FOR_ALL_SOLIDS(sp, &gdlp->gdl_headSolid) {
|
||||
createDListALL(sp);
|
||||
}
|
||||
|
||||
gdlp = next_gdlp;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+56
-18
@@ -2555,6 +2555,8 @@ init_sedit_vars(void)
|
||||
void
|
||||
replot_editing_solid(void)
|
||||
{
|
||||
register struct ged_display_list *gdlp;
|
||||
register struct ged_display_list *next_gdlp;
|
||||
mat_t mat;
|
||||
register struct solid *sp;
|
||||
struct directory *illdp;
|
||||
@@ -2565,11 +2567,18 @@ replot_editing_solid(void)
|
||||
|
||||
illdp = LAST_SOLID(illump);
|
||||
|
||||
FOR_ALL_SOLIDS(sp, &gedp->ged_gdp->gd_headSolid) {
|
||||
if (LAST_SOLID(sp) == illdp) {
|
||||
pathHmat(sp, mat, sp->s_fullpath.fp_len-2);
|
||||
(void)replot_modified_solid(sp, &es_int, mat);
|
||||
gdlp = BU_LIST_NEXT(ged_display_list, &gedp->ged_gdp->gd_headDisplay);
|
||||
while (BU_LIST_NOT_HEAD(gdlp, &gedp->ged_gdp->gd_headDisplay)) {
|
||||
next_gdlp = BU_LIST_PNEXT(ged_display_list, gdlp);
|
||||
|
||||
FOR_ALL_SOLIDS(sp, &gdlp->gdl_headSolid) {
|
||||
if (LAST_SOLID(sp) == illdp) {
|
||||
pathHmat(sp, mat, sp->s_fullpath.fp_len-2);
|
||||
(void)replot_modified_solid(sp, &es_int, mat);
|
||||
}
|
||||
}
|
||||
|
||||
gdlp = next_gdlp;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7616,6 +7625,8 @@ void oedit_reject(void);
|
||||
static void
|
||||
oedit_apply(int continue_editing)
|
||||
{
|
||||
register struct ged_display_list *gdlp;
|
||||
register struct ged_display_list *next_gdlp;
|
||||
register struct solid *sp;
|
||||
/* matrices used to accept editing done from a depth
|
||||
* >= 2 from the top of the illuminated path
|
||||
@@ -7663,20 +7674,29 @@ oedit_apply(int continue_editing)
|
||||
modelchanges[15] = 1000000000; /* => small ratio */
|
||||
|
||||
/* Now, recompute new chunks of displaylist */
|
||||
FOR_ALL_SOLIDS(sp, &gedp->ged_gdp->gd_headSolid) {
|
||||
if (sp->s_iflag == DOWN)
|
||||
continue;
|
||||
(void)replot_original_solid(sp);
|
||||
gdlp = BU_LIST_NEXT(ged_display_list, &gedp->ged_gdp->gd_headDisplay);
|
||||
while (BU_LIST_NOT_HEAD(gdlp, &gedp->ged_gdp->gd_headDisplay)) {
|
||||
next_gdlp = BU_LIST_PNEXT(ged_display_list, gdlp);
|
||||
|
||||
if (continue_editing == DOWN) {
|
||||
sp->s_iflag = DOWN;
|
||||
FOR_ALL_SOLIDS(sp, &gdlp->gdl_headSolid) {
|
||||
if (sp->s_iflag == DOWN)
|
||||
continue;
|
||||
(void)replot_original_solid(sp);
|
||||
|
||||
if (continue_editing == DOWN) {
|
||||
sp->s_iflag = DOWN;
|
||||
}
|
||||
}
|
||||
|
||||
gdlp = next_gdlp;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
oedit_accept(void)
|
||||
{
|
||||
register struct ged_display_list *gdlp;
|
||||
register struct ged_display_list *next_gdlp;
|
||||
register struct solid *sp;
|
||||
|
||||
if (dbip == DBI_NULL)
|
||||
@@ -7684,12 +7704,21 @@ oedit_accept(void)
|
||||
|
||||
if (dbip->dbi_read_only) {
|
||||
oedit_reject();
|
||||
FOR_ALL_SOLIDS(sp, &gedp->ged_gdp->gd_headSolid) {
|
||||
if (sp->s_iflag == DOWN)
|
||||
continue;
|
||||
(void)replot_original_solid(sp);
|
||||
sp->s_iflag = DOWN;
|
||||
|
||||
gdlp = BU_LIST_NEXT(ged_display_list, &gedp->ged_gdp->gd_headDisplay);
|
||||
while (BU_LIST_NOT_HEAD(gdlp, &gedp->ged_gdp->gd_headDisplay)) {
|
||||
next_gdlp = BU_LIST_PNEXT(ged_display_list, gdlp);
|
||||
|
||||
FOR_ALL_SOLIDS(sp, &gdlp->gdl_headSolid) {
|
||||
if (sp->s_iflag == DOWN)
|
||||
continue;
|
||||
(void)replot_original_solid(sp);
|
||||
sp->s_iflag = DOWN;
|
||||
}
|
||||
|
||||
gdlp = next_gdlp;
|
||||
}
|
||||
|
||||
bu_log("Sorry, this database is READ-ONLY\n");
|
||||
pr_prompt(interactive);
|
||||
|
||||
@@ -7920,11 +7949,20 @@ sedit_reject(void)
|
||||
|
||||
/* Restore the original solid everywhere */
|
||||
{
|
||||
register struct ged_display_list *gdlp;
|
||||
register struct ged_display_list *next_gdlp;
|
||||
register struct solid *sp;
|
||||
|
||||
FOR_ALL_SOLIDS(sp, &gedp->ged_gdp->gd_headSolid) {
|
||||
if (LAST_SOLID(sp) == LAST_SOLID(illump))
|
||||
(void)replot_original_solid(sp);
|
||||
gdlp = BU_LIST_NEXT(ged_display_list, &gedp->ged_gdp->gd_headDisplay);
|
||||
while (BU_LIST_NOT_HEAD(gdlp, &gedp->ged_gdp->gd_headDisplay)) {
|
||||
next_gdlp = BU_LIST_PNEXT(ged_display_list, gdlp);
|
||||
|
||||
FOR_ALL_SOLIDS(sp, &gdlp->gdl_headSolid) {
|
||||
if (LAST_SOLID(sp) == LAST_SOLID(illump))
|
||||
(void)replot_original_solid(sp);
|
||||
}
|
||||
|
||||
gdlp = next_gdlp;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+37
-19
@@ -124,6 +124,8 @@ hit_overlap(struct application *ap, struct partition *ph, struct region *r1, str
|
||||
int
|
||||
f_hideline(ClientData clientData, Tcl_Interp *interp, int argc, char **argv)
|
||||
{
|
||||
register struct ged_display_list *gdlp;
|
||||
register struct ged_display_list *next_gdlp;
|
||||
FILE *plotfp;
|
||||
char visible;
|
||||
int i, numobjs;
|
||||
@@ -160,13 +162,21 @@ f_hideline(ClientData clientData, Tcl_Interp *interp, int argc, char **argv)
|
||||
|
||||
/* Build list of objects being viewed */
|
||||
numobjs = 0;
|
||||
FOR_ALL_SOLIDS(sp, &gedp->ged_gdp->gd_headSolid) {
|
||||
for (i = 0; i < numobjs; i++) {
|
||||
if (objname[i] == FIRST_SOLID(sp)->d_namep)
|
||||
break;
|
||||
|
||||
gdlp = BU_LIST_NEXT(ged_display_list, &gedp->ged_gdp->gd_headDisplay);
|
||||
while (BU_LIST_NOT_HEAD(gdlp, &gedp->ged_gdp->gd_headDisplay)) {
|
||||
next_gdlp = BU_LIST_PNEXT(ged_display_list, gdlp);
|
||||
|
||||
FOR_ALL_SOLIDS(sp, &gdlp->gdl_headSolid) {
|
||||
for (i = 0; i < numobjs; i++) {
|
||||
if (objname[i] == FIRST_SOLID(sp)->d_namep)
|
||||
break;
|
||||
}
|
||||
if (i == numobjs)
|
||||
objname[numobjs++] = FIRST_SOLID(sp)->d_namep;
|
||||
}
|
||||
if (i == numobjs)
|
||||
objname[numobjs++] = FIRST_SOLID(sp)->d_namep;
|
||||
|
||||
gdlp = next_gdlp;
|
||||
}
|
||||
|
||||
Tcl_AppendResult(interp, "Generating hidden-line drawing of the following regions:\n",
|
||||
@@ -210,21 +220,25 @@ f_hideline(ClientData clientData, Tcl_Interp *interp, int argc, char **argv)
|
||||
MAT4X3VEC(a.a_ray.r_dir, view_state->vs_gvp->gv_view2model, temp);
|
||||
VUNITIZE(a.a_ray.r_dir);
|
||||
|
||||
FOR_ALL_SOLIDS(sp, &gedp->ged_gdp->gd_headSolid) {
|
||||
gdlp = BU_LIST_NEXT(ged_display_list, &gedp->ged_gdp->gd_headDisplay);
|
||||
while (BU_LIST_NOT_HEAD(gdlp, &gedp->ged_gdp->gd_headDisplay)) {
|
||||
next_gdlp = BU_LIST_PNEXT(ged_display_list, gdlp);
|
||||
|
||||
ratio = sp->s_size / VIEWSIZE; /* ignore if small or big */
|
||||
if (ratio >= dmp->dm_bound || ratio < 0.001)
|
||||
continue;
|
||||
FOR_ALL_SOLIDS(sp, &gdlp->gdl_headSolid) {
|
||||
|
||||
Tcl_AppendResult(interp, "Primitive\n", (char *)NULL);
|
||||
for (BU_LIST_FOR(vp, bn_vlist, &(sp->s_vlist))) {
|
||||
register int i;
|
||||
register int nused = vp->nused;
|
||||
register int *cmd = vp->cmd;
|
||||
register point_t *pt = vp->pt;
|
||||
for (i = 0; i < nused; i++, cmd++, pt++) {
|
||||
Tcl_AppendResult(interp, "\tVector\n", (char *)NULL);
|
||||
switch (*cmd) {
|
||||
ratio = sp->s_size / VIEWSIZE; /* ignore if small or big */
|
||||
if (ratio >= dmp->dm_bound || ratio < 0.001)
|
||||
continue;
|
||||
|
||||
Tcl_AppendResult(interp, "Primitive\n", (char *)NULL);
|
||||
for (BU_LIST_FOR(vp, bn_vlist, &(sp->s_vlist))) {
|
||||
register int i;
|
||||
register int nused = vp->nused;
|
||||
register int *cmd = vp->cmd;
|
||||
register point_t *pt = vp->pt;
|
||||
for (i = 0; i < nused; i++, cmd++, pt++) {
|
||||
Tcl_AppendResult(interp, "\tVector\n", (char *)NULL);
|
||||
switch (*cmd) {
|
||||
case BN_VLIST_POLY_START:
|
||||
case BN_VLIST_POLY_VERTNORM:
|
||||
break;
|
||||
@@ -270,10 +284,14 @@ f_hideline(ClientData clientData, Tcl_Interp *interp, int argc, char **argv)
|
||||
if (visible)
|
||||
DRAW(aim_point);
|
||||
VMOVE(last, *pt); /* new last vertex */
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
gdlp = next_gdlp;
|
||||
}
|
||||
|
||||
fclose(plotfp);
|
||||
return TCL_OK;
|
||||
}
|
||||
|
||||
+1
-41
@@ -129,47 +129,7 @@ color_zaprec(register struct mater *mp)
|
||||
void
|
||||
color_soltab(void)
|
||||
{
|
||||
register struct solid *sp;
|
||||
register struct mater *mp;
|
||||
|
||||
FOR_ALL_SOLIDS( sp, &gedp->ged_gdp->gd_headSolid ) {
|
||||
sp->s_cflag = 0;
|
||||
|
||||
/* the user specified the color, so use it */
|
||||
if ( sp->s_uflag ) {
|
||||
sp->s_color[0] = sp->s_basecolor[0];
|
||||
sp->s_color[1] = sp->s_basecolor[1];
|
||||
sp->s_color[2] = sp->s_basecolor[2];
|
||||
goto done;
|
||||
}
|
||||
|
||||
for ( mp = rt_material_head(); mp != MATER_NULL; mp = mp->mt_forw ) {
|
||||
if ( sp->s_regionid <= mp->mt_high &&
|
||||
sp->s_regionid >= mp->mt_low ) {
|
||||
sp->s_color[0] = mp->mt_r;
|
||||
sp->s_color[1] = mp->mt_g;
|
||||
sp->s_color[2] = mp->mt_b;
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* There is no region-id-based coloring entry in the
|
||||
* table, so use the combination-record ("mater"
|
||||
* command) based color if one was provided. Otherwise,
|
||||
* use the default wireframe color.
|
||||
* This is the "new way" of coloring things.
|
||||
*/
|
||||
|
||||
/* use wireframe_default_color */
|
||||
if (sp->s_dflag)
|
||||
sp->s_cflag = 1;
|
||||
/* Be conservative and copy color anyway, to avoid black */
|
||||
sp->s_color[0] = sp->s_basecolor[0];
|
||||
sp->s_color[1] = sp->s_basecolor[1];
|
||||
sp->s_color[2] = sp->s_basecolor[2];
|
||||
done: ;
|
||||
}
|
||||
ged_color_soltab(&gedp->ged_gdp->gd_headDisplay);
|
||||
update_views = 1; /* re-write control list with new colors */
|
||||
}
|
||||
|
||||
|
||||
+2
-1
@@ -248,6 +248,7 @@ extern void stop_catching_output(struct bu_vls *vp);
|
||||
* Pointer to solid in solid table to be illuminated. - defined in
|
||||
* usepen.c
|
||||
*/
|
||||
extern struct ged_display_list *illum_gdlp;
|
||||
extern struct solid *illump;/* == 0 if none, else points to ill. solid */
|
||||
extern int sedraw; /* apply solid editing changes */
|
||||
|
||||
@@ -642,7 +643,7 @@ void add_solid_path_to_result(
|
||||
|
||||
/* dozoom.c */
|
||||
void createDList(struct solid *sp);
|
||||
void createDLists(struct bu_list *hsp);
|
||||
void createDLists(struct bu_list *hdlp);
|
||||
void createDListALL(struct solid *sp);
|
||||
void createDListsAll(struct bu_list *hsp);
|
||||
void freeDListsAll(unsigned int dlist, int range);
|
||||
|
||||
+12
-3
@@ -89,6 +89,8 @@ cmd_overlay(ClientData clientData,
|
||||
int
|
||||
f_labelvert(ClientData clientData, Tcl_Interp *interp, int argc, char **argv)
|
||||
{
|
||||
register struct ged_display_list *gdlp;
|
||||
register struct ged_display_list *next_gdlp;
|
||||
int i;
|
||||
struct bn_vlblock*vbp;
|
||||
struct directory *dp;
|
||||
@@ -117,10 +119,17 @@ f_labelvert(ClientData clientData, Tcl_Interp *interp, int argc, char **argv)
|
||||
if ( (dp = db_lookup( dbip, argv[i], LOOKUP_NOISY )) == DIR_NULL )
|
||||
continue;
|
||||
/* Find uses of this solid in the solid table */
|
||||
FOR_ALL_SOLIDS(s, &gedp->ged_gdp->gd_headSolid) {
|
||||
if ( db_full_path_search( &s->s_fullpath, dp ) ) {
|
||||
rt_label_vlist_verts( vbp, &s->s_vlist, mat, scale, base2local );
|
||||
gdlp = BU_LIST_NEXT(ged_display_list, &gedp->ged_gdp->gd_headDisplay);
|
||||
while (BU_LIST_NOT_HEAD(gdlp, &gedp->ged_gdp->gd_headDisplay)) {
|
||||
next_gdlp = BU_LIST_PNEXT(ged_display_list, gdlp);
|
||||
|
||||
FOR_ALL_SOLIDS(s, &gdlp->gdl_headSolid) {
|
||||
if ( db_full_path_search( &s->s_fullpath, dp ) ) {
|
||||
rt_label_vlist_verts( vbp, &s->s_vlist, mat, scale, base2local );
|
||||
}
|
||||
}
|
||||
|
||||
gdlp = next_gdlp;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+54
-244
@@ -44,228 +44,11 @@
|
||||
#include "./mged_dm.h"
|
||||
|
||||
|
||||
/*
|
||||
* F _ P L O T
|
||||
*
|
||||
* plot file [opts]
|
||||
* potential options might include:
|
||||
* grid, 3d w/color, |filter, infinite Z
|
||||
*/
|
||||
int
|
||||
f_plot(ClientData clientData, Tcl_Interp *interp, int argc, char **argv)
|
||||
{
|
||||
register struct solid *sp;
|
||||
register struct bn_vlist *vp;
|
||||
register FILE *fp;
|
||||
static vect_t clipmin, clipmax;
|
||||
static vect_t last; /* last drawn point */
|
||||
static vect_t fin;
|
||||
static vect_t start;
|
||||
int Three_D; /* 0=2-D -vs- 1=3-D */
|
||||
int Z_clip; /* Z clipping */
|
||||
int Dashing; /* linetype is dashed */
|
||||
int floating; /* 3-D floating point plot */
|
||||
int is_pipe = 0;
|
||||
|
||||
if (argc < 2) {
|
||||
struct bu_vls vls;
|
||||
|
||||
bu_vls_init(&vls);
|
||||
bu_vls_printf(&vls, "help plot");
|
||||
Tcl_Eval(interp, bu_vls_addr(&vls));
|
||||
bu_vls_free(&vls);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
|
||||
if ( not_state( ST_VIEW, "UNIX Plot of view" ) )
|
||||
return TCL_ERROR;
|
||||
|
||||
/* Process any options */
|
||||
Three_D = 1; /* 3-D w/color, by default */
|
||||
Z_clip = 0; /* NO Z clipping, by default*/
|
||||
floating = 0;
|
||||
while ( argv[1] != (char *)0 && argv[1][0] == '-' ) {
|
||||
switch ( argv[1][1] ) {
|
||||
case 'f':
|
||||
floating = 1;
|
||||
break;
|
||||
case '3':
|
||||
Three_D = 1;
|
||||
break;
|
||||
case '2':
|
||||
Three_D = 0; /* 2-D, for portability */
|
||||
break;
|
||||
case 'g':
|
||||
/* do grid */
|
||||
Tcl_AppendResult(interp, "grid unimplemented\n", (char *)NULL);
|
||||
break;
|
||||
case 'z':
|
||||
case 'Z':
|
||||
/* Enable Z clipping */
|
||||
Tcl_AppendResult(interp, "Clipped in Z to viewing cube\n", (char *)NULL);
|
||||
Z_clip = 1;
|
||||
break;
|
||||
default:
|
||||
Tcl_AppendResult(interp, "bad PLOT option ", argv[1], "\n", (char *)NULL);
|
||||
break;
|
||||
}
|
||||
argv++;
|
||||
}
|
||||
if ( argv[1] == (char *)0 ) {
|
||||
Tcl_AppendResult(interp, "no filename or filter specified\n", (char *)NULL);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
if ( argv[1][0] == '|' ) {
|
||||
struct bu_vls str;
|
||||
bu_vls_init( &str );
|
||||
bu_vls_strcpy( &str, &argv[1][1] );
|
||||
while ( (++argv)[1] != (char *)0 ) {
|
||||
bu_vls_strcat( &str, " " );
|
||||
bu_vls_strcat( &str, argv[1] );
|
||||
}
|
||||
if ( (fp = popen( bu_vls_addr( &str ), "w" ) ) == NULL ) {
|
||||
perror( bu_vls_addr( &str ) );
|
||||
return TCL_ERROR;
|
||||
}
|
||||
|
||||
Tcl_AppendResult(interp, "piped to ", bu_vls_addr( &str ),
|
||||
"\n", (char *)NULL);
|
||||
bu_vls_free( &str );
|
||||
is_pipe = 1;
|
||||
} else {
|
||||
if ( (fp = fopen( argv[1], "w" )) == NULL ) {
|
||||
perror( argv[1] );
|
||||
return TCL_ERROR;
|
||||
}
|
||||
|
||||
Tcl_AppendResult(interp, "plot stored in ", argv[1], "\n", (char *)NULL);
|
||||
is_pipe = 0;
|
||||
}
|
||||
|
||||
if ( floating ) {
|
||||
pd_3space( fp,
|
||||
-view_state->vs_gvp->gv_center[MDX] - view_state->vs_gvp->gv_scale,
|
||||
-view_state->vs_gvp->gv_center[MDY] - view_state->vs_gvp->gv_scale,
|
||||
-view_state->vs_gvp->gv_center[MDZ] - view_state->vs_gvp->gv_scale,
|
||||
-view_state->vs_gvp->gv_center[MDX] + view_state->vs_gvp->gv_scale,
|
||||
-view_state->vs_gvp->gv_center[MDY] + view_state->vs_gvp->gv_scale,
|
||||
-view_state->vs_gvp->gv_center[MDZ] + view_state->vs_gvp->gv_scale );
|
||||
Dashing = 0;
|
||||
pl_linmod( fp, "solid" );
|
||||
FOR_ALL_SOLIDS(sp, &gedp->ged_gdp->gd_headSolid) {
|
||||
/* Could check for differences from last color */
|
||||
pl_color( fp,
|
||||
sp->s_color[0],
|
||||
sp->s_color[1],
|
||||
sp->s_color[2] );
|
||||
if ( Dashing != sp->s_soldash ) {
|
||||
if ( sp->s_soldash )
|
||||
pl_linmod( fp, "dotdashed");
|
||||
else
|
||||
pl_linmod( fp, "solid");
|
||||
Dashing = sp->s_soldash;
|
||||
}
|
||||
rt_vlist_to_uplot( fp, &(sp->s_vlist) );
|
||||
}
|
||||
goto out;
|
||||
}
|
||||
|
||||
/*
|
||||
* Integer output version, either 2-D or 3-D.
|
||||
* Viewing region is from -1.0 to +1.0
|
||||
* which is mapped to integer space -2048 to +2048 for plotting.
|
||||
* Compute the clipping bounds of the screen in view space.
|
||||
*/
|
||||
clipmin[X] = -1.0;
|
||||
clipmax[X] = 1.0;
|
||||
clipmin[Y] = -1.0;
|
||||
clipmax[Y] = 1.0;
|
||||
if ( Z_clip ) {
|
||||
clipmin[Z] = -1.0;
|
||||
clipmax[Z] = 1.0;
|
||||
} else {
|
||||
clipmin[Z] = -1.0e20;
|
||||
clipmax[Z] = 1.0e20;
|
||||
}
|
||||
|
||||
if ( Three_D )
|
||||
pl_3space( fp, (int)GED_MIN, (int)GED_MIN, (int)GED_MIN, (int)GED_MAX, (int)GED_MAX, (int)GED_MAX );
|
||||
else
|
||||
pl_space( fp, (int)GED_MIN, (int)GED_MIN, (int)GED_MAX, (int)GED_MAX );
|
||||
pl_erase( fp );
|
||||
Dashing = 0;
|
||||
pl_linmod( fp, "solid");
|
||||
FOR_ALL_SOLIDS(sp, &gedp->ged_gdp->gd_headSolid) {
|
||||
if ( Dashing != sp->s_soldash ) {
|
||||
if ( sp->s_soldash )
|
||||
pl_linmod( fp, "dotdashed");
|
||||
else
|
||||
pl_linmod( fp, "solid");
|
||||
Dashing = sp->s_soldash;
|
||||
}
|
||||
for ( BU_LIST_FOR( vp, bn_vlist, &(sp->s_vlist) ) ) {
|
||||
register int i;
|
||||
register int nused = vp->nused;
|
||||
register int *cmd = vp->cmd;
|
||||
register point_t *pt = vp->pt;
|
||||
for ( i = 0; i < nused; i++, cmd++, pt++ ) {
|
||||
switch ( *cmd ) {
|
||||
case BN_VLIST_POLY_START:
|
||||
case BN_VLIST_POLY_VERTNORM:
|
||||
continue;
|
||||
case BN_VLIST_POLY_MOVE:
|
||||
case BN_VLIST_LINE_MOVE:
|
||||
/* Move, not draw */
|
||||
MAT4X3PNT( last, view_state->vs_gvp->gv_model2view, *pt );
|
||||
continue;
|
||||
case BN_VLIST_POLY_DRAW:
|
||||
case BN_VLIST_POLY_END:
|
||||
case BN_VLIST_LINE_DRAW:
|
||||
/* draw */
|
||||
MAT4X3PNT(fin, view_state->vs_gvp->gv_model2view, *pt);
|
||||
VMOVE( start, last );
|
||||
VMOVE( last, fin );
|
||||
break;
|
||||
}
|
||||
if (
|
||||
vclip( start, fin, clipmin, clipmax ) == 0
|
||||
) continue;
|
||||
|
||||
if ( Three_D ) {
|
||||
/* Could check for differences from last color */
|
||||
pl_color( fp,
|
||||
sp->s_color[0],
|
||||
sp->s_color[1],
|
||||
sp->s_color[2] );
|
||||
pl_3line( fp,
|
||||
(int)( start[X] * GED_MAX ),
|
||||
(int)( start[Y] * GED_MAX ),
|
||||
(int)( start[Z] * GED_MAX ),
|
||||
(int)( fin[X] * GED_MAX ),
|
||||
(int)( fin[Y] * GED_MAX ),
|
||||
(int)( fin[Z] * GED_MAX ) );
|
||||
} else {
|
||||
pl_line( fp,
|
||||
(int)( start[0] * GED_MAX ),
|
||||
(int)( start[1] * GED_MAX ),
|
||||
(int)( fin[0] * GED_MAX ),
|
||||
(int)( fin[1] * GED_MAX ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
out:
|
||||
if ( is_pipe )
|
||||
(void)pclose( fp );
|
||||
else
|
||||
(void)fclose( fp );
|
||||
|
||||
return TCL_ERROR;
|
||||
}
|
||||
|
||||
int
|
||||
f_area(ClientData clientData, Tcl_Interp *interp, int argc, char **argv)
|
||||
{
|
||||
register struct ged_display_list *gdlp;
|
||||
register struct ged_display_list *next_gdlp;
|
||||
register struct solid *sp;
|
||||
register struct bn_vlist *vp;
|
||||
static vect_t last;
|
||||
@@ -282,6 +65,7 @@ f_area(ClientData clientData, Tcl_Interp *interp, int argc, char **argv)
|
||||
char result[RT_MAXLINE] = {0};
|
||||
char tol_str[32] = {0};
|
||||
char *tol_ptr;
|
||||
int is_empty = 1;
|
||||
|
||||
#ifndef _WIN32
|
||||
/* XXX needs fixing */
|
||||
@@ -301,21 +85,40 @@ f_area(ClientData clientData, Tcl_Interp *interp, int argc, char **argv)
|
||||
if ( not_state( ST_VIEW, "Presented Area Calculation" ) == TCL_ERROR )
|
||||
return TCL_ERROR;
|
||||
|
||||
if ( BU_LIST_IS_EMPTY( &gedp->ged_gdp->gd_headSolid ) ) {
|
||||
gdlp = BU_LIST_NEXT(ged_display_list, &gedp->ged_gdp->gd_headDisplay);
|
||||
while (BU_LIST_NOT_HEAD(gdlp, &gedp->ged_gdp->gd_headDisplay)) {
|
||||
next_gdlp = BU_LIST_PNEXT(ged_display_list, gdlp);
|
||||
|
||||
if (BU_LIST_NON_EMPTY(&gdlp->gdl_headSolid)) {
|
||||
is_empty = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
gdlp = next_gdlp;
|
||||
}
|
||||
|
||||
if (is_empty) {
|
||||
Tcl_AppendResult(interp, "No objects displayed!!!\n", (char *)NULL );
|
||||
return TCL_ERROR;
|
||||
}
|
||||
|
||||
FOR_ALL_SOLIDS(sp, &gedp->ged_gdp->gd_headSolid) {
|
||||
if ( !sp->s_Eflag && sp->s_soldash != 0 ) {
|
||||
struct bu_vls vls;
|
||||
gdlp = BU_LIST_NEXT(ged_display_list, &gedp->ged_gdp->gd_headDisplay);
|
||||
while (BU_LIST_NOT_HEAD(gdlp, &gedp->ged_gdp->gd_headDisplay)) {
|
||||
next_gdlp = BU_LIST_PNEXT(ged_display_list, gdlp);
|
||||
|
||||
bu_vls_init(&vls);
|
||||
bu_vls_printf(&vls, "help area");
|
||||
Tcl_Eval(interp, bu_vls_addr(&vls));
|
||||
bu_vls_free(&vls);
|
||||
return TCL_ERROR;
|
||||
FOR_ALL_SOLIDS(sp, &gdlp->gdl_headSolid) {
|
||||
if ( !sp->s_Eflag && sp->s_soldash != 0 ) {
|
||||
struct bu_vls vls;
|
||||
|
||||
bu_vls_init(&vls);
|
||||
bu_vls_printf(&vls, "help area");
|
||||
Tcl_Eval(interp, bu_vls_addr(&vls));
|
||||
bu_vls_free(&vls);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
gdlp = next_gdlp;
|
||||
}
|
||||
|
||||
if (argc == 2) {
|
||||
@@ -392,14 +195,18 @@ f_area(ClientData clientData, Tcl_Interp *interp, int argc, char **argv)
|
||||
* Write out rotated but unclipped, untranslated,
|
||||
* and unscaled vectors
|
||||
*/
|
||||
FOR_ALL_SOLIDS(sp, &gedp->ged_gdp->gd_headSolid) {
|
||||
for ( BU_LIST_FOR( vp, bn_vlist, &(sp->s_vlist) ) ) {
|
||||
register int i;
|
||||
register int nused = vp->nused;
|
||||
register int *cmd = vp->cmd;
|
||||
register point_t *pt = vp->pt;
|
||||
for ( i = 0; i < nused; i++, cmd++, pt++ ) {
|
||||
switch ( *cmd ) {
|
||||
gdlp = BU_LIST_NEXT(ged_display_list, &gedp->ged_gdp->gd_headDisplay);
|
||||
while (BU_LIST_NOT_HEAD(gdlp, &gedp->ged_gdp->gd_headDisplay)) {
|
||||
next_gdlp = BU_LIST_PNEXT(ged_display_list, gdlp);
|
||||
|
||||
FOR_ALL_SOLIDS(sp, &gdlp->gdl_headSolid) {
|
||||
for ( BU_LIST_FOR( vp, bn_vlist, &(sp->s_vlist) ) ) {
|
||||
register int i;
|
||||
register int nused = vp->nused;
|
||||
register int *cmd = vp->cmd;
|
||||
register point_t *pt = vp->pt;
|
||||
for ( i = 0; i < nused; i++, cmd++, pt++ ) {
|
||||
switch ( *cmd ) {
|
||||
case BN_VLIST_POLY_START:
|
||||
case BN_VLIST_POLY_VERTNORM:
|
||||
continue;
|
||||
@@ -414,17 +221,20 @@ f_area(ClientData clientData, Tcl_Interp *interp, int argc, char **argv)
|
||||
/* draw. */
|
||||
MAT4X3VEC(fin, view_state->vs_gvp->gv_rotation, *pt);
|
||||
break;
|
||||
}
|
||||
|
||||
fprintf(fp_w, "%.9e %.9e %.9e %.9e\n",
|
||||
last[X] * base2local,
|
||||
last[Y] * base2local,
|
||||
fin[X] * base2local,
|
||||
fin[Y] * base2local );
|
||||
|
||||
VMOVE( last, fin );
|
||||
}
|
||||
|
||||
fprintf(fp_w, "%.9e %.9e %.9e %.9e\n",
|
||||
last[X] * base2local,
|
||||
last[Y] * base2local,
|
||||
fin[X] * base2local,
|
||||
fin[Y] * base2local );
|
||||
|
||||
VMOVE( last, fin );
|
||||
}
|
||||
}
|
||||
|
||||
gdlp = next_gdlp;
|
||||
}
|
||||
|
||||
fclose(fp_w);
|
||||
|
||||
+19
-9
@@ -90,6 +90,8 @@ struct rt_imexport vertex_desc[] = {
|
||||
int
|
||||
f_polybinout(ClientData clientData, Tcl_Interp *interp, int argc, char **argv)
|
||||
{
|
||||
register struct ged_display_list *gdlp;
|
||||
register struct ged_display_list *next_gdlp;
|
||||
register struct solid *sp;
|
||||
register struct bn_vlist *vp;
|
||||
FILE *fp;
|
||||
@@ -115,15 +117,19 @@ f_polybinout(ClientData clientData, Tcl_Interp *interp, int argc, char **argv)
|
||||
return TCL_ERROR;
|
||||
}
|
||||
|
||||
FOR_ALL_SOLIDS(sp, &gedp->ged_gdp->gd_headSolid) {
|
||||
for ( BU_LIST_FOR( vp, bn_vlist, &(sp->s_vlist) ) ) {
|
||||
register int i;
|
||||
register int nused = vp->nused;
|
||||
register int *cmd = vp->cmd;
|
||||
register point_t *pt = vp->pt;
|
||||
for ( i = 0; i < nused; i++, cmd++, pt++ ) {
|
||||
/* For each polygon, spit it out. Ignore vectors */
|
||||
switch ( *cmd ) {
|
||||
gdlp = BU_LIST_NEXT(ged_display_list, &gedp->ged_gdp->gd_headDisplay);
|
||||
while (BU_LIST_NOT_HEAD(gdlp, &gedp->ged_gdp->gd_headDisplay)) {
|
||||
next_gdlp = BU_LIST_PNEXT(ged_display_list, gdlp);
|
||||
|
||||
FOR_ALL_SOLIDS(sp, &gdlp->gdl_headSolid) {
|
||||
for ( BU_LIST_FOR( vp, bn_vlist, &(sp->s_vlist) ) ) {
|
||||
register int i;
|
||||
register int nused = vp->nused;
|
||||
register int *cmd = vp->cmd;
|
||||
register point_t *pt = vp->pt;
|
||||
for ( i = 0; i < nused; i++, cmd++, pt++ ) {
|
||||
/* For each polygon, spit it out. Ignore vectors */
|
||||
switch ( *cmd ) {
|
||||
case BN_VLIST_LINE_MOVE:
|
||||
/* Move, start line */
|
||||
break;
|
||||
@@ -202,10 +208,14 @@ f_polybinout(ClientData clientData, Tcl_Interp *interp, int argc, char **argv)
|
||||
db_free_external( &obuf );
|
||||
ph.npts = 0; /* sanity */
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
gdlp = next_gdlp;
|
||||
}
|
||||
|
||||
fclose( fp );
|
||||
return TCL_OK;
|
||||
}
|
||||
|
||||
+18
-8
@@ -183,6 +183,8 @@ rt_read(FILE *fp, fastf_t *scale, fastf_t *eye, fastf_t *mat)
|
||||
int
|
||||
f_rmats(ClientData clientData, Tcl_Interp *interp, int argc, char **argv)
|
||||
{
|
||||
register struct ged_display_list *gdlp;
|
||||
register struct ged_display_list *next_gdlp;
|
||||
register FILE *fp;
|
||||
register struct directory *dp;
|
||||
register struct solid *sp;
|
||||
@@ -226,14 +228,22 @@ f_rmats(ClientData clientData, Tcl_Interp *interp, int argc, char **argv)
|
||||
mode = -1;
|
||||
break;
|
||||
}
|
||||
FOR_ALL_SOLIDS(sp, &gedp->ged_gdp->gd_headSolid) {
|
||||
if ( LAST_SOLID(sp) != dp ) continue;
|
||||
if ( BU_LIST_IS_EMPTY( &(sp->s_vlist) ) ) continue;
|
||||
vp = BU_LIST_LAST( bn_vlist, &(sp->s_vlist) );
|
||||
VMOVE( sav_start, vp->pt[vp->nused-1] );
|
||||
VMOVE( sav_center, sp->s_center );
|
||||
Tcl_AppendResult(interp, "animating EYE solid\n", (char *)NULL);
|
||||
goto work;
|
||||
|
||||
gdlp = BU_LIST_NEXT(ged_display_list, &gedp->ged_gdp->gd_headDisplay);
|
||||
while (BU_LIST_NOT_HEAD(gdlp, &gedp->ged_gdp->gd_headDisplay)) {
|
||||
next_gdlp = BU_LIST_PNEXT(ged_display_list, gdlp);
|
||||
|
||||
FOR_ALL_SOLIDS(sp, &gdlp->gdl_headSolid) {
|
||||
if ( LAST_SOLID(sp) != dp ) continue;
|
||||
if ( BU_LIST_IS_EMPTY( &(sp->s_vlist) ) ) continue;
|
||||
vp = BU_LIST_LAST( bn_vlist, &(sp->s_vlist) );
|
||||
VMOVE( sav_start, vp->pt[vp->nused-1] );
|
||||
VMOVE( sav_center, sp->s_center );
|
||||
Tcl_AppendResult(interp, "animating EYE solid\n", (char *)NULL);
|
||||
goto work;
|
||||
}
|
||||
|
||||
gdlp = next_gdlp;
|
||||
}
|
||||
/* Fall through */
|
||||
default:
|
||||
|
||||
+16
-5
@@ -372,7 +372,7 @@ set_dlist(void)
|
||||
if (dlp1->dml_dmp->dm_displaylist &&
|
||||
dlp1->dml_dlist_state->dl_active == 0) {
|
||||
curr_dm_list = dlp1;
|
||||
createDLists(&gedp->ged_gdp->gd_headSolid);
|
||||
createDLists(&gedp->ged_gdp->gd_headDisplay);
|
||||
dlp1->dml_dlist_state->dl_active = 1;
|
||||
dlp1->dml_dirty = 1;
|
||||
}
|
||||
@@ -401,11 +401,22 @@ set_dlist(void)
|
||||
|
||||
/* these display lists are not being used, so free them */
|
||||
if (BU_LIST_IS_HEAD(dlp2, &head_dm_list.l)) {
|
||||
register struct ged_display_list *gdlp;
|
||||
register struct ged_display_list *next_gdlp;
|
||||
|
||||
dlp1->dml_dlist_state->dl_active = 0;
|
||||
DM_FREEDLISTS(dlp1->dml_dmp,
|
||||
BU_LIST_FIRST(solid, &gedp->ged_gdp->gd_headSolid)->s_dlist,
|
||||
BU_LIST_LAST(solid, &gedp->ged_gdp->gd_headSolid)->s_dlist -
|
||||
BU_LIST_FIRST(solid, &gedp->ged_gdp->gd_headSolid)->s_dlist + 1);
|
||||
|
||||
gdlp = BU_LIST_NEXT(ged_display_list, &gedp->ged_gdp->gd_headDisplay);
|
||||
while (BU_LIST_NOT_HEAD(gdlp, &gedp->ged_gdp->gd_headDisplay)) {
|
||||
next_gdlp = BU_LIST_PNEXT(ged_display_list, gdlp);
|
||||
|
||||
DM_FREEDLISTS(dlp1->dml_dmp,
|
||||
BU_LIST_FIRST(solid, &gdlp->gdl_headSolid)->s_dlist,
|
||||
BU_LIST_LAST(solid, &gdlp->gdl_headSolid)->s_dlist -
|
||||
BU_LIST_FIRST(solid, &gdlp->gdl_headSolid)->s_dlist + 1);
|
||||
|
||||
gdlp = next_gdlp;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -192,7 +192,7 @@ f_share(ClientData clientData, Tcl_Interp *interp, int argc, char **argv)
|
||||
save_dlp = curr_dm_list;
|
||||
|
||||
curr_dm_list = dlp1;
|
||||
createDLists(&gedp->ged_gdp->gd_headSolid);
|
||||
createDLists(&gedp->ged_gdp->gd_headDisplay);
|
||||
|
||||
/* restore */
|
||||
curr_dm_list = save_dlp;
|
||||
|
||||
+61
-25
@@ -43,6 +43,7 @@
|
||||
double degtorad = 0.01745329251994329573;
|
||||
double radtodeg = 57.29577951308232098299;
|
||||
|
||||
struct ged_display_list *illum_gdlp = GED_DISPLAY_LIST_NULL;
|
||||
struct solid *illump = SOLID_NULL; /* == 0 if none, else points to ill. solid */
|
||||
int ipathpos = 0; /* path index of illuminated element */
|
||||
/* set by e9.c, cleared here */
|
||||
@@ -274,6 +275,8 @@ f_mouse(
|
||||
*/
|
||||
static void
|
||||
illuminate(int y) {
|
||||
register struct ged_display_list *gdlp;
|
||||
register struct ged_display_list *next_gdlp;
|
||||
register int count;
|
||||
register struct solid *sp;
|
||||
|
||||
@@ -284,17 +287,25 @@ illuminate(int y) {
|
||||
*/
|
||||
count = ((fastf_t)y + GED_MAX) * ndrawn / GED_RANGE;
|
||||
|
||||
FOR_ALL_SOLIDS(sp, &gedp->ged_gdp->gd_headSolid) {
|
||||
/* Only consider solids which are presently in view */
|
||||
if ( sp->s_flag == UP ) {
|
||||
if ( count-- == 0 ) {
|
||||
sp->s_iflag = UP;
|
||||
illump = sp;
|
||||
} else {
|
||||
/* All other solids have s_iflag set DOWN */
|
||||
sp->s_iflag = DOWN;
|
||||
gdlp = BU_LIST_NEXT(ged_display_list, &gedp->ged_gdp->gd_headDisplay);
|
||||
while (BU_LIST_NOT_HEAD(gdlp, &gedp->ged_gdp->gd_headDisplay)) {
|
||||
next_gdlp = BU_LIST_PNEXT(ged_display_list, gdlp);
|
||||
|
||||
FOR_ALL_SOLIDS(sp, &gdlp->gdl_headSolid) {
|
||||
/* Only consider solids which are presently in view */
|
||||
if ( sp->s_flag == UP ) {
|
||||
if ( count-- == 0 ) {
|
||||
sp->s_iflag = UP;
|
||||
illump = sp;
|
||||
illum_gdlp = gdlp;
|
||||
} else {
|
||||
/* All other solids have s_iflag set DOWN */
|
||||
sp->s_iflag = DOWN;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
gdlp = next_gdlp;
|
||||
}
|
||||
|
||||
update_views = 1;
|
||||
@@ -312,6 +323,7 @@ f_aip(
|
||||
int argc,
|
||||
char **argv)
|
||||
{
|
||||
register struct ged_display_list *gdlp;
|
||||
register struct solid *sp;
|
||||
|
||||
if (argc < 1 || 2 < argc) {
|
||||
@@ -344,17 +356,31 @@ f_aip(
|
||||
return TCL_ERROR;
|
||||
}
|
||||
} else {
|
||||
gdlp = illum_gdlp;
|
||||
sp = illump;
|
||||
sp->s_iflag = DOWN;
|
||||
if (argc == 1 || *argv[1] == 'f') {
|
||||
if (BU_LIST_NEXT_IS_HEAD(sp, &gedp->ged_gdp->gd_headSolid))
|
||||
sp = BU_LIST_NEXT(solid, &gedp->ged_gdp->gd_headSolid);
|
||||
else
|
||||
if (BU_LIST_NEXT_IS_HEAD(sp, &gdlp->gdl_headSolid)) {
|
||||
/* Advance the gdlp (i.e. display list) */
|
||||
if (BU_LIST_NEXT_IS_HEAD(gdlp, &gedp->ged_gdp->gd_headDisplay))
|
||||
gdlp = BU_LIST_NEXT(ged_display_list, &gedp->ged_gdp->gd_headDisplay);
|
||||
else
|
||||
gdlp = BU_LIST_PNEXT(ged_display_list, gdlp);
|
||||
|
||||
|
||||
sp = BU_LIST_NEXT(solid, &gdlp->gdl_headSolid);
|
||||
} else
|
||||
sp = BU_LIST_PNEXT(solid, sp);
|
||||
} else if (*argv[1] == 'b') {
|
||||
if (BU_LIST_PREV_IS_HEAD(sp, &gedp->ged_gdp->gd_headSolid))
|
||||
sp = BU_LIST_PREV(solid, &gedp->ged_gdp->gd_headSolid);
|
||||
else
|
||||
if (BU_LIST_PREV_IS_HEAD(sp, &gdlp->gdl_headSolid)) {
|
||||
/* Advance the gdlp (i.e. display list) */
|
||||
if (BU_LIST_PREV_IS_HEAD(gdlp, &gedp->ged_gdp->gd_headDisplay))
|
||||
gdlp = BU_LIST_PREV(ged_display_list, &gedp->ged_gdp->gd_headDisplay);
|
||||
else
|
||||
gdlp = BU_LIST_PLAST(ged_display_list, gdlp);
|
||||
|
||||
sp = BU_LIST_PREV(solid, &gdlp->gdl_headSolid);
|
||||
} else
|
||||
sp = BU_LIST_PLAST(solid, sp);
|
||||
} else {
|
||||
Tcl_AppendResult(interp, "aip: bad parameter - ", argv[1], "\n", (char *)NULL);
|
||||
@@ -363,6 +389,7 @@ f_aip(
|
||||
|
||||
sp->s_iflag = UP;
|
||||
illump = sp;
|
||||
illum_gdlp = gdlp;
|
||||
}
|
||||
|
||||
update_views = 1;
|
||||
@@ -472,6 +499,8 @@ f_matpick(
|
||||
int argc,
|
||||
char **argv)
|
||||
{
|
||||
register struct ged_display_list *gdlp;
|
||||
register struct ged_display_list *next_gdlp;
|
||||
register struct solid *sp;
|
||||
char *cp;
|
||||
register int j;
|
||||
@@ -534,17 +563,24 @@ f_matpick(
|
||||
}
|
||||
got:
|
||||
/* Include all solids with same tree top */
|
||||
FOR_ALL_SOLIDS(sp, &gedp->ged_gdp->gd_headSolid) {
|
||||
for ( j = 0; j <= ipathpos; j++ ) {
|
||||
if ( DB_FULL_PATH_GET(&sp->s_fullpath, j) !=
|
||||
DB_FULL_PATH_GET(&illump->s_fullpath, j) )
|
||||
break;
|
||||
gdlp = BU_LIST_NEXT(ged_display_list, &gedp->ged_gdp->gd_headDisplay);
|
||||
while (BU_LIST_NOT_HEAD(gdlp, &gedp->ged_gdp->gd_headDisplay)) {
|
||||
next_gdlp = BU_LIST_PNEXT(ged_display_list, gdlp);
|
||||
|
||||
FOR_ALL_SOLIDS(sp, &gdlp->gdl_headSolid) {
|
||||
for ( j = 0; j <= ipathpos; j++ ) {
|
||||
if ( DB_FULL_PATH_GET(&sp->s_fullpath, j) !=
|
||||
DB_FULL_PATH_GET(&illump->s_fullpath, j) )
|
||||
break;
|
||||
}
|
||||
/* Only accept if top of tree is identical */
|
||||
if ( j == ipathpos+1 )
|
||||
sp->s_iflag = UP;
|
||||
else
|
||||
sp->s_iflag = DOWN;
|
||||
}
|
||||
/* Only accept if top of tree is identical */
|
||||
if ( j == ipathpos+1 )
|
||||
sp->s_iflag = UP;
|
||||
else
|
||||
sp->s_iflag = DOWN;
|
||||
|
||||
gdlp = next_gdlp;
|
||||
}
|
||||
|
||||
if (!illum_only) {
|
||||
|
||||
Reference in new issue
Block a user