File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ class ShaderTargetObj extends h3d.scene.Object {
44 public var tag : String ;
55 public var priority : Int = 1 ;
66 public var shadersRoot : ShaderTarget ;
7+ var guard = 0 ;
78
89 public function apply (fx : hrt.prefab.fx. FX ) {
910 function reparentChildren (obj : hrt.prefab. Object3D ) {
@@ -53,10 +54,16 @@ class ShaderTargetObj extends h3d.scene.Object {
5354 public function removeShaders () {
5455 for (s in shadersRoot .findAll (Shader ))
5556 s .dispose ();
57+ guard -- ;
58+ }
59+
60+ public function isApplied () {
61+ return guard > 0 ;
5662 }
5763
5864 function applyShader (s : Shader ) {
5965 s .apply3d ((o ) -> return ! Std .isOfType (o , hrt.prefab.fx. FX . FXAnimation ) );
66+ guard ++ ;
6067 }
6168
6269 override function onRemove () {
@@ -104,7 +111,7 @@ class ShaderTarget extends Object3D {
104111 }
105112
106113 for (s in sts ) {
107- if (s .tag != null && actives .get (s .tag ) != s )
114+ if (( s .tag != null && actives .get (s .tag ) != s ) || s . isApplied () )
108115 continue ;
109116 s .applyShaders ();
110117 }
You can’t perform that action at this time.
0 commit comments