Script for Mirroring cgMuscles


#1

Hi all!

I got unexpected (and very welcome) help by Piek in another thread, and upon my “thank you” reply he said: Tell you what, if you find a simple way of mirroring muscles we’ll call it quits :o). He said it as a joke, but if I can pull it off, Im gonna try.

Ok. I have developed a script to mirror cgMuscles and its Proximal and Distal points and Im posting it here to get feedback and hopefully help out others. Please do not redistribute and by no means sell this script. It is my property and you are free to download it from this site.

What it does:

  • It mirrors the cgMuscle with all its properties and the Proximal and Distal points.
  • It asigns the Proximal and Distal points to the correct Node slot of the muscle
  • It renames the Proximal and Distal points cgMuscleXX_P or _D accordingly.
  • It can mirror muscles in X, Y or Z, but the mirror point is the 0 coordinate of the Axis chosen, so you may need to reposition your objects to fit this rule (further versions could use an arbitrary object, or a special coordinate)

What it doesnt do

  • It doesnt change the name of the muscle, the muscle is created with the next available cgMuslceXX number.
  • It doesnt try to figure out to which bones should the Proximal and Distal points should be parented to, nor does it tamper with rotation controllers of this points such as Orientation Constraints. This two settings must be done manualy.
  • If the muscle had any Modifier on top, it is disregarded.
  • It cant do batch mirroring, the process must be done one muscle at a time. Future versions can improve on this.
  • For the time being, original Proximal and Distal nodes should be of the type POINT for no special reason but the fact that the nodes created automatically with the muscle are of this type, and the script uses a points .size property to set the new nodes property. This should be corrected also.

Instructions:

  • Donwload the script from the following URL (right-click, save target as) to a location on your hard drive
    http://www.edicionesarchipielago.com/externos/MirrorCgMuscles.ms
    ** Edited: Please always download the newest version from the posts below.

  • From within MAX, select MAXScript menu -> Run Script and point to the file you downloaded.

  • A floating window appears, select the Axis in which you will mirror the muscle.

  • Click the “Mirror Muscle >” button and select the muscle you want to mirror. The new muscle appears and its Proximal and Distal controlers if it had any. CONTINUE WITH THE NEXT STEP

  • You MUST click the “Assign Proximal - Distal” button in order to link this two Nodes to the MUSCLE, for some strange reason, if this was done within the main script, the muscle will collapse into a strange form.

Thats it, continue clicking first the Miror button and then the Assign button for every muscle you want mirrored, and close the floating window.

*One small bug I found is that both MTStart and MTEnd are named $.MTStart internally, so the MTEnd value cannot be passed to the mirrored bone, but this is not me, its the design of the ACT plugins, this needs correcting in future versions.

Ok, thats it… please let me know your expierences and if its working, report any troubles, etc… Good luck every one.

Rafael Polit Jr.
Quito, Ecuador.


#2

Sorry, theres a typo in the lower button: it says Asign instead of Assign, I will correct it soon.

Rafael Polit Jr.
Quito, Ecuador.


#3

thank you for the script.


#4

New Version V1.02beta:

Link: http://www.edicionesarchipielago.com/externos/MirrorCgMusclesV1.02.ms

Ok, Ive been doing some testing and the previous version had a problem with the mirroring coordinates. They where dependant upon which viewport you created the muscle, and that is not acceptable at all, so here’s a new version with this bug corrected, and new features added.

Bug Fixes:

  • Fixed the issue of viewport dependant mirroring to deal with any muscle (the transform matrix is now corrected, I hope! ).

Changes:

  • Operation is now Undoable in two steps: Mirroring the muscle and Assigning Proximal-Distal nodes (in the inverse mode of creation, of course).
  • Proximal and Distal nodes can be anything now, not only Points, although the newly created node is always a POINT.
  • The center for mirroring can now be any object in the scene, or the default World position[0,0,0]. The mirroring still takes place in world coordinates, not in the nodes local transform. So the subject still needs to be aligned with one of the world axes.

Instructions for Selecting a mirror center other than the world (not required, only if needed):

  • Prior to any mirroring, click on the button with the label “World” (which is the node it will use if you dont select one yourself) and click on the object which will be the new center. Remember that its the objects position what matters, not its orientation (which is not used).

Ok, thats it, please leave feedback so I can know how you are using it and if anything goes wrong or if you have a different approach that might be more interesting.

Hey VirtualMesh, Thanks for answering, please be sure to download the new version and to leave feedback so I can know how its going!

Rafael Polit Jr.
Quito, Ecuador


#5

Rafael, I salute you! The script works like a dream. I normally create my own dummy objects, so I’ve only been mirroring the muscles and they work a-okay.

Thanks again.


#6

Hi Piek!

Glad to know its working out. Since Im very new to the muscle system, I have only tested my script under few muscle-construction conditions, so every piece of feedback information is very useful. As I continue to test maybe I come up with new solutions, or with corrections to the one I adopted for version 1.02 (V1.00 was completely wrong!), so please leave feedback as often as possible and be sure to check here out for an eventual new version with more additions or corrections.

Thanks again,

Rafael Polit Jr.
Quito, Ecuador.


#7

Hi Rafa,

Thanks a lot. Your script works great.

I faced one problem with the script. Well i have tried this script with two different PCs. It is working great in 1st system & creating some problem with unother.

It is giving Error , while reading
origMuscle.proximal = void

But My Head of department solved it…

IF we change the line

origmuscle.proximal = undefined
origmuscle.distal = undefined

Then it works fine…

We are wondering why this thing is happening ???
Any way now it’s works fine…

Thnks a lot for really good Script.

Atri Dave


#8

NEW VERSION V1.03
www.edicionesarchipielago.com/externos/MirrorCgMusclesV1.03.ms

Fixes:

  • Proximal and Distal nodes are now set to Undefined instead of Void before mirroring the muscle.
    Changes:
  • Thanks lines have been added as comments in the top of the script to acknowledge Piek for his motor idea, and Atri Dave for the changing of Void for Undefined.

Hi Atri Dave, thanks for the feedback

We are wondering why this thing is happening ???

Me too! :wink: Although after reading a bit in the MaxScript reference, I cannot find any variable being equaled to void, and undefined is the correct procedure. Both work out ok on my Max8 version though, in what version did it failed to work? That could be of some help. Anyway, I have changed this in the new version. Thanks.

Rafael Polit Jr.
Quito, Ecuador.


#9

NEW VERSION V1.04 -
www.edicionesarchipielago.com/externos/mirrorCGMuscle.dlu

Changes:

  • Transformed the Script to a Plugin Max6 to Max8 compatible.

New Instructions:
Instalation:

  • Download the file www.edicionesarchipielago.com/externos/mirrorCGMuscle.dlu
  • Copy the downloaded file to the plugins folder of your max instalation directory (as of max8, the default is C:\Program Files\Autodesk\3dsMax8\plugins)
  • From within Max, enter to the Utilities panel (red hammer tab)
  • Select the More… button from the Utilites rollout.
  • Select the mirrorCGMuscle utility.
  • Click on the Floating Dialog -> button.
  • The rest is the same as before (read instructions in previous posts).

Recomendation:

  • If you use this plugin quite frequently, you can add the Utility as a permanent button by selecting the button next to the Sets button, the only one with a graphic symbol and add the Utility. You can find it under the CG Muscle Utilities sub-section.

Please continue with feedback as often as possible,

thanks
Rafael Polit Jr.
Quito, Ecuador.


#10

[QUOTE=RafaPolit]NEW VERSION V1.04 -
www.edicionesarchipielago.com/externos/mirrorCGMuscle.dlu

why can’t download it ??!!


#11

Hi pcx2002

The Link is good, and the server is running, I can even download it form your reply to my post. Do you think maybe you have security settings which are stoping the download? What message does it bring up when you try to download?

Anyway, just to be sure, try to download by right clicking the link and selecting Save Target As… and select either a download folder or the plugins folder from the maxs installation directory. If the problem continues, try to write here as much info as possible: Operating System, Internet Browser and version, procedure wich you are following. That could yield some answers.

Regards
Rafael Polit Jr.
Quito, Ecuador.


#12

Hi rafael polit

displays can’t connect to the server the time is out
i even can’t open this page: www.edicionesarchipielago.com


#13

could you send the file to me ?
my email: pcx2002cn@yahoo.com.cn
thanks a lot


#14

pcx2002

I have mailed you the plugin. Please comment any suggestions or problems.

Regards,

Rafael Polit Jr.
Quito, Ecuador.


#15

rafael polit
Thanks your mail , thanks thanks
and It works very good


#16

Hi pcx2002,

Glad to know everything is working… let me know anything you think off, problems, etc.

Rafael Polit Jr.
Quito, Ecuador.


#17

RafaPolit,

I downloaded the plugin and installed it in the plugins folder, but when I startup Max, I get a warning that the plugin was not created for this version of Max and will not load. I am using Max 7. Any ideas?

M


#18

Hi alphamail,

Its true, I have just tested it in friends computers with Max 6 and 7 and both read that message you claim. I am a little confussed, as the 3DS Max SDK reads:

3ds Max Market Name: 8.0
3ds Max Plugin Compatibility: 6.0
Microsoft Visual C++ Compiler Version: Visual C++ 7.0 (Visual Studio .NET 2002)

I even downgraded my Visual Studio .NET 2003 so I could compile for Max, but I was under the impression that it would work for versions 6 and up! I will look into it, as I am absolutely new in the SDK realm, although I am somewhat proficient in MaxScript.

Anyway, I have re-enabled the link to version 1.03 so you can download it as a script while I figure out the compatibility issues (please be adviced that the script hasnt been tested in versions lower than 8 either!, but it should work)
www.edicionesarchipielago.com/externos/MirrorCgMusclesV1.03.ms

edit* Please only use the above link if you have versions lower than 8, if you are using version 8, download version 1.04 from previous posts.

Rafa Polit Jr.
Quito, Ecuador.


#19

New Version V1.05
www.edicionesarchipielago.com/externos/MirrorCgMusclesV1.05.mse

Changes:

  • Changed to encrypted script

While I figure out the compatibility issues of plugins, I am posting this scripted version which can be used as any other script in max, except you dont have access to source code.

Please, download this version until I can resolve compatibility issues to reach at least max 7 users.

Rafa Polit Jr.
Quito, Ecuador.


#20

Thank you for the script.
It works great. What a timesaver!
I’m just suprised this feature was not originally included in the ACT plugin.

M