Giter VIP home page Giter VIP logo

Comments (11)

ivansenic avatar ivansenic commented on May 30, 2024 1

I will send some final resolution about this during the day.

from nexrender.

ivansenic avatar ivansenic commented on May 30, 2024

Proposed solution:

    function isNestedComp(comp, name, parentChain) {
        if (
          name &&
          comp.name === name &&
          parentChain &&
          parentChain.length > 0 &&
          comp.usedIn.length > 0
        ) {
          for (var i = 0; i < comp.usedIn.length; i++) {
            if (
              comp.usedIn[i] instanceof CompItem &&
              comp.usedIn[i].name === parentChain[parentChain.length - 1]
            ) {
              var parentComp = comp.usedIn[i];
              if (parentChain.length === 1) {
                return true;
              } else {
                var chainCopy = [...parentChain];
                var isNested = isNestedComp(
                  parentComp,
                  chainCopy.pop(),
                  chainCopy
                );
                if (isNested) {
                  return true;
                }
              }
            }
          }
        }
        return false;
    }

from nexrender.

inlife avatar inlife commented on May 30, 2024

Have you had a chance to test the proposed solution @ivansenic ?
I might be wrong, but I feel like the [...] operator would not work in the older jsx scripting environment of AE

from nexrender.

ivansenic avatar ivansenic commented on May 30, 2024

Did not test it yet, will try tomorrow. Would .slice(..) be better alternative?

from nexrender.

inlife avatar inlife commented on May 30, 2024

Actually yeah, there potentially could work:

var chainCopy = parentChain.slice()
// or
var chainCopy = [].concat(parentChain)

from nexrender.

ivansenic avatar ivansenic commented on May 30, 2024

Will test this today with slice() and report back once I have resulsts..

from nexrender.

ivansenic avatar ivansenic commented on May 30, 2024

@inlife My solution does not work.. It still matches the first parent found so yea does now work.. I'll continue exploring the options..

from nexrender.

stale avatar stale commented on May 30, 2024

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

from nexrender.

inlife avatar inlife commented on May 30, 2024

Will be looking forward to that!

from nexrender.

ivansenic avatar ivansenic commented on May 30, 2024

I my comment I said that the fix is not working, but that's not really true. The fix proposed is definitely a good one, however, I would like to explain in what situations it helps and why I said it's not working in the test we did.

There are two situations to distinguish. When a same composition is used in two different parents, and when two completely different compositions have a same name.

Situation 1: Same comp in different parents

In this case we have a same composition included in two different parents. So we have following situation (made up IDs in brackets):

  • First (1) -> Target comp (3)
  • Second (2) -> Target comp (3)

Now without the fix above, following happens:

  • If you target a layer First->Target comp, it will work and layer would be updated. Because it's the same comp, it will be updated in that Target comp which influences both First (1) and Second (2).
  • If you target a layer Second->Target comp, it will not work and nothing will be updated (proposed fix solves this issue).

Now important is to understand that in this situation there is no way to update the layer only in one concrete path. As composition is contained in two parents, any matched path would influence the comp and thus both parents. This is the reason I said fix is not working at the first place, as it's actually impossible to achieve once you have same comp in different parents.

Situation 2: Different comps with same name

In this case we have different compositions included in two different parents. So we have following situation (made up IDs in brackets):

  • First (1) -> Target comp (3)
  • Second (2) -> Target comp (4)

Now without the fix above, following happens:

  • If you target a layer First->Target comp, it will work and layer would be updated. Because it's the different target comp, it will be updated on in the composition contained in the First (1).
  • If you target a layer Second->Target comp, it will not work and nothing will be updated (proposed fix solves this issue).

Conclusion

Fix is improving the path based selection for sure. It's deployed in our production for over a month now and we saw no other issues or any backward incompatibility.

from nexrender.

stale avatar stale commented on May 30, 2024

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

from nexrender.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.