HELP: when... callback (inside utility creation helper script)
Hello
I script utility helper plug-in, try to use
when transform MyObject change do
(....)
construction, but have a problem - how to know MyObject for creation helper?
First time I can use
MyObject=selection[1]
and it's work, but after re-load scene it isn't... I hope find a way to know obj node like "this" ...
Thank You
Comments
Sample code:
Hello. This is my test code:
plugin Helper TestHelper
name:"TestHelper"
classID:#(0x5a1b2412, 0x1e8d2f12)
category:"Standard"
extends:dummy
(
local meshObj, theMesh, MyObject
parameters pblock rollout:params
(
size type:#float animatable:true ui:size default:1.0
)
rollout params "TestHelper"
(
spinner size "Size:" range:[0, 1e9, 1]
)
on getDisplayMesh do
(
if theMesh == undefined then
(
local vertsArray = #( [0,0,0], [size,0 ,0], [size,size ,0], [0,size,0])
local facesArray = #([1,2,3], [3,4,1])
local edgeVis = #( #(true,true,false), #(true,true,false))
meshObj = mesh vertices:(for v in vertsArray collect v*size) faces:facesArray
for face = 1 to edgeVis.count do
for i = 1 to 3 do
setEdgeVis meshObj face i edgeVis[face][i]
theMesh = copy meshObj.mesh
delete meshObj
if MyObject==undefined do MyObject=selection[1]
when transform MyObject change id:#Volume do print MyObject.name
)
else
(
)
theMesh
)
tool create
(
on mousePoint click do
(
size=10
#stop
)
)
)
-- Thank You
`
Hi, It's bit not clear, Can we see the code ?
plugin Helper
plugin Helper TestHelper
name:"TestHelper"
classID:#(0x5a1b2412, 0x1e8d2f12)
category:"Standard"
extends:dummy
(
local meshObj, theMesh, MyObject
parameters pblock rollout:params
(
size type:#float animatable:true ui:size default:1.0
)
rollout params "TestHelper"
(
spinner size "Size:" range:[0, 1e9, 1]
)
on getDisplayMesh do
(
if theMesh == undefined then
(
local vertsArray = #( [0,0,0], [size,0 ,0], [size,size ,0], [0,size,0])
local facesArray = #([1,2,3], [3,4,1])
local edgeVis = #( #(true,true,false), #(true,true,false))
meshObj = mesh vertices:(for v in vertsArray collect v*size) faces:facesArray
for face = 1 to edgeVis.count do
for i = 1 to 3 do
setEdgeVis meshObj face i edgeVis[face][i]
theMesh = copy meshObj.mesh
delete meshObj
if MyObject==undefined do MyObject=selection[1]
when transform MyObject change id:#Volume do print MyObject.name
)
else
(
)
theMesh
)
tool create
(
on mousePoint click do
(
size=10
#stop
)
)
)
`
sorry, so busy last days, but will try to take a look this evening
Enybody?
Hello...
Somebody can help?
Please...
Thank You