|
Go
![]() |
New
![]() |
Find
![]() |
Notify
![]() |
Tools
![]() |
Reply
![]() |
|
|
Member |
I am loading an object and on load it is calling the following function.. the problem is it loads, it loads the texture, and i see the correct color for a split second before it goes back to the objects base color.
function doneLoading() { vmp.SetProperty('MTSMaterial.colorArea, 'difc', newDIFC); vmp.SetProperty('MTSTimeElem.textureReplace', 'Path', "test.jpg", 'mts_str'); vmp.SetProperty('MTSTimeElem.textureReplace', 'trgr', '1', 'mts_int'); } I thought this was because it wasn't loaded all the way.. but the strange thing is it keeps the new texture, just resets the color. |
||
|
|
Member |
Hi Shawn,
Without seeing the project directly, I'm not sure if this will help, but try re-rendering the scene: function doneLoading() { vmp.SetProperty('MTSMaterial.colorArea, 'difc', newDIFC); vmp.SetProperty('MTSTimeElem.textureReplace', 'Path', "test.jpg", 'mts_str'); vmp.SetProperty('MTSTimeElem.textureReplace', 'trgr', '1', 'mts_int'); vmp.SetProperty('MTSScene','nerd',1,'mts_int'); } Let me know if that by chance helps. If not, we'll figure something else out. |
|||
|
|
Member |
Its almost like when the texture finishes loading it resets the color... is there a way to throw an event when the texture finishes loading?
|
|||
|
|
Member |
Shawn,
I'm a little confused. In your code, it looks like you are setting a new diffuse color as well as assigning a diffuse texture. You cannot have both, only diffuse color or diffuse texture. Could you clarify? |
|||
|
|
Member |
The diffuse color is being applied to the back of the object while the texture is being applied to the front of the object.
I know it can be done because if I look the set diffuse color function up to a button and wait until after it is done loading the texture and everything to click it the diffuse color works fine. |
|||
|
|
Member |
Since it works that way, have you tried waiting until after it is done loading the texture and everything before you call your function in javascript?
|
|||
|
|
Member |
no.. I am not sure how to have the texture throw a done event when it is done loading a new texture.
|
|||
|
|
Member |
When you load the new object using MTSLoadMTX and put an MTXDoneEvent at the end of the loaded object's mtx, it should not post the MTXDoneEvent until the object, textures, and all are finished loading.
If this is not working (or is not the exact way you are loading the object), try using a delay when the object is finished loading (look up "Delay" in the MTX code reference http://developer.viewpoint.com/dc/xml.shtml). Something like this: <MTSInteractor> <MTSHandle Event="myDoneEvent" Action="MTSJavaScript" Func="doneLoading()" Delay="0.4" /> </MTSInteractor> This will delay calling the javascript function that changes the textures for 0.4 seconds. |
|||
|
|
Member |
I did something like that with the javascript delay function... I am just worried that depending on connection speed this could cause problems.
|
|||
|
|
Member |
Shawn,
MTSLoadMTX with MTXDoneEvent should work properly. The MTXDoneEvent should not fire until the new MTX is fully loaded (textures and all). If this is not working, my only suggestions are to use Delay, which you are right could vary depending on CPU speed, or somehow sending me an example that I could debug. Regards |
|||
|
| Powered by Eve Community |
| Please Wait. Your request is being processed... |
|

