Jump to content

Member isLocked for mesh


Dad72
 Share

Recommended Posts

Hi,

I want a isLocked member , but it does not exist. I would lock an object to any changes even if an object is pickable.

By locking an object, you can not change it, nor materials, nor select ...

is there a similar function or member? or could it be possible to have a work like this in Babylon? 

Thank you

Link to comment
Share on other sites

I know isPickable Jerome, I use it for 3 years now, this is one of the first thing I learned from Babylon. I just wish that even if isPickable is true, it may not be selectable, or modify the materials and other level.
Basically, I want to lock an object of any changes to my editor. because all the objects are selectable.
IsPickable also do not want the change on materials. isPickable is not a verous on objects. I must keep my pickable objects

If users want avoid select an object or change by error, I wish he could add a Security locks that blocks any modification, selection, movement.

Link to comment
Share on other sites

Thank you for your help bring here. Here's what I did in the end if it can be useful to the other. I hope that Babylon soon get this kind of functionality. but in the meantime, I hope this can help.

I managed to block the entire object and unlock it. In made, I simply create a clone of the subject and I add it visibility is false. This new object will be rendered visible when I unlock the freeze objects. The object freeze  will be deleted then.

This works well in 2 directions.

	lockObjet = function()
	{
		if(global.objetSelected) {	
			var name = global.objetSelected.name;
			global.objectsFreeze[name] = global.objetSelected.clone(name);
			global.objectsFreeze[name].visibility = false;
			Object.freeze(global.objetSelected);						
		}
	};	
	
	unlockObjet = function()
	{
		for(var i = 0; i < global.objets.length; i++) {	
			if(global.objectsFreeze[global.objets.name]) {
				global.objectsFreeze[global.objets.name].visibility = true;
				global.objets.dispose();	
				global.objets = global.objectsFreeze[global.objets.name];
			}
		}		
	};

 

global.objetSelected corresponds to all my global variables contained in a json: var global = {objetSelected : null, objets: [], objectFreeze: [], othervariable: valueDefaut};

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...