Ok... I'm trying this workaround:
- Create custom ICEAttributes instead of the factory ones via scripting,
with exactly the same type.
- Create a simple ICE graph that reads from the custom attributes and
writes to the factory attr via scripting.
I've managed to write the "MaterialID" this way, but with "Materials" I
have the problem that I cannot create an equal string array custom
attribute:
<JScript>
var oObj = CreatePrim("grid", "MeshSurface", "", "");
oICEAttrMats = oObj.ActivePrimitive.AddICEAttribute("MyString",
siICENodeDataString, siICENodeStructureArray, siICENodeContextSingleton);
oICEAttrMats.DataArray = ["a", "b", "c", "d"];
</JScript>
// WARNING : 3392 - Invalid offset specified while extracting data from
this attribute: <Attribute: MyString>
The DataType, StructType and ContextType of that string array attribute
is exactly the same as the factory "Materials" attribute.
(I checked in XSI_SAMPLES\ICE\Modelling_Materials.scn)
What's wrong now?
Thanks,
Eugen
Am 11.03.2013 18:46, schrieb Stephen Blair:
I don't think it is possible.
MaterialID becomes undefined/uninitialized pretty quick...
http://screencast.com/t/HeNPz4qgwlh
On 11/03/2013 12:25 PM, Eugen Sares wrote:
Thanks, Steven!
IsDefined is read-only, by the looks.
So how do I write to it to define it (outside of ICE), when it cannot
be written until it's defined??
Am 11.03.2013 17:15, schrieb Stephen Blair:
MaterialID isn't defined. Seems that you cannot set
MaterialID.DataArray unless IsDefined is True
On 11/03/2013 11:44 AM, Eugen Sares wrote:
Whereas this throws a warning:
<JScript>
NewScene("", "false");
var oObj = CreatePrim("grid", "MeshSurface", "", "");
SetValue("grid.polymsh.geom.subdivu", 2, null);
SetValue("grid.polymsh.geom.subdivv", 2, null);
var oICEAttr =
oObj.ActivePrimitive.GetICEAttributeFromName("MaterialID");
oICEAttr.DataArray = [0,1,2,3]; // WARNING : 3403 - The data is not
set on this ICEAttribute: MaterialID
var oProp = oObj.AddProperty("AttributeDisplay");
SetValue(oObj.Name + ".AttributeDisplay.attrname", "MyLong", null);
</JScript>