Entraides et échanges autour de la technologie Scol - Informations and exchanges on the Scol technology
Vous pouvez changer la langue de l'interface une fois inscrit - You can change the language once registered
You are not logged in.
colleagues:
I have modified the mainwindow plugit to create a new window and black object container as children of DMSwin, and I have encountered this:
in the 0s3d editor, i set window size to 600 width and 600 height
with the mainwindow plugit, I set the window width to 600 width and 200 height
in the os3d editor I enable the sky environment
I modified the mainwindow plugit to make the DMSwin 600 pixels wide and 600 high, and created a window and objectcontainer as children of DMSwin.
When I run the scene from a published scol file, the resulting play window is 600 pixels wide and 200 high, not 600x600 that I set the DMSwin to. Also, the 3d buffer (scene..in this case a sky rendering) appears behind the objectcontainer area if I resize the window to make it more than 600 pixels high.
So it seems like my code is not adjusting the size of DMSwin for some reason, or I don't understand what structure is the parent of the 3d buffer
Here is the cmainwindow.pkg modified code:
fun newOb(inst)=
// test if we are in editor then we stop the play mode
if (_test_exist "stopEditorFromPlugin") then
(
0;
)
else
(
let atoi (getPluginInstanceParam inst "width") -> width in
let if width == nil then 800 else width -> width in
let atoi (getPluginInstanceParam inst "height") -> height in
let if height == nil then 600 else height -> height in
let atoi (getPluginInstanceParam inst "desksize") -> desksize in
let if desksize == nil then 0 else desksize -> desksize in
let atoi (getPluginInstanceParam inst "resize") -> resize in
let if resize == nil then 1 else resize -> resize in
let atoi (getPluginInstanceParam inst "border") -> border in
let if border == nil then 1 else border -> border in
let atoi (getPluginInstanceParam inst "caption") -> caption in
let if caption == nil then 1 else caption -> caption in
let atoi (getPluginInstanceParam inst "catchClose") -> catchClose in
let if catchClose == nil then 0 else catchClose -> catchClose in
let (getPluginInstanceParam inst "title") -> title in
let _GETdesktopSize -> [sw sh] in
let WN_MENU|WN_SIZEBOX -> style in
(
if (border) then nil else
set style = style | WN_NOBORDER;
if (caption) then nil else
set style = style | WN_NOCAPTION;
if (resize) then nil else
set style = style & ~(WN_SIZEBOX);
if (!catchClose) then nil else
_CBwinClose mainWindow.EDW_win @cbWinClose inst;
_SETwindowStyle mainWindow.EDW_win style;
if ((title == nil) || ((strlen title) == 0)) then nil else
_SETwindowName mainWindow.EDW_win title;
if (!desksize) then
(
_SIZEwindowEx mainWindow.EDW_win width height ((sw / 2) - (width / 2)) ((sh / 2) - (height / 2));
_SETwindowMaxSize DMSwin 600 600;
_SETwindowMinSize DMSwin 600 600;
let _CRwindow _channel DMSwin 0 450 600 150 WN_CHILDINSIDE "A window"-> parentwindow in
_CRcontainerFromObjWin _channel parentwindow 0 0 600 150 CO_CHILDINSIDE 0x000000 "hackerwindow";
//return 0 close then brace
0;
)
else
(
//big hack to get the correct windows size with no border
_SIZEwindowEx mainWindow.EDW_win 800 600 0 0;
let _GETwindowPositionSize mainWindow.EDW_win -> [nx ny nw nh] in
let [(0 - nx) (0 - ny) (800 - nw) (600 - nh)] -> [nx ny nw nh] in
let _GETscreenSize -> [ssw ssh] in
_SIZEwindowEx mainWindow.EDW_win (ssw + nw) (ssh + nh) nx ny;
0;
);
PluginRegisterAction inst "Get focus" @cbGetFocus;
PluginRegisterAction inst "Show" @cbShow;
PluginRegisterAction inst "Hide" @cbHide;
PluginRegisterAction inst "Set title" @cbTitle;
);
0;
);
set globalInstance = inst;
setPluginInstanceCbDel inst @deleteOb;
_DMSevent this (getPluginInstanceEvent inst "Started") nil nil;
0;;
thx for your help.
Offline
mainWindow and DMSWin are the same ^^
this is just a variable for alias
I see.
So is there a structure that is a parent of these aliases that I cannot get a handle to?
I assume there must be one as there is in the editor as you have all sorts of windows that are not on top of the 3d buffer.
Offline
there is no parent
mainWindow / DMSwin is the first window.the 3D buffer is a chlid window of this one
thx....How would I access the 3d buffer to make it smaller than its parent?
Offline
let V3DgetSessionView c3dXsession -> viewstr in
(
V3DresizeView viewstr viewstr.V3D_iWinX viewstr.V3D_iWinY viewstr.V3D_iWinW viewstr.V3D_iWinH / 2;
let _CRwindow _channel DMSwin 0 (viewstr.V3D_iWinH / 2) viewstr.V3D_iWinW(viewstr.V3D_iWinH / 2) WN_CHILDINSIDE window_name_value -> thischildwindow in
....
);
Is this what you are referring to?
Last edited by hebdemnobad (9-Oct-2014 00:20:59)
Offline
yes this resize the 3D buffer on the main window
bu you will also have to reset the resize callback to avoid the 3D to get the full parent size on resize
Offline
yes this resize the 3D buffer on the main window
bu you will also have to reset the resize callback to avoid the 3D to get the full parent size on resize
Thx arkeon last night I looked through v3dlib.pkg and now understand a bit better the v3dview struct. Where can I find an example of the 3d buffer resize callback?
Offline
Ok this is where I have gotten, but I assume since I am not defining a callback all my resize commands won't work..any input appreciated, thx. At this point I'm a bit blind as to where to put the callback and which field(s) of the 3dview struct I should be altering:
fun newOb(inst)=
// test if we are in editor then we stop the play mode
if (_test_exist "stopEditorFromPlugin") then
(
0;
)
else
(
let atoi (getPluginInstanceParam inst "width") -> width in
let if width == nil then 800 else width -> width in
let atoi (getPluginInstanceParam inst "height") -> height in
let if height == nil then 600 else height -> height in
let atoi (getPluginInstanceParam inst "desksize") -> desksize in
let if desksize == nil then 0 else desksize -> desksize in
let atoi (getPluginInstanceParam inst "resize") -> resize in
let if resize == nil then 1 else resize -> resize in
let atoi (getPluginInstanceParam inst "border") -> border in
let if border == nil then 1 else border -> border in
let atoi (getPluginInstanceParam inst "caption") -> caption in
let if caption == nil then 1 else caption -> caption in
let atoi (getPluginInstanceParam inst "catchClose") -> catchClose in
let if catchClose == nil then 0 else catchClose -> catchClose in
let (getPluginInstanceParam inst "title") -> title in
let _GETdesktopSize -> [sw sh] in
let WN_MENU|WN_SIZEBOX -> style in
(
if (border) then nil else
set style = style | WN_NOBORDER;
if (caption) then nil else
set style = style | WN_NOCAPTION;
if (resize) then nil else
set style = style & ~(WN_SIZEBOX);
if (!catchClose) then nil else
_CBwinClose mainWindow.EDW_win @cbWinClose inst;
_SETwindowStyle mainWindow.EDW_win style;
if ((title == nil) || ((strlen title) == 0)) then nil else
_SETwindowName mainWindow.EDW_win title;
if (!desksize) then
(
_SIZEwindowEx mainWindow.EDW_win 800 800 200 200;
_SETwindowMaxSize mainWindow.EDW_win 800 800;
_SETwindowMinSize mainWindow.EDW_win 600 800;
let _CRwindow _channel DMSwin 0 450 600 150 WN_CHILDINSIDE "A window"-> parentwindow in
let _CRcontainerFromObjWin _channel parentwindow 0 0 600 150 CO_CHILDINSIDE 0x000000 "hackerwindow" -> twodguicontainer in
//openlet brace
(
_PAINTcontainer twodguicontainer;
//close let brace
);
//get 3dview struct for scene
let V3DgetSessionView c3dXsession -> viewstr in
(
//make v3dview 600 pixels wide and 450 high so it leaves room for non3d window and container this doesn't seem to work
V3DresizeView viewstr 0 0 800 450;
//try resetting 3dbuffer size
SO3BufferSetProperties viewstr.V3D_buffer 800 450 0;
//close let brace
);
//return 0 close then brace
0;
)
else
(
//big hack to get the correct windows size with no border
_SIZEwindowEx mainWindow.EDW_win 800 600 0 0;
let _GETwindowPositionSize mainWindow.EDW_win -> [nx ny nw nh] in
let [(0 - nx) (0 - ny) (800 - nw) (600 - nh)] -> [nx ny nw nh] in
let _GETscreenSize -> [ssw ssh] in
_SIZEwindowEx mainWindow.EDW_win (ssw + nw) (ssh + nh) nx ny;
0;
);
PluginRegisterAction inst "Get focus" @cbGetFocus;
PluginRegisterAction inst "Show" @cbShow;
PluginRegisterAction inst "Hide" @cbHide;
PluginRegisterAction inst "Set title" @cbTitle;
);
0;
);
set globalInstance = inst;
setPluginInstanceCbDel inst @deleteOb;
_DMSevent this (getPluginInstanceEvent inst "Started") nil nil;
0;;
I notice a few things:
1. the os3d player is not embedded in the web page. What line(s) of code are making this happen. This is what I am aiming for, but I'd like to know what is causing the detaching from the hosting page
2. as you point out arkeon, when I resize the window, the buffer doesn't resize. It grows to include the whole parent window
3. the object container I create (it's a black box in the child window) only gets rendered if I resize the parent window.
here is the scene:
http://ifam.net/hybridgui/web/index.html
thx for your input!
Last edited by hebdemnobad (9-Oct-2014 14:41:01)
Offline
Yay ...I think I got to resize the buffer correctly so it remains the same size and doesn't fill up dmswin on resizing. This is great, as it means I can make a free standing app without a web browser that uses os3d and other scol ui elements.
There is still the issue of not being able to embed the scene in a web page...the scol window only appears within the space in the window allotted to the scol player. I don't really mind this as I want to make a free standing app but it would be good for me to understand this. Perhaps that is the purpose of the mainwindow plugit? To make a free standing player be spawned by the browser?
and
The objectcontainer (a black box) won't render upon startup of the scene or upon resizing the main window.
But the buffer behaves itself and always remains the same size, so there is non-buffer room in the scol window.
I may not be passing the objectcontainer from the local variable that contains it to the _CBwinSize callback correctly, although the vm has no problems with my code.
here is the scene:
http://ifam.net/openspace/hybridgui2/web/index.html
here is the updated code, a bit sloppy as I don't quite know what I am doing, and when I copy and paste from bluefish it makes things look even worse.
fun newOb(inst)=
// test if we are in editor then we stop the play mode
if (_test_exist "stopEditorFromPlugin") then
(
0;
)
else
(
let atoi (getPluginInstanceParam inst "width") -> width in
let if width == nil then 800 else width -> width in
let atoi (getPluginInstanceParam inst "height") -> height in
let if height == nil then 600 else height -> height in
let atoi (getPluginInstanceParam inst "desksize") -> desksize in
let if desksize == nil then 0 else desksize -> desksize in
let atoi (getPluginInstanceParam inst "resize") -> resize in
let if resize == nil then 1 else resize -> resize in
let atoi (getPluginInstanceParam inst "border") -> border in
let if border == nil then 1 else border -> border in
let atoi (getPluginInstanceParam inst "caption") -> caption in
let if caption == nil then 1 else caption -> caption in
let atoi (getPluginInstanceParam inst "catchClose") -> catchClose in
let if catchClose == nil then 0 else catchClose -> catchClose in
let (getPluginInstanceParam inst "title") -> title in
let _GETdesktopSize -> [sw sh] in
let WN_MENU|WN_SIZEBOX -> style in
(
if (border) then nil else
set style = style | WN_NOBORDER;
if (caption) then nil else
set style = style | WN_NOCAPTION;
if (resize) then nil else
set style = style & ~(WN_SIZEBOX);
if (!catchClose) then nil else
_CBwinClose mainWindow.EDW_win @cbWinClose inst;
_SETwindowStyle mainWindow.EDW_win style;
if ((title == nil) || ((strlen title) == 0)) then nil else
_SETwindowName mainWindow.EDW_win title;
if (!desksize) then
(
_SIZEwindowEx mainWindow.EDW_win 800 600 200 200;
//_SETwindowMaxSize mainWindow.EDW_win 800 800;
//_SETwindowMinSize mainWindow.EDW_win 800 600;
let _CRwindow _channel DMSwin 0 450 600 150 WN_CHILDINSIDE "A window"-> parentwindow in
let _CRcontainerFromObjWin _channel parentwindow 0 0 600 150 CO_CHILDINSIDE 0x000000 "hackerwindow" -> twodguicontainer in
//openlet brace
(
_PAINTcontainer twodguicontainer;
_CBwinSize DMSwin @resize_buffer twodguicontainer;
//close let brace
);
//get 3dview struct for scene
let V3DgetSessionView c3dXsession -> viewstr in
(
//make v3dview 600 pixels wide and 450 high so it leaves room for non3d window and container this doesn't seem to work
V3DresizeView viewstr 0 0 800 450;
//try resetting 3dbuffer size
SO3BufferSetProperties viewstr.V3D_buffer 800 450 0;
//define window resize callback to resize buffer
//close let brace
);
//return 0 close then brace
0;
)
else
(
//big hack to get the correct windows size with no border
_SIZEwindowEx mainWindow.EDW_win 800 600 0 0;
let _GETwindowPositionSize mainWindow.EDW_win -> [nx ny nw nh] in
let [(0 - nx) (0 - ny) (800 - nw) (600 - nh)] -> [nx ny nw nh] in
let _GETscreenSize -> [ssw ssh] in
_SIZEwindowEx mainWindow.EDW_win (ssw + nw) (ssh + nh) nx ny;
0;
);
PluginRegisterAction inst "Get focus" @cbGetFocus;
PluginRegisterAction inst "Show" @cbShow;
PluginRegisterAction inst "Hide" @cbHide;
PluginRegisterAction inst "Set title" @cbTitle;
);
0;
);
set globalInstance = inst;
setPluginInstanceCbDel inst @deleteOb;
_DMSevent this (getPluginInstanceEvent inst "Started") nil nil;
0;;
Last edited by hebdemnobad (9-Oct-2014 16:09:10)
Offline
comment _SETwindowStyle
and it should work, you must set something wrong in style param.
thx arkeon! the player doesn't spawn a window, so I know what code makes that window get spawned. But the black object container still doesn't render on my laptop gpu....there is just a white field:
http://ifam.net/openspace/hybridui2/web/index.html
here is the complete plugit code:
/*
-----------------------------------------------------------------------------
This source file is part of OpenSpace3D
For the latest info, see http://www.openspace3d.com
Copyright (c) 2012 I-maginer
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License as published by the Free Software
Foundation; either version 2 of the License, or (at your option) any later
version.
This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along with
this program; if not, write to the Free Software Foundation, Inc., 59 Temple
Place - Suite 330, Boston, MA 02111-1307, USA, or go to
http://www.gnu.org/copyleft/lesser.txt
-----------------------------------------------------------------------------
*/
typeof globalInstance = PInstance;;
fun deleteOb(inst)=
0;;
fun cbGetFocus(inst, from, action, param, rep)=
let (V3DgetSessionView c3dXsession) -> viewstr in
V3DviewSetFocus viewstr;
0;;
fun cbShow(inst, from, action, param, rep)=
_SHOWwindow mainWindow.EDW_win WINDOW_UNHIDDEN;
0;;
fun cbHide(inst, from, action, param, rep)=
_SHOWwindow mainWindow.EDW_win WINDOW_HIDDEN;
0;;
fun cbTitle(inst, from, action, param, rep)=
if ((param == nil) || ((strlen param) == 0)) then nil else
_SETwindowName mainWindow.EDW_win param;
0;;
fun cbWinClose(win, inst)=
_DMSevent this (getPluginInstanceEvent inst "Closed") nil nil;
0;;
fun resize_buffer(obj, user_parameter, w, h) =
let V3DgetSessionView c3dXsession -> viewstr in
(
//make v3dview 600 pixels wide and 450 high so it leaves room for non3d window and container this doesn't seem to work
V3DresizeView viewstr 0 0 800 450;
//try resetting 3dbuffer size
SO3BufferSetProperties viewstr.V3D_buffer 800 450 0;
//define window resize callback to resize buffer
_PAINTcontainer user_parameter;
//close let brace
);
0;;
fun newOb(inst)=
// test if we are in editor then we stop the play mode
if (_test_exist "stopEditorFromPlugin") then
(
0;
)
else
(
let atoi (getPluginInstanceParam inst "width") -> width in
let if width == nil then 800 else width -> width in
let atoi (getPluginInstanceParam inst "height") -> height in
let if height == nil then 600 else height -> height in
let atoi (getPluginInstanceParam inst "desksize") -> desksize in
let if desksize == nil then 0 else desksize -> desksize in
let atoi (getPluginInstanceParam inst "resize") -> resize in
let if resize == nil then 1 else resize -> resize in
let atoi (getPluginInstanceParam inst "border") -> border in
let if border == nil then 1 else border -> border in
let atoi (getPluginInstanceParam inst "caption") -> caption in
let if caption == nil then 1 else caption -> caption in
let atoi (getPluginInstanceParam inst "catchClose") -> catchClose in
let if catchClose == nil then 0 else catchClose -> catchClose in
let (getPluginInstanceParam inst "title") -> title in
let _GETdesktopSize -> [sw sh] in
let WN_MENU|WN_SIZEBOX -> style in
(
if (border) then nil else
set style = style | WN_NOBORDER;
if (caption) then nil else
set style = style | WN_NOCAPTION;
if (resize) then nil else
set style = style & ~(WN_SIZEBOX);
if (!catchClose) then nil else
_CBwinClose mainWindow.EDW_win @cbWinClose inst;
//_SETwindowStyle mainWindow.EDW_win style;
if ((title == nil) || ((strlen title) == 0)) then nil else
_SETwindowName mainWindow.EDW_win title;
if (!desksize) then
(
//_SIZEwindowEx mainWindow.EDW_win 800 600 200 200;
//_SETwindowMaxSize mainWindow.EDW_win 800 800;
//_SETwindowMinSize mainWindow.EDW_win 800 600;
let _CRwindow _channel DMSwin 0 450 600 150 WN_CHILDINSIDE "A window"-> parentwindow in
let _CRcontainerFromObjWin _channel parentwindow 0 0 600 150 CO_CHILDINSIDE 0x000000 "hackerwindow" -> twodguicontainer in
//openlet brace
(
_PAINTcontainer twodguicontainer;
_CBwinSize DMSwin @resize_buffer twodguicontainer;
//close let brace
);
//get 3dview struct for scene
let V3DgetSessionView c3dXsession -> viewstr in
(
//make v3dview 600 pixels wide and 450 high so it leaves room for non3d window and container this doesn't seem to work
V3DresizeView viewstr 0 0 800 450;
//try resetting 3dbuffer size
SO3BufferSetProperties viewstr.V3D_buffer 800 450 0;
//define window resize callback to resize buffer
//close let brace
);
//return 0 close then brace
0;
)
else
(
//big hack to get the correct windows size with no border
_SIZEwindowEx mainWindow.EDW_win 800 600 0 0;
let _GETwindowPositionSize mainWindow.EDW_win -> [nx ny nw nh] in
let [(0 - nx) (0 - ny) (800 - nw) (600 - nh)] -> [nx ny nw nh] in
let _GETscreenSize -> [ssw ssh] in
_SIZEwindowEx mainWindow.EDW_win (ssw + nw) (ssh + nh) nx ny;
0;
);
PluginRegisterAction inst "Get focus" @cbGetFocus;
PluginRegisterAction inst "Show" @cbShow;
PluginRegisterAction inst "Hide" @cbHide;
PluginRegisterAction inst "Set title" @cbTitle;
);
0;
);
set globalInstance = inst;
setPluginInstanceCbDel inst @deleteOb;
_DMSevent this (getPluginInstanceEvent inst "Started") nil nil;
0;;
fun IniPlug(file)=
PlugRegister @newOb nil;
setPluginEditor @dynamicedit;
0;;
thx for your help!
-h
Offline
See the resize_buffer and newOb functions. Perhaps I'm not using or passing the container object using
_CBwinSize DMSwin @resize_buffer twodguicontainer;
(to resize_buffer)
correctly?
fun resize_buffer(obj, user_parameter, w, h) =
let V3DgetSessionView c3dXsession -> viewstr in
(
//make v3dview 600 pixels wide and 450 high so it leaves room for non3d window and container this doesn't seem to work
V3DresizeView viewstr 0 0 800 450;
//try resetting 3dbuffer size
SO3BufferSetProperties viewstr.V3D_buffer 800 450 0;
//is this line below not working?
_PAINTcontainer user_parameter;
//close let brace
);
0;;
Last edited by hebdemnobad (9-Oct-2014 19:46:42)
Offline
check coordinates of _CRcontainerFromObjWin it all wrong
Thx! I'll fix that.
Offline
I don't see anything wrong with_CRcontainerFromObjWin...its 0 pixels down from parentwindow and parentwindow is 450 pixels down from dmswin. The buffer is only 450 pixels high, so the container isn't covered by it.
When I resize dmswin, I see the black container flicker as I am resizing, but the black container disappears when I release the resize handle.
Yes I may be missing something obvious...I often do.
Last edited by hebdemnobad (10-Oct-2014 02:25:40)
Offline
here is a screen capture video, showing that the black container flickers on and off when resizing the parent window, and dissappears when i let go of the resize handles....the buffer doesn't want to share the screen with the container, and vice versa.
http://www.ifam.net/openspace/hybriduibug/flicker2.avi
Last edited by hebdemnobad (10-Oct-2014 03:44:09)
Offline
your container position on creation was 0 0
here an example which should work
fun cbResizeMainGui(winstr, w, h, cont) =
let V3DgetSessionView c3dXsession -> viewstr in
(
//make v3dview 600 pixels wide and 450 high so it leaves room for non3d window and container this doesn't seem to work
V3DresizeView viewstr 0 0 w (h - 150);
_SIZEcontainer cont 0 (h - 150) w 150;
_PAINTcontainer cont;
);
0;;
// ...plugIT start
//get 3dview struct for scene
let V3DgetSessionView c3dXsession -> viewstr in
// mainWindow.EDW_win == DMSwin so we prefer use the mainWindow edWindow structure to do not break things
let _GETwindowPositionSize DMSwin -> [dmsx dmsy dmsw dmsh] in
(
//reduce v3dview of 150 px on height
V3DresizeView viewstr 0 0 dmsw (dmsh - 150);
let _CRcontainerFromObjWin _channel mainWindow.EDW_win 0 (dmsh - 150) dmsw 150 CO_CHILDINSIDE 0x000000 "hackerwindow" -> twodguicontainer in
(
_PAINTcontainer twodguicontainer;
//define resize callback
setEdwindowCbSize mainWindow mkfun4 @cbResizeMainGui twodguicontainer;
);
);
Offline
Thx!!!!
I will try that. But im curious as to why doesn't the container at 0 0 work if it's created from a window at 0 450 which is in turn a child of dmswin?
And
Is the editor one window with many child containers, or does it contain multiple windows?
Offline
Offline
it's a lot more complicated in the editor and I think the 3D buffer parent window is not exposed to plugIts.
I see.
Offline
see link for thank you message:
http://ifam.net/openspace/hybridui3/web/index.html
and thanks for your patience....I guess what I am aiming for is an modified version of the player (along the lines of proprietary online 3d players that have come and gone) , and this is the first step towards that.
Last edited by hebdemnobad (10-Oct-2014 14:57:36)
Offline
hehe you're welcome
I could just add the 3D buffer parent window in a global variable for editor, but you should restore the initial setup on plugIT stop.
Offline