Collecting Vertices controlled by a bone

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

 
Thread Tools Search this Thread Display Modes
Old 04 April 2014   #1
Collecting Vertices controlled by a bone

How do you collect all the vertices that a bone controls into an array? I looked at all skinops options and none fits the bill.
 
Old 04 April 2014   #2
You usually do it on the 'skin' modifier, meaning that you get the skin modifier, get the bones from the list there, then loop through each vert that that bone affects.
__________________
http://stigatle.no
 
Old 04 April 2014   #3
Yeah i think you need to get the total verts then loop through them and using the getVertInfluences skinops function (theres one something like that if memory serves), you can then test if this vert is affected by your bone.
__________________
Matt Rennie
Sr. Character Rigger
Rockstar North
 
Old 04 April 2014   #4
Hey take a look at this script I posted a while back, you can quickly modify it to return an array of the verts. It already does that, but it might not be in the exact way that you want.

Look at the selectedVerts array.

http://felipenogueira3d.com/node/45

cheers,
__________________
Felipe Nogueira aka: PePeTD
Technical Artist/Character TD
http://felipenogueira3d.com
 
Old 04 April 2014   #5
Thanks guys. I will try that script out Felipe . It looks like what I want. One other thing - what's the quickest way to determine what verts lie near a given point, rather than looping through every vert in the mesh, is there an algorithim which makes it a quick process? Thanks in advance.

PS: I'm trying to write a script that can automatically exclude verts from lip skin envelopes in case you're wondering or in case such a script already exists someone knows of
 
Old 04 April 2014   #6
Originally Posted by DannyBoy3: One other thing - what's the quickest way to determine what verts lie near a given point, rather than looping through every vert in the mesh, is there an algorithim which makes it a quick process?

i can't say it's the quickest algorithm but i posted some on this forum... the algorithm uses 2D or 3D grid-buffer
 
Old 04 April 2014   #7
Are you talking about this Denis?:


try destroydialog VertexDistance catch ()
global testSettings = if testSettings == undefined then #(1.0,10.,32) else testSettings
rollout VertexDistance "Vertex Distance"
( 
 group "Create: "
 (
  button create "Create Test Mesh" width:120 align:#left across:3 
  spinner radius "Radius: " range:[0,1e9,testSettings[2]] scale:0.01 fieldwidth:60 align:#right offset:[-12,3]  
  spinner segments "Segments: " range:[1,1e9,testSettings[3]] scale:1 type:#integer fieldwidth:60 align:#right offset:[0,3] 
 )
 group "Vertices: "
 (
  spinner threshold "Distance: " range:[0,1e9,testSettings[1]] scale:0.001 fieldwidth:60 align:#left offset:[2,0] across:3 
  edittext amount "Amount:" fieldwidth:70 readonly:on align:#right offset:[-12,0]
  edittext selected "Selected:" fieldwidth:70 readonly:on align:#right offset:[0,0]
 )
 group "Algorithms: "
 (
  button bt1 "by Thorn444" width:120 align:#left across:3 
  edittext tt1 "Execution Time:" fieldwidth:70 readonly:on align:#right offset:[-12,2]
  edittext mm1 "Memory Leak:" fieldwidth:70 readonly:on align:#right offset:[0,2] 
  button bt2 "by denisT" width:120 align:#left across:3 
  edittext tt2 "Execution Time:" fieldwidth:70 readonly:on align:#right offset:[-12,2] 
  edittext mm2 "Memory Leak:" fieldwidth:70 readonly:on align:#right offset:[0,2]
 )
 
 on bt1 pressed do if iskindof (obj = selection[1]) Editable_Mesh do with undo off
 (
  sfc = testSettings[1]
  a = 1
  c = 2
  t1 = timestamp()
  h1 = heapfree
  vertlist = #{}
  VertSet = #()
  vertCount = meshop.getNumVerts $
  vertlist = obj.verts as bitarray
  for i =2 to vertcount while not keyboard.escpressed do 
  (
   for j=a to vertcount-1 do 
   (
	b = meshop.minVertexDistanceFrom $ a c
	if b < sfc then (appendIfUnique vertSet a) 
	if b < sfc then (appendIfUnique vertSet c) 
	c = c + 1
   )
   c = i + 1
   a = a +1
  )
  tt1.text = (timestamp() - t1) as string
  mm1.text = ((h1 - heapfree) as integer) as string
  obj.selectedverts = vertSet
  selected.text = obj.selectedverts.count as string
  subobjectlevel = 1
  gc light:on
 )
 on bt2 pressed do if iskindof (obj = selection[1]) Editable_Mesh do with undo off
 (
  fn sortByZ v1 v2 = if v1[2].z < v2[2].z then -1 else if v1[2].z > v2[2].z then 1 else 0
   
  dist = testSettings[1]
  
  t1 = timestamp()
  h1 = heapfree
  verts = obj.verts as bitarray
  
  vlist = for v in verts collect #(v, getvert obj v)
  qsort vlist sortByZ
  klist = deepcopy vlist
  
  list = #{}
  
  for i=1 to vlist.count while not keyboard.escpressed do 
  (
   v = vlist[i]
   out = off
   for j=i+1 to klist.count while not out where (k = klist[j]) != undefined do
   (
	if (distance v[2] k[2]) < dist do 
	(
	 append list v[1]
	 append list k[1]
	 klist[j] = undefined
	)
	out = abs (v[2].z - k[2].z) > dist
   )
  )
  tt2.text = (timestamp() - t1) as string
  mm2.text = ((h1 - heapfree) as integer) as string
  obj.selectedverts = list
  selected.text = obj.selectedverts.count as string
  setselectionlevel obj #vertex
  gc light:on
 )
 
 on threshold changed value do testSettings[1] = value
 on radius changed value do testSettings[2] = value
 on segments changed value do testSettings[3] = value
  
 on create pressed do undo "Create Test" on
 (
  suspendEditing()
  if objects.count > 0 do delete objects
  converttomesh (obj = sphere name:"findVerts" radius:testSettings[2] segs:testSettings[3] isSelected:on)
  if getCommandPanelTaskMode() != #modify do setCommandPanelTaskMode mode:#modify
  setselectionlevel obj #vertex
  amount.text = obj.numverts as string
  selected.text = obj.selectedverts.count as string
  resumeEditing()
 )
 on VertexDistance open do if iskindof (obj = selection[1]) Editable_Mesh do 
 (
  amount.text = obj.numverts as string
  selected.text = obj.selectedverts.count as string
 )
)
createdialog VertexDistance width:480 height:200
 
Old 04 April 2014   #8
check this one
http://forums.cgsociety.org/showpos...76&postcount=23

i couldn't find the exact right example about vertex distance. probably it's in the forum's archive already.
i will search in my archive and try to find there

Last edited by denisT : 04 April 2014 at 08:26 AM.
 
Old 04 April 2014   #9
Great. Looks promising. Thanks for your time Denis.
 
Old 04 April 2014   #10
Any luck with the archive Dennis?
 
Old 04 April 2014   #11
Originally Posted by DannyBoy3: Any luck with the archive Dennis?

here is the most close to what you looking for. http://forums.cgsociety.org/showpos...24&postcount=21
 
reply share thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
CGSociety
Society of Digital Artists
www.cgsociety.org

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump
Miscellaneous

All times are GMT. The time now is 08:51 AM.


Powered by vBulletin
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.