本文整理汇总了C++中ABrush类的典型用法代码示例。如果您正苦于以下问题:C++ ABrush类的具体用法?C++ ABrush怎么用?C++ ABrush使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ABrush类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetFromSource
void FEdModeGeometry::PostUndo()
{
// Rebuild the geometry data from the current brush state
GetFromSource();
// Restore selection information.
for( int32 o = 0 ; o < GeomObjects.Num() ; ++o )
{
int32 Idx = 0;
FGeomObject* go = GeomObjects[o];
ABrush* Actor = go->GetActualBrush();
// First, clear the current selection
go->SelectNone();
// Next, restore the cached selection
int32 res = go->SetPivotFromSelectionArray( Actor->SavedSelections );
//use the centre of the actor if we didnt find a suitable selection
if( res == INDEX_NONE )
{
FEditorModeTools& Tools = GEditorModeTools();
Tools.SetPivotLocation( Actor->GetActorLocation() , false );
}
go->ForceLastSelectionIndex( res );
}
}
示例2: AlignSurf
void UTexAlignerDefault::AlignSurf( ETexAlign InTexAlignType, UModel* InModel, FBspSurfIdx* InSurfIdx, FPoly* InPoly, FVector* InNormal )
{
InPoly->Base = InPoly->Vertices[0];
InPoly->TextureU = FVector::ZeroVector;
InPoly->TextureV = FVector::ZeroVector;
InPoly->Finalize( NULL, 0 );
InPoly->TextureU *= UTile;
InPoly->TextureV *= VTile;
ABrush* Actor = InSurfIdx->Surf->Actor;
const FVector PrePivot = Actor->GetPivotOffset();
const FVector Location = Actor->GetActorLocation();
const FRotator Rotation = Actor->GetActorRotation();
const FVector Scale = Actor->GetActorScale();
const FRotationMatrix RotMatrix(Rotation);
FVector Base = RotMatrix.TransformVector((InPoly->Base - PrePivot) * Scale) + Location;
FVector TextureU = RotMatrix.TransformVector(InPoly->TextureU / Scale);
FVector TextureV = RotMatrix.TransformVector(InPoly->TextureV / Scale);
InSurfIdx->Surf->pBase = FBSPOps::bspAddPoint(InModel, &Base, 0);
InSurfIdx->Surf->vTextureU = FBSPOps::bspAddVector( InModel, &TextureU, 0);
InSurfIdx->Surf->vTextureV = FBSPOps::bspAddVector( InModel, &TextureV, 0);
}
示例3:
void UEditorEngine::polyUpdateMaster
(
UModel* Model,
int32 iSurf,
int32 UpdateTexCoords
)
{
FBspSurf &Surf = Model->Surfs[iSurf];
ABrush* Actor = Surf.Actor;
if( !Actor )
return;
UModel* Brush = Actor->Brush;
check(Brush);
FVector ActorLocation;
FVector ActorPrePivot;
FVector ActorScale;
FRotator ActorRotation;
if (Brush->bCachedOwnerTransformValid)
{
// Use transform cached when the geometry was last built, in case the current Actor transform has changed since then
// (e.g. because Auto Update BSP is disabled)
ActorLocation = Brush->OwnerLocationWhenLastBuilt;
ActorPrePivot = Brush->OwnerPrepivotWhenLastBuilt;
ActorScale = Brush->OwnerScaleWhenLastBuilt;
ActorRotation = -Brush->OwnerRotationWhenLastBuilt;
}
else
{
// No cached owner transform, so use the current one
ActorLocation = Actor->GetActorLocation();
ActorPrePivot = Actor->GetPrePivot();
ActorScale = Actor->GetActorScale();
ActorRotation = -Actor->GetActorRotation();
}
for( int32 iEdPoly = Surf.iBrushPoly; iEdPoly < Brush->Polys->Element.Num(); iEdPoly++ )
{
FPoly& MasterEdPoly = Brush->Polys->Element[iEdPoly];
if( iEdPoly==Surf.iBrushPoly || MasterEdPoly.iLink==Surf.iBrushPoly )
{
MasterEdPoly.Material = Surf.Material;
MasterEdPoly.PolyFlags = Surf.PolyFlags & ~(PF_NoEdit);
if( UpdateTexCoords )
{
MasterEdPoly.Base = ActorRotation.RotateVector(Model->Points[Surf.pBase] - ActorLocation) / ActorScale + ActorPrePivot;
MasterEdPoly.TextureU = ActorRotation.RotateVector(Model->Vectors[Surf.vTextureU]) * ActorScale;
MasterEdPoly.TextureV = ActorRotation.RotateVector(Model->Vectors[Surf.vTextureV]) * ActorScale;
}
}
}
Model->InvalidSurfaces = true;
}
示例4: GLevelEditorModeTools
void UEditorEngine::mapBrushPut()
{
TArray<FEdMode*> ActiveModes;
GLevelEditorModeTools().GetActiveModes( ActiveModes );
for ( FSelectionIterator It( GEditor->GetSelectedActorIterator() ) ; It ; ++It )
{
AActor* Actor = static_cast<AActor*>( *It );
checkSlow( Actor->IsA(AActor::StaticClass()) );
ABrush* BrushActor = Cast< ABrush >( Actor );
if( BrushActor && !FActorEditorUtils::IsABuilderBrush(Actor) )
{
check( BrushActor->GetWorld() );
ABrush* WorldBrush = BrushActor->GetWorld()->GetDefaultBrush();
check( WorldBrush );
BrushActor->Modify();
BrushActor->Brush->Polys->Element = WorldBrush->Brush->Polys->Element;
BrushActor->CopyPosRotScaleFrom( WorldBrush );
BrushActor->SetNeedRebuild(BrushActor->GetLevel());
WorldBrush->ReregisterAllComponents();
for( int32 ModeIndex = 0; ModeIndex < ActiveModes.Num(); ++ModeIndex )
{
ActiveModes[ModeIndex]->UpdateInternalData();
}
}
}
}
示例5: check
/**
* Adds a brush to the list of CSG brushes in the level, using a CSG operation.
*
* @return A newly-created copy of the brush.
*/
ABrush* FBSPOps::csgAddOperation( ABrush* Actor, uint32 PolyFlags, EBrushType BrushType)
{
check(Actor);
check(Actor->BrushComponent);
check(Actor->Brush);
check(Actor->Brush->Polys);
check(Actor->GetWorld());
// Can't do this if brush has no polys.
if( !Actor->Brush->Polys->Element.Num() )
return NULL;
// Spawn a new actor for the brush.
ABrush* Result = Actor->GetWorld()->SpawnBrush();
Result->SetNotForClientOrServer();
// Duplicate the brush.
csgCopyBrush
(
Result,
Actor,
PolyFlags,
RF_Transactional,
0,
true
);
check(Result->Brush);
if( Result->GetBrushBuilder() )
{
Result->SetActorLabel( FText::Format( NSLOCTEXT("BSPBrushOps", "BrushName", "{0} Brush"), FText::FromString( Result->GetBrushBuilder()->GetClass()->GetDescription() ) ).ToString() );
}
// Assign the default material to the brush's polys.
for( int32 i=0; i<Result->Brush->Polys->Element.Num(); i++ )
{
FPoly& CurrentPoly = Result->Brush->Polys->Element[i];
if ( !CurrentPoly.Material )
{
CurrentPoly.Material = UMaterial::GetDefaultMaterial(MD_Surface);
}
}
// Set add-info.
Result->BrushType = BrushType;
Result->ReregisterAllComponents();
return Result;
}
示例6: MapSetBrush
void UEditorEngine::MapSetBrush( UWorld* InWorld, EMapSetBrushFlags PropertiesMask, uint16 BrushColor, FName GroupName, uint32 SetPolyFlags, uint32 ClearPolyFlags, uint32 BrushType, int32 DrawType )
{
// Fire ULevel::LevelDirtiedEvent when falling out of scope.
FScopedLevelDirtied LevelDirtyCallback;
for( FStaticBrushIterator It(InWorld); It; ++It )
{
ABrush* Brush = CastChecked<ABrush>(*It);
if( !FActorEditorUtils::IsABuilderBrush(Brush) && Brush->IsSelected() )
{
if( PropertiesMask & MSB_PolyFlags )
{
Brush->Modify();
Brush->PolyFlags = (Brush->PolyFlags & ~ClearPolyFlags) | SetPolyFlags;
Brush->UpdateComponentTransforms();
Brush->MarkPackageDirty();
LevelDirtyCallback.Request();
}
if( PropertiesMask & MSB_BrushType )
{
Brush->Modify();
Brush->BrushType = EBrushType(BrushType);
Brush->UpdateComponentTransforms();
Brush->MarkPackageDirty();
LevelDirtyCallback.Request();
}
}
}
}
示例7: GetWidgetLocation
FVector FEdModeTexture::GetWidgetLocation() const
{
for ( TSelectedSurfaceIterator<> It(GetWorld()) ; It ; ++It )
{
FBspSurf* Surf = *It;
ABrush* BrushActor = ( ABrush* )Surf->Actor;
if( BrushActor )
{
FPoly* poly = &BrushActor->Brush->Polys->Element[ Surf->iBrushPoly ];
return BrushActor->ActorToWorld().TransformPosition( poly->GetMidPoint() );
}
}
return FEdMode::GetWidgetLocation();
}
示例8: GetBrush
void ACanvasSkia::_SetPaint_Fill()
{
ABrush* br = GetBrush();
m_Paint.setStyle(SkPaint::kFill_Style);
if( br->GetType() == BrushTypeSolidColor )
{
ASolidBrush* sb = (ASolidBrush *)br;
m_Paint.setColor(toSkColor(sb->GetColor()));
}
else if( br->GetType() == BrushTypeLinearGradient )
{
SkPoint pts[2];
ALinearGradientBrush* lgb = (ALinearGradientBrush*)br;
SkRect rx = ToSkRect( lgb->GetRect() );
pts[0].set( rx.fLeft,rx.fTop );
if( lgb->IsVert() ) pts[1].set( rx.fLeft,rx.fBottom );
else pts[1].set( rx.fRight,rx.fTop );
SkColor colors[2];
colors[0] = toSkColor( lgb->GetStartColor() );
colors[1] = toSkColor( lgb->GetEndColor() );
SkScalar pos[2];
pos[0] = SkScalar(0.0);
pos[1] = SkScalar(1.0);
SkShader* pShader = SkGradientShader::CreateLinear(pts,colors,pos,2,SkShader::kClamp_TileMode);
m_Paint.setShader(pShader)->unref();
}
else if( br->GetType() == BrushTypeRadialGradient )
{
ARadialBrush* rb = (ARadialBrush*)br;
SkPoint ptCenter;
APoint ptCenter0 = rb->GetCenter();
ptCenter.set( SkIntToScalar(ptCenter0.x),SkIntToScalar(ptCenter0.y) );
SkScalar nRadius = SkIntToScalar( rb->GetRadius() );
SkColor colors[2];
colors[0] = toSkColor( rb->GetStartColor() );
colors[1] = toSkColor( rb->GetEndColor() );
SkScalar pos[2];
pos[0] = SkScalar(0.0);
pos[1] = SkScalar(1.0);
SkShader* pShader = SkGradientShader::CreateRadial(ptCenter,nRadius,colors,pos,2,SkShader::kClamp_TileMode);
m_Paint.setShader(pShader)->unref();
}
}
示例9: while
/**
* Iterates to next suitable actor.
*/
void operator++()
{
bool FoundSuitableActor = false;
while( !ReachedEnd && !FoundSuitableActor )
{
if( ++ActorIndex >= World->GetCurrentLevel()->Actors.Num() )
{
ReachedEnd = true;
}
else
{
//@todo locked levels - should we skip brushes contained by locked levels?
ABrush* Brush = Cast<ABrush>(World->GetCurrentLevel()->Actors[ActorIndex]);
FoundSuitableActor = Brush && Brush->IsStaticBrush();
}
}
}
示例10: checkSlow
void UEditorEngine::MapBrushGet(UWorld* InWorld)
{
for ( FSelectionIterator It( GEditor->GetSelectedActorIterator() ) ; It ; ++It )
{
AActor* Actor = static_cast<AActor*>( *It );
checkSlow( Actor->IsA(AActor::StaticClass()) );
ABrush* BrushActor = Cast< ABrush >( Actor );
if( BrushActor && !FActorEditorUtils::IsABuilderBrush(Actor) )
{
check( BrushActor->GetWorld() );
ABrush* WorldBrush = BrushActor->GetWorld()->GetDefaultBrush();
check( WorldBrush );
WorldBrush->Modify();
WorldBrush->Brush->Polys->Element = BrushActor->Brush->Polys->Element;
WorldBrush->CopyPosRotScaleFrom( BrushActor );
WorldBrush->ReregisterAllComponents();
break;
}
}
GEditor->SelectNone( false, true );
GEditor->SelectActor(InWorld->GetDefaultBrush(), true, true);
}
示例11: EndModify
bool FModeTool_GeometryModify::EndModify()
{
// Let the modifier finish up.
if( CurrentModifier != NULL )
{
FEdModeGeometry* mode = ((FEdModeGeometry*)GEditorModeTools().GetActiveMode(FBuiltinEditorModes::EM_Geometry));
// Update the source data to match the current geometry data.
mode->SendToSource();
// Make sure the source data has remained viable.
if( mode->FinalizeSourceData() )
{
// If the source data was modified, reconstruct the geometry data to reflect that.
mode->GetFromSource();
}
CurrentModifier->EndModify();
// Update internals.
for( FEdModeGeometry::TGeomObjectIterator Itor( mode->GeomObjectItor() ) ; Itor ; ++Itor )
{
FGeomObject* go = *Itor;
go->ComputeData();
FBSPOps::bspUnlinkPolys( go->GetActualBrush()->Brush );
// If geometry was actually changed, call PostEditBrush
if(bGeomModified)
{
ABrush* Brush = go->GetActualBrush();
if(Brush)
{
if(!Brush->IsStaticBrush())
{
FBSPOps::csgPrepMovingBrush(Brush);
}
}
bGeomModified = false;
}
}
}
return 1;
}
示例12: IsABuilderBrush
bool IsABuilderBrush( const AActor* InActor )
{
bool bIsBuilder = false;
#if WITH_EDITOR
if ( InActor && InActor->GetWorld() && !InActor->HasAnyFlags(RF_ClassDefaultObject) )
{
ULevel* ActorLevel = InActor->GetLevel();
if ((ActorLevel != nullptr) && (ActorLevel->Actors.Num() >= 2))
{
// If the builder brush exists then it will be the 2nd actor in the actors array.
ABrush* BuilderBrush = Cast<ABrush>(ActorLevel->Actors[1]);
// If the second actor is not a brush then it certainly cannot be the builder brush.
if ((BuilderBrush != nullptr) && (BuilderBrush->GetBrushComponent() != nullptr) && (BuilderBrush->Brush != nullptr))
{
bIsBuilder = (BuilderBrush == InActor);
}
}
}
#endif
return bIsBuilder;
}
示例13: check
bool FEdModeGeometry::GetCustomDrawingCoordinateSystem( FMatrix& InMatrix, void* InData )
{
if( GetSelectionState() == GSS_None )
{
return 0;
}
if( InData )
{
FGeomBase* GeomBase = static_cast<FGeomBase*>(InData);
FGeomObjectPtr GeomObject = GeomBase->GetParentObject();
check(GeomObject.IsValid());
ABrush* Brush = GeomObject->GetActualBrush();
InMatrix = FRotationMatrix(GeomBase->GetNormal().Rotation()) * FQuatRotationMatrix(Brush->GetActorQuat());
}
else
{
// If we don't have a specific geometry object to get the normal from
// use the one that was last selected.
for( int32 o = 0 ; o < GeomObjects.Num() ; ++o )
{
FGeomObjectPtr go = GeomObjects[o];
go->CompileSelectionOrder();
if( go->SelectionOrder.Num() )
{
FGeomBase* GeomBase = go->SelectionOrder[go->SelectionOrder.Num() - 1];
check(GeomBase != nullptr);
FGeomObjectPtr GeomObject = GeomBase->GetParentObject();
check(GeomObject.IsValid());
ABrush* Brush = GeomObject->GetActualBrush();
InMatrix = FRotationMatrix( go->SelectionOrder[ go->SelectionOrder.Num()-1 ]->GetWidgetRotation() ) * FQuatRotationMatrix(Brush->GetActorQuat());
return 1;
}
}
}
return 0;
}
示例14: BuildSelectedActorInfo
FSelectedActorInfo BuildSelectedActorInfo( const TArray<AActor*>& SelectedActors)
{
FSelectedActorInfo ActorInfo;
if( SelectedActors.Num() > 0 )
{
// Get the class type of the first actor.
AActor* FirstActor = SelectedActors[0];
if( FirstActor && !FirstActor->HasAnyFlags( RF_ClassDefaultObject ) )
{
UClass* FirstClass = FirstActor->GetClass();
UObject* FirstArchetype = FirstActor->GetArchetype();
ActorInfo.bAllSelectedAreBrushes = Cast< ABrush >( FirstActor ) != NULL;
ActorInfo.SelectionClass = FirstClass;
// Compare all actor types with the baseline.
for ( int32 ActorIndex = 0; ActorIndex < SelectedActors.Num(); ++ActorIndex )
{
AActor* CurrentActor = SelectedActors[ ActorIndex ];
if( CurrentActor->HasAnyFlags( RF_ClassDefaultObject ) )
{
continue;
}
ABrush* Brush = Cast< ABrush >( CurrentActor );
if( !Brush)
{
ActorInfo.bAllSelectedAreBrushes = false;
}
else
{
if( !ActorInfo.bHaveBuilderBrush )
{
ActorInfo.bHaveBuilderBrush = FActorEditorUtils::IsABuilderBrush(Brush);
}
ActorInfo.bHaveBrush |= true;
ActorInfo.bHaveBSPBrush |= (!Brush->IsVolumeBrush());
ActorInfo.bHaveVolume |= Brush->IsVolumeBrush();
}
UClass* CurrentClass = CurrentActor->GetClass();
if( FirstClass != CurrentClass )
{
ActorInfo.bAllSelectedActorsOfSameType = false;
ActorInfo.SelectionClass = NULL;
FirstClass = NULL;
}
else
{
ActorInfo.SelectionClass = CurrentActor->GetClass();
}
++ActorInfo.NumSelected;
if( ActorInfo.bAllSelectedActorsBelongToCurrentLevel )
{
if( !CurrentActor->GetOuter()->IsA(ULevel::StaticClass()) || !CurrentActor->GetLevel()->IsCurrentLevel() )
{
ActorInfo.bAllSelectedActorsBelongToCurrentLevel = false;
}
}
if( ActorInfo.bAllSelectedActorsBelongToSameWorld )
{
if ( !ActorInfo.SharedWorld )
{
ActorInfo.SharedWorld = CurrentActor->GetWorld();
check(ActorInfo.SharedWorld);
}
else
{
if( ActorInfo.SharedWorld != CurrentActor->GetWorld() )
{
ActorInfo.bAllSelectedActorsBelongToCurrentLevel = false;
ActorInfo.SharedWorld = NULL;
}
}
}
// To prevent move to other level for Landscape if its components are distributed in streaming levels
if (CurrentActor->IsA(ALandscape::StaticClass()))
{
ALandscape* Landscape = CastChecked<ALandscape>(CurrentActor);
if (!Landscape || !Landscape->HasAllComponent())
{
if( !ActorInfo.bAllSelectedActorsBelongToCurrentLevel )
{
ActorInfo.bAllSelectedActorsBelongToCurrentLevel = true;
}
}
}
if ( ActorInfo.bSelectedActorsBelongToSameLevel )
{
ULevel* ActorLevel = CurrentActor->GetOuter()->IsA(ULevel::StaticClass()) ? CurrentActor->GetLevel() : NULL;
if ( !ActorInfo.SharedLevel )
{
// This is the first selected actor we've encountered.
//.........这里部分代码省略.........
示例15: ImportProperties
//.........这里部分代码省略.........
// remove extra whitespace and optional semicolon from the end of the line
{
int32 Length = StrLine.Len();
while ( Length > 0 &&
(StrLine[Length - 1] == TCHAR(';') || StrLine[Length - 1] == TCHAR(' ') || StrLine[Length - 1] == 9) )
{
Length--;
}
if (Length != StrLine.Len())
{
StrLine = StrLine.Left(Length);
}
}
if ( ContextSupplier != NULL )
{
ContextSupplier->CurrentLine += LinesConsumed;
}
if (StrLine.Len() == 0)
{
continue;
}
const TCHAR* Str = *StrLine;
int32 NewLineNumber;
if( FParse::Value( Str, TEXT("linenumber="), NewLineNumber ) )
{
if ( ContextSupplier != NULL )
{
ContextSupplier->CurrentLine = NewLineNumber;
}
}
else if( GetBEGIN(&Str,TEXT("Brush")) && ObjectStruct->IsChildOf(ABrush::StaticClass()) )
{
// If SubobjectOuter is NULL, we are importing defaults for a UScriptStruct's defaultproperties block
if ( !bSubObjectsAllowed )
{
Warn->Logf(ELogVerbosity::Error, TEXT("BEGIN BRUSH: Subobjects are not allowed in this context"));
return NULL;
}
// Parse brush on this line.
TCHAR BrushName[NAME_SIZE];
if( FParse::Value( Str, TEXT("Name="), BrushName, NAME_SIZE ) )
{
// If an initialized brush with this name already exists in the level, rename the existing one.
// It is deemed to be initialized if it has a non-zero poly count.
// If it is uninitialized, the existing object will have been created by a forward reference in the import text,
// and it will now be redefined. This relies on the behavior that NewObject<> will return an existing pointer
// if an object with the same name and outer is passed.
UModel* ExistingBrush = FindObject<UModel>( SubobjectRoot, BrushName );
if (ExistingBrush && ExistingBrush->Polys && ExistingBrush->Polys->Element.Num() > 0)
{
ExistingBrush->Rename();
}
// Create model.
UModelFactory* ModelFactory = NewObject<UModelFactory>();
ModelFactory->FactoryCreateText( UModel::StaticClass(), SubobjectRoot, FName(BrushName, FNAME_Add, true), RF_NoFlags, NULL, TEXT("t3d"), SourceText, SourceText+FCString::Strlen(SourceText), Warn );
ImportedBrush = 1;
}
}
else if (GetBEGIN(&Str, TEXT("Foliage")))
{
UFoliageType* SourceFoliageType;