@@ -20,41 +20,28 @@ public static string AddCustomAttribute( this string decl, string container, str
2020 l = custAttributes.count mat;
2121 for i = 1 to l+1 do (
2222 if(mat.custAttributes[i] != undefined) then (
23- if(mat.custAttributes[i].name == attName) then return true
24- ) ) return false )" ;
23+ if(mat.custAttributes[i].name == attName) then
24+ (
25+ return true
26+ )
27+ ) ) return false )" ;
2528
26- /// <summary>
27- /// Note : We may run a check on all Slate view, because race condition into script execution
28- /// do not ensure the link beetwen material and bump are correctly set when material is updated.
29- /// </summary>
30- public static string CheckBumpMap = $@ "fn checkBumpMap = (
31- local babylonAttName = ""Babylon Attributes""
32- for v=1 to sme.GetNumViews() do
33- (
34- viewNode = sme.GetView(v)
35- for i=1 to viewNode.GetNumNodes() do
36- (
37- n = viewNode.GetNode i;
38- if(classof n.reference == Normal_Bump ) then
39- (
40- nbump = n.reference
41- if(hasBabylonCustomAttribute nbump babylonAttName == false ) then
42- (
43- { BumpMapCAtDef }
44- custAttributes.add nbump BUMP_MAP_CAT_DEF
45- )
46- )
47- )
48- )
49- )" ;
29+ public static string CheckBumpMap = $@ "fn checkBumpMap map = (
30+ local babylonAttName = ""Babylon Attributes""
31+ if(map != undefined) then
32+ (
33+ if( classof map == Normal_Bump ) then
34+ (
35+ if( hasBabylonCustomAttribute map babylonAttName == false) then
36+ (
37+ { BumpMapCAtDef }
38+ custAttributes.add map BUMP_MAP_CAT_DEF
39+ ))))" ;
5040
51- /// There is NO WAY to get an even on BumpMap creation into the Slate editor. Only Material creation is triggered.
52- /// This is the reason we listen for parameters Material change
5341 private static string AddPhysicalBabylonUI =
5442 $@ "if ( hasBabylonCustomAttribute maxMaterial ""Babylon Attributes"" == false) then (
55- { PhysicalBabylonCAtDef }
43+ { PhysicalBabylonCAtDef }
5644 custAttributes.add maxMaterial PHYSICAL_MATERIAL_CAT_DEF
57- when parameters maxMaterial change do checkBumpMap()
5845 )" ;
5946
6047 public static string AddCallback => $@ "addMaterialCallbackScript = ""maxMaterial = callbacks.notificationParam();
0 commit comments