Python Reference Guide
 
Loading...
Searching...
No Matches
BasicOperations\IndividualUndoCalls.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# Script description:
7# Shopw how to edit TRS property of a model with undo mecanism
8#
9# Topic: FBUndoManager
10#
11
12from pyfbsdk import *
13
14#Find Model
15lCube=FBFindModelByLabelName("Cube")
16if not lCube:
17 lCube=FBModelCube("Cube")
18 lCube.Show = True
19
20if not lCube.Visibility.IsAnimated():
21 lCube.Visibility.SetAnimated(True)
22
23if not lCube.Visibility.IsFocused():
24 lCube.Visibility.SetFocus(True)
25
26lUndo = FBUndoManager()
27
28# Important to open our transaction
29lUndo.TransactionBegin("vis1")
30lUndo.TransactionAddModelTRS(lCube)
31
32#Key 1
33lCube.Visibility.GetAnimationNode ().KeyAdd(FBTime(3,3,3,0),True)
34lUndo.TransactionEnd()
35
36lUndo.TransactionBegin("vis2")
37lUndo.TransactionAddModelTRS(lCube)
38#Key 2
39lCube.Visibility.GetAnimationNode ().KeyAdd(FBTime(0,0,0,10),True)
40lUndo.TransactionEnd()
41
42lUndo.TransactionBegin("vis3")
43lUndo.TransactionAddModelTRS(lCube)
44#Key 3
45lCube.Visibility.GetAnimationNode ().KeyAdd(FBTime(0,0,0,11),False)
46lUndo.TransactionEnd()
47
48lUndo.TransactionBegin("vis4")
49lUndo.TransactionAddModelTRS(lCube)
50#Key 4
51lCube.Visibility.GetAnimationNode ().KeyAdd(FBTime(0,0,0,20),False)
52lUndo.TransactionEnd()
53
54lUndo.TransactionBegin("vis5")
55lUndo.TransactionAddModelTRS(lCube)
56#Key 5
57lCube.Visibility.GetAnimationNode ().KeyAdd(FBTime(0,0,0,21),True)
58lUndo.TransactionEnd()
59
60lUndo.TransactionBegin("vis6")
61lUndo.TransactionAddModelTRS(lCube)
62#Key 6
63lCube.Visibility.GetAnimationNode ().KeyAdd(FBTime(0,0,0,30),True)
64lUndo.TransactionEnd()
65
66lUndo.TransactionBegin("vis7")
67lUndo.TransactionAddModelTRS(lCube)
68#Key 7
69lCube.Visibility.GetAnimationNode ().KeyAdd(FBTime(0,0,0,31),False)
70lUndo.TransactionEnd()
71
72lUndo.TransactionBegin("vis8")
73lUndo.TransactionAddModelTRS(lCube)
74#Key 8
75lCube.Visibility.GetAnimationNode ().KeyAdd(FBTime(0,0,0,40),False)
76lUndo.TransactionEnd()
77
78# undo last operation
79#lUndo.Undo()
80#lUndo.Redo()
Cube model class.
Definition: pyfbsdk_generated.h:11337
Time data structure.
Definition: pyfbsdk_generated.h:19596
Access to global undo and redo functionality.
Definition: pyfbsdk_generated.h:20534
FBModel FBFindModelByLabelName(str pModelLabelName)
Find a model in the scene by its label name.