Notifications
Clear all
[Closed] ProfessorXRef
Mar 20, 2008 11:32 pm
I’ve started rewriting the XRefScene Dialog piece by piece to add some missing basic functionality.
Here is the AddFunction as of today. It adds the ability to create a “gizmo” which is a little box around the bottom with the name of the max scene being imported.
Just though someone else might find it useful.
try(destroydialog ProfessorXrefAdd) catch()
global ProfessorXrefAdd
(
rollout ProfessorXrefAdd "ProfessorXref - Add File"
(
checkbox IgnoreLightCheck "Ignore Lights"
checkbox IgnoreCameraCheck "Ignore Cameras"
checkbox gizmoCheck "Gizmo" checked:true
button AddXrefScene "Add..." pos:[125,6] width:60 height:53
fn AddXRefObject XRefOpenName:undefined IgnoreLights:false IgnoreCameras:false gizmo:true =
(
if XRefOpenName != undefined do
(
ProfessorX = xrefs.addnewXRefFile XRefOpenName
ProfessorX.ignorelights = IgnoreLights
ProfessorX.ignorecameras = IgnoreCameras
if gizmo == true do
(
fn ControlGizmoMaker XRefSceneObject =
(
XRefFileName = getFilenameFile XRefSceneObject.filename
selectmin = [XRefSceneObject.tree.children.min[1], XRefSceneObject.tree.children.min[2], (XRefSceneObject.tree.children.min[3]+.25)]
selectmax = XRefSceneObject.tree.children.max
selectcenter = XRefSceneObject.tree.children.center
SelectX = selectmax[1]-selectmin[1]
SelectY = selectmax[2]-selectmin[2]
SelectZ = selectmax[3]-selectmin[3]
new_rectangle = rectangle length:SelectY Width:SelectX
new_rectangle.pos = [SelectCenter[1], SelectCenter[2], SelectMin[3]]
new_rectangle.wirecolor = green
new_rectangle.name = uniquename(XrefFilename+"_Rectangle_")
new_label = text text:XRefFileName size:6
new_label.wirecolor = green
New_label_offsetX = ((new_label.max[1] - new_label.min[1])/2)
new_label.pos = [(SelectMin[1]+New_Label_OffsetX), (SelectMin[2]-5),SelectMin[3]]
new_label.name = uniquename(XrefFilename+"_Label_")
new_group = group #(new_rectangle, new_label) name:(uniquename(XRefFileName+"_Gizmo_"))
return new_group
)
XGizmo = ControlGizmoMaker ProfessorX
ProfessorX.parent = XGizmo
)
)
return ProfessorX
)
on AddXrefScene pressed do
(
Filename = getOpenFileName types:"Open XRef Object (*.max)|*.max|"
AddXrefObject XrefOpenName:Filename IgnoreLights:ignorelightcheck.checked IgnoreCameras:ignorecameracheck.checked gizmo:gizmocheck.checked
)
)
createdialog ProfessorXRefAdd 200 65
)