polyop.getVertsByFlag <Poly poly> <int flag> mask:<int maskflag> 用法 例子

Each vertex in a poly contains a 32 bit flag variable.
 每一个点在poly 控制一个32 位的 “旗帜” 我觉得像maya的悬浮列片。

This method returns a bitarray of the vertices that have specific bits in this flag variable set,
 
这个办法返回一个 bit数组 。在flag 中设置了所有的点都有相应的 bit 地方。
 where the bits being tested are based on a combination of <flag> and <maskflag>.
  
 polyop.getVertsByFlag <Poly poly> <int flag> mask:<int maskflag>
 
 当在<int flag> mask:<int maskflag> 中的联合体的基础之上,
 
 

The default value for <maskflag> is 0.
 
maskflag 的缺省是数值是0


bit30 = bit.set 0 30 true  ---这里有点明白了

当 为了使
bit30 = bit.set 0 1 true
(polyOp.getVertsByFlag $ bit30) 返回的是当前选择的点。

系统的解释 :bit 1: vertex is selected

当为2 时
bit30 = bit.set 0 2 true
(polyOp.getVertsByFlag $ bit30) 为空。

系统的解释:bit 2: vertex is dead

当为3 时
bit30 = bit.set 0 3 true  返回的是4

(polyOp.getVertsByFlag $ bit30)

系统解释 :bit 3: reserved


当为4 时
bit30 = bit.set 0 4 true 返回8 时

(polyOp.getVertsByFlag $ bit30)

系统解释 : bit 4: indicates the vertex faces "backwards" in the current viewport

当为5—24 时

(polyOp.getVertsByFlag $ bit30)[12] --可返回对错


通过这些解释渐渐的有一点东西了


Internally, if <maskflag> is 0 then <maskflag> is set to the <flag> value, otherwise <flag> is
 
 set to the bitwise-AND of <flag> and <maskflag>. Bit 2 of <maskflag> is then set, which prevents dead vertices

 from being included in the resulting bitarray unless this bit was set in <mask>. Each bit in the resulting bitarray is
  
 set if the bitwise-AND of the flag variable and <maskflag> is equal to the bitwise-AND of <flag> and <maskflag>.

 
 
 
 
The vertex level flags are:

bit 1: vertex is selected

bit 2: vertex is dead

bit 3: reserved

bit 4: indicates the vertex faces "backwards" in the current viewport

bit 5-24: reserved

bit 25-32: available for general use 


polyop.getVertsByFlag <Poly poly> <int flag> mask:<int maskflag>


theObj = plane isSelected:true

convertto theObj editable_poly

nVerts = theObj.numverts ---顶点数。

bit30 = bit.set 0 30 true  ---这里面现在还真的不知道什么意思。

bit31 = bit.set 0 31 true   ----看了帮助这个就好了。

bit32 = bit.set 0 32 true

--\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
theObj =$
 bit30 = bit.set 0 4 true  --都可以进行设置 设定为2 时  bit 2: vertex is dead
 nVerts = $.numverts

-- set a bit on first 3/4 or so verts

(

flagsToSet = bit30

flagsToMask = 0

vertexSet = #{1..(3*nVerts/4)} --对这里是设置了一个顶点的3/4

theObj.setVertexFlags vertexSet flagsToSet flagMask:flagsToMask generateUndoRecord:true

ok

)

(polyOp.getVertsByFlag $ bit30)

-- and another on middle block

(

flagsToSet = bit31

flagsToMask = 0

vertexSet = #{(nVerts/3)..(nVerts-4)}

theObj.setVertexFlags vertexSet flagsToSet flagMask:flagsToMask generateUndoRecord:true

ok

)

-- set a bit on last 2 verts

(

flagsToSet = bit32

flagsToMask = 0

vertexSet = #{(nVerts-2)..nVerts}

theObj.setVertexFlags vertexSet flagsToSet flagMask:flagsToMask generateUndoRecord:true

ok

)

----都可以用上面的进行设置。
(polyOp.getVertsByFlag theObj bit30) --用他对储蓄存的进行查看。

(

-- get verts with bit30, 31, 32 set

format "30: %\n" (polyOp.getVertsByFlag theObj bit30)

format "31: %\n" (polyOp.getVertsByFlag theObj bit31)

format "32: %\n" (polyOp.getVertsByFlag theObj bit32)

-- get verts with bit30 set, but not bit31

format "30 and !31: %\n" (polyOp.getVertsByFlag theObj bit30 mask:(bit30+bit31))

-- get verts with bit31 not set, doesn't matter what the <flag>

-- value is as long as it's not bit31

format "!31: %\n" (polyOp.getVertsByFlag theObj bit30 mask:(bit31))

-- get verts with bit30 and bit31 set

format "30 and 31: %\n" (polyOp.getVertsByFlag theObj (bit30+bit31))

-- get verts with neither bit31 or bit32 set, doesn't matter what

-- the <flag> value is as long as it's not bit31 or bit32

format "!(31 or 32): %\n" (polyOp.getVertsByFlag theObj bit30 mask:(bit31+bit32))

)

关于这一块,要注意点,下面还有边面的形式,就想不到呢里用。先不学习了。段一下






posted on 2011-04-19 17:09  盖天00  阅读(458)  评论(0编辑  收藏  举报

导航