Revision: 64339
          http://sourceforge.net/p/brlcad/code/64339
Author:   n_reed
Date:     2015-03-04 21:12:18 +0000 (Wed, 04 Mar 2015)
Log Message:
-----------
Fix the Archer command entry so saveview can be run with its full range of 
arguments. By default saveview uses the name of the open database in the 
script. This is a problem in Archer because the open database is a working 
copy, which means it's deleted on program exit, invalidating the script. 
Address this by silently passing the name of the original database to saveview 
if the input database isn't specified by the user. There's still a problem in 
that if a user creates a saveview script based on the working copy and doesn't 
save changes back to the original database, then the saveview script may still 
be invalid. For now though, possibly invalid is better than always invalid.

Modified Paths:
--------------
    brlcad/trunk/src/libtclcad/tclcad_obj.c
    brlcad/trunk/src/tclscripts/archer/ArcherCore.tcl

Modified: brlcad/trunk/src/libtclcad/tclcad_obj.c
===================================================================
--- brlcad/trunk/src/libtclcad/tclcad_obj.c     2015-03-03 19:37:27 UTC (rev 
64338)
+++ brlcad/trunk/src/libtclcad/tclcad_obj.c     2015-03-04 21:12:18 UTC (rev 
64339)
@@ -1302,7 +1302,7 @@
     {"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},

Modified: brlcad/trunk/src/tclscripts/archer/ArcherCore.tcl
===================================================================
--- brlcad/trunk/src/tclscripts/archer/ArcherCore.tcl   2015-03-03 19:37:27 UTC 
(rev 64338)
+++ brlcad/trunk/src/tclscripts/archer/ArcherCore.tcl   2015-03-04 21:12:18 UTC 
(rev 64339)
@@ -290,6 +290,7 @@
        method rmater              {args}
        method rotate              {args}
        method rotate_arb_face     {args}
+       method saveview            {args}
        method scale               {args}
        method search              {args}
        method sed                 {_prim}
@@ -588,7 +589,7 @@
            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
        }
@@ -6844,6 +6845,19 @@
     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

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


------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits

Reply via email to