paint: add turntable.c template
This commit is contained in:
@@ -85,6 +85,7 @@ context_t *script_get_context();
|
||||
config_t *script_get_config();
|
||||
project_t *script_get_project();
|
||||
void script_set_stage(char *name);
|
||||
void script_show_envmap(bool b);
|
||||
void script_fade_to_stage(char *stage);
|
||||
void script_timer(f32 delay, void *fn);
|
||||
char *script_get_stage();
|
||||
@@ -1220,6 +1221,7 @@ void minic_register_builtins() {
|
||||
R(script_get_project, "p()");
|
||||
R(script_get_object, "p(p)");
|
||||
R(script_set_stage, "v(p)");
|
||||
R(script_show_envmap, "v(i)");
|
||||
R(script_fade_to_stage, "v(p)");
|
||||
R(script_timer, "v(f,p)");
|
||||
R(script_get_stage, "p()");
|
||||
|
||||
@@ -119,7 +119,7 @@ void tab_scripts_draw_edit() {
|
||||
ui_files_show("c", true, false, &tab_scripts_draw_export);
|
||||
}
|
||||
if (ui_menu_sub_button(ui_handle(__ID__), tr("Templates"))) {
|
||||
ui_menu_sub_begin(2);
|
||||
ui_menu_sub_begin(3);
|
||||
if (ui_menu_button("hello.c", "", ICON_DRAFT)) {
|
||||
tab_scripts_set("\
|
||||
void main() {\n\
|
||||
@@ -138,6 +138,23 @@ void on_update() {\n\
|
||||
void main() {\n\
|
||||
script_notify_on_update(on_update);\n\
|
||||
}\n\
|
||||
");
|
||||
}
|
||||
if (ui_menu_button("turntable.c", "", ICON_DRAFT)) {
|
||||
tab_scripts_set("\
|
||||
void on_update() {\n\
|
||||
mesh_object_t *o = context_main_object();\n\
|
||||
if (!mouse_down(\"right\")) {\n\
|
||||
transform_rotate(o->base->transform, vec4_z_axis(), 0.003);\n\
|
||||
}\n\
|
||||
context_t *c = script_get_context();\n\
|
||||
c->ddirty = 2;\n\
|
||||
}\n\
|
||||
void main() {\n\
|
||||
context_set_viewport_mode(1); // base\n\
|
||||
script_show_envmap(true);\n\
|
||||
script_notify_on_update(on_update);\n\
|
||||
}\n\
|
||||
");
|
||||
}
|
||||
ui_menu_sub_end();
|
||||
|
||||
@@ -15,6 +15,12 @@ void script_set_stage(char *name) {
|
||||
}
|
||||
}
|
||||
|
||||
void script_show_envmap(bool b) {
|
||||
g_context->show_envmap = b;
|
||||
context_load_envmap();
|
||||
g_context->ddirty = 2;
|
||||
}
|
||||
|
||||
char *script_get_stage() {
|
||||
stage_t *s = tab_stages_get_stage();
|
||||
return s != NULL ? s->name : NULL;
|
||||
|
||||
@@ -88,8 +88,14 @@ void util_shortcut_global() {
|
||||
box_preferences_show();
|
||||
}
|
||||
if (keyboard_started(any_map_get(g_keymap, "view_distract_free")) || (keyboard_started("escape") && !ui_base_show && !ui_box_show)) {
|
||||
bool allow = true;
|
||||
#ifdef IRON_WASM
|
||||
allow = g_config->workspace != WORKSPACE_PLAYER;
|
||||
#endif
|
||||
if (allow) {
|
||||
ui_base_toggle_distract_free();
|
||||
}
|
||||
}
|
||||
if (keyboard_started("f5") && g_config->workspace != WORKSPACE_PLAYER) {
|
||||
// g_config->workspace = WORKSPACE_PLAYER;
|
||||
// base_update_workspace();
|
||||
|
||||
Reference in New Issue
Block a user