How to create a parented null on each object selected

Issues concerning rigging & Face Robot...
User avatar
probiner
Posts: 127
Joined: 17 Apr 2013, 11:52

How to create a parented null on each object selected

Post by probiner » 23 Dec 2013, 16:58

Ok, I've search and found nothing, so here it goes.

I've got a bunch of nulls, constrained and want to create offseet nulls for each of them. It's a bit tedious to create, parent and match transforms for each. Is there a common way to generate offset nulls in mass?

Thank you.

missingkey
Posts: 91
Joined: 19 Dec 2012, 18:16

Re: How to create a parented null on each object selected

Post by missingkey » 23 Dec 2013, 18:40

Code: Select all

si = Application
sel = si.Selection

zeroTfm = XSIMath.CreateTransform()
for each in sel:
    offNull = each.AddNull( each.Name + "_Offset" )
    offNull.Kinematics.Local.Transform = zeroTfm
this will create offset nulls from your selection.
Last edited by missingkey on 28 Dec 2013, 03:41, edited 4 times in total.

User avatar
probiner
Posts: 127
Joined: 17 Apr 2013, 11:52

Re: How to create a parented null on each object selected

Post by probiner » 23 Dec 2013, 19:41

Works like a charm! Thanks

I tried to keep only the new nulls lines like:

Code: Select all

sel2 = si.Selection
Application.Selection = sel2 - sel
sel are type 'instance' and can't subtract :)

Anyways I can Isolate the nulls, run the script, hide the old ones and keep on doing my thing.
Cheers :-bd
Last edited by probiner on 23 Dec 2013, 20:03, edited 1 time in total.

missingkey
Posts: 91
Joined: 19 Dec 2012, 18:16

Re: How to create a parented null on each object selected

Post by missingkey » 23 Dec 2013, 19:46

probiner wrote:Works like a charm! Thanks

I tried to keep only the new nulls lines like:

Code: Select all

sel2 = si.Selection
Application.Selection = sel2 - sel
sel are type 'instance' and can't subtract :)

Anyways I can Isolate the nulls, run this hide the old ones and keep on doing my thing.
Cheers :-bd
umm, those lines aren't gonna work for quite a few reasons ;)

I'm unclear on what your asking for now.

User avatar
probiner
Posts: 127
Joined: 17 Apr 2013, 11:52

Re: How to create a parented null on each object selected

Post by probiner » 24 Dec 2013, 01:35

Ah! Basically I was looking forward the script to finish leaving the new nulls selected instead of their parents. So one can go on change they're display, give properties, etc.
But like I said, something doable with Isolation Mode. (Isolate the Nulls in question, apply script, click the Isolation '-' sign, so the new ones are left behind).

Thanks again :)

missingkey
Posts: 91
Joined: 19 Dec 2012, 18:16

Re: How to create a parented null on each object selected

Post by missingkey » 24 Dec 2013, 07:05

ah i see now. This should do it. Adding them to a group would make the most sense, but oh well. This selects the offset nulls after creating them.

Code: Select all

si = Application
sel = si.Selection

zeroTfm = XSIMath.CreateTransform()
selList = []
for each in sel:
    offNull = each.AddNull( each.Name + "_Offset" )
    offNull.Kinematics.Local.Transform = zeroTfm
    selList.append( offNull )

si.SelectObj( selList )

It's also rather easy to change their display in the script also.
Last edited by missingkey on 28 Dec 2013, 03:40, edited 5 times in total.

User avatar
probiner
Posts: 127
Joined: 17 Apr 2013, 11:52

Re: How to create a parented null on each object selected

Post by probiner » 25 Dec 2013, 22:56

Yup that does it! :ympeace:

True, a group it's probably best.

I was wondering around and found this:
http://www.softimageblog.com/archives/209

Which had this script: . Though it always give the the error: Select Component. And I had selected it.

Guess I really need to up my scripting game to solve this and other stuff more at ease :P

Cheers

missingkey
Posts: 91
Joined: 19 Dec 2012, 18:16

Re: How to create a parented null on each object selected

Post by missingkey » 26 Dec 2013, 03:32

are you selecting a component when you run the dorrito script? i.e. vertex, edge, face

the script creates clusters and nulls based on your component selection. Not object selection.

the second script sets up the static kine state expression, so you don't get double transforms.

User avatar
probiner
Posts: 127
Joined: 17 Apr 2013, 11:52

Re: How to create a parented null on each object selected

Post by probiner » 26 Dec 2013, 12:01

Yes, I was selecting the intended component before running the script.

Found also this one and runs as expected :)
http://xsisupport.com/2012/03/17/python ... omponents/. I added your selection bit and now looks like this: http://pastebin.com/RF2GNK2H. So it leaves the new nulls selected.

Trying to dig up how to create a group and add Static Kinestate to get this:
Like:

-Your script
-Create Group
-Stephen's Script
-CreateGroup
-Add Static Kinestate property
-Steven's Script (which also giving error)

One-Click "Doritos" rig :) But doing it by hand with the scripts seperated is probably best though, because allows tweaking.

Cheers

missingkey
Posts: 91
Joined: 19 Dec 2012, 18:16

Re: How to create a parented null on each object selected

Post by missingkey » 26 Dec 2013, 17:58

cool. You will still need to figure out how to use the dorritos. As in how to tie them to your rig.

IMO, sticky-face controllers aren't as useful as they seem cool. For an animator, it can get confusing. "Why are my controllers moving when they're not even animated?" It can be visually distracting to say the least.

I'll use them on a shape based rig (detailers) to provide some extra "joint" style deformers/controllers, so an animator can customize the shapes a bit better, or just ignore them completely.

goodluck!

User avatar
probiner
Posts: 127
Joined: 17 Apr 2013, 11:52

Re: How to create a parented null on each object selected

Post by probiner » 27 Dec 2013, 02:36

This was by request of the animator. He was tired of being too dependent on shapes. So he asked for skin controls and lattices on top of everything. I think/hope he won't be confused but happy. I'm following AnimSchool's Malcom Softimage Rig. He has a particularity I couldn't replicate a shape on the final head that copies the base, had a CopyOp applied to it... For now I'll do it with ICE or Clone, but found it interesting.

Just to sum up my findings for anyone that might be come across this:

1 - Apply to the face duplicate this ICE compound on the Shape construction to follow the base face rig.
2 - Create Nulls Constrained to Clusters with this script. Then use EtRenamer, put them somewhere on the hierarchy and Group for organization.
3 - Create OffsetNulls with this script and Group.
4 - OffsetNulls' Parents' KineGlobal to OffsetNulls' Static_KineState. Several Options: A) Select the Constrained Nulls with branch selection, "Select Child Nodes" and use this script. B) Modified version of the script where you just have to select the OffsetNulls. C) Use this script to apply apply this ICE Compound. Or

Stephen's script to open a file dialog and apply a compound is great even for single use. It applies it in the determined construction mode and uses pick sessions. Going to make a shortcut for it :)

Now I can focus more on results and less on setup. Thanks again missingkey.

Cheers
Last edited by probiner on 29 Dec 2013, 07:07, edited 3 times in total.

User avatar
probiner
Posts: 127
Joined: 17 Apr 2013, 11:52

Re: How to create a parented null on each object selected

Post by probiner » 27 Dec 2013, 16:49

I see what you mean now about being distracting, so I'm making them really small and hidden on playback. Pity wireframe opacity doesn't work on wireframe item..
Also seems to take a performance hit. Need to know the specifics of control needed before going kawabanga on extra controls :D (64 by now, not hard to go "null-happy"). Don't know if having ICE to animate the KineState instead of an expression helps too (keep having this error for Steve's script)
Hidden content: [ Show ]
# ERROR : Traceback (most recent call last):
# File "<Script Block >", line 28, in <module>
# setupStaticState()
# File "<Script Block >", line 14, in setupStaticState
# defKineState = a.Properties("Static_KineState")
# AttributeError: 'NoneType' object has no attribute 'Properties'
# - [line 14]
Cheers

missingkey
Posts: 91
Joined: 19 Dec 2012, 18:16

Re: How to create a parented null on each object selected

Post by missingkey » 27 Dec 2013, 18:30

lol, 64 detailers seems a bit much for just the face. I would try to look at where/why they setup face mocap markers where they do, and go from there. You need to allow your animator to simulate the muscular contractions, stretching, and subtle nuances in the face as easy as possible. Having to animate 20 extra controls to get a cheek shaped the way you want, is not usually ideal or preferred IMO.

The idea is to use less shapes, and less joint defomers symbiotically, to make for a really good, really simple, articulate face rig. The joints alleviate the need for dozens and dozens of extra shapes for all those nuances. But the shapes give you the art directable look for posing, and ease of use rigging.

btw, in your error. "a" is not being set correctly. That's why it can't find "Properties".

User avatar
probiner
Posts: 127
Joined: 17 Apr 2013, 11:52

Re: How to create a parented null on each object selected

Post by probiner » 29 Dec 2013, 07:16

Thanks for the guidelines. I'm sure when he gets back from holidays vacations he'll rant his feedback at me :D And then I'll have a better notion on where these are needed.

As for the script error, it was my fault for not selecting the constrained and then the offset nulls before running it. Updated the recipe post with that info.
Makes more sense to me to select the Offset nulls (child) since the hierarchy can change in between. I looked here in the sdk and wasn't that helpfull, since apparently I can't use those commands straight up. But when I pressed Shift+Alt+Up I was able to get the construct from the console to select the parents:

Code: Select all

app = Application
app.SelectNeighborObj(app.Selection, 0, "NODE", True)
Makes the scripts more stack-able in a One-click version. Only thing missing is setting the group and apply the display options. But I'm probably investing too much time by now on automation side, which is fine enough, and not on the results side :P

Cheers

missingkey
Posts: 91
Joined: 19 Dec 2012, 18:16

Re: How to create a parented null on each object selected

Post by missingkey » 29 Dec 2013, 21:26

investing a little time in automation is always good.

I'm still a little unclear on what your trying to achieve now. But nonetheless, Here's a slightly modified version of what I wrote to show how to set parameters on the offset nulls.

Code: Select all


si = Application
sel = si.Selection
log = si.LogMessage

zeroTfm = XSIMath.CreateTransform()
curModel = si.SIGetModel( sel[0] )
priIcon = 4
offSetCol = ( 0.25, 0.50, 0.75 )

selList = []
for each in sel:

    offNull = each.AddNull( each.Name + "_Offset" )
    offNull.Kinematics.Local.Transform = zeroTfm
    offNull.ActivePrimitive.Parameters( "primary_icon" ).Value = priIcon

    disProp = offNull.AddProperty( "Display Property" )
    disProp.Parameters( "wirecolorr" ).Value = offSetCol[0]
    disProp.Parameters( "wirecolorg" ).Value = offSetCol[1]
    disProp.Parameters( "wirecolorb" ).Value = offSetCol[2]

    selList.append( offNull )
    
si.CreateGroup( "offSetGrp", selList, curModel )
si.SelectObj( selList )

There's probably a dozen way to do it, but this was quick. It should be fairly readable.

User avatar
mattmos
Posts: 445
Joined: 02 Dec 2009, 16:59

Re: How to create a parented null on each object selected

Post by mattmos » 31 Dec 2013, 00:23

Interesting thread! Have you thought about using locations to constrain the nulls rather than the traditional methods? Its fairly re-usable once you have the compounds built - ie use a standard set of nulls to define a set of locations on the mesh, then another compound to read those and set the global kine of the parent nulls. Also you can keep it live while testing and freeze the location data once you're happy with the placement.

Post Reply

Who is online

Users browsing this forum: No registered users and 20 guests