Skip to content

Commit

Permalink
#5567: Basic setup for testing the frob-highlights
Browse files Browse the repository at this point in the history
  • Loading branch information
codereader committed Apr 2, 2021
1 parent 77a1d50 commit f2b17e6
Show file tree
Hide file tree
Showing 6 changed files with 160 additions and 9 deletions.
89 changes: 84 additions & 5 deletions install/ui/materialeditor.fbp
Expand Up @@ -2252,14 +2252,21 @@
<property name="orient">wxHORIZONTAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="border">0</property>
<property name="flag">wxALIGN_CENTER_VERTICAL</property>
<property name="proportion">1</property>
<object class="wxBoxSizer" expanded="1">
<object class="wxFlexGridSizer" expanded="1">
<property name="cols">3</property>
<property name="flexible_direction">wxBOTH</property>
<property name="growablecols">2</property>
<property name="growablerows"></property>
<property name="hgap">6</property>
<property name="minimum_size"></property>
<property name="name">bSizer8911</property>
<property name="orient">wxHORIZONTAL</property>
<property name="name">fgSizer22</property>
<property name="non_flexible_grow_mode">wxFLEX_GROWMODE_SPECIFIED</property>
<property name="permission">none</property>
<property name="rows">0</property>
<property name="vgap">6</property>
<object class="sizeritem" expanded="1">
<property name="border">0</property>
<property name="flag">wxALIGN_CENTER_VERTICAL</property>
Expand Down Expand Up @@ -2333,7 +2340,7 @@
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">6</property>
<property name="border">0</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxButton" expanded="1">
Expand Down Expand Up @@ -2404,6 +2411,78 @@
<property name="window_style"></property>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">0</property>
<property name="flag">wxALIGN_RIGHT</property>
<property name="proportion">0</property>
<object class="wxButton" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="bitmap"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="current"></property>
<property name="default">0</property>
<property name="default_pane">0</property>
<property name="disabled"></property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="focus"></property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Test</property>
<property name="margins"></property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">BasicTestFrobStages</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="position"></property>
<property name="pressed"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass">; ; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip">Enable the frob highlight as long as the mouse button is held down</property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
</object>
</object>
</object>
</object>
</object>
Expand Down
25 changes: 21 additions & 4 deletions install/ui/materialeditor.xrc
Expand Up @@ -434,9 +434,14 @@
<object class="sizeritem">
<option>1</option>
<flag>wxALIGN_CENTER_VERTICAL</flag>
<border>5</border>
<object class="wxBoxSizer">
<orient>wxHORIZONTAL</orient>
<border>0</border>
<object class="wxFlexGridSizer">
<rows>0</rows>
<cols>3</cols>
<vgap>6</vgap>
<hgap>6</hgap>
<growablecols>2</growablecols>
<growablerows></growablerows>
<object class="sizeritem">
<option>0</option>
<flag>wxALIGN_CENTER_VERTICAL</flag>
Expand All @@ -451,14 +456,26 @@
<object class="sizeritem">
<option>0</option>
<flag>wxALIGN_CENTER_VERTICAL|wxLEFT</flag>
<border>6</border>
<border>0</border>
<object class="wxButton" name="BasicRemoveFrobStages">
<label>Remove</label>
<default>0</default>
<markup>0</markup>
<bitmap />
</object>
</object>
<object class="sizeritem">
<option>0</option>
<flag>wxALIGN_RIGHT</flag>
<border>0</border>
<object class="wxButton" name="BasicTestFrobStages">
<tooltip>Enable the frob highlight as long as the mouse button is held down</tooltip>
<label>Test</label>
<default>0</default>
<markup>0</markup>
<bitmap />
</object>
</object>
</object>
</object>
</object>
Expand Down
39 changes: 39 additions & 0 deletions radiant/ui/materials/editor/MaterialEditor.cpp
Expand Up @@ -413,6 +413,16 @@ void MaterialEditor::setupBasicMaterialPage()

auto specularTabImage = getControl<wxStaticBitmap>("BasicSpecularTabImage");
replaceControl(specularTabImage, new TexturePreview(specularTabImage->GetParent(), TexturePreview::ImageType::Specular));

auto addFrob = getControl<wxButton>("BasicAddFrobStages");
auto removeFrob = getControl<wxButton>("BasicRemoveFrobStages");
auto testFrob = getControl<wxButton>("BasicTestFrobStages");

addFrob->Bind(wxEVT_BUTTON, &MaterialEditor::_onBasicAddFrobStages, this);
removeFrob->Bind(wxEVT_BUTTON, &MaterialEditor::_onBasicRemoveFrobStages, this);

testFrob->Bind(wxEVT_LEFT_DOWN, &MaterialEditor::_onBasicTestFrobStages, this);
testFrob->Bind(wxEVT_LEFT_UP, &MaterialEditor::_onBasicTestFrobStages, this);
}

void MaterialEditor::setupMaterialProperties()
Expand Down Expand Up @@ -1616,6 +1626,9 @@ void MaterialEditor::updateBasicFrobStageControls()

addFrob->Enable(materialCanBeModified && !hasFrobStages);
removeFrob->Enable(materialCanBeModified && hasFrobStages);

auto testFrob = getControl<wxButton>("BasicTestFrobStages");
testFrob->Enable(materialCanBeModified && hasFrobStages);
}

void MaterialEditor::updateBasicImagePreview()
Expand Down Expand Up @@ -2573,4 +2586,30 @@ void MaterialEditor::convertTextCtrlToMapExpressionEntry(const std::string& ctrl
replaceControl(oldCtrl, new MapExpressionEntry(oldCtrl->GetParent(), windowToPlaceDialogsOn));
}

void MaterialEditor::_onBasicAddFrobStages(wxCommandEvent& ev)
{
if (!_material || !GlobalMaterialManager().materialCanBeModified(_material->getName()))
{
return;
}

// TODO
}

void MaterialEditor::_onBasicRemoveFrobStages(wxCommandEvent& ev)
{
if (!_material || !GlobalMaterialManager().materialCanBeModified(_material->getName()))
{
return;
}

// TODO
}

void MaterialEditor::_onBasicTestFrobStages(wxMouseEvent& ev)
{
_preview->enableFrobHighlight(ev.ButtonDown());
ev.Skip();
}

}
3 changes: 3 additions & 0 deletions radiant/ui/materials/editor/MaterialEditor.h
Expand Up @@ -182,6 +182,9 @@ class MaterialEditor :
void _onDuplicateStage(wxCommandEvent& ev);
void _onSortRequestChanged(wxCommandEvent& ev);
void _onBasicMapEntryChanged(const std::string& entryName, IShaderLayer::Type type);
void _onBasicAddFrobStages(wxCommandEvent& ev);
void _onBasicRemoveFrobStages(wxCommandEvent& ev);
void _onBasicTestFrobStages(wxMouseEvent& ev);

void toggleSelectedStage();
void onMaterialChanged();
Expand Down

0 comments on commit f2b17e6

Please sign in to comment.