Hello!
console.log(line1.material.pluginManager._plugins)
const material2 = line1.material.clone()
console.log(material2.pluginManager._plugins)
#H1LRZ3#29
Thank you!
Hello!
console.log(line1.material.pluginManager._plugins)
const material2 = line1.material.clone()
console.log(material2.pluginManager._plugins)
#H1LRZ3#29
Thank you!
This PR will fix the problem:
Hello!
This causes issues for me:
because the constructor of GreasedLinePluginMaterial
is
constructor(
material: Material,
private _scene: Scene,
options: GreasedLineMaterialOptions
) {
and the Instantiate doesn’t set any parameters, obviously.
I’ll make the constructor working even without these parameters.
OK, seems to be working now
Cloning successful!
For ES6 to work, I think you will need to add this line at the end of the plugin file:
RegisterClass("BABYLON.GreasedLinePluginMaterial", GreasedLinePluginMaterial);
With this import:
import { RegisterClass } from "../Misc/typeStore";
Its working fine without this stuff. I’ve even created a cloning example PG and put it in the docs.
Even when using ES6? In ES6, there’s no “BABYLON” namespace, and so “BABYLON.GreasedLinePluginMaterial” should not be found, so Tools.Instantiate("BABYLON." + pluginClassName)
should not work.
Note that it is not the cloning that will fail, but the serialization + parsing (Tools.Instantiate("BABYLON." + pluginClassName)
is done in the Parse function).
Ehm, I just tried it in the Playground, where the BABYLON namespace is available. Now I get what did you mean. I am going to have a look at it.
This was absolutely correct! I’ve looked into another classes and it’s done this way.
RegisterClass
has been added to GreasedLinePluginMaterial
.
Many thanks!