Sorry to ask yet another silly question, I have already got all the info I could ever want from this thread
, just hmm.. in my bid to convert my stuff to object model (and making some more scripts to keep me amused) I'm a bit unsure how to match an object's center to another object.... e.g. how to replace :
Code: Select all
'Store oDupe's SRT to use for matching up oMerge's Center
oDupeScaleX = oSelecto.Kinematics.Global.Parameters("SclX").Value
oDupeScaleY = oSelecto.Kinematics.Global.Parameters("SclY").Value
oDupeScaleZ = oSelecto.Kinematics.Global.Parameters("SclZ").Value
oDupeRotX = oSelecto.Kinematics.Global.Parameters("RotX").Value
oDupeRotY = oSelecto.Kinematics.Global.Parameters("RotY").Value
oDupeRotZ = oSelecto.Kinematics.Global.Parameters("RotZ").Value
oDupePosX = oSelecto.Kinematics.Global.Parameters("PosX").Value
oDupePosY = oSelecto.Kinematics.Global.Parameters("PosY").Value
oDupePosZ = oSelecto.Kinematics.Global.Parameters("PosZ").Value
'Match oMerge's Center to oDupe's SRT
Translate oMerge, oDupePosX, oDupePosY, oDupePosZ, siAbsolute, siGlobal, siCtr, siXYZ, , , , , , , , , , 0
Rotate oMerge, oDupeRotX, oDupeRotY, oDupeRotZ, siAbsolute, siGlobal, siCtr, siXYZ, , , , , , , , 0
Scale oMerge, oDupeScaleX, oDupeScaleY, oDupeScaleZ, siAbsolute, siGlobal, siCtr, siXYZ, , , , , , , , 0
with something more like...
Code: Select all
'Match oMerge's Center to oDupe's SRT
oMerge.Kinematics.Local.Parameters("PSclX").Value = oSelecto.Kinematics.Global.Parameters("SclX").Value
oMerge.Kinematics.Local.Parameters("PSclY").Value = oSelecto.Kinematics.Global.Parameters("SclY").Value
oMerge.Kinematics.Local.Parameters("PSclZ").Value = oSelecto.Kinematics.Global.Parameters("SclZ").Value
oMerge.Kinematics.Local.Parameters("PRotX").Value = oSelecto.Kinematics.Global.Parameters("RotX").Value
oMerge.Kinematics.Local.Parameters("PRotY").Value = oSelecto.Kinematics.Global.Parameters("RotY").Value
oMerge.Kinematics.Local.Parameters("PRotZ").Value = oSelecto.Kinematics.Global.Parameters("RotZ").Value
oMerge.Kinematics.Local.Parameters("PPosX").Value = oSelecto.Kinematics.Global.Parameters("PosX").Value
oMerge.Kinematics.Local.Parameters("PPosY").Value = oSelecto.Kinematics.Global.Parameters("PosY").Value
oMerge.Kinematics.Local.Parameters("PPosZ").Value = oSelecto.Kinematics.Global.Parameters("PosZ").Value
I thought I was onto the center with pivot / PPos etc since hmm.. .something like ..
Code: Select all
set oSelecto = Selection(0)
oSelecto.Kinematics.Local.Parameters("PPosX").Value = 5
will move the objects center... am totally confused to be honest. To me the pivot position I thought would just be for a transform, it works to move the center tho.. I must be being an idiot somewhere hehe.
It makes no difference to the script really, just something that has been bugging me for a week now that I cant seem to find in manual. Apart from this I think I'm a convert to object model way since it makes more sense I guess, was really enjoying learning coding till I came up against that bug with setvalue, kinda killed the joy. Now that I realise it was mostly me being dumb and I'm slowly re-discovering the fun hehe, thanks again
. For most part its gone fine and with some silly tests (dunno how to time them properly so just counting seconds in my head) my scripts seem to be about twice the speed now
Edit:
http://pastebin.com/PZs4zzQP is the full script that is mostly working, with the ppos lines commented out at around line 350-360 or so. The code is far from finished, I'v just been concentrating on converting things to object model and fixing bugs, tiny amount of new functionality hehe. The way Iv been checking to see if the center move has been working is just create a sphere, move it away from 0,0,0 and create a model for it, reselect the sphere and run the script... If there's other things I still have that need to be converted I'd love to know