Parent layers to vertex

Hello,
Although I've found way and scripts to parent mask vertices to objects, I've been unsuccessful if creating the reverse.
I'm fairly new at this but not new to programming.
What I would like my this script to achieve:
     Making a layer mask at the corners of a layer - check
     Creating 4 nulls - check
     Parenting the nulls to the 4 corners -
For creating the mask I have this:
     var myShape = new Shape();
     var vertices = new Array ();
     myShape.vertices = [[0,0], [0,100], [100,100], [100,0]];
     var myProperty = theMaskGroup.property("ADBE Mask Shape");
     var vertexLimit = myShape.vertices.length;
For creating the nulls:
     function Nulls (){
     for (var i = 0; i < vertexLimit; i++){
        theNull = theComp.layers.addNull();
        theNull.source.name = "Null"+(i+1);
        i+1;
        nulls[i] = theNull;
When it comes to moving/parenting nulls to mask verts I am completely lost.
Any help would be much appreciated.
Thank you

Hi chillywilson,
As far as I know, by default you can`t just parent any property to mask vertices.
But you can do it in two ways:
break mask vertices to Nulls and then parent anything to them.
          This script has this function:
          Add Ons - aw_Triangulator | VideoHive
There is also a plugin that represents mask vertices as effect properties:
        http://aescripts.com/bao-mask-avenger/

Similar Messages

  • How can I apply a timestretch to different null objects and then use them to parent layers?

    I am using several hundred stills which are held on screen for different lengths of time. Is there a way to create null objects with various timestretch values and then use them to parent my stills?
    I'm trying to find an equivalent to the 'paste attributes' function in Final Cut Pro.
    Thanks in advance
    A

    If you have movement on the stills you can set up expressions based on in and out points. That's what I do. I then drop all my stills in order into a comp then set the out point for all stills for the longest duration. I then set group colors for layers that I want to make different lengths, do a group select and then adjust the out points for those layers. When I'm done I sequence the layers using the keyframe assistant.
    The other way I work is to use an audio track with markers for timing. I have an expression that reads the markers and sets opacity for the layers based on pairs of markers. The motion is also controlled by expressions. That's an even faster way to set up an animated slide show.
    The last way I work is just to set in an out points for all layers, sequence the layers, use expressions to do the motion and then use time remapping on a pre-comp to adjust the timing of the slide show. All methods are quick and easy.
    Here's a fly in bounce and then drop out fxx preset that will give you an idea of how expressions based on in and out point work for slide shows. You just drag the layer to it's resting position, apply the animatiokn preset and the layer flys in, bounces, and then drops out the bottom of the comp. Works in 2D and 3D space.

  • Select nested WMS layers with specific SRS value using XQuery

    A WMS getcapabilities document contains a nested list of Layers. I need to get a list of layers for which is true: - It is queryable and - It has an SRS value of EPSG:28992 or any of it's parent layers (or parents parents etc) has an SRS value of EPSG:28992.
    I came up with this query which I'm not very happy with because it only allows for three nested Layers.
    select t.*
            from xmltable(xmlnamespaces('http://www.w3.org/1999/xlink' as "xlink")
                          ,'for $d in /WMT_MS_Capabilities/Capability/Layer[SRS="EPSG:28992"]
                            where $d/@queryable="1"  return $d'
                          passing p_xml columns name varchar2(100) path 'Name'
                          ,title varchar2(100) path 'Title'
                          ,url varchar2(4000) path 'Style[1]/LegendURL/OnlineResource/@xlink:href'
                          ,style xmltype path 'Style') as t
          union all
                select t.*
                     from xmltable(xmlnamespaces('http://www.w3.org/1999/xlink' as "xlink")
                                ,'for $d in /WMT_MS_Capabilities/Capability/Layer/Layer
                                  where $d/@queryable="1"
                                    and (/WMT_MS_Capabilities/Capability/Layer/SRS="EPSG:28992"
                                         or /WMT_MS_Capabilities/Capability/Layer/Layer/SRS="EPSG:28992") return $d'
                                passing p_xml columns name varchar2(100) path 'Name'
                                ,title varchar2(100) path 'Title'
                                ,url varchar2(4000) path 'Style[1]/LegendURL/OnlineResource/@xlink:href'
                                ,style xmltype path 'Style') as t
          union all
                   select t.*
                      from xmltable(xmlnamespaces('http://www.w3.org/1999/xlink' as "xlink")
                                ,'for $d in /WMT_MS_Capabilities/Capability/Layer/Layer/Layer
                                  where $d/@queryable="1"
                                    and (/WMT_MS_Capabilities/Capability/Layer/SRS="EPSG:28992"
                                         or /WMT_MS_Capabilities/Capability/Layer/Layer/SRS="EPSG:28992"
                                         or /WMT_MS_Capabilities/Capability/Layer/Layer/Layer/SRS="EPSG:28992") return $d'
                                passing p_xml columns name varchar2(100) path 'Name'
                                ,title varchar2(100) path 'Title'
                                ,url varchar2(4000) path 'Style[1]/LegendURL/OnlineResource/@xlink:href'
                                ,style xmltype path 'Style') as t;I'm wondering if there is a better approach using Oracle 10.2.05.

    A couple of options (both quite slow unfortunately) :
    XQuery recursive function :
    select x.*
    from tmp_xml t
       , xmltable(
           xmlnamespaces('http://www.w3.org/1999/xlink' as "xlink")
         , 'declare function local:getLayer($e as element(Layer)*) as element(Layer)*
              for $i in $e
              where $i/SRS = "EPSG:4269"
              return $e[@queryable="1"] | local:getLayer($i/Layer)
            local:getLayer( /WMT_MS_Capabilities/Capability/Layer[SRS="EPSG:4269"] )'
           passing t.object_value
           columns name  varchar2(100)  path 'Name'
                 , title varchar2(100)  path 'Title'
                 , url   varchar2(4000) path 'Style[1]/LegendURL/OnlineResource/@xlink:href'
                 , style xmltype        path 'Style'
         ) x
    Ancestor axis :
    select x.*
    from tmp_xml t
       , xmltable(
           xmlnamespaces('http://www.w3.org/1999/xlink' as "xlink")
         , 'for $i in /WMT_MS_Capabilities/Capability/descendant::Layer
            where $i/@queryable = "1"
            and exists($i/ancestor-or-self::Layer[SRS="EPSG:4269"])
            return $i'
           passing t.object_value
           columns name  varchar2(100)  path 'Name'
                 , title varchar2(100)  path 'Title'
                 , url   varchar2(4000) path 'Style[1]/LegendURL/OnlineResource/@xlink:href'
                 , style xmltype        path 'Style'
         ) x
    ;Tested on a modified version of this document (stored in an XMLType table) :
    http://wms.ess-ws.nrcan.gc.ca/wms/toporama_en?VERSION=1.1.1&request=GetCapabilities&service=wms

  • Effects blurring layers

    OK, so I didn't want to jack the "Blurs" thread started by Darrell Toland, but I have a similar problem...
    I have two examples... Motion Problem 1 and Motion Problem 2. Just download the QT file and take a look...I don't have a website to post on, and FTPs change it to .flv and look like crap. Sorry.
    Anyway, it's a map that zooms in to an area (Atlantic Ocean). Atlantic Ocean text has Volumetrix effect on it (glow). Problem is, the effect makes the text blurry and it doesn't move correctly with the rest of the zoom. You can see that in Motion Problem 1. With Motion Problem 2, I split the text at the point where the glow starts (making it two layers) and put the effect on the second layer. So it goes from looking good to jumping and getting blurry right when it gets to the layer with the effect.
    I keep thinking back to specialcase's render pipeline comments about applying effects to top (parent) layers that have been nested rather than individual layers, but that wouldn't work here.
    Any suggestions how to keep the text from blurring when an effect is applied? Thanks.
    Jonathan
    Message was edited by: synergy1
    Message was edited by: synergy1

    Thanks, Peter. I don't know why I didn't just post this on your forum...since you developed the effect! I've got it bookmarked and all. I'll mess with the fixed layer stuff. But what about the effect making the text blurry, or "soft." You can see that in Problem 2...where it goes from crisp (no effect) to blurry (just as the effect starts) or in Problem 1, where the "Atlantic Ocean" text is softer than the rest since it has the effect applied.
    Jonathan

  • How to align layers without clipping masks?

    Hi,
    I would like to (left) align some layers that are made up of placed photos with clipping masks applied. When invoking the "left" align command Adobe Illustrator CS3 aligns everything bases on the invisible boundaries of the clipping masks instead of the desired results of the clipping masks themselves. See screenshot here: http://badtastic.com/temp/Picture%203.png
    Is there a "smart" way to align these layers without Adobe Illustrator CS3 taking into consideration the invisible boundaries of the clipping masks?
    Input appreciated.
    Kind Regards / Alex

    Hi Steve,
    Hey, thanks for your tip :)
    I managed to solve the problem by drilling down into the nested hierarchy and selecting only the clipping masks and successfully aligning those irrespective of their parent layers. Its also a bit laborious which makes one wish that there were the possibility / feature to not only select artwork based on "same" stroke / fills etc but even by similar layer names. If that had been possible, I could have easily selected one Clipping Mask and then selected all the others based on name similarity without having to unfold all the nested hierarchies to get to all the others one by one.
    Anyway, thanks again.
    Cheers / Alex

  • Parenting issues

    Could this be a bug of this version of After Efects ? does anyone now about it?
    I use AE CC 12.0.0, and I've  just noticed property values issues when parenting layers. 
    For instance if I have the first layer at 100,100 and the second layer at 500,500 and I decide to make the second layer the child of the first layer, I will end up with a value of 475, 475 for the child !!  And for what I know it should be 400,400 as its position should be relative to the first layer now!  
    OR 
    When I Shift Parent the same layers, I end up with a value of 75,75 for the child instead of 0,0. Still the layers seem to be perfectly overlapped.
    Both layers have the anchor point in the center.

    Thanks a lot for the advice, still with the latest version of After Effects CC 12.2.1.5 you will notice the same behaviour. If you asign a parent to a child you will notice 2 behaviours depending on what the parent layer is based on.
    1. if the parent layer is based on a SOLID, then you will notice this strange behaviour of the Position property values.
    2. if the parent is based on TEXT, SHAPE LAYER, NULL -  everything works as I was expecting.
    1. Eg.  I have the first SOLID layer at position 100,100 and the second layer at position 500,500 and I decide to make the second layer the child of the first SOLID layer, I will end up with a value of 475, 475 for the child.  Note also that the size of the solid parent (150/150px) is playing play a role in this 475/475 value. For instance if the parent is 100/100px then the child position value after simple parenting will be 450/450 ( all anchor points are centered on the layers).  And if you Shift parent the same layers you will end up with a position value of 75/75 instead of 0/0.
    2. Eg.  I have the first TEXT/ SHAPE LAYER/ NULL  layer at position 100,100 and the second layer at position 500,500 and I decide to make the second layer the child of the first layer, I will end up with a value of 400, 400 for the child.  If you shift parent the same layers you will end up with 0/0.   
    I do not know if this is normal behaviour but I just stumbled upon it. Thanks a lot.

  • Is there a Plug-In hook that allows direct control over position and rotation of a camera w/o keys

    Hi,
    I'm developing a camera animation system for Cinema 4D and looking ahead to see if it's adaptable for AE.  In C4D I can create a custom camera object and control it's motion through code (no keys or visible scripting or expressions).  Is this possible in AE? 
    So for example:
    User creates a camera and adds something I created to attach to it (like a tag in C4D) OR I can create a custom camera object that inherits all the normal camera functions but adds additional parameters I add that auto-animates the camera (again w/o keys / visible expressions).

    hi Chris Smith x0h00!
    welcome to the forum!
    thus far the fun part.
    now the problem part.
    what you're describing i possible, but just barely, and not without caveats.
    i don't know how deep you knowledge of the SDK is, so i'll start by explaining some basic concepts.
    if you're already familiar with it, the my apologies, and just skip ahead.
    there are 2 kinds of plug-ins in AE:
    1. EFFECTs, which are applied to layers in compositions, and are responsible for processing the image or the audio (or both) of a layer.
    these effects are handed an input pixel buffer containing the image result of previous effects and masks, and are given a pixel buffer to write the output to.
    2. AEGPs (After Effects General Plug-in), which are loaded on AE boot, and are kep loaded throughout the session. such plug-ins can manipulate project elements, change preferences, and add menu commands (and a host of other things).
    effects can also use most of the functionality available for AEGPs, so an effect can also change project elements and all sorts of other goodies.
    now something about AE's rendering logic:
    all 2D layers in a comp are rendered using AE's internal 2D renderer.
    all 3D layers in a comp are rendered using an AEGP of type "Artisan" (such as "Advanced 3D", as found in the comp settings).
    when a render is invoked, the artisan receives from AE a transformation matrix for the camera and the transformation matrix for each layer.
    now the part where it all starts to make sense:
    the transformation matrix of a layer or camera is a result of the transform parameters values, including parenting layers.
    the only way to change the transformation matrix, is to change the transform parameters values, or those of a parent layer.
    neither an effect, nor an AEGP can change the transformation matrix. they can only change the param values.
    the only exception to the rule, is an Artisan AEGP.
    since it is doing the actual rendering, it can ignore the existing transformations and come up with it's own.
    to pull that off you need to write a 3D renderer, and your artisan needs to be the selected one for that comp. (can be set automatically by a plug-in)
    what are you other options?
    1. well, you can't create a new kind of camera (or any other kind of layer), so you can only affect a regular camera.
    you can have an effect or AEGP change the camera's transformation values each frame.
    that would create a camera motion without keyframes or expressions, though it would be a bit strange for the user to see the camera behave that way...
    you could also incorporate exisitng camera values to allow the user a adjust the camera, though that would not allow keyframing of such changes as you apply new values for each frame which would create keyframes of it's own.
    you would also not get any motion blur from the camera movement, because as far as AE knows, there is no animation, just a constant value that magically changes whenever the time does.
    2. there are also custom perspective views in AE. you can manipulate them over time instead of a camera. (i think you can set values to the custom views... not sure about it)
    in such a case the user won't have a camera to tweak, and you'll also receive no motion blur.
    3. connect the camera via parent to a null, make the null invisible (either via making that layer shy or some other shenanigans as making the layer stream hidden (i think it's possible)), and manipulate the parent null.
    that's all i can think of.
    i hope i didn't discourage you...

  • Better way of managing heirarchical groupings?

    Sort of a feature request, but also a question to other users about different approaches you like to use.  I've often wished for a way of grouping layers in a heirarchy that is independant of layer order, like you can do in most 3D apps (or -ahem- node based compositing systems).
    The ony ways of grouping layers that I know if in AE are:
    1: Pre Comping (obviously creates a single layer from multipe layers, which has limitations in certain situations)
    2: Pre-Comping and collapsing gemetries (makes management easy, but still has limitations of layers being outside comp)
    3: Using nulls as parents (allows you to select, control and move groups of layers, but does not facilitate easy showing/hiding or re-use)
    4: Using expressions (often problematic if you are changing layer orders around a lot to accomplish a goal)
    5: Creating color-coded groups for easier selection (limited number of colors, doesn't help with anything besides selection)
    Each has advantages and disadvantages and accomplishes different goals.  I would love to be able to create groups of layers that could easily be hidden and shown in the layer panel; selected, copied, and re-used; contain expressions and parent/child relationships; and exist within a larger composition and be dispursed among other layers outside of the group.  Using Nulls as parents is the closest thing to what I would like to be able to do, but is a bit more convoluted than I think it needs to be.  It seems like the ability to put groups of layers into a "folder" that you could expand or collapse would be a helpful UI feature. If you could have a list of these "folders" in the Project window, similar to the way you have a list of solids, you could duplicate and re-use them in other comps, change the layer order around, etc, and still have a cohesive group of layers to manage as a unit.
    Let's say you build an animation that has 50 3D and 2D layers, several expressions, and a bunch of keyframes.  Maybe you would want to use it several times in different ways within a larger piece, but need to have access to all the layers in each instance.  Also, you don't want to see all of the layers in the layer panel at once--you only really care about them as a group.  One technique is to parent them all to a null, use select children to select them all at once, and shy layers to hide the layers you don't want to see in the layer pallette.  The downside is that if there are already parented layers within the group it becomes very tricky not to screw up the heirarchy or any expressions.  You're creating the null for no other purpose than to manage a bunch of layers as a group, but it can interfere with the relationships among them if you're not careful.  Also, shy layers only gives you one level of showing and hiding to work with, which can be limiting if you have loads of layers in a comp.  Simply pre-comping them, and then using collapse-geometries can work in certain situations, but it limits your ability to use things like track mattes, adjustment layers, shadows, and other relationships that require layers to be in the same comp.
    Hopefully that makes some kind of sense.  Please share any insights you have on the tao of managing complex groups of layers so that we all may learn!

    ALSO: to be able to turn the layers on and off as a group would be great--very important point I forgot to mention in the previous post.  If you have layers hidden and you use "select children," turning the parent layer on and off does nothing to them.

  • How to apply same Animation to different Objects?

    Hello,
    So, as the question stated, I am trying to animate multiple objects in the scene with the same animation.
    For example, I have a SQUARE and a CIRCLE in the scene, both of them in different layers. I want them to both scale from 0% to 120%, then back to 90%, and finally to 100%. What I do is going in the SQUARE "scale" section and add keyframes to the time I want each elements (percentage) to be at. When done, the SQUARE works perfectly (scaling from 0>120>90>100 percent). Then, I copy and paste the keyframes I use with the SQUARE to the CIRCLE, which gives me the same animation as the SQUARE (0>120>90>100 percent). But when I want to make changes to both of them, I need to change each keyframes in each objects (SQUARE and CIRCLE) one by one...
    Having only two objects in the scene isn't bad, but I have around 30 objects that needs to be animated exactly the same... so changing them one by one is pretty time-consuming.
    So, the question is, is there a way where I can easily apply a type of animation (scaling 0>120>90>100, and adjustable afterwards) to different objects (SQUARE, CIRCLE, etc.) in my composition without doing it one by one?
    This might be a stupid question, but I'm new with After Effects so this is quite complicated for me...
    Thank you,
    Pascal

    Several ways, parenting and expressions.
    Parenting: Create a small solid or a null object that will be 'controlling' the other layers. Parent the CIRCLE and the SQUARE to it (to achive this, in the Parent column of the Composition Panel, select the name of the controlling layer or directly pickwhip the layer).
    Once done, when you scale/rotate/move the controlling layer the parented layers transform accordingly. It doesnt affect opacity.
    Be aware that parenting modifies the values you see in the Composition panel for each of these properties (scale/rotation/position) for each of the parented layers. This is because the transform properties are now expressed in the coordinate system of the parent layer, and not in the one of the comp. Modifying the transform properties of the parented layers tranform these layers relatively to the controlling one.
    Expressions: You can enter expressions in the transform properties of your layers. For instance, if your controlling layer is named 'controller', alt+click the stopwatch of the property 'Scale' of the SQUARE for instance and enter this in the expression box:
    thisComp.layer("controller").transform.scale;
    Now when you scale the controller, the SQUARE scales accordingly. It works for any property.
    Note that since the expression doesnt refer to the property's own keyframes, those keys are now ignored. To refer to the property's own key value in an expression, use simply 'value'. For instance:
    s = thisComp.layer("controller").transform.scale/100;
    [s[0]*value[0], s[1]*value[1]];
    The possibilities are pretty much infinite.

  • Re-using expression-generated values to input into other expressions (read-out)

    Hi there everyone. I was wondering if there is a way to 'capture' expression generated values and either buffer these values or re-using them directly in other expressions. I am trying to track rotations of parented layers, which are generated from the DuDuf IK expressions. Getting the rotation through a pick-whip will always return zero, of course; but as After Effects is able to physically show the expression generated value as a number, I guess it should also be able to output this number somewhere as a (buffered) digital value to be re-used somewhere again.
    Anyone ideas?

    Hi Dan, good to hear from you. I know, it sounds that easy. I'll try to explain this thing with a little more detail. If I can find a way to tackle this challenge, it will save me about 60 hours rendering each time this job passes my desk.
    I have a standard (5 sec.) comp with four lines of text in just one font with a fixed size and everything. As explained before, I run a script that generates between 300 and 400 copies of this comp, giving each new comp a logical and unique name, ánd... replacing the contents of all text lines in every copy of the comp. Now the first line of text is easy: just a number. It's left justified and the layout is always correct. The second, third and fourth line are actually a few people's names (the whole comp is actually a crew title for participants in the Dakar rally), where every name is followed by a three-character nationality abbreviation, like USA, or GER or FRA and so on. You must understand that the comp is built up in seven independant text fields, of which each one gets its content automatically through the mentioned script from an Excel sheet. Now here is the problem:
    The designer who created the layout for the titles wants to have the three-character nationality abbreviation exactly one character space BEHIND the name in every title. Ofcourse, the name (set in its own text field and AE layer) is pretty variable in length, so the position of the nationality field that comes right next to the name field, needs to be automatically adjusted in accordance with the name field length. To determine this position, the designer wrote (or adapted) an expression that samples the 'image' of the preceding name title, thus finding the rightmost white pixel (the titles are all simply white on black) and thus, with a certain offset, generating the right basic position for the following title.
    Now I thought I checked thoroughly for a possibility to extract the rightmost 'bounding box line' of a title in another video layer in AE somehow, and I couldn't find it; whereas you mention this can be done. If that is really possible, it would save my day...
    All I ran into was that text layers are always comp size (thisLayer.height and thisLayer.width always give 1920x1080 in an HD comp, no matter how small the text in the text layer) and therefore it seemed impossible to me (and the man who wrote the expression probably) to get any useful info concerning the characters positions and bounding boxes etc.
    So: how can this be done? How can I measure directly what the position value of the rightmost pixel of a line of text is and pass that on to another layer's position? In that case I can work around the time consuming sampleImage expression.
    I'm sure someone is going to send you a big bottle of wine on this one .... :-)

  • Find a specific Sublayer and move to top level layer

    I have a lot of illustrator files that are organized by a template size. The layers are setup so that the top level layer is always Template. However the sublayer I need to move to the top level could be called 42 Pg Border or 30 Pg Border or 24 Pg Border.
    Is there a way for a script to search through the layers and if it finds "42 Pg Border" or "30 Pg Border" or "24 Pg Border" in the sublayer Template it would move it to the top level but if it doesn't see one of those it doesn't give an error?
    I'm still new to scripting so the extent of my knowledge on this is to scan all the layers and unlock them. Then look for a specific layer name. It's the sublayer and moving it to the top level that I am not sure of.
    Here is my current code:
    var doc = app.activeDocument;
    var allLayers = doc.layers;
    for (var i = allLayers.length-1; i >= 0; i--){
        allLayers[i].locked = false;
        if (allLayers[i].name == "42 Pg Border" || allLayers[i].name == "30 Pg Border" || allLayers[i].name == "24 Pg Border") {
            alert("I found the " + allLayers[i].name + " layer")
        } else {
            alert("Not the right layer")
    Any help would be greatly appreciated!
    I am using CS4 on a Windows 64 Bit PC with JavaScript

    OK so that code is really close! I tweaked it a bit. I kept getting an error that said cannot move a locked layer. So I just made a loop to unlock ALL the layers first thing. Then to get rid of some of the "extra" code I wrote I changed this line:
    if (layer.name == "42 Pg Border" || layer.name == "30 Pg Border" || layer.name == "24 Pg Border") {
    to this.....
    if ((layer.name).substr(-6) == "Border") {
    So now instead of looking for 42 30 24 (and other border templates I may have to add) I just told it to look at the 6 characters at the end of the string (which will always be the word Border).
    OK so now the code runs and does what it is supposed to but I am getting an undefined in my javascript console in extendscript. Any ideas?
    Current updated code:
    var doc = app.activeDocument;   
    var allLayers = doc.layers;  
    var count = 0;
    for (var z = allLayers.length-1; z >= 0; z--){
        allLayers[z].locked = false;
    for (var i = allLayers.length-1; i >= 0; i--){ 
    deeper(allLayers[i]);
      if (count == 0){ 
         alert("No Border Layer Found"); 
    function checkLayer(parent,layer){    
        if ((layer.name).substr(-6) == "Border") {   
      layer.move(allLayers[0],ElementPlacement.PLACEBEFORE); 
            ++count; 
    function deeper(parent){ 
    var subLayers = parent.layers; 
      if (subLayers.length > 0){ 
      for (var i = subLayers.length-1; i >= 0; i--){   
      checkLayer(parent,subLayers[i]); 
      if (count>0){return} 
      deeper(subLayers[i]); 
      } return 

  • Shortest path issue

    Hey guys, first...Happy thanksgiving :)
    Ok, so I'm on my last assignment for my amazingly taught Data Structures class. I battled my way successfully through recursion, binary trees, redblack trees, 234 trees, B Trees, and heaps!...no issues at all!....but, now I have hit graphs. I understand the concept, but my latest assignment has me a bit frustrated..Im so close to finishing I can taste it!!....I just cant find the spoon..
    Here we go:
    We are given a graph on paper. It has circles (verteci) representing cities in the USA. These circles are connected by lines (edges) representing the distance between the cities. Also, the lines have arrows pointing the direction they may be traversed.
    We are to construct the graph in the computer, and then compute the shortest path from washington (Vertex 0) to every other city.
    I managed to construct the graph, and it will find the shortest path no problem. My only issue is that, it wants us to print the path it took, not just the destination and total distance....
    I have tried using a stack to push the verteci onto as theyre visited, but im not getting happy results.
    I should also mention, this code is taken out of the book with modifications by me so that it can add edges and verteci, and it now accepts String types for the vertex labels instead of characters.
    Here is my code
    PATH.JAVA (the important part)
    // path.java
    // demonstrates shortest path with weighted, directed graphs
    // to run this program: C>java PathApp
    import java.lang.*;
    import java.io.*;
    class DistPar               // distance and parent
    {                           // items stored in sPath array
        public int distance;    // distance from start to this vertex
        public int parentVert;  // current parent of this vertex
        public DistPar(int pv, int d)  // constructor
            distance = d;
            parentVert = pv;
    }  // end class DistPar
    class Vertex
        public String label;        // label (e.g. 'A')
        public boolean isInTree;
        public Vertex(String lab)   // constructor
            label = lab;
            isInTree = false;
    }  // end class Vertex
    class Graph
        private final int MAX_VERTS = 20;
        private final int INFINITY = 1000000;
        private Vertex vertexList[];    // list of vertices
        private int adjMat[][];         // adjacency matrix
        private int nVerts;             // current number of vertices
        private int nTree;              // number of verts in tree
        private DistPar sPath[];        // array for shortest-path data
        private int currentVert;        // current vertex
        private int startToCurrent;     // distance to currentVert
        private stack path_taken;       // stack to record path taken
        public Graph()                  // constructor
            vertexList = new Vertex[MAX_VERTS];
                                             // adjacency matrix
            adjMat = new int[MAX_VERTS][MAX_VERTS];
            nVerts = 0;
            nTree  = 0;
            for(int j=0; j<MAX_VERTS; j++)      // set adjacency
                for(int k=0; k<MAX_VERTS; k++)  //     matrix
                    adjMat[j][k] = INFINITY;    //     to infinity
            sPath = new DistPar[MAX_VERTS];     // shortest paths
            path_taken = new stack(MAX_VERTS);
        }  // end constructor
        public void addVertex(String lab)
            vertexList[nVerts++] = new Vertex(lab);
        public void addEdge(int start, int end, int weight)
            adjMat[start][end] = weight;  // (directed)
        public void path()                // find all shortest paths
            int startTree = 0;             // start at vertex 0
            vertexList[startTree].isInTree = true;
            nTree = 1;                     // put it in tree
          // transfer row of distances from adjMat to sPath
            for(int j=0; j<nVerts; j++)
                int tempDist = adjMat[startTree][j];
                sPath[j] = new DistPar(startTree, tempDist);
          // until all vertices are in the tree
            while(nTree < nVerts)
                int indexMin = getMin();    // get minimum from sPath
                int minDist = sPath[indexMin].distance;
                if(minDist == INFINITY)     // if all infinite
                {                        // or in tree,
                    System.out.println("There are unreachable vertices");
                    break;                   // sPath is complete
                else
                {                        // reset currentVert
                    currentVert = indexMin;  // to closest vert
                    startToCurrent = sPath[indexMin].distance;
                    // minimum distance from startTree is
                    // to currentVert, and is startToCurrent
                // put current vertex in tree
                vertexList[currentVert].isInTree = true;
                nTree++;
                path_taken.push(sPath[indexMin]);
                adjust_sPath();             // update sPath[] array
            }  // end while(nTree<nVerts)
            displayPaths();                // display sPath[] contents
            nTree = 0;                     // clear tree
            for(int j=0; j<nVerts; j++)
                vertexList[j].isInTree = false;
        }  // end path()
        public int getMin()               // get entry from sPath
        {                              //    with minimum distance
            int minDist = INFINITY;        // assume minimum
            int indexMin = 0;
            for(int j=1; j<nVerts; j++)    // for each vertex,
            {                           // if it's in tree and
                if( !vertexList[j].isInTree &&  // smaller than old one
                                   sPath[j].distance < minDist )
                    minDist = sPath[j].distance;
                    indexMin = j;            // update minimum
            }  // end for
            return indexMin;               // return index of minimum
         }  // end getMin()
        public void adjust_sPath()
          // adjust values in shortest-path array sPath
            int column = 1;                // skip starting vertex
            while(column < nVerts)         // go across columns
             // if this column's vertex already in tree, skip it
                if( vertexList[column].isInTree )
                    column++;
                    continue;
             // calculate distance for one sPath entry
                           // get edge from currentVert to column
                int currentToFringe = adjMat[currentVert][column];
                           // add distance from start
                int startToFringe = startToCurrent + currentToFringe;
                           // get distance of current sPath entry
                int sPathDist = sPath[column].distance;
             // compare distance from start with sPath entry
                if(startToFringe < sPathDist)   // if shorter,
                {                            // update sPath
                    sPath[column].parentVert = currentVert;
                    sPath[column].distance = startToFringe;
                column++;
             }  // end while(column < nVerts)
        }  // end adjust_sPath()
        public void displayPaths()
            for(int j=0; j<nVerts; j++) // display contents of sPath[]
                System.out.print(vertexList[j].label + "="); // B=
                if(sPath[j].distance == INFINITY)
                    System.out.print("inf");                  // inf
                else
                    System.out.print(sPath[j].distance);      // 50
                    String parent = vertexList[ sPath[j].parentVert ].label;
                    System.out.print(" (" + parent + ") ");       // (A)
            System.out.println("");
            System.out.println("PRINTING path_taken");
            DistPar thing = null;
            while((thing = path_taken.pop()) != null)
                System.out.println(" " + vertexList[thing.parentVert].label + " "+ thing.distance);
    }  // end class GraphSTACK.JAVA (my stack class)
    // stack.java
    // demonstrates stacks
    // to run this program: C>java StackApp
    class stack
        private int maxSize;        // size of stack array
        private DistPar[] stackArray;
        private int top;            // top of stack
        public stack(int s)         // constructor
            maxSize = s;             // set array size
            stackArray = new DistPar[maxSize];  // create array
            top = -1;                // no items yet
        public void push(DistPar j)    // put item on top of stack
            stackArray[++top] = j;     // increment top, insert item
        public DistPar pop()           // take item from top of stack
            return stackArray[top--];  // access item, decrement top
        public DistPar peek()          // peek at top of stack
            return stackArray[top];
        public boolean isEmpty()    // true if stack is empty
            return (top == -1);
        public boolean isFull()     // true if stack is full
            return (top == maxSize-1);
    }PATHAPP.JAVA (test program..builds the graph and calls path())
    class PathApp
        public static void main(String[] args)
            Graph theGraph = new Graph();
            theGraph.addVertex("Washington");
            theGraph.addVertex("Atlanta");
            theGraph.addVertex("Houston");
            theGraph.addVertex("Denver");
            theGraph.addVertex("Dallas");
            theGraph.addVertex("Chicago");
            theGraph.addVertex("Austin");
            theGraph.addEdge(0,1,600);
            theGraph.addEdge(1,0,600);
            theGraph.addEdge(0,4,1300);
            theGraph.addEdge(4,3,780);
            theGraph.addEdge(3,1,1400);
            theGraph.addEdge(1,2,800);
            theGraph.addEdge(2,1,800);
            theGraph.addEdge(4,5,900);
            theGraph.addEdge(4,6,200);
            theGraph.addEdge(6,4,200);
            theGraph.addEdge(6,2,160);
            theGraph.addEdge(3,5,1000);
            theGraph.addEdge(5,3,1000);
            System.out.println("Shortest Paths");
            theGraph.path();
            //theGraph.displayPaths();
            System.out.println();
    }Im mostly having trouble comprehending the Path.java file. A few friends and I stared at it for a few hours and couldnt get it to do what we wanted...
    path_taken is the stack I added in to try and push/pop the verteci as theyre traversed, but with what I stuck in right now, it still just prints the most recently visited vertex, and the sum of the distances.
    Any help is greatly appreciated!
    Thanks :)
    ----Arkhan

    If your graph is G(V, E), and you're trying to get to vertex v_end, then create a new graph G'(V', E') whereV' = (V x N) U {v_end'}
        (v_end' is a new object)
    E' = {((u, t), (v, t + f(u, v, t))) : (u, v) in E, t in N} U
         {((u, t), (u, t + 1)) : u in V, t in N} U
         {((v_end, t), v_end') : t in N}G' is infinite, so you'll need to use a lazy graph structure. Then just use Dijkstra from (v_start, 0) to v_end'.

  • Can't exit out of dialogue box in After Effects

    Hi,
    A couple of times now I have accidently reduced my cameras scale below 0% and have had this dialogue box appear.
    When I click 'OK' it just keeps popping up again. I have no way of exiting out of it and resuming my work. The last couple of times I have forced closed After Effects, but as a result, I lost all my work since my last save!
    This time I have done too much to risk loosing it all, does anyone have any suggestions of how to exit this dialogue box without having to exit the program and lose my work?
    Thanks for your help!
    Kim

    The problem is easily reproduced, and I can't find any way out of it.  It's worth posting as a bug to the AE team, because really the software should be able to escape from the infinite loop it creates.
    In the short term, it appears to me you have no option but to force quit.  Hopefully you are using regular auto-saves so you don't lose more than a few minutes work.
    In the future, I'd recommend you simply get diligent about not editing the scale of any camera parented layers.  Ultimately this is a user error, after all.

  • Bulge effect center to follow a rotated layer

    Hey guys!
    This one got me bad I've been thinking my brains out but just can't seem to find a proper solution:
    Imagine a light bulb hanging from the ceiling. The wire that it's hanging from is rotating and the light bulb is parented to that wire, so that it follows the rotations. In other words the light bulb is swinging back and forth. I simply want the bulge effect to follow where the light bulb goes, but man is that turning out to be a difficult task!
    It's difficult, because the bulge effect can only be moved by changing the "bulge center" parameter. If I for example put the bulge effect on an adjustment layer and rotate/move the adjustment layer, nothing happens, since the bulge center itself is not moved.
    How on earth can I get the bulge center to follow a rotation that exists on a parent layer, so that also the anchor point of that bulge center rotation is placed where it should be (the same place where the anchor point for the wire is)? The anchor point is important to make the bulge center always be where the light bulb is, to give the illusion of the light bulb glass "bulging" the wall behind it.
    Wow am I in awe if someone can come up with an elegant solution!

    bulb = thisComp.layer("Bulb");
    cntr = bulb.anchorPoint;
    bulb.toComp(cntr)
    bulb is referring to the footage layer named Bulb
    cntr could be anything. This is just a cleaner way to write thisComp.layer("Bulb".anchorPoint") and it makes writing the layer space transformation easier.
    You could write:
    thisComp.layer("Bulb").toComp(thisComp.layer("Bulb").anchorPoint)
    I think that is a lot more difficult to understand and it's more difficult to write. The expression simply returns the composition coordinates of the "Bulb" layer's anchor point. IOW For the layer "Bulb" (bulb.) give me the Composition Coordinates of the Anchor Point (toComp (cntr).
    When you attach a parent to a layer the position property values are calculated as an offset from the parent layer's position property. Layer Space transformations recalculate the  position in relative to the composition or to the world when working with 3D layers.
    Here's how the expressions works in plain english.
    Calculate the position coordinates by calculating the offset of the target layer from the composition center by calculating the difference between the child layer's (Bulb) position coordinates from the parent layers (Cord Layer) position offset from the composition center to determine the actual composition coordinates of the child layer's anchor point.
    There's more info about layer space transformations in the expressions section of the help files. It's worth reading.

  • Problems Involving text and FCP

    I'm working on of the motion templates and the text that I am adding in motion, when I open the same project file in FCP the same text gets moved and is no longer in the same position.
    http://img685.imageshack.us/img685/4611/screenshot20100225at914.png
    This is a screen shot of what I am talking about. Notice the light blue text (Usion T(X)ENTY) is no longer in the same location in FCP as it was in Motion. Besides this I have noticed no other differences so I'm thinking it has something to do with the text. Thoughts?

    hi,
    I sometimes get this kind of issue with fonts moving or not looking right in fcp or on export. I can cure it by building the effect in a different way. For example applying as fade behaviour will sometimes result in a pixel shift of the text in and out of the fade. But if i manually keyframe the opacity of the text its all fine. Sometimes shifting effects to parent layers and clicking their fixed resolution will cure it as well.
    hth
    adam

Maybe you are looking for

  • Problem - Hyperlinks change on export to PDF

    Working in Indesign 7.0.3 and Snow Leopard 10.6.5 I have been asked to design a publication that will include hyperlinks to other files (PDFs and Word documents) on the client's network. The client has supplied as the source a Word document with hype

  • Download entire dashbord page at once.

    Hi Experts, I have several small reports on dashborad page... Is it possible to download all the reports from dashboard page at once? Thanks, Mani.

  • Flat File Upload from WebDynpro ABAP

    Hi, I am struggling to find a solution for this requirement and I hope I get some help from the Gurus here. I have to upload a ".csv" file from the WebDynpro application, and then store the data in the flat file in a Z# table. Can some one explain me

  • Mail app on imac is not working

    mail app will not load the page completly and i get the pizza wheel of death andmail does not load.

  • Typing Russian characters

    Is it possible to type in Russian characters on an Intel iMac, running Yosemite? Are there software apps that can simultaneously transcribe English alphabet to Russian? (Or rather, translate to Russian, which may not be the same thing). Thanks in adv