<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Delete SME views script causing error in 3ds Max Programming Forum</title>
    <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/delete-sme-views-script-causing-error/m-p/12561045#M6316</link>
    <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;fn delete_all_view_tvnodes = 
(
	x = trackViewNodes[#sme]
	del = 0
	for p in getpropnames x where iskindof (v = getproperty x p) MAXTVNode do 
	(
		res = deleteTrackViewNode x v 
		del += 1
	)
	del
)

fn delete_all_sme_views = 
(
	del = 0
	while sme.GetNumViews() do 
	(
		sme.DeleteView 1 false
		del += 1
	)
	del
)

for k=1 to 1000 do sme.CreateView ("TestView" + k as string)

format "START with number views:%\n" (sme.GetNumViews()) 

del = undo off
(
	d0 = delete_all_sme_views()
	d1 = delete_all_view_tvnodes()
	
	[d0, d1]
)

format "% - END with number views:%\n" del (sme.GetNumViews()) &lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;To run the test for the first time, you must open the SME at least once. After that, it can be closed...&lt;/P&gt;</description>
    <pubDate>Wed, 14 Feb 2024 23:34:52 GMT</pubDate>
    <dc:creator>denisT.MaxDoctor</dc:creator>
    <dc:date>2024-02-14T23:34:52Z</dc:date>
    <item>
      <title>Delete SME views script causing error</title>
      <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/delete-sme-views-script-causing-error/m-p/9761210#M6299</link>
      <description>&lt;P&gt;I have used this &lt;A href="http://www.scriptspot.com/3ds-max/scripts/delete-view-tabs-in-slate-material-editor" target="_blank" rel="noopener"&gt;script&lt;/A&gt; for a while in conjunction with the &lt;A href="http://www.scriptspot.com/3ds-max/scripts/show-materials-for-selected-just-1-click" target="_blank" rel="noopener"&gt;'show materials for selected'&lt;/A&gt; in order to quickly get materials in and out of the Slate Editor. Recently (I think it corresponds with me updating to Vray 5) the clear SME views one causes the below error, and a lot of the time causes max to crash.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm a complete scripting luddite and don't know what this means unfortunately, can anyone help!?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Or is there a more sensible way of doing it now (I'm on 2020)&lt;BR /&gt;&lt;BR /&gt;here's the script:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;----------------------------------------------------------------------------------------
-- Version:		v1.0
-- Author:			Aleksey Sheremetov  - https://kotiger.co/
----------------------------------------------------------------------------------------

macroScript Delete_SME_Views
category:"Kotscript"
tooltip:"Delete SME views"
buttontext:"DeleteViews"

(
	ViewsTotal = sme.GetNumViews ()
	ViewIndex = 1
	for i in 1 to ViewsTotal do 		
	(
		view = sme.GetView (ViewIndex)
		if matchPattern view.name pattern:"*View*" then
		(
			sme.DeleteView (sme.GetViewIndex (view)) false
		)
		else
		(	
			ViewIndex += 1
		)
	)
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 22 Sep 2020 13:25:37 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-programming-forum/delete-sme-views-script-causing-error/m-p/9761210#M6299</guid>
      <dc:creator>TB_RIO</dc:creator>
      <dc:date>2020-09-22T13:25:37Z</dc:date>
    </item>
    <item>
      <title>Re: Delete SME views script causing error</title>
      <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/delete-sme-views-script-causing-error/m-p/9766334#M6300</link>
      <description>&lt;P&gt;Now (in 2021) the script to put these materials in to the SME is broken:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;macroScript ShowMaterials category:"Rode3D" tooltip:"Show materials for selected objects"
(
	-- *** Opens the Material Editor and shows just the materials for the selected objects ***
	if (selection.count &amp;gt; 0) then
	(
		sme.Open()
		--POPULATE THE VIEW
		for obj in selection do
		(
			NewView.CreateNode obj.material[0,0]
		)
		--ARRANGE THE VIEW
		actionMan.executeAction 369891408 "40060"
	)
	else
	(
		messagebox "You must have at least one object selected!"
	)
)&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 24 Sep 2020 16:03:58 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-programming-forum/delete-sme-views-script-causing-error/m-p/9766334#M6300</guid>
      <dc:creator>TB_RIO</dc:creator>
      <dc:date>2020-09-24T16:03:58Z</dc:date>
    </item>
    <item>
      <title>Re: Delete SME views script causing error</title>
      <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/delete-sme-views-script-causing-error/m-p/9767183#M6301</link>
      <description>&lt;P&gt;delete all views:&lt;/P&gt;&lt;LI-CODE lang="general"&gt;while (sme.GetNumViews() &amp;gt; 0) do sme.DeleteView 1 false&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;delete views whose name starts with "View ...":&lt;/P&gt;&lt;LI-CODE lang="general"&gt;for i = sme.GetNumViews() to 1 by -1 where matchpattern (sme.GetView i).name pattern:"view*" do sme.DeleteView i false&lt;/LI-CODE&gt;&lt;P&gt;delete all views:&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 24 Sep 2020 23:48:01 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-programming-forum/delete-sme-views-script-causing-error/m-p/9767183#M6301</guid>
      <dc:creator>denisT.MaxDoctor</dc:creator>
      <dc:date>2020-09-24T23:48:01Z</dc:date>
    </item>
    <item>
      <title>Re: Delete SME views script causing error</title>
      <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/delete-sme-views-script-causing-error/m-p/9767193#M6302</link>
      <description>&lt;P&gt;max is correct... there is no such thing as &lt;STRONG&gt;NewView&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;here is how to do what you want:&lt;/P&gt;&lt;LI-CODE lang="general"&gt;if selection.count &amp;gt; 0 do
(
	sme.Open()
	for i = sme.GetNumViews() to 1 by -1 where matchpattern (sme.GetView i).name pattern:"Current Materials" do sme.DeleteView i false

	id = sme.CreateView "Current Materials"
	new_view = sme.GetView id 
	for node in selection where iskindof node.material Material do new_view.CreateNode node.material [0,0]
	actionMan.executeAction 369891408 "40060"
)&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 24 Sep 2020 23:58:53 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-programming-forum/delete-sme-views-script-causing-error/m-p/9767193#M6302</guid>
      <dc:creator>denisT.MaxDoctor</dc:creator>
      <dc:date>2020-09-24T23:58:53Z</dc:date>
    </item>
    <item>
      <title>Re: Delete SME views script causing error</title>
      <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/delete-sme-views-script-causing-error/m-p/10494291#M6303</link>
      <description>&lt;P&gt;I've tried both scripts and they are working on empty scene but when scene has objects and materials those scripts are crashing 3ds max.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 25 Jul 2021 10:58:08 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-programming-forum/delete-sme-views-script-causing-error/m-p/10494291#M6303</guid>
      <dc:creator>hoverpsonic</dc:creator>
      <dc:date>2021-07-25T10:58:08Z</dc:date>
    </item>
    <item>
      <title>Re: Delete SME views script causing error</title>
      <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/delete-sme-views-script-causing-error/m-p/10494292#M6304</link>
      <description>&lt;P&gt;&lt;SPAN&gt;I've tried both scripts and they are working on empty scene but when scene has objects and materials those scripts are crashing 3ds max.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 25 Jul 2021 10:59:10 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-programming-forum/delete-sme-views-script-causing-error/m-p/10494292#M6304</guid>
      <dc:creator>hoverpsonic</dc:creator>
      <dc:date>2021-07-25T10:59:10Z</dc:date>
    </item>
    <item>
      <title>Re: Delete SME views script causing error</title>
      <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/delete-sme-views-script-causing-error/m-p/10749187#M6305</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to bring this thread to life again because I need to batch many maxfiles. Problem exist in both 2021+2022&lt;/P&gt;&lt;P&gt;I have been trying to investigate it and the issue is really strange. The code doesnt work if the slate is populate and you evaluate just the lines but when you hook it up to a rollout, create a dialog and press the button it works all fine. As a standalone evaluation it will make 3dsmax crash and tell you its known system exception in 0x0 and it doesnt tell you more than that in the listener.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="unknown.png" style="width: 661px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/988315iD29D0D9BF3DAB7CA/image-size/large?v=v2&amp;amp;px=999" role="button" title="unknown.png" alt="unknown.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I get this error no matter how different I write the code. Tried a few different methods with while and for loops&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Lets say this is the default line of code that will make max crash&lt;/P&gt;&lt;LI-CODE lang="general"&gt;if not SME.isOpen() do SME.open()	
while (sme.GetNumViews() &amp;gt; 0) do sme.DeleteView 1 false
sme_view = sme.GetView (sme.CreateView "View1")&lt;/LI-CODE&gt;&lt;P&gt;if run the same code through a rollout and create dialog it will work fine (however this will make it impossible to batch run this code)&lt;/P&gt;&lt;LI-CODE lang="general"&gt;rollout clearSme_ro "ClearSME"
(		
                button btn_clearsme "ClearSME_button" 
		
                on btn_clearsme pressed do (
		   if not SME.isOpen() do SME.open()	
		   while (sme.GetNumViews() &amp;gt; 0) do sme.DeleteView 1 false
		   sme_view = sme.GetView (sme.CreateView "View1")
		)
)

CreateDialog clearSme_ro&lt;/LI-CODE&gt;&lt;P&gt;So I though if I&amp;nbsp; do a UI.Accessor press button it might work? But it does unfortunately crash and its impossible to figure out whats the problem.&lt;/P&gt;&lt;P&gt;Even tried to disable global rendering in SME, but still doesnt work.&amp;nbsp; Even delete view with actionman.executeAction will make it crash.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;rollout clearSme_ro "ClearSME"
(		
                button btn_clearsme "ClearSME_button" 
		on btn_clearsme pressed do (
		    if not SME.isOpen() do SME.open()	
		    while (sme.GetNumViews() &amp;gt; 0) do sme.DeleteView 1 false
		    sme_view = sme.GetView (sme.CreateView "View1")
		)
)

CreateDialog clearSme_ro

dialogHWND =  windows.getChildHWND 0 "ClearSME"
dialogChildren = windows.getChildrenhwnd dialogHWND[1]
for child in dialogChildren where child[5] == "ClearSME_button" do 
UIAccessor.pressButton child[1]&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/1634609"&gt;@denisT.MaxDoctor&lt;/a&gt;&amp;nbsp; any clue what the reason behind this might be or are there other ways to batch clean unused materials in a maxfile?&lt;/P&gt;</description>
      <pubDate>Wed, 10 Nov 2021 21:42:22 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-programming-forum/delete-sme-views-script-causing-error/m-p/10749187#M6305</guid>
      <dc:creator>victorEFVH7</dc:creator>
      <dc:date>2021-11-10T21:42:22Z</dc:date>
    </item>
    <item>
      <title>Re: Delete SME views script causing error</title>
      <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/delete-sme-views-script-causing-error/m-p/10751562#M6306</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/6584269"&gt;@TB_RIO&lt;/a&gt;,&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/10441388"&gt;@victorEFVH7&lt;/a&gt;,&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/10745360"&gt;@hoverpsonic&lt;/a&gt;&amp;nbsp;and&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/1634609"&gt;@denisT.MaxDoctor&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I've asked some of our MAXScript experts to take a look at this thread and see if they can help diagnose this issue.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Most important, though: Chaos Group recently discovered an issue with V-Ray (since fixed) where changing some PBR maps would result in a crash. They've already issued a hotfix with&amp;nbsp;&lt;SPAN&gt;VRay 5.20.01, so if you're running V-Ray, please make sure you've downloaded and installed that on your copies of 3ds Max.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;In addition, if Max is allowing you to submit Customer Error Reports (CERs) after these crashes, please submit them, make sure your email address is included, and then post those CER numbers here so I can look them up. Thanks!&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 11 Nov 2021 17:48:00 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-programming-forum/delete-sme-views-script-causing-error/m-p/10751562#M6306</guid>
      <dc:creator>jon.bell</dc:creator>
      <dc:date>2021-11-11T17:48:00Z</dc:date>
    </item>
    <item>
      <title>Re: Delete SME views script causing error</title>
      <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/delete-sme-views-script-causing-error/m-p/10751924#M6307</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/10441388"&gt;@victorEFVH7&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/1634609"&gt;@denisT.MaxDoctor&lt;/a&gt;&amp;nbsp; any clue what the reason behind this might be or are there other ways to batch clean&lt;/P&gt;&lt;P&gt;unused materials in a maxfile?&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;The code that I showed above works for me on 2016 and 2020. I can't test it on 2021/22 right now, but I see some difference of how the same code works on 2016 and 2020. So, I believe that you can have a problem on 2021/22.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My guess that was something changed in specific materials (V-Ray for example).&amp;nbsp;&lt;/P&gt;&lt;P&gt;Therefore, I propose to conduct several tests with a new method:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;fn sme_deleteAllViews open:off delNodes:on delRef:on delView:on = undo off
(
	if open then sme.open() else sme.close()
	
	k0 = sme.getnumviews()
	
	for k = sme.getnumviews() to 1 by -1 do
	(
		v = sme.getview k
		format "%:\n" v.name
		if delNodes do
		(
			n0 = v.getnumnodes()
			v.selectall()
			v.deleteselection()
			n1 = v.getnumnodes()
			format "\t% &amp;gt; nodes: %(%)\n" k n1 n0
		)
		if delRef do
		(
			r0 = refs.getreference trackViewNodes[#sme] k
			refs.replacereference trackViewNodes[#sme] k undefined
			r1 = refs.getreference trackViewNodes[#sme] k
			format "\t% &amp;gt; reference: %(%)\n" k r1 r0
		)
		if delView do
		(
			sme.deleteview k off
			k1 = sme.getnumviews()
			format "\t% &amp;gt; views: %(%)\n" k k1 k0
		)
	)
	(k0 - sme.getnumviews())
)	&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1. We do it with "undo off" now because the "deleteview" operation is not undoable anyway&lt;/P&gt;&lt;P&gt;2. We have some options:&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; 1) do it with open or closed sme&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; 2) you can delete all nodes of the view first and delete the view after&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; 3) you can delete sme view reference target before deleting the view&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Try all of these options and combinations of them ... maybe some of them will work. Maybe you have a better understanding of what exactly is causing the crash.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;(and please let us know)&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 11 Nov 2021 20:39:08 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-programming-forum/delete-sme-views-script-causing-error/m-p/10751924#M6307</guid>
      <dc:creator>denisT.MaxDoctor</dc:creator>
      <dc:date>2021-11-11T20:39:08Z</dc:date>
    </item>
    <item>
      <title>Re: Delete SME views script causing error</title>
      <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/delete-sme-views-script-causing-error/m-p/10751997#M6308</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/1634609"&gt;@denisT.MaxDoctor&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Works like a charm, all options works and give no error at all. Code is even successful with sme closed.&lt;/P&gt;&lt;P&gt;Also tried the previous code with undo off and it works like it did in previous versions of Max. So I guess max struggles with the undo.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Im currently batching 100 maxfiles and so far so good, lets see if I run into som error otherwise this case is closed.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for the quick reply guys.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 11 Nov 2021 21:07:37 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-programming-forum/delete-sme-views-script-causing-error/m-p/10751997#M6308</guid>
      <dc:creator>victorEFVH7</dc:creator>
      <dc:date>2021-11-11T21:07:37Z</dc:date>
    </item>
    <item>
      <title>Re: Delete SME views script causing error</title>
      <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/delete-sme-views-script-causing-error/m-p/10752027#M6309</link>
      <description>&lt;P&gt;&lt;EM&gt;Im currently batching 100 maxfiles and so far so good, lets see if I run into som error otherwise this case is closed.&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you are using batch mode (opening and closing new files), you need to open SME for every new scene (file). This is the only reliable way to update the current SME data.&lt;/P&gt;</description>
      <pubDate>Thu, 11 Nov 2021 21:21:09 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-programming-forum/delete-sme-views-script-causing-error/m-p/10752027#M6309</guid>
      <dc:creator>denisT.MaxDoctor</dc:creator>
      <dc:date>2021-11-11T21:21:09Z</dc:date>
    </item>
    <item>
      <title>Re: Delete SME views script causing error</title>
      <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/delete-sme-views-script-causing-error/m-p/10752059#M6310</link>
      <description>&lt;P&gt;For some reason, it worked fine without opening it. But I ran into a crash after 70 files however the violation code were different this time so thats "good" and maybe its not because of the script but other reasons.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 12 Nov 2021 18:47:54 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-programming-forum/delete-sme-views-script-causing-error/m-p/10752059#M6310</guid>
      <dc:creator>victorEFVH7</dc:creator>
      <dc:date>2021-11-12T18:47:54Z</dc:date>
    </item>
    <item>
      <title>Re: Delete SME views script causing error</title>
      <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/delete-sme-views-script-causing-error/m-p/10752108#M6311</link>
      <description>&lt;P&gt;It looks like your problem is with batch mode and sme. I recommend opening a new topic so as not to lump everything together.&lt;/P&gt;</description>
      <pubDate>Thu, 11 Nov 2021 21:59:51 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-programming-forum/delete-sme-views-script-causing-error/m-p/10752108#M6311</guid>
      <dc:creator>denisT.MaxDoctor</dc:creator>
      <dc:date>2021-11-11T21:59:51Z</dc:date>
    </item>
    <item>
      <title>Re: Delete SME views script causing error</title>
      <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/delete-sme-views-script-causing-error/m-p/10760356#M6312</link>
      <description>&lt;P&gt;Doesn't do anything for me on 2021/2022&lt;/P&gt;</description>
      <pubDate>Tue, 16 Nov 2021 10:31:31 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-programming-forum/delete-sme-views-script-causing-error/m-p/10760356#M6312</guid>
      <dc:creator>TB_RIO</dc:creator>
      <dc:date>2021-11-16T10:31:31Z</dc:date>
    </item>
    <item>
      <title>Re: Delete SME views script causing error</title>
      <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/delete-sme-views-script-causing-error/m-p/10761455#M6313</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/6584269"&gt;@TB_RIO&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;&lt;P&gt;Doesn't do anything for me on 2021/2022&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;what are you talking about?&amp;nbsp;what is not working for you?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 16 Nov 2021 17:51:45 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-programming-forum/delete-sme-views-script-causing-error/m-p/10761455#M6313</guid>
      <dc:creator>denisT.MaxDoctor</dc:creator>
      <dc:date>2021-11-16T17:51:45Z</dc:date>
    </item>
    <item>
      <title>Re: Delete SME views script causing error</title>
      <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/delete-sme-views-script-causing-error/m-p/12560926#M6314</link>
      <description>&lt;P&gt;Hi there, I wanted to revive this topic in order to have something to work in Max 2024 like its suppose to.&lt;/P&gt;&lt;P&gt;This line code that&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/10441388"&gt;@victorEFVH7&lt;/a&gt;&amp;nbsp;wrote, worked for me in Max 2024.&lt;/P&gt;&lt;PRE&gt;if not SME.isOpen() do SME.open()	
while (sme.GetNumViews() &amp;gt; 0) do sme.DeleteView 1 false
sme_view = sme.GetView (sme.CreateView "View1")&lt;/PRE&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;But when having a lot of View tabs it crashes.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Hope someone could take a look into this.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 14 Feb 2024 22:15:33 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-programming-forum/delete-sme-views-script-causing-error/m-p/12560926#M6314</guid>
      <dc:creator>calberto.cart</dc:creator>
      <dc:date>2024-02-14T22:15:33Z</dc:date>
    </item>
    <item>
      <title>Re: Delete SME views script causing error</title>
      <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/delete-sme-views-script-causing-error/m-p/12560941#M6315</link>
      <description>&lt;P&gt;Hi there, I wanted to revive this topic in order to have something to work in Max 2024 like its suppose to.&lt;/P&gt;&lt;P&gt;This line code that you wrote, worked for me in Max 2024.&lt;/P&gt;&lt;PRE&gt;if not SME.isOpen() do SME.open()	
while (sme.GetNumViews() &amp;gt; 0) do sme.DeleteView 1 false
sme_view = sme.GetView (sme.CreateView "View1")&lt;/PRE&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;But when having a lot of View tabs (it seems that more than 10) it crashes, but I dont know if its something in my file or its something in the code&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 14 Feb 2024 22:42:09 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-programming-forum/delete-sme-views-script-causing-error/m-p/12560941#M6315</guid>
      <dc:creator>calberto.cart</dc:creator>
      <dc:date>2024-02-14T22:42:09Z</dc:date>
    </item>
    <item>
      <title>Re: Delete SME views script causing error</title>
      <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/delete-sme-views-script-causing-error/m-p/12561045#M6316</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;fn delete_all_view_tvnodes = 
(
	x = trackViewNodes[#sme]
	del = 0
	for p in getpropnames x where iskindof (v = getproperty x p) MAXTVNode do 
	(
		res = deleteTrackViewNode x v 
		del += 1
	)
	del
)

fn delete_all_sme_views = 
(
	del = 0
	while sme.GetNumViews() do 
	(
		sme.DeleteView 1 false
		del += 1
	)
	del
)

for k=1 to 1000 do sme.CreateView ("TestView" + k as string)

format "START with number views:%\n" (sme.GetNumViews()) 

del = undo off
(
	d0 = delete_all_sme_views()
	d1 = delete_all_view_tvnodes()
	
	[d0, d1]
)

format "% - END with number views:%\n" del (sme.GetNumViews()) &lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;To run the test for the first time, you must open the SME at least once. After that, it can be closed...&lt;/P&gt;</description>
      <pubDate>Wed, 14 Feb 2024 23:34:52 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-programming-forum/delete-sme-views-script-causing-error/m-p/12561045#M6316</guid>
      <dc:creator>denisT.MaxDoctor</dc:creator>
      <dc:date>2024-02-14T23:34:52Z</dc:date>
    </item>
    <item>
      <title>Re: Delete SME views script causing error</title>
      <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/delete-sme-views-script-causing-error/m-p/12561098#M6317</link>
      <description>&lt;P&gt;Thank u so much for your quick replying but....with this script 3ds max freezes and then crashes&lt;/P&gt;&lt;P&gt;I have tried with the SME open and closed several times, also with different files, but still crashes, doesnt work at all &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;&lt;P&gt;With less than 10 View tabs it also freezes but it cleans all, but i cannot use SME I cannot create any other view tab&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Feb 2024 00:17:02 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-programming-forum/delete-sme-views-script-causing-error/m-p/12561098#M6317</guid>
      <dc:creator>calberto.cart</dc:creator>
      <dc:date>2024-02-15T00:17:02Z</dc:date>
    </item>
    <item>
      <title>Re: Delete SME views script causing error</title>
      <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/delete-sme-views-script-causing-error/m-p/12561748#M6318</link>
      <description>&lt;P&gt;The crash is not caused by the number of views but by their content. Certain materials or textures cause the crash.&lt;BR /&gt;The easiest way to test the assumption and possibly solve the problem is to attach the problematic scene.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Open a new thread and post an example scene to be able to reproduce the issue.&lt;/P&gt;</description>
      <pubDate>Thu, 15 Feb 2024 09:25:11 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-programming-forum/delete-sme-views-script-causing-error/m-p/12561748#M6318</guid>
      <dc:creator>denisT.MaxDoctor</dc:creator>
      <dc:date>2024-02-15T09:25:11Z</dc:date>
    </item>
  </channel>
</rss>

