forked from theodox/zsc
-
Notifications
You must be signed in to change notification settings - Fork 1
/
zbrush.py
2332 lines (1514 loc) · 47.8 KB
/
zbrush.py
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
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
"""
Conventions:
* Python type hints reinforce expected types
* Input with supplied defaults are Zbrush optionals. If the input is typed but specified with
'None', it means no input is required
* Most inputs are strings or numbers; here they are specified as str, float or int but in
zbrush they are all ascii strings or 'numbers' unless specified
* there's no unicode nonsense in zbrush, all strings are ascii or utf-8
* references to memeory blocks use the MemBlock type hint
* references to StrokeData use the StrokeData or MultipleStrokeData type hints
Not all functions in the zscript command list are represented directly as functions. The ones that
are omitted are represented by other python constructs
"""
from typing import Optional, Any, NewType
StrokeData = NewType()
MultipleStrokeData = NewType()
MemBlock = NewType()
ZBrushCommandList = NewType()
def BackColorSet(Red: int, Green: int, Blue: int) -> None:
"""
Sets the pen background color
"""
def ButtonFind(InterfaceItemPath: str, ButtonText: str, InitiallyDisabled: int = 0) -> str:
"""
Locates a ZBrush interface item
"""
pass
def ButtonPress(InterfaceItemPath: str, ButtonText: str, InitiallyDisabled: int = 0) -> None:
"""
Locates and presses a ZBrush interface item
"""
pass
def ButtonSet(InterfaceItemPath: str, Value: Any, ButtonName: str, InitiallyDisabled: int = 0) -> None:
"""
Locates and sets a new value to a ZBrush interface item
"""
pass
def ButtonUnPress(InterfaceItemPath: str, ButtonName: str = "", InitiallyDisabled: int = 0) -> None:
"""
Locates and unpresses a ZBrush interface item
"""
pass
def CanvasClick(*positions: int) -> None:
"""
Emulates a click within the current canvas area
Positions are passed 1 to 8 X, Y values, eg
CanvasClick (128, 128, 256, 512)
clicks at (x = 128, y= 128) and then (x=256, y=512)
"""
pass
def CanvasGyroHide() -> None:
"""
Hides the Transformation Gyro
"""
pass
def CanvasGyroShow() -> None:
"""
Shows the Transformation Gyro
"""
pass
def CanvasPanGetH() -> int:
"""
Returns the H pan value of the active document view
Output: The current H Pan value.
"""
pass
def CanvasPanGetV() -> int:
"""
Returns the V pan value of the active document view
Output: The current V Pan value.
"""
pass
def CanvasPanSet(HValue: int, VValue: int) -> None:
"""
Pans (Scrolls) the active document view
"""
pass
def CanvasStroke(StrokeData: StrokeData, DelayedUpdate: float = 0, Rotation: float = 0, HScale: float = 0, VScale: float = 0, HOffset: int = 0, VOffset: int = 0, HRotateCenter: int = 0, VRotateCenter: int = 0) -> None:
"""
Emulates a brush stroke within the current canvas area
"""
pass
def CanvasStrokes(StrokeData: MultipleStrokeData, DelayedUpdate: float = 0, Rotation: float = 0, HScale: float = 0, VScale: float = 0, HOffset: int = 0, VOffset: int = 0, HRotateCenter: int = 0, VRotateCenter: int = 0) -> None:
"""
Emulates multiple brush strokes within the current canvas area
"""
pass
def CanvasZoomGet() -> float:
"""
Returns the zoom value of the active document view
Output: The current zoom value.
"""
pass
def CanvasZoomSet(ZoomFactor: float) -> None:
"""
Sets the zoom factor of the active document view
"""
pass
def Caption(Text: str) -> None:
"""
Displays a text line using the current Caption settings
"""
pass
def CurveAddPoint(CurveIndex: int, XPos: int, YPos: int, ZPos: int) -> int:
"""
Add a new point to the specified curve
Output: Returns the point index (zero based) or -1 if failed.
"""
pass
def CurvesCreateMesh(Name: str, Action: int = 0, Thickness: int = 0) -> int:
"""
Creates a mesh from the current curves.
Action values:
0: Append mesh to the active mesh,
1: Add as a new subtool,
2: Export OBJ file if does not exists,
3: Export Obj file and overwrite if exsits,
Output: Returns the number of points in the new mesh. zero=error, 1=file exists
"""
pass
def CurvesDelete(CurveList: str) -> None:
"""
Deletes named curves list.
"""
pass
def CurvesNewCurve() -> int:
"""
Creates a new curve in the current curves list.
Output: Returns the curve index (zero based) or -1 if failed.
"""
pass
def CurvesNew(Name: str) -> None:
"""
Creates a new curves list.
"""
pass
def CurvesToUI() -> int:
"""
Copy the ZScript curves to UI
Output: Returns zero of OK or -1 if failed.
"""
pass
def Delay(DelaySeconds: float) -> None:
"""
Delays execution of ZScript for specified amount of time
"""
pass
def DispMapCreate(ImageWidth: int, ImageHeight: int, Smooth: int = 1, SubPoly: int = 0, Border: int = 8, UVTileIndex=0) -> int:
"""
Creates DisplacementMap
Output: Returns zero if executed successfully. Any other value indicates an error
"""
pass
# todo: do we want to support this with a python construct directly?
# if so, what?
def Exit() -> None:
"""
Aborts execution and exits the current ZScript
"""
pass
def FileDelete(FileName: str) -> int:
"""
Delete specific file.
Output: Returns zero if command executed successfully.
"""
pass
def FileExecute(FileName:str, MethodName: str, TextInputMem : MemBlock = None, Number: float= 0, InOutMem1: MemBlock = None, InOutMem2: MemBlock: None) -> int:
"""
Executes the specified plugin file (DLL).
Output: Returns the result value which was returned by the executed routine. Returns zero if error
"""
pass
def FileExists(FileName: str) -> int:
"""
Check if a specific file exists.
Output: Returns 1 if file exists. Returns zero if does not exists
"""
pass
def FileGetInfo(FileName: str, InfoIndex: int) ->float:
"""
Retrieve information about a specified file.
InfoIndex values:
1: file size (in mb)
2 -7: Creation date: year, month(1-12), day, hour, minutes, seconds
8 -13: Modified date: year, month(1-12), day, hour, minutes, seconds
14 -19: Access date: year, month(1-12), day, hour, minutes, seconds.
Output: Returns the requested information or zero if file not found
"""
pass
def FileNameAdvance(FileNameBase: str, NumDigits: int, AddCopyTag: int) -> str:
"""
Increments the index value contained within a filename string .
if "AddCopyTag" is not zero, add "Copy" to the name.
Output: Updated file Name
"""
pass
def FileNameAsk(Extensions: str, DefaultName: str = None, DialogTitle: str = None ) -> str:
"""
Asks user for a file name
If DefaultName is omitted, it's an Open dialog
Output: Result file name or an empty string if user canceled operation
"""
pass
def FileNameExtract(FileName: str, Component: int) -> str:
"""
Extracts filename components.
Components:
1: path
2: name
4: extension
values can be OR'ed, s FileNameExtract('xxx', 7) gets the full path with name and extension
Output: The extracted filename component/s.
"""
pass
# todo: should we use path.splitext, basename, etc?
def FileNameGetLastTyped() -> str:
"""
Retrieves the latest file name that was typed by the user in a Save/Load action
Output: Latest file name that was typed by the user. Returned Variable will be empty if the user has canceled the action.
"""
pass
def FileNameGetLastUsed() -> str:
"""
Retrieves the latest file name that was used (by the user or by ZBrush) in a Save/Load action
Output: Latest file name that was used. Returned Variable will be empty if the user has canceled the action.
"""
pass
def FileNameGetNext() -> str:
"""
Get the preset file name that will be used in the next Save/Load action, if it has been preset
Output: File name that will be used in the next Save/Load action. Returned Variable will be empty if no next file name is preset.
"""
pass
def FileNameHasNext() -> int:
"""
Test if the preset file name that will be used in the next Save/Load action have been set or not
Output: Returns 1 if next file name has been set, 0 otherwise.
"""
pass
def FileNameMake(BaseFileName: str, Index: int, NumDigits: int) -> str:
"""
Combines a base filename with an index number
Output: Combined file name Variable
"""
pass
def FileNameResolvePath(LocalFileName: str) ->str:
"""
Resolves local path to full path
Output: Full path.
"""
pass
def FileNameSetNext(FileName: str, TemplatePath: str=None) -> None:
"""
Pre-sets the file name that will be used in the next Save/Load action
"""
pass
def FileTemplateGetNext():
"""
Get the preset template file name that will be used in the next Save/Load action, if it has been preset
Output: Template file name that will be used in the next Save/Load action. Returned Variable will be empty if no next template file name is preset.
"""
pass
def FontSetColor(Red: int, Green: int, Blue: int) -> None:
"""
Sets the color of the text-flow font
"""
pass
def FontSetOpacity(Opacity: float) -> None:
"""
Sets the opacity of the text-flow font
"""
pass
def FontSetSize(Size: int) -> None:
"""
Sets the intensity of the text-flow font
Values:
1: Small
2: Med
3: Large
"""
pass
def FontSetSizeLarge() -> None:
"""
Sets the size of the text-flow font to large
"""
pass
def FontSetSizeMedium() -> None:
"""
Sets the size of the text-flow font to medium
"""
pass
def FontSetSizeSmall() -> None:
"""
Sets the size of the text-flow font to small
"""
pass
def FrontColorSet(Description: str, Red: int, Green: int, Blue: int, Disabled: int = 0) -> None:
"""
Sets the main interface color to a new value
"""
pass
def GetActiveToolPath() -> str:
"""
Returns the full path of the active tool
Output: The path of the active tool
"""
pass
# this is in the command text file but not the website... todo: is it supported?
'''def GetPolyMesh3DVolume():
"""
Get the volume of current PolyMesh3D SubTool
Output: Returns the Volume of current PolyMesh3D SubTool, or 0 if not a PolyMesh3D. Note: if PolyMesh3D is NOT a valid volume, then resulting value may be not accurate.
"""
pass
'''
def HotKeyText(InterfacePath: str) -> None:
"""
Displays a hot-key for the specified interface item
"""
pass
#------------- interface
def IButton(ButtonText: str, PopupText: str = None, Commands: ZBrushCommandList : None , Disabled: int = 0, Width: int = 0, Hotkey: str ='', Icon: str ='', Height: int =0) -> None:
"""
Creates an interactive push button
"""
pass
# TODO: Pick up type annotations here
def IClick(InterfacePath, *positions):
"""
Emulates a click within a specified ZBrush interface item
"""
pass
def IClose(InterfacePath, ShowZoom=0, TargetParent=0):
"""
Closes an interface item.
"""
pass
def IColorSet(Red, Green, Blue):
"""
Sets the active color to a new value
"""
pass
def IConfig(Config):
"""
Sets ZBrush internal version-configuration
"""
pass
def IDialog(Title, TitleMode=0, Icon='', LeftInset=0, RightInset=0, LeftTop=0, RightBottom=0):
"""
Adds a subpalette to ZBrush interface.
Mode :
mode? (0=Show Title and minimize button(ByDefault) 1=Show Title without minimize button 2=Hide Title )
Icon: Optional subpalette gray-scale (8-bits) icon (Standrad size of 20x20 pixels)
Output: Returns 1 if subpalette added succesfuly. Returns 0 if subpalette could not be added or if it already exsists.
"""
pass
def IDisable(WindowPath, WindowID):
"""
Disables a ZScript interface item (can only be used for ZScript-generated interface items)
"""
pass
def IEnable(WindowPath, WindowID):
"""
Enables a ZScript interface item (can only be used for ZScript-generated interface items)
"""
pass
def IExists(InterfaceItemPath):
"""
Verifies that a specified interface item exists.
Output: 1 if item exists, 0 otherwise
"""
pass
def IFadeIn(FadeOutSpeed=0.5):
"""
Fades ZBrush window to black.
"""
pass
def IFadeOut(FadeOutSpeed=0.5):
"""
Fades ZBrush window to black.
"""
pass
def IFreeze(CommandS, FadeOutSpeed=0.05):
"""
Disables interface updates.
"""
def IGet(InterfaceItemPath):
"""
Returns the current value of a ZBrush or ZScript interface item
Output: The item value
"""
pass
def IGetFlags(InterfaceItemPath):
"""
Returns the status flags of the specified interface item
Output: The flags
"""
pass
def IGetHotkey(InterfaceItemPath):
"""
Returns the hotkey of the specified interface item
Output: The Hotkey
"""
pass
def IGetID(InterfaceItemPath):
"""
Returns the window ID code of the specified interface item
Output: The Title
"""
pass
def IGetInfo(InterfaceItemPath):
"""
Returns the info (popup info) of the specified interface item
Output: The info
"""
pass
def IGetMax(InterfaceItemPath):
"""
Returns the maximum possible value of a ZBrush or ZScript interface item
Output: The item maximum value
"""
pass
def IGetMin(InterfaceItemPath):
"""
Returns the minimum possible value of a ZBrush or ZScript interface item
Output: The item minimum value
"""
pass
def IGetSecondary(InterfaceItemPath):
"""
Returns the the scondary value of a 2D interface item
Output: The item value
"""
pass
def IGetStatus(InterfaceItemPath):
"""
Returns the Enabled/Disabled status of a ZBrush or ZScript interface item
Output: The item status
0=Disabled
1=Enabled
"""
pass
def IGetTitle(InterfaceItemPath, ReturnFullPath):
"""
Returns the title of the specified interface item
Output: The Title of the button
"""
pass
def IHeight(InterfaceItemPath):
"""
Returns the pixel-height of an interface item.
Output: The height of the interface item.
"""
pass
def IHide(InterfaceItemPath, ShowZoomRectangles=0, TargetParentWindow=0):
"""
Hides an interface item.
"""
pass
def IHPos(InterfaceItemPath, UseGlobalCoords=0):
"""
Returns the H position of the interface item in Canvas or Global coordinates.
Output: The H position of the interface item.
"""
pass
def IKeyPress(KeyCode, Commands, HCursor=None, VCursor=None):
"""
Simulates a key press
"""
pass
def ILock(WindowPath, WindowID):
"""
Locks an interface item
"""
pass
def Image(FileName, Align, ResizedWidth):
"""
Loads and displays an image
Align (0=center 1=left 2=right
"""
def IMaximize(InterfaceItemPath, MaximizeSubPalettes):
"""
Locates an interface item and (if possible) maximize its size.
"""
pass
def IMinimize(InterfaceItemPath, MinimizeSubPalettes):
"""
Locates an interface item and (if possible) minimize its size.
"""
pass
def IModGet(InterfaceItemPath):
"""
Returns the current modifiers binary state of a ZBrush or ZScript interface item
Output: The item value
"""
pass
def IModSet(InterfaceItemPath, value):
"""
Sets the modifiers binary value of a ZBrush or a ZScript interface item
"""
pass
def Interpolate(Time, Value1, Value2, Value3, Value4, AngleInterpolate=0):
"""
Performs time-based interpolation
Time: (0=AtStart 0.5=half 1=AtEnd)
Values are (Num, VarName or ListName)
Output: Interpolated value or list
"""
pass
def IPress(InterfaceItemPath):
"""
Presses a ZBrush or ZScript interface item
"""
pass
def IReset(ItemToReset=0, ZBrushVersion=1.5):
"""
Interface Reset
ItemToReset = 0=All, 1=Interface, 2=Document, 3=Tools, 4=Lights, 5=Materials, 6=Stencil
Output: Returns the button that the user clicked. ( 0=NO, 1=YES )
"""
pass
def IsDisabled(InterfaceItemPath):
"""
Returns 1 if the specified ZBrush or ZScript interface item is currently disabled, returns 0 otherwise
Output: The item 'Disabled' status (1=Disabled 0=Enabled)
"""
pass
def IsEnabled(InterfaceItemPath):
"""
Returns 1 if the specified ZBrush or ZScript interface item is currently enabled, returns 0 otherwise
Output: The item 'Enabled' status (1=Enabled 0=Disabled)
"""
pass
def ISet(InterfaceItemPath, Value, SecondaryValue=None):
"""
Sets a new value to a ZBrush or ZScript interface item
"""
pass
def ISetHotkey(InterfaceItemPath, Hotkey):
"""
Sets the hotkey of the specified interface item
0 = no hotkey
"""
pass
def ISetMax(InterfaceItemPath, MaxValue):
"""
Sets the maximum value for an ISlider interface item (can only be used for ZScript-generated interface items)
"""
def ISetMin(InterfaceItemPath, MinValue):
"""
Sets the minimum value for an ISlider interface item (can only be used for ZScript-generated interface items)
"""
pass
def ISetStatus(InterfaceItemPath, Status):
"""
Enables or Disables a ZScript interface item (can only be used for ZScript-generated interface items)
New status ( 0=Disable NotZero=Enable )
"""
pass
def IShowActions(ShowActions):
"""
Temorarily sets the status of ShowActions
. 0=Disable ShowActions, Positive value=enable show actions Negative value=Reset ShowActions
"""
pass
def IShow(InterfaceItemPath, ShowZoomRectangles=0, TargetParenWindow=0):
"""
Locates an interface item and makes it visible.
"""
pass
def ISlider(SliderText, CurValue, Resolution, MinValue, MaxValue, PopupText, ChangeCommand, InitiallyDisabled=0, ButtonWidth=0):
"""
Creates an interactive slider
ButtonWidth: in pixels (0=AutoWidth NonZero=Specified width)
"""
pass
def IsLocked(InterfaceItemPath):
"""
Returns 1 if the specified ZBrush or ZScript interface item is currently locked, returns 0 otherwise
Output: The item 'Locked' status (1=Locked 0=Unlocked)
"""
def IsPolyMesh3DSolid():
"""
Tests if current PolyMesh3D is a Solid
Output: Returns 1 if current PolyMesh3D is a valid Solid, 0 otherwise.
"""
pass
def IStroke(InterfaceItemPath, StrokeData):
"""
Emulates a brush stroke within an interface item
"""
pass
def ISubPalette(PaletteName, TitleMode=0, Icon=None, LeftInset=0, RightInset=0, LeftTop=0, RightBottom=0):
"""
Adds a subpalette to ZBrush interface.
TitleMode: ? (0=Show Title and minimize button(ByDefault) 1=Show Title without minimize button 2=Hide Title ),
Icon (8-bits) icon (Standrad size of 20x20 pixels)
Output: Returns 1 if subpalette added succesfuly. Returns 0 if subpalette could not be added or if it already exsists.
"""
pass
def IsUnlocked(InterfaceItemPath):
"""
Returns 1 if the specified ZBrush or ZScript interface item is currently unlocked, returns 0 otherwise
Output: The item 'Unlocked' status (1=Unlocked 0=locked)
"""
pass
def ISwitch(ButtonText, InitialState, PopupText, PressCommands, UnpressedCommands, InitiallyDisabled=0, ButtonWidth=0):
"""
Creates an interactive switch
InitialState (1=pressed, 0=unpressed),
"""
pass
def IToggle(InterfaceItemPath):
"""
Toggles the state of a ZBrush or ZScript interface item
"""
pass
def IUnlock(WindowPath, WindowID):
"""
Unlocks an interface item
"""
pass
def IUnPress(InterfaceItemPath):
"""
Unpresses a ZBrush or ZScript interface item
"""
pass
def IUpdate(RepeatCount=1, Redraw=0):
"""
Updates the ZBrush interface.
"""
pass
def IVPos(InterfaceItemPath, UseGlobalCoords=0):
"""
Returns the V position of the interface item in Canvas or Global coordinates.
Output: The V position of the interface item.
"""
pass
def IWidth(InterfaceItemPath):
"""
Returns the pixel-width of an interface item.
Output: The width of the interface item.
"""
pass
def MemCopy(FromBlock, FromOffset, ToBlock, ToOffset, NumBytes=None):
"""
Copies data from one memory block into another.
if NumBytes is supplied, limit to that number of b
Output: Returns the mumber of bytes moved. (-1 indicates an error)
"""
pass
def MemCreate(BlockID, BlockSize, InitialFill=None):
"""
Creates a new memory block.
If InitialFill is supplied, fil with that value
Output: Returns the size of the new memory block or error code...0=Error -1=Memory already exists -2=Can't create memory block.