ScriptSpot home

ConStructOr

Downloads

Release history (1)
  • Version 0.4Listed version

    Listing updated

    No download linked to this version

3ds Max compatibility
Unknown
Community reviewsNo reviews yet.

Listing details

Version
0.4
Author’s update date
Legacy votes
14
Listing created
How compatibility works

Compatibility comes from the author’s supported range or requirements in the original listing. A tested version records what the author tried.

“2020 unconfirmed” in the catalog means support for 3ds Max 2020 is still unknown.

Community reports record successful tests on specific releases.

Posted by

Graph

More by this author

This is a WIP function collection to make the working with structs in maxScript easier.
It's kinda inspired by: 1.Garp's Primitive maker in that you can quickly reDefine structs and 2.the lack of functions provided by maxScript.

The only functions in it so far are:

  • addVar - add a property to a struct
  • gotProperty - the equivalent of hasProperty or isProperty functions for a struct

Let me know what kind of functions you'd like to see in here

Setup & notes


(
	clearlistener()

	struct constructorStr
	(
		addVar = fn AddVar str var2Add val2Add name isGlobal:false =
		(
			local name = if classOf name == string then name else "conStructorTempStr"
			local propNames = getPropNames str
			local temp = str()
			local props = for prop in propNames collect getProperty temp prop
			
			local stri = ""
			
			for i = 1 to propNames.count do 
			(
				case i of
				(
					1 : 
					(
						stri += "struct "+ name + "(\n"
						stri += propNames[i] as string + " = " + props[i] as string + ",\n"
					)
					default : 
					(
						stri += propNames[i] as string + " = " + props[i] as string + ",\n"
					)
					(propNames.count) : 
					(
						stri += propNames[i] as string + " = " + props[i] as string + ",\n"
						stri += var2Add as string + " = " + val2Add as string + ")\n"
					)
				)
			)
			
			local tStruct = if not isGlobal then copy (execute stri) else execute stri
			if not isGlobal do execute (name + " = undefined")
			
			return tStruct
		),--END addVar FN
		
		gotProperty = fn gotProperty str propName = 
		(
			local propNames = for o in (getPropNames str) collect o as string
			findItem propNames (propName as string) != 0
		)--END gotProperty FN
	)
	global constructor = constructorStr()
	

	/***************************************************************************************************************/
	/***************************************************************************************************************/
	
	struct personC
	(
		age, sex, job
	)
	
	local personClass = constructor.AddVar personC #skills #() "humanClass"
	
	local raphael = personClass age:23 sex:#male job:#TechnicalArtist skills:#(#MaxScript, #WorkflowImprovement, #Ect)
	
	print raphael
	
	format "personClass.gotProperty #skills % \n" (constructor.gotProperty personClass #skills)
	format "personClass.gotProperty #height % \n" (constructor.gotProperty personClass #height)
	
	OK
)--END local
Comments (0)