Notifications
Clear all

[Closed] Always on top window, it's possible?

Hello everyone!

I’m starting with MaxScript and the best form to do it is making useful tools.

I made a little tool that ables to:

  • Easy align unwrap vertex
  • Copy and paste UV properties with simple buttons
  • Select by Mat ID only by clicking the number

But my “little” problem appears when I want to use the UV editor maximized, because the “tool” disappears (is behind the UV editor, obviously).

Is possible to use maxscript for make always on top window?

I looked for it, but I don’t know if can call it by other name.

Thank you very much!

5 Replies

Are you using a rollout or a dotNet form?

If you’re using a dialog/rollout then it should always be on top.

If you’re using a dotNet form then you need to use a maxform:

form = dotNetObject "maxCustomControls.maxForm"  

And to make it always appear on top of the max window you need to use:

form.showModeLess()

rather than

form.show()

Ah actually having reread your post I think that won’t work. So you’ve created a dialog window and you want that to always sit on top of the UV editor even when the dialog is not in focus.

I’m not aware of a way to do this with a maxscript dialog. You might be able to use a timer to make sure it’s always the top window but that’s quite a nasty way of achieving your goal.

Hi!

I think is better if with my code in front:


/* UnWrap tools for Newbies
		This tool ables to:
		- Easy align unwrap vertex
		- Copy and paste UV properties with simple buttons
		- Select by Mat ID only by clicking the number
		
		Author: Sergio Zarraga
		UPF - MCV - 2011
		*/

	rollout AUnwrapV "Align UV Vertex" width:200 height:200
			(
				Group "Align UV Vertex"
				(
				button AoX "Align on X" visible:true width:90 pos:[10,20]
				button AoY "Align on Y" visible:true width:90 pos:[100,20]
				)
				
				Group "Copy/Paste UV"
				(
				button UVCopy "Copy UV" visible:true width:90 pos:[10,70]
				button UVPaste "Paste UV" visible:true width:90 pos:[100,70]
				)
				
				Group "Select by Mat. ID"
				(
					button matid1 "1" visible:true width:30 pos:[10,120]
					button matid2 "2" visible:true width:30 pos:[40,120]
					button matid3 "3" visible:true width:30 pos:[70,120]
					button matid4 "4" visible:true width:30 pos:[100,120]
					button matid5 "5" visible:true width:30 pos:[130,120]
					button matid6 "6" visible:true width:30 pos:[160,120]
					button matid7 "7" visible:true width:30 pos:[10,140]
					button matid8 "8" visible:true width:30 pos:[40,140]
					button matid9 "9" visible:true width:30 pos:[70,140]
					button matid10 "10" visible:true width:30 pos:[100,140]
					button matid11 "11" visible:true width:30 pos:[130,140]
					button matid12 "12" visible:true width:30 pos:[160,140]
				)
					
				on AoX pressed do (
					$.modifiers[#unwrap_uvw].unwrap.ScaleSelectedVerticesCenter 0.0 1)
				on AoY pressed do (
					$.modifiers[#unwrap_uvw].unwrap.ScaleSelectedVerticesCenter 0.0 2)
				on UVCopy pressed do (
					$.modifiers[#Unwrap_UVW].copy())
				on UVPaste pressed do (
					$.modifiers[#Unwrap_UVW].paste false)
					
				on matid1 pressed do (
					$.modifiers[#Unwrap_UVW].selectByMatID 1
				)
				on matid2 pressed do (
					$.modifiers[#Unwrap_UVW].selectByMatID 2
				)
				on matid3 pressed do (
					$.modifiers[#Unwrap_UVW].selectByMatID 3
				)
				on matid4 pressed do (
					$.modifiers[#Unwrap_UVW].selectByMatID 4
				)
				on matid5 pressed do (
					$.modifiers[#Unwrap_UVW].selectByMatID 5
				)
				on matid6 pressed do (
					$.modifiers[#Unwrap_UVW].selectByMatID 6
				)
				on matid7 pressed do (
					$.modifiers[#Unwrap_UVW].selectByMatID 7
				)
				on matid8 pressed do (
					$.modifiers[#Unwrap_UVW].selectByMatID 8
				)
				on matid9 pressed do (
					$.modifiers[#Unwrap_UVW].selectByMatID 9
				)
				on matid10 pressed do (
					$.modifiers[#Unwrap_UVW].selectByMatID 10
				)
				on matid11 pressed do (
					$.modifiers[#Unwrap_UVW].selectByMatID 11
				)			
				on matid12 pressed do (
					$.modifiers[#Unwrap_UVW].selectByMatID 12
				)
			)
		createDialog AUnwrapV

This is my code, if I open the “UV editor” it is behind…

Thank you!

to continue the old topic http://forums.cgsociety.org/showthread.php?f=98&t=925555&highlight=setWindowPos


global User32
fn CreateUser32Assembly =
(
	source = ""
	source += "using System;
"
	source += "using System.Runtime.InteropServices;
"
	source += "class User32
"
	source += "{
"
	source += " [DllImport(\"user32.dll\")]
"
	source += " public static extern bool SetWindowPos(Int64 hWnd, int hWndArg, int Left, int Top, int Width, int Height, int hWndFlags);
"
	source += "}
"

	csharpProvider = dotnetobject "Microsoft.CSharp.CSharpCodeProvider"
	compilerParams = dotnetobject "System.CodeDom.Compiler.CompilerParameters"
					
	compilerParams.GenerateInMemory = on
	compilerResults = csharpProvider.CompileAssemblyFromSource compilerParams #(source)
	compilerResults.CompiledAssembly.CreateInstance "User32"
)
User32 = CreateUser32Assembly()
fn showTopmost name act:on = if (hwnd = windows.getChildHWND 0 name) != undefined do 
(
	HWND_TOPMOST 	= -1
	HWND_NOTOPMOST 	= -2
	
	User32.setWindowPos hwnd[1] (if act then HWND_TOPMOST else HWND_NOTOPMOST) 0 0 0 0 0x3 -- (SWP_NOSIZE = 0x1, SWP_NOMOVE = 0x2)
	act
)
/*
showTopmost "MAXScript Listener" act:on
showTopmost "MAXScript Listener" act:off
*/

Hi!

I don’t understand. I should copy your code on my script?

Thank you