FBX SDK Programmeres Guide 2011
Total Page:16
File Type:pdf, Size:1020Kb
FBX SDK FBX SDK Programmer’s Guide 2011 April 2010 Autodesk® FBX® 2011 SDK © 2010 Autodesk, Inc. All rights reserved. Except as otherwise permitted by Autodesk, Inc., this publication, or parts thereof, may not be reproduced in any form, by any method, for any purpose. Certain materials included in this publication are reprinted with the permission of the copyright holder. The following are registered trademarks or trademarks of Autodesk, Inc., and/or its subsidiaries and/or affiliates in the USA and other countries: 3DEC (design/logo), 3December, 3December.com, 3ds Max, Algor, Alias, Alias (swirl design/logo), AliasStudio, Alias|Wavefront (design/logo), ATC, AUGI, AutoCAD, AutoCAD Learning Assistance, AutoCAD LT, AutoCAD Simulator, AutoCAD SQL Extension, AutoCAD SQL Interface, Autodesk, Autodesk Envision, Autodesk Intent, Autodesk Inventor, Autodesk Map, Autodesk MapGuide, Autodesk Streamline, AutoLISP, AutoSnap, AutoSketch, AutoTrack, Backburner, Backdraft, Built with ObjectARX (logo), Burn, Buzzsaw, CAiCE, Civil 3D, Cleaner, Cleaner Central, ClearScale, Colour Warper, Combustion, Communication Specification, Constructware, Content Explorer, Dancing Baby (image), DesignCenter, Design Doctor, Designer's Toolkit, DesignKids, DesignProf, DesignServer, DesignStudio, Design Web Format, Discreet, DWF, DWG, DWG (logo), DWG Extreme, DWG TrueConvert, DWG TrueView, DXF, Ecotect, Exposure, Extending the Design Team, Face Robot, FBX, Fempro, Fire, Flame, Flint, FMDesktop, Freewheel, GDX Driver, Green Building Studio, Heads-up Design, Heidi, HumanIK, IDEA Server, i-drop, ImageModeler, iMOUT, Incinerator, Inferno, Inventor, Inventor LT, Kaydara, Kaydara (design/logo), Kynapse, Kynogon, LandXplorer, Lustre, MatchMover, Maya, Mechanical Desktop, Moldflow, Moonbox, MotionBuilder, Movimento, MPA, MPA (design/logo), Moldflow Plastics Advisers, MPI, Moldflow Plastics Insight, MPX, MPX (design/logo), Moldflow Plastics Xpert, Mudbox, Multi-Master Editing, Navisworks, ObjectARX, ObjectDBX, Open Reality, Opticore, Opticore Opus, Pipeplus, PolarSnap, PortfolioWall, Powered with Autodesk Technology, Productstream, ProjectPoint, ProMaterials, RasterDWG, RealDWG, Real-time Roto, Recognize, Render Queue, Retimer,Reveal, Revit, Showcase, ShowMotion, SketchBook, Smoke, Softimage, Softimage|XSI (design/logo), Sparks, SteeringWheels, Stitcher, Stone, StudioTools, Topobase, Toxik, TrustedDWG, ViewCube, Visual, Visual LISP, Volo, Vtour, Wire, Wiretap, WiretapCentral, XSI, and XSI (design/logo). Python is a registered trademark of Python Software Foundation. All other brand names, product names or trademarks belong to their respective holders. Disclaimer THIS PUBLICATION AND THE INFORMATION CONTAINED HEREIN IS MADE AVAILABLE BY AUTODESK, INC. "AS IS." AUTODESK, INC. DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE REGARDING THESE MATERIALS. Contents Chapter 1 Welcome to FBX SDK . 1 Chapter 2 Introduction . 3 What’s new/What’s changed . 3 What you must know . 4 What is Autodesk FBX technology . 5 FBX SDK features . 11 Scene elements supported . 11 File formats imported and exported . 12 Texture file formats embedded or referenced . 13 Sample programs and tutorials . 13 Platform requirements . 13 Sources of information . 14 Naming conventions . 15 Getting technical support . 15 Chapter 3 Installing and Configuring . 17 Recommended development environments . 17 Downloading and installing . 18 Chapter 4 Sample programs . 25 Tutorial programs . 25 Brief sample programs . 26 ImportExport tutorial program . 31 SceneTreeView tutorial program . 32 SceneTreeView: the user interface . 33 SceneTreeView: Organization of the project . 33 SceneTreeView: the main logic . 34 CubeCreator tutorial program . 34 CubeCreator: Organization of the Project . 35 iii CubeCreator: The user interface . 36 CubeCreator: Location of texture file at run time . 38 CubeCreator: The main logic . 39 Building and running the sample programs . 39 Chapter 5 Getting started with file import/export . 41 Managing memory with the SDK manager . 41 Creating an empty scene . 44 Creating a file importer . 44 Checking version numbers . 44 Error handling . 45 Loading all or part of an import file . 45 Saving all or part of a scene . 46 Embedding media in FBX files . 46 Chapter 6 Traversing the Scene Graph . 49 Introducing the FBX scene . 49 Creating a scene and getting its root node . 50 Getting child nodes recursively . 51 Most relationships are two-way . 52 Getting the properties of a node as a point in space . 52 Getting the attribute type and contents of a node . 53 Chapter 7 Applying Textures and Materials to Meshes . 57 Creating the mesh for a cube . 57 Creating a mesh object . 57 Creating the cube’s vertices, faces, and normals . 58 Instancing: sharing a mesh (or other node attribute) . 59 Using layers to control how a model is rendered . 60 Layers contain materials, textures, UV, and other layer elements . 60 Using layer 0 to store a normal to each face . 61 Creating layer elements for materials and textures . 63 Managing textures and other media files . 65 Creating a texture object for a texture file . 65 Applying a texture to a cube . 65 Embedding media files in an FBX file . 66 Processing FBX files that contain embedded media . 66 Processing scene files with references to media . 66 Managing materials . 67 Creating a material . 67 Applying a material to the faces of a cube mesh . 67 Chapter 8 Animating a Scene . 69 Working with a camera . 69 Creating a camera . 69 Creating and positioning the camera’s target . 70 Pointing a camera at a target . 70 Set the camera as the scene’s default camera . 70 Animating a camera (or any other FBX object) . 71 Chapter 9 Selected Classes and Data Structures . 73 FBX SDK inheritance tree . 73 FBX objects: class KFbxObject . 74 Copying an FBX object . 74 FBX properties: class KFbxProperty and KFbxTypedProperty . 75 FBX nodes and node attributes . 77 iv | Contents FBX nodes: class KFbxNode . ..