hello all, i have a little problem with a mel script, i need to get the position XYZ of all CVs in a curve, now i already now how many CV do i have in the curve using the method in the manual (spans + degree) it works well now, i need to get each XYZ pos per cv into an array, now cv[n] is already and array and i cant have multidimensional arrays, so i try to use matrix but i dont know how big the matrix need to be and i try this but i get an error
i found myself again into another problem, i need to have a button, that when click it let you draw CV curves, that pretty straigh fordwar in using this $curCtx =curveCVCtx -d 1`; setToolTo $curCtx;
then starts my problem i need that when the curve is finish, i have to add a custom attribute
i using that becouese when you finish the curve is automatic selected. the problem is that maya dosent wait for me to complete the current tool and it goes to the next line of the script witch dosent work becouse there is nothing selected. anyone can help me with this
maya isnt brilliant at giving you methods of breaking code up into blocks where user interaction can occur...which may well be quite fair enough!
a couple of the more straight forward ways: one is to use scriptJobs, and detect the creation of the new node (and label it with your attribs) and another to detect completion of the tool ctx (which then kicks off into the next part of your script, as an additional, discrete, global proc entry point). you can also just make assumptions about what the curve will be named and do your business with just the tool completion event. another method might be to throw up a little window with buttons that the user can push after they've completed their creative efforts, or decided they want to bail (with the right course of script action attached to those buttons).
// Warning: line 14: Cannot add attributes to components. 'curveShape1.controlPoints[0]' ignored. // // Error: line 14: Found no valid items to add the attribute to. //
how can i detect the completion of a tool, i been looking for something like that, but no luck
im not sure how you managaed to have it working before with the new scriptJob being killed striaght after its creation (maybe that was a different script version?)...but in anycase, the error you were getting was becuase you were working on the selection, which is initially a single CV when the curve node is created, and the error message explains the rest. you could have querried the parent of the component to get the shape with that setup.
sure you can ask, i`n building a tool where the artist can create a path, that the game agent (NPC character) can fallow, and have some properties in the desire point (CV) to change the action (the animation thats played) and them export that to a text file, so that the game engine can read it, nothing too complex, is just that i never done something like this before.