# Emacs, this is -*- Mode: Tcl -*-
#
# sample mopsrc for "The Mops V0.42d"
# last change: 26 Jan 2000
# Usage:
# place this file in your home directory as ".mopsrc"
# (use "mopsrc" on Win32)
# or place it somewhere and let the environment variable
# "MOPSRC" point to it
# e.g. if it lives in /usr/local/lib as mopsrc do a
# tcsh, csh:
# > setenv MOPSRC /usr/local/lib/mopsrc
# or bash, ksh, sh, zsh:
# > export MOPSRC=/usr/local/lib/mopsrc
#
# WinNT users set environment variables using
# Start/Settings/Control-Panel/System/Environment
# The other poor souls (Win95, Win98 users) have to edit
# "c:/autoexec.bat" e.g.:
# SET MOPSRC=C:/mops/mopsrc
# _DO NOT USE BACKSLASHES_

###################################
# Warning: This file parsed by Tcl!
###################################

###################################
# Section 1 - Preferences
###################################
#
# SAVED PREFERENCES OVERRIDE ALL THESE SETTINGS!
# SKIP TO THE END OF THIS FILE AND EDIT THERE
# IF SAVED PREFERENCES EXIST!
#
# changes to the array "prefs" will automagically be applied
# after this file has been processed;
#
# values in the example settings denote the default settings

# where are the button images and the custom objects?
# (the path may be relative to the startup dir of the Mops binary)
# This setting will have no effect if the env var MOPSLIB exists!
#set prefs(MOPSLIB) "/usr/local/lib/mops"

# width of property GUI elements; valid values 0, 1
#set prefs(BorderWidth) 0

# resize main window to property GUI? valid values 0, 1
#set prefs(AutoResize) 1

# how exact is the picking? valid values: 0.0 - DBL_MAX
# 0.0 == best match taken
#set prefs(PickEpsilon) 0.2

# Automatically update the Transformations property
# after interactive modeling actions?
# 1 Yes, 0 No
#set prefs(UpdateTrafo) 1

# what happens if Mops encounters errors?
# 0 Stop, 1 GoOn
#set prefs(OnError) 0

# write view information into scene files?
# 0 No, 1 Yes
#set prefs(SaveViews) 1

# read RiOptions from scene files?
# 0 No, 1 Yes
#set prefs(ReadRiOpt) 1

# file to export RIB's to:
#set prefs(RIBFile) "Scene"

# image to render to:
#set prefs(Image) "RIB"

# resolve all instances, when writing a RIB?
# 0 No, 1 Yes
#set prefs(ResInstances) 0

# check for lights (and add default light if no lights are found)
# when writing a RIB?
# 0 No, 1 Yes
#set prefs(CheckLights) 1

# QuickRender command
# %s denotes filename of RIB
#set prefs(QRender) "rgl -rd 4 %s"

# Render command
# %s denotes filename of RIB
#set prefs(Render) "rendrib -d 4 %s"

# set up new daily tips? 
#set prefs(DailyTips) {{Your site-tip 1 here}{Your site-tip 2 here}}
# if you just want to add tips:
#lappend prefs(DailyTips) {New Tip.}

# where is mops.html?
#set prefs(mopsdoc) ""

# where else should we look for the docs?
#set prefs(docdirs) {}

# how to display the docs?
# "$mopsdoc" will be replaced by the actual path to the docs
#set prefs(docview) {netscape -remote openFile($mopsdoc)}

# if docview fails, which second command can we try?
#set prefs(docview2) {netscape $mopsdoc &}

# where are the shaders?
#set prefs(Shaders) ""

# where will we put temporary files?
# note, that this setting has no effect if The Mops has
# been compiled without -DMOPSHAVETEMPNAM (unlikely, though)
#set prefs(tmpdir) ""
#global tcl_platform
#if { $tcl_platform(platform) == "windows" } {
#  set prefs(tmpdir) "$env(TEMP)"
#} else {
#  set prefs(tmpdir) "/tmp"
#}

# how many temporary files should be kept
# on disk? (valid values: 1-100)
#set prefs(KeepNTmpFiles) 5

# The Geometry of the ToolBox?
# (widthxheight+posx+posy)
#set prefs(toolBoxGeom) ""

# The Geometry of the Main-Window?
# (widthxheight+posx+posy)
#set prefs(mainGeom) ""

# The Geometry of the IDR-Commander?
# (widthxheight+posx+posy)
#set prefs(idrGeom) ""

# Use the wheel of a wheel-mouse to zoom views?
# (does not work on Win32)
# 1 yes, 0 no
#set prefs(zoomWheel) 1

# Write RIBs, that contain only RI standard options and stuff?
# 1 yes, 0 no
#set prefs(RIStandard) 0

# Enable lazy notification?
# (Do no notification while dragging the mouse.)
# 1 yes, 0 no
#set prefs(LazyNotify) 0

# The timeout for the tool tips of the tools window
# in 1000th of a second
#set prefs(balloon) 1500

# What groups should appear in the ToolBox?
# Available Groups are:
# transforms solids crnurb points curves curves2 custom camera misc
# order in list determines order in toolbox from top to bottom
#set prefs(toolBoxList) {transforms solids crnurb points curves curves2 custom camera misc}

# Scripts that should be executed automagically
# after The Mops has been started up completely
#set prefs(scripts) {}

# If your main window is jumping while displaying new
# property GUIs, try to set this to 1.
#set prefs(twmcompat) 0

##################################
# Section 2 - Keyboard Shortcuts
##################################
# Note: In all shortcuts "Ctrl" will be replaced
#       by "Control" for the bind command, automagically.
# Note2: Prettyprint your current hot key configuration
#        using "printHotKeys" from "pphk.tcl".
#
# shortcuts for main window
array set mops_main_sc {
    Quit "Ctrl-q"
    New  "Ctrl-N"
    Replace "Ctrl-l"
    Insert "Ctrl-i"
    SaveAs "Ctrl-S"
    Save "Ctrl-s"
    ExportRIB "Ctrl-E"
    
    Apply "Ctrl-A"

    Copy "Ctrl-c"
    Cut "Ctrl-x"
    Paste "Ctrl-v"

    CopyP "Ctrl-C"
    ICopyP "Ctrl-I"
    PasteP "Ctrl-V"

    Name "Ctrl-n"
    Swap "Ctrl-w"
    Undo "Ctrl-u"

    Help "F1"
    Hide "Ctrl-z"
    SwCon "Shift-Tab"
}

# shortcuts for a view window
array set mops_view_sc {
    Close "Ctrl-w"
    QRender "Ctrl-r"
    Render "Ctrl-R"
    Redraw "Ctrl-d"
    Undo "Ctrl-u"

    Front "Ctrl-f"
    Side "Ctrl-s"
    Top "Ctrl-t"
    Persp "Ctrl-p"
    Trim "Ctrl-T"
    Halve "Ctrl-H"
    Double "Ctrl-D"
    
    RotL "Left"
    RotR "Right"
    RotU "Up"
    RotD "Down"

    ZoomI "KP_Add"
    ZoomO "KP_Subtract"
    
    Wire "Ctrl-W"
    Surf "Ctrl-S"
    Grid "Ctrl-G"
    SGrid "Ctrl-g"
    Light "Ctrl-L"
    Auto "Ctrl-A"
    ZoomTO "Ctrl-o"
}

# shortcuts for object actions
array set mops_oa_sc {
    MoveO "m"
    RotO "r"
    RotA "a"
    ScalX "x"
    ScalY "y"
    ScalZ "z"
    Scal2 "s"
    Scal3 "S"
    Stretch "Alt-s"

    Edit "e"
    EditD "p"
    WeightE "w"
    Select "t"
    DeSelect "D"
    InsertP "i"
    DelP "d"
    SplitC "c"
    FindU "u"

    ScalXW "X"
    ScalYW "Y"
    ScalZW "Z"
}

# shortcuts for view actions
array set mops_va_sc {
    MoveV "v"
    RotV "R"
    ZoomV "o"
    Break "Escape"
    MoveVButton "3"
    ZoomVButton "2"
}


##################################
# Section 3 - Load Custom Objects
##################################
if { [file exists ~/shelly/src/shell.so] } { lc ~/shelly/src/shell.so }

##################################
# Section 4 - Handy Procedures
##################################

##################################
# reverseOrder
# revert the order of the selected
# objects
proc reverseOrder { } {

 set sel [.fu.fMain.fHier.flb.li curselection]

 set ops [expr int([llength $sel] / 2)]

 while { $ops > 0 } {
     incr ops -1
     setSelect
     updateMopsSelect
     setSelect [lindex $sel $ops] [expr [llength $sel] - $ops]
     swapOb
 }


 return;
}

##################################
# el - EasyLight
# a handy little procedure (to be called from the console)
# creates a distant light at 10,10,10
proc el { } {
 setSelect
 crtOb light
 updateMopsSelect
 .fu.fMain.fHier.flb.li selection set end
 setSelect [.fu.fMain.fHier.flb.li curselection]
 upvar #0 lightShaderData lSD
 set lSD(ArgNames) {intensity lightcolor from to}
 set lSD(ArgTypes) {float color point point}
 set lSD(Name) distantlight
 set lSD(dummy) 0
 set lSD(from_X) 10.0
 set lSD(from_Y) 10.0
 set lSD(from_Z) 10.0
 set lSD(intensity) 1.0
 set lSD(lightcolor_A) 0
 set lSD(lightcolor_B) 255
 set lSD(lightcolor_G) 255
 set lSD(lightcolor_R) 255
 set lSD(to_X) 0.0
 set lSD(to_Y) 0.0
 set lSD(to_Z) 0.0
 setSProp light lightShaderData
 updateMopsSelect
 redrawAllViews
 return;
}

##################################
# deColorTree - decolor a sub tree
# of objects
proc deColorTree { } {

 forAll 1 {
 global attrPropData
 getAttrProp
 set attrPropData(Color_R) -1
 setAttrProp
 }

 redrawAllViews
 return;
}

##################################
# squashNCXY - squash all
# coordinates of all selected
# NCurves to XY plane
proc squashNCXY { } {
    forAllT NURBCurve 0 {
	uplevel #0 {
	    getNCAttrProp
	    for {set i 0} { $i < $ncattrPropData(Length)} {incr i} {
		getNCPoint $i x y z w; setNCPoint $i $x $y 0.0 $w
	    }
	}
    }
 redrawAllViews
}

##################################
# appendNCP
# append a point to a NURB curve
proc appendNCP { } {
    forAllT NURBCurve 0 {
	uplevel #0 {
	    getNCAttrProp
	    incr ncattrPropData(Length)
	    setNCAttrProp
	    getNCAttrProp
	    # the new point is now between old point #1 and #2
	    # we have to "shuffle" it through the old points to the end
	    set i 1
	    while { $i < [expr $ncattrPropData(Length)-1] } {
		getNCPoint [expr $i+1] x y z w
		setNCPoint $i $x $y $z $w
		incr i
	    }
	    # now we can displace the last point
	    getNCPoint [expr $ncattrPropData(Length)-3] x1 y1 z1 w1
	    getNCPoint [expr $ncattrPropData(Length)-2] x y z w
	    setNCPoint [expr $ncattrPropData(Length)-1] [expr $x+($x-$x1)]\
		    [expr $y+($y-$y1)] [expr $z+($z-$z1)] $w
	
	}
    }
 redrawAllViews
}

##################################
# Section 5 - Miscellaneous
##################################

# uncomment the following line to reduce
# the precision Tcl handles doubles
#set tcl_precision 6


# saved preferences follow, do not modify or delete this line!
