PDA

View Full Version : How can i do this ? and this ?


RappyBMX
12-30-2007, 10:47 PM
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.

RustyKnight
12-31-2007, 04:25 AM
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... ?
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"

2. 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

3. 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...

4. 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?

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... ?
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

focomoso
12-31-2007, 10:36 AM
hy
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... ?
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.

RustyKnight
12-31-2007, 12:17 PM
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.That is so cool...love learning new things... :)

RappyBMX
01-01-2008, 06:20 PM
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"

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

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...

Shane

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)

http://img113.imageshack.us/img113/9339/orionflamejz4.th.png (http://img113.imageshack.us/my.php?image=orionflamejz4.png)

=====

about question 1...here's what i wanna make pretty much !
http://img527.imageshack.us/img527/2517/screen0copymv1.th.jpg (http://img527.imageshack.us/my.php?image=screen0copymv1.jpg)
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 ! :(

focomoso
01-02-2008, 01:15 AM
about orionflame here's their website: http://www.orionflame.com/
and here's a picture (from their website)
http://img113.imageshack.us/img113/9339/orionflamejz4.th.png (http://img113.imageshack.us/my.php?image=orionflamejz4.png)

Look up "Creating Icon Bitmap Files" in the maxScript help.

about question 1...here's what i wanna make pretty much !
http://img527.imageshack.us/img527/2517/screen0copymv1.th.jpg (http://img527.imageshack.us/my.php?image=screen0copymv1.jpg)
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.

RustyKnight
01-02-2008, 09:31 AM
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]
)



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)

http://img113.imageshack.us/img113/9339/orionflamejz4.th.png (http://img113.imageshack.us/my.php?image=orionflamejz4.png)

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

RappyBMX
01-03-2008, 01:26 PM
Look up "Creating Icon Bitmap Files" in the maxScript help.
soo i checked that out and yea works... but still can't get the same look...

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

that should be the best option but i'm not too good at scripting... soo i think i'm gonna pass :D

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.controll er = 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.controlle r = 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"

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:

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 ?

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 ?

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

RustyKnight
01-03-2008, 10:00 PM
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

Gravey
01-03-2008, 10:13 PM
but this way i get this error:
---------------------------
MAXScript Rollout Handler Exception
---------------------------
-- Runtime error: connect requires subAnims
---------------------------
OK
---------------------------

why? 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

RappyBMX
01-04-2008, 01:40 PM
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....

RustyKnight
01-04-2008, 10:07 PM
=====

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 !

=======

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 #(#cui_floatable) it may remain undockable...just an idea.

You will probably still be able to resize it though...

Shane

RappyBMX
02-09-2008, 12:26 AM
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]
)

Zbuffer
02-10-2008, 11:22 PM
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... ?


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

RappyBMX
02-11-2008, 12:26 PM
thanks Zbuffer for the info :D


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

RustyKnight
02-11-2008, 09:04 PM
You will need to register a NodePreDelete callback and evaluate the type of node been deleted. If you are interested in said node, you will need to update your details.

Shane

RappyBMX
02-11-2008, 09:58 PM
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]
)


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

RustyKnight
02-11-2008, 10:39 PM
And like I said, you need to register a preNodeCallback to detect when a node is deleted.

If the node is a camera or light, you need to update the apprioprate data list.

May I suggest you take a quick look at the docs (look for callbacks | general event) and READ. It will tell you EVERYTHING you need to know about how to accomplish what you want! Forgive me, I've pulled my back out and my patience is at 0.

I think you may find you might have some issues with the dropdown items array, but it would be wroth running a few tests to see if you can delete items from that array, look up "array methods | deleteietem()"

You may also be interested in look at the NodeCreated callback event to detect when new items are created

Shane

RappyBMX
02-24-2008, 04:09 PM
And like I said, you need to register a preNodeCallback to detect when a node is deleted.

If the node is a camera or light, you need to update the apprioprate data list.

May I suggest you take a quick look at the docs (look for callbacks | general event) and READ. It will tell you EVERYTHING you need to know about how to accomplish what you want! Forgive me, I've pulled my back out and my patience is at 0.

I think you may find you might have some issues with the dropdown items array, but it would be wroth running a few tests to see if you can delete items from that array, look up "array methods | deleteietem()"

You may also be interested in look at the NodeCreated callback event to detect when new items are created

Shane

sorry if i pissed you off, and thank you for trying to help me :)
i tried to do what u said bet i got some errors so i thought for an alternative... i don't know if it's good but it works :D and it's easy :D

i created a timer i set it to tick every 5second' and when it thicks it will update my dropdownlist :D... will this slow down my max ?

RustyKnight
02-24-2008, 10:27 PM
No need to appologise...I have a lot of empathy of people with cronic pain issues...you simply can't focus on anything and everything makes you cranky (although my wife would argue that's my normal state ;))

As for the timer, yes I would imagin it would put quite a drag onto your resources over time...

I'm curious as to what issues you had with the callback system, I know you need to play with it very nicely or it can get very upset, but generally it has worked really well for me, doing what you want...

Shane

RappyBMX
04-12-2008, 12:23 PM
soo i'm back, i have 2 new questions/problems :)

1. in my script i don't want to make for all the buttons a macroscript, even if i would like i don't think that i could do that, anyway... i wan't to have just to macros...one to open up the script and the second one to store my last action... like if i press a button in the script then i run the second macro it will do what i did previously...( i click me poly button in my scrip window (makes the obj editable poly) then i select another obj and i want to make this also and editable poly, but if i have the second macro (that's assigned to a shortcut) i hit the shortcut key and it will make it editable poly :)....

so my question is how can i make that :|....

and something that i don't know is how can i press a button from my script from another script ( in my case from the second macro)

RappaTools.theZone.subModeling.poly < this is the button... how can i pressed it ???

2.
format "\nRappaTools % Loaded\n" rt_version
rt_version = "v313.1"
where rt_version is the version... ok so this works it will print this in my maxscript listener...

but how ca i do that with

displayTempPrompt "u have RappaTools !rt_version!" 100000000

or with print or...

how can i call rt_version ?


thanks in advanced

RappyBMX
04-15-2008, 03:34 PM
hmm...

soo since nobody replied i guess there's no way to press a button from a script... :((

RustyKnight
04-15-2008, 09:10 PM
hmm...

soo since nobody replied i guess there's no way to press a button from a script... :((Well, actually, you have any number of choices, all of which are well document in the docs and have been exampled here on the forum.

You're first choice is the most direct and looks something like this[rollout].[button].pressed()I lifted this straight from the docs, look under rollout | event handlers.

The second is a little more complicated and troublesome. But basically you'll want to look at the DialogMonitorOPS and UIAccessor functionality.

Shane

RappyBMX
04-16-2008, 02:11 PM
thanks RustyKnight, thanks for helping me :)

i tried to do that but without the () at the end :)...anyway...thanks

so know that i know that... i wan't to make the second macro :)...
what i have in my mind right now is to:
create a file that will store the last button
when I click a button it my script it will save the line that will click that button in that file :)
and the second macro will execute what is in that file :)
or i could do it kinda the same but with a little more script: same idea second file will store just the name of that button that was pressed, the macro will get that name... and i will write for every name what to do... but i think this way is alot more "harder"...
or i could save the last clicked button in the script ini :) that way i don't have to make another file :)... i'm going to try to make that second macro and i will let u know if i succeed...if not i will ask for help :)...

another thing i'm trying to make auto update for the script :)... i found a easy way on the internet(google)... here: http://www.stigatle.net/blog/?p=21
downloaded that tut...etc...
but i can't make it to work...

d = openFile "http://www.313designstudio.com/rappatools/version.dat"
id2 = readValue d -- reads the value, saves value in "id2"
close d --closes the fie

the problem is that it won't open the file on the website !!! an if you check http://www.313designstudio.com/rappatools/version.dat you will see that it works... how do i have to type the link to the files that are on the web ???

thanks in advanced

RappyBMX
04-16-2008, 03:37 PM
i made the second macro... uses the ini :)...
but ! now i have to add a line to all the buttons that i want to be used in macro2...
something like:
setIniSetting theIniFile "Macro" "last" "RappaTools.theZone.subModeling.poly.pressed()"
....works great.... Problem...yea, why not !... i have some buttons ( most of then :( ) that have some function with the ctrl pressed or shift or ctrl+shift... and my question is how can i pressed a button with shift or ctrl or both by script :) tried the help, couldn't find anything :(

RustyKnight
04-16-2008, 09:14 PM
ctrl pressed or shift or ctrl+shift... and my question is how can i pressed a button with shift or ctrl or both by script :) tried the helpI would suggest that it can't be done via maxscript as far as I know. You'd physically have to seed a "keydown" and "keyup" event into the system and maxscript simply is not made to do this. DotNet MIGHT.

d = openFile "http://www.313designstudio.com/rappatools/version.dat"
id2 = readValue d -- reads the value, saves value in "id2"
close d --closes the fie
Two things come to mind. The openFile function is most likely using an OS level "file" operation, which probably means it has no idea how to handle a http request. I had thought you might be able to use a "file://" request, but I doubt very much if that would work either, these functions simply are not meant to work with internet protocols, which is kind of a shame, cause that would lead to mean cool ideas.

If you REALLY want to read the file from the web, you'd need to look towards something like dotNet, which I'm sure would have the means to read a stream of data from an URL, but this is adding a lot more complexity then you really need.

Try downloading the file to a local location.

Shane

RappyBMX
04-16-2008, 09:30 PM
if you could point out how can i download something via maxscript would be grate :)... thanks again Shane :)

ZeBoxx2
04-16-2008, 10:47 PM
try (
(dotNetObject "System.Net.WebClient").downloadFile "http://www.313designstudio.com/rappatools/version.dat" "c:\\somedir\\somefile.ext"
)
catch (
-- some error ocurred
)

RappyBMX
04-17-2008, 12:22 PM
thanks ZeBoxx2, I'm going to try that later today :)

mir-vadim
04-17-2008, 01:39 PM
Hi Rappy :)
Actually You dont need to download file, you can use dotNet to read files remotely.

try (
(dotNetObject "System.Net.WebClient").downloadString "http://www.mirvadim.com/file.txt") catch ()
try to evaluate this code.

Also You dont need to reboot max after script was updated.
First of all You should close (destroydialog) script if it is open, then use this
filein "C:\somescript.mse"
and after that launch it again.

And thanks for this thread, it is nice idea to make automatic update system for scripts.
I have seen this thread few hours ago and for that moment already implemented this system into next RayFire Tool version. ;)

Good luck.

RappyBMX
04-17-2008, 07:31 PM
nice to hear that mir-vadim...

i finished the autoupdate for my script :)

here's the script http://313designstudio.com/rappatools/RappaTools.mzp ... maxscript > run the mzp and install it :)

RappyBMX
05-26-2008, 07:32 PM
back !
got one question...:
how to do a loop preview script ?
what i want it to do is if i enable loop preview then when i select and edge,2verts,2poly's it will loop the edge.. but ! it won't add the edges that wore loop to the selection, it will highlight them so u can see the loop, and if u want u can spin the edge....so how can i do that ? a callback when u change the selection, a function that will verifi the selection if correct then loop but how do i make the edges highlighted and not selected ?


thanks in advanced,
Juncu 'RappyBMX' Remus

RappyBMX
05-30-2008, 11:26 AM
no one... loop preview ???

RappyBMX
07-16-2008, 10:03 AM
hi, it's me again :|...

1. How can i set the script error to be silent. i mean when an error happens don't display it and don't crash the script so the user has to reaload the script ?

2. How can i find the allgorithm that has been used to get from this 574470992 to 140547561 or something like that ?

3. How can i connect to mysql database stored on my web server, then check if it has the the current hardwarelockid if not stop the script... and how to add to the database a hardwarelockid and a username for it... so if the hardwarelockid is added to the database with a user name it will say Hi (username) when u open the script :) (i checked the thread that's here about mysql but the script's that have been posted there don't work :( )

that's all for the moment, thanks in advanced,
Remus 'RappyBMX' Juncu

RustyKnight
07-16-2008, 11:43 AM
1. How can i set the script error to be silent. i mean when an error happens don't display it and don't crash the script so the user has to reaload the script ?Look up try expression in the help docs, this is actually a common concept in most programming languages...
2. How can i find the allgorithm that has been used to get from this 574470992 to 140547561 or something like that ?Are you talking about hashing?? Cause otherwise I have no idea what you are talking about. If you are talking about hashing, in most cases they are one way, so you can not reverse the process, good for encryption...

.net probably provides some kind of hashing algorithm...
3. How can i connect to mysql database stored on my web server, then check if it has the the current hardwarelockid if not stop the script... and how to add to the database a hardwarelockid and a username for it... so if the hardwarelockid is added to the database with a user name it will say Hi (username) when u open the script :) (i checked the thread that's here about mysql but the script's that have been posted there don't work :( )
This is a complex question. How good is your SQL?? Are you intending to use .net, a plugin, python or some other COM solution to access the database??

Connecting to the database is easy enough, look up the connection settings for the particular method of choice...

You can get the user name via the System Information interface, but that will only tell you who is logged in. You are better off getting the user name when you register the hardware id and reporting that information back...but that's me...

Be warned, many people have firewalls and strict access controls on there systems and generally do not like having applications or code access the outside world (especially when they are paying for the connection). If you want to protect you scripts you could look into using usb dongles instead, espically if you are providing multiple user licenses, much less intrusive...

Shane

JHN
09-01-2008, 08:41 AM
RappyBMX, I have a question about your tools, why are all of them encrypted, you state u have used scripts from others in your tool, which where probably freely available... I always wonder about the motivation to encrypt, especially when it's released as freeware, you could easily release under some GNU or MIT license...

Others will benefit from the free access to the source, that's how I learn my mxs, and most other too I think.

Don't get me wrong, it's your script, but I still wonder why the encryption...

-Johan

RappyBMX
09-01-2008, 10:34 AM
Well since the script's that i used are free other people can get them and do the same thing ! I'm not a script-er I just do this for fun and to make my 3ds max work with me the way I want it to, first i wanted to make this script just for me and some of my friends + the people that I chat with on yahoo messenger but after that I decided to make it available for other people... until now i just got two feedback's about the script since I made it public !!! so what's the point in making the source available... nobody asked me nothing about the source of the script guess they don't need it... so that's why i will keep it encrypted...

----
Remus 'RappyBMX' Juncu

LoneRobot
09-01-2008, 10:56 AM
until now i just got two feedback's about the script since I made it public !!! so what's the point in making the source available... nobody asked me nothing about the source of the script guess they don't need it... so that's why i will keep it encrypted...



awww, i feel all warm and fuzzy inside after reading that...:scream:

JHN
09-01-2008, 11:50 AM
Ok, thanks for answering my question.

RappyBMX
11-23-2008, 11:52 AM
new version (beta) + new website !!!... http://313designstudio.com/rappatools/

eek
11-23-2008, 03:34 PM
awww, i feel all warm and fuzzy inside after reading that...:scream:

Just in time for the christmas spirit too! :rolleyes:

Rappy,

The reason you don't encrypt your scripts is predominantly to support the community - you've been asking for all this help on this thread, and people are going out of the way to help you - With nothing in return. As the saying goes: "biting the hand that feeds you"

RappyBMX
11-23-2008, 05:34 PM
The reason you don't encrypt your scripts is predominantly to support the community - you've been asking for all this help on this thread, and people are going out of the way to help you - With nothing in return. As the saying goes: "biting the hand that feeds you"

eek,

Well kinda true, but what about the people that ask help here to make scripts that eventually they will sell it ? ain't that worst ?

here's RappaTools v313.14 source code...
http://313designstudio.com/rappatools/RappaTools-313.14-source.rar

Happy :) ?

Best,
Remus 'RappyBMX'

eek
11-24-2008, 01:27 AM
eek,

Well kinda true, but what about the people that ask help here to make scripts that eventually they will sell it ? ain't that worst ?


Hmm.. Im not sure. Most of the time they put only very small snippets and part of there frameworks is c++ or c# like a plugin for example. Also they tend to offer some sort remuneration to the people that helped them out firstly - and second if they do sell there script most of the time theres no encryption whatsoever.

Im not saying its good or bad - but its just the stance you come from. If your asking for a lot of help on a thread, such as this one then out of gratitude you should allow other technically minded people to look at your work and improve on it. You yourself said some of it was'nt that good. Most of the scripts ive seen arent encrypted in any form.

In the end its horses for courses. P.s most licenced code bases offer an eula on the use of the code base provided. If is allowed to be modified, altered etc etc - look at python for example.

redwatty
12-11-2008, 03:32 PM
hey man, thanx for releasing the source code for this, its a great help :)

RappyBMX
12-20-2008, 07:05 PM
is there a callback for materials ?... when a material name is changed ???

----

by the way new version of rappatools :) v313.151 beta
http://313designstudio.com/rappatools/

ZeBoxx2
12-21-2008, 12:48 AM
is there a callback for materials ?... when a material name is changed ???
no callback, but there is a changeHandler.

when name meditmaterials[1] changes id:#test do ( print meditmaterials[1].name )
After running that, play with changing the name of the material/map in medit slot 1; it will print the new name with each character change.

You do have to set this up for any material in advance.. if you need to do this for newly created materials, then you can use the #mtlRefAdded Callback to get a reference to that material so you can set a change handler up for it.

It is more efficient to feed a change handler a collection (array) of elements, so destroying the one you have and setting it up with any new material(s) added is better than setting up a bunch of separate ones.

RobGalanakis
12-21-2008, 01:30 AM
awww, i feel all warm and fuzzy inside after reading that...:scream:

I wish he had never un-encrypted his script. I looked at the source and found this:

WARNING: If you have inexperienced coders with you, they should leave the room. Mentor discretion is advised.

global is

Oh, the humanity!

RappyBMX
12-21-2008, 09:43 AM
I wish he had never un-encrypted his script. I looked at the source and found this:

WARNING: If you have inexperienced coders with you, they should leave the room. Mentor discretion is advised.

global is

Oh, the humanity!

:shrug:

----

hey ZeBoxx2 well what i wanted to do is to automatically update the names of the materials. like i did for the cam & light dropdown menus.


if ( i == 3 ) then --reload drop down menu
(
sceneMat = for i = 1 to meditmaterials.count collect i
sceneMatNames = meditthing + (for o in meditmaterials collect o.name)

RappaTools.theZone.subModeling.ddl_meditmat.items = sceneMatNames
)


http://scriptspot.com/files/change01.jpg

ZeBoxx2
12-21-2008, 10:44 AM
the changeHandler is your best bet, then - short of setting up a timer that calls a function which loops over all the materials %)

RappyBMX
02-10-2009, 05:03 PM
here's something that i can't figure out !


on mi_quadmenu picked do
(
if menuMan.registerMenuContext 0x313fff15 then
(
menuMan.createQuadMenu "RappaTools" "RappaTools" "extra" "selection" "modeling"
local quadmenu = menuMan.findQuadMenu "RappaTools"
menuMan.setViewportRightClickMenu #shiftAndControlPressed quadmenu

-- Get the default viewport right-click quad menu
--local quadMenu = menuMan.getViewportRightClickMenu #shiftAndControlPressed

menuMan.setShowAllQuads quadMenu true

-- Get the lower-left menu from the quad
local menu0 = quadMenu.getMenu 1
--menu0.setTitle "RappaTools"
local menu1 = quadMenu.getMenu 2
--menu1.setTitle "extra"
local menu2 = quadMenu.getMenu 3
--menu2.setTitle "selection"
local menu3 = quadMenu.getMenu 4
--menu3.setTitle "modeling"

-- create a menu item that calls the sample macroScript
local item_sep = menuMan.createSeparatorItem()

-- RAPPATOOLS
local item_0_1 = menuMan.createActionItem "RappaTools" "313DesignStudio"
.
.
.
-- EXTRA
local item_1_1 = menuMan.createActionItem "MePoly" "RappaTools"
.
.
.
-- SELECTION
local item_2_1 = menuMan.createActionItem "Ring" "RappaTools"
local item_2_2 = menuMan.createActionItem "loop" "RappaTools"
.
.
.
-- MODELING
local item_3_1 = menuMan.createActionItem "RConn" "RappaTools"
.
.
.

-- Add the item to the menu
-- RAPPATOOLS
menu0.addItem item_0_1 -1
.
.
.
-- EXTRA
menu1.addItem item_1_1 -1
.
.
.
-- SELECTION
menu2.addItem item_2_1 -1
.
.
.
-- MODELING
menu3.addItem item_3_1 -1
.
.
.
)
else
(
quadmenu = menuMan.findQuadMenu "RappaTools"
if quadmenu != undefined do
(
menuMan.setViewportRightClickMenu #shiftAndControlPressed quadmenu
menuMan.setShowAllQuads quadMenu true
)
)
)


here's the code when u remove rappatools


if menuMan.registerMenuContext 0x31300015 then
(
menuMan.createQuadMenu "empty" "" "" "" ""
quadmenu = menuMan.findQuadMenu "empty"
if (quadmenu != undefined) then
(
quadmenu.trackmenu true
menuman.setViewportRightClickMenu #shiftAndControlPressed quadmenu
)
)
else
(
quadmenu = menuMan.findQuadMenu "empty"
if (quadmenu != undefined) then
(
quadmenu.trackmenu true
menuman.setViewportRightClickMenu #shiftAndControlPressed quadmenu
)
)


it works, temporarily , any suggestions to make it work better or the way it should ? first of all the remove script needs to be changed but i cant find another way to remove rappatools quad... and for the people that already have customized the #shiftAndControlPressed quad ?

RappyBMX
02-18-2009, 01:13 PM
anyone ?

at least how can i remove the rappatools quad menu right ? not by creating and empty one...

Insanto
02-18-2009, 05:42 PM
i don't know about you but i like to not have to keep the mZip file and have an uninstall.exe
i use InnoSetup to create a setup for my scripts.. verry quick and simple and you can uninstall them howEver you want and without the sourcefile

for the quats.. no idea :shrug:

RappyBMX
02-18-2009, 05:56 PM
i could just add a remove script or button, and i think i will :)... but still, the quad problem remains :|

RappyBMX
08-29-2009, 02:23 PM
fixed the quad problem... but i got a question...

what's the difference between a mapped function and a normal one ? i looked in the help menu but i don't get it :|

denisT
08-29-2009, 03:39 PM
fixed the quad problem... but i got a question...

what's the difference between a mapped function and a normal one ? i looked in the help menu but i don't get it :|



From MXS Help... Creating Functions

Using the mapped prefix on a function definition marks this function to be automatically mapped over collections. This means the function will be automatically called repeatedly on the elements of a collection if the collection is given as the first argument to the function. This allows you to define scripted functions that behave in a similar manner to the mapped built-in functions, such as copy, delete, move, and so on, which can be applied to an object set, path name pattern, or array. See Collections (http://forums.cgsociety.org/Collections.htm) for more information.


(
mapped fn collectPosition obj &positions = append positions #(obj.name, obj.pos)
infos = #()
nodes = for k=1 to 10 collect (box pos:(random [-10,-10,0] [10,10,0]))
collectPosition nodes infos
delete nodes
format "%\n" infos
)

LoneRobot
08-29-2009, 04:59 PM
i posted a brief note on my blog about this too -

http://lonerobot.net/?p=179

RappyBMX
08-29-2009, 06:19 PM
denisT like i said i looked in help... but i did not get the point of mapped function... i asked for an explanation/example... you just copied the help...
----
LoneRobot thanks for the link... now i get the mapped thingy...

denisT
08-29-2009, 07:36 PM
I gave you a sample.

denisT
08-29-2009, 08:06 PM
[QUOTE=RappyBMX]denisT like i said i looked in help... but i did not get the point of mapped function... i asked for an explanation/example... you just copied the help...
QUOTE]

Here is another sample to show difference between mapped and not mapped functions:

mapped fn formatValue1 val = format "%\n" val
fn formatValue2 val = format "%\n" val

formatValue1 #(1,2,3)
formatValue2 #(1,2,3)

Piflik
08-29-2009, 08:07 PM
The Help does exactly tell what a Mapped Function is:
You can apply Mapped Functions to Object sets (eg 'move $Box*' would move every object with the name Box...), whereas standart functions have to be called for every object in a set seperately (eg 'get TMController $Box*' would not work. You'd have to say 'for o in $Box* do getTMController o').

denisT
08-29-2009, 08:12 PM
The Help does exactly tell what a Mapped Function is:
You can apply Mapped Functions to Object sets (eg 'move $Box*' would move every object with the name Box...), whereas standart functions have to be called for every object in a set seperately (eg 'get TMController $Box*' would not work. You'd have to say 'for o in $Box* do getTMController o').

mapped function works not only for nodes collection. it works for any collection (or array) of any type of elements:

mapped fn formatClassof1 val = format "%: %\n" val (classof val)
fn formatClassof2 val = format "%: %\n" val (classof val)
formatClassof1 #("test",float,3)
formatClassof2 #("test",float,3)

RappyBMX
08-29-2009, 08:19 PM
denisT that's what i was looking for an example like that... thanks.
Piflik thanks for the explanation.
----
got something else... in 3ds max 2010... macroscript stupid error...

macroScript CSlide
category:"RappaTools"
buttonText:"CSlide"
--tooltip:"Connect, Slide. ctrl: Connect, Slide, Push."
(
on isVisible do (try( (RappaTools.open)and( RappaTools.theZone.subModeling.btn_connectslidepush.enabled) )Catch() )
on isEnabled do (try( (RappaTools.open)and( RappaTools.theZone.subModeling.btn_connectslidepush.enabled) )Catch() )

on execute do
(
try
(
if ( ( RappaTools.open ) and ( RappaTools.theZone.subModeling.btn_connectslidepush.enabled ) ) then
(
RappaTools.theZone.subModeling.btn_connectslidepush.pressed()
)
)
Catch()
)
)

for example the macroscript above (from rappatools) when i install rappatools the macroscript works... but after i close 3ds max 2010 then open it again the macro script won't work... if i open the macroscript and evaluate it, the macroscript starts to work... but after i close then open max same thing it won't work :| weird... why ? only in max 2010 !

MarcoBrunetta
08-29-2009, 09:02 PM
Sound like a variable definition error, you should comment out the TRY CATCH to find exactly where the problem is, my guess is that the variable RappaTools or some of it's properties are not defined.

RappyBMX
08-29-2009, 09:14 PM
the problem it's here

if ( ( RappaTools.open ) and ( RappaTools.theZone.subModeling.btn_connectslidepus h.enabled ) ) then


says that RappaTools.open it's not defined... but if i type RappaTools.open in the listener or evaluate that... i get true like i should... but the macro won't see it...only if i evaluate the macro :|

MarcoBrunetta
08-29-2009, 09:17 PM
Yup, clearly a variable scope problem, it's hard to diagnose without the full code, but basically you have to make sure that RappaTools is defined as a global variable before anything else runs, or that it's visible to the macro.

RappyBMX
08-29-2009, 09:32 PM
--xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx--
-- START RAPPATOOLS
--xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx--

(
starTime = timeStamp()

--------------------
global RappaTools, theZone, subColors, subRender, subViewPort, subModeling, subFly, subShakeCam, subObjVibrator, subSnowMaker, subInfo
global RappaToolsSpinner, RappaToolsExtra, RappaToolsSetPos, RappaToolsColorsS, RappaToolsColorsL --thePose
--------------------
global rappa_fn, rappa_btn, infoMessage, PolyTools_Slide, Polytools_Push, disTool, roNotify, selElem -- is, savecolorsfn, loadcolorsfn, loadColorsList, deleteColorsList
global lightthing, camthing, meditthing
--, sceneCam, sceneCamNames, sceneLight, sceneLightNames, sceneMat, sceneMatNames
--------------------
global commandWidth = 225
--slf = 0, scf = 0, polycolor = (getuicolor 8)*255, polytext1, polytext2,


this is the beginning of the script :)... pretty sure that everything it's global !

if you have 3ds max 2010 you could try getting rappatools (i've released v1.6 today... yesterday since now it's 12:30AM) and see if you have the same problem :)

JHN
08-30-2009, 08:08 AM
So many globals, that's asking for problems...
You should try make 1 global rappatools struct and reference your other variables from there.
Or prefix every global var with a "rappatools_" prefix.
Variables like "infoMessage" are so generic, it's waiting for another tool to overwrite that.

My 2 cents,
-Johan

RappyBMX
08-30-2009, 06:25 PM
Johan well i started rewriting rappatools again... i think it's the 6'th time :)... now i have only one global or 2... i got rid of the subRollout's and i'm going to brake it in 2... but now i have to do test's over test's to make sure that that everything works again... plus i have to change a few thing since there are no more subRollout's... anyway...

i got another question (since the quad problem might get fixed after i finish the change) i was thinking of using .xml file instead of .ini to store settings and stuff like that... if it's faster or better how to use the xml ? like write to an xml file and read...

MarcoBrunetta
08-30-2009, 06:29 PM
Well, if you are only storing preferences and stuff like that, I would say stay with the INI. While you could use XML, I don't think it's worth the hassle. The beauty of XML is that it's well standardized, so it can be used to share with other applications for instance, but that's not really something you need.

As for the speed, unless you are writing massive amounts of data I doubt you'll notice any significant difference.

RappyBMX
08-30-2009, 09:07 PM
is it possible to have modify panel (from command panel) in a script rollout? i mean just the modifiers list and the subRollout bellow it !?

CGTalk Moderation
08-30-2009, 09:07 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.