Omni.replicator.core-1.7.7 possible bug in week reference on list object

Code 2022.3.3 uses omni.replicator.core-1.7.7
I get an error when trying to access hydra_textures property in the MultiTexture class using the following code:

from omni.replicator.core import vp_manager

# create render product here

viewp_manager = vp_manager.ViewportManager()
it = viewp_manager._hydra_textures.hydra_textures
tex = next(it, None)

I get this error:

2023-03-30 18:30:04  [Error] [] TypeError: cannot create weak reference to 'list' object
2023-03-30 18:30:04  [Error] [] 
2023-03-30 18:30:04  [Error] [] At:
2023-03-30 18:30:04  [Error] []   c:\users\mark\appdata\local\ov\pkg\code-2022.3.3\extscache\omni.replicator.core-1.7.7+104.2.wx64.r.cp37\omni\replicator\core\scripts\utils\ hydra_textures

if you look at the code in you’ll see:

def add_texture(self, context=None, *args, **kwargs):
   if context is None:
       context = "default"
   if self.__hydra_texture_factory is None:
       self.__hydra_texture_factory = omni.hydratexture.acquire_hydra_texture_factory_interface()    
   self.__hydra_textures.setdefault(context, []).append(
       HydraTextureWrapper(*args, **kwargs, hydra_texture_factory=self.__hydra_texture_factory)

 def hydra_textures(self):
     for tex in self.__hydra_textures.values():
          yield weakref.proxy(tex)

line 155 is yield weakref.proxy(tex) in the above code

I understand that I probably should not be using the private variable _hydra_textures for future changes of code sake but I have not found another way to get to the hydra texture. I need the hydra texture to change the camera as I have 6 cameras and 6 render products at once causes memory to run out.

Regardless, from what I’ve read you cannot create a weakref to a list in Python. So accessing the hydra_textures property will always crash as tex in line 155 is a list. Or am I missing something?

Windows 11
Code 2022.3.3

Thank you,

Mark Olson

Hello @mark148! I’ve shared your post with the dev team for further assistance.

1 Like