EditorFactory - Module for object management in a Canvas
Re: EditorFactory - Module for object management in a Canvas
I will take a look this weekend.
PB 6.01 ― Win 10, 21H2 ― Ryzen 9 3900X, 32 GB ― NVIDIA GeForce RTX 3080 ― Vivaldi 6.0 ― www.unionbytes.de
Lizard - Script language for symbolic calculations and more ― Typeface - Sprite-based font include/module
Lizard - Script language for symbolic calculations and more ― Typeface - Sprite-based font include/module
Re: EditorFactory - Module for object management in a Canvas
Writing an SaveObject/LoadObject is not that easy.
Storing all static or numeric properties is no problem, but there is a problem when you use callbacks, custom cursors, or objects with frames:
Storing all static or numeric properties is no problem, but there is a problem when you use callbacks, custom cursors, or objects with frames:
- In case of callbacks, I cannot save just the callback pointer, how it is stored during runtime. Because, such pointer become invalid after restarting the program. So, callbacks have to stored by names, but then you (or we) need the Runtime-Library of PureBasic and define callbacks via "Runtime Procedure RuntimeProcedure()" to have access via GetRuntimeInteger("RuntimeProcedure()"). Here, the string can be then saved in a file. This way would be fine for me.
- In case of custom cursors for the objects and the handles, I have no idea how to store such information into the file. The only why I see here, is to save the corresponding image as base64 encoded data.
- In case of objects with frames, the question is, if child objects should saved as well. And if, should they keep their object numbers? Or should they have new unique numbers after loading.
PB 6.01 ― Win 10, 21H2 ― Ryzen 9 3900X, 32 GB ― NVIDIA GeForce RTX 3080 ― Vivaldi 6.0 ― www.unionbytes.de
Lizard - Script language for symbolic calculations and more ― Typeface - Sprite-based font include/module
Lizard - Script language for symbolic calculations and more ― Typeface - Sprite-based font include/module
-
- Enthusiast
- Posts: 480
- Joined: Thu Jul 27, 2006 4:06 am
Re: EditorFactory - Module for object management in a Canvas
1) I thought the structure would be simpler but the project is quite complex for me I did notice pointers could be an issue if strings could be used to reference them in this way then that's a viable solution!
2) The idea of using base64 is fine you could also just have the path to the file and recognize when the string is a base64 data set by reading the first token just as they do in html. the cool thing about base64 images is that everything becomes self-contained but it may not be the ideal choice for some programs.
3) I would imagine all created objects should be stored and loaded properly retaining all of the original information.
all of this is easier said than done!
2) The idea of using base64 is fine you could also just have the path to the file and recognize when the string is a base64 data set by reading the first token just as they do in html. the cool thing about base64 images is that everything becomes self-contained but it may not be the ideal choice for some programs.
3) I would imagine all created objects should be stored and loaded properly retaining all of the original information.
all of this is easier said than done!
should I bash the keyboard and give up?
Re: EditorFactory - Module for object management in a Canvas
Short intermediate verbal update:
- I have changed the callback functions to string arguments:
With this, it is possible to save such a string during object export. During runtime, a normal callback pointer is save as well via GetRuntimeInteger(CallbackName). This method works fine without performance drawbacks.
Code: Select all
Runtime Procedure Callback_Function(Object.i, Width.i, Height.i, iData.i) EndProcedure ;... SetObjectDrawingCallback(#Object, "Callback_Function()")
- In case of handles with images, the images are stored as base64 strings within the JSON. Works fine as well. However, currently all images are saved individually, even if they have the same sources, making the export size huge. This has to be optimized.
- SaveObject() can be used in future to save single objects, all selected objects or all object within a canvas.
- LoadObject() can be used in future to load single objects (while defining a new object id) or multiple objects (while used their exported object IDs).
PB 6.01 ― Win 10, 21H2 ― Ryzen 9 3900X, 32 GB ― NVIDIA GeForce RTX 3080 ― Vivaldi 6.0 ― www.unionbytes.de
Lizard - Script language for symbolic calculations and more ― Typeface - Sprite-based font include/module
Lizard - Script language for symbolic calculations and more ― Typeface - Sprite-based font include/module
-
- Enthusiast
- Posts: 237
- Joined: Tue Feb 14, 2017 12:07 pm
Re: EditorFactory - Module for object management in a Canvas
so now it will be possible to create its own function of cancellation and restoration of objects, very nice work!
But how to do it ?
For example, only certain objects, or the selected objects if it has some, or all the objects.
And how to do, for example, as soon as there is a change, make a backup....
Not simple but I trust you for that.
great work STARGÅTE
But how to do it ?
For example, only certain objects, or the selected objects if it has some, or all the objects.
And how to do, for example, as soon as there is a change, make a backup....
Not simple but I trust you for that.
great work STARGÅTE
I am French, I do not speak English.
My apologies for the mistakes.
I have sometimes problems of expression
I am sometimes quite clumsy, please excuse me and let me know.
My apologies for the mistakes.
I have sometimes problems of expression
I am sometimes quite clumsy, please excuse me and let me know.
Re: EditorFactory - Module for object management in a Canvas
Dear all,
here is the feature request update for a load and save function for objects.
@superadnim: Please check out, if this works for you. Any feedback is welcome.
New Version 1.18.01
EditorFactory.pbi (Version 1.18.01, 2023-02-04)
EditorFactory-1-18-01.zip (Archive with include and examples)
The include is shared under the CC BY-NC 4.0 licence.
here is the feature request update for a load and save function for objects.
@superadnim: Please check out, if this works for you. Any feedback is welcome.
New Version 1.18.01
- Added: LoadObject and SaveObject
- Added: Example #7: Example07_SaveAndLoad.pb
- Changed: SetObjectDrawingCallback() needs now the string name of the callback function and keyword Runtime befor Procedure is needed.
EditorFactory.pbi (Version 1.18.01, 2023-02-04)
EditorFactory-1-18-01.zip (Archive with include and examples)
The include is shared under the CC BY-NC 4.0 licence.
PB 6.01 ― Win 10, 21H2 ― Ryzen 9 3900X, 32 GB ― NVIDIA GeForce RTX 3080 ― Vivaldi 6.0 ― www.unionbytes.de
Lizard - Script language for symbolic calculations and more ― Typeface - Sprite-based font include/module
Lizard - Script language for symbolic calculations and more ― Typeface - Sprite-based font include/module
Re: EditorFactory - Module for object management in a Canvas
Thanks for the new version. I hope you will add the (actual design of the splitter object), redo and undo in the future versions.
-
- Enthusiast
- Posts: 237
- Joined: Tue Feb 14, 2017 12:07 pm
Re: EditorFactory - Module for object management in a Canvas
Hello, cancel and restore is already possible with these functions !
for your request, I may have misunderstood, but I do not think it is useful ?
Can you give some examples ?
I am French, I do not speak English.
My apologies for the mistakes.
I have sometimes problems of expression
I am sometimes quite clumsy, please excuse me and let me know.
My apologies for the mistakes.
I have sometimes problems of expression
I am sometimes quite clumsy, please excuse me and let me know.
-
- Enthusiast
- Posts: 237
- Joined: Tue Feb 14, 2017 12:07 pm
Re: EditorFactory - Module for object management in a Canvas
Although it is possible to do it, it is not as simple as that, so maybe your idea will be integrated later but it will take a lot of work.
Last edited by ShadowStorm on Thu Feb 09, 2023 11:08 pm, edited 1 time in total.
I am French, I do not speak English.
My apologies for the mistakes.
I have sometimes problems of expression
I am sometimes quite clumsy, please excuse me and let me know.
My apologies for the mistakes.
I have sometimes problems of expression
I am sometimes quite clumsy, please excuse me and let me know.
-
- Enthusiast
- Posts: 237
- Joined: Tue Feb 14, 2017 12:07 pm
Re: EditorFactory - Module for object management in a Canvas
A new version should be available soon with some corrections.
I am French, I do not speak English.
My apologies for the mistakes.
I have sometimes problems of expression
I am sometimes quite clumsy, please excuse me and let me know.
My apologies for the mistakes.
I have sometimes problems of expression
I am sometimes quite clumsy, please excuse me and let me know.
-
- Enthusiast
- Posts: 480
- Joined: Thu Jul 27, 2006 4:06 am
Re: EditorFactory - Module for object management in a Canvas
fantastic!
one note: when testing the save/load example it somehow removes the top element whenever I load the json file
otherwise it all seems to work fine
I think this feature ties the whole lib together
one note: when testing the save/load example it somehow removes the top element whenever I load the json file
otherwise it all seems to work fine
I think this feature ties the whole lib together
should I bash the keyboard and give up?
Re: EditorFactory - Module for object management in a Canvas
Yes that is right (and a feature). The top element has a fixed ID (1) which is also saved in the JSON file. If you now load this file, EditorFactory creates new elements, but overrights the element with number 1 similar to CreateObject.superadnim wrote: ↑Wed Feb 22, 2023 12:27 am one note: when testing the save/load example it somehow removes the top element whenever I load the json file
However, I will also publish a small bug-fix version soon to fix related issues.
PB 6.01 ― Win 10, 21H2 ― Ryzen 9 3900X, 32 GB ― NVIDIA GeForce RTX 3080 ― Vivaldi 6.0 ― www.unionbytes.de
Lizard - Script language for symbolic calculations and more ― Typeface - Sprite-based font include/module
Lizard - Script language for symbolic calculations and more ― Typeface - Sprite-based font include/module
-
- Enthusiast
- Posts: 237
- Joined: Tue Feb 14, 2017 12:07 pm
Re: EditorFactory - Module for object management in a Canvas
Hello, I am working on some examples, but they will be in French.
- Saving and loading objects in a canvas. = finished
- Undo and restore changes in the editor. = finished
- Cut, copy, paste objects in the editor. = finished
- Creating a small object editor with code generation. = finished
- Saving and loading objects in a canvas. = finished
- Undo and restore changes in the editor. = finished
- Cut, copy, paste objects in the editor. = finished
- Creating a small object editor with code generation. = finished
I am French, I do not speak English.
My apologies for the mistakes.
I have sometimes problems of expression
I am sometimes quite clumsy, please excuse me and let me know.
My apologies for the mistakes.
I have sometimes problems of expression
I am sometimes quite clumsy, please excuse me and let me know.
Re: EditorFactory - Module for object management in a Canvas
where are these examples?ShadowStorm wrote: ↑Fri Feb 24, 2023 2:02 am Hello, I am working on some examples, but they will be in French.
- Saving and loading objects in a canvas. = finished
- Undo and restore changes in the editor. = finished
- Cut, copy, paste objects in the editor. = finished
- Creating a small object editor with code generation. = finished
-
- Enthusiast
- Posts: 237
- Joined: Tue Feb 14, 2017 12:07 pm
Re: EditorFactory - Module for object management in a Canvas
Hello mestnyi,
These examples are not yet shared at this time, moreover they are in French as I said.
I have many other examples to give and all are in French but I need to clean up and reorganize them.
Moreover, some of the new examples will have to be revised as soon as certain functionalities that I asked for will be added, I think in a short time depending on the availability of Stargate, that's why I'm waiting a little.
I think I will put the new examples the day of the release of a new version of Editor Factory, Stargate didn't have time to see them too.
And since people don't seem to be interested, I'll wait too.
I want to say that the examples I make are always very well documented in comments, trying to make good examples, it takes time but I like when things are well done.
I'm also looking for people who would be interested in translating my examples from French to English and correcting spelling in the process.
These examples are not yet shared at this time, moreover they are in French as I said.
I have many other examples to give and all are in French but I need to clean up and reorganize them.
Moreover, some of the new examples will have to be revised as soon as certain functionalities that I asked for will be added, I think in a short time depending on the availability of Stargate, that's why I'm waiting a little.
I think I will put the new examples the day of the release of a new version of Editor Factory, Stargate didn't have time to see them too.
And since people don't seem to be interested, I'll wait too.
I want to say that the examples I make are always very well documented in comments, trying to make good examples, it takes time but I like when things are well done.
I'm also looking for people who would be interested in translating my examples from French to English and correcting spelling in the process.
I am French, I do not speak English.
My apologies for the mistakes.
I have sometimes problems of expression
I am sometimes quite clumsy, please excuse me and let me know.
My apologies for the mistakes.
I have sometimes problems of expression
I am sometimes quite clumsy, please excuse me and let me know.