Panda diagrams - tutorial material.

Hi.

After discussing it with rdb, I went ahead and added these to the documentation section, cause they are too nice and shiny to hide them in several places of the manual. (Although we should also include them in the relevant chapters). Hope you don’t mind.

panda3d.org/documentation.php

Feel free to keep them updated there. I would suggest you to only keep them in that place and just link to them in your private space. (Except for WIP).

I’m calling them cheat sheets which is quite trendy. I also added some quick reference sheets from the BVW course, with a warning that they might out updated.

Hi, that’s great news. I am glad they passed muster :slight_smile:

I think I will keep using p3dp until the ‘cheats’ are done, and I’ll update (as you suggested) the wiki as I go more slowly, because I am still jumping around the SVG space like a wild thing.

Good plot. I will so adjust.

I fetched them, just in case they help the process.

Well, I am dong a ‘camera’ cheat at the moment, so let me get back to that.

One day I might actually write some code :slight_smile:

\d

PS - Liking the new site look. Although I do miss the bamboo.

New ‘cheat’ added (to p3dp, link in OP) - Camera diagram.

This one took ages. I hope it’s okay. Have at it!

HNY all.
\d

Camera diagrams updated and added.

Should I post on end of this thread or just update the OP for update notices?

\d

You can go ahead and update the manual directly with the new stuff if you prefer. Then, updating the first post would suffix, and it would be more usable for new users. (Although if you have brand new stuff you should post a new reply too, don’t be shy to triple-post and the like, since it’s become an utility thread).

EDIT: Also, maybe this is too much to ask, but could we have language-neutral diagrams? i.e: Provide C++ code along every piece of Python code? You could use color hinting if you want to make it clearer. Our current standard is orange for python and blue for C++, but now that I think about it maybe it should be green for python. (I chose those colors cause they went better with the color syntax colouring we had for both languages.) In any case, if you choose to use colors I may update the styles on the manual accordingly.

I’ll help with the C++ translations if you like the idea.

My thinking is that it’s still in flux and can be criticized and fixed more efficiently via p3d3 for now. Better to catch bugs before it goes to the manual, no?

Also, uploading attachments via a wiki interface is a pita :slight_smile:

Lol, it’s anything goes! Okay, I am not a forum expert so I think I’ll just keep growing the tail because then there’s some relation to feedback.

This could be done, but it would be tricky for a few reasons: chiefly that I am really a cheeky newb to Panda and these diagrams are a result of my own attempt at grokking things. C++ is a mystery to me, so I would suffer trying to both at once.

However, if you would not mind making a copy of the SVG source and hacking it to show me what you have in mind, that would give me a chance to see what’s involved: for example; it might be best to have 2 diagrams for each ‘sheet’ (one C++, one Python) or it may be that only a few need such treatment.

\d
PS - Anyone have crits/bugs/comments on the new camera diagrams at all?

I have one: I think you misunderstood the inheritance hierarchy a bit. Camera does indeed inherit from LensNode, but LensNode does not inherit from PerspectiveLens, and thus a Camera is not actually its lens. The LensNode (and thus Camera) is a container for a lens, not itself a lens; and this is why you can replace the lens with a setLens() call.

David

Yeah, don’t worry, you don’t need to know much about C++, as me or others could provide the translations. Take this diagram, for example:

I would tell you the C++ equivalents of the code, and for every code block you would have too lines, like:

[Python] cube.setH (h)
[CXX] cube.set_h (h);

Instead of Python you could use a snake head and for Cxx a small C++ icon would do, to keep your style.

Now, the policy around here has been that since translating from python to c++ is straightforward, not having the C++ form is OK. Before this is brought up I want to say that this is something I want to avoid. Why would you use a C++ framework where you have to “make educated guesses” when you can use a C++ framework where you don’t have to. C++ is what most professional users use so these diagrams would be a really nice push for Panda’s popularity if they were 100% language neutral (sorry, just trying to get across why I’m being so insistent on language neutrality.)

So, shall I make you the list of c++ modifications for all the current diagrams? Not everything is as straightforward as that, some features are nonorthogonal (hope I didnt make up a word) across APIs.

Ah, magic. I have fixed it. Hope it’s better now.

\d

Please do. Use the SVG source if you can. Email it to me and I will see what we can do.

Good word; whatever it means! I am a little concerned, as you say, that the API and conceptual approaches between Python and C++ may differ in places. Let’s take them as they come.

\d

We could use the SVG versions and then have a little client with librsvg that renders them, after filling in the code using a template system. Then again, I don’t think that it’s worth it since in many cases the visual arrangement will change in c++ due to the fact that there’s more stuff to explain, just throwing it out there.

In any case, is it OK if I just provide translations and annotations in text form for every image, in this thread? Cause you mention that I use the SVG but I’m not sure if that’s even necessary.

EDIT: Uh, while updating the image links to external urls I may have included images that you consider WIP. Feel free to modify it.

Heh. I think the same way about automating stuff, but it always ends up in a half-written project that quickly got more complex than I could ever imagine!

Yes, there are conceptual differences.

Please do it whatever way you feel most comfortable with. I will be able to judge how to do it in SVG once I see what you do.

Thanks. I’ll check it out.

\d

New diagram added in the “Parenting” section on p3dp: Climbing node trees.

Also fixed some bugs in the Orthographic lens diagram. Could someone check it for me?

I may be away for a day or two, so please have a look and drop a line if you see any bugs.

I will do one covering find() and company soon.

\d

Here are some translations, enough to try stuff for the moment. I’ll use a diff-like syntax, where - indicates the current python text and + indicates the c++ one.

dotherwise.p3dp.com/diagrams/PandaNodes.png

Unchanged.

dotherwise.p3dp.com/diagrams/NodePaths.png

-handle = NodePath(“a_name”)
+NodePath handle(“a_name”);

-handle = NodePath(pNode)
+NodePath handle(pNode);

-pNode = handle.node()
+PT(PandaNode) pNode = handle.node();

Here you could add a note like this: In C++, PT means “Pointer To”, it’s a Panda3D macro to designate reference-counted objects."

-empty = NodePath(“zip_nada”)
+NodePath empty = NodePath(“zip_nada”);

-null = NodePath()
+NodePath nullNode;

OT: This part is very confusing, you say that null=nodepath is an “empty” nodepath but then in the last piece of code you referred to your blank nodepath as “empty”. I suggest you replace “empty” with “blank” in “empty = NodePath(“zip_nada”)” and rename “null” to empty, since “null” usually means something that equals 0.

I have to think about the next ones.

I have made that fix. Thanks, it was confusing.

As to the C++ stuff, I want to find a solution and am playing around with options; however I am going into hospital soon, so I may not be back on the forum for an unknown period. Please be patient and continue posting (or emailing me) and I will attend to it when I am back in the saddle.

\d

Nothing serious, right?

Just wanted to thank you for your diagrams, helped me a lot to understand stuff better.

I dunno (yet.)
On the side, I asked for a new brain but the Doctor said they had no viable donors because my skull is so small. :smiley:

Thanks, that means a lot - glad they helped.

\d

UPDATE

I’ve added the SVG source file of those diagrams to my Google Drive. The url is:
drive.google.com/file/d/0ByXVQD … NiSlk5c1U/

AFAIK - that should take you to it.

The licence is CC BY NC SA, so there’s that.