ScriptSpot

Forum topic · General Scripting

Storing Array of names with Maxfile

By JokerMartini · 2011-07-24

Description

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 (9)

here is...

Anubis · 2011-07-25

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

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

Cheers!

Awesome

JokerMartini · 2011-07-25

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"

rootNode.Names.theNames

Anubis · 2011-07-25

If you use

rootScene

instead, keep in mind that it is new in Max 2011.

Add

JokerMartini · 2011-07-25

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

Storing Names

JokerMartini · 2011-07-24

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

link ref

Anubis · 2011-07-25

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

JokerMartini · 2011-07-24

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.

Hey John

Anubis · 2011-07-24

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!

miauu · 2011-07-24

CustomAttributes.