Your browser does not seem to support JavaScript. As a result, your viewing experience will be diminished, and you have been placed in read-only mode.
Please download a browser that supports JavaScript, or enable it if it's disabled (i.e. NoScript).
Hello !
My little dialog with CUSTOMGUI_HTMLVIEWER will black down and didn,t work anymore when mouse click anywhere out of the dialog, did I do something wrong?
CUSTOMGUI_HTMLVIEWER
Here is the worked onr and black one . The black one even cann;t close with the dialog button . only can close in windows toolbar. And I don't know how to solve
import c4d defpage = "https://www.baidu.com" class Dialog(c4d.gui.GeDialog): def __init__(self): self.AddGadget(c4d.DIALOG_NOMENUBAR, 0) def CreateLayout(self): self.SetTitle("Web Browser") self.GroupBegin(0, c4d.BFH_SCALEFIT, 0, 1) self.GroupBorderSpace(2, 2, 2, 0) self.AddEditText(1001, c4d.BFH_SCALEFIT) self.GroupEnd() self.b = self.AddCustomGui(1000, c4d.CUSTOMGUI_HTMLVIEWER, "", c4d.BFH_SCALEFIT | c4d.BFV_SCALEFIT, 200, 200) return True def InitValues(self): self.SetString(1001, defpage) self.Command(1, None) return True def Command(self, wid, bc): if wid == c4d.DLG_OK: # Enter pressed url = self.GetString(1001) self.b.SetUrl(url, c4d.URL_ENCODING_UTF16) return True dlg = Dialog() dlg.Open(c4d.DLG_TYPE_ASYNC)
Thanks
Hello @dunhou,
Thank you for reaching out to us and giving a clear description of your problem. I understand perfectly what your problem is but cannot reproduce it on my machine. I have tried R25.113, S26.107, as well as the upcoming RC and all of them do not exhibit the behavior of turning black and effectively freezing the dialog when clicking outside of the bounds of the dialog.
R25.113
S26.107
However, I noticed that when the HTML is loading/parsing a page, it renders itself as black. Which for example happens when you open the dialog, and a page is being loaded for the first time.
So, to solve your problem, we need a bit more context information, because the HTML gadget relies on your system browser and its caches/settings.
⊞ Win
Enter
I have also reached out to the developer of the browser integration to see if he has an idea what could be going wrong there.
Cheers, Ferdinand
@ferdinand
Thanks , here is my destop windows version , I have lastest win 11 in my home . Maybe I could test afterwork. And I test this on S26.107
About logged in Baidu , I think I did not . It's just a test url wo start with , I want to build a C4D info search tool, like search a Subdivision Surface in sdk or just Wiki it within c4d and I can dock the tab .
Subdivision Surface
So when I start the code , it runs , and I click out the dialog or input another url , It would black down and did not work anymore . And I cann't edit it anymore , even the url link box .(Like C4D Help do:Ctrl+F1 )
Ctrl+F1
Internet connection seems all right , I test Baidu translator API , It works well and return the translation in C4D . But I don't know how browser caches works, I use Edge , and test url in Chorme as well . they all works.
When loading , it renders itself as black. I didn't notice this happened , maybe my internet near to Baidu , that I cann't notice that (as I said I have no knowledge about Internet).
If any context information I have miss , plz let me know .
Thank you for the updated information. So, I spoke with the developer and did some digging.
First of all, I provided some slightly outdated information. Since the reimplementation of the HTML browser, it does not share the cache with the system default browser anymore, and there are now also two Browser types which can kick in, depending on your environment:
Chromium
EdgeHtml
The cache of our HTML gadget is stored under \{user}\AppData\Roaming\MAXON\{c4d version}\EBWebView. You can also force Cinema 4D to use the old engine by passing the startup augment -g_forceedge=false, e.g., C:\Program Files\Maxon\S26_107>"Cinema 4D.exe" -g_forceedge=false. When running Cinema 4D you can distinguish the internally used HTML engine easily by their context menu.
\{user}\AppData\Roaming\MAXON\{c4d version}\EBWebView
-g_forceedge=false
C:\Program Files\Maxon\S26_107>"Cinema 4D.exe" -g_forceedge=false
The context menu of the HTML gadget in the Quickstart dialog of S26.107 running in legacy browser mode with "Cinema 4D.exe" -g_forceedge=false
"Cinema 4D.exe" -g_forceedge=false
The context menu of the HTML gadget in the Quickstart dialog of S26.107 running in default browser mode with "Cinema 4D.exe", i.e., "Cinema 4D.exe" -g_forceedge=true
"Cinema 4D.exe"
"Cinema 4D.exe" -g_forceedge=true
HWND
GeDaialog.Open
I have provided below a conformant CommandData bound solution, could you please check if the issue is reproducible with this variant? When this does not fix your problem, could please also check the following:
CommandData
-g_forceedge=true
I will at least update the Python docs to indicate more clearly in c4d.gui.HtmlViewerCustomGui that this gadget is not supported in asynchronous dangling dialogs opened in the Script Manager.
The code:
"""Provides a simple example for a browser control in a dialog hosted by a CommandData plugin. The important caveats are here: 1. CUSTOMGUI_HTMLVIEWER only supports asynchronous dialogs. 2. Which by extension means that CUSTOMGUI_HTMLVIEWER is not supported in Script Manager scripts. You must save this file as a pyp plugin file in your plugin folder of choice. """ import c4d class HtmlDialog(c4d.gui.GeDialog): """A dialog with the HTML gadget in it. """ URL_DEFAULT: str = r"https://www.baidu.com" ID_GDT_URLBAR: int = 1000 ID_GDT_BROWSER: int = 1001 def CreateLayout(self): """Called by Cinema 4D to populate the dialog with gadgets. """ self.SetTitle("Web Browser") self.GroupBegin(0, c4d.BFH_SCALEFIT | c4d.BFV_SCALEFIT, 1) self.GroupSpace(5, 5) self.GroupBorderSpace(5, 5, 5, 5) self.AddEditText(HtmlDialog.ID_GDT_URLBAR, c4d.BFH_SCALEFIT) self.htmlView = self.AddCustomGui(HtmlDialog.ID_GDT_BROWSER, c4d.CUSTOMGUI_HTMLVIEWER, "", c4d.BFH_SCALEFIT | c4d.BFV_SCALEFIT, 200, 200, c4d.BaseContainer()) if not isinstance(self.htmlView, c4d.gui.BaseCustomGui): return False self.GroupEnd() return True def InitValues(self): """Init the dialog values after CreateLayout(). """ self.SetString(HtmlDialog.ID_GDT_URLBAR, HtmlDialog.URL_DEFAULT) self.htmlView.SetUrl(HtmlDialog.URL_DEFAULT, c4d.URL_ENCODING_UTF16) return True def Command(self, wid, bc): """React to input events in the dialog. """ if wid == c4d.DLG_OK: # Enter pressed url: str = self.GetString(HtmlDialog.ID_GDT_URLBAR) if url is not None: self.htmlView.SetUrl(url, c4d.URL_ENCODING_UTF16) return True class HtmlDialogCommand(c4d.plugins.CommandData): """Opens the HTML gadget dialog. """ ID_PLUGIN: int = 1060020 def __init__(self) -> None: """Initialize the dialog property of the command. """ self._dialog = None @property def Dialog (self) -> HtmlDialog: """Returns the dialog of the command instance. """ if self._dialog is None: self._dialog = HtmlDialog() return self._dialog def Execute(self, doc: c4d.documents.BaseDocument) -> bool: """Opens the HTML dialog of the command. """ self.Dialog.Open(c4d.DLG_TYPE_ASYNC, HtmlDialogCommand.ID_PLUGIN, defaultw=500, defaulth=500) return True def RestoreLayout(self, secret: object) -> bool: """Restores the HTML dialog on layout changes. """ return self.Dialog.Restore(HtmlDialogCommand.ID_PLUGIN, secret) if __name__ == '__main__': c4d.plugins.RegisterCommandPlugin( id=HtmlDialogCommand.ID_PLUGIN, str="PC14180 (GeDialog HTML gadget)", info=c4d.PLUGINFLAG_SMALLNODE, icon=None, help="PC14180", dat=HtmlDialogCommand())
Thanks for your explain .
The code you procvde work fine and the black not show again .
The old one is also use EdgeHtml viewer . Maybe render black in scripts manager is as a not support way as you mentioned?
Finnally, here is the contrast result .
Hey @dunhou,
thanks for your reply and the overview.
I am not quite sure that you consider this solved. Is the problem solved for you now or do you need further assistance?
@ferdinand Thnaks for your help, I think it is enough for this specific toppic . It work as espected