[Closed] Scripted helper plugin, getting tranforms?
I have a custom helper using scripted plugins.
I am extending a dummy object.
Im trying to get the position of my helper, but nothing seems to work.
Ive tryed using
this.pos
nodeTM
delegate.pos
Any idea whats wrong here?
Also is there a way so if i select multiple of my custom helper, i can still access the rollouts, IE do changes to all selected?
The only way that you can get rollouts for one changing values for all is if they are instances when you create them. Just like any other object in Max.
As for getting the position, not sure about that one.
would it be possible to automatically set this up?
for example when I create an object, if theres already one in the scene, just instance that?
Not sure that you could do that. When you are creating a new instance of the plugin and not an instance of one already in the scene. I think that you will just have to force people to create instances of ones that you already have in the scene.
Ok so here the code ive got so far.
plugin Helper CubeMapHelper
name:"CubeMap"
classID:#(0x3af3239a, 0x32f38d89) --GenclassID()
category:"Standard"
extends:Dummy
(
parameters pblock rollout:params
(
paramResolution type:#integer default:256 animatable:false ui:spinResolution
paramOutput type:#integer default:1 animatable:false ui:radioOutput
)
-- This is the display dialog/rollout!
rollout params "CubeMap Helper Parameters"
(
local uiX = 5
local uiY = 5
button btnGenerate "Generate" width:100 pos:[uiX,uiY]
Spinner spinResolution "Resolution:" range:[0, 2048, 256] pos:[uiX,uiY += 25] type:#integer
radiobuttons radioOutput "Output:" labels:#("Viewport","Render") default:1 columns:1 pos:[uiX,uiY += 20]
on btnGenerate pressed do
(
--this is where i want the node position, this is not working!!
position = this.pos
print position
)
)
on Postload do --force to this size
(
delegate.boxsize = [10,10,10]
)
)
Ok not shure whats going on here but if i use the following
printing the nodeTM works here, however if I use that same line within the generate button code, it says
“> MAXScript Rollout Handler Exception: – Unknown property: “translation” in undefined <<”
-- when creating the object
tool create
(
on mousePoint click do
(
nodeTM.translation = gridPoint
print nodeTM.translation
#stop
)
)
on getDisplayMesh do
(
meshObj = createInstance box length:10 width:10 height:10 mapCoords:false
meshObj.mesh
)
so what happens if the user moves that object? Is the object reacreated? If so I could store it in a variable?
Cheers