Moderators: e_phoenix13
Go
New
Find
Notify
Tools
Reply
  
-star Rating Rate It!  Login/Join 
Member
Posted
Hi Admin,

I did a small test, link shown below,
http://www.gtnconcept.com/mms9402/kai/cube_mod/cube_1.htm

User can type into values to change the apparence of the object (xscale and opacity) and get feedback when they drag the object.
The problem is I can not change the opacity.

What's wrong with my code?

Thanks for your helpSmile
 
Posts: 181 | Registered: January 24, 2003Reply With QuoteEdit or Delete MessageReport This Post
Member
Posted Hide Post
HTML CODE:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<script language="javascript" src="MTS3Interface.js"></script>
<script language="javascript">
<!--

var vmp; //This global variable is for the VET content

var a="";

var b="";

function Resize()
{
var value = document.getElementById('size').value;
if (value !='')
{
vmp.ExecuteVETScript("MTSInstances.Cube.Scale.x="+value+";");

a=vmp.GetProperty("MTSScene.MTSInstance.Cube", 'Scale.x');

alert(a);

}
else alert("Invalid or blank size value");
}



function Changeop()
{
var value = document.getElementById('opac').value;
if (value !='')
{
vmp.ExecuteVETScript("MTSInstances.Cube.Opacity="+value+";");

b=vmp.GetProperty("MTSScene.MTSInstance.Cube", 'Opacity');

alert(b);

}
else alert("Invalid or blank size value");
}



//-->


</script>
</head>

<body>
<script language="javascript">
vmp = new MTSPlugin("cube.mtx", 400, 400, "", "simple",'');
</script>

<form>
<input type="text" name="size" />
<input type="button" name="CubeResize" value="Resize" onclick="javascript:Resize();"/>

<input type="text" name="opac" />
<input type="button" name="Change Opacity" value="Changeop" onclick="javascript:Changeop();"/>


</form>

</body>
</html>
 
Posts: 181 | Registered: January 24, 2003Reply With QuoteEdit or Delete MessageReport This Post
Member
Posted Hide Post
MTX CODE:

<?xml version="1.0"?>
<MTSScene Version="330" >

<MTSSceneParms Scale="0.1" RenderMode="LightTexture" BlendShadow="1" EdgeBias="1" SortRule="0" ActiveCamera="MtsRuntimeCamera" />

<MTSCamera Name="MtsRuntimeCamera" CameraRotateMin="-90 -180 0" CameraRotateMax="90 180 180" CameraScaleMin="1 1 1" CameraScaleMax="1 1 1" OrbitDist="5" >
<Rotate x="30" y="-332" z="0" />
<Pivot x="0" y="0.55573" z="0" />
<ViewLocation x="0" y="0" z="4" />
</MTSCamera>

<MTSInstance Name="Cube" >
<MTSGeometry Name="MTSSimple_0" MultiUV="0" Type="MTSCube"/>


<MTSInstance Name="Layer2D_scale" >
<LayerData Text="ini" Name="text_s" DstPin="30.000000 30.000000" Font="Arial" TextColor="0 0 0" TextSize="16" Shadow="0" Center="0 0 0" AnchorWidget="1" WidgetLine="0" AlwaysVisible="1" />
</MTSInstance>

<MTSInstance Name="Layer2D_opacity" >
<LayerData Text="ini" Name="text_o" DstPin="80.000000 30.000000" Font="Arial" TextColor="0 0 0" TextSize="16" Shadow="0" Center="0 0 0" AnchorWidget="1" WidgetLine="0" AlwaysVisible="1" />
</MTSInstance>
</MTSInstance>


<MTSAction Name="drag">
<MTSDrag Target="MTSInstance.Cube"/>
<MTSCopyProperty Src="MTSInstance.Cube.Scale.x" Dest="text_s::text"/>
<MTSCopyProperty Src="MTSInstance.Cube.Opacity" Dest="text_o::text"/>
</MTSAction>


<MTSInteractor Name="interact_with_bill">
<Target Name="MTSInstance.Cube"/>
<MTSHandle Event="MouseDrag" Action="drag"/>
</MTSInteractor>


<MTSTimeElem Type="VETScriptInterpreter"/>
</MTSScene>
 
Posts: 181 | Registered: January 24, 2003Reply With QuoteEdit or Delete MessageReport This Post
EnIgMaTiCScOrPioN
Member
Picture of e_phoenix13
Posted Hide Post
Hey Dude,

To answer your question here and other places in the forums, try refering the XML code reference available at the Viewpoint Developer Central...
http://developer.viewpoint.com/dc/xml.shtml

I am sure you would have many questions answered.

Cheers,
Anup
 
Posts: 557 | Location: India | Registered: February 12, 2003Reply With QuoteEdit or Delete MessageReport This Post
Member
Picture of Admin
Posted Hide Post
You are doing vmp.ExecuteVETScript but you don't have any VETScript in the mtx. You have a VETScriptInterpreter defined in the MTX, but no VETScript code or VETScript function in the MTX which is what ExecuteVetScript is intended for.

Please refer to the VETScript documentation in the VMP 3.3.0.29 release notes pdf to learn how to insert VETScript in your MTX file.

Regards
 
Posts: 1188 | Registered: January 08, 2003Reply With QuoteEdit or Delete MessageReport This Post
Member
Posted Hide Post
Thanks Admin,

I checked the release notes.
Problem solved!!!

Big smile on my faceSmile
Thank you again!!!
 
Posts: 181 | Registered: January 24, 2003Reply With QuoteEdit or Delete MessageReport This Post
  Powered by Eve Community