improve Surface Inspector consistency
was showing shader of last selected brush, texdef of 1st now shows properties of single primitive at 1st tries to show last selected primitive to be responsible to selection prefers brushes over patches as general rule
This commit is contained in:
parent
0f2ad6378d
commit
0678e842b2
|
|
@ -908,6 +908,21 @@ void Scene_BrushGetTexdef_Selected( scene::Graph& graph, TextureProjection& proj
|
|||
Scene_ForEachSelectedBrush_ForEachFace( graph, FaceGetTexdef( projection ) );
|
||||
}
|
||||
|
||||
bool Scene_BrushGetShaderTexdef_Selected( scene::Graph& graph, CopiedString& shader, TextureProjection& projection ){
|
||||
BrushInstance *brush = nullptr;
|
||||
if ( GlobalSelectionSystem().countSelected() == 0
|
||||
|| !( brush = Instance_getBrush( GlobalSelectionSystem().ultimateSelected() ) ) ) {
|
||||
Scene_forEachSelectedBrush( [&brush]( BrushInstance& b ){ if( !brush ) brush = &b; } );
|
||||
}
|
||||
if( brush && !brush->getBrush().empty() ){
|
||||
Face *face = brush->getBrush().begin()->get();
|
||||
shader = face->GetShader();
|
||||
face->GetTexdef( projection );
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void Scene_BrushGetTexdef_Component_Selected( scene::Graph& graph, TextureProjection& projection ){
|
||||
#if 1
|
||||
if ( !g_SelectedFaceInstances.empty() ) {
|
||||
|
|
|
|||
|
|
@ -51,6 +51,7 @@ void Scene_BrushSetTexdef_Component_Selected( scene::Graph& graph, const Texture
|
|||
void Scene_BrushSetTexdef_Selected( scene::Graph& graph, const float* hShift, const float* vShift, const float* hScale, const float* vScale, const float* rotation );
|
||||
void Scene_BrushSetTexdef_Component_Selected( scene::Graph& graph, const float* hShift, const float* vShift, const float* hScale, const float* vScale, const float* rotation );
|
||||
void Scene_BrushGetTexdef_Selected( scene::Graph& graph, TextureProjection& projection );
|
||||
bool Scene_BrushGetShaderTexdef_Selected( scene::Graph& graph, CopiedString& shader, TextureProjection& projection );
|
||||
void Scene_BrushGetTexdef_Component_Selected( scene::Graph& graph, TextureProjection& projection );
|
||||
void Scene_BrushSetFlags_Selected( scene::Graph& graph, const ContentsFlagsValue& flags );
|
||||
void Scene_BrushSetFlags_Component_Selected( scene::Graph& graph, const ContentsFlagsValue& flags );
|
||||
|
|
|
|||
|
|
@ -1133,6 +1133,20 @@ void Scene_PatchGetTexdef_Selected( scene::Graph& graph, TextureProjection &proj
|
|||
}
|
||||
}
|
||||
|
||||
bool Scene_PatchGetShaderTexdef_Selected( scene::Graph& graph, CopiedString& name, TextureProjection &projection ){
|
||||
Patch* patch = nullptr;
|
||||
if ( !( patch = Scene_GetUltimateSelectedVisiblePatch() ) )
|
||||
Scene_forEachSelectedPatch( [&patch]( PatchInstance& p ){ if( !patch ) patch = &p.getPatch(); } );
|
||||
if( patch ){
|
||||
name = patch->GetShader();
|
||||
PatchTexdefConstructor c( patch );
|
||||
if( c.valid() )
|
||||
projection.m_brushprimit_texdef = c.m_bp;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void Patch_SetTexdef( const float* hShift, const float* vShift, const float* hScale, const float* vScale, const float* rotation ){
|
||||
Scene_forEachVisibleSelectedPatch( [hShift, vShift, hScale, vScale, rotation]( Patch& patch ){
|
||||
PatchTexdefConstructor c( &patch );
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@ void Scene_PatchFindReplaceShader( scene::Graph& graph, const char* find, const
|
|||
void Scene_PatchFindReplaceShader_Selected( scene::Graph& graph, const char* find, const char* replace );
|
||||
|
||||
void Scene_PatchGetTexdef_Selected( scene::Graph& graph, class TextureProjection &projection );
|
||||
bool Scene_PatchGetShaderTexdef_Selected( scene::Graph& graph, CopiedString& name, TextureProjection &projection );
|
||||
void Patch_SetTexdef( const float* hShift, const float* vShift, const float* hScale, const float* vScale, const float* rotation );
|
||||
|
||||
void Scene_PatchCapTexture_Selected( scene::Graph& graph );
|
||||
|
|
|
|||
|
|
@ -251,7 +251,7 @@ void SurfaceInspector_SetCurrent_FromSelected(){
|
|||
|
||||
CopiedString name;
|
||||
Scene_BrushGetShader_Component_Selected( GlobalSceneGraph(), name );
|
||||
if ( string_not_empty( name.c_str() ) ) {
|
||||
if ( !name.empty() ) {
|
||||
SurfaceInspector_SetSelectedShader( name.c_str() );
|
||||
}
|
||||
|
||||
|
|
@ -263,18 +263,12 @@ void SurfaceInspector_SetCurrent_FromSelected(){
|
|||
{
|
||||
TextureProjection projection;
|
||||
CopiedString name;
|
||||
Scene_BrushGetShader_Selected( GlobalSceneGraph(), name );
|
||||
if ( string_empty( name.c_str() ) ) {
|
||||
s_patch_mode = true;
|
||||
Scene_PatchGetShader_Selected( GlobalSceneGraph(), name );
|
||||
Scene_PatchGetTexdef_Selected( GlobalSceneGraph(), projection );
|
||||
}
|
||||
else{
|
||||
s_patch_mode = false;
|
||||
Scene_BrushGetTexdef_Selected( GlobalSceneGraph(), projection );
|
||||
}
|
||||
s_patch_mode = false;
|
||||
if( !Scene_BrushGetShaderTexdef_Selected( GlobalSceneGraph(), name, projection ) )
|
||||
if( Scene_PatchGetShaderTexdef_Selected( GlobalSceneGraph(), name, projection ) )
|
||||
s_patch_mode = true;
|
||||
SurfaceInspector_SetSelectedTexdef( projection );
|
||||
if ( string_not_empty( name.c_str() ) ) {
|
||||
if ( !name.empty() ) {
|
||||
SurfaceInspector_SetSelectedShader( name.c_str() );
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user