home |  downloads |  help  |  forum  |  contact us 
Welcome, Guest. Please login or register.
Did you miss your activation email?
May 25, 2013, 04:52:40 AM

Login with username, password and session length
Search:     Advanced search
fragMOTION 1.2.2 Released!
2787 Posts in 689 Topics by 789 Members
Latest Member: seanfisher7886
* Home Help Search Login Register
+  Fragmosoft Forum
|-+  fragMOTION
| |-+  Scripting
| | |-+  GetTextureByPath
« previous next »
Pages: [1] Go Down Print
Author Topic: GetTextureByPath  (Read 610 times)
Richcat
Newbie
**
Posts: 32


View Profile
GetTextureByPath
« on: November 24, 2011, 04:13:04 PM »

I'm trying to write a script to export an animated mesh to a text file to import into a game.
From reading the posts and scripts people had kindly shown here and the info in the FragmotionType library I've got as far as getting to print the correct Frames, Frame Rate, number of Mats used, Animation name but just canot get anywhere with getting the Path of the Texture using GetTextureByPaths.
I'm very new to this so its probably a silly error and my lack of understanding of lua scripting - so far its been a lot of trial and error, copying and a pasting etc, but has its rewarding moments when it works.  Grin

Any help or comments pointers in right direction, would be a great help.

Script so far - along way to go Smiley

--Start Script
editChar:ClearOutput();         --Clear the output window
local pAnim = IUserObject(editChar:GetSelAnimation());      --get pointer to the selected animation (IAnimation)
if (pAnim:isSet()) then                                                    -- if there is an anim currently selected
local num1 = pAnim.NumFrames;
   print("frames ".. num1 .."f");
local num2 = pAnim.FPS;
pAnim.FPS = num2;
        print("framerate "..num2);
local mod = editChar:GetModel();
local t = mod:TextureCount();
   print("MATS "..t );
local dwAnimID = pAnim:GetName();
   print(dwAnimID)
local map1 = IUserObject(editChar:GetModel());
local map2 = map1:GetTextureByPath();
print(map2)
end
Logged
fragmo
Administrator
Not A Newbie
*****
Posts: 10664



View Profile
Re: GetTextureByPath
« Reply #1 on: November 27, 2011, 04:26:39 PM »

if you have the texture object you want, the path can be accessed like this

local path = tex.Path;  // tex here is an IUserObject

IModel::GetTextureByPath is only useful to find duplicated textures
Logged
Richcat
Newbie
**
Posts: 32


View Profile
Re: GetTextureByPath
« Reply #2 on: November 28, 2011, 04:41:45 AM »

Thanks Fragmo

I'll give that a go.

Rich
« Last Edit: November 28, 2011, 04:43:30 AM by Richcat » Logged
Richcat
Newbie
**
Posts: 32


View Profile
Re: GetTextureByPath
« Reply #3 on: November 29, 2011, 03:36:09 PM »

Thanks Fragmo
Just to let know I got it working with your pointer  Cool

local tex =IUserObject(editChar:GetSelection());
local texmap = tex:GetName();
local texmap1 = tex.Path;
       print(texmap1);
end
Logged
Pages: [1] Go Up Print 
« previous next »
Jump to:  

Powered by MySQL Powered by PHP Fragmosoft Forum | Powered by SMF 1.0.8.
© 2001-2005, Lewis Media. All Rights Reserved.
Valid XHTML 1.0! Valid CSS!