1
1

Compare commits

..

154 Commits

Author SHA1 Message Date
206f3352dd fix missing type conversion 2021-06-28 15:46:59 +02:00
dd92220f0b Merge branch 'master' into temp-attribute-processor 2021-06-28 13:32:16 +02:00
5639dcef62 Fix after merge 2021-06-23 18:54:05 +02:00
a20e0fd1a5 fix 2021-06-23 14:23:06 +02:00
448710996b Merge branch 'master' into temp-attribute-processor 2021-06-23 14:00:05 +02:00
3b41749245 initial support for voronoi node
Only 3D in F1 mode with euclidean distance is support right now.
2021-06-23 08:34:54 +02:00
00944353be cleanup menu 2021-06-22 09:47:28 +02:00
623818f2d5 initial support for noise texture 2021-06-22 09:44:25 +02:00
4b7eae5cd3 Merge branch 'master' into temp-attribute-processor 2021-06-16 15:16:04 +02:00
1172c0ae44 Merge branch 'master' into temp-attribute-processor 2021-06-15 15:22:10 +02:00
7f17d15125 fix bugs 2021-06-10 14:56:30 +02:00
b33fd7e89e add Position Input/Output and Attribute Input node 2021-06-10 12:52:45 +02:00
10b78013eb support default mode again and have separate default attribute name 2021-06-10 12:07:37 +02:00
3d057de976 Merge branch 'master' into temp-attribute-processor 2021-06-10 09:35:41 +02:00
3817b408e0 fix crash when creating group 2021-06-09 14:01:03 +02:00
b8d3ad515a fix copying default value from node group inputs 2021-06-09 12:50:44 +02:00
022b541cb3 node group fixes 2021-06-09 12:44:33 +02:00
e294e7a99c fixes 2021-06-09 12:26:29 +02:00
7928578f18 support Set Attribute node 2021-06-09 12:13:44 +02:00
369aa3a8a0 improve Set Attribute node 2021-06-09 11:41:25 +02:00
243b5ac98c add initial Set Attribute node 2021-06-09 11:19:05 +02:00
b63483baec cleanup 2021-06-09 11:08:07 +02:00
4ee0e62986 cleanup 2021-06-09 10:54:59 +02:00
b2184402ae support selection 2021-06-09 10:52:13 +02:00
028777bdba cleanup 2021-06-09 10:41:50 +02:00
e43c171455 Cleanup 2021-06-09 10:37:02 +02:00
e433e4ae42 cleanup 2021-06-09 10:18:47 +02:00
f22aa19845 cleanup 2021-06-09 10:17:56 +02:00
3391649edd cleanup 2021-06-09 10:17:21 +02:00
9e95222cb7 Geometry Nodes: New Attribute Processor.
Differential Revision: https://developer.blender.org/D11547
2021-06-09 10:14:55 +02:00
ef07d5a297 fix 2021-06-08 16:42:41 +02:00
09ec88413b fix 2021-06-08 16:36:11 +02:00
b9c8bb4254 Merge branch 'master' into temp-attribute-processor 2021-06-08 16:32:51 +02:00
64eb1df4b3 move Index node to input category 2021-06-07 16:59:08 +02:00
9a9b87d9c5 support attribute node 2021-06-07 16:59:08 +02:00
257b6bcc61 move operator from python to c++ 2021-06-07 16:59:08 +02:00
b53babaae7 update socket names 2021-06-07 16:59:08 +02:00
aa9efbedf1 remove default modes 2021-06-07 16:59:08 +02:00
93a5fe3a37 use enum for socket types 2021-06-07 16:59:08 +02:00
90de4edc06 improve add node group interface operator 2021-06-07 16:59:08 +02:00
138a0c8109 make attribute processor more prominent in the menu 2021-06-07 16:59:08 +02:00
3a06d098da Fix T88899: __file__ not set for text.as_module() 2021-06-07 16:59:08 +02:00
10636857f8 Event Simulate: and a --keep-open command line argument
It can be useful to investigate the state of the file
after event simulation runs.
2021-06-07 16:59:08 +02:00
e69f9fe0ca Cleanup: unused argument 2021-06-07 16:59:08 +02:00
3b39482e2c LineArt: Fix edge clipping index error.
Small bug that's causing edge count to be incorrect in
final culled list, just being offset exactly 1 entry.

Reviewed By: Sebastian Parborg (zeddb)

Differential Revision: https://developer.blender.org/D11513
2021-06-07 16:59:08 +02:00
82c72ccdbc VSE: Remove seq->tmp usage from transform code
This field was used for extend feature to get handle position of
metastrip children. Since D9972 extend feature works only on meta
strip itself, not it's children.
So `SEQ_transform_get_left_handle_frame()` second argument is always
false and can be removed.

Another instance of `seq->tmp usage` is hack to distinguish strips to be
shuffled, which is not covered by this patch.

Reviewed By: campbellbarton

Differential Revision: https://developer.blender.org/D10321
2021-06-07 16:59:08 +02:00
6ea2f106a0 Exact Boolean: fix last commit: pass an arg by reference instead of value. 2021-06-07 16:59:08 +02:00
c9d4f5d625 Exact Boolean: speed up when there are many separate components.
Use bounding box tests quickly tell that two components cannot
have a containment relation between each other. This change
cut about 0.6s off a test with 25 big icospheres.
2021-06-07 16:59:08 +02:00
22c7967205 Limit Rotation: explicitly orthogonalize the matrix before processing.
Add a call to orthogonalize the matrix before processing for the
same reasons as D8915, and an early exit in case no limits are
enabled for a bit of extra efficiency.

Since the constraint goes through Euler decomposition, it would
in fact remove shear even before this change, but the resulting
rotation won't make much sense.

This change allows using the constraint without any enabled limits
purely for the purpose of efficiently removing shear.

Differential Revision: https://developer.blender.org/D9626
2021-06-07 16:59:08 +02:00
56088650be Limit Rotation: add an Euler Order option.
Since Limit Rotation is based on Euler decomposition, it should allow
specifying the order to use for the same reasons as Copy Rotation does,
namely, if the bone uses Quaternion rotation for its animation channels,
there is no way to choose the order for the constraint.

Ref D9626
2021-06-07 16:59:08 +02:00
14ec1f4e13 Fix T88859: Assert when changing view modes
The `loose_lines`' ibo was not being initialized.
2021-06-07 16:59:08 +02:00
33d262a7c8 BMesh: avoid extra faces-of-edges loop building partial update data 2021-06-07 16:59:08 +02:00
ec04ff8a33 Fix assert check in BLI_polyfill_beautify 2021-06-07 16:59:08 +02:00
c5c607bdaa Fix assert in gpencil_batches_ensure 2021-06-07 16:59:08 +02:00
f4392d1423 Cleanup: use ternary operator for icon argument 2021-06-07 16:59:08 +02:00
005f7318b2 Fix T88828: View/Navigation(Walk/Fly) disappeared from keymap
This was unintentionally removed in
f92f5d1ac6.
2021-06-07 16:59:08 +02:00
93e08fdf90 Cleanup: indentation 2021-06-07 16:59:08 +02:00
92e16e35dc Cleanup: spelling in comments
Also remove reference to function that never existed for adding `bNode`.
2021-06-07 16:59:08 +02:00
2abb09aa2b FFmpeg: Fix seeking not returning the correct frame when not using TC index
Fixed the logic for seeking in ffmpeg video files.
The main fix is that we now apply a small offset in ffmpeg_get_seek_pos
to make sure we don't get the frame in front of the seek position when
seeking backward.

The rest of the changes is general cleanup and untangling code.

Reviewed By: Richard Antalik

Differential Revision: http://developer.blender.org/D11492
2021-06-07 16:59:07 +02:00
a371d4bb2b Fix T88813: Scalable allocator not used on win10
Due to the way we ship the CRT on windows TBB's
malloc proxy was unable to attach it self to
the memory management functions on windows 10.

This change moves ucrtbase.dll out of the blender.crt
folder and back into the main blender folder to side
step some undesirable behaviour on win10 making TBB
once more able to attach it self.

Having this work again, should give a speed
boost in memory allocation heavy workloads
such as mantaflow.

For details on how this only failed on Win10
see T88813
2021-06-07 16:59:07 +02:00
03f9dba616 Edit Mesh: partial updates for normal and face tessellation
This patch exposes functionality for performing partial mesh updates
for normal calculation and face tessellation while transforming a mesh.

The partial update data only needs to be generated once,
afterwards the cached connectivity information can be reused
(with the exception of changing proportional editing radius).

Currently this is only used for transform, in the future it could be
used for other operators as well as the transform panel.

The best-case overall speedup while transforming geometry is about
1.45x since the time to update a small number of normals and faces is
negligible.

For an additional speedup partial face tessellation is multi-threaded,
this gives ~15x speedup on my system (timing tessellation alone).
Exact results depend on the number of CPU cores available.

Ref D11494

Reviewed By: mano-wii
2021-06-07 16:59:07 +02:00
Charlie Jolly
5f2ad6751c Nodes: Add Multiply Add to Vector Math nodes
Cycles, Eevee, OSL, Geo, Attribute

This operator provides consistency with the standard math node. Allows users to use a single node instead of two nodes for this common operation.

Reviewed By: HooglyBoogly, brecht

Differential Revision: https://developer.blender.org/D10808
2021-06-07 16:59:07 +02:00
04e6656ff1 windows/deps: Fix TBB build issues.
rB847579b42250 updated the TBB build script
which had some unintended consequences for
windows as the directory layout slightly
changed.

This change adjusts the builder to the new
structure, there are no version/functional
changes.
2021-06-07 16:59:07 +02:00
Philipp Oeser
0ed005d48a Texture Paint: changing paint slots and viewport could go out of sync
When changing to another texture paint slot, the texture displayed in
the viewport should change accordingly (as well as the image displayed
in the Image Editor).

The procedure to find the texture to display in the viewport
(BKE_texpaint_slot_material_find_node) could fail
though because it assumed iterating nodes would always happen in the
same order (it was index based). This is not the case though, nodes can
get sorted differently based on selection (see ED_node_sort).

Now check the actual image being referenced in the paint slot for
comparison.

ref T88788 (probably enough to call this a fix, the other issue(s)
mentioned in the report are more likely a feature request)

Reviewed By: mano-wii

Maniphest Tasks: T88788

Differential Revision: https://developer.blender.org/D11496
2021-06-07 16:59:07 +02:00
1f33e20f55 LibOverride: Fix early break in some of the resync code.
This `break` moved out of its braces at some point in the previous
fixes/refctors... :(
2021-06-07 16:59:07 +02:00
946f53d86e GPencil: Change Fill Boundary icon
The icon has been changed to `eye` because is more consistent with other areas.
2021-06-07 16:59:07 +02:00
7ab79ac6ba GPencil: Change Fill extend lines icon
The icon has been changed to `eye` because is more consistent with other areas.
2021-06-07 16:59:07 +02:00
Fynn Grotehans
049924c240 Update Camera presets
The (tracking) camera presets have not been updated in the last 7 or
more years, so they are very outdated. I found it pointless to have a
few specific camera models in the list and instead add the most commonly
used sensor sizes/film sizes. This way the list is shorter, easier to
maintain/becomes later outdated, and is more user friendly for most people
who don't own any of the specific cameras. I added the Crop Factor to the
Beginning of the name, so it gets sortet in the correct order and presets
are easier to find based on the size.

Reviewed By: #render_cycles, #motion_tracking, brecht, sergey

Differential Revision: https://developer.blender.org/D10739
2021-06-07 16:59:07 +02:00
6118cbb78e Greasepencil: show pressure curve widgets in the sidebar
These were only showing in the Properties Editor, but there is no reason
to have the panels be different in the sidebar (they should not show in
the top bar though).

agreed upon by both @anoniov and @mendio

ref T88787
2021-06-07 16:59:07 +02:00
bb2e2ad3ff BlenLoad: Ensure linked IDs are properly sorted.
So far, linked IDs were not properly sorted at all, only the ones
explicitely linked from WM code would be, but any indirectly linked
data-blocks would end up in some random order in their lists.

While not ideal, this is not a huge issue in itself, but it had bad
side-effects, e.g. causing (recursive) resync of overrides to happen in
random order, leading to mismatches between name indices of newly-generated
override IDs and the one existings e.g.

And in general, it is much better to be consistent here.

Note that the file sub-version is bumped for this commit, since some
sorting (the directly linked IDs which we keep a reference to) should
never need to be re-done after relevant doversion process.
2021-06-07 16:59:07 +02:00
467f97fb57 GPencil: Cleanup unneeded variable assign
The variable is assigned below again and the initial value is not used.
2021-06-07 16:59:07 +02:00
236ff239bb Fix T88803: GPencil Thickness modifier produces thicker lines
There was a double apply of the thickness due a bug in the fading new parameter.

Differential Revision: https://developer.blender.org/D11483
2021-06-07 16:59:07 +02:00
5e0068f3f7 Math: Added max_uu/min_uu variations. 2021-06-07 16:59:07 +02:00
Johnny Matthews
dfcb4abd4c Geometry Nodes: Curve Length Node
This commit adds a node that outputs the total length of all
evalauted curve splines in a geometry set as a float value.

Differential Revision: https://developer.blender.org/D11459
2021-06-07 16:59:04 +02:00
60bd05f920 Geometry Nodes: Support curve data in the geometry delete node
This commit implements support for deleting curve data in the geometry
delete node. Spline domain and point domain attributes are supported.

Differential Revision: https://developer.blender.org/D11464
2021-06-07 16:58:32 +02:00
688671b9d7 Cleanup: Add comment explaining assert
This triggers fairly often during development, so it might save some
frustration at some point to have a comment here.
2021-06-07 16:58:32 +02:00
07961e5358 Overlay: Flash on Mode Transfer overlay
This implements T87633

This overlay renders a flash animation on the target object when
transfering the mode to it using the mode transfer operator.
This provides visual feedback when switching between objects without
extra overlays that affect the general color and lighting in the scene.

Differences with the design task:

- This uses just a fade out animation instead of a fade in/out animation.
The code is ready for fade in/out, but as the rest of the overlays
(face sets, masks...) change instantly without animation, having a fade
in/out effect gives the impression that the object flashes twice (once
for the face sets, twice for the peak alpha of the flash animation).

- The rendering uses a flat color without fresnel for now, but this can
be improved in the future to make it look more like the shader in the
prototype.

- Not enabled by default (can be enabled in the overlays panel), maybe
the defaults can change for 3.0 to disable fade inactive and enable this
instead.

Reviewed By: jbakker, JulienKaspar

Differential Revision: https://developer.blender.org/D11055
2021-06-07 16:58:32 +02:00
01f2dad596 VSE: Add refresh_all operator to all sequencer regions
This operator is needed in some cases to update image preview.
In workspaces with smaller timelines this is limiting, because users
need to first check that mouse cursor is in correct place, then press
CTRL+R shortcut.
2021-06-07 16:58:32 +02:00
ffa4c53d10 VSE: Remove JPEG reference from proxy panel
Proxies doesn't use MJPEG codec anymore, but text still referenced it.
2021-06-07 16:58:32 +02:00
88c16c4e7a GHOST/wayland: fix restoring hidden cursor 2021-06-07 16:58:32 +02:00
fed3c58f92 GHOST/wayland: fix non-moving normal cursor 2021-06-07 16:58:32 +02:00
77f3b9ea9f GHOST/wayland: add 'xdg-decoration' support 2021-06-07 16:58:32 +02:00
1dd65919e5 GHOST/wayland: adapt window and cursor surface scale to support HiDPI screens 2021-06-07 16:58:32 +02:00
bdada925e3 GHOST/wayland: handle return values for data sources 2021-06-07 16:58:32 +02:00
89602a8366 GHOST/wayland: set parent relation only for dialogs to mimic X11 behaviour 2021-06-07 16:58:32 +02:00
96a8189d74 GHOST/wayland: handle missing relative-pointer and pointer-constraints support 2021-06-07 16:58:32 +02:00
8f18d076e9 GHOST/wayland: get cursor settings via D-Bus 2021-06-07 16:58:32 +02:00
1077c37f1b GHOST/wayland: inhibit warning 2021-06-07 16:58:32 +02:00
f54fc8ac6e cmake: use absolute path for Wayland libraries 2021-06-07 16:58:32 +02:00
a7e337957d GHOST/wayland: set swap interval to 0
The Wayland server will not update hidden surfaces. This will block the
main event loop and thus also block updates to visible windows in a multi-
window setup.
2021-06-07 16:58:32 +02:00
d6a773345b WM: only use the tablet drag threshold for mouse button events
Keyboard click-drag events now use the "Drag Threshold".
This resolves a problem where keyboard click drag events
used a much smaller threshold when using a tablet.
2021-06-07 16:58:32 +02:00
ff0259de92 LibOverride: fix previous commit (rB826bed4349fa). 2021-06-07 16:58:32 +02:00
6dac1211b1 LibOverride: Fix some fail cases with auto-resync.
In some cases e.g. only objects would actually need resync, so
collections on the override character would not be resynced, and if some
objects were sharing relationships with others those could be
lost/destroyed.
2021-06-07 16:58:32 +02:00
7568501934 Fix missing updates in RNA override create functions. 2021-06-07 16:58:32 +02:00
2200c5f761 LibOverride: Add override_hierarchy_createto ID's RNA API. 2021-06-07 16:58:32 +02:00
f11182b1be Fix T88762: UI using tab to enter next button could clamp the hard min/
max unneccessarily

Since rB298d5eb66916 [which was needed to update buttons with custom
property range functions correctly], using tab would always clamp
(hardmin/hardmax) properties which were using FLT_MAX / INT_MAX as range
in their property definitions.

The clamping of rB298d5eb66916 was copied over from rB9b7f44ceb56c
[where it was used for the softmin/softmax], and while the re-evaluation
of hardmin/hardmax is needed for custom property range functions, the
clamping should actually not take place.

There are many properties using FLT_MAX / INT_MAX etc. and while it
probably would be good to update these with ranges that make more sense
-- not using FLT_MAX / INT_MAX would not have done the clamping here --
there should not be an arbitrary limit to these and they should stay as
they are.

Maniphest Tasks: T88762

Differential Revision: https://developer.blender.org/D11473
2021-06-07 16:58:32 +02:00
a069bd219c Cleanup: make format 2021-06-07 16:58:32 +02:00
3d1a0f97f7 LibOverride: ensure proper indirect tag for 'virtual' linked IDs.
Ensure 'virtual' linked override IDs generated by the recursive resync
process are tagged as indirectly linked data.

This is needed to avoid the 'missing data' messages on those virtual
data-blocks after saving and reloading.
2021-06-07 16:58:32 +02:00
2d37e469a2 IDManagement: Collection: Fix several issues in relationships building code.
`BKE_main_collections_parent_relations_rebuild`,
`BKE_collection_parent_relations_rebuild` anf their internal
dependencies had two issues fixed by this commit:

* Main one was that a same collection could be processed several times,
  sometimes even in an infinite loop (in some rare corner cases), by
  `collection_parents_rebuild_recursive`.
* More exotic, code here would not ensure that the collections it was
  processing were actually in Main (or a master one from a scene in
  Main), which became an issue with some advanced ID management
  processes involving partially out-of-main remapping, like liboverride
  resync.
2021-06-07 16:58:32 +02:00
20b0de7db1 Cleanup: use ascii characters instead of unicode where possible
Follow own code style docs.
2021-06-07 16:58:32 +02:00
1b5288b87f Cleanup: spelling in comments, correct outdated comments 2021-06-07 16:58:32 +02:00
e83d96753c Cleanup: use doxy sections for node_relationships.cc 2021-06-07 16:58:32 +02:00
de5e3ef8e5 Fix invalid return values from file_execute
Error in 6c8c30d865
2021-06-07 16:58:32 +02:00
91544db137 Draw Mesh Extractor: Fix used thread count
Some threads were always idle because of this.
2021-06-07 16:58:32 +02:00
2cc7f32f18 Cleanup: Remove unused 'ExtractTaskData's members 2021-06-07 16:58:32 +02:00
9e16740ca1 Cleanup: Fix build warnings 2021-06-07 16:58:32 +02:00
fc94932596 VSE: Add strip-time intersection test function
Use SEQ_time_strip_intersects_frame function to test if strip intersects with frame.

Note: There are cases where this function should not be used. For example splitting
strips require at least 1 frame "inside" strip. Another example is drawing, where
playhead technically doesn't intersect strip, but it is rendered, because current
frame has "duration" or "thickness" of 1 frame.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D11320
2021-06-07 16:58:32 +02:00
97e363a06a Cleanup: Strip duplication code
Remove unused flag `SEQ_DUPE_ANIM` and code used by this flag.
Remove flag `SEQ_DUPE_CONTEXT` and refactor code, to split operator
logic from duplication code.
Reduce indentation level in for loop.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D11318
2021-06-07 16:58:32 +02:00
7d47eea06d Fix T57397: Movies are blurred after sws_scale
Images with 4:2:2 and 4:4:4 chroma subsampling were blurred when
`SWS_FAST_BILINEAR` interpolation is set for `anim->img_convert_ctx`.

Use `SWS_BILINEAR` interpolation for all movies, as performance is
not impacted by this change.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D11457
2021-06-07 16:58:32 +02:00
5dbe82f129 FFmpeg: Update proxy settings
Changes in rBce649c73446e, affected established proxy codec preset.
Presets were not working and all presets were similar to `veryfast`.
Tunes are now working too, so `fastdecode` tune can be used. I have
measured little improvement, but I tested this only on 2 machines and
I have been informed that `fastdecode` tune does influence decoding
performance for some users.

Change preset from `slow` to `veryfast` and add tune `fastdecode`

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D11454
2021-06-07 16:58:32 +02:00
9bd5dff790 FFmpeg: Fix H264 lossless render not lossless
While encoder parameters for lossless encoding are set correctly,
output is not lossless due to pixel format being set to
`AV_PIX_FMT_YUV420P` which is inherently lossy due to chroma subsampling.

This was reported in T61569 and was merged to T57397, but there were
2 bugs - one for encoding and one for decoding.

Set pixel format to `AV_PIX_FMT_YUV444P` when rendering lossless H264
files. This format isn't available in `codec->pix_fmts[0]` and it looks,
that it has to be hard-coded.

Reviewed By: sergey

Differential Revision: D11458
2021-06-07 16:58:32 +02:00
c3427196c2 Boolean exact: speedup by parallelizing a plane calculation.
This patch is from erik85, who says:
This patch makes populate_plane inside polymesh_from_trimesh_with_dissolve run in parallel.
On a test file with a boolean between two subdivided cubes (~6 million verts) this gives a 10% speed increase (49.5s to 45s) on my 6 core CPU.

Also there is an optimization of other_tri_if_manifold to skip the contains-call and get the pointer directly.
This reduces CPU time for find_patches from 5s to 2.2s on the same test file.
2021-06-07 16:58:32 +02:00
21c61092f0 Boolean exact: speedup when there are many components.
When there are many components (separate pieces of connected mesh),
a part of the algorithm to determine component containment was slow.
Using a float version of finding the nearest point on a triangle
as a prefilter sped this up enormously. A case of 25 icospheres
subdivided twice goes 11 seconds faster on my Macbook pro with this
change.
2021-06-07 16:58:32 +02:00
59ffc4945a Nodes: move some files to C++
This just moves a couple of files in `space_node` to C++ and fixes
related errors.

The goal is to be able to use C++ data structures to simplify the code.

Differential Revision: https://developer.blender.org/D11451
2021-06-07 16:58:32 +02:00
07b7158c29 Cleanup: unused variable 2021-06-07 16:58:32 +02:00
1b29d18790 Fix swapped x/y in event simulation script
Incorrect area center calculation, also correct comments.
2021-06-07 16:58:31 +02:00
f68eac3945 Fix T88732: Curve to mesh node crash with empty input curve
The mesh to curve node generated an empty curve because no edges were
selected. This commit changes that node to not add a curve in that case.

This also changes the curve to mesh node to not add a material when
no mesh was created. Even though we don't expect null curves or meshes
in this case, the change is harmless.
2021-06-07 16:58:31 +02:00
e99d523901 EEVEE: AOVs not same as cycles.
EEVEE uses hashing to sync aov names and types with the gpu.
For the type a hashed value was overridden making `decalA`
and `decalB` choose the same hash. This patches fixes this
by removing the most significant bit.
2021-06-07 16:58:31 +02:00
aa46b36a3f Revert "EEVEE: AOVs not same as cycles."
This reverts commit 730a46e87d.
2021-06-07 16:58:31 +02:00
cf84056954 EEVEE: AOVs not same as cycles.
EEVEE uses hashing to sync aov names and types with the gpu. For the type a hashed value was overridden making `decalA` and `decalB` choose the same hash. This patches fixes this by removing the most significant bit.
2021-06-07 16:58:31 +02:00
47d90d9a96 GPencil: New operator to Normalize strokes
Sometimes is required to reset the thickness or the opacity of the strokes. Actually this was done using a modifier, but this operators solves this.

Reviewed By: mendio, filedescriptor

Maniphest Tasks: T87427

Differential Revision: https://developer.blender.org/D11453
2021-06-07 16:58:31 +02:00
bbf78af3c5 Merge branch 'master' into temp-attribute-processor 2021-06-02 10:11:28 -04:00
3da0ad6bb2 add node to access iteration index 2021-05-31 11:41:51 +02:00
002e75fa24 Merge branch 'master' into temp-attribute-processor 2021-05-31 11:13:42 +02:00
427ea6e4ec create attribute node group in attribute tree 2021-05-28 12:16:59 +02:00
c1e587bc46 add initial attribute group 2021-05-28 11:28:05 +02:00
0a082f9ccd Merge branch 'master' into temp-attribute-processor 2021-05-28 10:55:42 +02:00
01321c7825 support other component types 2021-05-27 13:30:13 +02:00
abbd01aff0 support other input modes 2021-05-27 12:39:40 +02:00
40cbdf56fd fix socket recreation 2021-05-27 12:03:34 +02:00
29e5a8b200 cleanup 2021-05-27 11:27:46 +02:00
aa363a71cd improve naming 2021-05-27 11:27:30 +02:00
d42a2cfef4 Merge branch 'master' into temp-attribute-processor 2021-05-27 10:47:05 +02:00
1564743475 Merge branch 'master' into temp-attribute-processor 2021-05-27 10:42:04 +02:00
d932728ac1 initial working version 2021-05-25 18:41:45 +02:00
dcc7786f14 Merge branch 'master' into temp-attribute-processor 2021-05-25 16:58:15 +02:00
27fc7ca66c start creating network 2021-05-25 16:40:37 +02:00
9807cb0eef Merge branch 'master' into temp-attribute-processor 2021-05-25 16:30:02 +02:00
1f25ab4bb9 Merge branch 'master' into temp-attribute-processor 2021-05-25 11:38:01 +02:00
cadfba7aad support changing sockets 2021-05-25 11:13:20 +02:00
be5f911e2a add rna for group inputs 2021-05-25 09:52:57 +02:00
c37de30fdb add initial info for inputs and outputs 2021-05-24 17:53:58 +02:00
95d64038f4 show domain 2021-05-24 17:22:10 +02:00
7f32a3ddd3 start creating correct sockets 2021-05-24 17:13:20 +02:00
fcba670314 create nodes in new group 2021-05-24 17:07:18 +02:00
4fe0ef5eab fix showing menu items of wrong tree type 2021-05-24 16:57:31 +02:00
4a6a755afd support tab on attribute processor 2021-05-24 16:50:32 +02:00
64b4e66afb cleanup 2021-05-24 16:39:15 +02:00
ec77f2d11d support creating attribute processor 2021-05-24 16:36:00 +02:00
e36fe7b78f initial sockets on attribute processor 2021-05-24 16:13:50 +02:00
a795d243cb reference group in attribute processor 2021-05-24 16:07:24 +02:00
4c322f3fba initial attribute processor geometry node 2021-05-24 15:51:26 +02:00
03d31e568f add initial nodes to menu 2021-05-24 15:37:16 +02:00
1291e369f9 initial attribute nodes 2021-05-24 15:29:27 +02:00
979 changed files with 13206 additions and 15168 deletions

View File

@@ -216,9 +216,9 @@ set(OPENVDB_HASH 01b490be16cc0e15c690f9a153c21461)
set(OPENVDB_HASH_TYPE MD5)
set(OPENVDB_FILE openvdb-${OPENVDB_VERSION}.tar.gz)
set(NANOVDB_GIT_UID dc37d8a631922e7bef46712947dc19b755f3e841)
set(NANOVDB_GIT_UID e62f7a0bf1e27397223c61ddeaaf57edf111b77f)
set(NANOVDB_URI https://github.com/AcademySoftwareFoundation/openvdb/archive/${NANOVDB_GIT_UID}.tar.gz)
set(NANOVDB_HASH e7b9e863ec2f3b04ead171dec2322807)
set(NANOVDB_HASH 90919510bc6ccd630fedc56f748cb199)
set(NANOVDB_HASH_TYPE MD5)
set(NANOVDB_FILE nano-vdb-${NANOVDB_GIT_UID}.tar.gz)

View File

@@ -1073,7 +1073,7 @@ OPENVDB_SOURCE=( "https://github.com/AcademySoftwareFoundation/openvdb/archive/v
#~ OPENVDB_SOURCE_REPO_BRANCH="dev"
NANOVDB_USE_REPO=false
NANOVDB_SOURCE_REPO_UID="dc37d8a631922e7bef46712947dc19b755f3e841"
NANOVDB_SOURCE_REPO_UID="e62f7a0bf1e27397223c61ddeaaf57edf111b77f"
NANOVDB_SOURCE=( "https://github.com/AcademySoftwareFoundation/openvdb/archive/${NANOVDB_SOURCE_REPO_UID}.tar.gz" )
ALEMBIC_USE_REPO=false

View File

@@ -265,12 +265,6 @@ protected:
*/
void setSpecs(Specs specs);
/**
* Sets the audio output specification of the device.
* \param specs The output specification.
*/
void setSpecs(DeviceSpecs specs);
/**
* Empty default constructor. To setup the device call the function create()
* and to uninitialize call destroy().

View File

@@ -87,12 +87,6 @@ public:
*/
void setSpecs(Specs specs);
/**
* Sets the target specification for superposing.
* \param specs The target specification.
*/
void setSpecs(DeviceSpecs specs);
/**
* Mixes a buffer.
* \param buffer The buffer to superpose.

View File

@@ -78,7 +78,6 @@ void PulseAudioDevice::runMixingThread()
if(shouldStop())
{
AUD_pa_stream_cork(m_stream, 1, nullptr, nullptr);
AUD_pa_stream_flush(m_stream, nullptr, nullptr);
doStop();
return;
}
@@ -87,10 +86,7 @@ void PulseAudioDevice::runMixingThread()
if(AUD_pa_stream_is_corked(m_stream))
AUD_pa_stream_cork(m_stream, 0, nullptr, nullptr);
// similar to AUD_pa_mainloop_iterate(m_mainloop, false, nullptr); except with a longer timeout
AUD_pa_mainloop_prepare(m_mainloop, 1 << 14);
AUD_pa_mainloop_poll(m_mainloop);
AUD_pa_mainloop_dispatch(m_mainloop);
AUD_pa_mainloop_iterate(m_mainloop, true, nullptr);
}
}

View File

@@ -24,7 +24,6 @@ PULSEAUDIO_SYMBOL(pa_context_unref);
PULSEAUDIO_SYMBOL(pa_stream_begin_write);
PULSEAUDIO_SYMBOL(pa_stream_connect_playback);
PULSEAUDIO_SYMBOL(pa_stream_cork);
PULSEAUDIO_SYMBOL(pa_stream_flush);
PULSEAUDIO_SYMBOL(pa_stream_is_corked);
PULSEAUDIO_SYMBOL(pa_stream_new);
PULSEAUDIO_SYMBOL(pa_stream_set_buffer_attr);
@@ -36,6 +35,3 @@ PULSEAUDIO_SYMBOL(pa_mainloop_free);
PULSEAUDIO_SYMBOL(pa_mainloop_get_api);
PULSEAUDIO_SYMBOL(pa_mainloop_new);
PULSEAUDIO_SYMBOL(pa_mainloop_iterate);
PULSEAUDIO_SYMBOL(pa_mainloop_prepare);
PULSEAUDIO_SYMBOL(pa_mainloop_poll);
PULSEAUDIO_SYMBOL(pa_mainloop_dispatch);

View File

@@ -31,81 +31,65 @@ template <class T> void SafeRelease(T **ppT)
}
}
HRESULT WASAPIDevice::setupRenderClient(IAudioRenderClient*& render_client, UINT32& buffer_size)
void WASAPIDevice::runMixingThread()
{
const IID IID_IAudioRenderClient = __uuidof(IAudioRenderClient);
UINT32 buffer_size;
UINT32 padding;
UINT32 length;
data_t* buffer;
HRESULT result;
IAudioRenderClient* render_client = nullptr;
if(FAILED(result = m_audio_client->GetBufferSize(&buffer_size)))
return result;
{
std::lock_guard<ILockable> lock(*this);
if(FAILED(result = m_audio_client->GetService(IID_IAudioRenderClient, reinterpret_cast<void**>(&render_client))))
return result;
const IID IID_IAudioRenderClient = __uuidof(IAudioRenderClient);
if(FAILED(result = m_audio_client->GetCurrentPadding(&padding)))
return result;
if(FAILED(m_audio_client->GetBufferSize(&buffer_size)))
goto init_error;
length = buffer_size - padding;
if(FAILED(m_audio_client->GetService(IID_IAudioRenderClient, reinterpret_cast<void**>(&render_client))))
goto init_error;
if(FAILED(result = render_client->GetBuffer(length, &buffer)))
return result;
if(FAILED(m_audio_client->GetCurrentPadding(&padding)))
goto init_error;
mix((data_t*)buffer, length);
length = buffer_size - padding;
if(FAILED(result = render_client->ReleaseBuffer(length, 0)))
return result;
if(FAILED(render_client->GetBuffer(length, &buffer)))
goto init_error;
mix((data_t*)buffer, length);
if(FAILED(render_client->ReleaseBuffer(length, 0)))
{
init_error:
SafeRelease(&render_client);
doStop();
return;
}
}
m_audio_client->Start();
return result;
}
void WASAPIDevice::runMixingThread()
{
UINT32 buffer_size;
IAudioRenderClient* render_client = nullptr;
std::chrono::milliseconds sleep_duration;
bool run_init = true;
auto sleepDuration = std::chrono::milliseconds(buffer_size * 1000 / int(m_specs.rate) / 2);
for(;;)
{
HRESULT result = S_OK;
{
UINT32 padding;
UINT32 length;
data_t* buffer;
std::lock_guard<ILockable> lock(*this);
if(run_init)
{
result = setupRenderClient(render_client, buffer_size);
if(FAILED(result))
goto stop_thread;
sleep_duration = std::chrono::milliseconds(buffer_size * 1000 / int(m_specs.rate) / 2);
}
if(FAILED(result = m_audio_client->GetCurrentPadding(&padding)))
if(FAILED(m_audio_client->GetCurrentPadding(&padding)))
goto stop_thread;
length = buffer_size - padding;
if(FAILED(result = render_client->GetBuffer(length, &buffer)))
if(FAILED(render_client->GetBuffer(length, &buffer)))
goto stop_thread;
mix((data_t*)buffer, length);
if(FAILED(result = render_client->ReleaseBuffer(length, 0)))
if(FAILED(render_client->ReleaseBuffer(length, 0)))
goto stop_thread;
// stop thread
@@ -114,51 +98,53 @@ void WASAPIDevice::runMixingThread()
stop_thread:
m_audio_client->Stop();
SafeRelease(&render_client);
if(result == AUDCLNT_E_DEVICE_INVALIDATED)
{
DeviceSpecs specs = m_specs;
if(!setupDevice(specs))
result = S_FALSE;
else
{
setSpecs(specs);
run_init = true;
}
}
if(result != AUDCLNT_E_DEVICE_INVALIDATED)
{
doStop();
return;
}
doStop();
return;
}
}
std::this_thread::sleep_for(sleep_duration);
std::this_thread::sleep_for(sleepDuration);
}
}
bool WASAPIDevice::setupDevice(DeviceSpecs &specs)
WASAPIDevice::WASAPIDevice(DeviceSpecs specs, int buffersize) :
m_imm_device_enumerator(nullptr),
m_imm_device(nullptr),
m_audio_client(nullptr),
m_wave_format_extensible({})
{
SafeRelease(&m_audio_client);
SafeRelease(&m_imm_device);
// initialize COM if it hasn't happened yet
CoInitializeEx(nullptr, COINIT_MULTITHREADED);
const CLSID CLSID_MMDeviceEnumerator = __uuidof(MMDeviceEnumerator);
const IID IID_IMMDeviceEnumerator = __uuidof(IMMDeviceEnumerator);
const IID IID_IAudioClient = __uuidof(IAudioClient);
if(FAILED(m_imm_device_enumerator->GetDefaultAudioEndpoint(eRender, eMultimedia, &m_imm_device)))
return false;
if(FAILED(m_imm_device->Activate(IID_IAudioClient, CLSCTX_ALL, nullptr, reinterpret_cast<void**>(&m_audio_client))))
return false;
WAVEFORMATEXTENSIBLE wave_format_extensible_closest_match;
WAVEFORMATEXTENSIBLE* closest_match_pointer = &wave_format_extensible_closest_match;
HRESULT result;
REFERENCE_TIME minimum_time = 0;
REFERENCE_TIME buffer_duration;
if(FAILED(CoCreateInstance(CLSID_MMDeviceEnumerator, nullptr, CLSCTX_ALL, IID_IMMDeviceEnumerator, reinterpret_cast<void**>(&m_imm_device_enumerator))))
goto error;
if(FAILED(m_imm_device_enumerator->GetDefaultAudioEndpoint(eRender, eMultimedia, &m_imm_device)))
goto error;
if(FAILED(m_imm_device->Activate(IID_IAudioClient, CLSCTX_ALL, nullptr, reinterpret_cast<void**>(&m_audio_client))))
goto error;
if(specs.channels == CHANNELS_INVALID)
specs.channels = CHANNELS_STEREO;
if(specs.format == FORMAT_INVALID)
specs.format = FORMAT_FLOAT32;
if(specs.rate == RATE_INVALID)
specs.rate = RATE_48000;
switch(specs.format)
{
case FORMAT_U8:
@@ -217,14 +203,12 @@ bool WASAPIDevice::setupDevice(DeviceSpecs &specs)
m_wave_format_extensible.Format.cbSize = 22;
m_wave_format_extensible.Samples.wValidBitsPerSample = m_wave_format_extensible.Format.wBitsPerSample;
HRESULT result = m_audio_client->IsFormatSupported(AUDCLNT_SHAREMODE_SHARED, reinterpret_cast<const WAVEFORMATEX*>(&m_wave_format_extensible), reinterpret_cast<WAVEFORMATEX**>(&closest_match_pointer));
result = m_audio_client->IsFormatSupported(AUDCLNT_SHAREMODE_SHARED, reinterpret_cast<const WAVEFORMATEX*>(&m_wave_format_extensible), reinterpret_cast<WAVEFORMATEX**>(&closest_match_pointer));
if(result == S_FALSE)
{
bool errored = false;
if(closest_match_pointer->Format.wFormatTag != WAVE_FORMAT_EXTENSIBLE)
goto closest_match_error;
goto error;
specs.channels = Channels(closest_match_pointer->Format.nChannels);
specs.rate = closest_match_pointer->Format.nSamplesPerSec;
@@ -236,7 +220,7 @@ bool WASAPIDevice::setupDevice(DeviceSpecs &specs)
else if(closest_match_pointer->Format.wBitsPerSample == 64)
specs.format = FORMAT_FLOAT64;
else
goto closest_match_error;
goto error;
}
else if(closest_match_pointer->SubFormat == KSDATAFORMAT_SUBTYPE_PCM)
{
@@ -255,81 +239,44 @@ bool WASAPIDevice::setupDevice(DeviceSpecs &specs)
specs.format = FORMAT_S32;
break;
default:
goto closest_match_error;
goto error;
break;
}
}
else
goto closest_match_error;
goto error;
m_wave_format_extensible = *closest_match_pointer;
if(false)
{
closest_match_error:
errored = true;
}
if(closest_match_pointer != &wave_format_extensible_closest_match)
{
CoTaskMemFree(closest_match_pointer);
closest_match_pointer = &wave_format_extensible_closest_match;
}
if(errored)
return false;
}
else if(FAILED(result))
return false;
goto error;
if(FAILED(m_audio_client->GetDevicePeriod(nullptr, &minimum_time)))
return false;
goto error;
buffer_duration = REFERENCE_TIME(m_buffersize) * REFERENCE_TIME(10000000) / REFERENCE_TIME(specs.rate);
buffer_duration = REFERENCE_TIME(buffersize) * REFERENCE_TIME(10000000) / REFERENCE_TIME(specs.rate);
if(minimum_time > buffer_duration)
buffer_duration = minimum_time;
if(FAILED(m_audio_client->Initialize(AUDCLNT_SHAREMODE_SHARED, 0, buffer_duration, 0, reinterpret_cast<WAVEFORMATEX*>(&m_wave_format_extensible), nullptr)))
return false;
return true;
}
WASAPIDevice::WASAPIDevice(DeviceSpecs specs, int buffersize) :
m_buffersize(buffersize),
m_imm_device_enumerator(nullptr),
m_imm_device(nullptr),
m_audio_client(nullptr),
m_wave_format_extensible({})
{
// initialize COM if it hasn't happened yet
CoInitializeEx(nullptr, COINIT_MULTITHREADED);
const CLSID CLSID_MMDeviceEnumerator = __uuidof(MMDeviceEnumerator);
const IID IID_IMMDeviceEnumerator = __uuidof(IMMDeviceEnumerator);
if(specs.channels == CHANNELS_INVALID)
specs.channels = CHANNELS_STEREO;
if(specs.format == FORMAT_INVALID)
specs.format = FORMAT_FLOAT32;
if(specs.rate == RATE_INVALID)
specs.rate = RATE_48000;
if(FAILED(CoCreateInstance(CLSID_MMDeviceEnumerator, nullptr, CLSCTX_ALL, IID_IMMDeviceEnumerator, reinterpret_cast<void**>(&m_imm_device_enumerator))))
goto error;
if(!setupDevice(specs))
goto error;
m_specs = specs;
if(FAILED(m_audio_client->Initialize(AUDCLNT_SHAREMODE_SHARED, 0, buffer_duration, 0, reinterpret_cast<WAVEFORMATEX*>(&m_wave_format_extensible), nullptr)))
goto error;
create();
return;
error:
if(closest_match_pointer != &wave_format_extensible_closest_match)
CoTaskMemFree(closest_match_pointer);
SafeRelease(&m_imm_device);
SafeRelease(&m_imm_device_enumerator);
SafeRelease(&m_audio_client);

View File

@@ -43,21 +43,16 @@ AUD_NAMESPACE_BEGIN
class AUD_PLUGIN_API WASAPIDevice : public ThreadedDevice
{
private:
int m_buffersize;
IMMDeviceEnumerator* m_imm_device_enumerator;
IMMDevice* m_imm_device;
IAudioClient* m_audio_client;
WAVEFORMATEXTENSIBLE m_wave_format_extensible;
AUD_LOCAL HRESULT setupRenderClient(IAudioRenderClient*& render_client, UINT32& buffer_size);
/**
* Streaming thread main function.
*/
AUD_LOCAL void runMixingThread();
AUD_LOCAL bool setupDevice(DeviceSpecs& specs);
// delete copy constructor and operator=
WASAPIDevice(const WASAPIDevice&) = delete;
WASAPIDevice& operator=(const WASAPIDevice&) = delete;

View File

@@ -756,7 +756,6 @@ void SoftwareDevice::mix(data_t* buffer, int length)
// get the buffer from the source
pos = 0;
len = length;
eos = false;
// update 3D Info
sound->update();
@@ -843,27 +842,6 @@ void SoftwareDevice::setSpecs(Specs specs)
{
sound->setSpecs(specs);
}
for(auto& sound : m_pausedSounds)
{
sound->setSpecs(specs);
}
}
void SoftwareDevice::setSpecs(DeviceSpecs specs)
{
m_specs = specs;
m_mixer->setSpecs(specs);
for(auto& sound : m_playingSounds)
{
sound->setSpecs(specs.specs);
}
for(auto& sound : m_pausedSounds)
{
sound->setSpecs(specs.specs);
}
}
SoftwareDevice::SoftwareDevice()

View File

@@ -21,25 +21,9 @@
AUD_NAMESPACE_BEGIN
Mixer::Mixer(DeviceSpecs specs)
Mixer::Mixer(DeviceSpecs specs) :
m_specs(specs)
{
setSpecs(specs);
}
DeviceSpecs Mixer::getSpecs() const
{
return m_specs;
}
void Mixer::setSpecs(Specs specs)
{
m_specs.specs = specs;
}
void Mixer::setSpecs(DeviceSpecs specs)
{
m_specs = specs;
switch(m_specs.format)
{
case FORMAT_U8:
@@ -70,6 +54,16 @@ void Mixer::setSpecs(DeviceSpecs specs)
}
}
DeviceSpecs Mixer::getSpecs() const
{
return m_specs;
}
void Mixer::setSpecs(Specs specs)
{
m_specs.specs = specs;
}
void Mixer::clear(int length)
{
m_buffer.assureSize(length * AUD_SAMPLE_SIZE(m_specs));

View File

@@ -1254,19 +1254,12 @@ class CyclesObjectSettings(bpy.types.PropertyGroup):
)
shadow_terminator_offset: FloatProperty(
name="Shadow Terminator Shading Offset",
name="Shadow Terminator Offset",
description="Push the shadow terminator towards the light to hide artifacts on low poly geometry",
min=0.0, max=1.0,
default=0.0,
)
shadow_terminator_geometry_offset: FloatProperty(
name="Shadow Terminator Geometry Offset",
description="Offset rays from the surface to reduce shadow terminator artifact on low poly geometry. Only affects triangles at grazing angles to light",
min=0.0, max=1.0,
default=0.1,
)
is_shadow_catcher: BoolProperty(
name="Shadow Catcher",
description="Only render shadows on this object, for compositing renders into real footage",

View File

@@ -1223,31 +1223,20 @@ class CYCLES_OBJECT_PT_shading(CyclesButtonsPanel, Panel):
@classmethod
def poll(cls, context):
if not CyclesButtonsPanel.poll(context):
return False
ob = context.object
return ob and has_geometry_visibility(ob)
def draw(self, context):
pass
class CYCLES_OBJECT_PT_shading_shadow_terminator(CyclesButtonsPanel, Panel):
bl_label = "Shadow Terminator"
bl_parent_id = "CYCLES_OBJECT_PT_shading"
bl_context = "object"
return CyclesButtonsPanel.poll(context) and (context.object)
def draw(self, context):
layout = self.layout
layout.use_property_split = True
flow = layout.grid_flow(row_major=False, columns=0, even_columns=True, even_rows=False, align=True)
flow = layout.grid_flow(row_major=False, columns=0, even_columns=True, even_rows=False, align=False)
layout = self.layout
ob = context.object
cob = ob.cycles
flow.prop(cob, "shadow_terminator_geometry_offset", text="Geometry Offset")
flow.prop(cob, "shadow_terminator_offset", text="Shading Offset")
if has_geometry_visibility(ob):
col = flow.column()
col.prop(cob, "shadow_terminator_offset")
class CYCLES_OBJECT_PT_visibility(CyclesButtonsPanel, Panel):
@@ -2327,7 +2316,6 @@ classes = (
CYCLES_PT_context_material,
CYCLES_OBJECT_PT_motion_blur,
CYCLES_OBJECT_PT_shading,
CYCLES_OBJECT_PT_shading_shadow_terminator,
CYCLES_OBJECT_PT_visibility,
CYCLES_OBJECT_PT_visibility_ray_visibility,
CYCLES_OBJECT_PT_visibility_culling,

View File

@@ -290,12 +290,8 @@ Object *BlenderSync::sync_object(BL::Depsgraph &b_depsgraph,
bool is_shadow_catcher = get_boolean(cobject, "is_shadow_catcher");
object->set_is_shadow_catcher(is_shadow_catcher);
float shadow_terminator_shading_offset = get_float(cobject, "shadow_terminator_offset");
object->set_shadow_terminator_shading_offset(shadow_terminator_shading_offset);
float shadow_terminator_geometry_offset = get_float(cobject,
"shadow_terminator_geometry_offset");
object->set_shadow_terminator_geometry_offset(shadow_terminator_geometry_offset);
float shadow_terminator_offset = get_float(cobject, "shadow_terminator_offset");
object->set_shadow_terminator_offset(shadow_terminator_offset);
/* sync the asset name for Cryptomatte */
BL::Object parent = b_ob.parent();

View File

@@ -603,10 +603,8 @@ vector<Pass> BlenderSync::sync_render_passes(BL::Scene &b_scene,
for (BL::RenderPass &b_pass : b_rlay.passes) {
PassType pass_type = get_pass_type(b_pass);
if (pass_type == PASS_MOTION &&
(b_view_layer.use_motion_blur() && b_scene.render().use_motion_blur())) {
if (pass_type == PASS_MOTION && view_layer.use_motion_blur)
continue;
}
if (pass_type != PASS_NONE)
Pass::add(pass_type, passes, b_pass.name().c_str());
}

View File

@@ -71,87 +71,6 @@ ccl_device_inline float3 ray_offset(float3 P, float3 Ng)
#endif
}
/* This function should be used to compute a modified ray start position for
* rays leaving from a surface. The algorithm slightly distorts flat surface
* of a triangle. Surface is lifted by amount h along normal n in the incident
* point. */
ccl_device_inline float3 smooth_surface_offset(KernelGlobals *kg, ShaderData *sd, float3 Ng)
{
float3 V[3], N[3];
triangle_vertices_and_normals(kg, sd->prim, V, N);
const float u = sd->u, v = sd->v;
const float w = 1 - u - v;
float3 P = V[0] * u + V[1] * v + V[2] * w; /* Local space */
float3 n = N[0] * u + N[1] * v + N[2] * w; /* We get away without normalization */
n = normalize(
transform_direction_transposed_auto(&sd->ob_itfm, n)); /* Normal x scale, world space */
/* Parabolic approximation */
float a = dot(N[2] - N[0], V[0] - V[2]);
float b = dot(N[2] - N[1], V[1] - V[2]);
float c = dot(N[1] - N[0], V[1] - V[0]);
float h = a * u * (u - 1) + (a + b + c) * u * v + b * v * (v - 1);
/* Check flipped normals */
if (dot(n, Ng) > 0) {
/* Local linear envelope */
float h0 = max(max(dot(V[1] - V[0], N[0]), dot(V[2] - V[0], N[0])), 0.0f);
float h1 = max(max(dot(V[0] - V[1], N[1]), dot(V[2] - V[1], N[1])), 0.0f);
float h2 = max(max(dot(V[0] - V[2], N[2]), dot(V[1] - V[2], N[2])), 0.0f);
h0 = max(dot(V[0] - P, N[0]) + h0, 0.0f);
h1 = max(dot(V[1] - P, N[1]) + h1, 0.0f);
h2 = max(dot(V[2] - P, N[2]) + h2, 0.0f);
h = max(min(min(h0, h1), h2), h * 0.5f);
}
else {
float h0 = max(max(dot(V[0] - V[1], N[0]), dot(V[0] - V[2], N[0])), 0.0f);
float h1 = max(max(dot(V[1] - V[0], N[1]), dot(V[1] - V[2], N[1])), 0.0f);
float h2 = max(max(dot(V[2] - V[0], N[2]), dot(V[2] - V[1], N[2])), 0.0f);
h0 = max(dot(P - V[0], N[0]) + h0, 0.0f);
h1 = max(dot(P - V[1], N[1]) + h1, 0.0f);
h2 = max(dot(P - V[2], N[2]) + h2, 0.0f);
h = min(-min(min(h0, h1), h2), h * 0.5f);
}
return n * h;
}
/* Ray offset to avoid shadow terminator artifact. */
ccl_device_inline float3 ray_offset_shadow(KernelGlobals *kg, ShaderData *sd, float3 L)
{
float NL = dot(sd->N, L);
bool transmit = (NL < 0.0f);
float3 Ng = (transmit ? -sd->Ng : sd->Ng);
float3 P = ray_offset(sd->P, Ng);
if ((sd->type & PRIMITIVE_ALL_TRIANGLE) && (sd->shader & SHADER_SMOOTH_NORMAL)) {
const float offset_cutoff =
kernel_tex_fetch(__objects, sd->object).shadow_terminator_geometry_offset;
/* Do ray offset (heavy stuff) only for close to be terminated triangles:
* offset_cutoff = 0.1f means that 10-20% of rays will be affected. Also
* make a smooth transition near the threshold. */
if (offset_cutoff > 0.0f) {
float NgL = dot(Ng, L);
float offset_amount = 0.0f;
if (NL < offset_cutoff) {
offset_amount = clamp(2.0f - (NgL + NL) / offset_cutoff, 0.0f, 1.0f);
}
else {
offset_amount = clamp(1.0f - NgL / offset_cutoff, 0.0f, 1.0f);
}
if (offset_amount > 0.0f) {
P += smooth_surface_offset(kg, sd, Ng) * offset_amount;
}
}
}
return P;
}
#if defined(__VOLUME_RECORD_ALL__) || (defined(__SHADOW_RECORD_ALL__) && defined(__KERNEL_CPU__))
/* ToDo: Move to another file? */
ccl_device int intersections_compare(const void *a, const void *b)

View File

@@ -462,7 +462,7 @@ ccl_device_inline int bsdf_sample(KernelGlobals *kg,
else {
/* Shadow terminator offset. */
const float frequency_multiplier =
kernel_tex_fetch(__objects, sd->object).shadow_terminator_shading_offset;
kernel_tex_fetch(__objects, sd->object).shadow_terminator_offset;
if (frequency_multiplier > 1.0f) {
*eval *= shift_cos_in(dot(*omega_in, sc->N), frequency_multiplier);
}
@@ -488,9 +488,12 @@ ccl_device_inline
const float3 omega_in,
float *pdf)
{
/* For curves use the smooth normal, particularly for ribbons the geometric
* normal gives too much darkening otherwise. */
const float3 Ng = (sd->type & PRIMITIVE_ALL_CURVE) ? sd->N : sd->Ng;
float3 eval;
if (dot(sd->N, omega_in) >= 0.0f) {
if (dot(Ng, omega_in) >= 0.0f) {
switch (sc->type) {
case CLOSURE_BSDF_DIFFUSE_ID:
case CLOSURE_BSDF_BSSRDF_ID:
@@ -586,7 +589,7 @@ ccl_device_inline
}
/* Shadow terminator offset. */
const float frequency_multiplier =
kernel_tex_fetch(__objects, sd->object).shadow_terminator_shading_offset;
kernel_tex_fetch(__objects, sd->object).shadow_terminator_offset;
if (frequency_multiplier > 1.0f) {
eval *= shift_cos_in(dot(omega_in, sc->N), frequency_multiplier);
}

View File

@@ -138,7 +138,7 @@ ccl_device_inline float4 primitive_surface_attribute_float4(KernelGlobals *kg,
ccl_device_inline bool primitive_is_volume_attribute(const ShaderData *sd,
const AttributeDescriptor desc)
{
return sd->type == PRIMITIVE_VOLUME;
return (sd->object != OBJECT_NONE && desc.element == ATTR_ELEMENT_VOXEL);
}
ccl_device_inline float primitive_volume_attribute_float(KernelGlobals *kg,

View File

@@ -75,22 +75,6 @@ ccl_device_inline void triangle_vertices(KernelGlobals *kg, int prim, float3 P[3
P[2] = float4_to_float3(kernel_tex_fetch(__prim_tri_verts, tri_vindex.w + 2));
}
/* Triangle vertex locations and vertex normals */
ccl_device_inline void triangle_vertices_and_normals(KernelGlobals *kg,
int prim,
float3 P[3],
float3 N[3])
{
const uint4 tri_vindex = kernel_tex_fetch(__tri_vindex, prim);
P[0] = float4_to_float3(kernel_tex_fetch(__prim_tri_verts, tri_vindex.w + 0));
P[1] = float4_to_float3(kernel_tex_fetch(__prim_tri_verts, tri_vindex.w + 1));
P[2] = float4_to_float3(kernel_tex_fetch(__prim_tri_verts, tri_vindex.w + 2));
N[0] = float4_to_float3(kernel_tex_fetch(__tri_vnormal, tri_vindex.x));
N[1] = float4_to_float3(kernel_tex_fetch(__tri_vnormal, tri_vindex.y));
N[2] = float4_to_float3(kernel_tex_fetch(__tri_vnormal, tri_vindex.z));
}
/* Interpolate smooth vertex normal from vertices */
ccl_device_inline float3

View File

@@ -72,22 +72,14 @@ ccl_device float4 volume_attribute_float4(KernelGlobals *kg,
const ShaderData *sd,
const AttributeDescriptor desc)
{
if (desc.element & (ATTR_ELEMENT_OBJECT | ATTR_ELEMENT_MESH)) {
return kernel_tex_fetch(__attributes_float3, desc.offset);
}
else if (desc.element == ATTR_ELEMENT_VOXEL) {
/* todo: optimize this so we don't have to transform both here and in
* kernel_tex_image_interp_3d when possible. Also could optimize for the
* common case where transform is translation/scale only. */
float3 P = sd->P;
object_inverse_position_transform(kg, sd, &P);
InterpolationType interp = (sd->flag & SD_VOLUME_CUBIC) ? INTERPOLATION_CUBIC :
INTERPOLATION_NONE;
return kernel_tex_image_interp_3d(kg, desc.offset, P, interp);
}
else {
return make_float4(0.0f, 0.0f, 0.0f, 0.0f);
}
/* todo: optimize this so we don't have to transform both here and in
* kernel_tex_image_interp_3d when possible. Also could optimize for the
* common case where transform is translation/scale only. */
float3 P = sd->P;
object_inverse_position_transform(kg, sd, &P);
InterpolationType interp = (sd->flag & SD_VOLUME_CUBIC) ? INTERPOLATION_CUBIC :
INTERPOLATION_NONE;
return kernel_tex_image_interp_3d(kg, desc.offset, P, interp);
}
#endif

View File

@@ -40,7 +40,7 @@ ccl_device_noinline void compute_light_pass(
/* Evaluate surface shader. */
shader_eval_surface(kg, sd, &state, NULL, state.flag);
/* TODO: disable more closures we don't need besides transparent. */
/* TODO, disable more closures we don't need besides transparent */
shader_bsdf_disable_transparency(kg, sd);
/* Init ray. */

View File

@@ -176,7 +176,8 @@ ccl_device_noinline_cpu bool direct_emission(KernelGlobals *kg,
if (ls->shader & SHADER_CAST_SHADOW) {
/* setup ray */
ray->P = ray_offset_shadow(kg, sd, ls->D);
bool transmit = (dot(sd->Ng, ls->D) < 0.0f);
ray->P = ray_offset(sd->P, (transmit) ? -sd->Ng : sd->Ng);
if (ls->t == FLT_MAX) {
/* distant light */

View File

@@ -1268,7 +1268,6 @@ ccl_device_inline void shader_eval_volume(KernelGlobals *kg,
sd->num_closure_left = max_closures;
sd->flag = 0;
sd->object_flag = 0;
sd->type = PRIMITIVE_VOLUME;
for (int i = 0; stack[i].shader != SHADER_NONE; i++) {
/* setup shaderdata from stack. it's mostly setup already in

View File

@@ -689,24 +689,22 @@ typedef enum PrimitiveType {
PRIMITIVE_MOTION_CURVE_THICK = (1 << 3),
PRIMITIVE_CURVE_RIBBON = (1 << 4),
PRIMITIVE_MOTION_CURVE_RIBBON = (1 << 5),
PRIMITIVE_VOLUME = (1 << 6),
/* Lamp primitive is not included below on purpose,
* since it is no real traceable primitive.
*/
PRIMITIVE_LAMP = (1 << 7),
PRIMITIVE_LAMP = (1 << 6),
PRIMITIVE_ALL_TRIANGLE = (PRIMITIVE_TRIANGLE | PRIMITIVE_MOTION_TRIANGLE),
PRIMITIVE_ALL_CURVE = (PRIMITIVE_CURVE_THICK | PRIMITIVE_MOTION_CURVE_THICK |
PRIMITIVE_CURVE_RIBBON | PRIMITIVE_MOTION_CURVE_RIBBON),
PRIMITIVE_ALL_VOLUME = (PRIMITIVE_VOLUME),
PRIMITIVE_ALL_MOTION = (PRIMITIVE_MOTION_TRIANGLE | PRIMITIVE_MOTION_CURVE_THICK |
PRIMITIVE_MOTION_CURVE_RIBBON),
PRIMITIVE_ALL = (PRIMITIVE_ALL_TRIANGLE | PRIMITIVE_ALL_CURVE | PRIMITIVE_ALL_VOLUME),
PRIMITIVE_ALL = (PRIMITIVE_ALL_TRIANGLE | PRIMITIVE_ALL_CURVE),
/* Total number of different traceable primitives.
* NOTE: This is an actual value, not a bitflag.
*/
PRIMITIVE_NUM_TOTAL = 7,
PRIMITIVE_NUM_TOTAL = 6,
} PrimitiveType;
#define PRIMITIVE_PACK_SEGMENT(type, segment) ((segment << PRIMITIVE_NUM_TOTAL) | (type))
@@ -1481,8 +1479,7 @@ typedef struct KernelObject {
float cryptomatte_object;
float cryptomatte_asset;
float shadow_terminator_shading_offset;
float shadow_terminator_geometry_offset;
float shadow_terminator_offset;
float pad1, pad2, pad3;
} KernelObject;
static_assert_align(KernelObject, 16);

View File

@@ -48,7 +48,6 @@ void ConstantFolder::make_constant(float value) const
foreach (ShaderInput *sock, output->links) {
sock->set(value);
sock->constant_folded_in = true;
}
graph->disconnect(output);
@@ -60,7 +59,6 @@ void ConstantFolder::make_constant(float3 value) const
foreach (ShaderInput *sock, output->links) {
sock->set(value);
sock->constant_folded_in = true;
}
graph->disconnect(output);

View File

@@ -79,11 +79,7 @@ enum ShaderNodeSpecialType {
class ShaderInput {
public:
ShaderInput(const SocketType &socket_type_, ShaderNode *parent_)
: socket_type(socket_type_),
parent(parent_),
link(NULL),
stack_offset(SVM_STACK_INVALID),
constant_folded_in(false)
: socket_type(socket_type_), parent(parent_), link(NULL), stack_offset(SVM_STACK_INVALID)
{
}
@@ -115,10 +111,6 @@ class ShaderInput {
ShaderNode *parent;
ShaderOutput *link;
int stack_offset; /* for SVM compiler */
/* Keeps track of whether a constant was folded in this socket, to avoid over-optimizing when the
* link is null. */
bool constant_folded_in;
};
/* Output

View File

@@ -16,10 +16,8 @@
#include "render/image_vdb.h"
#include "util/util_logging.h"
#include "util/util_openvdb.h"
#ifdef WITH_OPENVDB
# include <openvdb/openvdb.h>
# include <openvdb/tools/Dense.h>
#endif
#ifdef WITH_NANOVDB
@@ -28,57 +26,6 @@
CCL_NAMESPACE_BEGIN
#ifdef WITH_OPENVDB
struct NumChannelsOp {
int num_channels = 0;
template<typename GridType, typename FloatGridType, typename FloatDataType, int channels>
bool operator()(const openvdb::GridBase::ConstPtr &grid)
{
num_channels = channels;
return true;
}
};
struct ToDenseOp {
openvdb::CoordBBox bbox;
void *pixels;
template<typename GridType, typename FloatGridType, typename FloatDataType, int channels>
bool operator()(const openvdb::GridBase::ConstPtr &grid)
{
openvdb::tools::Dense<FloatDataType, openvdb::tools::LayoutXYZ> dense(bbox,
(FloatDataType *)pixels);
openvdb::tools::copyToDense(*openvdb::gridConstPtrCast<GridType>(grid), dense);
return true;
}
};
# ifdef WITH_NANOVDB
struct ToNanoOp {
nanovdb::GridHandle<> nanogrid;
template<typename GridType, typename FloatGridType, typename FloatDataType, int channels>
bool operator()(const openvdb::GridBase::ConstPtr &grid)
{
if constexpr (!std::is_same_v<GridType, openvdb::MaskGrid>) {
try {
nanogrid = nanovdb::openToNanoVDB(
FloatGridType(*openvdb::gridConstPtrCast<GridType>(grid)));
}
catch (const std::exception &e) {
VLOG(1) << "Error converting OpenVDB to NanoVDB grid: " << e.what();
}
return true;
}
else {
return false;
}
}
};
# endif
#endif
VDBImageLoader::VDBImageLoader(const string &grid_name) : grid_name(grid_name)
{
}
@@ -94,40 +41,98 @@ bool VDBImageLoader::load_metadata(const ImageDeviceFeatures &features, ImageMet
return false;
}
/* Get number of channels from type. */
NumChannelsOp op;
if (!openvdb::grid_type_operation(grid, op)) {
return false;
}
metadata.channels = op.num_channels;
/* Set data type. */
# ifdef WITH_NANOVDB
if (features.has_nanovdb) {
/* NanoVDB expects no inactive leaf nodes. */
/*openvdb::FloatGrid &pruned_grid = *openvdb::gridPtrCast<openvdb::FloatGrid>(grid);
openvdb::tools::pruneInactive(pruned_grid.tree());
nanogrid = nanovdb::openToNanoVDB(pruned_grid);*/
ToNanoOp op;
if (!openvdb::grid_type_operation(grid, op)) {
return false;
}
nanogrid = std::move(op.nanogrid);
}
# endif
/* Set dimensions. */
bbox = grid->evalActiveVoxelBoundingBox();
if (bbox.empty()) {
return false;
}
/* Set dimensions. */
openvdb::Coord dim = bbox.dim();
metadata.width = dim.x();
metadata.height = dim.y();
metadata.depth = dim.z();
/* Set data type. */
if (grid->isType<openvdb::FloatGrid>()) {
metadata.channels = 1;
# ifdef WITH_NANOVDB
if (features.has_nanovdb) {
nanogrid = nanovdb::openToNanoVDB(*openvdb::gridConstPtrCast<openvdb::FloatGrid>(grid));
}
# endif
}
else if (grid->isType<openvdb::Vec3fGrid>()) {
metadata.channels = 3;
# ifdef WITH_NANOVDB
if (features.has_nanovdb) {
nanogrid = nanovdb::openToNanoVDB(*openvdb::gridConstPtrCast<openvdb::Vec3fGrid>(grid));
}
# endif
}
else if (grid->isType<openvdb::BoolGrid>()) {
metadata.channels = 1;
# ifdef WITH_NANOVDB
if (features.has_nanovdb) {
nanogrid = nanovdb::openToNanoVDB(
openvdb::FloatGrid(*openvdb::gridConstPtrCast<openvdb::BoolGrid>(grid)));
}
# endif
}
else if (grid->isType<openvdb::DoubleGrid>()) {
metadata.channels = 1;
# ifdef WITH_NANOVDB
if (features.has_nanovdb) {
nanogrid = nanovdb::openToNanoVDB(
openvdb::FloatGrid(*openvdb::gridConstPtrCast<openvdb::DoubleGrid>(grid)));
}
# endif
}
else if (grid->isType<openvdb::Int32Grid>()) {
metadata.channels = 1;
# ifdef WITH_NANOVDB
if (features.has_nanovdb) {
nanogrid = nanovdb::openToNanoVDB(
openvdb::FloatGrid(*openvdb::gridConstPtrCast<openvdb::Int32Grid>(grid)));
}
# endif
}
else if (grid->isType<openvdb::Int64Grid>()) {
metadata.channels = 1;
# ifdef WITH_NANOVDB
if (features.has_nanovdb) {
nanogrid = nanovdb::openToNanoVDB(
openvdb::FloatGrid(*openvdb::gridConstPtrCast<openvdb::Int64Grid>(grid)));
}
# endif
}
else if (grid->isType<openvdb::Vec3IGrid>()) {
metadata.channels = 3;
# ifdef WITH_NANOVDB
if (features.has_nanovdb) {
nanogrid = nanovdb::openToNanoVDB(
openvdb::Vec3fGrid(*openvdb::gridConstPtrCast<openvdb::Vec3IGrid>(grid)));
}
# endif
}
else if (grid->isType<openvdb::Vec3dGrid>()) {
metadata.channels = 3;
# ifdef WITH_NANOVDB
if (features.has_nanovdb) {
nanogrid = nanovdb::openToNanoVDB(
openvdb::Vec3fGrid(*openvdb::gridConstPtrCast<openvdb::Vec3dGrid>(grid)));
}
# endif
}
else if (grid->isType<openvdb::MaskGrid>()) {
metadata.channels = 1;
# ifdef WITH_NANOVDB
return false; // Unsupported
# endif
}
else {
return false;
}
# ifdef WITH_NANOVDB
if (nanogrid) {
metadata.byte_size = nanogrid.size();
@@ -195,10 +200,45 @@ bool VDBImageLoader::load_pixels(const ImageMetaData &, void *pixels, const size
else
# endif
{
ToDenseOp op;
op.pixels = pixels;
op.bbox = bbox;
openvdb::grid_type_operation(grid, op);
if (grid->isType<openvdb::FloatGrid>()) {
openvdb::tools::Dense<float, openvdb::tools::LayoutXYZ> dense(bbox, (float *)pixels);
openvdb::tools::copyToDense(*openvdb::gridConstPtrCast<openvdb::FloatGrid>(grid), dense);
}
else if (grid->isType<openvdb::Vec3fGrid>()) {
openvdb::tools::Dense<openvdb::Vec3f, openvdb::tools::LayoutXYZ> dense(
bbox, (openvdb::Vec3f *)pixels);
openvdb::tools::copyToDense(*openvdb::gridConstPtrCast<openvdb::Vec3fGrid>(grid), dense);
}
else if (grid->isType<openvdb::BoolGrid>()) {
openvdb::tools::Dense<float, openvdb::tools::LayoutXYZ> dense(bbox, (float *)pixels);
openvdb::tools::copyToDense(*openvdb::gridConstPtrCast<openvdb::BoolGrid>(grid), dense);
}
else if (grid->isType<openvdb::DoubleGrid>()) {
openvdb::tools::Dense<float, openvdb::tools::LayoutXYZ> dense(bbox, (float *)pixels);
openvdb::tools::copyToDense(*openvdb::gridConstPtrCast<openvdb::DoubleGrid>(grid), dense);
}
else if (grid->isType<openvdb::Int32Grid>()) {
openvdb::tools::Dense<float, openvdb::tools::LayoutXYZ> dense(bbox, (float *)pixels);
openvdb::tools::copyToDense(*openvdb::gridConstPtrCast<openvdb::Int32Grid>(grid), dense);
}
else if (grid->isType<openvdb::Int64Grid>()) {
openvdb::tools::Dense<float, openvdb::tools::LayoutXYZ> dense(bbox, (float *)pixels);
openvdb::tools::copyToDense(*openvdb::gridConstPtrCast<openvdb::Int64Grid>(grid), dense);
}
else if (grid->isType<openvdb::Vec3IGrid>()) {
openvdb::tools::Dense<openvdb::Vec3f, openvdb::tools::LayoutXYZ> dense(
bbox, (openvdb::Vec3f *)pixels);
openvdb::tools::copyToDense(*openvdb::gridConstPtrCast<openvdb::Vec3IGrid>(grid), dense);
}
else if (grid->isType<openvdb::Vec3dGrid>()) {
openvdb::tools::Dense<openvdb::Vec3f, openvdb::tools::LayoutXYZ> dense(
bbox, (openvdb::Vec3f *)pixels);
openvdb::tools::copyToDense(*openvdb::gridConstPtrCast<openvdb::Vec3dGrid>(grid), dense);
}
else if (grid->isType<openvdb::MaskGrid>()) {
openvdb::tools::Dense<float, openvdb::tools::LayoutXYZ> dense(bbox, (float *)pixels);
openvdb::tools::copyToDense(*openvdb::gridConstPtrCast<openvdb::MaskGrid>(grid), dense);
}
}
return true;
#else

View File

@@ -93,8 +93,7 @@ NODE_DEFINE(Object)
SOCKET_POINT(dupli_generated, "Dupli Generated", zero_float3());
SOCKET_POINT2(dupli_uv, "Dupli UV", zero_float2());
SOCKET_TRANSFORM_ARRAY(motion, "Motion", array<Transform>());
SOCKET_FLOAT(shadow_terminator_shading_offset, "Shadow Terminator Shading Offset", 0.0f);
SOCKET_FLOAT(shadow_terminator_geometry_offset, "Shadow Terminator Geometry Offset", 0.1f);
SOCKET_FLOAT(shadow_terminator_offset, "Terminator Offset", 0.0f);
SOCKET_STRING(asset_name, "Asset Name", ustring());
SOCKET_BOOLEAN(is_shadow_catcher, "Shadow Catcher", false);
@@ -508,9 +507,7 @@ void ObjectManager::device_update_object_transform(UpdateObjectTransformState *s
kobject.cryptomatte_asset = util_hash_to_float(hash_asset);
}
kobject.shadow_terminator_shading_offset = 1.0f /
(1.0f - 0.5f * ob->shadow_terminator_shading_offset);
kobject.shadow_terminator_geometry_offset = ob->shadow_terminator_geometry_offset;
kobject.shadow_terminator_offset = 1.0f / (1.0f - 0.5f * ob->shadow_terminator_offset);
/* Object flag. */
if (ob->use_holdout) {

View File

@@ -64,8 +64,7 @@ class Object : public Node {
NODE_SOCKET_API(bool, hide_on_missing_motion)
NODE_SOCKET_API(bool, use_holdout)
NODE_SOCKET_API(bool, is_shadow_catcher)
NODE_SOCKET_API(float, shadow_terminator_shading_offset)
NODE_SOCKET_API(float, shadow_terminator_geometry_offset)
NODE_SOCKET_API(float, shadow_terminator_offset)
NODE_SOCKET_API(float3, dupli_generated)
NODE_SOCKET_API(float2, dupli_uv)

View File

@@ -304,7 +304,7 @@ int SVMCompiler::stack_assign(ShaderOutput *output)
int SVMCompiler::stack_assign_if_linked(ShaderInput *input)
{
if (input->link || input->constant_folded_in)
if (input->link)
return stack_assign(input);
return SVM_STACK_INVALID;

View File

@@ -25,42 +25,6 @@ namespace openvdb {
using Vec4fTree = tree::Tree4<Vec4f, 5, 4, 3>::Type;
using Vec4fGrid = Grid<Vec4fTree>;
/* Apply operation to known grid types. */
template<typename OpType>
bool grid_type_operation(const openvdb::GridBase::ConstPtr &grid, OpType &&op)
{
if (grid->isType<openvdb::FloatGrid>()) {
return op.template operator()<openvdb::FloatGrid, openvdb::FloatGrid, float, 1>(grid);
}
else if (grid->isType<openvdb::Vec3fGrid>()) {
return op.template operator()<openvdb::Vec3fGrid, openvdb::Vec3fGrid, openvdb::Vec3f, 3>(grid);
}
else if (grid->isType<openvdb::BoolGrid>()) {
return op.template operator()<openvdb::BoolGrid, openvdb::FloatGrid, float, 1>(grid);
}
else if (grid->isType<openvdb::DoubleGrid>()) {
return op.template operator()<openvdb::DoubleGrid, openvdb::FloatGrid, float, 1>(grid);
}
else if (grid->isType<openvdb::Int32Grid>()) {
return op.template operator()<openvdb::Int32Grid, openvdb::FloatGrid, float, 1>(grid);
}
else if (grid->isType<openvdb::Int64Grid>()) {
return op.template operator()<openvdb::Int64Grid, openvdb::FloatGrid, float, 1>(grid);
}
else if (grid->isType<openvdb::Vec3IGrid>()) {
return op.template operator()<openvdb::Vec3IGrid, openvdb::Vec3fGrid, openvdb::Vec3f, 3>(grid);
}
else if (grid->isType<openvdb::Vec3dGrid>()) {
return op.template operator()<openvdb::Vec3dGrid, openvdb::Vec3fGrid, openvdb::Vec3f, 3>(grid);
}
else if (grid->isType<openvdb::MaskGrid>()) {
return op.template operator()<openvdb::MaskGrid, openvdb::FloatGrid, float, 1>(grid);
}
else {
return false;
}
}
}; // namespace openvdb
#endif

View File

@@ -96,7 +96,7 @@ extern GHOST_TSuccess GHOST_DisposeEventConsumer(GHOST_EventConsumerHandle consu
* \param systemhandle: The handle to the system.
* \return The number of milliseconds.
*/
extern uint64_t GHOST_GetMilliSeconds(GHOST_SystemHandle systemhandle);
extern GHOST_TUns64 GHOST_GetMilliSeconds(GHOST_SystemHandle systemhandle);
/**
* Installs a timer.
@@ -110,8 +110,8 @@ extern uint64_t GHOST_GetMilliSeconds(GHOST_SystemHandle systemhandle);
* \return A timer task (0 if timer task installation failed).
*/
extern GHOST_TimerTaskHandle GHOST_InstallTimer(GHOST_SystemHandle systemhandle,
uint64_t delay,
uint64_t interval,
GHOST_TUns64 delay,
GHOST_TUns64 interval,
GHOST_TimerProcPtr timerProc,
GHOST_TUserDataPtr userData);
@@ -133,7 +133,7 @@ extern GHOST_TSuccess GHOST_RemoveTimer(GHOST_SystemHandle systemhandle,
* \param systemhandle: The handle to the system.
* \return The number of displays.
*/
extern uint8_t GHOST_GetNumDisplays(GHOST_SystemHandle systemhandle);
extern GHOST_TUns8 GHOST_GetNumDisplays(GHOST_SystemHandle systemhandle);
/**
* Returns the dimensions of the main display on this system.
@@ -142,8 +142,8 @@ extern uint8_t GHOST_GetNumDisplays(GHOST_SystemHandle systemhandle);
* \param height: A pointer the height gets put in.
*/
extern void GHOST_GetMainDisplayDimensions(GHOST_SystemHandle systemhandle,
uint32_t *width,
uint32_t *height);
GHOST_TUns32 *width,
GHOST_TUns32 *height);
/**
* Returns the dimensions of all displays combine
@@ -154,8 +154,8 @@ extern void GHOST_GetMainDisplayDimensions(GHOST_SystemHandle systemhandle,
* \param height: A pointer the height gets put in.
*/
extern void GHOST_GetAllDisplayDimensions(GHOST_SystemHandle systemhandle,
uint32_t *width,
uint32_t *height);
GHOST_TUns32 *width,
GHOST_TUns32 *height);
/**
* Create a new window.
@@ -178,10 +178,10 @@ extern void GHOST_GetAllDisplayDimensions(GHOST_SystemHandle systemhandle,
extern GHOST_WindowHandle GHOST_CreateWindow(GHOST_SystemHandle systemhandle,
GHOST_WindowHandle parent_windowhandle,
const char *title,
int32_t left,
int32_t top,
uint32_t width,
uint32_t height,
GHOST_TInt32 left,
GHOST_TInt32 top,
GHOST_TUns32 width,
GHOST_TUns32 height,
GHOST_TWindowState state,
bool is_dialog,
GHOST_TDrawingContextType type,
@@ -360,13 +360,13 @@ extern GHOST_TSuccess GHOST_HasCursorShape(GHOST_WindowHandle windowhandle,
* \return Indication of success.
*/
extern GHOST_TSuccess GHOST_SetCustomCursorShape(GHOST_WindowHandle windowhandle,
uint8_t *bitmap,
uint8_t *mask,
GHOST_TUns8 *bitmap,
GHOST_TUns8 *mask,
int sizex,
int sizey,
int hotX,
int hotY,
bool canInvertColor);
GHOST_TUns8 canInvertColor);
/**
* Returns the visibility state of the cursor.
@@ -391,8 +391,8 @@ extern GHOST_TSuccess GHOST_SetCursorVisibility(GHOST_WindowHandle windowhandle,
* \return Indication of success.
*/
extern GHOST_TSuccess GHOST_GetCursorPosition(GHOST_SystemHandle systemhandle,
int32_t *x,
int32_t *y);
GHOST_TInt32 *x,
GHOST_TInt32 *y);
/**
* Updates the location of the cursor (location in screen coordinates).
@@ -403,8 +403,8 @@ extern GHOST_TSuccess GHOST_GetCursorPosition(GHOST_SystemHandle systemhandle,
* \return Indication of success.
*/
extern GHOST_TSuccess GHOST_SetCursorPosition(GHOST_SystemHandle systemhandle,
int32_t x,
int32_t y);
GHOST_TInt32 x,
GHOST_TInt32 y);
/**
* Grabs the cursor for a modal operation, to keep receiving
@@ -467,7 +467,7 @@ extern void GHOST_setNDOFDeadZone(float deadzone);
/**
* Tells if the ongoing drag'n'drop object can be accepted upon mouse drop
*/
extern void GHOST_setAcceptDragOperation(GHOST_WindowHandle windowhandle, bool canAccept);
extern void GHOST_setAcceptDragOperation(GHOST_WindowHandle windowhandle, GHOST_TInt8 canAccept);
/**
* Returns the event type.
@@ -481,7 +481,7 @@ extern GHOST_TEventType GHOST_GetEventType(GHOST_EventHandle eventhandle);
* \param eventhandle: The handle to the event.
* \return The event generation time.
*/
extern uint64_t GHOST_GetEventTime(GHOST_EventHandle eventhandle);
extern GHOST_TUns64 GHOST_GetEventTime(GHOST_EventHandle eventhandle);
/**
* Returns the window this event was generated on,
@@ -507,7 +507,7 @@ extern GHOST_TimerProcPtr GHOST_GetTimerProc(GHOST_TimerTaskHandle timertaskhand
/**
* Changes the timer callback.
* \param timertaskhandle: The handle to the timer-task.
* \param timertaskhandle: The handle to the timertask.
* \param timerProc: The timer callback.
*/
extern void GHOST_SetTimerProc(GHOST_TimerTaskHandle timertaskhandle,
@@ -515,14 +515,14 @@ extern void GHOST_SetTimerProc(GHOST_TimerTaskHandle timertaskhandle,
/**
* Returns the timer user data.
* \param timertaskhandle: The handle to the timer-task.
* \param timertaskhandle: The handle to the timertask.
* \return The timer user data.
*/
extern GHOST_TUserDataPtr GHOST_GetTimerTaskUserData(GHOST_TimerTaskHandle timertaskhandle);
/**
* Changes the time user data.
* \param timertaskhandle: The handle to the timer-task.
* \param timertaskhandle: The handle to the timertask.
* \param userdata: The timer user data.
*/
extern void GHOST_SetTimerTaskUserData(GHOST_TimerTaskHandle timertaskhandle,
@@ -595,7 +595,7 @@ void GHOST_DisposeRectangle(GHOST_RectangleHandle rectanglehandle);
* \param width: The new width of the client area of the window.
* \return Indication of success.
*/
extern GHOST_TSuccess GHOST_SetClientWidth(GHOST_WindowHandle windowhandle, uint32_t width);
extern GHOST_TSuccess GHOST_SetClientWidth(GHOST_WindowHandle windowhandle, GHOST_TUns32 width);
/**
* Resizes client rectangle height.
@@ -603,7 +603,7 @@ extern GHOST_TSuccess GHOST_SetClientWidth(GHOST_WindowHandle windowhandle, uint
* \param height: The new height of the client area of the window.
* \return Indication of success.
*/
extern GHOST_TSuccess GHOST_SetClientHeight(GHOST_WindowHandle windowhandle, uint32_t height);
extern GHOST_TSuccess GHOST_SetClientHeight(GHOST_WindowHandle windowhandle, GHOST_TUns32 height);
/**
* Resizes client rectangle.
@@ -613,8 +613,8 @@ extern GHOST_TSuccess GHOST_SetClientHeight(GHOST_WindowHandle windowhandle, uin
* \return Indication of success.
*/
extern GHOST_TSuccess GHOST_SetClientSize(GHOST_WindowHandle windowhandle,
uint32_t width,
uint32_t height);
GHOST_TUns32 width,
GHOST_TUns32 height);
/**
* Converts a point in screen coordinates to client rectangle coordinates
@@ -624,8 +624,11 @@ extern GHOST_TSuccess GHOST_SetClientSize(GHOST_WindowHandle windowhandle,
* \param outX: The x-coordinate in the client rectangle.
* \param outY: The y-coordinate in the client rectangle.
*/
extern void GHOST_ScreenToClient(
GHOST_WindowHandle windowhandle, int32_t inX, int32_t inY, int32_t *outX, int32_t *outY);
extern void GHOST_ScreenToClient(GHOST_WindowHandle windowhandle,
GHOST_TInt32 inX,
GHOST_TInt32 inY,
GHOST_TInt32 *outX,
GHOST_TInt32 *outY);
/**
* Converts a point in screen coordinates to client rectangle coordinates
@@ -635,8 +638,11 @@ extern void GHOST_ScreenToClient(
* \param outX: The x-coordinate on the screen.
* \param outY: The y-coordinate on the screen.
*/
extern void GHOST_ClientToScreen(
GHOST_WindowHandle windowhandle, int32_t inX, int32_t inY, int32_t *outX, int32_t *outY);
extern void GHOST_ClientToScreen(GHOST_WindowHandle windowhandle,
GHOST_TInt32 inX,
GHOST_TInt32 inY,
GHOST_TInt32 *outX,
GHOST_TInt32 *outY);
/**
* Returns the state of the window (normal, minimized, maximized).
@@ -661,7 +667,7 @@ extern GHOST_TSuccess GHOST_SetWindowState(GHOST_WindowHandle windowhandle,
* \return Indication of success.
*/
extern GHOST_TSuccess GHOST_SetWindowModifiedState(GHOST_WindowHandle windowhandle,
bool isUnsavedChanges);
GHOST_TUns8 isUnsavedChanges);
/**
* Sets the order of the window (bottom, top).
@@ -752,14 +758,14 @@ extern void GHOST_SetTabletAPI(GHOST_SystemHandle systemhandle, GHOST_TTabletAPI
* \param rectanglehandle: The handle to the rectangle.
* \return width of the rectangle
*/
extern int32_t GHOST_GetWidthRectangle(GHOST_RectangleHandle rectanglehandle);
extern GHOST_TInt32 GHOST_GetWidthRectangle(GHOST_RectangleHandle rectanglehandle);
/**
* Access to rectangle height.
* \param rectanglehandle: The handle to the rectangle.
* \return height of the rectangle
*/
extern int32_t GHOST_GetHeightRectangle(GHOST_RectangleHandle rectanglehandle);
extern GHOST_TInt32 GHOST_GetHeightRectangle(GHOST_RectangleHandle rectanglehandle);
/**
* Gets all members of the rectangle.
@@ -769,8 +775,11 @@ extern int32_t GHOST_GetHeightRectangle(GHOST_RectangleHandle rectanglehandle);
* \param r: Pointer to return right coordinate in.
* \param b: Pointer to return bottom coordinate in.
*/
extern void GHOST_GetRectangle(
GHOST_RectangleHandle rectanglehandle, int32_t *l, int32_t *t, int32_t *r, int32_t *b);
extern void GHOST_GetRectangle(GHOST_RectangleHandle rectanglehandle,
GHOST_TInt32 *l,
GHOST_TInt32 *t,
GHOST_TInt32 *r,
GHOST_TInt32 *b);
/**
* Sets all members of the rectangle.
@@ -780,8 +789,11 @@ extern void GHOST_GetRectangle(
* \param r: requested right coordinate of the rectangle.
* \param b: requested bottom coordinate of the rectangle.
*/
extern void GHOST_SetRectangle(
GHOST_RectangleHandle rectanglehandle, int32_t l, int32_t t, int32_t r, int32_t b);
extern void GHOST_SetRectangle(GHOST_RectangleHandle rectanglehandle,
GHOST_TInt32 l,
GHOST_TInt32 t,
GHOST_TInt32 r,
GHOST_TInt32 b);
/**
* Returns whether this rectangle is empty.
@@ -806,7 +818,7 @@ extern GHOST_TSuccess GHOST_IsValidRectangle(GHOST_RectangleHandle rectanglehand
* \param rectanglehandle: The handle to the rectangle.
* \param i: The amount of offset given to each extreme (negative values shrink the rectangle).
*/
extern void GHOST_InsetRectangle(GHOST_RectangleHandle rectanglehandle, int32_t i);
extern void GHOST_InsetRectangle(GHOST_RectangleHandle rectanglehandle, GHOST_TInt32 i);
/**
* Does a union of the rectangle given and this rectangle.
@@ -823,7 +835,9 @@ extern void GHOST_UnionRectangle(GHOST_RectangleHandle rectanglehandle,
* \param x: The x-coordinate of the point.
* \param y: The y-coordinate of the point.
*/
extern void GHOST_UnionPointRectangle(GHOST_RectangleHandle rectanglehandle, int32_t x, int32_t y);
extern void GHOST_UnionPointRectangle(GHOST_RectangleHandle rectanglehandle,
GHOST_TInt32 x,
GHOST_TInt32 y);
/**
* Returns whether the point is inside this rectangle.
@@ -834,8 +848,8 @@ extern void GHOST_UnionPointRectangle(GHOST_RectangleHandle rectanglehandle, int
* \return Success value (true if point is inside).
*/
extern GHOST_TSuccess GHOST_IsInsideRectangle(GHOST_RectangleHandle rectanglehandle,
int32_t x,
int32_t y);
GHOST_TInt32 x,
GHOST_TInt32 y);
/**
* Returns whether the rectangle is inside this rectangle.
@@ -854,8 +868,8 @@ extern GHOST_TVisibility GHOST_GetRectangleVisibility(
* \param cy: Requested center y-coordinate of the rectangle.
*/
extern void GHOST_SetCenterRectangle(GHOST_RectangleHandle rectanglehandle,
int32_t cx,
int32_t cy);
GHOST_TInt32 cx,
GHOST_TInt32 cy);
/**
* Sets rectangle members.
@@ -867,8 +881,11 @@ extern void GHOST_SetCenterRectangle(GHOST_RectangleHandle rectanglehandle,
* \param w: requested width of the rectangle.
* \param h: requested height of the rectangle.
*/
extern void GHOST_SetRectangleCenter(
GHOST_RectangleHandle rectanglehandle, int32_t cx, int32_t cy, int32_t w, int32_t h);
extern void GHOST_SetRectangleCenter(GHOST_RectangleHandle rectanglehandle,
GHOST_TInt32 cx,
GHOST_TInt32 cy,
GHOST_TInt32 w,
GHOST_TInt32 h);
/**
* Clips a rectangle.
@@ -886,14 +903,14 @@ extern GHOST_TSuccess GHOST_ClipRectangle(GHOST_RectangleHandle rectanglehandle,
* \param selection: Boolean to return the selection instead, X11 only feature.
* \return clipboard data
*/
extern char *GHOST_getClipboard(bool selection);
extern GHOST_TUns8 *GHOST_getClipboard(int selection);
/**
* Put data to the Clipboard
* \param buffer: the string buffer to set.
* \param selection: Set the selection instead, X11 only feature.
*/
extern void GHOST_putClipboard(char *buffer, bool selection);
extern void GHOST_putClipboard(GHOST_TInt8 *buffer, int selection);
/**
* Toggles console
@@ -925,7 +942,7 @@ extern float GHOST_GetNativePixelSize(GHOST_WindowHandle windowhandle);
/**
* Returns the suggested DPI for this window.
*/
extern uint16_t GHOST_GetDPIHint(GHOST_WindowHandle windowhandle);
extern GHOST_TUns16 GHOST_GetDPIHint(GHOST_WindowHandle windowhandle);
/**
* Enable IME attached to the given window, i.e. allows user-input
@@ -939,8 +956,12 @@ extern uint16_t GHOST_GetDPIHint(GHOST_WindowHandle windowhandle);
* - true: Start a new composition.
* - false: Move the IME windows to the given position without finishing it.
*/
extern void GHOST_BeginIME(
GHOST_WindowHandle windowhandle, int32_t x, int32_t y, int32_t w, int32_t h, bool complete);
extern void GHOST_BeginIME(GHOST_WindowHandle windowhandle,
GHOST_TInt32 x,
GHOST_TInt32 y,
GHOST_TInt32 w,
GHOST_TInt32 h,
int complete);
/**
* Disable the IME attached to the given window, i.e. prohibits any user-input
* events from being dispatched to the IME.
@@ -1055,7 +1076,7 @@ void GHOST_XrDestroyActionSet(GHOST_XrContextHandle xr_context, const char *acti
*/
int GHOST_XrCreateActions(GHOST_XrContextHandle xr_context,
const char *action_set_name,
uint32_t count,
GHOST_TUns32 count,
const GHOST_XrActionInfo *infos);
/**
@@ -1063,7 +1084,7 @@ int GHOST_XrCreateActions(GHOST_XrContextHandle xr_context,
*/
void GHOST_XrDestroyActions(GHOST_XrContextHandle xr_context,
const char *action_set_name,
uint32_t count,
GHOST_TUns32 count,
const char *const *action_names);
/**
@@ -1071,7 +1092,7 @@ void GHOST_XrDestroyActions(GHOST_XrContextHandle xr_context,
*/
int GHOST_XrCreateActionSpaces(GHOST_XrContextHandle xr_context,
const char *action_set_name,
uint32_t count,
GHOST_TUns32 count,
const GHOST_XrActionSpaceInfo *infos);
/**
@@ -1079,7 +1100,7 @@ int GHOST_XrCreateActionSpaces(GHOST_XrContextHandle xr_context,
*/
void GHOST_XrDestroyActionSpaces(GHOST_XrContextHandle xr_context,
const char *action_set_name,
uint32_t count,
GHOST_TUns32 count,
const GHOST_XrActionSpaceInfo *infos);
/**
@@ -1087,7 +1108,7 @@ void GHOST_XrDestroyActionSpaces(GHOST_XrContextHandle xr_context,
*/
int GHOST_XrCreateActionBindings(GHOST_XrContextHandle xr_context,
const char *action_set_name,
uint32_t count,
GHOST_TUns32 count,
const GHOST_XrActionProfileInfo *infos);
/**
@@ -1095,7 +1116,7 @@ int GHOST_XrCreateActionBindings(GHOST_XrContextHandle xr_context,
*/
void GHOST_XrDestroyActionBindings(GHOST_XrContextHandle xr_context,
const char *action_set_name,
uint32_t count,
GHOST_TUns32 count,
const GHOST_XrActionProfileInfo *infos);
/**
@@ -1117,7 +1138,7 @@ int GHOST_XrSyncActions(GHOST_XrContextHandle xr_context, const char *action_set
int GHOST_XrApplyHapticAction(GHOST_XrContextHandle xr_context,
const char *action_set_name,
const char *action_name,
const int64_t *duration,
const GHOST_TInt64 *duration,
const float *frequency,
const float *amplitude);

View File

@@ -58,7 +58,7 @@ class GHOST_IEvent {
* Returns the time this event was generated.
* \return The event generation time.
*/
virtual uint64_t getTime() = 0;
virtual GHOST_TUns64 getTime() = 0;
/**
* Returns the window this event was generated on,

View File

@@ -177,7 +177,7 @@ class GHOST_ISystem {
* Based on ANSI clock() routine.
* \return The number of milliseconds.
*/
virtual uint64_t getMilliSeconds() const = 0;
virtual GHOST_TUns64 getMilliSeconds() const = 0;
/**
* Installs a timer.
@@ -189,8 +189,8 @@ class GHOST_ISystem {
* \param userData: Placeholder for user data.
* \return A timer task (0 if timer task installation failed).
*/
virtual GHOST_ITimerTask *installTimer(uint64_t delay,
uint64_t interval,
virtual GHOST_ITimerTask *installTimer(GHOST_TUns64 delay,
GHOST_TUns64 interval,
GHOST_TimerProcPtr timerProc,
GHOST_TUserDataPtr userData = NULL) = 0;
@@ -209,19 +209,19 @@ class GHOST_ISystem {
* Returns the number of displays on this system.
* \return The number of displays.
*/
virtual uint8_t getNumDisplays() const = 0;
virtual GHOST_TUns8 getNumDisplays() const = 0;
/**
* Returns the dimensions of the main display on this system.
* \return The dimension of the main display.
*/
virtual void getMainDisplayDimensions(uint32_t &width, uint32_t &height) const = 0;
virtual void getMainDisplayDimensions(GHOST_TUns32 &width, GHOST_TUns32 &height) const = 0;
/**
* Returns the combine dimensions of all monitors.
* \return The dimension of the workspace.
*/
virtual void getAllDisplayDimensions(uint32_t &width, uint32_t &height) const = 0;
virtual void getAllDisplayDimensions(GHOST_TUns32 &width, GHOST_TUns32 &height) const = 0;
/**
* Create a new window.
@@ -242,10 +242,10 @@ class GHOST_ISystem {
* \return The new window (or 0 if creation failed).
*/
virtual GHOST_IWindow *createWindow(const char *title,
int32_t left,
int32_t top,
uint32_t width,
uint32_t height,
GHOST_TInt32 left,
GHOST_TInt32 top,
GHOST_TUns32 width,
GHOST_TUns32 height,
GHOST_TWindowState state,
GHOST_TDrawingContextType type,
GHOST_GLSettings glSettings,
@@ -365,7 +365,7 @@ class GHOST_ISystem {
* \param y: The y-coordinate of the cursor.
* \return Indication of success.
*/
virtual GHOST_TSuccess getCursorPosition(int32_t &x, int32_t &y) const = 0;
virtual GHOST_TSuccess getCursorPosition(GHOST_TInt32 &x, GHOST_TInt32 &y) const = 0;
/**
* Updates the location of the cursor (location in screen coordinates).
@@ -374,7 +374,7 @@ class GHOST_ISystem {
* \param y: The y-coordinate of the cursor.
* \return Indication of success.
*/
virtual GHOST_TSuccess setCursorPosition(int32_t x, int32_t y) = 0;
virtual GHOST_TSuccess setCursorPosition(GHOST_TInt32 x, GHOST_TInt32 y) = 0;
/***************************************************************************************
* Access to mouse button and keyboard states.
@@ -431,12 +431,12 @@ class GHOST_ISystem {
* \return "unsigned char" from X11 XA_CUT_BUFFER0 buffer
*
*/
virtual char *getClipboard(bool selection) const = 0;
virtual GHOST_TUns8 *getClipboard(bool selection) const = 0;
/**
* Put data to the Clipboard
*/
virtual void putClipboard(char *buffer, bool selection) const = 0;
virtual void putClipboard(GHOST_TInt8 *buffer, bool selection) const = 0;
/***************************************************************************************
* System Message Box.

View File

@@ -68,26 +68,26 @@ class GHOST_ISystemPaths {
* "unpack and run" path, then look for properly installed path, including versioning.
* \return Unsigned char string pointing to system dir (eg /usr/share/blender/).
*/
virtual const char *getSystemDir(int version, const char *versionstr) const = 0;
virtual const GHOST_TUns8 *getSystemDir(int version, const char *versionstr) const = 0;
/**
* Determine the base dir in which user configuration is stored, including versioning.
* If needed, it will create the base directory.
* \return Unsigned char string pointing to user dir (eg ~/.blender/).
*/
virtual const char *getUserDir(int version, const char *versionstr) const = 0;
virtual const GHOST_TUns8 *getUserDir(int version, const char *versionstr) const = 0;
/**
* Determine a special ("well known") and easy to reach user directory.
* \return Unsigned char string pointing to user dir (eg `~/Documents/`).
*/
virtual const char *getUserSpecialDir(GHOST_TUserSpecialDirTypes type) const = 0;
virtual const GHOST_TUns8 *getUserSpecialDir(GHOST_TUserSpecialDirTypes type) const = 0;
/**
* Determine the directory of the current binary
* \return Unsigned char string pointing to the binary dir
*/
virtual const char *getBinaryDir() const = 0;
virtual const GHOST_TUns8 *getBinaryDir() const = 0;
/**
* Add the file to the operating system most recently used files

View File

@@ -108,20 +108,20 @@ class GHOST_IWindow {
* Resizes client rectangle width.
* \param width: The new width of the client area of the window.
*/
virtual GHOST_TSuccess setClientWidth(uint32_t width) = 0;
virtual GHOST_TSuccess setClientWidth(GHOST_TUns32 width) = 0;
/**
* Resizes client rectangle height.
* \param height: The new height of the client area of the window.
*/
virtual GHOST_TSuccess setClientHeight(uint32_t height) = 0;
virtual GHOST_TSuccess setClientHeight(GHOST_TUns32 height) = 0;
/**
* Resizes client rectangle.
* \param width: The new width of the client area of the window.
* \param height: The new height of the client area of the window.
*/
virtual GHOST_TSuccess setClientSize(uint32_t width, uint32_t height) = 0;
virtual GHOST_TSuccess setClientSize(GHOST_TUns32 width, GHOST_TUns32 height) = 0;
/**
* Converts a point in screen coordinates to client rectangle coordinates
@@ -130,7 +130,10 @@ class GHOST_IWindow {
* \param outX: The x-coordinate in the client rectangle.
* \param outY: The y-coordinate in the client rectangle.
*/
virtual void screenToClient(int32_t inX, int32_t inY, int32_t &outX, int32_t &outY) const = 0;
virtual void screenToClient(GHOST_TInt32 inX,
GHOST_TInt32 inY,
GHOST_TInt32 &outX,
GHOST_TInt32 &outY) const = 0;
/**
* Converts a point in screen coordinates to client rectangle coordinates
@@ -139,7 +142,10 @@ class GHOST_IWindow {
* \param outX: The x-coordinate on the screen.
* \param outY: The y-coordinate on the screen.
*/
virtual void clientToScreen(int32_t inX, int32_t inY, int32_t &outX, int32_t &outY) const = 0;
virtual void clientToScreen(GHOST_TInt32 inX,
GHOST_TInt32 inY,
GHOST_TInt32 &outX,
GHOST_TInt32 &outY) const = 0;
/**
* Tells if the ongoing drag'n'drop object can be accepted upon mouse drop
@@ -284,8 +290,8 @@ class GHOST_IWindow {
* \param hotY: The Y coordinate of the cursor hot-spot.
* \return Indication of success.
*/
virtual GHOST_TSuccess setCustomCursorShape(uint8_t *bitmap,
uint8_t *mask,
virtual GHOST_TSuccess setCustomCursorShape(GHOST_TUns8 *bitmap,
GHOST_TUns8 *mask,
int sizex,
int sizey,
int hotX,
@@ -313,7 +319,7 @@ class GHOST_IWindow {
virtual GHOST_TSuccess setCursorGrab(GHOST_TGrabCursorMode /*mode*/,
GHOST_TAxisFlag /*wrap_axis*/,
GHOST_Rect * /*bounds*/,
int32_t /*mouse_ungrab_xy*/[2])
GHOST_TInt32 /*mouse_ungrab_xy*/[2])
{
return GHOST_kSuccess;
}
@@ -328,7 +334,7 @@ class GHOST_IWindow {
* Returns the recommended DPI for this window.
* \return The recommended DPI for this window.
*/
virtual uint16_t getDPIHint() = 0;
virtual GHOST_TUns16 getDPIHint() = 0;
#ifdef WITH_INPUT_IME
/**
@@ -342,7 +348,8 @@ class GHOST_IWindow {
* - true: Start a new composition
* - false: Move the IME windows to the given position without finishing it.
*/
virtual void beginIME(int32_t x, int32_t y, int32_t w, int32_t h, bool completed) = 0;
virtual void beginIME(
GHOST_TInt32 x, GHOST_TInt32 y, GHOST_TInt32 w, GHOST_TInt32 h, int completed) = 0;
/**
* Disable the IME attached to the given window, i.e. prohibits any user-input

View File

@@ -48,25 +48,25 @@ extern GHOST_TSuccess GHOST_DisposeSystemPaths(void);
* "unpack and run" path, then look for properly installed path, including versioning.
* \return Unsigned char string pointing to system dir (eg /usr/share/blender/).
*/
extern const char *GHOST_getSystemDir(int version, const char *versionstr);
extern const GHOST_TUns8 *GHOST_getSystemDir(int version, const char *versionstr);
/**
* Determine the base dir in which user configuration is stored, including versioning.
* \return Unsigned char string pointing to user dir (eg ~).
*/
extern const char *GHOST_getUserDir(int version, const char *versionstr);
extern const GHOST_TUns8 *GHOST_getUserDir(int version, const char *versionstr);
/**
* Determine a special ("well known") and easy to reach user directory.
* \return Unsigned char string pointing to user dir (eg `~/Documents/`).
*/
extern const char *GHOST_getUserSpecialDir(GHOST_TUserSpecialDirTypes type);
extern const GHOST_TUns8 *GHOST_getUserSpecialDir(GHOST_TUserSpecialDirTypes type);
/**
* Determine the dir in which the binary file is found.
* \return Unsigned char string pointing to binary dir (eg ~/usr/local/bin/).
*/
extern const char *GHOST_getBinaryDir(void);
extern const GHOST_TUns8 *GHOST_getBinaryDir(void);
/**
* Add the file to the operating system most recently used files

View File

@@ -42,7 +42,7 @@ class GHOST_Rect {
* \param r: requested right coordinate of the rectangle.
* \param b: requested bottom coordinate of the rectangle.
*/
GHOST_Rect(int32_t l = 0, int32_t t = 0, int32_t r = 0, int32_t b = 0)
GHOST_Rect(GHOST_TInt32 l = 0, GHOST_TInt32 t = 0, GHOST_TInt32 r = 0, GHOST_TInt32 b = 0)
: m_l(l), m_t(t), m_r(r), m_b(b)
{
}
@@ -58,13 +58,13 @@ class GHOST_Rect {
* Access to rectangle width.
* \return width of the rectangle.
*/
virtual inline int32_t getWidth() const;
virtual inline GHOST_TInt32 getWidth() const;
/**
* Access to rectangle height.
* \return height of the rectangle.
*/
virtual inline int32_t getHeight() const;
virtual inline GHOST_TInt32 getHeight() const;
/**
* Sets all members of the rectangle.
@@ -73,7 +73,7 @@ class GHOST_Rect {
* \param r: requested right coordinate of the rectangle.
* \param b: requested bottom coordinate of the rectangle.
*/
virtual inline void set(int32_t l, int32_t t, int32_t r, int32_t b);
virtual inline void set(GHOST_TInt32 l, GHOST_TInt32 t, GHOST_TInt32 r, GHOST_TInt32 b);
/**
* Returns whether this rectangle is empty.
@@ -95,7 +95,7 @@ class GHOST_Rect {
* The method avoids negative insets making the rectangle invalid
* \param i: The amount of offset given to each extreme (negative values shrink the rectangle).
*/
virtual void inset(int32_t i);
virtual void inset(GHOST_TInt32 i);
/**
* Does a union of the rectangle given and this rectangle.
@@ -109,14 +109,17 @@ class GHOST_Rect {
* \param x: The x-coordinate of the point.
* \param y: The y-coordinate of the point.
*/
virtual inline void unionPoint(int32_t x, int32_t y);
virtual inline void unionPoint(GHOST_TInt32 x, GHOST_TInt32 y);
/**
* Grows the rectangle to included a point.
* \param x: The x-coordinate of the point.
* \param y: The y-coordinate of the point.
*/
virtual inline void wrapPoint(int32_t &x, int32_t &y, int32_t ofs, GHOST_TAxisFlag axis);
virtual inline void wrapPoint(GHOST_TInt32 &x,
GHOST_TInt32 &y,
GHOST_TInt32 ofs,
GHOST_TAxisFlag axis);
/**
* Returns whether the point is inside this rectangle.
@@ -125,7 +128,7 @@ class GHOST_Rect {
* \param y: y-coordinate of point to test.
* \return boolean value (true if point is inside).
*/
virtual inline bool isInside(int32_t x, int32_t y) const;
virtual inline bool isInside(GHOST_TInt32 x, GHOST_TInt32 y) const;
/**
* Returns whether the rectangle is inside this rectangle.
@@ -140,7 +143,7 @@ class GHOST_Rect {
* \param cx: requested center x-coordinate of the rectangle.
* \param cy: requested center y-coordinate of the rectangle.
*/
virtual void setCenter(int32_t cx, int32_t cy);
virtual void setCenter(GHOST_TInt32 cx, GHOST_TInt32 cy);
/**
* Sets rectangle members.
@@ -151,7 +154,7 @@ class GHOST_Rect {
* \param w: requested width of the rectangle.
* \param h: requested height of the rectangle.
*/
virtual void setCenter(int32_t cx, int32_t cy, int32_t w, int32_t h);
virtual void setCenter(GHOST_TInt32 cx, GHOST_TInt32 cy, GHOST_TInt32 w, GHOST_TInt32 h);
/**
* Clips a rectangle.
@@ -163,30 +166,30 @@ class GHOST_Rect {
virtual bool clip(GHOST_Rect &r) const;
/** Left coordinate of the rectangle */
int32_t m_l;
GHOST_TInt32 m_l;
/** Top coordinate of the rectangle */
int32_t m_t;
GHOST_TInt32 m_t;
/** Right coordinate of the rectangle */
int32_t m_r;
GHOST_TInt32 m_r;
/** Bottom coordinate of the rectangle */
int32_t m_b;
GHOST_TInt32 m_b;
#ifdef WITH_CXX_GUARDEDALLOC
MEM_CXX_CLASS_ALLOC_FUNCS("GHOST:GHOST_Rect")
#endif
};
inline int32_t GHOST_Rect::getWidth() const
inline GHOST_TInt32 GHOST_Rect::getWidth() const
{
return m_r - m_l;
}
inline int32_t GHOST_Rect::getHeight() const
inline GHOST_TInt32 GHOST_Rect::getHeight() const
{
return m_b - m_t;
}
inline void GHOST_Rect::set(int32_t l, int32_t t, int32_t r, int32_t b)
inline void GHOST_Rect::set(GHOST_TInt32 l, GHOST_TInt32 t, GHOST_TInt32 r, GHOST_TInt32 b)
{
m_l = l;
m_t = t;
@@ -216,7 +219,7 @@ inline void GHOST_Rect::unionRect(const GHOST_Rect &r)
m_b = r.m_b;
}
inline void GHOST_Rect::unionPoint(int32_t x, int32_t y)
inline void GHOST_Rect::unionPoint(GHOST_TInt32 x, GHOST_TInt32 y)
{
if (x < m_l)
m_l = x;
@@ -228,10 +231,13 @@ inline void GHOST_Rect::unionPoint(int32_t x, int32_t y)
m_b = y;
}
inline void GHOST_Rect::wrapPoint(int32_t &x, int32_t &y, int32_t ofs, GHOST_TAxisFlag axis)
inline void GHOST_Rect::wrapPoint(GHOST_TInt32 &x,
GHOST_TInt32 &y,
GHOST_TInt32 ofs,
GHOST_TAxisFlag axis)
{
int32_t w = getWidth();
int32_t h = getHeight();
GHOST_TInt32 w = getWidth();
GHOST_TInt32 h = getHeight();
/* highly unlikely but avoid eternal loop */
if (w - ofs * 2 <= 0 || h - ofs * 2 <= 0) {
@@ -252,7 +258,7 @@ inline void GHOST_Rect::wrapPoint(int32_t &x, int32_t &y, int32_t ofs, GHOST_TAx
}
}
inline bool GHOST_Rect::isInside(int32_t x, int32_t y) const
inline bool GHOST_Rect::isInside(GHOST_TInt32 x, GHOST_TInt32 y) const
{
return (x >= m_l) && (x <= m_r) && (y >= m_t) && (y <= m_b);
}

View File

@@ -23,8 +23,6 @@
#pragma once
#include <stdint.h>
#ifdef WITH_CXX_GUARDEDALLOC
# include "MEM_guardedalloc.h"
#endif
@@ -58,6 +56,13 @@ GHOST_DECLARE_HANDLE(GHOST_EventConsumerHandle);
GHOST_DECLARE_HANDLE(GHOST_ContextHandle);
GHOST_DECLARE_HANDLE(GHOST_XrContextHandle);
typedef char GHOST_TInt8;
typedef unsigned char GHOST_TUns8;
typedef short GHOST_TInt16;
typedef unsigned short GHOST_TUns16;
typedef int GHOST_TInt32;
typedef unsigned int GHOST_TUns32;
typedef struct {
int flags;
} GHOST_GLSettings;
@@ -73,6 +78,14 @@ typedef enum GHOST_DialogOptions {
GHOST_DialogError = (1 << 1),
} GHOST_DialogOptions;
#ifdef _MSC_VER
typedef __int64 GHOST_TInt64;
typedef unsigned __int64 GHOST_TUns64;
#else
typedef long long GHOST_TInt64;
typedef unsigned long long GHOST_TUns64;
#endif
typedef void *GHOST_TUserDataPtr;
typedef enum { GHOST_kFailure = 0, GHOST_kSuccess } GHOST_TSuccess;
@@ -423,9 +436,9 @@ typedef void *GHOST_TEventDataPtr;
typedef struct {
/** The x-coordinate of the cursor position. */
int32_t x;
GHOST_TInt32 x;
/** The y-coordinate of the cursor position. */
int32_t y;
GHOST_TInt32 y;
/** Associated tablet data. */
GHOST_TabletData tablet;
} GHOST_TEventCursorData;
@@ -439,7 +452,7 @@ typedef struct {
typedef struct {
/** Displacement of a mouse wheel. */
int32_t z;
GHOST_TInt32 z;
} GHOST_TEventWheelData;
typedef enum {
@@ -455,13 +468,13 @@ typedef struct {
/** The event subtype */
GHOST_TTrackpadEventSubTypes subtype;
/** The x-location of the trackpad event */
int32_t x;
GHOST_TInt32 x;
/** The y-location of the trackpad event */
int32_t y;
GHOST_TInt32 y;
/** The x-delta or value of the trackpad event */
int32_t deltaX;
GHOST_TInt32 deltaX;
/** The y-delta (currently only for scroll subtype) of the trackpad event */
int32_t deltaY;
GHOST_TInt32 deltaY;
/** The delta is inverted from the device due to system preferences. */
char isDirectionInverted;
} GHOST_TEventTrackpadData;
@@ -475,9 +488,9 @@ typedef enum {
typedef struct {
/** The x-coordinate of the cursor position. */
int32_t x;
GHOST_TInt32 x;
/** The y-coordinate of the cursor position. */
int32_t y;
GHOST_TInt32 y;
/** The dropped item type */
GHOST_TDragnDropTypes dataType;
/** The "dropped content" */
@@ -502,7 +515,7 @@ typedef struct {
typedef struct {
int count;
uint8_t **strings;
GHOST_TUns8 **strings;
} GHOST_TStringArray;
typedef enum {
@@ -574,13 +587,13 @@ typedef enum {
typedef struct {
/** Number of pixels on a line. */
uint32_t xPixels;
GHOST_TUns32 xPixels;
/** Number of lines. */
uint32_t yPixels;
GHOST_TUns32 yPixels;
/** Number of bits per pixel. */
uint32_t bpp;
GHOST_TUns32 bpp;
/** Refresh rate (in Hertz). */
uint32_t frequency;
GHOST_TUns32 frequency;
} GHOST_DisplaySetting;
#ifdef _WIN32
@@ -600,10 +613,10 @@ typedef int GHOST_TEmbedderWindowID;
*/
#ifdef __cplusplus
class GHOST_ITimerTask;
typedef void (*GHOST_TimerProcPtr)(GHOST_ITimerTask *task, uint64_t time);
typedef void (*GHOST_TimerProcPtr)(GHOST_ITimerTask *task, GHOST_TUns64 time);
#else
struct GHOST_TimerTaskHandle__;
typedef void (*GHOST_TimerProcPtr)(struct GHOST_TimerTaskHandle__ *task, uint64_t time);
typedef void (*GHOST_TimerProcPtr)(struct GHOST_TimerTaskHandle__ *task, GHOST_TUns64 time);
#endif
#ifdef WITH_XR_OPENXR
@@ -711,7 +724,7 @@ typedef enum GHOST_XrActionType {
typedef struct GHOST_XrActionInfo {
const char *name;
GHOST_XrActionType type;
uint32_t count_subaction_paths;
GHOST_TUns32 count_subaction_paths;
const char **subaction_paths;
/** States for each subaction path. */
void *states;
@@ -722,7 +735,7 @@ typedef struct GHOST_XrActionInfo {
typedef struct GHOST_XrActionSpaceInfo {
const char *action_name;
uint32_t count_subaction_paths;
GHOST_TUns32 count_subaction_paths;
const char **subaction_paths;
/** Poses for each subaction path. */
const GHOST_XrPose *poses;
@@ -730,14 +743,14 @@ typedef struct GHOST_XrActionSpaceInfo {
typedef struct GHOST_XrActionBindingInfo {
const char *action_name;
uint32_t count_interaction_paths;
GHOST_TUns32 count_interaction_paths;
/** Interaction path: User (sub-action) path + component path. */
const char **interaction_paths;
} GHOST_XrActionBindingInfo;
typedef struct GHOST_XrActionProfileInfo {
const char *profile_path;
uint32_t count_bindings;
GHOST_TUns32 count_bindings;
const GHOST_XrActionBindingInfo *bindings;
} GHOST_XrActionProfileInfo;

View File

@@ -57,7 +57,7 @@ struct GHOST_Buttons {
*/
void clear();
uint8_t m_ButtonLeft : 1;
uint8_t m_ButtonMiddle : 1;
uint8_t m_ButtonRight : 1;
GHOST_TUns8 m_ButtonLeft : 1;
GHOST_TUns8 m_ButtonMiddle : 1;
GHOST_TUns8 m_ButtonRight : 1;
};

View File

@@ -84,7 +84,7 @@ GHOST_TSuccess GHOST_DisposeEventConsumer(GHOST_EventConsumerHandle consumerhand
return GHOST_kSuccess;
}
uint64_t GHOST_GetMilliSeconds(GHOST_SystemHandle systemhandle)
GHOST_TUns64 GHOST_GetMilliSeconds(GHOST_SystemHandle systemhandle)
{
GHOST_ISystem *system = (GHOST_ISystem *)systemhandle;
@@ -92,8 +92,8 @@ uint64_t GHOST_GetMilliSeconds(GHOST_SystemHandle systemhandle)
}
GHOST_TimerTaskHandle GHOST_InstallTimer(GHOST_SystemHandle systemhandle,
uint64_t delay,
uint64_t interval,
GHOST_TUns64 delay,
GHOST_TUns64 interval,
GHOST_TimerProcPtr timerproc,
GHOST_TUserDataPtr userdata)
{
@@ -111,7 +111,7 @@ GHOST_TSuccess GHOST_RemoveTimer(GHOST_SystemHandle systemhandle,
return system->removeTimer(timertask);
}
uint8_t GHOST_GetNumDisplays(GHOST_SystemHandle systemhandle)
GHOST_TUns8 GHOST_GetNumDisplays(GHOST_SystemHandle systemhandle)
{
GHOST_ISystem *system = (GHOST_ISystem *)systemhandle;
@@ -119,8 +119,8 @@ uint8_t GHOST_GetNumDisplays(GHOST_SystemHandle systemhandle)
}
void GHOST_GetMainDisplayDimensions(GHOST_SystemHandle systemhandle,
uint32_t *width,
uint32_t *height)
GHOST_TUns32 *width,
GHOST_TUns32 *height)
{
GHOST_ISystem *system = (GHOST_ISystem *)systemhandle;
@@ -128,8 +128,8 @@ void GHOST_GetMainDisplayDimensions(GHOST_SystemHandle systemhandle,
}
void GHOST_GetAllDisplayDimensions(GHOST_SystemHandle systemhandle,
uint32_t *width,
uint32_t *height)
GHOST_TUns32 *width,
GHOST_TUns32 *height)
{
GHOST_ISystem *system = (GHOST_ISystem *)systemhandle;
@@ -156,10 +156,10 @@ GHOST_TSuccess GHOST_DisposeOpenGLContext(GHOST_SystemHandle systemhandle,
GHOST_WindowHandle GHOST_CreateWindow(GHOST_SystemHandle systemhandle,
GHOST_WindowHandle parent_windowhandle,
const char *title,
int32_t left,
int32_t top,
uint32_t width,
uint32_t height,
GHOST_TInt32 left,
GHOST_TInt32 top,
GHOST_TUns32 width,
GHOST_TUns32 height,
GHOST_TWindowState state,
bool is_dialog,
GHOST_TDrawingContextType type,
@@ -317,13 +317,13 @@ GHOST_TSuccess GHOST_HasCursorShape(GHOST_WindowHandle windowhandle,
}
GHOST_TSuccess GHOST_SetCustomCursorShape(GHOST_WindowHandle windowhandle,
uint8_t *bitmap,
uint8_t *mask,
GHOST_TUns8 *bitmap,
GHOST_TUns8 *mask,
int sizex,
int sizey,
int hotX,
int hotY,
bool canInvertColor)
GHOST_TUns8 canInvertColor)
{
GHOST_IWindow *window = (GHOST_IWindow *)windowhandle;
@@ -344,14 +344,18 @@ GHOST_TSuccess GHOST_SetCursorVisibility(GHOST_WindowHandle windowhandle, int vi
return window->setCursorVisibility(visible ? true : false);
}
GHOST_TSuccess GHOST_GetCursorPosition(GHOST_SystemHandle systemhandle, int32_t *x, int32_t *y)
GHOST_TSuccess GHOST_GetCursorPosition(GHOST_SystemHandle systemhandle,
GHOST_TInt32 *x,
GHOST_TInt32 *y)
{
GHOST_ISystem *system = (GHOST_ISystem *)systemhandle;
return system->getCursorPosition(*x, *y);
}
GHOST_TSuccess GHOST_SetCursorPosition(GHOST_SystemHandle systemhandle, int32_t x, int32_t y)
GHOST_TSuccess GHOST_SetCursorPosition(GHOST_SystemHandle systemhandle,
GHOST_TInt32 x,
GHOST_TInt32 y)
{
GHOST_ISystem *system = (GHOST_ISystem *)systemhandle;
@@ -366,7 +370,7 @@ GHOST_TSuccess GHOST_SetCursorGrab(GHOST_WindowHandle windowhandle,
{
GHOST_IWindow *window = (GHOST_IWindow *)windowhandle;
GHOST_Rect bounds_rect;
int32_t mouse_xy[2];
GHOST_TInt32 mouse_xy[2];
if (bounds) {
bounds_rect = GHOST_Rect(bounds[0], bounds[1], bounds[2], bounds[3]);
@@ -416,7 +420,7 @@ void GHOST_setNDOFDeadZone(float deadzone)
}
#endif
void GHOST_setAcceptDragOperation(GHOST_WindowHandle windowhandle, bool canAccept)
void GHOST_setAcceptDragOperation(GHOST_WindowHandle windowhandle, GHOST_TInt8 canAccept)
{
GHOST_IWindow *window = (GHOST_IWindow *)windowhandle;
@@ -430,7 +434,7 @@ GHOST_TEventType GHOST_GetEventType(GHOST_EventHandle eventhandle)
return event->getType();
}
uint64_t GHOST_GetEventTime(GHOST_EventHandle eventhandle)
GHOST_TUns64 GHOST_GetEventTime(GHOST_EventHandle eventhandle)
{
GHOST_IEvent *event = (GHOST_IEvent *)eventhandle;
@@ -551,14 +555,14 @@ void GHOST_DisposeRectangle(GHOST_RectangleHandle rectanglehandle)
delete (GHOST_Rect *)rectanglehandle;
}
GHOST_TSuccess GHOST_SetClientWidth(GHOST_WindowHandle windowhandle, uint32_t width)
GHOST_TSuccess GHOST_SetClientWidth(GHOST_WindowHandle windowhandle, GHOST_TUns32 width)
{
GHOST_IWindow *window = (GHOST_IWindow *)windowhandle;
return window->setClientWidth(width);
}
GHOST_TSuccess GHOST_SetClientHeight(GHOST_WindowHandle windowhandle, uint32_t height)
GHOST_TSuccess GHOST_SetClientHeight(GHOST_WindowHandle windowhandle, GHOST_TUns32 height)
{
GHOST_IWindow *window = (GHOST_IWindow *)windowhandle;
@@ -566,24 +570,30 @@ GHOST_TSuccess GHOST_SetClientHeight(GHOST_WindowHandle windowhandle, uint32_t h
}
GHOST_TSuccess GHOST_SetClientSize(GHOST_WindowHandle windowhandle,
uint32_t width,
uint32_t height)
GHOST_TUns32 width,
GHOST_TUns32 height)
{
GHOST_IWindow *window = (GHOST_IWindow *)windowhandle;
return window->setClientSize(width, height);
}
void GHOST_ScreenToClient(
GHOST_WindowHandle windowhandle, int32_t inX, int32_t inY, int32_t *outX, int32_t *outY)
void GHOST_ScreenToClient(GHOST_WindowHandle windowhandle,
GHOST_TInt32 inX,
GHOST_TInt32 inY,
GHOST_TInt32 *outX,
GHOST_TInt32 *outY)
{
GHOST_IWindow *window = (GHOST_IWindow *)windowhandle;
window->screenToClient(inX, inY, *outX, *outY);
}
void GHOST_ClientToScreen(
GHOST_WindowHandle windowhandle, int32_t inX, int32_t inY, int32_t *outX, int32_t *outY)
void GHOST_ClientToScreen(GHOST_WindowHandle windowhandle,
GHOST_TInt32 inX,
GHOST_TInt32 inY,
GHOST_TInt32 *outX,
GHOST_TInt32 *outY)
{
GHOST_IWindow *window = (GHOST_IWindow *)windowhandle;
@@ -604,7 +614,8 @@ GHOST_TSuccess GHOST_SetWindowState(GHOST_WindowHandle windowhandle, GHOST_TWind
return window->setState(state);
}
GHOST_TSuccess GHOST_SetWindowModifiedState(GHOST_WindowHandle windowhandle, bool isUnsavedChanges)
GHOST_TSuccess GHOST_SetWindowModifiedState(GHOST_WindowHandle windowhandle,
GHOST_TUns8 isUnsavedChanges)
{
GHOST_IWindow *window = (GHOST_IWindow *)windowhandle;
@@ -692,18 +703,21 @@ void GHOST_SetTabletAPI(GHOST_SystemHandle systemhandle, GHOST_TTabletAPI api)
system->setTabletAPI(api);
}
int32_t GHOST_GetWidthRectangle(GHOST_RectangleHandle rectanglehandle)
GHOST_TInt32 GHOST_GetWidthRectangle(GHOST_RectangleHandle rectanglehandle)
{
return ((GHOST_Rect *)rectanglehandle)->getWidth();
}
int32_t GHOST_GetHeightRectangle(GHOST_RectangleHandle rectanglehandle)
GHOST_TInt32 GHOST_GetHeightRectangle(GHOST_RectangleHandle rectanglehandle)
{
return ((GHOST_Rect *)rectanglehandle)->getHeight();
}
void GHOST_GetRectangle(
GHOST_RectangleHandle rectanglehandle, int32_t *l, int32_t *t, int32_t *r, int32_t *b)
void GHOST_GetRectangle(GHOST_RectangleHandle rectanglehandle,
GHOST_TInt32 *l,
GHOST_TInt32 *t,
GHOST_TInt32 *r,
GHOST_TInt32 *b)
{
GHOST_Rect *rect = (GHOST_Rect *)rectanglehandle;
@@ -713,8 +727,11 @@ void GHOST_GetRectangle(
*b = rect->m_b;
}
void GHOST_SetRectangle(
GHOST_RectangleHandle rectanglehandle, int32_t l, int32_t t, int32_t r, int32_t b)
void GHOST_SetRectangle(GHOST_RectangleHandle rectanglehandle,
GHOST_TInt32 l,
GHOST_TInt32 t,
GHOST_TInt32 r,
GHOST_TInt32 b)
{
((GHOST_Rect *)rectanglehandle)->set(l, t, r, b);
}
@@ -739,7 +756,7 @@ GHOST_TSuccess GHOST_IsValidRectangle(GHOST_RectangleHandle rectanglehandle)
return result;
}
void GHOST_InsetRectangle(GHOST_RectangleHandle rectanglehandle, int32_t i)
void GHOST_InsetRectangle(GHOST_RectangleHandle rectanglehandle, GHOST_TInt32 i)
{
((GHOST_Rect *)rectanglehandle)->inset(i);
}
@@ -750,12 +767,16 @@ void GHOST_UnionRectangle(GHOST_RectangleHandle rectanglehandle,
((GHOST_Rect *)rectanglehandle)->unionRect(*(GHOST_Rect *)anotherrectanglehandle);
}
void GHOST_UnionPointRectangle(GHOST_RectangleHandle rectanglehandle, int32_t x, int32_t y)
void GHOST_UnionPointRectangle(GHOST_RectangleHandle rectanglehandle,
GHOST_TInt32 x,
GHOST_TInt32 y)
{
((GHOST_Rect *)rectanglehandle)->unionPoint(x, y);
}
GHOST_TSuccess GHOST_IsInsideRectangle(GHOST_RectangleHandle rectanglehandle, int32_t x, int32_t y)
GHOST_TSuccess GHOST_IsInsideRectangle(GHOST_RectangleHandle rectanglehandle,
GHOST_TInt32 x,
GHOST_TInt32 y)
{
GHOST_TSuccess result = GHOST_kFailure;
@@ -775,13 +796,18 @@ GHOST_TVisibility GHOST_GetRectangleVisibility(GHOST_RectangleHandle rectangleha
return visible;
}
void GHOST_SetCenterRectangle(GHOST_RectangleHandle rectanglehandle, int32_t cx, int32_t cy)
void GHOST_SetCenterRectangle(GHOST_RectangleHandle rectanglehandle,
GHOST_TInt32 cx,
GHOST_TInt32 cy)
{
((GHOST_Rect *)rectanglehandle)->setCenter(cx, cy);
}
void GHOST_SetRectangleCenter(
GHOST_RectangleHandle rectanglehandle, int32_t cx, int32_t cy, int32_t w, int32_t h)
void GHOST_SetRectangleCenter(GHOST_RectangleHandle rectanglehandle,
GHOST_TInt32 cx,
GHOST_TInt32 cy,
GHOST_TInt32 w,
GHOST_TInt32 h)
{
((GHOST_Rect *)rectanglehandle)->setCenter(cx, cy, w, h);
}
@@ -797,13 +823,13 @@ GHOST_TSuccess GHOST_ClipRectangle(GHOST_RectangleHandle rectanglehandle,
return result;
}
char *GHOST_getClipboard(bool selection)
GHOST_TUns8 *GHOST_getClipboard(int selection)
{
GHOST_ISystem *system = GHOST_ISystem::getSystem();
return system->getClipboard(selection);
}
void GHOST_putClipboard(char *buffer, bool selection)
void GHOST_putClipboard(GHOST_TInt8 *buffer, int selection)
{
GHOST_ISystem *system = GHOST_ISystem::getSystem();
system->putClipboard(buffer, selection);
@@ -835,7 +861,7 @@ float GHOST_GetNativePixelSize(GHOST_WindowHandle windowhandle)
return 1.0f;
}
uint16_t GHOST_GetDPIHint(GHOST_WindowHandle windowhandle)
GHOST_TUns16 GHOST_GetDPIHint(GHOST_WindowHandle windowhandle)
{
GHOST_IWindow *window = (GHOST_IWindow *)windowhandle;
return window->getDPIHint();
@@ -843,8 +869,12 @@ uint16_t GHOST_GetDPIHint(GHOST_WindowHandle windowhandle)
#ifdef WITH_INPUT_IME
void GHOST_BeginIME(
GHOST_WindowHandle windowhandle, int32_t x, int32_t y, int32_t w, int32_t h, bool complete)
void GHOST_BeginIME(GHOST_WindowHandle windowhandle,
GHOST_TInt32 x,
GHOST_TInt32 y,
GHOST_TInt32 w,
GHOST_TInt32 h,
int complete)
{
GHOST_IWindow *window = (GHOST_IWindow *)windowhandle;
window->beginIME(x, y, w, h, complete);
@@ -942,7 +972,7 @@ void GHOST_XrDestroyActionSet(GHOST_XrContextHandle xr_contexthandle, const char
int GHOST_XrCreateActions(GHOST_XrContextHandle xr_contexthandle,
const char *action_set_name,
uint32_t count,
GHOST_TUns32 count,
const GHOST_XrActionInfo *infos)
{
GHOST_IXrContext *xr_context = (GHOST_IXrContext *)xr_contexthandle;
@@ -953,7 +983,7 @@ int GHOST_XrCreateActions(GHOST_XrContextHandle xr_contexthandle,
void GHOST_XrDestroyActions(GHOST_XrContextHandle xr_contexthandle,
const char *action_set_name,
uint32_t count,
GHOST_TUns32 count,
const char *const *action_names)
{
GHOST_IXrContext *xr_context = (GHOST_IXrContext *)xr_contexthandle;
@@ -963,7 +993,7 @@ void GHOST_XrDestroyActions(GHOST_XrContextHandle xr_contexthandle,
int GHOST_XrCreateActionSpaces(GHOST_XrContextHandle xr_contexthandle,
const char *action_set_name,
uint32_t count,
GHOST_TUns32 count,
const GHOST_XrActionSpaceInfo *infos)
{
GHOST_IXrContext *xr_context = (GHOST_IXrContext *)xr_contexthandle;
@@ -975,7 +1005,7 @@ int GHOST_XrCreateActionSpaces(GHOST_XrContextHandle xr_contexthandle,
void GHOST_XrDestroyActionSpaces(GHOST_XrContextHandle xr_contexthandle,
const char *action_set_name,
uint32_t count,
GHOST_TUns32 count,
const GHOST_XrActionSpaceInfo *infos)
{
GHOST_IXrContext *xr_context = (GHOST_IXrContext *)xr_contexthandle;
@@ -985,7 +1015,7 @@ void GHOST_XrDestroyActionSpaces(GHOST_XrContextHandle xr_contexthandle,
int GHOST_XrCreateActionBindings(GHOST_XrContextHandle xr_contexthandle,
const char *action_set_name,
uint32_t count,
GHOST_TUns32 count,
const GHOST_XrActionProfileInfo *infos)
{
GHOST_IXrContext *xr_context = (GHOST_IXrContext *)xr_contexthandle;
@@ -997,7 +1027,7 @@ int GHOST_XrCreateActionBindings(GHOST_XrContextHandle xr_contexthandle,
void GHOST_XrDestroyActionBindings(GHOST_XrContextHandle xr_contexthandle,
const char *action_set_name,
uint32_t count,
GHOST_TUns32 count,
const GHOST_XrActionProfileInfo *infos)
{
GHOST_IXrContext *xr_context = (GHOST_IXrContext *)xr_contexthandle;
@@ -1024,7 +1054,7 @@ int GHOST_XrSyncActions(GHOST_XrContextHandle xr_contexthandle, const char *acti
int GHOST_XrApplyHapticAction(GHOST_XrContextHandle xr_contexthandle,
const char *action_set_name,
const char *action_name,
const int64_t *duration,
const GHOST_TInt64 *duration,
const float *frequency,
const float *amplitude)
{

View File

@@ -49,20 +49,20 @@ GHOST_TSuccess GHOST_DisplayManager::initialize(void)
return success;
}
GHOST_TSuccess GHOST_DisplayManager::getNumDisplays(uint8_t & /*numDisplays*/) const
GHOST_TSuccess GHOST_DisplayManager::getNumDisplays(GHOST_TUns8 & /*numDisplays*/) const
{
// Don't know if we have a display...
return GHOST_kFailure;
}
GHOST_TSuccess GHOST_DisplayManager::getNumDisplaySettings(uint8_t display,
int32_t &numSettings) const
GHOST_TSuccess GHOST_DisplayManager::getNumDisplaySettings(GHOST_TUns8 display,
GHOST_TInt32 &numSettings) const
{
GHOST_TSuccess success;
GHOST_ASSERT(m_settingsInitialized,
"GHOST_DisplayManager::getNumDisplaySettings(): m_settingsInitialized=false");
uint8_t numDisplays;
GHOST_TUns8 numDisplays;
success = getNumDisplays(numDisplays);
if (success == GHOST_kSuccess) {
if (display < numDisplays) {
@@ -75,18 +75,18 @@ GHOST_TSuccess GHOST_DisplayManager::getNumDisplaySettings(uint8_t display,
return success;
}
GHOST_TSuccess GHOST_DisplayManager::getDisplaySetting(uint8_t display,
int32_t index,
GHOST_TSuccess GHOST_DisplayManager::getDisplaySetting(GHOST_TUns8 display,
GHOST_TInt32 index,
GHOST_DisplaySetting &setting) const
{
GHOST_TSuccess success;
GHOST_ASSERT(m_settingsInitialized,
"GHOST_DisplayManager::getNumDisplaySettings(): m_settingsInitialized=false");
uint8_t numDisplays;
GHOST_TUns8 numDisplays;
success = getNumDisplays(numDisplays);
if (success == GHOST_kSuccess) {
if (display < numDisplays && ((uint8_t)index < m_settings[display].size())) {
if (display < numDisplays && ((GHOST_TUns8)index < m_settings[display].size())) {
setting = m_settings[display][index];
}
else {
@@ -97,18 +97,18 @@ GHOST_TSuccess GHOST_DisplayManager::getDisplaySetting(uint8_t display,
}
GHOST_TSuccess GHOST_DisplayManager::getCurrentDisplaySetting(
uint8_t /*display*/, GHOST_DisplaySetting & /*setting*/) const
GHOST_TUns8 /*display*/, GHOST_DisplaySetting & /*setting*/) const
{
return GHOST_kFailure;
}
GHOST_TSuccess GHOST_DisplayManager::setCurrentDisplaySetting(
uint8_t /*display*/, const GHOST_DisplaySetting & /*setting*/)
GHOST_TUns8 /*display*/, const GHOST_DisplaySetting & /*setting*/)
{
return GHOST_kFailure;
}
GHOST_TSuccess GHOST_DisplayManager::findMatch(uint8_t display,
GHOST_TSuccess GHOST_DisplayManager::findMatch(GHOST_TUns8 display,
const GHOST_DisplaySetting &setting,
GHOST_DisplaySetting &match) const
{
@@ -157,16 +157,17 @@ GHOST_TSuccess GHOST_DisplayManager::findMatch(uint8_t display,
GHOST_TSuccess GHOST_DisplayManager::initializeSettings(void)
{
uint8_t numDisplays;
GHOST_TUns8 numDisplays;
GHOST_TSuccess success = getNumDisplays(numDisplays);
if (success == GHOST_kSuccess) {
for (uint8_t display = 0; (display < numDisplays) && (success == GHOST_kSuccess); display++) {
for (GHOST_TUns8 display = 0; (display < numDisplays) && (success == GHOST_kSuccess);
display++) {
GHOST_DisplaySettings displaySettings;
m_settings.push_back(displaySettings);
int32_t numSettings;
GHOST_TInt32 numSettings;
success = getNumDisplaySettings(display, numSettings);
if (success == GHOST_kSuccess) {
int32_t index;
GHOST_TInt32 index;
GHOST_DisplaySetting setting;
for (index = 0; (index < numSettings) && (success == GHOST_kSuccess); index++) {
success = getDisplaySetting(display, index, setting);

View File

@@ -55,7 +55,7 @@ class GHOST_DisplayManager {
* \param numDisplays: The number of displays on this system.
* \return Indication of success.
*/
virtual GHOST_TSuccess getNumDisplays(uint8_t &numDisplays) const;
virtual GHOST_TSuccess getNumDisplays(GHOST_TUns8 &numDisplays) const;
/**
* Returns the number of display settings for this display device.
@@ -63,7 +63,8 @@ class GHOST_DisplayManager {
* \param numSettings: The number of settings of the display device with this index.
* \return Indication of success.
*/
virtual GHOST_TSuccess getNumDisplaySettings(uint8_t display, int32_t &numSettings) const;
virtual GHOST_TSuccess getNumDisplaySettings(GHOST_TUns8 display,
GHOST_TInt32 &numSettings) const;
/**
* Returns the current setting for this display device.
@@ -72,8 +73,8 @@ class GHOST_DisplayManager {
* \param setting: The setting of the display device with this index.
* \return Indication of success.
*/
virtual GHOST_TSuccess getDisplaySetting(uint8_t display,
int32_t index,
virtual GHOST_TSuccess getDisplaySetting(GHOST_TUns8 display,
GHOST_TInt32 index,
GHOST_DisplaySetting &setting) const;
/**
@@ -82,7 +83,7 @@ class GHOST_DisplayManager {
* \param setting: The current setting of the display device with this index.
* \return Indication of success.
*/
virtual GHOST_TSuccess getCurrentDisplaySetting(uint8_t display,
virtual GHOST_TSuccess getCurrentDisplaySetting(GHOST_TUns8 display,
GHOST_DisplaySetting &setting) const;
/**
@@ -93,7 +94,7 @@ class GHOST_DisplayManager {
* \param setting: The setting of the display device to be matched and activated.
* \return Indication of success.
*/
virtual GHOST_TSuccess setCurrentDisplaySetting(uint8_t display,
virtual GHOST_TSuccess setCurrentDisplaySetting(GHOST_TUns8 display,
const GHOST_DisplaySetting &setting);
protected:
@@ -106,7 +107,7 @@ class GHOST_DisplayManager {
* \param match: The optimal display setting.
* \return Indication of success.
*/
GHOST_TSuccess findMatch(uint8_t display,
GHOST_TSuccess findMatch(GHOST_TUns8 display,
const GHOST_DisplaySetting &setting,
GHOST_DisplaySetting &match) const;

View File

@@ -46,7 +46,7 @@ class GHOST_DisplayManagerCocoa : public GHOST_DisplayManager {
* \param numDisplays: The number of displays on this system.
* \return Indication of success.
*/
GHOST_TSuccess getNumDisplays(uint8_t &numDisplays) const;
GHOST_TSuccess getNumDisplays(GHOST_TUns8 &numDisplays) const;
/**
* Returns the number of display settings for this display device.
@@ -54,7 +54,7 @@ class GHOST_DisplayManagerCocoa : public GHOST_DisplayManager {
* \param numSetting: The number of settings of the display device with this index.
* \return Indication of success.
*/
GHOST_TSuccess getNumDisplaySettings(uint8_t display, int32_t &numSettings) const;
GHOST_TSuccess getNumDisplaySettings(GHOST_TUns8 display, GHOST_TInt32 &numSettings) const;
/**
* Returns the current setting for this display device.
@@ -63,8 +63,8 @@ class GHOST_DisplayManagerCocoa : public GHOST_DisplayManager {
* \param setting: The setting of the display device with this index.
* \return Indication of success.
*/
GHOST_TSuccess getDisplaySetting(uint8_t display,
int32_t index,
GHOST_TSuccess getDisplaySetting(GHOST_TUns8 display,
GHOST_TInt32 index,
GHOST_DisplaySetting &setting) const;
/**
@@ -73,7 +73,8 @@ class GHOST_DisplayManagerCocoa : public GHOST_DisplayManager {
* \param setting: The current setting of the display device with this index.
* \return Indication of success.
*/
GHOST_TSuccess getCurrentDisplaySetting(uint8_t display, GHOST_DisplaySetting &setting) const;
GHOST_TSuccess getCurrentDisplaySetting(GHOST_TUns8 display,
GHOST_DisplaySetting &setting) const;
/**
* Changes the current setting for this display device.
@@ -81,7 +82,8 @@ class GHOST_DisplayManagerCocoa : public GHOST_DisplayManager {
* \param setting: The current setting of the display device with this index.
* \return Indication of success.
*/
GHOST_TSuccess setCurrentDisplaySetting(uint8_t display, const GHOST_DisplaySetting &setting);
GHOST_TSuccess setCurrentDisplaySetting(GHOST_TUns8 display,
const GHOST_DisplaySetting &setting);
protected:
// Do not cache values as OS X supports screen hot plug

View File

@@ -29,26 +29,26 @@ GHOST_DisplayManagerCocoa::GHOST_DisplayManagerCocoa(void)
{
}
GHOST_TSuccess GHOST_DisplayManagerCocoa::getNumDisplays(uint8_t &numDisplays) const
GHOST_TSuccess GHOST_DisplayManagerCocoa::getNumDisplays(GHOST_TUns8 &numDisplays) const
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
numDisplays = (uint8_t)[[NSScreen screens] count];
numDisplays = (GHOST_TUns8)[[NSScreen screens] count];
[pool drain];
return GHOST_kSuccess;
}
GHOST_TSuccess GHOST_DisplayManagerCocoa::getNumDisplaySettings(uint8_t display,
int32_t &numSettings) const
GHOST_TSuccess GHOST_DisplayManagerCocoa::getNumDisplaySettings(GHOST_TUns8 display,
GHOST_TInt32 &numSettings) const
{
numSettings = (int32_t)3; // Width, Height, BitsPerPixel
numSettings = (GHOST_TInt32)3; // Width, Height, BitsPerPixel
return GHOST_kSuccess;
}
GHOST_TSuccess GHOST_DisplayManagerCocoa::getDisplaySetting(uint8_t display,
int32_t index,
GHOST_TSuccess GHOST_DisplayManagerCocoa::getDisplaySetting(GHOST_TUns8 display,
GHOST_TInt32 index,
GHOST_DisplaySetting &setting) const
{
NSScreen *askedDisplay;
@@ -86,7 +86,7 @@ GHOST_TSuccess GHOST_DisplayManagerCocoa::getDisplaySetting(uint8_t display,
}
GHOST_TSuccess GHOST_DisplayManagerCocoa::getCurrentDisplaySetting(
uint8_t display, GHOST_DisplaySetting &setting) const
GHOST_TUns8 display, GHOST_DisplaySetting &setting) const
{
NSScreen *askedDisplay;
@@ -127,7 +127,7 @@ GHOST_TSuccess GHOST_DisplayManagerCocoa::getCurrentDisplaySetting(
}
GHOST_TSuccess GHOST_DisplayManagerCocoa::setCurrentDisplaySetting(
uint8_t display, const GHOST_DisplaySetting &setting)
GHOST_TUns8 display, const GHOST_DisplaySetting &setting)
{
GHOST_ASSERT(
(display == kMainDisplay),

View File

@@ -31,25 +31,25 @@ class GHOST_DisplayManagerNULL : public GHOST_DisplayManager {
GHOST_DisplayManagerNULL(GHOST_SystemNULL *system) : GHOST_DisplayManager(), m_system(system)
{ /* nop */
}
GHOST_TSuccess getNumDisplays(uint8_t &numDisplays) const
GHOST_TSuccess getNumDisplays(GHOST_TUns8 &numDisplays) const
{
return GHOST_kFailure;
}
GHOST_TSuccess getNumDisplaySettings(uint8_t display, int32_t &numSettings) const
GHOST_TSuccess getNumDisplaySettings(GHOST_TUns8 display, GHOST_TInt32 &numSettings) const
{
return GHOST_kFailure;
}
GHOST_TSuccess getDisplaySetting(uint8_t display,
int32_t index,
GHOST_TSuccess getDisplaySetting(GHOST_TUns8 display,
GHOST_TInt32 index,
GHOST_DisplaySetting &setting) const
{
return GHOST_kFailure;
}
GHOST_TSuccess getCurrentDisplaySetting(uint8_t display, GHOST_DisplaySetting &setting) const
GHOST_TSuccess getCurrentDisplaySetting(GHOST_TUns8 display, GHOST_DisplaySetting &setting) const
{
return getDisplaySetting(display, int32_t(0), setting);
return getDisplaySetting(display, GHOST_TInt32(0), setting);
}
GHOST_TSuccess setCurrentDisplaySetting(uint8_t display, const GHOST_DisplaySetting &setting)
GHOST_TSuccess setCurrentDisplaySetting(GHOST_TUns8 display, const GHOST_DisplaySetting &setting)
{
return GHOST_kSuccess;
}

View File

@@ -33,14 +33,14 @@ GHOST_DisplayManagerSDL::GHOST_DisplayManagerSDL(GHOST_SystemSDL *system)
memset(&m_mode, 0, sizeof(m_mode));
}
GHOST_TSuccess GHOST_DisplayManagerSDL::getNumDisplays(uint8_t &numDisplays) const
GHOST_TSuccess GHOST_DisplayManagerSDL::getNumDisplays(GHOST_TUns8 &numDisplays) const
{
numDisplays = SDL_GetNumVideoDisplays();
return GHOST_kSuccess;
}
GHOST_TSuccess GHOST_DisplayManagerSDL::getNumDisplaySettings(uint8_t display,
int32_t &numSettings) const
GHOST_TSuccess GHOST_DisplayManagerSDL::getNumDisplaySettings(GHOST_TUns8 display,
GHOST_TInt32 &numSettings) const
{
GHOST_ASSERT(display < 1, "Only single display systems are currently supported.\n");
@@ -66,8 +66,8 @@ static void ghost_mode_to_sdl(const GHOST_DisplaySetting &setting, SDL_DisplayMo
mode->refresh_rate = setting.frequency;
}
GHOST_TSuccess GHOST_DisplayManagerSDL::getDisplaySetting(uint8_t display,
int32_t index,
GHOST_TSuccess GHOST_DisplayManagerSDL::getDisplaySetting(GHOST_TUns8 display,
GHOST_TInt32 index,
GHOST_DisplaySetting &setting) const
{
GHOST_ASSERT(display < 1, "Only single display systems are currently supported.\n");
@@ -81,7 +81,7 @@ GHOST_TSuccess GHOST_DisplayManagerSDL::getDisplaySetting(uint8_t display,
}
GHOST_TSuccess GHOST_DisplayManagerSDL::getCurrentDisplaySetting(
uint8_t display, GHOST_DisplaySetting &setting) const
GHOST_TUns8 display, GHOST_DisplaySetting &setting) const
{
SDL_DisplayMode mode;
SDL_GetCurrentDisplayMode(display, &mode);
@@ -98,7 +98,7 @@ GHOST_TSuccess GHOST_DisplayManagerSDL::getCurrentDisplayModeSDL(SDL_DisplayMode
}
GHOST_TSuccess GHOST_DisplayManagerSDL::setCurrentDisplaySetting(
uint8_t display, const GHOST_DisplaySetting &setting)
GHOST_TUns8 display, const GHOST_DisplaySetting &setting)
{
/*
* Mode switching code ported from Quake 2 version 3.21 and bzflag version

View File

@@ -37,19 +37,21 @@ class GHOST_DisplayManagerSDL : public GHOST_DisplayManager {
public:
GHOST_DisplayManagerSDL(GHOST_SystemSDL *system);
GHOST_TSuccess getNumDisplays(uint8_t &numDisplays) const;
GHOST_TSuccess getNumDisplays(GHOST_TUns8 &numDisplays) const;
GHOST_TSuccess getNumDisplaySettings(uint8_t display, int32_t &numSettings) const;
GHOST_TSuccess getNumDisplaySettings(GHOST_TUns8 display, GHOST_TInt32 &numSettings) const;
GHOST_TSuccess getDisplaySetting(uint8_t display,
int32_t index,
GHOST_TSuccess getDisplaySetting(GHOST_TUns8 display,
GHOST_TInt32 index,
GHOST_DisplaySetting &setting) const;
GHOST_TSuccess getCurrentDisplaySetting(uint8_t display, GHOST_DisplaySetting &setting) const;
GHOST_TSuccess getCurrentDisplaySetting(GHOST_TUns8 display,
GHOST_DisplaySetting &setting) const;
GHOST_TSuccess getCurrentDisplayModeSDL(SDL_DisplayMode &mode) const;
GHOST_TSuccess setCurrentDisplaySetting(uint8_t display, const GHOST_DisplaySetting &setting);
GHOST_TSuccess setCurrentDisplaySetting(GHOST_TUns8 display,
const GHOST_DisplaySetting &setting);
private:
GHOST_SystemSDL *m_system;

View File

@@ -35,7 +35,7 @@ GHOST_DisplayManagerWin32::GHOST_DisplayManagerWin32(void)
{
}
GHOST_TSuccess GHOST_DisplayManagerWin32::getNumDisplays(uint8_t &numDisplays) const
GHOST_TSuccess GHOST_DisplayManagerWin32::getNumDisplays(GHOST_TUns8 &numDisplays) const
{
numDisplays = ::GetSystemMetrics(SM_CMONITORS);
return numDisplays > 0 ? GHOST_kSuccess : GHOST_kFailure;
@@ -54,8 +54,8 @@ static BOOL get_dd(DWORD d, DISPLAY_DEVICE *dd)
* the information that was cached the last time the function was called with iModeNum
* set to zero.
*/
GHOST_TSuccess GHOST_DisplayManagerWin32::getNumDisplaySettings(uint8_t display,
int32_t &numSettings) const
GHOST_TSuccess GHOST_DisplayManagerWin32::getNumDisplaySettings(GHOST_TUns8 display,
GHOST_TInt32 &numSettings) const
{
DISPLAY_DEVICE display_device;
if (!get_dd(display, &display_device))
@@ -69,8 +69,8 @@ GHOST_TSuccess GHOST_DisplayManagerWin32::getNumDisplaySettings(uint8_t display,
return GHOST_kSuccess;
}
GHOST_TSuccess GHOST_DisplayManagerWin32::getDisplaySetting(uint8_t display,
int32_t index,
GHOST_TSuccess GHOST_DisplayManagerWin32::getDisplaySetting(GHOST_TUns8 display,
GHOST_TInt32 index,
GHOST_DisplaySetting &setting) const
{
DISPLAY_DEVICE display_device;
@@ -111,13 +111,13 @@ GHOST_TSuccess GHOST_DisplayManagerWin32::getDisplaySetting(uint8_t display,
}
GHOST_TSuccess GHOST_DisplayManagerWin32::getCurrentDisplaySetting(
uint8_t display, GHOST_DisplaySetting &setting) const
GHOST_TUns8 display, GHOST_DisplaySetting &setting) const
{
return getDisplaySetting(display, ENUM_CURRENT_SETTINGS, setting);
}
GHOST_TSuccess GHOST_DisplayManagerWin32::setCurrentDisplaySetting(
uint8_t display, const GHOST_DisplaySetting &setting)
GHOST_TUns8 display, const GHOST_DisplaySetting &setting)
{
DISPLAY_DEVICE display_device;
if (!get_dd(display, &display_device))

View File

@@ -45,7 +45,7 @@ class GHOST_DisplayManagerWin32 : public GHOST_DisplayManager {
* \param numDisplays: The number of displays on this system.
* \return Indication of success.
*/
GHOST_TSuccess getNumDisplays(uint8_t &numDisplays) const;
GHOST_TSuccess getNumDisplays(GHOST_TUns8 &numDisplays) const;
/**
* Returns the number of display settings for this display device.
@@ -53,7 +53,7 @@ class GHOST_DisplayManagerWin32 : public GHOST_DisplayManager {
* \param numSetting: The number of settings of the display device with this index.
* \return Indication of success.
*/
GHOST_TSuccess getNumDisplaySettings(uint8_t display, int32_t &numSettings) const;
GHOST_TSuccess getNumDisplaySettings(GHOST_TUns8 display, GHOST_TInt32 &numSettings) const;
/**
* Returns the current setting for this display device.
@@ -62,8 +62,8 @@ class GHOST_DisplayManagerWin32 : public GHOST_DisplayManager {
* \param setting: The setting of the display device with this index.
* \return Indication of success.
*/
GHOST_TSuccess getDisplaySetting(uint8_t display,
int32_t index,
GHOST_TSuccess getDisplaySetting(GHOST_TUns8 display,
GHOST_TInt32 index,
GHOST_DisplaySetting &setting) const;
/**
@@ -72,7 +72,8 @@ class GHOST_DisplayManagerWin32 : public GHOST_DisplayManager {
* \param setting: The current setting of the display device with this index.
* \return Indication of success.
*/
GHOST_TSuccess getCurrentDisplaySetting(uint8_t display, GHOST_DisplaySetting &setting) const;
GHOST_TSuccess getCurrentDisplaySetting(GHOST_TUns8 display,
GHOST_DisplaySetting &setting) const;
/**
* Changes the current setting for this display device.
@@ -80,7 +81,8 @@ class GHOST_DisplayManagerWin32 : public GHOST_DisplayManager {
* \param setting: The current setting of the display device with this index.
* \return Indication of success.
*/
GHOST_TSuccess setCurrentDisplaySetting(uint8_t display, const GHOST_DisplaySetting &setting);
GHOST_TSuccess setCurrentDisplaySetting(GHOST_TUns8 display,
const GHOST_DisplaySetting &setting);
protected:
};

View File

@@ -40,14 +40,14 @@ GHOST_DisplayManagerX11::GHOST_DisplayManagerX11(GHOST_SystemX11 *system)
/* nothing to do. */
}
GHOST_TSuccess GHOST_DisplayManagerX11::getNumDisplays(uint8_t &numDisplays) const
GHOST_TSuccess GHOST_DisplayManagerX11::getNumDisplays(GHOST_TUns8 &numDisplays) const
{
numDisplays = m_system->getNumDisplays();
return GHOST_kSuccess;
}
GHOST_TSuccess GHOST_DisplayManagerX11::getNumDisplaySettings(uint8_t display,
int32_t &numSettings) const
GHOST_TSuccess GHOST_DisplayManagerX11::getNumDisplaySettings(GHOST_TUns8 display,
GHOST_TInt32 &numSettings) const
{
#ifdef WITH_X11_XF86VMODE
int majorVersion, minorVersion;
@@ -88,8 +88,8 @@ static int calculate_rate(XF86VidModeModeInfo *info)
}
#endif
GHOST_TSuccess GHOST_DisplayManagerX11::getDisplaySetting(uint8_t display,
int32_t index,
GHOST_TSuccess GHOST_DisplayManagerX11::getDisplaySetting(GHOST_TUns8 display,
GHOST_TInt32 index,
GHOST_DisplaySetting &setting) const
{
Display *dpy = m_system->getXDisplay();
@@ -140,7 +140,7 @@ GHOST_TSuccess GHOST_DisplayManagerX11::getDisplaySetting(uint8_t display,
}
GHOST_TSuccess GHOST_DisplayManagerX11::getCurrentDisplaySetting(
uint8_t display, GHOST_DisplaySetting &setting) const
GHOST_TUns8 display, GHOST_DisplaySetting &setting) const
{
/* According to the xf86vidmodegetallmodelines man page,
* "The first element of the array corresponds to the current video mode."
@@ -149,7 +149,7 @@ GHOST_TSuccess GHOST_DisplayManagerX11::getCurrentDisplaySetting(
}
GHOST_TSuccess GHOST_DisplayManagerX11::setCurrentDisplaySetting(
uint8_t /*display*/, const GHOST_DisplaySetting &setting)
GHOST_TUns8 /*display*/, const GHOST_DisplaySetting &setting)
{
#ifdef WITH_X11_XF86VMODE
/* Mode switching code ported from SDL:

View File

@@ -43,7 +43,7 @@ class GHOST_DisplayManagerX11 : public GHOST_DisplayManager {
* \param numDisplays: The number of displays on this system.
* \return Indication of success.
*/
GHOST_TSuccess getNumDisplays(uint8_t &numDisplays) const;
GHOST_TSuccess getNumDisplays(GHOST_TUns8 &numDisplays) const;
/**
* Returns the number of display settings for this display device.
@@ -51,7 +51,7 @@ class GHOST_DisplayManagerX11 : public GHOST_DisplayManager {
* \param numSetting: The number of settings of the display device with this index.
* \return Indication of success.
*/
GHOST_TSuccess getNumDisplaySettings(uint8_t display, int32_t &numSettings) const;
GHOST_TSuccess getNumDisplaySettings(GHOST_TUns8 display, GHOST_TInt32 &numSettings) const;
/**
* Returns the current setting for this display device.
@@ -60,8 +60,8 @@ class GHOST_DisplayManagerX11 : public GHOST_DisplayManager {
* \param setting: The setting of the display device with this index.
* \return Indication of success.
*/
GHOST_TSuccess getDisplaySetting(uint8_t display,
int32_t index,
GHOST_TSuccess getDisplaySetting(GHOST_TUns8 display,
GHOST_TInt32 index,
GHOST_DisplaySetting &setting) const;
/**
@@ -70,7 +70,8 @@ class GHOST_DisplayManagerX11 : public GHOST_DisplayManager {
* \param setting: The current setting of the display device with this index.
* \return Indication of success.
*/
GHOST_TSuccess getCurrentDisplaySetting(uint8_t display, GHOST_DisplaySetting &setting) const;
GHOST_TSuccess getCurrentDisplaySetting(GHOST_TUns8 display,
GHOST_DisplaySetting &setting) const;
/**
* Changes the current setting for this display device.
@@ -78,7 +79,8 @@ class GHOST_DisplayManagerX11 : public GHOST_DisplayManager {
* \param setting: The current setting of the display device with this index.
* \return Indication of success.
*/
GHOST_TSuccess setCurrentDisplaySetting(uint8_t display, const GHOST_DisplaySetting &setting);
GHOST_TSuccess setCurrentDisplaySetting(GHOST_TUns8 display,
const GHOST_DisplaySetting &setting);
private:
GHOST_SystemX11 *m_system;

View File

@@ -242,7 +242,7 @@ void *GHOST_DropTargetWin32::getDropDataAsFilenames(IDataObject *pDataObject)
strArray = (GHOST_TStringArray *)::malloc(sizeof(GHOST_TStringArray));
strArray->count = 0;
strArray->strings = (uint8_t **)::malloc(totfiles * sizeof(uint8_t *));
strArray->strings = (GHOST_TUns8 **)::malloc(totfiles * sizeof(GHOST_TUns8 *));
for (UINT nfile = 0; nfile < totfiles; nfile++) {
if (::DragQueryFileW(hdrop, nfile, fpath, MAX_PATH) > 0) {
@@ -251,7 +251,7 @@ void *GHOST_DropTargetWin32::getDropDataAsFilenames(IDataObject *pDataObject)
}
// Just ignore paths that could not be converted verbatim.
strArray->strings[nvalid] = (uint8_t *)temp_path;
strArray->strings[nvalid] = (GHOST_TUns8 *)temp_path;
strArray->count = nvalid + 1;
nvalid++;
}

View File

@@ -216,7 +216,7 @@ void *GHOST_DropTargetX11::getURIListGhostData(unsigned char *dropBuffer, int dr
strArray = (GHOST_TStringArray *)malloc(sizeof(GHOST_TStringArray));
strArray->count = 0;
strArray->strings = (uint8_t **)malloc(totPaths * sizeof(uint8_t *));
strArray->strings = (GHOST_TUns8 **)malloc(totPaths * sizeof(GHOST_TUns8 *));
curLength = 0;
for (int i = 0; i <= dropBufferSize; i++) {
@@ -230,7 +230,7 @@ void *GHOST_DropTargetX11::getURIListGhostData(unsigned char *dropBuffer, int dr
decodedPath = FileUrlDecode(curPath);
if (decodedPath) {
strArray->strings[strArray->count] = (uint8_t *)decodedPath;
strArray->strings[strArray->count] = (GHOST_TUns8 *)decodedPath;
strArray->count++;
}

View File

@@ -37,7 +37,7 @@ class GHOST_Event : public GHOST_IEvent {
* \param type: The type of this event.
* \param window: The generating window (or NULL if system event).
*/
GHOST_Event(uint64_t msec, GHOST_TEventType type, GHOST_IWindow *window)
GHOST_Event(GHOST_TUns64 msec, GHOST_TEventType type, GHOST_IWindow *window)
: m_type(type), m_time(msec), m_window(window), m_data(NULL)
{
}
@@ -55,7 +55,7 @@ class GHOST_Event : public GHOST_IEvent {
* Returns the time this event was generated.
* \return The event generation time.
*/
uint64_t getTime()
GHOST_TUns64 getTime()
{
return m_time;
}
@@ -83,7 +83,7 @@ class GHOST_Event : public GHOST_IEvent {
/** Type of this event. */
GHOST_TEventType m_type;
/** The time this event was generated. */
uint64_t m_time;
GHOST_TUns64 m_time;
/** Pointer to the generating window. */
GHOST_IWindow *m_window;
/** Pointer to the event data. */

View File

@@ -40,7 +40,7 @@ class GHOST_EventButton : public GHOST_Event {
* \param button: The state of the buttons were at the time of the event.
* \param tablet: The tablet data associated with this event.
*/
GHOST_EventButton(uint64_t time,
GHOST_EventButton(GHOST_TUns64 time,
GHOST_TEventType type,
GHOST_IWindow *window,
GHOST_TButtonMask button,

View File

@@ -39,11 +39,11 @@ class GHOST_EventCursor : public GHOST_Event {
* \param y: The y-coordinate of the location the cursor was at the time of the event.
* \param tablet: The tablet data associated with this event.
*/
GHOST_EventCursor(uint64_t msec,
GHOST_EventCursor(GHOST_TUns64 msec,
GHOST_TEventType type,
GHOST_IWindow *window,
int32_t x,
int32_t y,
GHOST_TInt32 x,
GHOST_TInt32 y,
const GHOST_TabletData &tablet)
: GHOST_Event(msec, type, window), m_cursorEventData({x, y, tablet})
{

View File

@@ -72,7 +72,7 @@ class GHOST_EventDragnDrop : public GHOST_Event {
* \param y: The y-coordinate of the location the cursor was at the time of the event.
* \param data: The "content" dropped in the window.
*/
GHOST_EventDragnDrop(uint64_t time,
GHOST_EventDragnDrop(GHOST_TUns64 time,
GHOST_TEventType type,
GHOST_TDragnDropTypes dataType,
GHOST_IWindow *window,

View File

@@ -39,8 +39,11 @@ class GHOST_EventKey : public GHOST_Event {
* \param type: The type of key event.
* \param key: The key code of the key.
*/
GHOST_EventKey(
uint64_t msec, GHOST_TEventType type, GHOST_IWindow *window, GHOST_TKey key, bool is_repeat)
GHOST_EventKey(GHOST_TUns64 msec,
GHOST_TEventType type,
GHOST_IWindow *window,
GHOST_TKey key,
bool is_repeat)
: GHOST_Event(msec, type, window)
{
m_keyEventData.key = key;
@@ -57,7 +60,7 @@ class GHOST_EventKey : public GHOST_Event {
* \param key: The key code of the key.
* \param ascii: The ascii code for the key event.
*/
GHOST_EventKey(uint64_t msec,
GHOST_EventKey(GHOST_TUns64 msec,
GHOST_TEventType type,
GHOST_IWindow *window,
GHOST_TKey key,

View File

@@ -46,14 +46,14 @@ GHOST_EventManager::~GHOST_EventManager()
}
}
uint32_t GHOST_EventManager::getNumEvents()
GHOST_TUns32 GHOST_EventManager::getNumEvents()
{
return (uint32_t)m_events.size();
return (GHOST_TUns32)m_events.size();
}
uint32_t GHOST_EventManager::getNumEvents(GHOST_TEventType type)
GHOST_TUns32 GHOST_EventManager::getNumEvents(GHOST_TEventType type)
{
uint32_t numEvents = 0;
GHOST_TUns32 numEvents = 0;
TEventStack::iterator p;
for (p = m_events.begin(); p != m_events.end(); ++p) {
if ((*p)->getType() == type) {

View File

@@ -53,14 +53,14 @@ class GHOST_EventManager {
* Returns the number of events currently on the stack.
* \return The number of events on the stack.
*/
uint32_t getNumEvents();
GHOST_TUns32 getNumEvents();
/**
* Returns the number of events of a certain type currently on the stack.
* \param type: The type of events to be counted.
* \return The number of events on the stack of this type.
*/
uint32_t getNumEvents(GHOST_TEventType type);
GHOST_TUns32 getNumEvents(GHOST_TEventType type);
/**
* Pushes an event on the stack.

View File

@@ -31,7 +31,7 @@ class GHOST_EventNDOFMotion : public GHOST_Event {
GHOST_TEventNDOFMotionData m_axisData;
public:
GHOST_EventNDOFMotion(uint64_t time, GHOST_IWindow *window)
GHOST_EventNDOFMotion(GHOST_TUns64 time, GHOST_IWindow *window)
: GHOST_Event(time, GHOST_kEventNDOFMotion, window)
{
m_data = &m_axisData;
@@ -43,7 +43,7 @@ class GHOST_EventNDOFButton : public GHOST_Event {
GHOST_TEventNDOFButtonData m_buttonData;
public:
GHOST_EventNDOFButton(uint64_t time, GHOST_IWindow *window)
GHOST_EventNDOFButton(GHOST_TUns64 time, GHOST_IWindow *window)
: GHOST_Event(time, GHOST_kEventNDOFButton, window)
{
m_data = &m_buttonData;

View File

@@ -39,7 +39,7 @@ bool GHOST_EventPrinter::processEvent(GHOST_IEvent *event)
if (event->getType() == GHOST_kEventWindowUpdate)
return false;
std::cout << "GHOST_EventPrinter::processEvent, time: " << (int32_t)event->getTime()
std::cout << "GHOST_EventPrinter::processEvent, time: " << (GHOST_TInt32)event->getTime()
<< ", type: ";
switch (event->getType()) {
case GHOST_kEventUnknown:

View File

@@ -38,7 +38,7 @@ class GHOST_EventString : public GHOST_Event {
* \param window: The generating window (or NULL if system event).
* \param data_ptr: Pointer to the (un-formatted) data associated with the event.
*/
GHOST_EventString(uint64_t msec,
GHOST_EventString(GHOST_TUns64 msec,
GHOST_TEventType type,
GHOST_IWindow *window,
GHOST_TEventDataPtr data_ptr)

View File

@@ -39,13 +39,13 @@ class GHOST_EventTrackpad : public GHOST_Event {
* \param x: The x-delta of the pan event.
* \param y: The y-delta of the pan event.
*/
GHOST_EventTrackpad(uint64_t msec,
GHOST_EventTrackpad(GHOST_TUns64 msec,
GHOST_IWindow *window,
GHOST_TTrackpadEventSubTypes subtype,
int32_t x,
int32_t y,
int32_t deltaX,
int32_t deltaY,
GHOST_TInt32 x,
GHOST_TInt32 y,
GHOST_TInt32 deltaX,
GHOST_TInt32 deltaY,
bool isDirectionInverted)
: GHOST_Event(msec, GHOST_kEventTrackpad, window)
{

View File

@@ -39,7 +39,7 @@ class GHOST_EventWheel : public GHOST_Event {
* \param window: The window of this event.
* \param z: The displacement of the mouse wheel.
*/
GHOST_EventWheel(uint64_t msec, GHOST_IWindow *window, int32_t z)
GHOST_EventWheel(GHOST_TUns64 msec, GHOST_IWindow *window, GHOST_TInt32 z)
: GHOST_Event(msec, GHOST_kEventWheel, window)
{
m_wheelEventData.z = z;

View File

@@ -44,7 +44,7 @@ class GHOST_EventIME : public GHOST_Event {
* \param type: The type of key event.
* \param key: The key code of the key.
*/
GHOST_EventIME(uint64_t msec, GHOST_TEventType type, GHOST_IWindow *window, void *customdata)
GHOST_EventIME(GHOST_TUns64 msec, GHOST_TEventType type, GHOST_IWindow *window, void *customdata)
: GHOST_Event(msec, type, window)
{
this->m_data = customdata;

View File

@@ -72,17 +72,17 @@ struct GHOST_ModifierKeys {
bool equals(const GHOST_ModifierKeys &keys) const;
/** Bitfield that stores the appropriate key state. */
uint8_t m_LeftShift : 1;
GHOST_TUns8 m_LeftShift : 1;
/** Bitfield that stores the appropriate key state. */
uint8_t m_RightShift : 1;
GHOST_TUns8 m_RightShift : 1;
/** Bitfield that stores the appropriate key state. */
uint8_t m_LeftAlt : 1;
GHOST_TUns8 m_LeftAlt : 1;
/** Bitfield that stores the appropriate key state. */
uint8_t m_RightAlt : 1;
GHOST_TUns8 m_RightAlt : 1;
/** Bitfield that stores the appropriate key state. */
uint8_t m_LeftControl : 1;
GHOST_TUns8 m_LeftControl : 1;
/** Bitfield that stores the appropriate key state. */
uint8_t m_RightControl : 1;
GHOST_TUns8 m_RightControl : 1;
/** Bitfield that stores the appropriate key state. */
uint8_t m_OS : 1;
GHOST_TUns8 m_OS : 1;
};

View File

@@ -279,14 +279,14 @@ bool GHOST_NDOFManager::setDevice(unsigned short vendor_id, unsigned short produ
return m_deviceType != NDOF_UnknownDevice;
}
void GHOST_NDOFManager::updateTranslation(const int t[3], uint64_t time)
void GHOST_NDOFManager::updateTranslation(const int t[3], GHOST_TUns64 time)
{
memcpy(m_translation, t, sizeof(m_translation));
m_motionTime = time;
m_motionEventPending = true;
}
void GHOST_NDOFManager::updateRotation(const int r[3], uint64_t time)
void GHOST_NDOFManager::updateRotation(const int r[3], GHOST_TUns64 time)
{
memcpy(m_rotation, r, sizeof(m_rotation));
m_motionTime = time;
@@ -295,7 +295,7 @@ void GHOST_NDOFManager::updateRotation(const int r[3], uint64_t time)
void GHOST_NDOFManager::sendButtonEvent(NDOF_ButtonT button,
bool press,
uint64_t time,
GHOST_TUns64 time,
GHOST_IWindow *window)
{
GHOST_ASSERT(button > NDOF_BUTTON_NONE && button < NDOF_BUTTON_LAST,
@@ -316,7 +316,7 @@ void GHOST_NDOFManager::sendButtonEvent(NDOF_ButtonT button,
void GHOST_NDOFManager::sendKeyEvent(GHOST_TKey key,
bool press,
uint64_t time,
GHOST_TUns64 time,
GHOST_IWindow *window)
{
GHOST_TEventType type = press ? GHOST_kEventKeyDown : GHOST_kEventKeyUp;
@@ -329,7 +329,7 @@ void GHOST_NDOFManager::sendKeyEvent(GHOST_TKey key,
m_system.pushEvent(event);
}
void GHOST_NDOFManager::updateButton(int button_number, bool press, uint64_t time)
void GHOST_NDOFManager::updateButton(int button_number, bool press, GHOST_TUns64 time)
{
GHOST_IWindow *window = m_system.getWindowManager()->getActiveWindow();
@@ -371,7 +371,7 @@ void GHOST_NDOFManager::updateButton(int button_number, bool press, uint64_t tim
}
}
void GHOST_NDOFManager::updateButtons(int button_bits, uint64_t time)
void GHOST_NDOFManager::updateButtons(int button_bits, GHOST_TUns64 time)
{
button_bits &= m_buttonMask; // discard any "garbage" bits

View File

@@ -130,13 +130,13 @@ class GHOST_NDOFManager {
// rotations are + when CCW, - when CW
// each platform is responsible for getting axis data into this form
// these values should not be scaled (just shuffled or flipped)
void updateTranslation(const int t[3], uint64_t time);
void updateRotation(const int r[3], uint64_t time);
void updateTranslation(const int t[3], GHOST_TUns64 time);
void updateRotation(const int r[3], GHOST_TUns64 time);
// the latest raw button data from the device
// use HID button encoding (not NDOF_ButtonT)
void updateButton(int button_number, bool press, uint64_t time);
void updateButtons(int button_bits, uint64_t time);
void updateButton(int button_number, bool press, GHOST_TUns64 time);
void updateButtons(int button_bits, GHOST_TUns64 time);
// NDOFButton events are sent immediately
// processes and sends most recent raw data as an NDOFMotion event
@@ -147,8 +147,8 @@ class GHOST_NDOFManager {
GHOST_System &m_system;
private:
void sendButtonEvent(NDOF_ButtonT, bool press, uint64_t time, GHOST_IWindow *);
void sendKeyEvent(GHOST_TKey, bool press, uint64_t time, GHOST_IWindow *);
void sendButtonEvent(NDOF_ButtonT, bool press, GHOST_TUns64 time, GHOST_IWindow *);
void sendKeyEvent(GHOST_TKey, bool press, GHOST_TUns64 time, GHOST_IWindow *);
NDOF_DeviceT m_deviceType;
int m_buttonCount;
@@ -159,8 +159,8 @@ class GHOST_NDOFManager {
int m_rotation[3];
int m_buttons; // bit field
uint64_t m_motionTime; // in milliseconds
uint64_t m_prevMotionTime; // time of most recent Motion event sent
GHOST_TUns64 m_motionTime; // in milliseconds
GHOST_TUns64 m_prevMotionTime; // time of most recent Motion event sent
GHOST_TProgress m_motionState;
bool m_motionEventPending;

View File

@@ -195,7 +195,7 @@ static void DeviceEvent(uint32_t unused, uint32_t msg_type, void *msg_arg)
// device state is broadcast to all clients; only react if sent to us
if (s->client == clientID) {
// TODO: is s->time compatible with GHOST timestamps? if so use that instead.
uint64_t now = ghost_system->getMilliSeconds();
GHOST_TUns64 now = ghost_system->getMilliSeconds();
switch (s->command) {
case kConnexionCmdHandleAxis: {

View File

@@ -97,7 +97,7 @@ bool GHOST_NDOFManagerUnix::processEvents()
switch (e.type) {
case SPNAV_EVENT_MOTION: {
/* convert to blender view coords */
uint64_t now = m_system.getMilliSeconds();
GHOST_TUns64 now = m_system.getMilliSeconds();
const int t[3] = {(int)e.motion.x, (int)e.motion.y, (int)-e.motion.z};
const int r[3] = {(int)-e.motion.rx, (int)-e.motion.ry, (int)e.motion.rz};
@@ -109,7 +109,7 @@ bool GHOST_NDOFManagerUnix::processEvents()
break;
}
case SPNAV_EVENT_BUTTON:
uint64_t now = m_system.getMilliSeconds();
GHOST_TUns64 now = m_system.getMilliSeconds();
updateButton(e.button.bnum, e.button.press, now);
break;
}
@@ -118,7 +118,7 @@ bool GHOST_NDOFManagerUnix::processEvents()
#ifdef USE_FINISH_GLITCH_WORKAROUND
if (motion_test_prev == true && motion_test == false) {
uint64_t now = m_system.getMilliSeconds();
GHOST_TUns64 now = m_system.getMilliSeconds();
const int v[3] = {0, 0, 0};
updateTranslation(v, now);

View File

@@ -38,25 +38,25 @@ GHOST_TSuccess GHOST_DisposeSystemPaths(void)
return GHOST_ISystemPaths::dispose();
}
const char *GHOST_getSystemDir(int version, const char *versionstr)
const GHOST_TUns8 *GHOST_getSystemDir(int version, const char *versionstr)
{
GHOST_ISystemPaths *systemPaths = GHOST_ISystemPaths::get();
return systemPaths ? systemPaths->getSystemDir(version, versionstr) : NULL;
}
const char *GHOST_getUserDir(int version, const char *versionstr)
const GHOST_TUns8 *GHOST_getUserDir(int version, const char *versionstr)
{
GHOST_ISystemPaths *systemPaths = GHOST_ISystemPaths::get();
return systemPaths ? systemPaths->getUserDir(version, versionstr) : NULL; /* shouldn't be NULL */
}
const char *GHOST_getUserSpecialDir(GHOST_TUserSpecialDirTypes type)
const GHOST_TUns8 *GHOST_getUserSpecialDir(GHOST_TUserSpecialDirTypes type)
{
GHOST_ISystemPaths *systemPaths = GHOST_ISystemPaths::get();
return systemPaths ? systemPaths->getUserSpecialDir(type) : NULL; /* shouldn't be NULL */
}
const char *GHOST_getBinaryDir()
const GHOST_TUns8 *GHOST_getBinaryDir()
{
GHOST_ISystemPaths *systemPaths = GHOST_ISystemPaths::get();
return systemPaths ? systemPaths->getBinaryDir() : NULL; /* shouldn't be NULL */

View File

@@ -23,7 +23,7 @@
#include "GHOST_Rect.h"
void GHOST_Rect::inset(int32_t i)
void GHOST_Rect::inset(GHOST_TInt32 i)
{
if (i > 0) {
// Grow the rectangle
@@ -34,7 +34,7 @@ void GHOST_Rect::inset(int32_t i)
}
else if (i < 0) {
// Shrink the rectangle, check for insets larger than half the size
int32_t i2 = i * 2;
GHOST_TInt32 i2 = i * 2;
if (getWidth() > i2) {
m_l += i;
m_r -= i;
@@ -82,9 +82,9 @@ GHOST_TVisibility GHOST_Rect::getVisibility(GHOST_Rect &r) const
return v;
}
void GHOST_Rect::setCenter(int32_t cx, int32_t cy)
void GHOST_Rect::setCenter(GHOST_TInt32 cx, GHOST_TInt32 cy)
{
int32_t offset = cx - (m_l + (m_r - m_l) / 2);
GHOST_TInt32 offset = cx - (m_l + (m_r - m_l) / 2);
m_l += offset;
m_r += offset;
offset = cy - (m_t + (m_b - m_t) / 2);
@@ -92,7 +92,7 @@ void GHOST_Rect::setCenter(int32_t cx, int32_t cy)
m_b += offset;
}
void GHOST_Rect::setCenter(int32_t cx, int32_t cy, int32_t w, int32_t h)
void GHOST_Rect::setCenter(GHOST_TInt32 cx, GHOST_TInt32 cy, GHOST_TInt32 w, GHOST_TInt32 h)
{
long w_2, h_2;

View File

@@ -56,19 +56,19 @@ GHOST_System::~GHOST_System()
exit();
}
uint64_t GHOST_System::getMilliSeconds() const
GHOST_TUns64 GHOST_System::getMilliSeconds() const
{
return std::chrono::duration_cast<std::chrono::milliseconds>(
std::chrono::steady_clock::now().time_since_epoch())
.count();
}
GHOST_ITimerTask *GHOST_System::installTimer(uint64_t delay,
uint64_t interval,
GHOST_ITimerTask *GHOST_System::installTimer(GHOST_TUns64 delay,
GHOST_TUns64 interval,
GHOST_TimerProcPtr timerProc,
GHOST_TUserDataPtr userData)
{
uint64_t millis = getMilliSeconds();
GHOST_TUns64 millis = getMilliSeconds();
GHOST_TimerTask *timer = new GHOST_TimerTask(millis + delay, interval, timerProc, userData);
if (timer) {
if (m_timerManager->addTimer(timer) == GHOST_kSuccess) {

View File

@@ -75,7 +75,7 @@ class GHOST_System : public GHOST_ISystem {
* Based on ANSI clock() routine.
* \return The number of milliseconds.
*/
virtual uint64_t getMilliSeconds() const;
virtual GHOST_TUns64 getMilliSeconds() const;
/**
* Installs a timer.
@@ -89,8 +89,8 @@ class GHOST_System : public GHOST_ISystem {
* \param userData: Placeholder for user data.
* \return A timer task (0 if timer task installation failed).
*/
GHOST_ITimerTask *installTimer(uint64_t delay,
uint64_t interval,
GHOST_ITimerTask *installTimer(GHOST_TUns64 delay,
GHOST_TUns64 interval,
GHOST_TimerProcPtr timerProc,
GHOST_TUserDataPtr userData = NULL);
@@ -210,8 +210,8 @@ class GHOST_System : public GHOST_ISystem {
/**
* Inherited from GHOST_ISystem but left pure virtual
* <pre>
* GHOST_TSuccess getCursorPosition(int32_t& x, int32_t& y) const = 0;
* GHOST_TSuccess setCursorPosition(int32_t x, int32_t y)
* GHOST_TSuccess getCursorPosition(GHOST_TInt32& x, GHOST_TInt32& y) const = 0;
* GHOST_TSuccess setCursorPosition(GHOST_TInt32 x, GHOST_TInt32 y)
* </pre>
*/
@@ -308,14 +308,14 @@ class GHOST_System : public GHOST_ISystem {
* \return Returns the clipboard data
*
*/
virtual char *getClipboard(bool selection) const = 0;
virtual GHOST_TUns8 *getClipboard(bool selection) const = 0;
/**
* Put data to the Clipboard
* \param buffer: The buffer to copy to the clipboard.
* \param selection: The clipboard to copy too only used on X11.
*/
virtual void putClipboard(char *buffer, bool selection) const = 0;
virtual void putClipboard(GHOST_TInt8 *buffer, bool selection) const = 0;
/**
* Show a system message box

View File

@@ -59,7 +59,7 @@ class GHOST_SystemCocoa : public GHOST_System {
* Based on ANSI clock() routine.
* \return The number of milliseconds.
*/
uint64_t getMilliSeconds() const;
GHOST_TUns64 getMilliSeconds() const;
/***************************************************************************************
* Display/window management functionality
@@ -69,18 +69,18 @@ class GHOST_SystemCocoa : public GHOST_System {
* Returns the number of displays on this system.
* \return The number of displays.
*/
uint8_t getNumDisplays() const;
GHOST_TUns8 getNumDisplays() const;
/**
* Returns the dimensions of the main display on this system.
* \return The dimension of the main display.
*/
void getMainDisplayDimensions(uint32_t &width, uint32_t &height) const;
void getMainDisplayDimensions(GHOST_TUns32 &width, GHOST_TUns32 &height) const;
/** Returns the combine dimensions of all monitors.
* \return The dimension of the workspace.
*/
void getAllDisplayDimensions(uint32_t &width, uint32_t &height) const;
void getAllDisplayDimensions(GHOST_TUns32 &width, GHOST_TUns32 &height) const;
/**
* Create a new window.
@@ -100,10 +100,10 @@ class GHOST_SystemCocoa : public GHOST_System {
* \return The new window (or 0 if creation failed).
*/
GHOST_IWindow *createWindow(const char *title,
int32_t left,
int32_t top,
uint32_t width,
uint32_t height,
GHOST_TInt32 left,
GHOST_TInt32 top,
GHOST_TUns32 width,
GHOST_TUns32 height,
GHOST_TWindowState state,
GHOST_TDrawingContextType type,
GHOST_GLSettings glSettings,
@@ -137,7 +137,7 @@ class GHOST_SystemCocoa : public GHOST_System {
bool processEvents(bool waitForEvent);
/**
* Handle User request to quit, from Menu bar Quit, and Command+Q
* Handle User request to quit, from Menu bar Quit, and Cmd+Q
* Display alert panel if changes performed since last save
*/
void handleQuitRequest();
@@ -175,7 +175,7 @@ class GHOST_SystemCocoa : public GHOST_System {
* \param y: The y-coordinate of the cursor.
* \return Indication of success.
*/
GHOST_TSuccess getCursorPosition(int32_t &x, int32_t &y) const;
GHOST_TSuccess getCursorPosition(GHOST_TInt32 &x, GHOST_TInt32 &y) const;
/**
* Updates the location of the cursor (location in screen coordinates).
@@ -183,7 +183,7 @@ class GHOST_SystemCocoa : public GHOST_System {
* \param y: The y-coordinate of the cursor.
* \return Indication of success.
*/
GHOST_TSuccess setCursorPosition(int32_t x, int32_t y);
GHOST_TSuccess setCursorPosition(GHOST_TInt32 x, GHOST_TInt32 y);
/***************************************************************************************
* Access to mouse button and keyboard states.
@@ -208,14 +208,14 @@ class GHOST_SystemCocoa : public GHOST_System {
* \param selection: Indicate which buffer to return.
* \return Returns the selected buffer
*/
char *getClipboard(bool selection) const;
GHOST_TUns8 *getClipboard(bool selection) const;
/**
* Puts buffer to system clipboard
* \param buffer: The buffer to be copied.
* \param selection: Indicates which buffer to copy too, only used on X11.
*/
void putClipboard(char *buffer, bool selection) const;
void putClipboard(GHOST_TInt8 *buffer, bool selection) const;
/**
* Handles a window event. Called by GHOST_WindowCocoa window delegate
@@ -288,10 +288,10 @@ class GHOST_SystemCocoa : public GHOST_System {
* \param y: The y-coordinate of the cursor.
* \return Indication of success.
*/
GHOST_TSuccess setMouseCursorPosition(int32_t x, int32_t y);
GHOST_TSuccess setMouseCursorPosition(GHOST_TInt32 x, GHOST_TInt32 y);
/** Start time at initialization. */
uint64_t m_start_time;
GHOST_TUns64 m_start_time;
/** Event has been processed directly by Cocoa (or NDOF manager)
* and has sent a ghost event to be dispatched */
@@ -302,7 +302,7 @@ class GHOST_SystemCocoa : public GHOST_System {
bool m_needDelayedApplicationBecomeActiveEventProcessing;
/** State of the modifiers. */
uint32_t m_modifierMask;
GHOST_TUns32 m_modifierMask;
/** Ignores window size messages (when window is dragged). */
bool m_ignoreWindowSizedMessages;

View File

@@ -655,7 +655,7 @@ GHOST_TSuccess GHOST_SystemCocoa::init()
#pragma mark window management
uint64_t GHOST_SystemCocoa::getMilliSeconds() const
GHOST_TUns64 GHOST_SystemCocoa::getMilliSeconds() const
{
// Cocoa equivalent exists in 10.6 ([[NSProcessInfo processInfo] systemUptime])
struct timeval currentTime;
@@ -667,7 +667,7 @@ uint64_t GHOST_SystemCocoa::getMilliSeconds() const
return ((currentTime.tv_sec * 1000) + (currentTime.tv_usec / 1000) - m_start_time);
}
uint8_t GHOST_SystemCocoa::getNumDisplays() const
GHOST_TUns8 GHOST_SystemCocoa::getNumDisplays() const
{
// Note that OS X supports monitor hot plug
// We do not support multiple monitors at the moment
@@ -676,7 +676,7 @@ uint8_t GHOST_SystemCocoa::getNumDisplays() const
}
}
void GHOST_SystemCocoa::getMainDisplayDimensions(uint32_t &width, uint32_t &height) const
void GHOST_SystemCocoa::getMainDisplayDimensions(GHOST_TUns32 &width, GHOST_TUns32 &height) const
{
@autoreleasepool {
// Get visible frame, that is frame excluding dock and top menu bar
@@ -693,17 +693,17 @@ void GHOST_SystemCocoa::getMainDisplayDimensions(uint32_t &width, uint32_t &heig
}
}
void GHOST_SystemCocoa::getAllDisplayDimensions(uint32_t &width, uint32_t &height) const
void GHOST_SystemCocoa::getAllDisplayDimensions(GHOST_TUns32 &width, GHOST_TUns32 &height) const
{
/* TODO! */
getMainDisplayDimensions(width, height);
}
GHOST_IWindow *GHOST_SystemCocoa::createWindow(const char *title,
int32_t left,
int32_t top,
uint32_t width,
uint32_t height,
GHOST_TInt32 left,
GHOST_TInt32 top,
GHOST_TUns32 width,
GHOST_TUns32 height,
GHOST_TWindowState state,
GHOST_TDrawingContextType type,
GHOST_GLSettings glSettings,
@@ -721,7 +721,7 @@ GHOST_IWindow *GHOST_SystemCocoa::createWindow(const char *title,
styleMask:(NSWindowStyleMaskTitled | NSWindowStyleMaskClosable |
NSWindowStyleMaskMiniaturizable)];
int32_t bottom = (contentRect.size.height - 1) - height - top;
GHOST_TInt32 bottom = (contentRect.size.height - 1) - height - top;
// Ensures window top left is inside this available rect
left = left > contentRect.origin.x ? left : contentRect.origin.x;
@@ -791,20 +791,20 @@ GHOST_TSuccess GHOST_SystemCocoa::disposeContext(GHOST_IContext *context)
/**
* \note : returns coordinates in Cocoa screen coordinates
*/
GHOST_TSuccess GHOST_SystemCocoa::getCursorPosition(int32_t &x, int32_t &y) const
GHOST_TSuccess GHOST_SystemCocoa::getCursorPosition(GHOST_TInt32 &x, GHOST_TInt32 &y) const
{
NSPoint mouseLoc = [NSEvent mouseLocation];
// Returns the mouse location in screen coordinates
x = (int32_t)mouseLoc.x;
y = (int32_t)mouseLoc.y;
x = (GHOST_TInt32)mouseLoc.x;
y = (GHOST_TInt32)mouseLoc.y;
return GHOST_kSuccess;
}
/**
* \note : expect Cocoa screen coordinates
*/
GHOST_TSuccess GHOST_SystemCocoa::setCursorPosition(int32_t x, int32_t y)
GHOST_TSuccess GHOST_SystemCocoa::setCursorPosition(GHOST_TInt32 x, GHOST_TInt32 y)
{
GHOST_WindowCocoa *window = (GHOST_WindowCocoa *)m_windowManager->getActiveWindow();
if (!window)
@@ -824,7 +824,7 @@ GHOST_TSuccess GHOST_SystemCocoa::setCursorPosition(int32_t x, int32_t y)
return GHOST_kSuccess;
}
GHOST_TSuccess GHOST_SystemCocoa::setMouseCursorPosition(int32_t x, int32_t y)
GHOST_TSuccess GHOST_SystemCocoa::setMouseCursorPosition(GHOST_TInt32 x, GHOST_TInt32 y)
{
float xf = (float)x, yf = (float)y;
GHOST_WindowCocoa *window = (GHOST_WindowCocoa *)m_windowManager->getActiveWindow();
@@ -897,7 +897,7 @@ bool GHOST_SystemCocoa::processEvents(bool waitForEvent)
GHOST_TimerManager* timerMgr = getTimerManager();
if (waitForEvent) {
uint64_t next = timerMgr->nextFireTime();
GHOST_TUns64 next = timerMgr->nextFireTime();
double timeOut;
if (next == GHOST_kFireTimeNever) {
@@ -1132,7 +1132,7 @@ GHOST_TSuccess GHOST_SystemCocoa::handleDraggingEvent(GHOST_TEventType eventType
break;
case GHOST_kEventDraggingDropDone: {
uint8_t *temp_buff;
GHOST_TUns8 *temp_buff;
GHOST_TStringArray *strArray;
NSArray *droppedArray;
size_t pastedTextSize;
@@ -1157,13 +1157,13 @@ GHOST_TSuccess GHOST_SystemCocoa::handleDraggingEvent(GHOST_TEventType eventType
return GHOST_kFailure;
}
strArray->strings = (uint8_t **)malloc(strArray->count * sizeof(uint8_t *));
strArray->strings = (GHOST_TUns8 **)malloc(strArray->count * sizeof(GHOST_TUns8 *));
for (i = 0; i < strArray->count; i++) {
droppedStr = [droppedArray objectAtIndex:i];
pastedTextSize = [droppedStr lengthOfBytesUsingEncoding:NSUTF8StringEncoding];
temp_buff = (uint8_t *)malloc(pastedTextSize + 1);
temp_buff = (GHOST_TUns8 *)malloc(pastedTextSize + 1);
if (!temp_buff) {
strArray->count = i;
@@ -1185,7 +1185,7 @@ GHOST_TSuccess GHOST_SystemCocoa::handleDraggingEvent(GHOST_TEventType eventType
droppedStr = (NSString *)data;
pastedTextSize = [droppedStr lengthOfBytesUsingEncoding:NSUTF8StringEncoding];
temp_buff = (uint8_t *)malloc(pastedTextSize + 1);
temp_buff = (GHOST_TUns8 *)malloc(pastedTextSize + 1);
if (temp_buff == NULL) {
return GHOST_kFailure;
@@ -1204,9 +1204,9 @@ GHOST_TSuccess GHOST_SystemCocoa::handleDraggingEvent(GHOST_TEventType eventType
NSImage *droppedImg = (NSImage *)data;
NSSize imgSize = [droppedImg size];
ImBuf *ibuf = NULL;
uint8_t *rasterRGB = NULL;
uint8_t *rasterRGBA = NULL;
uint8_t *toIBuf = NULL;
GHOST_TUns8 *rasterRGB = NULL;
GHOST_TUns8 *rasterRGBA = NULL;
GHOST_TUns8 *toIBuf = NULL;
int x, y, to_i, from_i;
NSBitmapImageRep *blBitmapFormatImageRGB, *blBitmapFormatImageRGBA, *bitmapImage = nil;
NSEnumerator *enumerator;
@@ -1232,8 +1232,8 @@ GHOST_TSuccess GHOST_SystemCocoa::handleDraggingEvent(GHOST_TEventType eventType
if (([bitmapImage bitsPerPixel] == 32) && (([bitmapImage bitmapFormat] & 0x5) == 0) &&
![bitmapImage isPlanar]) {
/* Try a fast copy if the image is a meshed RGBA 32bit bitmap. */
toIBuf = (uint8_t *)ibuf->rect;
rasterRGB = (uint8_t *)[bitmapImage bitmapData];
toIBuf = (GHOST_TUns8 *)ibuf->rect;
rasterRGB = (GHOST_TUns8 *)[bitmapImage bitmapData];
for (y = 0; y < imgSize.height; y++) {
to_i = (imgSize.height - y - 1) * imgSize.width;
from_i = y * imgSize.width;
@@ -1270,7 +1270,7 @@ GHOST_TSuccess GHOST_SystemCocoa::handleDraggingEvent(GHOST_TEventType eventType
[bitmapImage draw];
[NSGraphicsContext restoreGraphicsState];
rasterRGB = (uint8_t *)[blBitmapFormatImageRGB bitmapData];
rasterRGB = (GHOST_TUns8 *)[blBitmapFormatImageRGB bitmapData];
if (rasterRGB == NULL) {
[bitmapImage release];
[blBitmapFormatImageRGB release];
@@ -1299,7 +1299,7 @@ GHOST_TSuccess GHOST_SystemCocoa::handleDraggingEvent(GHOST_TEventType eventType
[bitmapImage draw];
[NSGraphicsContext restoreGraphicsState];
rasterRGBA = (uint8_t *)[blBitmapFormatImageRGBA bitmapData];
rasterRGBA = (GHOST_TUns8 *)[blBitmapFormatImageRGBA bitmapData];
if (rasterRGBA == NULL) {
[bitmapImage release];
[blBitmapFormatImageRGB release];
@@ -1309,7 +1309,7 @@ GHOST_TSuccess GHOST_SystemCocoa::handleDraggingEvent(GHOST_TEventType eventType
}
/* Copy the image to ibuf, flipping it vertically. */
toIBuf = (uint8_t *)ibuf->rect;
toIBuf = (GHOST_TUns8 *)ibuf->rect;
for (y = 0; y < imgSize.height; y++) {
for (x = 0; x < imgSize.width; x++) {
to_i = (imgSize.height - y - 1) * imgSize.width + x;
@@ -1563,7 +1563,7 @@ GHOST_TSuccess GHOST_SystemCocoa::handleMouseEvent(void *eventPtr)
switch (grab_mode) {
case GHOST_kGrabHide: // Cursor hidden grab operation : no cursor move
{
int32_t x_warp, y_warp, x_accum, y_accum, x, y;
GHOST_TInt32 x_warp, y_warp, x_accum, y_accum, x, y;
window->getCursorGrabInitPos(x_warp, y_warp);
window->screenToClientIntern(x_warp, y_warp, x_warp, y_warp);
@@ -1593,8 +1593,8 @@ GHOST_TSuccess GHOST_SystemCocoa::handleMouseEvent(void *eventPtr)
}
NSPoint mousePos = [event locationInWindow];
int32_t x_mouse = mousePos.x;
int32_t y_mouse = mousePos.y;
GHOST_TInt32 x_mouse = mousePos.x;
GHOST_TInt32 y_mouse = mousePos.y;
GHOST_Rect bounds, windowBounds, correctedBounds;
/* fallback to window bounds */
@@ -1610,19 +1610,19 @@ GHOST_TSuccess GHOST_SystemCocoa::handleMouseEvent(void *eventPtr)
correctedBounds.m_t = (windowBounds.m_b - windowBounds.m_t) - correctedBounds.m_t;
// Get accumulation from previous mouse warps
int32_t x_accum, y_accum;
GHOST_TInt32 x_accum, y_accum;
window->getCursorGrabAccum(x_accum, y_accum);
// Warp mouse cursor if needed
int32_t warped_x_mouse = x_mouse;
int32_t warped_y_mouse = y_mouse;
GHOST_TInt32 warped_x_mouse = x_mouse;
GHOST_TInt32 warped_y_mouse = y_mouse;
correctedBounds.wrapPoint(
warped_x_mouse, warped_y_mouse, 4, window->getCursorGrabAxis());
// Set new cursor position
if (x_mouse != warped_x_mouse || y_mouse != warped_y_mouse) {
int32_t warped_x, warped_y;
GHOST_TInt32 warped_x, warped_y;
window->clientToScreenIntern(warped_x_mouse, warped_y_mouse, warped_x, warped_y);
setMouseCursorPosition(warped_x, warped_y); /* wrap */
window->setCursorGrabAccum(x_accum + (x_mouse - warped_x_mouse),
@@ -1633,7 +1633,7 @@ GHOST_TSuccess GHOST_SystemCocoa::handleMouseEvent(void *eventPtr)
}
// Generate event
int32_t x, y;
GHOST_TInt32 x, y;
window->clientToScreenIntern(x_mouse + x_accum, y_mouse + y_accum, x, y);
pushEvent(new GHOST_EventCursor([event timestamp] * 1000,
GHOST_kEventCursorMove,
@@ -1646,7 +1646,7 @@ GHOST_TSuccess GHOST_SystemCocoa::handleMouseEvent(void *eventPtr)
default: {
// Normal cursor operation: send mouse position in window
NSPoint mousePos = [event locationInWindow];
int32_t x, y;
GHOST_TInt32 x, y;
window->clientToScreenIntern(mousePos.x, mousePos.y, x, y);
pushEvent(new GHOST_EventCursor([event timestamp] * 1000,
@@ -1690,7 +1690,7 @@ GHOST_TSuccess GHOST_SystemCocoa::handleMouseEvent(void *eventPtr)
/* Standard scroll-wheel case, if no swiping happened,
* and no momentum (kinetic scroll) works. */
if (!m_multiTouchScroll && momentumPhase == NSEventPhaseNone) {
int32_t delta;
GHOST_TInt32 delta;
double deltaF = [event deltaY];
@@ -1704,7 +1704,7 @@ GHOST_TSuccess GHOST_SystemCocoa::handleMouseEvent(void *eventPtr)
}
else {
NSPoint mousePos = [event locationInWindow];
int32_t x, y;
GHOST_TInt32 x, y;
double dx;
double dy;
@@ -1734,7 +1734,7 @@ GHOST_TSuccess GHOST_SystemCocoa::handleMouseEvent(void *eventPtr)
case NSEventTypeMagnify: {
NSPoint mousePos = [event locationInWindow];
int32_t x, y;
GHOST_TInt32 x, y;
window->clientToScreenIntern(mousePos.x, mousePos.y, x, y);
pushEvent(new GHOST_EventTrackpad([event timestamp] * 1000,
window,
@@ -1748,7 +1748,7 @@ GHOST_TSuccess GHOST_SystemCocoa::handleMouseEvent(void *eventPtr)
case NSEventTypeSmartMagnify: {
NSPoint mousePos = [event locationInWindow];
int32_t x, y;
GHOST_TInt32 x, y;
window->clientToScreenIntern(mousePos.x, mousePos.y, x, y);
pushEvent(new GHOST_EventTrackpad(
[event timestamp] * 1000, window, GHOST_kTrackpadEventSmartMagnify, x, y, 0, 0, false));
@@ -1756,7 +1756,7 @@ GHOST_TSuccess GHOST_SystemCocoa::handleMouseEvent(void *eventPtr)
case NSEventTypeRotate: {
NSPoint mousePos = [event locationInWindow];
int32_t x, y;
GHOST_TInt32 x, y;
window->clientToScreenIntern(mousePos.x, mousePos.y, x, y);
pushEvent(new GHOST_EventTrackpad([event timestamp] * 1000,
window,
@@ -1933,9 +1933,9 @@ GHOST_TSuccess GHOST_SystemCocoa::handleKeyEvent(void *eventPtr)
#pragma mark Clipboard get/set
char *GHOST_SystemCocoa::getClipboard(bool selection) const
GHOST_TUns8 *GHOST_SystemCocoa::getClipboard(bool selection) const
{
char *temp_buff;
GHOST_TUns8 *temp_buff;
size_t pastedTextSize;
@autoreleasepool {
@@ -1950,13 +1950,14 @@ char *GHOST_SystemCocoa::getClipboard(bool selection) const
pastedTextSize = [textPasted lengthOfBytesUsingEncoding:NSUTF8StringEncoding];
temp_buff = (char *)malloc(pastedTextSize + 1);
temp_buff = (GHOST_TUns8 *)malloc(pastedTextSize + 1);
if (temp_buff == NULL) {
return NULL;
}
strncpy(temp_buff, [textPasted cStringUsingEncoding:NSUTF8StringEncoding], pastedTextSize);
strncpy(
(char *)temp_buff, [textPasted cStringUsingEncoding:NSUTF8StringEncoding], pastedTextSize);
temp_buff[pastedTextSize] = '\0';
@@ -1969,7 +1970,7 @@ char *GHOST_SystemCocoa::getClipboard(bool selection) const
}
}
void GHOST_SystemCocoa::putClipboard(char *buffer, bool selection) const
void GHOST_SystemCocoa::putClipboard(GHOST_TInt8 *buffer, bool selection) const
{
if (selection)
return; // for copying the selection, used on X11

View File

@@ -52,33 +52,33 @@ class GHOST_SystemNULL : public GHOST_System {
{
return GHOST_kSuccess;
}
char *getClipboard(bool selection) const
GHOST_TUns8 *getClipboard(bool selection) const
{
return NULL;
}
void putClipboard(char *buffer, bool selection) const
void putClipboard(GHOST_TInt8 *buffer, bool selection) const
{ /* nop */
}
uint64_t getMilliSeconds() const
GHOST_TUns64 getMilliSeconds() const
{
return 0;
}
uint8_t getNumDisplays() const
GHOST_TUns8 getNumDisplays() const
{
return uint8_t(1);
return GHOST_TUns8(1);
}
GHOST_TSuccess getCursorPosition(int32_t &x, int32_t &y) const
GHOST_TSuccess getCursorPosition(GHOST_TInt32 &x, GHOST_TInt32 &y) const
{
return GHOST_kFailure;
}
GHOST_TSuccess setCursorPosition(int32_t x, int32_t y)
GHOST_TSuccess setCursorPosition(GHOST_TInt32 x, GHOST_TInt32 y)
{
return GHOST_kFailure;
}
void getMainDisplayDimensions(uint32_t &width, uint32_t &height) const
void getMainDisplayDimensions(GHOST_TUns32 &width, GHOST_TUns32 &height) const
{ /* nop */
}
void getAllDisplayDimensions(uint32_t &width, uint32_t &height) const
void getAllDisplayDimensions(GHOST_TUns32 &width, GHOST_TUns32 &height) const
{ /* nop */
}
GHOST_IContext *createOffscreenContext(GHOST_GLSettings glSettings)
@@ -106,10 +106,10 @@ class GHOST_SystemNULL : public GHOST_System {
}
GHOST_IWindow *createWindow(const char *title,
int32_t left,
int32_t top,
uint32_t width,
uint32_t height,
GHOST_TInt32 left,
GHOST_TInt32 top,
GHOST_TUns32 width,
GHOST_TUns32 height,
GHOST_TWindowState state,
GHOST_TDrawingContextType type,
GHOST_GLSettings glSettings,

View File

@@ -49,20 +49,20 @@ class GHOST_SystemPaths : public GHOST_ISystemPaths {
* "unpack and run" path, then look for properly installed path, including versioning.
* \return Unsigned char string pointing to system dir (eg /usr/share/blender/).
*/
virtual const char *getSystemDir(int version, const char *versionstr) const = 0;
virtual const GHOST_TUns8 *getSystemDir(int version, const char *versionstr) const = 0;
/**
* Determine the base dir in which user configuration is stored, including versioning.
* If needed, it will create the base directory.
* \return Unsigned char string pointing to user dir (eg ~/.blender/).
*/
virtual const char *getUserDir(int version, const char *versionstr) const = 0;
virtual const GHOST_TUns8 *getUserDir(int version, const char *versionstr) const = 0;
/**
* Determine the directory of the current binary
* \return Unsigned char string pointing to the binary dir
*/
virtual const char *getBinaryDir() const = 0;
virtual const GHOST_TUns8 *getBinaryDir() const = 0;
/**
* Add the file to the operating system most recently used files

View File

@@ -46,26 +46,26 @@ class GHOST_SystemPathsCocoa : public GHOST_SystemPaths {
* "unpack and run" path, then look for properly installed path, including versioning.
* \return Unsigned char string pointing to system dir (eg /usr/share/blender/).
*/
const char *getSystemDir(int version, const char *versionstr) const;
const GHOST_TUns8 *getSystemDir(int version, const char *versionstr) const;
/**
* Determine the base dir in which user configuration is stored, including versioning.
* If needed, it will create the base directory.
* \return Unsigned char string pointing to user dir (eg ~/.blender/).
*/
const char *getUserDir(int version, const char *versionstr) const;
const GHOST_TUns8 *getUserDir(int version, const char *versionstr) const;
/**
* Determine a special ("well known") and easy to reach user directory.
* \return Unsigned char string pointing to user dir (eg `~/Documents/`).
*/
const char *getUserSpecialDir(GHOST_TUserSpecialDirTypes type) const;
const GHOST_TUns8 *getUserSpecialDir(GHOST_TUserSpecialDirTypes type) const;
/**
* Determine the directory of the current binary
* \return Unsigned char string pointing to the binary dir
*/
const char *getBinaryDir() const;
const GHOST_TUns8 *getBinaryDir() const;
/**
* Add the file to the operating system most recently used files

View File

@@ -36,7 +36,7 @@ GHOST_SystemPathsCocoa::~GHOST_SystemPathsCocoa()
#pragma mark Base directories retrieval
const char *GHOST_SystemPathsCocoa::getSystemDir(int, const char *versionstr) const
const GHOST_TUns8 *GHOST_SystemPathsCocoa::getSystemDir(int, const char *versionstr) const
{
static char tempPath[512] = "";
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
@@ -60,10 +60,10 @@ const char *GHOST_SystemPathsCocoa::getSystemDir(int, const char *versionstr) co
versionstr);
[pool drain];
return tempPath;
return (GHOST_TUns8 *)tempPath;
}
const char *GHOST_SystemPathsCocoa::getUserDir(int, const char *versionstr) const
const GHOST_TUns8 *GHOST_SystemPathsCocoa::getUserDir(int, const char *versionstr) const
{
static char tempPath[512] = "";
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
@@ -87,10 +87,10 @@ const char *GHOST_SystemPathsCocoa::getUserDir(int, const char *versionstr) cons
versionstr);
[pool drain];
return tempPath;
return (GHOST_TUns8 *)tempPath;
}
const char *GHOST_SystemPathsCocoa::getUserSpecialDir(GHOST_TUserSpecialDirTypes type) const
const GHOST_TUns8 *GHOST_SystemPathsCocoa::getUserSpecialDir(GHOST_TUserSpecialDirTypes type) const
{
static char tempPath[512] = "";
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
@@ -138,12 +138,12 @@ const char *GHOST_SystemPathsCocoa::getUserSpecialDir(GHOST_TUserSpecialDirTypes
(char *)tempPath, [basePath cStringUsingEncoding:NSASCIIStringEncoding], sizeof(tempPath));
[pool drain];
return tempPath;
return (GHOST_TUns8 *)tempPath;
}
const char *GHOST_SystemPathsCocoa::getBinaryDir() const
const GHOST_TUns8 *GHOST_SystemPathsCocoa::getBinaryDir() const
{
static char tempPath[512] = "";
static GHOST_TUns8 tempPath[512] = "";
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
NSString *basePath;

View File

@@ -55,18 +55,18 @@ GHOST_SystemPathsUnix::~GHOST_SystemPathsUnix()
{
}
const char *GHOST_SystemPathsUnix::getSystemDir(int, const char *versionstr) const
const GHOST_TUns8 *GHOST_SystemPathsUnix::getSystemDir(int, const char *versionstr) const
{
/* no prefix assumes a portable build which only uses bundled scripts */
if (static_path) {
static string system_path = string(static_path) + "/blender/" + versionstr;
return system_path.c_str();
return (GHOST_TUns8 *)system_path.c_str();
}
return NULL;
}
const char *GHOST_SystemPathsUnix::getUserDir(int version, const char *versionstr) const
const GHOST_TUns8 *GHOST_SystemPathsUnix::getUserDir(int version, const char *versionstr) const
{
static string user_path = "";
static int last_version = 0;
@@ -86,7 +86,7 @@ const char *GHOST_SystemPathsUnix::getUserDir(int version, const char *versionst
return NULL;
}
}
return user_path.c_str();
return (GHOST_TUns8 *)user_path.c_str();
}
else {
if (user_path.empty() || last_version != version) {
@@ -107,11 +107,11 @@ const char *GHOST_SystemPathsUnix::getUserDir(int version, const char *versionst
}
}
return user_path.c_str();
return (const GHOST_TUns8 *)user_path.c_str();
}
}
const char *GHOST_SystemPathsUnix::getUserSpecialDir(GHOST_TUserSpecialDirTypes type) const
const GHOST_TUns8 *GHOST_SystemPathsUnix::getUserSpecialDir(GHOST_TUserSpecialDirTypes type) const
{
const char *type_str;
@@ -164,10 +164,10 @@ const char *GHOST_SystemPathsUnix::getUserSpecialDir(GHOST_TUserSpecialDirTypes
}
path = path_stream.str();
return path[0] ? path.c_str() : NULL;
return path[0] ? (const GHOST_TUns8 *)path.c_str() : NULL;
}
const char *GHOST_SystemPathsUnix::getBinaryDir() const
const GHOST_TUns8 *GHOST_SystemPathsUnix::getBinaryDir() const
{
return NULL;
}

View File

@@ -44,26 +44,26 @@ class GHOST_SystemPathsUnix : public GHOST_SystemPaths {
* "unpack and run" path, then look for properly installed path, including versioning.
* \return Unsigned char string pointing to system dir (eg `/usr/share/blender/`).
*/
const char *getSystemDir(int version, const char *versionstr) const;
const GHOST_TUns8 *getSystemDir(int version, const char *versionstr) const;
/**
* Determine the base dir in which user configuration is stored, including versioning.
* If needed, it will create the base directory.
* \return Unsigned char string pointing to user dir (eg `~/.config/.blender/`).
*/
const char *getUserDir(int version, const char *versionstr) const;
const GHOST_TUns8 *getUserDir(int version, const char *versionstr) const;
/**
* Determine a special ("well known") and easy to reach user directory.
* \return Unsigned char string pointing to user dir (eg `~/Documents/`).
*/
const char *getUserSpecialDir(GHOST_TUserSpecialDirTypes type) const;
const GHOST_TUns8 *getUserSpecialDir(GHOST_TUserSpecialDirTypes type) const;
/**
* Determine the directory of the current binary
* \return Unsigned char string pointing to the binary dir
*/
const char *getBinaryDir() const;
const GHOST_TUns8 *getBinaryDir() const;
/**
* Add the file to the operating system most recently used files

View File

@@ -38,7 +38,7 @@ GHOST_SystemPathsWin32::~GHOST_SystemPathsWin32()
{
}
const char *GHOST_SystemPathsWin32::getSystemDir(int, const char *versionstr) const
const GHOST_TUns8 *GHOST_SystemPathsWin32::getSystemDir(int, const char *versionstr) const
{
/* 1 utf-16 might translate into 3 utf-8. 2 utf-16 translates into 4 utf-8. */
static char knownpath[MAX_PATH * 3 + 128] = {0};
@@ -52,13 +52,13 @@ const char *GHOST_SystemPathsWin32::getSystemDir(int, const char *versionstr) co
CoTaskMemFree(knownpath_16);
strcat(knownpath, "\\Blender Foundation\\Blender\\");
strcat(knownpath, versionstr);
return knownpath;
return (GHOST_TUns8 *)knownpath;
}
return NULL;
}
const char *GHOST_SystemPathsWin32::getUserDir(int, const char *versionstr) const
const GHOST_TUns8 *GHOST_SystemPathsWin32::getUserDir(int, const char *versionstr) const
{
static char knownpath[MAX_PATH * 3 + 128] = {0};
PWSTR knownpath_16 = NULL;
@@ -71,13 +71,13 @@ const char *GHOST_SystemPathsWin32::getUserDir(int, const char *versionstr) cons
CoTaskMemFree(knownpath_16);
strcat(knownpath, "\\Blender Foundation\\Blender\\");
strcat(knownpath, versionstr);
return knownpath;
return (GHOST_TUns8 *)knownpath;
}
return NULL;
}
const char *GHOST_SystemPathsWin32::getUserSpecialDir(GHOST_TUserSpecialDirTypes type) const
const GHOST_TUns8 *GHOST_SystemPathsWin32::getUserSpecialDir(GHOST_TUserSpecialDirTypes type) const
{
GUID folderid;
@@ -114,21 +114,21 @@ const char *GHOST_SystemPathsWin32::getUserSpecialDir(GHOST_TUserSpecialDirTypes
if (hResult == S_OK) {
conv_utf_16_to_8(knownpath_16, knownpath, MAX_PATH * 3);
CoTaskMemFree(knownpath_16);
return knownpath;
return (GHOST_TUns8 *)knownpath;
}
CoTaskMemFree(knownpath_16);
return NULL;
}
const char *GHOST_SystemPathsWin32::getBinaryDir() const
const GHOST_TUns8 *GHOST_SystemPathsWin32::getBinaryDir() const
{
static char fullname[MAX_PATH * 3] = {0};
wchar_t fullname_16[MAX_PATH * 3];
if (GetModuleFileNameW(0, fullname_16, MAX_PATH)) {
conv_utf_16_to_8(fullname_16, fullname, MAX_PATH * 3);
return fullname;
return (GHOST_TUns8 *)fullname;
}
return NULL;

View File

@@ -53,26 +53,26 @@ class GHOST_SystemPathsWin32 : public GHOST_SystemPaths {
* "unpack and run" path, then look for properly installed path, including versioning.
* \return Unsigned char string pointing to system dir (eg /usr/share/).
*/
const char *getSystemDir(int version, const char *versionstr) const;
const GHOST_TUns8 *getSystemDir(int version, const char *versionstr) const;
/**
* Determine the base dir in which user configuration is stored, including versioning.
* If needed, it will create the base directory.
* \return Unsigned char string pointing to user dir (eg ~/).
*/
const char *getUserDir(int version, const char *versionstr) const;
const GHOST_TUns8 *getUserDir(int version, const char *versionstr) const;
/**
* Determine a special ("well known") and easy to reach user directory.
* \return Unsigned char string pointing to user dir (eg `~/Documents/`).
*/
const char *getUserSpecialDir(GHOST_TUserSpecialDirTypes type) const;
const GHOST_TUns8 *getUserSpecialDir(GHOST_TUserSpecialDirTypes type) const;
/**
* Determine the directory of the current binary
* \return Unsigned char string pointing to the binary dir
*/
const char *getBinaryDir() const;
const GHOST_TUns8 *getBinaryDir() const;
/**
* Add the file to the operating system most recently used files

View File

@@ -50,10 +50,10 @@ GHOST_SystemSDL::~GHOST_SystemSDL()
}
GHOST_IWindow *GHOST_SystemSDL::createWindow(const char *title,
int32_t left,
int32_t top,
uint32_t width,
uint32_t height,
GHOST_TInt32 left,
GHOST_TInt32 top,
GHOST_TUns32 width,
GHOST_TUns32 height,
GHOST_TWindowState state,
GHOST_TDrawingContextType type,
GHOST_GLSettings glSettings,
@@ -118,23 +118,23 @@ GHOST_TSuccess GHOST_SystemSDL::init()
* Returns the dimensions of the main display on this system.
* \return The dimension of the main display.
*/
void GHOST_SystemSDL::getAllDisplayDimensions(uint32_t &width, uint32_t &height) const
void GHOST_SystemSDL::getAllDisplayDimensions(GHOST_TUns32 &width, GHOST_TUns32 &height) const
{
SDL_DisplayMode mode;
SDL_GetDesktopDisplayMode(0, &mode); /* NOTE: always 0 display. */
SDL_GetDesktopDisplayMode(0, &mode); /* note, always 0 display */
width = mode.w;
height = mode.h;
}
void GHOST_SystemSDL::getMainDisplayDimensions(uint32_t &width, uint32_t &height) const
void GHOST_SystemSDL::getMainDisplayDimensions(GHOST_TUns32 &width, GHOST_TUns32 &height) const
{
SDL_DisplayMode mode;
SDL_GetCurrentDisplayMode(0, &mode); /* NOTE: always 0 display. */
SDL_GetCurrentDisplayMode(0, &mode); /* note, always 0 display */
width = mode.w;
height = mode.h;
}
uint8_t GHOST_SystemSDL::getNumDisplays() const
GHOST_TUns8 GHOST_SystemSDL::getNumDisplays() const
{
return SDL_GetNumVideoDisplays();
}
@@ -356,15 +356,15 @@ void GHOST_SystemSDL::processEvent(SDL_Event *sdl_event)
int x_win, y_win;
SDL_GetWindowPosition(sdl_win, &x_win, &y_win);
int32_t x_root = sdl_sub_evt.x + x_win;
int32_t y_root = sdl_sub_evt.y + y_win;
GHOST_TInt32 x_root = sdl_sub_evt.x + x_win;
GHOST_TInt32 y_root = sdl_sub_evt.y + y_win;
#if 0
if (window->getCursorGrabMode() != GHOST_kGrabDisable &&
window->getCursorGrabMode() != GHOST_kGrabNormal) {
int32_t x_new = x_root;
int32_t y_new = y_root;
int32_t x_accum, y_accum;
GHOST_TInt32 x_new = x_root;
GHOST_TInt32 y_new = y_root;
GHOST_TInt32 x_accum, y_accum;
GHOST_Rect bounds;
/* fallback to window bounds */
@@ -468,8 +468,8 @@ void GHOST_SystemSDL::processEvent(SDL_Event *sdl_event)
assert(window != NULL);
GHOST_TKey gkey = convertSDLKey(sdl_sub_evt.keysym.scancode);
/* NOTE: the `sdl_sub_evt.keysym.sym` is truncated,
* for unicode support ghost has to be modified. */
/* note, the sdl_sub_evt.keysym.sym is truncated,
* for unicode support ghost has to be modified */
/* printf("%d\n", sym); */
if (sym > 127) {
switch (sym) {
@@ -611,7 +611,7 @@ void GHOST_SystemSDL::processEvent(SDL_Event *sdl_event)
}
}
GHOST_TSuccess GHOST_SystemSDL::getCursorPosition(int32_t &x, int32_t &y) const
GHOST_TSuccess GHOST_SystemSDL::getCursorPosition(GHOST_TInt32 &x, GHOST_TInt32 &y) const
{
int x_win, y_win;
SDL_Window *win = SDL_GetMouseFocus();
@@ -625,7 +625,7 @@ GHOST_TSuccess GHOST_SystemSDL::getCursorPosition(int32_t &x, int32_t &y) const
return GHOST_kSuccess;
}
GHOST_TSuccess GHOST_SystemSDL::setCursorPosition(int32_t x, int32_t y)
GHOST_TSuccess GHOST_SystemSDL::setCursorPosition(GHOST_TInt32 x, GHOST_TInt32 y)
{
int x_win, y_win;
SDL_Window *win = SDL_GetMouseFocus();
@@ -668,14 +668,14 @@ bool GHOST_SystemSDL::processEvents(bool waitForEvent)
GHOST_TimerManager *timerMgr = getTimerManager();
if (waitForEvent && m_dirty_windows.empty() && !SDL_HasEvents(SDL_FIRSTEVENT, SDL_LASTEVENT)) {
uint64_t next = timerMgr->nextFireTime();
GHOST_TUns64 next = timerMgr->nextFireTime();
if (next == GHOST_kFireTimeNever) {
SDL_WaitEventTimeout(NULL, -1);
// SleepTillEvent(m_display, -1);
}
else {
int64_t maxSleep = next - getMilliSeconds();
GHOST_TInt64 maxSleep = next - getMilliSeconds();
if (maxSleep >= 0) {
SDL_WaitEventTimeout(NULL, next - getMilliSeconds());
@@ -743,17 +743,17 @@ GHOST_TSuccess GHOST_SystemSDL::getButtons(GHOST_Buttons &buttons) const
return GHOST_kSuccess;
}
char *GHOST_SystemSDL::getClipboard(bool selection) const
GHOST_TUns8 *GHOST_SystemSDL::getClipboard(bool selection) const
{
return (char *)SDL_GetClipboardText();
return (GHOST_TUns8 *)SDL_GetClipboardText();
}
void GHOST_SystemSDL::putClipboard(char *buffer, bool selection) const
void GHOST_SystemSDL::putClipboard(GHOST_TInt8 *buffer, bool selection) const
{
SDL_SetClipboardText(buffer);
}
uint64_t GHOST_SystemSDL::getMilliSeconds()
GHOST_TUns64 GHOST_SystemSDL::getMilliSeconds()
{
return uint64_t(SDL_GetTicks()); /* NOTE: 32 -> 64bits. */
return GHOST_TUns64(SDL_GetTicks()); /* note, 32 -> 64bits */
}

View File

@@ -56,21 +56,21 @@ class GHOST_SystemSDL : public GHOST_System {
GHOST_TSuccess getButtons(GHOST_Buttons &buttons) const;
char *getClipboard(bool selection) const;
GHOST_TUns8 *getClipboard(bool selection) const;
void putClipboard(char *buffer, bool selection) const;
void putClipboard(GHOST_TInt8 *buffer, bool selection) const;
uint64_t getMilliSeconds();
GHOST_TUns64 getMilliSeconds();
uint8_t getNumDisplays() const;
GHOST_TUns8 getNumDisplays() const;
GHOST_TSuccess getCursorPosition(int32_t &x, int32_t &y) const;
GHOST_TSuccess getCursorPosition(GHOST_TInt32 &x, GHOST_TInt32 &y) const;
GHOST_TSuccess setCursorPosition(int32_t x, int32_t y);
GHOST_TSuccess setCursorPosition(GHOST_TInt32 x, GHOST_TInt32 y);
void getAllDisplayDimensions(uint32_t &width, uint32_t &height) const;
void getAllDisplayDimensions(GHOST_TUns32 &width, GHOST_TUns32 &height) const;
void getMainDisplayDimensions(uint32_t &width, uint32_t &height) const;
void getMainDisplayDimensions(GHOST_TUns32 &width, GHOST_TUns32 &height) const;
GHOST_IContext *createOffscreenContext(GHOST_GLSettings glSettings);
@@ -80,10 +80,10 @@ class GHOST_SystemSDL : public GHOST_System {
GHOST_TSuccess init();
GHOST_IWindow *createWindow(const char *title,
int32_t left,
int32_t top,
uint32_t width,
uint32_t height,
GHOST_TInt32 left,
GHOST_TInt32 top,
GHOST_TUns32 width,
GHOST_TUns32 height,
GHOST_TWindowState state,
GHOST_TDrawingContextType type,
GHOST_GLSettings glSettings,

View File

@@ -468,7 +468,7 @@ static const zwp_relative_pointer_v1_listener relative_pointer_listener = {
static void dnd_events(const input_t *const input, const GHOST_TEventType event)
{
const uint64_t time = input->system->getMilliSeconds();
const GHOST_TUns64 time = input->system->getMilliSeconds();
GHOST_IWindow *const window = static_cast<GHOST_WindowWayland *>(
wl_surface_get_user_data(input->focus_pointer));
for (const std::string &type : mime_preference_order) {
@@ -718,9 +718,10 @@ static void data_device_drop(void *data, struct wl_data_device * /*wl_data_devic
GHOST_TStringArray *flist = static_cast<GHOST_TStringArray *>(
malloc(sizeof(GHOST_TStringArray)));
flist->count = int(uris.size());
flist->strings = static_cast<uint8_t **>(malloc(uris.size() * sizeof(uint8_t *)));
flist->strings = static_cast<GHOST_TUns8 **>(malloc(uris.size() * sizeof(GHOST_TUns8 *)));
for (size_t i = 0; i < uris.size(); i++) {
flist->strings[i] = static_cast<uint8_t *>(malloc((uris[i].size() + 1) * sizeof(uint8_t)));
flist->strings[i] = static_cast<GHOST_TUns8 *>(
malloc((uris[i].size() + 1) * sizeof(GHOST_TUns8)));
memcpy(flist->strings[i], uris[i].data(), uris[i].size() + 1);
}
GHOST_IWindow *win = static_cast<GHOST_WindowWayland *>(
@@ -1170,7 +1171,7 @@ static void keyboard_key(void *data,
.key_data = key_data,
});
auto cb = [](GHOST_ITimerTask *task, uint64_t /*time*/) {
auto cb = [](GHOST_ITimerTask *task, GHOST_TUns64 /*time*/) {
struct key_repeat_payload_t *payload = static_cast<key_repeat_payload_t *>(
task->getUserData());
payload->system->pushEvent(new GHOST_EventKey(payload->system->getMilliSeconds(),
@@ -1510,14 +1511,14 @@ GHOST_TSuccess GHOST_SystemWayland::getButtons(GHOST_Buttons &buttons) const
return GHOST_kFailure;
}
char *GHOST_SystemWayland::getClipboard(bool /*selection*/) const
GHOST_TUns8 *GHOST_SystemWayland::getClipboard(bool /*selection*/) const
{
char *clipboard = static_cast<char *>(malloc((selection.size() + 1)));
GHOST_TUns8 *clipboard = static_cast<GHOST_TUns8 *>(malloc((selection.size() + 1)));
memcpy(clipboard, selection.data(), selection.size() + 1);
return clipboard;
}
void GHOST_SystemWayland::putClipboard(char *buffer, bool /*selection*/) const
void GHOST_SystemWayland::putClipboard(GHOST_TInt8 *buffer, bool /*selection*/) const
{
if (!d->data_device_manager || d->inputs.empty()) {
return;
@@ -1544,12 +1545,12 @@ void GHOST_SystemWayland::putClipboard(char *buffer, bool /*selection*/) const
}
}
uint8_t GHOST_SystemWayland::getNumDisplays() const
GHOST_TUns8 GHOST_SystemWayland::getNumDisplays() const
{
return d ? uint8_t(d->outputs.size()) : 0;
return d ? GHOST_TUns8(d->outputs.size()) : 0;
}
GHOST_TSuccess GHOST_SystemWayland::getCursorPosition(int32_t &x, int32_t &y) const
GHOST_TSuccess GHOST_SystemWayland::getCursorPosition(GHOST_TInt32 &x, GHOST_TInt32 &y) const
{
if (!d->inputs.empty() && (d->inputs[0]->focus_pointer != nullptr)) {
x = d->inputs[0]->x;
@@ -1561,12 +1562,12 @@ GHOST_TSuccess GHOST_SystemWayland::getCursorPosition(int32_t &x, int32_t &y) co
}
}
GHOST_TSuccess GHOST_SystemWayland::setCursorPosition(int32_t /*x*/, int32_t /*y*/)
GHOST_TSuccess GHOST_SystemWayland::setCursorPosition(GHOST_TInt32 /*x*/, GHOST_TInt32 /*y*/)
{
return GHOST_kFailure;
}
void GHOST_SystemWayland::getMainDisplayDimensions(uint32_t &width, uint32_t &height) const
void GHOST_SystemWayland::getMainDisplayDimensions(GHOST_TUns32 &width, GHOST_TUns32 &height) const
{
if (getNumDisplays() > 0) {
/* We assume first output as main. */
@@ -1575,7 +1576,7 @@ void GHOST_SystemWayland::getMainDisplayDimensions(uint32_t &width, uint32_t &he
}
}
void GHOST_SystemWayland::getAllDisplayDimensions(uint32_t &width, uint32_t &height) const
void GHOST_SystemWayland::getAllDisplayDimensions(GHOST_TUns32 &width, GHOST_TUns32 &height) const
{
getMainDisplayDimensions(width, height);
}
@@ -1639,10 +1640,10 @@ GHOST_TSuccess GHOST_SystemWayland::disposeContext(GHOST_IContext *context)
}
GHOST_IWindow *GHOST_SystemWayland::createWindow(const char *title,
int32_t left,
int32_t top,
uint32_t width,
uint32_t height,
GHOST_TInt32 left,
GHOST_TInt32 top,
GHOST_TUns32 width,
GHOST_TUns32 height,
GHOST_TWindowState state,
GHOST_TDrawingContextType type,
GHOST_GLSettings glSettings,
@@ -1779,8 +1780,8 @@ GHOST_TSuccess GHOST_SystemWayland::hasCursorShape(GHOST_TStandardCursor cursorS
return GHOST_TSuccess(cursors.count(cursorShape) && !cursors.at(cursorShape).empty());
}
GHOST_TSuccess GHOST_SystemWayland::setCustomCursorShape(uint8_t *bitmap,
uint8_t *mask,
GHOST_TSuccess GHOST_SystemWayland::setCustomCursorShape(GHOST_TUns8 *bitmap,
GHOST_TUns8 *mask,
int sizex,
int sizey,
int hotX,

View File

@@ -59,29 +59,29 @@ class GHOST_SystemWayland : public GHOST_System {
GHOST_TSuccess getButtons(GHOST_Buttons &buttons) const override;
char *getClipboard(bool selection) const override;
GHOST_TUns8 *getClipboard(bool selection) const override;
void putClipboard(char *buffer, bool selection) const override;
void putClipboard(GHOST_TInt8 *buffer, bool selection) const override;
uint8_t getNumDisplays() const override;
GHOST_TUns8 getNumDisplays() const override;
GHOST_TSuccess getCursorPosition(int32_t &x, int32_t &y) const override;
GHOST_TSuccess getCursorPosition(GHOST_TInt32 &x, GHOST_TInt32 &y) const override;
GHOST_TSuccess setCursorPosition(int32_t x, int32_t y) override;
GHOST_TSuccess setCursorPosition(GHOST_TInt32 x, GHOST_TInt32 y) override;
void getMainDisplayDimensions(uint32_t &width, uint32_t &height) const override;
void getMainDisplayDimensions(GHOST_TUns32 &width, GHOST_TUns32 &height) const override;
void getAllDisplayDimensions(uint32_t &width, uint32_t &height) const override;
void getAllDisplayDimensions(GHOST_TUns32 &width, GHOST_TUns32 &height) const override;
GHOST_IContext *createOffscreenContext(GHOST_GLSettings glSettings) override;
GHOST_TSuccess disposeContext(GHOST_IContext *context) override;
GHOST_IWindow *createWindow(const char *title,
int32_t left,
int32_t top,
uint32_t width,
uint32_t height,
GHOST_TInt32 left,
GHOST_TInt32 top,
GHOST_TUns32 width,
GHOST_TUns32 height,
GHOST_TWindowState state,
GHOST_TDrawingContextType type,
GHOST_GLSettings glSettings,
@@ -107,8 +107,8 @@ class GHOST_SystemWayland : public GHOST_System {
GHOST_TSuccess hasCursorShape(GHOST_TStandardCursor cursorShape);
GHOST_TSuccess setCustomCursorShape(uint8_t *bitmap,
uint8_t *mask,
GHOST_TSuccess setCustomCursorShape(GHOST_TUns8 *bitmap,
GHOST_TUns8 *mask,
int sizex,
int sizey,
int hotX,

View File

@@ -169,21 +169,21 @@ GHOST_SystemWin32::~GHOST_SystemWin32()
toggleConsole(1);
}
uint64_t GHOST_SystemWin32::performanceCounterToMillis(__int64 perf_ticks) const
GHOST_TUns64 GHOST_SystemWin32::performanceCounterToMillis(__int64 perf_ticks) const
{
// Calculate the time passed since system initialization.
__int64 delta = (perf_ticks - m_start) * 1000;
uint64_t t = (uint64_t)(delta / m_freq);
GHOST_TUns64 t = (GHOST_TUns64)(delta / m_freq);
return t;
}
uint64_t GHOST_SystemWin32::tickCountToMillis(__int64 ticks) const
GHOST_TUns64 GHOST_SystemWin32::tickCountToMillis(__int64 ticks) const
{
return ticks - m_lfstart;
}
uint64_t GHOST_SystemWin32::getMilliSeconds() const
GHOST_TUns64 GHOST_SystemWin32::getMilliSeconds() const
{
// Hardware does not support high resolution timers. We will use GetTickCount instead then.
if (!m_hasPerformanceCounter) {
@@ -197,31 +197,31 @@ uint64_t GHOST_SystemWin32::getMilliSeconds() const
return performanceCounterToMillis(count);
}
uint8_t GHOST_SystemWin32::getNumDisplays() const
GHOST_TUns8 GHOST_SystemWin32::getNumDisplays() const
{
GHOST_ASSERT(m_displayManager, "GHOST_SystemWin32::getNumDisplays(): m_displayManager==0\n");
uint8_t numDisplays;
GHOST_TUns8 numDisplays;
m_displayManager->getNumDisplays(numDisplays);
return numDisplays;
}
void GHOST_SystemWin32::getMainDisplayDimensions(uint32_t &width, uint32_t &height) const
void GHOST_SystemWin32::getMainDisplayDimensions(GHOST_TUns32 &width, GHOST_TUns32 &height) const
{
width = ::GetSystemMetrics(SM_CXSCREEN);
height = ::GetSystemMetrics(SM_CYSCREEN);
}
void GHOST_SystemWin32::getAllDisplayDimensions(uint32_t &width, uint32_t &height) const
void GHOST_SystemWin32::getAllDisplayDimensions(GHOST_TUns32 &width, GHOST_TUns32 &height) const
{
width = ::GetSystemMetrics(SM_CXVIRTUALSCREEN);
height = ::GetSystemMetrics(SM_CYVIRTUALSCREEN);
}
GHOST_IWindow *GHOST_SystemWin32::createWindow(const char *title,
int32_t left,
int32_t top,
uint32_t width,
uint32_t height,
GHOST_TInt32 left,
GHOST_TInt32 top,
GHOST_TUns32 width,
GHOST_TUns32 height,
GHOST_TWindowState state,
GHOST_TDrawingContextType type,
GHOST_GLSettings glSettings,
@@ -410,8 +410,8 @@ bool GHOST_SystemWin32::processEvents(bool waitForEvent)
#if 1
::Sleep(1);
#else
uint64_t next = timerMgr->nextFireTime();
int64_t maxSleep = next - getMilliSeconds();
GHOST_TUns64 next = timerMgr->nextFireTime();
GHOST_TInt64 maxSleep = next - getMilliSeconds();
if (next == GHOST_kFireTimeNever) {
::WaitMessage();
@@ -448,7 +448,7 @@ bool GHOST_SystemWin32::processEvents(bool waitForEvent)
return hasEventHandled;
}
GHOST_TSuccess GHOST_SystemWin32::getCursorPosition(int32_t &x, int32_t &y) const
GHOST_TSuccess GHOST_SystemWin32::getCursorPosition(GHOST_TInt32 &x, GHOST_TInt32 &y) const
{
POINT point;
if (::GetCursorPos(&point)) {
@@ -459,7 +459,7 @@ GHOST_TSuccess GHOST_SystemWin32::getCursorPosition(int32_t &x, int32_t &y) cons
return GHOST_kFailure;
}
GHOST_TSuccess GHOST_SystemWin32::setCursorPosition(int32_t x, int32_t y)
GHOST_TSuccess GHOST_SystemWin32::setCursorPosition(GHOST_TInt32 x, GHOST_TInt32 y)
{
if (!::GetActiveWindow())
return GHOST_kFailure;
@@ -1029,7 +1029,7 @@ void GHOST_SystemWin32::processPointerEvent(
case WM_POINTERUPDATE:
/* Coalesced pointer events are reverse chronological order, reorder chronologically.
* Only contiguous move events are coalesced. */
for (uint32_t i = pointerInfo.size(); i-- > 0;) {
for (GHOST_TUns32 i = pointerInfo.size(); i-- > 0;) {
system->pushEvent(new GHOST_EventCursor(pointerInfo[i].time,
GHOST_kEventCursorMove,
window,
@@ -1079,7 +1079,7 @@ void GHOST_SystemWin32::processPointerEvent(
GHOST_EventCursor *GHOST_SystemWin32::processCursorEvent(GHOST_WindowWin32 *window)
{
int32_t x_screen, y_screen;
GHOST_TInt32 x_screen, y_screen;
GHOST_SystemWin32 *system = (GHOST_SystemWin32 *)getSystem();
if (window->getTabletData().Active != GHOST_kTabletModeNone) {
@@ -1090,9 +1090,9 @@ GHOST_EventCursor *GHOST_SystemWin32::processCursorEvent(GHOST_WindowWin32 *wind
system->getCursorPosition(x_screen, y_screen);
if (window->getCursorGrabModeIsWarp()) {
int32_t x_new = x_screen;
int32_t y_new = y_screen;
int32_t x_accum, y_accum;
GHOST_TInt32 x_new = x_screen;
GHOST_TInt32 y_new = y_screen;
GHOST_TInt32 x_accum, y_accum;
GHOST_Rect bounds;
/* Fallback to window bounds. */
@@ -1197,8 +1197,8 @@ GHOST_EventKey *GHOST_SystemWin32::processKeyEvent(GHOST_WindowWin32 *window, RA
// Don't call ToUnicodeEx on dead keys as it clears the buffer and so won't allow diacritical
// composition.
else if (MapVirtualKeyW(vk, 2) != 0) {
/* TODO: #ToUnicodeEx can respond with up to 4 utf16 chars (only 2 here).
* Could be up to 24 utf8 bytes. */
// todo: ToUnicodeEx can respond with up to 4 utf16 chars (only 2 here).
// Could be up to 24 utf8 bytes.
if ((r = ToUnicodeEx(
vk, raw.data.keyboard.MakeCode, state, utf16, 2, 0, system->m_keylayout))) {
if ((r > 0 && r < 3)) {
@@ -1322,7 +1322,7 @@ void GHOST_SystemWin32::processMinMaxInfo(MINMAXINFO *minmax)
bool GHOST_SystemWin32::processNDOF(RAWINPUT const &raw)
{
bool eventSent = false;
uint64_t now = getMilliSeconds();
GHOST_TUns64 now = getMilliSeconds();
static bool firstEvent = true;
if (firstEvent) { // determine exactly which device is plugged in
@@ -1627,14 +1627,14 @@ LRESULT WINAPI GHOST_SystemWin32::s_wndProc(HWND hwnd, UINT msg, WPARAM wParam,
processPointerEvent(msg, window, wParam, lParam, eventHandled);
break;
case WM_POINTERLEAVE: {
uint32_t pointerId = GET_POINTERID_WPARAM(wParam);
GHOST_TUns32 pointerId = GET_POINTERID_WPARAM(wParam);
POINTER_INFO pointerInfo;
if (!GetPointerInfo(pointerId, &pointerInfo)) {
break;
}
/* Reset pointer pen info if pen device has left tracking range. */
if (pointerInfo.pointerType == PT_PEN) {
if (pointerInfo.pointerType == PT_PEN && !IS_POINTER_INRANGE_WPARAM(wParam)) {
window->resetPointerPenInfo();
eventHandled = true;
}
@@ -2002,7 +2002,7 @@ LRESULT WINAPI GHOST_SystemWin32::s_wndProc(HWND hwnd, UINT msg, WPARAM wParam,
return lResult;
}
char *GHOST_SystemWin32::getClipboard(bool selection) const
GHOST_TUns8 *GHOST_SystemWin32::getClipboard(bool selection) const
{
char *temp_buff;
@@ -2026,7 +2026,7 @@ char *GHOST_SystemWin32::getClipboard(bool selection) const
GlobalUnlock(hData);
CloseClipboard();
return temp_buff;
return (GHOST_TUns8 *)temp_buff;
}
else if (IsClipboardFormatAvailable(CF_TEXT) && OpenClipboard(NULL)) {
char *buffer;
@@ -2052,14 +2052,14 @@ char *GHOST_SystemWin32::getClipboard(bool selection) const
GlobalUnlock(hData);
CloseClipboard();
return temp_buff;
return (GHOST_TUns8 *)temp_buff;
}
else {
return NULL;
}
}
void GHOST_SystemWin32::putClipboard(char *buffer, bool selection) const
void GHOST_SystemWin32::putClipboard(GHOST_TInt8 *buffer, bool selection) const
{
if (selection) {
return;

View File

@@ -69,14 +69,14 @@ class GHOST_SystemWin32 : public GHOST_System {
* system process.
* \return The number of milliseconds since the start of the system process.
*/
uint64_t performanceCounterToMillis(__int64 perf_ticks) const;
GHOST_TUns64 performanceCounterToMillis(__int64 perf_ticks) const;
/**
* This method converts system ticks into milliseconds since the start of the
* system process.
* \return The number of milliseconds since the start of the system process.
*/
uint64_t tickCountToMillis(__int64 ticks) const;
GHOST_TUns64 tickCountToMillis(__int64 ticks) const;
/**
* Returns the system time.
@@ -84,7 +84,7 @@ class GHOST_SystemWin32 : public GHOST_System {
* This overloaded method uses the high frequency timer if available.
* \return The number of milliseconds.
*/
uint64_t getMilliSeconds() const;
GHOST_TUns64 getMilliSeconds() const;
/***************************************************************************************
** Display/window management functionality
@@ -94,19 +94,19 @@ class GHOST_SystemWin32 : public GHOST_System {
* Returns the number of displays on this system.
* \return The number of displays.
*/
uint8_t getNumDisplays() const;
GHOST_TUns8 getNumDisplays() const;
/**
* Returns the dimensions of the main display on this system.
* \return The dimension of the main display.
*/
void getMainDisplayDimensions(uint32_t &width, uint32_t &height) const;
void getMainDisplayDimensions(GHOST_TUns32 &width, GHOST_TUns32 &height) const;
/**
* Returns the dimensions of all displays on this system.
* \return The dimension of the main display.
*/
void getAllDisplayDimensions(uint32_t &width, uint32_t &height) const;
void getAllDisplayDimensions(GHOST_TUns32 &width, GHOST_TUns32 &height) const;
/**
* Create a new window.
@@ -126,10 +126,10 @@ class GHOST_SystemWin32 : public GHOST_System {
* \return The new window (or 0 if creation failed).
*/
GHOST_IWindow *createWindow(const char *title,
int32_t left,
int32_t top,
uint32_t width,
uint32_t height,
GHOST_TInt32 left,
GHOST_TInt32 top,
GHOST_TUns32 width,
GHOST_TUns32 height,
GHOST_TWindowState state,
GHOST_TDrawingContextType type,
GHOST_GLSettings glSettings,
@@ -189,7 +189,7 @@ class GHOST_SystemWin32 : public GHOST_System {
* \param y: The y-coordinate of the cursor.
* \return Indication of success.
*/
GHOST_TSuccess getCursorPosition(int32_t &x, int32_t &y) const;
GHOST_TSuccess getCursorPosition(GHOST_TInt32 &x, GHOST_TInt32 &y) const;
/**
* Updates the location of the cursor (location in screen coordinates).
@@ -197,7 +197,7 @@ class GHOST_SystemWin32 : public GHOST_System {
* \param y: The y-coordinate of the cursor.
* \return Indication of success.
*/
GHOST_TSuccess setCursorPosition(int32_t x, int32_t y);
GHOST_TSuccess setCursorPosition(GHOST_TInt32 x, GHOST_TInt32 y);
/***************************************************************************************
** Access to mouse button and keyboard states.
@@ -222,14 +222,14 @@ class GHOST_SystemWin32 : public GHOST_System {
* \param selection: Used by X11 only.
* \return Returns the Clipboard.
*/
char *getClipboard(bool selection) const;
GHOST_TUns8 *getClipboard(bool selection) const;
/**
* Puts buffer to system clipboard.
* \param selection: Used by X11 only.
* \return No return.
*/
void putClipboard(char *buffer, bool selection) const;
void putClipboard(GHOST_TInt8 *buffer, bool selection) const;
/**
* Show a system message box

View File

@@ -186,7 +186,7 @@ GHOST_SystemX11::GHOST_SystemX11() : GHOST_System(), m_xkb_descr(NULL), m_start_
}
/* Taking care not to overflow the `tv.tv_sec * 1000`. */
m_start_time = uint64_t(tv.tv_sec) * 1000 + tv.tv_usec / 1000;
m_start_time = GHOST_TUns64(tv.tv_sec) * 1000 + tv.tv_usec / 1000;
/* Use detectable auto-repeat, mac and windows also do this. */
int use_xkb;
@@ -279,7 +279,7 @@ GHOST_TSuccess GHOST_SystemX11::init()
return GHOST_kFailure;
}
uint64_t GHOST_SystemX11::getMilliSeconds() const
GHOST_TUns64 GHOST_SystemX11::getMilliSeconds() const
{
timeval tv;
if (gettimeofday(&tv, NULL) == -1) {
@@ -287,24 +287,24 @@ uint64_t GHOST_SystemX11::getMilliSeconds() const
}
/* Taking care not to overflow the tv.tv_sec * 1000 */
return uint64_t(tv.tv_sec) * 1000 + tv.tv_usec / 1000 - m_start_time;
return GHOST_TUns64(tv.tv_sec) * 1000 + tv.tv_usec / 1000 - m_start_time;
}
uint8_t GHOST_SystemX11::getNumDisplays() const
GHOST_TUns8 GHOST_SystemX11::getNumDisplays() const
{
return uint8_t(1);
return GHOST_TUns8(1);
}
/**
* Returns the dimensions of the main display on this system.
* \return The dimension of the main display.
*/
void GHOST_SystemX11::getMainDisplayDimensions(uint32_t &width, uint32_t &height) const
void GHOST_SystemX11::getMainDisplayDimensions(GHOST_TUns32 &width, GHOST_TUns32 &height) const
{
if (m_display) {
/* NOTE(campbell): for this to work as documented,
/* note, for this to work as documented,
* we would need to use Xinerama check r54370 for code that did this,
* we've since removed since its not worth the extra dependency. */
* we've since removed since its not worth the extra dep - campbell */
getAllDisplayDimensions(width, height);
}
}
@@ -313,7 +313,7 @@ void GHOST_SystemX11::getMainDisplayDimensions(uint32_t &width, uint32_t &height
* Returns the dimensions of the main display on this system.
* \return The dimension of the main display.
*/
void GHOST_SystemX11::getAllDisplayDimensions(uint32_t &width, uint32_t &height) const
void GHOST_SystemX11::getAllDisplayDimensions(GHOST_TUns32 &width, GHOST_TUns32 &height) const
{
if (m_display) {
width = DisplayWidth(m_display, DefaultScreen(m_display));
@@ -339,10 +339,10 @@ void GHOST_SystemX11::getAllDisplayDimensions(uint32_t &width, uint32_t &height)
* \return The new window (or 0 if creation failed).
*/
GHOST_IWindow *GHOST_SystemX11::createWindow(const char *title,
int32_t left,
int32_t top,
uint32_t width,
uint32_t height,
GHOST_TInt32 left,
GHOST_TInt32 top,
GHOST_TUns32 width,
GHOST_TUns32 height,
GHOST_TWindowState state,
GHOST_TDrawingContextType type,
GHOST_GLSettings glSettings,
@@ -570,7 +570,7 @@ GHOST_WindowX11 *GHOST_SystemX11::findGhostWindow(Window xwind) const
return NULL;
}
static void SleepTillEvent(Display *display, int64_t maxSleep)
static void SleepTillEvent(Display *display, GHOST_TInt64 maxSleep)
{
int fd = ConnectionNumber(display);
fd_set fds;
@@ -649,13 +649,13 @@ bool GHOST_SystemX11::processEvents(bool waitForEvent)
GHOST_TimerManager *timerMgr = getTimerManager();
if (waitForEvent && m_dirty_windows.empty() && !XPending(m_display)) {
uint64_t next = timerMgr->nextFireTime();
GHOST_TUns64 next = timerMgr->nextFireTime();
if (next == GHOST_kFireTimeNever) {
SleepTillEvent(m_display, -1);
}
else {
int64_t maxSleep = next - getMilliSeconds();
GHOST_TInt64 maxSleep = next - getMilliSeconds();
if (maxSleep >= 0)
SleepTillEvent(m_display, next - getMilliSeconds());
@@ -965,9 +965,9 @@ void GHOST_SystemX11::processEvent(XEvent *xe)
bool is_tablet = window->GetTabletData().Active != GHOST_kTabletModeNone;
if (is_tablet == false && window->getCursorGrabModeIsWarp()) {
int32_t x_new = xme.x_root;
int32_t y_new = xme.y_root;
int32_t x_accum, y_accum;
GHOST_TInt32 x_new = xme.x_root;
GHOST_TInt32 y_new = xme.y_root;
GHOST_TInt32 x_accum, y_accum;
GHOST_Rect bounds;
/* fallback to window bounds */
@@ -1044,30 +1044,33 @@ void GHOST_SystemX11::processEvent(XEvent *xe)
GHOST_TKey gkey;
#ifdef USE_NON_LATIN_KB_WORKAROUND
/* XXX: Code below is kinda awfully convoluted... Issues are:
* - In keyboards like latin ones, numbers need a 'Shift' to be accessed but key_sym
* is unmodified (or anyone swapping the keys with `xmodmap`).
* - #XLookupKeysym seems to always use first defined key-map (see T47228), which generates
* key-codes unusable by ghost_key_from_keysym for non-Latin-compatible key-maps.
/* XXX Code below is kinda awfully convoluted... Issues are:
*
* - In keyboards like latin ones, numbers need a 'Shift' to be accessed but key_sym
* is unmodified (or anyone swapping the keys with xmodmap).
*
* - XLookupKeysym seems to always use first defined keymap (see T47228), which generates
* keycodes unusable by ghost_key_from_keysym for non-Latin-compatible keymaps.
*
* To address this, we:
* - Try to get a 'number' key_sym using #XLookupKeysym (with virtual shift modifier),
* in a very restrictive set of cases.
* - Fallback to #XLookupString to get a key_sym from active user-defined key-map.
*
* - Try to get a 'number' key_sym using XLookupKeysym (with virtual shift modifier),
* in a very restrictive set of cases.
* - Fallback to XLookupString to get a key_sym from active user-defined keymap.
*
* Note that:
* - This effectively 'lock' main number keys to always output number events
* (except when using alt-gr).
* - This enforces users to use an ASCII-compatible key-map with Blender -
* but at least it gives predictable and consistent results.
* - This effectively 'lock' main number keys to always output number events
* (except when using alt-gr).
* - This enforces users to use an ASCII-compatible keymap with Blender -
* but at least it gives predictable and consistent results.
*
* Also, note that nothing in XLib sources [1] makes it obvious why those two functions give
* different key_sym results.
* different key_sym results...
*
* [1] http://cgit.freedesktop.org/xorg/lib/libX11/tree/src/KeyBind.c
*/
KeySym key_sym_str;
/* Mode_switch 'modifier' is `AltGr` - when this one or Shift are enabled,
/* Mode_switch 'modifier' is AltGr - when this one or Shift are enabled,
* we do not want to apply that 'forced number' hack. */
const unsigned int mode_switch_mask = XkbKeysymToModifiers(xke->display, XK_Mode_switch);
const unsigned int number_hack_forbidden_kmods_mask = mode_switch_mask | ShiftMask;
@@ -1638,8 +1641,8 @@ GHOST_TSuccess GHOST_SystemX11::getButtons(GHOST_Buttons &buttons) const
}
static GHOST_TSuccess getCursorPosition_impl(Display *display,
int32_t &x,
int32_t &y,
GHOST_TInt32 &x,
GHOST_TInt32 &y,
Window *child_return)
{
int rx, ry, wx, wy;
@@ -1664,13 +1667,13 @@ static GHOST_TSuccess getCursorPosition_impl(Display *display,
return GHOST_kSuccess;
}
GHOST_TSuccess GHOST_SystemX11::getCursorPosition(int32_t &x, int32_t &y) const
GHOST_TSuccess GHOST_SystemX11::getCursorPosition(GHOST_TInt32 &x, GHOST_TInt32 &y) const
{
Window child_return;
return getCursorPosition_impl(m_display, x, y, &child_return);
}
GHOST_TSuccess GHOST_SystemX11::setCursorPosition(int32_t x, int32_t y)
GHOST_TSuccess GHOST_SystemX11::setCursorPosition(GHOST_TInt32 x, GHOST_TInt32 y)
{
/* This is a brute force move in screen coordinates
@@ -2136,14 +2139,14 @@ void GHOST_SystemX11::getClipboard_xcout(const XEvent *evt,
return;
}
char *GHOST_SystemX11::getClipboard(bool selection) const
GHOST_TUns8 *GHOST_SystemX11::getClipboard(bool selection) const
{
Atom sseln;
Atom target = m_atom.UTF8_STRING;
Window owner;
/* from xclip.c doOut() v0.11 */
char *sel_buf;
unsigned char *sel_buf;
unsigned long sel_len = 0;
XEvent evt;
unsigned int context = XCLIB_XCOUT_NONE;
@@ -2162,13 +2165,13 @@ char *GHOST_SystemX11::getClipboard(bool selection) const
owner = XGetSelectionOwner(m_display, sseln);
if (owner == win) {
if (sseln == m_atom.CLIPBOARD) {
sel_buf = (char *)malloc(strlen(txt_cut_buffer) + 1);
strcpy(sel_buf, txt_cut_buffer);
sel_buf = (unsigned char *)malloc(strlen(txt_cut_buffer) + 1);
strcpy((char *)sel_buf, txt_cut_buffer);
return sel_buf;
}
else {
sel_buf = (char *)malloc(strlen(txt_select_buffer) + 1);
strcpy(sel_buf, txt_select_buffer);
sel_buf = (unsigned char *)malloc(strlen(txt_select_buffer) + 1);
strcpy((char *)sel_buf, txt_select_buffer);
return sel_buf;
}
}
@@ -2187,7 +2190,7 @@ char *GHOST_SystemX11::getClipboard(bool selection) const
}
/* fetch the selection, or part of it */
getClipboard_xcout(&evt, sseln, target, (unsigned char **)&sel_buf, &sel_len, &context);
getClipboard_xcout(&evt, sseln, target, &sel_buf, &sel_len, &context);
if (restore_this_event) {
restore_events.push_back(evt);
@@ -2228,8 +2231,8 @@ char *GHOST_SystemX11::getClipboard(bool selection) const
if (sel_len) {
/* Only print the buffer out, and free it, if it's not empty. */
char *tmp_data = (char *)malloc(sel_len + 1);
memcpy(tmp_data, (char *)sel_buf, sel_len);
unsigned char *tmp_data = (unsigned char *)malloc(sel_len + 1);
memcpy((char *)tmp_data, (char *)sel_buf, sel_len);
tmp_data[sel_len] = '\0';
if (sseln == m_atom.STRING)
@@ -2242,7 +2245,7 @@ char *GHOST_SystemX11::getClipboard(bool selection) const
return NULL;
}
void GHOST_SystemX11::putClipboard(char *buffer, bool selection) const
void GHOST_SystemX11::putClipboard(GHOST_TInt8 *buffer, bool selection) const
{
Window m_window, owner;

View File

@@ -98,25 +98,25 @@ class GHOST_SystemX11 : public GHOST_System {
* Returns the number of milliseconds since the start of the system process.
* \return The number of milliseconds.
*/
uint64_t getMilliSeconds() const;
GHOST_TUns64 getMilliSeconds() const;
/**
* Returns the number of displays on this system.
* \return The number of displays.
*/
uint8_t getNumDisplays() const;
GHOST_TUns8 getNumDisplays() const;
/**
* Returns the dimensions of the main display on this system.
* \return The dimension of the main display.
*/
void getMainDisplayDimensions(uint32_t &width, uint32_t &height) const;
void getMainDisplayDimensions(GHOST_TUns32 &width, GHOST_TUns32 &height) const;
/**
* Returns the dimensions of all displays on this system.
* \return The dimension of the main display.
*/
void getAllDisplayDimensions(uint32_t &width, uint32_t &height) const;
void getAllDisplayDimensions(GHOST_TUns32 &width, GHOST_TUns32 &height) const;
/**
* Create a new window.
@@ -136,10 +136,10 @@ class GHOST_SystemX11 : public GHOST_System {
* \return The new window (or 0 if creation failed).
*/
GHOST_IWindow *createWindow(const char *title,
int32_t left,
int32_t top,
uint32_t width,
uint32_t height,
GHOST_TInt32 left,
GHOST_TInt32 top,
GHOST_TUns32 width,
GHOST_TUns32 height,
GHOST_TWindowState state,
GHOST_TDrawingContextType type,
GHOST_GLSettings glSettings,
@@ -168,9 +168,9 @@ class GHOST_SystemX11 : public GHOST_System {
*/
bool processEvents(bool waitForEvent);
GHOST_TSuccess getCursorPosition(int32_t &x, int32_t &y) const;
GHOST_TSuccess getCursorPosition(GHOST_TInt32 &x, GHOST_TInt32 &y) const;
GHOST_TSuccess setCursorPosition(int32_t x, int32_t y);
GHOST_TSuccess setCursorPosition(GHOST_TInt32 x, GHOST_TInt32 y);
/**
* Returns the state of all modifier keys.
@@ -222,14 +222,14 @@ class GHOST_SystemX11 : public GHOST_System {
* \param selection: Get selection, X11 only feature.
* \return Returns the Clipboard indicated by Flag.
*/
char *getClipboard(bool selection) const;
GHOST_TUns8 *getClipboard(bool selection) const;
/**
* Puts buffer to system clipboard
* \param buffer: The buffer to copy to the clipboard.
* \param selection: Set the selection into the clipboard, X11 only feature.
*/
void putClipboard(char *buffer, bool selection) const;
void putClipboard(GHOST_TInt8 *buffer, bool selection) const;
/**
* Show a system message box
@@ -351,7 +351,7 @@ class GHOST_SystemX11 : public GHOST_System {
std::vector<GHOST_WindowX11 *> m_dirty_windows;
/** Start time at initialization. */
uint64_t m_start_time;
GHOST_TUns64 m_start_time;
/** A vector of keyboard key masks. */
char m_keyboard_vector[32];

View File

@@ -40,9 +40,9 @@ GHOST_TimerManager::~GHOST_TimerManager()
disposeTimers();
}
uint32_t GHOST_TimerManager::getNumTimers()
GHOST_TUns32 GHOST_TimerManager::getNumTimers()
{
return (uint32_t)m_timers.size();
return (GHOST_TUns32)m_timers.size();
}
bool GHOST_TimerManager::getTimerFound(GHOST_TimerTask *timer)
@@ -81,13 +81,13 @@ GHOST_TSuccess GHOST_TimerManager::removeTimer(GHOST_TimerTask *timer)
return success;
}
uint64_t GHOST_TimerManager::nextFireTime()
GHOST_TUns64 GHOST_TimerManager::nextFireTime()
{
uint64_t smallest = GHOST_kFireTimeNever;
GHOST_TUns64 smallest = GHOST_kFireTimeNever;
TTimerVector::iterator iter;
for (iter = m_timers.begin(); iter != m_timers.end(); ++iter) {
uint64_t next = (*iter)->getNext();
GHOST_TUns64 next = (*iter)->getNext();
if (next < smallest)
smallest = next;
@@ -96,7 +96,7 @@ uint64_t GHOST_TimerManager::nextFireTime()
return smallest;
}
bool GHOST_TimerManager::fireTimers(uint64_t time)
bool GHOST_TimerManager::fireTimers(GHOST_TUns64 time)
{
TTimerVector::iterator iter;
bool anyProcessed = false;
@@ -109,20 +109,20 @@ bool GHOST_TimerManager::fireTimers(uint64_t time)
return anyProcessed;
}
bool GHOST_TimerManager::fireTimer(uint64_t time, GHOST_TimerTask *task)
bool GHOST_TimerManager::fireTimer(GHOST_TUns64 time, GHOST_TimerTask *task)
{
uint64_t next = task->getNext();
GHOST_TUns64 next = task->getNext();
// Check if the timer should be fired
if (time > next) {
// Fire the timer
GHOST_TimerProcPtr timerProc = task->getTimerProc();
uint64_t start = task->getStart();
GHOST_TUns64 start = task->getStart();
timerProc(task, time - start);
// Update the time at which we will fire it again
uint64_t interval = task->getInterval();
uint64_t numCalls = (next - start) / interval;
GHOST_TUns64 interval = task->getInterval();
GHOST_TUns64 numCalls = (next - start) / interval;
numCalls++;
next = start + numCalls * interval;
task->setNext(next);

View File

@@ -51,7 +51,7 @@ class GHOST_TimerManager {
* Returns the number of timer tasks.
* \return The number of events on the stack.
*/
uint32_t getNumTimers();
GHOST_TUns32 getNumTimers();
/**
* Returns whether this timer task ins in our list.
@@ -80,14 +80,14 @@ class GHOST_TimerManager {
* \return The soonest time the next timer would fire,
* or GHOST_kFireTimeNever if no timers exist.
*/
uint64_t nextFireTime();
GHOST_TUns64 nextFireTime();
/**
* Checks all timer tasks to see if they are expired and fires them if needed.
* \param time: The current time.
* \return True if any timers were fired.
*/
bool fireTimers(uint64_t time);
bool fireTimers(GHOST_TUns64 time);
/**
* Checks this timer task to see if they are expired and fires them if needed.
@@ -95,7 +95,7 @@ class GHOST_TimerManager {
* \param task: The timer task to check and optionally fire.
* \return True if the timer fired.
*/
bool fireTimer(uint64_t time, GHOST_TimerTask *task);
bool fireTimer(GHOST_TUns64 time, GHOST_TimerTask *task);
protected:
/**

View File

@@ -38,8 +38,8 @@ class GHOST_TimerTask : public GHOST_ITimerTask {
* \param timerProc: The callback invoked when the interval expires.
* \param userData: The timer user data.
*/
GHOST_TimerTask(uint64_t start,
uint64_t interval,
GHOST_TimerTask(GHOST_TUns64 start,
GHOST_TUns64 interval,
GHOST_TimerProcPtr timerProc,
GHOST_TUserDataPtr userData = NULL)
: m_start(start),
@@ -55,7 +55,7 @@ class GHOST_TimerTask : public GHOST_ITimerTask {
* Returns the timer start time.
* \return The timer start time.
*/
inline uint64_t getStart() const
inline GHOST_TUns64 getStart() const
{
return m_start;
}
@@ -64,7 +64,7 @@ class GHOST_TimerTask : public GHOST_ITimerTask {
* Changes the timer start time.
* \param start: The timer start time.
*/
void setStart(uint64_t start)
void setStart(GHOST_TUns64 start)
{
m_start = start;
}
@@ -73,7 +73,7 @@ class GHOST_TimerTask : public GHOST_ITimerTask {
* Returns the timer interval.
* \return The timer interval.
*/
inline uint64_t getInterval() const
inline GHOST_TUns64 getInterval() const
{
return m_interval;
}
@@ -82,7 +82,7 @@ class GHOST_TimerTask : public GHOST_ITimerTask {
* Changes the timer interval.
* \param interval: The timer interval.
*/
void setInterval(uint64_t interval)
void setInterval(GHOST_TUns64 interval)
{
m_interval = interval;
}
@@ -91,7 +91,7 @@ class GHOST_TimerTask : public GHOST_ITimerTask {
* Returns the time the timerProc will be called.
* \return The time the timerProc will be called.
*/
inline uint64_t getNext() const
inline GHOST_TUns64 getNext() const
{
return m_next;
}
@@ -100,7 +100,7 @@ class GHOST_TimerTask : public GHOST_ITimerTask {
* Changes the time the timerProc will be called.
* \param next: The time the timerProc will be called.
*/
void setNext(uint64_t next)
void setNext(GHOST_TUns64 next)
{
m_next = next;
}
@@ -145,7 +145,7 @@ class GHOST_TimerTask : public GHOST_ITimerTask {
* Returns the auxiliary storage room.
* \return The auxiliary storage room.
*/
inline uint32_t getAuxData() const
inline GHOST_TUns32 getAuxData() const
{
return m_auxData;
}
@@ -154,20 +154,20 @@ class GHOST_TimerTask : public GHOST_ITimerTask {
* Changes the auxiliary storage room.
* \param auxData: The auxiliary storage room.
*/
void setAuxData(uint32_t auxData)
void setAuxData(GHOST_TUns32 auxData)
{
m_auxData = auxData;
}
protected:
/** The time the timer task was started. */
uint64_t m_start;
GHOST_TUns64 m_start;
/** The interval between calls. */
uint64_t m_interval;
GHOST_TUns64 m_interval;
/** The time the timerProc will be called. */
uint64_t m_next;
GHOST_TUns64 m_next;
/** The callback invoked when the timer expires. */
GHOST_TimerProcPtr m_timerProc;
@@ -176,5 +176,5 @@ class GHOST_TimerTask : public GHOST_ITimerTask {
GHOST_TUserDataPtr m_userData;
/** Auxiliary storage room. */
uint32_t m_auxData;
GHOST_TUns32 m_auxData;
};

View File

@@ -31,8 +31,8 @@
#include <assert.h>
GHOST_Window::GHOST_Window(uint32_t width,
uint32_t height,
GHOST_Window::GHOST_Window(GHOST_TUns32 width,
GHOST_TUns32 height,
GHOST_TWindowState state,
const bool wantStereoVisual,
const bool /*exclusive*/)
@@ -143,7 +143,7 @@ GHOST_TSuccess GHOST_Window::setCursorVisibility(bool visible)
GHOST_TSuccess GHOST_Window::setCursorGrab(GHOST_TGrabCursorMode mode,
GHOST_TAxisFlag wrap_axis,
GHOST_Rect *bounds,
int32_t mouse_ungrab_xy[2])
GHOST_TInt32 mouse_ungrab_xy[2])
{
if (m_cursorGrab == mode)
return GHOST_kSuccess;
@@ -192,8 +192,13 @@ GHOST_TSuccess GHOST_Window::setCursorShape(GHOST_TStandardCursor cursorShape)
}
}
GHOST_TSuccess GHOST_Window::setCustomCursorShape(
uint8_t *bitmap, uint8_t *mask, int sizex, int sizey, int hotX, int hotY, bool canInvertColor)
GHOST_TSuccess GHOST_Window::setCustomCursorShape(GHOST_TUns8 *bitmap,
GHOST_TUns8 *mask,
int sizex,
int sizey,
int hotX,
int hotY,
bool canInvertColor)
{
if (setWindowCustomCursorShape(bitmap, mask, sizex, sizey, hotX, hotY, canInvertColor)) {
m_cursorShape = GHOST_kStandardCursorCustom;

View File

@@ -48,8 +48,8 @@ class GHOST_Window : public GHOST_IWindow {
* \param stereoVisual: Stereo visual for quad buffered stereo.
* \param exclusive: Use to show the window ontop and ignore others (used full-screen).
*/
GHOST_Window(uint32_t width,
uint32_t height,
GHOST_Window(GHOST_TUns32 width,
GHOST_TUns32 height,
GHOST_TWindowState state,
const bool wantStereoVisual = false,
const bool exclusive = false);
@@ -62,13 +62,13 @@ class GHOST_Window : public GHOST_IWindow {
* virtual std::string getTitle() const = 0;
* virtual void getWindowBounds(GHOST_Rect& bounds) const = 0;
* virtual void getClientBounds(GHOST_Rect& bounds) const = 0;
* virtual GHOST_TSuccess setClientWidth(uint32_t width) = 0;
* virtual GHOST_TSuccess setClientHeight(uint32_t height) = 0;
* virtual GHOST_TSuccess setClientSize(uint32_t width, uint32_t height) = 0;
* virtual GHOST_TSuccess setClientWidth(GHOST_TUns32 width) = 0;
* virtual GHOST_TSuccess setClientHeight(GHOST_TUns32 height) = 0;
* virtual GHOST_TSuccess setClientSize(GHOST_TUns32 width, GHOST_TUns32 height) = 0;
* virtual void screenToClient(
* int32_t inX, int32_t inY, int32_t& outX, int32_t& outY) const = 0;
* GHOST_TInt32 inX, GHOST_TInt32 inY, GHOST_TInt32& outX, GHOST_TInt32& outY) const = 0;
* virtual void clientToScreen(
* int32_t inX, int32_t inY, int32_t& outX, int32_t& outY) const = 0;
* GHOST_TInt32 inX, GHOST_TInt32 inY, GHOST_TInt32& outX, GHOST_TInt32& outY) const = 0;
* virtual GHOST_TWindowState getState() const = 0;
* virtual GHOST_TSuccess setState(GHOST_TWindowState state) = 0;
* virtual GHOST_TSuccess setOrder(GHOST_TWindowOrder order) = 0;
@@ -126,8 +126,8 @@ class GHOST_Window : public GHOST_IWindow {
* \param hotY: The Y coordinate of the cursor hot-spot.
* \return Indication of success.
*/
GHOST_TSuccess setCustomCursorShape(uint8_t *bitmap,
uint8_t *mask,
GHOST_TSuccess setCustomCursorShape(GHOST_TUns8 *bitmap,
GHOST_TUns8 *mask,
int sizex,
int sizey,
int hotX,
@@ -142,9 +142,9 @@ class GHOST_Window : public GHOST_IWindow {
inline GHOST_TGrabCursorMode getCursorGrabMode() const;
inline bool getCursorGrabModeIsWarp() const;
inline GHOST_TAxisFlag getCursorGrabAxis() const;
inline void getCursorGrabInitPos(int32_t &x, int32_t &y) const;
inline void getCursorGrabAccum(int32_t &x, int32_t &y) const;
inline void setCursorGrabAccum(int32_t x, int32_t y);
inline void getCursorGrabInitPos(GHOST_TInt32 &x, GHOST_TInt32 &y) const;
inline void getCursorGrabAccum(GHOST_TInt32 &x, GHOST_TInt32 &y) const;
inline void setCursorGrabAccum(GHOST_TInt32 x, GHOST_TInt32 y);
/**
* Shows or hides the cursor.
@@ -161,7 +161,7 @@ class GHOST_Window : public GHOST_IWindow {
GHOST_TSuccess setCursorGrab(GHOST_TGrabCursorMode mode,
GHOST_TAxisFlag wrap_axis,
GHOST_Rect *bounds,
int32_t mouse_ungrab_xy[2]);
GHOST_TInt32 mouse_ungrab_xy[2]);
/**
* Gets the cursor grab region, if unset the window is used.
@@ -292,13 +292,14 @@ class GHOST_Window : public GHOST_IWindow {
* Returns the recommended DPI for this window.
* \return The recommended DPI for this window.
*/
virtual inline uint16_t getDPIHint()
virtual inline GHOST_TUns16 getDPIHint()
{
return 96;
}
#ifdef WITH_INPUT_IME
virtual void beginIME(int32_t x, int32_t y, int32_t w, int32_t h, bool completed)
virtual void beginIME(
GHOST_TInt32 x, GHOST_TInt32 y, GHOST_TInt32 w, GHOST_TInt32 h, int completed)
{
/* do nothing temporarily if not in windows */
}
@@ -342,8 +343,8 @@ class GHOST_Window : public GHOST_IWindow {
* Sets the cursor shape on the window using
* native window system calls.
*/
virtual GHOST_TSuccess setWindowCustomCursorShape(uint8_t *bitmap,
uint8_t *mask,
virtual GHOST_TSuccess setWindowCustomCursorShape(GHOST_TUns8 *bitmap,
GHOST_TUns8 *mask,
int szx,
int szy,
int hotX,
@@ -368,10 +369,10 @@ class GHOST_Window : public GHOST_IWindow {
GHOST_TAxisFlag m_cursorGrabAxis;
/** Initial grab location. */
int32_t m_cursorGrabInitPos[2];
GHOST_TInt32 m_cursorGrabInitPos[2];
/** Accumulated offset from m_cursorGrabInitPos. */
int32_t m_cursorGrabAccumPos[2];
GHOST_TInt32 m_cursorGrabAccumPos[2];
/** Wrap the cursor within this region. */
GHOST_Rect m_cursorGrabBounds;
@@ -395,9 +396,9 @@ class GHOST_Window : public GHOST_IWindow {
bool m_wantStereoVisual;
/** Full-screen width */
uint32_t m_fullScreenWidth;
GHOST_TUns32 m_fullScreenWidth;
/** Full-screen height */
uint32_t m_fullScreenHeight;
GHOST_TUns32 m_fullScreenHeight;
/* OSX only, retina screens */
float m_nativePixelSize;
@@ -431,19 +432,19 @@ inline GHOST_TAxisFlag GHOST_Window::getCursorGrabAxis() const
return m_cursorGrabAxis;
}
inline void GHOST_Window::getCursorGrabInitPos(int32_t &x, int32_t &y) const
inline void GHOST_Window::getCursorGrabInitPos(GHOST_TInt32 &x, GHOST_TInt32 &y) const
{
x = m_cursorGrabInitPos[0];
y = m_cursorGrabInitPos[1];
}
inline void GHOST_Window::getCursorGrabAccum(int32_t &x, int32_t &y) const
inline void GHOST_Window::getCursorGrabAccum(GHOST_TInt32 &x, GHOST_TInt32 &y) const
{
x = m_cursorGrabAccumPos[0];
y = m_cursorGrabAccumPos[1];
}
inline void GHOST_Window::setCursorGrabAccum(int32_t x, int32_t y)
inline void GHOST_Window::setCursorGrabAccum(GHOST_TInt32 x, GHOST_TInt32 y)
{
m_cursorGrabAccumPos[0] = x;
m_cursorGrabAccumPos[1] = y;

View File

@@ -57,10 +57,10 @@ class GHOST_WindowCocoa : public GHOST_Window {
*/
GHOST_WindowCocoa(GHOST_SystemCocoa *systemCocoa,
const char *title,
int32_t left,
int32_t bottom,
uint32_t width,
uint32_t height,
GHOST_TInt32 left,
GHOST_TInt32 bottom,
GHOST_TUns32 width,
GHOST_TUns32 height,
GHOST_TWindowState state,
GHOST_TDrawingContextType type = GHOST_kDrawingContextTypeNone,
const bool stereoVisual = false,
@@ -116,20 +116,20 @@ class GHOST_WindowCocoa : public GHOST_Window {
* Resizes client rectangle width.
* \param width: The new width of the client area of the window.
*/
GHOST_TSuccess setClientWidth(uint32_t width);
GHOST_TSuccess setClientWidth(GHOST_TUns32 width);
/**
* Resizes client rectangle height.
* \param height: The new height of the client area of the window.
*/
GHOST_TSuccess setClientHeight(uint32_t height);
GHOST_TSuccess setClientHeight(GHOST_TUns32 height);
/**
* Resizes client rectangle.
* \param width: The new width of the client area of the window.
* \param height: The new height of the client area of the window.
*/
GHOST_TSuccess setClientSize(uint32_t width, uint32_t height);
GHOST_TSuccess setClientSize(GHOST_TUns32 width, GHOST_TUns32 height);
/**
* Returns the state of the window (normal, minimized, maximized).
@@ -151,7 +151,10 @@ class GHOST_WindowCocoa : public GHOST_Window {
* \param outX: The x-coordinate in the client rectangle.
* \param outY: The y-coordinate in the client rectangle.
*/
void screenToClient(int32_t inX, int32_t inY, int32_t &outX, int32_t &outY) const;
void screenToClient(GHOST_TInt32 inX,
GHOST_TInt32 inY,
GHOST_TInt32 &outX,
GHOST_TInt32 &outY) const;
/**
* Converts a point in screen coordinates to client rectangle coordinates
@@ -160,7 +163,10 @@ class GHOST_WindowCocoa : public GHOST_Window {
* \param outX: The x-coordinate on the screen.
* \param outY: The y-coordinate on the screen.
*/
void clientToScreen(int32_t inX, int32_t inY, int32_t &outX, int32_t &outY) const;
void clientToScreen(GHOST_TInt32 inX,
GHOST_TInt32 inY,
GHOST_TInt32 &outX,
GHOST_TInt32 &outY) const;
/**
* Converts a point in screen coordinates to client rectangle coordinates
@@ -170,7 +176,10 @@ class GHOST_WindowCocoa : public GHOST_Window {
* \param outX: The x-coordinate on the screen.
* \param outY: The y-coordinate on the screen.
*/
void clientToScreenIntern(int32_t inX, int32_t inY, int32_t &outX, int32_t &outY) const;
void clientToScreenIntern(GHOST_TInt32 inX,
GHOST_TInt32 inY,
GHOST_TInt32 &outX,
GHOST_TInt32 &outY) const;
/**
* Converts a point in screen coordinates to client rectangle coordinates,
@@ -180,7 +189,10 @@ class GHOST_WindowCocoa : public GHOST_Window {
* \param outX: The x-coordinate on the screen.
* \param outY: The y-coordinate on the screen.
*/
void screenToClientIntern(int32_t inX, int32_t inY, int32_t &outX, int32_t &outY) const;
void screenToClientIntern(GHOST_TInt32 inX,
GHOST_TInt32 inY,
GHOST_TInt32 &outX,
GHOST_TInt32 &outY) const;
/**
* Gets the screen the window is displayed in
@@ -287,8 +299,8 @@ class GHOST_WindowCocoa : public GHOST_Window {
* Sets the cursor shape on the window using
* native window system calls.
*/
GHOST_TSuccess setWindowCustomCursorShape(uint8_t *bitmap,
uint8_t *mask,
GHOST_TSuccess setWindowCustomCursorShape(GHOST_TUns8 *bitmap,
GHOST_TUns8 *mask,
int sizex,
int sizey,
int hotX,

View File

@@ -284,10 +284,10 @@
GHOST_WindowCocoa::GHOST_WindowCocoa(GHOST_SystemCocoa *systemCocoa,
const char *title,
int32_t left,
int32_t bottom,
uint32_t width,
uint32_t height,
GHOST_TInt32 left,
GHOST_TInt32 bottom,
GHOST_TUns32 width,
GHOST_TUns32 height,
GHOST_TWindowState state,
GHOST_TDrawingContextType type,
const bool stereoVisual,
@@ -570,13 +570,13 @@ void GHOST_WindowCocoa::getClientBounds(GHOST_Rect &bounds) const
[pool drain];
}
GHOST_TSuccess GHOST_WindowCocoa::setClientWidth(uint32_t width)
GHOST_TSuccess GHOST_WindowCocoa::setClientWidth(GHOST_TUns32 width)
{
GHOST_ASSERT(getValid(), "GHOST_WindowCocoa::setClientWidth(): window invalid");
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
GHOST_Rect cBnds, wBnds;
getClientBounds(cBnds);
if (((uint32_t)cBnds.getWidth()) != width) {
if (((GHOST_TUns32)cBnds.getWidth()) != width) {
NSSize size;
size.width = width;
size.height = cBnds.getHeight();
@@ -586,13 +586,13 @@ GHOST_TSuccess GHOST_WindowCocoa::setClientWidth(uint32_t width)
return GHOST_kSuccess;
}
GHOST_TSuccess GHOST_WindowCocoa::setClientHeight(uint32_t height)
GHOST_TSuccess GHOST_WindowCocoa::setClientHeight(GHOST_TUns32 height)
{
GHOST_ASSERT(getValid(), "GHOST_WindowCocoa::setClientHeight(): window invalid");
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
GHOST_Rect cBnds, wBnds;
getClientBounds(cBnds);
if (((uint32_t)cBnds.getHeight()) != height) {
if (((GHOST_TUns32)cBnds.getHeight()) != height) {
NSSize size;
size.width = cBnds.getWidth();
size.height = height;
@@ -602,13 +602,14 @@ GHOST_TSuccess GHOST_WindowCocoa::setClientHeight(uint32_t height)
return GHOST_kSuccess;
}
GHOST_TSuccess GHOST_WindowCocoa::setClientSize(uint32_t width, uint32_t height)
GHOST_TSuccess GHOST_WindowCocoa::setClientSize(GHOST_TUns32 width, GHOST_TUns32 height)
{
GHOST_ASSERT(getValid(), "GHOST_WindowCocoa::setClientSize(): window invalid");
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
GHOST_Rect cBnds, wBnds;
getClientBounds(cBnds);
if ((((uint32_t)cBnds.getWidth()) != width) || (((uint32_t)cBnds.getHeight()) != height)) {
if ((((GHOST_TUns32)cBnds.getWidth()) != width) ||
(((GHOST_TUns32)cBnds.getHeight()) != height)) {
NSSize size;
size.width = width;
size.height = height;
@@ -653,10 +654,10 @@ GHOST_TWindowState GHOST_WindowCocoa::getState() const
return state;
}
void GHOST_WindowCocoa::screenToClient(int32_t inX,
int32_t inY,
int32_t &outX,
int32_t &outY) const
void GHOST_WindowCocoa::screenToClient(GHOST_TInt32 inX,
GHOST_TInt32 inY,
GHOST_TInt32 &outX,
GHOST_TInt32 &outY) const
{
GHOST_ASSERT(getValid(), "GHOST_WindowCocoa::screenToClient(): window invalid");
@@ -668,10 +669,10 @@ void GHOST_WindowCocoa::screenToClient(int32_t inX,
outY = (cBnds.getHeight() - 1) - outY;
}
void GHOST_WindowCocoa::clientToScreen(int32_t inX,
int32_t inY,
int32_t &outX,
int32_t &outY) const
void GHOST_WindowCocoa::clientToScreen(GHOST_TInt32 inX,
GHOST_TInt32 inY,
GHOST_TInt32 &outX,
GHOST_TInt32 &outY) const
{
GHOST_ASSERT(getValid(), "GHOST_WindowCocoa::clientToScreen(): window invalid");
@@ -683,10 +684,10 @@ void GHOST_WindowCocoa::clientToScreen(int32_t inX,
clientToScreenIntern(inX, inY, outX, outY);
}
void GHOST_WindowCocoa::screenToClientIntern(int32_t inX,
int32_t inY,
int32_t &outX,
int32_t &outY) const
void GHOST_WindowCocoa::screenToClientIntern(GHOST_TInt32 inX,
GHOST_TInt32 inY,
GHOST_TInt32 &outX,
GHOST_TInt32 &outY) const
{
NSRect screenCoord;
NSRect baseCoord;
@@ -700,10 +701,10 @@ void GHOST_WindowCocoa::screenToClientIntern(int32_t inX,
outY = baseCoord.origin.y;
}
void GHOST_WindowCocoa::clientToScreenIntern(int32_t inX,
int32_t inY,
int32_t &outX,
int32_t &outY) const
void GHOST_WindowCocoa::clientToScreenIntern(GHOST_TInt32 inX,
GHOST_TInt32 inY,
GHOST_TInt32 &outX,
GHOST_TInt32 &outY) const
{
NSRect screenCoord;
NSRect baseCoord;
@@ -1126,9 +1127,9 @@ GHOST_TSuccess GHOST_WindowCocoa::hasCursorShape(GHOST_TStandardCursor shape)
return success;
}
/* Reverse the bits in a uint8_t */
/* Reverse the bits in a GHOST_TUns8 */
#if 0
static uint8_t uns8ReverseBits(uint8_t ch)
static GHOST_TUns8 uns8ReverseBits(GHOST_TUns8 ch)
{
ch= ((ch >> 1) & 0x55) | ((ch << 1) & 0xAA);
ch= ((ch >> 2) & 0x33) | ((ch << 2) & 0xCC);
@@ -1137,8 +1138,8 @@ static uint8_t uns8ReverseBits(uint8_t ch)
}
#endif
/** Reverse the bits in a uint16_t */
static uint16_t uns16ReverseBits(uint16_t shrt)
/** Reverse the bits in a GHOST_TUns16 */
static GHOST_TUns16 uns16ReverseBits(GHOST_TUns16 shrt)
{
shrt = ((shrt >> 1) & 0x5555) | ((shrt << 1) & 0xAAAA);
shrt = ((shrt >> 2) & 0x3333) | ((shrt << 2) & 0xCCCC);
@@ -1147,15 +1148,20 @@ static uint16_t uns16ReverseBits(uint16_t shrt)
return shrt;
}
GHOST_TSuccess GHOST_WindowCocoa::setWindowCustomCursorShape(
uint8_t *bitmap, uint8_t *mask, int sizex, int sizey, int hotX, int hotY, bool canInvertColor)
GHOST_TSuccess GHOST_WindowCocoa::setWindowCustomCursorShape(GHOST_TUns8 *bitmap,
GHOST_TUns8 *mask,
int sizex,
int sizey,
int hotX,
int hotY,
bool canInvertColor)
{
int y, nbUns16;
NSPoint hotSpotPoint;
NSBitmapImageRep *cursorImageRep;
NSImage *cursorImage;
NSSize imSize;
uint16_t *cursorBitmap;
GHOST_TUns16 *cursorBitmap;
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
@@ -1176,7 +1182,7 @@ GHOST_TSuccess GHOST_WindowCocoa::setWindowCustomCursorShape(
bytesPerRow:(sizex / 8 + (sizex % 8 > 0 ? 1 : 0))
bitsPerPixel:1];
cursorBitmap = (uint16_t *)[cursorImageRep bitmapData];
cursorBitmap = (GHOST_TUns16 *)[cursorImageRep bitmapData];
nbUns16 = [cursorImageRep bytesPerPlane] / 2;
for (y = 0; y < nbUns16; y++) {

Some files were not shown because too many files have changed in this diff Show More