defining an array as a custom attribute
Ok, at the moment, I am trying to make an array as a custom attribute.. Only problem, I'm getting the following weird error:
-- Error occurred in anonymous codeblock; filename: J:\Dropbox\ICT312 (1)\scripts\entityAttribs.ms; position: 579; line: 30 -- Unable to convert: #() to type: String
for the following code:
newAttrib = attributes entityAttrib ( parameters posParam rollout:entParams ( isStatic type:#boolean ui:isStatic checked:false castShadow type:#boolean ui:castShadow checked:false isChild type:#boolean childeren type:#() ) rollout entParams "Entity Atributes" ( checkbox isStatic "Static Entity" checkbox castShadow "Casts Shadows" edittext isChildTxt "is child" text:"no" on isChild changed do ( if isChild == true then ( isChildTxt.text = "yes" ) else ( isChildTxt.text = "no" ) ) ) ) custAttributes.add $ newAttrib --and then use >> $.baseObject.entityAttrib.castShadow = on $.baseObject.entityAttrib.isStatic = on $.baseObject.entityAttrib.isChild = on $.baseObject.entityAttrib.childeren = on isProperty $.baseObject #castShadow isProperty $.baseObject #isStatic isProperty $.baseObject #isChild isProperty $.baseObject #childeren
if I follow tutorials on how to make an array inside of just any odd script, not inside of a custom paramater, i.e.
childeren = #()
I get the following error:
-- Error occurred in anonymous codeblock; filename: J:\Dropbox\ICT312 (1)\scripts\entityAttribs.ms; position: 231; line: 8 -- Syntax error: at =, expected name -- In line: childeren = #
I know it's probably something silly.. But I can't for the life of me understand why my array isn't working inside of a parameters :(
Is there a proper way??
If anyone's curious, the reason why I need an array is because I'm holding children meshes inside of an array (needed for proper extraction of scene data for exporter)
Comments
Another good example by Paul
Another good example by Paul Neale
http://paulneale.com/tutorials/Scripting/weakReferences/weakReferences.htm
bga
How in gods earth do you find
How in gods earth do you find these things.. I search for hours...
I'll check out in full in the morning.. 3am isn't best time to script
The basic rule: only that you
The basic rule:
only that you need is to know what do you want and place where to find.:)
Hope this help.
Cheers man!
bga
At the end of code you
At the end of code you probable noticed the line "max modify mode".
This is important because by switchin command panel to modfy mode
you create CA rollout and thus avoiding errors
bga
I hate to ask stupid
I hate to ask stupid questions, but you can probably tell, that I aint really all that familiar with MaxScript.. Is there anyway I can intigrate an array into this function
I' just really not confident with the language as a whole and I understand how that code words and I feer translating my code into that other structure will cause more and more stupid little problems Ide know how to fix if I knew the language better. And I would learn the language better, but by the looks of it it's an experience language, meaning u learn from eperience.. Unfortunately I don't have 4 weeks to learn.
It sounds like I am being lazy here and just not doing the hard hours.. But trust me, I am doing the hard hours.. I am in final year uni with 2 other units all demanding all my time.
If I understand you correctly
If I understand you correctly you want when press button "add child"
to collect all children nodes of current selection and store it in
"children" array.Right?
bga
yes correct, then my exporter
yes correct, then my exporter would make it a node inside of itself, here's an example of our XML structure.
box02 in this case is a child of box01
don't worry about my ability to export the XML, it's already up and running, all I'm doing now is adding all the attributes for it to export
Here we go now you can
Here we go
now you can collect all children nodes of current selection and store it in children array.
Press the button and look what Listener throw
bga
would you be able to break
would you be able to break down this:
I think I understand it, the first line finds the item which this rollout is attached to, the next one itterates through all the elements inside of the childeren array...
one problem...
my code doesn't seem to be working :( again :(
neither
or
add it to the childerens array :( any help?
Sorry for heaps of questions.. just this is kinda vital and I have no where near enought max experience
Aha, i see that. You're an
Aha, i see that. You're an inexperienced user who know all about Beckground Worker, XML and when construct. tell me about it :)
I know somethig about BGWorker and XML but i never use before when construct.
You need to explaine what do you want to achive now?
If you need to append picked object in "children array" try to use pickbutton.Then you don't need other advanced fn
bga