Buttons change texture on object  - got a script now what ?

I'm newbie on Javascript and I'm trying to figure out this script that was posted by Michael Kreutz on this forum ;
---- This is the script that is used on the 3D object -----
//##### changeDiffuseTexture #####
function changeDiffuseTexture() {
textureRes = new Resource("pdf://yourTexture.jpg");
textureImg = new Image(textureRes);
//#### if you want to call the mesh by index #####
objectMaterial = scene.meshes.getByIndex(0).material;
//##### if you want to call the mesh by name instead of index #####
//objectMaterial = scene.meshes.getByName("theMeshsName").material;
objectMaterial.diffuseTexture.setImage(textureImg);
---- This is the script that is used on the button ----
getAnnots3D(0)[0].context3D.changeDiffuseTexture();
I'm making a proof of concept to show this (future) client the possibilities of 3D pdf.
I show a 3D object and besides the 3D object are several buttons that change the texture of the 3D object.
This 3D object has 2 materials ; one is just diffuse color and the other one has a UVmap on the diffuse map.
So when one clicks on a button the script should load up the correct UVdiffusemap-image.
I use this plugin to attach the resource images for the UVmap
http://www.graysonlang.com/Attach3DResource.api
Now for the question part :)
** When I apply the "getbyindex" version and click a button it replaces the diffusecolor part of the object with the image, instead of the UVmap part - how can I tell javascript to look for my UVmap .. in other words where can I see what the index of this material is -> I've tried changing the numbers in both scripts but that didn't do it !
The "getbyname" didn't do anything -> where can I see the name of the UVmap part ?
** How can I apply the different images to the different buttons ? Or should I do this in the .js-file that is attached to the 3D object ?
** Is there a way to make the change of texture realtime - without first having to click on the 3D-window ? That is what happens now when the texture of the diffusecolor part changes !
Any hint is welcome -
K.

I'm newbie on Javascript and I'm trying to figure out this script that was posted by Michael Kreutz on this forum ;
---- This is the script that is used on the 3D object -----
//##### changeDiffuseTexture #####
function changeDiffuseTexture() {
textureRes = new Resource("pdf://yourTexture.jpg");
textureImg = new Image(textureRes);
//#### if you want to call the mesh by index #####
objectMaterial = scene.meshes.getByIndex(0).material;
//##### if you want to call the mesh by name instead of index #####
//objectMaterial = scene.meshes.getByName("theMeshsName").material;
objectMaterial.diffuseTexture.setImage(textureImg);
---- This is the script that is used on the button ----
getAnnots3D(0)[0].context3D.changeDiffuseTexture();
I'm making a proof of concept to show this (future) client the possibilities of 3D pdf.
I show a 3D object and besides the 3D object are several buttons that change the texture of the 3D object.
This 3D object has 2 materials ; one is just diffuse color and the other one has a UVmap on the diffuse map.
So when one clicks on a button the script should load up the correct UVdiffusemap-image.
I use this plugin to attach the resource images for the UVmap
http://www.graysonlang.com/Attach3DResource.api
Now for the question part :)
** When I apply the "getbyindex" version and click a button it replaces the diffusecolor part of the object with the image, instead of the UVmap part - how can I tell javascript to look for my UVmap .. in other words where can I see what the index of this material is -> I've tried changing the numbers in both scripts but that didn't do it !
The "getbyname" didn't do anything -> where can I see the name of the UVmap part ?
** How can I apply the different images to the different buttons ? Or should I do this in the .js-file that is attached to the 3D object ?
** Is there a way to make the change of texture realtime - without first having to click on the 3D-window ? That is what happens now when the texture of the diffusecolor part changes !
Any hint is welcome -
K.

Similar Messages

  • I recently did the iOS 7.0.2 update, now I'm unable to purchase apps. "App could not be purchased at this time. Please try again later. ". I have tried a few of the suggestions and nothing has worked. Reset,change auto lock time on main screen, now what??

    I recently did the iOS 7.0.2 update, now I'm unable to purchase apps. "App could not be purchased at this time. Please try again later. ". I have tried a few of the suggestions and nothing has worked. Reset,change auto lock time on main screen, change language setting. Now what???

    This sorted it for me:
    Backup your iPhone to iCloud (I believe backing up to iTunes will work too). Now go to "Settings --> General --> Reset --> Erase All Content and Settings" to completely restore your iPhone to factory settings. Assuming you've backed up to iCloud, you'll be asked when setting up your iPhone if you want to restore from an iCloud backup. Choose that option and once your iPhone has restored itself from your backup, this annoying problem will finally be gone! (was for me anyway).
    To restore from an iTunes backup, connect your iPhone to your computer, load iTunes. Click the File menu and select Devices > Restore from Back up.

  • Got the .jar now what?

    i have a GUI application...i used the deployment wizard
    got the .jar file ...now what in the world do i do with
    the .jar file???

    try:
    c:\JBuilder\bin\java -jar port1.jar port.classi think you have forgotten one "\" between the path and the java exe :-)
    I think you should also try to see if the manifest file inside the jar is correctly created. if not the jar file will not work as an executable file. You can search through the forums with "jar executable" to find more information about it.
    Hope this helps.
    Zerjillo

  • Computer keeps getting folder with a question mark (?) I changed the HD and the SATA cable, now what?

    The problem started when my computer was having problems reading the HD by slowing down and freezing. The Apple Genius told me the computer needed a new HD, and that it would cost $228 to replace it through them. I opted out and purchased a Hd myself and installed it. Everything was good for about two months until one day the screen went black and I smelled something burning on my Mac, yes like fire. Upon inspection I found the burning smell came from the middle of the SATA cable and that it shorted. I ordered a new cable from Hong Kong that took 22 days to get here. It still does not read the HD. I tried a SATA cable from a 2011 MacBook that still works (had to stretch it a little but still connected) I also tried the previous HD that was in there and two other HD from 2 different MacBooks that are still functional. Nothing worked. Is my motherboard toast as a result of the SATA cable dying? The computer reads an external drive, however, and can boot into time machine. The cable, btw had been receiving physical damage from the case when the MacBook lost its little black feet. This is where it fried as the section that had marks from the case melted the plastic right underneath.

    Prep your new drive:
    Drive Preparation
    1. Boot from your OS X Installer Disc. After the installer loads select your language and click on the Continue button.  When the menu bar appears select Disk Utility from the Utilities menu.
    2. After DU loads select your hard drive (this is the entry with the mfgr.'s ID and size) from the left side list. Note the SMART status of the drive in DU's status area.  If it does not say "Verified" then the drive is failing or has failed and will need replacing.  SMART info will not be reported  on external drives. Otherwise, click on the Partition tab in the DU main window.
    3. Under the Volume Scheme heading set the number of partitions from the drop down menu to one. Click on the Options button, set the partition scheme to GUID (for Intel Macs) or APM (for PPC Macs,) then click on the OK button. Set the format type to Mac OS Extended (Journaled.) Click on the Partition button and wait until the process has completed.
    4. Select the volume you just created (this is the sub-entry under the drive entry) from the left side list. Click on the Erase tab in the DU main window.
    5. Set the format type to Mac OS Extended (Journaled.) Click on the Security button, check the button for Zero Data and click on OK to return to the Erase window.
    6. Click on the Erase button. The format process can take up to several hours depending upon the drive size.
    After formatting has completed quit DU and return to the installer. Install OS X.

  • HT5312 I got mixed up, now what do I do? I forgot the answer to my security questions

    How can I reset my security questions?

    See Here > Apple ID: Contacting Apple for help with Apple ID account security
              Ask to speak with the Account Security Team...
    Or Email Here  >  Apple  Support  iTunes Store  Contact
    More Info >  Apple ID: All about Apple ID security questions
    Note:
    You can only set up and/or change a Rescue Email BEFORE you forget the questions/answers.

  • Got my NANO, now what?

    I just came back from the SF Apple store where i bought my 4 gig black NANO, i will open it and use it tonight after i get off work, few questions thought...
    Out of the box, do i just connect the NANO to my USB 2.0 powered HUB and charge it? And can i transfer music at the same time?
    Should i upgrade to iTunes 5 before connecting NANO?
    And how can i extend the battery life, should i let the battery die after the first charge?
    Thanks in advance.

    I just got back from purchasing one at the Towson Town Center mall in Maryland. I was surprised that they had them in stock. The Apple Store didn't even have anything up yet to advertise the Nano...not even a display sample. One of the associates actually had one, holding onto it like it's the crown jewels.
    Before arriving at the store, I was torn between the colors...but after seeing the black one, I was sold in 10 seconds. Watching Steve's presentation, you do get an idea of how small it is, but seeing it in person it's a totally different perspective. The width is smaller than a credit card, same length. The screen is bright and easy to read. The black one shows the controls better on the click wheel vs the white one.
    With a purchase of a Nano, you get a limited edition black cardstock shopping bag, advertising the nano on both sides of it. I got stares as I was walking back to my car (I was scared that someone is going to snatch it from my hand). I would have wanted a t-shirt instead.
    I promised myself that I'l going to wait until someone starts selling a case for it, but I cracked under pressure! Apple...you need to stop making such beautiful products because I'm truly broke! : )

  • Got an iphone, now what?

    I was a bit surprised to find that there were hardly any instructions that came with the iphone about basic things like how to insert a sim card.
    I got the pay as you go option and am charging it now but I'm not sure if the sim card needs to be inserted before charging and how to do it.
    Are there any good online instructions for the iphone anywhere?

    I found this on another site.
    Does it sound like it makes sense and will allow me to do what I want?
    'I've seen some people here asking how to sync with their home and work computers without having to erase the iPhone. This is simple.
    Copy your ~/Music/iTunes/iTunes Library and ~/Music/iTunes/iTunes Music Library.xml to a flash drive at home and bring it to work.
    Then copy those files to the same location on your work computer. Then launch iTunes. You'll notice all the music you have at home show up, but it's ALL missing. This is okay. Just delete it all in iTunes.
    Then drag your ~/Music/iTunes/iTunes Music folder onto the iTunes icon to get all your work music back into iTunes. Now you can sync with both computers because iTunes thinks it's the same computer. Nice.
    I hope this helps some people who may not know about this trick. It's working for me.
    EDIT: This is important. Make sure you've enabled "Manually Manage Music and Videos" in the iPhone tab in iTunes. If you have it auto-sync I'm pretty sure it will replace the music which would defeat the purpose of this trick."

  • Got an iSight, now what?

    Greetings
    I got an iSight but other than family no one I know uses Mac.
    Until Skype fixes their incompatibility issues with iSight and comes out with video on their Mac client, I understand there is not many other ways to use my new toy with PC users (I know about iVisit and Mercury and don't like them).
    So I would like to turn the Mac users community and make new contacts with other iSight users.
    Would there be a place/ web site for this?

     The information in the Users Manual that came with your iSight should give you a place to start.
    Using iSight will give you some more suggestions.

  • Error while updating software on iphone and it got wiped out, now what?

    I was updating my iphone software through iTunes, and there was an error.  Now my iPhone won't even show a screen, just an image of a USB cable pointing to an iTunes logo.  I rebooted both phone and computer. Nothing.  I uninstalled iTunes and all related software per Apple instructions and reinstalled iTunes.  Reconnected and...Nothing.  Now I am screwed.  I can't even use my phone as a phone let alone anything else.  Good news is I do have everything that was on it backed up -just how do I get my phone to work again?

    What is the error when you try and restore the phone after connecting to iTunes? Use this support document to decide what to do for specific restore errors. http://support.apple.com/kb/TS3694

  • Just got a Macbook - Now what?

    I just received my Macbook (2.16 GHz, 120 GB) in the mail yesterday. I've installed all the programs I need and such but I'm a little confused about what to do about the battery. I've been a Mac user for a while but I've only used desktops. I know that Mac batteries are not the greatest in the world so what should I do to keep it at its best? Should I keep my laptop plugged in at all times?
    -Megan

    I suggest you don't use your battery unless you need to. It does it no harm to sit idle in your machine while plugged into AC. I don't really know what to say about your bad battery statement and am wondering why you think Mac batteries are bad? The biggest problem recently was SONY batteries having a problem. All the manufacturers that used them had problems.
    I have my MacBook plugged in almost all the time except for when I calibrate it or need to use it in the other room for a few minutes. Don't worry about running your battery flat every time before you charge it. That is not good for li-ion batteries. In the links below you will find all kinds of god information on battery care. If need any more help you have come to the right place.
    These are good things to know about the MacBook and it's battery.
    MacBook reduces processor speed when battery is removed while operating from an A/C adaptor
    Apple portable computer's battery does not show a full charge in Mac OS X
    You should calibrate your battery at least every month or two. I do mine every other month and have had no problems.
    Look here and here for some good tips about battery care.

  • I got this..now what?

    How do i go about tracking this?
    8155418046 :    Order number:1600
     Tracking number 183.193.293.32
     Courier. MC07

    hate to give bad news but thats verizons ip addy not a tracking number 

  • Just got a PS4 now what?

    Hi all, I received my PS4 from {removed per forum guidelines}. It's my first I have owned since a SNES, although I did play a fair bit of PS2 at Uni.
    Anyhow, what games are good (2 player ideally) what should i wait for, Whats this internet subscription thing, can I play online and so on... i have seen ther eis a subscription charge?
    Thanks!

    "Last of Us: Remastered" is a must own.
    'Infamous Second Son" with its stand alone DLC "Infamous:First Light" is also a great game.
    'Killzone Shadow Fall" is a great continuation of the series
    "Little Big Planet 3" is a great party game, its not just for kids.
    "Bloodborne" if you enjoy DarkSoul style games you will love this one aswell.
    "Uncharted Remastered and Uncharted 4" Coming soon so look out for those.
    These are some of the retail games I can think of but their are others only available on the PSN Store.
    "The Order 1886" is an interesting concept but not worth more than a $20 purchase at most. Even better just rent it. You can beat it on the hardest setting in under one day.
    "Warframe" Space-ninjas is the best way to describe the game and I personally backed the game back in alpha before it was available on PS4.
    Its free to try so give it a shot. You don't have to pay any money to enjoy it. Money is solely for cosmetics and for shortcuts.
    Posted this on previous post with similar question.
    As for the subscription, "PS Plus," it is required to play online for non free-2-play games. If I remember correctly that's all you need it for; netflix, crunchyroll, spotify and other services don't require it.
    The benefits of having it is free games every month that you get to keep playing as long as you have an active subsription. You also receive discounts on games, dlc and movies.

  • Installed 10.5.7 update - got problems.  Now what?

    Hi,
    I did install said update that is now buzzing this community. Tried both (normal and combo) and neither work - programmes crash when I try to print.
    What do I do now?
    I am not a apple tech and need step by step instructions! I also can't afford to pay someone cause I am poor!
    Can anyone help me...?
    please...

    10.5.7 gave me spontaneous system crashes when running on battery power, with plenty of battery life left. To clarify: what I mean by 'spontaneous system crash' is, the machine behaves exactly as if the battery had been pulled out. Years ago I experienced similar behavior with old batteries that needed replacing. Currently, though, I actually have two young batteries that I alternate between, and the problem occurs with both batteries. I no longer have a laptop. I have a desktop.
    I am sure it is not the logic board-- everything was fine until immediately after 10.5.7 upgrade. I bet that this is related to older logic boards, though-- I have the first intel MBP that came out. I have seen two people posting on discussions here saying that logic board replacements fixed their apparently identical problems. Perhaps these posters' logic board fixes happened because the upgrade replaced the older board with a more modern board that is not susceptible to the bug.
    I will be downgrading to 10.5.6 ASAP, and I am not happy about it. Time machine is no help, because you can't revert the OS only, you have to lose all new data created after the system update.
    It appears from the various postings here that upgrading to 10.5.7 is a kind of russian roulette. Many people (perhaps even most) have no problems, but then there are others (like me) who experience catastrophic problems. I would say to those who are considering the upgrade: are you feeling lucky?

  • Script-change from local object to package

    Hi Experts,
       I have created a script.My problem is i have saved the script in local  object,but i want in  package.
                How to change from local object to a package? Pls advice me on this issue.
    With Regards,
    Sharmila.S

    Hi,
    Go to SE03.
    Go to Object Directory-->Change Object Directory Entries
    Put the object type as FORM and press enter.
    Then enter the sap script name in the object name.
    Run and then change the package.
    Regards,
    Ankur Parab

  • When an Object got invalid?

    Hi All,
    Is there any way to findout when(date / time) an object got invalid, as the LAST_DDL_TIME and TIMESTAMP columns of the DBA_OBJECTS do not change if the parent object gets affected and child become invalid right?

    Enfact I want to know at what time an object became INVALID,
    there are 2 n more DBA's applying the Script for the Database, One is working on an assignment to remove the unwanted Objected from DB and the other is working on normal development , now both executed their script which invalidated around 200 Objects, I want to know Invalid objects by each action (Cleanup or Development action) As I am aware of the time the statements were executed, one way to get the list, is to revert the changes and work pro-activly, but it would be very easy for me if I group the list of objects invalidated by the time.otherwise I would have to get the list of all objects before and after every action activity, which is frequent
    Thanks

Maybe you are looking for