I should mention that the draw back here is flashing in the imgTag as the map is redrawn over and over. But it works without anything fancy. Would be nice to have a dotNet version, let me know when that tool is ready.
Many thanks Pen. I appreciate your time. I’ve not use the imgTag before. Clearly it a pretty powerful tool.
I’ve noticed that changing viewport can cause the red lines to disappear. It looks like ‘Mouse.pos’ reports values in viewport coordinates whilst ‘GetDialogPos’ reports in Screen coordinates. But I’m sure theres a simple way around the problem.
I be sure to post up new versions of the mouse window as I develop it. I’ll try and see if theres an easy way to develop the DotNet Control version and Floating Form version at the same time.
Oops, I should be using screenPos not pos. I’ll correct that and post again. I thought there was something odd going on.
Two controls working now in it.
try(destroyDialog testImgTag)catch()
rollout testImgTag "Test Img Tag"
(
local currentControl=undefined
imgTag mouseTracker "MouseTracker" \
height:100 width:100 bitMap:undefined
imgTag mouseTracker02 "MouseTracker" \
height:100 width:100 bitMap:undefined
timer mouseTime interval:50
fn createBitMap control:undefined width:0 height:0 pos:[0,0]=
(
if control!=undefined then
(
crossCol=(color 255 0 0)
bm=bitmap width height color:(color 255 255 255)
for i = 0 to width do (setPixels bm [i,pos.y] #(crossCol))
for i = 0 to height do (setPixels bm [pos.x,i] #(crossCol))
control.bitmap=bm
)
)
on mouseTracker lbuttondown pos flag do (currentControl=mouseTracker)
on mouseTracker lbuttonup pos flag do (currentControl=undefined;gc light:true)
on mouseTracker mouseout do (currentControl=undefined;gc light:true)
on mouseTracker02 lbuttondown pos flag do (currentControl=mouseTracker02)
on mouseTracker02 lbuttonup pos flag do (currentControl=undefined;gc light:true)
on mouseTracker02 mouseout do (currentControl=undefined;gc light:true)
on mouseTime tick do
(
if currentControl!=undefined then
(
newPos=(mouse.screenPos-(GetDialogPos testImgTag)-currentControl.pos-[3,22])
createBitMap control:currentControl width:currentControl.width height:currentControl.height pos:newPos
)
)
on testImgTag open do
(
createBitMap control:mouseTracker width:mouseTracker.width height:mouseTracker.height
createBitMap control:mouseTracker02 width:mouseTracker02.width height:mouseTracker02.height
)
)
createDialog testImgTag
Good stuff Paul. Funny, I was just about to post in the python thread about how to do something like this using python.
I didn’t know this imgTag control. It seems powerful.
About the mouse control, I think it would not be so difficult to create a .NET custom control version.
I believe some one is already working on that. This is a good alternative if you don’t want to add any plugins or add ons. I often do work for small quick clients, the last thing that I want to introduce is plugins into thier pipeline or lack of one where they don’t know how to get a tool working again after a machine has been rebuilt. So alternatives like this for me is something that I will use even if there is a better way. If the client can handle it then I will drop every thing I can on them.
I would like to see how that is done with the new Blur plugin by Eric, I wonder if it would be faster or slower? I would think that there might be more control with the functions in Python, I have not used them but I have poked around them a bit for building maps. I still haven’t found time to get deep in to python as I’m always being pulled off onto more pressing work.
Some more fun.
try(destroyDialog testImgTag)catch()
rollout testImgTag "Test Img Tag"
(
local curBoxControl=undefined
local curSliderControlX=undefined
local curSliderControlY=undefined
local boxControlItVal=[0,0]
imgTag boxControlIt "MouseTracker" \
height:100 width:100 bitMap:undefined
imgTag sliderControlItY "MouseTracker" \
height:100 width:15 bitMap:undefined offset:[105,-105]
imgTag sliderControlItX "MouseTracker" \
height:15 width:100 bitMap:undefined
timer mouseTime interval:50
fn boxControl control:undefined width:0 height:0 pos:[0,0]=
(
if control!=undefined then
(
crossCol=(color 255 0 0)
bm=bitmap width height color:(color 255 255 255)
for i = 0 to width do (setPixels bm [i,pos.y] #(crossCol))
for i = 0 to height do (setPixels bm [pos.x,i] #(crossCol))
control.bitmap=bm
boxControlItVal=pos
)
)
fn sliderControl control:undefined width:0 height:0 pos:[0,0] axis:#x=
(
if control!=undefined then
(
col=(color 50 50 255)
bm=bitmap width height color:(color 220 220 220)
case axis of
(
#x:
(
for h = 0 to height do
(
for i = 0 to pos.x do
(
setPixels bm [i,h] #(col)
)
for i = 0 to width by 10 do
(
curCol=(getPixels bm [i,h] 1)[1]
if curCol!=undefined then
(
curCol.v+=100
setPixels bm [i,h] #(curCol)
)
)
)
)
#y:
(
for w = 0 to width do
(
for i = height to pos.y by-1 do
(
setPixels bm [w,i] #(col)
)
for i = 0 to height by 10 do
(
curCol=(getPixels bm [w,i] 1)[1]
if curCol!=undefined then
(
curCol.v+=100
setPixels bm [w,i] #(curCol)
)
)
)
)
)
control.bitmap=bm
)
)
fn conMenus=
(
rcMenu menu
(
menuItem reset "Reset"
menuItem resetX "Reset X"
menuItem resetY "Reset Y"
on reset picked do
(
boxControlItVal=[boxControlIt.width/2,boxControlIt.height/2]
boxControl control:boxControlIt width:boxControlIt.width height:boxControlIt.height pos:boxControlItVal
sliderControl control:sliderControlItX width:sliderControlItX.width height:sliderControlItX.height pos:boxControlItVal axis:#x
sliderControl control:sliderControlItY width:sliderControlItY.width height:sliderControlItY.height pos:boxControlItVal axis:#y
)
on resetX picked do
(
boxControlItVal=[boxControlIt.width/2,boxControlItVal.y]
boxControl control:boxControlIt width:boxControlIt.width height:boxControlIt.height pos:boxControlItVal
sliderControl control:sliderControlItX width:sliderControlItX.width height:sliderControlItX.height pos:boxControlItVal axis:#x
)
on resetY picked do
(
boxControlItVal=[boxControlItVal.x,boxControlIt.height/2]
boxControl control:boxControlIt width:boxControlIt.width height:boxControlIt.height pos:boxControlItVal
sliderControl control:sliderControlItY width:sliderControlItY.width height:sliderControlItY.height pos:boxControlItVal axis:#y
)
)
)
on boxControlIt lbuttondown pos flag do (curBoxControl=boxControlIt)
on boxControlIt lbuttonup pos flag do (curBoxControl=undefined;gc light:true)
on boxControlIt mouseout do (curBoxControl=undefined;gc light:true)
on boxControlIt rbuttonDown do
(
PopupMenu (conMenus())
)
on sliderControlItX lbuttondown pos flag do (curSliderControlX=sliderControlItX)
on sliderControlItX lbuttonup pos flag do (curSliderControlX=undefined;gc light:true)
on sliderControlItX mouseout do (curSliderControlX=undefined;gc light:true)
on sliderControlItY lbuttondown pos flag do (curSliderControlY=sliderControlItY)
on sliderControlItY lbuttonup pos flag do (curSliderControlY=undefined;gc light:true)
on sliderControlItY mouseout do (curSliderControlY=undefined;gc light:true)
on mouseTime tick do
(
dPos=mouse.screenPos-(GetDialogPos testImgTag)
if curBoxControl!=undefined then
(
newPos=dPos-curBoxControl.pos-[3,22]
boxControl control:curBoxControl width:curBoxControl.width height:curBoxControl.height pos:newPos
sliderControl control:sliderControlItX width:sliderControlItX.width height:sliderControlItX.height pos:newPos axis:#x
sliderControl control:sliderControlItY width:sliderControlItY.width height:sliderControlItY.height pos:newPos axis:#y
)
if curSliderControlX!=undefined then
(
newPos=dPos-curSliderControlX.pos-[3,22]
sliderControl control:curSliderControlX width:curSliderControlX.width height:curSliderControlX.height pos:newPos axis:#x
boxControl control:boxControlIt width:boxControlIt.width height:boxControlIt.height pos:[newPos.x,boxControlItVal.y]
)
if curSliderControlY!=undefined then
(
newPos=dPos-curSliderControlY.pos-[3,22]
sliderControl control:curSliderControlY width:curSliderControlY.width height:curSliderControlY.height pos:newPos axis:#y
boxControl control:boxControlIt width:boxControlIt.width height:boxControlIt.height pos:[boxControlItVal.x,newPos.y]
)
)
on testImgTag open do
(
boxControl control:boxControlIt width:boxControlIt.width height:boxControlIt.height pos:[boxControlIt.width/2,boxControlIt.height/2]
sliderControl control:sliderControlItX width:sliderControlItX.width height:sliderControlItX.height pos:[sliderControlItX.width/2,sliderControlItX.height/2] axis:#x
sliderControl control:sliderControlItY width:sliderControlItY.width height:sliderControlItY.height pos:[sliderControlItY.width/2,sliderControlItY.height/2] axis:#y
)
)
createDialog testImgTag
I should mention that there is a RC menu on the right click over the box control as well in that last version.
Also there are problems with the position if you are using the newer windows look with the rounded title bar. Set the values [3,22] to [3,30] and it will work better.
No animator could ever complain about this verision, I call it the supper trippy, psycho-delic UI.
try(destroyDialog testImgTag)catch()
rollout testImgTag "Test Img Tag"
(
local curBoxControl=undefined
local curSliderControlX=undefined
local curSliderControlY=undefined
local boxControlItVal=[0,0]
imgTag boxControlIt "MouseTracker" \
height:100 width:100 bitMap:undefined
imgTag sliderControlItY "MouseTracker" \
height:100 width:15 bitMap:undefined offset:[105,-105]
imgTag sliderControlItX "MouseTracker" \
height:15 width:100 bitMap:undefined
timer mouseTime interval:50
fn boxControl control:undefined width:0 height:0 pos:[0,0]=
(
if control!=undefined then
(
crossCol=(color 255 0 0)
bm=bitmap width height color:(random (color 255 255 255) (color 1 1 1))
for i = 0 to width do (setPixels bm [i,pos.y] #(crossCol))
for i = 0 to height do (setPixels bm [pos.x,i] #(crossCol))
control.bitmap=bm
boxControlItVal=pos
)
)
fn sliderControl control:undefined width:0 height:0 pos:[0,0] axis:#x=
(
if control!=undefined then
(
bm=bitmap width height color:(color 220 220 220)
case axis of
(
#x:
(
for h = 0 to height do
(
col=(color 0 0 255)
for i = 0 to pos.x do
(
col.h+=1
setPixels bm [i,h] #(col)
)
for i = 0 to width by 10 do
(
curCol=(getPixels bm [i,h] 1)[1]
if curCol!=undefined then
(
curCol.v+=100
setPixels bm [i,h] #(curCol)
)
)
)
)
#y:
(
for w = 0 to width do
(
col=(color 0 0 255)
for i = height to pos.y by-1 do
(
col.h+=1
setPixels bm [w,i] #(col)
)
for i = 0 to height by 10 do
(
curCol=(getPixels bm [w,i] 1)[1]
if curCol!=undefined then
(
curCol.v+=100
setPixels bm [w,i] #(curCol)
)
)
)
)
)
control.bitmap=bm
)
)
fn conMenus=
(
rcMenu menu
(
menuItem reset "Reset"
menuItem resetX "Reset X"
menuItem resetY "Reset Y"
on reset picked do
(
boxControlItVal=[boxControlIt.width/2,boxControlIt.height/2]
boxControl control:boxControlIt width:boxControlIt.width height:boxControlIt.height pos:boxControlItVal
sliderControl control:sliderControlItX width:sliderControlItX.width height:sliderControlItX.height pos:boxControlItVal axis:#x
sliderControl control:sliderControlItY width:sliderControlItY.width height:sliderControlItY.height pos:boxControlItVal axis:#y
)
on resetX picked do
(
boxControlItVal=[boxControlIt.width/2,boxControlItVal.y]
boxControl control:boxControlIt width:boxControlIt.width height:boxControlIt.height pos:boxControlItVal
sliderControl control:sliderControlItX width:sliderControlItX.width height:sliderControlItX.height pos:boxControlItVal axis:#x
)
on resetY picked do
(
boxControlItVal=[boxControlItVal.x,boxControlIt.height/2]
boxControl control:boxControlIt width:boxControlIt.width height:boxControlIt.height pos:boxControlItVal
sliderControl control:sliderControlItY width:sliderControlItY.width height:sliderControlItY.height pos:boxControlItVal axis:#y
)
)
)
on boxControlIt lbuttondown pos flag do (curBoxControl=boxControlIt)
on boxControlIt lbuttonup pos flag do (curBoxControl=undefined;gc light:true)
on boxControlIt mouseout do (curBoxControl=undefined;gc light:true)
on boxControlIt rbuttonDown do
(
PopupMenu (conMenus())
)
on sliderControlItX lbuttondown pos flag do (curSliderControlX=sliderControlItX)
on sliderControlItX lbuttonup pos flag do (curSliderControlX=undefined;gc light:true)
on sliderControlItX mouseout do (curSliderControlX=undefined;gc light:true)
on sliderControlItY lbuttondown pos flag do (curSliderControlY=sliderControlItY)
on sliderControlItY lbuttonup pos flag do (curSliderControlY=undefined;gc light:true)
on sliderControlItY mouseout do (curSliderControlY=undefined;gc light:true)
on mouseTime tick do
(
dPos=mouse.screenPos-(GetDialogPos testImgTag)-[3,22]
if curBoxControl!=undefined then
(
newPos=dPos-curBoxControl.pos
boxControl control:curBoxControl width:curBoxControl.width height:curBoxControl.height pos:newPos
sliderControl control:sliderControlItX width:sliderControlItX.width height:sliderControlItX.height pos:newPos axis:#x
sliderControl control:sliderControlItY width:sliderControlItY.width height:sliderControlItY.height pos:newPos axis:#y
)
if curSliderControlX!=undefined then
(
newPos=dPos-curSliderControlX.pos
sliderControl control:curSliderControlX width:curSliderControlX.width height:curSliderControlX.height pos:newPos axis:#x
boxControl control:boxControlIt width:boxControlIt.width height:boxControlIt.height pos:[newPos.x,boxControlItVal.y]
)
if curSliderControlY!=undefined then
(
newPos=dPos-curSliderControlY.pos
sliderControl control:curSliderControlY width:curSliderControlY.width height:curSliderControlY.height pos:newPos axis:#y
boxControl control:boxControlIt width:boxControlIt.width height:boxControlIt.height pos:[boxControlItVal.x,newPos.y]
)
)
on testImgTag open do
(
boxControl control:boxControlIt width:boxControlIt.width height:boxControlIt.height pos:[boxControlIt.width/2,boxControlIt.height/2]
sliderControl control:sliderControlItX width:sliderControlItX.width height:sliderControlItX.height pos:[sliderControlItX.width/2,sliderControlItX.height/2] axis:#x
sliderControl control:sliderControlItY width:sliderControlItY.width height:sliderControlItY.height pos:[sliderControlItY.width/2,sliderControlItY.height/2] axis:#y
)
)
createDialog testImgTag