Skip to content
Snippets Groups Projects
Commit 4d1cfd29 authored by Marco Biasini's avatar Marco Biasini Committed by Ansgar Philippsen
Browse files

don't overwrite scene.__getitem__ for glob-style access to scene objects

It's breaking more complexcases, e.g.

scene["model"].selection=scene["model"].view.Select('aname=CA')

To use the glob-style access, use scene.Match("*")
parent 7804d9ae
No related branches found
No related tags found
No related merge requests found
...@@ -141,7 +141,7 @@ def FitToScreen(gfx_ent, width=None, height=None, margin=0.01): ...@@ -141,7 +141,7 @@ def FitToScreen(gfx_ent, width=None, height=None, margin=0.01):
scene.SetRTC(rtc) scene.SetRTC(rtc)
class GfxNodeListAttrProxy: class GfxNodeListAttrProxy(object):
def __init__(self, node_list, name): def __init__(self, node_list, name):
self._node_list=node_list self._node_list=node_list
self._name=name self._name=name
...@@ -164,6 +164,11 @@ class GfxNodeListProxy(object): ...@@ -164,6 +164,11 @@ class GfxNodeListProxy(object):
return super(GfxNodeListProxy, self).__getattr__(name) return super(GfxNodeListProxy, self).__getattr__(name)
return GfxNodeListAttrProxy(self._nodes, name) return GfxNodeListAttrProxy(self._nodes, name)
def __dir__(self):
if len(self._nodes)==0:
return dir(None)
return dir(self._nodes[0])
def __setattr__(self, name, value): def __setattr__(self, name, value):
if name.startswith('_'): if name.startswith('_'):
super(GfxNodeListProxy, self).__setattr__(name, value) super(GfxNodeListProxy, self).__setattr__(name, value)
...@@ -183,4 +188,4 @@ def _Match(scene, pattern="*"): ...@@ -183,4 +188,4 @@ def _Match(scene, pattern="*"):
return matches return matches
return GfxNodeListProxy(_Recurse("", Scene().root_node, pattern)) return GfxNodeListProxy(_Recurse("", Scene().root_node, pattern))
SceneSingleton.__getitem__=_Match SceneSingleton.Match=_Match
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment