Page 2 of 19 FirstFirst 123412 ... LastLast
Results 16 to 30 of 276

Thread: How to change a rig in 45 scene files?

  1. #16
    automator of tasks xchrisx's Avatar
    Join Date
    Jul 2003
    Location
    Nevada
    Posts
    593
    Blog Entries
    6
    Personally I dont find this that feasible. Its a ton of work and here are a couple hurdles you would encounter right off the bat:

    * The null object with the LScript attached detects it needs to load items from external LWS
    You cannot choose what items from a separate scene to load via load from scene. So you would have to strip a scene of all the stuff you dont want it to load in order to bring in just those objects.

    *load Motion data from the predefined path (as saved earlier) for every keyframe != frame 0
    If you save the motion data out as individual keys, there would need to be a way to get the TCB values / hermite values / etc to be store as well so that you get the same data when you load it back on. Or you can save out data as MOT files (which personally I like better), however you cannot tell it to only load specific ranges or channels because it will overwrite everything when you apply it back on.


    In other words, there might be ways to work around a lot of this stuff by parsing scene files and parsing mot files then creating keys from that data, but it will not be a simple thing to script. Not trying to sound discouraging but this is a major undertaking to make and those are only a few of the hurdles I could see with this.

    -chris
    My Lscript Collection | LinkedIn
    3D Generalist IGT

  2. #17
    Super Member vncnt's Avatar
    Join Date
    Sep 2003
    Location
    Amsterdam
    Posts
    1,602
    Quote Originally Posted by xchrisx View Post
    Personally I dont find this that feasible. Its a ton of work and here are a couple hurdles you would encounter right off the bat:
    Yes it's a lot of work but that didn't stop me from building "LW-link" as well - and that script for Sony Vegas Pro serves me very well right now.

    Quote Originally Posted by xchrisx View Post
    * The null object with the LScript attached detects it needs to load items from external LWS
    You cannot choose what items from a separate scene to load via load from scene. So you would have to strip a scene of all the stuff you dont want it to load in order to bring in just those objects.
    No problem.
    I already have a null on top of each character rig - and it's not very difficult to re-parent the entire hierarchy either.

    Quote Originally Posted by xchrisx View Post
    *load Motion data from the predefined path (as saved earlier) for every keyframe != frame 0
    If you save the motion data out as individual keys, there would need to be a way to get the TCB values / hermite values / etc to be store as well so that you get the same data when you load it back on. Or you can save out data as MOT files (which personally I like better), however you cannot tell it to only load specific ranges or channels because it will overwrite everything when you apply it back on.
    Correct. I noticed "LoadMotion <filename>" and tested with .mot files. They seem suitable.
    Also, there seems to be a solution to check if there are keyframes (other than frame 0).
    Other types of animations can not be directly saved in this way (morphs, dissolve, motion modifiers, etc) so that needs custom file I/O. But this is for the future. Saving .mot files for every child in the hierarchy that has keyframes should be possible with the available LScript commands.

    Quote Originally Posted by xchrisx View Post
    In other words, there might be ways to work around a lot of this stuff by parsing scene files and parsing mot files then creating keys from that data, but it will not be a simple thing to script. Not trying to sound discouraging but this is a major undertaking to make and those are only a few of the hurdles I could see with this.

    -chris
    With parsing it's easy to get illegal .lws files. And you really need to know what to change and how to change it - for each modification. Not very user friendly.

    Ok, I've been doing some LScript scripting (for the first time in my life) and the result is an interface (a custom object script) to explore my needs. It is now capable of saving it's settings to the .lws file and load those settings during .lws loading. For each object holding a RigManager script.

    Attachment 116205

    The first field defines the filename to the external rig in a .lws file.
    The second field now displays the name of the current object but that will become the parent object that holds the hierarchy.
    The third field defines the RigManager folder name - it will hold all sub-folders, one for each "instance".
    The fourth field defines the name of the sub-folder that is going to contain all .mot files.

    The next fields define save/update/delete behaviour.
    During scripting I'll set these to their first item "manual", these settings will give you an idea of their function.

    The the final section currently just holds one option: "Keyframes" (for Position, Rotation and Size).
    I've reserved some space in the code for morphs, master channels and others.

    My next step is to get read access to the external .lws file, retrieve a list of relevant objects and experiment with "LoadElementsFromScene <elements> <filename>".
    Last edited by vncnt; 08-08-2013 at 04:36 AM.

  3. #18
    automator of tasks xchrisx's Avatar
    Join Date
    Jul 2003
    Location
    Nevada
    Posts
    593
    Blog Entries
    6
    Quote Originally Posted by vncnt View Post
    Yes it's a lot of work but that didn't stop me from building "LW-link" as well - and that script for Sony Vegas Pro serves me very well right now.
    I wasn't trying to be a nay-sayer I was just expressing my opinion that it isnt a minor undertaking

    Quote Originally Posted by vncnt View Post
    Correct. I noticed "LoadMotion <filename>" and tested with .mot files. They seem suitable.
    Also, there seems to be a solution to check if there are keyframes (other than frame 0).
    Other types of animations can not be directly saved in this way (morphs, dissolve, motion modifiers, etc) so that needs custom file I/O. But this is for the future. Saving .mot files for every child in the hierarchy that has keyframes should be possible with the available LScript commands.
    Loading motion files for every item works well and I have done it several times in the past to bring in animation from other scene files.

    Quote Originally Posted by vncnt View Post
    With parsing it's easy to get illegal .lws files. And you really need to know what to change and how to change it - for each modification. Not very user friendly.
    Agreed it is not user friendly, but I was referring to getting values from a scene file not writing to. Sometimes the only way to access an attribute is to scan the scene file and search for it.

    Just as a side note, one other thing that has been a pain in the past (for me at least) is that doing any type of LoadFromScene with expressions can cause expressions to break. Primarily I noticed it when objects (for controls) or bones have been cloned. Dont know why but its something to watch out for if you use expressions in your rigs.

    All of that aside, nice work so far
    My Lscript Collection | LinkedIn
    3D Generalist IGT

  4. #19
    Super Member vncnt's Avatar
    Join Date
    Sep 2003
    Location
    Amsterdam
    Posts
    1,602
    Quote Originally Posted by xchrisx View Post
    Just as a side note, one other thing that has been a pain in the past (for me at least) is that doing any type of LoadFromScene with expressions can cause expressions to break. Primarily I noticed it when objects (for controls) or bones have been cloned. Dont know why but its something to watch out for if you use expressions in your rigs.
    Iīll keep that in mind during testing.

    Ok, second impression: Attachment 116335

    Modified the GUI slightly to get the listbox (instead of the popup) updated correctly.
    The listbox contains every NULL in the external LWS, filtered by "Rig Hierarchy Parent Filter".
    The first four fields seem to ripple updates nicely (1 -> 2 -> 3 -> 4) and (2 -> 3 -> 4) and (3 -> 4).

    The "Rig Hierarchy Parent Filter" defaults to "MASTER_Character_*" in order to filter the character (just one per external rig) and this first list item is selected by default. The current "MASTER_Ch*" setting is a demonstration that the listbox indeed updates correctly in case of more than one null object.

    The "Rig Manager Folder" is based on 3 values: "RigManager", scene name and the (pre-)selected Rig Hierarchy Parent.
    These directories will be created in the standard Content directory later.
    Als long as you donīt touch the first 3 fields, the "Rig Manager Folder" can also be set manually but this is not recommended since we need a unique folder for each "rig instance".

    The "Ignore Items/Lights" is needed to filter any Object or Light that shouldnīt be in the hierarchy.

    Currently Iīm only looking at "Keyframes" as "Supported Animation" (the rest is just a reservation) and every object that has keyframes will have these Keyframes saved as .mot files.

    So far so good.

  5. #20
    Super Member vncnt's Avatar
    Join Date
    Sep 2003
    Location
    Amsterdam
    Posts
    1,602
    Third impression: Attachment 116376

    Actions are split into 4 parts now and displayed in logical order.
    All (currently non-supported) Animation selections at the bottom are also saved in the plugin section of the LWS. And loaded during LWS load.

    The "now"-button for Save Animation acts as a test function.
    It succesfully creates the 3 recursive subdirectories in the working directory.

    It creates an array of child items of the currently selected item that needs processing. This of course needs to change into the children of the RigManager item that has the plugin attached.

    And each child item saves a .mot file with the same name as the item.name.

    To assist in finding items that have been re-parented I want to enhance the name of each .mot file with the name/type of the current parent and the name/type of the current children (limited to a maximum to keep the size of the filename to a sane level). Separated by a "@" character.

    This way in many cases it will be possible to identify multiple non-uniquely named items, detect a parent change while having some references to (hopefully unchanged) children as a last resort.
    Even with non-unique item names, like: "NULL (1)", "NULL (2)", etc, it can be possible to identify orphan child objects and re-connect them to the right .mot file. There will still remain some issues with the motion path of re-parented items but that is for later. Maybe not in all cases but for the moment this is good enough.

    Tomorrow Iīll try to register that parent and child data for each item into the array so that itīs available during processing of the .mot files.

  6. #21
    Super Member vncnt's Avatar
    Join Date
    Sep 2003
    Location
    Amsterdam
    Posts
    1,602
    Fourth impression: Attachment 116410

    Each .mot file has a name based on the item name, a separator character "@", number of child items, a separator character "@", and a maximum of 4 child item names (also separated by "@").

    Now writing a routine that can interpret this filename, make decisions and ask the user for advice in difficult cases.

    A re-parented item with unchanged child statistics is easier to recognise.

    EDIT: I just changed the separator before the number of child items into "#" to distinguish between types of data.
    In case there is no parent and/or there are no child items.

    The final format of the filename is:

    ItemName(@ParentName)(#[email protected] e1(@ChildName2(@ChildName3(@ChildName4)))).mot
    Last edited by vncnt; 08-15-2013 at 06:02 AM.

  7. #22
    Super Member vncnt's Avatar
    Join Date
    Sep 2003
    Location
    Amsterdam
    Posts
    1,602
    To avoid situations with .mot files that belong to ambiguous item names Iīve introduced the GrandParentName and the GreatGrandParentName.
    For the moment this should provide enough information to match hierarchy patterns with filenames and provide enough hints in case of re-parented hierarchies.

    The "final" final format of the filename is:

    ItemName(@ParentName(@GrandParentName(@GreatGrandP arentName)))
    (#[email protected](@ChildName2(@Child Name3(@ChildName4)))).mot

    At the moment "RigManager" exports .mot files for all child items, even if they have no keyframes besides frame0.
    So I need to check if there are examples available that can do that efficiently.

    EDIT: ok, haven't seen any useful example but got that working now after some experiments.
    Next, handling of orphaned items (incl. bones, lights and cameras) seems correct but RM triggers on a Light that has seems to have a matching "family". Hmm.
    Last edited by vncnt; 08-17-2013 at 09:20 AM.

  8. #23
    Super Member vncnt's Avatar
    Join Date
    Sep 2003
    Location
    Amsterdam
    Posts
    1,602
    Handling of orphaned .mot files has been fixed.

    Next issues:
    1] Bone.mot files that have duplicates in other parts of the selection tree contain the envelopes of their duplicates.
    2] And why do the duplicate bones not even get selected for exporting .mot files?

    and were introduced after implementing "selective saving" for items that do have more than one key.

    Tried SelectItem() with item.name and item.id and tried SelectByName() but it might have to do with selecting the Object first, before attempting to select the bone that resides under that specific Object.

  9. #24
    Super Member vncnt's Avatar
    Join Date
    Sep 2003
    Location
    Amsterdam
    Posts
    1,602
    The solution: after the recursive SelectChildren routine I used a list of items that was only matched by item.name.
    Added item.id to that check so now itīs fixed (and it stopped overwriting .mot files - thatīs why there were less .mot files than available in the rig hierarchy).

    During the process of debugging Iīve also added information to the filename: "SelectionIndex", as returned by the recursive selectionprocess, and "BoneParentObjectName", the parent Object that is needed for each Bone hierarchy.

    The "final final" final format of the filename is now:

    (SelectionIndex%)ItemName($BoneParentObjectName)(@ ParentName)(#[email protected](@ChildN ame2(@ChildName3(@ChildName4)))).mot

    Note the separator characters: %, $, @ and # that are needed to mark the optional items.

    Current available methods to match .mot files with scene items:
    1. - item.name + (1..4) child.name + parent.name [+ boneparentobjectname] (strong match but no changes to the rig allowed)
    2. - item.name + (1..4) child.name (strong match in case of re-parenting)
    3. - item.name + parent.name (medium strength match, no re-parenting allowed)
    4. - selection index (lossy match, no re-parenting or additional child items allowed)

    The boneparentobjectname match is not yet implemented during automatic matching but itīs easy to make it visible in the Manual Matching dialog.
    The Manual Matching dialog is activated when match method #1 didnīt return a 100% match.
    So the user is always in charge when something has changed.

    Iīve re-enabled the HasKeys() function during export stage so only items that have keyframes in one of their channels will export a .mot file.

    All exported .mot files import correct during import stage.

    Guess the next step is to actually import the rig hierarchy from the external .lws file and reparent it to the null that holds my plug-in: RigMagager.
    Coulnīt find a better name for it, sorry.

  10. #25
    Super Member vncnt's Avatar
    Join Date
    Sep 2003
    Location
    Amsterdam
    Posts
    1,602
    Quote Originally Posted by vncnt View Post
    Guess the next step is to actually import the rig hierarchy from the external .lws file and reparent it to the null that holds my plug-in
    Fixed.

    Final steps: apply Ignore Items/Lights and replace manual actions to: OnLoad, OnEverySave, OnExitSave.

  11. #26
    Super Member geo_n's Avatar
    Join Date
    Aug 2007
    Location
    jpn
    Posts
    4,677
    This looks interesting. How to change a rig in 45 scene files
    Is this a better method than load item from scene?

  12. #27
    Super Member vncnt's Avatar
    Join Date
    Sep 2003
    Location
    Amsterdam
    Posts
    1,602
    Quote Originally Posted by geo_n View Post
    This looks interesting. How to change a rig in 45 scene files
    Is this a better method than load item from scene?
    Actually itīs using a LoadFromScene(ExternalRigFile); and then re-parents the pre-defined MASTER_Character* null object (from the external file) to the null that has the RigManager plug-in. You canīt really control LoadFromScene from an external script so I also need a marker to tell RigManager which Lights and hierarchy parts to ignore (all items starting with "_"). Cameras and Master Plugins are unselected by default so you won't see those in this kind of "instanced" rig. And I also wanted a method, controlled by myself, to link motions to rig controllers in a flexible way.

    After the re-parenting step it will search for motion files in the RigManager directory structure, unique for each scene that contains the RigManager plug-in and unique for each character, and it will automatically load the right motion file to the right rig controller as long you didnīt change the rig.

    But changing the rig is what this is all about: after re-parenting/adding/deleting some parts of the hierarchy in the central rig file --- and only when automatic 100% matching isnīt possible --- the Manual Match dialog ask you what to do with that orphaned motion file that cannot be matched to a recogniseable structure and presents some alternatives (based on child/parent/grandparent/greatgrandparent/boneparentobject/index) that you simply have to confirm.

    And it does this completely automatic during scene load and vice-versa when saving.

    With RigManager I can build hundreds of shots with multiple characters while maintaining the rigs for those characters in one central .lws file.
    And those rigs can become complicated.

    Quote Originally Posted by geo_n View Post
    Is this a better method than load item from scene?
    Yes. LoadFromScene is a manual process. RigManager works without intervention, once setup.

    As long as LW does not support some form of nested scenes I think RigManager will give us flexibility and save us lotīs of time during production of character animation.

    For now it only supports regular keyframes that belong to an object (position/rotation/size but some other channels might be supported already if they are linked to that object - this needs to be tested further) but other parameters that have envelopes might be supported in future versions of RigManager.
    Last edited by vncnt; 08-19-2013 at 02:22 AM.

  13. #28
    Super Member vncnt's Avatar
    Join Date
    Sep 2003
    Location
    Amsterdam
    Posts
    1,602
    Quote Originally Posted by vncnt View Post
    For now it only supports regular keyframes that belong to an object (position/rotation/size but some other channels might be supported already if they are linked to that object - this needs to be tested further) but other parameters that have envelopes might be supported in future versions of RigManager.
    Ehm, just finished some code to save MasterChannels and also Morphs per object.
    Couldnīt resist.

    Filename formats:
    MC#(channel.name).env
    MORPH#(object.name)%(channel.name).env

    Guess I need to tweak the filename for Morphs to include parent info, just like the .mot filename format.
    The envelopes are placed in the same directory as the .mot files.

    Unfortunately it took some time to deal with channelgroups and to write my own SaveEnvelope(channel,filename) function to be able to save and load envelopes when I want to. Especially the handling of curve types. In particular, Hermite and Bezier seem not completly documented so you have to figure it out yourself.

    Next step is to load those envelopes back into their channels and of course build the triggers that can automatically start the four steps: update hierarcy, update animation, save animation and delete hierarcy.
    Last edited by vncnt; 08-19-2013 at 03:35 PM.

  14. #29
    Super Member geo_n's Avatar
    Join Date
    Aug 2007
    Location
    jpn
    Posts
    4,677
    I wonder if this can also be used to deal with issues of slightly mismatch hierarchy when merging only motion envelopes from fbx rig files to a master rig lws file? http://forums.newtek.com/showthread....se-mocap/page5

    Or this only works with lw format?

  15. #30
    Super Member vncnt's Avatar
    Join Date
    Sep 2003
    Location
    Amsterdam
    Posts
    1,602
    Quote Originally Posted by geo_n View Post
    I wonder if this can also be used to deal with issues of slightly mismatch hierarchy when merging only motion envelopes from fbx rig files to a master rig lws file? http://forums.newtek.com/showthread....se-mocap/page5

    Or this only works with lw format?
    RM stores & reloads the motion channels x/y/z/h/p/b/X/Y/Z or individual items in .mot format and individual channels in .env format.

    Would it assist the retargetting process if I added calculations during reload of .mot/.env?
    Can you describe exactly what steps would be involved if the rig had different dimensions when re-opening a RM-controlled rig?
    For instance would it help if .mot and (some) .env data would calculate the difference between position at frame zero and then add that to every other keyframe?
    How much more is involved?
    Last edited by vncnt; 08-20-2013 at 02:26 AM.

Page 2 of 19 FirstFirst 123412 ... LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •