You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to urh...@googlegroups.com
Hi! Is it possible to assign Material (Shader etc) type variable in the ScriptInstance (AngelScript API) through the Editor? Thanks.
Chris Friesen
unread,
Oct 4, 2013, 6:20:18 PM10/4/13
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to urh...@googlegroups.com
Yup.
class AddMat : ScriptObject
{
void Start()
{
StaticModel@ model = node.GetComponent("StaticModel");
Material@ mat = cache.GetResource("Material", "Materials/CloudPlane.xml");
model.material = mat;
}
}
Is that what you are trying to do?
Chris Friesen
unread,
Oct 4, 2013, 6:42:59 PM10/4/13
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to urh...@googlegroups.com
node is a reference to the current node
all variables in the class that are not prefixed with an _ are available in the editor.
class AddMat : ScriptObject
{
string materialName;
void Start()
{
StaticModel@ model = node.GetComponent("StaticModel");
Material@ mat = cache.GetResource("Material", materialName);
model.material = mat;
}
}
Alexander M
unread,
Oct 5, 2013, 6:59:45 AM10/5/13
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to urh...@googlegroups.com
Thanks for the replies!
Sorry, I'm not exactly described the problem. Is there any possibility to call Resource Picker for Material like in the BillboardSet component?
Lasse Öörni
unread,
Oct 5, 2013, 7:25:04 AM10/5/13
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to urh...@googlegroups.com
Right now handles to Resource objects are not supported by
ScriptInstance variable introspection, only Node & Component
subclasses.
I believe it is doable, but requires expansion of the
information stored for registered object classes. Basically, need a way
to determine at runtime (preferably without hardcoding) when a class
name is a Resource subclass.
Lasse Öörni
unread,
Oct 5, 2013, 5:15:38 PM10/5/13
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to urh...@googlegroups.com
There's now support for assigning script object's resource handle variables from the editor. Here's a (stupid) example script which would set a different material out of two for a StaticModel each frame:
class MaterialChanger : ScriptObject { Material@ mat1; Material@ mat2; uint index = 0;
void Update(float timeStep)
{ StaticModel@ model = node.GetComponent("StaticModel");