Changing value of WPF property

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

THREAD CLOSED
 
Thread Tools Display Modes
  02 February 2011
Changing value of WPF property

Hello!

So I've been playing around a bit with 3dsMax ui lately, and I've been trying to "Hide/Show Menu Bar" through maxscript.
As you may know it's not exposed to maxscript at all.
But I found this utility called "Snoop" that basically allows you to spy on WPF forms. I found the variable that shows/hides the menu bar.

Now I "just" need to be able to change that value through maxscript instead of "Snoop". And since I have no idea how to go on from here, I'm just throwing it out there, maybe someone knows how to proceed from here...


Cheers,
Norman
Attached Images
File Type: jpg show_menu_bar.jpg (93.0 KB, 86 views)
 
  02 February 2011
Here is a little something I found...

http://through-the-interface.typepa...-using-net.html

It's also using "Autodesk.Windows.ToolBars.QuickAccessToolBarSource "
 
  02 February 2011
So I did some progress here...
Alex Krammer's "Show .Net Property" tool actually can access "Autodesk.Windows.ToolBars.QuickAccessToolBarSource ".
(See screenshot)

But I'm still unable to change the property. Does anyone know why?


QAT_Toolbar = dotNetObject "Autodesk.Windows.ToolBars.QuickAccessToolBarSource  "
QAT_Toolbar.IsMenuBarVisible = false
Attached Images
File Type: jpg show_menu_bar_2.jpg (85.1 KB, 57 views)
 
  02 February 2011
Don't create a new toolbar, use the component manager singleton to fetch the existing one:

qatbar = (dotnetclass "Autodesk.Windows.ComponentManager").QuickAccessToolBar

qatbar.IsVisible = false
qatbar.IsMenuBarVisible = false

qatbar.IsVisible = true
qatbar.IsMenuBarVisible = true


.biddle
 
  02 February 2011
So I'm just going to leave this here, in case anyone is interested. It should get rid of the InfoCenter and the QuickAccessToolbar.

ComponentManager = (dotnetclass "Autodesk.Windows.ComponentManager")

ComponentManager.QuickAccessToolBar.IsVisible = false
ComponentManager.InfoCenterToolBar.MaxWidth = 0
ComponentManager.InfoCenterToolBar.MinWidth = 0


Thanks again biddle!

Edit: It looks so much better now...


Last edited by Norman3D : 02 February 2011 at 02:21 AM.
 
  02 February 2011
Just a quick question its a bit off topic where do you find

Autodesk.Windows etc... Assembly i dont see it in the SDK :(
__________________
My TechBlog
 
  02 February 2011
great stuff!
thank you for permanently killing the stupid info center for me!
 
  02 February 2011
Originally Posted by listener: Just a quick question its a bit off topic where do you find

Autodesk.Windows etc... Assembly i dont see it in the SDK :(


It isn't documented but you can use reflection to ferret out what you need.

I typically rely on the Object Browser that comes with Visual Studio to pull in assembly files and snoop around for things that look interesting, but you can discover a lot with 3dsmax alone.

The following snippet will dump all the exported types found in the assemblies located in your max root folder.

for dllname in getfiles ((getdir #maxroot)+"*.dll") do
(
	try (
		asm = dotnet.LoadAssembly dllname
		format "\n-------------------------------------------\n"
		format "[%] exports:\n" dllname
		for etype in (asm.GetExportedTypes()) do
		(
			format "%\n" etype.FullName
		)
	)
	catch ()
)


The "Autodesk" namespace contains code that looks to be shared with (or derived from) the stuff that is in AutoCAD. Perhaps you can look there for enlightenment? link

I tried poking around adding buttons to the quick access bar & such, but it seemed kind of klunky.

.biddle
 
  02 February 2011
Thank you... it helped me alot. Im now looking into assemblies, could you possibly post example how you add buttons to toolbar because i made few examples since but just cant run them in max.
__________________
My TechBlog
 
  02 February 2011
Actually there is another undocumented method of adding items to the QAT toolbar:

fn QATaddItem MacroScriptName Category =
(

	maintoolbar_file = pathConfig.removePathLeaf((symbolicPaths.getPathVa  lue "$userscripts")) + "\\ui\\MaxStartUI.cui"

	--First save our current CUI file as the MaxStartUI.cui
	deleteFile maintoolbar_file
	cui.saveConfigAs maintoolbar_file

	--Read Current Item count
	QATItemCount = getINISetting maintoolbar_file "QATItems" "QATItemCount"

	--Set value
	setINISetting maintoolbar_file "QATItems" ("Item" + QATItemCount) ("647397|" + MacroScriptName + "`" + Category)

	--Reload cui file
	cui.loadConfig maintoolbar_file
)
 
  02 February 2011
Ok finally did it
Quote: Autodesk.Windows.ToolBars.QuickAccessToolBarSource strip = ComponentManager.QuickAccessToolBar;
if (strip != null)
{
RibbonButton rb = new RibbonButton();
rb.Text = "test";
strip.AddStandardItem(rb);
rb.Description = "Desc";
rb.Image = GetIcon(theImage);
}


This adds button to quick launch bar.


EDIT: Managed to add new WPF panel like graphite modeling tools it works really awesome, still trying to add button to main max menu, i add item to menu i see empty space but it does not show icon or text but still working on it.
__________________
My TechBlog

Last edited by listener : 02 February 2011 at 03:58 PM.
 
  02 February 2011
We might be going a bit offtopic here but, I just realized what a mess the whole QAT is...

There seem to be multiple ways of adding/removing stuff from the toolbar.

You can add/remove items from the Customize window or directly by changing the cui file and reloading. (or simply use qat.add)

But, you can also add items through the ribbon interface, right clicking items and clicking on "Add to QAT". (You can also add separators by rightclicking in the QAT.)
But, NONE of the items added through the ribbon interface will be saved in the cui file, so they will not show up next time you run 3dsMax. So it's... completly useless for the user?

Either you add items through the old Customize window, but you won't be able to add all the items you want, and you won't be able to change icons and other things.
Or... you add items through the ribbon interface, but they will be gone next time you start 3dsmax!

Last edited by Norman3D : 02 February 2011 at 07:45 PM.
 
  02 February 2011
Originally Posted by Norman3D: We might be going a bit offtopic here but, I just realized what a mess the whole QAT is...

There seem to be multiple ways of adding/removing stuff from the toolbar.

You can add/remove items from the Customize window or directly by changing the cui file and reloading. (or simply use qat.add)

But, you can also add items through the ribbon interface, right clicking items and clicking on "Add to QAT". (You can also add separators by rightclicking in the QAT.)
But, NONE of the items added through the ribbon interface will be saved in the cui file, so they will not show up next time you run 3dsMax. So it's... completly useless for the user?

Either you add items through the old Customize window, but you won't be able to add all the items you want, and you won't be able to change icons and other things.
Or... you add items through the ribbon interface, but they will be gone next time you start 3dsmax!


What about a startup script? i did it with your snipplet to remove the call center stuff, it's in my stdscripts folder and works great.
The whole max custom UI stuff is very unreliable anyway, the ribbon gets easily corrupted. It makes no sense for the user to customize it, because changes are not portable (all or nothing), and if it corrupts you have to start again.
 
  02 February 2011
Yep, I realized that as well. It is really slow as well... just switching between subselections in editable poly, takes away 1s to 2s

A startup script that repopulates the QAT could be possible... but I'm wondering why would Autodesk give you the option to customize the QAT, if you can't save the changes?
 
Thread Closed share thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
CGSociety
Society of Digital Artists
www.cgsociety.org

Powered by vBulletin
Copyright ©2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump
Miscellaneous

All times are GMT. The time now is 12:51 PM.


Powered by vBulletin
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.