Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

kamilisa/controlShape

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

8 Commits

Repository files navigation

What is controlShape?

controlShape is a Maya shape node that can be attached to whole meshes or their faces.

controlShape

https://www.youtube.com/watch?v=8aVKpmMS_aA

Features

  • Static and dynamic meshes.
  • Scale by a normal.
  • Color and opacity control.

How to use

Compile the plugin for the Maya version you want using Visual Studio. No dependencies required.

Use the following code to create or parent controlShapes.

import pymel.core as pm
def makeControlShape():
 ls = pm.ls(sl=True)
 faces = pm.ls(sl=True, fl=True, type="float3")
 
 sh = pm.createNode("controlShape")
 if faces:
 mesh = faces[0].node()
 mesh.outMesh >> sh.mesh
 sh.meshInWorldSpace.set(True) 
 
 indices = [f.index() for f in faces] 
 sh.meshFaces.set(indices, type="Int32Array")
 sh.meshMatrix.set(mesh.getParent().wm.get())
 
 elif ls:
 pm.connectAttr(ls[0].outMesh, sh.mesh)
 pm.disconnectAttr(ls[0].outMesh, sh.mesh)
 sh.getParent().setMatrix(ls[0].wm.get())
 
def parentControlShape():
 ls = pm.ls(sl=True)
 if ls and len(ls) == 2:
 controlShape, control = ls
 
 for sh in controlShape.listRelatives(s=True, type="controlShape"):
 pm.parent(sh, control, r=True, s=True)
 sh.rename(control+"Shape")
 
 if not sh.meshInWorldSpace.get():
 sh.meshMatrix.set(controlShape.getMatrix() * control.wim.get())
 
 pm.delete(controlShape)
 else:
 pm.warning("Select controlShape and transform") 
#makeControlShape() # select mesh/mesh faces
#parentControlShape() # select controlShape transform and a control you want to parent to.

makeControlShape can be applied to both whole meshes and mesh faces. In the first case there will be a static mesh control created. The second one case creates a dynamic deformable shape control.

About

Mesh shaped controls for Maya

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 90.1%
  • CMake 9.9%

AltStyle によって変換されたページ (->オリジナル) /