Diffuse color changing with js

Hi all
is it possible to change the diffuse color of a material through a js command? And swaping between different image maps?
Let say we want to change the color of a chair with a mouse click on a button... Could please someone post a sample piece of code?
Thanks for helping
Alberto

Hi Alberto,
it is possible to change the diffuse color and the diffuse texture of a material. To change the texture you have to add an imageresource to your PDF-file first. Acrobat Professional and Acrobat 3D dont support adding resources. To add a resource you need a plugin. You can download such a plugin here: http://www.graysonlang.com/Attach3DResource.api
Use the following code to change the diffuse color or the diffuse texture of your meshes:
//##### changeDiffuseColor #####
function changeDiffuseColor() {
//##### 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.diffuseColor.setColor(c1);
objectMaterial.diffuseColor.set3(0.9,0.99,0.1);
//##### 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);
You can download a working example at my website:
http://www.web-3d.info/material.zip
I hope i could help you
Michael

Similar Messages

  • Chart color change with CSS in DS 1.3

    Hi together,
    Did somebody now a solution with CSS in the design studio 1.3, to change the color from the chart-bar or the chart-pie (like PrintScreen)? Or is this planned in the DS Version 1.4?
    We found only a solution to change this setting for the chart. Not the color of the bar or pie.
    We would like to set this in the CSS because it is a Style guide rule of the company.
    Best Regards
    Gabriel

    Do you mean use CSS for your chart?  See response from David Gyurasz Styling a chart in Design Studio
    If not I recommend searching SCN for your answer - I searched "CSS color design studio chart" and 234 searches were found.

  • Recovery Slider: Color Changes with Camera Profiles, not so much with ACR 4.4 Profile?

    I'm sure there's a reason for this, and not necessarily a defect, but I have to ask:
    The recovery slider: if I use the Recovery Slider on an image set to the ACR 4.4 camera calibration profile, this helps control my highlights without affecting the overall color/tint of the image. However, if an image is set to the Adobe Standard camera calibration profile (or any of the other camera profiles) and I use the Recovery Slider on that image, the affect on the image seems to be different: the highlights are also controlled, but not without a perceived effect on the color tint of the image. The color balance almost seems to slightly change. Particularly noticeable on skin tones. I'm working with 5D files, using Lightroom 2.3 on a Mac.
    What's the reason for this? Anyone experience similar?
    Thanks

    This is a known "problem". It is caused by "hue twists" that are present in the camera-matching profiles and the new Adobe profiles. Several threads on this in the ACR forum:
    http://www.adobeforums.com/webx?128@@.3bc03c04.59b77b09
    http://www.adobeforums.com/webx?128@@.3bc03c04.59b783f8

  • Linux: The tabs text color changes with the theme, while the menu text color is always black.

    Hello,
    When Firefox theme is changed, it usually changes window appearance, e. g. backgrounds, and sets corresponding text color to contrast with that background. It always used to be like this. For instance, I currently use Sunflower_01 theme which sets blue sky as a background. The tabs text is white, as well as the bookmarks. The white text contrasts very fine with the sky. But the menu items are awfully black, casting dark-gray shadows on the dark-blue sky. The menu remains black regardless of the theme I set.
    Of course, it's all fine without any add-ons (light background, dark text), but with a theme enabled, it looks not the way it used to be. I wonder if it can be fixed somehow.
    I use Mozilla Firefox 33.0 for Linux Mint (release 13, maya).
    Looking forward to your reply.
    Regards,
    Andrey

    Hello,
    Did you install from the repositories? I have found the same problem with Ubuntu 14.04, a workaround is to either use a userChrome.css file, or (in my opinion, the easier route) [https://addons.mozilla.org/en-US/firefox/addon/stylish/ Stylish] extension with a new Style.
    See these articles about the userChrome.css file:
    * http://kb.mozillazine.org/index.php?title=UserChrome.css
    * http://kb.mozillazine.org/UserChrome.css_Element_Names/IDs
    If you use the userChrome.css route, you may need to restart Firefox to apply the changes.
    See this article for Stylish:
    * http://forums.mozillazine.org/viewtopic.php?f=38&t=1570945
    To add a new style in Stylish, click on the Stylish tool on your toolbar, then "Write New Style", then "Blank style". Or:
    * Tools (or [[Image: New Fx Menu]]) > Add-ons > User Styles > Write New Style
    Example code for either one method you choose (you can play around with the colours, but I found this worked nicely for my theme):
    @namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");
    /*change size, color, style of text in Menu Bar */
    menubar > menu
    {color: darkgray !important}
    /* Mouse hovering over menu */
    menubar > menu[_moz-menuactive="true"]
    {color: white !important;}
    /* Active/Open menus */
    menubar > menu[_moz-menuactive="true"][open="true"]
    {color: black !important;}

  • G5 suffers color change with user switching

    This is my biggest issue with my Mac. It has been going on since 10.4.1. Every time I switch to another user, then switch back, it seems as though the colors wash out. It happens about 3 seconds after I switch back. I have tried setting the colors the same in the color tables, but nothing seems to help. I have to restart to get my colors back. What can I do?

    There is a good workaround:
    http://www.macosxhints.com/article.php?story=20060103162354164
    Powerbook G4 1Ghz   Mac OS X (10.4.4)  

  • Color change with duplication of calendars

    In a recent synch of my iCal, my calendars were duplicated and represented in a different color. Each of two calendars had all the items of the original calendar. In a subsequent synch I was prompted to resolve the color conflict (of some but not all the calendars), which I unfortunately did. I resolved these to the .Mac color--that one was the same as my original color choice. After this synch, for these "resolved" calendars I now have two calendars, both of the same color: one has no entries whatsover, and the other calendar has every entry in duplicate.
    I have no idea why this occurred or how to solve the problem and would welcome any suggestions.
    I'm only synching between two computers and a .Mac account (no other devices involved). Both of the computers now have the same duplicated configuration. I have unregistered and registered one computer (as recommended in one support page) and have resynched but the problem still persists. (I think the .Mac info is all duplicated)

    You're welcome.
    In case you aren't aware, prior to firmware version 3.0 it was possible to sync contacts and calendar events over the air with an Exchange account and/or with a MobileMe account or direct with a supported application on your computer. You could do one or the other, not both at the same time.
    This was added primarily for those accessing an Exchange account with their iPhone who also wanted to sync personal contacts and calendar events with a supported application via the iTunes sync process on their personal computer at home. When doing so, business contacts and calendar events synced over the air with the Exchange server are kept separate from personal contacts and calendar events synced direct via the iTunes sync process with a personal computer. You can view business and personal contacts and calendar events combined or separately.
    When doing the same with a MobileMe account, this does nothing but duplicate the contacts and calendars events on your iPhone.

  • Text color changes when more than one color is used in the same paragraph in a bulleted list

    I work in a print shop on designers' files preparing them for print. Machine I use is an iMac, plenty of RAM, running Tiger 10.4. Here is my problem: A PC user sent us an InDesign CS3 file. A portion of the text is styled as a bulleted list with character color and bullet (the solid circle) defined as (default) black. However, the style is over-ridden on the bullet and first two words following the bullet with a spot color red, which is present in the Swatches palette (PMS 186). The remainder of the sentence stays black. The text somehow lost this override, and instead of keeping the 2 different colors all the text changed to black. This seems to have occurred when I saved the file on my machine. When I go back and open the original file the text is still colored both red and black. I think that the file was originally an InDesign CS2 file, and could even have been a Indd version 1 or Quark file. Why did the color change with no user intervention? Also, I can't understand why, when the first 2 words are highlighted and changed to red, the bullet also changes to red. (That is good, of course, because that is what we want, but I don't understand how that happens when the character style is black, and I can't even highlight the bullet itself). I sure would appreciate any ideas anyone has on this, I have to try to explain why we printed the text in black when it was supposed to be red and black!

    thanks Alan and Bob. Nothing has explained the loss of color so far.
    Alan, I will suggest to the designer that she use a nested style. I wonder if that will make the styling more stable moving accross the different platforms.
    Bob, I feel like you may have thought, as I did, that hundreds of saves and saved-as and many different applications would have damaged the file, but as you could see by the History, the file was fairly fresh.
    There is a very outside chance that I wiped out the style overides by command click but I am really careful and I doubt it.
    So I'll thank you both again and check back each day, perhaps this will happen to someone else and become an issue. I have tried to repeat my actions and cause the error again but to no avail.

  • Does anyone has a problem with the screen of the new ipad? (there's a part of the screen which the color in it is "very" bright) and when I move the aluminium part of the smart cover when it's attached to the ipad the colors change!! Help!!!

    Does anyone has a problem with the screen of the new ipad? (there's a part of the screen which the color in it is "very" bright) and when I move the aluminium part of the smart cover when it's attached to the ipad the colors change!! Help!!!

    I'd take it into my local APple store and have them look at it. There may be something wrong inside your device.

  • Bug when importing Ppt slides with animation: color changes to foam green

    Hi everyone,
    I am using Captivate 7 and I am experiencing what seems like a bug when I try to import Powerpoint slides that have animation effects and then publish the video as HTML5.
    I am using Ppt 2007 and importing the slides as .pptx files using the Import> Ppt slides command in Captivate.
    An example of Ppt slide that I need to import is this: in the slide, there are two groups, created by grouping together several objects (lines, shapes etc). One group has a fade effect applied on it, while the other group has a diagonal down right movement applied to it.
    When I import the slide in Captivate, the following happens:
    If I do not select the High fidelity check box, then the Ppt slide is imported as static, and no effect is shown in the HTML5 video, although the effect is shown in the Captivate preview.
    If I select the High fidelity check box, then the Ppt slide is imported with the effect, and with the original Ppt colors, but as soon as I press F3 to play the slide, or F4 to play the whole project, or I publish the video in HTML5 output, all the original colors change to foam green for the fill in and black for the shape outlines. Furthermore, the text boxes are displayed with their box frame displayed:
    ORIGINAL PPT IMAGE:
    RESULT AFTER CAPTIVATE IMPORT:
    I have read in the forum several posts on this issue, eg colors being changed to foam green even with static Ppt slides, and I tried to apply the suggestions, but none seems to work.
    Any help will be appreciated.

    Hi there
    As Hyperlinks don't survive the import process, perhaps try removing the links and just applying the desired color in PPT before importing into Captivate?
    Cheers... Rick
    Click here for Adobe Authorized Captivate and RoboHelp HTML Training
    Click here for the SorcerStone Blog
    Click here for RoboHelp and Captivate eBooks

  • Help with unexpected picture color changes on load

    Hi,
    I have been learning elements for a couple years and am getting reasonably good at editing
    pics like portraits.
    Recently was doing high key portrait edits, when I was comparing the RAW CR2 file in ele along side the photos
    converted to Adobe psd, the colors where changing after opening and saving as psd.
    The thing is I didnt do any changes.  I just opened up the raw file, then clicked open from raw edit to go into ele.
    Once it opens as a psd the colors have changed.
    Camera is set to Adobe RGB.  Ele set to manage color for printing.
    Is this normal, or something I am doing or not doing.
    Suggestion and recommendations requested.
    txz.
    Will

    I understand you are comparing on screen side by side:
    - the image in the ACR dialog, without any edits
    - the image seen after opening in the editor and saved unedited as psd and reopened to be able to compare side by side.
    I agree that you should not see any significant color changes.
    A note about your settings:
    - Camera set to Adobe RGB : good for jpegs, setting ignored with raw files (in PSE ACR, the choice between sRGB and aRGB depends on the second setting in the editor : always optimize for print). Not relevant to your problem.
    - Always optimize for print : means the raw data will be converted to aRGB for printing, and shown according to your display. That's the right setting if you want to print in aRGB.
    So, nothing wrong with your settings.
    Is there a wrong screen color profile saved on your computer? That could happen with other softwares or with attempted screen calibration tools...
    I can't help much in that situation, but it would perhaps help if you described the differences in color betwee both displays. For a better view to compare colors, beware of the surrounding parts of the images : if one is on a clear background (ACR) and the other in a dark one (Editor), you won't see exactly the same colors.

  • Color Settings change with resizing Photoshop window

    I have been seeing a weird phenomenom with Photoshop lately and I hope someone can help me figure this out. I have been editing photos in Lightroom. I occasionally take a photo into Photoshop for more editing and when I do this, if I make any change to the program window side, the color changes to a darker, more muted looking photo. If I minimize the program, nothing changes. If I either change the window size to a smaller, non-maximized window or drag it to my secondary display, the color changes to what I am guessing is a different color space. The only way to fix this is to shut down Photoshop and restart it. I am sure this is some setting in Photoshop color settings, but not sure. Should I have my color settings set to my monitor calibration file or should it be Adobe RGB? Not sure what Lightroom edits in. I do have it set up to send the file to Photoshop in Adobe RGB.
    Any help would be appreciated.
    Thanks,
    Toby

  • Problems with color change (Acrobat 8 to Acrobat 9)

    Hi.  We are have an issue with the colors changing from the way they look on the screen to the way it plots out on our plotter.  The PDF had no problems in Acrobat 8.  The same file was then plotted in 9 and now the colors change from the way they appear on screen to the way they appear on paper.  The PDF file originated from ESRI ArcGIS 9.3.1.  We open up the file in Acrobat and send it to our plotter, a HP DesignJet 1050C PS 3.  Any suggestions would greatly be appreciated.  Thanks in advance!

    Hi LuigiAntonio,
    Some more information would be required as to the exact error message if any and screenshots of the issue would be helpful.
    What kind of problems are you referring to?

  • Indesign issues. Impossible to fill a form created by the pen either with color either with an image. The image is there but is invisible. Same problem with the line (impossible to color it or to change the tickness. Is there anything to change in the pre

    I have recently installed Indesign CC (I had the CS 5.5). I have some issues in doing simple things such as fill in a forma created with the pen either with a color either with an image. The image is there but is invisible. same issue when I want to draw a line. Impossible to color the line  and when I increased the thickness, it was creating a sort of wrap around the shape. have you ever encountered this kind of issue ? Thanking the community for his help.

    You will probably get better help in InDesign
    This forum is about the Cloud as a delivery process, not about using individual programs
    If you start at the Forums Index https://forums.adobe.com/welcome
    You will be able to select a forum for the specific Adobe product(s) you use
    Click the "down arrow" symbol on the right (where it says All communities) to open the drop down list and scroll

  • ICal Calendar Colors Changing On Their Own; iCloud Connection

    AGGRAVATING PROBLEM:
    Many in this forum have written recently about a problem ongoing for people with multiple iCal calendars where iCal calendar colors change "automatically" when you haven't selected those colors, or even "change back" before your eyes to some color your DIDN'T select after you select a new one.  If you log into iCloud on the Web and try to change the color of certain calendars, they refuse to change.  Try as you might, the color you want for your calendar won't "stick" and it is forced to be the wrong color on all your devices.  In some cases, even the names of some of the calendars cannot be changed.  On other calendars in your list, the colors and names will change fine. 
    Related symptoms:  Calendars you have deleted "come back."   Or, calendars you did not create yourself show up in your calendars list, such as "Calendar" or "Home" or even "Untitled."  Note that the problem seems to be most prevalent with calendars with names "Home," "Work," OR either of these words in the NAME of the calendar.  For instance, "Bob's Work" might get snagged (it can't be deleted without coming back or its color is stuck and "comes back"). 
    I spent a long time on the phone with a helpful Apple senior advanced specialist on this problem today.  We conducted a very large number of "experiments". Our family has two iPads, 2 iPhones, and 2 iMacs, so it was easy to rule things in or out.  I will present some information that may help.
    SOME OF WHAT APPEARS TO BE GOING ON:
    First, Apple has not resolved this.  But the problem appears to be related to iCloud, and NOT to individual devices.  After de-linking all of my individual devices from iCloud, I could change any of the colors or names at will on any given device, create new calendars and then change their colors to whatever I wish, delete calendars, change names...no problem.  However, after re-linking calendars to iCloud, all the problems mentioned above returned.  The chances that my iMacs, iPhones, and iPads are all causing the problem independently is very low. They also have slightly different OS versions on them, so it is not likely an a particular device OS, though that could be indirectly related.  Also, the colors "change back" within about the same time (usually a few seconds to up to 30 seconds) that it takes to do a "refresh" (i.e. an update) to the iCloud servers.  This when iCloud is turned on, and the absence of it when iCloud is turned off (for calendars), strongly suggests that it is the iCloud server and its interaction with your devices that the fundamental cause of the problem.
    Apple has said that they are aware of this problem and their engineers are working on a fix.  Historically, this can mean just a few days, or it could be a few months, years, or "whenever."  They don't give estimates of when it will be fixed.  Exactly WHY this is happening is unclear, but my guess is that it is a modification to the iCloud server code that Apple implemented without testing it thoroughly enough to discover this problem.  Apple does not admit to that, of course and I don't know if I am correct.
    A WORKAROUND SOLUTION THAT WORKED FOR ME:
    Please note this is a workaround and not a full fix.  Apple needs to run a patch on their iCloud server code.  Until then, I did the following which seems to have worked for me for now.  Read the whole list before deciding whether to proceed.  I don't guarantee it will work in all situations.
    Note...I found I was stuck for now with the color of ONE of my calendars.  If you are like me, you want to keep that one and work around it....
    Backup first... Make sure that your iCloud copy of your calendar data has the calendar event information you want to save - even if the color is wrong.  Log in at www.icloud.com and do a refresh to sync to the Cloud.  Check over your calendars online to make sure the event data appears to be there for all of your calendars (even if their color or name is not what you want).
    Steps:
    1.     Go to every device that you have linked to iCloud separately. Go into Settings, iCloud, and then uncheck the "Calendars" option.  This delinks your calendars for that device to iCloud.  As you do this on each device, when prompted, select "Keep On My" ..iPAD...iPhone...iMac... etc.  This will preserve the calendar information on the device so it won't be deleted.  I think this is safer, but you can click on "Delete" if you want, too.  Note - if one of your devices is an iMac, with OSX Lion and before, you may be forced (I was) to delete the iCloud calendars from the iMac.  So again, make sure they are backed up to the Cloud first (or somewhere else).
    3.     With the iCloud Calendars Option on all your devices still turned off, go to the WEB and log into iCloud.com.  You need to figure our which calendar iCloud won't let you change the color for.  You probably already know.  On iCloud.com, click on "Calendars," then click open your calendar list and select "EDIT" at the bottom of the dialog box.  One at a time, click on the color dots next to each calendar name and try to change the color (you can put any back after the test if you want). You will probably see a certain one that just goes right back to what you don't want.  This is the one for which the color is stuck, but you may be able to change the name of it now that your devices are unlinked from iCloud.
    4.     Still in iCloud.com, change the names and colors of any of the other calendars you wish to change.  Delete any empty calendars that mysteriously appeared without your wanting them.  Take note of all the calendars, names, and colors that are on the final list of calendars.
    5.     On EVERY device, BEFORE turning iCloud back on on ANY of them: Change the colors and/or names of calendars, delete calendars, etc. so that the calendar names and colors on the device are exactly the same as what you left in iCloud.com in the last step.
    6.   One at a time on each device, go back to Settings and then "iCloud" and check again the box for "Calendars."  You will be asked whether you want to "MERGE" your data with iCloud.  I selected MERGE to ensure I didn't lose anything.  Link each device again into iCloud one at a time.
    7.  When each device is back, go back to iCloud on the Web, or go into iCAL on one of your devices.  Set to view ALL calendars.  Look for duplicates of some of your events.  I found quite several as an artifact of "merging", but in my case it only took me about 5 minutes to go through quickly and delete the duplicates.  It deleted the duplicates on all of the devices at once, so I only needed to delete dups on one device.  I did not find that I lost any events as long as I kept one valid copy.
    Again, no guarantees...hope this works for others.  Good luck.

    I'm getting the same thing and it's really bugging me! Keeps changing colour to one I do not want and I have tried everything to get it to stay the colour I have chosen!!

  • Colors changing on my calendar

    What is Apple doing about supporting its clients with information on fixing the problem of colors changing on iCal?
    Is this even on their radar?

    This is actually not about the colors changing.  The colors change but it's because the appointments are being assigned randomly (it seems) to another calender like, Home, Work, Birthday.  If you uncheck the calender it will cause the events to disappear.  Check the calender again and the events reappear.
    I don't know how the other calenders got turned on and how they linked to only some events.  If you click on Calender in the upper right you'll see what is checked.  try unchecking and see if your appointments disappear.  So for Apple, please correct this issue.

Maybe you are looking for