-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to get source id for item #321
Comments
Hi, sorry for the late response. First off, I'll just give some sort of a direction on what you can do to achieve what you intended to do, assuming that you just want to simply skip the linked items if they were already "processed" at least once:
Pseudocode:
As for why does xjs always request Edit: as for why does xjs always requests Hope that helps. |
Thanks for your response. What you propose now is pretty much exactly what we're doing now (except iterating sources per scene rather than all at once), but it's too slow. We have a project where most sources have a dozen or so linked items, and we've found that We have a project with around 500 items and maybe 50-100 sources, and iterating them all took minutes. We then realized that we didn't actually need
True, but the same thing applies to the
But when an item is unlinked, wouldn't that just duplicate the source, so that he old id is still valid but a new one is added? And wouldn't it be more correct for the More specifically, consider:
This seems wrong: I had a reference to a source, which is suddenly changed to another source, which seems wrong to me. Unless you interpret a |
In XJS, when you’re trying to get or set a property of an item, both the core/items/item.ts (and all other item variants) and core/source/source.ts (and all other source variants) would make use of internal/item.ts’ get, wrapGet, set, wrapSet methods. With that in mind, the difference between using the item class and source class is minimal in terms of the level of indirection since they both use the same internal static methods.
I would have to agree with you on this one. A source shouldn’t change to another source, and the only way for a source to be “invalid” is if it was deleted. But what you said in the second part is true, which is why it currently behaves this way:
The reason why XJS was designed in such a way rather than the other way around is mainly due to the fact that XJS 2 was created and released before XSplit had a concept of "sources" and "items" (ie. before the "linked items" feature came around). The fact that existing plugins that use XJS already treats the items as the base object, the whole sources concept was then treated as just another property to get from an item. Just to give an example of an issue that we tried to avoid:
We could've made the sources as the base of all items in XJS, but it could be treated as a breaking change... and that would mean releasing a major version to denote that whatever concept we had in XJS2 would most likely not apply in the new version. |
Yeah exactly, though I still expect operating on sources to be (somewhat) slower because of the extra code in
Yeah, I had guessed as much from looking at the internals. Doesn't make the code easier, but I can see how this affects compatibility indeed.
I think that's pretty much the same as the example I gave, though you talk about getting the name rather than the source id. And I guess the name of a source is actually the name of an item, so different items have different names even when they share the same source. So what makes it weird is that you can access Item properties through a Source object, which does not make sense conceptually, but is needed for compatibility because what's now an Item used to be called Source before linked sources. I can see the problem, yeah :-) Anyway, I think I know enough to move forward here. The core of the issue remains open, though: Should an Item get a |
Yeah, adding that method does make sense and shouldn't be hard to do. Edit: @SML-MeSo is there an active milestone that we can sneak this changes to? |
I'm looking to identify which items are linked to the same source (more specifically, when iterating over all items, only process one item for each linked source and skipping subsequent ways). An obvious way to do so would be to get the id of the source linked to an item and see if that id is the same.
It think I can do this using
Item._srcId
, but that's of course an internal property. There does not seem to be anItem.getSourceId()
or so, would that be worth adding?I could of course do
getSource().getId()
, but that involves several async requests (sincegetSource()
requestsconfig
rather than usingthis._xmlparams
which I suspect is the same, andgetId()
for a source requestsprop:srcid
rather than returning justthis._srcId
, for reasons I don't follow) and constructs a new object, which should not really be needed.The text was updated successfully, but these errors were encountered: