def update(self): """Call to force the element to update according to the contents of the scene""" curItems = noneToList(self.p_selectItem) self.p_removeAll = 1 # add all items according to the scene and the configuration if self._show_selected: self.p_append = self.kSelectedNodes for ns in RootNamespace.children(): self.p_append = ns # END for each namespace in scene # reselect previous items for sli in curItems: try: self.p_selectItem = sli except RuntimeError: pass
def test_user_interface( self ): if cmds.about( batch=1 ): return Scene.open(fixture_path('1still3moving.ma'), force=1) exp_file = self._set_export_file() # show UI awin = AnimIO_UI().show() ectrl = awin.main.exportctrl # TEST EXPORT # nothing selected in UI - failure ectrl.nodeselector.set_uses_selection(False) ectrl.nodeselector.set_uses_selection(False) self.failUnlessRaises(ValueError, ectrl._on_export, None) assert not exp_file.isfile() # should use selected nodes, but there is no one selected in the scene ectrl.nodeselector.set_uses_selection(True) ectrl.nodeselector.set_uses_selection(True) self.failUnlessRaises(ValueError, ectrl._on_export, None) assert not exp_file.isfile() # something with keys is selected nt.select('coneAnimated') ectrl._on_export(None) assert exp_file.isfile() cone_anim_file = exp_file # TODO: reapply it to the same item without animation # for simplicity we just # TEST NAMESPACES Scene.open(fixture_path('3moving3namespaces.ma'), force=1) assert Scene.name() == fixture_path('3moving3namespaces.ma') # nodeselector should have 4 namespaces now, but no one is selected assert len(ectrl.nodeselector.selected_namespaces()) == 0 # but it displays them assert ectrl.nodeselector.p_numberOfItems == 4 # 3 ns + 1 sel nodes # select namespaces, retrieve them all_ns = RootNamespace.children() ectrl.nodeselector.select_namespaces(all_ns) assert all_ns == ectrl.nodeselector.selected_namespaces() assert ectrl.nodeselector.uses_selection() # export to namespaces exp_file = self._set_export_file() ectrl._on_export(None) assert exp_file.isfile() # TODO: reimport the file with namespaces, test filters and converters cmds.fileDialog = self._orig_fileDialog cone_anim_file.remove()