Sie sind nicht angemeldet.

ciul

Schüler

  • »ciul« ist der Autor dieses Themas

Beiträge: 149

Wohnort: Colombia

Beruf: Creative developer guy

  • Nachricht senden

1

Sonntag, 6. März 2011, 18:44

Problem with removeplugin action

Hi krpano pals.

Need your help.

I have some actions that create thumbnails which work as links between scenes of a pano, but also need to remove them to create new thumbnails of a new pano.

The actions are working correctly by itself, but not when one call the other, not all thumbnails are removed.

Attached is the actions.xml file.

The problem is that it creates the thumbnails but when load another pano (through the map or not), not all the thumbnails are removed then, as you can see in image3.jpg (attached) thumbnails images are not the correct.

I'd appreciate any help

Regards,
Ciul
»ciul« hat folgende Bilder angehängt:
  • image1.jpg
  • image2.jpg
  • image3.jpg
»ciul« hat folgende Datei angehängt:
  • actions.xml (8,69 kB - 74 mal heruntergeladen - zuletzt: 17. Oktober 2023, 20:15)

Tuur

Erleuchteter

Beiträge: 3 839

Wohnort: Netherlands

Beruf: Krpano custom coding / Virtual Tours / Photography / Musician / Recording engineer

  • Nachricht senden

2

Sonntag, 6. März 2011, 19:05

Hi Ciul ;-)

i'm not sure but at the end you write:

Quellcode

1
2
3
4
5
6
7
8
9
10
	<action name="removethumbs_v">
		if(%1 != nextloop, set(thumbs_v_j,0));
		
		if(plugin[get(thumbs_v_j)].style == 'thumbnail_v',
			removeplugin(get(plugin[get(thumbs_v_j)].name));
		);
		
		inc(thumbs_v_j);
		if(thumbs_v_j LT plugin.count,removethumbs_v(nextloop); );
	</action>


shouldn't this :

thumbs_v_j,0


be:
thumbs_v_i,0


that's 3 times in that part of code..

Cheers

tuur *thumbsup*

ciul

Schüler

  • »ciul« ist der Autor dieses Themas

Beiträge: 149

Wohnort: Colombia

Beruf: Creative developer guy

  • Nachricht senden

3

Sonntag, 6. März 2011, 19:10

Hi Ciul ;-)

i'm not sure but at the end you write:

...

Cheers

tuur *thumbsup*


Hi Tuur.

Well I don't think that is the problem,

I use j instead of i to have a different variable that doesn't interfere with the buildthumbs_v action counter variable (thumbs_v_i)

Regards,
Ciul

4

Sonntag, 6. März 2011, 20:10

Hi Ciul,

I have not looked all your code but I think this can be the problem...
Try this code for your removethumbs_v() action:

Quellcode

1
2
3
4
5
6
7
8
9
10
	<action name="removethumbs_v">
		if(%1 != nextloop, set(thumbs_v_j,get(plugin.count)));
		
		if(plugin[get(thumbs_v_j)].style == 'thumbnail_v',
			removeplugin(get(plugin[get(thumbs_v_j)].name));
		);
		
		dec(thumbs_v_j);
		if(thumbs_v_j GE 0,removethumbs_v(nextloop); );
	</action>


Look at this thread that have some relation with yours...

Hope this help.

SAlut.

ciul

Schüler

  • »ciul« ist der Autor dieses Themas

Beiträge: 149

Wohnort: Colombia

Beruf: Creative developer guy

  • Nachricht senden

5

Montag, 7. März 2011, 14:02

Hi Ciul,

I have not looked all your code but I think this can be the problem...
...
Look at this thread that have some relation with yours...

Hope this help.

SAlut.
Hi Michel.

Thanks for your answer.

My though: Your action does the same than mine just that decrementally instead of incrementally as I do, but at the end both achieve the same.

The problem seems to be in the speed of removeplugin krpano action, it misses some calls, the strange is that it doesn't alert that on the console (showlog).

I kinda solved it already changing a few things here and there.

If you have panos from one only place, that already works fine as it already is.
The thing is that I have several panos from different places each one, loaded from a google map, then, when the user goes to map and click on a different location, it has to remove the older thumbnails and display the thumbnails of the place the user wants to go to.


So it is like if you had different tours in one.

Ok, any solution or comment would be appreciated and if I finally solve it I will post it.

I'm doing my own thumbnails actions from scratch because of the several tours in one, and because I doing thumbnails that take approach of actual 'preview.jpg' images that krpano tools already makes. I crop them and use them to create the thumbnails, so server resources are saved and also they load faster since those preview images were already loaded from user. Tuur said it was a smart idea *g* Thanks

Best regards,
Ciul

6

Montag, 7. März 2011, 14:57

i had the same issue trying to run the loop against the 'style' attribute. so in the style itself i added tag="thumbs" then ran the loop against that tag instead of the style and it performed better.

ciul

Schüler

  • »ciul« ist der Autor dieses Themas

Beiträge: 149

Wohnort: Colombia

Beruf: Creative developer guy

  • Nachricht senden

7

Montag, 7. März 2011, 17:29

SOLVED!!! I re-wrote the buildthumbs action

Hi Krpano pals.

Finally, I solved it (I think, at least after testing it seems working really nice *smile* )

I re-wrote the buildthumbs_v (the v is from vertical) so it runs all plugins, but if there's already a plugin, it removes it (the old one) before create the new one.

Attached are the thumbs_parent.png (it is a 20x20 pixels black image) image and the white_square.png (it is a 20x20 pixels white image) image which work as thumbnails wrappers.

The solution was kinda simple but had to remember old lessons from teacher about basic routines to run over multidimensional arrays (it sounds more hard than what it really is).


Ok now, why I think you will find these thumbnails_v actions rock! is because:
  1. It uses preview.jpg images from 'data/scene_#.tiles' that krpano tools already gives us (using cubical images)
  2. It crops those preview.jpg images (then u can choos which face to act as thumbnail)
  3. It is smart, if there was and old thumbnail, it removes it before create the new one
  4. It has no WAIT or DELAYEDCALL (that shall be boring like to be a user)


By latter then:
  1. They load faster (because the preview images were already loaded by user)
  2. It saves you server resources (because the preview images were already downloaded by user when loaded)
  3. It can be used for several different panos that are loaded from one common source tour
  4. It can be used for a tour that is lonely (I mean no common source tour)
  5. They are created fast (since there's no WAIT or DELAYEDCALL at all)


Please, test them and well, if anything has to be fixed please tell me.

Regards,
Ciul
»ciul« hat folgende Bilder angehängt:
  • thumbs_parent.png
  • white_square.png
»ciul« hat folgende Datei angehängt:

8

Montag, 7. März 2011, 18:22

Hi Ciul,

Zitat

My though: Your action does the same than mine just that decrementally instead of incrementally as I do, but at the end both achieve the same.
NO *huh* , it doesn't achieve the same...
Why? Because of your variable that goes incrementing while the plugin.count is going decreasing with each removeplugin()...So there is a moment that your variable is greater than the number of available plugins so there no more possibility to remove the rest of plugins *rolleyes* ...

Hope this help ;-) ...

SAlut.

ciul

Schüler

  • »ciul« ist der Autor dieses Themas

Beiträge: 149

Wohnort: Colombia

Beruf: Creative developer guy

  • Nachricht senden

9

Montag, 7. März 2011, 20:42

Hi Ciul,

Zitat

My though: Your action does the same than mine just that decrementally instead of incrementally as I do, but at the end both achieve the same.
NO *huh* , it doesn't achieve the same...
Why? Because of your variable that goes incrementing while the plugin.count is going decreasing with each removeplugin()...So there is a moment that your variable is greater than the number of available plugins so there no more possibility to remove the rest of plugins *rolleyes* ...

Hope this help ;-) ...

SAlut.
Hi Michel.

Well, you have a good point. Then I will change the counter which is compared to plugin.count to decrement instead of increment.

Anyway it already works because it tests the plugin's existence throught it's name not it's index, if it doesn't exist I get a null in return then it never tries to remove a non-existing plugin *smile* .

Already using in a live site and it runs flawlessly *g*

Regards,
Ciul.