Announcements

Between mid-October and November, the content on AREA will be relocated to the Autodesk Community M&E Hub and the Autodesk Community Gallery. Learn more HERE.

Cannot wrap Plugin call in an IF block

Cannot wrap Plugin call in an IF block

lightcube
Advisor Advisor
350 Views
0 Replies
Message 1 of 1

Cannot wrap Plugin call in an IF block

lightcube
Advisor
Advisor

Sharing this just as general knowledge: You cannot wrap a plugin definition inside an IF block. You can do it, but don't expect that it will only run based on the condition of the IF block. It will run regardless.

 

This means if you want to use, for example, a simpleSpline plugin object but make it only run in 3ds Max 2016+, you need to define the plugin outside of the file doing the version logic. Why? Because in the example below, Max will have an error if you execute it in 3ds Max 2015 or older (where simpleSpline isn't known).

 

if ((MaxVersion())[1]  >= 18000) then (
	-- only load this for Max 2016+
	plugin simpleSpline MySimpleSplinePlugin
	name:"Custom Spline"
	category:"Custom Shape"
	classID:#(0x31388d8c, 0x735f4fe9)
	(
		/*
		code for spline
		*/
	)
)

The safe way to do this that is backwards compatible:

if ((MaxVersion())[1]  >= 18000) then (
	-- only load this for Max 2016+
	fileIn "myCustomSpline.ms"
)


Shawn Olson

Developer of Wall Worm
3ds Max plugins and Scripts

3ds Max 4/Gmax - 3ds Max 2020
Mudbox 2009-2019

Windows 10 x64
i7 8700K
64GB RAM
Geforce 1080ti
351 Views
0 Replies
Replies (0)