I would like to use a mouseCallback with a numeric box control. The callback function is listed as a property in PROPS_NUMERIC_BOX, but I can't get it to work.
Infact the only control I can get a mouseCallback to work with is a bitmap. Since I can get it to work with that, I feel I do understand how it should work.
Does the api documentation imply mouseCallbacks work with a bunch of controls that actually don't support this. Code below.
Thanks for your help.
Mark
-- Hookup the callbacks with all the GUI elements
btnFileOpen:updateProperties { callback = guiCallback }
chkDiffuseMaterial:updateProperties { callback = guiCallback }
chkGlossyMaterial:updateProperties { callback = guiCallback }
chkSpecularMaterial:updateProperties { callback = guiCallback }
chkMetallicMaterial:updateProperties { callback = guiCallback }
btnProcessFile:updateProperties { callback = guiCallback }
btnTint:updateProperties { callback = guiCallback }
clsTintColorPicker:updateProperties { callback = guiCallback }
btnTintOk:updateProperties { callback = guiCallback }
btnTintApply:updateProperties { callback = guiCallback }
btnTintCancel:updateProperties { callback = guiCallback }
nbxSpecularRadius:updateProperties { callback = guiCallback }
nbxNormalAmount:updateProperties { callback = guiCallback }
--nbxDisplacementContrast:updateProperties { callback = guiCallback }
--nbxSpecularBrightness:updateProperties { callback = guiCallback }
btnReplacePixel:updateProperties { callback = guiCallback, mouseCallback = mouseCallback }
btnHelp:updateProperties { callback = guiCallback }
btnHelpClose:updateProperties { callback = guiCallback }
btnMainClose:updateProperties { callback = guiCallback }
nbxDisplacementContrast:updateProperties {mouseCallback = mouseCallback }
nbxSpecularBrightness:updateProperties {mouseCallback = mouseCallback }
picDisplacementMap:updateProperties {mouseCallback = mouseCallback }
btnReplacePixel:updateProperties {mouseCallback = mouseCallback }
-- The mouseCallback function, bitmaps work, all others don't
function mouseCallback(component, event)
--print("@mouseCallback", component, event)
if component == nbxDisplacementContrast then
print("@nbxDisplacementContrast mouse events")
if event == octane.gui.eventType.MOUSE_UP or event == octane.gui.eventType.MOUSE_DRAG then
print(" Component, Event =", component, event)
octane.gui.dispatchGuiEvents(400)
setDisplacementMapContrast(nbxDisplacementContrast.value)
end
elseif component == nbxSpecularBrightness then
print("@nbxSpecularBrightness mouse events")
if event == octane.gui.eventType.MOUSE_UP or event == octane.gui.eventType.MOUSE_DRAG then
print(" Component, Event =", component, event)
octane.gui.dispatchGuiEvents(400)
setSpecularMapBrightness(nbxSpecularBrightness.value)
end
elseif component == btnReplacePixel then
print("@btnReplacePixel mouse events")
if event == octane.gui.eventType.MOUSE_DOWN then --or event == octane.gui.eventType.MOUSE_DRAG then
print(" Button Mouse Down")
--Get the pixel color
octane.gui.dispatchGuiEvents(400)
--setSpecularMapBrightness(nbxSpecularBrightness.value)
end
if event == octane.gui.eventType.MOUSE_UP then --or event == octane.gui.eventType.MOUSE_DRAG then
print(" Button Mouse Up")
--Get the pixel color
octane.gui.dispatchGuiEvents(400)
--setSpecularMapBrightness(nbxSpecularBrightness.value)
end
elseif component == picDisplacementMap then
--print("@picDisplacementMap mouse events")
if event == octane.gui.eventType.MOUSE_DOWN then --or event == octane.gui.eventType.MOUSE_DRAG then
print(" Mouse Down")
--Get the pixel color
octane.gui.dispatchGuiEvents(400)
--setDisplacementContrast(nbxDisplacementContrast.value)
end
if event == octane.gui.eventType.MOUSE_UP then --or event == octane.gui.eventType.MOUSE_DRAG then
print(" Mouse Up")
--Get the pixel color
octane.gui.dispatchGuiEvents(400)
--setSpecularMapBrightness(nbxSpecularBrightness.value)
end
end
end