def select(self, skelctxt, selection): segment = skelctxt.getObject().findExistingSegmentByIds(self.nodes) clist, plist = selection.trackerlist() courier = skeletonselectioncourier.SingleObjectCourier( skelctxt.getObject(), segment, clist, plist) self.operator.operate(selection, courier) SegmentSelectionMethodRegistration( 'Single Segment', SingleSegmentSelect, ordering=0, params=[ parameter.hidden( parameter.ListOfIntsParameter('nodes', tip="List of node IDs.")), selectionoperators.SelectionOperatorParam('operator', passive=1) ], tip="Select a segment joining two nodes.", discussion=xmlmenudump.loadFile( 'DISCUSSIONS/engine/reg/single_segment.xml')) #=--=##=--=##=--=##=--=##=--=##=--=##=--=##=--=##=--=##=--=##=--=##=--=# class SingleFaceSelect(FaceSelectionMethod): def __init__(self, nodes, operator): self.nodes = nodes self.operator = operator def select(self, skelctxt, selection):
def _assignMat(menuitem, mesh, elements, material): reporter.warn( "Explicit material assignments to mesh elements are no longer supported!" ) meshmenu.addItem( OOFMenuItem( 'AssignMaterial', callback=_assignMat, params=[ whoville.WhoParameter('mesh', ooflib.engine.mesh.meshes, tip=parameter.emptyTipString), parameter.ListOfIntsParameter('elements', tip='Indices of the elements'), parameter.StringParameter('material', tip='Material to assign to the elements') ], help="Load explicitly assigned Materials into a Mesh", no_doc=1)) def _status(menuitem, mesh, status): meshcontext = ooflib.engine.mesh.meshes[mesh] meshcontext.setStatus(status) meshmenu.addItem( OOFMenuItem( 'Status',
pinned = skelcontext.pinnednodes for i in nodes: pinned.pin(skeleton.getNode(i)) #pinned.pin([skeleton.nodes[i] for i in nodes]) pinned.signal() skelmenu.addItem( OOFMenuItem( 'PinnedNodes', callback=_loadPinnedNodes, params=[ whoville.WhoParameter('skeleton', skeletoncontext.skeletonContexts, tip=parameter.emptyTipString), parameter.ListOfIntsParameter( 'nodes', tip="List of indices of pinned nodes.") ], help="Load pinned Nodes. Used internally in data files.", discussion= "<para>Load <link linkend='MenuItem-OOF.Graphics_n.Toolbox.Pin_Nodes.Pin'>pinned</link> nodes from a &skel; data file.</para>" )) ### def _loadPointBoundary(menuitem, skeleton, name, nodes, exterior): # "nodes" is a list of integer indices into skeleton.nodes skelcontext = skeletoncontext.skeletonContexts[skeleton] skeleton = skelcontext.getObject() skelcontext.createPointBoundary(name, [skeleton.getNode(i) for i in nodes], exterior,