minic: add script_get_material
This commit is contained in:
@@ -1231,6 +1231,7 @@ void minic_register_builtins() {
|
||||
R(script_get_config, "p:config_t()");
|
||||
R(script_get_project, "p:project_t()");
|
||||
R(script_get_object, "p:object_t(p:char s)");
|
||||
R(script_get_material, "p:slot_material_t(p:char s)");
|
||||
R(script_shape_add, "p:object_t(p:char name)");
|
||||
R(script_object_duplicate, "p:object_t(p:object_t o)");
|
||||
R(script_add_trait, "v(p:char object,p:char trait)");
|
||||
|
||||
@@ -164,6 +164,15 @@ object_t *script_get_object(char *s) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
slot_material_t *script_get_material(char *s) {
|
||||
for (int i = 0; i < g_project->_->materials->length; ++i) {
|
||||
if (string_equals(g_project->_->materials->buffer[i]->canvas->name, s)) {
|
||||
return g_project->_->materials->buffer[i];
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static bool script_paint_active = false;
|
||||
static bool script_paint_first = true;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user