PDA

View Full Version : How To Achieve Pose Saving Without Pen Holder!


shalabology
09-08-2009, 08:57 PM
no dont misunder stand me i am a big fan of paul neale , literally i am , but i deemed having something like his pen holder that i can write myself , i opened his but didnt get as much of it ,any simple idea getting into this via scripting?

IkerCLoN
09-08-2009, 11:23 PM
You'll need some scripting, but what you need is to store the objects transformation, and then load it again. It's not quite hard to create a little tool that writes this on a file (let's say a file per pose) and then read and apply it again.

Here I show you one thing I started to write time ago, but never finished. Maybe it's useful to you. Remember several things before running it:

- You need to have a 'temp' folder on your C:\ hard drive.
- Create 8 points with their default name. Since I coded a little thumbnail thingie, create a camera that looks at those points, and if you want something to render, create also some spheres and parent each one to each point.
- It only saves one 'pose' for all the points at the same time.

This code is very basic but you can make it grow until it satisfies your needs ;-)


closeRolloutFloater rof
rollout test1 "Test" width:119 height:179
(
fn SavePos object =
(
pointsArr = #($Point01,$Point02, $Point03,$Point04,$Point05,$Point06, $Point07,$Point08)
out_name = ("C://temp//testpos2.plc")
out_file = createfile out_name
openFile "C://temp//testpos2.plc"

for i = 1 to pointsArr.count do
(
format "$%\n%\n" pointsArr[i].name pointsArr[i].pos to:out_file
)
close out_file
)

fn LoadPos object =
(
obj_array = #()
pos_array = #()
in_name = ("C://temp//testpos2.plc")
in_file = openFile in_name
if in_file != undefined then
(
while (not eof in_file) do
(
num_objs = readValue in_file
append obj_array num_objs
num_pos = readValue in_file
append pos_array num_pos
)
close in_file
)

for i = 1 to obj_array.count do
(
obj_array[i].pos = pos_array[i]
)

)

button btn1 "Save" pos:[9,121] width:44 height:43
button btn2 "Load" pos:[63,121] width:46 height:43

bitmap bmp1 "Bitmap" pos:[9,8] width:100 height:100
on btn1 pressed do
(
SavePos $
myPic = render camera:$Camera01 outputSize:[100,100] outputFile:"test1.bmp" vfb:off
test1.bmp1.bitmap = myPic
)
on btn2 pressed do
(
LoadPos $
)
)

rof=newrolloutfloater "test" 130 200
addrollout test1 rof

CGTalk Moderation
09-08-2009, 11:23 PM
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.