How do I use the GeometryConstraint class?

Shannon Hochkins

I've been trying to get this to work for so long now, I've read the docs here, but I can't seem to understand how to implement the GeometryConstraint.

Normally, the derivative version of this would be:

geometryConstraintNode = pm.geometryConstraint(target, object)

However, in Pymel, It looks a little nicer when setting attributes, which is why I want to use it, because it's much more readable.

I've tried this:

geometryConstraintNode = nt.GeometryConstraint(target, object).setName('geoConstraint')

But no luck, can someone take a look?

Shannon

theodox

this doesn't work for you?

import pymel.core as pm

const = pm.geometryConstraint('pSphere1', 'locator1', n='geoConstraint')
print const
const.rename('fred')
print const

output would be

geoConstraint
fred

and a constraint object named 'fred'.

The pymel node is the return value that comes back from the command defined in pm.animation.geometryConstraint. What it returns is a class wrapper for the actual in-scene constraint, which is defined in pm.nodetypes.GeometryConstraint. It's the class version where you get to do all the attribute setting, etc; the command version is a match for the same thing in maya.cmds with sometimes a little syntactic sugar added.

In this case, the pymel node is like any other pymel node, so things like renamimg use the same '.rename' functionality inherited from DagNode. You could also use functions inherited from Transform, like 'getChildren()' or 'setParent()' The docs make this clear in a round-about way by including the inheritance tree at the top of the nodetype's page. Basically all pynode returns will share at least DagNode (stuff like naming) and usually Transform (things like move, rotate, parent) or Shape (query components, etc)

이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.

침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제

에서 수정
0

몇 마디 만하겠습니다

0리뷰
로그인참여 후 검토

관련 기사

분류에서Dev

How do I use an extended generic type's type in a class?

분류에서Dev

How do I use a HashMap from another class or function?

분류에서Dev

How do I use MapStateListener?

분류에서Dev

How do I Use other functions from a different class in Asynchronous methods

분류에서Dev

How do I reference a string in another class?

분류에서Dev

How do I use OR with if statements in regards to strings

분류에서Dev

How do i use Blazor components in the code?

분류에서Dev

Python: How do i use itertools?

분류에서Dev

How do I use runit with zookeeper

분류에서Dev

How do I use Firefox cookies with Wget?

분류에서Dev

How do I make use of rotation matrices?

분류에서Dev

How do I configure ActiveJob to use Resque?

분류에서Dev

How do i use SetPixel on a new Bitmap?

분류에서Dev

How do i get cURL to use https

분류에서Dev

How do I use "<<" with my own struct?

분류에서Dev

How do I use URL directories as variables?

분류에서Dev

What is fileAPI ? How do I use it with angular?

분류에서Dev

How do I open and use phpmyadmin?

분류에서Dev

How do I configure Docker to use ZFS?

분류에서Dev

How do I use the latest GCC on Ubuntu?

분류에서Dev

How do I use man pages to learn how to use commands?

분류에서Dev

How do I install and use PyCharm without having to use a terminal?

분류에서Dev

How do I install and use PyCharm without having to use a terminal?

분류에서Dev

how can I use cudaStreamAddCallback() with a class member method?

분류에서Dev

How can I use a guava class (HashMultiset) from Scala?

분류에서Dev

How do I return a first class module from the same module?

분류에서Dev

AS3: How do i draw shapes in my own class

분류에서Dev

How do I map relationships in Custom NSManagedObject class

분류에서Dev

How do I See if All of My Divs Have Class?

Related 관련 기사

뜨겁다태그

보관