Default
Sep 17, 2009
Post id: 299399 Report Item

Hi !

I'm coding some UI wich is built by tokenizing arguments concatenated into one string, for each control. Essentially through the attrControlGrp command.

I've been using the triplet "|||" to separate arguments, worked fine with test scenes, but real scenes often have non-unique object names.

So I introduced DAG paths, but now tokenize takes one single | as a triplet |||.

Ex:

string $burp[];
tokenize group3|pCylinder29|pCylinderShape29 "|||" $burp;
print `size $burp`;
//result: 3

Dangit. Now I got unterminated string errors etc. I understand /why/ (tokenize is buggy, doh).

Can you tell me how to work this around, or recommand to me a specific separator for tokenizing wich would not interfere with usual Maya naming, ie obviously I can't use a period either, attributes would clash.

What's your take on this ? Am I doing something wrong ? I was sure to disambiguish the separator with ||| :?

Thanks

Dashboard_avatar
Sep 17, 2009
Post id: 299400 Report Item

Dangit. Now I got unterminated string errors etc. I understand /why/ (tokenize is buggy, doh).

Its not a bug if you read the (*¤%/) documentation of tokenizer it becomes clear. ;)

The firts sting is what to tokenize, the second string si NOT the pattern to seek but a list of things to search for So if you were to do


tokenize "aqschbq" "abc" $target;

then you would get the list:

"q","s","h" and "q".

This is intentional, exactly what they MEANT TO DO ergo no bug (it would be a bug if it was intended to work like you think it was not). Just because you think something works like you think does mean it was even supposed to. Alas that means:

I was sure to disambiguish the separator with ||| :?

No disabiguation theres just no such thing in the tool that can tokenize based on sequences. So unfortunately the tool will never do what you want.

I would suggest you use a character mayas guaranteed to never use i would choose something like \b (bell, note its not 2 characters its one escape sequance) its pretty damn guaranteed not to be used by almost anybody. Maya also never uses \n in names this ones perhaps even better, and natural, as it makes debugging the strings extremely easy just dump into any place an a human will see them as lines (same applies to \t), Other things guaranteed never to exist in mayas names are !#¤%&/()='´`£@, and so on

string $a[];
tokenize "test|with|real|separator\btest|cool|separator" "\b" $a;
print $a;

results in:

test|with|real|separator
test|cool|separator

Default
Sep 17, 2009
Post id: 299401 Report Item

Thanks a lot for your complete answer Joojaa, and for your time. I feel doubly sorry for my lazy self-documenting, indeed I imagined how tokenizing should work, and it did pretty well until now, lucky me...

"Note: tokenize does not match the entire split string; it matches any character in the string. " <- I must have belittled that detail... woops.

If I happen to request again something that is obviously resulting of a bad usage of the documentation, just point that out, I should then help myself !

Though, I'll take your advice and use special characters (#, ¤ or £), because I'm passing \n for text controls.

Thanks again !

Default
Sep 17, 2009
Post id: 299404 Report Item

in your example, I have now to assume that you meant

"qs","h" and "q"

for the result ;)

I wish I could have edited the title of the thread, but either my browser settings or the site won't let me.

Cheers

Dashboard_avatar
Sep 17, 2009
Post id: 299406 Report Item

Yes thets what i meant

> I wish I could have edited the title of the thread, but either my browser settings or the site won't let me.

The beta code si still a bit buggy should work, report in the bugs forum please. (the idea of making the forum live is to force the site to be ready some day)

Default
Sep 18, 2009
Post id: 299428 Report Item

I will report the "bug" along with the IE(7) debug output.

I have to take some precautions after this first thread of mines in qualifying events ;)

And I will update to IE8 also.

ty