示例#1
0
	def slateDraw( self ):
		# processing the text
		import re
		scene = self._scene
		text = self._slateText
		matches = re.findall( r'(\[)([F|f][R|r][A|a][M|m][E|e])( +)?(#[0-9]+)?( +)?(\])', text )
		for match in matches:
			padding = match[3]
			if padding:
				padding = int( padding.strip( '#' ) )
			else:
				padding = 1
			text = text.replace( ''.join( match ), str( scene.currentFrame() ).zfill( padding ) )

		# rendering the slate
		text = text + '  '
		viewSize = self.size()
		textSize = mxs.GetTextExtent( text )
		textWidth = int( textSize.x )
		if self.safeFrameIsActive():
			safeFrameSize = self.safeFrameSize()
			safeFrameMargins = self.safeFrameMargins()
			hMargin = safeFrameMargins[0]
			vMargin = safeFrameMargins[1]
		else:
			hMargin = 0
			vMargin = 0

		textPos = mxs.point3( viewSize[0] - textWidth - hMargin, vMargin, 0 )
		color = mxs.color( 255,255,255 )
		mxs.gw.htext( textPos, text, color=color )
		mxs.gw.enlargeUpdateRect( mxs.pyhelper.namify( 'whole' ) )
		mxs.gw.updatescreen() 
示例#2
0
 def __init__(self, node_pairs, properties):
     BeamThing.BeamThing.__init__(self)
     MaxObjectCustAttribute.MaxObjectCustAttribute.__init__(self)
     self.apply_custattributes(properties)
     self.max_object.wirecolor = mxs.color(55, 76, 83)
     self.max_object.render_displayRenderMesh = True
     self.max_object.render_viewport_rectangular = False
     self.max_object.render_thickness = (properties['radius'] * 2)
     self.max_object.render_sides = properties['rays']
     self.draw_lines_from_node_pairs(node_pairs)
    def addThreeNodesRig(self):
        """
            \remarks    implements the AbstractScene._createNativeCamera3NodeRig method to return a new 3 node rig
            \param      name            <str>
            \return     <variant> top node of rig
        """
        cam = self.nativePointer()

        # create controls
        pos = mxs.star(radius1 = 6.5, radius2 = 5.5, points=16)
        trans = mxs.rectangle(length=10.2, width=4.5)
        rot = mxs.ngon(radius=2.0, nSides=3, corner_radius=0.5)

        # rename controls
        pos.name = str(cam.name) + 'position'
        trans.name = str(cam.name) + 'translation'
        rot.name = str(cam.name) + 'rotation'

        # rotate controls into place
        pos.rotation = mxs.eulerangles(90, 0 , 0)
        trans.rotation = mxs.eulerangles(90, 0 , 0)
        rot.rotation = mxs.eulerangles(0, 0, -90)

        # reset xforms
        mxs.resetxform(pos)
        mxs.resetxform(trans)
        mxs.resetxform(rot)

        # collapse xforms
        mxs.maxOps.CollapseNode(pos, True)
        mxs.maxOps.CollapseNode(trans, True)
        mxs.maxOps.CollapseNode(rot, True)

        rot.parent = trans
        trans.parent = pos

        pos.wirecolor = rot.wirecolor = trans.wirecolor = mxs.color(0, 230, 250)

        # Move the rig to align with the cam
        pivrot=cam.rotation
        pos.rotation*=pivrot;
        #pos.objectoffsetrot*=pivrot;
        #pos.objectoffsetpos*=pivrot;

        pos.position = cam.position
        #mxs.resetxform(pos)
        #pos.rotation = cam.rotation


        # parent the cam to to rig
        cam.parent = rot

        return True
示例#4
0
    def addThreeNodesRig(self):
        """
            \remarks    implements the AbstractScene._createNativeCamera3NodeRig method to return a new 3 node rig
            \param      name            <str>
            \return     <variant> top node of rig
        """
        cam = self.nativePointer()

        # create controls
        pos = mxs.star(radius1=6.5, radius2=5.5, points=16)
        trans = mxs.rectangle(length=10.2, width=4.5)
        rot = mxs.ngon(radius=2.0, nSides=3, corner_radius=0.5)

        # rename controls
        pos.name = str(cam.name) + 'position'
        trans.name = str(cam.name) + 'translation'
        rot.name = str(cam.name) + 'rotation'

        # rotate controls into place
        pos.rotation = mxs.eulerangles(90, 0, 0)
        trans.rotation = mxs.eulerangles(90, 0, 0)
        rot.rotation = mxs.eulerangles(0, 0, -90)

        # reset xforms
        mxs.resetxform(pos)
        mxs.resetxform(trans)
        mxs.resetxform(rot)

        # collapse xforms
        mxs.maxOps.CollapseNode(pos, True)
        mxs.maxOps.CollapseNode(trans, True)
        mxs.maxOps.CollapseNode(rot, True)

        rot.parent = trans
        trans.parent = pos

        pos.wirecolor = rot.wirecolor = trans.wirecolor = mxs.color(
            0, 230, 250)

        # Move the rig to align with the cam
        pivrot = cam.rotation
        pos.rotation *= pivrot
        #pos.objectoffsetrot*=pivrot;
        #pos.objectoffsetpos*=pivrot;

        pos.position = cam.position
        #mxs.resetxform(pos)
        #pos.rotation = cam.rotation

        # parent the cam to to rig
        cam.parent = rot

        return True
示例#5
0
def convert_object():
    """ pydoc """
    current_selection = mxs.selection
    if len(current_selection) > 0:
        for m in current_selection:
            mxs.convertTo(m, mxs.editable_Poly)
            randomR = random.randint(10, 200)
            randomB = random.randint(10, 200)
            randomG = random.randint(10, 200)
            m.wireColor = mxs.color(randomR, randomG, randomB)
    else:
        mxs.messageBox("Nothing selected")
    mxs.completeRedraw()
def import_wheel(counter, node_positions, wheel_group, object_holder):
    node_pairs = []
    for wheel in wheel_group:
        temp = []
        node_pairs.append(temp)
        temp.append(node_positions[wheel['node1']])
        temp.append(node_positions[wheel['node2']])
    wheel = Wheel.Wheel(node_pairs, wheel_group[0])
    wheel.name = "wheel_" + str(counter)
    object_holder.add_object(wheel.max_object)
    
    first_wheel = wheel_group[0]
    if first_wheel['rigidity_node'] != 9999:
        rigidity_node = Box.Box(node_positions[first_wheel['rigidity_node']],
                                name="rigidity_node_" + wheel.name,
                                wirecolor=mxs.color(55, 76, 83))
        object_holder.add_object(rigidity_node.max_object)
示例#7
0
 def __init__(self, node_pairs, properties):
     BeamThing.BeamThing.__init__(self)
     MaxObjectCustAttribute.MaxObjectCustAttribute.__init__(self)
     self.apply_custattributes(properties)
     self.max_object.wirecolor = mxs.color(0, 0, 0)
     self.draw_lines_from_node_pairs(node_pairs)