/*! * @param url URL to 3D animation file to load. * @param target name of avatar/garment to apply animation to * if null, the current avatar is assumed * Load a 3D animation content file (BVH, Havok or Vixen format) * and apply it to the named avatar or garment. The name of the * animation is the base name of the file without the extension. * * @see PlayAnimation PauseAnimation */ public virtual void LoadAnimation(String url, String targetname) { String ext = url.Substring(url.LastIndexOf('.')).ToLower(); SharedObj targobj = null; Garment g = null; if (ext == ".scp") { scriptor.LoadScript(url); return; } if (ext == ".xml") { if (targetname != null) { g = FindGarment(targetname); } else { g = currentGarment; } LoadMayaCache(g, url, null, scriptor); } else { Puppet p = null; if (targetname != null) { p = FindAvatar(targetname); g = FindGarment(targetname); } else { if (currentAvatar == null) { return; } p = currentAvatar; } if (p != null) { targetname = p.AnimSkeleton.Name; targetname = targetname.Substring(targetname.IndexOf('.')); targobj = p.AnimSkeleton; } else if (g != null) { targobj = g.ClothMesh; targetname = g.ClothMesh.Name; } scriptor.Load(url, targetname, 0, targobj); } }
/*! * @param url URL to 3D animation file to load. * Load a 3D animation content file (BVH or Vixen format) * and apply it to the current skeleton. * * @see PlayAnimation PauseAnimation */ public void LoadAnimation(string url) { Viewer3D viewer = Viewer as Viewer3D; Scriptor scriptor = AnimScriptor; String ext = url.Substring(url.LastIndexOf('.')).ToLower(); string skelname = ConnectSkeleton(); AnimScriptor.Directory = Path.GetDirectoryName(url); AnimScriptor.Target = _skeleton; if (ext == ".scp") { scriptor.LoadScript(url); } else { _animName = Path.GetFileNameWithoutExtension(url) + skelname; scriptor.Load(url, skelname, Animator.AUTO_PLAY, _skeleton); } }
public Garment OnLoad(Scene scene, SharedWorld world, dynamic avatarconfig) { Garment g = Find(scene.Name); dynamic tmp = g; if (g == null) { SharedWorld.LogError(scene.Name + " not a garment - ignoring this load event"); return(null); } if (g.IsLoaded) { SharedWorld.LogError(scene.Name + " already loaded - ignoring this load event"); return(g); } g.Connect(world, scene, avatarconfig); if ((scriptor != null) && (tmp.script != null)) { scriptor.LoadScript(tmp.script); } Select(g); return(g); }