playMaker

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - looi

Pages: [1] 2
1
Action Requests / Re: ArrayList Get Vertex Positions (world space)
« on: April 12, 2019, 02:43:11 PM »
OK, worldSpace bool added:

Code: [Select]
// (c) Jean Fabre, 2011-2013 All rights reserved.
// http://www.fabrejean.net

// INSTRUCTIONS
// Drop a PlayMakerArrayList script onto a GameObject, and define a unique name for reference if several PlayMakerArrayList coexists on that GameObject.
// In this Action interface, link that GameObject in "arrayListObject" and input the reference name if defined.
// Note: You can directly reference that GameObject or store it in an Fsm variable or global Fsm variable

// credits: action created by LampRabbit: http://hutonggames.com/playmakerforum/index.php?topic=3982.msg18550#msg18550

using System;
using UnityEngine;

namespace HutongGames.PlayMaker.Actions
{
[ActionCategory("ArrayMaker/ArrayList")]
[Tooltip("Store mesh vertex positions into an arrayList")]
public class ArrayListGetVertexPositions2 : ArrayListActions
{

[ActionSection("Set up")]

[RequiredField]
[Tooltip("The gameObject with the PlayMaker ArrayList Proxy component")]
[CheckForComponent(typeof(PlayMakerArrayListProxy))]
public FsmOwnerDefault gameObject;

[Tooltip("Author defined Reference of the PlayMaker ArrayList Proxy component ( necessary if several component coexists on the same GameObject")]
public FsmString reference;


[ActionSection("Source")]

[Tooltip("the GameObject to get the mesh from")]
[CheckForComponent(typeof(MeshFilter))]
public FsmGameObject mesh;
        public bool worldSpace;


public override void Reset()
{
gameObject = null;
reference = null;
mesh = null;
worldSpace = false;
}


public override void OnEnter()
{
if ( SetUpArrayListProxyPointer(Fsm.GetOwnerDefaultTarget(gameObject),reference.Value) )
getVertexPositions();

Finish();
}


public void getVertexPositions()
{
if (! isProxyValid())
return;

proxy.arrayList.Clear();


GameObject _go = mesh.Value;
if (_go==null)
{
return;
}


MeshFilter _mesh = _go.GetComponent<MeshFilter>();
if (_mesh ==null)
{
return;
}

            if (worldSpace)
            {
                for (int i = 0; i < _mesh.mesh.vertices.Length; i++)
                {
                    proxy.arrayList.Add(_mesh.transform.TransformPoint(_mesh.mesh.vertices[i]));
                }
            }
            else
            {
                proxy.arrayList.InsertRange(0, _mesh.mesh.vertices);
            }


}
}
}

2
Action Requests / ArrayList Get Vertex Positions (world space)
« on: April 10, 2019, 06:25:56 PM »
Hello,

I've modified the action ArrayListGetVertexPositions to obtain the world space points of a mesh vertices instead of local points.

I think it might be usefull to upload it to Ecosystem.

Code: [Select]
// (c) Jean Fabre, 2011-2013 All rights reserved.
// http://www.fabrejean.net

// INSTRUCTIONS
// Drop a PlayMakerArrayList script onto a GameObject, and define a unique name for reference if several PlayMakerArrayList coexists on that GameObject.
// In this Action interface, link that GameObject in "arrayListObject" and input the reference name if defined.
// Note: You can directly reference that GameObject or store it in an Fsm variable or global Fsm variable

// credits: action created by LampRabbit: http://hutonggames.com/playmakerforum/index.php?topic=3982.msg18550#msg18550

using System;
using UnityEngine;

namespace HutongGames.PlayMaker.Actions
{
[ActionCategory("ArrayMaker/ArrayList")]
[Tooltip("Store mesh vertex positions into an arrayList")]
public class ArrayListGetVertexPositions : ArrayListActions
{

[ActionSection("Set up")]

[RequiredField]
[Tooltip("The gameObject with the PlayMaker ArrayList Proxy component")]
[CheckForComponent(typeof(PlayMakerArrayListProxy))]
public FsmOwnerDefault gameObject;

[Tooltip("Author defined Reference of the PlayMaker ArrayList Proxy component ( necessary if several component coexists on the same GameObject")]
public FsmString reference;


[ActionSection("Source")]

[Tooltip("the GameObject to get the mesh from")]
[CheckForComponent(typeof(MeshFilter))]
public FsmGameObject mesh;



public override void Reset()
{
gameObject = null;
reference = null;
mesh = null;

}


public override void OnEnter()
{
if ( SetUpArrayListProxyPointer(Fsm.GetOwnerDefaultTarget(gameObject),reference.Value) )
getVertexPositions();

Finish();
}


public void getVertexPositions()
{
if (! isProxyValid())
return;

proxy.arrayList.Clear();


GameObject _go = mesh.Value;
if (_go==null)
{
return;
}


MeshFilter _mesh = _go.GetComponent<MeshFilter>();
if (_mesh ==null)
{
return;
}
            proxy.arrayList.Clear();
            for (int i = 0; i < _mesh.mesh.vertices.Length; i++) {
                proxy.arrayList.Add(_mesh.transform.TransformPoint(_mesh.mesh.vertices[i]));
            }

//proxy.arrayList.InsertRange(0,_mesh.mesh.vertices);


}
}
}

3
Action Requests / get File Name From Path
« on: March 20, 2019, 10:36:36 AM »
Hello!

One request: an action to obtain a filename from a path. I think it should be easy, but I can't do it.

It may use the GetFileName function https://docs.microsoft.com/en-us/dotnet/api/system.io.path.getfilename?redirectedfrom=MSDN&view=netframework-4.7.2#System_IO_Path_GetFileName_System_String_

Code: [Select]
string onlyFileName = System.IO.Path.GetFileName(entirePath);
someone? :D

4
Playmaker Help / Re: Create Render Texture at runtime?
« on: February 13, 2019, 11:46:47 AM »
Thank you Jean!  :D

5
Playmaker Help / Re: [SOLVED] Large FSM severely slow
« on: October 10, 2018, 07:16:40 PM »
I was suffering this problem and until now I've found the solution that gave me back the fluidity: in Preferences I've disabled the option "Enable Real Time Error Checker".

I've got like more than 200 playmaker "errors" and It seems the editor was looking on them every frame or something.

So anyone having this issue shoud try this. It definitely saved my productivity! :)

6
Share New Actions / Re: Get the remainder of two float values
« on: July 26, 2018, 07:25:42 PM »
Oooh! Thank you so much! This has helped me a lot! I looked for it in the Ecosystem and I couldn't find it.
Love youuu!  <3

7
Playmaker Help / Re: Access PlayMakerHashTableProxy from scipt
« on: May 18, 2018, 10:04:32 AM »
Finally I found a workarround: to parse the DictionaryEntry.Value. I know this is nonsense, but It works for me and I do not reach something better.
This is the entire function:

Code: [Select]
public void closestColor3(Color32 target){
float hue1 = getHue (target.r, target.g, target.b);
var num1 = ColorNum(target);
float minimaDiferenciaColores = 10000;
string key="";
int flag = 0;
int index = 0;
Color valor; Color32 valor32; Color colorParecido = new Color();
foreach (DictionaryEntry colorDeLaLista in listaNcs.hashTable) {
flag++;
float Rvalor = float.Parse (colorDeLaLista.Value.ToString ().Substring (5, 5));
float Gvalor = float.Parse (colorDeLaLista.Value.ToString ().Substring (12, 5));
float Bvalor = float.Parse (colorDeLaLista.Value.ToString ().Substring (19, 5));
valor = new Color (Rvalor,Gvalor,Bvalor);
valor32 = (Color32)valor;
float diferenciaColores = Math.Abs(ColorNum(valor) - num1) + getHueDistance(getHue(valor32.r, valor32.g, valor32.b), hue1);
if (diferenciaColores < minimaDiferenciaColores) {
minimaDiferenciaColores = diferenciaColores;
key = colorDeLaLista.Key.ToString ();
index = flag;
colorParecido = valor;
}
}
img_NCS.color = colorParecido;
txt_NCS.text = key;
}

If you have any suggestion to improve it, please tell me. Thanks! :)

8
Playmaker Help / Access PlayMakerHashTableProxy from scipt
« on: May 16, 2018, 03:43:08 PM »
Hello!

First of all, I know this is more relative to a C# understanding than PlayMaker itself, even so, I would appreciate your help.

I've filled a playmaker hashtable with all NCS colors with their key names, now I need to access them from a script. I've managed to read all the values, but I cannot convert them to UnityEngine.Color32 to be able to operate them and to do all calculations I want to do with RGB, etc.

Code: [Select]
foreach (DictionaryEntry colorInTheList in NcsList.hashTable) {
     Debug.Log(colorInTheList.Value) //it prints RGBA(0,0,0,0) the color!
     Color32 colorValue = colorInTheList.Value
}

with this code, the console says "error CS0266: Cannot implicitly convert type `object' to `UnityEngine.Color32'. An explicit conversion exists (are you missing a cast?)"

Thank youuu!

9
Playmaker Bug Reporting / Re: I cannot add new Global Variable
« on: December 27, 2017, 11:06:26 AM »
Unity 2017.2.0f3
Playmaker 1.8.6.
For the moment I've just avoid the bug by adding the new global variable using the "NEW GLOBAL VARIABLE" option in an action.

Using ArrayMaker, Ecosistem and Easy Save 2

10
Playmaker Bug Reporting / I cannot add new Global Variable
« on: December 26, 2017, 11:19:47 AM »
I open the Global Variables window and I click on the input text to create a new global variable, but the cursor just doesn't stay there as always. So, as the cursor is not in the input text, I can't type anything and I can't add the variable.

I have noticed that after doing that, if I try to add a local variable, it happens the same. Before trying to add a new global variable I can add local variables, but after the error, I cannot even create a local variable.

It happens happens whenever I try to create a global variable.

(PS: I have just reported the bug via Editor)

11
Playmaker Bug Reporting / Global variables become inaccesible
« on: June 27, 2016, 02:41:55 AM »
Hello,

I don't know how to describe well this issue, because it is a little strange.
I have a project with a huge list of global variables. I started it with the previous version of Playmaker and I upgrade to the last version and all works... apparently.

Now, when I try to access a global variable from a script, I just doesn't find it. It's correctly written and all is okay, but it doens't find it.

I have to delete the variable and create it again with the same name. Then it works well.

Why is it happening? Maybe I should not update to 1.8.1?  :-\

Thank you!

12
Playmaker Help / Re: Xml Select Nodes by Fsm String
« on: June 20, 2016, 12:36:30 AM »
Thank you Jean!

I will try to use another option then

13
Playmaker Help / Xml Select Nodes by Fsm String
« on: June 17, 2016, 05:25:48 AM »
Hello

I want to parse an XML from a URL and save it in a ArrayList.
I've done the first part, I got the XML with the action WWW Object and I'm saving it in a string.

Then, I want to parse it with the action Xml Select Nodes. I select Source selection: Use Variable. Then, it appears the dropdown list with all my strings, but I can't select any of them.

When I try to select a string from the list, In the Console appears this error:
Code: [Select]
ArgumentException: Object type HutongGames.PlayMaker.FsmString cannot be converted to target type: HutongGames.PlayMaker.FsmEvent
Parameter name: val
System.Reflection.MonoField.SetValue (System.Object obj, System.Object val, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoField.cs:133)
System.Reflection.FieldInfo.SetValue (System.Object obj, System.Object value) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/FieldInfo.cs:150)
HutongGames.PlayMakerEditor.ActionEditor.DoVariableSelection (System.Object userdata) (at c:/Users/Alex/Documents/Unity/Playmaker/Projects/Playmaker.source.unity/Assets/PlayMaker/Editor/Classes/ActionEditor.cs:2826)
UnityEditor.GenericMenu.CatchMenu (System.Object userData, System.String[] options, Int32 selected) (at C:/buildslave/unity/build/artifacts/generated/common/editor/GenericMenuBindings.gen.cs:122)

I've searched for this problem and I couldn't find solution here. In this case the problem is not in the variable itself, because I cannot choose any.
Running Unity 5.3.5f1, PlayMaker 1.8.1.f10 and last DataMaker in Ecosystem

Do you know why this may happen?

Thank you very much!

14
Oh Oh!

It was my fault, I was incorrectly using the variables inside the parsed string! I didn't understand what "Variable _0_" means but now I do!

Thanks to this magnífic video:
https://www.youtube.com/watch?v=eB_E4embTvw

15
Hello!

I'm using the action Xml Select Single Node action, which is in the DataMaker package. I am using a xml file as source.

When I do the action with an xPath Query introduced by text it works fine, but the problems comes when I want to set the xPath Query by an string variable. It just don't allow me to select any string. I mean, they appear in the dropdown, but when I select one, the input remains in "None".

If I try to do it at runtime, it appears this error in the console:

"ArgumentException: Object type HutongGames.PlayMaker.FsmString cannot be converted to target type: System.Boolean
Parameter name: val
System.Reflection.MonoField.SetValue (System.Object obj, System.Object val, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System.Reflection/MonoField.cs:133)
System.Reflection.FieldInfo.SetValue (System.Object obj, System.Object value) (at /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System.Reflection/FieldInfo.cs:150)
HutongGames.PlayMakerEditor.ActionEditor.DoVariableSelection (System.Object userdata) (at c:/Users/Alex/Documents/Unity/Playmaker/Projects/Playmaker.source.unity/Assets/PlayMaker/Editor/Classes/ActionEditor.cs:2779)
UnityEditor.GenericMenu.CatchMenu (System.Object userData, System.String[] options, Int32 selected) (at C:/buildslave/unity/build/artifacts/generated/common/editor/GenericMenuBindings.gen.cs:122)"

So I don't know if I am missing something or what, but I can't find why it happens. I've also tried to set it as "None" and then add more variables, but it just don't work...

Have somebody been in this problem?

Thank you!

Pages: [1] 2