Notifications
Clear all

[Closed] How can i do this ? and this ?

hy

i just can’t find out how to do a few thing in max script !

here’s what i don’t know:

  1. how can i make a few buttons in the selected viewport ! like when i’m in the perspective and i wanna have some buttons/text in the right side of the viewport… and when i click one to do something like create plane or extrude… ?

  2. how can i link an obj/helper to another obj/hepler… but only in the z rotation ?

  3. how can i rotate and obj with a slider only in the z axis ?

  4. how do i do an interface like orionflame 4 ? only images ?

  5. how can i make a dialog stay in the right or left side:

cui.registerdialogbar dialogTools
cui.dockdialogbar dialogTools #cui_dock_right

but when i double click the top bar of it the dialogTools get’s out of dock state ! i wan’t it to remain docked like when i lock UI i can’t move it after i dock it to right or left… ?

that’s all i wan’t to know, pls help me with those, thanks in advanced.

69 Replies

If I understand correctly, what you want can’t be done…at least not via maxscript. Yes you can “draw” text in the viewport, but I can’t think of a way to trap a mouse event when it is clicked, I could be wrong. You would be better off having a floater with a set of tools/command built into. I don’t know if this is what you really want, but have a look at “MAXScript Dialogs and Rollout Floaters as Extended viewports”

  1. how can i link an obj/helper to another obj/hepler… but only in the z rotation ?

This is is the same as wired parameters right? Take a look at “Parameter Wiring” in the docs, it will explain what you need to know

  1. how can i rotate and obj with a slider only in the z axis ?

We’ll you start with the previous question, obviously. You will then need to setup some custom attributes. The prefered method seems be, start with and empty modifier/attribute holder and the construct your controls onto that…check out “Scripted Custom Attributes” to help get you started…

  1. how do i do an interface like orionflame 4 ? only images ?

Sorry, never used it (please don’t hurt me)…can you draw me a picture?

  1. how can i make a dialog stay in the right or left side:

cui.registerdialogbar dialogTools
cui.dockdialogbar dialogTools #cui_dock_right

but when i double click the top bar of it the dialogTools get’s out of dock state ! i wan’t it to remain docked like when i lock UI i can’t move it after i dock it to right or left… ?

I’m not sure I fully understand your problem, however, to stop a toolbar from been floated again, check out the “style” parameter…


  cui.RegisterDialogBar rof style:#(#cui_dock_left, #cui_max_sized)
  

This seems to have stopped my rollout from been floated…

Shane

You can’t do this with regular interface buttons, but you can do it with a manipulator. You can draw anything you want and make your own buttons. There’s extensive stuff in the maxscript help, but your best bet is to dissect bobo’s slider and joystick. Also, look at putting macros in custom quad menus: just as easy to access and saves you the screen real estate. Or a tiny floating toolbar may be best. Depends on what you need it for.

1 Reply
(@rustyknight)
Joined: 11 months ago

Posts: 0

That is so cool…love learning new things…

thanks… but i can’t make it work here’s what i made:


 	on btn_link pressed do
 	undo "Link !" on
 		(
 			masterWheel = $wheel_front_l
 			masterWheel.rotation.controller = Local_Euler_XYZ ()
 			masterWheel.rotation.controller.available.controller = local_z_rotation()
 			masterWheel.rotation.controller.setActive 3
 			masterWheel.rotation.controller.setName 3 "WireFromHere"
 			--==--
 			f_toy_ctrl.rotation.controller = Local_Euler_XYZ ()
 			f_toy_ctrl.rotation.controller.available.controller = local_z_rotation()
 			f_toy_ctrl.rotation.controller.setActive 3
 			f_toy_ctrl.rotation.controller.setName 3 "WireToHere"
 
 			paramWire.connect masterWheel.rot.controller[3] f_toy_ctrl.rot.controller[3]
 		)
 

about orionflame here’s their website: http://www.orionflame.com/
and here’s a picture (from their website)

=====

about question 1…here’s what i wanna make pretty much !

could someone make me a simple example how to do this ! cuz i’m not soo good at script !

and focomoso thanks for your idea but don’t know how to do that !

1 Reply
(@rustyknight)
Joined: 11 months ago

Posts: 0
 			masterWheel = $wheel_front_l
 			 masterWheel.rotation.controller = Local_Euler_XYZ ()
 			 -- No Idea what all this does...as these parameters don't exist as far as I
 			 -- can tell...
 			 --masterWheel.rotation.controller.available.controller = local_z_rotation()
 			 --masterWheel.rotation.controller.setActive 3
 			 --masterWheel.rotation.controller.setName 3 "WireFromHere"
 			 --==--
 			 $f_toy_ctrl.rotation.controller = Local_Euler_XYZ ()
 			 --f_toy_ctrl.rotation.controller.available.controller = local_z_rotation()
 			 --f_toy_ctrl.rotation.controller.setActive 3
 			 --f_toy_ctrl.rotation.controller.setName 3 "WireToHere"
  
 			-- You were missing, in particular, the "expression" at the end of the function call
 			paramWire.connect $.rotation.controller[#Z_Rotation] $f_toy_ctrl.rotation.controller[#Z_Rotation] "Z_Rotation"
 

about orionflame here’s their website: http://www.orionflame.com/
and here’s a picture (from their website)

From the immediate looks, it would appear to be a custom dialog, using custom rollups which the only way you could fully duplicate would be to write your own plugin…but you could mimic the look at fill with rollouts and buttons

Shane

Look up “Creating Icon Bitmap Files” in the maxScript help.

about question 1…here’s what i wanna make pretty much !

could someone make me a simple example how to do this ! cuz i’m not soo good at script !

So, what exactly is the advantage of putting this in the viewport over creating a custom toolbar? You can put a toolbar anywhere you want, lock it to the sides or top, exactly above where you have it in your example.

The advantage to doing it as a toolbar is you don’t need to know any maxScript. You just drag the macros to your bar and you’re done.

2 Replies
(@rappybmx)
Joined: 11 months ago

Posts: 0

soo i checked that out and yea works… but still can’t get the same look…

that should be the best option but i’m not too good at scripting… soo i think i’m gonna pass

thanks but still can’t make it work… the way u post it won’t work and i tried:


			  $wheel_front_l.rotation.controller = Local_Euler_XYZ ()
			
			  $f_toy_ctrl.rotation.controller = Local_Euler_XYZ ()
				
			  paramWire.connect $wheel_front_l.rotation.controller[#Z_Rotation] $f_toy_ctrl.rotation.controller[#Z_Rotation] "Z_Rotation"

but this way i get this error:

MAXScript Rollout Handler Exception

– Runtime error: connect requires subAnims

OK

why?

o and i have more questions:

  1. Soo i have this to my script:
    createdialog dialogTools menu:dialogMenu
    and in the menu i have a few buttons… my question is how can i align them to center ?

  2. The dialog has this style set to it: style:#(#style_resizing) lockHeight:true lockWidth:true

and how can i create a button in the menu:dialogMenu, and when a click on it to drag the dialog ?

  1. Is there a way to change the colors to the text in my dialog… or the buttons and soo on ?

that’s pretty much it for the moment :D… and thanks again

(@gravey)
Joined: 11 months ago

Posts: 0

this one’s pretty simple. You have changed the rotation controllers on your two objects to Local_Euler_XYZ controllers and yet you are still trying to connect them by name as if they were regular Euler_XYZ controllers. This is how your code should look:

$wheel_front_1.rotation.controller = Local_Euler_XYZ ()
 $f_toy_ctrl.rotation.controller = Local_Euler_XYZ ()
 paramWire.connect $wheel_front_1.rotation.controller[#Local_Z_Rotation] $f_toy_ctrl.rotation.controller[#Local_Z_Rotation] "Local_Z_Rotation"

alternatively you could use [3] insteal of [#Local_Z_Rotation] since we know that the z_rotation is always the 3rd subanim, but you’ll still need to specify the “Local_Z_Rotation” string

thanks but still can't make it work... the way u post it won't work and i tried:
  			  $wheel_front_l.rotation.controller = Local_Euler_XYZ ()
  			
  			  $f_toy_ctrl.rotation.controller = Local_Euler_XYZ ()
  				
  			  paramWire.connect $wheel_front_l.rotation.controller[#Z_Rotation] $f_toy_ctrl.rotation.controller[#Z_Rotation] "Z_Rotation"
 
      
      but this way i get this error:
      ---------------------------
      MAXScript Rollout Handler Exception
      ---------------------------
      -- Runtime error: connect requires subAnims
      ---------------------------
      OK   
      ---------------------------
      
      why?
     
 Sorry, my bad...this should work....
paramWire.connect $wheel_front_l.rotation.controller[#Local_Z_Rotation] $f_toy_ctrl.rotation.controller[#Local_Z_Rotation] "Local_Z_Rotation"
     
  o and i have more questions:
  
  6. Soo i have this to my script:
  createdialog dialogTools menu:dialogMenu
  and in the menu i have a few buttons... my question is how can i align them to center ?
 My short answer would be, you can't...the responsibility for the display of the menu has been delegated over to the dialog, so you no longer have control...

BUT, you might be able to get something like it to work if you were able to add a dotnet menu to the dialog

  7. The dialog has this style set to it: style:#(#style_resizing) lockHeight:true lockWidth:true
  
  and how can i create a button in the menu:dialogMenu, and when a click on it to drag the dialog ?

So, if I understand correctly, you are trying to stop the dialog from been resized and pinned to a location UNTIL the user chooses an option from the menu…but not only have you specified the the dialog as been resiable, you’ve also specified that the height and width be locked…I’m surprised that you PC hasn’t blowen up

 The short answer ... plugin ...
 
 It might be possible to "pin" the dialog in a single spot, but I can't find a SetDialogSize method.
 
 If you listen for the rollout resized event, you might be able to set the rollout.width and rollout.height properties.
 
 The basic idea would be to place code in the moved and resized event handlers that would keep the size and position of the dialog fixed...but you need to get rid of the lockheight/lockwidth clause...
 8. Is there a way to change the colors to the text in my dialog... or the buttons and soo on ?
  
  that's pretty much it for the moment :P :D... and thanks again
 Maybe...but you would have to try the dotnet equivilant

here’s what i’m trying to do…
i made a tutorial…here http://www.sharecg.com/v/22087/video-tutorial/CarRig-with-Reactor
and now i wanna make a script to do all that !..
i attached what i made until now but i have a few problems with it !
if anybody could help me to fix !

=====

and about this ” style:#(#style_resizing) lockHeight:true lockWidth:true”

i did the bycouse i don’t want the dialog to have a title i want it to be simple… but if I put another style i cannot move it anymore… so put it it resizing and locked it and when i try to resize it it moves :D… that’s why i asked how to move a dialog with a button, so i can get rid of that style and one with no border !

=======

in my tutorial u can see a script in the right side… that’s another script of mine that i’m working on… but it’s not entirely mine… it’s based on Tim Jones “Common Tools Toolbar” and some other scripts !!! and some of mine…

1 Reply
(@rustyknight)
Joined: 11 months ago

Posts: 0

Have you tried creating it as a floating toolbar insead?? This creates a small, tool, style dialog box.

cui.RegisterDialogBar <RolloutFloater_or_Rollout> [minSize:<Point2>] [maxSize:<Point2>] [style:<Array>]

I think if you define the style as #([b]#cui_floatable) it may remain undockable…just an idea.

You will probably still be able to resize it though…

Shane
[/b]

so i had made some changes to the script… but now i have some new problems

  1. i added a ini file to the script that will save the position and the state if it’s docked (and where if it’s docked) or not…

but every time i undock the script it won’t get back to the last position :(( it will move it down by 21 pixels or something like that… why ?

here’s a sample:


global RappaTools
---other globals

try(destroyDialog RappaTools)catch()  --if opened
try(cui.UnRegisterDialogBar RappaTools)catch()  --if docked !
try(destroyDialog RappaTools)catch()  --if opened

local theIniFile = getDir #plugcfg + "\\RappaTools.ini"
local dialogWidth = 125
local dialogHeight = 492

----stuff here

rollout RappaTools "RappaTools" --width:125 height:492
(
	subRollout theZone "RappaTools" pos:[-6,-3] width:139 height:492
	
	on RappaTools moved pos do
		setIniSetting theIniFile "Dialog" "Position" (pos as string)
)

---subrollouts script


thePos = execute (getIniSetting theIniFile "Dialog" "Position")
if thePos == OK do thePos = [35,200]

if thePos.x > sysinfo.desktopSize.x - dialogWidth do thePos.x = sysinfo.desktopSize.x - dialogWidth
if thePos.y > sysinfo.desktopSize.y - dialogHeight do thePos.y = sysinfo.desktopSize.y - dialogHeight - 25
if thePos.x < 0 do thePos.x = 0
if thePos.y < 0 do thePos.y = 0

flyState = execute (getIniSetting theIniFile "Dialog" "flyState")

if flyState == 1 then thePos.y = thePos.y-21
if flyState == 2 then thePos.y = thePos.y-21

createDialog RappaTools dialogWidth dialogHeight thePos.x thePos.y menu:rappaMenu style:#(#style_resizing) lockHeight:true lockWidth:true
--style:#(#style_toolwindow)
AddSubRollout RappaTools.theZone subColors
AddSubRollout RappaTools.theZone subRender
AddSubRollout RappaTools.theZone subViewPort
AddSubRollout RappaTools.theZone subModeling

Print "RappaTools v0.313 by RappyBMX Loaded"
Print "RappaTools last update: 02/09/08"
displayTempPrompt "RappaTools © RappyBMX " 1000000000

if flyState == 0 do flyState = false

if flyState == 1 then
	(
		RappaTools.height = 855
		RappaTools.theZone.height = 855
		cui.RegisterDialogBar RappaTools style:#(#cui_handles)
		cui.dockdialogbar RappaTools #cui_dock_left
	)
if flyState == 2 then
	(
		RappaTools.height = 855
		RappaTools.theZone.height = 855
		cui.RegisterDialogBar RappaTools style:#(#cui_handles)
		cui.dockdialogbar RappaTools #cui_dock_right
	)

)


2.in the viewport subrollout i have added 2 dropdown lists, one gathers the lights and one the cameras… when i open the script it will get the cameras and the lights… but if i delete a cam or light or i create one it won’t update…my question is how do i make that to look for changes ? or something…

script:


	 sceneCam = for o in cameras where classof o != TargetObject collect o
	 sceneCamNames = for o in sceneCam collect o.name
	 sceneLight = for o in lights where classof o != TargetObject collect o
	 sceneLightNames = for o in sceneLight collect o.name

rollout subViewPort "ViewPort" width:125 height:73
(

	dropDownList ddl_cam "" pos:[97,1] width:25 height:21 items:sceneCamNames
	dropDownList ddl_light "" pos:[5,1] width:25 height:21 items:sceneLightNames

	--buttons and stuff !!!

	 on ddl_cam selected i do select sceneCam[i]
	 on ddl_light selected i do select sceneLight[i]
)

1 Reply
(@rappybmx)
Joined: 11 months ago

Posts: 0

like i said… i just did that… made 2 ddl (drop down list…just to make it clear) one for cams and one for light… then made this for the ddl to collect the cams and lights…

 	 sceneCam = for o in cameras where classof o != TargetObject collect o
 	 sceneCamNames = for o in sceneCam collect o.name
 	 sceneLight = for o in lights where classof o != TargetObject collect o
 	 sceneLightNames = for o in sceneLight collect o.name

soo now if i create or open a scene with some lights and cams then open the script i will get them in the ddl, i can select them

 	 on ddl_cam selected i do select sceneCam[i]
 	 on ddl_light selected i do select sceneLight[i]

but if i delete a light or a cam it won’t update my ddl… and my problem it that i don’t know how to do that ! a function or something that will update the ddl…

thanks in advanced,
Juncu Remus Gabriel

http://forums.cgsociety.org/showthread.php?f=98&t=589864

thanks Zbuffer for the info

can anyone help me with this ???

2.in the viewport subrollout i have added 2 dropdown lists, one gathers the lights and one the cameras... when i open the script it will get the cameras and the lights.... but if i delete a cam or light or i create one it won't update...my question is how do i make that to look for changes ? or something...

posted in my previous post ? thanks in advanced

Page 1 / 6