Professional Web Applications Themes

Trouble Applying meshDeform with JavaScript - Macromedia Director 3D

I am working on swapping images on the same model, and need to make sure that the UV coordinates don't change. I understand that I need to apply the meshDeform modifier to access the textureCoordinateList, but I don't think I am getting it right. Could anyone help with the correct syntax for applying the meshDeform modifier in JavaScript? Any help is appreciated. //This is inside of a movie script. function prepareMovie(){ //Resets the 3D cast member member("BlueMan").resetWorld(); //Applies the keyframePlayer modifier. member("BlueMan").getPropRef("model", 1).addModifier(symbol("keyframePlayer")); //Applies the meshDeform modifier to the cast member. member("BlueMan").getPropRef("model", 1).addModifier(symbol("meshDeform")); //Creates a variable. _global.mBlueMan = member("BlueMan").getPropRef("model", 1); ...

  1. #1

    Default Trouble Applying meshDeform with JavaScript

    I am working on swapping images on the same model, and need to make sure that
    the UV coordinates don't change. I understand that I need to apply the
    meshDeform modifier to access the textureCoordinateList, but I don't think I am
    getting it right. Could anyone help with the correct syntax for applying the
    meshDeform modifier in JavaScript? Any help is appreciated.

    //This is inside of a movie script.
    function prepareMovie(){

    //Resets the 3D cast member
    member("BlueMan").resetWorld();

    //Applies the keyframePlayer modifier.
    member("BlueMan").getPropRef("model",
    1).addModifier(symbol("keyframePlayer"));

    //Applies the meshDeform modifier to the cast member.
    member("BlueMan").getPropRef("model", 1).addModifier(symbol("meshDeform"));

    //Creates a variable.
    _global.mBlueMan = member("BlueMan").getPropRef("model", 1);

    //Trace output:
    trace(mBlueMan);//Returns -> <model("BlueMan")>
    trace("1: "+mBlueMan.getPropRef("keyframePlayer").playLi st);//Returns -> 1:
    <[[#name: "BlueMankey", #loop: 0, #startTime: 0, #endTime: 4000, #scale:
    1.0000]]>
    trace("2: "+mBlueMan.getPropRef("meshDeform").mesh.count );//Returns -> 2:
    undefined

    }

    adam@blueapplestudio Guest

  2. #2

    Default Re: Trouble Applying meshDeform with JavaScript

    Can you explain a little bit more what is not working? To change a texture, you
    will under normal conditions not need the meshdeformmodifier. Just change the
    texture in the shader it should not change the texturecoordinatelist at all.

    But maybe i did not understand what you are trying to do exactly, can you
    explain it a little bit more?

    hondo3000 Guest

  3. #3

    Default Re: Trouble Applying meshDeform with JavaScript

    You've applied the modifier correctly. Your last line of code should be


    trace("2: "+mBlueMan.getPropRef("meshDeform").count("mesh")) ;
    Ex Guest

  4. #4

    Default Re: Trouble Applying meshDeform with JavaScript

    Thank you both for your speedy responses.

    Hondo 3000
    I am already swapping the image map, but the image?s placement is wrong. When
    the new image is placed, the face portion of the image is mapped to the
    character?s butt, and vice versa. It was suggested in a previous thread that I
    look at the UV coordinates with textureCoordinateList before and after the
    image swap to see where the change is occurring.

    Ex Malterra
    Thanks for the code correction; that is very helpful. I have been encouraged
    by others to learn Director using JavaScript, as it is so close to ActionScript
    (which I am already familiar with,) and because JavaScript can have other
    applications outside of Director. However I am finding that code examples
    using JavaScript are few and far between.

    If anyone out there writes an exhaustive book on 3D in Director using
    JavaScript I?ll be the first to buy :)

    Take care.


    adam@blueapplestudio Guest

Similar Threads

  1. Trouble with javascript:window.print
    By Fedic in forum Macromedia Exchange Dreamweaver Extensions
    Replies: 1
    Last Post: March 10th, 09:54 PM
  2. Trouble with Particle Systems and JavaScript
    By CottonPanties in forum Macromedia Director 3D
    Replies: 0
    Last Post: November 5th, 03:58 AM
  3. Javascript <--> Flash: communication trouble
    By automan25 in forum Macromedia Flash Actionscript
    Replies: 2
    Last Post: March 4th, 05:43 PM
  4. Diff file trouble applying?
    By Charley in forum PHP Development
    Replies: 2
    Last Post: October 12th, 07:07 AM
  5. BuildEnvironment trouble after applying SUN-Patch
    By Markus Breuer in forum Sun Solaris
    Replies: 0
    Last Post: June 30th, 05:29 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139