Thread: Model Viewer Interface

Page 1 of 2 12 LastLast
Results 1 to 10 of 12
  1. #1 Model Viewer Interface 
    Ex Rune-Scaper

    Join Date
    Jun 2008
    Posts
    3,534
    Thanks given
    457
    Thanks received
    1,257
    Rep Power
    990
    Simple way you can view any model in the cache.

    might wanna center the models better, just made this quick to show the concept.

    use command

    ::viewmodel type id
    ::viewmodel id (view model from index1)
    ::viewmodel -1 (resets interface)

    type represents which type of model it is (such as an item model, npc model, player model or any model)
    id represents a fileid in index1 of the cache if its type 1, or the entity id if its 2 or 4. type 3 ignores it.
    • type 1 = any model
    • type 2 = npc
    • type 3 = player head
    • type 4 item


    Code:
    	public static void modelViewer(int interfaceId, int modelType, int entityId) {		
    		Widget widget = Widget.addInterface(interfaceId);
    		Widget rsi = Widget.addTabInterface(interfaceId + 1);		
    		rsi.id = interfaceId;
    		rsi.parent = interfaceId;
    		rsi.type = 6;
    		rsi.optionType = 0;
    		rsi.contentType = 329;
    		rsi.width = 136;
    		rsi.height = 168;
    		rsi.opacity = 0;
    		rsi.mOverInterToTrigger = 0;
    		rsi.modelZoom = 560;
    		rsi.modelRotationY = 150;
    		rsi.modelRotationX = 0;
    		rsi.defaultAnimationId = -1;
    		rsi.secondaryAnimationId = -1;
    		rsi.modelType = modelType;
    		rsi.modelFileId = entityId;
    		widget.totalChildren(1);
    		widget.child(0, interfaceId + 1, 190, 150);
    	}
    Code:
    		if (index == 329) {
    			try {
    
    			Model model = null;
    			
    			int rotationOffsetY = 0;
    			
    			if (widget.modelType == 1) {
    				model = Model.getModel(widget.modelFileId);
    				
    				rotationOffsetY = 150;
    			} else if (widget.modelType == 2) {
    				
    				// this will get the full npc model
    				NpcDefinition npc = NpcDefinition.lookup(widget.modelFileId);	
    				model = npc.getAnimatedModel(-1, -1, null);	
    				
    				// to only get the head you would use
    				//Widget.getModel(2, widget.modelFileId);
    				
    				rotationOffsetY = 200;
    			} else if (widget.modelType == 3) {
    				model = Widget.getModel(3, widget.modelFileId);
    			} else if (widget.modelType == 4) {
    				model = Widget.getModel(4, widget.modelFileId);
    
    				rotationOffsetY = 400;
    				widget.modelZoom = 350;
    			}
    			
    			
    			widget.modelRotationY = rotationOffsetY;			
    			widget.modelRotationX = ((int) (Math.sin((double) tick / 40D) * 256D) & 0x7ff);
    					
    			
    			if (model == null) {
    				return;
    			}
    			
    		    model.skin();
    		    model.scale2(1);		
    
    			widget.defaultMediaType = 5;
    			//widget.defaultMedia = 0;
    			Widget.method208(false, model);
    			} catch (Exception ex) {
    				ex.printStackTrace();
    			}			
    			return;
    		}
    Code:
    						if (inputString.startsWith("::viewmodel")) {							
    							try {	
    								
    								/*
    								 * type 1 = any model
    								 * type 2 = npc
    								 * type 3 = player head
    								 * type 4  item
    								 */
    			
    							String[] split = inputString.split(" ");
    							
    							int interfaceId = 37990;
    							
    							if (split.length == 3) {
    								int type = Integer.parseInt(split[1]);
    								
    								int id = Integer.parseInt(split[2]);
    								
    								if (id <= -1 || (type < 1 || type > 4)) {
    									interfaceId = -1;
    								}
    
    								Widget.modelViewer(37990, type, id);
    							} else if (split.length == 2) {
    								
    								int id = Integer.parseInt(split[1]);
    								
    								if (id <= -1) {
    									interfaceId = -1;
    								}
    
    								Widget.modelViewer(37990, 1, id);
    							} else if (split.length == 1) {
    								Widget.modelViewer(37990, 0, 0);
    							}
    							
    							if (interfaceId == -1) {
    								clearScreen();
    							} else {
    								showInterface(37990);
    							}							
    							
    							} catch (Exception ex) {
    								ex.printStackTrace();
    							}							
    						}

    Result
    Attached image
    Reply With Quote  
     


  2. #2  
    Respected Member


    George's Avatar
    Join Date
    Mar 2009
    Posts
    7,099
    Thanks given
    2,226
    Thanks received
    3,146
    Rep Power
    5000
    Quote Originally Posted by Freyr View Post
    Simple way you can view any model in the cache.

    use command

    ::viewmodel type id

    type represents which type of model it is.
    id represents a fileid if its type 1 or the entity id if its 2 or 4. type 3 ignores it.
    • type 1 = any model
    • type 2 = npc
    • type 3 = player head
    • type 4 item


    Code:
    	public static void modelViewer(int interfaceId, int modelType, int entityId) {		
    		Widget widget = Widget.addInterface(interfaceId);
    		Widget rsi = Widget.addTabInterface(interfaceId + 1);		
    		rsi.id = interfaceId;
    		rsi.parent = interfaceId;
    		rsi.type = 6;
    		rsi.optionType = 0;
    		rsi.contentType = 329;
    		rsi.width = 136;
    		rsi.height = 168;
    		rsi.opacity = 0;
    		rsi.mOverInterToTrigger = 0;
    		rsi.modelZoom = 560;
    		rsi.modelRotationY = 150;
    		rsi.modelRotationX = 0;
    		rsi.defaultAnimationId = -1;
    		rsi.secondaryAnimationId = -1;
    		rsi.modelType = modelType;
    		rsi.modelFileId = entityId;
    		widget.totalChildren(1);
    		widget.child(0, interfaceId + 1, 190, 150);
    	}
    Code:
    		if (index == 329) {
    			try {
    
    			Model model = null;
    			
    			int rotationOffsetY = 0;
    			
    			if (widget.modelType == 1) {
    				model = Model.getModel(widget.modelFileId);
    				
    				rotationOffsetY = 150;
    			} else if (widget.modelType == 2) {
    				
    				// this will get the full npc model
    				NpcDefinition npc = NpcDefinition.lookup(widget.modelFileId);	
    				model = npc.getAnimatedModel(-1, -1, null);	
    				
    				// to only get the head you would use
    				//Widget.getModel(2, widget.modelFileId);
    				
    				rotationOffsetY = 200;
    			} else if (widget.modelType == 3) {
    				model = Widget.getModel(3, widget.modelFileId);
    			} else if (widget.modelType == 4) {
    				model = Widget.getModel(4, widget.modelFileId);
    
    				rotationOffsetY = 400;
    				widget.modelZoom = 350;
    			}
    			
    			
    			widget.modelRotationY = rotationOffsetY;			
    			widget.modelRotationX = ((int) (Math.sin((double) tick / 40D) * 256D) & 0x7ff);
    					
    			
    			if (model == null) {
    				return;
    			}
    			
    		    model.skin();
    		    model.scale2(1);		
    
    			widget.defaultMediaType = 5;
    			//widget.defaultMedia = 0;
    			Widget.method208(false, model);
    			} catch (Exception ex) {
    				ex.printStackTrace();
    			}			
    			return;
    		}
    Code:
    						if (inputString.startsWith("::viewmodel")) {							
    							try {	
    								
    								/*
    								 * type 1 = any model
    								 * type 2 = npc
    								 * type 3 = player head
    								 * type 4  item
    								 */
    								
    							// reload widgets so this interface can be dynamic
    							GameFont gameFonts[] = { smallText, regularText, boldText, gameFont };
    							Widget.load(createArchive(3, "interface", "interface", archiveCRCs[3], 35), gameFonts, mediaStreamLoader);
    														
    							String[] split = inputString.split(" ");
    							
    							int interfaceId = 37990;
    							
    							if (split.length == 3) {
    								int type = Integer.parseInt(split[1]);
    								
    								int id = Integer.parseInt(split[2]);
    								
    								if (id <= -1 || (type < 1 || type > 4)) {
    									interfaceId = -1;
    								}
    
    								Widget.modelViewer(37990, type, id);
    							} else if (split.length == 2) {
    								
    								int id = Integer.parseInt(split[1]);
    								
    								if (id <= -1) {
    									interfaceId = -1;
    								}
    
    								Widget.modelViewer(37990, 1, id);
    							} else if (split.length == 1) {
    								Widget.modelViewer(37990, 0, 0);
    							}
    							
    							if (interfaceId == -1) {
    								clearScreen();
    							} else {
    								showInterface(37990);
    							}							
    							
    							} catch (Exception ex) {
    								ex.printStackTrace();
    							}							
    						}

    Result
    das dope.

    Seriously, will come in handy, thanks man.
    Attached image

    Spoiler for Spoilers!:
    Attached image
    Attached image
    Attached image
    Attached image
    Reply With Quote  
     

  3. #3  
    Banned

    Join Date
    Mar 2017
    Posts
    293
    Thanks given
    200
    Thanks received
    192
    Rep Power
    0
    wow thanks. Will definitely come in handy.
    Reply With Quote  
     

  4. #4  
    Ex Rune-Scaper

    Join Date
    Jun 2008
    Posts
    3,534
    Thanks given
    457
    Thanks received
    1,257
    Rep Power
    990
    Quote Originally Posted by Arlo View Post
    wow thanks. Will definitely come in handy.
    Quote Originally Posted by Idiot Dansker View Post
    das dope.

    Seriously, will come in handy, thanks man.
    Thanks, I thought it was pretty cool too

    removed the interface reloading that was only in there for debugging

    now switching models is instant with no delay

    Attached image
    Reply With Quote  
     

  5. #5  
    Banned

    Join Date
    Aug 2016
    Posts
    242
    Thanks given
    109
    Thanks received
    61
    Rep Power
    0
    Good shit once again Freyr
    Reply With Quote  
     

  6. #6  
    Registered Member
    Join Date
    Apr 2017
    Posts
    301
    Thanks given
    34
    Thanks received
    59
    Rep Power
    65
    Do you have #showInterface on hand?
    Reply With Quote  
     

  7. #7  
    Donator

    Ghost's Avatar
    Join Date
    Sep 2010
    Posts
    222
    Thanks given
    76
    Thanks received
    292
    Rep Power
    508
    Nice work! Had already implemented something similar myself:

    Attached image
    Attached image
    Reply With Quote  
     

  8. Thankful user:


  9. #8  
    Registered Member
    Lennard's Avatar
    Join Date
    Mar 2010
    Posts
    924
    Thanks given
    0
    Thanks received
    234
    Rep Power
    274
    Quote Originally Posted by Ghost View Post
    Nice work! Had already implemented something similar myself:

    Attached image
    Damn that looks really cool, you actually got a working sailing skill??
    Attached image
    The greatest upcoming OSRS PK server
    Reply With Quote  
     

  10. Thankful user:


  11. #9  
    Ex Rune-Scaper

    Join Date
    Jun 2008
    Posts
    3,534
    Thanks given
    457
    Thanks received
    1,257
    Rep Power
    990
    Quote Originally Posted by VenomRS View Post
    Do you have #showInterface on hand?
    Code:
    	private void showInterface(int interfaceId) {
    
    		resetAnimation(interfaceId);
    
    		if (overlayInterfaceId != -1) {
    			overlayInterfaceId = -1;
    			tabAreaAltered = true;
    		}
    
    		if (backDialogueId != -1) {
    			backDialogueId = -1;
    			updateChatbox = true;
    		}
    
    		if (inputDialogState != 0) {
    			inputDialogState = 0;
    			updateChatbox = true;
    		}
    
    		openInterfaceId = interfaceId;
    		continuedDialogue = false;
    	}
    Quote Originally Posted by Ghost View Post
    Nice work! Had already implemented something similar myself:

    Attached image
    Very nice!
    Attached image
    Reply With Quote  
     

  12. #10  
    Donator

    Ghost's Avatar
    Join Date
    Sep 2010
    Posts
    222
    Thanks given
    76
    Thanks received
    292
    Rep Power
    508
    Quote Originally Posted by Lennard View Post
    Damn that looks really cool, you actually got a working sailing skill??
    Yeah! Not far off being finished - welcome to click my signature in order to see more.
    Also: I wasn't intending to advertise my project on your thread Freyr, will remove if you'd like!
    Attached image
    Reply With Quote  
     

Page 1 of 2 12 LastLast

Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)


User Tag List

Similar Threads

  1. [req] bentski's model viewer version 3
    By Animato in forum Requests
    Replies: 7
    Last Post: 04-03-2008, 05:27 PM
  2. model viewer
    By N1ghtm4r3 in forum Models
    Replies: 3
    Last Post: 01-25-2008, 01:04 AM
  3. Defyboys Cache Extractor & Bentskis Model Viewer
    By Feared Gear in forum RS2 Server
    Replies: 1
    Last Post: 11-10-2007, 03:03 PM
  4. Model Viewer!
    By 1337scape in forum RS2 Client
    Replies: 1
    Last Post: 11-04-2007, 08:33 AM
  5. bentski's model viewer v 0.3
    By ~Kajakas~ in forum Downloads
    Replies: 0
    Last Post: 10-04-2007, 12:09 PM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •