Storing Array of names with Maxfile

What is the best way to stay an array of names (string) with a maxfile?

I tried persistent globals but those did not seem to work.

Thanks
JokerMartini

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Anubis's picture

here is...

It was array of strings stored there so something like this:

myArray = (
	if isProperty rootNode "Names" then
		rootNode.Names.theNames as array
	else #()
)

Cheers!

my recent MAXScripts RSS (archive here)

JokerMartini's picture

Awesome

Thanks Anubis, I've got it working now. It's coming together great.
One last question...for now atleast is how to do a check like this.

if rootNode.Names.theNames == true then print "yes" else print "no"

John Martini
Digital Artist
http://www.JokerMartini.com (new site)

Anubis's picture

rootNode.Names.theNames

If you use rootScene instead, keep in mind that it is new in Max 2011.

my recent MAXScripts RSS (archive here)

JokerMartini's picture

Add

So I've been able to add it to the scene But I do not understand how to get names placed into the parameter as well as getting them.

rootNode.names.main.theNames.default??

Then do i have to add this
custAttributes.add rootscene CA

CA = attributes Names
(
	parameters main
	(
		theNames type:#stringTab tabSizeVariable:true
	)
)
custAttributes.add rootNode CA
custAttributes.add rootscene CA

John Martini
Digital Artist
http://www.JokerMartini.com (new site)

JokerMartini's picture

Storing Names

This is what I'm trying to do. Saving the dropdown list items names with the maxfile.

try(destroyDialog rlTestStore)catch()
rollout rlTestStore "Store with Maxfile"
(
	local lstNamesArr = #()
 
	fn fnUpdateNames =
	(
		rlTestStore.dlNames.items =  lstNamesArr
	)
 
	button btnAddName "Add Name"width:124 height:18 pos:[10,6]
	dropdownlist dlNames items:#() pos:[10,28]
 
	on btnAddName pressed do
	(
		try(destroyDialog rlNewName)catch()
		rollout rlNewName "New Name"
		(
			edittext etNewName "New Name: "
 
			on etNewName entered txt do
			(
				appendifUnique lstNamesArr txt
				fnUpdateNames()
				try(destroyDialog rlNewName)catch()
			)
		)
		createDialog rlNewName
	)
)
createDialog rlTestStore 150 54

John Martini
Digital Artist
http://www.JokerMartini.com (new site)

Anubis's picture

link ref

Check this script, it store materials to the rootNode, but am sure you'll find inside all what you looking for ;)

my recent MAXScripts RSS (archive here)

JokerMartini's picture

Those seem to store on

Those seem to store on objects which in the end save with the max file but if those objects are deleted then the information is lost.

John Martini
Digital Artist
http://www.JokerMartini.com (new site)

Anubis's picture

Hey John

You has another (2) options to add custom attributes:

CA = attributes Names
(
	parameters main
	(
		theNames type:#stringTab tabSizeVariable:true
	)
)
 
--// variant #1 > add to rootNode
custAttributes.add rootNode CA
 
--// variant #2 > add to a new track
newTrackViewNode "yourCustomName" -- create new track
custAttributes.add (trackViewNodes [#yourCustomName]) CA

Cheers!

my recent MAXScripts RSS (archive here)

miauu's picture

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.