editing the wiki

How can one edit the wiki? (I mean the one at panda3d.org/manual/ ). Sometimes, I wouldn’t mind updating the c++ sections as I read the manual. Is this possible at all?

That would be great, we’re always happy with good contributions!

Click the tiny blue dot in the lower left corner of the manual page. That should bring you to a login page, where there is a register link somewhere.

But before you edit anything, carefully read this page:
panda3d.org/manual/index.php/Talk:Main_page

Ok. I’ve translated to c++ just this page in “Procedurally Generating 3D Models”. Since it’s the first time, could somebody check my code conventions there before I edit other pages?

Looks great to me. Thanks!

Cool. Since it’s wiki related I didn’t want to create another post for this. Could you guys add this piece of css to the website:

<style>
pre.cpp {
 border-left : 2px solid orange;
 padding-left : 5px;
}
pre.python {
 border-left : 2px solid green;
 padding-left : 5px;
}
</style>

What is does is differentiate python snippets from c++ snippets with a thin coloured sidebar as shown in the image, python as green, c++ as orange.

It may seem silly but it would help finding out fast which sections are translated to c++ and which aren’t. It also helps quickly telling apart in which section you are and what code snippets are still using the old notation (cause those wouldn’t show any line at all.)

That sounds like a great idea, thanks! I’ve just added this to the stylesheet.

Thanks! I just noticed it.

Also, I just realized that the next code that I was gonna use crashes on exit (I hadn’t noticed cause I was stopping execution from my IDE).

I’ve reduced it as much as possible. This shows the triangle but after exiting the program an exception is thrown at the destructor of WeakReferenceList. Can you tell me if you spot any error? It wouldn’t be nice if I introduced a crasher in the manual…

#include "pandaFramework.h"
#include "pandaSystem.h"
#include "load_prc_file.h"
#include "geomTriangles.h"
#include "genericAsyncTask.h"
#include "asyncTaskManager.h"
 
PandaFramework framework;

int main(int argc, char *argv[]) {
// Open a new window framework and set the title
framework.open_framework(argc, argv);
framework.set_window_title("My Panda3D Window");

// Open the window
WindowFramework *window = framework.open_window();
window->setup_trackball();
PT(GeomVertexData) vdata;

vdata = new GeomVertexData("name", GeomVertexFormat::get_v3(), Geom::UH_static);
GeomVertexWriter vertex, normal, color, texcoord;
vertex = GeomVertexWriter(vdata, "vertex");

vertex.add_data3f(0, 0, 0);
vertex.add_data3f(1, 0, 0);
vertex.add_data3f(1, 0, 1);

PT(GeomTriangles) prim;
prim = new GeomTriangles(Geom::UH_static);

prim->add_consecutive_vertices(0,3);
prim->close_primitive();

PT(Geom) geom;
geom = new Geom(vdata);
geom->add_primitive(prim);

PT(GeomNode) node;
node = new GeomNode("gnode");
node->add_geom(geom);

NodePath nodePath = 
window->get_render().attach_new_node(node);
nodePath.set_pos(0,0,0);  

framework.main_loop();
framework.close_framework();
return (0);
}

That code looks fine to me, and in fact it does not crash for me.

Perhaps you’ve hit the same problem we just discovered in another thread–is NDEBUG defined in your project? If so, take it out.

David

Yeah, it was that. Thanks!

I finished translating the section “Procedurally Generating 3D Models”.
I’m thinking of improving the index a little, by indicating which sections are Python-specific or c+±specific and marking the c++ sections that still have python code. This will allow me to better track progress as I translate stuff every once in a while, is that ok?

EDIT: Ugh, I noticed the following comment in the TOC:

Note: this table of contents is scanned and processed by
a number of scripts. It must be kept in a rigid format.
Try not to put [cxx] and [python] tags here - it might
confuse the automatic scripts.

So could you tell me how to add annotations to the right of each title in a way that doesn’t break said scripts?

EDIT2: I was testing events in panda so I went to translate the events section to c++ but I don’t know what’s the equivalent of “doMethodLater”, is there no such thing in c++?

EDIT3: @pro-rsoft: I realized that I made a poor choice of colors. I think we should use blue for c++ and orange for python. The reason is simple, python keywords are orange and c++ keywords are blue. So when I look at a python sample and see all that orange sometimes I mistake it for a c++ block until I read the content.

Here it is the updated snippet. It’s 10 times better this way, you’ll see.

pre.cpp {
 border-left : 2px solid blue;
 padding-left : 5px;
}
pre.python {
 border-left : 2px solid orange;
 padding-left : 5px;
} 

You shouldn’t add [cxx] or [python] tags to the front page. What kind of annotations do you really need to make?

doMethodLater is the same as creating a normal task and calling set_delay.

Thanks, I’ve fixed the stylesheet.

Thanks for the answer. Basically, I just wanted to add a mark like “*” to the sections that haven’t been translated to c++. For a gradual community process like this I really think it’s good to have a global, immediate view of the progress. (It also works as a motivation because it encourages people to translate a section to get rid of those *.)

Do you think that if I changed some sections from:

  • [[Starting Panda3D]]

    To

  • [[Starting Panda3D]]*

    The parser scripts would break? I’m thinking the scripts probably read inside the double brackets so they should ignore that asterisk. I just need confirmation from somebody with access to those scripts. (Or are they visible somewhere?)

  • I translated the tasks section to c++, I’m gonna need somebody to review it since tasks don’t translate orthogonally from python to c++.

    panda3d.org/manual/index.php/Tasks

    Some things I want to note specifically:

    1. I skipped the Do-later section in c++ but I included a stub clarifying in case a Python user was looking for it. But this means that some things are explained in a different order. I think the c++ section order is more logical now anyway.

    2. The wake_time warning is absent from c++ because I don’t think you can change it directly in c++ at least I didn’t see how. But this is weird, how does the python binding manage to allow you to change this if it isn’t possible in c++? Is this just something that has been removed recently or something?

    3. There’s no way to directly print the tasks in c++ so I provided a snippet that iterates the collection returned by get_active_tasks(), is this snippet thread safe? Do we have some kind of locking mechanism so that you can make sure the task still is at that pointer when you are gonna print it?

    4. I’m using std::cout as a means to printing, do we have another preferred standard or are we ok with that?

    5. I assumed task->remove() is an OK way to remove tasks so I didn’t provide an example to remove tasks via taskMgr->remove(task).

    6. In the set_upon_death() big example at the end, for the task stopper task I pass the task as an argument and then I cast it back in the function as a regular c++ pointer, i.e: ((GenericAsyncTask*)data)->remove(); Is there a more preferred way to do this?

    Many thanks! This is great stuff.

    Sounds fine. For the record, the set_delay() function is also available in Python, but we provide doMethodLater() there mainly for historical reasons, and also as a convenience (it saves one line of typing).

    I like the improved order too. I was never really happy with the task page of the manual, and I think it needs to be rewritten from the ground up one day. The problem with it is that it doesn’t really live up to the Panda manual standards: it should introduce the concept of tasks and the TaskManager carefully; it should explain why you would want tasks and how they work; it should at least mention all of the high-level interfaces that tasks provide (especially task chains), and it should eventually introduce threading as an advanced concept and talk about tasks with respect to threading. It should explain the actual interfaces as it introduces the concepts, with perhaps an additional page at the end to recap the interfaces in a convenient reference. Obviously, this would demand a whole chapter of the manual instead of a single page. (And why shouldn’t it? Tasks are hugely important!)

    It doesn’t do any of this at the moment. Instead, it reads like a typical wiki page: a list of interfaces you might be interested in, in a random order, without a lot of context.

    But, that’s still way better than no information at all; and before yesterday, it didn’t even do that properly, because it left C++ users completely in the dark! So, thank you for fixing this. :slight_smile:

    Right, this is no longer possible in Python either, as of version 1.6.x.

    Actually, you can directly print the tasks in C++ using:

    taskMgr->write(cout);

    Many Panda objects have a write() method like this; and this is equivalent to “print taskMgr” in Python.

    But, for the record, your snippet is indeed thread-safe, at least in a sense, because get_active_tasks() returns a copy of the task list at the time of the call. So the loop will correctly print all of the tasks that were active at the time of the get_active_tasks() call, even though by the time some of them are actually printed it’s possible that they will no longer be active.

    That’s what we use too. You can also use nout, which stands for “notify out” and is Panda’s normal log output object. This is the stream to which all of Panda’s “notify” (log) messages are written, and it normally maps to cerr, but it can be redirected to anywhere else.

    Either interface is acceptable, both in Python and in C++. The taskMgr->remove(task) is the older interface, which may be why it is the only one mentioned in the Python manual. It also allows you to remove a task by name, which is sometimes a convenience.

    Nope, that’s pretty much what the extra argument is for. If you’re referring to the casting, though, Panda does provide its own equivalent to dynamic_cast with the DCAST macro (Panda itself predates this feature in C++), which would be something like DCAST(GenericAsyncTask, data), but that can’t actually be used in this case because you’re starting from a void pointer instead of a TypedObject-derived pointer.

    David

    huge thanks for your work on the manual. may the great panda reward you with a hug :smiley:

    Thanks for the clarifications drwr. Yeah, I assumed that section was still work in progress, you can tell because at some point it’s mentioned that “task chains” will be explained in the next section but they are never explained. I’m not confident enough with the engine yet to add that kind of stuff, so for now I’ll just translate the current text to c++. Also, since the source code for the python and c++ manual is shared it would be trivial for other person to improve both of them at the same time, so the work is not wasted.

    I removed the snippet to iterate the tasks, and introduced the write() method (I didn’t see it because I just tried output() on the collection).

    Anyway, can I do the following renames on sections so that they are language agnostic? (Kinda necessary since we can’t use language specifiers in the index)

    “How to use a Python Editor” -> “Setting up your IDE”
    “Using Command Prompt to Run your Program” -> “Running your program”

    That way we can explain python IDE’s in the python mode and c++ IDE in the c++ mode. Also this would provide a more obvious place to explain c++ setup. (Right now it’s in a link inside the first part of the hello world section).

    If you want to avoid the term IDE we could use “editor”, “development tools”, etc.

    Sounds great to me. You can rename pages by clicking the “move” button at the bottom of the page. Don’t forget to update the link at the main page.

    It’s gonna be a bit tricky when we get to the DirectGui pages. We might just put more descriptive titles (like “Scrolled Frame” rather than “DirectScrolledFrame”), or we might just make a separate PGui section and add a “skip” link to the C++ side of the DirectGui page.

    Thanks for your great work on the manual!

    Hi, I like the idea to help with the manual ( thanks Gogg for pointing it out ).
    Just started carefully and updated
    http://www.panda3d.org/manual/index.php/Text_Fonts
    Can somebody check it for errors ?

    One question: Is it allowed to add a #include “headerfilename.h”, to point out the correct name of the header file in question ?
    for example:

    [cxx]

    #include DynamicTextFont
    PT(DynamicTextFont) font=FontPool::load_font(“arial.ttf”);
    font->set_pixels_per_unit(60);

    [/cxx]

    I found it a bit annoying to have to go to the include folder all the time, to find the correct header file name.

    Panda3D Manual: Text Fonts
    Panda3D Manual: Text Node
    updated just to find out how the wiki is edited.
    Since I have been struggling with PGUI, I would like to pick up the task to add that to the manual.
    Unfortunately, I still don’t master the PGUI completely so I’ll do some more experimenting with it. If there is already useful information on it, I would like to know about it.

    Hm. Not a lot of response.
    Well, the PGui button seems to be very unstable.
    Even with a simple Pgui button it will crash sooner or later when it’s clicked on, also when I use a callback function that does nothing at all.

    I’ll leave the whole class alone and make something myself.