Notifications
Clear all
[Closed] mousetrack question
Sep 08, 2015 2:48 am
----------------------------------------------------------------------------------------
-- Script Name: AlignObjectToFace
-- Version: v0.12
-- Started: 04/29/2001
-- Last Modified: 04/30/2001
-- Description: Mouse Tool similar to Autogrid, but for existing objects.
-- Documentation: Visit http://www.gfxcentral.com/bobo/mxs4/alignobject2face
-- Code by: Borislav Petrov [Boboland] [email]bobo@email.archlab.tuwien.ac.at[/email]
-- Martin Breidt [email]martin@breidt.net[/email]
--
-- Ideas by: Martin Coven, Adrian Tysoe, Martin Breidt, Borislav Petrov
----------------------------------------------------------------------------------------
-- NOTE! This tool CANNOT be used from a Quad Menu!!!
-- Please use as Keyboard Shortcut or Toolbar icon only!
----------------------------------------------------------------------------------------
-- on isVisible return (selection.count == 1)
-- on isEnabled return (selection.count == 1)
-- on Execute do
-- (
global AO2F_object_to_align = $
format "Align Object % - Please Pick Surface To Align To...
" AO2F_object_to_align.name
--global AO2F_surface_obj = pickobject filter:filter_geometry
--format "Aligning Object % to %
" AO2F_object_to_align.name AO2F_surface_obj.name
global AO2F_Original_TM = AO2F_object_to_align.transform
global anothersurface = ::collectSurfaceUnder()
global theTimer = dotNetObject "System.Windows.Forms.Timer"
fn filter_geometry obj = superclassof obj == GeometryClass and classof obj != TargetObject
fn collectSurfaceUnder =
(
local theArr=#()
wray = mapScreenToWorldRay mouse.pos
inodes = intersectRayScene wray
inodes = for obj in inodes where not obj[1].ishiddenInVpt collect obj[1]
if inodes.count!=0 do
(
theArr=inodes
)
theArr
)
fn get_normal_function msg ir obj faceNum shift ctrl alt =
(
if msg == #freeMove then
(
if ir != undefined then
(
AO2F_object_to_align.pos = ir.pos
AO2F_object_to_align.dir = ir.dir
-- Addition by Martin Breidt
--if ctrl then in coordsys local (rotate AO2F_object_to_align (eulerangles 90 0 0))
--if alt then in coordsys local (rotate AO2F_object_to_align (eulerangles 0 90 0))
--if shift then AO2F_object_to_align.dir *= -1
-- End Addition
anothersurface = collectSurfaceUnder()
print anothersurface
return #continue
)
else
(
return #continue
)
)
if msg == #mouseAbort then
(
AO2F_object_to_align.transform = AO2F_Original_TM
format "Align Object To Face Aborted!
"
return #end
)
if msg != #mousePoint then
(
return #continue
)
else
(
format "Align Object To Face Finished.
"
return #end
)
)--end fn
fn startPainting =
(
thwSurf=collectSurfaceUnder()
a = mouseTrack on:thwSurf trackCallBack:get_normal_function
)
-- )--end on
startPainting()
note : script credit to bobo
is there any way to make mousetrack on: (suppose node for surface) here update on the fly ? Like when my mouse point near object [ex:box] the on: here update and use those object under the mouse instead the one I defined first.
Thanks