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?
 
Scriptquestion camera and viewport

Scriptquestion camera and viewport

2005-05-19       - By Guillaume Laforge

 Back
Reply:     1     2     3     4     5  

Here it is :
//switch_two_cams.js
//Guillaume Laforge 05-2005

var oRoot = ActiveProject.ActiveScene.Root

// your two cameras you want to switch
var cam1 = oRoot.findChild("Camera_1")
var cam2 = oRoot.findChild("Camera_2")

//The current camera in viewport b
var oVM = Application.Desktop.ActiveLayout.Views( "vm" ) ;
oCurent_Cam = oVM.GetAttributeValue ("activecamera:b") ;

//The switch
if( oCurent_Cam == cam1.Name <http://cam1.Name>)
{
oVM.SetAttributeValue ("activecamera:b", cam2.Name <http://cam2.Name>) ;
}
if( oCurent_Cam == cam2.Name <http://cam2.Name>)
{
oVM.SetAttributeValue ("activecamera:b", cam1.Name <http://cam1.Name>) ;
}
Cheers,
Guillaume Laforge
CG artist
www.vol2nuit.fr <http://www.vol2nuit.fr>


2005/5/19, Rob Wuijster <rob@(protected)>:
>
> Hi,
>  Just a quick question here:
>  How can I script switching a camera in a certain viewport. Say viewport
> B, switching from cam1 to cam2.
> I found a SetValue "Views.ViewX" statement but that doesn't work... Still
> trying to grasp scripting here...
>  cheers,
>  rob wuijster
> s-5 multimedia
> holland
>

<div>Here it is :</div>
<div>&nbsp;</div>
<div><font size="2">//switch_two_cams.js</font></div>
<div><font size="2">//Guillaume Laforge 05-2005&nbsp;</font></div>
<p>var oRoot = ActiveProject.ActiveScene.Root</p>
<p>// your two cameras you want to switch<br>var cam1 = oRoot.findChild(&quot
;Camera_1&quot;)<br>var cam2 = oRoot.findChild(&quot;Camera_2&quot;)</p>
<p>//The current camera in viewport b<br>var oVM = Application.Desktop
.ActiveLayout.Views( &quot;vm&quot; ) ;<br>oCurent_Cam = oVM.GetAttributeValue (
&quot;activecamera:b&quot;) ;</p>
<p>//The switch<br>if( oCurent_Cam == <a href="http://cam1.Name">cam1.Name</a>)
<br>{<br>oVM.SetAttributeValue (&quot;activecamera:b&quot;, <a href="http://cam2
.Name">cam2.Name</a>) ;<br>}<br>if( oCurent_Cam == <a href="http://cam2.Name">
cam2.Name</a>)<br>{<br>oVM.SetAttributeValue (&quot;activecamera:b&quot;, <a
href="http://cam1.Name">cam1.Name</a>) ;<br>}</p>
<div>Cheers,</div>
<div>&nbsp;</div>
<div>Guillaume Laforge</div>
<div>CG artist</div>
<div><a href="http://www.vol2nuit.fr">www.vol2nuit.fr</a></div>
<div><br><br>&nbsp;</div>
<div><span class="gmail_quote">2005/5/19, Rob Wuijster &lt;<a href="mailto:rob
@(protected)">rob@(protected)</a>&gt;:</span>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0
.8ex; BORDER-LEFT: #ccc 1px solid">
<div><span><font face="Arial" size="2">Hi,</font></span></div>
<div><span><font face="Arial" size="2"></font></span>&nbsp;</div>
<div><span><font face="Arial" size="2">Just a quick question here:</font></span
></div>
<div><span><font face="Arial" size="2"></font></span>&nbsp;</div>
<div><span><font face="Arial" size="2">How can I script switching a camera in a
certain viewport. Say viewport B, switching from cam1 to cam2.</font></span><
/div>
<div><span><font size="2"><font face="Arial">I found a SetValue &quot;Views
.ViewX&quot; statement but that doesn't work... Still trying to grasp scripting
here...</font></font></span></div>
<div><span><font face="Arial" size="2"></font></span>&nbsp;</div>
<div><span><font face="Arial" size="2">cheers,</font></span></div><span class=
"sg">
<div>&nbsp;</div>
<div align="left"><font face="Arial" size="2">rob wuijster</font></div>
<div align="left"><font face="Arial" size="2">s-5 multimedia</font></div>
<div align="left"><font face="Arial" size="2">holland</font></div>
<div align="left"><font face="Arial" color="#ffffff" size="2"></font>&nbsp;<
/div>
<div>&nbsp;</div></span></blockquote></div><br>