ScriptSpot home

Forum topic · General Scripting

dotnet btns to max menu

By artrender · 2013-06-03

Downloads
Description

srry for "HARD" questions :)

Is it possible?

Comments (42)
artrender

I have Updated the information there, I've added max file and script!

Reply to artrender
Branko Živković

And discussion back when we start :)

Here is the solution. Enjoy!


try(destroyDialog ::bgaRoll)catch()
rollout bgaRoll "• • •"
(
	fn filtGroup o = isGroupMember o or isGroupHead o
	fn getRootGroupHead node = if isgroupmember node do
	(
		while node != undefined and (not isgrouphead node or isgroupmember node) do (node = node.parent)
		node
	)
	pickbutton pick "PickGroup" pos:[5,5] width:100 height:20 filter:filtGroup
	on pick picked obj do if obj != undefined and selection.count !=0 do
	(
		local rootGroup = getRootGroupHead obj
		InstanceMgr.GetInstances rootGroup &groups
		selObjs = getCurrentSelection()
		if groups.count > 1 then 
		(
			with redraw off 
			(
				for i = 1 to groups.count where groups[i] != rootGroup do
				(
					maxOps.cloneNodes selObjs cloneType:#instance newNodes:&objs
					for o in objs do
					(
						if o.parent != undefined do o.parent = undefined
						tm = o.transform * (inverse rootGroup.transform)
						o.transform = tm*groups[i].transform
						attachNodesToGroup o groups[i]
					)
				)
				attachNodesToGroup selObjs rootGroup
			)
		)
	)

)
createDialog bgaRoll 110 30 10 110 style:#(#style_titlebar, #style_sysmenu, #style_toolwindow)

help to create rollout button...

barigazy you who are expert in scripts help me, how to create the rollout buttons, which contain other scripts or icons inside, and can save space in my icon bar,

like in the image

https://ibb.co/mUaUAA

I hope you understand me I speak Spanish

artrender

thx, Barigazy!

But I still have a problem with adding objects to all group instances, when groups are transformed! You remember, I've sent it to you before, to your email! I like - group manager - sounds easy and close to what it does!

Reply to artrender
Branko Živković

Your problem can be solved if you provide an *.max example and code which cause error. Don't forget screenshoot also to see exactly what do you want to achive. Post it here or open new thread if you want and we will continue discussion. Ok?

artrender

hm

no, I'm talking from another computer here! :)

Reply to artrender
Branko Živković

When do you plan to post your finished tool here on scriptspot?
Awesome idea for new script will be "GroupManager" (like LayerManager) using .net treelis. Just thinking out loud :)Do you dare to accept the challenge?

;)

artrender

Barigazy, I've answered at cgsociety!

you can take a look! Thank you!

artrender

thx, Barigazy

it works fine and smooth! And thx for the code! If I find words to express happiness, then I will add them to the dictionary!

Branko Živković

Ok. Times up. Author will recive *.ms like I promised. Maybe next time will discuss about this types of forms and interesting funcionality of its controls ei objects. Be free to open new thread and we will talk there.

artrender

barigazy!

I think it's better to post your solution with a printscreen in Cgtalk! I'm sure there will be people that want to hear your ideas!

Reply to artrender
Branko Živković

:)

Of course it would be. But this forum need some attention too. Members on CGTalk (like me) already knows everything about .net basics.

artrender

people

display here your interest, pleaaaase!

artrender

Oh, barigazy!

You're a great person! By the way, I've just seen some errors in my icons when dark bg, I need to correct them (shame for me :)

artrender

ok

then I'm the first (or second?!!! :)))! haha! Interesting! Very good idea to scale the window!

Reply to artrender
Branko Živković

Yup. You are second. One more. Is not only about scaling you will see there is more interesting stuff. I can show code right now but this is not interesting. You will get original *.ms to put the rest of buttons functions to finish the tool.

Branko Živković

solution

Anyway I'm not fan of max docking system. So I try something here which can be very useful for tools that need to stay open all the time and use minimal space of working area. So if anyone interested how to make this kind of .net GUI (look attachment) please let me know. If minimum 3 people post comment here I will open new thread and explain step by step creation process. So up to you guys.

Attachments

Don't wayt the people to post commnets. Thay maybe not read this thread. I am sure that this GUI can be done with pure maxscript(almost the same - borderless rollout, imgtag-s for small buttons, and the Icons can be generated in the script(light and radk scheme), and maybe one dotnet label for the tool name), but it is a good idea to show the dotnet solution.
:)

Reply to miauu
Branko Živković

Hey Kostadin,
this is the pure .net solution. It will be good example for anyone who want to learn or start to learning mxs+.net. This forum not have many examples about this topics. My code is not perfect but if the other members are involved then we can always create better tool.

Reply to Branko Živković
Raymond Homme Ingebretsen

Interesting stuff barigazy, i'm not into .net stuff, but i love the GUI you did here :)

artrender

wow

so many files there! Very confusing where is the part which deals with gui, I mean a simple form where you have to put your code in order for it to work!

Reply to artrender
miauu

You can read all files, they are not encrypted. But, the author of the Outliner uses custom controls(in outliner.dll file), so you can't create them with pure maxscript.

artrender

I still

couldn't find any piece of information about outliner! please, show us an example!!!

miauu

Outliner is a beter Layer manager for 3ds max and much much more. Nested layers, hierarchy mode, material mode.... just try it. For max2014 you have to modify the startup file, because max2014 can't dock rollouts with dotnet controls in it. I montoined the Oitliner, because it have dotnet controls and you can install it on max2014, but without the modification of the startup script of Outliner you can't run max2014. The problem is the reason of this thread. :)

Reply to miauu
Branko Živković

When Autodesk published max2k14 I was just wondering what is the new about MXS and .NET. This is the great news, I'm happy now :(.
Even some of AD developers use Outliner in their workflow. First "Active Type" [X] and now Outliner. What's next?

artrender

I was talking about

Outliner! I still didn't understand what is it! Can it be used somehow instead of rollout, or I missunderstood this? About max, I agree, and only about max - all thigs in this world become worse. And even the quality of people! It's good that in this forum there are good people :) - I HOPE!!!

artrender

and now

can you talk more about that please?

Reply to artrender
Branko Živković

Talk about what? We can talk more then week about max2k14 new "features" ei.bugs. :)

miauu

Yep, MAx2014 can't dosk

Yep, MAx2014 can't dock/undock rollouts with dotnet controls. Crash every time. You can try with Outliner.

Reply to miauu
Branko Živković

whether the outliner works? I did not try jet.

artrender

wow, it's working!


dotNet.loadAssembly @"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\v3.0\WindowsFormsIntegration.dll"

rollout wpfRefresh_RLT "" width:70 height:220
(
	dotNetControl eh "Integration.ElementHost" width:70 height:500 align:#left offset:[-14,-5]
	local doRefresh = true
	on wpfRefresh_RLT open do
	(
		uc = dotNetObject "System.Windows.Controls.UserControl"
		eh.child = uc
		sp = dotNetObject "System.Windows.Controls.StackPanel"
		for i = 1 to 10 do
		(
			btn = dotNetObject "System.Windows.Controls.Button"
			btn.height = 20
			btn.content = "button " + i as string
			sp.children.add btn
		)
		uc.content = sp
	)
	-- refresh the elementHost whenever it's "Paint" event is triggered
	on eh Paint args do
	(
		if doRefresh then
		(
			doRefresh = false
			eh.refresh()
			doRefresh = true
		)
	)
)
createDialog wpfRefresh_RLT style:#(#style_toolwindow,#style_sysmenu,#style_resizing)
cui.RegisterDialogBar wpfRefresh_RLT style:#(#cui_floatable,#cui_dock_left,#cui_handles  )
cui.DockDialogBar wpfRefresh_RLT #cui_dock_left

it can be placed on the left or right! It's already a good begining! I don't just know how to place it on top menu like in my picture! If it's difficult I can refuse from this idea!

Reply to artrender
Branko Živković

Max2014 crash when you try this. Also try to undock now if you can :)
to dock on the top

cui.DockDialogBar wpfRefresh_RLT #cui_dock_top

artrender

with

a single tool, I mean that whenever you want you can get them back from max menu, and they will remain connected! Some may prefer to put it vertically on the right or left hand!

artrender

this is

a rollout with net buttons! In fact I can make them apart, for everyone a script apart because I need anyway hotkeys, however, If it is possible to keep them like a single tool, all together, to be able to assign hotkeys for every button and be able to apply it to the maxmenu, it would be the best option :)))

Branko Živković

Are theses macro buttons or you have rollout with mxs butons or .net buttons?