iterated mel script from command by command
I am trying to write a mel script that assigns a CV curve (with 5 knots) to each vertex on an animated object. For each vertex on the animated object the base of a single CV curve is then aligned using the constraints in order: geometry, normal (with length of CV curve aligned with normal direction), and point on poly. After this each of the CV curves are made dynamic in the nHair module, with the base anchored to the vertex on the animated object. I have been able to record the mel commands for a single instance of this but do to know how to repeat the same command for all vertices on the animated object
curve -d 3 -p 0 0 0 -p 0 1 0 -p 0 2 0 -p 0 3 0 -p 0 4 0 -p 0 5 0 -k 0 -k 0 -k 0 -k 1 -k 2 -k 3 -k 3 -k 3 ;
select -r pSphere1 ;
select -tgl curve1 ;
geometryConstraint -weight 1;
select -r pSphere1 ;
select -tgl curve1 ;
normalConstraint -weight 1 -aimVector 0 1 0 -upVector 0 1 0 -worldUpType "vector" -worldUpVector 0 1 0;
select -r pSphere1.vtx[184] ;
select -tgl curve1 ;
doCreatePointOnPolyConstraintArgList 2 { "0" ,"0" ,"0" ,"1" ,"" ,"1" ,"0" ,"0" ,"0" ,"0" };
{string $constraint=`pointOnPolyConstraint -offset 0 0 0 -weight 1`; setAttr ($constraint[0]+".pSphere1U0") 0.200000; setAttr ($constraint[0]+".pSphere1V0") 0.500000;};
select -r curve1 ;
makeCurvesDynamic 2 { "0", "1", "1", "1", "0"};
select -r follicle1 ;
selectKey -clear ;
setAttr "follicleShape1.pointLock" 1;
(great! can't embed an image yet as I haven't earned enough points...)
I know this is just a screengrab of the normals displayed on a sphere in Maya (if I was allowed to embed it - for now just turn normals display on for a sphere in Maya), but if you can imagine each normal line is actually a CV curve follicle then you can understand what I am trying to script - I want to be able to select all the vertices on the sphere and assign CVs which are then converted to dynamic follicles...
mel
add a comment |
I am trying to write a mel script that assigns a CV curve (with 5 knots) to each vertex on an animated object. For each vertex on the animated object the base of a single CV curve is then aligned using the constraints in order: geometry, normal (with length of CV curve aligned with normal direction), and point on poly. After this each of the CV curves are made dynamic in the nHair module, with the base anchored to the vertex on the animated object. I have been able to record the mel commands for a single instance of this but do to know how to repeat the same command for all vertices on the animated object
curve -d 3 -p 0 0 0 -p 0 1 0 -p 0 2 0 -p 0 3 0 -p 0 4 0 -p 0 5 0 -k 0 -k 0 -k 0 -k 1 -k 2 -k 3 -k 3 -k 3 ;
select -r pSphere1 ;
select -tgl curve1 ;
geometryConstraint -weight 1;
select -r pSphere1 ;
select -tgl curve1 ;
normalConstraint -weight 1 -aimVector 0 1 0 -upVector 0 1 0 -worldUpType "vector" -worldUpVector 0 1 0;
select -r pSphere1.vtx[184] ;
select -tgl curve1 ;
doCreatePointOnPolyConstraintArgList 2 { "0" ,"0" ,"0" ,"1" ,"" ,"1" ,"0" ,"0" ,"0" ,"0" };
{string $constraint=`pointOnPolyConstraint -offset 0 0 0 -weight 1`; setAttr ($constraint[0]+".pSphere1U0") 0.200000; setAttr ($constraint[0]+".pSphere1V0") 0.500000;};
select -r curve1 ;
makeCurvesDynamic 2 { "0", "1", "1", "1", "0"};
select -r follicle1 ;
selectKey -clear ;
setAttr "follicleShape1.pointLock" 1;
(great! can't embed an image yet as I haven't earned enough points...)
I know this is just a screengrab of the normals displayed on a sphere in Maya (if I was allowed to embed it - for now just turn normals display on for a sphere in Maya), but if you can imagine each normal line is actually a CV curve follicle then you can understand what I am trying to script - I want to be able to select all the vertices on the sphere and assign CVs which are then converted to dynamic follicles...
mel
add a comment |
I am trying to write a mel script that assigns a CV curve (with 5 knots) to each vertex on an animated object. For each vertex on the animated object the base of a single CV curve is then aligned using the constraints in order: geometry, normal (with length of CV curve aligned with normal direction), and point on poly. After this each of the CV curves are made dynamic in the nHair module, with the base anchored to the vertex on the animated object. I have been able to record the mel commands for a single instance of this but do to know how to repeat the same command for all vertices on the animated object
curve -d 3 -p 0 0 0 -p 0 1 0 -p 0 2 0 -p 0 3 0 -p 0 4 0 -p 0 5 0 -k 0 -k 0 -k 0 -k 1 -k 2 -k 3 -k 3 -k 3 ;
select -r pSphere1 ;
select -tgl curve1 ;
geometryConstraint -weight 1;
select -r pSphere1 ;
select -tgl curve1 ;
normalConstraint -weight 1 -aimVector 0 1 0 -upVector 0 1 0 -worldUpType "vector" -worldUpVector 0 1 0;
select -r pSphere1.vtx[184] ;
select -tgl curve1 ;
doCreatePointOnPolyConstraintArgList 2 { "0" ,"0" ,"0" ,"1" ,"" ,"1" ,"0" ,"0" ,"0" ,"0" };
{string $constraint=`pointOnPolyConstraint -offset 0 0 0 -weight 1`; setAttr ($constraint[0]+".pSphere1U0") 0.200000; setAttr ($constraint[0]+".pSphere1V0") 0.500000;};
select -r curve1 ;
makeCurvesDynamic 2 { "0", "1", "1", "1", "0"};
select -r follicle1 ;
selectKey -clear ;
setAttr "follicleShape1.pointLock" 1;
(great! can't embed an image yet as I haven't earned enough points...)
I know this is just a screengrab of the normals displayed on a sphere in Maya (if I was allowed to embed it - for now just turn normals display on for a sphere in Maya), but if you can imagine each normal line is actually a CV curve follicle then you can understand what I am trying to script - I want to be able to select all the vertices on the sphere and assign CVs which are then converted to dynamic follicles...
mel
I am trying to write a mel script that assigns a CV curve (with 5 knots) to each vertex on an animated object. For each vertex on the animated object the base of a single CV curve is then aligned using the constraints in order: geometry, normal (with length of CV curve aligned with normal direction), and point on poly. After this each of the CV curves are made dynamic in the nHair module, with the base anchored to the vertex on the animated object. I have been able to record the mel commands for a single instance of this but do to know how to repeat the same command for all vertices on the animated object
curve -d 3 -p 0 0 0 -p 0 1 0 -p 0 2 0 -p 0 3 0 -p 0 4 0 -p 0 5 0 -k 0 -k 0 -k 0 -k 1 -k 2 -k 3 -k 3 -k 3 ;
select -r pSphere1 ;
select -tgl curve1 ;
geometryConstraint -weight 1;
select -r pSphere1 ;
select -tgl curve1 ;
normalConstraint -weight 1 -aimVector 0 1 0 -upVector 0 1 0 -worldUpType "vector" -worldUpVector 0 1 0;
select -r pSphere1.vtx[184] ;
select -tgl curve1 ;
doCreatePointOnPolyConstraintArgList 2 { "0" ,"0" ,"0" ,"1" ,"" ,"1" ,"0" ,"0" ,"0" ,"0" };
{string $constraint=`pointOnPolyConstraint -offset 0 0 0 -weight 1`; setAttr ($constraint[0]+".pSphere1U0") 0.200000; setAttr ($constraint[0]+".pSphere1V0") 0.500000;};
select -r curve1 ;
makeCurvesDynamic 2 { "0", "1", "1", "1", "0"};
select -r follicle1 ;
selectKey -clear ;
setAttr "follicleShape1.pointLock" 1;
(great! can't embed an image yet as I haven't earned enough points...)
I know this is just a screengrab of the normals displayed on a sphere in Maya (if I was allowed to embed it - for now just turn normals display on for a sphere in Maya), but if you can imagine each normal line is actually a CV curve follicle then you can understand what I am trying to script - I want to be able to select all the vertices on the sphere and assign CVs which are then converted to dynamic follicles...
mel
mel
edited Nov 15 at 22:46
S.D
26817
26817
asked Nov 15 at 12:35
twyeld
35
35
add a comment |
add a comment |
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53319649%2fiterated-mel-script-from-command-by-command%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53319649%2fiterated-mel-script-from-command-by-command%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown