PDA

View Full Version : Parent Child and scripted helpers


lehthanis
07-03-2008, 06:52 PM
Hi all...I think the reason I'm not getting any help on my export script from you guys is because I'm not being specific enough...So I've decided that a point helper would be great for specifying an origin...I've just gotta figure out how to detect it...

Currently I'm using a loop through all the geometry in a selection...


allObj = for o in selection where findItem GeometryClass.classes (classof o) > 0 collect o


I need to adjust that to include point helpers...

I imagine the best way would be to check for children of the type scripted point helper, and evaluate the point helper from there right? I have no idea how to read heirarchy from objects.

lehthanis
07-03-2008, 08:09 PM
Weird...double posted for some reason....mods delete one plz? ;)

PEN
07-03-2008, 08:38 PM
Are you trying to do

helperObjs=for x in objects where superClassOf x==helper collect x

lehthanis
07-03-2008, 08:44 PM
Would that be better than:


if allObj[i].children.count >0 then
for c=allObj[i].children.count to 1 by -1 do
if allObj[i].children[c].name == "X-Plane Anim Rotation" then
(
ANIMRot = true
)


Because The above method is working...ANIMRot is returning true.

Now I just need to be able to get the parameters from the scripted helper once its found...your code looks much better...

given my code...and the following scripted helper...how can I pull those properties?


plugin Helper XPlaneObj8AnimRotate
name:"X-Plane Anim Rotation"
classID:#(0x24d578c3, 0x7572756)
extends:Point
replaceUI:true
(
parameters main rollout:XPlaneObj8AnimRotateParams
(
simDataRef type:#string ui:txtDataRef default:"sim/"
XRot type:#float ui:spnXRot
YRot type:#float ui:spnYRot
ZRot type:#float ui:spnZRot
CCWAngle type:#float ui:spnCCWAngle
CWAngle type:#float ui:spnCWAngle
SimMin type:#string ui:txtSimMin
SimMax type:#string ui:txtSimMax
)
rollout XPlaneObj8AnimRotateInfo "X-Plane Anim Rotation" width:162 height:319
(
label lab1 "This mesh will be"
label lab2 "designated as"
label lab3 "ANIM_Rotate"
)
rollout XPlaneObj8AnimRotateParams "Rotation Parameters" width:162 height:319
(
edittext txtDataRef "Sim DataRef: " fieldwidth:135 labelOnTop:true
spinner spnXRot "X Rotation: " range:[0,1,1] scale:0.1 fieldwidth:50
spinner spnYRot "Y Rotation: " range:[0,1,1] scale:0.1 fieldwidth:50
spinner spnZRot "Z Rotation: " range:[0,1,1] scale:0.1 fieldwidth:50
spinner spnCCWAngle "CCW Angle: " range:[-360,360,0] scale:0.1 fieldwidth:50
spinner spnCWAngle "CW Angle: " range:[-360,360,0] scale:0.1 fieldwidth:50
edittext txtSimMin "DataRef Min: " align:#right fieldwidth:59
edittext txtSimMax "DataRef Max: " align:#right fieldwidth:59
)
)

lehthanis
07-03-2008, 08:50 PM
I think replacing that big if for if combo with your code woudl be better...but I'm not sure how it all lines up.

lehthanis
07-03-2008, 08:55 PM
Actually...I already have code that has all of those parameters as a simplemod that I can apply to the geometry...and I'm already coded to retrieve those parameters from the simplemod...

Would it be easier and equally as intuitive to require that the point helper I just posted be set as a child to specify pivot point ALONG WITH the simplemod? That way I don't have to check for children for each object...I only have to check for children when I see that specific simplemod...then I grab the parameters from the simplemod, and use the point helper to determine the pivot...right?

lehthanis
07-03-2008, 10:58 PM
I got this working actually...I am using a simplemod with all the parameters for the animation on it...

During my export, I evaluate the modifiers on each piece of geometry, and if the modifier is the rotation modifier, I look for children. Here's the code:


ANIMPivots = for m in allObj[i].children where classof m == XPlaneObj8AnimRotatePivot collect m
If ANIMPivots.count >0 then
(
ANIMRotPivot = ANIMPivots[1].pivot
ANIMRotPivotX = FormattedPrint ANIMRotPivot.X format:".6f"
ANIMRotPivotY = FormattedPrint ANIMRotPivot.Y format:".6f"
ANIMRotPivotZ = FormattedPrint ANIMRotPivot.Z format:".6f"
)


This is working...quite nicely...except for one thing...and I mention it in my other thread...Its the scale/rotate that I do on the snapshotmeshes...I'm going to start another thread for that.

In the meantime if anyone can see a better way to evaluate the children as opposed to directly referring to ANIMPivots[1]...I'm all ears...I'd love to loop through them instead.

PEN
07-03-2008, 11:35 PM
So did you guys ever end up using my car rig?

I'm still not all that sure what it is you are trying to do?

lehthanis
07-03-2008, 11:39 PM
Car rig? Confusing me with someone else?

Check the thread I just posted to solve what MAY be my last problem for now...

This threads problem is sorta solved...BUT...its not efficient...

I'm creating a collection of helpers...but when I actually call it, I call it by the first one in the list...using the number 1...Isn't there a more appropriate way to do that?

PEN
07-04-2008, 01:12 AM
Lockheed Martin IT
Pensacola, USA


They purchased one of my rigs.

lehthanis
07-04-2008, 01:16 AM
Ohhh...no clue...I'm not really a part of the main corporate office...I'm an engineer on a small IT contract to the Navy to build and maintain simulators for Physiology training. Unless you're the guy we bought a helicopter model from not too long ago?

PEN
07-04-2008, 01:21 AM
Nope, that wasn't me. well sounds to me like you need some Max script training and real fast.

lehthanis
07-04-2008, 01:23 AM
Yeah...though I'm sooo close to being done with this script...I've come a long way actually.

All I really need to do to make it useable at this point is to figure out how to rotate and scale the point helper about its parents pivot point.

PEN
07-04-2008, 01:27 AM
Look up

in coordsys

CGTalk Moderation
07-04-2008, 01:27 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.