[Closed] Parent/Child and scripted helpers
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.
Are you trying to do
helperObjs=for x in objects where superClassOf x==helper collect x
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
)
)
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.
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?
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.
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?
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?