Posts by Kabkee

    I’m really excited about the new reactive programming features in Krpano—great work! 😊
    I was especially looking forward to the ondestroy event for layers and hotspots, as it seems like a great fit for addressing certain challenges.

    For example, I often create tween animations with the donecall parameter for infinite loops. However, when changing scenes, warnings like “unknown action” appear because all layers or hotspots from the previous scene are destroyed. To avoid these warnings, I’ve been adding onremovepano actions to every scene that includes tween animations.

    If the new ondestroy event could serve as an alternative to my current solution, it would be a perfect fit given its name, “ONDESTROY.” It feels like this event could be the most intuitive and practical way to handle such scenarios.

    Here’s a simple example of what I mean:

    <layer url="abc.jpg"
    ongoup="tween(y, 10,,, ongodown() )"
    ongodown="tween(y, -10,,, ongoup() )"
    onloaded="ongoup();"
    ondestroy="stoptween(y)"
    />

    I’m really looking forward to seeing improvements to the ondestroy event in the near future.
    Also, could you share some guidance on the best practices for using ondestroy as it was intended? That would be incredibly helpful!

    This version reads more polished and positive while clearly expressing your points. Let me know if you’d like further adjustments! 😊

    To get a 'caller' object, the action need to be a localscope action.

    Code
    <action ... scope="local">
    ...
    </action>


    That’s correct. I made an oversight in not initially clarifying that the scope is local.

    However, even with that considered, this behavior is NOT functioning as expected.

    Consider the following example:

    <layer name="ly_kabkee" url="/assets/panda.png"
    onleft="tween(rotate, 45,,, onright);"
    onright="tween(rotate, 0,,, onleft);"
    onloaded="onleft()"
    ondestroy="trace('bye for now 1.22.3'); onDestroyElement();"
    />

    When the ondestroy event for the layer is triggered, attributes like layer.name or other properties are not accessible within the onDestroyElement action.

    This is the core issue I’m highlighting: these attributes should be accessible during the ondestroy event. Unfortunately, they are not.

    Additionally, even inline ondestroy commands fail to work as expected. Consider this example:

    <layer name="ly_kabkee" url="/assets/panda.png"
    onleft="tween(rotate, 45,,, onright);"
    onright="tween(rotate, 0,,, onleft);"
    onloaded="onleft()"
    ondestroy="trace('bye for now 1.22.3'); get(name)"
    />

    Here, using get(name) within the ondestroy event does not return the expected value. In this case, get(name) should return the layer name, "ly_kabkee", but it does not.

    Hypothesis:
    I suspect this might be happening because the layer is already destroyed before the ondestroy event is fired.

    Suggestion:
    Even if that’s the case, this behavior should be adjusted so that the ondestroy event is triggered before the layer is destroyed. This would allow developers to properly access the layer’s attributes during the ondestroy event, as expected.

    In the onDestroyElement action, the resulting path behaves globally.

    This indicates that the caller of the ondestroy event is not tied to the layer itself, which seems incorrect. Ideally, the caller of the ondestroy event should directly reference the layer being destroyed.

    This behavior appears to be a bug, and I believe it would benefit from clarification or confirmation from Klaus.

    It should function such that the caller of the ondestroy event is indeed the specific layer triggering the event.

    Hi,

    Please take a look at the code snippet below:


    <layer name="ly_kabkee" url="/assets/panda.png"

    enabled="false"

    edge="center"

    align="center"

    onleft="tween(rotate, 45,,, onright);"

    onright="tween(rotate, 0,,, onleft);"

    onloaded="onleft()"

    ondestroy="trace('bye for now 1.22.3'); onDestroyElement();"

    />


    <action name="onDestroyElement">

    trace(get(caller.name));

    trace(caller);

    stoptween(layer[get(name)].rotate);

    </action>


    This code is designed to make the layer rotate left and right repeatedly and call the onDestroyElement action when the layer is destroyed.


    The issue is that while the onDestroyElement action is properly triggered in Krpano 1.22.3, the caller information or properties like name and url seem to be unavailable when accessed within inline code.


    For example:

    ondestroy="trace('bye for now 1.22.3'); trace(name); trace(URL)"


    Both name and url return no values.

    That also effects the stoptween is not working in the onDestroyElement action.


    Additionally, when switching scenes, the following warning appears:

    WARNING: Unknown action: onleft

    This could have been prevented if I properly called the stoptween action before changing scenes.


    This seems to happen because the layer’s body element has already been removed.


    To address this, I’ve had to define an additional onremovepano action to clean things up. However, my expectation was that the ondestroy event would allow me to write less code by automatically handling cleanup. Unfortunately, it doesn’t seem to pass any caller information, making it less useful in this context.


    Am I using the ondestroy event incorrectly, or is there another way to approach this?

    Let me know if this works for you!

    Hi,

    Thank you for the new update, it’s much appreciated. The new ‘Face Map’ feature seems quite useful.

    Regarding the JSON files, I wonder if they could replace the print output from the Blender console. It’s a bit inconvenient to run Blender using the terminal on macOS just to use the console. If the JSON output could replace the console prints, it would be great for me.

    Could you explain how to use the JSON output and when it would be most useful?

    Thank you.

    I’m looking for a plugin similar to Matterport’s navigation.


    I know the everpano 3D navigator exists, but it’s only for everpano 3D. The depthmap_navigation.xml plugin is also quite good for general 3D world navigation and it supports collision detection.


    However, I need a plugin that includes the following features:


    1. A mouse indicator for ground and walls.

    2. Triggering the loadscene action when navigating close to specific hotspots.

    3. Calling the nearest hotspot’s loadscene action when clicking on the wall or ground.


    I could potentially create my own plugin, but I currently don’t have any ideas on how to start. If you have any advice or inspiration, please share.

    ---

    ### Google Map Layer Visibility Issue

    **Previous Version (1.19):**
    In version 1.19, there were no issues.

    **Current Version (1.21):**
    However, in version 1.21, changing the `layer.visible` property of the Google map is not working.

    **Details:**
    I am using `<layer url='googlemap.js' />` from Google Map version 1.21. I toggle between the Google map and my custom image map. When switching maps, I use `set()` to change both `layer.visible` and `layer.alpha`.

    The custom image map works fine, but after updating to version 1.21, the Google map disappears and does not display properly.

    **Problem:**
    After extensive investigation, I discovered the issue. The Google map layer's visibility is not updating correctly even though the `visible` value changes. In other words, even if the map layer's `visible` property is `true`, it does not display but still exists.

    **Solution:**
    Instead of changing both `layer.visible` and `layer.alpha`, only change `layer.alpha`. Ensure that the layer's `autoalpha` property is set to `true`.

    **Note:**
    Although I find `autoalpha` convenient, it can cause bugs, such as disappearing hotspots in krpano version 1.19. However, in version 1.21, I had to use `autoalpha` to fix the Google map layer disappearance issue.

    ---

    Hi, klaus thank you for having me reply so fast.


    To make things clear, I prepare a sample code!

    It could be somehow a chrome bug.

    With renderer 'webgl', an interactive area hotspot works fine.

    But when it comes with 'css3d' renderer, it become smaller even if its div size is correct and the parent div is set at the correct size.

    Please have a look at the following urls ;

    1. webgl renderer interactive video - https://look360.kr/project/krpano…rtscene=scene_2
    2. css3d renerer - https://look360.kr/project/krpano…ene=scene_2_css


    I found this issue when I test applying css filter on krpano div sprite.

    The point of the smaller video with css3d renderer is its parent div is the correct size. but the <video /> element itself is NOT.


    For more information,
    I found on 1.21 version, the css3d video hotspot is just disappeared. Because of that, I tought that the css3d is not supported on normal view of PC, mobile.

    I found on 1.20.11, 1.20.09 versions, the css3d video hotspot is showing but smaller size unexpactedly.

    I'd like to test how to have the video in VR is got affected by css "-webkit-filter".

    For the reason, I have to change the video hotspot into a css3d renderer version.

    Unfortunately, the video disapears. with normal renderer (not mention or webgl, it works properly)

    on 1.20.09 ver, it disappears but the mouse cursor changes when it's hovering on the hotspot.
    on 1.20.11 and 1.21 ver, it disappears. I can NOT see it, and NOT feel it.


    It's not supported or do I have to set some other atrtributes?

    Thanks.


    @ Kabkee
    anyway, in any case only the direct caller is accessible! you cant get a higher caller
    thats why the example above hardcodes the callers name inside the callback function
    this way you have the needed information

    Yes. that makes me sense. All about the local scope and callwith you said, I agree with them.
    To make simple the topic of this thread, I brought a new sample code below.

    Today I have a deep thinking time on this, and I got an idea *w00t* *attention* why it is.
    My guess is that It is because "klaus make this so".
    I don't know it's in purpose or not, but please review the blow code.


    Playsound oncomplete, tween donecall works the same.
    All returns "got YOU".

    Code
    <action name='anaction'>
    	set(getMyName, 'got YOU');
    	tween(view.hlookat, 90,,,
    		trace(getMyName); // got YOU
    	);
    	playsound(narration, get(sound_source[effect_popup].url), false, 1,
    		trace(getMyName); // got YOU
    	);
    </action>


    Playsound oncomplete, tween donecall works differently.


    My Guess,
    1. tween is genuine krpano action and its donecall works remaining in krpano.
    2. playsound is a plugin action which is integrated with howlerJs.
    3. In the code of integration, (maybe) in the listening event callback function don't get any information because the callback function is running in an isolated function which is in static mode.


    What do you think?

    I think. Only Klus can reveal the fact how this possible.
    I'm just curious and this has not been solved clearly for few days :(

    OK.
    As you called the 'oncomplete' as a "callback", YES I think it's real javascript callback function which could not access other territories, variables.
    Specially, in such a limited environment like krpano javascript type action. (Somehow, it works so in krpano to get intergrated with pure Javascript library - hower js)


    As Hyung mentioned in the thread - https://krpano.com/forum/wbb/inde…&threadID=19413
    The two different callback - "donecall" and "oncomplte" - look like the same, but work differently.


    Then, could I make the conclusion of this tread?

    Why I made this tread is to get access caller (in local scoped action) in oncomplete(callback function of playsound, Sound Interface).
    However, it's not possible to get the history of callback because of the mechanism or so.


    Related to this thread,
    one thing left question driven from Hyung is that.


    1. HOW donecall of tween and oncomplete of playsound (sound interface) are differently working in Krpano?

    2. WHAT makes donecall of tween and oncomplete of playsound (sound interface) work different in the same situation?


    I'd like to get your opinion or advice to use them correctly with right knowledge.
    Thank you in advance.


    strange.. it works fine here
    proof of concept -->


    Thank you for your example. it works. Yes, I know.
    But ah...

    I got to know that I mistitled this post and I should had to mention the words "oncomplete of playsound - SoundInterface"


    I re-point that
    "I want a way to get caller of local scoped action which called from a hotspot in oncomplete of ""playsound"" action."

    There's no way so far, and i wrote this post.
    AND I'm finding other's opinions, its possibilities, or the exact reason why it is.


    ""I hope that you tried my code which mentioned the beginning.
    specially, have your attention on "playsound" action and in the oncomplete session, you cannot get any caller in there.""


    Thank you for your prompt response.
    and you right mentioned that's why I'm finding a way to get access some variables out of the local scope of playsound's 'oncomplete'.

    I know there's no anaction, no anhotspot in the scope of 'oncomplete', it makes me feel like it's so much isolated from other scopes.
    But, it can access to "global" !!

    The following code works:

    Code
    <action name='anaction' scope='local'>
    trace(caller.name);
    copy(global.callerName, caller.name);
    playsound(narration, get(sound_source[effect_popup].url), false, 1, trace(get(global.callerName)) );
    </action>


    However, it's not the way what I do NOT want.
    So, here's my solution. make a xml element and using its' attribues like below:

    Code
    <some_setting tempcaller='' />
    <action name='anaction' scope='local'>
    trace(caller.name);
    copy(some_setting.tempcaller, caller.name);
    playsound(narration, get(sound_source[effect_popup].url), false, 1, trace(some_setting.tempcaller) );
    </action>


    As you expected, the above codes are work properly.


    Unfortunately, your codes below are not working.

    Code
    maybe that works:
    calc(local.callback, "trace("+caller.name+")");
    playsound(_name_, _source_, false, 1, get(callback));


    Maybe.. or somehow, there could be a better solution to get access to caller from oncomplete???
    *whistling* *rolleyes* *confused*


    !! UPDATE !!
    I'm using krpano ver. 1.20.11.
    ------------------

    I don't know exactly when it started 'oncomplete' running differently.
    I think it could be from krpano ver. 1.20 updates which had had replaced its sound interface from HTML5-Audio to webAudio API.
    --- if possible, I'd like to know when it started exactly just for information.


    - this action works as usual : playsound(_name_, _source_, false, 1, oncomplete() );


    But in a local scope action, the 'oncomplte' cannot access caller.
    'caller' is not the caller itself who acually called the action, but trace() shows null.

    Code
    <action autorun='onstart'>	callwith(hotspot[anhotspot], anaction);</action>
    <hotspot name='anhotspot' />
    <action name='anaction' scope='local'>	trace(caller.name); // anhotspot	playsound(_name_, _source_, false, 1, trace(caller.name) ); // undefined or null</action>


    in that case, if you needed get the extra information from the caller - the hotspot named 'anhotspot' is NOT possible in 'oncomplete'.

    Yes, in different way, it could be solved problem,
    However, I'd like to know if there's another way to get the action caller in easy way OR it's impossible to be accessed.

    Thanks.

    Embedding Pano, with embedpano();

    I implemented onready attribute and all works good.

    However, sometimes I faced the below error when I too fast to call krpano actions before changing black screen to pano just in time (i don't know when exactly)

    Every single time when new pano loading. there are chances.


    Code
    VM41313:8 Uncaught TypeError: Cannot read properties of null (reading 'webGL')at Q (eval at B.e.loading (eval at embedpano (tour.js:10:73)), <anonymous>:8:73)at Object.l.callaction (eval at embedpano (tour.js:10:73), <anonymous>:1:92617)at Object.l.processTicks (eval at embedpano (tour.js:10:73), <anonymous>:1:96938)at ff (eval at embedpano (tour.js:10:73), <anonymous>:1:37166)at b (eval at embedpano (tour.js:10:73), <anonymous>:1:348535)


    It seems DOES exist the krpano instance in the code, i think because the pano works well.
    But it shows the error and freeze the screen. When only changing black to new panos (when right just before loading another pano)


    Since that, I have to setTimeout on 'onready' function for wait 0.5 sec for calling the first one of krpano actions.
    But it doesn't help, because it's not just 'instance ready or not' issue.


    Any Idea for this?
    Waiting for your advice. thanks.


    I'm using ;

    - Mac OS Monterey v 12.2.1
    - Chrome Browser Version 99.0.4844.74 (Official Build) (x86_64)

    After testing, I found that the raycaster is reversed due to the value created by camera projection_matrix, but I don’t know anything about projection_matrix


    I only removed minus(-) in which "-mouse_y" in the line of raycatser's ray direction set as like the below, it show the right direction.

    Code
    camera_hittest_raycaster.ray.direction.set(mouse_x, mouse_y, 1.0).unproject(camera).normalize();


    but the intersection is not sill working :(
    even it's not directing the correct way with the mouse pointer.


    my test resource is in the link , and can see the live source in the link
    please check them out, and anyone got some ideas, comments, or advices please let me know :)

    Good luck with ThreeJs

    I'd also experienced this when i use everpano naviation plugin.
    For making not this happen, I remove all everpano relative plugins, and add plugins made by Klous in a krpano example.

    I don't know why but i think some where relative axis is different from default ones which made by krpano tools.



    Using Autolock and automatically play the sound, onplay event is not fired at the moment.
    The below doesn't work.


    streamsound(bgm, get(sound_source[bgm].url), true, 1);
    set(sound[bgm].onplay, trace(onplay) );

    After pause and play, the event is fired properly.
    Automatic playing is not firing the event.


    Sometimes when I get the paused attribute, autoplayed sound says it's paused, even if it's playing the sound.


    Which part that I should fix?