*/}}
Przeglądaj źródła

Material add fix

YimingWu 3 miesięcy temu
rodzic
commit
e7843cb3f2
1 zmienionych plików z 4 dodań i 4 usunięć
  1. 4 4
      resources/la_modelling.c

+ 4 - 4
resources/la_modelling.c

@@ -1928,8 +1928,9 @@ int OPINV_RemoveRootObject(laOperator *a, laEvent *e){
 }
 
 int OPINV_NewMaterial(laOperator *a, laEvent *e){
-    tnsMaterial* mat=tnsCreateMaterial("Material"); laNotifyUsers("tns.world.materials");
-    if(!a->This && a->This->EndInstance) return;
+    tnsMaterial* mat=tnsCreateMaterial("Material"); laRecordDifferences(0,"tns.world.materials");
+    laDetachedTrySet("material",mat); laNotifyUsers("tns.world.materials");
+    if(!a->This || !a->This->EndInstance){ laPushDifferences("New material",0); return; }
     laPropContainer* pc=la_EnsureSubTarget(a->This->LastPs->p,a->This->EndInstance);
     if(pc==TNS_PC_OBJECT_MESH){
         tnsMeshObject* mo=a->This->EndInstance; if(mo->CurrentMaterial){
@@ -1944,8 +1945,7 @@ int OPINV_NewMaterial(laOperator *a, laEvent *e){
             laRecordInstanceDifferences(so,"tns_shape_object"); laNotifyInstanceUsers(so);
         }
     }
-    laDetachedTrySet("material",mat);
-    laRecordDifferences(0,"tns.world.materials"); laPushDifferences("New material",0);
+    laPushDifferences("New material",0);
     return LA_FINISHED;
 }
 int OPCHK_RemoveMaterial(laPropPack *This, laStringSplitor *ss){