Skip to content

Commit

Permalink
Revert "Merge branch 'scene_obj_manage' into main"
Browse files Browse the repository at this point in the history
MGED's games with GEDP make a mess out of the view state, and the new
logic requiring an initialized view can't tolerate it.  Revert merge to
main until we figure something out.
  • Loading branch information
starseeker committed Apr 10, 2022
1 parent fc025d5 commit d6e2224
Show file tree
Hide file tree
Showing 68 changed files with 754 additions and 1,110 deletions.
2 changes: 1 addition & 1 deletion include/bg/polygon.h
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ struct bv_polygon {
//
// v->gv_width = dm_get_width((struct dm *)v->dmp);
// v->gv_height = dm_get_height((struct dm *)v->dmp);
BG_EXPORT extern struct bv_scene_obj *bv_create_polygon(struct bview *v, int type, int x, int y);
BG_EXPORT extern struct bv_scene_obj *bv_create_polygon(struct bview *v, int type, int x, int y, struct bv_scene_obj *free_scene_obj);

// Various update modes have similar logic - we pass in the flags to the update
// routine to enable/disable specific portions of the overall flow.
Expand Down
1 change: 0 additions & 1 deletion include/bv.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
#include "./bv/adc.h"
#include "./bv/util.h"
#include "./bv/vlist.h"
#include "./bv/view_sets.h"

#endif /* BV_H */

Expand Down
1 change: 0 additions & 1 deletion include/bv/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ set(bv_headers
util.h
vectfont.h
vlist.h
view_sets.h
)
BRLCAD_MANAGE_FILES(bv_headers ${INCLUDE_DIR}/brlcad/bv)

Expand Down
36 changes: 14 additions & 22 deletions include/bv/defines.h
Original file line number Diff line number Diff line change
Expand Up @@ -212,15 +212,6 @@ struct bv_obj_settings {

struct bview;

#define BV_SCENE_OBJ_DB 0
#define BV_SCENE_OBJ_VIEW 1
#define BV_SCENE_OBJ_DB_LOCAL 2
#define BV_SCENE_OBJ_VIEW_LOCAL 3

#define BV_DB_OBJS 0x01
#define BV_VIEW_OBJS 0x02
#define BV_SHARED_OBJS 0x04

struct bv_scene_obj {
struct bu_list l;

Expand Down Expand Up @@ -287,19 +278,9 @@ struct bv_scene_obj {
/* Child objects of this object */
struct bu_ptbl children;

/* Object level pointers to parent containers. These are stored so
* that the object itself knows everything needed for data manipulation
* and it is unnecessary to explicitly pass other parameters. */

/* Reusable vlists */
struct bu_list *vlfree;

/* Container for reusing bv_scene_obj allocations */
struct bv_scene_obj *free_scene_obj;

/* View container containing this object */
struct bu_ptbl *otbl;

/* For more specialized routines not using vlists, we may need
* additional drawing data associated with a scene object */
void *draw_data;
Expand Down Expand Up @@ -432,7 +413,7 @@ struct bview_objs {
// Container for db object groups unique to this view (typical use case is
// adaptive plotting, where geometry wireframes may differ from view to
// view and thus need unique vlists.)
struct bu_ptbl *db_objs;
struct bu_ptbl *view_grps;
// Container for storing bv_scene_obj elements unique to this view.
struct bu_ptbl *view_objs;

Expand Down Expand Up @@ -545,11 +526,22 @@ struct bview {
// Because bview instances frequently share objects in applications, they are
// not always fully independent - we define a container and some basic
// operations to manage this.
struct bview_set_internal;
struct bview_set {
struct bview_set_internal *i;
struct bu_ptbl views;
struct bu_ptbl shared_db_objs;
struct bu_ptbl shared_view_objs;
struct bview_settings settings;

struct bv_scene_obj *free_scene_obj;
struct bu_list vlfree;
};
BV_EXPORT void
bv_set_init(struct bview_set *s);
BV_EXPORT void
bv_set_free(struct bview_set *s);

BV_EXPORT void
bv_set_add(struct bview_set *s, struct bview *v);

#endif /* BV_DEFINES_H */

Expand Down
51 changes: 6 additions & 45 deletions include/bv/util.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,6 @@ BV_EXPORT extern unsigned long long bv_hash(struct bview *v);
/* Return a hash of the contents of a display list. Returns 0 on failure. */
BV_EXPORT extern unsigned long long bv_dl_hash(struct display_list *dl);

/* Return number of objects defined in any object container
* known to this view (0 if completely cleared). */
BV_EXPORT size_t
bv_clear(struct bview *v, int flags);

/* Note that some of these are mutually exclusive as far as producing any
* changes - a simultaneous constraint in X and Y, for example, results in a
Expand Down Expand Up @@ -101,6 +97,12 @@ BV_EXPORT extern int bv_adjust(struct bview *v, int dx, int dy, point_t keypoint
* calculation is impossible), else 0. */
BV_EXPORT extern int bv_screen_to_view(struct bview *v, fastf_t *fx, fastf_t *fy, fastf_t x, fastf_t y);

/* Initialize a scene object to standard default settings */
BV_EXPORT extern void bv_scene_obj_init(struct bv_scene_obj *s, struct bv_scene_obj *free_scene_obj);

/* Free the object contents, including all child objects */
BV_EXPORT extern void bv_scene_obj_free(struct bv_scene_obj *s, struct bv_scene_obj *free_scene_obj);

/* Compute the min, max, and center points of the scene object.
* Return 1 if a bound was computed, else 0 */
BV_EXPORT extern int bv_scene_obj_bound(struct bv_scene_obj *s);
Expand All @@ -109,47 +111,6 @@ BV_EXPORT extern int bv_scene_obj_bound(struct bv_scene_obj *s);
* the vlist points in s in the context of view v */
BV_EXPORT extern fastf_t bv_vZ_calc(struct bv_scene_obj *s, struct bview *v, int mode);


/* Given a view, create an object of the specified type. Issues such as memory
* management as a function of view settings are handled internally, so client
* codes don't need to manage it. */
BV_EXPORT struct bv_scene_obj *
bv_obj_get(struct bview *v, int type);

/* Given an object, create an object that is a child of that object. Issues
* such as memory management as a function of view settings are handled
* internally, so client codes don't need to manage it. */
BV_EXPORT struct bv_scene_obj *
bv_obj_get_child(struct bv_scene_obj *s);

/* Clear the contents of an object (including releasing its children), but keep
* it active in the view. Generally used when redrawing an object */
BV_EXPORT void
bv_obj_reset(struct bv_scene_obj *s);

/* Release an object to the internal pools. */
BV_EXPORT void
bv_obj_put(struct bv_scene_obj *o);

/* Given a scene object and a name vname, glob match child names and uuids to
* attempt to locate a child of s that matches vname */
BV_EXPORT struct bv_scene_obj *
bv_find_child(struct bv_scene_obj *s, const char *vname);

/* Given a view and a name vname, glob match names and uuids to attempt to
* locate a scene object in v that matches vname.
*
* NOTE - currently this is searching the top level objects, but does not walk
* down into their children. May want to support that in the future... */
BV_EXPORT struct bv_scene_obj *
bv_find_obj(struct bview *v, const char *vname);

/* For the given view, return a pointer to the bu_ptbl holding active scene
* objects with the specified type */
BV_EXPORT struct bu_ptbl *
bv_view_objs(struct bview *v, int type);


__END_DECLS

/** @} */
Expand Down
93 changes: 0 additions & 93 deletions include/bv/view_sets.h

This file was deleted.

4 changes: 0 additions & 4 deletions include/bv/vlist.h
Original file line number Diff line number Diff line change
Expand Up @@ -316,10 +316,6 @@ BV_EXPORT extern void bv_vlblock_to_objs(struct bu_ptbl *out,
struct bv_scene_obj *f,
struct bu_list *vlfree);


BV_EXPORT extern struct bv_scene_obj *
bv_vlblock_obj(struct bv_vlblock *vbp, struct bview *v, const char *name);

/**
* Output a vlist as an extended 3-D floating point UNIX-Plot file.
* You provide the file. Uses libplot3 routines to create the
Expand Down
2 changes: 2 additions & 0 deletions include/ged/view.h
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,8 @@ GED_EXPORT extern struct bg_polygon *ged_import_polygon(struct ged *gedp, const
GED_EXPORT extern int ged_polygons_overlap(struct ged *gedp, struct bg_polygon *polyA, struct bg_polygon *polyB);
GED_EXPORT extern void ged_polygon_fill_segments(struct ged *gedp, struct bg_polygon *poly, vect2d_t vfilldir, fastf_t vfilldelta);

GED_EXPORT extern struct bview * ged_find_view(struct ged *gedp, const char *key);

__END_DECLS

#endif /* GED_VIEW_H */
Expand Down
2 changes: 1 addition & 1 deletion include/rt/primitives/sketch.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ RT_EXPORT extern int curve_to_tcl_list(struct bu_vls *vls,
struct rt_curve *crv);

RT_EXPORT extern struct bv_scene_obj *
db_sketch_to_scene_obj(const char *sname, struct db_i *dbip, struct directory *dp, struct bview *sv);
db_sketch_to_scene_obj(const char *sname, struct db_i *dbip, struct directory *dp, struct bview *sv, struct bv_scene_obj *free_scene_obj);

RT_EXPORT extern struct directory *
db_scene_obj_to_sketch(struct db_i *dbip, const char *sname, struct bv_scene_obj *s);
Expand Down
Loading

0 comments on commit d6e2224

Please sign in to comment.