Notifications
Clear all

[Closed] duplicate mesh and assign duplicated mesh as bone

 em3

Hello!

I am trying to Frankenstein a script together that will do the following:

[ul]
[li]select mesh and hide unselected
[/li][li]duplicate mesh
[/li][li]apply skin modifier and add duplicated mesh as bone
[/li][li]unhide all
[/li][li]loop
[/li][/ul]

I tried recording a macro to do it but that failed miserably.

Is there an handy way to do this or maybe a script out there that already does it?

Thanks in advance!

7 Replies
2 Replies
 eek
(@eek)
Joined: 11 months ago

Posts: 0

for o in objects do
(
select o;

if superClassOf o == Geometry do
(
if o.isSelected == true then
(
maxModifyMode
local tmpMesh = copy o;
addModifier o (skin());
skinOps.addBone o.skin tmpMesh 1;
)
)
)

something like this i guess…

(@denist)
Joined: 11 months ago

Posts: 0

you are guessing wrong because of at least 3 reasons…

  • skinops doesn’t work if modpanel is not opened and modpanel’s current object is not your skin modifier…
 em3

here is what I have so far…

x = dave
(
Objs = for o in objects collect o

for o in Objs do
(
copy o
x = o.name
addmodifier o (skin())
skinOps.addbone x <—getting hung up here
)
)

1 Reply
(@denist)
Joined: 11 months ago

Posts: 0

what I have to say? You are doing everything wrong…

i can fix your code (it will not crash) but it will still be wrong



 (
   objs = objects as array
 
   for o in objs do
   (
	 x = copy o
 	 x.name = o.name
	 select o
 	 modpanel.addmodtoselection (modi = skin()) ui:on 
 	 skinOps.addbone modi x 
   )
 )

 em3

WooHoo! Thanks man, here is the finished code that works great for my needs.


(
Objs = for o in objects collect o

for o in Objs do
(

x = copy o
x.name = o.name + "copy"
addmodifier o (skin())
print o
select o
skinOps.addBone $.modifiers[#Skin] x 1
)
)

1 Reply
(@denist)
Joined: 11 months ago

Posts: 0

was happy to help but as I said it’s a wrong way… Good luck!

 eek
for o in objects do 
(
select o;

if (superClassOf o == GeometryClass) do
(
if (o.isSelected == true) do
(
max Modify Mode
local tmpMesh = copy o;
addModifier o (skin());
modPanel.setCurrentObject o.skin node:o ui:true
skinOps.addBone o.skin tmpMesh 1;
)
)
)

roughly, seeing as a I just got up.