Skip to content
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

Manually selecting the parent of an already selected transform is causing a maya error #22

Closed
sirpalee opened this issue Aug 16, 2017 · 1 comment
Assignees

Comments

@sirpalee
Copy link
Contributor

sirpalee commented Aug 16, 2017

How to reproduce the issue:

  • Load up an usd file into a proxy with several levels of prims.
  • Use the proxy shape select to select one of the prims in the deeper levels.
  • Open the outliner and click on one of its parents.

Explanation.
This whole issue starts from the OnSelectionChanged callback. Whenever the user clicks on the outliner, the second branch is executed in ProxyShape::onSelectionChanged (i.e., selectionMode is zero). This ends up calling AL_usdmaya_ProxyShapeSelect, and passes the prims that are not in the current selection list as parameters. Since the active selection list is already updated to the new one, it contains one of the parent prims, so the previously selected prim is about to be removed.

This jumps through a couple of functions and ends up in ProxyShape::removeUsdTransformChain_internal.

Here, the prim passed to the command is getting deleted, and all of its parent prims. However, this deletes the prim that was just selected. And Maya throws an error.

My initial pass at the problem was not to delete objects that are in the current selection list. (pseudocode below)

MSelectionList sl;
MGlobal::getActiveSelectionList(sl);
...
if(it->second.checkRef(reason))
{
  MObject object = it->second.m_node;
  MFnDagNode dgNode(object);
  MDagPath dg;
  dgNode.getPath(dg);
  if (sl.hasItem(dg)) { return; }
  ...

However, this approach does not take branches in the hierarchy account. Ie, the usd file looks something like this

- A
  - B
    - C
    - D

We have both C and D selected, and the user deselects C in the UI. That'll trigger deletion of C, and because none of its parent transforms is selected, all of them are going to be selected.

While the snippet above added to the code helps the first time a parent is selected, the second time it fails too. (none of the transforms are removed, and the stuck around) That happens, because proxy->selectedPaths is going to be empty, and the selection command exits early.

I tried to force reselection of the nodes that are part of the active selection list in the onSelectionChanged callback to ensure they still exist / / maintained properly in the internal selection lists, but that created other problems.

So far it looks like this issue is a general problem of how the selections are tracked. Unless I missed something very trivial in other parts of the pipe.

Any feedback would be greatly appreciated.

@robthebloke robthebloke self-assigned this Sep 19, 2017
seando-adsk pushed a commit to autodesk-forks/AL_USDMaya that referenced this issue Nov 19, 2018
seando-adsk pushed a commit to autodesk-forks/AL_USDMaya that referenced this issue Nov 27, 2018
1. glext.h is not in the devkit anymore, switching files

2. Adding chrono for windows only

3. Adding python libraries to fix link issue

4. MAYA-xxxx Integrating UFE into AL_USDMaya plugin
- Integration of the UFE libraries include cmake lookup and cmake on/off
  variables to enable and disable compilation with UFE
- Integration of a runtime variable to switch on/off UFE selection with
  the plugin
- Integrate UFE selection and disabling creation of proxy nodes for usd
   prim selections

5. Updating runtime id, separator of USD, and adding an added header in the want ufe build ompile

6. Missing header file

7. Merging 0.28.5 into dev-adsk (AnimalLogic#9)

8. Windows build fixes: (AnimalLogic#10)
* Remove treat warnings as errors (/WX)
* Multiline (with \) the C++ options

9. Show the UFE selection in the viewport (AnimalLogic#11)

* Show the UFE selection in the viewport

* When drawing the override, if the env var MAYA_WANT_UFE_SELECTION is
  set get the UFE selection and for the USD items draw them in wireframe
  with the Maya selection color.

* Code review: adding code comments

* Fix spelling mistake

10. Changing PATHS to HINTS in cmake file

11. Windows build fixes (AnimalLogic#13)

* MAYA-93327 - Integrate USD in Maya

* Install the Windows .pdb files.

* Add UFE build define when cmake flag is set.

* Fix relative library path for plugInfo.json files.

* Build schemas/plugInfo.json in binary folder (not source).
  So git status is not dirtied.

* Use UFE_VERSION (instead of hard-coded value) which is set above this
  repo when building.

* When building with UFE, we must have the UFE version defined.

* Code review comments - build ufe major/minor vars in the parent rather
  than child (FindUFE.cmake). This way they are accessible to others.

12. MAYA-93327 - Integrate USD in Maya (AnimalLogic#14)

* RPATH has been deprecated in favor or RUNPATH which is same except
  that it is searched after LD_LIBRARY_PATH. This gives users the ability
  to override the shared libraries.

13. Use local UFE and versioning fix.

14. Convert FindUFE.cmake to LF line endings.

15. Improved USD selection highlighting.

16. MAYA-88299 - Versioning for UFE and API (AnimalLogic#16)

* UFE lib/dll/so/dylib with major only version (no minor).

17. Merging master (0.29.1) into dev-adsk (AnimalLogic#17)

18. MAYA-94776 - Update USD plugin to latest AL branch (AnimalLogic#18)

* Adding missing pdb file for new plugin file.

19. MAYA-94776 - Update 'dev-adsk' to latest 'develop' to get VP2 Selection code (AnimalLogic#19)

20. MAYA-95136 consistent behavior with legacy VP1 selection (AnimalLogic#20)

21. MAYA-94667 deselect USD objs by clicking void area (AnimalLogic#21)

* MAYA-94667 deselect USD objs by clicking void area

* MAYA-94667 code review suggestions

* MAYA-94667 code review suggestion

22. MAYA-95136 selection under complex transform nodes (AnimalLogic#22)

23. MAYA-95391 revert regression change (AnimalLogic#23)

24. MAYA-95391 RMB click shouldn't trigger selection (AnimalLogic#24)

Port the VP1 implementation in ProxyShapeUI::select().

25. MAYA-95322 update bounding box of AL_MayaUSD proxy shape (AnimalLogic#25)

* MAYA-95322 update bounding box of AL_MayaUSD proxy shape

* MAYA-95322 code review feedback

26. Temporary restore alwaysDirty ProxyDrawOrride

(cherry picked from commit 6060036)

MAYA-95165 : Crash when duplicating USD objects

   The regression was introduced by the commit https://git.autodesk.com/autodesk-forks/AL_USDMaya/commit/321be29175a43aa270bb9d50387ac335c0d483d0
   To avoid that problem we cherry-picked the correction from the last
   updates in the develop branch.

27. MAYA-95627 - Update to latest AL develop branch v0.29.4 + USD v18.11

Merge branch 'develop' into donnels/merging_in_develop_0.29.4

28. MAYA-95627 - Update to latest AL develop branch v0.29.4 + USD v18.11

* Fixing merge (of develop branch into dev-adsk) error.

29. MAYA-95627 - Update to latest AL develop branch v0.29.4 + USD v18.11 (AnimalLogic#28)

* Some minor fixes related to merging discovered when trying to merge
  our 'dev-adsk' branch into 'develop'.

30. Comment from initial pull request to AL
@pmolodo
Copy link
Contributor

pmolodo commented Apr 17, 2019

I believe this has been fixed / merged, so you can close this issue...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants