*/}}
Ver Fonte

Instance skipping when saving

YimingWu há 1 ano atrás
pai
commit
01155f534f

+ 1 - 1
la_animation.c

@@ -655,7 +655,7 @@ void la_RegisterAnimationResources(){
     pc = laDefineOperatorProps(at, 0);
     p = laAddSubGroup(pc, "holder", "Holder", "Action holder to add the new action into", "la_animation_action_holder",
         0, 0, laui_IdentifierOnly, -1, laget_AnimationFirstActionHolder, 0, laget_ListNext, 0, 0, laset_AnimationNewActionSetHolder,0,0);
-    laSubGroupExtraFunctions(p,0,0,0,laget_AnimationActionHolderCategory);
+    laSubGroupExtraFunctions(p,0,0,0,0,laget_AnimationActionHolderCategory);
     at->UiDefine=laui_AnimationNewAction;
 
     at=laCreateOperatorType("LA_animation_select_action", "Select Action", "Select an action",0,0,0,OPINV_AnimationSelectAction,OPMOD_FinishOnData,U'⯆',0);

+ 5 - 2
la_data.c

@@ -1070,9 +1070,9 @@ laProp *laAddSubGroup(laPropContainer *Container, const char *Identifier, const
     return p;
 }
 
-void laSubGroupExtraFunctions(laProp* p, laSubUIFilterF* UiFilter, laSubUIThemeF* GetTheme, laSubUIGapF GetGap, laSubUICategoryF GetCategory){
+void laSubGroupExtraFunctions(laProp* p, laSubUIFilterF* UiFilter, laSubSaveFilterF* SaveFilter, laSubUIThemeF* GetTheme, laSubUIGapF GetGap, laSubUICategoryF GetCategory){
     laSubProp *sp=p;
-    sp->UiFilter=UiFilter; sp->GetTheme=GetTheme; sp->GetGap=GetGap; sp->GetCategory=GetCategory;
+    sp->UiFilter=UiFilter; sp->SaveFilter=SaveFilter; sp->GetTheme=GetTheme; sp->GetGap=GetGap; sp->GetCategory=GetCategory;
 }
 void laSubGroupDetachable(laProp *SubProp, laSubTypeDetachedGet DetachedGet, laSubTypeDetachedGetNext DetachedGetNext){
     laSubProp *sp = SubProp;
@@ -2807,6 +2807,9 @@ int la_WriteProp(laUDF *udf, laPropPack *pp, int FromThis, int UseInstanceList){
             }
 
             while (inst){
+                if(((laSubProp*)p)->SaveFilter && (!((laSubProp*)p)->SaveFilter(pp->LastPs->UseInstance, inst))){
+                    inst = laGetNextInstance(p, inst, &pi); pp->EndInstance = inst; continue;
+                }
                 laPropContainer* pc=p->SubProp; int need_type=0;
                 if (((laSubProp*)p)->GetType){ pc=((laSubProp*)p)->GetType(inst); need_type=1; }
 

+ 3 - 1
la_data.h

@@ -76,6 +76,7 @@ typedef void *(*laSubTypeDetachedGet)(void *, void *);
 typedef void *(*laSubTypeDetachedGetNext)(void *, void *);
 typedef void *(*laSubGetTypeF)(void *);// inst, returns type ref.
 typedef int (*laSubUIFilterF)(void* parent, void* inst); // 1 show, 0 discard.
+typedef int (*laSubSaveFilterF)(void* parent, void* inst); // 1 save, 0 discard.
 typedef void *(*laSubUIThemeF)(void* parent, void* inst); // return a theme, MAIN.CurrentTheme can always be referenced to produce invert.
 typedef int (*laSubUIGapF)(void* parent, void* inst);
 typedef void (*laSubUICategoryF)(void* parent, void* inst, char *copy_result, char** direct_result);
@@ -382,6 +383,7 @@ STRUCTURE(laSubProp){
     laSubSetStateF SetState;
     laSubGetAmountF GetAmount;
     laSubUIFilterF UiFilter;
+    laSubSaveFilterF SaveFilter;
     laSubUIThemeF GetTheme;
     laSubUIGapF GetGap;
     laSubUICategoryF GetCategory;
@@ -901,7 +903,7 @@ laProp *laAddSubGroup(laPropContainer *Container, const char *Identifier, const
                       const char *TargetId, laGetNodeTypeFunc GetType, laWidget* DefaultWidget, laUiDefineFunc DefaultUiDef,
                       int OffsetSize, laSubGetInstanceF Get, laSubGetInstanceF GetActive, laSubGetNextF GetNext, laSubSetInstanceF Set,
                       laSubGetStateF GetState, laSubSetStateF SetState, int ListHandleOffset, u64bit Tag);
-void laSubGroupExtraFunctions(laProp* p, laSubUIFilterF* UiFilter, laSubUIThemeF* GetTheme, laSubUIGapF GetGap, laSubUICategoryF GetCategory);
+void laSubGroupExtraFunctions(laProp* p, laSubUIFilterF* UiFilter, laSubSaveFilterF* SaveFilter, laSubUIThemeF* GetTheme, laSubUIGapF GetGap, laSubUICategoryF GetCategory);
 void laSubGroupDetachable(laProp *SubProp, laSubTypeDetachedGet DetachedGet, laSubTypeDetachedGetNext DetachedGetNext);
 
 laProp *laAddOperatorProperty(laPropContainer *Container, const char *Identifier, const char *Name, const char *Description,

+ 1 - 1
resources/la_modelling.c

@@ -1255,7 +1255,7 @@ int OPINV_Add(laOperator *a, laEvent *e){
         if(ran){ laRecordAndPush(0,"tns.world","Add object",TNS_HINT_GEOMETRY); laNotifyUsers("tns.world"); }
     }else{ ad->Context=LA_ADD_CTX_MESH;
         if(strSame(str,"PLANE")){
-            tnsMMeshDeselectAll(mo); tnsAddMMeshPlane(mo, 10); tnsMMeshEnsureSelection(mo,ex->SelectMode); ran=1;
+            tnsMMeshDeselectAll(mo); tnsAddMMeshPlane(mo, 1); tnsMMeshEnsureSelection(mo,ex->SelectMode); ran=1;
         }else{ laEnableOperatorPanel(a,a->This,e->x,e->y,200,200,0,0,0,0,0,0,0,0,e); return LA_RUNNING; }
         if(ran){
             tnsMMeshRefreshIndex(mo); tnsInvalidateMeshBatch(mo); 

+ 1 - 1
resources/la_nodes_basic.c

@@ -1211,7 +1211,7 @@ void la_RegisterInputMapperOperators(){
     pc=laAddPropertyContainer("la_node_rack", "Input Rack", "Input rack for putting input mapping nodes",0,0,sizeof(laNodeRack),0,0,1);
     laAddStringProperty(pc,"name","Name","Name of this rack",0,0,0,0,1,offsetof(laNodeRack,Name),0,0,0,0,LA_AS_IDENTIFIER);
     p=laAddSubGroup(pc,"nodes","Nodes","Nodes under this rack","la_base_node",laget_BaseNodeType,0,0,-1,0,0,0,0,0,0,offsetof(laNodeRack,Nodes),0);
-    laSubGroupExtraFunctions(p,0,laget_NodeGetTheme,laget_BaseNodeGap,0);
+    laSubGroupExtraFunctions(p,0,0,laget_NodeGetTheme,laget_BaseNodeGap,0);
     laAddSubGroup(pc,"parent_page","Parent Page","Parent page of this rack","la_rack_page",0,0,0,offsetof(laNodeRack,ParentPage),0,0,0,0,0,0,0,LA_UDF_REFER);
     laAddIntProperty(pc,"type", "Type", "Type of the rack", 0,0,0,0,0,0,0,0,offsetof(laNodeRack,RackType),0,0,0,0,0,0,0,0,0,0,LA_READ_ONLY);
     laAddOperatorProperty(pc,"add_node","Add Node","Add a node into this rack","OPINV_AddNode",'+',0);

+ 1 - 1
resources/la_operators.c

@@ -2043,7 +2043,7 @@ void la_RegisterBuiltinOperators(){
                           0, 0, 0, OPINV_NewPanel, OPMOD_NewPanel, U'🞆', LA_ACTUATOR_SYSTEM);
     pc = laDefineOperatorProps(at, 0);
     p = laAddSubGroup(pc, "template", "Template", "Template selection used to create the new panel", "panel_template", 0, 0, laui_TitleOnly, -1, laget_FirstPanelTemplate, laget_NewPanelGetActiveTemplate, laget_ListNext, 0, 0, laset_NewPanelSetTemplate,0,0);
-    laSubGroupExtraFunctions(p,0,0,0,laget_PanelTemplateCategory);
+    laSubGroupExtraFunctions(p,0,0,0,0,laget_PanelTemplateCategory);
     at->UiDefine=laui_PanelTemplateSelect;
 
     laCreateOperatorType("LA_block_fold_title", "Fold Title", "Fold the tile bar of the block", 0, 0, 0, OPINV_BlockFoldTitle, 0, U'⯅', LA_ACTUATOR_SYSTEM);

+ 7 - 3
resources/la_properties.c

@@ -782,6 +782,9 @@ void tnstouched_Object(tnsObject *o, int hint){
     tnsInvalidateEvaluation(o);
     laNotifyUsers("tns.world");
 }
+int tnsfilter_SavableObject(void* unused, tnsObject* o){
+    if(o->InRoot) return 1; return 0;
+}
 
 int tnsget_MeshObjectVertSize(tnsMeshObject* o){ return o->totv*sizeof(tnsVert);/*can't use maxv*/ }
 int tnsget_MeshObjectEdgeSize(tnsMeshObject* o){ return o->tote*sizeof(tnsEdge);/*can't use maxv*/ }
@@ -976,6 +979,7 @@ void la_RegisterTNSProps(){
         laSubGroupDetachable(sp, tnsget_detached_FirstRootObject, laget_ListNext);
         laAddSubGroup(p, "active_root", "Active Root Object", "Global active root object", "tns_object",0,0,0,offsetof(tnsWorld,ActiveRoot),tnsget_detached_FirstRootObject,0,laget_ListNext,0,0,0,0,LA_UDF_REFER);
         sp = laAddSubGroup(p, "objects", "Objects", "List of all objects", "tns_object",tnsget_ObjectType, 0,0,-1,0,0,0,0,0,0,offsetof(tnsWorld, AllObjects), 0);
+        laSubGroupExtraFunctions(sp,tnsfilter_SavableObject,tnsfilter_SavableObject,0,0,0);
     }
 
     p = laAddPropertyContainer("tns_child_object", "Child Object", "Child object linker", 0,0,sizeof(laListItemPointer), 0,0,0);{
@@ -1204,7 +1208,7 @@ void la_RegisterInternalProps(){
             laAddSubGroup(p, "managed_props", "Managed Props", "Managed properties for saving", "managed_prop",0,0,0,-1, 0,0,0,0,0,0,offsetof(LA, ManagedSaveProps), LA_UDF_IGNORE|LA_READ_ONLY);
             laAddSubGroup(p, "managed_udfs", "Managed UDFs", "Managed UDFs for saving", "managed_udf", 0,0,laui_ManagedUDFOps, -1, 0,0,0,0,0,0,offsetof(LA, ManagedUDFs), LA_UDF_IGNORE|LA_READ_ONLY);
             laAddSubGroup(p, "user_preferences", "User Preference", "Kernel Settings For LA Main Structure", "la_user_preference",0,0,0,-1, laget_Main, 0,0,0,0,0,0,LA_UDF_LOCAL);
-            laSubGroupExtraFunctions(sp,0,0,0,laget_PanelTemplateCategory);
+            laSubGroupExtraFunctions(sp,0,0,0,0,laget_PanelTemplateCategory);
 
             laAddSubGroup(p, "themes", "Themes", "Themes Loded In The Program", "theme",0,0,laui_Theme, -1, 0,laget_ActiveTheme, 0,laset_ActiveTheme, 0,0,offsetof(LA,Themes), 0);
 
@@ -1213,7 +1217,7 @@ void la_RegisterInternalProps(){
             LA_PROP_CONTROLLER=sp;
 
             sp=laAddSubGroup(p, "node_categories", "Node Categories", "Node categories","la_node_category",0,0,0,offsetof(LA,CurrentNodeCategory),0,0,0,0,0,0,offsetof(LA,NodeCategories),0);
-            laSubGroupExtraFunctions(sp,lafilter_NodeCategory,0,0,0);
+            laSubGroupExtraFunctions(sp,lafilter_NodeCategory,0,0,0,0);
 
             laAddSubGroup(p, "input_mapping", "Input Mapping", "Input mapping page collection","la_input_mapping_collection",0,0,0,offsetof(LA,InputMapping),0,0,0,0,0,0,0,LA_UDF_SINGLE);
             
@@ -1629,7 +1633,7 @@ void la_RegisterInternalProps(){
 
         p = laAddPropertyContainer("la_animation", "Animation", "Animation data",0,0,sizeof(laAnimation),0,0,1);{
             sp = laAddSubGroup(p, "action_holders", "Action Holders", "All action holders","la_animation_action_holder",0,0,0,-1,0,0,0,0,0,0,offsetof(laAnimation,ActionHolders),0);
-            laSubGroupExtraFunctions(sp,0,0,0,laget_AnimationActionHolderCategory);
+            laSubGroupExtraFunctions(sp,0,0,0,0,laget_AnimationActionHolderCategory);
 
             laAddSubGroup(p, "current_action", "Current Action", "Current action","la_animation_action",0,0,0,offsetof(laAnimation,CurrentAction),0,0,0,0,0,0,0,LA_UDF_REFER|LA_READ_ONLY);