Notifications
Clear all
[Closed] Change base node?
Oct 27, 2008 1:36 pm
Hi,
I am not much of a scripter and need some help with creating a script that will change a point helper into a sphere,
so if I select a few points and click my button each one will change into a sphere.
at the moment i am doing this through the curve editor one by one,
Cheers,
Asa
3 Replies
1 Reply
If you want instances of the sphere, you can say
(
s = sphere() --create a sphere
for o in selection do o.baseobject = s.baseobject --instance its base to the selected nodes
delete s --delete the sphere
)
If you want copies, you can say
for o in selection do
(
s = sphere()
o.baseobject = s.baseobject
delete s
)
You can also pick a scene node to instance it’s base object:
(
p = pickobject()
if isValidNode p do
for o in selection do o.baseobject = p.baseobject
)
You can add the line
MacroScript InstBO category:"Forum Help"
to each one of these to make them MacroScripts…
You could make it even better by ensuring there IS a selection first:
MacroScript InstBO category:"Forum Help"
(
on isEnabled return selection.count > 0 --enable button if anything selected
on Execute do
(
p = pickobject() --pick a scene node
if isValidNode p do --if the pick was valid
for o in selection do o.baseobject = p.baseobject --instance the base node
)--end execute
)--end macro
Oct 27, 2008 1:36 pm
Unless I misunderstood, isn’t this a work for clone and align tool?