Jump to content

EXCEPTION_ACCESS_VIOLATION When deleting After Mesh Modifier using maxscript


cippall

Recommended Posts

Hi,

 

I'm getting EXCEPTION_ACCESS_VIOLATION when trying to delete all after mesh modifiers via maxscript( 3dsmax 2020 and GrowFX 1.9.9 SP9). I'm using this function - from a Rollout - while all paths are disabled:

 

	fn removeAfterMeshWindModifiers oGFX =
	(
		for x = 1 to oGFX.getNumPaths() do
		(
			for y = (oGFX.getNumAfterMeshModifiers x) to 1 by -1 do
			(	
				oGFX.deleteAfterMeshModifier x y
			)				
		)
	)

Is there a better way to do this ? I suspect GrowFX updates the nodes while the script is traversing the paths tree and is causing this exception.

 

Some of the error logs 

-- ########################################################################
-- Address: 0x329fff23; nCode: 0x00000000C0000005
-- Desc: EXCEPTION_ACCESS_VIOLATION The thread tried to read from or write to a virtual address for which it does not have the appropriate access.
--       Read of Address: 0x0000000000000150
-- ########################################################################

.....



--	called from top-level
-- ########################################################################
-- C++ callstack:
-- (GrowFX): (filename not available): (function-name not available)
-- (GrowFX): (filename not available): LibVersion
-- (GrowFX): (filename not available): LibVersion
-- (MAXScrpt): (filename not available): Generic::apply
-- (MAXScrpt): (filename not available): CodeTree::eval
-- (MAXScrpt): (filename not available): Primitive::apply
-- (MAXScrpt): (filename not available): clear_error_source_data
-- (MAXScrpt): (filename not available): Primitive::apply
-- (MAXScrpt): (filename not available): CodeTree::eval
-- (MAXScrpt): (filename not available): Primitive::apply
-- (MAXScrpt): (filename not available): clear_error_source_data
-- (MAXScrpt): (filename not available): Primitive::apply
-- (MAXScrpt): (filename not available): CodeTree::eval
-- (MAXScrpt): (filename not available): SourceFileWrapper::eval
-- (MAXScrpt): (filename not available): Generic::apply
-- (MAXScrpt): (filename not available): CodeTree::eval
-- (MAXScrpt): (filename not available): Primitive::apply
-- (MAXScrpt): (filename not available): CodeTree::eval
-- (MAXScrpt): (filename not available): SourceFileWrapper::eval
-- (MAXScrpt): (filename not available): Generic::apply
-- (MAXScrpt): (filename not available): CodeTree::eval
-- (MAXScrpt): (filename not available): Primitive::apply
-- (MAXScrpt): (filename not available): CodeTree::eval
-- (MAXScrpt): (filename not available): clear_error_source_data
-- (MAXScrpt): (filename not available): Primitive::apply
-- (MAXScrpt): (filename not available): CodeTree::eval
-- (MAXScrpt): (filename not available): clear_error_source_data
-- (MAXScrpt): (filename not available): Primitive::apply
-- (MAXScrpt): (filename not available): CodeTree::eval
-- (MAXScrpt): (filename not available): clear_error_source_data
-- (MAXScrpt): (filename not available): Primitive::apply
-- (MAXScrpt): (filename not available): CodeTree::eval
-- (MAXScrpt): (filename not available): clear_error_source_data
-- (MAXScrpt): (filename not available): Primitive::apply
-- (MAXScrpt): (filename not available): CodeTree::eval
-- (MAXScrpt): (filename not available): Primitive::apply
-- (MAXScrpt): (filename not available): CodeTree::eval
-- (MAXScrpt): (filename not available): clear_error_source_data
-- (MAXScrpt): (filename not available): Primitive::apply
-- (MAXScrpt): (filename not available): CodeTree::eval
-- (MAXScrpt): (filename not available): Primitive::apply
-- (MAXScrpt): (filename not available): CodeTree::eval
-- (MAXScrpt): (filename not available): clear_error_source_data
-- (MAXScrpt): (filename not available): Primitive::apply
-- (MAXScrpt): (filename not available): CodeTree::eval
-- (MAXScrpt): (filename not available): Primitive::apply
-- (MAXScrpt): (filename not available): CodeTree::eval
-- (MAXScrpt): (filename not available): Generic::apply
-- (MAXScrpt): (filename not available): SourceFileWrapper::apply
-- (MAXScrpt): (filename not available): RolloutControl::call_event_handler
-- (MAXScrpt): (filename not available): RolloutControl::get_wrapped_event_handler
-- (MAXScrpt): (filename not available): InitMacroScriptDir
-- (MAXScrpt): (filename not available): InitMacroScriptDir
-- (USER32): (filename not available): CallWindowProcW
-- (USER32): (filename not available): DispatchMessageW
-- (USER32): (filename not available): IsWindowVisible
-- (ntdll): (filename not available): KiUserCallbackDispatcher
-- (win32u): (filename not available): NtUserMessageCall
-- (USER32): (filename not available): SendMessageW
-- (USER32): (filename not available): SendMessageW
-- (core): (filename not available): GetICustButton
-- (core): (filename not available): CustomControl::WindowProc
-- (core): (filename not available): AncestorIsCUIToolbarWindow
-- (USER32): (filename not available): CallWindowProcW
-- (USER32): (filename not available): DispatchMessageW
-- (USER32): (filename not available): IsDialogMessageW
-- (3dsmax): (filename not available): NodeAndAnims::SetNode

 

Link to comment
Share on other sites

Did more testing and created a simplified version to be able to reproduce the behavior. If the script runs while the GrowFX object is selected and the 3dsmax Modify panel is active the error doesn't occur. 

 

To recreate the error run this script in a scene with :

 -  one  GrowFX that has  at least one Wind Modifier attached to any paths

 -  no GrowFX object selected during execution

 -  3dsmax 2020

 -  GrowFX 1.9.9 SP9 

 

(	
	fn removeAfterMeshWindModifiers oGFX =
	(
		for x = 1 to oGFX.getNumPaths() do
		(
			for y = (oGFX.getNumAfterMeshModifiers x) to 1 by -1 do
			(
				gfxAfterMeshModifier = oGFX.getAfterMeshModifier x y
				
				if hasProperty gfxAfterMeshModifier "Stiffness" then
				(
					oGFX.deleteAfterMeshModifier x y
				)
			)				
		)
	)
	
	try(destroydialog DeleteAfterMesh)catch()

	rollout DeleteAfterMesh "Demo" width:280 height:100
	(
		button btn_1 "START"  width:252.0 usePercentageWidth:true percentageWidth:90.0 height:40
		
		on btn_1 pressed do
		(
			if queryBox "Deleting after mesh modifiers. Are you sure?" beep:false then
			(
				aGFX = for x in objects where classOf x == GrowFX collect x
					
				for gfx in aGFX do removeAfterMeshWindModifiers gfx
			)
		)
		
	)
	
	createDialog DeleteAfterMesh

)

 

Link to comment
Share on other sites

  • 1 month later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...