CC build an output path named "copperlichtdata" where he put all used textures. I want to load a texture (on a click event) that is *in* CC ! In other words, a texture that has been loaded in CC before running !īut finally it seem to be the same problem. do we understand each other Dreamcutter ? 1 feature request, followed by webgl & droid support of ccbSetSceneNodeMaterialProperty ccbSetSceneNodeProperty, Image (2dol) to load eternal textures on action. >But now how can we load a texture that is *in* CC, not in an absolute path.<< Var t = ccbSetSceneNodeMaterialProperty(s, 0, "Texture1", "default_texture.jpg") ? (it does not work here). Not a boolean every time.īut now how can we load a texture that is *in* CC, not in an absolute path. "Value" is the new value of the property. If the path of the image file is correct you change the texture of your item.įinally I don't know why I didn't understand the logical. I used the scene of default that creates CopperCube, I renamed the cube object with the name B1 I created the path to the image file in my harddrive as you have set in the script and everything works.Ĭopy the code then go to Menu CopperCube "Show scripting window" -> delete the contents of the window and paste the code. Var s = ccbGetSceneNodeFromName("B1") var t = ccbSetSceneNodeMaterialProperty(s, 0, "Texture1", "C:\\AllTextures\\default_texture.jpg") It may not work in the coppercube preview. var s = ccbGetSceneNodeFromName("B1") ccbSetSceneNodeMaterialProperty(s, 0,"Texture1","C:\\AllTextures\\default_texture.jpg") Īlso you could try to use this code below and save your. Niko would you mind showing us what is the rigth code for loading a loaded texture (a texture that exist in CC editor) ? And I'm sure C:\\AllTextures\\default_texture.jpg is right path because I tried remplacing "\\" with "\" in the file path and window's explorer found the image.ĬC says "Could not open file or texture" (it seems logical since in ccbSetSceneNodeMaterialProperty(p1, p2,p3,p4) JavaScript Scripting reference says that parameter p4 is a boolean (True or false) not a file path ) Var s = ccbGetSceneNodeFromName("B1") ccbSetSceneNodeMaterialProperty(s, 0,"Texture1","C:\\AllTextures\\default_texture.jpg") ĬcbSetSceneNodeMaterialProperty(s, 0,"Texture1","C:\\AllTextures\\default_texture.jpg") ĭoesn't work here, for me. Var t = ccbSetSceneNodeMaterialProperty(s, 0, "default_texture.jpg", true) "default_texture.jpg" was a loaded texture ! You could get a new texture loaded externally with the function ccbLoadTexture, but this is experimental and might not work perfectly on all platforms well as well. The way you are using it, with strings, might work on some targets (like Windows and Mac OS X), but might not on others (like Flash). Var s = ccbGetSceneNodeFromName("B1") // internal CC's root path var t = ccbSetSceneNodeMaterialProperty(s, 0, "default_texture.jpg", true) // OR a local path with escape char : var t = ccbSetSceneNodeMaterialProperty(s, 0, "C:\\AllTextures\\default_texture.jpg", true) Ĭurrently, this method is intended to be used for setting existing, loaded textures. I have try these lines of codes in a click event/execute javascript (texture "default_texture.jpg" is loaded in CC at runtime (present in CC's editor)), but it didn't work. I need to load a texture in an object (B1 in the attached example Loading a texture on a click event using JS Ambiera Forum > CopperCube > Help with CopperCube
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |