Notifications
Clear all
[Closed] Putting an xRef inside a helper-plugin
Apr 20, 2006 10:21 am
For a game I am working on objects in 3dsmax that represent interactable game-objects, so that the level-designers can place them. These objects are BoxGizmos and should also be visualised in 3dsmax by meshes from external files, so I think I need xRef’s for this. However, I am unsure how to tackle this and what I have right now does not work.
So, my question is, how can I do this?
What I am trying right now, but cannot get to work, is creating a plugin that extends BoxGizmo and has a #node-parameter with the xRef in it. If I am trying the right thing, then I have the following questions:
- How can I find out in what folder my script is? The current folder in 3dsmax may have changed since loading the plug-in and I know where the meshes are only relatively to the folder with the plug-in.
- How can I get the position of my plug-in BoxGizmo inside the plug-in? this.transform and delegate.transform both give an error in 3dsmax.
- I make an xRef, but the new object is not stored in the parameter for it. After “visualisationNode = objXRefs.addNewXRefObject xRefFileNames[index] nameLabels 0” an xRef is created in the scene, but “visualisationNode” is still “undefined”.
- I do not want my designers to select the xRef-object seperately. I figured I could freeze it to prevent this, but the user could unfreeze it and still move it out of the BoxGizmo. Is there some way too force that the user cannot select it?
- I want the xRef to always be on the same position as the BoxGizmo. I could link it, but the user might unlink it. Is there some way to force that it cannot be unlinked?
This is what I have so far:
plugin Helper Paintable
name:"Paintable"
classID:#(0x16b44e5c, 0x592e6a26)
category:"PaintBall"
extends:BoxGizmo
replaceUI:true
(
local nameLabels = #("Car1", "Car2")
local xRefFileNames = #("..\\..\\assets\\Models\\Interactable objects\\voertuigen\\Cars.max", "..\\..\\assets\\Models\\Interactable objects\\voertuigen\\Cars.max")
function setXRef index =
(
--delete the old xRef
if visualisationNode != undefined then
(
delete visualisationNode
)
--create a new xRef
visualisationNode = objXRefs.addNewXRefObject xRefFileNames[index] nameLabels 0
print this.transform
)
parameters main rollout:params
(
meshTypeIndex type:#radiobtnIndex ui:meshTypeRadioButton default:1
visualisationNode type:#node
)
rollout params "Parameters"
(
label l1 "Choose object type:"
radioButtons meshTypeRadioButton labels:nameLabels
on meshTypeRadioButton changed index do
(
setXRef index
)
)
tool create
(
on mousePoint click do
(
nodeTM.position = gridPoint
setXRef 1
#stop
)
)
)
Is this the right approach anyway, or is there some much simpler way to do all this?
Thanks for looking at my question!