utils.core¶
The core functionality for Primvar tool.
-
utils.core.
add_attr
(node, attr_name, debug=False, **kwargs)[source]¶ Assign attributes to the given object.
>>> import pymel.core as pm >>> FOO = pm.sphere() # Result: [nt.Transform(u'nurbsSphere1'), t.MakeNurbSphere(u'makeNurbSphere2')] # >>> shapeNode = FOO[-1] # Get the shape of the FOO >>> add_attr(shapeNode, "newAttributeName", attributeType='float') # Create a new attribute called "newAttributeName", type float
Parameters: - node – (PyMel nodes) Object to assign new attributes to.
- attr_name – (String) attributes name
- debug – (Boolean) Set True if you want to print out the result.
- kwargs – attribute keywords. ex:
-
utils.core.
get_random_vector
(minimum_x=0, maximum_x=1, minimum_y=0, maximum_y=1, minimum_z=0, maximum_z=1, variation=False, kind='float')[source]¶ Returns list of three numbers, vector, integer of float.
Parameters: - minimum_x – (float or int) Minimum x range
- maximum_x – (float or int) Maximum x range
- minimum_y – (float or int) Minimum y range
- maximum_y – (float or int) Maximum y range
- minimum_z – (float or int) Minimum z range
- maximum_z – (float or int) Maximum z range
- variation – (Boolean) If True, result in uniform result.
- kind – (String) Kind of vector, integer or float. Default is float.
Returns: (List) List of vector. ex: [1,0,2] or [1.234, 2.426, 1.64]
-
utils.core.
get_rman_attr
(nodes, debug=False)[source]¶ Returns the dictionary of primvar attribute found on the given nodes.
Parameters: - nodes – (List of PyMel nodes) Nodes to query their primvar attributes.
- debug – (Boolean) Set True if you want to print out the result.
-
utils.core.
get_shapes
(nodes, debug=False)[source]¶ Yields the name on shape node for each selected object.
Parameters: - nodes – (List of PyMel node) objects to be check for shape node.
- debug – (Boolean) If True, it’ll output the errors and the process.
Yield: (PyMel node) shape node of the selected node.
-
utils.core.
remove_attr
(node, attr_name, debug=False)[source]¶ Remove the given attribute from the given node
Parameters: - node – (PyMel Node) The object that needs to be its attribute deleted.
- attr_name – (Str) Name of the attribute to be deleted from the object.
- debug – (Boolean) Set True if you want to print out the result.
-
utils.core.
set_attr
(node, attr_name, value, debug=False)[source]¶ Setting the attribute of the object
Parameters: - node – (PyMel nodes) Object to set its attribute.
- attr_name – (String) Attribute name of the object to be set.
- value – (String, Int, Float) Value of the attribute to set.
- debug – (Boolean) Print out the process of setting the attribute