Python Reference Guide
 
Loading...
Searching...
No Matches
Tasks\DeleteUnusedMedia.py
1# Copyright 2009 Autodesk, Inc. All rights reserved.
2# Use of this software is subject to the terms of the Autodesk license agreement
3# provided at the time of installation or download, or which otherwise accompanies
4# this software in either electronic or hard copy form.
5#
6# Topic: FBTexture, FBScene, FBVideo
7#
8
9from pyfbsdk import FBSystem, FBComponent
10
11lSystem = FBSystem()
12
13# Since the videos are parented to textures, we need to removed unused
14# textures before removing the unused videos.
15
16# Delete any texture whose only parent is Scene.
17lList = [ lTexture for lTexture in lSystem.Scene.Textures if (len( lTexture.Parents ) == 1 and lTexture.Parents[0].Name=="Scene") ]
18list( map( FBComponent.FBDelete, lList ) )
19
20# Delete any VideoClip whose only parent is Scene.
21lList = [ lMedia for lMedia in lSystem.Scene.VideoClips if (len( lMedia.Parents ) == 1 and lMedia.Parents[0].Name=="Scene") ]
22list( map( FBComponent.FBDelete, lList ) )
23
24
25# Cleanup
26
27# Conditional cleanup
28if dir().__contains__( 'lTexture' ): del( lTexture )
29if dir().__contains__( 'lMedia' ): del( lMedia )
30
31# Cleanup local variables
32del( lSystem, lList )
33
34# Cleanup things from pyfbsdk
35del( FBSystem, FBComponent )
Provides access to the underlying system, and the MotionBuilder scene.
Definition: pyfbsdk_generated.h:18771
Python built-in list container class.
Definition: pyfbsdk.h:65