-
Notifications
You must be signed in to change notification settings - Fork 9
/
06c35de9-0ec7-43ad-a458-879332db2977.mop
199 lines (199 loc) · 7.66 KB
/
06c35de9-0ec7-43ad-a458-879332db2977.mop
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
{
"Name": "LoadImgWithoutCaching",
"_id": "06c35de9-0ec7-43ad-a458-879332db2977",
"Namespace": "user.pixtur.research",
"Description": "This loads an image bypassind tooll.io's Resource Manager. This can be faster can loading images from an image sequrence.",
"Inputs": [
{
"Name": "ImagePath",
"MetaInstanceID": "c57f02b3-46ad-4ecf-9a64-08a50ec23011",
"DefaultValue": {
"Type": "Text",
"Value": "assets-common/image/chipmunk.jpg"
},
"MetaID": "c522a66e-3260-4692-b3e3-79fd0361fa3d",
"IsMultiInput": "False",
"Relevance": "Relevant",
"Description": "",
"Min": "-100000",
"Max": "100000",
"Scale": "1",
"ScaleType": "Linear",
"EnumValues": []
}
],
"Outputs": [
{
"Name": "Image",
"MetaInstanceID": "1c7cb862-1d85-4130-a18b-df51b5babc9f",
"MetaID": "9848060d-fd84-45b0-b658-d0d531c61dab"
},
{
"Name": "Size.X",
"MetaInstanceID": "eeff5cfa-4129-4ad1-be6a-7280469f742d",
"MetaID": "3f76dee3-3897-44ac-82d6-25ce9f53a506"
},
{
"Name": "Size.Y",
"MetaInstanceID": "b2bf3aa0-4cd1-4920-8c49-75f28436f45b",
"MetaID": "3f76dee3-3897-44ac-82d6-25ce9f53a506"
}
],
"OperatorParts": [
{
"MetaInstanceID": "73cbf301-ab95-46da-8f23-6258097cf4ae",
"MetaID": "b9c5480d-835e-4cc9-b1e2-477ef584630f",
"Name": "LoadImgWithoutCachingFunc",
"Version": "87c95453-a995-4f6e-81b3-9e85596c0566",
"Type": "Float",
"IsMultiInput": "True",
"Script": [
"//>>> _using",
"using System;",
"using System.Collections.Generic;",
"using System.Linq;",
"using System.Text;",
"using SharpDX;",
"using SharpDX.Direct3D11;",
"using SharpDX.Windows;",
"//<<< _using",
"using System.IO;",
"",
"namespace Framefield.Core.IDb9c5480d_835e_4cc9_b1e2_477ef584630f",
"{",
" public class Class_LoadImageFromSequence : OperatorPart.Function",
" {",
" //>>> _inputids",
" private enum InputId",
" {",
" ImagePath = 0",
" }",
" //<<< _inputids",
"",
" //>>> _outputids",
" private enum OutputId",
" {",
" Image = 0,",
" SizeX = 1,",
" SizeY = 2",
" }",
" //<<< _outputids",
"",
" public override void Dispose() {",
" Utilities.DisposeObj(ref _imageTexture);",
" }",
"",
" public override OperatorPartContext Eval(OperatorPartContext context, List<OperatorPart> inputs, int outputIdx) ",
" {",
" //>>> _params",
" var ImagePath = inputs[(int)InputId.ImagePath].Eval(context).Text;",
" //<<< _params",
"",
" if (ImagePath == _lastImage)",
" Changed = false;",
"",
" _lastImage = ImagePath;",
"",
" if (Changed)",
" {",
" Dispose();",
" if (File.Exists(ImagePath))",
" {",
" //_imageResource = ResourceManager.ReadImage(ImagePath);",
" _imageTexture = SharpDX.Direct3D11.Resource.FromFile<Texture2D>(D3DDevice.Device, ImagePath); ",
" //Texture2D.ToFile(context.D3DDevice.ImmediateContext, _imageTexture, ImageFileFormat.Dds, ImagePath + \".dds\");",
" _size = new Vector2(_imageTexture.Description.Width, _imageTexture.Description.Height); ",
" //Logger.Info(\"loaded:\" + ImagePath);",
" }",
" else",
" {",
" Logger.Error(this,\"Imagefile not found '{0}'\", ImagePath);",
" }",
"",
" //somehow this will cause an exception",
" //FileInfo fi = new FileInfo(ImagePath);",
" //var depthFilename = fi.DirectoryName + \"\\\\\" + Path.GetFileNameWithoutExtension(fi.Name) + \"_depth.dds\";",
" //Logger.Error(this,\"'{0}'\", depthFilename);",
" //if (File.Exists(depthFilename))",
" //{",
" // _depthImageResource = ResourceManager.ReadImage(depthFilename);",
" //}",
" Changed = false;",
" }",
"",
" if (_imageTexture != null)",
" {",
" switch ((OutputId)outputIdx)",
" {",
" case OutputId.Image:",
" context.Image = _imageTexture;",
" break;",
" case OutputId.SizeX:",
" context.Value = _size.X;",
" break;",
" case OutputId.SizeY:",
" context.Value = _size.Y;",
" break;",
" }",
" }",
" else",
" {",
" switch (outputIdx)",
" {",
" case (int)OutputId.Image:",
" context.Image = null;",
" context.DepthImage = null;",
" break;",
" case (int)OutputId.SizeX:",
" context.Value = 0;",
" break;",
" case (int)OutputId.SizeY:",
" context.Value = 0;",
" break;",
" }",
" }",
"",
" return context;",
" }",
"",
" //ImageResource _imageResource;",
" //ImageResource _depthImageResource;",
" Texture2D _imageTexture;",
" Vector2 _size;",
" String _lastImage = String.Empty;",
" }",
"}",
"",
""
],
"AdditionalAssemblies": []
}
],
"Operators": [],
"Connections": [
{
"SourceOp": "00000000-0000-0000-0000-000000000000",
"SourceOpPart": "73cbf301-ab95-46da-8f23-6258097cf4ae",
"TargetOp": "00000000-0000-0000-0000-000000000000",
"TargetOpPart": "1c7cb862-1d85-4130-a18b-df51b5babc9f"
},
{
"SourceOp": "00000000-0000-0000-0000-000000000000",
"SourceOpPart": "c57f02b3-46ad-4ecf-9a64-08a50ec23011",
"TargetOp": "00000000-0000-0000-0000-000000000000",
"TargetOpPart": "73cbf301-ab95-46da-8f23-6258097cf4ae"
},
{
"SourceOp": "00000000-0000-0000-0000-000000000000",
"SourceOpPart": "73cbf301-ab95-46da-8f23-6258097cf4ae",
"TargetOp": "00000000-0000-0000-0000-000000000000",
"TargetOpPart": "eeff5cfa-4129-4ad1-be6a-7280469f742d"
},
{
"SourceOp": "00000000-0000-0000-0000-000000000000",
"SourceOpPart": "73cbf301-ab95-46da-8f23-6258097cf4ae",
"TargetOp": "00000000-0000-0000-0000-000000000000",
"TargetOpPart": "b2bf3aa0-4cd1-4920-8c49-75f28436f45b"
}
]
}