Compare commits
20
Commits
gedplugins
...
eab
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b9b08ac247 | ||
|
|
fd46180d35 | ||
|
|
2c4e72133d | ||
|
|
14c5bba72a | ||
|
|
e540017986 | ||
|
|
a4a86b9642 | ||
|
|
582a559aa4 | ||
|
|
9a683abc3b | ||
|
|
ab35ad4724 | ||
|
|
3c48c05b62 | ||
|
|
3b234f6598 | ||
|
|
17a79a6cd5 | ||
|
|
a1689c8370 | ||
|
|
acca4717b5 | ||
|
|
164b237cc9 | ||
|
|
432c45ea2b | ||
|
|
27aaf93857 | ||
|
|
a7142e54a9 | ||
|
|
a6e7ead562 | ||
|
|
12773c6f11 |
@@ -1,2 +0,0 @@
|
||||
/bin
|
||||
/lib
|
||||
+2
-1
@@ -182,6 +182,7 @@ typedef struct {
|
||||
|
||||
typedef struct {
|
||||
int gdps_draw;
|
||||
int gdps_moveAll;
|
||||
int gdps_color[3];
|
||||
int gdps_line_width; /* in pixels */
|
||||
int gdps_line_style;
|
||||
@@ -196,7 +197,7 @@ typedef struct {
|
||||
mat_t gdps_rotation;
|
||||
mat_t gdps_view2model;
|
||||
mat_t gdps_model2view;
|
||||
bview_polygons gdps_polygons;
|
||||
bview_polygons gdps_polygons;
|
||||
fastf_t gdps_data_vZ;
|
||||
} bview_data_polygon_state;
|
||||
|
||||
|
||||
@@ -367,6 +367,7 @@ struct ged {
|
||||
void (*ged_refresh_handler)(void *); /**< @brief function for handling refresh requests */
|
||||
void (*ged_output_handler)(struct ged *, char *); /**< @brief function for handling output */
|
||||
char *ged_output_script; /**< @brief script for use by the outputHandler */
|
||||
void (*ged_create_vlist_solid_callback)(struct solid *); /**< @brief function to call after creating a vlist to create display list for solid */
|
||||
void (*ged_create_vlist_callback)(struct display_list *); /**< @brief function to call after creating a vlist */
|
||||
void (*ged_free_vlist_callback)(); /**< @brief function to call after freeing a vlist */
|
||||
|
||||
@@ -1169,6 +1170,11 @@ GED_EXPORT extern int ged_killrefs(struct ged *gedp, int argc, const char *argv[
|
||||
*/
|
||||
GED_EXPORT extern int ged_killtree(struct ged *gedp, int argc, const char *argv[]);
|
||||
|
||||
/**
|
||||
* List attributes of regions within a group/combination.
|
||||
*/
|
||||
GED_EXPORT extern int ged_lc(struct ged *gedp, int argc, const char *argv[]);
|
||||
|
||||
/**
|
||||
* List object information, verbose.
|
||||
*/
|
||||
@@ -1899,6 +1905,7 @@ GED_EXPORT extern int ged_export_polygon(struct ged *gedp, bview_data_polygon_st
|
||||
GED_EXPORT extern bview_polygon *ged_import_polygon(struct ged *gedp, const char *sname);
|
||||
GED_EXPORT extern fastf_t ged_find_polygon_area(bview_polygon *gpoly, fastf_t sf, matp_t model2view, fastf_t size);
|
||||
GED_EXPORT extern int ged_polygons_overlap(struct ged *gedp, bview_polygon *polyA, bview_polygon *polyB);
|
||||
GED_EXPORT extern void ged_polygon_fill_segments(struct ged *gedp, bview_polygon *poly, vect2d_t vfilldir, fastf_t vfilldelta);
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -4576,58 +4576,6 @@ RT_EXPORT extern void db_update_nref(struct db_i *dbip,
|
||||
struct resource *resp);
|
||||
|
||||
|
||||
/**
|
||||
* DEPRECATED: Use bu_fnmatch() instead of this function.
|
||||
*
|
||||
* If string matches pattern, return 1, else return 0
|
||||
*
|
||||
* special characters:
|
||||
* * Matches any string including the null string.
|
||||
* ? Matches any single character.
|
||||
* [...] Matches any one of the characters enclosed.
|
||||
* - May be used inside brackets to specify range
|
||||
* (i.e. str[1-58] matches str1, str2, ... str5, str8)
|
||||
* \ Escapes special characters.
|
||||
*/
|
||||
DEPRECATED RT_EXPORT extern int db_regexp_match(const char *pattern,
|
||||
const char *string);
|
||||
|
||||
|
||||
/**
|
||||
* Appends a list of all database matches to the given vls, or the
|
||||
* pattern itself if no matches are found. Returns the number of
|
||||
* matches.
|
||||
*/
|
||||
RT_EXPORT extern int db_regexp_match_all(struct bu_vls *dest,
|
||||
struct db_i *dbip,
|
||||
const char *pattern);
|
||||
|
||||
/* db_ls.c */
|
||||
/**
|
||||
* db_ls takes a database instance pointer and assembles a directory
|
||||
* pointer array of objects in the database according to a set of
|
||||
* flags.
|
||||
*
|
||||
* The caller is responsible for freeing the array.
|
||||
*
|
||||
* Returns -
|
||||
* integer count of objects in dpv
|
||||
* struct directory ** array of objects in dpv via argument
|
||||
*
|
||||
* WARNING: THIS FUNCTION IS STILL IN DEVELOPMENT - IT IS NOT YET
|
||||
* ASSUMED THAT THIS IS ITS FINAL FORM - DO NOT DEPEND ON IT REMAINING
|
||||
* THE SAME UNTIL THIS WARNING IS REMOVED
|
||||
*/
|
||||
#define DB_LS_PRIM 0x1 /* filter for primitives (solids)*/
|
||||
#define DB_LS_COMB 0x2 /* filter for combinations */
|
||||
#define DB_LS_REGION 0x4 /* filter for regions */
|
||||
#define DB_LS_HIDDEN 0x8 /* include hidden objects in results */
|
||||
#define DB_LS_NON_GEOM 0x10 /* filter for non-geometry objects */
|
||||
#define DB_LS_TOPS 0x20 /* filter for objects un-referenced by other objects */
|
||||
RT_EXPORT extern int db_ls(const struct db_i *dbip,
|
||||
int flags,
|
||||
struct directory ***dpv);
|
||||
|
||||
/**
|
||||
* convert an argv list of names to a directory pointer array.
|
||||
*
|
||||
|
||||
+43
-4
@@ -17,12 +17,12 @@
|
||||
* License along with this file; see the file named COPYING for more
|
||||
* information.
|
||||
*/
|
||||
/** @addtogroup librt */
|
||||
/** @{ */
|
||||
/** @file include/rt/search.h
|
||||
*
|
||||
/** @addtogroup db_search
|
||||
* @brief
|
||||
* Functionality for searching .g files
|
||||
*/
|
||||
/** @{ */
|
||||
/** @file include/rt/search.h */
|
||||
|
||||
#ifndef RT_SEARCH_H
|
||||
#define RT_SEARCH_H
|
||||
@@ -34,6 +34,7 @@
|
||||
|
||||
#include "rt/defines.h"
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
/**
|
||||
* @brief Search for objects in a geometry database using filters
|
||||
@@ -121,6 +122,38 @@ RT_EXPORT extern int db_search(struct bu_ptbl *results,
|
||||
RT_EXPORT extern void db_search_free(struct bu_ptbl *search_results);
|
||||
|
||||
|
||||
/* db_ls.c */
|
||||
/**
|
||||
* db_ls takes a database instance pointer and assembles a directory
|
||||
* pointer array of objects in the database according to a set of
|
||||
* flags. An optional pattern can be supplied for match filtering
|
||||
* via globbing rules (see bu_fnmatch). If pattern is NULL, filtering
|
||||
* is performed using only the flags.
|
||||
*
|
||||
* The caller is responsible for freeing the array.
|
||||
*
|
||||
* Returns -
|
||||
* integer count of objects in dpv
|
||||
* struct directory ** array of objects in dpv via argument
|
||||
*
|
||||
*/
|
||||
RT_EXPORT extern size_t db_ls(const struct db_i *dbip,
|
||||
int flags,
|
||||
const char *pattern,
|
||||
struct directory ***dpv);
|
||||
|
||||
/* These are the possible listing flags. */
|
||||
#define DB_LS_PRIM 0x1 /**< @brief filter for primitives (solids)*/
|
||||
#define DB_LS_COMB 0x2 /**< @brief filter for combinations */
|
||||
#define DB_LS_REGION 0x4 /**< @brief filter for regions */
|
||||
#define DB_LS_HIDDEN 0x8 /**< @brief include hidden objects in results */
|
||||
#define DB_LS_NON_GEOM 0x10 /**< @brief filter for non-geometry objects */
|
||||
#define DB_LS_TOPS 0x20 /**< @brief filter for objects un-referenced by other objects */
|
||||
/* TODO - implement this flag
|
||||
#define DB_LS_REGEX 0x40*/ /* interpret pattern using regex rules, instead of
|
||||
globbing rules (default) */
|
||||
|
||||
|
||||
|
||||
/***************************************************************
|
||||
* DEPRECATED - all structures and functions below this notice
|
||||
@@ -144,8 +177,14 @@ DEPRECATED RT_EXPORT extern struct db_full_path_list *db_search_full_paths(void
|
||||
DEPRECATED RT_EXPORT extern struct bu_ptbl *db_search_unique_objects(void *searchplan,
|
||||
struct db_full_path_list *path_list,
|
||||
struct db_i *dbip);
|
||||
/* DEPRECATED: Use db_ls() instead of this function. */
|
||||
DEPRECATED RT_EXPORT extern int db_regexp_match_all(struct bu_vls *dest,
|
||||
struct db_i *dbip,
|
||||
const char *pattern);
|
||||
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif /* RT_SEARCH_H*/
|
||||
/** @} */
|
||||
/*
|
||||
|
||||
@@ -115,7 +115,7 @@ main(int argc, char *argv[])
|
||||
if (convert_tops_list) {
|
||||
/* Need db_update_nref for DB_LS_TOPS to work */
|
||||
db_update_nref(dbip, &rt_uniresource);
|
||||
path_cnt = db_ls(dbip, DB_LS_TOPS, &paths);
|
||||
path_cnt = db_ls(dbip, DB_LS_TOPS, NULL, &paths);
|
||||
if (!path_cnt) {
|
||||
std::cerr << "ERROR: no objects found in .g file" << "\n" << std::endl;
|
||||
delete dotg;
|
||||
|
||||
@@ -62,6 +62,7 @@ set(LIBBU_SOURCES
|
||||
observer.c
|
||||
parallel.c
|
||||
parse.c
|
||||
path.c
|
||||
printb.c
|
||||
process.c
|
||||
progname.c
|
||||
|
||||
+53
-5
@@ -32,6 +32,10 @@
|
||||
extern int kill(pid_t, int);
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_KILL
|
||||
#include <TlHelp32.h>
|
||||
int bu_terminateWinProc(int process);
|
||||
#endif
|
||||
|
||||
int
|
||||
bu_terminate(int process)
|
||||
@@ -40,18 +44,62 @@ bu_terminate(int process)
|
||||
|
||||
#ifdef HAVE_KILL
|
||||
/* kill() returns 0 for success */
|
||||
successful = kill(process, SIGKILL);
|
||||
successful = kill(-process, SIGKILL);
|
||||
successful = !successful;
|
||||
#else
|
||||
HANDLE hProcess = OpenProcess(PROCESS_ALL_ACCESS, TRUE, (DWORD)process);
|
||||
if (hProcess != NULL) {
|
||||
successful = TerminateProcess(hProcess, 0);
|
||||
}
|
||||
bu_terminateWinProc(process);
|
||||
#endif
|
||||
|
||||
return successful;
|
||||
}
|
||||
|
||||
#ifndef HAVE_KILL
|
||||
int
|
||||
bu_terminateWinProc(int process)
|
||||
{
|
||||
int successful = 0;
|
||||
HANDLE hProcessSnap;
|
||||
HANDLE hProcess;
|
||||
PROCESSENTRY32 pe32 = {0};
|
||||
|
||||
pe32.dwSize = sizeof(PROCESSENTRY32);
|
||||
hProcessSnap = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
|
||||
if (hProcessSnap == INVALID_HANDLE_VALUE) {
|
||||
return successful;
|
||||
}
|
||||
|
||||
if (!Process32First(hProcessSnap, &pe32)) {
|
||||
CloseHandle(hProcessSnap);
|
||||
return successful;
|
||||
}
|
||||
|
||||
/* First, find and kill the children */
|
||||
do {
|
||||
if (pe32.th32ParentProcessID == (DWORD)process) {
|
||||
#if 1
|
||||
bu_terminateWinProc((int)pe32.th32ProcessID);
|
||||
#else
|
||||
hProcess = OpenProcess(PROCESS_ALL_ACCESS, TRUE, pe32.th32ProcessID);
|
||||
if (hProcess != NULL) {
|
||||
TerminateProcess(hProcess, 0);
|
||||
CloseHandle(hProcess);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
} while(Process32Next(hProcessSnap, &pe32));
|
||||
|
||||
/* Finally, kill the parent */
|
||||
hProcess = OpenProcess(PROCESS_ALL_ACCESS, TRUE, (DWORD)process);
|
||||
if (hProcess != NULL) {
|
||||
successful = TerminateProcess(hProcess, 0);
|
||||
CloseHandle(hProcess);
|
||||
}
|
||||
|
||||
CloseHandle(hProcessSnap);
|
||||
return successful;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Local Variables:
|
||||
* tab-width: 8
|
||||
|
||||
+22
-98
@@ -59,6 +59,7 @@
|
||||
#ifdef HAVE_GL_GL_H
|
||||
# include <GL/gl.h>
|
||||
#endif
|
||||
|
||||
#undef remainder
|
||||
#undef access
|
||||
#undef index
|
||||
@@ -72,7 +73,6 @@
|
||||
|
||||
#include "vmath.h"
|
||||
#include "bn.h"
|
||||
#include "raytrace.h"
|
||||
#include "dm.h"
|
||||
#include "dm-ogl.h"
|
||||
#include "dm-Null.h"
|
||||
@@ -92,28 +92,6 @@
|
||||
#define YSTEREO 491 /* subfield height, in scanlines */
|
||||
#define YOFFSET_LEFT 532 /* YSTEREO + YBLANK ? */
|
||||
|
||||
#define Ogl_MV_O(_m) offsetof(struct modifiable_ogl_vars, _m)
|
||||
|
||||
struct modifiable_ogl_vars {
|
||||
dm *this_dm;
|
||||
int cueing_on;
|
||||
int zclipping_on;
|
||||
int zbuffer_on;
|
||||
int lighting_on;
|
||||
int transparency_on;
|
||||
int fastfog;
|
||||
double fogdensity;
|
||||
int zbuf;
|
||||
int rgb;
|
||||
int doublebuffer;
|
||||
int depth;
|
||||
int debug;
|
||||
struct bu_vls log;
|
||||
double bound;
|
||||
int boundFlag;
|
||||
};
|
||||
|
||||
|
||||
HIDDEN XVisualInfo *ogl_choose_visual(struct dm_internal *dmp, Tk_Window tkwin);
|
||||
|
||||
/* Display Manager package interface */
|
||||
@@ -1781,6 +1759,9 @@ ogl_drawVList(struct dm_internal *dmp, struct bn_vlist *vp)
|
||||
if (first == 0)
|
||||
glEnd();
|
||||
first = 0;
|
||||
#if 0
|
||||
glEnable(GL_POINT_SMOOTH);
|
||||
#endif
|
||||
glBegin(GL_POINTS);
|
||||
glVertex3dv(dpt);
|
||||
break;
|
||||
@@ -1941,6 +1922,9 @@ ogl_drawPoint2D(struct dm_internal *dmp, fastf_t x, fastf_t y)
|
||||
bu_log("\tdmp: %p\tx - %lf\ty - %lf\n", (void *)dmp, x, y);
|
||||
}
|
||||
|
||||
#if 0
|
||||
glEnable(GL_POINT_SMOOTH);
|
||||
#endif
|
||||
glBegin(GL_POINTS);
|
||||
glVertex2f(x, y);
|
||||
glEnd();
|
||||
@@ -1965,6 +1949,9 @@ ogl_drawPoint3D(struct dm_internal *dmp, point_t point)
|
||||
/* fastf_t to double */
|
||||
VMOVE(dpt, point);
|
||||
|
||||
#if 0
|
||||
glEnable(GL_POINT_SMOOTH);
|
||||
#endif
|
||||
glBegin(GL_POINTS);
|
||||
glVertex3dv(dpt);
|
||||
glEnd();
|
||||
@@ -1986,7 +1973,9 @@ ogl_drawPoints3D(struct dm_internal *dmp, int npoints, point_t *points)
|
||||
bu_log("ogl_drawPoint3D():\n");
|
||||
}
|
||||
|
||||
|
||||
#if 0
|
||||
glEnable(GL_POINT_SMOOTH);
|
||||
#endif
|
||||
glBegin(GL_POINTS);
|
||||
for (i = 0; i < npoints; ++i) {
|
||||
/* fastf_t to double */
|
||||
@@ -2264,85 +2253,20 @@ ogl_draw_obj(struct dm_internal *dmp, struct display_list *obj)
|
||||
HIDDEN int
|
||||
ogl_getDisplayImage(struct dm_internal *dmp, unsigned char **image)
|
||||
{
|
||||
unsigned char *idata = NULL;
|
||||
int width = 0;
|
||||
int height = 0;
|
||||
int bytes_per_pixel = 3; /*rgb no alpha for raw pix */
|
||||
GLuint *pixels;
|
||||
unsigned int pixel;
|
||||
unsigned int red_mask = 0xff000000;
|
||||
unsigned int green_mask = 0x00ff0000;
|
||||
unsigned int blue_mask = 0x0000ff00;
|
||||
int h, w;
|
||||
#if defined(DM_WGL)
|
||||
unsigned int alpha_mask = 0x000000ff;
|
||||
int big_endian;
|
||||
int swap_bytes;
|
||||
|
||||
if ((bu_byteorder() == BU_BIG_ENDIAN))
|
||||
big_endian = 1;
|
||||
else
|
||||
big_endian = 0;
|
||||
|
||||
/* WTF */
|
||||
swap_bytes = !big_endian;
|
||||
#endif
|
||||
|
||||
if (dmp->dm_type == DM_TYPE_WGL || dmp->dm_type == DM_TYPE_OGL) {
|
||||
unsigned char *idata;
|
||||
int width;
|
||||
int height;
|
||||
|
||||
width = dmp->dm_width;
|
||||
height = dmp->dm_height;
|
||||
|
||||
pixels = (GLuint *)bu_calloc(width * height, sizeof(GLuint), "pixels");
|
||||
idata = (unsigned char*)bu_calloc(height * width * 3, sizeof(unsigned char), "rgb data");
|
||||
|
||||
{
|
||||
glReadBuffer(GL_FRONT);
|
||||
#if defined(DM_WGL)
|
||||
/* XXX GL_UNSIGNED_INT_8_8_8_8 is currently not
|
||||
* available on windows. Need to update when it
|
||||
* becomes available.
|
||||
*/
|
||||
glReadPixels(0, 0, width, height, GL_RGBA, GL_UNSIGNED_BYTE, pixels);
|
||||
#else
|
||||
glReadPixels(0, 0, width, height, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8, pixels);
|
||||
#endif
|
||||
|
||||
idata = (unsigned char *)bu_calloc(height * width * bytes_per_pixel, sizeof(unsigned char), "rgb data");
|
||||
*image = idata;
|
||||
|
||||
for (h = 0; h < height; h++) {
|
||||
for (w = 0; w < width; w++) {
|
||||
int i = h*width + w;
|
||||
int i_h_inv = (height - h - 1)*width + w;
|
||||
int j = i*bytes_per_pixel;
|
||||
unsigned char *value = (unsigned char *)(idata + j);
|
||||
#if defined(DM_WGL)
|
||||
unsigned char alpha;
|
||||
#endif
|
||||
|
||||
pixel = pixels[i_h_inv];
|
||||
|
||||
value[0] = (pixel & red_mask) >> 24;
|
||||
value[1] = (pixel & green_mask) >> 16;
|
||||
value[2] = (pixel & blue_mask) >> 8;
|
||||
|
||||
#if defined(DM_WGL)
|
||||
alpha = pixel & alpha_mask;
|
||||
if (swap_bytes) {
|
||||
unsigned char tmp_byte;
|
||||
|
||||
value[0] = alpha;
|
||||
/* swap byte1 and byte2 */
|
||||
tmp_byte = value[1];
|
||||
value[1] = value[2];
|
||||
value[2] = tmp_byte;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
bu_free(pixels, "pixels");
|
||||
}
|
||||
glReadBuffer(GL_FRONT);
|
||||
glPixelStorei(GL_PACK_ALIGNMENT, 1);
|
||||
glReadPixels(0, 0, width, height, GL_RGB, GL_UNSIGNED_BYTE, idata);
|
||||
*image = idata;
|
||||
} else {
|
||||
bu_log("ogl_getDisplayImage: Display type not set as OGL or WGL\n");
|
||||
return TCL_ERROR;
|
||||
|
||||
+67
-81
@@ -41,7 +41,6 @@
|
||||
|
||||
#include "vmath.h"
|
||||
#include "bn.h"
|
||||
#include "raytrace.h"
|
||||
#include "dm.h"
|
||||
#include "dm-Null.h"
|
||||
#include "dm-wgl.h"
|
||||
@@ -52,27 +51,6 @@
|
||||
|
||||
#include "./dm_private.h"
|
||||
|
||||
#define Wgl_MV_O(_m) offsetof(struct modifiable_wgl_vars, _m)
|
||||
|
||||
struct modifiable_wgl_vars {
|
||||
dm *this_dm;
|
||||
int cueing_on;
|
||||
int zclipping_on;
|
||||
int zbuffer_on;
|
||||
int lighting_on;
|
||||
int transparency_on;
|
||||
int fastfog;
|
||||
double fogdensity;
|
||||
int zbuf;
|
||||
int rgb;
|
||||
int doublebuffer;
|
||||
int depth;
|
||||
int debug;
|
||||
struct bu_vls log;
|
||||
double bound;
|
||||
int boundFlag;
|
||||
};
|
||||
|
||||
#define VIEWFACTOR (1.0/(*dmp->dm_vp))
|
||||
#define VIEWSIZE (2.0*(*dmp->dm_vp))
|
||||
|
||||
@@ -115,7 +93,7 @@ static float backDiffuseColorLight[4];
|
||||
void
|
||||
wgl_fogHint(dm *dmp, int fastfog)
|
||||
{
|
||||
struct modifiable_wgl_vars *mvars = (struct modifiable_wgl_vars *)dmp->m_vars;
|
||||
struct modifiable_ogl_vars *mvars = (struct modifiable_ogl_vars *)dmp->m_vars;
|
||||
mvars->fastfog = fastfog;
|
||||
glHint(GL_FOG_HINT, fastfog ? GL_FASTEST : GL_NICEST);
|
||||
}
|
||||
@@ -187,7 +165,7 @@ wgl_setBGColor(dm *dmp,
|
||||
unsigned char g,
|
||||
unsigned char b)
|
||||
{
|
||||
struct modifiable_wgl_vars *mvars = (struct modifiable_wgl_vars *)dmp->m_vars;
|
||||
struct modifiable_ogl_vars *mvars = (struct modifiable_ogl_vars *)dmp->m_vars;
|
||||
if (dmp->dm_debugLevel)
|
||||
bu_log("wgl_setBGColor()\n");
|
||||
|
||||
@@ -224,7 +202,7 @@ wgl_open(Tcl_Interp *interp, int argc, char *argv[])
|
||||
int make_square = -1;
|
||||
struct bu_vls str = BU_VLS_INIT_ZERO;
|
||||
struct bu_vls init_proc_vls = BU_VLS_INIT_ZERO;
|
||||
struct modifiable_wgl_vars *mvars = NULL;
|
||||
struct modifiable_ogl_vars *mvars = NULL;
|
||||
dm *dmp = (dm *)NULL;
|
||||
Tk_Window tkwin;
|
||||
HWND hwnd;
|
||||
@@ -244,7 +222,7 @@ wgl_open(Tcl_Interp *interp, int argc, char *argv[])
|
||||
BU_ALLOC(dmp->dm_vars.priv_vars, struct wgl_vars);
|
||||
|
||||
dmp->dm_get_internal(dmp);
|
||||
mvars = (struct modifiable_wgl_vars *)dmp->m_vars;
|
||||
mvars = (struct modifiable_ogl_vars *)dmp->m_vars;
|
||||
|
||||
dmp->dm_vp = &default_viewscale;
|
||||
|
||||
@@ -504,7 +482,7 @@ wgl_share_dlist(dm *dmp1, dm *dmp2)
|
||||
GLfloat backgnd[4];
|
||||
GLfloat vf;
|
||||
HGLRC old_glxContext;
|
||||
struct modifiable_wgl_vars *mvars = (struct modifiable_wgl_vars *)dmp1->m_vars;
|
||||
struct modifiable_ogl_vars *mvars = (struct modifiable_ogl_vars *)dmp1->m_vars;
|
||||
|
||||
if (dmp1 == (dm *)NULL)
|
||||
return TCL_ERROR;
|
||||
@@ -695,7 +673,7 @@ wgl_close(dm *dmp)
|
||||
HIDDEN int
|
||||
wgl_drawBegin(dm *dmp)
|
||||
{
|
||||
struct modifiable_wgl_vars *mvars = (struct modifiable_wgl_vars *)dmp->m_vars;
|
||||
struct modifiable_ogl_vars *mvars = (struct modifiable_ogl_vars *)dmp->m_vars;
|
||||
GLfloat fogdepth;
|
||||
|
||||
if (dmp->dm_debugLevel) {
|
||||
@@ -765,7 +743,7 @@ wgl_drawBegin(dm *dmp)
|
||||
HIDDEN int
|
||||
wgl_drawEnd(dm *dmp)
|
||||
{
|
||||
struct modifiable_wgl_vars *mvars = (struct modifiable_wgl_vars *)dmp->m_vars;
|
||||
struct modifiable_ogl_vars *mvars = (struct modifiable_ogl_vars *)dmp->m_vars;
|
||||
if (dmp->dm_debugLevel)
|
||||
bu_log("wgl_drawEnd\n");
|
||||
|
||||
@@ -944,7 +922,7 @@ wgl_drawVListHiddenLine(dm *dmp, register struct bn_vlist *vp)
|
||||
{
|
||||
register struct bn_vlist *tvp;
|
||||
register int first;
|
||||
struct modifiable_wgl_vars *mvars = (struct modifiable_wgl_vars *)dmp->m_vars;
|
||||
struct modifiable_ogl_vars *mvars = (struct modifiable_ogl_vars *)dmp->m_vars;
|
||||
|
||||
if (dmp->dm_debugLevel)
|
||||
bu_log("wgl_drawVList()\n");
|
||||
@@ -979,6 +957,9 @@ wgl_drawVListHiddenLine(dm *dmp, register struct bn_vlist *vp)
|
||||
for (i = 0; i < nused; i++, cmd++, pt++) {
|
||||
if (dmp->dm_debugLevel > 2)
|
||||
bu_log(" %d (%g %g %g)\n", *cmd, V3ARGS(pt));
|
||||
|
||||
VMOVE(glpt, *pt);
|
||||
|
||||
switch (*cmd) {
|
||||
case BN_VLIST_LINE_MOVE:
|
||||
case BN_VLIST_LINE_DRAW:
|
||||
@@ -991,19 +972,16 @@ wgl_drawVListHiddenLine(dm *dmp, register struct bn_vlist *vp)
|
||||
|
||||
glBegin(GL_POLYGON);
|
||||
/* Set surface normal (vl_pnt points outward) */
|
||||
VMOVE(glpt, *pt);
|
||||
glNormal3dv(glpt);
|
||||
break;
|
||||
case BN_VLIST_POLY_MOVE:
|
||||
case BN_VLIST_POLY_DRAW:
|
||||
case BN_VLIST_TRI_MOVE:
|
||||
case BN_VLIST_TRI_DRAW:
|
||||
VMOVE(glpt, *pt);
|
||||
glVertex3dv(glpt);
|
||||
break;
|
||||
case BN_VLIST_POLY_END:
|
||||
/* Draw, End Polygon */
|
||||
VMOVE(glpt, *pt);
|
||||
glVertex3dv(glpt);
|
||||
glEnd();
|
||||
first = 1;
|
||||
@@ -1011,7 +989,6 @@ wgl_drawVListHiddenLine(dm *dmp, register struct bn_vlist *vp)
|
||||
case BN_VLIST_POLY_VERTNORM:
|
||||
case BN_VLIST_TRI_VERTNORM:
|
||||
/* Set per-vertex normal. Given before vert. */
|
||||
VMOVE(glpt, *pt);
|
||||
glNormal3dv(glpt);
|
||||
break;
|
||||
case BN_VLIST_TRI_START:
|
||||
@@ -1021,7 +998,6 @@ wgl_drawVListHiddenLine(dm *dmp, register struct bn_vlist *vp)
|
||||
first = 0;
|
||||
|
||||
/* Set surface normal (vl_pnt points outward) */
|
||||
VMOVE(glpt, *pt);
|
||||
glNormal3dv(glpt);
|
||||
|
||||
break;
|
||||
@@ -1047,9 +1023,14 @@ wgl_drawVListHiddenLine(dm *dmp, register struct bn_vlist *vp)
|
||||
register int *cmd = tvp->cmd;
|
||||
register point_t *pt = tvp->pt;
|
||||
GLdouble glpt[3];
|
||||
|
||||
for (i = 0; i < nused; i++, cmd++, pt++) {
|
||||
|
||||
if (dmp->dm_debugLevel > 2)
|
||||
bu_log(" %d (%g %g %g)\n", *cmd, V3ARGS(pt));
|
||||
|
||||
VMOVE(glpt, *pt);
|
||||
|
||||
switch (*cmd) {
|
||||
case BN_VLIST_LINE_MOVE:
|
||||
/* Move, start line */
|
||||
@@ -1058,7 +1039,6 @@ wgl_drawVListHiddenLine(dm *dmp, register struct bn_vlist *vp)
|
||||
first = 0;
|
||||
|
||||
glBegin(GL_LINE_STRIP);
|
||||
VMOVE(glpt, *pt);
|
||||
glVertex3dv(glpt);
|
||||
break;
|
||||
case BN_VLIST_POLY_START:
|
||||
@@ -1075,13 +1055,11 @@ wgl_drawVListHiddenLine(dm *dmp, register struct bn_vlist *vp)
|
||||
case BN_VLIST_POLY_DRAW:
|
||||
case BN_VLIST_TRI_MOVE:
|
||||
case BN_VLIST_TRI_DRAW:
|
||||
VMOVE(glpt, *pt);
|
||||
glVertex3dv(glpt);
|
||||
break;
|
||||
case BN_VLIST_POLY_END:
|
||||
case BN_VLIST_TRI_END:
|
||||
/* Draw, End Polygon */
|
||||
VMOVE(glpt, *pt);
|
||||
glVertex3dv(glpt);
|
||||
glEnd();
|
||||
first = 1;
|
||||
@@ -1089,7 +1067,6 @@ wgl_drawVListHiddenLine(dm *dmp, register struct bn_vlist *vp)
|
||||
case BN_VLIST_POLY_VERTNORM:
|
||||
case BN_VLIST_TRI_VERTNORM:
|
||||
/* Set per-vertex normal. Given before vert. */
|
||||
VMOVE(glpt, glpt);
|
||||
glNormal3dv(*pt);
|
||||
break;
|
||||
}
|
||||
@@ -1138,9 +1115,14 @@ wgl_drawVList(dm *dmp, struct bn_vlist *vp)
|
||||
register int *cmd = tvp->cmd;
|
||||
register point_t *pt = tvp->pt;
|
||||
GLdouble glpt[3];
|
||||
|
||||
for (i = 0; i < nused; i++, cmd++, pt++) {
|
||||
|
||||
if (dmp->dm_debugLevel > 2)
|
||||
bu_log(" %d (%g %g %g)\n", *cmd, V3ARGS(pt));
|
||||
|
||||
VMOVE(glpt, *pt);
|
||||
|
||||
switch (*cmd) {
|
||||
case BN_VLIST_LINE_MOVE:
|
||||
/* Move, start line */
|
||||
@@ -1160,7 +1142,6 @@ wgl_drawVList(dm *dmp, struct bn_vlist *vp)
|
||||
}
|
||||
|
||||
glBegin(GL_LINE_STRIP);
|
||||
VMOVE(glpt, *pt);
|
||||
glVertex3dv(glpt);
|
||||
break;
|
||||
case BN_VLIST_POLY_START:
|
||||
@@ -1201,7 +1182,6 @@ wgl_drawVList(dm *dmp, struct bn_vlist *vp)
|
||||
glBegin(GL_TRIANGLES);
|
||||
|
||||
/* Set surface normal (vl_pnt points outward) */
|
||||
VMOVE(glpt, *pt);
|
||||
glNormal3dv(glpt);
|
||||
|
||||
first = 0;
|
||||
@@ -1212,12 +1192,10 @@ wgl_drawVList(dm *dmp, struct bn_vlist *vp)
|
||||
case BN_VLIST_POLY_DRAW:
|
||||
case BN_VLIST_TRI_MOVE:
|
||||
case BN_VLIST_TRI_DRAW:
|
||||
VMOVE(glpt, *pt);
|
||||
glVertex3dv(glpt);
|
||||
break;
|
||||
case BN_VLIST_POLY_END:
|
||||
/* Draw, End Polygon */
|
||||
VMOVE(glpt, *pt);
|
||||
glVertex3dv(glpt);
|
||||
glEnd();
|
||||
first = 1;
|
||||
@@ -1227,7 +1205,6 @@ wgl_drawVList(dm *dmp, struct bn_vlist *vp)
|
||||
case BN_VLIST_POLY_VERTNORM:
|
||||
case BN_VLIST_TRI_VERTNORM:
|
||||
/* Set per-vertex normal. Given before vert. */
|
||||
VMOVE(glpt, *pt);
|
||||
glNormal3dv(glpt);
|
||||
break;
|
||||
case BN_VLIST_POINT_DRAW:
|
||||
@@ -1296,7 +1273,7 @@ HIDDEN int
|
||||
wgl_normal(dm *dmp)
|
||||
{
|
||||
|
||||
struct modifiable_wgl_vars *mvars = (struct modifiable_wgl_vars *)dmp->m_vars;
|
||||
struct modifiable_ogl_vars *mvars = (struct modifiable_ogl_vars *)dmp->m_vars;
|
||||
if (dmp->dm_debugLevel)
|
||||
bu_log("wgl_normal\n");
|
||||
|
||||
@@ -1395,6 +1372,9 @@ wgl_drawPoint2D(dm *dmp, fastf_t x, fastf_t y)
|
||||
bu_log("\tdmp: %p\tx - %lf\ty - %lf\n", (void *)dmp, x, y);
|
||||
}
|
||||
|
||||
#if 0
|
||||
glEnable(GL_POINT_SMOOTH);
|
||||
#endif
|
||||
glBegin(GL_POINTS);
|
||||
glVertex2f(x, y);
|
||||
glEnd();
|
||||
@@ -1414,6 +1394,9 @@ wgl_drawPoint3D(dm *dmp, point_t point)
|
||||
bu_log("\tdmp: %llu\tpt - %lf %lf %lf\n", (unsigned long long)dmp, V3ARGS(point));
|
||||
}
|
||||
|
||||
#if 0
|
||||
glEnable(GL_POINT_SMOOTH);
|
||||
#endif
|
||||
glBegin(GL_POINTS);
|
||||
glVertex3dv(point);
|
||||
glEnd();
|
||||
@@ -1434,6 +1417,9 @@ wgl_drawPoints3D(dm *dmp, int npoints, point_t *points)
|
||||
bu_log("wgl_drawPoint3D():\n");
|
||||
}
|
||||
|
||||
#if 0
|
||||
glEnable(GL_POINT_SMOOTH);
|
||||
#endif
|
||||
glBegin(GL_POINTS);
|
||||
for (i = 0; i < npoints; ++i)
|
||||
glVertex3dv(points[i]);
|
||||
@@ -1508,7 +1494,7 @@ HIDDEN PIXELFORMATDESCRIPTOR *
|
||||
wgl_choose_visual(dm *dmp,
|
||||
Tk_Window tkwin)
|
||||
{
|
||||
struct modifiable_wgl_vars *mvars = (struct modifiable_wgl_vars *)dmp->m_vars;
|
||||
struct modifiable_ogl_vars *mvars = (struct modifiable_ogl_vars *)dmp->m_vars;
|
||||
int iPixelFormat;
|
||||
PIXELFORMATDESCRIPTOR *ppfd, pfd;
|
||||
BOOL good;
|
||||
@@ -1950,7 +1936,7 @@ wgl_configureWin(dm *dmp, int force)
|
||||
HIDDEN int
|
||||
wgl_setLight(dm *dmp, int lighting_on)
|
||||
{
|
||||
struct modifiable_wgl_vars *mvars = (struct modifiable_wgl_vars *)dmp->m_vars;
|
||||
struct modifiable_ogl_vars *mvars = (struct modifiable_ogl_vars *)dmp->m_vars;
|
||||
if (dmp->dm_debugLevel)
|
||||
bu_log("wgl_setLight()\n");
|
||||
|
||||
@@ -1986,7 +1972,7 @@ HIDDEN int
|
||||
wgl_setTransparency(dm *dmp,
|
||||
int transparency_on)
|
||||
{
|
||||
struct modifiable_wgl_vars *mvars = (struct modifiable_wgl_vars *)dmp->m_vars;
|
||||
struct modifiable_ogl_vars *mvars = (struct modifiable_ogl_vars *)dmp->m_vars;
|
||||
if (dmp->dm_debugLevel)
|
||||
bu_log("wgl_setTransparency()\n");
|
||||
|
||||
@@ -2026,7 +2012,7 @@ wgl_setDepthMask(dm *dmp,
|
||||
HIDDEN int
|
||||
wgl_setZBuffer(dm *dmp, int zbuffer_on)
|
||||
{
|
||||
struct modifiable_wgl_vars *mvars = (struct modifiable_wgl_vars *)dmp->m_vars;
|
||||
struct modifiable_ogl_vars *mvars = (struct modifiable_ogl_vars *)dmp->m_vars;
|
||||
if (dmp->dm_debugLevel)
|
||||
bu_log("wgl_setZBuffer:\n");
|
||||
|
||||
@@ -2126,7 +2112,7 @@ wgl_openFb(dm *dmp)
|
||||
{
|
||||
struct fb_platform_specific *fb_ps;
|
||||
struct wgl_fb_info *wfb_ps;
|
||||
struct modifiable_wgl_vars *mvars = (struct modifiable_wgl_vars *)dmp->m_vars;
|
||||
struct modifiable_ogl_vars *mvars = (struct modifiable_ogl_vars *)dmp->m_vars;
|
||||
struct dm_xvars *pubvars = (struct dm_xvars *)dmp->dm_vars.pub_vars;
|
||||
struct wgl_vars *privars = (struct wgl_vars *)dmp->dm_vars.priv_vars;
|
||||
|
||||
@@ -2148,10 +2134,10 @@ wgl_openFb(dm *dmp)
|
||||
void
|
||||
wgl_get_internal(struct dm_internal *dmp)
|
||||
{
|
||||
struct modifiable_wgl_vars *mvars = NULL;
|
||||
struct modifiable_ogl_vars *mvars = NULL;
|
||||
if (!dmp->m_vars) {
|
||||
BU_GET(dmp->m_vars, struct modifiable_wgl_vars);
|
||||
mvars = (struct modifiable_wgl_vars *)dmp->m_vars;
|
||||
BU_GET(dmp->m_vars, struct modifiable_ogl_vars);
|
||||
mvars = (struct modifiable_ogl_vars *)dmp->m_vars;
|
||||
mvars->this_dm = dmp;
|
||||
bu_vls_init(&(mvars->log));
|
||||
}
|
||||
@@ -2160,11 +2146,11 @@ wgl_get_internal(struct dm_internal *dmp)
|
||||
void
|
||||
wgl_put_internal(struct dm_internal *dmp)
|
||||
{
|
||||
struct modifiable_wgl_vars *mvars = NULL;
|
||||
struct modifiable_ogl_vars *mvars = NULL;
|
||||
if (dmp->m_vars) {
|
||||
mvars = (struct modifiable_wgl_vars *)dmp->m_vars;
|
||||
mvars = (struct modifiable_ogl_vars *)dmp->m_vars;
|
||||
bu_vls_free(&(mvars->log));
|
||||
BU_PUT(dmp->m_vars, struct modifiable_wgl_vars);
|
||||
BU_PUT(dmp->m_vars, struct modifiable_ogl_vars);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2175,7 +2161,7 @@ Wgl_colorchange(const struct bu_structparse *sdp,
|
||||
const char *value,
|
||||
void *data)
|
||||
{
|
||||
struct modifiable_wgl_vars *mvars = (struct modifiable_wgl_vars *)base;
|
||||
struct modifiable_ogl_vars *mvars = (struct modifiable_ogl_vars *)base;
|
||||
if (mvars->cueing_on) {
|
||||
glEnable(GL_FOG);
|
||||
} else {
|
||||
@@ -2192,7 +2178,7 @@ wgl_zclip_hook(const struct bu_structparse *sdp,
|
||||
const char *value,
|
||||
void *data)
|
||||
{
|
||||
struct modifiable_wgl_vars *mvars = (struct modifiable_wgl_vars *)base;
|
||||
struct modifiable_ogl_vars *mvars = (struct modifiable_ogl_vars *)base;
|
||||
dm *dmp = mvars->this_dm;
|
||||
fastf_t bounds[6] = { GED_MIN, GED_MAX, GED_MIN, GED_MAX, GED_MIN, GED_MAX };
|
||||
|
||||
@@ -2216,7 +2202,7 @@ wgl_debug_hook(const struct bu_structparse *sdp,
|
||||
const char *value,
|
||||
void *data)
|
||||
{
|
||||
struct modifiable_wgl_vars *mvars = (struct modifiable_wgl_vars *)base;
|
||||
struct modifiable_ogl_vars *mvars = (struct modifiable_ogl_vars *)base;
|
||||
dm *dmp = mvars->this_dm;
|
||||
|
||||
dm_debug(dmp, mvars->debug);
|
||||
@@ -2232,7 +2218,7 @@ wgl_logfile_hook(const struct bu_structparse *sdp,
|
||||
const char *value,
|
||||
void *data)
|
||||
{
|
||||
struct modifiable_wgl_vars *mvars = (struct modifiable_wgl_vars *)base;
|
||||
struct modifiable_ogl_vars *mvars = (struct modifiable_ogl_vars *)base;
|
||||
dm *dmp = mvars->this_dm;
|
||||
|
||||
dm_logfile(dmp, bu_vls_addr(&mvars->log));
|
||||
@@ -2247,7 +2233,7 @@ wgl_bound_hook(const struct bu_structparse *sdp,
|
||||
const char *value,
|
||||
void *data)
|
||||
{
|
||||
struct modifiable_wgl_vars *mvars = (struct modifiable_wgl_vars *)base;
|
||||
struct modifiable_ogl_vars *mvars = (struct modifiable_ogl_vars *)base;
|
||||
dm *dmp = mvars->this_dm;
|
||||
|
||||
dmp->dm_bound = mvars->bound;
|
||||
@@ -2262,7 +2248,7 @@ wgl_bound_flag_hook(const struct bu_structparse *sdp,
|
||||
const char *value,
|
||||
void *data)
|
||||
{
|
||||
struct modifiable_wgl_vars *mvars = (struct modifiable_wgl_vars *)base;
|
||||
struct modifiable_ogl_vars *mvars = (struct modifiable_ogl_vars *)base;
|
||||
dm *dmp = mvars->this_dm;
|
||||
|
||||
dmp->dm_boundFlag = mvars->boundFlag;
|
||||
@@ -2277,7 +2263,7 @@ wgl_zbuffer_hook(const struct bu_structparse *sdp,
|
||||
const char *value,
|
||||
void *data)
|
||||
{
|
||||
struct modifiable_wgl_vars *mvars = (struct modifiable_wgl_vars *)base;
|
||||
struct modifiable_ogl_vars *mvars = (struct modifiable_ogl_vars *)base;
|
||||
dm *dmp = mvars->this_dm;
|
||||
|
||||
(void)dm_make_current(dmp);
|
||||
@@ -2293,7 +2279,7 @@ wgl_lighting_hook(const struct bu_structparse *sdp,
|
||||
const char *value,
|
||||
void *data)
|
||||
{
|
||||
struct modifiable_wgl_vars *mvars = (struct modifiable_wgl_vars *)base;
|
||||
struct modifiable_ogl_vars *mvars = (struct modifiable_ogl_vars *)base;
|
||||
dm *dmp = mvars->this_dm;
|
||||
|
||||
(void)dm_make_current(dmp);
|
||||
@@ -2309,7 +2295,7 @@ wgl_transparency_hook(const struct bu_structparse *sdp,
|
||||
const char *value,
|
||||
void *data)
|
||||
{
|
||||
struct modifiable_wgl_vars *mvars = (struct modifiable_wgl_vars *)base;
|
||||
struct modifiable_ogl_vars *mvars = (struct modifiable_ogl_vars *)base;
|
||||
dm *dmp = mvars->this_dm;
|
||||
|
||||
(void)dm_make_current(dmp);
|
||||
@@ -2325,7 +2311,7 @@ wgl_fog_hook(const struct bu_structparse *sdp,
|
||||
const char *value,
|
||||
void *data)
|
||||
{
|
||||
struct modifiable_wgl_vars *mvars = (struct modifiable_wgl_vars *)base;
|
||||
struct modifiable_ogl_vars *mvars = (struct modifiable_ogl_vars *)base;
|
||||
dm *dmp = mvars->this_dm;
|
||||
|
||||
dm_fogHint(dmp, mvars->fastfog);
|
||||
@@ -2334,21 +2320,21 @@ wgl_fog_hook(const struct bu_structparse *sdp,
|
||||
}
|
||||
|
||||
struct bu_structparse Wgl_vparse[] = {
|
||||
{"%d", 1, "depthcue", Wgl_MV_O(cueing_on), Wgl_colorchange, NULL, NULL },
|
||||
{"%d", 1, "zclip", Wgl_MV_O(zclipping_on), wgl_zclip_hook, NULL, NULL },
|
||||
{"%d", 1, "zbuffer", Wgl_MV_O(zbuffer_on), wgl_zbuffer_hook, NULL, NULL },
|
||||
{"%d", 1, "lighting", Wgl_MV_O(lighting_on), wgl_lighting_hook, NULL, NULL },
|
||||
{"%d", 1, "transparency", Wgl_MV_O(transparency_on), wgl_transparency_hook, NULL, NULL },
|
||||
{"%d", 1, "fastfog", Wgl_MV_O(fastfog), wgl_fog_hook, NULL, NULL },
|
||||
{"%g", 1, "density", Wgl_MV_O(fogdensity), dm_generic_hook, NULL, NULL },
|
||||
{"%d", 1, "has_zbuf", Wgl_MV_O(zbuf), dm_generic_hook, NULL, NULL },
|
||||
{"%d", 1, "has_rgb", Wgl_MV_O(rgb), dm_generic_hook, NULL, NULL },
|
||||
{"%d", 1, "has_doublebuffer", Wgl_MV_O(doublebuffer), dm_generic_hook, NULL, NULL },
|
||||
{"%d", 1, "depth", Wgl_MV_O(depth), dm_generic_hook, NULL, NULL },
|
||||
{"%d", 1, "debug", Wgl_MV_O(debug), wgl_debug_hook, NULL, NULL },
|
||||
{"%V", 1, "log", Wgl_MV_O(log), wgl_logfile_hook, NULL, NULL },
|
||||
{"%g", 1, "bound", Wgl_MV_O(bound), wgl_bound_hook, NULL, NULL },
|
||||
{"%d", 1, "useBound", Wgl_MV_O(boundFlag), wgl_bound_flag_hook, NULL, NULL },
|
||||
{"%d", 1, "depthcue", Ogl_MV_O(cueing_on), Wgl_colorchange, NULL, NULL },
|
||||
{"%d", 1, "zclip", Ogl_MV_O(zclipping_on), wgl_zclip_hook, NULL, NULL },
|
||||
{"%d", 1, "zbuffer", Ogl_MV_O(zbuffer_on), wgl_zbuffer_hook, NULL, NULL },
|
||||
{"%d", 1, "lighting", Ogl_MV_O(lighting_on), wgl_lighting_hook, NULL, NULL },
|
||||
{"%d", 1, "transparency", Ogl_MV_O(transparency_on), wgl_transparency_hook, NULL, NULL },
|
||||
{"%d", 1, "fastfog", Ogl_MV_O(fastfog), wgl_fog_hook, NULL, NULL },
|
||||
{"%g", 1, "density", Ogl_MV_O(fogdensity), dm_generic_hook, NULL, NULL },
|
||||
{"%d", 1, "has_zbuf", Ogl_MV_O(zbuf), dm_generic_hook, NULL, NULL },
|
||||
{"%d", 1, "has_rgb", Ogl_MV_O(rgb), dm_generic_hook, NULL, NULL },
|
||||
{"%d", 1, "has_doublebuffer", Ogl_MV_O(doublebuffer), dm_generic_hook, NULL, NULL },
|
||||
{"%d", 1, "depth", Ogl_MV_O(depth), dm_generic_hook, NULL, NULL },
|
||||
{"%d", 1, "debug", Ogl_MV_O(debug), wgl_debug_hook, NULL, NULL },
|
||||
{"%V", 1, "log", Ogl_MV_O(log), wgl_logfile_hook, NULL, NULL },
|
||||
{"%g", 1, "bound", Ogl_MV_O(bound), wgl_bound_hook, NULL, NULL },
|
||||
{"%d", 1, "useBound", Ogl_MV_O(boundFlag), wgl_bound_flag_hook, NULL, NULL },
|
||||
{"", 0, (char *)0, 0, BU_STRUCTPARSE_FUNC_NULL, NULL, NULL }
|
||||
};
|
||||
|
||||
|
||||
@@ -36,6 +36,29 @@ struct dm_vars {
|
||||
void *priv_vars;
|
||||
};
|
||||
|
||||
#if defined(DM_OGL) || defined(DM_WGL)
|
||||
#define Ogl_MV_O(_m) offsetof(struct modifiable_ogl_vars, _m)
|
||||
|
||||
struct modifiable_ogl_vars {
|
||||
dm *this_dm;
|
||||
int cueing_on;
|
||||
int zclipping_on;
|
||||
int zbuffer_on;
|
||||
int lighting_on;
|
||||
int transparency_on;
|
||||
int fastfog;
|
||||
double fogdensity;
|
||||
int zbuf;
|
||||
int rgb;
|
||||
int doublebuffer;
|
||||
int depth;
|
||||
int debug;
|
||||
struct bu_vls log;
|
||||
double bound;
|
||||
int boundFlag;
|
||||
};
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Interface to a specific Display Manager
|
||||
*/
|
||||
|
||||
+4
-4
@@ -77,7 +77,7 @@ drawLine3D(struct dm_internal *dmp, point_t pt1, point_t pt2, const char *log_bu
|
||||
}
|
||||
|
||||
int
|
||||
drawLines3D(struct dm_internal *dmp, int npoints, point_t *points, int sflag, const char *log_bu, float *wireColor)
|
||||
drawLines3D(struct dm_internal *dmp, int npoints, point_t *points, int lflag, const char *log_bu, float *wireColor)
|
||||
{
|
||||
register int i;
|
||||
static float black[4] = {0.0, 0.0, 0.0, 0.0};
|
||||
@@ -102,7 +102,7 @@ drawLines3D(struct dm_internal *dmp, int npoints, point_t *points, int sflag, co
|
||||
bu_log("%g %g %g %g\n", pmat[3], pmat[7], pmat[11], pmat[15]);
|
||||
}
|
||||
|
||||
if (npoints < 2 || (!sflag && npoints%2))
|
||||
if (npoints < 2 || (!lflag && npoints%2))
|
||||
return TCL_OK;
|
||||
|
||||
if (dmp->dm_light) {
|
||||
@@ -115,8 +115,8 @@ drawLines3D(struct dm_internal *dmp, int npoints, point_t *points, int sflag, co
|
||||
glDisable(GL_BLEND);
|
||||
}
|
||||
|
||||
if (sflag)
|
||||
glBegin(GL_LINE_STRIP);
|
||||
if (lflag)
|
||||
glBegin(GL_LINE_LOOP);
|
||||
else
|
||||
glBegin(GL_LINES);
|
||||
|
||||
|
||||
@@ -138,6 +138,7 @@ set(LIBGED_SOURCES
|
||||
killrefs.c
|
||||
killtree.c
|
||||
label.c
|
||||
lc.c
|
||||
list.c
|
||||
loadview.c
|
||||
lod.c
|
||||
|
||||
+371
-173
@@ -27,6 +27,7 @@
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "bu/getopt.h"
|
||||
#include "bu/sort.h"
|
||||
#include "./ged_private.h"
|
||||
|
||||
@@ -38,6 +39,7 @@ typedef enum {
|
||||
ATTR_SET,
|
||||
ATTR_SHOW,
|
||||
ATTR_SORT,
|
||||
ATTR_LIST,
|
||||
ATTR_UNKNOWN
|
||||
} attr_cmd_t;
|
||||
|
||||
@@ -116,6 +118,7 @@ attr_cmd(const char* arg)
|
||||
/* sub-commands */
|
||||
const char APPEND[] = "append";
|
||||
const char GET[] = "get";
|
||||
const char LIST[] = "list";
|
||||
const char RM[] = "rm";
|
||||
const char SET[] = "set";
|
||||
const char SHOW[] = "show";
|
||||
@@ -134,6 +137,8 @@ attr_cmd(const char* arg)
|
||||
return ATTR_APPEND;
|
||||
else if (BU_STR_EQUIV(GET, arg))
|
||||
return ATTR_GET;
|
||||
else if (BU_STR_EQUIV(LIST, arg))
|
||||
return ATTR_LIST;
|
||||
else
|
||||
return ATTR_UNKNOWN;
|
||||
}
|
||||
@@ -141,14 +146,14 @@ attr_cmd(const char* arg)
|
||||
|
||||
HIDDEN void
|
||||
attr_print(struct ged *gedp, struct bu_attribute_value_set *avs,
|
||||
const int max_attr_name_len)
|
||||
const size_t max_attr_name_len)
|
||||
{
|
||||
struct bu_attribute_value_pair *avpp;
|
||||
size_t i;
|
||||
|
||||
for (i = 0, avpp = avs->avp; i < avs->count; i++, avpp++) {
|
||||
int len_diff = 0;
|
||||
int count = 0;
|
||||
size_t len_diff = 0;
|
||||
size_t count = 0;
|
||||
bu_vls_printf(gedp->ged_result_str, "\t%s", avpp->name);
|
||||
len_diff = max_attr_name_len - strlen(avpp->name);
|
||||
while (count < (len_diff) + 1) {
|
||||
@@ -165,10 +170,14 @@ ged_attr(struct ged *gedp, int argc, const char *argv[])
|
||||
{
|
||||
size_t i;
|
||||
struct directory *dp;
|
||||
struct bu_attribute_value_set avs;
|
||||
struct bu_attribute_value_pair *avpp;
|
||||
static const char *usage = "{set|get|show|rm|append|sort} object [key [value] ... ]";
|
||||
static const char *usage = "{[-c sep_char] set|get|show|rm|append|sort} object [key [value] ... ]";
|
||||
attr_cmd_t scmd;
|
||||
struct directory **paths = NULL;
|
||||
size_t path_cnt = 0;
|
||||
int opt;
|
||||
int c_sep = -1;
|
||||
const char *cmd_name = argv[0];
|
||||
|
||||
/* sort types */
|
||||
const char CASE[] = "case";
|
||||
@@ -176,10 +185,6 @@ ged_attr(struct ged *gedp, int argc, const char *argv[])
|
||||
const char VALUE[] = "value";
|
||||
const char VALUE_NOCASE[] = "value-nocase";
|
||||
|
||||
/* for pretty printing */
|
||||
int max_attr_name_len = 0;
|
||||
int max_attr_value_len = 0;
|
||||
|
||||
GED_CHECK_ARGC_GT_0(gedp, argc, GED_ERROR);
|
||||
|
||||
/* initialize result */
|
||||
@@ -187,12 +192,27 @@ ged_attr(struct ged *gedp, int argc, const char *argv[])
|
||||
|
||||
/* must be wanting help */
|
||||
if (argc == 1) {
|
||||
bu_vls_printf(gedp->ged_result_str, "Usage: %s %s", argv[0], usage);
|
||||
bu_vls_printf(gedp->ged_result_str, "Usage: %s %s", cmd_name, usage);
|
||||
return GED_HELP;
|
||||
}
|
||||
|
||||
bu_optind = 1; /* re-init bu_getopt() */
|
||||
while ((opt = bu_getopt(argc, (char * const *)argv, "c:")) != -1) {
|
||||
switch (opt) {
|
||||
case 'c':
|
||||
c_sep = (int)bu_optarg[0];
|
||||
break;
|
||||
default:
|
||||
bu_vls_printf(gedp->ged_result_str, "Unrecognized option - %c", opt);
|
||||
return GED_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
argc -= bu_optind - 1;
|
||||
argv += bu_optind - 1;
|
||||
|
||||
if (argc < 3) {
|
||||
bu_vls_printf(gedp->ged_result_str, "Usage: %s %s", argv[0], usage);
|
||||
bu_vls_printf(gedp->ged_result_str, "Usage: %s %s", cmd_name, usage);
|
||||
return GED_ERROR;
|
||||
}
|
||||
|
||||
@@ -206,228 +226,406 @@ ged_attr(struct ged *gedp, int argc, const char *argv[])
|
||||
return GED_ERROR;
|
||||
}
|
||||
|
||||
GED_DB_LOOKUP(gedp, dp, argv[2], LOOKUP_QUIET, GED_ERROR);
|
||||
scmd = attr_cmd(argv[1]);
|
||||
|
||||
bu_avs_init_empty(&avs);
|
||||
if (db5_get_attributes(gedp->ged_wdbp->dbip, &avs, dp)) {
|
||||
bu_vls_printf(gedp->ged_result_str, "Cannot get attributes for object %s\n", dp->d_namep);
|
||||
path_cnt = db_ls(gedp->ged_wdbp->dbip, DB_LS_HIDDEN, argv[2], &paths);
|
||||
|
||||
if (path_cnt == 0) {
|
||||
bu_vls_printf(gedp->ged_result_str, "Cannot locate objects matching %s\n", argv[2]);
|
||||
return GED_ERROR;
|
||||
}
|
||||
|
||||
scmd = attr_cmd(argv[1]);
|
||||
|
||||
if ((scmd == ATTR_SHOW && argc == 3) || scmd == ATTR_SORT) {
|
||||
/* get a jump on calculating name and value lengths */
|
||||
for (i = 0, avpp = avs.avp; i < avs.count; i++, avpp++) {
|
||||
int len = (int)strlen(avpp->name);
|
||||
if (len > max_attr_name_len)
|
||||
max_attr_name_len = len;
|
||||
if (avpp->value) {
|
||||
len = (int)strlen(avpp->value);
|
||||
if (len > max_attr_value_len)
|
||||
max_attr_value_len = len;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* default: sort attribute-value set array by attribute name (case sensitive) */
|
||||
bu_sort(&avs.avp[0], avs.count, sizeof(struct bu_attribute_value_pair), attr_cmp, NULL);
|
||||
|
||||
if (scmd == ATTR_SORT) {
|
||||
/* pretty print */
|
||||
if ((attr_pretty_print(gedp, dp, argv[2])) != GED_OK)
|
||||
return GED_ERROR;
|
||||
for (i = 0; i < path_cnt; i++) {
|
||||
/* for pretty printing */
|
||||
size_t j = 0;
|
||||
size_t max_attr_name_len = 0;
|
||||
size_t max_attr_value_len = 0;
|
||||
|
||||
if (argc == 3) {
|
||||
/* just list the already sorted attribute-value pairs */
|
||||
attr_print(gedp, &avs, max_attr_name_len);
|
||||
} else {
|
||||
/* argv[3] is the sort type: 'case', 'nocase', 'value', 'value-nocase' */
|
||||
if (BU_STR_EQUIV(argv[3], NOCASE)) {
|
||||
bu_sort(&avs.avp[0], avs.count, sizeof(struct bu_attribute_value_pair), attr_cmp_nocase, NULL);
|
||||
} else if (BU_STR_EQUIV(argv[3], VALUE)) {
|
||||
bu_sort(&avs.avp[0], avs.count, sizeof(struct bu_attribute_value_pair), attr_cmp_value, NULL);
|
||||
} else if (BU_STR_EQUIV(argv[3], VALUE_NOCASE)) {
|
||||
bu_sort(&avs.avp[0], avs.count, sizeof(struct bu_attribute_value_pair), attr_cmp_value_nocase, NULL);
|
||||
} else if (BU_STR_EQUIV(argv[3], CASE)) {
|
||||
; /* don't need to do anything since this is the existing (default) sort */
|
||||
struct bu_attribute_value_set avs;
|
||||
bu_avs_init_empty(&avs);
|
||||
|
||||
dp = paths[i];
|
||||
|
||||
if (db5_get_attributes(gedp->ged_wdbp->dbip, &avs, dp)) {
|
||||
bu_vls_printf(gedp->ged_result_str, "Cannot get attributes for object %s\n", dp->d_namep);
|
||||
return GED_ERROR;
|
||||
}
|
||||
/* just list the already sorted attribute-value pairs */
|
||||
attr_print(gedp, &avs, max_attr_name_len);
|
||||
bu_sort(&avs.avp[0], avs.count, sizeof(struct bu_attribute_value_pair), attr_cmp, NULL);
|
||||
/* get a jump on calculating name and value lengths */
|
||||
for (j = 0, avpp = avs.avp; j < avs.count; j++, avpp++) {
|
||||
size_t len = strlen(avpp->name);
|
||||
if (len > max_attr_name_len)
|
||||
max_attr_name_len = len;
|
||||
if (avpp->value) {
|
||||
len = strlen(avpp->value);
|
||||
if (len > max_attr_value_len)
|
||||
max_attr_value_len = len;
|
||||
}
|
||||
}
|
||||
|
||||
/* pretty print */
|
||||
if ((attr_pretty_print(gedp, dp, argv[2])) != GED_OK) {
|
||||
return GED_ERROR;
|
||||
}
|
||||
if (argc == 3) {
|
||||
/* just list the already sorted attribute-value pairs */
|
||||
attr_print(gedp, &avs, max_attr_name_len);
|
||||
} else {
|
||||
/* argv[3] is the sort type: 'case', 'nocase', 'value', 'value-nocase' */
|
||||
if (BU_STR_EQUIV(argv[3], NOCASE)) {
|
||||
bu_sort(&avs.avp[0], avs.count, sizeof(struct bu_attribute_value_pair), attr_cmp_nocase, NULL);
|
||||
} else if (BU_STR_EQUIV(argv[3], VALUE)) {
|
||||
bu_sort(&avs.avp[0], avs.count, sizeof(struct bu_attribute_value_pair), attr_cmp_value, NULL);
|
||||
} else if (BU_STR_EQUIV(argv[3], VALUE_NOCASE)) {
|
||||
bu_sort(&avs.avp[0], avs.count, sizeof(struct bu_attribute_value_pair), attr_cmp_value_nocase, NULL);
|
||||
} else if (BU_STR_EQUIV(argv[3], CASE)) {
|
||||
; /* don't need to do anything since this is the existing (default) sort */
|
||||
}
|
||||
/* just list the already sorted attribute-value pairs */
|
||||
attr_print(gedp, &avs, max_attr_name_len);
|
||||
}
|
||||
bu_avs_free(&avs);
|
||||
}
|
||||
} else if (scmd == ATTR_GET) {
|
||||
if (argc == 3) {
|
||||
/* just list all the attributes */
|
||||
for (i = 0, avpp = avs.avp; i < avs.count; i++, avpp++) {
|
||||
bu_vls_printf(gedp->ged_result_str, "%s {%s} ", avpp->name, avpp->value);
|
||||
}
|
||||
} else {
|
||||
const char *val;
|
||||
int do_separators=argc-4; /* if more than one attribute */
|
||||
if (path_cnt == 1) {
|
||||
struct bu_attribute_value_set avs;
|
||||
bu_avs_init_empty(&avs);
|
||||
|
||||
for (i = 3; i < (size_t)argc; i++) {
|
||||
val = bu_avs_get(&avs, argv[i]);
|
||||
if (!val) {
|
||||
bu_vls_printf(gedp->ged_result_str,
|
||||
"Object %s does not have a %s attribute\n",
|
||||
dp->d_namep,
|
||||
argv[i]);
|
||||
bu_avs_free(&avs);
|
||||
dp = paths[0];
|
||||
|
||||
if (db5_get_attributes(gedp->ged_wdbp->dbip, &avs, dp)) {
|
||||
bu_vls_printf(gedp->ged_result_str, "Cannot get attributes for object %s\n", dp->d_namep);
|
||||
return GED_ERROR;
|
||||
}
|
||||
bu_sort(&avs.avp[0], avs.count, sizeof(struct bu_attribute_value_pair), attr_cmp, NULL);
|
||||
|
||||
if (argc == 3) {
|
||||
/* just list all the attributes */
|
||||
for (i = 0, avpp = avs.avp; i < avs.count; i++, avpp++) {
|
||||
if (c_sep == -1)
|
||||
bu_vls_printf(gedp->ged_result_str, "%s {%s} ", avpp->name, avpp->value);
|
||||
else {
|
||||
if (i == 0)
|
||||
bu_vls_printf(gedp->ged_result_str, "%s%c%s", avpp->name, (char)c_sep, avpp->value);
|
||||
else
|
||||
bu_vls_printf(gedp->ged_result_str, "%c%s%c%s", (char)c_sep, avpp->name, (char)c_sep, avpp->value);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
const char *val;
|
||||
int do_separators=argc-4; /* if more than one attribute */
|
||||
|
||||
for (i = 3; i < (size_t)argc; i++) {
|
||||
val = bu_avs_get(&avs, argv[i]);
|
||||
if (!val) {
|
||||
bu_vls_printf(gedp->ged_result_str,
|
||||
"Object %s does not have a %s attribute\n",
|
||||
dp->d_namep,
|
||||
argv[i]);
|
||||
bu_avs_free(&avs);
|
||||
return GED_ERROR;
|
||||
}
|
||||
if (do_separators) {
|
||||
if (c_sep == -1)
|
||||
bu_vls_printf(gedp->ged_result_str, "{%s} ", val);
|
||||
else {
|
||||
if (i == 3)
|
||||
bu_vls_printf(gedp->ged_result_str, "%s", val);
|
||||
else
|
||||
bu_vls_printf(gedp->ged_result_str, "%c%s", (char)c_sep, val);
|
||||
}
|
||||
} else {
|
||||
bu_vls_printf(gedp->ged_result_str, "%s", val);
|
||||
}
|
||||
}
|
||||
}
|
||||
bu_avs_free(&avs);
|
||||
} else {
|
||||
for (i = 0; i < path_cnt; i++) {
|
||||
size_t j = 0;
|
||||
struct bu_vls obj_vals = BU_VLS_INIT_ZERO;
|
||||
struct bu_attribute_value_set avs;
|
||||
bu_avs_init_empty(&avs);
|
||||
dp = paths[i];
|
||||
|
||||
if (db5_get_attributes(gedp->ged_wdbp->dbip, &avs, dp)) {
|
||||
bu_vls_printf(gedp->ged_result_str, "Cannot get attributes for object %s\n", dp->d_namep);
|
||||
return GED_ERROR;
|
||||
}
|
||||
if (do_separators) {
|
||||
bu_vls_printf(gedp->ged_result_str, "{%s} ", val);
|
||||
bu_sort(&avs.avp[0], avs.count, sizeof(struct bu_attribute_value_pair), attr_cmp, NULL);
|
||||
|
||||
if (argc == 3) {
|
||||
/* just list all the attributes */
|
||||
for (j = 0, avpp = avs.avp; j < avs.count; j++, avpp++) {
|
||||
if (c_sep == -1)
|
||||
bu_vls_printf(&obj_vals, "%s {%s} ", avpp->name, avpp->value);
|
||||
else {
|
||||
if (j == 0)
|
||||
bu_vls_printf(&obj_vals, "%s%c%s", avpp->name, (char)c_sep, avpp->value);
|
||||
else
|
||||
bu_vls_printf(&obj_vals, "%c%s%c%s", (char)c_sep, avpp->name, (char)c_sep, avpp->value);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
bu_vls_printf(gedp->ged_result_str, "%s", val);
|
||||
const char *val;
|
||||
int do_separators=argc-4; /* if more than one attribute */
|
||||
|
||||
for (j = 3; j < (size_t)argc; j++) {
|
||||
val = bu_avs_get(&avs, argv[j]);
|
||||
if (val) {
|
||||
if (do_separators) {
|
||||
if (c_sep == -1)
|
||||
bu_vls_printf(&obj_vals, "{%s} ", val);
|
||||
else {
|
||||
if (j == 0)
|
||||
bu_vls_printf(&obj_vals, "%s", val);
|
||||
else
|
||||
bu_vls_printf(&obj_vals, "%c%s", (char)c_sep, val);
|
||||
}
|
||||
} else {
|
||||
bu_vls_printf(&obj_vals, "%s", val);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (strlen(bu_vls_addr(&obj_vals)) > 0) {
|
||||
bu_vls_printf(gedp->ged_result_str, "%s: ", dp->d_namep);
|
||||
bu_vls_printf(gedp->ged_result_str, "%s", bu_vls_addr(&obj_vals));
|
||||
|
||||
if (i < path_cnt-1) {
|
||||
bu_vls_printf(gedp->ged_result_str, "\n");
|
||||
}
|
||||
}
|
||||
|
||||
bu_vls_free(&obj_vals);
|
||||
bu_avs_free(&avs);
|
||||
}
|
||||
}
|
||||
} else if (scmd == ATTR_LIST) {
|
||||
struct bu_attribute_value_set avs;
|
||||
bu_avs_init_empty(&avs);
|
||||
|
||||
for (i = 0; i < path_cnt; i++) {
|
||||
struct bu_attribute_value_set lavs;
|
||||
bu_avs_init_empty(&lavs);
|
||||
dp = paths[i];
|
||||
if (db5_get_attributes(gedp->ged_wdbp->dbip, &lavs, dp)) {
|
||||
bu_vls_printf(gedp->ged_result_str, "Cannot get attributes for object %s\n", dp->d_namep);
|
||||
return GED_ERROR;
|
||||
}
|
||||
bu_avs_merge(&avs, &lavs);
|
||||
bu_avs_free(&lavs);
|
||||
}
|
||||
/* Now that we have them all, sort */
|
||||
bu_sort(&avs.avp[0], avs.count, sizeof(struct bu_attribute_value_pair), attr_cmp, NULL);
|
||||
/* list all the attributes */
|
||||
for (i = 0, avpp = avs.avp; i < avs.count; i++, avpp++) {
|
||||
bu_vls_printf(gedp->ged_result_str, "%s\n", avpp->name);
|
||||
}
|
||||
bu_avs_free(&avs);
|
||||
|
||||
} else if (scmd == ATTR_SET) {
|
||||
GED_CHECK_READ_ONLY(gedp, GED_ERROR);
|
||||
/* setting attribute/value pairs */
|
||||
if ((argc - 3) % 2) {
|
||||
bu_vls_printf(gedp->ged_result_str,
|
||||
"Error: attribute names and values must be in pairs!!!\n");
|
||||
bu_avs_free(&avs);
|
||||
"Error: attribute names and values must be in pairs!!!\n");
|
||||
return GED_ERROR;
|
||||
}
|
||||
for (i = 0; i < path_cnt; i++) {
|
||||
size_t j = 3;
|
||||
struct bu_attribute_value_set avs;
|
||||
bu_avs_init_empty(&avs);
|
||||
dp = paths[i];
|
||||
|
||||
i = 3;
|
||||
while (i < (size_t)argc) {
|
||||
if (BU_STR_EQUAL(argv[i], "region") && BU_STR_EQUAL(argv[i+1], "R")) {
|
||||
dp->d_flags |= RT_DIR_REGION;
|
||||
if (db5_get_attributes(gedp->ged_wdbp->dbip, &avs, dp)) {
|
||||
bu_vls_printf(gedp->ged_result_str, "Cannot get attributes for object %s\n", dp->d_namep);
|
||||
return GED_ERROR;
|
||||
}
|
||||
(void)bu_avs_add(&avs, argv[i], argv[i+1]);
|
||||
i += 2;
|
||||
bu_sort(&avs.avp[0], avs.count, sizeof(struct bu_attribute_value_pair), attr_cmp, NULL);
|
||||
while (j < (size_t)argc) {
|
||||
if (BU_STR_EQUAL(argv[j], "region") && BU_STR_EQUAL(argv[j+1], "R")) {
|
||||
dp->d_flags |= RT_DIR_REGION;
|
||||
}
|
||||
(void)bu_avs_add(&avs, argv[j], argv[j+1]);
|
||||
j += 2;
|
||||
}
|
||||
db5_standardize_avs(&avs);
|
||||
if (db5_update_attributes(dp, &avs, gedp->ged_wdbp->dbip)) {
|
||||
bu_vls_printf(gedp->ged_result_str,
|
||||
"Error: failed to update attributes\n");
|
||||
bu_avs_free(&avs);
|
||||
return GED_ERROR;
|
||||
}
|
||||
/* avs is freed by db5_update_attributes() */
|
||||
}
|
||||
db5_standardize_avs(&avs);
|
||||
if (db5_update_attributes(dp, &avs, gedp->ged_wdbp->dbip)) {
|
||||
bu_vls_printf(gedp->ged_result_str,
|
||||
"Error: failed to update attributes\n");
|
||||
bu_avs_free(&avs);
|
||||
return GED_ERROR;
|
||||
}
|
||||
|
||||
/* avs is freed by db5_update_attributes() */
|
||||
|
||||
} else if (scmd == ATTR_RM) {
|
||||
GED_CHECK_READ_ONLY(gedp, GED_ERROR);
|
||||
i = 3;
|
||||
while (i < (size_t)argc) {
|
||||
if (BU_STR_EQUAL(argv[i], "region")) {
|
||||
dp->d_flags = dp->d_flags & ~(RT_DIR_REGION);
|
||||
}
|
||||
(void)bu_avs_remove(&avs, argv[i]);
|
||||
i++;
|
||||
}
|
||||
if (db5_replace_attributes(dp, &avs, gedp->ged_wdbp->dbip)) {
|
||||
bu_vls_printf(gedp->ged_result_str,
|
||||
"Error: failed to update attributes\n");
|
||||
bu_avs_free(&avs);
|
||||
return GED_ERROR;
|
||||
}
|
||||
for (i = 0; i < path_cnt; i++) {
|
||||
size_t j = 3;
|
||||
struct bu_attribute_value_set avs;
|
||||
bu_avs_init_empty(&avs);
|
||||
dp = paths[i];
|
||||
|
||||
/* avs is freed by db5_replace_attributes() */
|
||||
if (db5_get_attributes(gedp->ged_wdbp->dbip, &avs, dp)) {
|
||||
bu_vls_printf(gedp->ged_result_str, "Cannot get attributes for object %s\n", dp->d_namep);
|
||||
return GED_ERROR;
|
||||
}
|
||||
bu_sort(&avs.avp[0], avs.count, sizeof(struct bu_attribute_value_pair), attr_cmp, NULL);
|
||||
|
||||
while (j < (size_t)argc) {
|
||||
if (BU_STR_EQUAL(argv[j], "region")) {
|
||||
dp->d_flags = dp->d_flags & ~(RT_DIR_REGION);
|
||||
}
|
||||
(void)bu_avs_remove(&avs, argv[j]);
|
||||
j++;
|
||||
}
|
||||
if (db5_replace_attributes(dp, &avs, gedp->ged_wdbp->dbip)) {
|
||||
bu_vls_printf(gedp->ged_result_str,
|
||||
"Error: failed to update attributes\n");
|
||||
bu_avs_free(&avs);
|
||||
return GED_ERROR;
|
||||
}
|
||||
/* avs is freed by db5_replace_attributes() */
|
||||
}
|
||||
|
||||
} else if (scmd == ATTR_APPEND) {
|
||||
GED_CHECK_READ_ONLY(gedp, GED_ERROR);
|
||||
if ((argc-3) % 2) {
|
||||
bu_vls_printf(gedp->ged_result_str,
|
||||
"Error: attribute names and values must be in pairs!!!\n");
|
||||
bu_avs_free(&avs);
|
||||
return GED_ERROR;
|
||||
}
|
||||
i = 3;
|
||||
while (i < (size_t)argc) {
|
||||
const char *old_val;
|
||||
if (BU_STR_EQUAL(argv[i], "region") && BU_STR_EQUAL(argv[i+1], "R")) {
|
||||
dp->d_flags |= RT_DIR_REGION;
|
||||
}
|
||||
old_val = bu_avs_get(&avs, argv[i]);
|
||||
if (!old_val) {
|
||||
(void)bu_avs_add(&avs, argv[i], argv[i+1]);
|
||||
} else {
|
||||
struct bu_vls vls = BU_VLS_INIT_ZERO;
|
||||
for (i = 0; i < path_cnt; i++) {
|
||||
size_t j = 3;
|
||||
struct bu_attribute_value_set avs;
|
||||
bu_avs_init_empty(&avs);
|
||||
dp = paths[i];
|
||||
|
||||
bu_vls_strcat(&vls, old_val);
|
||||
bu_vls_strcat(&vls, argv[i+1]);
|
||||
bu_avs_add_vls(&avs, argv[i], &vls);
|
||||
bu_vls_free(&vls);
|
||||
if (db5_get_attributes(gedp->ged_wdbp->dbip, &avs, dp)) {
|
||||
bu_vls_printf(gedp->ged_result_str, "Cannot get attributes for object %s\n", dp->d_namep);
|
||||
return GED_ERROR;
|
||||
}
|
||||
bu_sort(&avs.avp[0], avs.count, sizeof(struct bu_attribute_value_pair), attr_cmp, NULL);
|
||||
|
||||
while (j < (size_t)argc) {
|
||||
const char *old_val;
|
||||
if (BU_STR_EQUAL(argv[j], "region") && BU_STR_EQUAL(argv[j+1], "R")) {
|
||||
dp->d_flags |= RT_DIR_REGION;
|
||||
}
|
||||
old_val = bu_avs_get(&avs, argv[j]);
|
||||
if (!old_val) {
|
||||
(void)bu_avs_add(&avs, argv[j], argv[j+1]);
|
||||
} else {
|
||||
struct bu_vls vls = BU_VLS_INIT_ZERO;
|
||||
|
||||
bu_vls_strcat(&vls, old_val);
|
||||
bu_vls_strcat(&vls, argv[j+1]);
|
||||
bu_avs_add_vls(&avs, argv[j], &vls);
|
||||
bu_vls_free(&vls);
|
||||
}
|
||||
|
||||
j += 2;
|
||||
}
|
||||
if (db5_replace_attributes(dp, &avs, gedp->ged_wdbp->dbip)) {
|
||||
bu_vls_printf(gedp->ged_result_str,
|
||||
"Error: failed to update attributes\n");
|
||||
bu_avs_free(&avs);
|
||||
return GED_ERROR;
|
||||
}
|
||||
|
||||
i += 2;
|
||||
/* avs is freed by db5_replace_attributes() */
|
||||
}
|
||||
if (db5_replace_attributes(dp, &avs, gedp->ged_wdbp->dbip)) {
|
||||
bu_vls_printf(gedp->ged_result_str,
|
||||
"Error: failed to update attributes\n");
|
||||
bu_avs_free(&avs);
|
||||
return GED_ERROR;
|
||||
}
|
||||
|
||||
/* avs is freed by db5_replace_attributes() */
|
||||
|
||||
} else if (scmd == ATTR_SHOW) {
|
||||
int tabs1 = 0;
|
||||
for (i = 0; i < path_cnt; i++) {
|
||||
/* for pretty printing */
|
||||
size_t max_attr_name_len = 0;
|
||||
size_t max_attr_value_len = 0;
|
||||
|
||||
/* pretty print */
|
||||
if ((attr_pretty_print(gedp, dp, argv[2])) != GED_OK)
|
||||
return GED_ERROR;
|
||||
size_t j = 0;
|
||||
size_t tabs1 = 0;
|
||||
struct bu_attribute_value_set avs;
|
||||
bu_avs_init_empty(&avs);
|
||||
dp = paths[i];
|
||||
|
||||
if (argc == 3) {
|
||||
/* just display all attributes */
|
||||
attr_print(gedp, &avs, max_attr_name_len);
|
||||
} else {
|
||||
const char *val;
|
||||
int len;
|
||||
if (db5_get_attributes(gedp->ged_wdbp->dbip, &avs, dp)) {
|
||||
bu_vls_printf(gedp->ged_result_str, "Cannot get attributes for object %s\n", dp->d_namep);
|
||||
return GED_ERROR;
|
||||
}
|
||||
|
||||
/* show just the specified attributes */
|
||||
for (i = 0; i < (size_t)argc; i++) {
|
||||
len = (int)strlen(argv[i]);
|
||||
if (len > max_attr_name_len) {
|
||||
/* get a jump on calculating name and value lengths */
|
||||
for (j = 0, avpp = avs.avp; j < avs.count; j++, avpp++) {
|
||||
size_t len = strlen(avpp->name);
|
||||
if (len > max_attr_name_len)
|
||||
max_attr_name_len = len;
|
||||
if (avpp->value) {
|
||||
len = strlen(avpp->value);
|
||||
if (len > max_attr_value_len)
|
||||
max_attr_value_len = len;
|
||||
}
|
||||
}
|
||||
tabs1 = 2 + max_attr_name_len/8;
|
||||
for (i = 3; i < (size_t)argc; i++) {
|
||||
int tabs2;
|
||||
int k;
|
||||
const char *c;
|
||||
|
||||
val = bu_avs_get(&avs, argv[i]);
|
||||
if (!val) {
|
||||
bu_vls_printf(gedp->ged_result_str,
|
||||
"Object %s does not have a %s attribute\n",
|
||||
dp->d_namep,
|
||||
argv[i]);
|
||||
bu_avs_free(&avs);
|
||||
return GED_ERROR;
|
||||
/* pretty print */
|
||||
if ((attr_pretty_print(gedp, dp, dp->d_namep)) != GED_OK) {
|
||||
return GED_ERROR;
|
||||
}
|
||||
|
||||
if (argc == 3) {
|
||||
/* just display all attributes */
|
||||
attr_print(gedp, &avs, max_attr_name_len);
|
||||
} else {
|
||||
const char *val;
|
||||
size_t len;
|
||||
|
||||
/* show just the specified attributes */
|
||||
for (j = 0; j < (size_t)argc; j++) {
|
||||
len = strlen(argv[j]);
|
||||
if (len > max_attr_name_len) {
|
||||
max_attr_name_len = len;
|
||||
}
|
||||
}
|
||||
bu_vls_printf(gedp->ged_result_str, "\t%s", argv[i]);
|
||||
len = (int)strlen(val);
|
||||
tabs2 = tabs1 - 1 - len/8;
|
||||
for (k = 0; k < tabs2; k++) {
|
||||
bu_vls_putc(gedp->ged_result_str, '\t');
|
||||
}
|
||||
c = val;
|
||||
while (*c) {
|
||||
bu_vls_putc(gedp->ged_result_str, *c);
|
||||
if (*c == '\n') {
|
||||
for (k = 0; k < tabs1; k++) {
|
||||
bu_vls_putc(gedp->ged_result_str, '\t');
|
||||
tabs1 = 2 + max_attr_name_len/8;
|
||||
for (j = 3; j < (size_t)argc; j++) {
|
||||
size_t tabs2;
|
||||
size_t k;
|
||||
const char *c;
|
||||
|
||||
val = bu_avs_get(&avs, argv[j]);
|
||||
if (!val && path_cnt == 1) {
|
||||
bu_vls_printf(gedp->ged_result_str,
|
||||
"Object %s does not have a %s attribute\n",
|
||||
dp->d_namep,
|
||||
argv[j]);
|
||||
bu_avs_free(&avs);
|
||||
return GED_ERROR;
|
||||
} else {
|
||||
if (val) {
|
||||
bu_vls_printf(gedp->ged_result_str, "\t%s", argv[j]);
|
||||
len = strlen(val);
|
||||
tabs2 = tabs1 - 1 - len/8;
|
||||
for (k = 0; k < tabs2; k++) {
|
||||
bu_vls_putc(gedp->ged_result_str, '\t');
|
||||
}
|
||||
c = val;
|
||||
while (*c) {
|
||||
bu_vls_putc(gedp->ged_result_str, *c);
|
||||
if (*c == '\n') {
|
||||
for (k = 0; k < tabs1; k++) {
|
||||
bu_vls_putc(gedp->ged_result_str, '\t');
|
||||
}
|
||||
}
|
||||
c++;
|
||||
}
|
||||
bu_vls_putc(gedp->ged_result_str, '\n');
|
||||
}
|
||||
}
|
||||
c++;
|
||||
}
|
||||
bu_vls_putc(gedp->ged_result_str, '\n');
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
bu_vls_printf(gedp->ged_result_str, "ERROR: unrecognized attr subcommand %s\n", argv[1]);
|
||||
bu_vls_printf(gedp->ged_result_str, "Usage: %s %s", argv[0], usage);
|
||||
bu_vls_printf(gedp->ged_result_str, "Usage: %s %s", cmd_name, usage);
|
||||
|
||||
return GED_ERROR;
|
||||
}
|
||||
|
||||
+2
-2
@@ -261,7 +261,7 @@ comb_flatten(struct ged *gedp, struct directory *dp)
|
||||
|
||||
|
||||
/* Find the combs NOT in the tree */
|
||||
obj_cnt = db_ls(gedp->ged_wdbp->dbip, DB_LS_TOPS, &all_paths);
|
||||
obj_cnt = db_ls(gedp->ged_wdbp->dbip, DB_LS_TOPS, NULL, &all_paths);
|
||||
bu_vls_init(&plan_string);
|
||||
bu_vls_sprintf(&plan_string, "-mindepth 1 ! -below -name %s -type comb", dp->d_namep);
|
||||
(void)db_search(&combs_outside_of_tree, DB_SEARCH_RETURN_UNIQ_DP, bu_vls_addr(&plan_string), obj_cnt, all_paths, gedp->ged_wdbp->dbip);
|
||||
@@ -347,7 +347,7 @@ comb_lift_region(struct ged *gedp, struct directory *dp)
|
||||
}
|
||||
|
||||
/* Find the combs NOT in the tree */
|
||||
obj_cnt = db_ls(gedp->ged_wdbp->dbip, DB_LS_TOPS, &all_paths);
|
||||
obj_cnt = db_ls(gedp->ged_wdbp->dbip, DB_LS_TOPS, NULL, &all_paths);
|
||||
bu_vls_init(&plan_string);
|
||||
bu_vls_sprintf(&plan_string, "-mindepth 1 ! -below -name %s -type comb", dp->d_namep);
|
||||
(void)db_search(&combs_outside_of_tree, DB_SEARCH_RETURN_UNIQ_DP, bu_vls_addr(&plan_string), obj_cnt, all_paths, gedp->ged_wdbp->dbip);
|
||||
|
||||
@@ -702,6 +702,12 @@ _ged_drawtrees(struct ged *gedp, int argc, const char *argv[], int kind, struct
|
||||
|
||||
}
|
||||
|
||||
if (!argc) {
|
||||
bu_vls_printf(gedp->ged_result_str, "Please specify one or more objects to be drawn.\n");
|
||||
--drawtrees_depth;
|
||||
return -1;
|
||||
}
|
||||
|
||||
switch (kind) {
|
||||
default:
|
||||
bu_vls_printf(gedp->ged_result_str, "ERROR, bad kind\n");
|
||||
|
||||
+18
-2
@@ -29,6 +29,7 @@
|
||||
#include <ctype.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "bu/path.h"
|
||||
#include "./ged_private.h"
|
||||
|
||||
|
||||
@@ -157,13 +158,28 @@ ged_glob(struct ged *gedp, int argc, const char *argv[])
|
||||
it to the database. */
|
||||
|
||||
if (regexp) {
|
||||
register int i, num;
|
||||
register struct directory *dp;
|
||||
/* No database to match against, so return. */
|
||||
if (gedp->ged_wdbp == RT_WDB_NULL || gedp->ged_wdbp->dbip == DBI_NULL)
|
||||
return GED_OK;
|
||||
|
||||
bu_vls_trunc(&temp, 0);
|
||||
if (db_regexp_match_all(&temp, gedp->ged_wdbp->dbip,
|
||||
bu_vls_addr(&word)) == 0) {
|
||||
for (i = num = 0; i < RT_DBNHASH; i++) {
|
||||
for (dp = gedp->ged_wdbp->dbip->dbi_Head[i]; dp != RT_DIR_NULL; dp = dp->d_forw) {
|
||||
if (bu_fnmatch(bu_vls_addr(&word), dp->d_namep, 0) != 0)
|
||||
continue;
|
||||
if (num == 0)
|
||||
bu_vls_strcat(&temp, dp->d_namep);
|
||||
else {
|
||||
bu_vls_strcat(&temp, " ");
|
||||
bu_vls_strcat(&temp, dp->d_namep);
|
||||
}
|
||||
++num;
|
||||
}
|
||||
}
|
||||
|
||||
if (num == 0) {
|
||||
debackslash(&temp, &word);
|
||||
backslash(gedp->ged_result_str, &temp);
|
||||
} else
|
||||
|
||||
+417
@@ -0,0 +1,417 @@
|
||||
/* L C . C
|
||||
* BRL-CAD
|
||||
*
|
||||
* Copyright (c) 2014-2014 United States Government as represented by
|
||||
* the U.S. Army Research Laboratory.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public License
|
||||
* version 2.1 as published by the Free Software Foundation.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this file; see the file named COPYING for more
|
||||
* information.
|
||||
*/
|
||||
/** @file libged/lc.c
|
||||
*
|
||||
* The lc command.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "common.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include "ged.h"
|
||||
#include "bu/str.h"
|
||||
#include "bu/vls.h"
|
||||
#include "bu/file.h"
|
||||
#include "bu/getopt.h"
|
||||
#include "bu/sort.h"
|
||||
#include "bu/ptbl.h"
|
||||
|
||||
|
||||
struct region_record
|
||||
{
|
||||
int ignore;
|
||||
const char *region_id;
|
||||
const char *material_id;
|
||||
const char *los;
|
||||
const char *obj_name;
|
||||
const char *obj_parent;
|
||||
};
|
||||
|
||||
/**
|
||||
* Sorts the region lists such that identical entries are next to each
|
||||
* other; used to remove duplicates.
|
||||
*/
|
||||
static int
|
||||
cmp_regions(const void *a, const void *b, void *UNUSED(arg))
|
||||
{
|
||||
struct region_record *r1 = (struct region_record *)a;
|
||||
struct region_record *r2 = (struct region_record *)b;
|
||||
int cmp;
|
||||
|
||||
cmp = bu_strcmp(r1->region_id, r2->region_id);
|
||||
if (cmp) { return cmp; }
|
||||
cmp = bu_strcmp(r1->material_id, r2->material_id);
|
||||
if (cmp) { return cmp; }
|
||||
cmp = bu_strcmp(r1->los, r2->los);
|
||||
return cmp;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sorts the region list according to the sort parameter (1 - 5) passed in.
|
||||
*/
|
||||
static int
|
||||
sort_regions(const void *a, const void *b, void *arg)
|
||||
{
|
||||
struct region_record *r1 = (struct region_record *)a;
|
||||
struct region_record *r2 = (struct region_record *)b;
|
||||
int *sort_type = (int *)arg;
|
||||
int temp1,temp2;
|
||||
|
||||
switch (*sort_type) {
|
||||
case 1:
|
||||
temp1=atoi(r1->region_id);
|
||||
temp2=atoi(r2->region_id);
|
||||
goto continue_run;
|
||||
case 2:
|
||||
temp1=atoi(r1->material_id);
|
||||
temp2=atoi(r2->material_id);
|
||||
goto continue_run;
|
||||
case 3:
|
||||
temp1=atoi(r1->los);
|
||||
temp2=atoi(r2->los);
|
||||
continue_run:
|
||||
if ( temp1 > temp2 )
|
||||
return 1;
|
||||
if ( temp1 == temp2 )
|
||||
return 0;
|
||||
return -1;
|
||||
case 4:
|
||||
return bu_strcmp(r1->obj_name, r2->obj_name);
|
||||
case 5:
|
||||
return bu_strcmp(r1->obj_parent, r2->obj_parent);
|
||||
}
|
||||
/* This should never be executed */
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
print_cmd_args(struct bu_vls *output, int argc, const char *argv[])
|
||||
{
|
||||
int i;
|
||||
bu_vls_printf(output, "Command args: '");
|
||||
for (i = 0; i < argc; i++) {
|
||||
bu_vls_printf(output, "%s", argv[i]);
|
||||
if (i < argc - 1) {
|
||||
bu_vls_printf(output, " ");
|
||||
} else {
|
||||
bu_vls_printf(output, "'\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get an attribute from a bu_avs, like bu_avs_get, but return "--" if
|
||||
* the item is missing, instead of NULL
|
||||
*/
|
||||
static const char *
|
||||
get_attr(const struct bu_attribute_value_set *avp, const char *attribute)
|
||||
{
|
||||
const char *value = bu_avs_get(avp, attribute);
|
||||
return value ? value : "--";
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
ged_lc(struct ged *gedp, int argc, const char *argv[])
|
||||
{
|
||||
char *file_name = NULL;
|
||||
int file_name_flag_cnt = 0;
|
||||
int sort_column = 1;
|
||||
int sort_column_flag_cnt = 0;
|
||||
int find_duplicates_flag = 0;
|
||||
int skip_special_duplicates_flag = 0;
|
||||
int skip_subtracted_regions_flag = 0;
|
||||
int descending_sort_flag = 0;
|
||||
int unrecognized_flag_cnt = 0;
|
||||
|
||||
int orig_argc;
|
||||
const char **orig_argv;
|
||||
|
||||
static const char *usage = "[-d|-s] [-r] [-z] [-0|-1|-2|-3|-4|-5] [-f {FileName}] {GroupName}";
|
||||
|
||||
int c;
|
||||
int error_cnt = 0;
|
||||
|
||||
FILE *outfile = NULL;
|
||||
struct bu_vls *output;
|
||||
|
||||
const char *group_name;
|
||||
|
||||
size_t i,j;
|
||||
struct bu_ptbl results1 = BU_PTBL_INIT_ZERO;
|
||||
struct bu_ptbl results2 = BU_PTBL_INIT_ZERO;
|
||||
char *path;
|
||||
char *plan;
|
||||
struct db_full_path root;
|
||||
int matches;
|
||||
struct region_record *regions;
|
||||
size_t ignored_cnt = 0;
|
||||
|
||||
/* The defaults are the minimum widths to accommodate column headers */
|
||||
size_t region_id_len_max = 2;
|
||||
size_t material_id_len_max = 3;
|
||||
size_t los_len_max = 3;
|
||||
size_t obj_len_max = 6;
|
||||
|
||||
/* For the output at the end */
|
||||
size_t start, end, incr;
|
||||
|
||||
/* initialize result */
|
||||
bu_vls_trunc(gedp->ged_result_str, 0);
|
||||
|
||||
if (argc == 1) {
|
||||
bu_vls_printf(gedp->ged_result_str, "Usage: %s\n", usage);
|
||||
return GED_HELP;
|
||||
}
|
||||
|
||||
GED_CHECK_DATABASE_OPEN(gedp, GED_ERROR);
|
||||
GED_CHECK_ARGC_GT_0(gedp, argc, GED_ERROR);
|
||||
|
||||
bu_optind = 1; /* re-init bu_getopt() */
|
||||
while ((c = bu_getopt(argc, (char * const *)argv, "dsrz012345f:")) != -1) {
|
||||
switch (c) {
|
||||
case '0':
|
||||
case '1':
|
||||
case '2':
|
||||
case '3':
|
||||
case '4':
|
||||
case '5':
|
||||
sort_column_flag_cnt++;
|
||||
sort_column = c - '0';
|
||||
break;
|
||||
case 'f':
|
||||
file_name_flag_cnt++;
|
||||
file_name = bu_optarg;
|
||||
break;
|
||||
case 's':
|
||||
skip_special_duplicates_flag = 1;
|
||||
/* FALLTHROUGH */
|
||||
case 'd':
|
||||
find_duplicates_flag = 1;
|
||||
break;
|
||||
case 'r':
|
||||
skip_subtracted_regions_flag = 1;
|
||||
break;
|
||||
case 'z':
|
||||
descending_sort_flag = 1;
|
||||
break;
|
||||
default:
|
||||
unrecognized_flag_cnt++;
|
||||
}
|
||||
}
|
||||
orig_argc = argc;
|
||||
orig_argv = argv;
|
||||
argc -= (bu_optind - 1);
|
||||
argv += (bu_optind - 1);
|
||||
|
||||
/* Attempt to recreate the exact error messages from the original lc.tcl */
|
||||
|
||||
if (file_name_flag_cnt > 1) {
|
||||
bu_vls_printf(gedp->ged_result_str, "Error: '-f' used more than once.\n");
|
||||
error_cnt++;
|
||||
}
|
||||
|
||||
if (sort_column_flag_cnt > 1) {
|
||||
bu_vls_printf(gedp->ged_result_str, "Error: Sort column defined more than once.\n");
|
||||
error_cnt++;
|
||||
}
|
||||
|
||||
if (file_name_flag_cnt + argc + unrecognized_flag_cnt > 3) {
|
||||
bu_vls_printf(gedp->ged_result_str, "Error: More than one group name and/or file name was specified.\n");
|
||||
error_cnt++;
|
||||
} else if (argc < 2) {
|
||||
if (file_name_flag_cnt && !file_name) {
|
||||
bu_vls_printf(gedp->ged_result_str, "Error: Group name and file name not specified\n");
|
||||
} else {
|
||||
bu_vls_printf(gedp->ged_result_str, "Error: Group name not specified.\n");
|
||||
}
|
||||
error_cnt++;
|
||||
} else if (argc + unrecognized_flag_cnt > 2) {
|
||||
bu_vls_printf(gedp->ged_result_str, "Error: More than one group name was specified.\n");
|
||||
error_cnt++;
|
||||
} else if (file_name_flag_cnt && !file_name) {
|
||||
bu_vls_printf(gedp->ged_result_str, "Error: File name not specified.\n");
|
||||
error_cnt++;
|
||||
}
|
||||
|
||||
if (file_name) {
|
||||
char *norm_name;
|
||||
norm_name = bu_realpath(file_name, NULL);
|
||||
if (file_name[0] == '-') {
|
||||
bu_vls_printf(gedp->ged_result_str, "Error: File name can not start with '-'.\n");
|
||||
error_cnt++;
|
||||
} else if (bu_file_exists(file_name, NULL)) {
|
||||
bu_vls_printf(gedp->ged_result_str, "Error: Output file %s already exists.\n",norm_name);
|
||||
error_cnt++;
|
||||
} else {
|
||||
outfile = fopen(file_name, "w");
|
||||
if (!outfile) {
|
||||
bu_vls_printf(gedp->ged_result_str, "Error: %d\n", errno);
|
||||
error_cnt++;
|
||||
}
|
||||
}
|
||||
bu_vls_printf(gedp->ged_result_str, "Output filename: %s\n", norm_name);
|
||||
bu_free(norm_name, "ged_lc");
|
||||
output = bu_vls_vlsinit();
|
||||
} else {
|
||||
output = gedp->ged_result_str;
|
||||
}
|
||||
|
||||
if (error_cnt > 0) { return GED_ERROR; }
|
||||
|
||||
group_name = argv[1];
|
||||
|
||||
/* The 7 is for the "-name" and '\0' */
|
||||
plan = (char *) bu_malloc(sizeof(char) * (strlen(group_name) + 7), "ged_lc");
|
||||
sprintf(plan, "-name %s", group_name);
|
||||
matches = db_search(&results1, DB_SEARCH_TREE, plan, 0, NULL, gedp->ged_wdbp->dbip);
|
||||
if (matches < 1) {
|
||||
bu_vls_printf(gedp->ged_result_str, "Error: Group '%s' does not exist.\n", group_name);
|
||||
return GED_ERROR;
|
||||
}
|
||||
bu_free(plan, "ged_lc");
|
||||
db_search_free(&results1);
|
||||
|
||||
if (skip_subtracted_regions_flag) {
|
||||
plan = "-type region ! -bool -";
|
||||
} else {
|
||||
plan = "-type region";
|
||||
}
|
||||
path = (char *) bu_malloc(sizeof(char) * (strlen(group_name) + 2), "ged_lc");
|
||||
sprintf(path, "/%s", group_name);
|
||||
db_string_to_path(&root, gedp->ged_wdbp->dbip, path);
|
||||
matches = db_search(&results2, DB_SEARCH_TREE, plan, root.fp_len, root.fp_names, gedp->ged_wdbp->dbip);
|
||||
bu_free(path, "ged_lc");
|
||||
if (matches < 1) { return GED_ERROR; }
|
||||
regions = (struct region_record *) bu_malloc(sizeof(struct region_record) * BU_PTBL_LEN(&results2), "ged_lc");
|
||||
for (i = 0; i < BU_PTBL_LEN(&results2); i++) {
|
||||
struct db_full_path *entry = (struct db_full_path *)BU_PTBL_GET(&results2, i);
|
||||
struct directory *dp_curr_dir = DB_FULL_PATH_CUR_DIR(entry);
|
||||
struct bu_attribute_value_set avs;
|
||||
|
||||
j = BU_PTBL_LEN(&results2) - i - 1 ;
|
||||
regions[j].ignore = 0;
|
||||
|
||||
bu_avs_init_empty(&avs);
|
||||
db5_get_attributes(gedp->ged_wdbp->dbip, &avs, dp_curr_dir);
|
||||
|
||||
regions[j].region_id = get_attr(&avs, "region_id");
|
||||
V_MAX(region_id_len_max, strlen(regions[j].region_id));
|
||||
regions[j].material_id = get_attr(&avs, "material_id");
|
||||
V_MAX(material_id_len_max, strlen(regions[j].material_id));
|
||||
regions[j].los = get_attr(&avs, "los");
|
||||
V_MAX(los_len_max, strlen(regions[j].los));
|
||||
regions[j].obj_name = dp_curr_dir->d_namep;
|
||||
V_MAX(obj_len_max, strlen(regions[j].obj_name));
|
||||
|
||||
if (entry->fp_len > 1) {
|
||||
struct directory *dp_parent = DB_FULL_PATH_GET(entry, entry->fp_len - 2);
|
||||
regions[j].obj_parent = dp_parent->d_namep;
|
||||
} else {
|
||||
regions[j].obj_parent = "--";
|
||||
}
|
||||
}
|
||||
|
||||
if (find_duplicates_flag) {
|
||||
|
||||
bu_sort((void *) regions, BU_PTBL_LEN(&results2), sizeof(struct region_record), cmp_regions, NULL);
|
||||
|
||||
for (i = 1; i < BU_PTBL_LEN(&results2); i++) {
|
||||
int same;
|
||||
if (skip_special_duplicates_flag) {
|
||||
same = !cmp_regions((void *)&(regions[i - 1]), (void *)&(regions[i]), NULL);
|
||||
} else {
|
||||
same = !bu_strcmp(regions[i - 1].region_id, regions[i].region_id);
|
||||
}
|
||||
if (same) {
|
||||
regions[i].ignore = 1;
|
||||
ignored_cnt++;
|
||||
}
|
||||
}
|
||||
|
||||
if (ignored_cnt == BU_PTBL_LEN(&results2)) {
|
||||
if (file_name) {
|
||||
print_cmd_args(output, orig_argc, orig_argv);
|
||||
bu_vls_printf(output, "No duplicate region_id\n");
|
||||
bu_vls_fwrite(outfile, output);
|
||||
fclose(outfile);
|
||||
}
|
||||
bu_vls_printf(gedp->ged_result_str, "No duplicate region_id\n");
|
||||
bu_vls_printf(gedp->ged_result_str, "Done.\n");
|
||||
bu_free(regions, "ged_lc");
|
||||
return GED_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
if (sort_column > 0) {
|
||||
bu_sort((void *) regions, BU_PTBL_LEN(&results2), sizeof(struct region_record), sort_regions, (void *)&sort_column);
|
||||
}
|
||||
|
||||
if (file_name) {
|
||||
print_cmd_args(output, orig_argc, orig_argv);
|
||||
}
|
||||
|
||||
bu_vls_printf(output, "List length: %d\n", BU_PTBL_LEN(&results2) - ignored_cnt);
|
||||
bu_vls_printf(output, "%-*s %-*s %-*s %-*s %s\n",
|
||||
region_id_len_max + 1, "ID",
|
||||
material_id_len_max + 1, "MAT",
|
||||
los_len_max, "LOS",
|
||||
obj_len_max, "REGION",
|
||||
"PARENT");
|
||||
end = BU_PTBL_LEN(&results2);
|
||||
if (descending_sort_flag) {
|
||||
start = end - 1; end = -1; incr = -1;
|
||||
} else {
|
||||
start = 0; incr = 1;
|
||||
}
|
||||
for (i = start; i != end; i += incr) {
|
||||
if (regions[i].ignore) { continue; }
|
||||
bu_vls_printf(output, "%-*s %-*s %-*s %-*s %s\n",
|
||||
region_id_len_max + 1, regions[i].region_id,
|
||||
material_id_len_max + 1, regions[i].material_id,
|
||||
los_len_max, regions[i].los,
|
||||
obj_len_max, regions[i].obj_name,
|
||||
regions[i].obj_parent);
|
||||
}
|
||||
bu_vls_printf(gedp->ged_result_str, "Done.\n");
|
||||
|
||||
if (file_name) {
|
||||
bu_vls_fwrite(outfile, output);
|
||||
fclose(outfile);
|
||||
}
|
||||
|
||||
bu_free(regions, "ged_lc");
|
||||
|
||||
return GED_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* Local Variables:
|
||||
* tab-width: 8
|
||||
* mode: C
|
||||
* indent-tabs-mode: t
|
||||
* c-file-style: "stroustrup"
|
||||
* End:
|
||||
* ex: shiftwidth=4 tabstop=8
|
||||
*/
|
||||
+34
-8
@@ -27,13 +27,13 @@
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "bu/getopt.h"
|
||||
#include "bu/cmd.h"
|
||||
|
||||
#include "./ged_private.h"
|
||||
|
||||
|
||||
static int
|
||||
list_children(struct ged *gedp, struct directory *dp)
|
||||
list_children(struct ged *gedp, struct directory *dp, int c_sep)
|
||||
{
|
||||
size_t i;
|
||||
struct rt_db_internal intern;
|
||||
@@ -93,7 +93,15 @@ list_children(struct ged *gedp, struct directory *dp)
|
||||
break;
|
||||
}
|
||||
|
||||
bu_vls_printf(gedp->ged_result_str, "{%c %s} ", op, rt_tree_array[i].tl_tree->tr_l.tl_name);
|
||||
if (c_sep == -1)
|
||||
bu_vls_printf(gedp->ged_result_str, "{%c %s} ", op, rt_tree_array[i].tl_tree->tr_l.tl_name);
|
||||
else {
|
||||
if (i == 0)
|
||||
bu_vls_printf(gedp->ged_result_str, "%s", rt_tree_array[i].tl_tree->tr_l.tl_name);
|
||||
else
|
||||
bu_vls_printf(gedp->ged_result_str, "%c%s", (char)c_sep, rt_tree_array[i].tl_tree->tr_l.tl_name);
|
||||
}
|
||||
|
||||
db_free_tree(rt_tree_array[i].tl_tree, &rt_uniresource);
|
||||
}
|
||||
bu_vls_free(&vls);
|
||||
@@ -111,7 +119,10 @@ int
|
||||
ged_lt(struct ged *gedp, int argc, const char *argv[])
|
||||
{
|
||||
struct directory *dp;
|
||||
static const char *usage = "object";
|
||||
static const char *usage = "[-c sep_char] object";
|
||||
int opt;
|
||||
int c_sep = -1;
|
||||
const char *cmd_name = argv[0];
|
||||
|
||||
GED_CHECK_DATABASE_OPEN(gedp, GED_ERROR);
|
||||
GED_CHECK_ARGC_GT_0(gedp, argc, GED_ERROR);
|
||||
@@ -121,21 +132,36 @@ ged_lt(struct ged *gedp, int argc, const char *argv[])
|
||||
|
||||
/* must be wanting help */
|
||||
if (argc == 1) {
|
||||
bu_vls_printf(gedp->ged_result_str, "Usage: %s %s", argv[0], usage);
|
||||
bu_vls_printf(gedp->ged_result_str, "Usage: %s %s", cmd_name, usage);
|
||||
return GED_HELP;
|
||||
}
|
||||
|
||||
bu_optind = 1; /* re-init bu_getopt() */
|
||||
while ((opt = bu_getopt(argc, (char * const *)argv, "c:")) != -1) {
|
||||
switch (opt) {
|
||||
case 'c':
|
||||
c_sep = (int)bu_optarg[0];
|
||||
break;
|
||||
default:
|
||||
bu_vls_printf(gedp->ged_result_str, "Unrecognized option - %c", opt);
|
||||
return GED_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
argc -= bu_optind - 1;
|
||||
argv += bu_optind - 1;
|
||||
|
||||
if (argc != 2) {
|
||||
bu_vls_printf(gedp->ged_result_str, "Usage: %s %s", argv[0], usage);
|
||||
bu_vls_printf(gedp->ged_result_str, "Usage: %s %s", cmd_name, usage);
|
||||
return GED_ERROR;
|
||||
}
|
||||
|
||||
if ((dp = db_lookup(gedp->ged_wdbp->dbip, argv[1], LOOKUP_NOISY)) == RT_DIR_NULL) {
|
||||
bu_vls_printf(gedp->ged_result_str, "Usage: %s %s", argv[0], usage);
|
||||
bu_vls_printf(gedp->ged_result_str, "Usage: %s %s", cmd_name, usage);
|
||||
return GED_ERROR;
|
||||
}
|
||||
|
||||
return list_children(gedp, dp);
|
||||
return list_children(gedp, dp, c_sep);
|
||||
}
|
||||
|
||||
|
||||
|
||||
+18
-1
@@ -28,6 +28,7 @@
|
||||
#include <string.h>
|
||||
|
||||
#include "bu/cmd.h"
|
||||
#include "bu/path.h"
|
||||
|
||||
#include "./ged_private.h"
|
||||
|
||||
@@ -50,7 +51,23 @@ ged_match(struct ged *gedp, int argc, const char *argv[])
|
||||
}
|
||||
|
||||
for (++argv; *argv != NULL; ++argv) {
|
||||
if (db_regexp_match_all(gedp->ged_result_str, gedp->ged_wdbp->dbip, *argv) > 0)
|
||||
register int i, num;
|
||||
register struct directory *dp;
|
||||
for (i = num = 0; i < RT_DBNHASH; i++) {
|
||||
for (dp = gedp->ged_wdbp->dbip->dbi_Head[i]; dp != RT_DIR_NULL; dp = dp->d_forw) {
|
||||
if (bu_fnmatch(*argv, dp->d_namep, 0) != 0)
|
||||
continue;
|
||||
if (num == 0)
|
||||
bu_vls_strcat(gedp->ged_result_str, dp->d_namep);
|
||||
else {
|
||||
bu_vls_strcat(gedp->ged_result_str, " ");
|
||||
bu_vls_strcat(gedp->ged_result_str, dp->d_namep);
|
||||
}
|
||||
++num;
|
||||
}
|
||||
}
|
||||
|
||||
if (num > 0)
|
||||
bu_vls_strcat(gedp->ged_result_str, " ");
|
||||
}
|
||||
bu_vls_trimspace(gedp->ged_result_str);
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
|
||||
#include <clipper.hpp>
|
||||
|
||||
#include "bu/sort.h"
|
||||
#include "ged.h"
|
||||
|
||||
|
||||
@@ -888,6 +889,258 @@ end:
|
||||
}
|
||||
|
||||
|
||||
HIDDEN int
|
||||
sort_by_X(const void *p1, const void *p2, void *UNUSED(arg))
|
||||
{
|
||||
point2d_t *pt1 = (point2d_t *)p1;
|
||||
point2d_t *pt2 = (point2d_t *)p2;
|
||||
|
||||
if (*pt1[X] < *pt2[X]) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (*pt1[X] > *pt2[X]) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
ged_polygon_fill_segments(struct ged *gedp, bview_polygon *poly, vect2d_t vfilldir, fastf_t vfilldelta)
|
||||
{
|
||||
register size_t i, j;
|
||||
register fastf_t vx, vy, vZ;
|
||||
register size_t begin, end;
|
||||
point2d_t pt_2d;
|
||||
point_t pt;
|
||||
point_t hit_pt;
|
||||
polygon_2d poly_2d;
|
||||
size_t ecount;
|
||||
size_t icount;
|
||||
size_t final_icount;
|
||||
struct bu_vls result_vls;
|
||||
point2d_t *isect2;
|
||||
point2d_t *final_isect2;
|
||||
int tweakCount;
|
||||
static size_t isectSize = 8;
|
||||
static int maxTweaks = 10;
|
||||
|
||||
/* initialize result */
|
||||
bu_vls_trunc(gedp->ged_result_str, 0);
|
||||
|
||||
if (poly->gp_num_contours < 1 || poly->gp_contour[0].gpc_num_points < 3)
|
||||
return;
|
||||
|
||||
if (vfilldelta < 0)
|
||||
vfilldelta = -vfilldelta;
|
||||
|
||||
isect2 = (point2d_t *)bu_calloc(isectSize, sizeof(point2d_t), "isect2");
|
||||
final_isect2 = (point2d_t *)bu_calloc(isectSize, sizeof(point2d_t), "final_isect2");
|
||||
|
||||
/* Project poly onto the view plane */
|
||||
poly_2d.p_num_contours = poly->gp_num_contours;
|
||||
poly_2d.p_hole = (int *)bu_calloc(poly->gp_num_contours, sizeof(int), "p_hole");
|
||||
poly_2d.p_contour = (poly_contour_2d *)bu_calloc(poly->gp_num_contours, sizeof(poly_contour_2d), "p_contour");
|
||||
|
||||
for (i = 0; i < poly->gp_num_contours; ++i) {
|
||||
poly_2d.p_hole[i] = poly->gp_hole[i];
|
||||
poly_2d.p_contour[i].pc_num_points = poly->gp_contour[i].gpc_num_points;
|
||||
poly_2d.p_contour[i].pc_point = (point2d_t *)bu_calloc(poly->gp_contour[i].gpc_num_points, sizeof(point2d_t), "pc_point");
|
||||
|
||||
for (j = 0; j < poly->gp_contour[i].gpc_num_points; ++j) {
|
||||
point_t vpoint;
|
||||
|
||||
MAT4X3PNT(vpoint, gedp->ged_gvp->gv_model2view, poly->gp_contour[i].gpc_point[j]);
|
||||
V2MOVE(poly_2d.p_contour[i].pc_point[j], vpoint);
|
||||
vZ = vpoint[Z];
|
||||
}
|
||||
}
|
||||
|
||||
VUNITIZE(vfilldir);
|
||||
bu_vls_init(&result_vls);
|
||||
|
||||
/* Intersect diagonal view lines with the 2d polygon */
|
||||
pt_2d[X] = -1.0;
|
||||
for (vy = 1.0 - vfilldelta; vy > -1.0; vy -= vfilldelta) {
|
||||
tweakCount = 0;
|
||||
pt_2d[Y] = vy;
|
||||
|
||||
try_y_tweak:
|
||||
ecount = 0;
|
||||
icount = 0;
|
||||
for (i = 0; i < poly_2d.p_num_contours; ++i) {
|
||||
for (begin = 0; begin < poly_2d.p_contour[i].pc_num_points; ++begin) {
|
||||
vect2d_t distvec;
|
||||
vect2d_t pdir;
|
||||
int ret;
|
||||
|
||||
/* wrap around */
|
||||
if (begin == poly_2d.p_contour[i].pc_num_points-1)
|
||||
end = 0;
|
||||
else
|
||||
end = begin + 1;
|
||||
|
||||
V2SUB2(pdir, poly_2d.p_contour[i].pc_point[end], poly_2d.p_contour[i].pc_point[begin]);
|
||||
|
||||
if ((ret = bn_isect_line2_lseg2(distvec,
|
||||
pt_2d, vfilldir,
|
||||
poly_2d.p_contour[i].pc_point[begin], pdir,
|
||||
&gedp->ged_wdbp->wdb_tol)) >= 0) {
|
||||
/* We have an intersection */
|
||||
V2JOIN1(pt, poly_2d.p_contour[i].pc_point[begin], distvec[1], pdir);
|
||||
|
||||
if (ret == 1 || ret == 2) {
|
||||
++ecount;
|
||||
|
||||
if (ecount > 1 && tweakCount < maxTweaks) {
|
||||
++tweakCount;
|
||||
pt_2d[Y] = pt_2d[Y] - vfilldelta*0.01;
|
||||
goto try_y_tweak;
|
||||
}
|
||||
}
|
||||
|
||||
if (icount >= isectSize) {
|
||||
isectSize *= 2;
|
||||
isect2 = (point2d_t *)bu_realloc((void *)isect2, isectSize*sizeof(point2d_t), "isect2");
|
||||
final_isect2 = (point2d_t *)bu_realloc((void *)final_isect2, isectSize*sizeof(point2d_t), "final_isect2");
|
||||
}
|
||||
|
||||
V2MOVE(isect2[icount], pt);
|
||||
++icount;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (icount) {
|
||||
final_icount = icount;
|
||||
|
||||
bu_sort(isect2, icount, sizeof(point2d_t), sort_by_X, NULL);
|
||||
V2MOVE(final_isect2[0], isect2[0]);
|
||||
|
||||
/* remove duplicates */
|
||||
j = 1;
|
||||
for (i = 1; i < icount; ++i) {
|
||||
if (V2NEAR_EQUAL(final_isect2[j-1], isect2[i], SMALL_FASTF)) {
|
||||
--final_icount;
|
||||
continue;
|
||||
}
|
||||
|
||||
V2MOVE(final_isect2[j], isect2[i]);
|
||||
++j;
|
||||
}
|
||||
|
||||
if (!(final_icount%2)) {
|
||||
for (i = 0; i < final_icount; ++i) {
|
||||
V2MOVE(pt, final_isect2[i]);
|
||||
pt[Z] = vZ;
|
||||
MAT4X3PNT(hit_pt, gedp->ged_gvp->gv_view2model, pt);
|
||||
bu_vls_printf(&result_vls, "{%lf %lf %lf} ", V3ARGS(hit_pt));
|
||||
}
|
||||
} else if (tweakCount < maxTweaks) {
|
||||
++tweakCount;
|
||||
pt_2d[Y] = pt_2d[Y] - vfilldelta*0.01;
|
||||
goto try_y_tweak;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (vfilldir[X]*vfilldir[Y] < 0)
|
||||
pt_2d[Y] = 1.0;
|
||||
else
|
||||
pt_2d[Y] = -1.0;
|
||||
|
||||
for (vx = -1.0; vx < 1.0; vx += vfilldelta) {
|
||||
tweakCount = 0;
|
||||
pt_2d[X] = vx;
|
||||
|
||||
try_x_tweak:
|
||||
ecount = 0;
|
||||
icount = 0;
|
||||
for (i = 0; i < poly_2d.p_num_contours; ++i) {
|
||||
for (begin = 0; begin < poly_2d.p_contour[i].pc_num_points; ++begin) {
|
||||
vect2d_t distvec;
|
||||
vect2d_t pdir;
|
||||
int ret;
|
||||
|
||||
/* wrap around */
|
||||
if (begin == poly_2d.p_contour[i].pc_num_points-1)
|
||||
end = 0;
|
||||
else
|
||||
end = begin + 1;
|
||||
|
||||
|
||||
V2SUB2(pdir, poly_2d.p_contour[i].pc_point[end], poly_2d.p_contour[i].pc_point[begin]);
|
||||
|
||||
if ((ret = bn_isect_line2_lseg2(distvec,
|
||||
pt_2d, vfilldir,
|
||||
poly_2d.p_contour[i].pc_point[begin], pdir,
|
||||
&gedp->ged_wdbp->wdb_tol)) >= 0) {
|
||||
/* We have an intersection */
|
||||
V2JOIN1(pt, poly_2d.p_contour[i].pc_point[begin], distvec[1], pdir);
|
||||
|
||||
if (ret == 1 || ret == 2) {
|
||||
++ecount;
|
||||
|
||||
if (ecount > 1 && tweakCount < maxTweaks) {
|
||||
++tweakCount;
|
||||
pt_2d[X] = pt_2d[X] + vfilldelta*0.01;
|
||||
goto try_x_tweak;
|
||||
}
|
||||
}
|
||||
|
||||
if (icount >= isectSize) {
|
||||
isectSize *= 2;
|
||||
isect2 = (point2d_t *)bu_realloc((void *)isect2, isectSize*sizeof(point2d_t), "isect2");
|
||||
final_isect2 = (point2d_t *)bu_realloc((void *)final_isect2, isectSize*sizeof(point2d_t), "final_isect2");
|
||||
}
|
||||
|
||||
V2MOVE(isect2[icount], pt);
|
||||
++icount;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (icount) {
|
||||
final_icount = icount;
|
||||
|
||||
bu_sort(isect2, icount, sizeof(point2d_t), sort_by_X, NULL);
|
||||
V2MOVE(final_isect2[0], isect2[0]);
|
||||
|
||||
/* remove duplicates */
|
||||
j = 1;
|
||||
for (i = 1; i < icount; ++i) {
|
||||
if (V2NEAR_EQUAL(final_isect2[j-1], isect2[i], SMALL_FASTF)) {
|
||||
--final_icount;
|
||||
continue;
|
||||
}
|
||||
|
||||
V2MOVE(final_isect2[j], isect2[i]);
|
||||
++j;
|
||||
}
|
||||
|
||||
if (!(final_icount%2)) {
|
||||
for (i = 0; i < final_icount; ++i) {
|
||||
V2MOVE(pt, final_isect2[i]);
|
||||
pt[Z] = vZ;
|
||||
MAT4X3PNT(hit_pt, gedp->ged_gvp->gv_view2model, pt);
|
||||
bu_vls_printf(&result_vls, "{%lf %lf %lf} ", V3ARGS(hit_pt));
|
||||
}
|
||||
} else if (tweakCount < maxTweaks) {
|
||||
++tweakCount;
|
||||
pt_2d[X] = pt_2d[X] + vfilldelta*0.01;
|
||||
goto try_x_tweak;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bu_vls_printf(gedp->ged_result_str, "%s", bu_vls_addr(&result_vls));
|
||||
bu_free((void *)isect2, "isect2");
|
||||
bu_free((void *)final_isect2, "final_isect2");
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Local Variables:
|
||||
* tab-width: 8
|
||||
|
||||
+9
-8
@@ -36,6 +36,7 @@
|
||||
|
||||
#include "bu/cmd.h"
|
||||
#include "bu/getopt.h"
|
||||
#include "bu/path.h"
|
||||
|
||||
#include "./ged_private.h"
|
||||
|
||||
@@ -60,7 +61,7 @@ _path_scrub(struct bu_vls *path)
|
||||
if (bu_vls_addr(path)[0] == '/')
|
||||
islocal = 0;
|
||||
|
||||
normalized = db_normalize(bu_vls_addr(path));
|
||||
normalized = bu_normalize(bu_vls_addr(path));
|
||||
|
||||
if (normalized && !BU_STR_EQUAL(normalized, "/")) {
|
||||
char *tbasename = (char *)bu_calloc(strlen(normalized), sizeof(char), "_path_scrub tbasename");
|
||||
@@ -231,6 +232,7 @@ ged_search(struct ged *gedp, int argc, const char *argv_orig[])
|
||||
* any further than the max possible option count */
|
||||
bu_optind = 1;
|
||||
while ((bu_optind < (optcnt + 1)) && ((c = bu_getopt(argc, (char * const *)argv_orig, "?aQhv")) != -1)) {
|
||||
if (bu_optopt == '?') c='h';
|
||||
switch (c) {
|
||||
case 'a':
|
||||
aflag = 1;
|
||||
@@ -246,7 +248,6 @@ ged_search(struct ged *gedp, int argc, const char *argv_orig[])
|
||||
flags |= DB_SEARCH_QUIET;
|
||||
break;
|
||||
case 'h':
|
||||
case '?':
|
||||
want_help = 1;
|
||||
break;
|
||||
default:
|
||||
@@ -309,10 +310,10 @@ ged_search(struct ged *gedp, int argc, const char *argv_orig[])
|
||||
return (wflag) ? GED_OK : GED_ERROR;
|
||||
}
|
||||
if (!is_specific) {
|
||||
if (!is_flat && !aflag && !flat_only) new_search->path_cnt = db_ls(gedp->ged_wdbp->dbip, DB_LS_TOPS, &(new_search->paths));
|
||||
if (!is_flat && aflag && !flat_only) new_search->path_cnt = db_ls(gedp->ged_wdbp->dbip, DB_LS_TOPS | DB_LS_HIDDEN, &(new_search->paths));
|
||||
if (is_flat && !aflag && !flat_only) new_search->path_cnt = db_ls(gedp->ged_wdbp->dbip, 0, &(new_search->paths));
|
||||
if (is_flat && aflag && !flat_only) new_search->path_cnt = db_ls(gedp->ged_wdbp->dbip, DB_LS_HIDDEN, &(new_search->paths));
|
||||
if (!is_flat && !aflag && !flat_only) new_search->path_cnt = db_ls(gedp->ged_wdbp->dbip, DB_LS_TOPS, NULL, &(new_search->paths));
|
||||
if (!is_flat && aflag && !flat_only) new_search->path_cnt = db_ls(gedp->ged_wdbp->dbip, DB_LS_TOPS | DB_LS_HIDDEN, NULL, &(new_search->paths));
|
||||
if (is_flat && !aflag && !flat_only) new_search->path_cnt = db_ls(gedp->ged_wdbp->dbip, 0, NULL, &(new_search->paths));
|
||||
if (is_flat && aflag && !flat_only) new_search->path_cnt = db_ls(gedp->ged_wdbp->dbip, DB_LS_HIDDEN, NULL, &(new_search->paths));
|
||||
} else {
|
||||
/* _ged_search_characterize_path verified that the db_lookup will succeed */
|
||||
struct directory *local_dp = db_lookup(gedp->ged_wdbp->dbip, bu_vls_addr(&argvls), LOOKUP_QUIET);
|
||||
@@ -335,8 +336,8 @@ ged_search(struct ged *gedp, int argc, const char *argv_orig[])
|
||||
/* We have a plan but not path - in that case, do a non-full-path tops search */
|
||||
struct ged_search *new_search;
|
||||
BU_ALLOC(new_search, struct ged_search);
|
||||
if (!aflag) new_search->path_cnt = db_ls(gedp->ged_wdbp->dbip, DB_LS_TOPS, &(new_search->paths));
|
||||
if (aflag) new_search->path_cnt = db_ls(gedp->ged_wdbp->dbip, DB_LS_TOPS | DB_LS_HIDDEN, &(new_search->paths));
|
||||
if (!aflag) new_search->path_cnt = db_ls(gedp->ged_wdbp->dbip, DB_LS_TOPS, NULL, &(new_search->paths));
|
||||
if (aflag) new_search->path_cnt = db_ls(gedp->ged_wdbp->dbip, DB_LS_TOPS | DB_LS_HIDDEN, NULL, &(new_search->paths));
|
||||
new_search->search_type = 1;
|
||||
bu_ptbl_ins(search_set, (long *)new_search);
|
||||
}
|
||||
|
||||
+9
-10
@@ -260,18 +260,17 @@ ged_rselect(struct ged *gedp, int argc, const char *argv[])
|
||||
return ret;
|
||||
} else {
|
||||
if (pflag)
|
||||
|
||||
return dl_select_partial(gedp->ged_gdp->gd_headDisplay, gedp->ged_gvp->gv_model2view, gedp->ged_result_str, gedp->ged_gvp->gv_rect.x,
|
||||
gedp->ged_gvp->gv_rect.y,
|
||||
gedp->ged_gvp->gv_rect.width,
|
||||
gedp->ged_gvp->gv_rect.height,
|
||||
0);
|
||||
gedp->ged_gvp->gv_rect.y,
|
||||
gedp->ged_gvp->gv_rect.width,
|
||||
gedp->ged_gvp->gv_rect.height,
|
||||
0);
|
||||
else
|
||||
return dl_select_partial(gedp->ged_gdp->gd_headDisplay, gedp->ged_gvp->gv_model2view, gedp->ged_result_str, gedp->ged_gvp->gv_rect.x,
|
||||
gedp->ged_gvp->gv_rect.y,
|
||||
gedp->ged_gvp->gv_rect.width,
|
||||
gedp->ged_gvp->gv_rect.height,
|
||||
0);
|
||||
return dl_select(gedp->ged_gdp->gd_headDisplay, gedp->ged_gvp->gv_model2view, gedp->ged_result_str, gedp->ged_gvp->gv_rect.x,
|
||||
gedp->ged_gvp->gv_rect.y,
|
||||
gedp->ged_gvp->gv_rect.width,
|
||||
gedp->ged_gvp->gv_rect.height,
|
||||
0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+13
-12
@@ -28,8 +28,9 @@
|
||||
#include <string.h>
|
||||
#include "bio.h"
|
||||
|
||||
#include "bu/path.h"
|
||||
#include "vmath.h"
|
||||
#include "db.h"
|
||||
#include "rt/db4.h"
|
||||
#include "raytrace.h"
|
||||
|
||||
HIDDEN int
|
||||
@@ -54,11 +55,11 @@ dp_eval_flags(struct directory *dp, int flags)
|
||||
return (flag_eval) ? 0 : 1;
|
||||
}
|
||||
|
||||
int
|
||||
db_ls(const struct db_i *dbip, int flags, struct directory ***dpv)
|
||||
size_t
|
||||
db_ls(const struct db_i *dbip, int flags, const char *pattern, struct directory ***dpv)
|
||||
{
|
||||
int i;
|
||||
int objcount = 0;
|
||||
size_t i;
|
||||
size_t objcount = 0;
|
||||
struct directory *dp;
|
||||
|
||||
RT_CK_DBI(dbip);
|
||||
@@ -74,8 +75,10 @@ db_ls(const struct db_i *dbip, int flags, struct directory ***dpv)
|
||||
for (i = 0; i < RT_DBNHASH; i++) {
|
||||
for (dp = dbip->dbi_Head[i]; dp != RT_DIR_NULL; dp = dp->d_forw) {
|
||||
if (dp_eval_flags(dp,flags)) {
|
||||
(*dpv)[objcount] = dp;
|
||||
objcount++;
|
||||
if (!pattern || !bu_fnmatch(pattern, dp->d_namep, 0)) {
|
||||
(*dpv)[objcount] = dp;
|
||||
objcount++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -122,17 +125,15 @@ db_dpv_to_argv(struct directory **dpv)
|
||||
{
|
||||
char **argv = NULL;
|
||||
int dpv_cnt = 0;
|
||||
struct directory *dp = dpv[dpv_cnt];
|
||||
if (!dpv) return argv;
|
||||
while (dp) {
|
||||
|
||||
while (dpv[dpv_cnt]) {
|
||||
dpv_cnt++;
|
||||
dp = dpv[dpv_cnt];
|
||||
}
|
||||
if (dpv_cnt > 0) {
|
||||
argv = (char **)bu_malloc(sizeof(char *) * (dpv_cnt + 1), "char pointer array");
|
||||
dpv_cnt = 0;
|
||||
dp = dpv[0];
|
||||
while (dpv) {
|
||||
while (dpv[dpv_cnt]) {
|
||||
argv[dpv_cnt] = dpv[dpv_cnt]->d_namep;
|
||||
dpv_cnt++;
|
||||
}
|
||||
|
||||
+15
-16
@@ -86,12 +86,15 @@
|
||||
#include <stdlib.h>
|
||||
#include <ctype.h>
|
||||
#include <time.h>
|
||||
#include <regex.h>
|
||||
#include <limits.h> /* for INT_MAX */
|
||||
|
||||
#include "bu/cmd.h"
|
||||
#define __restrict /* quell gcc 4.1.2 system regex.h -pedantic-errors */
|
||||
#include <regex.h>
|
||||
|
||||
#include "db.h"
|
||||
#include "bu/cmd.h"
|
||||
#include "bu/path.h"
|
||||
|
||||
#include "rt/db4.h"
|
||||
#include "./librt_private.h"
|
||||
#include "./search.h"
|
||||
|
||||
@@ -1005,28 +1008,22 @@ f_type(struct db_plan_t *plan, struct db_node_t *db_node, struct db_i *dbip, str
|
||||
if (dp->d_flags & RT_DIR_COMB) {
|
||||
if (dp->d_flags & RT_DIR_REGION) {
|
||||
if ((!bu_fnmatch(plan->type_data, "r", 0)) || (!bu_fnmatch(plan->type_data, "reg", 0)) || (!bu_fnmatch(plan->type_data, "region", 0))) {
|
||||
return 1;
|
||||
} else {
|
||||
db_node->matched_filters = 0;
|
||||
return 0;
|
||||
type_match = 1;
|
||||
}
|
||||
}
|
||||
if ((!bu_fnmatch(plan->type_data, "c", 0)) || (!bu_fnmatch(plan->type_data, "comb", 0)) || (!bu_fnmatch(plan->type_data, "combination", 0))) {
|
||||
return 1;
|
||||
} else {
|
||||
db_node->matched_filters = 0;
|
||||
return 0;
|
||||
type_match = 1;
|
||||
}
|
||||
goto return_label;
|
||||
} else {
|
||||
if ((!bu_fnmatch(plan->type_data, "r", 0)) || (!bu_fnmatch(plan->type_data, "reg", 0)) || (!bu_fnmatch(plan->type_data, "region", 0)) || (!bu_fnmatch(plan->type_data, "c", 0)) || (!bu_fnmatch(plan->type_data, "comb", 0)) || (!bu_fnmatch(plan->type_data, "combination", 0))) {
|
||||
db_node->matched_filters = 0;
|
||||
return 0;
|
||||
goto return_label;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (rt_db_get_internal(&intern, dp, dbip, (fastf_t *)NULL, &rt_uniresource) < 0) return 0;
|
||||
if (intern.idb_major_type != DB5_MAJORTYPE_BRLCAD || !intern.idb_meth->ft_label) {
|
||||
if (intern.idb_major_type != DB5_MAJORTYPE_BRLCAD) {
|
||||
rt_db_free_internal(&intern);
|
||||
db_node->matched_filters = 0;
|
||||
return 0;
|
||||
@@ -1079,6 +1076,8 @@ f_type(struct db_plan_t *plan, struct db_node_t *db_node, struct db_i *dbip, str
|
||||
|
||||
rt_db_free_internal(&intern);
|
||||
|
||||
return_label:
|
||||
|
||||
if (!type_match) db_node->matched_filters = 0;
|
||||
return type_match;
|
||||
}
|
||||
@@ -2280,9 +2279,9 @@ db_search(struct bu_ptbl *search_results,
|
||||
|
||||
if (!paths) {
|
||||
if (search_flags & DB_SEARCH_HIDDEN) {
|
||||
path_cnt = db_ls(dbip, DB_LS_TOPS | DB_LS_HIDDEN, &top_level_objects);
|
||||
path_cnt = db_ls(dbip, DB_LS_TOPS | DB_LS_HIDDEN, NULL, &top_level_objects);
|
||||
} else {
|
||||
path_cnt = db_ls(dbip, DB_LS_TOPS, &top_level_objects);
|
||||
path_cnt = db_ls(dbip, DB_LS_TOPS, NULL, &top_level_objects);
|
||||
}
|
||||
paths = top_level_objects;
|
||||
}
|
||||
|
||||
+126
-49
@@ -47,10 +47,8 @@
|
||||
#include "bu/cmd.h"
|
||||
#include "bu/units.h"
|
||||
#include "vmath.h"
|
||||
#include "db.h"
|
||||
#include "rtgeom.h"
|
||||
#include "wdb.h"
|
||||
#include "mater.h"
|
||||
#include "raytrace.h"
|
||||
#include "tclcad.h"
|
||||
|
||||
#include "solid.h"
|
||||
@@ -943,6 +941,7 @@ HIDDEN void to_dm_get_display_image(struct ged *gedp, unsigned char **idata);
|
||||
HIDDEN void to_fbs_callback();
|
||||
HIDDEN int to_open_fbs(struct ged_dm_view *gdvp, Tcl_Interp *interp);
|
||||
|
||||
HIDDEN void to_create_vlist_callback_solid(struct solid *gdlp);
|
||||
HIDDEN void to_create_vlist_callback(struct display_list *gdlp);
|
||||
HIDDEN void to_free_vlist_callback(unsigned int dlist, int range);
|
||||
HIDDEN void to_refresh_all_views(struct tclcad_obj *top);
|
||||
@@ -965,6 +964,8 @@ static struct tclcad_obj *current_top = TCLCAD_OBJ_NULL;
|
||||
|
||||
struct path_edit_params {
|
||||
int edit_mode;
|
||||
double dx;
|
||||
double dy;
|
||||
mat_t edit_mat;
|
||||
};
|
||||
|
||||
@@ -1131,6 +1132,7 @@ static struct to_cmdtab to_cmds[] = {
|
||||
{"killrefs", (char *)0, TO_UNLIMITED, to_pass_through_and_refresh_func, ged_killrefs},
|
||||
{"killtree", (char *)0, TO_UNLIMITED, to_pass_through_and_refresh_func, ged_killtree},
|
||||
{"l", (char *)0, TO_UNLIMITED, to_pass_through_func, ged_list},
|
||||
{"lc", "[-d|-s|-r] [-z] [-0|-1|-2|-3|-4|-5] [-f {FileName}] {GroupName}", TO_UNLIMITED, to_pass_through_func, ged_lc},
|
||||
{"light", "[0|1]", TO_UNLIMITED, to_light, GED_FUNC_PTR_NULL},
|
||||
{"list_views", (char *)0, TO_UNLIMITED, to_list_views, GED_FUNC_PTR_NULL},
|
||||
{"listen", "[port]", TO_UNLIMITED, to_listen, GED_FUNC_PTR_NULL},
|
||||
@@ -1298,7 +1300,7 @@ static struct to_cmdtab to_cmds[] = {
|
||||
{"rtweight", "[args]", TO_UNLIMITED, to_view_func, ged_rt},
|
||||
{"rtwizard", "[args]", TO_UNLIMITED, to_view_func, ged_rtwizard},
|
||||
{"savekey", "filename", 3, to_view_func, ged_savekey},
|
||||
{"saveview", "filename", 3, to_view_func, ged_saveview},
|
||||
{"saveview", (char *)0, TO_UNLIMITED, to_view_func, ged_saveview},
|
||||
{"sca", "sf", 3, to_view_func_plus, ged_scale},
|
||||
{"scale_mode", "x y", TO_UNLIMITED, to_scale_mode, GED_FUNC_PTR_NULL},
|
||||
{"screen2model", "x y", TO_UNLIMITED, to_screen2model, GED_FUNC_PTR_NULL},
|
||||
@@ -1681,6 +1683,7 @@ Usage: go_open\n\
|
||||
|
||||
top->to_gop->go_gedp->ged_output_handler = to_output_handler;
|
||||
top->to_gop->go_gedp->ged_refresh_handler = to_refresh_handler;
|
||||
top->to_gop->go_gedp->ged_create_vlist_solid_callback = to_create_vlist_callback_solid;
|
||||
top->to_gop->go_gedp->ged_create_vlist_callback = to_create_vlist_callback;
|
||||
top->to_gop->go_gedp->ged_free_vlist_callback = to_free_vlist_callback;
|
||||
|
||||
@@ -3764,6 +3767,30 @@ to_data_polygons(struct ged *gedp,
|
||||
goto bad;
|
||||
}
|
||||
|
||||
if (BU_STR_EQUAL(argv[2], "moveall")) {
|
||||
if (argc == 3) {
|
||||
bu_vls_printf(gedp->ged_result_str, "%d", gdpsp->gdps_moveAll);
|
||||
return GED_OK;
|
||||
}
|
||||
|
||||
if (argc == 4) {
|
||||
int i;
|
||||
|
||||
if (bu_sscanf(argv[3], "%d", &i) != 1)
|
||||
goto bad;
|
||||
|
||||
if (i)
|
||||
gdpsp->gdps_moveAll = 1;
|
||||
else
|
||||
gdpsp->gdps_moveAll = 0;
|
||||
|
||||
to_refresh_view(gdvp);
|
||||
return GED_OK;
|
||||
}
|
||||
|
||||
goto bad;
|
||||
}
|
||||
|
||||
/* Usage: poly_color i [r g b]
|
||||
*
|
||||
* Set/get the color of polygon i.
|
||||
@@ -4175,6 +4202,33 @@ to_data_polygons(struct ged *gedp,
|
||||
return GED_OK;
|
||||
}
|
||||
|
||||
if (BU_STR_EQUAL(argv[2], "fill")) {
|
||||
size_t i;
|
||||
vect2d_t vdir;
|
||||
fastf_t vdelta;
|
||||
|
||||
if (argc != 6)
|
||||
goto bad;
|
||||
|
||||
if (bu_sscanf(argv[3], "%zu", &i) != 1 ||
|
||||
i >= gdpsp->gdps_polygons.gp_num_polygons)
|
||||
goto bad;
|
||||
|
||||
if (bu_sscanf(argv[4], "%lf %lf", &vdir[X], &vdir[Y]) != 2) {
|
||||
bu_vls_printf(gedp->ged_result_str, "%s: bad dir", argv[0], argv[4]);
|
||||
goto bad;
|
||||
}
|
||||
|
||||
if (bu_sscanf(argv[5], "%lf", &vdelta) != 1) {
|
||||
bu_vls_printf(gedp->ged_result_str, "%s: bad delta", argv[0], argv[5]);
|
||||
goto bad;
|
||||
}
|
||||
|
||||
ged_polygon_fill_segments(gedp, &gdpsp->gdps_polygons.gp_polygon[i], vdir, vdelta);
|
||||
|
||||
return GED_OK;
|
||||
}
|
||||
|
||||
/* Usage: area i
|
||||
*
|
||||
* Find area of polygon i
|
||||
@@ -4511,7 +4565,7 @@ to_data_move(struct ged *gedp,
|
||||
k >= gdpsp->gdps_polygons.gp_polygon[i].gp_contour[j].gpc_num_points)
|
||||
return GED_OK;
|
||||
|
||||
/* This section is for moving the entire contour */
|
||||
/* This section is for moving more than a single point on a contour */
|
||||
if (gdvp->gdv_view->gv_mode == TCLCAD_DATA_MOVE_OBJECT_MODE) {
|
||||
point_t old_mpoint, new_mpoint;
|
||||
vect_t diff;
|
||||
@@ -4524,13 +4578,28 @@ to_data_move(struct ged *gedp,
|
||||
MAT4X3PNT(new_mpoint, gdvp->gdv_view->gv_view2model, vpoint);
|
||||
VSUB2(diff, new_mpoint, old_mpoint);
|
||||
|
||||
for (k = 0; k < gdpsp->gdps_polygons.gp_polygon[i].gp_contour[j].gpc_num_points; ++k) {
|
||||
VADD2(gdpsp->gdps_polygons.gp_polygon[i].gp_contour[j].gpc_point[k],
|
||||
gdpsp->gdps_polygons.gp_polygon[i].gp_contour[j].gpc_point[k],
|
||||
diff);
|
||||
/* Move all polygons and all their respective contours. */
|
||||
if (gdpsp->gdps_moveAll) {
|
||||
size_t p, c;
|
||||
for (p = 0; p < gdpsp->gdps_polygons.gp_num_polygons; ++p) {
|
||||
for (c = 0; c < gdpsp->gdps_polygons.gp_polygon[p].gp_num_contours; ++c) {
|
||||
for (k = 0; k < gdpsp->gdps_polygons.gp_polygon[p].gp_contour[c].gpc_num_points; ++k) {
|
||||
VADD2(gdpsp->gdps_polygons.gp_polygon[p].gp_contour[c].gpc_point[k],
|
||||
gdpsp->gdps_polygons.gp_polygon[p].gp_contour[c].gpc_point[k],
|
||||
diff);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
/* Move only the contour. */
|
||||
for (k = 0; k < gdpsp->gdps_polygons.gp_polygon[i].gp_contour[j].gpc_num_points; ++k) {
|
||||
VADD2(gdpsp->gdps_polygons.gp_polygon[i].gp_contour[j].gpc_point[k],
|
||||
gdpsp->gdps_polygons.gp_polygon[i].gp_contour[j].gpc_point[k],
|
||||
diff);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
/* This section is for moving a single point in the contour */
|
||||
/* This section is for moving a single point on a contour */
|
||||
MAT4X3PNT(vpoint, gdvp->gdv_view->gv_model2view, gdpsp->gdps_polygons.gp_polygon[i].gp_contour[j].gpc_point[k]);
|
||||
vpoint[X] = vx;
|
||||
vpoint[Y] = vy;
|
||||
@@ -5486,23 +5555,23 @@ to_init_default_bindings(struct ged_dm_view *gdvp)
|
||||
#endif
|
||||
|
||||
/* Idle Mode */
|
||||
bu_vls_printf(&bindings, "bind %s <ButtonRelease> {%s idle_mode %s; break}; ",
|
||||
bu_vls_printf(&bindings, "bind %s <ButtonRelease> {%s idle_mode %s}; ",
|
||||
bu_vls_addr(dm_get_pathname(gdvp->gdv_dmp)),
|
||||
bu_vls_addr(¤t_top->to_gop->go_name),
|
||||
bu_vls_addr(&gdvp->gdv_name));
|
||||
bu_vls_printf(&bindings, "bind %s <KeyRelease-Control_L> {%s idle_mode %s; break}; ",
|
||||
bu_vls_printf(&bindings, "bind %s <KeyRelease-Control_L> {%s idle_mode %s}; ",
|
||||
bu_vls_addr(dm_get_pathname(gdvp->gdv_dmp)),
|
||||
bu_vls_addr(¤t_top->to_gop->go_name),
|
||||
bu_vls_addr(&gdvp->gdv_name));
|
||||
bu_vls_printf(&bindings, "bind %s <KeyRelease-Control_R> {%s idle_mode %s; break}; ",
|
||||
bu_vls_printf(&bindings, "bind %s <KeyRelease-Control_R> {%s idle_mode %s}; ",
|
||||
bu_vls_addr(dm_get_pathname(gdvp->gdv_dmp)),
|
||||
bu_vls_addr(¤t_top->to_gop->go_name),
|
||||
bu_vls_addr(&gdvp->gdv_name));
|
||||
bu_vls_printf(&bindings, "bind %s <KeyRelease-Shift_L> {%s idle_mode %s; break}; ",
|
||||
bu_vls_printf(&bindings, "bind %s <KeyRelease-Shift_L> {%s idle_mode %s}; ",
|
||||
bu_vls_addr(dm_get_pathname(gdvp->gdv_dmp)),
|
||||
bu_vls_addr(¤t_top->to_gop->go_name),
|
||||
bu_vls_addr(&gdvp->gdv_name));
|
||||
bu_vls_printf(&bindings, "bind %s <KeyRelease-Shift_R> {%s idle_mode %s; break}; ",
|
||||
bu_vls_printf(&bindings, "bind %s <KeyRelease-Shift_R> {%s idle_mode %s}; ",
|
||||
bu_vls_addr(dm_get_pathname(gdvp->gdv_dmp)),
|
||||
bu_vls_addr(¤t_top->to_gop->go_name),
|
||||
bu_vls_addr(&gdvp->gdv_name));
|
||||
@@ -5516,61 +5585,61 @@ to_init_default_bindings(struct ged_dm_view *gdvp)
|
||||
bu_vls_addr(&gdvp->gdv_name));
|
||||
|
||||
/* Rotate Mode */
|
||||
bu_vls_printf(&bindings, "bind %s <Control-ButtonRelease-1> {%s idle_mode %s; break}; ",
|
||||
bu_vls_printf(&bindings, "bind %s <Control-ButtonRelease-1> {%s idle_mode %s}; ",
|
||||
bu_vls_addr(dm_get_pathname(gdvp->gdv_dmp)),
|
||||
bu_vls_addr(¤t_top->to_gop->go_name),
|
||||
bu_vls_addr(&gdvp->gdv_name));
|
||||
bu_vls_printf(&bindings, "bind %s <Control-ButtonPress-1> {%s rotate_mode %s %%x %%y; break}; ",
|
||||
bu_vls_printf(&bindings, "bind %s <Control-ButtonPress-1> {%s rotate_mode %s %%x %%y}; ",
|
||||
bu_vls_addr(dm_get_pathname(gdvp->gdv_dmp)),
|
||||
bu_vls_addr(¤t_top->to_gop->go_name),
|
||||
bu_vls_addr(&gdvp->gdv_name));
|
||||
bu_vls_printf(&bindings, "bind %s <Control-ButtonPress-2> {%s rotate_mode %s %%x %%y; break}; ",
|
||||
bu_vls_printf(&bindings, "bind %s <Control-ButtonPress-2> {%s rotate_mode %s %%x %%y}; ",
|
||||
bu_vls_addr(dm_get_pathname(gdvp->gdv_dmp)),
|
||||
bu_vls_addr(¤t_top->to_gop->go_name),
|
||||
bu_vls_addr(&gdvp->gdv_name));
|
||||
bu_vls_printf(&bindings, "bind %s <Control-ButtonPress-3> {%s rotate_mode %s %%x %%y; break}; ",
|
||||
bu_vls_printf(&bindings, "bind %s <Control-ButtonPress-3> {%s rotate_mode %s %%x %%y}; ",
|
||||
bu_vls_addr(dm_get_pathname(gdvp->gdv_dmp)),
|
||||
bu_vls_addr(¤t_top->to_gop->go_name),
|
||||
bu_vls_addr(&gdvp->gdv_name));
|
||||
|
||||
/* Translate Mode */
|
||||
bu_vls_printf(&bindings, "bind %s <Shift-ButtonRelease-1> {%s idle_mode %s; break}; ",
|
||||
bu_vls_printf(&bindings, "bind %s <Shift-ButtonRelease-1> {%s idle_mode %s}; ",
|
||||
bu_vls_addr(dm_get_pathname(gdvp->gdv_dmp)),
|
||||
bu_vls_addr(¤t_top->to_gop->go_name),
|
||||
bu_vls_addr(&gdvp->gdv_name));
|
||||
bu_vls_printf(&bindings, "bind %s <Shift-ButtonPress-1> {%s translate_mode %s %%x %%y; break}; ",
|
||||
bu_vls_printf(&bindings, "bind %s <Shift-ButtonPress-1> {%s translate_mode %s %%x %%y}; ",
|
||||
bu_vls_addr(dm_get_pathname(gdvp->gdv_dmp)),
|
||||
bu_vls_addr(¤t_top->to_gop->go_name),
|
||||
bu_vls_addr(&gdvp->gdv_name));
|
||||
bu_vls_printf(&bindings, "bind %s <Shift-ButtonPress-2> {%s translate_mode %s %%x %%y; break}; ",
|
||||
bu_vls_printf(&bindings, "bind %s <Shift-ButtonPress-2> {%s translate_mode %s %%x %%y}; ",
|
||||
bu_vls_addr(dm_get_pathname(gdvp->gdv_dmp)),
|
||||
bu_vls_addr(¤t_top->to_gop->go_name),
|
||||
bu_vls_addr(&gdvp->gdv_name));
|
||||
bu_vls_printf(&bindings, "bind %s <Shift-ButtonPress-3> {%s translate_mode %s %%x %%y; break}; ",
|
||||
bu_vls_printf(&bindings, "bind %s <Shift-ButtonPress-3> {%s translate_mode %s %%x %%y}; ",
|
||||
bu_vls_addr(dm_get_pathname(gdvp->gdv_dmp)),
|
||||
bu_vls_addr(¤t_top->to_gop->go_name),
|
||||
bu_vls_addr(&gdvp->gdv_name));
|
||||
|
||||
/* Scale Mode */
|
||||
bu_vls_printf(&bindings, "bind %s <Control-Shift-ButtonRelease-1> {%s idle_mode %s; break}; ",
|
||||
bu_vls_printf(&bindings, "bind %s <Control-Shift-ButtonRelease-1> {%s idle_mode %s}; ",
|
||||
bu_vls_addr(dm_get_pathname(gdvp->gdv_dmp)),
|
||||
bu_vls_addr(¤t_top->to_gop->go_name),
|
||||
bu_vls_addr(&gdvp->gdv_name));
|
||||
bu_vls_printf(&bindings, "bind %s <Control-Shift-ButtonPress-1> {%s scale_mode %s %%x %%y; break}; ",
|
||||
bu_vls_printf(&bindings, "bind %s <Control-Shift-ButtonPress-1> {%s scale_mode %s %%x %%y}; ",
|
||||
bu_vls_addr(dm_get_pathname(gdvp->gdv_dmp)),
|
||||
bu_vls_addr(¤t_top->to_gop->go_name),
|
||||
bu_vls_addr(&gdvp->gdv_name));
|
||||
bu_vls_printf(&bindings, "bind %s <Control-Shift-ButtonPress-2> {%s scale_mode %s %%x %%y; break}; ",
|
||||
bu_vls_printf(&bindings, "bind %s <Control-Shift-ButtonPress-2> {%s scale_mode %s %%x %%y}; ",
|
||||
bu_vls_addr(dm_get_pathname(gdvp->gdv_dmp)),
|
||||
bu_vls_addr(¤t_top->to_gop->go_name),
|
||||
bu_vls_addr(&gdvp->gdv_name));
|
||||
bu_vls_printf(&bindings, "bind %s <Control-Shift-ButtonPress-3> {%s scale_mode %s %%x %%y; break}; ",
|
||||
bu_vls_printf(&bindings, "bind %s <Control-Shift-ButtonPress-3> {%s scale_mode %s %%x %%y}; ",
|
||||
bu_vls_addr(dm_get_pathname(gdvp->gdv_dmp)),
|
||||
bu_vls_addr(¤t_top->to_gop->go_name),
|
||||
bu_vls_addr(&gdvp->gdv_name));
|
||||
|
||||
/* Constrained Rotate Mode */
|
||||
bu_vls_printf(&bindings, "bind %s <Control-Lock-ButtonRelease-1> {%s idle_mode %s; break}; ",
|
||||
bu_vls_printf(&bindings, "bind %s <Control-Lock-ButtonRelease-1> {%s idle_mode %s}; ",
|
||||
bu_vls_addr(dm_get_pathname(gdvp->gdv_dmp)),
|
||||
bu_vls_addr(¤t_top->to_gop->go_name),
|
||||
bu_vls_addr(&gdvp->gdv_name));
|
||||
@@ -6244,6 +6313,7 @@ redraw_edited_path(struct bu_hash_entry *entry, void *udata)
|
||||
bu_vls_printf(&tran_x_vls, "%lf", dvec[X]);
|
||||
bu_vls_printf(&tran_y_vls, "%lf", dvec[Y]);
|
||||
bu_vls_printf(&tran_z_vls, "%lf", dvec[Z]);
|
||||
MAT_IDN(params->edit_mat);
|
||||
|
||||
bu_vls_printf(&tcl_cmd, "%s otranslate %s %s %s",
|
||||
bu_vls_addr(&data->gdvp->gdv_edit_motion_delta_callback),
|
||||
@@ -6257,8 +6327,6 @@ redraw_edited_path(struct bu_hash_entry *entry, void *udata)
|
||||
bu_vls_free(&tran_z_vls);
|
||||
}
|
||||
|
||||
Tcl_Eval(current_top->to_interp, "SetWaitCursor $::ArcherCore::application");
|
||||
|
||||
av[0] = "how";
|
||||
av[1] = draw_path;
|
||||
av[2] = NULL;
|
||||
@@ -6283,7 +6351,6 @@ redraw_edited_path(struct bu_hash_entry *entry, void *udata)
|
||||
av[4] = NULL;
|
||||
ged_draw(data->gedp, 4, av);
|
||||
}
|
||||
Tcl_Eval(current_top->to_interp, "SetNormalCursor $::ArcherCore::application");
|
||||
|
||||
*data->need_refresh = 1;
|
||||
|
||||
@@ -6373,6 +6440,7 @@ to_idle_mode(struct ged *gedp,
|
||||
}
|
||||
|
||||
/* redraw any edited paths, then clear them from our table */
|
||||
Tcl_Eval(current_top->to_interp, "SetWaitCursor $::ArcherCore::application");
|
||||
data.gedp = gedp;
|
||||
data.gdvp = gdvp;
|
||||
data.need_refresh = &need_refresh;
|
||||
@@ -6381,6 +6449,7 @@ to_idle_mode(struct ged *gedp,
|
||||
bu_hash_tbl_traverse(current_top->to_gop->go_edited_paths, free_path_edit_params_entry, NULL);
|
||||
bu_hash_tbl_free(current_top->to_gop->go_edited_paths);
|
||||
current_top->to_gop->go_edited_paths = bu_hash_tbl_create(0);
|
||||
Tcl_Eval(current_top->to_interp, "SetNormalCursor $::ArcherCore::application");
|
||||
|
||||
if (need_refresh) {
|
||||
to_refresh_all_views(current_top);
|
||||
@@ -8702,8 +8771,8 @@ to_mouse_otranslate(struct ged *gedp,
|
||||
int width;
|
||||
fastf_t dx, dy;
|
||||
fastf_t inv_width;
|
||||
point_t model;
|
||||
point_t view;
|
||||
point_t model = VINIT_ZERO;
|
||||
point_t view = VINIT_ZERO;
|
||||
mat_t inv_rot;
|
||||
struct bu_vls tran_x_vls = BU_VLS_INIT_ZERO;
|
||||
struct bu_vls tran_y_vls = BU_VLS_INIT_ZERO;
|
||||
@@ -8764,10 +8833,8 @@ to_mouse_otranslate(struct ged *gedp,
|
||||
/* ged_otranslate expects things to be in local units */
|
||||
dx *= inv_width * gdvp->gdv_view->gv_size * gedp->ged_wdbp->dbip->dbi_base2local;
|
||||
dy *= inv_width * gdvp->gdv_view->gv_size * gedp->ged_wdbp->dbip->dbi_base2local;
|
||||
VSET(view, dx, dy, 0.0);
|
||||
bn_mat_inv(inv_rot, gdvp->gdv_view->gv_rotation);
|
||||
MAT4X3PNT(model, inv_rot, view);
|
||||
|
||||
VSET(view, dx, dy, 0.0);
|
||||
bu_vls_printf(&tran_x_vls, "%lf", model[X]);
|
||||
bu_vls_printf(&tran_y_vls, "%lf", model[Y]);
|
||||
bu_vls_printf(&tran_z_vls, "%lf", model[Z]);
|
||||
@@ -8779,7 +8846,6 @@ to_mouse_otranslate(struct ged *gedp,
|
||||
struct path_edit_params *params;
|
||||
int is_entry_new;
|
||||
struct bu_hash_entry *entry;
|
||||
mat_t dmat, prev_mat;
|
||||
vect_t dvec;
|
||||
|
||||
entry = bu_hash_tbl_add(current_top->to_gop->go_edited_paths,
|
||||
@@ -8789,21 +8855,24 @@ to_mouse_otranslate(struct ged *gedp,
|
||||
|
||||
if (is_entry_new) {
|
||||
BU_GET(params, struct path_edit_params);
|
||||
MAT_IDN(params->edit_mat);
|
||||
params->edit_mode = gdvp->gdv_view->gv_mode;
|
||||
params->dx = params->dy = 0.0;
|
||||
|
||||
bu_set_hash_value(entry, (unsigned char *)params);
|
||||
} else {
|
||||
params = (struct path_edit_params *)bu_get_hash_value(entry);
|
||||
}
|
||||
|
||||
MAT_IDN(dmat);
|
||||
params->dx += dx;
|
||||
params->dy += dy;
|
||||
VSET(view, params->dx, params->dy, 0.0);
|
||||
bn_mat_inv(inv_rot, gdvp->gdv_view->gv_rotation);
|
||||
MAT4X3PNT(model, inv_rot, view);
|
||||
|
||||
MAT_IDN(params->edit_mat);
|
||||
MAT4X3PNT(model, inv_rot, view);
|
||||
VSCALE(dvec, model, gedp->ged_wdbp->dbip->dbi_local2base);
|
||||
MAT_DELTAS_VEC(dmat, dvec);
|
||||
|
||||
MAT_COPY(prev_mat, params->edit_mat);
|
||||
bn_mat_mul(params->edit_mat, prev_mat, dmat);
|
||||
|
||||
MAT_DELTAS_VEC(params->edit_mat, dvec);
|
||||
|
||||
to_refresh_view(gdvp);
|
||||
} else {
|
||||
@@ -14226,13 +14295,21 @@ go_dm_draw_lines(dm *dmp, struct bview_data_line_state *gdlsp)
|
||||
(_gdpsp)->gdps_polygons.gp_polygon[_i].gp_color[2], \
|
||||
1, 1.0); \
|
||||
\
|
||||
/* set the linewidth and linestyle for polygon i */ \
|
||||
(void)dm_set_line_attr((_dmp), \
|
||||
(_gdpsp)->gdps_polygons.gp_polygon[_i].gp_line_width, \
|
||||
(_gdpsp)->gdps_polygons.gp_polygon[_i].gp_line_style); \
|
||||
\
|
||||
for (_j = 0; _j < (_gdpsp)->gdps_polygons.gp_polygon[_i].gp_num_contours; ++_j) { \
|
||||
size_t _last = (_gdpsp)->gdps_polygons.gp_polygon[_i].gp_contour[_j].gpc_num_points-1; \
|
||||
int _line_style; \
|
||||
\
|
||||
/* always draw holes using segmented lines */ \
|
||||
if ((_gdpsp)->gdps_polygons.gp_polygon[_i].gp_hole[_j]) { \
|
||||
_line_style = 1; \
|
||||
} else { \
|
||||
_line_style = (_gdpsp)->gdps_polygons.gp_polygon[_i].gp_line_style; \
|
||||
} \
|
||||
\
|
||||
/* set the linewidth and linestyle for polygon i, contour j */ \
|
||||
(void)dm_set_line_attr((_dmp), \
|
||||
(_gdpsp)->gdps_polygons.gp_polygon[_i].gp_line_width, \
|
||||
_line_style); \
|
||||
\
|
||||
(void)dm_draw_lines_3d((_dmp), \
|
||||
(_gdpsp)->gdps_polygons.gp_polygon[_i].gp_contour[_j].gpc_num_points, \
|
||||
|
||||
+100
@@ -993,6 +993,105 @@ backslash_specials(struct bu_vls *dest, struct bu_vls *src)
|
||||
}
|
||||
|
||||
|
||||
#if 1
|
||||
void
|
||||
mged_compat(struct bu_vls *dest, struct bu_vls *src, int use_first)
|
||||
{
|
||||
char *start, *end; /* Start and ends of words */
|
||||
int regexp; /* Set to TRUE when word is a regexp */
|
||||
int backslashed;
|
||||
int firstword;
|
||||
struct bu_vls word = BU_VLS_INIT_ZERO; /* Current word being processed */
|
||||
struct bu_vls temp = BU_VLS_INIT_ZERO;
|
||||
|
||||
if (dbip == DBI_NULL) {
|
||||
bu_vls_vlscat(dest, src);
|
||||
return;
|
||||
}
|
||||
|
||||
start = end = bu_vls_addr(src);
|
||||
firstword = 1;
|
||||
while (*end != '\0') {
|
||||
/* Run through entire string */
|
||||
|
||||
/* First, pass along leading whitespace. */
|
||||
|
||||
start = end; /* Begin where last word ended */
|
||||
while (*start != '\0') {
|
||||
if (*start == ' ' ||
|
||||
*start == '\t' ||
|
||||
*start == '\n')
|
||||
bu_vls_putc(dest, *start++);
|
||||
else
|
||||
break;
|
||||
}
|
||||
if (*start == '\0')
|
||||
break;
|
||||
|
||||
/* Next, advance "end" pointer to the end of the word, while
|
||||
* adding each character to the "word" vls. Also make a note
|
||||
* of any unbackslashed wildcard characters.
|
||||
*/
|
||||
|
||||
end = start;
|
||||
bu_vls_trunc(&word, 0);
|
||||
regexp = 0;
|
||||
backslashed = 0;
|
||||
while (*end != '\0') {
|
||||
if (*end == ' ' ||
|
||||
*end == '\t' ||
|
||||
*end == '\n')
|
||||
break;
|
||||
if ((*end == '*' || *end == '?' || *end == '[') && !backslashed)
|
||||
regexp = 1;
|
||||
if (*end == '\\' && !backslashed)
|
||||
backslashed = 1;
|
||||
else
|
||||
backslashed = 0;
|
||||
bu_vls_putc(&word, *end++);
|
||||
}
|
||||
|
||||
if (firstword && !use_first)
|
||||
regexp = 0;
|
||||
|
||||
/* Now, if the word was suspected of being a wildcard, try to
|
||||
* match it to the database.
|
||||
*/
|
||||
|
||||
if (regexp) {
|
||||
register int i, num;
|
||||
register struct directory *dp;
|
||||
bu_vls_trunc(&temp, 0);
|
||||
for (i = num = 0; i < RT_DBNHASH; i++) {
|
||||
for (dp = dbip->dbi_Head[i]; dp != RT_DIR_NULL; dp = dp->d_forw) {
|
||||
if (bu_fnmatch(bu_vls_addr(&word), dp->d_namep, 0) != 0)
|
||||
continue;
|
||||
if (num == 0)
|
||||
bu_vls_strcat(&temp, dp->d_namep);
|
||||
else {
|
||||
bu_vls_strcat(&temp, " ");
|
||||
bu_vls_strcat(&temp, dp->d_namep);
|
||||
}
|
||||
++num;
|
||||
}
|
||||
}
|
||||
|
||||
if (num == 0) {
|
||||
debackslash(&temp, &word);
|
||||
backslash_specials(dest, &temp);
|
||||
} else
|
||||
bu_vls_vlscat(dest, &temp);
|
||||
} else {
|
||||
debackslash(dest, &word);
|
||||
}
|
||||
|
||||
firstword = 0;
|
||||
}
|
||||
|
||||
bu_vls_free(&temp);
|
||||
bu_vls_free(&word);
|
||||
}
|
||||
#else
|
||||
/**
|
||||
* This routine is called to perform wildcard expansion and character
|
||||
* quoting on the given vls (typically input from the keyboard.)
|
||||
@@ -1079,6 +1178,7 @@ mged_compat(struct bu_vls *dest, struct bu_vls *src, int use_first)
|
||||
bu_vls_free(&temp);
|
||||
bu_vls_free(&word);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef _WIN32
|
||||
|
||||
@@ -2406,6 +2406,50 @@ wdb_reopen_tcl(void *clientData,
|
||||
}
|
||||
|
||||
|
||||
#if 1
|
||||
int
|
||||
wdb_match_cmd(struct rt_wdb *wdbp,
|
||||
int UNUSED(argc),
|
||||
const char *argv[])
|
||||
{
|
||||
struct bu_vls matches;
|
||||
|
||||
RT_CK_WDB(wdbp);
|
||||
|
||||
/* Verify that this wdb supports lookup operations
|
||||
(non-null dbip) */
|
||||
if (wdbp->dbip == 0) {
|
||||
Tcl_AppendResult((Tcl_Interp *)wdbp->wdb_interp, "this database does not support lookup operations");
|
||||
return TCL_ERROR;
|
||||
}
|
||||
|
||||
bu_vls_init(&matches);
|
||||
for (++argv; *argv != NULL; ++argv) {
|
||||
register int i, num;
|
||||
register struct directory *dp;
|
||||
for (i = num = 0; i < RT_DBNHASH; i++) {
|
||||
for (dp = wdbp->dbip->dbi_Head[i]; dp != RT_DIR_NULL; dp = dp->d_forw) {
|
||||
if (bu_fnmatch(*argv, dp->d_namep, 0) != 0)
|
||||
continue;
|
||||
if (num == 0)
|
||||
bu_vls_strcat(&matches, dp->d_namep);
|
||||
else {
|
||||
bu_vls_strcat(&matches, " ");
|
||||
bu_vls_strcat(&matches, dp->d_namep);
|
||||
}
|
||||
++num;
|
||||
}
|
||||
}
|
||||
|
||||
if (num > 0)
|
||||
bu_vls_strcat(&matches, " ");
|
||||
}
|
||||
bu_vls_trimspace(&matches);
|
||||
Tcl_AppendResult((Tcl_Interp *)wdbp->wdb_interp, bu_vls_addr(&matches), (char *)NULL);
|
||||
bu_vls_free(&matches);
|
||||
return TCL_OK;
|
||||
}
|
||||
#else
|
||||
int
|
||||
wdb_match_cmd(struct rt_wdb *wdbp,
|
||||
int UNUSED(argc),
|
||||
@@ -2432,6 +2476,7 @@ wdb_match_cmd(struct rt_wdb *wdbp,
|
||||
bu_vls_free(&matches);
|
||||
return TCL_OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/**
|
||||
|
||||
+237
-453
File diff suppressed because it is too large
Load Diff
@@ -84,6 +84,7 @@ namespace eval ArcherCore {
|
||||
common DISPLAY_MODE_SHADED_ALL 2
|
||||
common DISPLAY_MODE_EVALUATED 3
|
||||
common DISPLAY_MODE_HIDDEN 4
|
||||
common DISPLAY_MODE_SHADED_EVAL 5
|
||||
|
||||
common MATRIX_ABOVE_MODE 0
|
||||
common MATRIX_BELOW_MODE 1
|
||||
@@ -171,6 +172,7 @@ namespace eval ArcherCore {
|
||||
method putString {_str}
|
||||
method rtcntrl {args}
|
||||
method setStatusString {_str}
|
||||
method getSelectedTreePaths {}
|
||||
|
||||
# Commands exposed to the user via the command line.
|
||||
# More to be added later...
|
||||
@@ -248,6 +250,7 @@ namespace eval ArcherCore {
|
||||
method killtree {args}
|
||||
method l {args}
|
||||
method ls {args}
|
||||
method lc {args}
|
||||
method make {args}
|
||||
method make_name {args}
|
||||
method make_pnts {args}
|
||||
@@ -287,6 +290,7 @@ namespace eval ArcherCore {
|
||||
method rmater {args}
|
||||
method rotate {args}
|
||||
method rotate_arb_face {args}
|
||||
method saveview {args}
|
||||
method scale {args}
|
||||
method search {args}
|
||||
method sed {_prim}
|
||||
@@ -367,7 +371,6 @@ namespace eval ArcherCore {
|
||||
variable mSelectedObjType ""
|
||||
variable mMultiPane 0
|
||||
variable mTransparency 0
|
||||
variable mAllowDataClear 1
|
||||
|
||||
variable mHPaneFraction1 80
|
||||
variable mHPaneFraction2 20
|
||||
@@ -430,9 +433,6 @@ namespace eval ArcherCore {
|
||||
variable mSeparateCommandWindowPref ""
|
||||
variable mSepCmdPrefix "sepcmd_"
|
||||
|
||||
variable mRtBotMintie 0
|
||||
variable mRtBotMintiePref ""
|
||||
|
||||
variable mCompPickMode $COMP_PICK_TREE_SELECT_MODE
|
||||
variable mCompSelectMode $COMP_SELECT_LIST_MODE
|
||||
variable mCompSelectModePref ""
|
||||
@@ -526,6 +526,8 @@ namespace eval ArcherCore {
|
||||
variable mGroundPlaneMinorColor Grey
|
||||
variable mGroundPlaneMinorColorPref ""
|
||||
|
||||
variable mViewAxesSizeOffsets
|
||||
variable mViewAxesSizeValues
|
||||
variable mViewAxesSize Small
|
||||
variable mViewAxesSizePref ""
|
||||
variable mViewAxesPosition "Lower Right"
|
||||
@@ -537,6 +539,7 @@ namespace eval ArcherCore {
|
||||
variable mViewAxesLabelColor Yellow
|
||||
variable mViewAxesLabelColorPref ""
|
||||
|
||||
variable mModelAxesSizeValues
|
||||
variable mModelAxesSize "View (1x)"
|
||||
variable mModelAxesSizePref ""
|
||||
variable mModelAxesPosition "0 0 0"
|
||||
@@ -581,12 +584,12 @@ namespace eval ArcherCore {
|
||||
delete draw e E edarb edcodes edcolor edcomb edit edmater d erase ev exists \
|
||||
exit facetize fracture freezeGUI g get graph group hide human i igraph \
|
||||
importFg4Section in inside item kill killall killrefs \
|
||||
killtree l ls make make_name make_pnts man mater mirror move \
|
||||
killtree l lc ls make make_name make_pnts man mater mirror move \
|
||||
move_arb_edge move_arb_face mv mvall nmg_collapse \
|
||||
nmg_simplify ocenter opendb orotate oscale otranslate p q \
|
||||
quit packTree prefix protate pscale ptranslate pull push put \
|
||||
put_comb putmat pwd r rcodes red rfarb rm rmater rotate \
|
||||
rotate_arb_face scale search sed shader shells tire title \
|
||||
rotate_arb_face saveview scale search sed shader shells tire title \
|
||||
track translate unhide units unpackTree vmake wmater xpush \
|
||||
Z zap
|
||||
}
|
||||
@@ -617,6 +620,9 @@ namespace eval ArcherCore {
|
||||
variable mMouseRayCallbacks ""
|
||||
variable mLastTags ""
|
||||
|
||||
variable mStandardViewsMenuCommands
|
||||
|
||||
method OpenTarget {target}
|
||||
method handleMoreArgs {args}
|
||||
|
||||
method checkIfSelectedObjExists {}
|
||||
@@ -630,8 +636,8 @@ namespace eval ArcherCore {
|
||||
|
||||
method colorMenuStatusCB {_w}
|
||||
method menuStatusCB {_w}
|
||||
method menuStatusCB_junk {_w}
|
||||
method transparencyMenuStatusCB {_w}
|
||||
method setViewTypeFromTreeMode {}
|
||||
|
||||
method updateSaveMode {}
|
||||
method createTargetCopy {}
|
||||
@@ -643,6 +649,8 @@ namespace eval ArcherCore {
|
||||
method showPrimitiveLabels {}
|
||||
method showViewParams {}
|
||||
method showScale {}
|
||||
method compareViewAxesSizes {a b}
|
||||
method compareModelAxesSizes {a b}
|
||||
|
||||
method launchNirt {}
|
||||
method launchRtApp {_app _size}
|
||||
@@ -650,12 +658,13 @@ namespace eval ArcherCore {
|
||||
method updateDisplaySettings {}
|
||||
method updateLightingMode {}
|
||||
method updatePerspective {_unused}
|
||||
method updateZClipPlanes {_unused}
|
||||
method updateZClipPlanes {_front _front_max _back _back_max}
|
||||
method updateZClipPlanesFromSettings {}
|
||||
method updateZClipPlanesFromPreferences {{_unused 0.0}}
|
||||
method calculateZClipMax {}
|
||||
method calculateZClipBackMax {}
|
||||
method calculateZClipFrontMax {}
|
||||
method pushPerspectiveSettings {}
|
||||
method pushZClipSettings {}
|
||||
method validateZClipMax {_d}
|
||||
|
||||
method shootRay_doit {_start _op _target _prep _no_bool _onehit _bot_dflag _objects}
|
||||
@@ -690,10 +699,26 @@ namespace eval ArcherCore {
|
||||
variable mImage_arb8Inter ""
|
||||
variable mImage_arb8Sub ""
|
||||
variable mImage_arb8Union ""
|
||||
variable mImage_arb7Labeled ""
|
||||
variable mImage_arb6Labeled ""
|
||||
variable mImage_arb5Labeled ""
|
||||
variable mImage_arb4Labeled ""
|
||||
variable mImage_arb7 ""
|
||||
variable mImage_arb7Labeled ""
|
||||
variable mImage_arb7Inter ""
|
||||
variable mImage_arb7Sub ""
|
||||
variable mImage_arb7Union ""
|
||||
variable mImage_arb6 ""
|
||||
variable mImage_arb6Labeled ""
|
||||
variable mImage_arb6Inter ""
|
||||
variable mImage_arb6Sub ""
|
||||
variable mImage_arb6Union ""
|
||||
variable mImage_arb5 ""
|
||||
variable mImage_arb5Labeled ""
|
||||
variable mImage_arb5Inter ""
|
||||
variable mImage_arb5Sub ""
|
||||
variable mImage_arb5Union ""
|
||||
variable mImage_arb4 ""
|
||||
variable mImage_arb4Labeled ""
|
||||
variable mImage_arb4Inter ""
|
||||
variable mImage_arb4Sub ""
|
||||
variable mImage_arb4Union ""
|
||||
variable mImage_arbn ""
|
||||
variable mImage_arbnLabeled ""
|
||||
variable mImage_arbnInter ""
|
||||
@@ -879,6 +904,7 @@ namespace eval ArcherCore {
|
||||
method treeNodeIsOpen {_node}
|
||||
method purgeNodeData {_node}
|
||||
method updateTreeTopWithName {_name}
|
||||
method handleCmdPopup {_X _Y}
|
||||
|
||||
# db/display commands
|
||||
method getNodeChildren {_node}
|
||||
@@ -995,6 +1021,49 @@ namespace eval ArcherCore {
|
||||
set mDisplayFontSizes {0 5 6 7 8 9 10 12}
|
||||
}
|
||||
|
||||
array set mViewAxesSizeOffsets {
|
||||
"Small" 0.85
|
||||
"Medium" 0.75
|
||||
"Large" 0.55
|
||||
"X-Large" 0.0
|
||||
}
|
||||
array set mViewAxesSizeValues {
|
||||
"Small" 0.2
|
||||
"Medium" 0.4
|
||||
"Large" 0.8
|
||||
"X-Large" 1.6
|
||||
}
|
||||
array set mModelAxesSizeValues {
|
||||
"Small" 0.2
|
||||
"Medium" 0.4
|
||||
"Large" 0.8
|
||||
"X-Large" 1.6
|
||||
"View (1x)" 2.0
|
||||
"View (2x)" 4.0
|
||||
"View (4x)" 8.0
|
||||
"View (8x)" 16.0
|
||||
}
|
||||
|
||||
set mStandardViewsMenuCommands {
|
||||
command front -label "Front" \
|
||||
-helpstr "Set view to front"
|
||||
command rear -label "Rear" \
|
||||
-helpstr "Set view to rear"
|
||||
command port -label "Port" \
|
||||
-helpstr "Set view to port/left"
|
||||
command starboard -label "Starboard" \
|
||||
-helpstr "Set view to starboard/right"
|
||||
command top -label "Top" \
|
||||
-helpstr "Set view to top"
|
||||
command bottom -label "Bottom" \
|
||||
-helpstr "Set view to bottom"
|
||||
separator sep0
|
||||
command 35, 25 -label "35, 25" \
|
||||
-helpstr "Set view to az=35, el=25"
|
||||
command 45, 45 -label "45, 45" \
|
||||
-helpstr "Set view to az=45, el=45"
|
||||
}
|
||||
|
||||
set mLastSelectedDir [pwd]
|
||||
|
||||
set mFontText [list $SystemWindowFont 8]
|
||||
@@ -1240,7 +1309,6 @@ namespace eval ArcherCore {
|
||||
trace add variable [::itcl::scope mRayColorVoid] write watchVar
|
||||
|
||||
trace add variable [::itcl::scope mDisplayFontSize] write watchVar
|
||||
trace add variable [::itcl::scope mRtBotMintie] write watchVar
|
||||
|
||||
eval itk_initialize $args
|
||||
|
||||
@@ -1394,33 +1462,25 @@ namespace eval ArcherCore {
|
||||
|
||||
$itk_component(advancedTabs) add $itk_component(cmd) -text "Command"
|
||||
$itk_component(advancedTabs) add $itk_component(history) -text "History"
|
||||
|
||||
itk_component add cmdpopup {
|
||||
::menu $itk_component(advancedTabs).cmdmenu \
|
||||
-tearoff 0
|
||||
} {}
|
||||
|
||||
$itk_component(cmdpopup) add command \
|
||||
-label "Paste Selected Path" \
|
||||
-command "[$itk_component(cmd) component text] insert insert \
|
||||
\[[::itcl::code $this getSelectedTreePaths]\]"
|
||||
|
||||
bind [$itk_component(cmd) component text] <Button-3> [::itcl::code $this handleCmdPopup %X %Y]
|
||||
}
|
||||
|
||||
::itcl::body ArcherCore::buildCanvasMenubar {} {
|
||||
if {$mViewOnly && !$mNoToolbar} {
|
||||
# View Menu
|
||||
$itk_component(canvas_menu) add menubutton view \
|
||||
-text "View" -menu {
|
||||
options -tearoff 0
|
||||
|
||||
command front -label "Front" \
|
||||
-helpstr "Set view to front"
|
||||
command rear -label "Rear" \
|
||||
-helpstr "Set view to rear"
|
||||
command port -label "Port" \
|
||||
-helpstr "Set view to port/left"
|
||||
command starboard -label "Starboard" \
|
||||
-helpstr "Set view to starboard/right"
|
||||
command top -label "Top" \
|
||||
-helpstr "Set view to top"
|
||||
command bottom -label "Bottom" \
|
||||
-helpstr "Set view to bottom"
|
||||
separator sep0
|
||||
command 35,25 -label "35,25" \
|
||||
-helpstr "Set view to az=35, el=25"
|
||||
command 45,45 -label "45,45" \
|
||||
-helpstr "Set view to az=45, el=45"
|
||||
}
|
||||
-text "View" -menu "options -tearoff 0 $mStandardViewsMenuCommands"
|
||||
|
||||
$itk_component(canvas_menu) menuconfigure .view.front \
|
||||
-command [::itcl::code $this doAe 0 0] \
|
||||
@@ -1778,10 +1838,29 @@ namespace eval ArcherCore {
|
||||
set mImage_arb8Sub [image create photo -file [file join $mImgDir arb8_subtract.png]]
|
||||
set mImage_arb8Union [image create photo -file [file join $mImgDir arb8_union.png]]
|
||||
|
||||
set mImage_arb7 [image create photo -file [file join $mImgDir arb7.png]]
|
||||
set mImage_arb7Labeled [image create photo -file [file join $mImgDir arb7_labeled.png]]
|
||||
set mImage_arb7Inter [image create photo -file [file join $mImgDir arb7_intersect.png]]
|
||||
set mImage_arb7Sub [image create photo -file [file join $mImgDir arb7_subtract.png]]
|
||||
set mImage_arb7Union [image create photo -file [file join $mImgDir arb7_union.png]]
|
||||
|
||||
set mImage_arb6 [image create photo -file [file join $mImgDir arb6.png]]
|
||||
set mImage_arb6Labeled [image create photo -file [file join $mImgDir arb6_labeled.png]]
|
||||
set mImage_arb6Inter [image create photo -file [file join $mImgDir arb6_intersect.png]]
|
||||
set mImage_arb6Sub [image create photo -file [file join $mImgDir arb6_subtract.png]]
|
||||
set mImage_arb6Union [image create photo -file [file join $mImgDir arb6_union.png]]
|
||||
|
||||
set mImage_arb5 [image create photo -file [file join $mImgDir arb5.png]]
|
||||
set mImage_arb5Labeled [image create photo -file [file join $mImgDir arb5_labeled.png]]
|
||||
set mImage_arb5Inter [image create photo -file [file join $mImgDir arb5_intersect.png]]
|
||||
set mImage_arb5Sub [image create photo -file [file join $mImgDir arb5_subtract.png]]
|
||||
set mImage_arb5Union [image create photo -file [file join $mImgDir arb5_union.png]]
|
||||
|
||||
set mImage_arb4 [image create photo -file [file join $mImgDir arb4.png]]
|
||||
set mImage_arb4Labeled [image create photo -file [file join $mImgDir arb4_labeled.png]]
|
||||
set mImage_arb4Inter [image create photo -file [file join $mImgDir arb4_intersect.png]]
|
||||
set mImage_arb4Sub [image create photo -file [file join $mImgDir arb4_subtract.png]]
|
||||
set mImage_arb4Union [image create photo -file [file join $mImgDir arb4_union.png]]
|
||||
|
||||
set mImage_arbn [image create photo -file [file join $mImgDir arbn.png]]
|
||||
set mImage_arbnLabeled [image create photo -file [file join $mImgDir arbn_labeled.png]]
|
||||
@@ -2334,6 +2413,31 @@ namespace eval ArcherCore {
|
||||
# ------------------------------------------------------------
|
||||
# PUBLIC TREE COMMANDS
|
||||
# ------------------------------------------------------------
|
||||
::itcl::body ArcherCore::setViewTypeFromTreeMode {} {
|
||||
switch -- $mTreeMode \
|
||||
$TREE_MODE_TREE - \
|
||||
$TREE_MODE_COLOR_OBJECTS {
|
||||
if {$mEnableColorListView} {
|
||||
set mEnableListView 1
|
||||
} else {
|
||||
set mEnableListView 0
|
||||
}
|
||||
} \
|
||||
$TREE_MODE_GHOST_OBJECTS {
|
||||
if {$mEnableGhostListView} {
|
||||
set mEnableListView 1
|
||||
} else {
|
||||
set mEnableListView 0
|
||||
}
|
||||
} \
|
||||
$TREE_MODE_EDGE_OBJECTS {
|
||||
if {$mEnableEdgeListView} {
|
||||
set mEnableListView 1
|
||||
} else {
|
||||
set mEnableListView 0
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
::itcl::body ArcherCore::rebuildTree {} {
|
||||
if {$mNoTree || $mFreezeGUI} {
|
||||
@@ -2365,29 +2469,7 @@ namespace eval ArcherCore {
|
||||
set mNodeDrawList ""
|
||||
set mAffectedNodeList ""
|
||||
|
||||
switch -- $mTreeMode \
|
||||
$TREE_MODE_TREE - \
|
||||
$TREE_MODE_COLOR_OBJECTS {
|
||||
if {$mEnableColorListView} {
|
||||
set mEnableListView 1
|
||||
} else {
|
||||
set mEnableListView 0
|
||||
}
|
||||
} \
|
||||
$TREE_MODE_GHOST_OBJECTS {
|
||||
if {$mEnableGhostListView} {
|
||||
set mEnableListView 1
|
||||
} else {
|
||||
set mEnableListView 0
|
||||
}
|
||||
} \
|
||||
$TREE_MODE_EDGE_OBJECTS {
|
||||
if {$mEnableEdgeListView} {
|
||||
set mEnableListView 1
|
||||
} else {
|
||||
set mEnableListView 0
|
||||
}
|
||||
}
|
||||
setViewTypeFromTreeMode
|
||||
|
||||
if {$mEnableListView} {
|
||||
set items [lsort -dictionary [$itk_component(ged) ls]]
|
||||
@@ -2510,7 +2592,7 @@ namespace eval ArcherCore {
|
||||
|
||||
set mlist [lreplace $mlist $i $i]
|
||||
|
||||
if {[catch {$itk_component(ged) get $ctext} cgdata]} {
|
||||
if {[catch {$itk_component(ged) get_type $ctext} cgdata]} {
|
||||
# In here, the child node refers to non-existent geometry
|
||||
# so update the image and remove any grandchildren etc.
|
||||
|
||||
@@ -2761,35 +2843,31 @@ namespace eval ArcherCore {
|
||||
::itcl::body ArcherCore::setDefaultBindingMode {_mode} {
|
||||
set mDefaultBindingMode $_mode
|
||||
|
||||
set ret 0
|
||||
set ret 1
|
||||
switch -- $mDefaultBindingMode \
|
||||
$VIEW_ROTATE_MODE { \
|
||||
beginViewRotate \
|
||||
set ret 1
|
||||
$VIEW_ROTATE_MODE {
|
||||
$itk_component(primaryToolbar) component rotate invoke
|
||||
} \
|
||||
$VIEW_TRANSLATE_MODE { \
|
||||
beginViewTranslate \
|
||||
set ret 1
|
||||
$VIEW_TRANSLATE_MODE {
|
||||
$itk_component(primaryToolbar) component translate invoke
|
||||
} \
|
||||
$VIEW_SCALE_MODE { \
|
||||
beginViewScale \
|
||||
set ret 1
|
||||
$VIEW_SCALE_MODE {
|
||||
$itk_component(primaryToolbar) component scale invoke
|
||||
} \
|
||||
$VIEW_CENTER_MODE { \
|
||||
initViewCenterMode \
|
||||
set ret 1
|
||||
$VIEW_CENTER_MODE {
|
||||
$itk_component(primaryToolbar) component center invoke
|
||||
} \
|
||||
$COMP_PICK_MODE { \
|
||||
initCompPick \
|
||||
set ret 1
|
||||
$COMP_PICK_MODE {
|
||||
$itk_component(primaryToolbar) component cpick invoke
|
||||
} \
|
||||
$COMP_SELECT_MODE { \
|
||||
initCompSelect \
|
||||
set ret 1
|
||||
$COMP_SELECT_MODE {
|
||||
$itk_component(primaryToolbar) component cselect invoke
|
||||
} \
|
||||
$MEASURE_MODE { \
|
||||
initViewMeasure \
|
||||
set ret 1
|
||||
$MEASURE_MODE {
|
||||
$itk_component(primaryToolbar) component measure invoke
|
||||
} \
|
||||
default {
|
||||
set ret 0
|
||||
}
|
||||
|
||||
return $ret
|
||||
@@ -3772,6 +3850,9 @@ namespace eval ArcherCore {
|
||||
$DISPLAY_MODE_SHADED_ALL {
|
||||
gedCmd draw -m2 -x$_trans $_node
|
||||
} \
|
||||
$DISPLAY_MODE_SHADED_EVAL {
|
||||
gedCmd draw -m3 -x$_trans $_node
|
||||
} \
|
||||
$DISPLAY_MODE_EVALUATED {
|
||||
gedCmd E $_node
|
||||
} \
|
||||
@@ -3795,6 +3876,10 @@ namespace eval ArcherCore {
|
||||
gedCmd draw -m2 -x$_trans \
|
||||
-C$displayColor $_node
|
||||
} \
|
||||
$DISPLAY_MODE_SHADED_EVAL {
|
||||
gedCmd draw -m3 -x$_trans \
|
||||
-C$displayColor $_node
|
||||
} \
|
||||
$DISPLAY_MODE_EVALUATED {
|
||||
gedCmd E -C$displayColor $_node
|
||||
} \
|
||||
@@ -3813,10 +3898,8 @@ namespace eval ArcherCore {
|
||||
} else {
|
||||
gedCmd configure -primitiveLabels {}
|
||||
|
||||
if {$mAllowDataClear} {
|
||||
gedCmd data_axes points {}
|
||||
gedCmd data_lines points {}
|
||||
}
|
||||
gedCmd data_axes points {}
|
||||
gedCmd data_lines points {}
|
||||
}
|
||||
} else {
|
||||
set soi -1
|
||||
@@ -3829,10 +3912,8 @@ namespace eval ArcherCore {
|
||||
if {$soi != -1} {
|
||||
gedCmd configure -primitiveLabels {}
|
||||
|
||||
if {$mAllowDataClear} {
|
||||
gedCmd data_axes points {}
|
||||
gedCmd data_lines points {}
|
||||
}
|
||||
gedCmd data_axes points {}
|
||||
gedCmd data_lines points {}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4179,12 +4260,18 @@ namespace eval ArcherCore {
|
||||
return
|
||||
}
|
||||
|
||||
if {[catch {$itk_component(ged) get $_ctext} cgdata]} {
|
||||
set ctype invalid
|
||||
set isregion 0
|
||||
} else {
|
||||
set ctype [lindex $cgdata 0]
|
||||
set isregion [isRegion $cgdata]
|
||||
set ctype invalid
|
||||
set isregion 0
|
||||
|
||||
if {![catch {$itk_component(ged) get_type $_ctext} ctype]} {
|
||||
if {![catch {$itk_component(ged) form $ctype} cform]} {
|
||||
if {[lsearch $cform region] > -1} {
|
||||
if {![catch {$itk_component(ged) get $_ctext} cgdata]} {
|
||||
set ctype [lindex $cgdata 0]
|
||||
set isregion [isRegion $cgdata]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
set ptext $mNode2Text($_pnode)
|
||||
@@ -4326,6 +4413,11 @@ namespace eval ArcherCore {
|
||||
$_menu add radiobutton -label "Shaded" \
|
||||
-indicatoron 1 -value 2 -variable [::itcl::scope mRenderMode] \
|
||||
-command [::itcl::code $this render $_node $DISPLAY_MODE_SHADED_ALL 1 1 1 $_node_id]
|
||||
|
||||
$_menu add radiobutton -label "Shaded (Evaluated)" \
|
||||
-indicatoron 1 -value 5 -variable [::itcl::scope mRenderMode] \
|
||||
-command [::itcl::code $this render $_node $DISPLAY_MODE_SHADED_EVAL 1 1 1 $_node_id]
|
||||
|
||||
$_menu add radiobutton -label "Hidden Line" \
|
||||
-indicatoron 1 -value 4 -variable [::itcl::scope mRenderMode] \
|
||||
-command [::itcl::code $this render $_node $DISPLAY_MODE_HIDDEN 1 1 1 $_node_id]
|
||||
@@ -4348,6 +4440,10 @@ namespace eval ArcherCore {
|
||||
|
||||
$_menu add command -label "Shaded" \
|
||||
-command [::itcl::code $this render $_node $DISPLAY_MODE_SHADED_ALL 1 1 1 $_node_id]
|
||||
|
||||
$_menu add command -label "Shaded (Evaluated)" \
|
||||
-command [::itcl::code $this render $_node $DISPLAY_MODE_SHADED_EVAL 1 1 1 $_node_id]
|
||||
|
||||
$_menu add command -label "Hidden Line" \
|
||||
-command [::itcl::code $this render $_node $DISPLAY_MODE_HIDDEN 1 1 1 $_node_id]
|
||||
|
||||
@@ -4564,6 +4660,10 @@ namespace eval ArcherCore {
|
||||
}
|
||||
}
|
||||
}
|
||||
arb4 -
|
||||
arb5 -
|
||||
arb6 -
|
||||
arb7 -
|
||||
arb8 -
|
||||
arbn -
|
||||
ars -
|
||||
@@ -4713,6 +4813,10 @@ namespace eval ArcherCore {
|
||||
return [getTreePath $parent $_path]
|
||||
}
|
||||
|
||||
::itcl::body ArcherCore::getSelectedTreePaths {} {
|
||||
return [getTreePath [$itk_component(newtree) selection]]
|
||||
}
|
||||
|
||||
::itcl::body ArcherCore::handleTreeClose {} {
|
||||
}
|
||||
|
||||
@@ -4725,10 +4829,11 @@ namespace eval ArcherCore {
|
||||
|
||||
set cnode [$itk_component(newtree) focus]
|
||||
set ctext [$itk_component(newtree) item $cnode -text]
|
||||
set cgdata [$itk_component(ged) get $ctext]
|
||||
set cgdata [$itk_component(ged) get_type $ctext]
|
||||
set ctype [lindex $cgdata 0]
|
||||
|
||||
if {($ctype == "comb" ||
|
||||
$ctype == "region" ||
|
||||
$ctype == "dsp" ||
|
||||
$ctype == "ebm" ||
|
||||
$ctype == "extrude" ||
|
||||
@@ -4743,10 +4848,11 @@ namespace eval ArcherCore {
|
||||
unset mPNode2CList($cnode)
|
||||
|
||||
switch -- $ctype {
|
||||
"region" -
|
||||
"comb" {
|
||||
#set tree [getTreeFromGData $cgdata]
|
||||
foreach gctext [getTreeMembers $ctext 1] {
|
||||
if {[catch {$itk_component(ged) get $gctext} gcgdata]} {
|
||||
if {[catch {$itk_component(ged) get_type $gctext} gcgdata]} {
|
||||
set op [getTreeOp $ctext $gctext]
|
||||
set img [getTreeImage $gctext "invalid" $op]
|
||||
|
||||
@@ -4846,6 +4952,10 @@ namespace eval ArcherCore {
|
||||
tk_popup $itk_component(newtreepopup) $_X $_Y
|
||||
}
|
||||
|
||||
::itcl::body ArcherCore::handleCmdPopup {_X _Y} {
|
||||
tk_popup $itk_component(cmdpopup) $_X $_Y
|
||||
}
|
||||
|
||||
::itcl::body ArcherCore::handleTreeSelect {} {
|
||||
if {$mDoubleClickActive} {
|
||||
set mDoubleClickActive 0
|
||||
@@ -5069,29 +5179,7 @@ namespace eval ArcherCore {
|
||||
}
|
||||
}
|
||||
|
||||
switch -- $mTreeMode \
|
||||
$TREE_MODE_TREE - \
|
||||
$TREE_MODE_COLOR_OBJECTS {
|
||||
if {$mEnableColorListView} {
|
||||
set mEnableListView 1
|
||||
} else {
|
||||
set mEnableListView 0
|
||||
}
|
||||
} \
|
||||
$TREE_MODE_GHOST_OBJECTS {
|
||||
if {$mEnableGhostListView} {
|
||||
set mEnableListView 1
|
||||
} else {
|
||||
set mEnableListView 0
|
||||
}
|
||||
} \
|
||||
$TREE_MODE_EDGE_OBJECTS {
|
||||
if {$mEnableEdgeListView} {
|
||||
set mEnableListView 1
|
||||
} else {
|
||||
set mEnableListView 0
|
||||
}
|
||||
}
|
||||
setViewTypeFromTreeMode
|
||||
|
||||
if {$mTreeMode < $TREE_MODE_COLOR_OBJECTS} {
|
||||
if {$mEnableListView} {
|
||||
@@ -5191,7 +5279,7 @@ namespace eval ArcherCore {
|
||||
# Note -_name is expected to exist in the database.
|
||||
#
|
||||
::itcl::body ArcherCore::updateTreeTopWithName {_name} {
|
||||
# Check to see if its okay to add a toplevel node
|
||||
# Check to see if it's okay to add a toplevel node
|
||||
set toplist {}
|
||||
foreach item [$itk_component(ged) tops] {
|
||||
lappend toplist [regsub {/.*} $item {}]
|
||||
@@ -5253,17 +5341,7 @@ namespace eval ArcherCore {
|
||||
# ------------------------------------------------------------
|
||||
# GENERAL
|
||||
# ------------------------------------------------------------
|
||||
::itcl::body ArcherCore::Load {target} {
|
||||
global tcl_platform
|
||||
|
||||
SetWaitCursor $this
|
||||
if {$mNeedSave} {
|
||||
askToSave
|
||||
}
|
||||
|
||||
set mNeedSave 0
|
||||
updateSaveMode
|
||||
|
||||
::itcl::body ArcherCore::OpenTarget {target} {
|
||||
set mTarget $target
|
||||
set mDbType "BRL-CAD"
|
||||
set mCopyObj ""
|
||||
@@ -5291,22 +5369,36 @@ namespace eval ArcherCore {
|
||||
}
|
||||
|
||||
# Load MGED database
|
||||
if {[info exists itk_component(ged)]} {
|
||||
if {$mDbShared} {
|
||||
$itk_component(ged) sharedGed $mTarget
|
||||
} elseif {$mDbNoCopy || $mDbReadOnly} {
|
||||
$itk_component(ged) open $mTarget
|
||||
} else {
|
||||
$itk_component(ged) open $mTargetCopy
|
||||
}
|
||||
if {![info exists itk_component(ged)]} {
|
||||
return false
|
||||
}
|
||||
|
||||
if {$mAllowDataClear} {
|
||||
gedCmd data_axes points {}
|
||||
gedCmd data_lines points {}
|
||||
}
|
||||
|
||||
gedCmd configure -primitiveLabels {}
|
||||
if {$mDbShared} {
|
||||
$itk_component(ged) sharedGed $mTarget
|
||||
} elseif {$mDbNoCopy || $mDbReadOnly} {
|
||||
$itk_component(ged) open $mTarget
|
||||
} else {
|
||||
$itk_component(ged) open $mTargetCopy
|
||||
}
|
||||
gedCmd data_axes points {}
|
||||
gedCmd data_lines points {}
|
||||
gedCmd configure -primitiveLabels {}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
::itcl::body ArcherCore::Load {target} {
|
||||
global tcl_platform
|
||||
|
||||
SetWaitCursor $this
|
||||
if {$mNeedSave} {
|
||||
askToSave
|
||||
}
|
||||
|
||||
set mNeedSave 0
|
||||
updateSaveMode
|
||||
|
||||
if {![OpenTarget $target]} {
|
||||
initGed
|
||||
|
||||
grid forget $itk_component(canvas)
|
||||
@@ -5565,120 +5657,6 @@ namespace eval ArcherCore {
|
||||
}
|
||||
}
|
||||
|
||||
::itcl::body ArcherCore::menuStatusCB_junk {_w} {
|
||||
if {$mDoStatus} {
|
||||
# entry might not support -label (i.e. tearoffs)
|
||||
if {[catch {$_w entrycget active -label} op]} {
|
||||
set op ""
|
||||
}
|
||||
|
||||
switch -- $op {
|
||||
"Open..." {
|
||||
set mStatusStr "Open a target description"
|
||||
}
|
||||
"Save" {
|
||||
set mStatusStr "Save the current target description"
|
||||
}
|
||||
"Quit" {
|
||||
set mStatusStr "Exit ArcherCore"
|
||||
}
|
||||
"Reset" {
|
||||
set mStatusStr "Set view to default"
|
||||
}
|
||||
"Autoview" {
|
||||
set mStatusStr "Set view size and center according to what's being displayed"
|
||||
}
|
||||
"Center..." {
|
||||
set mStatusStr "Set the view center"
|
||||
}
|
||||
"Front" {
|
||||
set mStatusStr "Set view to front"
|
||||
}
|
||||
"Rear" {
|
||||
set mStatusStr "Set view to rear"
|
||||
}
|
||||
"Port" {
|
||||
set mStatusStr "Set view to port/left"
|
||||
}
|
||||
"Starboard" {
|
||||
set mStatusStr "Set view to starboard/right"
|
||||
}
|
||||
"Top" {
|
||||
set mStatusStr "Set view to top"
|
||||
}
|
||||
"Bottom" {
|
||||
set mStatusStr "Set view to bottom"
|
||||
}
|
||||
"35,25" {
|
||||
set mStatusStr "Set view to az=35, el=25"
|
||||
}
|
||||
"45,45" {
|
||||
set mStatusStr "Set view to az=45, el=45"
|
||||
}
|
||||
"Primary" {
|
||||
set mStatusStr "Toggle on/off primary toolbar"
|
||||
}
|
||||
"View Controls" {
|
||||
set mStatusStr "Toggle on/off view toolbar"
|
||||
}
|
||||
"Status Bar" {
|
||||
set mStatusStr "Toggle on/off status bar"
|
||||
}
|
||||
"Command Window" {
|
||||
set mStatusStr "Toggle on/off command window"
|
||||
}
|
||||
"Upper Left" {
|
||||
set mStatusStr "Set the active pane to the upper left pane"
|
||||
}
|
||||
"Upper Right" {
|
||||
set mStatusStr "Set the active pane to the upper right pane"
|
||||
}
|
||||
"Lower Left" {
|
||||
set mStatusStr "Set the active pane to the lower left pane"
|
||||
}
|
||||
"Lower Right" {
|
||||
set mStatusStr "Set the active pane to the lower right pane"
|
||||
}
|
||||
"Quad View" {
|
||||
set mStatusStr "Toggle between single and multiple geometry pane mode"
|
||||
}
|
||||
"View Axes" {
|
||||
set mStatusStr "Hide/Show view axes"
|
||||
}
|
||||
"Model Axes" {
|
||||
set mStatusStr "Hide/Show model axes"
|
||||
}
|
||||
"File" {
|
||||
set mStatusStr ""
|
||||
}
|
||||
"View" {
|
||||
set mStatusStr ""
|
||||
}
|
||||
"Modes" {
|
||||
set mStatusStr ""
|
||||
}
|
||||
"Help" {
|
||||
set mStatusStr ""
|
||||
}
|
||||
"Wireframe" {
|
||||
set mStatusStr "Draw object as wireframe"
|
||||
}
|
||||
"Shaded" {
|
||||
set mStatusStr "Draw object as shaded if a bot or polysolid (unevaluated)"
|
||||
}
|
||||
"Hidden Line" {
|
||||
set mStatusStr "Draw object as hidden line"
|
||||
}
|
||||
"Off" {
|
||||
set mStatusStr "Erase object"
|
||||
}
|
||||
default {
|
||||
set mStatusStr ""
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
::itcl::body ArcherCore::transparencyMenuStatusCB {_w} {
|
||||
if {$mDoStatus} {
|
||||
# entry might not support -label (i.e. tearoffs)
|
||||
@@ -5888,6 +5866,26 @@ namespace eval ArcherCore {
|
||||
refreshDisplay
|
||||
}
|
||||
|
||||
::itcl::body ArcherCore::compareViewAxesSizes {a b} {
|
||||
if {$mViewAxesSizeValues($a) < $mViewAxesSizeValues($b)} {
|
||||
return -1
|
||||
}
|
||||
if {$mViewAxesSizeValues($a) > $mViewAxesSizeValues($b)} {
|
||||
return 1
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
::itcl::body ArcherCore::compareModelAxesSizes {a b} {
|
||||
if {$mModelAxesSizeValues($a) < $mModelAxesSizeValues($b)} {
|
||||
return -1
|
||||
}
|
||||
if {$mModelAxesSizeValues($a) > $mModelAxesSizeValues($b)} {
|
||||
return 1
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
::itcl::body ArcherCore::launchNirt {} {
|
||||
putString "nirt -b"
|
||||
putString [$itk_component(ged) nirt -b]
|
||||
@@ -5909,7 +5907,7 @@ namespace eval ArcherCore {
|
||||
::itcl::body ArcherCore::updateDisplaySettings {} {
|
||||
$itk_component(ged) refresh_off
|
||||
|
||||
updateZClipPlanes 0
|
||||
updateZClipPlanesFromSettings
|
||||
updatePerspective 0
|
||||
doLighting
|
||||
gedCmd dlist_on $mDisplayListMode
|
||||
@@ -5936,13 +5934,24 @@ namespace eval ArcherCore {
|
||||
$itk_component(ged) perspective_all $mPerspectivePref
|
||||
}
|
||||
|
||||
::itcl::body ArcherCore::updateZClipPlanes {_unused} {
|
||||
set near [expr {0.01 * $mZClipFrontPref * $mZClipFrontMaxPref}]
|
||||
set far [expr {0.01 * $mZClipBackPref * $mZClipBackMaxPref}]
|
||||
::itcl::body ArcherCore::updateZClipPlanes {_front _front_max _back _back_max} {
|
||||
set near [expr {0.01 * $_front * $_front_max}]
|
||||
set far [expr {0.01 * $_back * $_back_max}]
|
||||
$itk_component(ged) bounds_all "-1.0 1.0 -1.0 1.0 -$near $far"
|
||||
$itk_component(ged) refresh_all
|
||||
}
|
||||
|
||||
::itcl::body ArcherCore::updateZClipPlanesFromSettings {} {
|
||||
updateZClipPlanes $mZClipFront $mZClipFrontMax $mZClipBack $mZClipBackMax
|
||||
}
|
||||
|
||||
# Note: This method is used by scale widgets in the Archer Preferences
|
||||
# dialog, which is why it has an unused parameter.
|
||||
::itcl::body ArcherCore::updateZClipPlanesFromPreferences {{_unused 0.0}} {
|
||||
updateZClipPlanes $mZClipFrontPref $mZClipFrontMaxPref $mZClipBackPref \
|
||||
$mZClipBackMaxPref
|
||||
}
|
||||
|
||||
::itcl::body ArcherCore::calculateZClipMax {} {
|
||||
set size [$itk_component(ged) size]
|
||||
set autoview_l [$itk_component(ged) get_autoview]
|
||||
@@ -5957,12 +5966,12 @@ namespace eval ArcherCore {
|
||||
|
||||
::itcl::body ArcherCore::calculateZClipBackMax {} {
|
||||
set mZClipBackMaxPref [calculateZClipMax]
|
||||
updateZClipPlanes 0
|
||||
updateZClipPlanesFromPreferences
|
||||
}
|
||||
|
||||
::itcl::body ArcherCore::calculateZClipFrontMax {} {
|
||||
set mZClipFrontMaxPref [calculateZClipMax]
|
||||
updateZClipPlanes 0
|
||||
updateZClipPlanesFromPreferences
|
||||
}
|
||||
|
||||
::itcl::body ArcherCore::validateZClipMax {_d} {
|
||||
@@ -5976,7 +5985,7 @@ namespace eval ArcherCore {
|
||||
return 0
|
||||
}
|
||||
|
||||
after idle [::itcl::code $this updateZClipPlanes 0]
|
||||
after idle [::itcl::code $this updateZClipPlanesFromPreferences]
|
||||
return 1
|
||||
}
|
||||
|
||||
@@ -5988,14 +5997,6 @@ namespace eval ArcherCore {
|
||||
updatePerspective 0
|
||||
}
|
||||
|
||||
::itcl::body ArcherCore::pushZClipSettings {} {
|
||||
set mZClipBackMaxPref $mZClipBackMax
|
||||
set mZClipFrontMaxPref $mZClipFrontMax
|
||||
set mZClipBackPref $mZClipBack
|
||||
set mZClipFrontPref $mZClipFront
|
||||
updateZClipPlanes 0
|
||||
}
|
||||
|
||||
::itcl::body ArcherCore::shootRay_doit {_start _op _target _prep _no_bool _onehit _bot_dflag _objects} {
|
||||
$itk_component(ged) init_shoot_ray ray $_prep $_no_bool $_onehit $_bot_dflag $_objects
|
||||
return [ray shootray $_start $_op $_target]
|
||||
@@ -6439,10 +6440,8 @@ namespace eval ArcherCore {
|
||||
if {$soi != -1} {
|
||||
gedCmd configure -primitiveLabels {}
|
||||
|
||||
if {$mAllowDataClear} {
|
||||
gedCmd data_axes points {}
|
||||
gedCmd data_lines points {}
|
||||
}
|
||||
gedCmd data_axes points {}
|
||||
gedCmd data_lines points {}
|
||||
}
|
||||
|
||||
updateTreeDrawLists
|
||||
@@ -6567,6 +6566,9 @@ namespace eval ArcherCore {
|
||||
::itcl::body ArcherCore::l {args} {
|
||||
eval gedWrapper l 1 0 0 0 $args
|
||||
}
|
||||
::itcl::body ArcherCore::lc {args} {
|
||||
eval gedWrapper lc 1 0 0 0 $args
|
||||
}
|
||||
::itcl::body ArcherCore::ls {args} {
|
||||
eval gedWrapper ls 1 0 0 0 $args
|
||||
}
|
||||
@@ -6843,6 +6845,19 @@ namespace eval ArcherCore {
|
||||
eval gedWrapper rotate_arb_face 0 0 1 0 $args
|
||||
}
|
||||
|
||||
::itcl::body ArcherCore::saveview {args} {
|
||||
# If no input database is specified and the open database is a
|
||||
# working copy, specify the name of the original database so that
|
||||
# the saveview script remains valid after the working copy is
|
||||
# deleted on program exit.
|
||||
set i [lsearch $args "-i"]
|
||||
if {$i == -1 && $mTargetCopy != "" && !$mDbNoCopy} {
|
||||
set args [linsert $args 0 "$mTarget"]
|
||||
set args [linsert $args 0 "-i"]
|
||||
}
|
||||
eval gedWrapper saveview 0 0 0 0 $args
|
||||
}
|
||||
|
||||
::itcl::body ArcherCore::scale {args} {
|
||||
set args [linsert $args 0 "scale"]
|
||||
eval gedWrapper edit 0 0 1 0 $args
|
||||
@@ -7263,7 +7278,6 @@ namespace eval ArcherCore {
|
||||
}
|
||||
|
||||
::itcl::body ArcherCore::watchVar {_name1 _name2 _op} {
|
||||
global rt_bot_mintie
|
||||
global env
|
||||
|
||||
if {![info exists itk_component(ged)]} {
|
||||
@@ -7326,10 +7340,6 @@ namespace eval ArcherCore {
|
||||
mRayColorVoid {
|
||||
$itk_component(ged) configure -rayColorVoid $mRayColorVoid
|
||||
}
|
||||
mRtBotMintie {
|
||||
set rt_bot_mintie $mRtBotMintie
|
||||
set env(LIBRT_BOT_MINTIE) $mRtBotMintie
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -283,6 +283,7 @@ package provide cadwidgets::Ged 1.0
|
||||
method killtree {args}
|
||||
method l {args}
|
||||
method lastMouseRayPos {}
|
||||
method lc {args}
|
||||
method light {args}
|
||||
method light_all {args}
|
||||
method list_views {args}
|
||||
@@ -741,7 +742,7 @@ package provide cadwidgets::Ged 1.0
|
||||
method init_data_pick {{_button 1}}
|
||||
method init_data_scale {{_button 1}}
|
||||
method init_data_poly_circ {{_button 1}}
|
||||
method init_data_poly_cont {{_button 1}}
|
||||
method init_data_poly_cont {{_button1 1} {_button2 2}}
|
||||
method init_data_poly_ell {{_button 1}}
|
||||
method init_data_poly_rect {{_button 1} {_sflag 0}}
|
||||
method init_find_arb_edge {_obj {_button 1} {_callback {}}}
|
||||
@@ -1528,8 +1529,10 @@ package provide cadwidgets::Ged 1.0
|
||||
$scmd == "poly_line_style" ||
|
||||
$scmd == "polygons_overlap" ||
|
||||
$scmd == "area" ||
|
||||
$scmd == "fill" ||
|
||||
$scmd == "export" ||
|
||||
$scmd == "import"} {
|
||||
$scmd == "import" ||
|
||||
$scmd == "moveall"} {
|
||||
return [eval $mGed data_polygons $itk_component($itk_option(-pane)) $args]
|
||||
}
|
||||
|
||||
@@ -2016,6 +2019,10 @@ package provide cadwidgets::Ged 1.0
|
||||
return $mLastMouseRayPos
|
||||
}
|
||||
|
||||
::itcl::body cadwidgets::Ged::lc {args} {
|
||||
eval $mGed lc $args
|
||||
}
|
||||
|
||||
::itcl::body cadwidgets::Ged::light {args} {
|
||||
eval $mGed light $itk_component($itk_option(-pane)) $args
|
||||
}
|
||||
@@ -4370,6 +4377,17 @@ package provide cadwidgets::Ged 1.0
|
||||
eval $mGed data_polygons $itk_component($_pane) replace_point $mLastDataIndex [list $point]
|
||||
}
|
||||
|
||||
if {[$mGed data_polygons $itk_component($_pane) moveall]} {
|
||||
foreach callback $mEndDataPolygonCallbacks {
|
||||
catch {$callback $mLastDataIndex}
|
||||
}
|
||||
|
||||
set mLastDataIndex ""
|
||||
refresh_on
|
||||
refresh_all
|
||||
return
|
||||
}
|
||||
|
||||
set pindex [lindex $mLastDataIndex 0]
|
||||
set cindex [lindex $mLastDataIndex 1]
|
||||
set plist [$mGed data_polygons $itk_component($_pane) polygons]
|
||||
@@ -4891,14 +4909,20 @@ package provide cadwidgets::Ged 1.0
|
||||
}
|
||||
|
||||
|
||||
::itcl::body cadwidgets::Ged::init_data_poly_cont {{_button 1}} {
|
||||
::itcl::body cadwidgets::Ged::init_data_poly_cont {{_button1 1} {_button2 2}} {
|
||||
measure_line_erase
|
||||
|
||||
foreach dm {ur ul ll lr} {
|
||||
bind $itk_component($dm) <$_button> "[::itcl::code $this begin_data_poly_cont]; $mGed poly_cont_build $itk_component($dm) %x %y; focus %W; break"
|
||||
bind $itk_component($dm) <Shift-$_button> "[::itcl::code $this end_data_poly_cont $dm]; break"
|
||||
bind $itk_component($dm) <$_button1> "[::itcl::code $this begin_data_poly_cont]; $mGed poly_cont_build $itk_component($dm) %x %y; focus %W; break"
|
||||
bind $itk_component($dm) <$_button2> "[::itcl::code $this end_data_poly_cont $dm]; break"
|
||||
|
||||
if {$_button1 == $_button2} {
|
||||
bind $itk_component($dm) <Shift-$_button1> "[::itcl::code $this end_data_poly_cont $dm]; break"
|
||||
}
|
||||
|
||||
bind $itk_component($dm) <ButtonRelease> ""
|
||||
bind $itk_component($dm) <ButtonRelease-$_button> ""
|
||||
bind $itk_component($dm) <ButtonRelease-$_button1> ""
|
||||
bind $itk_component($dm) <ButtonRelease-$_button2> ""
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -114,13 +114,7 @@ proc rtimage {rtimage_dict} {
|
||||
#
|
||||
# Run rt to generate the color insert
|
||||
#
|
||||
catch {eval exec $cmd >& $_log_file &} curr_pid
|
||||
if { !($_pid_filename == "/dev/null") && !($_pid_filename == "NUL") } {
|
||||
set chan [open $_pid_filename w]
|
||||
puts $chan $curr_pid
|
||||
close $chan
|
||||
}
|
||||
::pid_wait $curr_pid
|
||||
catch {eval exec $cmd >& $_log_file} curr_pid
|
||||
|
||||
# Look for color objects that also get edges
|
||||
if {[llength $_edge_objects] && [llength $_ecolor] == 3} {
|
||||
@@ -172,13 +166,7 @@ proc rtimage {rtimage_dict} {
|
||||
#
|
||||
# Run rtedge to generate the full-color with edges
|
||||
#
|
||||
catch {eval exec $cmd >& $_log_file &} curr_pid
|
||||
if { !($_pid_filename == "/dev/null") && !($_pid_filename == "NUL") } {
|
||||
set chan [open $_pid_filename w]
|
||||
puts $chan $curr_pid
|
||||
close $chan
|
||||
}
|
||||
::pid_wait $curr_pid
|
||||
catch {eval exec $cmd >& $_log_file} curr_pid
|
||||
}
|
||||
}
|
||||
|
||||
@@ -216,14 +204,7 @@ proc rtimage {rtimage_dict} {
|
||||
#
|
||||
# Run rt to generate the full-color version of the ghost image
|
||||
#
|
||||
catch {eval exec $cmd >& $_log_file &} curr_pid
|
||||
if { !($_pid_filename == "/dev/null") && !($_pid_filename == "NUL") } {
|
||||
set chan [open $_pid_filename w]
|
||||
puts $chan $curr_pid
|
||||
close $chan
|
||||
}
|
||||
|
||||
::pid_wait $curr_pid
|
||||
catch {eval exec $cmd >& $_log_file} curr_pid
|
||||
|
||||
set cmd [list [file join $binpath rt] -w $_w -n $_n \
|
||||
-o $tgfci \
|
||||
@@ -244,13 +225,7 @@ proc rtimage {rtimage_dict} {
|
||||
#
|
||||
# Run rt to generate the full-color version of the occlude_objects (i.e. color and ghost)
|
||||
#
|
||||
catch {eval exec $cmd >& $_log_file &} curr_pid
|
||||
if { !($_pid_filename == "/dev/null") && !($_pid_filename == "NUL") } {
|
||||
set chan [open $_pid_filename w]
|
||||
puts $chan $curr_pid
|
||||
close $chan
|
||||
}
|
||||
::pid_wait $curr_pid
|
||||
catch {eval exec $cmd >& $_log_file} curr_pid
|
||||
|
||||
#
|
||||
# Convert to ghost image
|
||||
@@ -316,14 +291,7 @@ proc rtimage {rtimage_dict} {
|
||||
#
|
||||
# Run rtedge to generate the full-color version of the ghost image
|
||||
#
|
||||
catch {eval exec $cmd >& $_log_file &} curr_pid
|
||||
if { !($_pid_filename == "/dev/null") && !($_pid_filename == "NUL") } {
|
||||
set chan [open $_pid_filename w]
|
||||
puts $chan $curr_pid
|
||||
close $chan
|
||||
}
|
||||
|
||||
::pid_wait $curr_pid
|
||||
catch {eval exec $cmd >& $_log_file} curr_pid
|
||||
}
|
||||
|
||||
catch {file delete -force $tgi}
|
||||
@@ -334,7 +302,11 @@ proc rtimage {rtimage_dict} {
|
||||
catch {file delete -force $tbw}
|
||||
catch {file delete -force $tmod}
|
||||
catch {file delete -force $tbwpix}
|
||||
|
||||
#end proc rtimage
|
||||
}
|
||||
|
||||
#end namespace cadwidgets
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -55,18 +55,31 @@ namespace eval Grouper {
|
||||
set size_orig ""
|
||||
set ae_orig ""
|
||||
|
||||
|
||||
proc getTreeMembers {_comb} {
|
||||
if {![exists $_comb]} {
|
||||
return ""
|
||||
}
|
||||
|
||||
set i 0
|
||||
|
||||
set tlist {}
|
||||
foreach item [regsub -all {/|/R} [lrange [split [tree -d 1 $_comb] "\n"] 1 end-1] ""] {
|
||||
lappend tlist [lindex $item 1]
|
||||
incr i
|
||||
}
|
||||
|
||||
return $tlist
|
||||
}
|
||||
|
||||
|
||||
proc remdup { GroupName } {
|
||||
set ItemList [search $GroupName -maxdepth 1]
|
||||
set ItemList [lrange $ItemList 1 end]
|
||||
set ItemList [getTreeMembers $GroupName]
|
||||
set ItemList [lsort -unique $ItemList]
|
||||
|
||||
set found_tmp 0
|
||||
while { !$found_tmp } {
|
||||
set tmp_grp [expr rand()]
|
||||
if { [search -name $tmp_grp] == "" } {
|
||||
set found_tmp 1
|
||||
}
|
||||
}
|
||||
make_name -s 0
|
||||
set tmp_grp [make_name tmp_group]
|
||||
|
||||
eval g $tmp_grp $ItemList
|
||||
kill $GroupName
|
||||
mv $tmp_grp $GroupName
|
||||
@@ -99,11 +112,19 @@ namespace eval Grouper {
|
||||
if { $dimX > 0 } {
|
||||
# Rectangle was created left-to-right. Select only
|
||||
# objects completely in the rectangle.
|
||||
set objs [select $posX $posY $dimX $dimY]
|
||||
# set objs [select $posX $posY $dimX $dimY]
|
||||
if {[catch {select -- $posX $posY $dimX $dimY} objs]} {
|
||||
puts $objs
|
||||
return "no_result"
|
||||
}
|
||||
} else {
|
||||
# Rectangle was created right-to-left. Select everything
|
||||
# completely and partly in the rectangle.
|
||||
set objs [select -p $posX $posY $dimX $dimY]
|
||||
# set objs [select -p $posX $posY $dimX $dimY]
|
||||
if {[catch {select -p -- $posX $posY $dimX $dimY} objs]} {
|
||||
puts $objs
|
||||
return "no_result"
|
||||
}
|
||||
}
|
||||
|
||||
if { $objs == "" } {
|
||||
@@ -144,27 +165,15 @@ namespace eval Grouper {
|
||||
set size_orig [size]
|
||||
set ae_orig [ae]
|
||||
|
||||
# Temporarily erase group from display while getting objects in rectangle"
|
||||
after 1 {
|
||||
if { [search -name $::Grouper::GroupNameGlobal] != "" } {
|
||||
set ::Grouper::erase_status [erase $::Grouper::GroupNameGlobal]
|
||||
} else {
|
||||
set ::Grouper::erase_status 1
|
||||
}
|
||||
if {[exists $::Grouper::GroupNameGlobal]} {
|
||||
erase $::Grouper::GroupNameGlobal
|
||||
}
|
||||
|
||||
# Wait for the group to be erased from the display before we continue
|
||||
vwait ::Grouper::erase_status
|
||||
|
||||
after 1 {set ::Grouper::objs [::Grouper::getObjInRectangle]}
|
||||
|
||||
puts stdout "Selection running ..."
|
||||
vwait ::Grouper::objs
|
||||
set ::Grouper::objs [::Grouper::getObjInRectangle]
|
||||
|
||||
if { $objs == "invalid_selection" } {
|
||||
puts stdout "Invalid selection (zero area selection box)."
|
||||
# highlight in yellow current group
|
||||
if { [search -name $GroupName] != "" } {
|
||||
if {[exists $GroupName]} {
|
||||
e -C255/255/0 $GroupName
|
||||
center $center_orig
|
||||
size $size_orig
|
||||
@@ -176,7 +185,7 @@ namespace eval Grouper {
|
||||
if { $objs == "no_result" } {
|
||||
puts stdout "Nothing selected."
|
||||
# highlight in yellow current group
|
||||
if { [search -name $GroupName] != "" } {
|
||||
if {[exists $GroupName]} {
|
||||
e -C255/255/0 $GroupName
|
||||
center $center_orig
|
||||
size $size_orig
|
||||
@@ -188,34 +197,36 @@ namespace eval Grouper {
|
||||
set objs [lsort -unique $objs]
|
||||
set tot_obj_in_rect [llength $objs]
|
||||
|
||||
if { [search -name $GroupName] == "" } {
|
||||
if {![exists $GroupName]} {
|
||||
set grp_obj_list_before ""
|
||||
set grp_obj_list_len_before 0
|
||||
} else {
|
||||
set grp_obj_list_before [search $GroupName -maxdepth 1]
|
||||
set grp_obj_list_len_before [expr [llength $grp_obj_list_before] - 1]
|
||||
set grp_obj_list_before [getTreeMembers $GroupName]
|
||||
set grp_obj_list_len_before [llength $grp_obj_list_before]
|
||||
}
|
||||
|
||||
if { $Boolean == "+" } {
|
||||
foreach obj $objs {
|
||||
g $GroupName $obj
|
||||
#puts "Adding $obj to $GroupName ..."
|
||||
catch {g $GroupName $obj}
|
||||
}
|
||||
} else {
|
||||
foreach obj $objs {
|
||||
catch {rm $GroupName $obj} tmp_msg
|
||||
#puts "Removing $obj from $GroupName ..."
|
||||
catch {rm $GroupName $obj}
|
||||
}
|
||||
}
|
||||
|
||||
if { ([search -name $GroupName] != "") && ($Boolean == "+") } {
|
||||
if {[exists $GroupName] && $Boolean == "+"} {
|
||||
remdup $GroupName
|
||||
}
|
||||
|
||||
if { [search -name $GroupName] == "" } {
|
||||
if {![exists $GroupName]} {
|
||||
set grp_obj_list_after ""
|
||||
set grp_obj_list_len_after 0
|
||||
} else {
|
||||
set grp_obj_list_after [search $GroupName -maxdepth 1]
|
||||
set grp_obj_list_len_after [expr [llength $grp_obj_list_after] - 1]
|
||||
set grp_obj_list_after [getTreeMembers $GroupName]
|
||||
set grp_obj_list_len_after [llength $grp_obj_list_after]
|
||||
}
|
||||
|
||||
if { $grp_obj_list_len_after > $grp_obj_list_len_before } {
|
||||
@@ -258,7 +269,7 @@ namespace eval Grouper {
|
||||
}
|
||||
|
||||
# highlight in yellow current group
|
||||
if { [search -name $GroupName] != "" } {
|
||||
if {[exists $GroupName]} {
|
||||
e -C255/255/0 $GroupName
|
||||
center $center_orig
|
||||
size $size_orig
|
||||
@@ -352,7 +363,7 @@ proc grouper { args } {
|
||||
bind $mged_gui($id,active_dm) <Control-ButtonRelease-2> " winset $mged_gui($id,active_dm); dm idle; done_grouper"
|
||||
|
||||
# highlight in yellow current group
|
||||
if { [search -name $GroupName] != "" } {
|
||||
if {[exists $GroupName]} {
|
||||
e -C255/255/0 $GroupName
|
||||
center $::Grouper::center_orig
|
||||
size $::Grouper::size_orig
|
||||
@@ -385,7 +396,7 @@ proc done_grouper {} {
|
||||
bind $mged_gui($id,active_dm) <ButtonRelease-2> ""
|
||||
|
||||
# remove yellow highlights from the display
|
||||
if { [search -name $::Grouper::GroupNameGlobal] != "" } {
|
||||
if {[exists $::Grouper::GroupNameGlobal]} {
|
||||
erase $::Grouper::GroupNameGlobal
|
||||
}
|
||||
set ::Grouper::GrouperRunning 0
|
||||
|
||||
Executable → Regular
+17
-3
@@ -155,6 +155,18 @@ namespace eval RtWizard {
|
||||
#
|
||||
set perspective [$viewPage getPerspective]
|
||||
|
||||
if {$::tcl_platform(platform) == "windows"} {
|
||||
set pid_filename "NUL"
|
||||
} else {
|
||||
set pid_filename "/dev/null"
|
||||
}
|
||||
|
||||
if {$::tcl_platform(platform) == "windows"} {
|
||||
set log_file "NUL"
|
||||
} else {
|
||||
set log_file "/dev/null"
|
||||
}
|
||||
|
||||
# populate a dictionary to pass to rtimage
|
||||
set rtimage_dict [dict create \
|
||||
_dbfile $::RtWizard::wizard_state(dbFile) \
|
||||
@@ -166,7 +178,9 @@ namespace eval RtWizard {
|
||||
_eye_pt $eye_pt \
|
||||
_perspective $perspective \
|
||||
_bgcolor $bg \
|
||||
_color_objects $color_objects ]
|
||||
_color_objects $color_objects \
|
||||
_pid_filename $pid_filename \
|
||||
_log_file $log_file]
|
||||
|
||||
::cadwidgets::rtimage $rtimage_dict
|
||||
|
||||
@@ -184,13 +198,13 @@ namespace eval RtWizard {
|
||||
set output_generated 1
|
||||
}
|
||||
if {$::tcl_platform(platform) == "windows"} {
|
||||
set kill_cmd [auto_execok taskkill]
|
||||
set kill_cmd "[auto_execok taskkill] /F /PID"
|
||||
} else {
|
||||
set kill_cmd [auto_execok kill]
|
||||
}
|
||||
|
||||
if {$kill_cmd != ""} {
|
||||
exec $kill_cmd $fbpid
|
||||
eval exec $kill_cmd $fbpid
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Executable → Regular
+17
-3
@@ -165,6 +165,18 @@ puts $fb
|
||||
#
|
||||
set perspective [$viewPage getPerspective]
|
||||
|
||||
if {$::tcl_platform(platform) == "windows"} {
|
||||
set pid_filename "NUL"
|
||||
} else {
|
||||
set pid_filename "/dev/null"
|
||||
}
|
||||
|
||||
if {$::tcl_platform(platform) == "windows"} {
|
||||
set log_file "NUL"
|
||||
} else {
|
||||
set log_file "/dev/null"
|
||||
}
|
||||
|
||||
set rtimage_dict [dict create \
|
||||
_dbfile $::RtWizard::wizard_state(dbFile) \
|
||||
_port $fb \
|
||||
@@ -178,7 +190,9 @@ puts $fb
|
||||
_ecolor $l \
|
||||
_necolor $nl\
|
||||
_occmode 0 \
|
||||
_edge_objects $line_objects ]
|
||||
_edge_objects $line_objects \
|
||||
_pid_filename $pid_filename \
|
||||
_log_file $log_file]
|
||||
|
||||
::cadwidgets::rtimage $rtimage_dict
|
||||
|
||||
@@ -196,13 +210,13 @@ puts $fb
|
||||
set output_generated 1
|
||||
}
|
||||
if {$::tcl_platform(platform) == "windows"} {
|
||||
set kill_cmd [auto_execok taskkill]
|
||||
set kill_cmd "[auto_execok taskkill] /F /PID"
|
||||
} else {
|
||||
set kill_cmd [auto_execok kill]
|
||||
}
|
||||
|
||||
if {$kill_cmd != ""} {
|
||||
exec $kill_cmd $fbpid
|
||||
eval exec $kill_cmd $fbpid
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Executable → Regular
+17
-3
@@ -166,6 +166,18 @@ namespace eval RtWizard {
|
||||
#
|
||||
set perspective [$viewPage getPerspective]
|
||||
|
||||
if {$::tcl_platform(platform) == "windows"} {
|
||||
set pid_filename "NUL"
|
||||
} else {
|
||||
set pid_filename "/dev/null"
|
||||
}
|
||||
|
||||
if {$::tcl_platform(platform) == "windows"} {
|
||||
set log_file "NUL"
|
||||
} else {
|
||||
set log_file "/dev/null"
|
||||
}
|
||||
|
||||
set rtimage_dict [dict create \
|
||||
_dbfile $::RtWizard::wizard_state(dbFile) \
|
||||
_port $fb \
|
||||
@@ -180,7 +192,9 @@ namespace eval RtWizard {
|
||||
_necolor $nl \
|
||||
_occmode 1 \
|
||||
_color_objects $color_objects \
|
||||
_edge_objects $color_objects ]
|
||||
_edge_objects $color_objects \
|
||||
_pid_filename $pid_filename \
|
||||
_log_file $log_file]
|
||||
|
||||
::cadwidgets::rtimage $rtimage_dict
|
||||
|
||||
@@ -198,13 +212,13 @@ namespace eval RtWizard {
|
||||
set output_generated 1
|
||||
}
|
||||
if {$::tcl_platform(platform) == "windows"} {
|
||||
set kill_cmd [auto_execok taskkill]
|
||||
set kill_cmd "[auto_execok taskkill] /F /PID"
|
||||
} else {
|
||||
set kill_cmd [auto_execok kill]
|
||||
}
|
||||
|
||||
if {$kill_cmd != ""} {
|
||||
exec $kill_cmd $fbpid
|
||||
eval exec $kill_cmd $fbpid
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Executable → Regular
+17
-3
@@ -183,6 +183,18 @@ namespace eval RtWizard {
|
||||
#
|
||||
set perspective [$viewPage getPerspective]
|
||||
|
||||
if {$::tcl_platform(platform) == "windows"} {
|
||||
set pid_filename "NUL"
|
||||
} else {
|
||||
set pid_filename "/dev/null"
|
||||
}
|
||||
|
||||
if {$::tcl_platform(platform) == "windows"} {
|
||||
set log_file "NUL"
|
||||
} else {
|
||||
set log_file "/dev/null"
|
||||
}
|
||||
|
||||
set rtimage_dict [dict create \
|
||||
_dbfile $::RtWizard::wizard_state(dbFile) \
|
||||
_port $fb \
|
||||
@@ -197,7 +209,9 @@ namespace eval RtWizard {
|
||||
_necolor $nl \
|
||||
_occmode $occMode \
|
||||
_color_objects $color_objects \
|
||||
_edge_objects $line_objects ]
|
||||
_edge_objects $line_objects \
|
||||
_pid_filename $pid_filename \
|
||||
_log_file $log_file]
|
||||
|
||||
::cadwidgets::rtimage $rtimage_dict
|
||||
|
||||
@@ -215,13 +229,13 @@ namespace eval RtWizard {
|
||||
set output_generated 1
|
||||
}
|
||||
if {$::tcl_platform(platform) == "windows"} {
|
||||
set kill_cmd [auto_execok taskkill]
|
||||
set kill_cmd "[auto_execok taskkill] /F /PID"
|
||||
} else {
|
||||
set kill_cmd [auto_execok kill]
|
||||
}
|
||||
|
||||
if {$kill_cmd != ""} {
|
||||
exec $kill_cmd $fbpid
|
||||
eval exec $kill_cmd $fbpid
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Executable → Regular
+17
-3
@@ -160,6 +160,18 @@ namespace eval RtWizard {
|
||||
#
|
||||
set perspective [$viewPage getPerspective]
|
||||
|
||||
if {$::tcl_platform(platform) == "windows"} {
|
||||
set pid_filename "NUL"
|
||||
} else {
|
||||
set pid_filename "/dev/null"
|
||||
}
|
||||
|
||||
if {$::tcl_platform(platform) == "windows"} {
|
||||
set log_file "NUL"
|
||||
} else {
|
||||
set log_file "/dev/null"
|
||||
}
|
||||
|
||||
set rtimage_dict [dict create \
|
||||
_dbfile $::RtWizard::wizard_state(dbFile) \
|
||||
_port $fb \
|
||||
@@ -172,7 +184,9 @@ namespace eval RtWizard {
|
||||
_bgcolor $bg \
|
||||
_gamma $gamma \
|
||||
_color_objects $color_objects \
|
||||
_ghost_objects $ghost_objects ]
|
||||
_ghost_objects $ghost_objects \
|
||||
_pid_filename $pid_filename \
|
||||
_log_file $log_file]
|
||||
|
||||
::cadwidgets::rtimage $rtimage_dict
|
||||
|
||||
@@ -190,13 +204,13 @@ namespace eval RtWizard {
|
||||
set output_generated 1
|
||||
}
|
||||
if {$::tcl_platform(platform) == "windows"} {
|
||||
set kill_cmd [auto_execok taskkill]
|
||||
set kill_cmd "[auto_execok taskkill] /F /PID"
|
||||
} else {
|
||||
set kill_cmd [auto_execok kill]
|
||||
}
|
||||
|
||||
if {$kill_cmd != ""} {
|
||||
exec $kill_cmd $fbpid
|
||||
eval exec $kill_cmd $fbpid
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Executable → Regular
+17
-3
@@ -187,6 +187,18 @@ namespace eval RtWizard {
|
||||
#
|
||||
set perspective [$viewPage getPerspective]
|
||||
|
||||
if {$::tcl_platform(platform) == "windows"} {
|
||||
set pid_filename "NUL"
|
||||
} else {
|
||||
set pid_filename "/dev/null"
|
||||
}
|
||||
|
||||
if {$::tcl_platform(platform) == "windows"} {
|
||||
set log_file "NUL"
|
||||
} else {
|
||||
set log_file "/dev/null"
|
||||
}
|
||||
|
||||
set rtimage_dict [dict create \
|
||||
_dbfile $::RtWizard::wizard_state(dbFile) \
|
||||
_port $fb \
|
||||
@@ -203,7 +215,9 @@ namespace eval RtWizard {
|
||||
_gamma $gamma \
|
||||
_color_objects $color_objects \
|
||||
_ghost_objects $ghost_objects \
|
||||
_edge_objects $line_objects ]
|
||||
_edge_objects $line_objects \
|
||||
_pid_filename $pid_filename \
|
||||
_log_file $log_file]
|
||||
|
||||
::cadwidgets::rtimage $rtimage_dict
|
||||
|
||||
@@ -221,13 +235,13 @@ namespace eval RtWizard {
|
||||
set output_generated 1
|
||||
}
|
||||
if {$::tcl_platform(platform) == "windows"} {
|
||||
set kill_cmd [auto_execok taskkill]
|
||||
set kill_cmd "[auto_execok taskkill] /F /PID"
|
||||
} else {
|
||||
set kill_cmd [auto_execok kill]
|
||||
}
|
||||
|
||||
if {$kill_cmd != ""} {
|
||||
exec $kill_cmd $fbpid
|
||||
eval exec $kill_cmd $fbpid
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user