Enhancing OOPS, Tuhopuu Updated with python/oops accsess!

The interface, modeling, 3d editing tools, import/export, feature requests, etc

Moderators: jesterKing, stiv

Post Reply
ideasman
Posts: 0
Joined: Tue Feb 25, 2003 2:37 pm

Enhancing OOPS, Tuhopuu Updated with python/oops accsess!

Post by ideasman » Thu Jun 03, 2004 3:21 pm

Hi, Sombody a while back said that it would be cool to be able to make/remove parents in the OOPS window.

I have been getting into the blender source and added this for a challange.
Anyboy have any ideas for the OOPS view??

Modify constraints?

Copy Objects (other datablocks too)? Deleate them too?

hmmmm.... spline lines could look nice to join them.

Preview data in each box (Mesh's, Text, Images, Materials, TEX...) Would look realy nice (eyecandy factor) but it could suck up some CPU rendering all that stuff.

Patch on BF-Blender

Code: Select all

Index: source/blender/src/editoops.c
===================================================================
RCS file: /cvsroot/bf-blender/blender/source/blender/src/editoops.c,v
retrieving revision 1.9
diff -u -r1.9 editoops.c
--- source/blender/src/editoops.c	19 Nov 2003 22:00:13 -0000	1.9
+++ source/blender/src/editoops.c	3 Jun 2004 13:19:10 -0000
@@ -110,7 +110,8 @@
 	base= FIRSTBASE;
 	while(base) {
 		if(base->flag != base->object->flag) {
-			base->flag= base->object->flag;
+      base->flag= base->object->flag;
+      set_active_base(base);
 		}
 		base= base->next;
 	}
Index: source/blender/src/space.c
===================================================================
RCS file: /cvsroot/bf-blender/blender/source/blender/src/space.c,v
retrieving revision 1.138
diff -u -r1.138 space.c
--- source/blender/src/space.c	21 May 2004 09:27:42 -0000	1.138
+++ source/blender/src/space.c	3 Jun 2004 13:19:18 -0000
@@ -3560,8 +3560,15 @@
 			transform_oops('s');
 		}
 		break;
+  case PKEY:
+		if((G.qual==LR_CTRLKEY)) {
+      make_parent();
+    } else if((G.qual==LR_ALTKEY)) {
+      clear_parent();
+		}
+		break;
 
-	case ONEKEY:
+  case ONEKEY:
 		do_layer_buttons(0); break;
 	case TWOKEY:
 		do_layer_buttons(1); break;

Last edited by ideasman on Sun Aug 08, 2004 2:39 pm, edited 2 times in total.

matt_e
Posts: 410
Joined: Mon Oct 14, 2002 4:32 am
Location: Sydney, Australia
Contact:

Post by matt_e » Thu Jun 03, 2004 4:33 pm

Parenting, constraints, etc would be so much easier if it could be done via drag and drop!

ideasman
Posts: 0
Joined: Tue Feb 25, 2003 2:37 pm

Post by ideasman » Fri Jun 04, 2004 1:29 am

Drag and drop would be nice, but when making many objects the child of 1 parent Ctrl+P is still usefull.

This would still be nice though :)

This is now comitted to the CVS.

gabio
Posts: 0
Joined: Thu Jan 15, 2004 6:41 am
Location: Canada - Québec - Sherbrooke
Contact:

Post by gabio » Fri Jun 04, 2004 5:03 am

you'r the guy! All you said is good to me, hey finaly the OOPS will be usefull!

link, unlink, parent, unparent, track, untrack, use, don't use, Add empty datablock, ->delete Data block <-. Put or remove the fake user.
that's what i think could be the best Data manager for blender...

ideasman
Posts: 0
Joined: Tue Feb 25, 2003 2:37 pm

Post by ideasman » Fri Jun 04, 2004 10:14 am

Patch to add spline curves between objects, I think it makes it more obvious where lines are coming and going to.

Code: Select all

Index: source/blender/src/drawoops.c
===================================================================
RCS file: /cvsroot/bf-blender/blender/source/blender/src/drawoops.c,v
retrieving revision 1.13
diff -u -r1.13 drawoops.c
--- source/blender/src/drawoops.c	14 Mar 2004 16:59:46 -0000	1.13
+++ source/blender/src/drawoops.c	4 Jun 2004 08:11:56 -0000
@@ -129,8 +129,13 @@
 void draw_oopslink(Oops *oops)
 {
 	OopsLink *ol;
-	float vec[4];
-	
+	float ptA[2];
+	float ptB[2];
+	/* All these are used for spline drawing */
+	int i;  
+	float ctrlPoints[4][3];
+	glEnable(GL_MAP1_VERTEX_3); 
+  
 	if(oops->type==ID_SCE) {
 		if(oops->flag & SELECT) {
 			if(oops->id->lib) cpack(0x4080A0);
@@ -150,11 +155,35 @@
 	while(ol) {
 		if(ol->to && ol->to->hide==0) {
 			
-			give_oopslink_line(oops, ol, vec, vec+2);
+			give_oopslink_line(oops, ol, ptA, ptB);
+			
+			/* Set up control points for spline */
+			/* Location ptA*/
+			ctrlPoints[0][0] = ptA[0];
+			ctrlPoints[0][1] = ptA[1];
+			/* Handle ptA*/
+			ctrlPoints[1][0] = ptA[0];
+			ctrlPoints[1][1] = (ptA[1] + ptB[1])/2;
+			/* Handle ptB*/
+			ctrlPoints[2][0] = ptB[0];
+			ctrlPoints[2][1] = (ptA[1] + ptB[1])/2;
+			/* Location ptB*/
+			ctrlPoints[3][0] = ptB[0];
+			ctrlPoints[3][1] = ptB[1];
+			
+			/*Make 0 only 2D coords needed*/
+			ctrlPoints[0][2] = 0.0f;
+			ctrlPoints[1][2] = 0.0f;
+			ctrlPoints[2][2] = 0.0f;
+			ctrlPoints[3][2] = 0.0f;
 			
+			glMap1f(GL_MAP1_VERTEX_3, 0.0f, 100.0f, 3, 4,&ctrlPoints[0][0]);
+      
 			glBegin(GL_LINE_STRIP);
-			glVertex2fv(vec);
-			glVertex2fv(vec+2);
+			for(i=0;i  <=100;i++)
+			{
+				glEvalCoord1f((GLfloat) i);
+			}
 			glEnd();
 		}
 		ol= ol->next;


Goofster
Posts: 108
Joined: Mon Oct 14, 2002 12:26 pm

Post by Goofster » Fri Jun 04, 2004 10:35 am

Do you have any screenshots of this?

Roel

ideasman
Posts: 0
Joined: Tue Feb 25, 2003 2:37 pm

Post by ideasman » Fri Jun 04, 2004 10:40 am

Image

matt_e
Posts: 410
Joined: Mon Oct 14, 2002 4:32 am
Location: Sydney, Australia
Contact:

Post by matt_e » Fri Jun 04, 2004 10:59 am

Sheesh mate, that was quick!

Perhaps we should get you commit access to tuhopuu so you can test it out nice and easily without having to send in patches all the time. Let us know on tuhopuu-devel if you're interested.

Monkeyboi
Posts: 251
Joined: Tue Nov 26, 2002 1:24 pm
Location: Copenhagen, Denmark
Contact:

Post by Monkeyboi » Fri Jun 04, 2004 12:40 pm

Whoa, brilliant stuff!

I'm mostly intrested in the ability to DETELE datablocks so I can finally get rid of unused images etc I don't want anymore. (I know of the unassign-close-reopen technique for deleting, but its often hard to find evey instance where something you dont want is used, and it is very unintuitive to use)

You should be able to instance (alt-D) and copy (ctrl-D) datablocks and connect them up with each other. You could then manage and assign different IPOs (for example) to an object in a nice clear manner.

Another thing is that it is not possible to visualise Action datablocks, could these be implemented in the Oops? Not sure you can see bone datablocks either..

Oh, and ability to visualise constraints would be neat too. When using the Track constraint, for example, it could draw a dotted line between the object and the target.

These things would transform the Oops from pretty useless to extremely useful IMO.

Thanks for the great work.

ideasman
Posts: 0
Joined: Tue Feb 25, 2003 2:37 pm

Post by ideasman » Fri Jun 04, 2004 2:55 pm

Yeah, thats the next thing Id like to add.

But somthing thats lacking in blender (AFAIK) Is the function to remove DATA blocks (One of my annoyances with blender)

When you hit the cross on the image/uv window it only removes links to the image and dosent remove the image its self.
To remove the image it must be unused and then the blend file opened and saved a few times.

This is sloppy, it should be more like the text block that actually deleates the object..... hmmm a topic to discuss further.

On Furt6her inspection blender realy needs a way to handle deleating of objects.

So you want to remove a mesh- What happens to the object that uses the mesh...
... Is it removed?? Then what happens to its children......
Does the next object in the list get used? Or a dummy object created?
kinda opens up a can or worms.
- Cam

ideasman
Posts: 0
Joined: Tue Feb 25, 2003 2:37 pm

Post by ideasman » Fri Jun 04, 2004 3:56 pm

Monkeyboi- Interested in doing some mockups on how thge oops could look?

Think of..
- Curved edges to fit in with the theme
- Different colour theme (I think existing is too grey and dosent discern differences between different types)
- Drop shadows? Why not.
- Graphical way to parent/assiciate oops blocks: Click and drag? (Could copy logic blocks??)
- Different ways to represint data broperties graphicly.
- eg- This could mean an object preview... but that might be a bit too much, mabe somewhere on the objects blocj that shows its material colour, same goes for light, It would probably not be hard to thumbnail textures into the oops view.
...
Mabe thats enough... :-)

ideasman
Posts: 0
Joined: Tue Feb 25, 2003 2:37 pm

Post by ideasman » Fri Jun 04, 2004 4:55 pm

Just added almost every keyboard function to OOPS.

join, erase, copy, copyLinked..... copyAttrib, MakeTrack clear track. to name a few.

The only 2 the tshould not be there are the Duplicate (Ctrl/Alt+D)
Since they grap the keyboard for object movement... just press enter right away and it will all work fine.

This patch also adds spline curves.. need to add blue spline curves for constraints :-)

Code: Select all

Index: source/blender/src/drawoops.c
===================================================================
RCS file: /cvsroot/bf-blender/blender/source/blender/src/drawoops.c,v
retrieving revision 1.13
diff -u -r1.13 drawoops.c
--- source/blender/src/drawoops.c	14 Mar 2004 16:59:46 -0000	1.13
+++ source/blender/src/drawoops.c	4 Jun 2004 14:52:24 -0000
@@ -129,8 +129,20 @@
 void draw_oopslink(Oops *oops)
 {
 	OopsLink *ol;
-	float vec[4];
-	
+	float ptA[2];
+	float ptB[2];
+	/* All these are used for spline drawing */
+	int i;  
+	float ctrlPoints[4][3];
+  
+  /*Make 0 only 2D coords needed, only do this once */
+	ctrlPoints[0][2] = 0.0f;
+	ctrlPoints[1][2] = 0.0f;
+	ctrlPoints[2][2] = 0.0f;
+	ctrlPoints[3][2] = 0.0f;
+  
+	glEnable(GL_MAP1_VERTEX_3); 
+  
 	if(oops->type==ID_SCE) {
 		if(oops->flag & SELECT) {
 			if(oops->id->lib) cpack(0x4080A0);
@@ -150,11 +162,29 @@
 	while(ol) {
 		if(ol->to && ol->to->hide==0) {
 			
-			give_oopslink_line(oops, ol, vec, vec+2);
+			give_oopslink_line(oops, ol, ptA, ptB);
+			
+			/* Set up control points for spline */
+			/* Location ptA*/
+			ctrlPoints[0][0] = ptA[0];
+			ctrlPoints[0][1] = ptA[1];
+			/* Handle ptA*/
+			ctrlPoints[1][0] = ptA[0];
+			ctrlPoints[1][1] = (ptA[1] + ptB[1])/2;
+			/* Handle ptB*/
+			ctrlPoints[2][0] = ptB[0];
+			ctrlPoints[2][1] = (ptA[1] + ptB[1])/2;
+			/* Location ptB*/
+			ctrlPoints[3][0] = ptB[0];
+			ctrlPoints[3][1] = ptB[1];
 			
+			glMap1f(GL_MAP1_VERTEX_3, 0.0f, 100.0f, 3, 4,&ctrlPoints[0][0]);
+      
 			glBegin(GL_LINE_STRIP);
-			glVertex2fv(vec);
-			glVertex2fv(vec+2);
+			for(i=0;i  <=100;i++)
+			{
+				glEvalCoord1f((GLfloat) i);
+			}
 			glEnd();
 		}
 		ol= ol->next;
Index: source/blender/src/editoops.c
===================================================================
RCS file: /cvsroot/bf-blender/blender/source/blender/src/editoops.c,v
retrieving revision 1.10
diff -u -r1.10 editoops.c
--- source/blender/src/editoops.c	3 Jun 2004 14:26:43 -0000	1.10
+++ source/blender/src/editoops.c	4 Jun 2004 14:52:25 -0000
@@ -111,7 +111,6 @@
 	while(base) {
 		if(base->flag != base->object->flag) {
 			base->flag= base->object->flag;
-			set_active_base(base);
 		}
 		base= base->next;
 	}
@@ -430,6 +429,8 @@
 void mouse_select_oops(void)
 {
 	Oops *oops;
+  Object *ob;
+  Base *base;
 	extern float oopslastx, oopslasty;	/* oops.c */
 	
 	if(G.soops==0) return;	
@@ -456,7 +457,17 @@
 				oops->flag |= SELECT;
 			}
 		}
-		
+  
+    /* Set the object active */
+    base= FIRSTBASE;
+    ob= (Object *)oops->id;
+    while(base) {
+      if(base->object == ob) {
+        set_active_base(base);
+      }
+      base= base->next;
+    }
+    
 		oopslastx= oops->x;
 		oopslasty= oops->y;
 		
Index: source/blender/src/space.c
===================================================================
RCS file: /cvsroot/bf-blender/blender/source/blender/src/space.c,v
retrieving revision 1.140
diff -u -r1.140 space.c
--- source/blender/src/space.c	3 Jun 2004 14:29:14 -0000	1.140
+++ source/blender/src/space.c	4 Jun 2004 14:52:33 -0000
@@ -3481,6 +3481,7 @@
 	SpaceOops *soops= curarea->spacedata.first;
 	View2D *v2d= &soops->v2d;
 	float dx, dy;
+	Object *ob; /* Only needed for join */
 
 	if(val==0) return;
 
@@ -3531,6 +3532,8 @@
 		if((G.qual==0)) {
 			swap_select_all_oops();
 			scrarea_queue_winredraw(curarea);
+		} else if((G.qual==LR_CTRLKEY)) {
+			apply_object();
 		}
 		break;
 	case BKEY:
@@ -3538,14 +3541,20 @@
 			borderselect_oops();
 		break;
 	case GKEY:
-		if((G.qual==0))
+		if((G.qual==0)) {
 			transform_oops('g');
+		} else if((G.qual==LR_SHIFTKEY))
+			select_group_menu();
 		break;
 	case LKEY:
 		if((G.qual==LR_SHIFTKEY))
 			select_backlinked_oops();
 		else if((G.qual==0))
+		{
 			select_linked_oops();
+			if(! G.obedit && ! G.obpose)
+				make_local();
+		}
 		break;
 	case SKEY:
 		if((G.qual==LR_ALTKEY)) {
@@ -3567,9 +3576,49 @@
 			clear_parent();
 		}
 		break;
+	case TKEY:
+		if((G.qual==LR_CTRLKEY)) {
+			make_track();
+		} else if((G.qual==LR_ALTKEY)) {
+			clear_track();
+		}
+		break;
+	case XKEY:
+	case DELKEY:
+		if(G.qual==0) 
+			delete_context_selected();
+		
+	case DKEY:
+		if((G.qual==LR_SHIFTKEY)) {
+			duplicate_context_selected();
+		} else if(G.qual==LR_ALTKEY) {
+			if(G.obpose)
+				error ("Duplicate not possible in posemode.");
+			else if((G.obedit==0))
+				adduplicate(0);
+		}
 
-
-	case ONEKEY:
+	case JKEY:
+		if((G.qual==LR_CTRLKEY)) {
+			if( (ob= OBACT) ) {
+				if(ob->type == OB_MESH)
+					join_mesh();
+				else if(ob->type == OB_CURVE)
+					join_curve(OB_CURVE);
+				else if(ob->type == OB_SURF)
+					join_curve(OB_SURF);
+				else if(ob->type == OB_ARMATURE)
+					join_armature ();
+			}
+		}
+	case UKEY:
+		single_user();
+		
+	case CKEY:
+		if(G.qual==LR_CTRLKEY)
+			copy_attr_menu();
+	
+			case ONEKEY:
 		do_layer_buttons(0); break;
 	case TWOKEY:
 		do_layer_buttons(1); break;


Monkeyboi
Posts: 251
Joined: Tue Nov 26, 2002 1:24 pm
Location: Copenhagen, Denmark
Contact:

Post by Monkeyboi » Sat Jun 05, 2004 3:51 am

ideasman wrote:Yeah, thats the next thing Id like to add.

But somthing thats lacking in blender (AFAIK) Is the function to remove DATA blocks (One of my annoyances with blender)
Agreed, that would be great.
ideasman wrote:On Furt6her inspection blender realy needs a way to handle deleating of objects.

So you want to remove a mesh- What happens to the object that uses the mesh...
... Is it removed?? Then what happens to its children......
Does the next object in the list get used? Or a dummy object created?
kinda opens up a can or worms.
Ah yes, problematic. Could you have an object with no mesh/curve assigned to it? (This would be nicest in many ways so that you could temporarily unassign a datablock and assign a different one instead.) If not, it could jump to the next one.


How about adding the ability to set the ACTIVE object in the Oops? You only do this in the 3D view currently.

I'm doing a mockup, will slap it up here in a jiffy.

matt_e
Posts: 410
Joined: Mon Oct 14, 2002 4:32 am
Location: Sydney, Australia
Contact:

Post by matt_e » Sat Jun 05, 2004 3:55 am

Heh, well, I already wrote up my own thoughts on the issue last night, so here you go. The theme/graphical stuff is easy - let me know if you want a hand (I did most of the other stuff in the default theme).


Drag and drop:

There should be an 'output' UI control on every block (I guess something functionally like the current little square point) to drag a spline from one block to the other, as in crafter, realtime buttons, etc. Drag can occur from the 'output' control and connect up to other blocks. Upon dragging the spline, if the mouse is over a valid block to connect to, the block will highlight with a white border like what happens when dragging/docking panels. When the mouse is released over a valid panel, a context-sensitive popup menu appears, containing the available relationships that can be created between the two blocks.

For example, dragging...

Object block -> Scene block
Link Object to Scene
Mesh (or other obData) block -> Object block:
Link obData to object
Ipo block -> Object block:
Link Ipo to object
Material block -> Object block
Link material to object
Material block -> Mesh block:
Link material to mesh
Texture block -> Material block:
Add texture in the next available texture slot
Texture block -> Lamp block:
Add texture in the next available texture slot
Image Block -> Mesh block:
Use image as a UV texture, if there are UV co-ords
Image Block -> Material block:
Add an image texture in the next available texture slot

Object block -> Object block:
Parent object to object (destination object becomes the parent of the source object)
-----
Then a list of the available constraints

...

If the mouse pointer is over a spline, it should highlight, and allow you to 'pick up' the spline again by dragging it to a different block. When the spline is highlighted it can be erased (removing the relationship) by pressing delete or X. A method like in crafter would be cool, too - use a mouse gesture that cuts (intersects) the spline to remove the link.

Dragging and dropping should be used when creating relationships between datablocks. Other actions that manipulate the data rather than creating relationships, like copying attributes and joining objects, can be done through the standard menus.


Previews:

Ton is already starting a big project to re-do the preview rendering code, so perhaps it would be a good idea to wait until he's done (or at least mention to him to take possible usage in the OOPS into consideration) before thinking about things like previews. Thumbnails especially of materials, textures, images would be very useful though.


Misc:

A feature I'd love to see would be a viewing mode that positions the datablocks spatially, like you're looking through a blender view. i.e. like you're looking from a top view in the 3D View, the datablocks are positioned in the 2d OOPS window using their 3D X and Y co-ordinates. This would make it much easier to determine what object block is what, particularly if one hasn't been vigilant in naming everything :) It would also help to create a nice conceptual link between the abstract (OOPS) and the 'concrete' (3D View), helping people to understand the system.

There's a couple of other things that would be useful (posted this to the ML, but may as well mention it here too) that we can borrow from Shake :P One is a button to activate the selected object, another is a button to view the current object in any open 3D Views (like View Selected (NumPad .) in 3D View). These buttons would only appear on selected blocks.

Monkeyboi
Posts: 251
Joined: Tue Nov 26, 2002 1:24 pm
Location: Copenhagen, Denmark
Contact:

Post by Monkeyboi » Sat Jun 05, 2004 4:46 am

mockup:

Image

Using the same widgets as the logic bricks you can assign/unassign datablocks with each other. These specific object datablocks don't have a mesh datablock on them, although this would typically be the case. Idea of preview for materials and textures displayed.
You can use the arrow to minimise or maximise the blocks which are now renameable.

Comments?

Post Reply