1
- #include " Publisher /ResourcePublisher.h"
1
+ #include " ResourcePublisher /ResourcePublisher.h"
2
2
3
3
namespace sc {
4
4
namespace Adobe {
5
- void ResourcePublisher::Publish (AppContext & context) {
6
- context.window -> ui ->SetProgress (
7
- (uint8_t )PublisherExportStage ::LibraryProcessing
5
+ void ResourcePublisher::Publish (Context & context) {
6
+ context.progressBar -> window ->SetProgress (
7
+ (uint8_t )PublisherStage ::LibraryProcessing
8
8
);
9
- context.window -> ui ->SetStatus (" " );
9
+ context.progressBar -> window ->SetStatus (" " );
10
10
11
11
FCM::Double fps;
12
12
FCM::U_Int8 framesPerSec;
@@ -20,32 +20,32 @@ namespace sc {
20
20
shared_ptr<SharedWriter> writer;
21
21
switch (context.config .method ) {
22
22
case PublisherMethod::SWF:
23
- writer = shared_ptr<SharedWriter>(new Writer (context ));
23
+ writer = shared_ptr<SharedWriter>(new SCWriter ( ));
24
24
break ;
25
25
case PublisherMethod::JSON:
26
- writer = shared_ptr<SharedWriter>(new JSONWriter (context ));
26
+ writer = shared_ptr<SharedWriter>(new JSONWriter ());
27
27
break ;
28
28
default :
29
29
throw exception (" Failed to get writer" );
30
30
}
31
31
32
- writer->Init ();
32
+ writer->Init (context );
33
33
34
34
ResourcePublisher resources (context, writer.get ());
35
35
resources.InitDocument (framesPerSec);
36
36
37
37
std::vector<std::u16string> paths;
38
38
GetItemsPaths (context, libraryItems, paths);
39
39
40
- ProgressBar * itemProgress = context.window -> ui ->GetAvailableProgressBar ();
40
+ StatusComponent * itemProgress = context.progressBar -> window ->GetAvailableProgressBar ();
41
41
ASSERT (itemProgress != nullptr );
42
42
itemProgress->SetRange (paths.size ());
43
43
itemProgress->SetLabel (wxStringU16 (context.locale .Get (" TID_BAR_LABEL_LIBRARY_ITEMS" )));
44
44
45
45
for (uint32_t i = 0 ; paths.size () > i; i++) {
46
46
std::u16string& path = paths[i];
47
47
48
- if (resources.context .window -> ui ->aboutToExit ) {
48
+ if (resources.context .progressBar -> window ->aboutToExit ) {
49
49
resources.context .close ();
50
50
return ;
51
51
}
@@ -65,7 +65,7 @@ namespace sc {
65
65
context.close ();
66
66
}
67
67
68
- void ResourcePublisher::GetItemsPaths (AppContext & context, FCM::FCMListPtr libraryItems, std::vector<std::u16string>& paths) {
68
+ void ResourcePublisher::GetItemsPaths (Context & context, FCM::FCMListPtr libraryItems, std::vector<std::u16string>& paths) {
69
69
uint32_t itemCount = 0 ;
70
70
libraryItems->Count (itemCount);
71
71
@@ -114,13 +114,13 @@ namespace sc {
114
114
ASSERT (symbolItem != nullptr || mediaItem != nullptr );
115
115
116
116
if (symbolItem) {
117
+ SymbolBehaviorInfo symbolBehavior;
118
+
117
119
FCM::AutoPtr<FCM::IFCMDictionary> properties;
118
120
item->GetProperties (properties.m_Ptr );
121
+ Utils::ReadString (properties, kLibProp_SymbolType_DictKey , symbolBehavior.type );
119
122
120
- std::string symbolType;
121
- Utils::ReadString (properties, kLibProp_SymbolType_DictKey , symbolType);
122
-
123
- return AddSymbol (name, symbolItem, symbolType);
123
+ return AddSymbol (name, symbolItem, symbolBehavior);
124
124
}
125
125
else if (mediaItem) {
126
126
pSharedShapeWriter shape = m_writer->AddShape ();
@@ -143,30 +143,41 @@ namespace sc {
143
143
uint16_t ResourcePublisher::AddSymbol (
144
144
std::u16string name,
145
145
DOM::LibraryItem::ISymbolItem* item,
146
- std::string symbolType
146
+ SymbolBehaviorInfo& symbolBehavior
147
147
) {
148
148
FCM::AutoPtr<DOM::ITimeline> timeline;
149
149
item->GetTimeLine (timeline.m_Ptr );
150
150
151
+ assert (timeline != nullptr );
152
+
151
153
uint16_t result = UINT16_MAX;
152
154
153
- if (symbolType != " MovieClip" ) {
155
+ if (symbolBehavior. type != " MovieClip" ) {
154
156
result = AddShape (name, timeline);
155
157
}
156
158
157
159
if (result == UINT16_MAX) {
158
- return AddMovieclip (name, timeline);
160
+ return AddMovieclip (name, timeline, symbolBehavior );
159
161
}
160
162
161
163
return result;
162
164
};
163
165
164
166
uint16_t ResourcePublisher::AddMovieclip (
165
167
u16string name,
166
- FCM::AutoPtr<DOM::ITimeline> timeline
168
+ FCM::AutoPtr<DOM::ITimeline1> timeline,
169
+ SymbolBehaviorInfo& symbolBehavior
167
170
) {
171
+ CDocumentPage* symbol = timeline->GetDocPage ();
172
+ symbolBehavior.hasSlice9 = symbol->GetScale9 ();
173
+ if (symbolBehavior.hasSlice9 )
174
+ {
175
+ symbol->GetScale9Rect (symbolBehavior.slice9 );
176
+ }
177
+
168
178
pSharedMovieclipWriter movieclip = m_writer->AddMovieclip ();
169
- timelineBuilder->Generate (movieclip, timeline);
179
+
180
+ timelineBuilder->Generate (context, movieclip, symbolBehavior, timeline);
170
181
171
182
uint16_t identifer = m_id++;
172
183
m_symbolsData[name] = identifer;
@@ -178,7 +189,7 @@ namespace sc {
178
189
179
190
uint16_t ResourcePublisher::AddShape (
180
191
u16string name,
181
- FCM::AutoPtr<DOM::ITimeline > timeline
192
+ FCM::AutoPtr<DOM::ITimeline1 > timeline
182
193
) {
183
194
bool isShape = ShapeGenerator::Validate (timeline);
184
195
@@ -237,7 +248,7 @@ namespace sc {
237
248
238
249
uint16_t identifer = m_id++;
239
250
240
- shape->AddFilledShape (filledShape, false );
251
+ shape->AddFilledShape (filledShape);
241
252
242
253
shape->Finalize (identifer);
243
254
m_filledShapeDict.push_back ({ filledShape , identifer });
0 commit comments