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

Ufe selection stops working if USD object set to inactive #6

Open
pmolodo opened this issue Jan 30, 2019 · 2 comments
Open

Ufe selection stops working if USD object set to inactive #6

pmolodo opened this issue Jan 30, 2019 · 2 comments

Comments

@pmolodo
Copy link
Contributor

pmolodo commented Jan 30, 2019

To reproduce, run this code, then note that you can't click on any ufe objects:

# Ufe selection stops working after item set to inactive

import maya.cmds as cmds
import maya.mel as mel
import pymel.core as pm

def safeLoadPlugin(plugin):
    if not cmds.pluginInfo(plugin, q=1, loaded=1):
        cmds.loadPlugin(plugin)
safeLoadPlugin('AL_USDMayaPlugin')
safeLoadPlugin('maya-ufe-cmd-plugin')
safeLoadPlugin('maya-ufe-usd-plugin')

cmds.file(f=1, new=1)
cmds.AL_usdmaya_ProxyShapeImport(file='/path/to/Kitchen_set/Kitchen_set.usd')
persp = pm.PyNode('persp')
persp.translate.set((55, -780, 525))
persp.rotate.set((52, 0, 0))
persp.getShape().centerOfInterest.set(771)
cmds.refresh()

import maya.cmds as cmds; cmds.loadPlugin("mtoh")
activePanel = cmds.playblast(ae=1)
mel.eval('setRendererAndOverrideInModelPanel $gViewport2 mtohRenderOverride_HdStreamRendererPlugin {};'.format(activePanel))

################

import AL.usdmaya
proxy = AL.usdmaya.ProxyShape.getByName('AL_usdmaya_ProxyShape')
stage = proxy.getUsdStage()
tableTopPath = "/Kitchen_set/Props_grp/DiningTable_grp/KitchenTable_1/Geom/Top"
tableTopPrim = stage.GetPrimAtPath(tableTopPath)
assert tableTopPrim.IsValid()

tableTopPrim.SetActive(False)

I suspect any edit to the usd scene would cause this, not just making something inactive, but haven't confirmed that...

@pmolodo
Copy link
Contributor Author

pmolodo commented Jan 31, 2019

This is caused because mtoh is currently relying on AL's selection callbacks to figure out what is actually selected (it just - potentially - handles drawing of the selected object).

If anything is set inactive, this causes AL to essentially throw out it's renderIndex; however, since AL never receives a draw call, it never actually makes a new renderIndex, and so it's selection calls (which use openGL under the hood) always return nothing.

To fix, we need to implement our OWN selection, and disable AL's selection callback. We want to do this anyway, since having an entire duplicated renderIndex, just for selection, is obviously wasteful.

@pmolodo
Copy link
Contributor Author

pmolodo commented Feb 14, 2019

Have solved this internally, by making it possible to "tell" the AL proxy shape to use "our" renderIndex / engine / taskController for selection. However, that required some changes to both AL and mtoh for this to work. Will update this ticket with branches once I push everything to github.

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

No branches or pull requests

1 participant