[brlcad-commits] SF.net SVN: brlcad:[50597] brlcad/trunk/src/tclscripts/rtwizard/lib
Open Source Solid Modeling CAD
Brought to you by:
brlcad
From: <sta...@us...> - 2012-05-17 21:57:09
|
Revision: 50597 http://brlcad.svn.sourceforge.net/brlcad/?rev=50597&view=rev Author: starseeker Date: 2012-05-17 21:57:02 +0000 (Thu, 17 May 2012) Log Message: ----------- Start transitioning rtwizard pages over to using rtimage script. There is probably some intermediate breakage while this progresses Modified Paths: -------------- brlcad/trunk/src/tclscripts/rtwizard/lib/FbPage.itk brlcad/trunk/src/tclscripts/rtwizard/lib/PictureTypeA.itcl brlcad/trunk/src/tclscripts/rtwizard/lib/PictureTypeBase.itcl Modified: brlcad/trunk/src/tclscripts/rtwizard/lib/FbPage.itk =================================================================== --- brlcad/trunk/src/tclscripts/rtwizard/lib/FbPage.itk 2012-05-17 20:26:40 UTC (rev 50596) +++ brlcad/trunk/src/tclscripts/rtwizard/lib/FbPage.itk 2012-05-17 21:57:02 UTC (rev 50597) @@ -436,7 +436,14 @@ if { [string match $mode "toFile"] && \ [string length $fbFile] > 0 && \ [string match $screenOnly "false"] } { - return "-o $fbFile" + # Will be generating a file - need in-memory fb + set port 0 + while { ! [catch {exec [file join [bu_brlcad_root bin] fbclear] -F $port } error ] } { + if {$::RtWizard::wizard_state(verbose)} {puts "fbserv port $fbserv_port is already in use."} + incr port + } + catch {exec [file join [bu_brlcad_root bin] fbserv] -w $width -n $height $port /dev/mem &} pid + return "$port $pid $fbFile" } set binpath [bu_brlcad_root "bin"] # @@ -468,7 +475,7 @@ exec "$binpath/fbclear" -F $port 0 0 0 set lastPort $port - return "-F $port" + return "$port" } #--------------------# Modified: brlcad/trunk/src/tclscripts/rtwizard/lib/PictureTypeA.itcl =================================================================== --- brlcad/trunk/src/tclscripts/rtwizard/lib/PictureTypeA.itcl 2012-05-17 20:26:40 UTC (rev 50596) +++ brlcad/trunk/src/tclscripts/rtwizard/lib/PictureTypeA.itcl 2012-05-17 21:57:02 UTC (rev 50597) @@ -130,10 +130,40 @@ set fb [$::fbp getFrameBuffer $w2 $h2 true] # - # Run rt + # Get the view info # - rtCmd $fcp $fb $w2 $h2 + set viewPage [$::exp getViewPage] + set viewInfo [$viewPage getEyeModel] + set view_info [regsub -all ";" $viewInfo ""] + set vdata [split $view_info "\n"] + set viewsize [lindex [lindex $vdata 0] 1] + set orientation [lrange [lindex $vdata 1] 1 end] + set eye_pt [lrange [lindex $vdata 2] 1 end] + # + # Get the background color + # + set objPage $fcp + set bgHex [$objPage getBackgroundColor] + set bg [hexToRGB $bgHex] + + # + # Get the object list, the file is global + # + set color_objects [$objPage getObjects] + + # Get the perspective angle + # + set perspective [$viewPage getPerspective] + + ::cadwidgets::rtimage $::RtWizard::wizard_state(dbFile) $fb \ + $w2 $h2 \ + $viewsize $orientation $eye_pt $perspective\ + $bg "" ""\ + "" "" \ + $color_objects \ + "" \ + "" } # @@ -150,11 +180,73 @@ # get a framebuffer # set fb [$::fbp getFrameBuffer $w $h] + set fbarray [split $fb " "] + if { [llength $fbarray] > 1 } { + set fb [lindex $fbarray 0] + set fbpid [lindex $fbarray 1] + set filename [lindex $fbarray 2] + } # - # Run rt + # Get the view info # - rtCmd $fcp $fb $w $h + set viewPage [$::exp getViewPage] + set viewInfo [$viewPage getEyeModel] + set view_info [regsub -all ";" $viewInfo ""] + set vdata [split $view_info "\n"] + set viewsize [lindex [lindex $vdata 0] 1] + set orientation [lrange [lindex $vdata 1] 1 end] + set eye_pt [lrange [lindex $vdata 2] 1 end] + + # + # Get the background color + # + set objPage $fcp + set bgHex [$objPage getBackgroundColor] + set bg [hexToRGB $bgHex] + + # + # Get the object list, the file is global + # + set color_objects [$objPage getObjects] + + # Get the perspective angle + # + set perspective [$viewPage getPerspective] + + ::cadwidgets::rtimage $::RtWizard::wizard_state(dbFile) $fb \ + $w $h \ + $viewsize $orientation $eye_pt $perspective\ + $bg "" ""\ + "" "" \ + $color_objects \ + "" \ + "" + + # If we're outputting a file, write it out and close down + # the in-memory fbserv + if {[info exists filename]} { + if {[string length $filename] > 0 } { + set output_generated 0 + if {[file extension $filename] == ".png"} { + exec [file join [bu_brlcad_root bin] fb-png] -w $w -n $h -F $fb $filename + set output_generated 1 + } + if {!$output_generated} { + exec [file join [bu_brlcad_root bin] fb-pix] -w $w -n $h -F $fb $filename + set output_generated 1 + } + if {$::tcl_platform(platform) == "windows"} { + set kill_cmd [auto_execok taskkill] + } else { + set kill_cmd [auto_execok kill] + } + + if {$kill_cmd != ""} { + exec $kill_cmd $fbpid + } + } + } } Modified: brlcad/trunk/src/tclscripts/rtwizard/lib/PictureTypeBase.itcl =================================================================== --- brlcad/trunk/src/tclscripts/rtwizard/lib/PictureTypeBase.itcl 2012-05-17 20:26:40 UTC (rev 50596) +++ brlcad/trunk/src/tclscripts/rtwizard/lib/PictureTypeBase.itcl 2012-05-17 21:57:02 UTC (rev 50597) @@ -266,9 +266,7 @@ # Assemble the rt command - note that it is a # full-blown script. # - set otype [lindex [split $fb " "] 0] - set fbout [join [lreplace [split $fb " "] 0 0] " "] - set cmd [list [file join [bu_brlcad_root bin] rt] -M -R $otype $fbout -w $width \ + set cmd [list [file join [bu_brlcad_root bin] rt] -M -R -F $fb -w $width \ -n $height -V $ar -A 0.9 -p $perspective \ -C [lindex $bg 0]/[lindex $bg 1]/[lindex $bg 2] \ $::RtWizard::wizard_state(dbFile)] @@ -335,9 +333,6 @@ set fgMode [list set fg=[lindex $l 0],[lindex $l 1],[lindex $l 2]] } - set otype [lindex [split $fb " "] 0] - set fbout [join [lreplace [split $fb " "] 0 0] " "] - # # Assemble the rtedge command - note that it is a # full-blown script. @@ -348,7 +343,7 @@ # set occObjects [$occObjsPage getObjects] - set cmd [list [file join [bu_brlcad_root bin] rtedge] -M -R $otype $fbout -w $width \ + set cmd [list [file join [bu_brlcad_root bin] rtedge] -M -R -F $fb -w $width \ -n $height -V $ar -A 0.9 -p $perspective \ -c "$fgMode" \ -c "set bg=[lindex $nl 0],[lindex $nl 1],[lindex $nl 2]" \ @@ -357,7 +352,7 @@ $::RtWizard::wizard_state(dbFile)] } else { - set cmd [list [file join [bu_brlcad_root bin] rtedge] -M -R $otype $fbout -w $width \ + set cmd [list [file join [bu_brlcad_root bin] rtedge] -M -R -F $fb -w $width \ -n $height -V $ar -A 0.9 \ -c "$fgMode" \ -c "set bg=[lindex $nl 0],[lindex $nl 1],[lindex $nl 2]" \ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |