Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build WP error. #29

Closed
wants to merge 68 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
68 commits
Select commit Hold shift + click to select a range
4587e72
Package for Bird-Tutorial.
Banbury Jan 23, 2014
a6a8fef
SkinMesh: Creating formfitting meshes for sprites.
Banbury Jan 19, 2014
e5642c4
Added missing license.
Banbury Jan 25, 2014
64f6db7
New package.
Banbury Jan 25, 2014
ffbedae
SkinMesh: Fix for generation of UV-coordinates of packed sprites.
Banbury Jan 25, 2014
8c340c3
New package.
Banbury Jan 25, 2014
1a048ba
Merge branch 'master' into unstable
Banbury Feb 9, 2014
a1e1246
Gradle build file.
Banbury Feb 9, 2014
91e5e3a
Files for tutorial 7.
Banbury Feb 9, 2014
39c50fc
Bugfix for displaying weight colors.
Banbury Feb 9, 2014
74ed307
New package.
Banbury Feb 9, 2014
a11da9c
Diverse changes.
Banbury Mar 1, 2014
961a525
Added ability to name poses
mjholtzem Feb 23, 2014
ed5b07f
Streamlined the IK Helper creation process
mjholtzem Feb 24, 2014
2a07313
New Package
Banbury Mar 1, 2014
61170e6
Added editor for weight painting.
Banbury Feb 19, 2014
1636965
Added support for scaling of bones.
Banbury Mar 4, 2014
b0e169f
Surrounded HSBColor with a namespace to avoid conflicts with other ad…
Banbury Mar 4, 2014
afd2806
Version 1.1
Banbury Mar 4, 2014
695419b
Moved tutorial files to separate folder.
Banbury Mar 15, 2014
b0657e8
Added AnimationToPNG utility script to output a series of PNG files f…
playemgames Mar 26, 2014
ca73bb8
Merge pull request #25 from playemgames/unstable
Banbury Mar 28, 2014
8ef75dc
Merge branch 'unstable' of https://github.com/Banbury/UnitySpritesAnd…
Banbury Mar 28, 2014
0790a8b
Added automatic camera creation for AnimationToPNG.
Banbury Mar 28, 2014
4ddbf56
Added menu in GameObjects for AnimationToPNG.
Banbury Mar 28, 2014
25969d4
Added support for multiple Skin2D components.
denvil Apr 13, 2014
a401236
Added support for nondeformable bones.
Banbury Apr 14, 2014
624df45
Merge branch 'unstable' of https://github.com/Banbury/UnitySpritesAnd…
denvil Apr 14, 2014
b9c5825
Moved calculating weights to skeleton. Now SkinnedMeshes can be in sk…
denvil Apr 14, 2014
1a7cf85
Allow all bones to weights, not just deform bones.
denvil Apr 14, 2014
93b058d
Reverted using to using bone index so that vertex weights is show right.
denvil Apr 14, 2014
a961194
Revert "Reverted using to using bone index so that vertex weights is …
denvil Apr 14, 2014
06248f8
Edit AnimationToPNG instructions to include description on autodetect…
playemgames Jun 29, 2014
47dd9b3
Merge branch 'unstable' of https://github.com/Banbury/UnitySpritesAnd…
playemgames Jun 29, 2014
245b189
Merge pull request #1 from denvil/unstable
playemgames Jun 29, 2014
90f12ca
Revert file order for project so prefabs work
playemgames Jun 29, 2014
6d2d4f4
Updated to try multiskinning, example included in scenes.
playemgames Jun 29, 2014
0b53d28
Changed Skin2D to run from Window>Sprites>Skin2D, also if a sprite is…
playemgames Jul 3, 2014
de0f84e
Added ability to change color to bones, and automatically color bones…
playemgames Jul 3, 2014
c6acc38
Added Ability to create control points to skinned meshes to freeform …
playemgames Jul 3, 2014
c58bbb1
Added Ability to create control points to skinned meshes to freeform …
playemgames Jul 3, 2014
55ce305
Merge branch 'unstable' of https://github.com/playemgames/UnitySprite…
playemgames Jul 3, 2014
02c03c1
Forgot to figure in scaling when placing the control points.
playemgames Jul 3, 2014
ceb17c0
Minor edits to ControlPoint and Skin2D.
playemgames Jul 3, 2014
7a97e8d
Fixed PolygonMesh creation using a polygon collider by resetting the …
playemgames Jul 9, 2014
bf8ff12
Made Control Points multi-editable, added Weight Painter to Sprites m…
playemgames Jul 9, 2014
b6b5f38
Changed Menu to "Sprites and Bones"
playemgames Jul 9, 2014
3131f40
Added slipping to the Skeleton class as well as using Lighting and Sh…
playemgames Jul 11, 2014
55d5932
Adding customization options to the helper gizmo. Helpers can now ha…
ketura Jul 13, 2014
6b33d4b
Updating helper menu item to conform to the new menu setup.
ketura Jul 13, 2014
2f41520
Merge pull request #2 from ketura/unstable
playemgames Jul 13, 2014
b6d2cd5
Fixed handling initial rotation with Control Points and Sprite and Po…
playemgames Jul 14, 2014
15db481
Minor change to menu name, changed "Sprite And Bones" to "Sprites And…
playemgames Jul 14, 2014
93acdce
Reset Scale before creating meshes. Pixels To Units are scaled with …
playemgames Jul 14, 2014
9add13c
Calculate Pixels to Units for Polygon mesh creation using the sprite'…
playemgames Jul 14, 2014
76064e2
Hid backup fields flip and useShadows.
Banbury Jul 20, 2014
22c910b
Added preferences for bone colors.
Banbury Jul 20, 2014
6e92f4e
Create Mesh: Polygon collider is added if none has been found.
Banbury Jul 20, 2014
b7cb6de
Updated package to version 1.2.
Banbury Jul 20, 2014
d034b04
Cleaned up GUI for Skeleton.
Banbury Aug 4, 2014
9754bb5
fixes #26 Replaced System.Array functions for compatibility with WP8.
Banbury Aug 5, 2014
a242b5e
resolved #19 Added creating ragdoll from skeleton.
Banbury Aug 5, 2014
30fb648
Added simplified skinned mesh component.
Banbury Aug 11, 2014
3c2b838
Removed tutorial and test files.
Banbury Aug 14, 2014
b5ce225
Calculating the offset seems to be unnecessary before applying to the…
playemgames Jul 29, 2014
f2fc417
Manually merged some minor changes by playemgames.
playemgames Aug 8, 2014
202b130
Removed unity package.
Banbury Aug 14, 2014
1716c88
Added #if UNITY_EDITOR liberally to allow compilation of standalone p…
Banbury Aug 16, 2014
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,6 @@ Library/
Assets/AssetStoreTools/
Gizmos/
Assets/GitSharp/
.gradle/
.gradle/
build/
SpritesAndBones.unitypackage
Binary file not shown.
Binary file not shown.
Binary file removed Assets/SpritesAndBones/Prefabs/Orc.prefab
Binary file not shown.
Binary file removed Assets/SpritesAndBones/Prefabs/Sintel.prefab
Binary file not shown.
Binary file removed Assets/SpritesAndBones/Root.controller
Binary file not shown.
68 changes: 38 additions & 30 deletions Assets/SpritesAndBones/Scripts/Bone.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
The MIT License (MIT)

Copyright (c) 2013 Banbury
Copyright (c) 2014 Banbury & Play-Em

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -41,6 +41,7 @@ public class Bone : MonoBehaviour {
public float influenceTail = 0.25f;
public float influenceHead = 0.25f;
public float zOrder = 0;
public Color color = Color.cyan;

private Bone parent;

Expand All @@ -52,8 +53,8 @@ public Vector2 Head {
}
}

#if UNITY_EDITOR
[MenuItem("GameObject/Create Other/Bone")]
#if UNITY_EDITOR
[MenuItem("Sprites And Bones/Bone")]
public static Bone Create() {
GameObject b = new GameObject("Bone");
Undo.RegisterCreatedObjectUndo(b, "Add child bone");
Expand All @@ -76,6 +77,7 @@ public static Bone Create() {
Bone[] bones = skel.GetComponentsInChildren<Bone>();
int index = bones.Max(bn => bn.index) + 1;
b.GetComponent<Bone>().index = index;
skel.CalculateWeights(true);
}

Selection.activeGameObject = b;
Expand Down Expand Up @@ -129,57 +131,66 @@ public static void Split() {
public void AddIK() {
Undo.AddComponent<InverseKinematics>(gameObject);
}
#endif
#endif

// Use this for initialization
void Start () {
void Start() {
if (gameObject.transform.parent != null)
parent = gameObject.transform.parent.GetComponent<Bone>();
}
// Update is called once per frame
void Update () {
}

// Update is called once per frame
void Update() {
transform.localRotation = Quaternion.Euler(0, 0, transform.localRotation.eulerAngles.z);

#if UNITY_EDITOR
if (Application.isEditor && editMode && snapToParent && parent != null) {
gameObject.transform.position = parent.Head;
}
#endif
}
}

#if UNITY_EDITOR
void OnDrawGizmos() {
if (gameObject.Equals(Selection.activeGameObject)) {
Gizmos.color = Color.yellow;
}
else {
Color c = this.color;
if (gameObject.name.ToUpper().EndsWith(".R") || gameObject.name.ToUpper().EndsWith("RIGHT")) {
c = Utils.ColorFromInt(EditorPrefs.GetInt("BoneRightColor", Color.red.AsInt()));
}
else if (gameObject.name.ToUpper().EndsWith(".L") || gameObject.name.ToUpper().EndsWith("LEFT")) {
c = Utils.ColorFromInt(EditorPrefs.GetInt("BoneLeftColor", Color.green.AsInt()));
}
c.a = 1;

if (editMode) {
Gizmos.color = Color.gray;
Gizmos.color = new Color(c.r * 0.75f, c.g * 0.75f, c.b * 0.75f, c.a);
}
else {
Gizmos.color = Color.blue;
Gizmos.color = c;
}
}

int div = 5;

Vector3 v = Quaternion.AngleAxis(45, Vector3.forward) * (((Vector3)Head - gameObject.transform.position) / div);
Gizmos.DrawLine(gameObject.transform.position, gameObject.transform.position + v);
Gizmos.DrawLine(gameObject.transform.position + v, Head);
Vector3 v = Quaternion.AngleAxis(45, Vector3.forward) * (((Vector3)Head - gameObject.transform.position) / div);
Gizmos.DrawLine(gameObject.transform.position, gameObject.transform.position + v);
Gizmos.DrawLine(gameObject.transform.position + v, Head);

v = Quaternion.AngleAxis(-45, Vector3.forward) * (((Vector3)Head - gameObject.transform.position) / div);
Gizmos.DrawLine(gameObject.transform.position, gameObject.transform.position + v);
Gizmos.DrawLine(gameObject.transform.position + v, Head);
v = Quaternion.AngleAxis(-45, Vector3.forward) * (((Vector3)Head - gameObject.transform.position) / div);
Gizmos.DrawLine(gameObject.transform.position, gameObject.transform.position + v);
Gizmos.DrawLine(gameObject.transform.position + v, Head);

Gizmos.DrawLine(gameObject.transform.position, Head);
Gizmos.DrawLine(gameObject.transform.position, Head);

Gizmos.color = new Color(Gizmos.color.r, Gizmos.color.g, Gizmos.color.b, 0.5f);
Gizmos.color = new Color(Gizmos.color.r, Gizmos.color.g, Gizmos.color.b, 0.5f);

if (editMode && showInfluence) {
Gizmos.DrawWireSphere(transform.position, influenceTail);
Gizmos.DrawWireSphere(Head, influenceHead);
}
if (deform && editMode && showInfluence) {
Gizmos.DrawWireSphere(transform.position, influenceTail);
Gizmos.DrawWireSphere(Head, influenceHead);
}
}
#endif

Expand All @@ -194,8 +205,7 @@ public float GetInfluence(Vector2 p) {
return 0;
else
return influenceTail;
}
else {
} else {
float t = Vector2.Dot(p - (Vector2)transform.position, wv) / wv.sqrMagnitude;

if (t < 0) {
Expand All @@ -204,15 +214,13 @@ public float GetInfluence(Vector2 p) {
return 0;
else
return (influenceTail - dist) / influenceTail;
}
else if (t > 1.0f) {
} else if (t > 1.0f) {
dist = (p - Head).magnitude;
if (dist > influenceHead)
return 0;
else
return (influenceHead - dist) / influenceHead;
}
else {
} else {
Vector2 proj = (Vector2)transform.position + (wv * t);
dist = (proj - p).magnitude;

Expand Down
135 changes: 135 additions & 0 deletions Assets/SpritesAndBones/Scripts/ControlPoint.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
/*
The MIT License (MIT)

Copyright (c) 2014 Play-Em

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/

using UnityEngine;
#if UNITY_EDITOR
using UnityEditor;
#endif
using System.Collections;
using System.Linq;
using System.Linq.Expressions;

[ExecuteInEditMode]
public class ControlPoint : MonoBehaviour {
[SerializeField] public Color color = Color.red;
[SerializeField] public float size = 0.01f;

[HideInInspector]
public Vector3 originalPosition;
[HideInInspector]
public int index;
[HideInInspector]
public SkinnedMeshRenderer skin;

#if UNITY_EDITOR
public static void CreateControlPoints(SkinnedMeshRenderer skin) {
if (skin.sharedMesh != null)
{
for (int i = 0; i < skin.sharedMesh.vertices.Length; i++)
{
GameObject b = new GameObject("Control Point");
// Unparent the skin temporarily before adding the control point
Transform skinParent = skin.transform.parent;
skin.transform.parent = null;

// Reset the rotation before creating the mesh so the UV's will align properly
Quaternion localRotation = skin.transform.localRotation;
skin.transform.localRotation = Quaternion.identity;

b.transform.position = new Vector3(skin.transform.position.x + (skin.sharedMesh.vertices[i].x * skin.transform.localScale.x), skin.transform.position.y + (skin.sharedMesh.vertices[i].y * skin.transform.localScale.y), skin.transform.position.z + (skin.sharedMesh.vertices[i].z * skin.transform.localScale.z));
b.transform.parent = skin.transform;
ControlPoint[] points = b.transform.parent.transform.GetComponentsInChildren<ControlPoint>();
if (points != null && points.Length > 0)
{
b.gameObject.name = b.gameObject.name + points.Length;
}
Undo.RegisterCreatedObjectUndo(b, "Add control point");
ControlPoint controlPoint = b.AddComponent<ControlPoint>();
controlPoint.index = i;
controlPoint.skin = skin;
controlPoint.originalPosition = b.transform.localPosition;

// Reset the rotations of the object
skin.transform.localRotation = localRotation;
skin.transform.parent = skinParent;
}
}
}
#endif

// Use this for initialization
void Start () {
}

// Update is called once per frame
void Update () {
if (skin != null && skin.sharedMesh != null)
{

if (skin.sharedMesh.vertices[index] != transform.localPosition)
{
Vector3[] vertices = new Vector3[skin.sharedMesh.vertices.Length];
System.Array.Copy(skin.sharedMesh.vertices, vertices, skin.sharedMesh.vertices.Length);
vertices[index] = transform.localPosition;
skin.sharedMesh.vertices = vertices;
skin.sharedMesh.RecalculateBounds();
}
}
}

#if UNITY_EDITOR
void OnDrawGizmos() {
if (Selection.activeGameObject != null)
{
if (gameObject.Equals(Selection.activeGameObject)
|| gameObject.transform.parent.gameObject.Equals(Selection.activeGameObject)
|| gameObject.transform.parent == Selection.activeGameObject.transform.parent)
{
if (gameObject.Equals(Selection.activeGameObject)) {
Gizmos.color = Color.green;
}
else {
if (gameObject.name.ToUpper().EndsWith("R") || gameObject.name.ToUpper().EndsWith("RIGHT"))
{
Gizmos.color = new Color(255.0f/255.0f, 128.0f/255.0f, 0f, 255.0f/255.0f);
}
else if (gameObject.name.ToUpper().EndsWith("L") || gameObject.name.ToUpper().EndsWith("LEFT"))
{
Gizmos.color = Color.magenta;
}
else
{
Gizmos.color = color;
}
}
Gizmos.DrawSphere(gameObject.transform.position, size);
}
}
}
#endif

public void ResetPosition() {
transform.localPosition = originalPosition;
}
}
14 changes: 14 additions & 0 deletions Assets/SpritesAndBones/Scripts/Editor/AlphaNumericSort.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
using UnityEngine;
using UnityEditor;
using System.Collections;

public class AlphaNumericSort : BaseHierarchySort
{
public override int Compare(GameObject lhs, GameObject rhs)
{
if (lhs == rhs) return 0;
if (lhs == null) return -1;
if (rhs == null) return 1;
return EditorUtility.NaturalCompare(lhs.name, rhs.name);
}
}
12 changes: 12 additions & 0 deletions Assets/SpritesAndBones/Scripts/Editor/AnimationToPNGMenu.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
using UnityEngine;
using UnityEditor;
using System.Collections;

public class AnimationToPNGMenu {
[MenuItem("Sprites And Bones/Animation To PNG")]
public static void Create() {
GameObject o = new GameObject("Animation To PNG");
Undo.RegisterCreatedObjectUndo(o, "Create skeleton");
o.AddComponent<AnimationToPNG>();
}
}
43 changes: 43 additions & 0 deletions Assets/SpritesAndBones/Scripts/Editor/ControlPointEditor.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/*
The MIT License (MIT)

Copyright (c) 2014 Play-Em

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/

using UnityEngine;
using UnityEditor;
using System.Collections;

[CanEditMultipleObjects]
[CustomEditor(typeof(ControlPoint))]
public class ControlPointEditor : Editor {
public override void OnInspectorGUI() {
ControlPoint controlPoint = (ControlPoint)target;

DrawDefaultInspector();

EditorGUILayout.Separator();

if (GUILayout.Button("Reset Position")) {
controlPoint.ResetPosition();
}
}
}
Loading