[Closed] Custom gizmo?
How can I create custom gizmo or geometry within my script? I am creating an explosion toolset and I want my bomb gizmo to be created from spline…
Hi Loran, take look at scripted manipulators, they provide drawing functions and mouse interaction checking to create custom gizmos.
- Enrico
yeah,
and i also suggest you to watch Bobo´s MasterClass The Secret World of Scripted Manipulators. You´re going to find a lot of usefull tips, specially in the chapter 06.
i cleaned up your code a little bit:
fn create_sphereGizmo thePrefix:"kaboom_" theName:"bomb" Rad:15 Colour:blue thePos:[0,-2.5,0] =
(
c1= circle radius:Rad wirecolor:Colour name:(thePrefix + theName)
c2 = copy c1 radius:Rad wirecolor:Colour
c2.objectOffsetRot = eulerAngles 90 0 0
c3 = copy c1 radius:Rad wirecolor:Colour
c3.objectOffsetRot = eulerAngles 0 90 0
c4 = circle radius:(Rad-2) wirecolor:Colour
t1=text size:(Rad-4) text:theName pos:thePos
converttosplineshape #(c1,c2,c3,c4,t1)
addAndWeld c1 t1 0
addAndWeld c1 c2 0
addAndWeld c1 c3 0
addAndWeld c1 c4 0
)
hope it helps
Or use a plugin helper class and build it in there. I have an example of one on my site and there is lots in the help file about it.
I am curently using a SphereGizmo and I want to have a specific design, I don’t like manipulators. I want all to be in the script, no plug ins or something else to install
You can actually include a SimpleManipulator in a standard MacroScript, like a Rollout or a Structure, nothing more to add to a single scripted file, and really versatile. You can have a look at standard lightTool.ms code for a sample:
…<MaxRoot>\stdplugs\stdscripts\lightTool.ms
- Enrico
Got it! I just spy how Paul Neal did is custom helpers
By the way, is there a best way to do that?
rad = 15
c1=circle radius:rad
c2=circle radius:rad
c2.rotation = eulerangles 90 0 0
c3=circle radius:rad
c3.rotation = eulerangles 0 90 0
c4=circle radius:17
t1=text()
–t1.rotation = eulerangles -90 0 0
t1.size= rad-4
t1.text=“bomb”
t1.pos = [0,-2.5,0]
converttosplineshape c1
converttosplineshape c2
converttosplineshape c3
converttosplineshape c4
converttosplineshape t1
addAndWeld c1 t1 0
addAndWeld c1 c2 0
addAndWeld c1 c3 0
addAndWeld c1 c4 0
c1.name=“kaboom-BOMB”
c1.wireColor = [255,100,200]
Well if what you want is a spline based control that works just fine. You can also build the splines vert by vert which is the other way that I do it in some of those spline controls.
“MasterClass The Secret World of Scripted Manipulators DVD”
Where would one find this?
Subscription center, under Training > 3ds Max Training Videos (English) > Scripting and API
I went today to check it out and it turned out to be quite entertaining
plugin simpleManipulator kaboom_Boom
name:"kaboom_Boom"
invisible:false
classID:#(0x662c3c16, 0x77a572f7)
category:"Manipulators"
(
local blueColor = blue/255.0
local orangeColor = orange/255.0
local whiteColor = white/255.0
local Pos = [0,0,0]
local Seg = 8
local Rad = 15
parameters main rollout:paramRollout
(
txt type:#string ui:ed_text default:"BOOM"
)
rollout paramRollout "Parameters"
(
edittext ed_text "Txt: " fieldWidth:140 align:#center labelOnTop:true
)
tool create
(
on mousePoint click do
(
case click of
(
1:
(
theTM = matrix3 1
theTM.row4 = gridPoint
nodeTM = theTM
#stop
) -- 1
2:
(
#stop
) -- 2
) -- end case
)
)
on canManipulate target return ( findItem(getPropNames target) #txt ) !=0
on updateGizmos do
(
this.clearGizmos()
local flags = 0
if (target != undefined)
then
(
this.txt = target.txt
)
--GIZMO 1
local c1 = (manip.makeCircle Pos Rad Seg)
this.addGizmoShape c1 flags blueColor orangeColor
--GIZMO 2
local theTXT = filterString txt "
" splitEmptyTokens:true
for i = 1 to (theTXT.count) do
this.addGizmoText theTXT[i] Pos flags whiteColor orangeColor
return ( findItem(getPropNames this) #txt ) !=0
)
)
evalute and go to create tab> helpers> manipulators> kaboom_Boom
i liked it a lot Bobo, it´s very interesting !! ;)
just one question:
why max loses my custom scripted manipulators when save/open scenes ?? what do i have to do to keep it working ?
it´s independent, it doesn´t need scene nodes and can be created by itself…