Skip to content

Conversation

@yannci
Copy link
Contributor

@yannci yannci commented Nov 3, 2022

This PR adds a proxy type of ieSceneShape. In maya scenes with lots of ieSceneShapes we noticed huge frame rate drops. These are related to maya's ViewPort2 and the SubSceneOverride asking every ieSceneShape if it needs to be updated.
This call turned out to be very costly and is also executed for scene shapes that are set to invisible. Multiple attempts of rewriting scene shape to use other API classes failed or have proven themselves as unstable. We therefore implement a proxy version of ieSceneShape that provides the same functionality as the base class in regards of reading scene caches and output paths, attributes and tags but is not registered with the viewport as drawable. This allows us to replace hidden ieSceneShapes with ieSceneShapeProxy and gain back performance.

  • Add ieSceneShapeProxy as a subclass of ieSceneShape that is not registered as drawable
  • Allow ieSceneShape to find ieSceneShape and ieSceneShapeProxy types during hierarchy traversal
  • Change FnSceneShape's staticmethods to classmethods for easier subclassing
  • Allow FnSceneShape to operate on scene shapes and proxies interchangeable while keeping the API
  • Restructure ieSceneShape tests to allow subclassing and run the same tests with a different node type

Related Issues

Checklist

  • I have read the contribution guidelines.
  • I have updated the documentation, if applicable.
  • I have tested my change(s) in the test suite, and added new test cases where necessary.
  • My code follows the Cortex project's prevailing coding style and conventions.

yannci added 12 commits October 6, 2022 16:48
We noticed huge FPS drops in scenes with a huge amount of
`SceneShapes`. Profiling showed that a lot of time is spend by
`SubSceneOverride` requesting draw updates from the shapes in
the scene. This also happens for shapes that are set as hidden,
what we consider a bug/flaw in Maya's VP2 drawing API.

To alleviate this issue, we derive the proxy from `SceneShape`
and inherit all of it's behaviour with the exception, that we don't
register it as drawable. This allows us to replace `SceneShape`s with
its proxy implementation, where only the data reading capabilities
are needed, e.g. layouts or rigs.
We backport the Python3 compatibility changes for `FnSceneShape.py`
and `__init__.py from the following commits:
   - 58d250f
   - 8f7f614

This is to avoid merge conflicts later on
Changing all `staticmethod`s to `classmethod`s and replacing
all method calls from within the class to use either `self`
or `cls` instead of the class name. This allows for easier
inheritance and less code duplication in subclasses
With overriding the `__new__` method of the `FnSceneShape` class we
change the object type during construction and before initialization.
This gives us the ability to use `FnSceneShape` regardless if it's
dealing with a `SceneShape` or it's proxy version.
We add the `shapeType` argument to the methods that can create a
`SceneShape` node to specify if we want to create an `ieSceneShape` or
its proxy version. If we don't pass in the argument `FnSceneShape`
will create shapes of the type it was initially created with.
Moving the node creation in the `setUp` method, which is called before
every test method, gives subclasses the ability to run the same test
cases with a different node. This is e.g. useful for
`ieSceneShapeProxy` as we need to make sure that it behaves the same
way as it's non proxy version
@ivanimanishi ivanimanishi merged commit df242ef into ImageEngine:RB-10.3 Nov 3, 2022
@ivanimanishi ivanimanishi deleted the ieSceneShapeProxy branch November 3, 2022 23:29
ivanimanishi added a commit that referenced this pull request Nov 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants