Community Tip - Visit the PTCooler (the community lounge) to get to know your fellow community members and check out some of Dale's Friday Humor posts! X
Hi,
I read this article (here) and try it on my project, but it doesn't work.
Whatever texture changed, it didn't show difference.
I uploaded two pictures (sea and forest for test).
Then use this script to change texture and shader.
$scope.init = function(){
//$scope.setWidgetProp('model-1', 'texture', 'app/resources/Uploaded/sea.jpg?name=tex0&edge=repeat');
$scope.setWidgetProp('model-1', 'texture', 'app/resources/Uploaded/forest.jpg?name=tex0&edge=repeat');
$scope.setWidgetProp('model-1', 'shader', 'reflect;mixer f 0.5');
};
angular.element(document).ready($scope.init);
In runtime, it look like that.
Did I miss something?
Solved! Go to Solution.
Hello,
I think it must be a model-item you apply a texture on, not a model.
//Per
Use timeout function
//This applies shader to certain model items. Make sure you have a model item defined!
$timeout(function() {
$scope.view.wdg['wheel']['texture'] = "app/resources/Uploaded/MyImage.jpg?name=tex0&edge=repeat";
$scope.view.wdg['wheel']['shader'] = "reflect;mixer f 0.5";
} ,50);
Hi Suraj_Patil,
Thank you for replay,
I changed script and try difference timeout value but not work either.
Script:
$scope.init = function(){
$timeout(function() {
//$scope.setWidgetProp('model-1', 'texture', 'app/resources/Uploaded/sea.jpg?name=tex0&edge=repeat');
$scope.setWidgetProp('model-1', 'texture', 'app/resources/Uploaded/forest.jpg?name=tex0&edge=repeat');
$scope.setWidgetProp('model-1', 'shader', 'reflect;mixer f 0.5');
} ,500);
console.log($scope.app.view['Home'].wdg['model-1']);
};
angular.element(document).ready($scope.init);
Hello,
I think it must be a model-item you apply a texture on, not a model.
//Per
Hi Pandersson,
Yes, you are right.
I use the model and it is mistake.
Need to use Model Item to apply texture and shader.
Thank you so much.