int get_mask(FILE *stream, int n, int size) { uint nexttag; Chunk_hdr nxt; Mapping *m = loadmtl->map[n]; if (m==NULL) { m = NewMapping(n,0); if (m==NULL) { MtlError(); return(0); } loadmtl->map[n] = m; } m->use = 1; while(size) { if(get_next_chunk(stream,&nxt)==0) return(0); nexttag = nxt.tag; #ifdef DBGLDMLI if (dbgldmli) printf(" get_MASK loop: nexttag = %X \n",nexttag); #endif if (!get_mapdata_chunk(stream,nexttag,&m->mask)) return(0); size-=nxt.size; } return(1); }
int get_map(FILE *stream, int n, int size) { uint nexttag; Chunk_hdr nxt; Mapping *m = loadmtl->map[n]; #ifdef DBGLDMLI if (dbgldmli) printf(" GET_MAP: n = %d\n",n); #endif if (m==NULL) { m = NewMapping(n,0); if (m==NULL) { MtlError(); return(0); } loadmtl->map[n] = m; } m->use = 1; while(size) { if(get_next_chunk(stream,&nxt)==0) return(0); nexttag = nxt.tag; switch(nexttag) { case INT_PERCENTAGE: case FLOAT_PERCENTAGE: if(get_mtlchunk(stream,NULL)==0) return(0); m->amt.pct = ipct; if (n==Nbump) m->amt.pct = (ipct<=20)?4*ipct:100; /* for old files */ #ifdef DBGLDMLI if (dbgldmli) printf(" get_map %d : pct: %d \n",n,ipct); #endif break; case MAT_BUMP_PERCENT: if(get_mtlchunk(stream,NULL)==0) return(0); m->amt.pct = ipct; /* for version 3+ files */ break; default: if (!get_mapdata_chunk(stream,nexttag,&m->map)) { #ifdef DBGLDMLI if (dbgldmli) printf(" Error in get_mapdata_chunk, nexttag = %X\n",nexttag); #endif MtlError(); return(0); } break; } size-=nxt.size; } #ifdef DBGLDMLI if (dbgldmli) printf(" EXIT GET_MAP: n = %d\n",n); #endif return(1); }
void FAxisMappingsNodeBuilder::AddAxisMappingToGroupButton_OnClick(const FMappingSet MappingSet) { const FScopedTransaction Transaction(LOCTEXT("AddAxisMappingToGroup_Transaction", "Add Axis Mapping To Group")); TArray<UObject*> OuterObjects; AxisMappingsPropertyHandle->GetOuterObjects(OuterObjects); if (OuterObjects.Num() == 1) { UInputSettings* InputSettings = CastChecked<UInputSettings>(OuterObjects[0]); InputSettings->Modify(); AxisMappingsPropertyHandle->NotifyPreChange(); FInputAxisKeyMapping NewMapping(MappingSet.SharedName); InputSettings->AxisMappings.Add(NewMapping); AxisMappingsPropertyHandle->NotifyPostChange(); } }
void FActionMappingsNodeBuilder::AddActionMappingToGroupButton_OnClick(const FMappingSet MappingSet) { const FScopedTransaction Transaction(LOCTEXT("AddActionMappingToGroup_Transaction", "Add Action Mapping To Group")); TArray<UObject*> OuterObjects; ActionMappingsPropertyHandle->GetOuterObjects(OuterObjects); if (OuterObjects.Num() == 1) { UInputSettings* InputSettings = CastChecked<UInputSettings>(OuterObjects[0]); InputSettings->Modify(); ActionMappingsPropertyHandle->NotifyPreChange(); DelayedGroupExpansionStates.Add(TPairInitializer<FName, bool>(MappingSet.SharedName, true)); FInputActionKeyMapping NewMapping(MappingSet.SharedName); InputSettings->ActionMappings.Add(NewMapping); ActionMappingsPropertyHandle->NotifyPostChange(); } }
void FAxisMappingsNodeBuilder::AddAxisMappingButton_OnClick() { static const FName BaseAxisMappingName(*LOCTEXT("NewAxisMappingName", "NewAxisMapping").ToString()); static int32 NewMappingCount = 0; const FScopedTransaction Transaction(LOCTEXT("AddAxisMapping_Transaction", "Add Axis Mapping")); TArray<UObject*> OuterObjects; AxisMappingsPropertyHandle->GetOuterObjects(OuterObjects); if (OuterObjects.Num() == 1) { UInputSettings* InputSettings = CastChecked<UInputSettings>(OuterObjects[0]); InputSettings->Modify(); AxisMappingsPropertyHandle->NotifyPreChange(); FName NewAxisMappingName; bool bFoundUniqueName; do { // Create a numbered name and check whether it's already been used NewAxisMappingName = FName(BaseAxisMappingName, ++NewMappingCount); bFoundUniqueName = true; for (int32 Index = 0; Index < InputSettings->AxisMappings.Num(); ++Index) { if (InputSettings->AxisMappings[Index].AxisName == NewAxisMappingName) { bFoundUniqueName = false; break; } } } while (!bFoundUniqueName); DelayedGroupExpansionStates.Add(TPairInitializer<FName, bool>(NewAxisMappingName, true)); FInputAxisKeyMapping NewMapping(NewAxisMappingName); InputSettings->AxisMappings.Add(NewMapping); AxisMappingsPropertyHandle->NotifyPostChange(); } }
int get_sxp_data(FILE *stream, int n, int size, int isMask) { ULONG **pp,*ptr; Mapping *m = loadmtl->map[n]; #ifdef DBGLDMLI if (dbgldmli) printf("GET_SXP_DATA: n=%d, size = %d, isMask = %d, m=%X\n", n,size,isMask,m); #endif if (size==0) return(1); if (m==NULL) { m = NewMapping(n,0); if (m==NULL) { MtlError(); return(0); } loadmtl->map[n] = m; } if (isMask) pp = (ULONG **)&m->mask.p.tex.sxp_data; else pp = (ULONG **)&m->map.p.tex.sxp_data; if (*pp!=NULL) XMFreeAndZero((void **)pp); ptr = (ULONG *)XMAlloc(size+4); if (ptr==NULL) { MtlError(); return(0); } ptr[0] = size; #ifdef DBGLDMLI if (dbgldmli) printf(" sxp_data: addr = %X, size = %X\n", ptr, ptr[0]); #endif RDERR(&ptr[1],size); *pp = ptr; return(1); }