Mailing List
Home
Forum Home
Softimage
Carrara
trueSpace
Dir3d-l
Maya - a powerful 3D animation and visual effects software
Macromedia Flash Development
Subjects
Cameras
scaleDown command
black out solved
Aircraft Tutorial
Mathematical XYZ ?
Its done This vs That
Its done first week
recommendations for screen video captures?
3DExplorer "Oddity "
New Director
ProTeam renewals
Fuel 's new websites (X post)
Blue peter create a make toy
targeting groups question
XPost: Shockwave 3D game ( sort of )
RES: RES: RES: Fish Modeling
Emitting particles from object intersection
Fuel 's new websites (X post)
Texturing
Big Break Contest Videos
New Plugins
Models and Texture on my updated site
Error Installing Patch tS6 6
Plasma?
Looking for Inspiration
Weird EMail Q
It 's done first week ?
Cherry not cranberry
New game
Camera Animation Problem
Particle plugins?
 
Viewport scripting

Viewport scripting

2005-05-17       - By Alain Laferrière

 Back
Reply:     1     2     3     4     5  

Hi Patrick,

Although there is no native support for this currently, a possible work-around
would be to expand on the method which I implemented in Xgs_Slate : this is a
XGS ( XSI Graphic Synthesizer ) plugin, which gets evaluated on a per-view
basis to display custom information in 3D views.

The plugin's source code shows how to detect the view for which the plugin is
evaluated, as well as how to get the view OpenGL dimensions and current camera
( used for formatting text to be displayed ).

To achieve what you're interested in :
- take Xgs_Slate, strip out all the code that draws on screen
- use the Execute function to get the view dimensions and camera and store in a
global array ( for all views )
- add a custom command handler to implement your command ( e.g.
"GetViewCameraUnderMouse" )
- "GetViewCameraUnderMouse" command implementation :
  - get current mouse coordinates
  - compare mouse coordinates with all views ( in global array ) ; detect
which view ( if any ) is under the mouse
  - return the view camear name or "None"

You can find the source code for Xgs_Slate on http://www.softimage.com/xsinet.

I suggest you also look at the source code of XSI_UserNormalEditing, for an
example of getting the mouse coordinates and implementing custom commands in a
C++ plugin.

I hope this helps,
Alain



__ ____ ____ ____ ____ ____ ____

  From: owner-xsi@(protected) [mailto:owner-xsi@(protected)] On Behalf Of
Rafe Sacks
  Sent: Tuesday, May 17, 2005 8:03 AM
  To: XSI@(protected)
  Subject: Re: Viewport scripting
 
 
  Hi Patrick,
 
 
  I don't think it is possible to know over what the mouse is "hovering" in XSI.
 
  If you find a way, let me know!!
 
 
 
  --
 
  __ ____ ____ ____ ____ ____ ____
  R A F E   S A C K S
  Lead Character TD - Technical
  Animal Logic Film
  +612  9383 - 4800
 
 
 
 
 


  Patrick Boucher wrote:
 

    Hey all,
   
       Is it possible to know, through scripting, which viewport the mouse is
over and what is in that viewport? I'd have to get to the camera that is
displayed in a viewport.
   
    Many thanks,
   
   


 
 


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE></TITLE>
<META http-equiv=Content-Type content="text/html; charset=iso-8859 (See http://iso-8859.ora-code.com)-1">
<META content="MSHTML 6.00.2900.2180" name=GENERATOR></HEAD>
<BODY text=#000000 bgColor=#ffffff>
<DIV dir=ltr align=left><FONT color=#0000ff size=2><SPAN
class=741564404-17052005>Hi Patrick,</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2><SPAN
class=741564404-17052005></SPAN></FONT>&nbsp;</DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2><SPAN
class=741564404-17052005>Although there is no native support for this currently
,
a possible work-around would be to expand on the method which I implemented in
Xgs_Slate : this is a XGS ( XSI Graphic Synthesizer ) plugin, which gets
evaluated on a per-view basis to display custom&nbsp;information in 3D
views.</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2><SPAN
class=741564404-17052005></SPAN></FONT>&nbsp;</DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2><SPAN
class=741564404-17052005>The plugin's source code shows how to detect the view
for which the plugin is evaluated, as well as how to get the view OpenGL
dimensions and current camera&nbsp;( used for formatting text to be displayed
).</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2><SPAN
class=741564404-17052005></SPAN></FONT>&nbsp;</DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2><SPAN
class=741564404-17052005>To achieve what you're interested in
:</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2><SPAN
class=741564404-17052005>- take Xgs_Slate, strip out all the code that draws on
screen</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2><SPAN
class=741564404-17052005>- use the Execute function to get the view dimensions
and camera and store in a global array ( for all views )</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2><SPAN
class=741564404-17052005>- add a custom command handler to implement&nbsp;your
command ( e.g.&nbsp;"GetViewCameraUnderMouse" )</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2><SPAN
class=741564404-17052005>- "GetViewCameraUnderMouse" command implementation
:</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2><SPAN
class=741564404-17052005>&nbsp;&nbsp; - get current mouse
coordinates</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2><SPAN
class=741564404-17052005>&nbsp;&nbsp;&nbsp;- compare mouse coordinates with all
views ( in global array ) ; detect which view ( if any ) is under the
mouse</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2><SPAN
class=741564404-17052005>&nbsp;&nbsp; - return the view camear name or
"None"</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2><SPAN
class=741564404-17052005></SPAN></FONT>&nbsp;</DIV>
<DIV dir=ltr align=left><FONT><SPAN class=741564404-17052005></SPAN></FONT>
<FONT
color=#0000ff size=2><SPAN class=741564404-17052005>You can find the source
code
for Xgs_Slate on <A
href="http://www.softimage.com/xsinet">http://www.softimage.com/xsinet</A>.<
/SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2><SPAN
class=741564404-17052005></SPAN></FONT>&nbsp;</DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2><SPAN
class=741564404-17052005>I suggest you also look at the source code of
XSI_UserNormalEditing, for an example of getting the mouse coordinates and
implementing custom commands in a C++ plugin.</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2><SPAN
class=741564404-17052005></SPAN></FONT>&nbsp;</DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2><SPAN
class=741564404-17052005>I hope this helps,</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2><SPAN
class=741564404-17052005>Alain</SPAN></FONT></DIV><FONT color=#0000ff
size=2></FONT><BR>
<BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px">
 <DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left>
 <HR tabIndex=-1>
 <FONT face=Tahoma size=2><B>From:</B> owner-xsi@(protected)
 [mailto:owner-xsi@(protected)] <B>On Behalf Of </B>Rafe
 Sacks<BR><B>Sent:</B> Tuesday, May 17, 2005 8:03 AM<BR><B>To:</B>
 XSI@(protected)<BR><B>Subject:</B> Re: Viewport
 scripting<BR></FONT><BR></DIV>
 <DIV></DIV><SMALL><FONT face="Helvetica, Arial, sans-serif" color=#000099>Hi
 Patrick,<BR><BR><BR>I don't think it is possible to know over what the mouse
 is "hovering" in XSI.<BR><BR>If you find a way, let me
 know!!</FONT></SMALL><BR><BR><BR>
 <DIV class=moz-signature>-- <BR>
 <META content="Rafe Sacks" name=author><PRE wrap=""><SMALL><FONT face=
"Century Gothic"><FONT color=#000066><FONT color=#000066><FONT style="COLOR: rgb
(192,192,192)" color=#c0c0c0><SPAN style="FONT-FAMILY: helvetica,arial,sans
-serif"></SPAN></FONT></FONT></FONT></FONT></SMALL><SPAN style="COLOR: rgb(204
,204,204); FONT-FAMILY: helvetica,arial,sans-serif"><SMALL><BIG><SMALL><FONT
face="Century Gothic"><SMALL><SPAN style="FONT-FAMILY: helvetica,arial,sans
-serif"></SPAN></SMALL></FONT></SMALL></BIG></SMALL></SPAN><SPAN style="COLOR:
rgb(102,102,102); FONT-FAMILY: helvetica,arial,sans-serif"><SPAN style="COLOR:
rgb(153,153,153)"><SPAN style="FONT-FAMILY: helvetica,arial,sans-serif"><SPAN
style="COLOR: rgb(102,102,102); FONT-FAMILY: helvetica,arial,sans-serif"><SMALL
><FONT color=#000066><FONT color=#000066><FONT style="COLOR: rgb(204,204,204)"
color=#c0c0c0>__ ____ ____ ____ ____ ____ ____</FONT>
</FONT></FONT><FONT style="FONT-FAMILY: helvetica,arial,sans-serif"><FONT color
=#000066><SMALL><SMALL><FONT color=#666666><BIG><FONT color=#000066><BIG><BIG>
<SMALL style="FONT-WEIGHT: bold">R A F E   S A C K S</SMALL><SPAN style="FONT
-WEIGHT: bold"></SPAN></BIG>
</BIG></FONT></BIG></FONT></SMALL></SMALL></FONT></FONT></SMALL><SMALL style=
"COLOR: rgb(153,153,153)"><BIG><SMALL><SMALL><SPAN style="COLOR: rgb(192,192,192
)">Lead Character TD - Technical</SPAN>
<SPAN style="COLOR: rgb(192,192,192)">Animal Logic Film</SPAN>
<SPAN style="COLOR: rgb(192,192,192)">+612  9383 - 4800</SPAN>



</SMALL></SMALL></BIG></SMALL></SPAN></SPAN></SPAN></SPAN><SPAN style="COLOR:
rgb(102,102,102); FONT-FAMILY: helvetica,arial,sans-serif"><SMALL style="COLOR:
rgb(153,153,153)"><BIG><SMALL><FONT face="Century Gothic"><SMALL><SPAN style=
"FONT-FAMILY: helvetica,arial,sans-serif">
</SPAN></SMALL></FONT></SMALL></BIG></SMALL></SPAN></PRE></DIV><BR><BR>Patrick
 Boucher wrote:<BR>
 <BLOCKQUOTE cite=mid4288CD4D.1050108@(protected) type="cite">Hey all,
   <BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;Is it possible to know, through scripting,
   which viewport the mouse is over and what is in that viewport? I'd have to
   get to the camera that is displayed in a viewport. <BR><BR>Many thanks,
   <BR><BR></BLOCKQUOTE><BR>
 <DIV class=moz-signature><PRE wrap=""><SPAN style="COLOR: rgb(102,102,102);
FONT-FAMILY: helvetica,arial,sans-serif"><SMALL style="COLOR: rgb(153,153,153)"
><BIG><SMALL><FONT face="Century Gothic"><SMALL><SPAN style="FONT-FAMILY:
helvetica,arial,sans-serif">
</SPAN></SMALL></FONT></SMALL></BIG></SMALL></SPAN></PRE></DIV></BLOCKQUOTE><
/BODY></HTML>