[Closed] Maxscripting the Graphite Module
MaxRibbonControl has only one simple constructor. Looks like the control can’t be added to any .NET control without c#ing. I couldn’t find a way. But the creating of MaxRibbonControl(s) is not my goal. Honestly I don’t like Ribbon. I want to get access to its resources, elements.
in fact, I think it’s the right pointer because if you send close to it , it close the ribbon not the docking frame , I think it something else that prevent acess , what do you think ?
edit : how do you know that it’s not the ribbon, it seam like the ribbon to me !!
shoddy… ???
ho, and I wonder if it have something to do but there’s another docking panel hided below the big green button it it’s called Graphite modeling tools (vertical) …
>why they did not create it on the fly like any other panel … maybe it need to be there because they can’t recreate the ribbon once max is started ??
>ok, you where right , that was not the ribbon:banghead:
after I played with this ribbon a bit more , I’m able to tell you more about it :
1:your not going to find your pointer from maxscript , unless autodesk put a nice function to do so!
2:we can create the ribbon from maxscript 😮
I’m still not sure how all of this is working, I’ve got some trouble finding how to add the button , that’s the first time I play with wpf stuff …here what I got so far…
(
--dotnet.loadassembly "$Max\\bin\assemblies\\MaxWpfContent.dll"
--dotnet.loadassembly "$Max\\AdWindows.dll"
--//--
FloatingFrame=dotnetobject "Autodesk.Internal.Windows.FloatingFrame"
RibbonPanelControl=dotnetobject "Autodesk.Private.Windows.RibbonPanelControl"
RibbonPanel=dotnetobject "Autodesk.Windows.RibbonPanel"
RibbonPanelSource=dotnetobject "Autodesk.Windows.RibbonPanelSource"
RibbonButton=dotnetobject "Autodesk.Windows.RibbonButton"
--//--
RibbonPanelSource.Title="MarTroYx Ribbon Test"
--//--
FloatingFrame.Content=RibbonPanelControl
RibbonPanelControl.Panel=RibbonPanel
RibbonPanel.Source=RibbonPanelSource
--//--
FloatingFrame.topmost=true
FloatingFrame.Show()
)
fell free to correct me if I’m wrong of course !
Martin
maybe a bit late but that’s the max ribbon object…
ComponentManager=dotnetclass "Autodesk.Windows.ComponentManager"
MaxRibbon=ComponentManager.Ribbon
seam to lose ref to the current one if we create new one, so you may need to restart :).
regard,
Martin
I assume you’re doing that on 64bit , cause this code and the one you posted earlier (post 28) doesn’t work on 32 bit
the code in your earlier post gives me the glorious message
-- Runtime error: dotNet runtime exception: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
the same thing occured in my attempts to instanciate a wpf window or any framework 3 object in 32bit max !
Well this is all looking hopeful, I’m not sure what I would want to do with it yet but it is always good to know what can be done.
Thanks guys for doing this leg work, I just don’t have time for this sort of thing these days.
Hi cyfer,
Ho well, yes I didn’t tested it under 32bit that’s true
so , I think I found the solution …you simply need to collect the garbage
(
ComponentManager=dotnetclass "Autodesk.Windows.ComponentManager"
ComponentManager.Ribbon.Tabs.Clear()
--//--
Mx_Tab=dotnetobject "Autodesk.Windows.RibbonTab"
Mx_Tab.Title="Test Martin"
--//--
Mx_Panel=dotnetobject "Autodesk.Windows.RibbonPanel"
--//--
RibbonPanelSource=dotnetobject "Autodesk.Windows.RibbonPanelSource"
--//--
Mx_Button1=dotnetobject "Autodesk.Windows.RibbonButton"
Mx_Button1.Text="1"
Mx_Button1.showtext=true
--//--
Mx_Button2=dotnetobject "Autodesk.Windows.RibbonButton"
Mx_Button2.Text="2"
Mx_Button2.showtext=true
--//--
Mx_Button3=dotnetobject "Autodesk.Windows.RibbonButton"
Mx_Button3.Text="3"
Mx_Button3.showtext=true
--//--
Mx_Button4=dotnetobject "Autodesk.Windows.RibbonButton"
Mx_Button4.Text="4"
Mx_Button4.showtext=true
--//--
ComponentManager.Ribbon.Tabs.Add(Mx_Tab)
Mx_Panel.Source=RibbonPanelSource
RibbonPanelSource.items.add(Mx_Button1)
RibbonPanelSource.items.add(Mx_Button2)
RibbonPanelSource.items.add(Mx_Button3)
RibbonPanelSource.items.add(Mx_Button4)
Mx_Tab.Panels.Add(Mx_Panel)
--//--
ComponentManager=undefined
(dotnetclass "System.gc").collect()
gc() ---just to make sure :-)
)
edit: in fact I think that it’s the maxscript gc needed here, if I remove it , it crash when touching the ribbon !!
can you please confirm that it’s working …maybe I got something else that make
it work who know
regard,
Martin
yes , it worked ! , lost the original ribbon but it worked
when i removed the garbage collection … i got the crash
the maxscript GC does nothing btw
well , another crash with the dot.net garbage colection only …LOL
and here comes the third crash with garbage collection form mxs and .net
i actually don’t need this ribbon shit :hmm:
i’ve extracted the whole functions and the macroscripts of the ribbon from the macrofiles that come with the ribbon sometime ago
i can run them all using a ExcuteMaxScriptCommand from inside a C# dll
i stopped for now cause i couldn’t find a suitable easy …fast … etc layout for all of those
once i get a decent idea … bye bye ribbon for good
hehe it not that bad …it work well on my test here just need to make sure componentmanager is collected by maxscript gc …I dont need the function from the ribbon I just want to use the frame to dock some other tool
I’m under xp64 through …maybe it don’t work in a 32bit os … but can’t test it for now !!
edit : ho, make sure you execute in local scope too