krpano 实现小行星加载完成再显示所有的热点

刚接触krpano,发现这个神奇的玩意,做全景图开发的工具。不过这几年也是不温不火。不过感觉还是挺新奇。

刚好遇到了一些问题,比如,默认皮肤的情况下,使用小行星在加载的时候就会出现各个热点,这样子并不好看。

接下来实现小行星加载完成再显示所有的热点。说明一下,我的krpano版本是1.19 pr16的。

其他方法可以参考肥宗的文档。》》http://www.krpano360.com/little-planet/
(我的也是参考他的)
 

首先在tour.xml文件skin_settings里设置littleplanetintro为true(开启小行星还在模式)

littleplanetintro="true"

然后在skin目录下vtourskin.xml文件里找到skin_setup_littleplanetintro


		set(global.lpinfo, 
			scene=get(xml.scene), 
			hlookat=get(view.hlookat), 
			vlookat=get(view.vlookat), 
			fov=get(view.fov), 
			fovmax=get(view.fovmax), 
			limitview=get(view.limitview) 
		);
		set(view, 
			fovmax=170, 
			limitview=lookto, 
			vlookatmin=90, 
			vlookatmax=90
		);
		lookat(calc(lp_hlookat - 180), 90, 150, 1, 0, 0);
		set(events[lp_events].onloadcomplete,
			delayedcall(0.5,
				if(lpinfo.scene === xml.scene,
					set(control.usercontrol, off);
					set(view, 
						limitview=get(lpinfo.limitview), 
						vlookatmin=null, 
						view.vlookatmax=null
					);
					tween(
						view.hlookat|view.vlookat|view.fov|view.distortion, 
						calc('' + lpinfo.hlookat + '|' + lpinfo.vlookat + '|' + lpinfo.fov + '|' + 0.0),
						3.0, easeOutQuad,
						set(control.usercontrol, all);
						tween(view.fovmax, get(lpinfo.fovmax));
						skin_deeplinking_update_url();
						delete(global.lpinfo);
					);
				  ,
					delete(global.lpinfo);
				);
			);
		);
	

将这里修改为如下


		set(global.lpinfo, 
			scene=get(xml.scene), 
			hlookat=get(view.hlookat), 
			vlookat=get(view.vlookat), 
			fov=get(view.fov), 
			fovmax=get(view.fovmax), 
			limitview=get(view.limitview) 
		);
		set(view, 
			fovmax=170, 
			limitview=lookto, 
			vlookatmin=90, 
			vlookatmax=90
		);
		
		
		set_hotspot_visible(false);
		set(layer[skin_layer],visible=false,alpha=0);
		set(layer[skin_control_bar],visible=false,alpha=0);
		set(layer[skin_splitter_bottom],visible=false,alpha=0);
		
		
		lookat(calc(lp_hlookat - 180), 90, 150, 1, 0, 0);
		set(events[lp_events].onloadcomplete,
			delayedcall(0.5,
				if(lpinfo.scene === xml.scene,
					set(control.usercontrol, off);
					set(view, 
						limitview=get(lpinfo.limitview), 
						vlookatmin=null, 
						view.vlookatmax=null
					);
					tween(
						view.hlookat|view.vlookat|view.fov|view.distortion, 
						calc('' + lpinfo.hlookat + '|' + lpinfo.vlookat + '|' + lpinfo.fov + '|' + 0.0),
						3.0, easeOutQuad,
						set(control.usercontrol, all);
						tween(view.fovmax, get(lpinfo.fovmax));
						
						
						set_hotspot_visible(true);
						set(layer[skin_layer].visible,true);tween(layer[skin_layer].alpha,1,1);
						set(layer[skin_control_bar].visible,true);tween(layer[skin_control_bar].alpha,1,1);
						set(layer[skin_splitter_bottom].visible,true);tween(layer[skin_splitter_bottom].alpha,1,1);
						
						
						skin_deeplinking_update_url();
						delete(global.lpinfo);
					);
				  ,
					delete(global.lpinfo);
				);
			);
		);
	
	
	
	
		for(set(i,0),i LT hotspot.count,inc(i),
			if(%1 == false,
				if(hotspot[get(i)].visible == true,
					set(hotspot[get(i)].mark,true);set(hotspot[get(i)].visible,%1);
				);
				,
				if(hotspot[get(i)].mark == true OR hotspot[get(i)].mark2 == true,
					set(hotspot[get(i)].visible,%1);
				);
			);
		);
	

这里外加了一个set_hotspot_visible的action元素,用来循环查找hotspot并设置其属性visible为false。然后在skin_setup_littleplanetintro加载小行星之前传false隐藏热点,然后在加载完小行星后再传true显示热点。

你可能感兴趣的:(krpano)