Tanoda
LeapSpriteFeature.cs
Go to the documentation of this file.
1
/******************************************************************************
2
* Copyright (C) Ultraleap, Inc. 2011-2020. *
3
* *
4
* Use subject to the terms of the Apache License 2.0 available at *
5
* http://www.apache.org/licenses/LICENSE-2.0, or another agreement *
6
* between Ultraleap and you, your company or other organization. *
7
******************************************************************************/
8
9
using
System;
10
using
UnityEngine
;
11
using
UnityEngine
.Rendering;
12
#if UNITY_EDITOR
13
using
UnityEditor
;
14
using
UnityEditor
.Sprites;
15
#endif
16
using
Leap
.
Unity
.
Attributes
;
17
18
namespace
Leap.Unity.GraphicalRenderer
{
19
20
[LeapGraphicTag(
"Sprite"
, 20)]
21
[Serializable]
22
public
class
LeapSpriteFeature
:
LeapGraphicFeature
<LeapSpriteData> {
23
24
[Delayed]
25
[
EditTimeOnly
]
26
public
string
propertyName
=
"_MainTex"
;
27
28
[
EditTimeOnly
]
29
public
UVChannelFlags
channel
= UVChannelFlags.UV0;
30
31
#if UNITY_EDITOR
32
public
bool
AreAllSpritesPacked() {
33
foreach
(var dataObj
in
featureData
) {
34
if
(dataObj.sprite ==
null
)
continue
;
35
36
if
(!dataObj.sprite.packed) {
37
return
false
;
38
}
39
}
40
return
true
;
41
}
42
43
public
bool
AreAllSpritesOnSameTexture() {
44
Texture2D mainTex =
null
;
45
foreach
(var dataObj
in
featureData
) {
46
if
(dataObj.sprite ==
null
)
continue
;
47
48
string
atlasName;
49
Texture2D atlasTex;
50
Packer.GetAtlasDataForSprite(dataObj.sprite, out atlasName, out atlasTex);
51
52
if
(mainTex ==
null
) {
53
mainTex = atlasTex;
54
}
else
{
55
if
(mainTex != atlasTex) {
56
return
false
;
57
}
58
}
59
}
60
61
return
true
;
62
}
63
#endif
64
}
65
}
Leap.Unity.Attributes.EditTimeOnly
Definition:
EditTimeOnly.cs:15
Leap.Unity.GraphicalRenderer.LeapGraphicFeature
Definition:
LeapGraphicFeature.cs:63
Leap.Unity.GraphicalRenderer.LeapGraphicFeature< LeapSpriteData >::featureData
List< DataType > featureData
A list of all feature data.
Definition:
LeapGraphicFeature.cs:69
Leap.Unity.GraphicalRenderer.LeapSpriteFeature
Definition:
LeapSpriteFeature.cs:22
Leap.Unity.GraphicalRenderer.LeapSpriteFeature.channel
UVChannelFlags channel
Definition:
LeapSpriteFeature.cs:29
Leap.Unity.GraphicalRenderer.LeapSpriteFeature.propertyName
string propertyName
Definition:
LeapSpriteFeature.cs:26
Leap.Unity.Attributes
Definition:
CombinablePropertyDrawer.cs:16
Leap.Unity.GraphicalRenderer
Definition:
EditorPickingMeshRebuilder.cs:12
Leap.Unity
Definition:
AssetFolderPropertyDrawer.cs:15
Leap
Definition:
AssetFolderPropertyDrawer.cs:15
UnityEditor
Definition:
BoxSliderEditor.cs:6
UnityEngine
Definition:
HSVPicker/UtilityScripts/BoxSlider.cs:7
Source
Assets
Plugins
LeapMotion
Legacy
GraphicRenderer
Scripts
Features
Sprite
LeapSpriteFeature.cs
Generated by
1.9.3