{"action":"created","issue":{"url":"https://api.github.com/repos/AnimalLogic/AL_USDMaya/issues/80","repository_url":"https://api.github.com/repos/AnimalLogic/AL_USDMaya","labels_url":"https://api.github.com/repos/AnimalLogic/AL_USDMaya/issues/80/labels{/name}","comments_url":"https://api.github.com/repos/AnimalLogic/AL_USDMaya/issues/80/comments","events_url":"https://api.github.com/repos/AnimalLogic/AL_USDMaya/issues/80/events","html_url":"https://github.com/AnimalLogic/AL_USDMaya/pull/80","id":317118822,"number":80,"title":"Layermanager now tracks all EditTargets","user":{"login":"dbaz","id":118460,"avatar_url":"https://avatars1.githubusercontent.com/u/118460?v=4","gravatar_id":"","url":"https://api.github.com/users/dbaz","html_url":"https://github.com/dbaz","followers_url":"https://api.github.com/users/dbaz/followers","following_url":"https://api.github.com/users/dbaz/following{/other_user}","gists_url":"https://api.github.com/users/dbaz/gists{/gist_id}","starred_url":"https://api.github.com/users/dbaz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dbaz/subscriptions","organizations_url":"https://api.github.com/users/dbaz/orgs","repos_url":"https://api.github.com/users/dbaz/repos","events_url":"https://api.github.com/users/dbaz/events{/privacy}","received_events_url":"https://api.github.com/users/dbaz/received_events","type":"User","site_admin":false},"labels":[{"id":912119669,"url":"https://api.github.com/repos/AnimalLogic/AL_USDMaya/labels/not%20for%20merging","name":"not for merging","color":"fef2c0","default":false}],"state":"open","locked":false,"assignee":{"login":"dbaz","id":118460,"avatar_url":"https://avatars1.githubusercontent.com/u/118460?v=4","gravatar_id":"","url":"https://api.github.com/users/dbaz","html_url":"https://github.com/dbaz","followers_url":"https://api.github.com/users/dbaz/followers","following_url":"https://api.github.com/users/dbaz/following{/other_user}","gists_url":"https://api.github.com/users/dbaz/gists{/gist_id}","starred_url":"https://api.github.com/users/dbaz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dbaz/subscriptions","organizations_url":"https://api.github.com/users/dbaz/orgs","repos_url":"https://api.github.com/users/dbaz/repos","events_url":"https://api.github.com/users/dbaz/events{/privacy}","received_events_url":"https://api.github.com/users/dbaz/received_events","type":"User","site_admin":false},"assignees":[{"login":"dbaz","id":118460,"avatar_url":"https://avatars1.githubusercontent.com/u/118460?v=4","gravatar_id":"","url":"https://api.github.com/users/dbaz","html_url":"https://github.com/dbaz","followers_url":"https://api.github.com/users/dbaz/followers","following_url":"https://api.github.com/users/dbaz/following{/other_user}","gists_url":"https://api.github.com/users/dbaz/gists{/gist_id}","starred_url":"https://api.github.com/users/dbaz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dbaz/subscriptions","organizations_url":"https://api.github.com/users/dbaz/orgs","repos_url":"https://api.github.com/users/dbaz/repos","events_url":"https://api.github.com/users/dbaz/events{/privacy}","received_events_url":"https://api.github.com/users/dbaz/received_events","type":"User","site_admin":false}],"milestone":null,"comments":1,"created_at":"2018-04-24T08:21:08Z","updated_at":"2018-05-03T06:48:53Z","closed_at":null,"author_association":"COLLABORATOR","pull_request":{"url":"https://api.github.com/repos/AnimalLogic/AL_USDMaya/pulls/80","html_url":"https://github.com/AnimalLogic/AL_USDMaya/pull/80","diff_url":"https://github.com/AnimalLogic/AL_USDMaya/pull/80.diff","patch_url":"https://github.com/AnimalLogic/AL_USDMaya/pull/80.patch"},"body":"## Description\r\n@nxkb @elrond79 @sirpalee \r\n\r\nThis is a preview of some code I modified during a task I'm part way through for some AL internal pipeline work where I need to be able to get all the layers that have been modified so I can serialise them out.\r\n\r\nPreviously, the layerManager wasn't keeping track of the first EditTarget or the last EditTarget that was set, only the previously set EditTarget. Now, if you set an EditTarget the LayerManager immediately starts to track the layer.\r\n\r\nThe LayerManager also now has the option to only return \"Dirty\" layers, which are layers that have changed from it's persistent(serialised?) representation. The API defaults to only return the \"Dirty\" layers.\r\n\r\nLet me know if this logic breaks anything on your ends.\r\n\r\n## Changelog\r\n\r\n### Added\r\n\r\n- You can now ask for all layers or just the dirty layers from the LayerManager\r\n\r\n### Changed\r\n\r\n- All layers that are set as the EditTarget are tracked by the LayerManager\r\n\r\n### Deprecated\r\n\r\n### Removed\r\n\r\n### Fixed\r\n\r\n## Checklist (Please do not remove this line)\r\n- [ ] Make sure the Title and Description of the PR make sense and  provide sufficient context for your work\r\n- [ ] Do any added files have the correct AL Apache Licence Header?\r\n- [ ] Are there Doxygen comments in the headers?\r\n- [ ] Are any new features, behaviour changes documented in the .md format [documentation](https://github.com/AnimalLogic/AL_USDMaya/docs)\r\n- [ ] Have you added, updated tests to cover new features and behaviour changes\r\n- [ ] Do all the commits in this PR have a meaningful message?\r\n- [ ] Can ChangeLog info be extracted from the PR description or commit messages\r\n"},"comment":{"url":"https://api.github.com/repos/AnimalLogic/AL_USDMaya/issues/comments/386204912","html_url":"https://github.com/AnimalLogic/AL_USDMaya/pull/80#issuecomment-386204912","issue_url":"https://api.github.com/repos/AnimalLogic/AL_USDMaya/issues/80","id":386204912,"user":{"login":"dbaz","id":118460,"avatar_url":"https://avatars1.githubusercontent.com/u/118460?v=4","gravatar_id":"","url":"https://api.github.com/users/dbaz","html_url":"https://github.com/dbaz","followers_url":"https://api.github.com/users/dbaz/followers","following_url":"https://api.github.com/users/dbaz/following{/other_user}","gists_url":"https://api.github.com/users/dbaz/gists{/gist_id}","starred_url":"https://api.github.com/users/dbaz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dbaz/subscriptions","organizations_url":"https://api.github.com/users/dbaz/orgs","repos_url":"https://api.github.com/users/dbaz/repos","events_url":"https://api.github.com/users/dbaz/events{/privacy}","received_events_url":"https://api.github.com/users/dbaz/received_events","type":"User","site_admin":false},"created_at":"2018-05-03T06:48:53Z","updated_at":"2018-05-03T06:48:53Z","author_association":"COLLABORATOR","body":"tldr;\r\nYes, I just need to know about all the layers that have been dirtied. No, I don't need to know about all the Layers that have been EditTarget.\r\n\r\nIf I call ```trackEditTargetLayer()``` just before wanting to grab the dirty EditTargets (or add that flag you mentioned), in it's current implementation, will track the current EditTarget's layer even if it hasn't been dirtied. Does it follow the design to put the logic to track only dirty layers here? \r\n\r\n\r\nBit longer brain dump:\r\nI see the paradigm is shifting in this way:\r\nA) LayerManager will only track layers that were dirtied. Is up to be up-to-date when serialising\r\nB) LayerManager will track all layers that have been set as the EditTarget. Is updated when EditTarget is set.\r\n\r\n\r\nThe two solutions are a bit different in the way of \"how and when\" LayerManager is up to date with the dirty layers. Previously, it was guarentee'd up to date when saving the scene, but I wanted it to be up to date immediatly after doing edits on a newly set EditTarget. I have a usecase lower down.\r\n\r\n\r\n```Consider the scenario where we open a maya file which has a serialized layer, and then immediately save it again. It's not hard to imagine that a layer might be considered not dirty```\r\nI'm not sure how my change could effect the previous logic with the deserialisation, but from my tests the ``ImportFromString`` marks it as dirty, so it will be saved again, in both implementations.\r\n\r\n\r\n```Taking a step back - it generally seems a safer approach to say:\r\n\r\nA) only save in our local storage things that we really need to... but then once it's there, it STAYS there until we explicitly remove it```\r\n\r\nYep this is the optimal solution, to track only layers that are 'dirty' and that have been the EditTarget.\r\nI agree that my solution isn't optimal because as you stated since it tracks all layers that have been the EditTarget, even if it isn't 'dirtied', though I don't think it's a performance killer or anything like that, but it can be a tad wasteful. To do this optimally is a bit more work using USD's notices. But all this I think is outside the original design of the LayerManager who's main goal was the serialise out all the dirty layers.\r\n\r\n```\r\nDid you actually run into a scenario where this was the case, or is this just based on your reading of the code?\r\n```\r\nYep, I ran through the usecase below.\r\n\r\n```However, it is not just called by the onEditTargetChanged() callback; it is also called when the stage is first created, in ProxyShape::loadStage(), and immediately before it is serialized, in ProxyShape::serialize()```\r\n\r\nThis is where I ran into problems, I don't save the scene in my use case, but yes, it correctly serialises all the layers that have been edited when saved, but I wanted to be able to ask the LayerManager for all the edited layers at any time. \r\n\r\nSo the steps I do are:\r\n1 Load a ProxyShape\r\n2 Set the EditTarget to my SubLayer\r\n3 Modify the EditTarget contents\r\n4 Run a script that exports the Maya scene into our renderer's scene description\r\n\r\nDuring step 3, no LayerManager node is created, so when the script runs to export our renderer's scene description it can't find any modified layers."}}
{"actor":{"display_login":"dbaz"}}