|
Go
![]() |
New
![]() |
Find
![]() |
Notify
![]() |
Tools
![]() |
Reply
![]() |
|
|
Member |
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 help |
||
|
|
Member |
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> |
|||
|
|
Member |
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> |
|||
|
|
EnIgMaTiCScOrPioN Member |
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 |
|||
|
|
Member |
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 |
|||
|
|
Member |
Thanks Admin,
I checked the release notes. Problem solved!!! Big smile on my face Thank you again!!! |
|||
|
| Powered by Eve Community |
| Please Wait. Your request is being processed... |
|

