mirror of https://github.com/Poikilos/b3view
icon, install scripts, mime type, lowercase name
parent
94e3b8f883
commit
14cd5315cf
27
CHANGELOG.md
27
CHANGELOG.md
|
@ -1,14 +1,24 @@
|
|||
# Changelog
|
||||
|
||||
## [git] - 2019-03-06
|
||||
(first poikilos commit, based on https://github.com/egrath)
|
||||
(poikilos)
|
||||
### Added
|
||||
* created install.sh and install.bat, and added Install and Usage
|
||||
to README.md
|
||||
* icon, install scripts, and mime type (`model/b3d`)--see README.md
|
||||
### Changed
|
||||
* The program can now start without "test.b3d" in the current working
|
||||
directory (fixed Segmentation Fault).
|
||||
* set `TARGET = b3view` in B3View.pro, so that binary is lowercase as
|
||||
per usual Linux naming conventions.
|
||||
|
||||
## [git-94e3b8f] - 2019-03-06
|
||||
(poikilos)
|
||||
### Added
|
||||
(CGUITTFont methods are in CGUITTFont class unless otherwise specified)
|
||||
* README.md
|
||||
* .gitignore (a [Qt .gitignore](https://github.com/github/gitignore/blob/master/Qt.gitignore))
|
||||
|
||||
### Changed
|
||||
* changed `#include <irrlicht.h>` to `#include <irrlicht/irrlicht.h>`
|
||||
(CGUITTFont methods are in CGUITTFont class unless otherwise specified)
|
||||
* fixed instances of "0 as null pointer constant" (changed to `nullptr`)
|
||||
* changed inconsistent use of spaces and tabs (changed tabs to 4 spaces)
|
||||
* (UserInterface.cpp) fixed "logical not is only applied to the left hand side of this comparison..." (put parenthesis around `event.EventType == EET_GUI_EVENT`)
|
||||
|
@ -27,3 +37,12 @@
|
|||
|
||||
### Removed
|
||||
* arial.tff removed, since it may be the "real" Arial font, which has a proprietary license
|
||||
|
||||
## [git-d964384] - 2019-03-06
|
||||
### Changed
|
||||
(first poikilos commit, based on https://github.com/egrath)
|
||||
* changed `#include <irrlicht.h>` to `#include <irrlicht/irrlicht.h>`
|
||||
|
||||
### Added
|
||||
* .gitignore (a [Qt .gitignore](https://github.com/github/gitignore/blob/master/Qt.gitignore))
|
||||
* CHANGELOG.md
|
||||
|
|
|
@ -123,7 +123,7 @@ Engine::Engine()
|
|||
m_Scene = m_Device->getSceneManager();
|
||||
|
||||
wstringstream windowTitle;
|
||||
windowTitle << L"Blitz3D Viewer [" << m_Driver->getName() << L"]";
|
||||
windowTitle << L"b3view (Blitz3D/Irrlicht Viewer) [" << m_Driver->getName() << L"]";
|
||||
m_Device->setWindowCaption( windowTitle.str().c_str() );
|
||||
|
||||
setupScene();
|
||||
|
|
55
README.md
55
README.md
|
@ -3,15 +3,58 @@ View B3D files (and possibly other files supported by Irrlicht).
|
|||
|
||||
This is a modernized fork by poikilos (see CHANGELOG.md).
|
||||
|
||||
## Installation
|
||||
* Open .pro file in Qt Creator
|
||||
## Compiling
|
||||
* Make sure you have the Irrlicht and Qt development packages
|
||||
(such as via `sudo dnf -y install qt-devel qt-creator irrlicht-devel`
|
||||
on Fedora 29)
|
||||
* Open Qt Creator, click File, Open, then choose this project's .pro
|
||||
file.
|
||||
* Build & Run (if you have trouble compiling, see
|
||||
[filehandoff#compiling-issues](https://github.com/poikilos/filehandoff#compiling-issues))
|
||||
* Copy all of the files from `./build` to your actual build directory,
|
||||
if your build directory is not `./build`
|
||||
* Copy your favorite font to `./build/arial.tff` (Arial is not included
|
||||
due its proprietary license).
|
||||
* Copy your favorite font to `./build/arial.tff` _(Arial is not included
|
||||
due it possibly being the "real" Arial, which has a proprietary
|
||||
license)_.
|
||||
|
||||
## Installation
|
||||
### Windows
|
||||
* copy install.bat to your build directory if you are not using a
|
||||
release version.
|
||||
* double-click install.bat (read any messages that appear then press
|
||||
a key to continue when prompted).
|
||||
* Associate the b3d file extension (and possibly other Irrlicht-
|
||||
compatible 3D mesh formats) with
|
||||
`%USERPROFILE%\Applications\b3view\b3view.exe` (right-click a b3d
|
||||
file, then Open With, show additional programs, then either paste that
|
||||
path or choose This PC, C:, Users, your username, Applications,
|
||||
b3view, b3view.exe)
|
||||
|
||||
### GNU/Linux Systems
|
||||
* copy install.sh to your build directory if you are not using a release
|
||||
version and your build directory is not `./build`
|
||||
* run install.sh as root, such by running `sudo bash install.sh` in
|
||||
Terminal from the project directory (if you are not root, the install
|
||||
will install to $USER/Applications after giving an opportunity to
|
||||
cancel with Ctrl C during a countdown).
|
||||
(the script will install the "Blitz3D Model File" (`model/b3d`) mime
|
||||
type, which will be used for all files with the `b3d` extension--
|
||||
this allows associating the file type with a program).
|
||||
* Associate the b3d file extension (and possibly other Irrlicht-
|
||||
compatible 3D mesh formats) with b3view: Right-click any B3D file,
|
||||
"Open With...", find or type b3view, then check "Remember
|
||||
application..." or "Set as default..." or something similar depending
|
||||
on your desktop environment (an option to always use the same program
|
||||
will only be available if the mime type was successfully installed for
|
||||
the user profile or system such as via install.sh).
|
||||
|
||||
|
||||
## Usage
|
||||
* File, Open
|
||||
* Choose an Irrlicht-compatible B3D file.
|
||||
* You can click "File," "Open.", then choose an Irrlicht-compatible B3D
|
||||
file. However, the program is much easier to use if you associate the
|
||||
format with b3view (see "Installation" above) so you can just double-
|
||||
click the file to open b3view automatically.
|
||||
|
||||
## Known Issues
|
||||
* Warn on missing texture.
|
||||
* Implement Start/Stop button functionality.
|
||||
|
|
|
@ -7,6 +7,14 @@ void Utility::dumpVectorToConsole( const vector3df &vector )
|
|||
|
||||
void Utility::dumpMeshInfoToConsole( IAnimatedMeshSceneNode *node )
|
||||
{
|
||||
if (node == nullptr) {
|
||||
debug() << "[MESH]: # node: nullptr" << endl;
|
||||
return;
|
||||
}
|
||||
if (node->getMesh() == nullptr) {
|
||||
debug() << "[MESH]: # node->getMesh(): nullptr" << endl;
|
||||
return;
|
||||
}
|
||||
// Dump some information about the mesh to the console
|
||||
IAnimatedMesh *mesh = node->getMesh();
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
CONFIG -= qt
|
||||
TARGET = b3view
|
||||
DESTDIR = build
|
||||
OBJECTS_DIR = tmp
|
||||
SOURCES += main.cpp \
|
Binary file not shown.
|
@ -0,0 +1,19 @@
|
|||
[Desktop Entry]
|
||||
Comment[en_US]=
|
||||
Comment=
|
||||
Exec=b3view
|
||||
GenericName[en_US]=Irrlicht Model Viewer
|
||||
GenericName=Irrlicht Model Viewer
|
||||
Icon=/usr/local/share/pixmaps/b3view.png
|
||||
MimeType=
|
||||
Name[en_US]=b3view
|
||||
Name=b3view
|
||||
Path=
|
||||
StartupNotify=true
|
||||
Terminal=false
|
||||
TerminalOptions=
|
||||
Type=Application
|
||||
X-DBUS-ServiceName=
|
||||
X-DBUS-StartupType=
|
||||
X-KDE-SubstituteUID=false
|
||||
X-KDE-Username=
|
|
@ -0,0 +1 @@
|
|||
/home/owner/git/build-b3view-Qt_5_10_1_System-Release/build/b3view
|
Binary file not shown.
After Width: | Height: | Size: 727 B |
|
@ -0,0 +1,9 @@
|
|||
SET THIS_EXE=b3view.exe
|
||||
SET PROGRAMS="%USERPROFILE%\Applications"
|
||||
IF NOT EXIST "%PROGRAMS%" MD "%PROGRAMS%"
|
||||
IF NOT EXIST "%PROGRAMS%\b3view" MD "%PROGRAMS%\Applications\b3view"
|
||||
echo.
|
||||
echo.
|
||||
IF NOT EXIST "%THIS_EXE%" ECHO ERROR: Nothing done since %THIS_EXE% not found--you must run this from the build directory
|
||||
COPY "%THIS_EXE%" ""
|
||||
pause
|
|
@ -0,0 +1,121 @@
|
|||
#!/bin/bash
|
||||
echo
|
||||
echo
|
||||
if [ -z "$PREFIX" ]; then PREFIX=/usr/local; fi
|
||||
dest_bin_dir="$PREFIX/bin"
|
||||
dest_share_dir="$PREFIX/share"
|
||||
project_unix_name=b3view
|
||||
dest_name=$project_unix_name
|
||||
src_path="$project_unix_name"
|
||||
try_dest_bin="$dest_bin_dir/$dest_name"
|
||||
icon_name="b3view.png"
|
||||
icon_src_path="icons/$icon_name"
|
||||
shortcut_name="org.poikilos.b3view.desktop"
|
||||
shortcut_src_path="applications/$shortcut_name"
|
||||
icons_root=$PREFIX/share/pixmaps
|
||||
applications_path=$PREFIX/share/applications
|
||||
|
||||
mime_name=model-b3d.xml
|
||||
mime_path="share/mime/packages/$mime_name"
|
||||
USER_MIMETYPES_DB_PATH=$HOME/.local/share/mime
|
||||
#USER_MIMETYPES_PATH="$USER_MIMETYPES_DB_PATH/packages"
|
||||
SYSTEM_MIMETYPES_DB_PATH=/usr/share/mime
|
||||
#SYSTEM_MIMETYPES_PATH=$SYSTEM_MIMETYPES_DB_PATH/packages
|
||||
MIMETYPES_DB_PATH=$SYSTEM_MIMETYPES_DB_PATH
|
||||
|
||||
|
||||
if [ ! -f $src_path ]; then
|
||||
echo "ERROR: Nothing done since missing $src_path"
|
||||
sleep 4
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -d "$try_dest_bin" ]; then
|
||||
echo "ERROR: nothing done since '$try_dest_bin' is a directory (should be deleted or a binary file of old version)"
|
||||
sleep 4
|
||||
exit 2
|
||||
fi
|
||||
|
||||
PROFILE_ENABLE=false
|
||||
if [ -f "$try_dest_bin" ]; then
|
||||
rm -f "$try_dest_bin"
|
||||
if [ -f "$try_dest_bin" ]; then
|
||||
echo "WARNING: can't remove old $try_dest_bin, so"
|
||||
PROFILE_ENABLE=true
|
||||
fi
|
||||
fi
|
||||
|
||||
cp -f "$src_path" "$try_dest_bin"
|
||||
|
||||
if [ ! -f "$try_dest_bin" ]; then
|
||||
PROFILE_ENABLE=true
|
||||
prev_dir="$dest_bin_dir"
|
||||
echo "WARNING: can't write to $prev_dir, so"
|
||||
fi
|
||||
if [ "@$PROFILE_ENABLE" = "@true" ]; then
|
||||
dest_bin_dir="$USER/.local/bin"
|
||||
echo "installing to '$dest_bin_dir'."
|
||||
echo "Press Ctrl C to cancel..."
|
||||
sleep 1
|
||||
echo "3..."
|
||||
sleep 1
|
||||
echo "2..."
|
||||
sleep 1
|
||||
echo "1..."
|
||||
sleep 1
|
||||
else
|
||||
echo "Successfully installed as '$try_dest_bin'"
|
||||
fi
|
||||
if [ "@$PROFILE_ENABLE" = "@true" ]; then
|
||||
if [ ! -d "$dest_bin_dir" ]; then mkdir "$dest_bin_dir"; fi
|
||||
cp -f $src_path "$dest_bin_dir/"
|
||||
icons_root="$USER/.local/share/icons"
|
||||
applications_path="$USER/.local/share/applications"
|
||||
MIMETYPES_DB_PATH="$USER_MIMETYPES_DB_PATH"
|
||||
fi
|
||||
if [ ! -d "$icons_root" ]; then
|
||||
mkdir -p "$icons_root"
|
||||
fi
|
||||
cp -f "$icon_src_path" "$icons_root/"
|
||||
if [ -f "$icons_root/$icon_name" ]; then
|
||||
echo "Successfully copied '$icons_root/$icon_name'"
|
||||
else
|
||||
echo "FAILED to install '$icons_root/$icon_name'"
|
||||
fi
|
||||
|
||||
if [ ! -d "$applications_path" ]; then
|
||||
mkdir -p "$applications_path"
|
||||
fi
|
||||
if [ "@$PROFILE_ENABLE" = "@true" ]; then
|
||||
if [ -f "$shortcut_src_path" ]; then
|
||||
cat "$shortcut_src_path" | grep -v Exec= | grep -v Icon= > "$applications_path/$shortcut_name"
|
||||
echo "Exec=$dest_bin_dir/$project_unix_name" >> "$applications_path/$shortcut_name"
|
||||
echo "Icon=$icons_root/$icon_name" >> "$applications_path/$shortcut_name"
|
||||
echo >> "$applications_path/$shortcut_name"
|
||||
else
|
||||
echo "ERROR: No icon installed since missing '$shortcut_src_path'"
|
||||
fi
|
||||
else
|
||||
cp -f "$shortcut_src_path" "$applications_path/"
|
||||
fi
|
||||
if [ -f "$applications_path/$shortcut_name" ]; then
|
||||
echo "Successfully copied '$applications_path/$shortcut_name'"
|
||||
else
|
||||
echo "FAILED to install '$applications_path/$shortcut_name'"
|
||||
fi
|
||||
|
||||
if [ ! -d "$MIMETYPES_DB_PATH/packages" ]; then
|
||||
# echo "Creating '$MIMETYPES_DB_PATH/packages'..."
|
||||
mkdir "$MIMETYPES_DB_PATH/packages"
|
||||
fi
|
||||
if [ -f "$mime_path" ]; then
|
||||
# echo "Copying as '$MIMETYPES_DB_PATH/packages/$mime_name'..."
|
||||
cp -f "$mime_path" "$MIMETYPES_DB_PATH/packages/"
|
||||
echo "Updating mime type database '$MIMETYPES_DB_PATH'..."
|
||||
update-mime-database "$MIMETYPES_DB_PATH" # must contain packages
|
||||
else
|
||||
echo "ERROR: $mime_path must be in working directory in order to install it using this script."
|
||||
fi
|
||||
|
||||
echo
|
||||
echo
|
|
@ -0,0 +1,9 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<mime-info xmlns="http://www.freedesktop.org/standards/shared-mime-info">
|
||||
<mime-type type="model/b3d">
|
||||
<comment>Blitz3D Model File</comment>
|
||||
<icon name="model-b3d"/>
|
||||
<glob-deleteall/>
|
||||
<glob pattern="*.b3d"/>
|
||||
</mime-type>
|
||||
</mime-info>
|
|
@ -0,0 +1,40 @@
|
|||
#!/bin/sh
|
||||
|
||||
#NOTES on the xml file:
|
||||
#see also https://developer.gnome.org/integration-guide/stable/mime.html.en
|
||||
#see also https://wiki.archlinux.org/index.php/default_applications#MIME_types
|
||||
# * note that mime-type tag is inside the mime-info tag (as per sites above)
|
||||
# * glob-deleteall "indicates that patterns from previously parsed directories must be discarded" - https://developer.gnome.org/shared-mime-info-spec
|
||||
|
||||
#NOTES on desktop file:
|
||||
#Desktop file installed in applications folder should include MimeType line such as:
|
||||
# MimeType=text/x-forwardfilesyncscript
|
||||
# to indicate to the system that the application can open the mimetype
|
||||
|
||||
|
||||
USER_MIMETYPES_DB_PATH=$HOME/.local/share/mime
|
||||
# formerly $HOME/.mime.types according to whtyger on
|
||||
# <https://unix.stackexchange.com/questions/270250/how-to-set-an-icon-for-custom-mimetype-in-linux-mint-mate>
|
||||
|
||||
USER_MIMETYPES_DB_PATH=$USER_MIMETYPES_DB_PATH/packages
|
||||
|
||||
SYSTEM_MIMETYPES_DB_PATH=/usr/share/mime/packages
|
||||
SYSTEM_MIMETYPES_DB_PATH=/usr/share/mime
|
||||
|
||||
#MIMETYPES_DB_PATH=$USER_MIMETYPES_DB_PATH
|
||||
#MIMETYPES_DB_PATH=$USER_MIMETYPES_DB_PATH
|
||||
#or alternatively, install system-wide at:
|
||||
MIMETYPES_DB_PATH=$SYSTEM_MIMETYPES_DB_PATH
|
||||
|
||||
if [ ! -d "$MIMETYPES_DB_PATH" ]; then
|
||||
mkdir "$MIMETYPES_DB_PATH"
|
||||
fi
|
||||
mime_name=model-b3d.xml
|
||||
mime_path="$mime_name"
|
||||
if [ -f "$mime_path" ]; then
|
||||
cp -f "$mime_path" "$MIMETYPES_DB_PATH/"
|
||||
update-mime-database "$MIMETYPES_DB_PATH"
|
||||
else
|
||||
echo "ERROR: $mime_path must be in working directory in order to install it using this script!"
|
||||
exit 1
|
||||
fi
|
Loading…
Reference in New Issue